同步设置

master
anthonyywj2 3 years ago
parent 8d3c080f34
commit f03891fd4a

@ -1,6 +1,7 @@
package com.glxp.sale.admin.controller.basic;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.db.sql.Order;
import com.glxp.sale.admin.constant.ConstantStatus;
import com.glxp.sale.admin.dao.basic.UdiInfoDao;
import com.glxp.sale.admin.entity.auth.AuthAdmin;
@ -8,6 +9,7 @@ import com.glxp.sale.admin.entity.basic.*;
import com.glxp.sale.admin.entity.info.CompanyProductRelevanceEntity;
import com.glxp.sale.admin.entity.inout.*;
import com.glxp.sale.admin.entity.inventory.InvWarehouseEntity;
import com.glxp.sale.admin.entity.param.SyncDataBustypeEntity;
import com.glxp.sale.admin.entity.receipt.ProductInfoEntity;
import com.glxp.sale.admin.entity.thrsys.*;
import com.glxp.sale.admin.req.auth.AuthAdminQueryRequest;
@ -270,8 +272,6 @@ public class SpsSyncDownloadService {
OrderService orderService;
@Resource
CodesService codesService;
@Resource
OrderDetailService orderDetailService;
public BaseResponse findOrder(SpsSyncDataRequest spsSyncDataRequest) {
@ -284,45 +284,74 @@ public class SpsSyncDownloadService {
if (syncDataSetEntity.isOrderUnReceive()) {
OrderFilterRequest orderFilterRequest = new OrderFilterRequest();
BeanUtils.copyProperties(spsSyncDataRequest, orderFilterRequest);
orderFilterRequest.setFilterActions(syncDataSetEntity.getBusTypes());
if (CollUtil.isNotEmpty(orderFilterRequest.getFilterActions())) {
orderFilterRequest.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS);
orderFilterRequest.setReceiveStatus(ConstantStatus.RECEIVE_UN);
List<OrderEntity> temps = orderService.findAllByTime(orderFilterRequest);
if (CollUtil.isNotEmpty(temps)) {
orderEntities.addAll(temps);
if (CollUtil.isNotEmpty(syncDataSetEntity.getBusTypes())) {
for (SyncDataBustypeEntity syncDataBustypeEntity : syncDataSetEntity.getBusTypes()) {
List<String> filterList = new ArrayList<>();
filterList.add(syncDataBustypeEntity.getAction());
orderFilterRequest.setFilterActions(filterList);
orderFilterRequest.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS);
orderFilterRequest.setReceiveStatus(ConstantStatus.RECEIVE_UN);
List<OrderEntity> temps = orderService.findAllByTime(orderFilterRequest);
if (CollUtil.isNotEmpty(temps)) {
for (OrderEntity orderEntity : temps) {
if (orderEntity.getFromType() != ConstantStatus.FROM_UDIWMS) {
orderEntity.setSyncOutChange(syncDataBustypeEntity.isOutChange());
orderEntities.add(orderEntity);
}
}
}
}
}
}
if (syncDataSetEntity.isOrderUnCheck()) {
OrderFilterRequest orderFilterRequest = new OrderFilterRequest();
BeanUtils.copyProperties(spsSyncDataRequest, orderFilterRequest);
orderFilterRequest.setFilterActions(syncDataSetEntity.getBusTypes());
if (CollUtil.isNotEmpty(orderFilterRequest.getFilterActions())) {
orderFilterRequest.setStatus(ConstantStatus.ORDER_STATUS_CHECK);
List<OrderEntity> temps = orderService.findAllByTime(orderFilterRequest);
if (CollUtil.isNotEmpty(temps)) {
orderEntities.addAll(temps);
if (CollUtil.isNotEmpty(syncDataSetEntity.getBusTypes())) {
for (SyncDataBustypeEntity syncDataBustypeEntity : syncDataSetEntity.getBusTypes()) {
List<String> filterList = new ArrayList<>();
filterList.add(syncDataBustypeEntity.getAction());
orderFilterRequest.setFilterActions(filterList);
orderFilterRequest.setStatus(ConstantStatus.ORDER_STATUS_CHECK);
List<OrderEntity> temps = orderService.findAllByTime(orderFilterRequest);
if (CollUtil.isNotEmpty(temps)) {
for (OrderEntity orderEntity : temps) {
if (orderEntity.getFromType() != ConstantStatus.FROM_UDIWMS) {
orderEntity.setSyncOutChange(syncDataBustypeEntity.isOutChange());
orderEntities.add(orderEntity);
}
}
}
}
}
}
if (syncDataSetEntity.isOrderScanFinish()) {
OrderFilterRequest orderFilterRequest = new OrderFilterRequest();
BeanUtils.copyProperties(spsSyncDataRequest, orderFilterRequest);
orderFilterRequest.setFilterActions(syncDataSetEntity.getBusTypes());
if (CollUtil.isNotEmpty(orderFilterRequest.getFilterActions())) {
orderFilterRequest.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS);
orderFilterRequest.setReceiveStatus(ConstantStatus.RECEIVE_ED);
List<OrderEntity> temps = orderService.findAllByTime(orderFilterRequest);
if (CollUtil.isNotEmpty(temps)) {
orderEntities.addAll(temps);
if (CollUtil.isNotEmpty(syncDataSetEntity.getBusTypes())) {
for (SyncDataBustypeEntity syncDataBustypeEntity : syncDataSetEntity.getBusTypes()) {
List<String> filterList = new ArrayList<>();
filterList.add(syncDataBustypeEntity.getAction());
orderFilterRequest.setFilterActions(filterList);
orderFilterRequest.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS);
orderFilterRequest.setReceiveStatus(ConstantStatus.RECEIVE_ED);
List<OrderEntity> temps = orderService.findAllByTime(orderFilterRequest);
if (CollUtil.isNotEmpty(temps)) {
for (OrderEntity orderEntity : temps) {
if (orderEntity.getFromType() != ConstantStatus.FROM_UDIWMS) {
orderEntity.setSyncOutChange(syncDataBustypeEntity.isOutChange());
orderEntities.add(orderEntity);
}
}
}
}
}
}

@ -501,7 +501,7 @@ public class WareHouseController {
}
if (checkSuccess) {
if (code.endsWith("\u001D")) {
code = code.replace("\u001D", "");
code = code.substring(0, code.length() - "\u001D".length());
}
return ResultVOUtils.success(code);
} else {
@ -864,6 +864,9 @@ public class WareHouseController {
if (!StrUtil.emptyIfNull(originUdiEntity.getExpireDate()).equals(StrUtil.emptyIfNull(udiEntity.getExpireDate()))) {
continue;
}
if (!StrUtil.emptyIfNull(originUdiEntity.getSerialNo()).equals(StrUtil.emptyIfNull(udiEntity.getSerialNo()))) {
continue;
}
return drugCodeSelectEntity;
}
return null;

@ -2,13 +2,16 @@ package com.glxp.sale.admin.controller.param;
import com.alibaba.fastjson.JSON;
import com.glxp.sale.admin.annotation.AuthRuleAnnotation;
import com.glxp.sale.admin.entity.param.SyncDataBustypeEntity;
import com.glxp.sale.admin.entity.param.SyncDataSetEntity;
import com.glxp.sale.admin.res.param.SyncDataSetResponse;
import com.glxp.sale.admin.service.param.SyncDataBustypeService;
import com.glxp.sale.admin.service.param.SyncDataSetService;
import com.glxp.sale.admin.util.BeanUtils;
import com.glxp.sale.common.enums.ResultEnum;
import com.glxp.sale.common.res.BaseResponse;
import com.glxp.sale.common.util.ResultVOUtils;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -16,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
@RestController
public class SyncDataSetController {
@ -23,6 +27,8 @@ public class SyncDataSetController {
@Resource
private SyncDataSetService syncDataSetService;
@Resource
private SyncDataBustypeService syncDataBustypeService;
@AuthRuleAnnotation("system/param/syncData/config")
@ -35,10 +41,12 @@ public class SyncDataSetController {
@PostMapping("/system/param/syncData/save")
public BaseResponse save(@RequestBody @Valid SyncDataSetResponse syncDataSetResponse
) {
SyncDataSetEntity syncDataSetEntity = new SyncDataSetEntity();
BeanUtils.copyProperties(syncDataSetResponse, syncDataSetEntity);
syncDataSetEntity.setBusTypes(JSON.toJSONString(syncDataSetResponse.getBusTypes()));
List<SyncDataBustypeEntity> busTypes = syncDataSetResponse.getBusTypes();
syncDataBustypeService.deleteAll();
syncDataBustypeService.inserts(busTypes);
syncDataSetEntity.setBusTypes(null);
boolean b = syncDataSetService.insert(syncDataSetEntity);
if (!b) {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);

@ -0,0 +1,18 @@
package com.glxp.sale.admin.dao.param;
import com.glxp.sale.admin.entity.param.SyncDataBustypeEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface SyncDataBustypeDao {
List<SyncDataBustypeEntity> findAll();
boolean deleteAll();
void inserts(@Param("syncDataBustypeEntities") List<SyncDataBustypeEntity> syncDataBustypeEntities);
}

@ -54,4 +54,7 @@ public class OrderEntity {
//复制单号,多个单号之间使用英文逗号,分隔
private String replicateNo;
private boolean syncOutChange;//同步后是否可以缺量补单
}

@ -0,0 +1,14 @@
package com.glxp.sale.admin.entity.param;
import lombok.Data;
@Data
public class SyncDataBustypeEntity {
private Integer id;
private String action;
private String name;
private boolean outChange;
}

@ -1,5 +1,6 @@
package com.glxp.sale.admin.res.param;
import com.glxp.sale.admin.entity.param.SyncDataBustypeEntity;
import lombok.Data;
import java.util.List;
@ -23,7 +24,7 @@ public class SyncDataSetResponse {
private boolean orderUnReceive;
private boolean orderUnCheck;
private boolean sysUser;
private List<String> busTypes;
private List<SyncDataBustypeEntity> busTypes;
private Integer syncTime;
private Integer orderSyncTime;

@ -107,7 +107,7 @@ public class InvPreInProductDetailServiceImpl implements InvPreInProductDetailSe
List<InvProductDetailEntity> datas = invPreInProductDetailDao.filterInvProductDetail(filterInvProductDetailRequest);
if (CollUtil.isEmpty(datas)) {
filterInvProductDetailRequest.setOriginCode(null);
UdiEntity udiEntity = FilterUdiUtils.getGS1Udi(code);
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
if (StrUtil.isNotEmpty(udiEntity.getBatchNo()))
filterInvProductDetailRequest.setBatchNo(udiEntity.getBatchNo());
else

@ -106,7 +106,7 @@ public class InvPreProductDetailServiceImpl implements InvPreProductDetailServic
List<InvProductDetailEntity> datas = invPreProductDetailDao.filterInvProductDetail(filterInvProductDetailRequest);
if (CollUtil.isEmpty(datas)) {
filterInvProductDetailRequest.setOriginCode(null);
UdiEntity udiEntity = FilterUdiUtils.getGS1Udi(code);
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
if (StrUtil.isNotEmpty(udiEntity.getBatchNo()))
filterInvProductDetailRequest.setBatchNo(udiEntity.getBatchNo());
else

@ -111,7 +111,7 @@ public class InvProductDetailServiceImpl implements InvProductDetailService {
List<InvProductDetailEntity> datas = invProductDetailDao.filterInvProductDetail(filterInvProductDetailRequest);
if (CollUtil.isEmpty(datas)) {
filterInvProductDetailRequest.setOriginCode(null);
UdiEntity udiEntity = FilterUdiUtils.getGS1Udi(code);
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
if (StrUtil.isNotEmpty(udiEntity.getBatchNo()))
filterInvProductDetailRequest.setBatchNo(udiEntity.getBatchNo());
else

@ -0,0 +1,17 @@
package com.glxp.sale.admin.service.param;
import com.glxp.sale.admin.entity.param.SyncDataBustypeEntity;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface SyncDataBustypeService {
List<SyncDataBustypeEntity> findAll();
boolean deleteAll();
void inserts(List<SyncDataBustypeEntity> syncDataBustypeEntities);
}

@ -0,0 +1,31 @@
package com.glxp.sale.admin.service.param.impl;
import com.glxp.sale.admin.dao.param.SyncDataBustypeDao;
import com.glxp.sale.admin.entity.param.SyncDataBustypeEntity;
import com.glxp.sale.admin.service.param.SyncDataBustypeService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class SyncDataBustypeServiceImpl implements SyncDataBustypeService {
@Resource
SyncDataBustypeDao syncDataBustypeDao;
@Override
public List<SyncDataBustypeEntity> findAll() {
return syncDataBustypeDao.findAll();
}
@Override
public boolean deleteAll() {
return syncDataBustypeDao.deleteAll();
}
@Override
public void inserts(List<SyncDataBustypeEntity> syncDataBustypeEntities) {
syncDataBustypeDao.inserts(syncDataBustypeEntities);
}
}

@ -1,16 +1,15 @@
package com.glxp.sale.admin.service.param.impl;
import com.alibaba.fastjson.JSON;
import com.glxp.sale.admin.dao.param.SyncDataSetDao;
import com.glxp.sale.admin.entity.param.SyncDataBustypeEntity;
import com.glxp.sale.admin.entity.param.SyncDataSetEntity;
import com.glxp.sale.admin.res.param.SyncDataSetResponse;
import com.glxp.sale.admin.service.param.SyncDataBustypeService;
import com.glxp.sale.admin.service.param.SyncDataSetService;
import com.glxp.sale.admin.util.BeanUtils;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.lang.reflect.Type;
import java.util.List;
@Service
@ -18,6 +17,8 @@ public class SyncDataSetServiceImpl implements SyncDataSetService {
@Resource
SyncDataSetDao syncDataSetDao;
@Resource
SyncDataBustypeService syncDataBustypeService;
@Override
public SyncDataSetEntity findSet() {
@ -27,14 +28,11 @@ public class SyncDataSetServiceImpl implements SyncDataSetService {
@Override
public SyncDataSetResponse selectSet() {
SyncDataSetEntity syncDataSetEntity = syncDataSetDao.selectSet();
SyncDataSetResponse syncDataSetResponse = new SyncDataSetResponse();
BeanUtils.copyProperties(syncDataSetEntity, syncDataSetResponse);
List<String> busTypes = JSON.parseArray(syncDataSetEntity.getBusTypes(), String.class);
syncDataSetResponse.setBusTypes(busTypes);
List<SyncDataBustypeEntity> syncDataBustypeEntities = syncDataBustypeService.findAll();
syncDataSetResponse.setBusTypes(syncDataBustypeEntities);
return syncDataSetResponse;
}

@ -61,7 +61,7 @@ public class AsyncHeartTask implements SchedulingConfigurer {
SyncDataSetResponse syncDataSetEntity = syncDataSetService.selectSet();
if (syncDataSetEntity.isDownstreamEnable()) {
//定时同步最近更新数据至任务表,等待下载
//定时同步基础数据最近更新数据至任务表,等待下载
if (syncDataSetEntity.getSyncTime() != null) {
long timeInterval = syncDataSetEntity.getSyncTime() * 60 * 1000;
long curTime = System.currentTimeMillis();
@ -76,6 +76,21 @@ public class AsyncHeartTask implements SchedulingConfigurer {
redisUtil.set("SPS_SYNC_GEN_DATA", curTime);
}
}
//定时同步单据最近更新数据至任务表,等待下载
if (syncDataSetEntity.getOrderSyncTime() != null) {
long timeInterval = syncDataSetEntity.getOrderSyncTime() * 60 * 1000;
long curTime = System.currentTimeMillis();
Long lastTime = (Long) redisUtil.get("SPS_ORDER_SYNC_GEN_DATA");
if (lastTime == null) {
lastTime = System.currentTimeMillis();
redisUtil.set("SPS_ORDER_SYNC_GEN_DATA", lastTime);
}
if (curTime - lastTime > timeInterval) {
backUpdateProductService.syncOrderUpdateTime();
redisUtil.set("SPS_ORDER_SYNC_GEN_DATA", curTime);
}
}
}
}

@ -21,6 +21,8 @@ import com.glxp.sale.admin.util.DateUtil;
import com.glxp.sale.admin.util.GennerOrderUtils;
import com.glxp.sale.admin.util.RedisUtil;
import com.glxp.sale.common.res.BaseResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@ -51,6 +53,9 @@ public class BasicBackUpdateProductService {
@Resource
GennerOrderUtils gennerOrderUtils;
final Logger logger = LoggerFactory.getLogger(BasicBackUpdateProductService.class);
//定时或一键下载更新全部线上产品信息
@Async
public void addAllProducts(FilterErpGoodsRequest filterErpGoodsRequest, String productUrl, String onHandUrl, String thirdSysId, Boolean isEnable) {
@ -255,7 +260,9 @@ public class BasicBackUpdateProductService {
@Resource
SpsSyncDownloadService spsSyncDownloadService;
public void syncUpdatetTime() {
public void syncOrderUpdateTime() {
logger.info("创建单据同步任务");
//自动创建要求被下载已完成单据任务
BasicExportStatusEntity basicExportStatusEntity1 = basicExportService.findByData(ConstantStatus.SYNC_SCAN_ORDER, 0);
if (basicExportStatusEntity1 == null) {
@ -273,7 +280,10 @@ public class BasicBackUpdateProductService {
basicExportService.insertExportStatus(orderStatusEntity);
}
}
}
public void syncUpdatetTime() {
logger.info("创建基础数据同步任务");
//自动创建要求被下载单据类型任务
BasicExportStatusEntity basicExportStatusEntity2 = basicExportService.findByData(ConstantStatus.SYNC_BUS_TYPE, 0);

@ -498,7 +498,7 @@ public class IoTransInoutService {
public String checkOriginCode(WarehouseEntity warehouseEntity, BussinessTypeEntity bussinessTypeEntity) {
UdiEntity udiEntity = FilterUdiUtils.getGS1Udi(warehouseEntity.getCode());
UdiEntity udiEntity = FilterUdiUtils.getUdi(warehouseEntity.getCode());
//校验条码的完整性
String errMsg = "";
UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectByNameCode(udiEntity.getUdi());

@ -36,8 +36,8 @@ logging.file=D:/glxpdata/udiwms/udiwms.log
file_path=D:/glxpdata/udiwms
#UDI\u6570\u636E\u4E0B\u8F7D
UDI_KEY=6b137c66-6286-46c6-8efa-c2f5dd9237df
UDI_SERVER_URL=https://www.udims.com/UDI_DL_Server_test
#UDI_SERVER_URL=http://127.0.0.1:9994
#UDI_SERVER_URL=https://www.udims.com/UDI_DL_Server_test
UDI_SERVER_URL=http://127.0.0.1:9994
#UDI_SERVER_URL=https://www.udims.com/UDI_DL_Server
#UCLOD\u670D\u52A1
#UCLOD_SERVER_URL=http://127.0.0.1:9997

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.glxp.sale.admin.dao.param.SyncDataBustypeDao">
<select id="findAll"
resultType="com.glxp.sale.admin.entity.param.SyncDataBustypeEntity">
SELECT *
FROM sync_data_bustypes
</select>
<delete id="deleteAll">
DELETE
FROM sync_data_bustypes
</delete>
<insert id="inserts" parameterType="com.glxp.sale.admin.entity.param.SyncDataBustypeEntity">
insert INTO sync_data_bustypes
( `action`, `name`, outChange)
values
<foreach collection="syncDataBustypeEntities" item="item" index="index"
separator=",">
(
#{item.action}, #{item.name},
#{item.outChange})
</foreach>
</insert>
</mapper>
Loading…
Cancel
Save