From 691eef3c0184b0aba60b6d0d4189e25ce0cbda7d Mon Sep 17 00:00:00 2001 From: yusijie <ysj@hz-kingdee.com> Date: 星期四, 29 六月 2023 10:03:28 +0800 Subject: [PATCH] 1 --- WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_BarCodeBill.html | 226 ++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 200 insertions(+), 26 deletions(-) diff --git a/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_BarCodeBill.html b/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_BarCodeBill.html index 0b4e5cf..b941276 100644 --- a/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_BarCodeBill.html +++ b/WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_BarCodeBill.html @@ -11,7 +11,7 @@ <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all"> <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all"> <link rel="stylesheet" href="../../layuiadmin/layui/css/style-self.css" media="all"> - + </head> <body> <div id="layout1" class="layui-fluid"> @@ -97,7 +97,7 @@ <div class="layui-btn-container"> <!--<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-normal">鏅�氭潯鐮�</button>--> <!--<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-box">鍐呭绠辨潯鐮�</button>--> - + <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-add"><i class="layui-icon layui-icon-addition"></i>鎷嗗垎</button> </div> </script> </div> @@ -220,8 +220,6 @@ type: "GET", data: { "sMsg": linterid }, success: function (d) { - console.log(d.data); - //$("#HDate").val(d.) $("#HInterID").val(d.data[0].HInterID); $("#HBillNo").val(d.data[0].HBillNo); $("#HRemark").val(d.data[0].HRemark); @@ -257,8 +255,6 @@ //debugger; var sMainStr = JSON.stringify(data.field); var sSubStr = JSON.stringify(table.cache['mainTable']); - console.log(sMainStr) - console.log(sSubStr) var sMainSub = sMainStr + ';' + sSubStr; layer.load(3) $.ajax( @@ -327,8 +323,6 @@ //debugger; var sMainStr = JSON.stringify(data.field); var sSubStr = JSON.stringify(table.cache['mainTable']); - console.log(sMainStr) - console.log(sSubStr) var sMainSub = sMainStr + ';' + sSubStr; layer.load(3) $.ajax( @@ -392,12 +386,60 @@ }); return false; }); - //鐢熸垚鍐呭绠辩爜 + //鐢熸垚鍐呭绠辩爜 + + //鑾峰彇褰撳墠鏁版嵁鎵�鍦ㄦ暟缁勭殑涓嬫爣 + function findIndex(HMaterNumber, HMaterModel, array) { + for (var i = 0; i < array.length; i++) { + if (array[i].HMaterNumber === HMaterNumber && array[i].HMaterModel === HMaterModel) { + return i; + } + } + return -1; + } + form.on('submit(HBarcodeSaverBox)', function (data) {//淇濆瓨 + var a = 0; + var newArray = []; + var index = -1; //debugger; var sMainStr = JSON.stringify(data.field); var sSubStr = JSON.stringify(table.cache['mainTable']); var sMainSub = sMainStr + ';' + sSubStr; + var _sSubStr = JSON.parse(sSubStr); + for (var i = 0; i < _sSubStr.length; i++) { + if (_sSubStr[i].HQty > 0 && (_sSubStr[i].HMinQty == 0 || _sSubStr[i].HWXQty == 0)) { + layer.msg("鏄庣粏璁板綍绗�" + (i + 1) + "琛�,鍖呰鏁伴噺涓嶈兘涓�0!", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" }); + return Result = false; + } + if (_sSubStr[i].HQty > _sSubStr[i].HNotBarcodeCount) { + console.log("鏈:" + _sSubStr[i].HQty); + console.log("鍓╀綑:" + _sSubStr[i].HNotBarcodeCount); + layer.msg("鏄庣粏璁板綍绗�" + (i + 1) + "琛�,鏈鐢熸垚鏉$爜鏁伴噺涓嶈兘瓒呭嚭鏈敓鎴愭潯鐮佹暟閲�!", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" }); + return Result = false; + } + if (_sSubStr[i].HQty > 0 && (_sSubStr[i].HBatchNo == "" || _sSubStr[i].HKFDate == "")) { + layer.msg("鏄庣粏璁板綍绗�" + (i + 1) + "琛�,鎵规鎴栫敓浜ф棩鏈熶笉鑳戒负绌�!", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" }); + return Result = false; + } + //鑾峰彇涓嬫爣 + index = findIndex(_sSubStr[i].HMaterNumber, _sSubStr[i].HMaterModel, newArray); + if (index === -1) { + //濡傛灉鏁扮粍涓病鏈夊綋鍓嶆暟鎹紝鍒欏皢鏁版嵁娣诲姞杩涙暟缁勪腑 + newArray.push(_sSubStr[i]); + + } else { + //濡傛灉鏁扮粍涓湁鍜屽綋鍓嶆暟鎹腑鐗╂枡浠g爜銆佽鏍煎瀷鍙蜂竴鑷寸殑淇℃伅锛屽垯灏嗕粬浠殑鏁伴噺绱姞 + newArray[index].HQty = Number(newArray[index].HQty) + Number(_sSubStr[i].HQty); + } + } + + for (let i = 0; i < newArray.length; i++) { + if (newArray[i].HQty > newArray[i].HNotBarcodeCount) { + layer.msg("缂栫爜:" + newArray[i].HMaterNumber + " 瑙勬牸鍨嬪彿:" + newArray[i].HMaterModel + "<br>" + " 鏈鐢熸垚鏉$爜鎬绘暟閲忚秴鍑哄墿浣欏彲鐢熸垚鏉$爜鏁帮紒" + "<br>" + " 鏈鐢熸垚鎬绘暟閲�:" + newArray[i].HQty + " 鍙敓鎴愭潯鐮佹暟閲�:" + newArray[i].HNotBarcodeCount, { icon: 5, btn: ['纭'], time: 10000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" }); + return Result = false; + } + } layer.load(3) $.ajax( { @@ -411,7 +453,7 @@ layer.msg(data.Message, { icon: 1 }); element.tabDelete('tabDemo', '2'); //鍒犻櫎 element.tabDelete('tabDemo', '3'); //鍒犻櫎 - + element.tabAdd('tabDemo', { title: '澶栫鏉$爜' , content: '<table class="layui-hide" id="subTable" lay-filter="subTable"></table>' //鏀寔浼犲叆(html浠g爜锛変笉鎸佹敮鐩存帴浼犲叆html椤甸潰 @@ -442,13 +484,11 @@ , { field: 'HKFDQDate', title: '鍒版湡鏃ユ湡', width: 100 } ]] - // , data: [linterid] - // , page: true , done: function () { layer.closeAll("loading"); } }); - + element.tabAdd('tabDemo', { title: '鍐呯鏉$爜' , content: '<table class="layui-hide" id="subTable2" lay-filter="subTable2"></table>' //鏀寔浼犲叆(html浠g爜锛変笉鎸佹敮鐩存帴浼犲叆html椤甸潰 @@ -499,7 +539,6 @@ }); return false; }); - form.on('submit(Print)', function (data) {//鎵撳嵃 var data1 = layui.table.cache["subTable"] , data2 = layui.table.cache["subTable2"]; @@ -520,10 +559,25 @@ rows = rows.substring(rows.length - 1, 0); rows2 = rows2.substring(rows2.length - 1, 0); if (rows == "") { - layer.msg("鑷冲皯閫夋嫨涓�琛岃褰曪紒") + layer.msg("娌℃湁闇�瑕佹墦鍗扮殑鏁版嵁锛�") return; } else { + var url = "linteridSession"; + $.ajax({ + type: "POST", + url: GetWEBURL() + url, //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚� + async: true, + data: { "linterid": rows.toString(), "HUserName": sessionStorage["HUserName"] }, + dataType: "json", + success: function (data) { + layer.closeAll("loading"); + }, + error: function (err) { + layer.alert("閿欒:" + err, { icon: 5 }); + } + }); + sessionStorage["linterid"] = rows.toString(); layer.open({ type: 2 , area: ['50%', '50%'] @@ -531,7 +585,7 @@ , shade: 0.6 //閬僵閫忔槑搴� , maxmin: false //鍏佽鍏ㄥ睆鏈�灏忓寲 , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚� - , content: ['../../views/BaseSet/SRM_OpenTmpList.html?linterid=' + rows.toString() + '&HBarcode=&Type=' + openTmpListType, 'yes'] + , content: ['../../views/BaseSet/SRM_OpenTmpList.html?linterid=' + sessionStorage["HUserName"] + '&HBarcode=&Type=' + openTmpListType, 'yes'] , resize: false //, cancel: function () { // $(".layui-btn").removeClass("layui-btn-disabled"); @@ -543,7 +597,6 @@ var index = parent.layer.getFrameIndex(window.name); //鍏堝緱鍒板綋鍓峣frame灞傜殑绱㈠紩 parent.layer.close(index); //鍐嶆墽琛屽叧闂� }); - //鐩戝惉鎻愪氦 form.verify({ numberOrEmpty: function (value, item) { @@ -555,7 +608,6 @@ } }); layer.load(3) - table.render({ elem: '#mainTable' , url: GetWEBURL() + subUrl @@ -563,18 +615,25 @@ , defaultToolbar: ['filter', 'exports'] , where: { sMsg: linterid, sMsg2: lentryid } , cols: [[ + { type: 'checkbox', fixed: 'left' } , { field: 'HMaterID', title: '鐗╂枡ID', width: 100, hide: true } , { field: 'HMaterNumber', title: '鐗╂枡缂栫爜', width: 120 } - , { field: 'HMaterShortNumber', title: '鐗╂枡浠g爜', width: 120 } + , { field: 'HOldMaterNumber', title: '鏃х墿鏂欑紪鐮�', width: 120 } + , { field: 'HMaterShortNumber', title: '鐗╂枡浠g爜', width: 120, hide: true } + , { field: 'HSubjoin', title: '鐗╂枡浠g爜', width: 120 } , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', width: 120 } , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿', width: 120 } , { field: 'HUnitName', title: '璁¢噺鍗曚綅', width: 100 } , { field: 'HUnitNumber', title: '璁¢噺鍗曚綅浠g爜', width: 100, hide: true } , { field: 'HUnitID', title: '璁¢噺鍗曚綅ID', width: 100, hide: true } - , { field: 'HQty', title: '鏁伴噺', width: 100 } - , { field: 'HMinQty', title: '鍐呯鍖呰鏁�', width: 100, edit: 'text' } + , { field: 'HDDQty', title: '璁㈠崟鏁伴噺', width: 100 } + , { field: 'HMrbQty', title: '閫�鏂欐暟閲�', width: 100 } + , { field: 'HBarcodeCount', title: '宸茬敓鎴愭潯鐮佹暟閲�', width: 135 } + , { field: 'HNotBarcodeCount', title: '鍙敓鎴愭潯鐮佹暟閲�', width: 135 } + , { field: 'HQty', title: '鏈鐢熸垚鏉$爜鏁伴噺', width: 135, edit: 'text', event: "inputHQty" } + , { field: 'HMinQty', title: '鍐呯鍖呰鏁�', width: 100, edit: 'text', event: "inputHMinQty" } , { field: 'HBQty', title: '鍐呯鏁�', width: 100 } - , { field: 'HWXQty', title: '澶栫鍖呰鏁�', width: 100, edit: 'text' } + , { field: 'HWXQty', title: '澶栫鍖呰鏁�', width: 100, edit: 'text', event: "inputHWXQty" } , { field: 'HWBQty', title: '澶栫鏁�', width: 100 } , { field: 'HPrice', title: '鍗曚环', width: 100, hide: true } , { field: 'HMoney', title: '閲戦', width: 100, hide: true } @@ -583,8 +642,8 @@ //, { field: 'HBeginDate', title: '鐢熶骇鏃ユ湡', width: 120, data_field: 'HBeginDate', event: "chooseHBeginDate" } //, { field: 'HEndDate', title: '澶辨晥鏃ユ湡', width: 120, data_field: 'HEndDate', event: "chooseHEndDate" } , { field: 'HKFDate', title: '鐢熶骇鏃ユ湡', align: 'center', width: 150, data_field: 'HKFDate', event: "chooseHKFDate" }// - , { field: 'HKFPeriod', title: '淇濊川鏈�', width: 100, edit: 'text', event: "inputHKFPeriod" }// - , { field: 'HKFDQDate', title: '鍒版湡鏃ユ湡', align: 'center', width: 150, data_field: 'HKFDQDate', event: "chooseHKFDQDate" }// + , { field: 'HKFPeriod', title: '淇濊川鏈�', width: 100 }// + , { field: 'HKFDQDate', title: '鍒版湡鏃ユ湡', align: 'center', width: 150, data_field: 'HKFDQDate' }//, event: "chooseHKFDQDate" //, { field: 'HDate', title: '瑕佹眰浜よ揣鏃ユ湡', width: 150 } , { field: 'HPOOrderInterID', title: '閲囪喘璁㈠崟涓诲唴鐮�', width: 150, hide: true } , { field: 'HPOOrderEntryID', title: '閲囪喘璁㈠崟瀛愬唴鐮�', width: 150, hide: true } @@ -602,7 +661,6 @@ ]] , done: function (res, curr, count) { - console.log(res); layer.closeAll("loading"); } }); @@ -610,7 +668,102 @@ table.on('toolbar(mainTable)', function (obj) { var checkStatus = table.checkStatus(obj.config.id); switch (obj.event) { + case "btn-add": + var oldData = table.cache["mainTable"]; + var checkStatus = table.checkStatus('mainTable') + , data = checkStatus.data; + var rows = ''; + var arr = []; + arr.push(oldData); + arr.push(checkStatus); + for (var i = 0; i < data.length; i++) { + rows += data[i].HMaterID.toString() + ','; + } + rows = rows.substring(rows.length - 1, 0); + if (rows == "") { + layer.msg("鑷冲皯閫夋嫨涓�琛岃褰曪紒") + } + else { + var HRowCount; + layer.prompt({ + formType: 2, + //value: '', + title: '璇疯緭鍏ヨ鎷嗘垚鍑犺', + area: ['200px', '100px'] //鑷畾涔夋枃鏈煙瀹介珮 + }, function (value, index, elem) { + HRowCount = value.toString(); + var count = parseInt(HRowCount); + if (count > 1) { + var data1; + var dataindex = 0; + for (var i = 0; i < data.length; i++) { + for (var j = 0; j < oldData.length; j++) { + if (data[i].sorderid == oldData[j].sorderid) { + dataindex = j; + for (var x = 0; x < count - 1; x++) { + //dataindex = dataindex + x; + data1 = { + /* "sorderid": oldData.length + 1*/ + "HMaterID": data[i].HMaterID + , "HMaterNumber": data[i].HMaterNumber + , "HOldMaterNumber": data[i].HOldMaterNumber + , "HMaterShortNumber": data[i].HMaterShortNumber + , "HSubjoin": data[i].HSubjoin + , "HMaterName": data[i].HMaterName + , "HMaterModel": data[i].HMaterModel + , "HUnitName": data[i].HUnitName + , "HUnitNumber": data[i].HUnitNumber + , "HUnitID": data[i].HUnitID + , "HDDQty": data[i].HDDQty + , "HMrbQty": data[i].HMrbQty + , "HBarcodeCount": data[i].HBarcodeCount + , "HNotBarcodeCount": data[i].HNotBarcodeCount + , "HQty": data[i].HQty + , "HMinQty": data[i].HMinQty + , "HBQty": data[i].HBQty + , "HWXQty": data[i].HWXQty + , "HWBQty": data[i].HWBQty + , "HPrice": data[i].HPrice + , "HMoney": data[i].HMoney + , "HMTONO": data[i].HMTONO + , "HBatchNo": data[i].HBatchNo + , "HKFDate": data[i].HKFDate + , "HKFPeriod": data[i].HKFPeriod + , "HKFDQDate": data[i].HKFDQDate + , "HPOOrderInterID": data[i].HPOOrderInterID + , "HPOOrderEntryID": data[i].HPOOrderEntryID + , "HPOOrderBillNo": data[i].HPOOrderBillNo + , "HWWOrderInterID": data[i].HWWOrderInterID + , "HWWOrderEntryID": data[i].HWWOrderEntryID + , "HWWOrderDetaiLID": data[i].HWWOrderDetaiLID + , "HWWOrderBillNo": data[i].HWWOrderBillNo + , "HSourceBillType": data[i].HSourceBillType + , "HSourceBillNo": data[i].HSourceBillNo + , "HSourceEntryID": data[i].HSourceEntryID + , "HSourceInterID": data[i].HSourceInterID + , "HSupID": data[i].HSupID + , "HSupName": data[i].HSupName + } + //oldData.push(data1); + oldData.splice(dataindex, 0, data1); + }; + break; + } + } + } + table.reload('mainTable', { + url: '', //闇�瑕佹妸url缃┖,鍚﹀垯table.reload()閲嶈浇鏂规硶涓嶇敓鏁堛�� + data: oldData + }); + layer.close(index); + } + else { + layer.msg("鎷嗚鏁伴噺鑷冲皯涓�2锛�") + } + }); + } + break; //鑷畾涔夊ご宸ュ叿鏍� case 'btn-normal': table.render({ @@ -777,7 +930,28 @@ $(obj.tr).find(".layui-table-edit").keyup(function () { var $input = $(this), val = $input.val(); if (!val) val = "1"; - $input.val(val.replace(/[^\d]/g, '')); + $input.val(val.replace(/[^\d*\.?\d*]/g, '')); + }); + } + else if (obj.event == 'inputHQty') { + $(obj.tr).find(".layui-table-edit").keyup(function () { + var $input = $(this), val = $input.val(); + if (!val) val = "0"; + $input.val(val.replace(/[^\d*\.?\d*]/g, '')); + }); + } + else if (obj.event == 'inputHMinQty') { + $(obj.tr).find(".layui-table-edit").keyup(function () { + var $input = $(this), val = $input.val(); + if (!val) val = "0"; + $input.val(val.replace(/[^\d*\.?\d*]/g, '')); + }); + } + else if (obj.event == 'inputHWXQty') { + $(obj.tr).find(".layui-table-edit").keyup(function () { + var $input = $(this), val = $input.val(); + if (!val) val = "0"; + $input.val(val.replace(/[^\d*\.?\d*]/g, '')); }); } }); -- Gitblit v1.9.1