From c923a3aca3cfb4da23eca4666ad7367b8aa3f217 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期四, 25 三月 2021 09:22:06 +0800 Subject: [PATCH] # --- src/main/webapp/static/js/ioWorks/matQuery.js | 149 ++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 115 insertions(+), 34 deletions(-) diff --git a/src/main/webapp/static/js/ioWorks/matQuery.js b/src/main/webapp/static/js/ioWorks/matQuery.js index 390e731..4fcf307 100644 --- a/src/main/webapp/static/js/ioWorks/matQuery.js +++ b/src/main/webapp/static/js/ioWorks/matQuery.js @@ -9,17 +9,22 @@ cols.push({fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:65}) return cols; } - -layui.use(['table','laydate', 'form'], function() { +layui.config({ + base: baseUrl + "/static/layui/lay/modules/" +}).extend({ + notice: 'notice/notice', +}).use(['table','laydate', 'form', 'notice'], function() { var table = layui.table; var $ = layui.jquery; var layer = layui.layer; var form = layui.form; + var notice = layui.notice; tableIns = table.render({ elem: '#chooseData', headers: {token: localStorage.getItem('token')}, data: [], + limit: 100, even: true, toolbar: '#toolbar', cellMinWidth: 50, @@ -38,34 +43,40 @@ table.on('toolbar(chooseData)', function (obj) { var data = matData; switch (obj.event) { - case 'outbound': + case 'createDoc': if (data.length === 0){ - layer.msg('璇峰厛娣诲姞鐗╂枡'); + notice.error({ + title: '娑堟伅閫氱煡', + message: '璇锋坊鍔犵墿鏂�' + }); } else { - var locDetls = []; - data.forEach(function(elem) { - locDetls.push({nodeId: elem.nodeId, matnr: elem.matnr, count: elem.count}); - }); - $.ajax({ - url: baseUrl+"/work/pakout/init", - headers: {'token': localStorage.getItem('token')}, - data: JSON.stringify(locDetls), - contentType:'application/json;charset=UTF-8', - method: 'POST', - success: function (res) { - if (res.code === 200){ - matData = []; - tableIns.reload({data: matData,done:function (res) { - limit(); - }}); - layer.msg(res.msg, {icon: 1}); - } else if (res.code === 403){ - top.location.href = baseUrl+"/"; - } else { - layer.msg(res.msg) - } + var success = true; + for (var i=0;i<matData.length;i++) { + if (matData[i].count <= 0) { + notice.error({ + title: '娑堟伅閫氱煡', + message: matData[i].matnr + '鐗╂枡鏁伴噺蹇呴』澶т簬闆讹紒' + }); + success = false; + return false; } - }); + } + if (success) { + layer.open({ + type: 1, + title: '瀹氫箟閲囪喘閫�璐у崟缂栧彿', + offset: '100px', + area: ['360px'], + shade: 0.1, + content: $('#getOrderNo'), + success: function(layero, index){ + layer.iframeAuto(index) + }, + cancel: function () { + $('#orderNo').val(''); + } + }); + } } break; } @@ -88,23 +99,72 @@ } }); + // 寮�濮嬬敓鎴愭嫞璐у崟 + form.on('submit(confirm)', function (data) { + var matDetls = []; + matData.forEach(function(elem) { + matDetls.push({matnr: elem.matnr + , count: elem.count + + }); + }); + var number = data.field.orderNo; // 鍗曞彿 + if (number.substring(0, 3) !== 'PR-') { + notice.error({ + title: '娑堟伅閫氱煡', + message: '鍗曞彿涓嶇鍚堣鍒欙紝璇蜂互 PR- 寮�澶�' + }); + return false; + } + var req = JSON.stringify({ + number: number + , customerTypeId: data.field.customerTypeId + , list: matDetls + }) + $.ajax({ + url: baseUrl+"/work/order/init", + headers: {'token': localStorage.getItem('token')}, + data: req, + contentType:'application/json;charset=UTF-8', + method: 'POST', + success: function (res) { + if (res.code === 200){ + notice.success({ + title: '娑堟伅閫氱煡', + message: res.msg + }); + top.layui.layer.close(top.popupRight); + } else if (res.code === 403){ + top.location.href = baseUrl+"/"; + } else { + notice.error({ + title: '娑堟伅閫氱煡', + message: res.msg + }); + } + } + }); + }) + function updateMatData(locNo, matnr, count) { if (isNaN(count)) { - layer.msg("璇疯緭鍏ユ暟瀛�"); + notice.error({ + title: '娑堟伅閫氱煡', + message: '璇疯緭鍏ユ暟瀛�' + }); } else { if (count > 0) { for (var i=0;i<matData.length;i++){ if (matData[i]["matnr"] === matnr){ - // if (count > locDetlData[i]["anfme"]) { - // layer.msg("涓嶈兘瓒呰繃鍘熸暟閲�"); - // } else { - matData[i]["count"] = count; - // } + matData[i]["count"] = count; break; } } } else { - layer.msg("鏁伴噺蹇呴』澶т簬闆�"); + notice.error({ + title: '娑堟伅閫氱煡', + message: '鏁伴噺蹇呴』澶т簬闆�' + }); } } tableIns.reload({data: matData,done:function (res) { @@ -149,4 +209,25 @@ matData.push.apply(matData, data); tableIns.reload({data: matData}); layer.close(matDetlLayerIdx); +} + +function initOrderNo() { + $.ajax({ + url: baseUrl+"/work/orderNo/init", + headers: {'token': localStorage.getItem('token')}, + async: false, + method: 'GET', + success: function (res) { + if (res.code === 200){ + $('#orderNo').val(res.data) + } else if (res.code === 403){ + top.location.href = baseUrl+"/"; + } else { + notice.error({ + title: '娑堟伅閫氱煡', + message: res.msg + }); + } + } + }); } \ No newline at end of file -- Gitblit v1.9.1