From fdcc14aa3b74bf493d8d02d8a4e8c170b89d42ba Mon Sep 17 00:00:00 2001 From: "[li_she]" <[li.she@xujiesoft.com]> Date: Sat, 28 Jan 2023 08:55:31 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=87=E8=B4=AD=E9=80=80=E8=B4=A7-=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=20=202023=E5=B9=B41=E6=9C=8828=E6=97=A5=20=20sxm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/pda/js/receipt/purchase_return.js | 163 ++++++++++++++++++ .../pda/js/receipt/purchase_supplier.js | 89 ++++++++++ .../templates/receipt/purchase_return.ftl | 142 +++++++++++++++ .../templates/receipt/purchase_supplier.ftl | 101 +++++++++++ 4 files changed, 495 insertions(+) create mode 100644 src/main/resources/static/pda/js/receipt/purchase_return.js create mode 100644 src/main/resources/static/pda/js/receipt/purchase_supplier.js create mode 100644 src/main/resources/templates/receipt/purchase_return.ftl create mode 100644 src/main/resources/templates/receipt/purchase_supplier.ftl diff --git a/src/main/resources/static/pda/js/receipt/purchase_return.js b/src/main/resources/static/pda/js/receipt/purchase_return.js new file mode 100644 index 0000000..470963d --- /dev/null +++ b/src/main/resources/static/pda/js/receipt/purchase_return.js @@ -0,0 +1,163 @@ +// 页面初始化加在数据 +$(function () { + getSupplier() +}); + +// 拆分 供应商编号 供应商ID +function getSupplier() { + var item = localStorage.getItem("supplier"); + let supplierId = item.split("|")[0] + let supplierName = item.split("|")[0] + $('#supplier').val(item) + $('#supplierId').val(supplierId) + $('#supplierName').val(supplierName) + + +} + +//为内部卷号绑定一个失去焦点事件 +$("#rollNo").bind("keydown", function (event) { + if (event.keyCode == 13) { + var rollNo = $("#rollNo").val(); + if (null == rollNo || rollNo == "") { + layer.alert("卷号不能为空!"); + } else { + scanRollNo(rollNo); + return false; + } + } + return true; +}); +let rolls = [] + +// 通过内部卷号获取信息 +function scanRollNo(rollNo) { + let dto = { + rollno: rollNo, + site: $('#current_site').val(), + supplierid: $('#supplierId').val() + } + $.ajax({ + url: "/purchaseReturn/scanRollNo", + contentType: 'application/json', + type: "POST", + data: JSON.stringify(dto),//你的formid + dataType: "JSON", + beforeSend: function (request) { + request.setRequestHeader("token", $.cookie("token")); + }, + success: function (data) { + var code = data.code; + var rollInfo = data.data; + if (code == 0) { + // 是否已扫描 + let find = rolls.filter(item => item.rollno == rollInfo.rollno); + if (find.length>0){ + layer.alert('该卷已扫描!') + return + } + rolls.push(rollInfo) + let str = '' + + '' + + '' + + '' + + '' + rollInfo.rollno + '' + + '' + + '' + rollInfo.rollqty + '' + + ''; + $("#roll_table").append(str); + } else if (code == 500) { + layer.alert(data.msg); + } + $("#rollNo").val(''); + }, + error: function (data) { + + } + }); +} + +// 删除扫描的卷 +function removerRoll(rollNo){ + rolls = rolls.filter( item => item.rollno != rollNo) + $("#roll_table").html(''); + let str = '' + for (let i = 0; i < rolls.length; i++) { + let rollInfo = rolls[i] + str = '' + + '' + + '' + + '' + + '' + rollInfo.rollno + '' + + '' + + '' + rollInfo.rollqty + '' + + ''; + } + $("#roll_table").html(str); +} + +// 结束当前扫描操作 +function returnGoods() { + if (rolls.length==0){ + layer.alert('请扫描退货的卷') + return; + } + layer.confirm('确定退货?', { + btn : [ '确认', '取消' ] + // 按钮 + }, function() { + layer.closeAll('dialog'); + $.ajax({ + url: "/purchaseReturn/returnGoods", + type: "POST", + contentType: 'application/json', + data: JSON.stringify(rolls), + dataType: "json", + beforeSend: function (request) { + request.setRequestHeader("token", $.cookie("token")); + }, + success: function (data) { + var code = data.code; + if (code == 0) { + layer.confirm(data.msg+', 是否返回上级-选择供应商', { + btn: ['确认', '取消'] + // 按钮 + }, function () { + layer.closeAll('dialog'); + window.document.location.href = "/pda/purchaseSupplier" + }, function () { + window.document.location.href = "/pda/purchaseReturn" + }); + } else { + layer.alert(data.msg); + } + }, + error: function (data) { + layer.alert(data.msg); + } + }); + }, function() { + layer.closeAll('dialog'); + }); + +} + +// 返回主界面清除缓存信息 +function goBack() { + layer.confirm("返回上级菜单,将会删除当前扫描信息!!", { + btn: ['确认', '取消'] + // 按钮 + }, function () { + layer.closeAll('dialog'); + window.document.location.href = "/pda/purchaseSupplier" + }, function () { + layer.closeAll('dialog'); + }); +} + +// 清楚信息 +function clear() { + $("#rollNo").val(""); +} \ No newline at end of file diff --git a/src/main/resources/static/pda/js/receipt/purchase_supplier.js b/src/main/resources/static/pda/js/receipt/purchase_supplier.js new file mode 100644 index 0000000..61d7e1f --- /dev/null +++ b/src/main/resources/static/pda/js/receipt/purchase_supplier.js @@ -0,0 +1,89 @@ +$(function () { + // 初始化供应商 + initSupplier(); + +}); + +//初始化供应商信息 +function initSupplier() { + var jsonData = { + site: $('#current_site').val(), + } + $.ajax({ + url: "/toolPda/getSupplierList", + contentType: 'application/json', + type: "POST", + data: JSON.stringify(jsonData),//你的formid + dataType: "JSON", + beforeSend: function (request) { + request.setRequestHeader("token", $.cookie("token")); + }, + success: function (data) { + if (data.code == 0) { + var rows = data.rows; + $("#supplier_table").html(''); + var str = '' + for (var i = 0; i < rows.length; i++) { + let supplier = rows[i].supplierid+"|" +rows[i].suppliername + str += '' + + '' + + '' + + '' + + '' + rows[i].supplierid + '' + + '' + + '' + rows[i].suppliername + '' + + ''; + } + $("#supplier_table").html(str); + + } else if (data.code == '401') { + window.location.href = "/login"; + } + }, + error: function (data) { + var responseText = data.responseText; + var json_str = JSON.parse(responseText); + var status = json_str.status; + var message = json_str.message; + //判断是否是session超时 + if (403 == status) { + layer.alert(message, function () { + window.location.href = "/login"; + }); + } + layer.closeAll('loading'); + } + }) +} + + +// 执行返回主界面清除缓存信息 +function goBackHome() { + var token = { + "token": $.cookie("token") + } + $.ajax({ + url: "/qa/goBackHome", + type: "POST", + data: token, + dataType: "json", + beforeSend: function (request) { + request.setRequestHeader("token", $.cookie("token")); + }, + success: function (data) { + var code = data.code; + if (code == '200') { + window.location.href = "/pda/publicMenu?titleName=''&menuId=0"; + } + }, + error: function (data) { + layer.alert(data.msg); + } + }); +} + +function goPurchaseReturn(item){ + localStorage.setItem("supplier",item) + window.location.href='/pda/purchaseReturn' +} \ No newline at end of file diff --git a/src/main/resources/templates/receipt/purchase_return.ftl b/src/main/resources/templates/receipt/purchase_return.ftl new file mode 100644 index 0000000..a723599 --- /dev/null +++ b/src/main/resources/templates/receipt/purchase_return.ftl @@ -0,0 +1,142 @@ + + + + + + + + + + + ${projectTitle!"MESPda"} + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + 融欣MES - 退货采购订单 +
+
+

+
+
+
+
+ +
+
+ +
+ +
+
+
+ +
+
+ +
+
+
+
+ +
+
已扫描记录
+
+
+ + + + + + + + + + + + + +
+ 操作 + + 卷号 + + 数量 +
+
+
+ + + + + + + + +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/receipt/purchase_supplier.ftl b/src/main/resources/templates/receipt/purchase_supplier.ftl new file mode 100644 index 0000000..57b8ae2 --- /dev/null +++ b/src/main/resources/templates/receipt/purchase_supplier.ftl @@ -0,0 +1,101 @@ + + + + + + + + + + + ${projectTitle!"MESPda"} + + + + + + + + + + + + + +
+ + +
+
+
+
+ + 融欣MES - 选择供应商 +
+
+

+
+
+
+
+ + + + + + + + + + + + + +
+ 操作 + + 供应商编号 + + 供应商名称 +
+
+
+ + + + + + + + +
+
+ +
+ +
+
+ + + + + + + \ No newline at end of file