From 3e07a83f45550c24e9ebed12935caf55a108e2df Mon Sep 17 00:00:00 2001 From: erdanergou Date: Wed, 28 Dec 2022 16:31:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=93=E5=AD=98=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DepositoryRecordController.java | 11 +++++- .../controller/MaterialController.java | 4 ++ .../depository_manage/pojo/InventoryP.java | 5 ++- .../service/impl/MaterialServiceImpl.java | 6 +-- .../pages/application/application_multi.html | 31 +++++++++++---- .../pages/depository/table-stock.html | 39 ++++++++++++++++--- .../pages/application/application_multi.html | 31 +++++++++++---- .../pages/depository/table-stock.html | 39 ++++++++++++++++--- 8 files changed, 136 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java index f14a6d2d..33da719f 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java @@ -941,7 +941,16 @@ public class DepositoryRecordController { String type = (String) map.get("type"); Integer success = 0; if ("in".equals(type)) { - success += depositoryRecordService.applicationInPlace(map); + String unit = (String)(map.get("unit")); + if (!"-1".equals(unit)) { + map.put("type","in"); + Integer addSplitInventory = splitUnitService.addSplitInventory(map); + if (addSplitInventory != -1) { + success += addSplitInventory; + } + } else { + success += depositoryRecordService.applicationInPlace(map); + } } else if ("out".equals(type)) { // 获取部门负责人 List departmentHeadByUsers = LinkInterfaceUtil.findDepartmentHeadByUser(userToken); 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 268e0f63..eb2c3216 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java @@ -173,6 +173,10 @@ public class MaterialController { list.addAll(inventory); total += materialService.findInventoryCount(map); } + for (InventoryP inventoryP :list + ) { + inventoryP.setSplitInfoList(splitUnitService.findSplitInfoByMid(inventoryP.getMid())); + } return new RestResponse(list, total, 200); } diff --git a/src/main/java/com/dreamchaser/depository_manage/pojo/InventoryP.java b/src/main/java/com/dreamchaser/depository_manage/pojo/InventoryP.java index 4146b49a..26414d8f 100644 --- a/src/main/java/com/dreamchaser/depository_manage/pojo/InventoryP.java +++ b/src/main/java/com/dreamchaser/depository_manage/pojo/InventoryP.java @@ -7,6 +7,7 @@ import com.dreamchaser.depository_manage.entity.SplitInfo; import lombok.Data; import java.util.List; +import java.util.Map; @Data public class InventoryP { @@ -175,7 +176,9 @@ public class InventoryP { /** * 用于展示的数量 */ - private String showQuantity; + private Map showQuantity; + + diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java index 270a2479..7987981f 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java @@ -678,10 +678,8 @@ public class MaterialServiceImpl implements MaterialService { // 设置新总额 m.setAmounts(m.getAmounts() + amounts); // 获取当前各拆单信息对应的库存 - for (Map.Entry entry : splitInventoryForUnit.entrySet()) { - showQuantity.append(entry.getKey()).append(":").append(entry.getValue()).append(" "); - } - m.setShowQuantity(showQuantity.toString()); + splitInventoryForUnit.put(inventory.getUnit(),inventory.getQuantity()); + m.setShowQuantity(splitInventoryForUnit); result.add(m); } return result; diff --git a/src/main/resources/templates/pages/application/application_multi.html b/src/main/resources/templates/pages/application/application_multi.html index 86cfb6e8..743eb0ef 100644 --- a/src/main/resources/templates/pages/application/application_multi.html +++ b/src/main/resources/templates/pages/application/application_multi.html @@ -43,10 +43,9 @@ 出库申请 - @@ -89,9 +88,8 @@ {field: 'version', width: 150, title: '规格型号'}, {field: 'code',width: 200,title: '存货编码',sort: true}, {field: 'depositoryName', width: 150, title: '仓库名称'}, - {field: 'placeCode', width: 150, title: '库位编码'}, {field: 'quantity', width: 150, title: '数量',edit:'quantity'}, - {field: 'unit', width: 150, title: '计量单位'}, + {title: '计量单位', width: 200, templet: '#changeUnit', align: "center"}, // {rowspan: 2,title:'计量单位', width: 200, templet: '#selectUnit'}, {field: 'price', width: 150, title: '单价',edit:'price'}, @@ -332,7 +330,26 @@ } - else if(obj.event === 'selectDepository'){ + else if (obj.event === 'changeUnit') { + let splitInfoList = data.splitInfoList; + let btn = $("#btn_"+data.id); + let clickNum = Number(btn.attr("click_num")); + if(splitInfoList.length > 0){ + if(clickNum < splitInfoList.length){ + let newUnit = splitInfoList[clickNum].newUnit; + btn.text(newUnit); + clickNum += 1; + btn.attr("click_num",clickNum); + obj.update({unit:newUnit}) + }else{ + btn.text(data.unit); + obj.update({unit:data.unit}) + btn.attr("click_num",0); + + } + + } + } }); }); diff --git a/src/main/resources/templates/pages/depository/table-stock.html b/src/main/resources/templates/pages/depository/table-stock.html index 925ff428..d78e53a9 100644 --- a/src/main/resources/templates/pages/depository/table-stock.html +++ b/src/main/resources/templates/pages/depository/table-stock.html @@ -69,9 +69,9 @@ 出库申请 - - @@ -79,6 +79,7 @@ - @@ -89,9 +88,8 @@ {field: 'version', width: 150, title: '规格型号'}, {field: 'code',width: 200,title: '存货编码',sort: true}, {field: 'depositoryName', width: 150, title: '仓库名称'}, - {field: 'placeCode', width: 150, title: '库位编码'}, {field: 'quantity', width: 150, title: '数量',edit:'quantity'}, - {field: 'unit', width: 150, title: '计量单位'}, + {title: '计量单位', width: 200, templet: '#changeUnit', align: "center"}, // {rowspan: 2,title:'计量单位', width: 200, templet: '#selectUnit'}, {field: 'price', width: 150, title: '单价',edit:'price'}, @@ -332,7 +330,26 @@ } - else if(obj.event === 'selectDepository'){ + else if (obj.event === 'changeUnit') { + let splitInfoList = data.splitInfoList; + let btn = $("#btn_"+data.id); + let clickNum = Number(btn.attr("click_num")); + if(splitInfoList.length > 0){ + if(clickNum < splitInfoList.length){ + let newUnit = splitInfoList[clickNum].newUnit; + btn.text(newUnit); + clickNum += 1; + btn.attr("click_num",clickNum); + obj.update({unit:newUnit}) + }else{ + btn.text(data.unit); + obj.update({unit:data.unit}) + btn.attr("click_num",0); + + } + + } + } }); }); diff --git a/target/classes/templates/pages/depository/table-stock.html b/target/classes/templates/pages/depository/table-stock.html index 925ff428..d78e53a9 100644 --- a/target/classes/templates/pages/depository/table-stock.html +++ b/target/classes/templates/pages/depository/table-stock.html @@ -69,9 +69,9 @@ 出库申请 - - @@ -79,6 +79,7 @@