diff --git a/api-admin/src/main/java/com/glxp/api/admin/controller/inout/utils/InoutUtils.java b/api-admin/src/main/java/com/glxp/api/admin/controller/inout/utils/InoutUtils.java index 7d910182..a3b32414 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/controller/inout/utils/InoutUtils.java +++ b/api-admin/src/main/java/com/glxp/api/admin/controller/inout/utils/InoutUtils.java @@ -50,9 +50,9 @@ public class InoutUtils { } - public UdiInfoEntity getUdiInfo(UdiInfoService udiInfoService, UdiRelevanceService udiRelevanceService, String code, UdiDlHttpClient udiDlHttpClient) { + public UdiInfoEntity getUdiInfo(UdiInfoService udiInfoService, UdiRelevanceService udiRelevanceService, WarehouseEntity warehouseEntity, UdiDlHttpClient udiDlHttpClient) { String prefix; - prefix = FilterUdiUtils.getDiStr(code); + prefix = FilterUdiUtils.getDiStr(warehouseEntity.getCode()); UdiInfoEntity udiInfoEntity = udiInfoService.findByNameCode(prefix); if (udiInfoEntity == null) { List froms = udiDlHttpClient.getUdiByDi(prefix); @@ -73,15 +73,19 @@ public class InoutUtils { } } - udiInfoEntity.setCode(code); - udiInfoEntity = FilterUdiUtils.transUdi(udiInfoEntity); + udiInfoEntity.setCode(warehouseEntity.getCode()); + udiInfoEntity.setBatchNo(warehouseEntity.getBatchNo()); + udiInfoEntity.setProduceDate(warehouseEntity.getProduceDate()); + udiInfoEntity.setExpireDate(warehouseEntity.getExpireDate()); + udiInfoEntity.setSerialNo(warehouseEntity.getSerialNo()); + udiInfoEntity.setUdi(warehouseEntity.getNameCode()); return udiInfoEntity; } - public UdiInfoEntity getUdiInfoByRlId(UdiInfoService udiInfoService, UdiRelevanceService udiRelevanceService, String code) { + public UdiInfoEntity getUdiInfoByRlId(UdiInfoService udiInfoService, UdiRelevanceService udiRelevanceService, WarehouseEntity warehouseEntity) { String prefix; - prefix = FilterUdiUtils.getDiStr(code); + prefix = FilterUdiUtils.getDiStr(warehouseEntity.getCode()); UdiInfoEntity udiInfoEntity = new UdiInfoEntity(); UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectByNameCode(prefix); @@ -91,16 +95,21 @@ public class InoutUtils { udiRelevanceResponse = udiRelevanceResponses.get(0); } if (udiRelevanceResponse == null) { - udiInfoEntity = getUdiInfo(udiInfoService, udiRelevanceService, code, udiDlHttpClient); + udiInfoEntity = getUdiInfo(udiInfoService, udiRelevanceService, warehouseEntity, udiDlHttpClient); } else { BeanUtils.copyProperties(udiRelevanceResponse, udiInfoEntity); udiInfoEntity.setRelId(udiRelevanceResponse.getId() + ""); - udiInfoEntity.setCode(code); - udiInfoEntity = FilterUdiUtils.transUdi(udiInfoEntity); + udiInfoEntity.setCode(warehouseEntity.getCode()); +// udiInfoEntity = FilterUdiUtils.transUdi(udiInfoEntity); udiInfoEntity.setNameCode(udiRelevanceResponse.getNameCode()); + udiInfoEntity.setCode(warehouseEntity.getCode()); + udiInfoEntity.setBatchNo(warehouseEntity.getBatchNo()); + udiInfoEntity.setProduceDate(warehouseEntity.getProduceDate()); + udiInfoEntity.setExpireDate(warehouseEntity.getExpireDate()); + udiInfoEntity.setSerialNo(warehouseEntity.getSerialNo()); + udiInfoEntity.setUdi(warehouseEntity.getNameCode()); } - - udiInfoEntity.setCode(code); + udiInfoEntity.setCode(warehouseEntity.getCode()); return udiInfoEntity; @@ -114,7 +123,7 @@ public class InoutUtils { List udiInfoEntities = new ArrayList<>(); for (WarehouseEntity warehouseEntity : warehouseEntityList) { UdiInfoEntity udiInfoEntity = null; - udiInfoEntity = getUdiInfoByRlId(udiInfoService, udiRelevanceService, warehouseEntity.getCode()); + udiInfoEntity = getUdiInfoByRlId(udiInfoService, udiRelevanceService, warehouseEntity); if (udiInfoEntity != null) { udiInfoEntity.setCount(getActCount(warehouseEntity, udiRelevanceService) * warehouseEntity.getCount()); udiInfoEntity.setRelId(warehouseEntity.getRelId()); diff --git a/api-admin/src/main/java/com/glxp/api/admin/service/inventory/impl/InvProductServiceImpl.java b/api-admin/src/main/java/com/glxp/api/admin/service/inventory/impl/InvProductServiceImpl.java index 7c0abe72..0cd71e32 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/service/inventory/impl/InvProductServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/api/admin/service/inventory/impl/InvProductServiceImpl.java @@ -48,17 +48,6 @@ public class InvProductServiceImpl implements InvProductService { @Override public InvProductEntity selectByUuid(String uuid, String batchNo, String supId, String invStorageCode, String invWarehouseCode) { -// FilterInvProductRequest filterInvProductRequest = new FilterInvProductRequest(); -// filterInvProductRequest.setRelIdFk(uuid); -// filterInvProductRequest.setBatchNo(batchNo); -// filterInvProductRequest.setSupId(supId); -// filterInvProductRequest.setInvWarehouseCode(invWarehouseCode); -// filterInvProductRequest.setInvStorageCode(invStorageCode); -// List data = filterInvProduct(filterInvProductRequest); -// if (data != null && data.size() > 0) { -// return data.get(0); -// } -// return null; if (StrUtil.isEmpty(batchNo)) { batchNo = "empty"; } diff --git a/api-admin/src/main/java/com/glxp/api/admin/thread/DlBasicService.java b/api-admin/src/main/java/com/glxp/api/admin/thread/DlBasicService.java index df8d15c6..33f2908e 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/thread/DlBasicService.java +++ b/api-admin/src/main/java/com/glxp/api/admin/thread/DlBasicService.java @@ -346,8 +346,27 @@ public class DlBasicService { orderEntity.setErpFk(null); orderEntity.setOutChangeEnable(false); orderEntity.setStatus(ConstantStatus.ORDER_STATUS_PROCESS); - orderService.deleteByOrderId(orderEntity.getId()); - mapper.importOrder(orderEntity); + + OrderEntity temp = orderService.findById(orderEntity.getId()); + if(temp == null){ + mapper.importOrder(orderEntity); + + if (CollUtil.isNotEmpty(syncDataResponse.getWarehouseEntityList())) { + try { + CodesTempDao codeMappert = batchSession.getMapper(CodesTempDao.class); + List warehouseEntityList = syncDataResponse.getWarehouseEntityList(); + for (WarehouseEntity warehouseEntity:warehouseEntityList){ + if(warehouseEntity.getOrderId().equals(orderEntity.getId())){ + codeMappert.replaceCodesTempSingle(warehouseEntity); + } + } + batchSession.commit(); + } catch (Exception e) { + } + } + + } + } batchSession.commit(); } catch (Exception e) { @@ -364,17 +383,7 @@ public class DlBasicService { // } catch (Exception e) { // } // } - if (CollUtil.isNotEmpty(syncDataResponse.getWarehouseEntityList())) { - try { - List warehouseEntityList = syncDataResponse.getWarehouseEntityList(); - CodesTempDao mapper = batchSession.getMapper(CodesTempDao.class); - for (WarehouseEntity warehouseEntity : warehouseEntityList) { - mapper.replaceCodesTempSingle(warehouseEntity); - } - batchSession.commit(); - } catch (Exception e) { - } - } + batchSession.close(); spGetHttp.postBasicStatus(basicExportStatusEntity.getId()); } diff --git a/api-admin/src/main/java/com/glxp/api/admin/thread/UpBasicService.java b/api-admin/src/main/java/com/glxp/api/admin/thread/UpBasicService.java index 98668ddf..de765cc1 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/thread/UpBasicService.java +++ b/api-admin/src/main/java/com/glxp/api/admin/thread/UpBasicService.java @@ -104,6 +104,14 @@ public class UpBasicService { syncDataResponse.setUdiInfoEntities(udiInfoEntities); syncDataResponse.setUdiRelevanceEntities(udiRelevanceEntities); + + + + //供应商产品信息关联表 + FilterCompanyProductRelevanceRequest filterCompanyProductRelevanceRequest = new FilterCompanyProductRelevanceRequest(); + BeanUtils.copyProperties(spsSyncDataRequest, filterCompanyProductRelevanceRequest); + List companyProductRelevanceEntities = companyProductRelevanceService.filterCompanyProductRelevance(filterCompanyProductRelevanceRequest); + syncDataResponse.setCompanyProductRelevanceEntities(companyProductRelevanceEntities); } //往来单位字典 @@ -157,12 +165,7 @@ public class UpBasicService { syncDataResponse.setThrOrderEntities(thrOrderEntities); } - //供应商产品信息关联表 - FilterCompanyProductRelevanceRequest filterCompanyProductRelevanceRequest = new FilterCompanyProductRelevanceRequest(); - BeanUtils.copyProperties(spsSyncDataRequest, filterCompanyProductRelevanceRequest); - List companyProductRelevanceEntities = companyProductRelevanceService.filterCompanyProductRelevance(filterCompanyProductRelevanceRequest); - syncDataResponse.setCompanyProductRelevanceEntities(companyProductRelevanceEntities); return syncDataResponse; } @@ -279,10 +282,6 @@ public class UpBasicService { List warehouseEntityList = new ArrayList<>(); if (CollUtil.isNotEmpty(orderEntities)) { for (OrderEntity orderEntity : orderEntities) { -// List orderDetailEntityList = orderDetailService.filterAllByOrderIdFk(orderEntity.getId()); -// if (CollUtil.isNotEmpty(orderDetailEntityList)) { -// allOrderDetailEntityList.addAll(orderDetailEntityList); -// } List codes = codesService.findByReceiptId(orderEntity.getId()); if (CollUtil.isNotEmpty(codes)) { warehouseEntityList.addAll(codes); diff --git a/api-admin/src/main/resources/mybatis/mapper/inout/CodesTempDao.xml b/api-admin/src/main/resources/mybatis/mapper/inout/CodesTempDao.xml index 255dbcc3..e57569b5 100644 --- a/api-admin/src/main/resources/mybatis/mapper/inout/CodesTempDao.xml +++ b/api-admin/src/main/resources/mybatis/mapper/inout/CodesTempDao.xml @@ -63,12 +63,12 @@ - replace - INTO io_codes_temp(id,`action`, mainAction, code, corpOrderId, actor, actDate, + insert + ignore + INTO io_codes_temp(`action`, mainAction, code, corpOrderId, actor, actDate, fromCorpId, fromCorp, orderId, batchNo, produceDate, expireDate, serialNo, `count`, nameCode, supId, invStorageCode, invWarehouseCode, locStorageCode, relId) values ( - #{id}, #{action}, #{mainAction}, #{code}, diff --git a/api-admin/src/main/resources/mybatis/mapper/inout/OrderDao.xml b/api-admin/src/main/resources/mybatis/mapper/inout/OrderDao.xml index d0c6acee..8ed4af97 100644 --- a/api-admin/src/main/resources/mybatis/mapper/inout/OrderDao.xml +++ b/api-admin/src/main/resources/mybatis/mapper/inout/OrderDao.xml @@ -33,7 +33,7 @@ fromCorp, status, remark, exportStatus, fromType, contrastStatus, signStatus, receiveStatus, erpFk, stockCheckFk, supId, exportFilePath, locStorageCode, supplementNo, ullageSupNo, createUser, reviewUser, - outChangeEnable, originUllageSupNo,preCheck,thirdBillNo) + outChangeEnable, originUllageSupNo, preCheck, thirdBillNo) values (#{id}, #{action}, #{corpOrderId}, @@ -52,11 +52,13 @@ #{erpFk}, #{stockCheckFk}, #{supId}, #{exportFilePath}, #{locStorageCode}, #{supplementNo} - , #{ullageSupNo}, #{createUser}, #{reviewUser}, #{outChangeEnable}, #{originUllageSupNo},#{preCheck},#{thirdBillNo}) + , #{ullageSupNo}, #{createUser}, #{reviewUser}, #{outChangeEnable}, #{originUllageSupNo}, + #{preCheck}, #{thirdBillNo}) - replace + insert + ignore INTO io_order(id, action, corpOrderId, actDate, fromCorpId, actor, mainAction, fromCorp, status, remark, exportStatus, fromType, contrastStatus, signStatus, receiveStatus, erpFk, stockCheckFk, supId, @@ -88,7 +90,9 @@ #{createUser}, #{reviewUser}, #{outChangeEnable}, - #{originUllageSupNo},#{preCheck},#{thirdBillNo} + #{originUllageSupNo}, + #{preCheck}, + #{thirdBillNo} ) @@ -237,7 +241,8 @@ and reviewUser =#{reviewUser} - and ((createUser =#{unionUser} or reviewUser =#{unionUser}) or (reviewUser is null and createUser is null) ) + and ((createUser =#{unionUser} or reviewUser =#{unionUser}) or (reviewUser is null and createUser is + null) ) and ullageSupNo =#{ullageSupNo} @@ -502,7 +507,8 @@ and receiveStatus = #{receiveStatus} - and = DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S') ]]> + and + = DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S') ]]> and `action` in @@ -549,8 +555,8 @@ update io_order - set actDate = #{actDate}, - auditTime = #{auditTime}, + set actDate = #{actDate}, + auditTime = #{auditTime}, updateTime = #{updateTime} where id in