From 111c1fb9909d954892242156fb022fe3460efe51 Mon Sep 17 00:00:00 2001 From: MrZhai Date: Fri, 18 Mar 2022 17:19:58 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E7=AC=AC=E4=B8=89=E6=96=B9?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E6=B7=BB=E5=8A=A0=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../thrsys/ThrInvWarehouseController.java | 22 +++++++++++++- .../admin/dao/thrsys/ThrInvWarehouseDao.java | 2 ++ .../thrsys/FilterThrInvWarehouseRequest.java | 2 ++ .../thrsys/ThrInvWarehouseService.java | 1 + .../impl/ThrInvWarehouseServiceImpl.java | 5 ++++ .../mapper/thrsys/ThrInvWarehouseDao.xml | 30 +++++++++++++++++++ 6 files changed, 61 insertions(+), 1 deletion(-) diff --git a/api-admin/src/main/java/com/glxp/sale/admin/controller/thrsys/ThrInvWarehouseController.java b/api-admin/src/main/java/com/glxp/sale/admin/controller/thrsys/ThrInvWarehouseController.java index d2b6ca7..e5ceaba 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/controller/thrsys/ThrInvWarehouseController.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/controller/thrsys/ThrInvWarehouseController.java @@ -71,13 +71,33 @@ public class ThrInvWarehouseController { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } - if (thrInvWarehouseEntity.getPid() == null) { + if (thrInvWarehouseEntity.getPid() == null) {//仓库 thrInvWarehouseEntity.setPid(0); // 默认设置 + FilterThrInvWarehouseRequest filterThrInvWarehouseRequest = new FilterThrInvWarehouseRequest(); + filterThrInvWarehouseRequest.setPid(thrInvWarehouseEntity.getPid()); + ThrInvWarehouseEntity codeEntity = thrInvWarehouseService.selectMaxCode(filterThrInvWarehouseRequest); + thrInvWarehouseEntity.setCode(Integer.parseInt(codeEntity.getCode()) + 1 + ""); + } else {//货位 + + FilterThrInvWarehouseRequest filterThrInvWarehouseRequest = new FilterThrInvWarehouseRequest(); + filterThrInvWarehouseRequest.setPid(thrInvWarehouseEntity.getPid()); + ThrInvWarehouseEntity codeEntity = thrInvWarehouseService.selectMaxCode(filterThrInvWarehouseRequest); + ThrInvWarehouseEntity pEntity = thrInvWarehouseService.selectById(thrInvWarehouseEntity.getPid() + ""); + if (codeEntity == null) { + int code = Integer.parseInt(pEntity.getCode()) * 1000; + thrInvWarehouseEntity.setCode(code + ""); + } else { + thrInvWarehouseEntity.setCode(Integer.parseInt(codeEntity.getCode()) + 1 + ""); + } + thrInvWarehouseEntity.setAdvanceType(pEntity.getAdvanceType()); + thrInvWarehouseEntity.setLevel(pEntity.getLevel()); + thrInvWarehouseEntity.setPcode(pEntity.getPcode()); } boolean b = thrInvWarehouseService.insertInvWarehouse(thrInvWarehouseEntity); if (!b) { return ResultVOUtils.error(ResultEnum.NOT_NETWORK); } + return ResultVOUtils.success("添加成功!"); } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/dao/thrsys/ThrInvWarehouseDao.java b/api-admin/src/main/java/com/glxp/sale/admin/dao/thrsys/ThrInvWarehouseDao.java index 5124861..175689c 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/dao/thrsys/ThrInvWarehouseDao.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/dao/thrsys/ThrInvWarehouseDao.java @@ -27,4 +27,6 @@ public interface ThrInvWarehouseDao { * @return */ ThrInvWarehouseEntity selectByCode(@Param("code") String code); + + ThrInvWarehouseEntity selectMaxCode(FilterThrInvWarehouseRequest filterThrInvWarehouseRequest); } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/req/thrsys/FilterThrInvWarehouseRequest.java b/api-admin/src/main/java/com/glxp/sale/admin/req/thrsys/FilterThrInvWarehouseRequest.java index 8833fc1..39ad120 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/req/thrsys/FilterThrInvWarehouseRequest.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/req/thrsys/FilterThrInvWarehouseRequest.java @@ -16,4 +16,6 @@ public class FilterThrInvWarehouseRequest extends ListPageRequest { private Boolean isDefault; private Date updateTime; private String key; + private String pcode; + private Integer level; } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/thrsys/ThrInvWarehouseService.java b/api-admin/src/main/java/com/glxp/sale/admin/service/thrsys/ThrInvWarehouseService.java index 5b905f9..1f8b2df 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/service/thrsys/ThrInvWarehouseService.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/thrsys/ThrInvWarehouseService.java @@ -25,4 +25,5 @@ public interface ThrInvWarehouseService { boolean deleteById(String id); + ThrInvWarehouseEntity selectMaxCode(FilterThrInvWarehouseRequest filterThrInvWarehouseRequest); } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/thrsys/impl/ThrInvWarehouseServiceImpl.java b/api-admin/src/main/java/com/glxp/sale/admin/service/thrsys/impl/ThrInvWarehouseServiceImpl.java index a85eae1..4c417b9 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/service/thrsys/impl/ThrInvWarehouseServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/thrsys/impl/ThrInvWarehouseServiceImpl.java @@ -83,4 +83,9 @@ public class ThrInvWarehouseServiceImpl implements ThrInvWarehouseService { public boolean deleteById(String id) { return thrInvWarehouseDao.deleteById(id); } + + @Override + public ThrInvWarehouseEntity selectMaxCode(FilterThrInvWarehouseRequest filterThrInvWarehouseRequest) { + return thrInvWarehouseDao.selectMaxCode(filterThrInvWarehouseRequest); + } } diff --git a/api-admin/src/main/resources/mybatis/mapper/thrsys/ThrInvWarehouseDao.xml b/api-admin/src/main/resources/mybatis/mapper/thrsys/ThrInvWarehouseDao.xml index e269047..7ff6c38 100644 --- a/api-admin/src/main/resources/mybatis/mapper/thrsys/ThrInvWarehouseDao.xml +++ b/api-admin/src/main/resources/mybatis/mapper/thrsys/ThrInvWarehouseDao.xml @@ -100,4 +100,34 @@ + + \ No newline at end of file