diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java b/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java index ccee034b..d4eb7b92 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java @@ -2273,6 +2273,12 @@ public class PageController { } + /** + * 用于跳转到打印页面 + * @param mid 打印id + * @param flag 标志位 + * @return + */ @GetMapping("/printCode") public ModelAndView printCode(int mid, int flag) { ModelAndView mv = new ModelAndView(); @@ -2321,4 +2327,33 @@ public class PageController { return mv; } + /** + * 用于查看当前库位该物料的库存 + * @param id 库位id + * @return + */ + @GetMapping("/materialForPlace") + public ModelAndView materialForPlace(Integer id){ + ModelAndView mv = new ModelAndView(); + mv.setViewName("pages/place/materialForPlace"); + // 获取当前的映射 + MaterialAndPlace placeAndMaterial = placeService.findPlaceAndMaterialById(id); + // 获取库存记录 + Inventory inventoryById = materialService.findInventoryById(placeAndMaterial.getMid()); + // 获取当前所有拆单库存记录 + List splitInfoByMid = splitUnitService.findSplitInfoByMid(inventoryById.getMid()); + List splitInventoryByIid = new ArrayList<>(); + for (SplitInfo splitInfo: + splitInfoByMid) { + SplitInventory splitInventory = splitUnitService.findSplitInventoryByIidAndSid(placeAndMaterial.getId(), splitInfo.getId()); + splitInventory.setSplitInfo(splitInfo); + splitInventoryByIid.add(splitInventory); + } + mv.addObject("record",placeAndMaterial); + mv.addObject("inventory",inventoryById); + mv.addObject("splitInventoryList",splitInventoryByIid); + return mv; + } + + } diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/PlaceController.java b/src/main/java/com/dreamchaser/depository_manage/controller/PlaceController.java index a36d9c89..77ca973c 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/PlaceController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/PlaceController.java @@ -43,24 +43,24 @@ public class PlaceController { public RestResponse findMaterial(@RequestParam Map map) { List placeByCondition = placeService.findPlaceByCondition(map); List placePList = new ArrayList<>(); - for (int i = 0; i < placeByCondition.size(); i++) { - Place place = placeByCondition.get(i); + for (Place place : placeByCondition) { PlaceP placeP = new PlaceP(place); Integer depositoryId = place.getDid(); Depository depositoryById = depositoryService.findDepositoryById(depositoryId); // 获取当前库位所有的物料信息 List placeAndMaterialByPid = placeService.findPlaceAndMaterialByPid(place.getId()); - if(placeAndMaterialByPid == null){ + if (placeAndMaterialByPid == null) { placeAndMaterialByPid = new ArrayList<>(); } StringBuilder mname = new StringBuilder(); - for (int j = 0; j < placeAndMaterialByPid.size(); j++) { - Integer mid = placeAndMaterialByPid.get(j).getMid(); + for (MaterialAndPlace materialAndPlace : placeAndMaterialByPid) { + Integer mid = materialAndPlace.getMid(); Inventory materialById = materialService.findInventoryById(mid); - mname.append(materialById.getMname()+","); + mname.append(materialById.getMname()).append(","); } + placeP.setMaterialAndPlaceList(placeAndMaterialByPid); placeP.setMname(mname.toString()); - if(depositoryById != null) { + if (depositoryById != null) { placeP.setDepositoryName(depositoryById.getDname()); placeP.setDepositoryCode(depositoryById.getCode()); } diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/SplitController.java b/src/main/java/com/dreamchaser/depository_manage/controller/SplitController.java index e20982bb..7ab2b3c5 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/SplitController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/SplitController.java @@ -3,6 +3,7 @@ package com.dreamchaser.depository_manage.controller; import com.dreamchaser.depository_manage.entity.Inventory; import com.dreamchaser.depository_manage.entity.SplitInfo; +import com.dreamchaser.depository_manage.entity.SplitInventory; import com.dreamchaser.depository_manage.exception.MyException; import com.dreamchaser.depository_manage.pojo.RestResponse; import com.dreamchaser.depository_manage.pojo.StatusInfo; @@ -46,6 +47,23 @@ public class SplitController { } + /** + * 用于查找当前库存的拆单记录 + * @param map + * @return + */ + @PostMapping("/findSplitInventoryByIid") + public RestResponse findSplitInventoryByIid(@RequestBody Map map){ + if (map.containsKey("iid") ) { + Integer iid = ObjectFormatUtil.toInteger(map.get("iid")); + List splitInventoryByIid = splitUnitService.findSplitInventoryByIid(iid); + return new RestResponse(splitInventoryByIid); + } else { + throw new MyException("缺少必要参数"); + } + } + + /** * 用于根据条件查询拆单记录 * diff --git a/src/main/java/com/dreamchaser/depository_manage/entity/SplitInventory.java b/src/main/java/com/dreamchaser/depository_manage/entity/SplitInventory.java index 44c1e795..efd7fe03 100644 --- a/src/main/java/com/dreamchaser/depository_manage/entity/SplitInventory.java +++ b/src/main/java/com/dreamchaser/depository_manage/entity/SplitInventory.java @@ -31,4 +31,9 @@ public class SplitInventory { * 入库后剩余的数量 */ private Integer saveQuantity; + + /** + * 当前拆单的单位 + */ + private SplitInfo splitInfo; } diff --git a/src/main/java/com/dreamchaser/depository_manage/mapper/PlaceMapper.java b/src/main/java/com/dreamchaser/depository_manage/mapper/PlaceMapper.java index 9a0ff6c4..9576d1f3 100644 --- a/src/main/java/com/dreamchaser/depository_manage/mapper/PlaceMapper.java +++ b/src/main/java/com/dreamchaser/depository_manage/mapper/PlaceMapper.java @@ -148,6 +148,11 @@ public interface PlaceMapper { */ MaterialAndPlace findPlaceAndMaterialByMidAndPid(Map map); + /** + * 根据id获取物料与库位的映射 + */ + MaterialAndPlace findPlaceAndMaterialById(Integer id); + /** * 修改当前库位存放物料信息 * @param map diff --git a/src/main/java/com/dreamchaser/depository_manage/mapper/PlaceMapper.xml b/src/main/java/com/dreamchaser/depository_manage/mapper/PlaceMapper.xml index 83e1c8f7..6398fd0e 100644 --- a/src/main/java/com/dreamchaser/depository_manage/mapper/PlaceMapper.xml +++ b/src/main/java/com/dreamchaser/depository_manage/mapper/PlaceMapper.xml @@ -234,6 +234,13 @@ and mp.pid = #{pid} + + diff --git a/src/main/java/com/dreamchaser/depository_manage/pojo/PlaceP.java b/src/main/java/com/dreamchaser/depository_manage/pojo/PlaceP.java index 42c2ca3d..9a1d60a3 100644 --- a/src/main/java/com/dreamchaser/depository_manage/pojo/PlaceP.java +++ b/src/main/java/com/dreamchaser/depository_manage/pojo/PlaceP.java @@ -78,6 +78,9 @@ public class PlaceP { private List mcodeList; + + private List materialAndPlaceList; + public PlaceP(Integer id, Integer x, Integer y, Integer z, Integer mid, Integer did, String code, Integer min, Integer max, Integer state, String mname, String mcode, String depositoryCode, String depositoryName) { this.id = id; this.x = x; diff --git a/src/main/java/com/dreamchaser/depository_manage/service/PlaceService.java b/src/main/java/com/dreamchaser/depository_manage/service/PlaceService.java index 62e85339..cfb6510e 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/PlaceService.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/PlaceService.java @@ -120,6 +120,10 @@ public interface PlaceService { * 根据当前库位编号及物料编号获取具体库位 */ MaterialAndPlace findPlaceAndMaterialByMidAndPid(Integer pid,Integer mid); + /** + * 根据id获取物料与库位的映射 + */ + MaterialAndPlace findPlaceAndMaterialById(Integer id); /** * 添加物料到库位 diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/PlaceServiceImpl.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/PlaceServiceImpl.java index ea2b3585..55a766fb 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/PlaceServiceImpl.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/PlaceServiceImpl.java @@ -250,6 +250,14 @@ public class PlaceServiceImpl implements PlaceService { return placeMapper.findPlaceAndMaterialByMidAndPid(map); } + /** + * 根据id获取物料与库位的映射 + */ + @Override + public MaterialAndPlace findPlaceAndMaterialById(Integer id) { + return placeMapper.findPlaceAndMaterialById(id); + } + /** * 添加物料到库位 * @param map diff --git a/src/main/resources/templates/pages/place/materialForPlace.html b/src/main/resources/templates/pages/place/materialForPlace.html new file mode 100644 index 00000000..81538a3e --- /dev/null +++ b/src/main/resources/templates/pages/place/materialForPlace.html @@ -0,0 +1,61 @@ + + + + + layui + + + + + + + +
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
物料名称骁龙888芯片
存货编码
库存409
库存409
+
+
+
+
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/src/main/resources/templates/pages/warehouse/warehouseByParentId.html b/src/main/resources/templates/pages/warehouse/warehouseByParentId.html index 8ee14a2a..4ffcba06 100644 --- a/src/main/resources/templates/pages/warehouse/warehouseByParentId.html +++ b/src/main/resources/templates/pages/warehouse/warehouseByParentId.html @@ -90,6 +90,10 @@ diff --git a/target/classes/com/dreamchaser/depository_manage/mapper/PlaceMapper.xml b/target/classes/com/dreamchaser/depository_manage/mapper/PlaceMapper.xml index 83e1c8f7..6398fd0e 100644 --- a/target/classes/com/dreamchaser/depository_manage/mapper/PlaceMapper.xml +++ b/target/classes/com/dreamchaser/depository_manage/mapper/PlaceMapper.xml @@ -234,6 +234,13 @@ and mp.pid = #{pid} + + diff --git a/target/classes/templates/pages/warehouse/warehouseByParentId.html b/target/classes/templates/pages/warehouse/warehouseByParentId.html index 8ee14a2a..4ffcba06 100644 --- a/target/classes/templates/pages/warehouse/warehouseByParentId.html +++ b/target/classes/templates/pages/warehouse/warehouseByParentId.html @@ -90,6 +90,10 @@