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