diff --git a/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java b/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java index 3444d3e7b..e7cf6c1ef 100644 --- a/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java +++ b/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java @@ -473,7 +473,7 @@ public class IoAddInoutService { for (IoOrderDetailCodeEntity orderDetailCodeEntity : ioOrderDetailCodeEntities) { if (orderDetailCodeEntity.getBindRlFk().longValue() == udiRelevanceResponse.getId().longValue() && StrUtil.trimToEmpty(orderDetailCodeEntity.getBatchNo()).equals(StrUtil.trimToEmpty(codeTempEntity.getBatchNo()) - ) + ) ) { orderDetailCodeEntity.setCount(orderDetailCodeEntity.getCount() + codeTempEntity.getMyCount()); orderDetailCodeEntity.setReCount(orderDetailCodeEntity.getReCount() + codeTempEntity.getMyReCount()); @@ -985,16 +985,20 @@ public class IoAddInoutService { basicCorpEntity = new BasicCorpEntity(); basicCorpEntity.setName(basicSkSickerEntity.getName() + " " + basicSkSickerEntity.getAdNum()); basicCorpEntity.setAdSickNum(basicSkSickerEntity.getAdNum()); - genBasicCorp(basicCorpEntity); + String erpId = genBasicCorp(basicCorpEntity); + basicCorpEntity.setErpId(erpId); } } } else { basicCorpEntity = basicCorpService.selectByName(fromCorp); + if (basicCorpEntity == null) + basicCorpEntity = basicCorpService.selectByErpId(fromCorp + " "); } if (basicCorpEntity == null) { basicCorpEntity = new BasicCorpEntity(); basicCorpEntity.setName(fromCorp); - genBasicCorp(basicCorpEntity); + String erpId = genBasicCorp(basicCorpEntity); + basicCorpEntity.setErpId(erpId); } return basicCorpEntity.getErpId(); @@ -1004,12 +1008,13 @@ public class IoAddInoutService { } - public void genBasicCorp(BasicCorpEntity basicCorpEntity) { + public String genBasicCorp(BasicCorpEntity basicCorpEntity) { basicCorpEntity.setErpId(CustomUtil.getUnitId()); basicCorpEntity.setCorpType(ConstantStatus.CORP_SICK); basicCorpEntity.setOutType(ConstantStatus.CORP_SICK_SICK); basicCorpEntity.setId(IdUtil.getSnowflakeNextId()); basicCorpService.insert(basicCorpEntity); + return basicCorpEntity.getErpId(); } public BaseResponse checkSubmitEnable(IoOrderEntity orderEntity) { diff --git a/src/main/java/com/glxp/api/service/inout/IoGenInvService.java b/src/main/java/com/glxp/api/service/inout/IoGenInvService.java index 81e2264ad..df74fda48 100644 --- a/src/main/java/com/glxp/api/service/inout/IoGenInvService.java +++ b/src/main/java/com/glxp/api/service/inout/IoGenInvService.java @@ -106,11 +106,12 @@ public class IoGenInvService { invProductService.update(invProductEntity); InvProductBatchEntity batchEntity = new InvProductBatchEntity(); - BeanUtils.copyProperties(invProductEntity,batchEntity); + BeanUtils.copyProperties(invProductEntity, batchEntity); + batchEntity.setId(null); batchEntities.add(batchEntity); } - if (CollUtil.isNotEmpty(batchEntities)){ + if (CollUtil.isNotEmpty(batchEntities)) { invProductBatchService.saveBatch(batchEntities); }