From 727e9481c6ed1c96fe995a1bf25ee9b6002494c9 Mon Sep 17 00:00:00 2001 From: anthonyywj2 <353682448@qq.com> Date: Sat, 25 Jun 2022 09:18:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AD=E7=BB=A7=E6=9C=8D=E5=8A=A1=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E4=BF=AE=E6=94=B9=EF=BC=8C=E5=88=86=E5=BA=93=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inventory/InvWarehouseController.java | 2 +- .../dao/inventory/InvSubWarehouseDao.java | 1 + .../inventory/InvSubWarehouseService.java | 2 +- .../impl/InvSubWarehouseServiceImpl.java | 5 ++ .../glxp/api/admin/thread/DlBasicService.java | 57 ++++++++++++------- .../glxp/api/admin/thread/HeartService.java | 5 +- .../admin/thread/InvProductsTrService.java | 2 +- .../glxp/api/admin/thread/UpBasicService.java | 39 +++++++++---- .../src/main/resources/logback-spring.xml | 2 +- .../mybatis/mapper/inout/OrderDao.xml | 6 +- .../mapper/inventory/InvSubWarehouseDao.xml | 7 +++ 11 files changed, 89 insertions(+), 39 deletions(-) diff --git a/api-admin/src/main/java/com/glxp/api/admin/controller/inventory/InvWarehouseController.java b/api-admin/src/main/java/com/glxp/api/admin/controller/inventory/InvWarehouseController.java index 7b09d322..0a505cac 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/controller/inventory/InvWarehouseController.java +++ b/api-admin/src/main/java/com/glxp/api/admin/controller/inventory/InvWarehouseController.java @@ -210,7 +210,7 @@ public class InvWarehouseController { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } - if (invWarehouseEntity.getPid() == null) {//仓库 + if (invWarehouseEntity.getPid() == null || invWarehouseEntity.getPid() == 0) {//仓库 invWarehouseEntity.setPid(0); // 默认设置 FilterInvWarehouseRequest filterInvWarehouseRequest = new FilterInvWarehouseRequest(); filterInvWarehouseRequest.setPid(invWarehouseEntity.getPid()); diff --git a/api-admin/src/main/java/com/glxp/api/admin/dao/inventory/InvSubWarehouseDao.java b/api-admin/src/main/java/com/glxp/api/admin/dao/inventory/InvSubWarehouseDao.java index 4462f4b7..a4ac6913 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/dao/inventory/InvSubWarehouseDao.java +++ b/api-admin/src/main/java/com/glxp/api/admin/dao/inventory/InvSubWarehouseDao.java @@ -25,4 +25,5 @@ public interface InvSubWarehouseDao { boolean deleteById(String id); + boolean deleteByParentCode(@Param("code") String code); } diff --git a/api-admin/src/main/java/com/glxp/api/admin/service/inventory/InvSubWarehouseService.java b/api-admin/src/main/java/com/glxp/api/admin/service/inventory/InvSubWarehouseService.java index f3eb9aff..9ebe9560 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/service/inventory/InvSubWarehouseService.java +++ b/api-admin/src/main/java/com/glxp/api/admin/service/inventory/InvSubWarehouseService.java @@ -25,5 +25,5 @@ public interface InvSubWarehouseService { boolean deleteById(String id); - + boolean deleteByParentCode(String code); } diff --git a/api-admin/src/main/java/com/glxp/api/admin/service/inventory/impl/InvSubWarehouseServiceImpl.java b/api-admin/src/main/java/com/glxp/api/admin/service/inventory/impl/InvSubWarehouseServiceImpl.java index d4d17825..af08b720 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/service/inventory/impl/InvSubWarehouseServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/api/admin/service/inventory/impl/InvSubWarehouseServiceImpl.java @@ -84,4 +84,9 @@ public class InvSubWarehouseServiceImpl implements InvSubWarehouseService { public boolean deleteById(String id) { return invSubWarehouseDao.deleteById(id); } + + @Override + public boolean deleteByParentCode(String code) { + return invSubWarehouseDao.deleteByParentCode(code); + } } 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 1f4db43b..256a1349 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 @@ -21,6 +21,7 @@ import com.glxp.api.admin.entity.inout.OrderEntity; import com.glxp.api.admin.entity.inout.WarehouseBussinessTypeEntity; import com.glxp.api.admin.entity.inout.WarehouseEntity; import com.glxp.api.admin.entity.inout.WarehouseUserEntity; +import com.glxp.api.admin.entity.inventory.InvSubWarehouseEntity; import com.glxp.api.admin.entity.inventory.InvWarehouseEntity; import com.glxp.api.admin.entity.thrsys.*; import com.glxp.api.admin.httpclient.SpGetHttpClient; @@ -34,6 +35,7 @@ import com.glxp.api.admin.service.basic.BussinessChangeTypeService; import com.glxp.api.admin.service.basic.EntrustReceService; import com.glxp.api.admin.service.info.SystemParamConfigService; import com.glxp.api.admin.service.inout.OrderService; +import com.glxp.api.admin.service.inventory.InvSubWarehouseService; import com.glxp.api.admin.service.inventory.InvWarehouseService; import com.glxp.api.admin.service.thrsys.ThrInvWarehouseService; import com.glxp.api.admin.util.CustomUtil; @@ -73,6 +75,9 @@ public class DlBasicService { AuthAdminDao authAdminService; @Resource WarehouseUserDao warehouseUserDao; + + @Resource + InvSubWarehouseService invSubWarehouseService; @Resource WarehouseBussinessTypeDao warehouseBussinessTypeDao; @Resource @@ -122,15 +127,45 @@ public class DlBasicService { for (InvWarehouseEntity invWarehouseEntity : syncDataResponse.getInvWarehouseEntities()) { invWarehouseEntity.setUpdateTime(null); - warehouseUserDao.deleteByCode(invWarehouseEntity.getCode()); - warehouseBussinessTypeDao.deleteByCode(invWarehouseEntity.getCode()); + List invSubWarehouseEntities = invSubWarehouseService.findByParentId(invWarehouseEntity.getCode()); + if (CollUtil.isNotEmpty(invSubWarehouseEntities)) { + for (InvSubWarehouseEntity invSubWarehouseEntity : invSubWarehouseEntities) { + warehouseUserDao.deleteByCode(invSubWarehouseEntity.getCode()); + warehouseBussinessTypeDao.deleteByCode(invSubWarehouseEntity.getCode()); + } + } + invSubWarehouseService.deleteByParentCode(invWarehouseEntity.getCode()); } - invWarehouseService.importInvWarehouse(syncDataResponse.getInvWarehouseEntities()); remark.append("仓库字典:").append(syncDataResponse.getInvWarehouseEntities().size()).append("条\n"); } + //分库 + if (CollUtil.isNotEmpty(syncDataResponse.getInvSubWarehouseEntities())) { + for (InvSubWarehouseEntity invSubWarehouseEntity : syncDataResponse.getInvSubWarehouseEntities()) { + invSubWarehouseService.insertInvSubWarehouse(invSubWarehouseEntity); + } + remark.append("仓库用户:").append(syncDataResponse.getWarehouseUserEntities().size()).append("条\n"); + } + + //仓库用户表 + if (CollUtil.isNotEmpty(syncDataResponse.getWarehouseUserEntities())) { + for (WarehouseUserEntity warehouseUserEntity : syncDataResponse.getWarehouseUserEntities()) { + warehouseUserDao.insertOrUpdate(warehouseUserEntity); + } + remark.append("仓库用户:").append(syncDataResponse.getWarehouseUserEntities().size()).append("条\n"); + } + + //仓库单据类型表 + if (CollUtil.isNotEmpty(syncDataResponse.getWarehouseBussinessTypeEntities())) { + for (WarehouseBussinessTypeEntity warehouseUserEntity : syncDataResponse.getWarehouseBussinessTypeEntities()) { + warehouseBussinessTypeDao.insertOrUpdate(warehouseUserEntity); + } + remark.append("仓库单据:").append(syncDataResponse.getWarehouseBussinessTypeEntities().size()).append("条\n"); + } + + //关联表导入 if (CollUtil.isNotEmpty(syncDataResponse.getUdiRelevanceEntities())) { try { @@ -262,22 +297,6 @@ public class DlBasicService { } - //仓库用户表 - if (CollUtil.isNotEmpty(syncDataResponse.getWarehouseUserEntities())) { - for (WarehouseUserEntity warehouseUserEntity : syncDataResponse.getWarehouseUserEntities()) { - warehouseUserDao.insertOrUpdate(warehouseUserEntity); - } - remark.append("仓库用户:").append(syncDataResponse.getWarehouseUserEntities().size()).append("条\n"); - } - - //仓库单据类型表 - if (CollUtil.isNotEmpty(syncDataResponse.getWarehouseBussinessTypeEntities())) { - for (WarehouseBussinessTypeEntity warehouseUserEntity : syncDataResponse.getWarehouseBussinessTypeEntities()) { - warehouseBussinessTypeDao.insertOrUpdate(warehouseUserEntity); - } - remark.append("仓库单据:").append(syncDataResponse.getWarehouseBussinessTypeEntities().size()).append("条\n"); - } - //用户表 if (CollUtil.isNotEmpty(syncDataResponse.getAuthAdminList())) { for (AuthAdmin authAdmin : syncDataResponse.getAuthAdminList()) { diff --git a/api-admin/src/main/java/com/glxp/api/admin/thread/HeartService.java b/api-admin/src/main/java/com/glxp/api/admin/thread/HeartService.java index 818ebe91..a60b0e4c 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/thread/HeartService.java +++ b/api-admin/src/main/java/com/glxp/api/admin/thread/HeartService.java @@ -181,7 +181,8 @@ public class HeartService { && CollUtil.isEmpty(syncDataResponse.getUdiRelevanceEntities()) && CollUtil.isEmpty(syncDataResponse.getAuthAdminList()) && CollUtil.isEmpty(syncDataResponse.getWarehouseBussinessTypeEntities()) - && CollUtil.isEmpty(syncDataResponse.getWarehouseUserEntities())) { + && CollUtil.isEmpty(syncDataResponse.getWarehouseUserEntities()) + && CollUtil.isEmpty(syncDataResponse.getInvSubWarehouseEntities())) { //数据不记录日志 return ResultVOUtils.success("无数据"); } @@ -221,6 +222,8 @@ public class HeartService { logs = logs + "供应商关联产品信息:" + syncDataResponse.getCompanyProductRelevanceEntities().size() + "条\n"; if (CollUtil.isNotEmpty(syncDataResponse.getInvWarehouseEntities())) logs = logs + "仓库字典:" + syncDataResponse.getInvWarehouseEntities().size() + "条\n"; + if (CollUtil.isNotEmpty(syncDataResponse.getInvSubWarehouseEntities())) + logs = logs + "分库信息:" + syncDataResponse.getInvSubWarehouseEntities().size() + "条\n"; if (CollUtil.isNotEmpty(syncDataResponse.getThrInvWarehouseEntities())) logs = logs + "第三方仓库字典:" + syncDataResponse.getThrInvWarehouseEntities().size() + "条\n"; if (CollUtil.isNotEmpty(syncDataResponse.getThrOrderEntities())) diff --git a/api-admin/src/main/java/com/glxp/api/admin/thread/InvProductsTrService.java b/api-admin/src/main/java/com/glxp/api/admin/thread/InvProductsTrService.java index a08d1f38..b2339135 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/thread/InvProductsTrService.java +++ b/api-admin/src/main/java/com/glxp/api/admin/thread/InvProductsTrService.java @@ -96,7 +96,7 @@ public class InvProductsTrService { if (bussinessTypeEntity.isPreIn()) { InvProductEntity invPreProductEntity = invPreInProductService.selectByUuid(erpOrderEntity.getGoodsid(), erpOrderEntity.getBatchNo(), warehouseEntity.getSupId() - , null, null); + , warehouseEntity.getLocStorageCode(), warehouseEntity.getInvWarehouseCode()); if (invPreProductEntity == null) { invPreProductEntity = buildInvProduct(erpOrderEntity.getGoodsid(), erpOrderEntity, orderEntity, warehouseEntity); invPreInProductService.insertInvProduct(invPreProductEntity); 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 e044c718..7c8d20a6 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 @@ -10,6 +10,7 @@ import com.glxp.api.admin.entity.basic.*; import com.glxp.api.admin.entity.info.SyncDataBustypeEntity; import com.glxp.api.admin.entity.info.SyncDataSetEntity; import com.glxp.api.admin.entity.inout.*; +import com.glxp.api.admin.entity.inventory.InvSubWarehouseEntity; import com.glxp.api.admin.entity.inventory.InvWarehouseEntity; import com.glxp.api.admin.entity.thrsys.*; import com.glxp.api.admin.req.auth.AuthAdminQueryRequest; @@ -29,6 +30,7 @@ import com.glxp.api.admin.service.basic.*; import com.glxp.api.admin.service.info.CompanyProductRelevanceService; import com.glxp.api.admin.service.info.SyncDataSetService; import com.glxp.api.admin.service.inout.*; +import com.glxp.api.admin.service.inventory.InvSubWarehouseService; import com.glxp.api.admin.service.inventory.InvWarehouseService; import com.glxp.api.admin.service.thrsys.*; import org.springframework.beans.BeanUtils; @@ -46,6 +48,8 @@ public class UpBasicService { @Resource InvWarehouseService invWarehouseService; @Resource + InvSubWarehouseService invSubWarehouseService; + @Resource UdiRelevanceService udiRelevanceService; @Resource UdiInfoDao udiInfoDao; @@ -87,30 +91,41 @@ public class UpBasicService { //仓库字典 if (syncDataSetEntity.isBasicInv()) { + + + //仓库字典 FilterInvWarehouseRequest filterInvWarehouseRequest = new FilterInvWarehouseRequest(); BeanUtils.copyProperties(spsSyncDataRequest, filterInvWarehouseRequest); List invWarehouseEntities = invWarehouseService.filterGroupInvWarehouse(filterInvWarehouseRequest); syncDataResponse.setInvWarehouseEntities(invWarehouseEntities); + + //获取仓库分库 if (CollUtil.isNotEmpty(invWarehouseEntities)) { + List mInvSubWarehouseEntities = new ArrayList<>(); List mWarehouseBussinessTypeEntities = new ArrayList<>(); List mWarehouseUserEntities = new ArrayList<>(); for (InvWarehouseEntity invWarehouseEntity : invWarehouseEntities) { - //仓库关联单据类型 - FilterInvBusTypeRequest filterInvBusTypeRequest = new FilterInvBusTypeRequest(); - filterInvBusTypeRequest.setCode(invWarehouseEntity.getCode()); - List warehouseBussinessTypeEntities = warehouseBussinessTypeService.filterList(filterInvBusTypeRequest); - mWarehouseBussinessTypeEntities.addAll(warehouseBussinessTypeEntities); - //仓库关联用户 - FilterInvUserRequest filterInvUserRequest = new FilterInvUserRequest(); - filterInvUserRequest.setCode(invWarehouseEntity.getCode()); - List warehouseUserEntities = warehouseUserService.filterWarehouseUsers(filterInvUserRequest); - mWarehouseUserEntities.addAll(warehouseUserEntities); - + List invSubWarehouseEntities = invSubWarehouseService.findByParentId(invWarehouseEntity.getCode()); + if (CollUtil.isNotEmpty(invSubWarehouseEntities)) { + mInvSubWarehouseEntities.addAll(invSubWarehouseEntities); + for (InvSubWarehouseEntity invSubWarehouseEntity : invSubWarehouseEntities) { + //仓库关联单据类型 + FilterInvBusTypeRequest filterInvBusTypeRequest = new FilterInvBusTypeRequest(); + filterInvBusTypeRequest.setCode(invSubWarehouseEntity.getCode()); + List warehouseBussinessTypeEntities = warehouseBussinessTypeService.filterList(filterInvBusTypeRequest); + mWarehouseBussinessTypeEntities.addAll(warehouseBussinessTypeEntities); + //仓库关联用户 + FilterInvUserRequest filterInvUserRequest = new FilterInvUserRequest(); + filterInvUserRequest.setCode(invSubWarehouseEntity.getCode()); + List warehouseUserEntities = warehouseUserService.filterWarehouseUsers(filterInvUserRequest); + mWarehouseUserEntities.addAll(warehouseUserEntities); + } + } } + syncDataResponse.setInvSubWarehouseEntities(mInvSubWarehouseEntities); syncDataResponse.setWarehouseUserEntities(mWarehouseUserEntities); syncDataResponse.setWarehouseBussinessTypeEntities(mWarehouseBussinessTypeEntities); - } } diff --git a/api-admin/src/main/resources/logback-spring.xml b/api-admin/src/main/resources/logback-spring.xml index b67920b1..229d4f07 100644 --- a/api-admin/src/main/resources/logback-spring.xml +++ b/api-admin/src/main/resources/logback-spring.xml @@ -1,7 +1,7 @@ logback - + 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 f06c636f..22f01f49 100644 --- a/api-admin/src/main/resources/mybatis/mapper/inout/OrderDao.xml +++ b/api-admin/src/main/resources/mybatis/mapper/inout/OrderDao.xml @@ -136,9 +136,9 @@ preCheck=#{preCheck}, thirdBillNo=#{thirdBillNo}, auditTime=#{auditTime}, - replicateNo=#{replicateNo} - fromSubInvCode=#{fromSubInvCode} - createTime=#{createTime} + replicateNo=#{replicateNo}, + fromSubInvCode=#{fromSubInvCode}, + createTime=#{createTime}, WHERE id = #{id} diff --git a/api-admin/src/main/resources/mybatis/mapper/inventory/InvSubWarehouseDao.xml b/api-admin/src/main/resources/mybatis/mapper/inventory/InvSubWarehouseDao.xml index f68285c8..2c5f616c 100644 --- a/api-admin/src/main/resources/mybatis/mapper/inventory/InvSubWarehouseDao.xml +++ b/api-admin/src/main/resources/mybatis/mapper/inventory/InvSubWarehouseDao.xml @@ -89,6 +89,13 @@ WHERE id = #{id} + + + DELETE + FROM inv_warehouse_sub + WHERE parentId = #{code} + + UPDATE inv_warehouse_sub