diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java b/src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java index 6adfa16e..19de1696 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java @@ -842,63 +842,14 @@ public class MaterialController { } - // 获取扫描结果并跳转到库存转移 - @PostMapping("/qywxApplicationTransferScanQrCode") - public RestResponse qywxApplicationTransferScanQrCode(@RequestBody Map map, HttpServletRequest request) { - UserByPort userByPort = (UserByPort) request.getAttribute("userToken"); - // 获取当前用户所在部门拥有的仓库 - List depositoryByAdminorg = depositoryService.findDepositoryByAdminorg(userByPort.getMaindeparment().toString()); - // 获取当前扫描的二维码 - String qrCode = (String) map.get("qrCode"); - // 根据扫描的二维码获取对应的物料编码 - String mcode = materialService.findMaterialCodeByQrCode(qrCode); - InventoryP mp = null; - if (mcode == null) { - return new RestResponse(mp); - } - // 根据物料编码获取物料 - Material material = materialService.findMaterialByCode(mcode); - Map param = new HashMap<>(); - List placePList = new ArrayList<>(); - param.put("mcode", mcode); - param.put("codeFlag", 1); - - // 获取物料与条形码的对应关系 - List materialByBarCodeByCondition = materialService.findMaterialByBarCodeByCondition(param); - Boolean flag = false; - for (int j = 0; j < depositoryByAdminorg.size(); j++) { - Depository depository = depositoryByAdminorg.get(j); - param.put("mcode", material.getCode()); - param.put("depositoryId", depository.getId()); - // 获取当前仓库下是否有当前物料的库存 - List inventory = materialService.findInventory(param); - if (inventory.size() > 0) { - mp = inventory.get(0); - List place = placeService.findPlaceByMidAndDid(mp.getId(), depository.getId()); - placePList.addAll(place); - flag = true; - } - } - if (flag) { - // 设置当前物料在相关仓库下的所有库位 - mp.setPlacePList(placePList); - // 设置物料与条形码的对应关系 - mp.setMaterialAndBarCodeList(materialByBarCodeByCondition); - // 获取拆单信息 - List splitInfoByMid = splitUnitService.findSplitInfoByMid(mp.getMid()); - mp.setSplitInfoList(splitInfoByMid); - } - return new RestResponse(mp); - - } - - // 获取扫描结果并跳转到出库 @PostMapping("/qywxApplicationOutScanQrCode") public RestResponse qywxApplicationOutScanQrCode(@RequestBody Map map, HttpServletRequest request) { UserByPort userByPort = (UserByPort) request.getAttribute("userToken"); // 获取当前用户所在部门拥有的仓库 List depositoryByAdminorg = depositoryService.findDepositoryByAdminorg(userByPort.getMaindeparment().toString()); + // 查询当前用户管理的仓库 + List depositoryAndRole = roleService.findDepositoryAndRole(userByPort.getId()); // 获取当前扫描的二维码 String qrCode = (String) map.get("qrCode"); // 根据扫描的二维码获取对应的物料编码 @@ -910,7 +861,6 @@ public class MaterialController { return new RestResponse(mp); } // 根据物料编码获取物料 - Material material = materialService.findMaterialByCode(mcode); Map param = new HashMap<>(); List placePList = new ArrayList<>(); param.put("mcode", mcode); @@ -919,14 +869,24 @@ public class MaterialController { // 获取物料与条形码的对应关系 List materialByBarCodeByCondition = materialService.findMaterialByBarCodeByCondition(param); boolean flag = false; + List depositoryIdList = new ArrayList<>(); for (Depository depository : depositoryByAdminorg) { - param.put("mcode", material.getCode()); - param.put("depositoryId", depository.getId()); + depositoryIdList.add(depository.getId()); + } + for (RoleAndDepository depository : depositoryAndRole) { + if(!depositoryIdList.contains(depository.getDepositoryId())){ + depositoryIdList.add(depository.getDepositoryId()); + } + } + + for (Integer depositoryId:depositoryIdList){ + param.put("mcode", mcode); + param.put("depositoryId", depositoryId); // 获取当前仓库下是否有当前物料的库存 List inventory = materialService.findInventory(param); if (inventory.size() > 0) { mp = inventory.get(0); - List place = placeService.findPlaceByMidAndDid(mp.getMid(), depository.getId()); + List place = placeService.findPlaceByMidAndDid(mp.getMid(), depositoryId); placePList.addAll(place); flag = true; } @@ -1213,65 +1173,40 @@ public class MaterialController { return new RestResponse(result); } - @PostMapping("/qywxApplicationTransferScanBarCode") - public RestResponse qywxApplicationTransferScanBarCode(@RequestBody Map map, HttpServletRequest request) { - UserByPort userByPort = (UserByPort) request.getAttribute("userToken"); - // 获取当前用户部门所拥有仓库 - List depositoryByAdminorg = depositoryService.findDepositoryByAdminorg(userByPort.getMaindeparment().toString()); - // 获取扫描的条形码 - String qrCode = (String) map.get("qrCode"); - // 获取条形码与物料的映射 - MaterialAndBarCode materialByBarCode = materialService.findMaterialByBarCode(qrCode); - if (materialByBarCode != null) { - for (Depository depository : depositoryByAdminorg) { - List placePList = new ArrayList<>(); - Boolean isExist = false; - Map param = new HashMap<>(); - param.put("depositoryId", depository.getId()); - param.put("mcode", materialByBarCode.getMcode()); - List inventory = materialService.findInventory(param); - if (inventory.size() > 0) { - // 如果存在该物料 - InventoryP materialP = inventory.get(0); - materialByBarCode.setMid(materialP.getId()); - List placeByMidAndDid = placeService.findPlaceByMidAndDid(materialP.getId(), depository.getId()); - placePList.addAll(placeByMidAndDid); - isExist = true; - } - if (isExist) { - materialByBarCode.setPlacePList(placePList); - Inventory inventoryById = materialService.findInventoryById(materialByBarCode.getMid()); - List splitInfoByMid = splitUnitService.findSplitInfoByMid(inventoryById.getMid()); - materialByBarCode.setSplitInfoList(splitInfoByMid); - return new RestResponse(materialByBarCode); - } - } - return new RestResponse(null); - } - return new RestResponse(null); - } // 获取条形码扫描结果 @PostMapping("/qywxApplicationOutScanBarCode") public RestResponse qywxApplicationOutScanBarCode(@RequestBody Map map, HttpServletRequest request) { UserByPort userByPort = (UserByPort) request.getAttribute("userToken"); - // 获取当前用户部门所拥有仓库 - List depositoryByAdminorg = depositoryService.findDepositoryByAdminorg(userByPort.getMaindeparment().toString()); String barCode = (String) map.get("qrCode"); // 获取条形码与物料的映射 MaterialAndBarCode materialByBarCode = materialService.findMaterialByBarCode(barCode); if (materialByBarCode != null) { - List placePList = new ArrayList<>(); + // 获取当前用户部门所拥有仓库 + List depositoryByAdminorg = depositoryService.findDepositoryByAdminorg(userByPort.getMaindeparment().toString()); + // 查询当前用户管理的仓库 + List depositoryAndRole = roleService.findDepositoryAndRole(userByPort.getId()); + List depositoryIdList = new ArrayList<>(); for (Depository depository : depositoryByAdminorg) { + depositoryIdList.add(depository.getId()); + } + for (RoleAndDepository depository : depositoryAndRole) { + if(!depositoryIdList.contains(depository.getDepositoryId())){ + depositoryIdList.add(depository.getDepositoryId()); + } + } + + List placePList = new ArrayList<>(); + for (Integer depositoryId:depositoryIdList) { Boolean isExist = false; Map param = new HashMap<>(); - param.put("depositoryId", depository.getId()); + param.put("depositoryId", depositoryId); param.put("mid", materialByBarCode.getMid()); List inventory = materialService.findInventory(param); if (inventory.size() > 0) { // 如果存在该物料 InventoryP inventoryP = inventory.get(0); - List placeByMidAndDid = placeService.findPlaceByMidAndDid(inventoryP.getId(), depository.getId()); + List placeByMidAndDid = placeService.findPlaceByMidAndDid(inventoryP.getId(), depositoryId); materialByBarCode.setIid(inventoryP.getId()); placePList.addAll(placeByMidAndDid); isExist = true; 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 ce811340..45a71186 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java @@ -357,7 +357,7 @@ public class PageController { // 获取子订单键值 String[] split = minRecord.replace("[", "").replace("]", "").split(","); for (String s : split) { - if("".equals(s)){ + if ("".equals(s)) { continue; } Integer minRecordId = ObjectFormatUtil.toInteger(s.split(":")[1]); @@ -527,9 +527,9 @@ public class PageController { SplitInventory splitInventory = splitUnitService.findSplitInventoryByIidAndSid(placeAndMaterialByMidAndPid.getId(), splitInfo.getId()); if (splitInventory != null) { mv.addObject("quantity", splitInventory.getSaveQuantity()); - }else{ + } else { int Scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); - mv.addObject("quantity",inventoryById.getQuantity() * Scale); + mv.addObject("quantity", inventoryById.getQuantity() * Scale); } } mv.addObject("depositoryId", depositoryId); @@ -1338,7 +1338,7 @@ public class PageController { String[] split = departmentheads.split(","); StringBuilder departmentHeadName = new StringBuilder(); for (String value : split) { - if("".equals(value)){ + if ("".equals(value)) { continue; } UserByPort departmenthead = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(value), userToken); @@ -1354,7 +1354,7 @@ public class PageController { List depositoryManager = new ArrayList<>(); StringBuilder depositoryManagerNames = new StringBuilder(); for (String s : depositoryManagerId) { - if("".equals(s)){ + if ("".equals(s)) { continue; } Integer managerid = ObjectFormatUtil.toInteger(s); @@ -1441,7 +1441,7 @@ public class PageController { recordMinP.setDepositoryName(depository.getDname()); recordMinP.setMname(inventoryById.getMname()); recordMinP.setMcode(inventoryById.getCode()); - recordMinP.setVersion(inventoryById.getVersion() == null ? "":inventoryById.getVersion()); + recordMinP.setVersion(inventoryById.getVersion() == null ? "" : inventoryById.getVersion()); recordMinP.setPlaceCode(placeById.getCode()); String unit = recordMinP.getUnit(); if ("-1".equals(unit)) { @@ -1464,6 +1464,16 @@ public class PageController { price = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); recordMinP.setPrice(price); } + mv.addObject("display","none"); + if (recordMinP.getTransferId() != null) { + // 如果是转移订单 + mv.addObject("display","table-row"); + // 获取订单详情 + TransferRecord transferRecord = depositoryRecordService.findTransferRecordById(recordMin.getTransferId()); + Place place = placeService.findPlaceById(transferRecord.getToPlaceId()); + Depository depositoryById = depositoryService.findDepositoryById(transferRecord.getToId()); + mv.addObject("toLocation", depositoryById.getDname() + "-" + place.getCode()); + } mv.addObject("recordMinP", recordMinP); } else { throw new MyException("缺少必要参数!"); @@ -1566,7 +1576,7 @@ public class PageController { } StringBuilder departmentHeadName = new StringBuilder(); for (String value : split) { - if("".equals(value)){ + if ("".equals(value)) { continue; } UserByPort departmenthead = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(value), userToken); diff --git a/src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationOutRecordMinP.java b/src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationOutRecordMinP.java index f2314164..d1b92d16 100644 --- a/src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationOutRecordMinP.java +++ b/src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationOutRecordMinP.java @@ -96,6 +96,11 @@ public class ApplicationOutRecordMinP { * 出库物料的型号 */ private String version; + /** + * 转移申请编号 + */ + private Integer transferId; + @@ -110,5 +115,6 @@ public class ApplicationOutRecordMinP { this.parentId = recordMin.getParentId(); this.placeId = recordMin.getPlaceId(); this.unit = recordMin.getUnit(); + this.transferId = recordMin.getTransferId(); } } diff --git a/src/main/java/com/dreamchaser/depository_manage/service/DepositoryRecordService.java b/src/main/java/com/dreamchaser/depository_manage/service/DepositoryRecordService.java index 5a4e4eb6..0c8f4114 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/DepositoryRecordService.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/DepositoryRecordService.java @@ -438,4 +438,11 @@ public interface DepositoryRecordService { * @return */ boolean judgeApplicationOutRecordStatus(Integer id); + + /** + * 根据主键查询转移记录 + * @param id + * @return + */ + TransferRecord findTransferRecordById(Integer id); } diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java index 1e085f88..0f8d2de4 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java @@ -1980,6 +1980,16 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { } } + /** + * 根据主键查询转移记录 + * @param id + * @return + */ + @Override + public TransferRecord findTransferRecordById(Integer id) { + return transferRecordMapper.findTransferRecordById(id); + } + /** * 转移申请 * diff --git a/src/main/resources/templates/pages/application/application-transfer.html b/src/main/resources/templates/pages/application/application-transfer.html index 985cee7d..e762cc56 100644 --- a/src/main/resources/templates/pages/application/application-transfer.html +++ b/src/main/resources/templates/pages/application/application-transfer.html @@ -418,7 +418,7 @@ req.qrCode = result; req.codeFlag = 1; $.ajax({ - url: "/material/qywxApplicationTransferScanBarCode", + url: "/material/qywxApplicationOutScanBarCode", type: "post", dataType: 'json', data: JSON.stringify(req), @@ -513,7 +513,7 @@ req.qrCode = result; req.codeFlag = 2; $.ajax({ - url: "/material/qywxApplicationTransferScanQrCode", + url: "/material/qywxApplicationOutScanQrCode", type: "post", dataType: 'json', data: JSON.stringify(req), diff --git a/src/main/resources/templates/pages/application/form-step-look_back.html b/src/main/resources/templates/pages/application/form-step-look_back.html index e20ab07c..3595d0d8 100644 --- a/src/main/resources/templates/pages/application/form-step-look_back.html +++ b/src/main/resources/templates/pages/application/form-step-look_back.html @@ -36,6 +36,10 @@ + + 是否为转移申请 + 外芯仓库 + 仓库名称 外芯仓库 diff --git a/src/main/resources/templates/pages/application/form-step-look_minRecordOut.html b/src/main/resources/templates/pages/application/form-step-look_minRecordOut.html index 9bbd65a0..60a371a5 100644 --- a/src/main/resources/templates/pages/application/form-step-look_minRecordOut.html +++ b/src/main/resources/templates/pages/application/form-step-look_minRecordOut.html @@ -62,10 +62,16 @@ 库位编码 外芯仓库 + + 转入位置 + 2016-11-28 + + 出库人员 2016-11-28 +