From 00e84033e9f527e3d68b7aae1945a52629b9462d Mon Sep 17 00:00:00 2001 From: erdanergou Date: Sun, 25 Jun 2023 08:39:17 +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=E9=80=89=E6=8B=A9=E5=90=8E=E4=BB=93=E5=BA=93=E5=8F=AF?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E9=80=89=E6=8B=A9=E4=B8=BA=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E7=9A=84=E4=BB=93=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/MaterialController.java | 13 +++++++++---- .../pages/application/application-out.html | 6 +++++- .../application-out.html | 6 +++++- .../application-out_admin.html | 5 ++++- 4 files changed, 23 insertions(+), 7 deletions(-) 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 11496fb4..31574052 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java @@ -310,7 +310,7 @@ public class MaterialController { * @return */ @GetMapping("/findMatrialById") - public RestResponse findMatrialById(@RequestParam(value = "mid", required = false) String mid, @RequestParam(value = "type", required = false) String type, HttpServletRequest request) { + public RestResponse findMaterialById(@RequestParam(value = "mid", required = false) String mid, @RequestParam(value = "type", required = false) String type, HttpServletRequest request) { String token = request.getHeader("user-token"); if (token == null) { token = (String) request.getSession().getAttribute("userToken"); @@ -323,9 +323,9 @@ public class MaterialController { Material materialById = materialService.findMaterialById(ObjectFormatUtil.toInteger(mid)); String mcode = materialById.getCode(); - + Inventory inventoryById = null; if ("out".equals(type)) { - Inventory inventoryById = materialService.findInventoryById(ObjectFormatUtil.toInteger(mid)); + inventoryById = materialService.findInventoryById(ObjectFormatUtil.toInteger(mid)); mcode = inventoryById.getCode(); } List placePList = new ArrayList<>(); @@ -350,7 +350,12 @@ public class MaterialController { } tempDepositoryID = (List) CollectionUtils.union(depositoryIdList, tempDepositoryID); List depositoryByIds = depositoryService.findDepositoryByIds(tempDepositoryID); - InventoryP materialP = inventoryPS.get(0); + InventoryP materialP = null; + if (inventoryById != null) { + materialP = new InventoryP(inventoryById); + } else { + materialP = inventoryPS.get(0); + } materialP.setMaterialAndBarCodeList(materialByBarCodeByCondition); List splitInfoByMid = splitUnitService.findSplitInfoByMid(materialP.getMid()); materialP.setSplitInfoList(splitInfoByMid); diff --git a/src/main/resources/templates/pages/application/application-out.html b/src/main/resources/templates/pages/application/application-out.html index 66492234..eed5d779 100644 --- a/src/main/resources/templates/pages/application/application-out.html +++ b/src/main/resources/templates/pages/application/application-out.html @@ -1181,11 +1181,15 @@ } } if (depositoryDisplay !== "none") { + let inventoryInDepositoryId = material.depositoryId; $("#showDepository" + idNumber).empty(); let depositoryList = material.depositoryList; if (depositoryList !== null) { for (let i = 0; i < depositoryList.length; i++) { - $("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id)); + let depositoryListElement = depositoryList[i]; + let defaultSelect = false; + defaultSelect = inventoryInDepositoryId !== null && depositoryListElement.id === inventoryInDepositoryId; + $("#showDepository" + idNumber).append(new Option(depositoryListElement.dname, depositoryListElement.id,defaultSelect,defaultSelect)); } } } diff --git a/src/main/resources/templates/pages/applicationForStorageCenter/application-out.html b/src/main/resources/templates/pages/applicationForStorageCenter/application-out.html index d41499fb..1e0a6766 100644 --- a/src/main/resources/templates/pages/applicationForStorageCenter/application-out.html +++ b/src/main/resources/templates/pages/applicationForStorageCenter/application-out.html @@ -1296,11 +1296,15 @@ } } if (depositoryDisplay !== "none") { + let inventoryInDepositoryId = material.depositoryId; $("#showDepository" + idNumber).empty(); let depositoryList = material.depositoryList; if (depositoryList !== null) { for (let i = 0; i < depositoryList.length; i++) { - $("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id)); + let depositoryListElement = depositoryList[i]; + let defaultSelect = false; + defaultSelect = inventoryInDepositoryId !== null && depositoryListElement.id === inventoryInDepositoryId; + $("#showDepository" + idNumber).append(new Option(depositoryListElement.dname, depositoryListElement.id,defaultSelect,defaultSelect)); } } } diff --git a/src/main/resources/templates/pages/applicationForStorageCenter/application-out_admin.html b/src/main/resources/templates/pages/applicationForStorageCenter/application-out_admin.html index 9181f7cf..f5ff12c4 100644 --- a/src/main/resources/templates/pages/applicationForStorageCenter/application-out_admin.html +++ b/src/main/resources/templates/pages/applicationForStorageCenter/application-out_admin.html @@ -1204,7 +1204,10 @@ let depositoryList = material.depositoryList; if (depositoryList !== null) { for (let i = 0; i < depositoryList.length; i++) { - $("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id)); + let depositoryListElement = depositoryList[i]; + let defaultSelect = false; + defaultSelect = inventoryInDepositoryId !== null && depositoryListElement.id === inventoryInDepositoryId; + $("#showDepository" + idNumber).append(new Option(depositoryListElement.dname, depositoryListElement.id,defaultSelect,defaultSelect)); } } }