From 39078e5dbd1ef3bbe2fad1b5bd1fb2ac41e483f8 Mon Sep 17 00:00:00 2001 From: erdanergou Date: Fri, 17 Mar 2023 14:29:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=85=A5=E5=BA=93=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/DepositoryRecordServiceImpl.java | 4 +- .../service/impl/GroupServiceImpl.java | 27 +-- .../service/impl/MaterialServiceImpl.java | 30 +--- .../pages/application/application-in.html | 8 +- .../pages/application/application-in.html | 8 +- .../templates/pages/split/split_add.html | 157 ++++++++++-------- 6 files changed, 125 insertions(+), 109 deletions(-) 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 b125fbce..d88652ef 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 @@ -2631,13 +2631,13 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { if (mproducedDate == null) { mproducedDate = 0L; } - Integer newMid = updateOrInsertInventory(paramForUpdateInventory, materialByCondition, (double) recordP.getQuantity(), materialById.getId(), recordP.getDepositoryId(), mproducedDate); + Integer newMid = updateOrInsertInventory(paramForUpdateInventory, materialByCondition, (double) recordP.getQuantity() / 100, materialById.getId(), recordP.getDepositoryId(), mproducedDate); // 修改库位库存 paramForUpdateInventory.put("newInMid", newMid); paramForUpdateInventory.put("id", recordP.getId()); paramForUpdateInventory.put("producedDate", recordP.getMproducedDate()); Place placeById = placeMapper.findPlaceById(recordP.getPlaceId()); - updateInventoryInfoForApproval(paramForUpdateInventory, recordP.getQuantity(), materialById, placeById); + updateInventoryInfoForApproval(paramForUpdateInventory, recordP.getQuantity() / 100, materialById, placeById); } else { // 如果是拆单单位 diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/GroupServiceImpl.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/GroupServiceImpl.java index 23ea2b32..b9b9ee42 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/GroupServiceImpl.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/GroupServiceImpl.java @@ -507,7 +507,7 @@ public class GroupServiceImpl implements GroupService { // 定义开启线程数目 int openThreadSize = 0; - if(threadSize == 0){ + if (threadSize == 0) { return list; } // 开启对应数量的线程 @@ -841,14 +841,6 @@ public class GroupServiceImpl implements GroupService { // 获取入库的仓库 Integer depositoryId = ObjectFormatUtil.toInteger(map.get("depositoryId")); -// List depositoryIdForIn = roleMapper.findRoleAndDepositoryByDepositoryIdForIn(depositoryId); - - // 用于标志该仓库是否需要进行审批 - boolean flagForApproval = false; // 默认不需要 -// if (depositoryIdForIn.size() > 0) { -// flagForApproval = true; // 需要 -// } - map.put("flagForApproval", flagForApproval); // 定义参数用与入库 Map insertForApplicationInRecord = new HashMap<>(); @@ -856,7 +848,7 @@ public class GroupServiceImpl implements GroupService { insertForApplicationInRecord.put("applicantId", userToken.getId()); // 获取当前入库的组合数量 - Integer quantityForGroup = ObjectFormatUtil.toInteger(map.get("quantity")); + Double quantityForGroup = ObjectFormatUtil.toDouble(map.get("quantity")); // 获取要出库的组合 Integer gid = ObjectFormatUtil.toInteger(map.get("gid")); @@ -872,9 +864,21 @@ public class GroupServiceImpl implements GroupService { insertForApplicationInRecord.put("placeId", placeId); insertForApplicationInRecord.put("applyRemark", map.get("applyRemark")); + // 用于标志该是否需要进行审批 + boolean flagForApproval = false; // 默认不需要 // 循环当前组合信息 for (GroupInfo groupInfo : groupInfoByGid) { + + // 获取当前类型是否有用户进行管理入库审批 + Map paramForMtRole = new HashMap<>(); + paramForMtRole.put("mtid", groupInfo.getMtid()); + List roleAndMaterials = roleMapper.findRoleAndMaterialTypeByCondition(paramForMtRole); + + if (roleAndMaterials.size() > 0 ) { + flagForApproval = true; // 需要 + } + // 获取当前组合记录中的单位 String unit = groupInfo.getUnit(); insertForApplicationInRecord.put("mid", groupInfo.getMid()); @@ -913,9 +917,10 @@ public class GroupServiceImpl implements GroupService { insertForApplicationInRecord.remove("applicationInId"); } } + map.put("flagForApproval", flagForApproval); insertForApplicationInRecord.remove("toGroupId"); insertForApplicationInRecord.put("flagForGroup", 2); - insertForApplicationInRecord.put("quantity", quantityForGroup.toString()); + insertForApplicationInRecord.put("quantity", quantityForGroup * 100); insertForApplicationInRecord.put("mid", gid); insertForApplicationInRecord.put("unit", -1); Depository depository = depositoryMapper.findDepositoryById(depositoryId); 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 45c4cde4..b228df60 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 @@ -219,26 +219,6 @@ public class MaterialServiceImpl implements MaterialService { } else { material.setPrice(0.0); } - material.setAmounts(material.getPrice() * material.getQuantity()); - // 获取当前物料所处仓库 - Integer depositoryId = material.getDepositoryId(); - // 获取当前物料所处库位 - - StringBuilder placeCode = new StringBuilder(); - if (depositoryId != null) { - Integer mid = material.getId(); - List placeByMidAndDid = placeService.findPlaceByMidAndDid(mid, depositoryId); - for (int j = 0; j < placeByMidAndDid.size(); j++) { - placeCode.append(placeByMidAndDid.get(j).getCode()).append(" "); - } - } - - if (depositoryId != null) { - Depository depositoryRecordById = depositoryMapper.findDepositoryById(depositoryId); - String code = depositoryRecordById.getCode(); - material.setDepositoryCode(code); - } - material.setPlaceCode(placeCode.toString()); } return packForMatieral(list); } @@ -894,11 +874,11 @@ public class MaterialServiceImpl implements MaterialService { splitInfoByMid = new ArrayList<>(); } - Map paramByBarcode = new HashMap<>(); - paramByBarcode.put("mcode", m.getCode()); - paramByBarcode.put("codeFlag", 1); - List materialByBarCodeByCondition = materialMapper.findMaterialByBarCodeByCondition(paramByBarcode); - m.setMaterialAndBarCodeList(materialByBarCodeByCondition); +// Map paramByBarcode = new HashMap<>(); +// paramByBarcode.put("mcode", m.getCode()); +// paramByBarcode.put("codeFlag", 1); +// List materialByBarCodeByCondition = materialMapper.findMaterialByBarCodeByCondition(paramByBarcode); +// m.setMaterialAndBarCodeList(materialByBarCodeByCondition); m.setSplitInfoList(splitInfoByMid); MaterialType materialTypeByOldId = materialTypeMapper.findMaterialTypeByOldId(material.getMaterialTypeId()); m.setTypeName(materialTypeByOldId.getTname()); diff --git a/src/main/resources/templates/pages/application/application-in.html b/src/main/resources/templates/pages/application/application-in.html index 580ddbb8..893b1576 100644 --- a/src/main/resources/templates/pages/application/application-in.html +++ b/src/main/resources/templates/pages/application/application-in.html @@ -473,7 +473,9 @@ if (data.status >= 300) { var d = data.data; if (d === "") { - layer.msg(data.statusInfo.detail); + layer.msg(data.statusInfo.detail,{icon:0,time:500},function () { + flagForForm = false; + }); } else { var err = d["err"]; var success = d["success"]; @@ -531,7 +533,9 @@ success: function (d) { layer.close(this.layerIndex); if (d.status >= 300) { - layer.msg(d.statusInfo.detail);//失败的表情 + layer.msg(d.statusInfo.detail,{icon:5,time:1000},function() { + GroupflagForForm = false; + });//失败的表情 } else { layer.msg("申请提交成功", { diff --git a/target/classes/templates/pages/application/application-in.html b/target/classes/templates/pages/application/application-in.html index 580ddbb8..893b1576 100644 --- a/target/classes/templates/pages/application/application-in.html +++ b/target/classes/templates/pages/application/application-in.html @@ -473,7 +473,9 @@ if (data.status >= 300) { var d = data.data; if (d === "") { - layer.msg(data.statusInfo.detail); + layer.msg(data.statusInfo.detail,{icon:0,time:500},function () { + flagForForm = false; + }); } else { var err = d["err"]; var success = d["success"]; @@ -531,7 +533,9 @@ success: function (d) { layer.close(this.layerIndex); if (d.status >= 300) { - layer.msg(d.statusInfo.detail);//失败的表情 + layer.msg(d.statusInfo.detail,{icon:5,time:1000},function() { + GroupflagForForm = false; + });//失败的表情 } else { layer.msg("申请提交成功", { diff --git a/target/classes/templates/pages/split/split_add.html b/target/classes/templates/pages/split/split_add.html index f3bedc21..abfb0ed6 100644 --- a/target/classes/templates/pages/split/split_add.html +++ b/target/classes/templates/pages/split/split_add.html @@ -236,6 +236,7 @@ data = data.split(",")[0]; if(data !== ""){ req.mname = data; + let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); let materialId = $("#mid"); let codeValue = $("#code"); let version = $("#version"); @@ -249,21 +250,27 @@ contentType: "application/json;charset=utf-8", success: function (d) { if (d.count > 1) { - layer.msg("请点击右侧搜索确定物品"); - materialId.val(""); - codeValue.val(""); - version.val(""); - typeName.val(""); - unit.empty(); + layer.msg("请点击右侧搜索确定物品",{icon:0,time:500},function () { + materialId.val(""); + codeValue.val(""); + version.val(""); + typeName.val(""); + unit.empty(); + layer.close(loading2); + }); + return false; } else if (d.count === 0) { - layer.msg("没有该物品,请确认输入是否正确"); - materialId.val(""); - codeValue.val(""); - materialName.val(""); - version.val(""); - typeName.val(""); - unit.empty(); + layer.msg("没有该物品,请确认输入是否正确",{icon:0,time:500},function () { + materialId.val(""); + codeValue.val(""); + materialName.val(""); + version.val(""); + typeName.val(""); + unit.empty(); + layer.close(loading2); + }); + return false; } else { var material = d.data[0]; @@ -292,6 +299,7 @@ } else { $("#barCode").empty(); } + layer.close(loading2); } } }); @@ -323,6 +331,7 @@ end: function () { var mid = $("#mid").val(); if (mid !== '') { + let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); $.ajax({ url: "/material/findMatrialById?mid=" + mid, type: "get", @@ -349,7 +358,7 @@ if (materialAndBarCodeList !== null && materialAndBarCodeList.length > 0) { // 如果有对应的条形码 - $("#barCode").empty() + $("#barCode").empty(); $.each(materialAndBarCodeList, function (index, item) { $("#barCode").append(new Option(item.bmcode, item.id));//往下拉菜单里添加元素 }); @@ -358,6 +367,7 @@ $("#barCode").empty(); } + layer.close(loading2); } }); } @@ -385,6 +395,8 @@ var req = {}; req.qrCode = result; req.codeFlag = 2; + let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); + $.ajax({ url: "/material/qywxApplicationInScanQrCode", type: "post", @@ -406,6 +418,7 @@ $("#version").val(""); $("#barCode").empty(); $("#unit").empty(); + layer.close(loading2); }) } else { // 如果有对应关系 @@ -441,6 +454,7 @@ unit.append(new Option(unitList[i].newUnit, unitList[i].newUnit)); } form.render(); + layer.close(loading2); } } @@ -470,6 +484,7 @@ let barCode = $("#barCode"); barCode.empty(); barCode.append(new Option(result, result)); + let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); $.ajax({ url: "/material/qywxApplicationInScanBarCode", type: "post", @@ -494,7 +509,7 @@ }); } form.render(); - + layer.close(loading2); } else { @@ -509,6 +524,7 @@ $("#version").val(""); unit.empty(); $("#barCode").empty(); + layer.close(loading2); }) } @@ -533,64 +549,71 @@ var req = {}; req.code = code; req.type = "in"; - $.ajax({ - url: "/material/findMatrialByCode", - type: "get", - dataType: 'json', - data: req, - contentType: "application/json;charset=utf-8", - success: function (d) { - var d = d.data; - if (d == null) { - layer.msg("没有该编码,请确认是否输入正确"); - $("#mname").val(""); - $("#mid").val(""); - $("#code").val(""); - $("#barCode").val(""); - $("#version").val(""); - $("#unit").empty(); - $("#typeName").val(""); - form.render(); - - } else { - $("#mname").val(d.mname); - $("#mid").val(d.mid); - $("#version").val(d.version); - $("#unit").empty(); - $('#unit').append(new Option(d.unit, d.unit)); - var splitInfoList = d["splitInfoList"]; - $.each(splitInfoList, function (index, item) { - $("#unit").append(new Option(item.newUnit, item.newUnit));//往下拉菜单里添加元素 - }); - form.render(); - $("#typeName").val(d.typeName); - // 获取物料与条形码的对应关系 - var materialAndBarCodeList = d["materialAndBarCodeList"]; - if (materialAndBarCodeList !== null && materialAndBarCodeList.length > 0) { - // 如果有对应的条形码 - $("#barCode").remove(); - $(".layui-unselect").remove(); - var barCodeSelect = ` - `; - $("#barCodeImg").before(barCodeSelect); + if(code !== ""){ + let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); + $.ajax({ + url: "/material/findMatrialByCode", + type: "get", + dataType: 'json', + data: req, + contentType: "application/json;charset=utf-8", + success: function (d) { + var d = d.data; + if (d == null) { + layer.msg("没有该编码,请确认是否输入正确",{icon:0,time:500},function () { + $("#mname").val(""); + $("#mid").val(""); + $("#code").val(""); + $("#barCode").val(""); + $("#version").val(""); + $("#unit").empty(); + $("#typeName").val(""); + form.render(); + layer.close(loading2); + }); - form.render(); - $.each(materialAndBarCodeList, function (index, item) { - $("#barCode").append(new Option(item.bmcode, item.bmcode));//往下拉菜单里添加元素 + + } else { + $("#mname").val(d.mname); + $("#mid").val(d.mid); + $("#version").val(d.version); + $("#unit").empty(); + $('#unit').append(new Option(d.unit, d.unit)); + var splitInfoList = d["splitInfoList"]; + $.each(splitInfoList, function (index, item) { + $("#unit").append(new Option(item.newUnit, item.newUnit));//往下拉菜单里添加元素 }); form.render(); - } else { - let children = $("#barCode").parent().children(); - if (children.length > 2) { - $("#barCode").empty(); - $(children[1]).empty(); + $("#typeName").val(d.typeName); + // 获取物料与条形码的对应关系 + var materialAndBarCodeList = d["materialAndBarCodeList"]; + if (materialAndBarCodeList !== null && materialAndBarCodeList.length > 0) { + // 如果有对应的条形码 + $("#barCode").remove(); + $(".layui-unselect").remove(); + var barCodeSelect = ` + `; + $("#barCodeImg").before(barCodeSelect); + + form.render(); + $.each(materialAndBarCodeList, function (index, item) { + $("#barCode").append(new Option(item.bmcode, item.bmcode));//往下拉菜单里添加元素 + }); + form.render(); + } else { + let children = $("#barCode").parent().children(); + if (children.length > 2) { + $("#barCode").empty(); + $(children[1]).empty(); + } } + layer.close(loading2); } - } - } - }); + }); + + } };