From f03891fd4a208950c220c2d0a4548a84e5fd17dc Mon Sep 17 00:00:00 2001 From: anthonyywj2 <353682448@qq.com> Date: Thu, 16 Jun 2022 09:22:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic/SpsSyncDownloadService.java | 77 +++++++++++++------ .../controller/inout/WareHouseController.java | 5 +- .../param/SyncDataSetController.java | 12 ++- .../admin/dao/param/SyncDataBustypeDao.java | 18 +++++ .../sale/admin/entity/inout/OrderEntity.java | 3 + .../entity/param/SyncDataBustypeEntity.java | 14 ++++ .../admin/res/param/SyncDataSetResponse.java | 3 +- .../InvPreInProductDetailServiceImpl.java | 2 +- .../impl/InvPreProductDetailServiceImpl.java | 2 +- .../impl/InvProductDetailServiceImpl.java | 2 +- .../service/param/SyncDataBustypeService.java | 17 ++++ .../impl/SyncDataBustypeServiceImpl.java | 31 ++++++++ .../param/impl/SyncDataSetServiceImpl.java | 14 ++-- .../sale/admin/thread/AsyncHeartTask.java | 17 +++- .../thread/BasicBackUpdateProductService.java | 12 ++- .../admin/thread/IoTransInoutService.java | 2 +- .../main/resources/application-pro.properties | 4 +- .../mapper/param/SyncDataBustypeDao.xml | 33 ++++++++ 18 files changed, 224 insertions(+), 44 deletions(-) create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/dao/param/SyncDataBustypeDao.java create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/entity/param/SyncDataBustypeEntity.java create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/service/param/SyncDataBustypeService.java create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/service/param/impl/SyncDataBustypeServiceImpl.java create mode 100644 api-admin/src/main/resources/mybatis/mapper/param/SyncDataBustypeDao.xml diff --git a/api-admin/src/main/java/com/glxp/sale/admin/controller/basic/SpsSyncDownloadService.java b/api-admin/src/main/java/com/glxp/sale/admin/controller/basic/SpsSyncDownloadService.java index 04add0f..998346b 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/controller/basic/SpsSyncDownloadService.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/controller/basic/SpsSyncDownloadService.java @@ -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 temps = orderService.findAllByTime(orderFilterRequest); - if (CollUtil.isNotEmpty(temps)) { - orderEntities.addAll(temps); + if (CollUtil.isNotEmpty(syncDataSetEntity.getBusTypes())) { + for (SyncDataBustypeEntity syncDataBustypeEntity : syncDataSetEntity.getBusTypes()) { + List filterList = new ArrayList<>(); + filterList.add(syncDataBustypeEntity.getAction()); + orderFilterRequest.setFilterActions(filterList); + orderFilterRequest.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS); + orderFilterRequest.setReceiveStatus(ConstantStatus.RECEIVE_UN); + List 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 temps = orderService.findAllByTime(orderFilterRequest); - if (CollUtil.isNotEmpty(temps)) { - orderEntities.addAll(temps); + + if (CollUtil.isNotEmpty(syncDataSetEntity.getBusTypes())) { + for (SyncDataBustypeEntity syncDataBustypeEntity : syncDataSetEntity.getBusTypes()) { + List filterList = new ArrayList<>(); + filterList.add(syncDataBustypeEntity.getAction()); + orderFilterRequest.setFilterActions(filterList); + orderFilterRequest.setStatus(ConstantStatus.ORDER_STATUS_CHECK); + List 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 temps = orderService.findAllByTime(orderFilterRequest); - if (CollUtil.isNotEmpty(temps)) { - orderEntities.addAll(temps); + + if (CollUtil.isNotEmpty(syncDataSetEntity.getBusTypes())) { + for (SyncDataBustypeEntity syncDataBustypeEntity : syncDataSetEntity.getBusTypes()) { + List filterList = new ArrayList<>(); + filterList.add(syncDataBustypeEntity.getAction()); + orderFilterRequest.setFilterActions(filterList); + orderFilterRequest.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS); + orderFilterRequest.setReceiveStatus(ConstantStatus.RECEIVE_ED); + List 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); + } + } + } } } - } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/WareHouseController.java b/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/WareHouseController.java index 9c530c3..1e6e2d8 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/WareHouseController.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/WareHouseController.java @@ -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; diff --git a/api-admin/src/main/java/com/glxp/sale/admin/controller/param/SyncDataSetController.java b/api-admin/src/main/java/com/glxp/sale/admin/controller/param/SyncDataSetController.java index cf2beca..167df73 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/controller/param/SyncDataSetController.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/controller/param/SyncDataSetController.java @@ -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 busTypes = syncDataSetResponse.getBusTypes(); + syncDataBustypeService.deleteAll(); + syncDataBustypeService.inserts(busTypes); + syncDataSetEntity.setBusTypes(null); boolean b = syncDataSetService.insert(syncDataSetEntity); if (!b) { return ResultVOUtils.error(ResultEnum.NOT_NETWORK); diff --git a/api-admin/src/main/java/com/glxp/sale/admin/dao/param/SyncDataBustypeDao.java b/api-admin/src/main/java/com/glxp/sale/admin/dao/param/SyncDataBustypeDao.java new file mode 100644 index 0000000..8003ca8 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/dao/param/SyncDataBustypeDao.java @@ -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 findAll(); + + boolean deleteAll(); + + void inserts(@Param("syncDataBustypeEntities") List syncDataBustypeEntities); + +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/OrderEntity.java b/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/OrderEntity.java index 594b4de..8394fdf 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/OrderEntity.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/entity/inout/OrderEntity.java @@ -54,4 +54,7 @@ public class OrderEntity { //复制单号,多个单号之间使用英文逗号,分隔 private String replicateNo; + + private boolean syncOutChange;//同步后是否可以缺量补单 + } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/entity/param/SyncDataBustypeEntity.java b/api-admin/src/main/java/com/glxp/sale/admin/entity/param/SyncDataBustypeEntity.java new file mode 100644 index 0000000..2c3b8ec --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/entity/param/SyncDataBustypeEntity.java @@ -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; + +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/res/param/SyncDataSetResponse.java b/api-admin/src/main/java/com/glxp/sale/admin/res/param/SyncDataSetResponse.java index 86b909b..3dba040 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/res/param/SyncDataSetResponse.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/res/param/SyncDataSetResponse.java @@ -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 busTypes; + private List busTypes; private Integer syncTime; private Integer orderSyncTime; diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/inventory/impl/InvPreInProductDetailServiceImpl.java b/api-admin/src/main/java/com/glxp/sale/admin/service/inventory/impl/InvPreInProductDetailServiceImpl.java index 370b4d1..28802c9 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/service/inventory/impl/InvPreInProductDetailServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/inventory/impl/InvPreInProductDetailServiceImpl.java @@ -107,7 +107,7 @@ public class InvPreInProductDetailServiceImpl implements InvPreInProductDetailSe List 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 diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/inventory/impl/InvPreProductDetailServiceImpl.java b/api-admin/src/main/java/com/glxp/sale/admin/service/inventory/impl/InvPreProductDetailServiceImpl.java index d393e1f..eba4ab0 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/service/inventory/impl/InvPreProductDetailServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/inventory/impl/InvPreProductDetailServiceImpl.java @@ -106,7 +106,7 @@ public class InvPreProductDetailServiceImpl implements InvPreProductDetailServic List 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 diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/inventory/impl/InvProductDetailServiceImpl.java b/api-admin/src/main/java/com/glxp/sale/admin/service/inventory/impl/InvProductDetailServiceImpl.java index 8f24aad..62917e3 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/service/inventory/impl/InvProductDetailServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/inventory/impl/InvProductDetailServiceImpl.java @@ -111,7 +111,7 @@ public class InvProductDetailServiceImpl implements InvProductDetailService { List 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 diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/param/SyncDataBustypeService.java b/api-admin/src/main/java/com/glxp/sale/admin/service/param/SyncDataBustypeService.java new file mode 100644 index 0000000..1fa2553 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/param/SyncDataBustypeService.java @@ -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 findAll(); + + boolean deleteAll(); + + void inserts(List syncDataBustypeEntities); + +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/param/impl/SyncDataBustypeServiceImpl.java b/api-admin/src/main/java/com/glxp/sale/admin/service/param/impl/SyncDataBustypeServiceImpl.java new file mode 100644 index 0000000..742c6d3 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/param/impl/SyncDataBustypeServiceImpl.java @@ -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 findAll() { + return syncDataBustypeDao.findAll(); + } + + @Override + public boolean deleteAll() { + return syncDataBustypeDao.deleteAll(); + } + + @Override + public void inserts(List syncDataBustypeEntities) { + syncDataBustypeDao.inserts(syncDataBustypeEntities); + } +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/param/impl/SyncDataSetServiceImpl.java b/api-admin/src/main/java/com/glxp/sale/admin/service/param/impl/SyncDataSetServiceImpl.java index 60537bc..57e6368 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/service/param/impl/SyncDataSetServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/param/impl/SyncDataSetServiceImpl.java @@ -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 busTypes = JSON.parseArray(syncDataSetEntity.getBusTypes(), String.class); - syncDataSetResponse.setBusTypes(busTypes); - - + List syncDataBustypeEntities = syncDataBustypeService.findAll(); + syncDataSetResponse.setBusTypes(syncDataBustypeEntities); return syncDataSetResponse; } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/thread/AsyncHeartTask.java b/api-admin/src/main/java/com/glxp/sale/admin/thread/AsyncHeartTask.java index e5c7d9b..d430b61 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/thread/AsyncHeartTask.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/thread/AsyncHeartTask.java @@ -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); + } + } } } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/thread/BasicBackUpdateProductService.java b/api-admin/src/main/java/com/glxp/sale/admin/thread/BasicBackUpdateProductService.java index 2ca8f14..299ff8f 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/thread/BasicBackUpdateProductService.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/thread/BasicBackUpdateProductService.java @@ -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); diff --git a/api-admin/src/main/java/com/glxp/sale/admin/thread/IoTransInoutService.java b/api-admin/src/main/java/com/glxp/sale/admin/thread/IoTransInoutService.java index fa9ffd2..f5268ae 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/thread/IoTransInoutService.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/thread/IoTransInoutService.java @@ -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()); diff --git a/api-admin/src/main/resources/application-pro.properties b/api-admin/src/main/resources/application-pro.properties index 2ff29cf..3f2c370 100644 --- a/api-admin/src/main/resources/application-pro.properties +++ b/api-admin/src/main/resources/application-pro.properties @@ -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 diff --git a/api-admin/src/main/resources/mybatis/mapper/param/SyncDataBustypeDao.xml b/api-admin/src/main/resources/mybatis/mapper/param/SyncDataBustypeDao.xml new file mode 100644 index 0000000..bbae816 --- /dev/null +++ b/api-admin/src/main/resources/mybatis/mapper/param/SyncDataBustypeDao.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + DELETE + FROM sync_data_bustypes + + + + insert INTO sync_data_bustypes + ( `action`, `name`, outChange) + values + + + ( + #{item.action}, #{item.name}, + #{item.outChange}) + + + + + \ No newline at end of file