From c0ba8eb882f606bb58f6450c6821cb6ff8cd49cd Mon Sep 17 00:00:00 2001 From: erdanergou Date: Mon, 30 Jan 2023 13:17:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=87=BA=E5=BA=93=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E5=AE=A1=E6=89=B9=E6=97=B6=EF=BC=8C=E4=B8=BA=E5=89=8D?= =?UTF-8?q?=E7=BD=AE=E4=BB=93=E7=9A=84=E4=B8=8D=E8=B5=B0=E4=BB=93=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DepositoryController.java | 20 +- .../controller/MaterialTypeController.java | 26 +- .../mapper/MaterialMapper.java | 8 + .../mapper/MaterialMapper.xml | 9 + .../mapper/MaterialTypeMapper.xml | 2 +- .../service/DepositoryService.java | 9 + .../service/MaterialService.java | 13 + .../service/impl/DepositoryServiceImpl.java | 284 ++++++++++-------- .../service/impl/MaterialServiceImpl.java | 81 +++-- .../service/impl/QyWxOperationService.java | 43 ++- .../pages/materialtype/materialType_view.html | 3 +- .../depository_manage/TestForOther.java | 10 + .../mapper/MaterialMapper.xml | 9 + .../mapper/MaterialTypeMapper.xml | 2 +- .../pages/materialtype/materialType_view.html | 3 +- 15 files changed, 336 insertions(+), 186 deletions(-) diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryController.java b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryController.java index 00e97eae..baee302d 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryController.java @@ -589,7 +589,7 @@ public class DepositoryController { new Thread(new Runnable() { @Override public void run() { - UpdateSonMaterialState(id, state); +// UpdateSonMaterialState(id, state); } }).start(); } @@ -604,14 +604,14 @@ public class DepositoryController { public void UpdateSonState(String parentId, Integer state, boolean envelop, UserByPort userToken) { Map param = new HashMap<>(); param.put("parentId", parentId); + // 获取当前仓库所有子仓库 List depositoryRecordPByCondition = depositoryService.findDepositoryByCondition(param, userToken); - if (envelop) { +// if (envelop) { // 将当前仓库下的产品状态改为禁用 - UpdateSonMaterialState(parentId, state); - } - for (int i = 0; i < depositoryRecordPByCondition.size(); i++) { - Depository depository = depositoryRecordPByCondition.get(i); +// UpdateSonMaterialState(parentId, state); +// } + for (Depository depository : depositoryRecordPByCondition) { int depositoryId = depository.getId(); Map newMap = new HashMap<>(); newMap.put("parentId", depositoryId); @@ -632,14 +632,6 @@ public class DepositoryController { public void UpdateSonMaterialState(String parentId, Integer state) { Map param = new HashMap<>(); param.put("depositoryId", parentId); - List materialPByCondition = materialService.findMaterialPByCondition(param); - for (int i = 0; i < materialPByCondition.size(); i++) { - MaterialP materialP = materialPByCondition.get(i); - Map map = new HashMap<>(); - map.put("id", materialP.getId()); - map.put("state", state); - materialService.updateStateByParam(map); - } } diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/MaterialTypeController.java b/src/main/java/com/dreamchaser/depository_manage/controller/MaterialTypeController.java index 2f68e73d..f7195367 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/MaterialTypeController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/MaterialTypeController.java @@ -43,7 +43,7 @@ public class MaterialTypeController { } catch (InterruptedException e) { e.printStackTrace(); } - materialService.InitTreeMenus_Test(); + materialService.RefreshInitTreeMenus(); } }).start(); return CrudUtil.postHandle(integer,1); @@ -105,7 +105,7 @@ public class MaterialTypeController { } catch (InterruptedException e) { e.printStackTrace(); } - materialService.InitTreeMenus_Test(); + materialService.RefreshInitTreeMenus(); } }).start(); @@ -134,7 +134,7 @@ public class MaterialTypeController { } catch (InterruptedException e) { e.printStackTrace(); } - materialService.InitTreeMenus_Test(); + materialService.RefreshInitTreeMenus(); } }).start(); return CrudUtil.deleteHandle(integer,ids.size()); @@ -187,7 +187,7 @@ public class MaterialTypeController { } catch (InterruptedException e) { e.printStackTrace(); } - materialService.InitTreeMenus_Test(); + materialService.RefreshInitTreeMenus(); } }).start(); @@ -215,7 +215,7 @@ public class MaterialTypeController { } catch (InterruptedException e) { e.printStackTrace(); } - materialService.InitTreeMenus_Test(); + materialService.RefreshInitTreeMenus(); } }).start(); @@ -248,7 +248,7 @@ public class MaterialTypeController { } catch (InterruptedException e) { e.printStackTrace(); } - materialService.InitTreeMenus_Test(); + materialService.RefreshInitTreeMenus(); } }).start(); return CrudUtil.postHandle(integer,1); @@ -362,7 +362,7 @@ public class MaterialTypeController { } catch (InterruptedException e) { e.printStackTrace(); } - materialService.InitTreeMenus_Test(); + materialService.RefreshInitTreeMenus(); } }).start(); @@ -399,15 +399,9 @@ public class MaterialTypeController { */ public void UpdateSonMaterialState(String parentId,Integer state){ Map param = new HashMap<>(); - param.put("materialTypeId",parentId); - List materialPByCondition = materialService.findMaterialPByCondition(param); - for (int i = 0; i < materialPByCondition.size(); i++) { - MaterialP materialP = materialPByCondition.get(i); - Map map = new HashMap<>(); - map.put("id",materialP.getId()); - map.put("state",state); - materialService.updateStateByParam(map); - } + param.put("typeId",parentId); + param.put("state",state); + materialService.updateStateByTypeId(param); } diff --git a/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.java b/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.java index 34309d50..fb088215 100644 --- a/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.java +++ b/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.java @@ -227,6 +227,14 @@ public interface MaterialMapper { */ Integer updateStateByParam(Map map); + /** + * 根据物料类型修改物料状态 + * @param map 待修改条件 + * @return + */ + Integer updateStateByTypeId(Map map); + + /** * 根据仓库查询物品 * @param ids diff --git a/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml b/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml index 623cdf85..f222086e 100644 --- a/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml +++ b/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml @@ -1043,6 +1043,15 @@ and state != 3 + + + UPDATE material + + state = #{state} + + where type_id = #{typeId} + + update material diff --git a/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialTypeMapper.xml b/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialTypeMapper.xml index 42340661..beef38b0 100644 --- a/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialTypeMapper.xml +++ b/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialTypeMapper.xml @@ -31,7 +31,7 @@ select FROM material_type mt - where mt.state != 3 and mt.state != 4 and mt.parentId = 0 + where mt.state = 1 and mt.parentId = 0