From 49b6af1257770124993bd3d3062e8da4f4c612a7 Mon Sep 17 00:00:00 2001 From: erdanergou Date: Tue, 21 Feb 2023 13:48:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E5=85=A5=E5=BA=93=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E5=A4=84=E7=90=86=E6=8A=BD=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/DepositoryRecordServiceImpl.java | 4 +- .../pages/application/application-in.html | 198 +++++++++--------- .../application/application-in_back.html | 39 ++-- .../application-in_scanQrCode.html | 111 +++++----- .../pages/application/application-out.html | 186 ++++++++-------- .../application/application-out_back.html | 53 ++--- .../application-out_scanQrCode.html | 71 ++++--- .../application/application-transfer.html | 125 +++++------ .../application-transfer_back.html | 69 +++--- .../depository_manage/TestOther.java | 6 +- 10 files changed, 449 insertions(+), 413 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 b914dab8..a178c7cc 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 @@ -107,7 +107,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { @Transactional(rollbackFor = Exception.class) public Integer applicationIn(Map map) { Boolean flagForApproval = ObjectFormatUtil.toBoolean(map.get("flagForApproval")); - Integer depositoryId = ObjectFormatUtil.toInteger(map.get("depositoryId")); Depository depositoryRecordById = depositoryMapper.findDepositoryById(depositoryId); Map temp = new HashMap<>(); @@ -666,6 +665,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { Integer result = updateInventoryInfoForApproval(map, quantity, materialById, placeById); map.remove("applicationInId"); return result; + }else{ + map.put("applicationInId",map.get("id")); + map.remove("id"); } return integer; } else { diff --git a/src/main/resources/templates/pages/application/application-in.html b/src/main/resources/templates/pages/application/application-in.html index 8c3fdad0..3cf4a793 100644 --- a/src/main/resources/templates/pages/application/application-in.html +++ b/src/main/resources/templates/pages/application/application-in.html @@ -699,73 +699,76 @@ 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; - var idNumber = materialId.name.split("mid")[1]; - if (d == null) { - layer.msg("没有该编码,请确认是否输入正确"); - materialName.value = ""; - materialId.value = ""; - obj.value = ""; - $("#barCode" + idNumber).empty(); - $("#unit" + idNumber).empty(); - form.render(); + if(code !== ""){ + $.ajax({ + url: "/material/findMatrialByCode", + type: "get", + dataType: 'json', + data: req, + contentType: "application/json;charset=utf-8", + success: function (d) { + var d = d.data; + var idNumber = materialId.name.split("mid")[1]; + if (d == null) { + layer.msg("没有该编码,请确认是否输入正确"); + materialName.value = ""; + materialId.value = ""; + obj.value = ""; + $("#barCode" + idNumber).empty(); + $("#unit" + idNumber).empty(); + form.render(); - } else { - materialName.value = d.mname; - materialId.value = d.mid; - // 获取物料与条形码的对应关系 - var materialAndBarCodeList = d["materialAndBarCodeList"]; - var barCode = $("#barCode" + idNumber); - if (barCode.length > 0) { - barCode.empty(); - } - var unit = $("#unit" + idNumber); - unit.empty(); - $("#unit" + idNumber).append(new Option(d.baseUnit, "-1")); - var unitList = d["splitInfoList"]; - for (let i = 0; i < unitList.length; i++) { - $("#unit" + idNumber).append(new Option(unitList[i].newUnit, unitList[i].newUnit)); - } - form.render(); - if (materialAndBarCodeList.length > 0) { - // 如果有对应的条形码 - var barCodeImg = barCodeItem.childNodes[1].childNodes[3]; - var barCodeInput = barCodeItem.childNodes[1].childNodes[1]; - var id = barCodeInput.id; - $("#" + id).remove(); + } else { + materialName.value = d.mname; + materialId.value = d.mid; + // 获取物料与条形码的对应关系 + var materialAndBarCodeList = d["materialAndBarCodeList"]; var barCode = $("#barCode" + idNumber); if (barCode.length > 0) { barCode.empty(); - } else { - var barCodeSelect = ` - `; - $("#" + barCodeImg.id).before(barCodeSelect); + } + var unit = $("#unit" + idNumber); + unit.empty(); + $("#unit" + idNumber).append(new Option(d.baseUnit, "-1")); + var unitList = d["splitInfoList"]; + for (let i = 0; i < unitList.length; i++) { + $("#unit" + idNumber).append(new Option(unitList[i].newUnit, unitList[i].newUnit)); } form.render(); + if (materialAndBarCodeList.length > 0) { + // 如果有对应的条形码 + var barCodeImg = barCodeItem.childNodes[1].childNodes[3]; + var barCodeInput = barCodeItem.childNodes[1].childNodes[1]; + var id = barCodeInput.id; + $("#" + id).remove(); + var barCode = $("#barCode" + idNumber); + if (barCode.length > 0) { + barCode.empty(); + } else { + var barCodeSelect = ` + `; + $("#" + barCodeImg.id).before(barCodeSelect); + } + form.render(); - $.each(materialAndBarCodeList, function (index, item) { - $("#barCode" + idNumber).append(new Option(item.bmcode, item.bmcode));//往下拉菜单里添加元素 - }); - form.render(); - } - var shelfLife = d.shelfLife; - if (shelfLife !== null && shelfLife !== undefined) { - $("#" + "producedDateItem" + idNumber).show(); - $("#" + "producedDate" + idNumber).attr("lay-verify", "required"); - } else { - $("#" + "producedDateItem" + idNumber).hide(); + $.each(materialAndBarCodeList, function (index, item) { + $("#barCode" + idNumber).append(new Option(item.bmcode, item.bmcode));//往下拉菜单里添加元素 + }); + form.render(); + } + var shelfLife = d.shelfLife; + if (shelfLife !== null && shelfLife !== undefined) { + $("#" + "producedDateItem" + idNumber).show(); + $("#" + "producedDate" + idNumber).attr("lay-verify", "required"); + } else { + $("#" + "producedDateItem" + idNumber).hide(); + } } } - } - }); + }); + } + }; // 用于实现点击搜索按钮 @@ -1255,50 +1258,53 @@ // gname let gnameItem = gnameParent.childNodes[1].childNodes[1]; let req = {}; - req.code = code; - $.ajax({ - url: "/group/findGroupByCodeForIn", - type: "post", - dataType: 'json', - data: JSON.stringify(req), - contentType: "application/json;charset=utf-8", - success: function (d) { - var data = d.data; - if (data === null) { - layer.msg(d.statusInfo.detail, { - icon: 0, - time: 1500 - }, function () { - obj.value = ''; - gidItem.value = ''; - gnameItem.value = ''; + if(code !== ""){ + req.code = code; + $.ajax({ + url: "/group/findGroupByCodeForIn", + type: "post", + dataType: 'json', + data: JSON.stringify(req), + contentType: "application/json;charset=utf-8", + success: function (d) { + var data = d.data; + if (data === null) { + layer.msg(d.statusInfo.detail, { + icon: 0, + time: 1500 + }, function () { + obj.value = ''; + gidItem.value = ''; + gnameItem.value = ''; + let childNodes = parent.childNodes; + for (let i = 0; i < childNodes.length; i++) { + if (childNodes[i].className === "layui-collapse") { + childNodes[i].remove() + } + } + }) + } else { let childNodes = parent.childNodes; - for (let i = 0; i < childNodes.length; i++) { - if (childNodes[i].className === "layui-collapse") { - childNodes[i].remove() + if (childNodes.length > 9) { + for (let i = 0; i < childNodes.length; i++) { + if (childNodes[i].className === "layui-collapse") { + childNodes[i].remove() + } } } - }) - } else { - let childNodes = parent.childNodes; - if (childNodes.length > 9) { - for (let i = 0; i < childNodes.length; i++) { - if (childNodes[i].className === "layui-collapse") { - childNodes[i].remove() - } + // 赋值给gname + gnameItem.value = data[0].gname; + gidItem.value = data[0].gid; + for (let i = 0; i < data.length; i++) { + CoverpageForGroup(pid, data[i]); } - } - // 赋值给gname - gnameItem.value = data[0].gname; - gidItem.value = data[0].gid; - for (let i = 0; i < data.length; i++) { - CoverpageForGroup(pid, data[i]); - } - element.init(); + element.init(); + } } - } - }); + }); + } + }; // 用于实现点击搜索按钮(组合) diff --git a/src/main/resources/templates/pages/application/application-in_back.html b/src/main/resources/templates/pages/application/application-in_back.html index a3999d8f..242de9f4 100644 --- a/src/main/resources/templates/pages/application/application-in_back.html +++ b/src/main/resources/templates/pages/application/application-in_back.html @@ -158,25 +158,28 @@ 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("没有该编码,请确认是否输入正确"); - $("#openSonByMaterial").val(""); - $("#mid").val(""); - $("#code").val(""); - }else{ - $("#openSonByMaterial").val(d.mname); - $("#mid").val(d.id); + if(code !== ""){ + $.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("没有该编码,请确认是否输入正确"); + $("#openSonByMaterial").val(""); + $("#mid").val(""); + $("#code").val(""); + }else{ + $("#openSonByMaterial").val(d.mname); + $("#mid").val(d.id); + } } - } - }); + }); + } + }); $("#openSonByMaterial").blur(function () { diff --git a/src/main/resources/templates/pages/application/application-in_scanQrCode.html b/src/main/resources/templates/pages/application/application-in_scanQrCode.html index 84d93a45..2441b01a 100644 --- a/src/main/resources/templates/pages/application/application-in_scanQrCode.html +++ b/src/main/resources/templates/pages/application/application-in_scanQrCode.html @@ -611,66 +611,69 @@ 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; - var idNumber = materialId.name.split("mid")[1]; - if (d == null) { - layer.msg("没有该编码,请确认是否输入正确"); - materialName.value = ""; - materialId.value = ""; - obj.value = ""; - $("#barCode" + idNumber).remove(); - form.render(); - } else { - materialName.value = d.mname; - materialId.value = d.id; - // 获取物料与条形码的对应关系 - var materialAndBarCodeList = d["materialAndBarCodeList"]; - var splitInfoList = d["splitInfoList"]; - let unit = $("#unit" + idNumber); - unit.empty(); - unit.append(new Option(d.unit, "-1")); - $.each(splitInfoList, function (index, item) { - unit.append(new Option(item.newUnit, item.newUnit));//往下拉菜单里添加元素 - }); - form.render(); - if (materialAndBarCodeList.length > 0) { - // 如果有对应的条形码 - var barCodeInput = barCodeItem.childNodes[1].childNodes[1]; - var barCodeImg = barCodeItem.childNodes[1].childNodes[3]; - var id = barCodeInput.id; - $("#" + id).remove(); - $("#barCode" + idNumber).empty(); - var barCode = $("#barCode" + idNumber); - if (barCode.length > 0) { - barCode.empty(); - } else { - var barCodeSelect = ` - `; - $("#" + barCodeImg.id).before(barCodeSelect); - } + if(code !== ""){ + $.ajax({ + url: "/material/findMatrialByCode", + type: "get", + dataType: 'json', + data: req, + contentType: "application/json;charset=utf-8", + success: function (d) { + var d = d.data; + var idNumber = materialId.name.split("mid")[1]; + if (d == null) { + layer.msg("没有该编码,请确认是否输入正确"); + materialName.value = ""; + materialId.value = ""; + obj.value = ""; + $("#barCode" + idNumber).remove(); form.render(); - - $.each(materialAndBarCodeList, function (index, item) { - $("#barCode" + idNumber).append(new Option(item.bmcode, item.id));//往下拉菜单里添加元素 + } else { + materialName.value = d.mname; + materialId.value = d.id; + // 获取物料与条形码的对应关系 + var materialAndBarCodeList = d["materialAndBarCodeList"]; + var splitInfoList = d["splitInfoList"]; + let unit = $("#unit" + idNumber); + unit.empty(); + unit.append(new Option(d.unit, "-1")); + $.each(splitInfoList, function (index, item) { + unit.append(new Option(item.newUnit, item.newUnit));//往下拉菜单里添加元素 }); form.render(); - } else { - var barCode = $("#barCode" + idNumber); - if (barCode.length > 0) { - barCode.empty(); + if (materialAndBarCodeList.length > 0) { + // 如果有对应的条形码 + var barCodeInput = barCodeItem.childNodes[1].childNodes[1]; + var barCodeImg = barCodeItem.childNodes[1].childNodes[3]; + var id = barCodeInput.id; + $("#" + id).remove(); + $("#barCode" + idNumber).empty(); + var barCode = $("#barCode" + idNumber); + if (barCode.length > 0) { + barCode.empty(); + } else { + var barCodeSelect = ` + `; + $("#" + barCodeImg.id).before(barCodeSelect); + } + form.render(); + + $.each(materialAndBarCodeList, function (index, item) { + $("#barCode" + idNumber).append(new Option(item.bmcode, item.id));//往下拉菜单里添加元素 + }); + form.render(); + } else { + var barCode = $("#barCode" + idNumber); + if (barCode.length > 0) { + barCode.empty(); + } } } } - } - }); + }); + } + }; // 用于实现点击搜索按钮 diff --git a/src/main/resources/templates/pages/application/application-out.html b/src/main/resources/templates/pages/application/application-out.html index 428a6739..e380e7d7 100644 --- a/src/main/resources/templates/pages/application/application-out.html +++ b/src/main/resources/templates/pages/application/application-out.html @@ -762,65 +762,68 @@ var req = {}; req.code = code; req.type = "out"; - $.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("仓库中暂无该物料"); - materialName.value = ""; - materialId.value = ""; - obj.value = ""; - $('#place' + objId).empty(); + if(code !== ""){ + $.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("仓库中暂无该物料"); + materialName.value = ""; + materialId.value = ""; + obj.value = ""; + $('#place' + objId).empty(); - } else { - materialName.value = d.mname; - materialId.value = d.id; - var idNumber = materialId.name.split("mid")[1]; - // 获取物料与条形码的对应关系 - var materialAndBarCodeList = d["materialAndBarCodeList"]; - var unit = $("#unit" + idNumber); - unit.empty(); - $("#unit" + idNumber).append(new Option(d.baseUnit, "-1")); - var unitList = d["splitInfoList"]; - for (let i = 0; i < unitList.length; i++) { - $("#unit" + idNumber).append(new Option(unitList[i].newUnit, unitList[i].newUnit)); - } - form.render(); - if (materialAndBarCodeList.length > 0) { - // 如果有对应的条形码 - var barCodeInput = barCodeItem.childNodes[1].childNodes[1]; - var barCodeImg = barCodeItem.childNodes[1].childNodes[3]; - var id = barCodeInput.id; - $("#" + id).remove(); - $("#barCode" + idNumber).empty(); - var barCode = $("#barCode" + idNumber); - if (barCode.length > 0) { - barCode.empty(); - } else { - var barCodeSelect = ` - `; - $("#" + barCodeImg.id).before(barCodeSelect); + } else { + materialName.value = d.mname; + materialId.value = d.id; + var idNumber = materialId.name.split("mid")[1]; + // 获取物料与条形码的对应关系 + var materialAndBarCodeList = d["materialAndBarCodeList"]; + var unit = $("#unit" + idNumber); + unit.empty(); + $("#unit" + idNumber).append(new Option(d.baseUnit, "-1")); + var unitList = d["splitInfoList"]; + for (let i = 0; i < unitList.length; i++) { + $("#unit" + idNumber).append(new Option(unitList[i].newUnit, unitList[i].newUnit)); } form.render(); - $.each(materialAndBarCodeList, function (index, item) { - $("#barCode" + idNumber).append(new Option(item.bmcode, item.id));//往下拉菜单里添加元素 - }); - form.render(); - } else { - var barCode = $("#barCode" + idNumber); - if (barCode.length > 0) { - barCode.empty(); + if (materialAndBarCodeList.length > 0) { + // 如果有对应的条形码 + var barCodeInput = barCodeItem.childNodes[1].childNodes[1]; + var barCodeImg = barCodeItem.childNodes[1].childNodes[3]; + var id = barCodeInput.id; + $("#" + id).remove(); + $("#barCode" + idNumber).empty(); + var barCode = $("#barCode" + idNumber); + if (barCode.length > 0) { + barCode.empty(); + } else { + var barCodeSelect = ` + `; + $("#" + barCodeImg.id).before(barCodeSelect); + } + form.render(); + $.each(materialAndBarCodeList, function (index, item) { + $("#barCode" + idNumber).append(new Option(item.bmcode, item.id));//往下拉菜单里添加元素 + }); + form.render(); + } else { + var barCode = $("#barCode" + idNumber); + if (barCode.length > 0) { + barCode.empty(); + } } } } - } - }); + }); + } + }; // 用于实现通过编码查询组合 @@ -840,49 +843,52 @@ let gnameItem = gnameParent.childNodes[1].childNodes[1]; let req = {}; req.code = code; - $.ajax({ - url: "/group/findGroupByCode", - type: "post", - dataType: 'json', - data: JSON.stringify(req), - contentType: "application/json;charset=utf-8", - success: function (d) { - var data = d.data; - if (data === null) { - layer.msg(d.statusInfo.detail, { - icon: 0, - time: 1500 - },function () { - obj.value = ''; - gidItem.value = ''; - gnameItem.value = ''; + if(code !== ""){ + $.ajax({ + url: "/group/findGroupByCode", + type: "post", + dataType: 'json', + data: JSON.stringify(req), + contentType: "application/json;charset=utf-8", + success: function (d) { + var data = d.data; + if (data === null) { + layer.msg(d.statusInfo.detail, { + icon: 0, + time: 1500 + },function () { + obj.value = ''; + gidItem.value = ''; + gnameItem.value = ''; + let childNodes = parent.childNodes; + for (let i = 0; i < childNodes.length; i++) { + if (childNodes[i].className === "layui-collapse") { + childNodes[i].remove() + } + } + }) + } else { let childNodes = parent.childNodes; - for (let i = 0; i < childNodes.length; i++) { - if (childNodes[i].className === "layui-collapse") { - childNodes[i].remove() + if (childNodes.length > 9) { + for (let i = 0; i < childNodes.length; i++) { + if (childNodes[i].className === "layui-collapse") { + childNodes[i].remove() + } } } - }) - } else { - let childNodes = parent.childNodes; - if (childNodes.length > 9) { - for (let i = 0; i < childNodes.length; i++) { - if (childNodes[i].className === "layui-collapse") { - childNodes[i].remove() - } + // 赋值给gname + gnameItem.value = data[0].gname; + gidItem.value = data[0].gid; + for (let i = 0; i < data.length; i++) { + CoverpageForGroup(pid, data[i]); } - } - // 赋值给gname - gnameItem.value = data[0].gname; - gidItem.value = data[0].gid; - for (let i = 0; i < data.length; i++) { - CoverpageForGroup(pid, data[i]); - } - element.init(); + element.init(); + } } - } - }); + }); + } + }; // 用于实现点击搜索按钮 diff --git a/src/main/resources/templates/pages/application/application-out_back.html b/src/main/resources/templates/pages/application/application-out_back.html index 26d68271..976c40b3 100644 --- a/src/main/resources/templates/pages/application/application-out_back.html +++ b/src/main/resources/templates/pages/application/application-out_back.html @@ -156,32 +156,35 @@ var req = {}; req.code = code; req.type = "out"; - $.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(""); - } else { - req.mid = d.id; - let unitItem = $("#unit"); - unitItem.empty(); - unitItem.append(new Option(d.baseUnit, "-1")); - $.each(d.splitInfoList, function (index, item) { - $("#unit").append(new Option(item.newUnit, item.newUnit)); - }); - $("#mname").val(d.mname); - $("#mid").val(d.id); - form.render(); + if(code !== ""){ + $.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(""); + } else { + req.mid = d.id; + let unitItem = $("#unit"); + unitItem.empty(); + unitItem.append(new Option(d.baseUnit, "-1")); + $.each(d.splitInfoList, function (index, item) { + $("#unit").append(new Option(item.newUnit, item.newUnit)); + }); + $("#mname").val(d.mname); + $("#mid").val(d.id); + form.render(); + } } - } - }) + }) + } + }); $("#mname").blur(function () { diff --git a/src/main/resources/templates/pages/application/application-out_scanQrCode.html b/src/main/resources/templates/pages/application/application-out_scanQrCode.html index 07125385..bbb894a7 100644 --- a/src/main/resources/templates/pages/application/application-out_scanQrCode.html +++ b/src/main/resources/templates/pages/application/application-out_scanQrCode.html @@ -448,42 +448,45 @@ var req = {}; req.code = code; req.type = "out"; - $.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("没有该编码,请确认是否输入正确"); - materialName.value = ""; - materialId.value = ""; - obj.value = ""; - $('#place').empty(); - }else{ - req.mid = d.id; - $.ajax({ - url: "/place/findPlaceByMid", - type: "post", - dataType: 'json', - data:JSON.stringify(req), - contentType: "application/json;charset=utf-8", - success:function (res) { - $('#place').empty(); - $.each(res.data, function (index, item) { - $('#place').append(new Option(item.depositoryName+"-"+item.code, item.id));//往下拉菜单里添加元素 - }); - form.render(); - materialName.value = d.mname; - materialId.value = d.id; - } - }); + if(code !== ""){ + $.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("没有该编码,请确认是否输入正确"); + materialName.value = ""; + materialId.value = ""; + obj.value = ""; + $('#place').empty(); + }else{ + req.mid = d.id; + $.ajax({ + url: "/place/findPlaceByMid", + type: "post", + dataType: 'json', + data:JSON.stringify(req), + contentType: "application/json;charset=utf-8", + success:function (res) { + $('#place').empty(); + $.each(res.data, function (index, item) { + $('#place').append(new Option(item.depositoryName+"-"+item.code, item.id));//往下拉菜单里添加元素 + }); + form.render(); + materialName.value = d.mname; + materialId.value = d.id; + } + }); + } } - } - }); + }); + } + }; // 用于实现点击搜索按钮 diff --git a/src/main/resources/templates/pages/application/application-transfer.html b/src/main/resources/templates/pages/application/application-transfer.html index e762cc56..063037d6 100644 --- a/src/main/resources/templates/pages/application/application-transfer.html +++ b/src/main/resources/templates/pages/application/application-transfer.html @@ -610,78 +610,81 @@ var req = {}; req.code = code; req.type = "out"; - $.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("没有该编码,请确认是否输入正确"); - materialName.value = ""; - materialId.value = ""; - obj.value = ""; - }else{ - req.mid = d.id; - $.ajax({ - url: "/place/findPlaceByMid", - type: "post", - dataType: 'json', - data:JSON.stringify(req), - contentType: "application/json;charset=utf-8", - success:function (res) { - var idNumber = materialId.name.split("mid")[1]; - // 获取物料与条形码的对应关系 - var materialAndBarCodeList = d["materialAndBarCodeList"]; - var barCode = $("#barCode" + idNumber); - if (barCode.length > 0) { - barCode.empty(); - } - var unit = $("#unit" + idNumber); - unit.empty(); - $("#unit" + idNumber).append(new Option(d.baseUnit, "-1")); - var unitList = d["splitInfoList"]; - for (let i = 0; i < unitList.length; i++) { - $("#unit" + idNumber).append(new Option(unitList[i].newUnit, unitList[i].newUnit)); - } - form.render(); - if (materialAndBarCodeList.length > 0) { - // 如果有对应的条形码 - var barCodeInput = barCodeItem.childNodes[1].childNodes[1]; - var barCodeImg = barCodeItem.childNodes[1].childNodes[3]; - var id = barCodeInput.id; - $("#" + id).remove(); + if(code !== ""){ + $.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("没有该编码,请确认是否输入正确"); + materialName.value = ""; + materialId.value = ""; + obj.value = ""; + }else{ + req.mid = d.id; + $.ajax({ + url: "/place/findPlaceByMid", + type: "post", + dataType: 'json', + data:JSON.stringify(req), + contentType: "application/json;charset=utf-8", + success:function (res) { + var idNumber = materialId.name.split("mid")[1]; + // 获取物料与条形码的对应关系 + var materialAndBarCodeList = d["materialAndBarCodeList"]; var barCode = $("#barCode" + idNumber); if (barCode.length > 0) { barCode.empty(); - } else { - var barCodeSelect = ` + } + var unit = $("#unit" + idNumber); + unit.empty(); + $("#unit" + idNumber).append(new Option(d.baseUnit, "-1")); + var unitList = d["splitInfoList"]; + for (let i = 0; i < unitList.length; i++) { + $("#unit" + idNumber).append(new Option(unitList[i].newUnit, unitList[i].newUnit)); + } + form.render(); + if (materialAndBarCodeList.length > 0) { + // 如果有对应的条形码 + var barCodeInput = barCodeItem.childNodes[1].childNodes[1]; + var barCodeImg = barCodeItem.childNodes[1].childNodes[3]; + var id = barCodeInput.id; + $("#" + id).remove(); + var barCode = $("#barCode" + idNumber); + if (barCode.length > 0) { + barCode.empty(); + } else { + var barCodeSelect = ` `; - $("#" + barCodeImg.id).before(barCodeSelect); + $("#" + barCodeImg.id).before(barCodeSelect); + } + form.render(); + + $.each(materialAndBarCodeList, function (index, item) { + $("#barCode" + idNumber).append(new Option(item.bmcode, item.id));//往下拉菜单里添加元素 + }); + form.render(); } - form.render(); + $('#place' + codeId).empty(); - $.each(materialAndBarCodeList, function (index, item) { - $("#barCode" + idNumber).append(new Option(item.bmcode, item.id));//往下拉菜单里添加元素 + $.each(res.data, function (index, item) { + $('#place' + codeId).append(new Option(item.depositoryName + "-" + item.code, item.id));//往下拉菜单里添加元素 }); form.render(); + materialName.value = d.mname; + materialId.value = d.id; } - $('#place' + codeId).empty(); - - $.each(res.data, function (index, item) { - $('#place' + codeId).append(new Option(item.depositoryName + "-" + item.code, item.id));//往下拉菜单里添加元素 - }); - form.render(); - materialName.value = d.mname; - materialId.value = d.id; - } - }); + }); + } } - } - }); + }); + } + }; // 用于实现点击搜索按钮 diff --git a/src/main/resources/templates/pages/application/application-transfer_back.html b/src/main/resources/templates/pages/application/application-transfer_back.html index ce06e4d1..5d9e40e1 100644 --- a/src/main/resources/templates/pages/application/application-transfer_back.html +++ b/src/main/resources/templates/pages/application/application-transfer_back.html @@ -330,40 +330,43 @@ var req = {}; req.code = code; req.type = "out"; - $.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("没有该编码,请确认是否输入正确"); - materialName.value = ""; - materialId.value = ""; - obj.value = ""; - }else{ - req.mid = d.id; - $.ajax({ - url: "/place/findPlaceByMid", - type: "post", - dataType: 'json', - data:JSON.stringify(req), - contentType: "application/json;charset=utf-8", - success:function (res) { - $('#place'+id).empty(); - $.each(res.data, function (index, item) { - $('#place'+id).append(new Option(item.depositoryName+"-"+item.code, item.id));//往下拉菜单里添加元素 - }); - form.render(); - materialName.value = d.mname; - materialId.value = d.id; - } - }); + if(code !== ""){ + $.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("没有该编码,请确认是否输入正确"); + materialName.value = ""; + materialId.value = ""; + obj.value = ""; + }else{ + req.mid = d.id; + $.ajax({ + url: "/place/findPlaceByMid", + type: "post", + dataType: 'json', + data:JSON.stringify(req), + contentType: "application/json;charset=utf-8", + success:function (res) { + $('#place'+id).empty(); + $.each(res.data, function (index, item) { + $('#place'+id).append(new Option(item.depositoryName+"-"+item.code, item.id));//往下拉菜单里添加元素 + }); + form.render(); + materialName.value = d.mname; + materialId.value = d.id; + } + }); + } } - } - }); + }); + } + }; // 用于实现点击搜索按钮 diff --git a/src/test/java/com/dreamchaser/depository_manage/TestOther.java b/src/test/java/com/dreamchaser/depository_manage/TestOther.java index 851b09cc..5ebc85c2 100644 --- a/src/test/java/com/dreamchaser/depository_manage/TestOther.java +++ b/src/test/java/com/dreamchaser/depository_manage/TestOther.java @@ -31,7 +31,11 @@ public class TestOther { @Test public void Test() throws IOException { - System.out.println(ObjectFormatUtil.toBoolean("true")); + Map map = new HashMap<>(); + Boolean flag = true; + map.put("flag",flag); + Boolean flag1 = ObjectFormatUtil.toBoolean(map.get("flag")); + System.out.println(flag1); }