From 3b58c2efb901713674a7e2ef7d4491afbad1e889 Mon Sep 17 00:00:00 2001 From: "DESKTOP-ESU4BDD\\WeiZhiQiang" <598748873@qq.com> Date: Fri, 6 Oct 2023 21:42:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=B7=A5=E5=8D=95=E9=AA=8C=E6=94=B6?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/erpMachin/erpDepartMachinList.js | 15 ++ .../js/erpMachin/erpMachinAcceptance.js | 159 +++++++++--------- .../template/js/erpMachin/erpMachinList.js | 6 +- .../template/js/erpMachin/machinAccept.js | 46 +++++ .../tpl/erpMachin/erpDepartMachinList.html | 5 + .../tpl/erpMachin/erpMachinAcceptance.html | 4 +- .../template/tpl/erpMachin/machinAccept.html | 76 +++++++++ .../template/json/skyeyeClassEnum.json | 1 + 8 files changed, 227 insertions(+), 85 deletions(-) create mode 100644 erp-produce/src/main/resources/template/js/erpMachin/machinAccept.js create mode 100644 erp-produce/src/main/resources/template/tpl/erpMachin/machinAccept.html diff --git a/erp-produce/src/main/resources/template/js/erpMachin/erpDepartMachinList.js b/erp-produce/src/main/resources/template/js/erpMachin/erpDepartMachinList.js index 5b903ed1b..4fa2f5147 100644 --- a/erp-produce/src/main/resources/template/js/erpMachin/erpDepartMachinList.js +++ b/erp-produce/src/main/resources/template/js/erpMachin/erpDepartMachinList.js @@ -60,6 +60,8 @@ layui.config({ var layEvent = obj.event; if (layEvent === 'details') { // 详情 details(data); + } else if (layEvent === 'machinAccept') { //工序验收 + machinAccept(data); } }); @@ -74,6 +76,19 @@ layui.config({ }}); } + // 工序验收 + function machinAccept(data) { + _openNewWindows({ + url: "../../tpl/erpMachin/machinAccept.html?id=" + data.id, + title: '工序验收', + pageId: "machinAccept", + area: ['90vw', '90vh'], + callBack: function (refreshCode) { + winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1, time: 2000}); + loadTable(); + }}); + } + form.render(); $("body").on("click", "#reloadTable", function() { loadTable(); diff --git a/erp-produce/src/main/resources/template/js/erpMachin/erpMachinAcceptance.js b/erp-produce/src/main/resources/template/js/erpMachin/erpMachinAcceptance.js index 3e489c05a..d5e307652 100644 --- a/erp-produce/src/main/resources/template/js/erpMachin/erpMachinAcceptance.js +++ b/erp-produce/src/main/resources/template/js/erpMachin/erpMachinAcceptance.js @@ -4,90 +4,89 @@ layui.config({ version: skyeyeVersion }).extend({ window: 'js/winui.window' -}).define(['window', 'jquery', 'winui'], function (exports) { +}).define(['window', 'jquery', 'winui', 'form'], function (exports) { winui.renderColor(); - layui.use(['form'], function (form) { - var index = parent.layer.getFrameIndex(window.name); - var $ = layui.$, - form = layui.form; - - var selOption = getFileContent('tpl/template/select-option.tpl'); - - // 提交类型,1.工序验收;2.生成验收单 - var subType = 1; - - subType = parent.subType; - - if(subType == 1){ - $("#depotIdBox").remove(); + var index = parent.layer.getFrameIndex(window.name); + var $ = layui.$, + form = layui.form; + var selOption = getFileContent('tpl/template/select-option.tpl'); + // 提交类型,1.工序验收;2.生成验收单 + var subType = GetUrlParam("subType"); + var id = GetUrlParam("id"); + var needNum = parseInt(GetUrlParam("needNum")); + $("#acceptNum").val(needNum); + $("#quantityNum").val(needNum); + + if(subType == 1){ + $("#depotIdBox").remove(); + } else { + erpOrderUtil.getDepotList(function (json){ + // 加载仓库数据 + $("#depotId").html(getDataUseHandlebars(selOption, json)); + form.render('select'); + }); + } + + $("body").on("input", "#acceptNum", function() { + calcNum(1); + }); + $("body").on("change", "#acceptNum", function() { + calcNum(1); + }); + + $("body").on("input", "#belowNum", function() { + calcNum(2); + }); + $("body").on("change", "#belowNum", function() { + calcNum(2); + }); + + function calcNum(type){ + var changeNum = 0; + if(type == 1){ + changeNum = parseInt(isNull($("#acceptNum").val()) ? "0" : $("#acceptNum").val()); + $("#belowNum").val(needNum - changeNum); } else { - erpOrderUtil.getDepotList(function (json){ - // 加载仓库数据 - $("#depotId").html(getDataUseHandlebars(selOption, json)); - form.render('select'); - }); + changeNum = parseInt(isNull($("#belowNum").val()) ? "0" : $("#belowNum").val()); + $("#acceptNum").val(needNum - changeNum); } - - var needNum = parent.needNum; - $("#needNum").val(needNum); - $("#acceptNum").val(needNum); - - $("body").on("input", "#acceptNum", function() { - calcNum(1); - }); - $("body").on("change", "#acceptNum", function() { - calcNum(1); - }); - - $("body").on("input", "#belowNum", function() { - calcNum(2); - }); - $("body").on("change", "#belowNum", function() { - calcNum(2); - }); - - function calcNum(type){ - var changeNum = 0; - if(type == 1){ - changeNum = parseInt(isNull($("#acceptNum").val()) ? "0" : $("#acceptNum").val()); - $("#belowNum").val(needNum - changeNum); - } else { - changeNum = parseInt(isNull($("#belowNum").val()) ? "0" : $("#belowNum").val()); - $("#acceptNum").val(needNum - changeNum); + } + + matchingLanguage(); + form.render(); + form.on('submit(formAddBean)', function (data) { + if (winui.verifyForm(data.elem)) { + if (parseInt(isNull($("#quantityNum").val()) ? "0" : $("#quantityNum").val()) < 0) { + winui.window.msg('合格数量不能小于0.', {icon: 2, time: 2000}); + return false; + } + if (parseInt(isNull($("#belowNum").val()) ? "0" : $("#belowNum").val()) < 0) { + winui.window.msg('不合格数量不能小于0.', {icon: 2, time: 2000}); + return false; + } + + if (parseInt($("#belowNum").val()) + parseInt($("#quantityNum").val()) != needNum) { + winui.window.msg('合格数量以及不合格数量总和与总量不匹配.', {icon: 2, time: 2000}); + return false; } + + var params = { + childId: id, + acceptNum: $("#acceptNum").val(), + belowNum: $("#belowNum").val(), + depotId: (subType == 1) ? "" : $("#depotId").val() + }; + AjaxPostUtil.request({url: sysMainMation.erpBasePath + "erpmachin012", params: params, type: 'json', callback: function (json) { + parent.layer.close(index); + parent.refreshCode = '0'; + }}); } - - matchingLanguage(); - form.render(); - form.on('submit(formAddBean)', function (data) { - if (winui.verifyForm(data.elem)) { - if(parseInt(isNull($("#acceptNum").val()) ? "0" : $("#acceptNum").val()) < 0){ - winui.window.msg('合格数量不能小于0.', {icon: 2, time: 2000}); - return false; - } - if(parseInt(isNull($("#belowNum").val()) ? "0" : $("#belowNum").val()) < 0){ - winui.window.msg('不合格数量不能小于0.', {icon: 2, time: 2000}); - return false; - } - - var params = { - childId: parent.childId, - acceptNum: $("#acceptNum").val(), - belowNum: $("#belowNum").val(), - depotId: (subType == 1) ? "" : $("#depotId").val() - }; - AjaxPostUtil.request({url: flowableBasePath + "erpmachin012", params: params, type: 'json', callback: function (json) { - parent.layer.close(index); - parent.refreshCode = '0'; - }}); - } - return false; - }); - - // 取消 - $("body").on("click", "#cancle", function() { - parent.layer.close(index); - }); + return false; }); - + + // 取消 + $("body").on("click", "#cancle", function() { + parent.layer.close(index); + }); + }); \ No newline at end of file diff --git a/erp-produce/src/main/resources/template/js/erpMachin/erpMachinList.js b/erp-produce/src/main/resources/template/js/erpMachin/erpMachinList.js index 85c7b9ad5..4bb53d13a 100644 --- a/erp-produce/src/main/resources/template/js/erpMachin/erpMachinList.js +++ b/erp-produce/src/main/resources/template/js/erpMachin/erpMachinList.js @@ -78,7 +78,7 @@ layui.config({ // 添加 $("body").on("click", "#addBean", function() { _openNewWindows({ - url: systemCommonUtil.getUrl('FP2023100300001', null), + url: systemCommonUtil.getUrl('FP2023100300001', null), title: systemLanguage["com.skyeye.addPageTitle"][languageType], pageId: "erpMachinAdd", area: ['90vw', '90vh'], @@ -91,7 +91,7 @@ layui.config({ // 编辑 function edit(data) { _openNewWindows({ - url: systemCommonUtil.getUrl('FP2023100300002&id=' + data.id, null), + url: systemCommonUtil.getUrl('FP2023100300002&id=' + data.id, null), title: systemLanguage["com.skyeye.editPageTitle"][languageType], pageId: "erpMachinEdit", area: ['90vw', '90vh'], @@ -104,7 +104,7 @@ layui.config({ // 详情 function details(data) { _openNewWindows({ - url: systemCommonUtil.getUrl('FP2023100300003&id=' + data.id, null), + url: systemCommonUtil.getUrl('FP2023100300003&id=' + data.id, null), title: systemLanguage["com.skyeye.detailsPageTitle"][languageType], pageId: "erpMachinDetails", area: ['90vw', '90vh'], diff --git a/erp-produce/src/main/resources/template/js/erpMachin/machinAccept.js b/erp-produce/src/main/resources/template/js/erpMachin/machinAccept.js new file mode 100644 index 000000000..db0971824 --- /dev/null +++ b/erp-produce/src/main/resources/template/js/erpMachin/machinAccept.js @@ -0,0 +1,46 @@ + +layui.config({ + base: basePath, + version: skyeyeVersion +}).extend({ + window: 'js/winui.window' +}).define(['window', 'jquery', 'winui', 'form'], function (exports) { + winui.renderColor(); + var index = parent.layer.getFrameIndex(window.name); + var $ = layui.$, + form = layui.form; + + var id = GetUrlParam("id"); + var machinMation; + AjaxPostUtil.request({url: sysMainMation.erpBasePath + "queryMachinById", params: {id: id}, type: 'json', method: 'GET', callback: function (json) { + machinMation = json.bean; + $.each(json.bean.machinChildList, function(i, item) { + item.unitPrice = parseFloat(item.unitPrice).toFixed(2); + item.quantityNum = item.acceptNum - item.belowNum; + item.stateName = skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("machinChildStateEnum", 'id', item.state, 'name'); + if (item.state == 'waitForCheckig') { + if (i == (json.bean.machinChildList.length - 1)) { + item.operator = ''; + } else { + item.operator = ''; + } + } + }); + $("#showForm").html(getDataUseHandlebars($("#useTemplate").html(), json)); + }}); + + // 工序验收 + $("body").on("click", ".acceptance", function() { + var id = $(this).attr('rowId'); + var subType = $(this).attr('subType'); + _openNewWindows({ + url: "../../tpl/erpMachin/erpMachinAcceptance.html?id=" + id + '&subType=' + subType + '&needNum=' + machinMation.needNum, + title: '工序验收', + pageId: "acceptance", + area: ['90vw', '90vh'], + callBack: function (refreshCode) { + winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1, time: 2000}); + }}); + }); + +}); \ No newline at end of file diff --git a/erp-produce/src/main/resources/template/tpl/erpMachin/erpDepartMachinList.html b/erp-produce/src/main/resources/template/tpl/erpMachin/erpDepartMachinList.html index a6e701dbf..175d1b54a 100644 --- a/erp-produce/src/main/resources/template/tpl/erpMachin/erpDepartMachinList.html +++ b/erp-produce/src/main/resources/template/tpl/erpMachin/erpDepartMachinList.html @@ -18,6 +18,11 @@