From 5d3b1302000fb9372fa4f0dfe7f839eb68c3871c Mon Sep 17 00:00:00 2001 From: pzy <2829717936@qq.com> Date: 星期一, 30 九月 2024 10:30:45 +0800 Subject: [PATCH] 删行 --- WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_BarCodeBill.html | 719 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 673 insertions(+), 46 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 2197558..9554a58 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 @@ -24,8 +24,12 @@ <!--<button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Saver">淇濆瓨</button>--> <!--<button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="HBarcodeSaverPZ">鐢熸垚鍝佺鐮�</button> <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="HBarcodeSaverWY">鐢熸垚鍞竴鐮�</button>--> - <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="HBarcodeSaverBox">鐢熸垚鍐呭绠辨潯鐮�</button> - <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Print">鏉$爜鎵撳嵃</button> + <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="HBarcodeSaverBox" id="HBarcodeSaverBox">鐢熸垚鍐呭绠辨潯鐮�</button> + <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Print">鍐呭绠辨潯鐮佹墦鍗�</button> + <!--<button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Print_nx">鍐呯鏉$爜鎵撳嵃</button> + <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Print_wx">澶栫鏉$爜鎵撳嵃</button>--> + <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="set_Print_NX_Convenient">鍐呯鏉$爜鎵撳嵃</button> + <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="set_Print_WX_Convenient">澶栫鏉$爜鎵撳嵃</button> <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Exit">閫�鍑�</button> </div> @@ -97,7 +101,9 @@ <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> + <button type="button" class="layui-btn layui-btn-sm" lay-event="btn_HideColumn"><i class="layui-icon layui-icon-addition"></i>鍒楄缃�</button> + <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-del"><i class="layui-icon layui-icon-subtraction"></i>鍒犺</button> </div> </script> </div> @@ -115,8 +121,10 @@ <script src="../../layuiadmin/Scripts/json2.js" type="text/javascript"></script> <script src="../../layuiadmin/Scripts/jquery-1.4.1.js" type="text/javascript"></script> <script src="../../../../Scripts/webConfig.js"></script> + <script src="../../layuiadmin/Scripts/general.js"></script> <!--<script src="../../../../Scripts/jquery-1.8.2.js"></script>--> <script> + var HModName = "SRM_BarCodeBill"; function f_alert(sMsg) { layer.alert(sMsg, { icon: 5 }); //layer.open({ @@ -130,6 +138,60 @@ // } //}); } + + var option = { + cols: [[ + { type: 'checkbox', fixed: 'left' } + , { field: 'HMaterID', title: '鐗╂枡ID', width: 100, hide: true } + , { field: 'HMaterNumber', title: '鐗╂枡缂栫爜', width: 120 } + , { field: 'HOldMaterNumber', title: '鏃х墿鏂欑紪鐮�', width: 120, hide: true } + , { field: 'HMaterShortNumber', title: '鐗╂枡浠g爜', width: 120, hide: true } + , { field: 'HSubjoin', title: '鐗╂枡浠g爜', width: 120, hide: true } + , { 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: 'HDDQty', title: '璁㈠崟鏁伴噺', width: 100 } + , { field: 'HMrbQty', title: '閫�鏂欐暟閲�', width: 100, hide: true } + , { 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', event: "inputHWXQty" } + , { field: 'HWBQty', title: '澶栫鏁�', width: 100 } + , { field: 'HPrice', title: '鍗曚环', width: 100, hide: true } + , { field: 'HMoney', title: '閲戦', width: 100, hide: true } + , { field: 'HMTONO', title: '璁″垝璺熻釜鍗曞彿', width: 100, hide: true } + , { field: 'HBatchNo', title: '鎵瑰彿', width: 100, edit: 'text' } + , { field: 'HBatchManager', title: '鍚敤鎵瑰彿', width: 100, hide: true } + , { field: 'HISKFPERIOD', title: '鏄惁鍚敤淇濊川鏈�', width: 100, edit: 'text', hide: true } + , { field: 'HEXPUNIT', title: '淇濊川鏈熷崟浣�', width: 100, edit: 'text', hide: true } + , { field: 'HKFDate', title: '鐢熶骇鏃ユ湡', align: 'center', width: 150, data_field: 'HKFDate', event: "chooseHKFDate" }//, event: "chooseHKFDate" + , { field: 'HKFPeriod', title: '淇濊川鏈�', width: 100 }// + , { field: 'HKFDQDate', title: '鍒版湡鏃ユ湡', align: 'center', width: 150, data_field: 'HKFDQDate' }//, event: "chooseHKFDQDate" + , { field: 'HSupMaterNumber', title: '渚涘簲鍟嗘枡鍙�', width: 100, edit: 'text' } + , { field: 'HSupBatchNo', title: '渚涘簲鍟嗘壒娆�', width: 100, edit: 'text' } + //, { field: 'HBeginDate', title: '鐢熶骇鏃ユ湡', width: 120, data_field: 'HBeginDate', event: "chooseHBeginDate" } + //, { field: 'HEndDate', title: '澶辨晥鏃ユ湡', width: 120, data_field: 'HEndDate', event: "chooseHEndDate" } + //, { field: 'HDate', title: '瑕佹眰浜よ揣鏃ユ湡', width: 150 } + , { field: 'HPOOrderInterID', title: '閲囪喘璁㈠崟涓诲唴鐮�', width: 150, hide: true } + , { field: 'HPOOrderEntryID', title: '閲囪喘璁㈠崟瀛愬唴鐮�', width: 150, hide: true } + , { field: 'HPOOrderBillNo', title: '閲囪喘璁㈠崟鍙�', width: 200 } + , { field: 'HWWOrderInterID', title: '濮斿璁㈠崟涓诲唴鐮�', width: 150, hide: true } + , { field: 'HWWOrderEntryID', title: '濮斿璁㈠崟瀛愬唴鐮�', width: 150, hide: true } + , { field: 'HWWOrderDetaiLID ', title: '濮斿璁㈠崟鏄庣粏鍐呯爜', width: 150, hide: true } + , { field: 'HWWOrderBillNo', title: '濮斿璁㈠崟鍗曞彿', width: 200, hide: true } + , { field: 'HSourceBillType', title: '婧愬崟绫诲瀷', width: 100 } + , { field: 'HSourceBillNo', title: '婧愬崟鍗曞彿', width: 200 } + , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', width: 150, hide: true } + , { field: 'HSourceInterID', title: '婧愬崟涓诲唴鐮�', width: 150, hide: true } + , { field: 'HSupID', title: '渚涘簲鍟咺D', width: 150, hide: true } + , { field: 'HSupName', title: '渚涘簲鍟嗗悕绉�', width: 150, hide: true } + , { field: 'HIsSplit', title: '鏄惁鎷嗗垎', width: 150, hide: true } //0鍚︼紝1鏄� + ]] + }; function isPositiveIntegerTimes(x, y) { if (x > y) { var flag = x; @@ -149,27 +211,58 @@ } } } - function addDate(date, days) { - if (days == undefined || days == '') { - days = 1; - } - var date = new Date(date); - date.setDate(date.getDate() + days); - var month = date.getMonth() + 1; - var day = date.getDate(); - var mm = "'" + month + "'"; - var dd = "'" + day + "'"; + function addDate(date, days, HExpUnit, HKFPeriod) { + //璁$畻鏈夋晥鏈熻嚦 + if (HExpUnit == "Y") {//骞� + date = new Date(date); + date.setYear(date.getFullYear(date) + HKFPeriod); + date.setDate(date.getDate(date) - 1); - //鍗曚綅鏁板墠闈㈠姞0 - if (mm.length == 3) { - month = "0" + month; + return Format(date, "yyyy-MM-dd"); } - if (dd.length == 3) { - day = "0" + day; + if (HExpUnit == "M") {//鏈� + date = new Date(date); + date.setMonth(date.getMonth(date) + HKFPeriod); + date.setDate(date.getDate(date) - 1); + + return Format(date, "yyyy-MM-dd"); + } + if (HExpUnit == "D") {//鏃� + date = new Date(date); + date.setDate(date.getDate(date) + HKFPeriod); + date.setDate(date.getDate(date) - 1); + + return Format(date, "yyyy-MM-dd"); + } + else { //瀹夌憺璁$畻鏂瑰紡 + if (days == undefined || days == '') { + days = 1; + } + + var havingLeapYear = isDecimal(days / 365); //濡傛灉days涓嶈兘琚�365鏁撮櫎锛屽垯涓洪棸骞达紝闇�瑕佸噺灏戜竴澶� + if (havingLeapYear) { + days--;//缁忛獙璇侊紝澶╂暟鍙渶瑕佸噺灏戜竴娆″嵆鍙紝瀛樺湪澶氫釜闂板勾涓嶉渶瑕佸惊鐜�掑噺 + } + + var date = new Date(date); + date.setDate(date.getDate() + days); + var month = date.getMonth() + 1; + var day = date.getDate(); + var mm = "'" + month + "'"; + var dd = "'" + day + "'"; + + //鍗曚綅鏁板墠闈㈠姞0 + if (mm.length == 3) { + month = "0" + month; + } + if (dd.length == 3) { + day = "0" + day; + } + + var time = date.getFullYear() + "-" + month + "-" + day + return time; } - var time = date.getFullYear() + "-" + month + "-" + day - return time; } function DateDiff(sDate1, sDate2) { //sDate1鍜宻Date2鏄�2002-12-18鏍煎紡 var aDate, oDate1, oDate2, iDays @@ -189,6 +282,10 @@ vars[hash[0]] = hash[1]; } return vars; + } + //鍒ゆ柇鏄惁涓哄皬鏁� + function isDecimal(days) { + return days % 1 != 0 } var params = getUrlVars(); var linterid = params[params[0]]; @@ -282,7 +379,7 @@ , where: { sMsg: linterid } , cols: [[ // , { field: 'HMTONO', title: '璁″垝璺熻釜鍗曞彿', width: 100, sort: true, fixed: true edit: 'text', hide: true } - , { field: 'HItemID', title: 'HItemID', width: 100, hide: true } + { field: 'HItemID', title: 'HItemID', width: 100, hide: true } , { field: 'HMaterID', title: '鐗╂枡ID', width: 100, hide: true } , { field: 'HMaterNumber', title: '鐗╂枡浠g爜', width: 200 } , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', width: 200 } @@ -387,7 +484,21 @@ 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']); @@ -399,11 +510,36 @@ 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: "娓╅Θ鎻愮ず" }); + if (_sSubStr[i].HQty > 0 && _sSubStr[i].HISKFPERIOD == 1 && (/*_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; + } + if (_sSubStr[i].HBatchManager == "鏄�" && _sSubStr[i].HBatchNo == "") { + 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 || _sSubStr[i].HIsSplit == 0) { + //濡傛灉鏁扮粍涓病鏈夊綋鍓嶆暟鎹紝鍒欏皢鏁版嵁娣诲姞杩涙暟缁勪腑 + newArray.push(_sSubStr[i]); + + } else { + if (newArray[index].HPOOrderBillNo == _sSubStr[i].HPOOrderBillNo) { + //濡傛灉鏁扮粍涓湁鍜屽綋鍓嶆暟鎹腑鐗╂枡浠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; } } @@ -420,6 +556,8 @@ layer.msg(data.Message, { icon: 1 }); element.tabDelete('tabDemo', '2'); //鍒犻櫎 element.tabDelete('tabDemo', '3'); //鍒犻櫎 + + $('#HBarcodeSaverBox').addClass("layui-btn-disabled").attr("disabled", true);//鐢熸垚鏉$爜鎸夐挳绂佺敤 element.tabAdd('tabDemo', { title: '澶栫鏉$爜' @@ -506,7 +644,9 @@ }); return false; }); - form.on('submit(Print)', function (data) {//鎵撳嵃 + + //鍐呭绠辨墦鍗� + form.on('submit(Print)', function (data) { var data1 = layui.table.cache["subTable"] , data2 = layui.table.cache["subTable2"]; var rows = ''; @@ -547,12 +687,12 @@ sessionStorage["linterid"] = rows.toString(); layer.open({ type: 2 - , area: ['50%', '50%'] + , area: ['80%', '80%'] , title: '鎵撳嵃妯$増閫夋嫨' , shade: 0.6 //閬僵閫忔槑搴� , maxmin: false //鍏佽鍏ㄥ睆鏈�灏忓寲 , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚� - , content: ['../../views/BaseSet/SRM_OpenTmpList.html?linterid=' + sessionStorage["HUserName"] + '&HBarcode=&Type=' + openTmpListType, 'yes'] + , content: ['../../views/BaseSet/SRM_OpenTmpList.html?linterid=' + sessionStorage["linterid"] + '&HBarcode=&Type=SRM_POOrderBillList', 'yes'] , resize: false //, cancel: function () { // $(".layui-btn").removeClass("layui-btn-disabled"); @@ -560,6 +700,228 @@ }) } }); + + //鍐呯鎵撳嵃 + form.on('submit(Print_nx)', function (data) { + var data2 = layui.table.cache["subTable2"];//鍐呯鏉$爜 + + var rows = ''; + var rows2 = ''; + if (data2 == undefined) { + layer.msg("璇峰厛鐢熸垚鍐呯鏉$爜锛�") + return; + } + for (var j = 0; j < data2.length; j++) { + rows += data2[j].HItemID.toString() + ','; + rows2 += data2[j].HBarCode.toString() + ','; + } + rows = rows.substring(rows.length - 1, 0); + rows2 = rows2.substring(rows2.length - 1, 0); + if (rows == "") { + 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%'] + , title: '鎵撳嵃妯$増閫夋嫨' + , shade: 0.6 //閬僵閫忔槑搴� + , maxmin: false //鍏佽鍏ㄥ睆鏈�灏忓寲 + , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚� + , content: ['../../views/BaseSet/SRM_OpenTmpList.html?linterid=' + sessionStorage["linterid"] + '&HBarcode=&Type=SRM_POOrderBillList', 'yes'] + , resize: false + //, cancel: function () { + // $(".layui-btn").removeClass("layui-btn-disabled"); + //} + }) + } + }); + + //澶栫鎵撳嵃 + form.on('submit(Print_wx)', function (data) { + var data1 = layui.table.cache["subTable"]//澶栫鏉$爜 + var rows = ''; + var rows2 = ''; + if (data1 == undefined) { + layer.msg("璇峰厛鐢熸垚澶栫鏉$爜锛�") + return; + } + for (var i = 0; i < data1.length; i++) { + rows += data1[i].HItemID.toString() + ','; + rows2 += data1[i].HBarCode.toString() + ','; + } + + rows = rows.substring(rows.length - 1, 0); + rows2 = rows2.substring(rows2.length - 1, 0); + if (rows == "") { + 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%'] + , title: '鎵撳嵃妯$増閫夋嫨' + , shade: 0.6 //閬僵閫忔槑搴� + , maxmin: false //鍏佽鍏ㄥ睆鏈�灏忓寲 + , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚� + , content: ['../../views/BaseSet/SRM_OpenTmpList.html?linterid=' + sessionStorage["linterid"] + '&HBarcode=&Type=SRM_POOrderBillList', 'yes'] + , resize: false + //, cancel: function () { + // $(".layui-btn").removeClass("layui-btn-disabled"); + //} + }) + } + }); + + //涓�閿墦鍗板唴绠� + form.on('submit(set_Print_NX_Convenient)', function (data) { + var data2 = layui.table.cache["subTable2"];//鍐呯鏉$爜 + + var rows = ''; + var rows2 = ''; + if (data2 == undefined) { + layer.msg("璇峰厛鐢熸垚鍐呯鏉$爜锛�") + return; + } + for (var j = 0; j < data2.length; j++) { + rows += data2[j].HItemID.toString() + ','; + rows2 += data2[j].HBarCode.toString() + ','; + } + rows = rows.substring(rows.length - 1, 0); + rows2 = rows2.substring(rows2.length - 1, 0); + if (rows == "") { + 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(); + + $.ajax({ + type: "get", + url: GetWEBURL() + "/Open_PrintTem/GetDefaultOpenTmp_Json", + async: true, + data: { "HNumber": 'SRM_POOrderBillList' }, + //data: { "Value": Value }, + success: function (result) { + if (result.count == 1) { + var OpenTmp = result.data[0].妯℃澘鍚嶇О + window.open("../../views/SRM/HBarPlanPrint.html?linterid=" + sessionStorage["linterid"].toString() + "&Type=SRM_POOrderBillList" + "&OpenTmp=" + OpenTmp.toString()); + } else { + layer.msg(result.Message); + } + }, + error: function (result) { + console.log(result); + } + }); + } + }); + + //涓�閿墦鍗板绠� + form.on('submit(set_Print_WX_Convenient)', function (data) { + var data1 = layui.table.cache["subTable"]//澶栫鏉$爜 + var rows = ''; + var rows2 = ''; + if (data1 == undefined) { + layer.msg("璇峰厛鐢熸垚澶栫鏉$爜锛�") + return; + } + for (var i = 0; i < data1.length; i++) { + rows += data1[i].HItemID.toString() + ','; + rows2 += data1[i].HBarCode.toString() + ','; + } + + rows = rows.substring(rows.length - 1, 0); + rows2 = rows2.substring(rows2.length - 1, 0); + if (rows == "") { + 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(); + + $.ajax({ + type: "get", + url: GetWEBURL() + "/Open_PrintTem/GetDefaultOpenTmp_Json", + async: true, + data: { "HNumber": 'SRM_POOrderBillList' }, + //data: { "Value": Value }, + success: function (result) { + if (result.count == 1) { + var OpenTmp = result.data[0].妯℃澘鍚嶇О + window.open("../../views/SRM/HBarPlanPrint.html?linterid=" + sessionStorage["linterid"].toString() + "&Type=SRM_POOrderBillList" + "&OpenTmp=" + OpenTmp.toString()); + } else { + layer.msg(result.Message); + } + }, + error: function (result) { + console.log(result); + } + }); + } + }); + form.on('submit(Exit)', function (data) {//閫�鍑� var index = parent.layer.getFrameIndex(window.name); //鍏堝緱鍒板綋鍓峣frame灞傜殑绱㈠紩 parent.layer.close(index); //鍐嶆墽琛屽叧闂� @@ -574,6 +936,8 @@ //} } }); + + //杩涘叆椤甸潰鏌ヨ琛ㄤ綋鐗╂枡淇℃伅 layer.load(3) table.render({ elem: '#mainTable' @@ -582,33 +946,40 @@ , 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: 'HOldMaterNumber', title: '鏃х墿鏂欑紪鐮�', width: 120 } + , { field: 'HOldMaterNumber', title: '鏃х墿鏂欑紪鐮�', width: 120, hide: true } , { field: 'HMaterShortNumber', title: '鐗╂枡浠g爜', width: 120, hide: true } - , { field: 'HSubjoin', title: '鐗╂枡浠g爜', width: 120} + , { field: 'HSubjoin', title: '鐗╂枡浠g爜', width: 120, hide: true } , { 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: 'HDDQty', title: '璁㈠崟鏁伴噺', width: 100 } + , { field: 'HMrbQty', title: '閫�鏂欐暟閲�', width: 100, hide: true } , { field: 'HBarcodeCount', title: '宸茬敓鎴愭潯鐮佹暟閲�', width: 135 } - , { field: 'HNotBarcodeCount', 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: 'HMinQty', title: '鍐呯瑁呯鏁�', width: 100, edit: 'text', event: "inputHMinQty" } , { field: 'HBQty', title: '鍐呯鏁�', width: 100 } - , { field: 'HWXQty', title: '澶栫鍖呰鏁�', width: 100, edit: 'text', event: "inputHWXQty" } + , { 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 } - , { field: 'HMTONO', title: '璁″垝璺熻釜鍗曞彿', width: 100 } - , { field: 'HBatchNo', title: '鎵规', width: 100, edit: 'text' } + , { field: 'HMTONO', title: '璁″垝璺熻釜鍗曞彿', width: 100, hide: true } + , { field: 'HBatchNo', title: '鎵瑰彿', width: 100, edit: 'text' } + , { field: 'HBatchManager', title: '鍚敤鎵瑰彿', width: 100, hide: true } + , { field: 'HISKFPERIOD', title: '鏄惁鍚敤淇濊川鏈�', width: 100, edit: 'text', hide: true } + , { field: 'HEXPUNIT', title: '淇濊川鏈熷崟浣�', width: 100, edit: 'text', hide: true } + , { field: 'HKFDate', title: '鐢熶骇鏃ユ湡', align: 'center', width: 150, data_field: 'HKFDate', event: "chooseHKFDate" }//, event: "chooseHKFDate" + , { field: 'HKFPeriod', title: '淇濊川鏈�', width: 100 }// + , { field: 'HKFDQDate', title: '鍒版湡鏃ユ湡', align: 'center', width: 150, data_field: 'HKFDQDate' }//, event: "chooseHKFDQDate" + , { field: 'HSupMaterNumber', title: '渚涘簲鍟嗘枡鍙�', width: 100, edit: 'text' } + , { field: 'HSupBatchNo', title: '渚涘簲鍟嗘壒娆�', width: 100, edit: 'text' } //, { 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: 'HDate', title: '瑕佹眰浜よ揣鏃ユ湡', width: 150 } , { field: 'HPOOrderInterID', title: '閲囪喘璁㈠崟涓诲唴鐮�', width: 150, hide: true } , { field: 'HPOOrderEntryID', title: '閲囪喘璁㈠崟瀛愬唴鐮�', width: 150, hide: true } @@ -616,24 +987,161 @@ , { field: 'HWWOrderInterID', title: '濮斿璁㈠崟涓诲唴鐮�', width: 150, hide: true } , { field: 'HWWOrderEntryID', title: '濮斿璁㈠崟瀛愬唴鐮�', width: 150, hide: true } , { field: 'HWWOrderDetaiLID ', title: '濮斿璁㈠崟鏄庣粏鍐呯爜', width: 150, hide: true } - , { field: 'HWWOrderBillNo', title: '濮斿璁㈠崟鍗曞彿', width: 200 } + , { field: 'HWWOrderBillNo', title: '濮斿璁㈠崟鍗曞彿', width: 200, hide: true } , { field: 'HSourceBillType', title: '婧愬崟绫诲瀷', width: 100 } , { field: 'HSourceBillNo', title: '婧愬崟鍗曞彿', width: 200 } , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', width: 150, hide: true } , { field: 'HSourceInterID', title: '婧愬崟涓诲唴鐮�', width: 150, hide: true } , { field: 'HSupID', title: '渚涘簲鍟咺D', width: 150, hide: true } , { field: 'HSupName', title: '渚涘簲鍟嗗悕绉�', width: 150, hide: true } - + , { field: 'HIsSplit', title: '鏄惁鎷嗗垎', width: 150, hide: true } //0鍚︼紝1鏄� ]] , done: function (res, curr, count) { layer.closeAll("loading"); - } + }, }); + //澶村伐鍏锋爮浜嬩欢 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 + , "HSupBatchNo": data[i].HSupBatchNo + , "HSupMaterNumber": data[i].HSupMaterNumber + , "HEXPUNIT": data[i].HEXPUNIT + , "HIsSplit": 1 + } + 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-del": + var oldData = table.cache["mainTable"]; + var checkStatus = table.checkStatus('mainTable') + , data = checkStatus.data; + + + var rows = ''; + 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 { + layer.confirm('鏄惁纭?', { icon: 3, title: '鎻愮ず' }, function (index) { + + for (var i = 0; i < data.length; i++) { + for (var j = 0; j < oldData.length; j++) { + if (data[i].sorderid == oldData[j].sorderid) { + oldData.splice(j, 1); + break; + } + } + } + table.reload('mainTable', { + data: oldData + }); + layer.close(index); + }); + } + break; + case 'btn_HideColumn': + //闅愯棌鍒楄缃� + get_HideColumn(); + break; //鑷畾涔夊ご宸ュ叿鏍� case 'btn-normal': table.render({ @@ -727,8 +1235,6 @@ } }); break; - - }; }); //鐩戝惉琛屽伐鍏蜂簨浠� @@ -736,6 +1242,15 @@ var data = obj.data; if (obj.event === 'chooseHKFDate') { var field = $(this).data('field'); + var HExpUnit = data.HEXPUNIT; //淇濊川鏈熷崟浣� + var HKFPeriod = data.HKFPeriod; //淇濊川鏈� + if (HExpUnit != 'Y' && HExpUnit != 'M' && HExpUnit != 'D') { + layer.msg("姝ょ墿鏂欐病鏈夊惎鐢ㄤ繚璐ㄦ湡锛�"); + obj.update({ + HKFDate: '', + }); + return; + } laydate.render({ elem: this.firstChild , show: true //鐩存帴鏄剧ず @@ -744,7 +1259,7 @@ data[field] = value; obj.update(data); if (parseInt(obj.data.HKFPeriod) >= 0) { - var sKFDQDate = addDate(value, parseInt(obj.data.HKFPeriod)); + var sKFDQDate = addDate(value, parseInt(obj.data.HKFPeriod), HExpUnit, HKFPeriod); obj.update({ HKFDQDate: sKFDQDate, }); @@ -800,31 +1315,143 @@ $(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]/g, '')); + $input.val(parseInt(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]/g, '')); + $input.val(parseInt(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]/g, '')); + $input.val(parseInt(val.replace(/[^\d*\.?\d*]/g, ''))); }); } }); + + //鏄剧ず鍒楁暟鎹� + //闅愯棌鍒楄缃� + function get_HideColumn() { + var colName = ""; + for (var i = 1; i < option.cols[0].length - 1; i++) { + colName += option.cols[0][i]["title"] + ","; + } + + colName = encodeURI(colName.substring(0, colName.length - 1));//瀵� URI 杩涜缂栫爜 + layer.open({ + type: 2 + , skin: "layui-layer-rim" //鍔犱笂杈规 + , title: "闅愯棌鍒楄缃�" //鏍囬 + , closeBtn: 1 //绐椾綋鍙充笂瑙掑叧闂� 鐨� 鏍峰紡 + , shift: 2 //寮瑰嚭鍔ㄧ敾 + , area: ["50%", "90%"] //绐椾綋澶у皬 + , maxmin: true //璁剧疆鏈�澶ф渶灏忔寜閽槸鍚︽樉绀� + , content: ['../鍩虹璧勬枡/闅愯棌鍒楄缃�/Gy_GridView_Hide.html?HModName=' + HModName + '&colName=' + colName, "yes"] + , btn: ["纭畾", "鍙栨秷"] + , btn1: function (index, laero) { + //鍒锋柊琛ㄦ牸鏁版嵁 + DisPlay_HideColumn(); + //鏇存柊琛ㄦ牸缂撳瓨鐨勬暟鎹� + layer.close(index);//鍏抽棴寮圭獥 + } + }) + } + + //鏄剧ず鍒楁暟鎹� + function DisPlay_HideColumn(){ + $.ajax({ + url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList', + type: "GET", + data: { "HModName": HModName, "user": sessionStorage["HUserName"] }, + success: function (data1) { + if (data1.data.length != 0) { + var dataCol = [];//鏁版嵁搴撴煡璇㈠嚭鐨勫垪鏁版嵁 + dataCol = data1.data[0].HGridString.split(','); + for (var i = 0; i < dataCol.length; i++) { + var dataCols = dataCol[i].split('|'); + //闅愯棌鍒� + if (dataCols[1] == 1) { + option.cols[0][i + 1]["hide"] = true; + } + //鏄剧ず鍒� + if (dataCols[1] == 0 && $.inArray(option.cols[0][i + 1]["title"], titleData) == -1) { + option.cols[0][i + 1]["hide"] = false; + } + //闅愯棌id + //璁剧疆鍒楀 + if (dataCols[3] > 0) { + if (option.cols[0][i + 1]["field"] == '渚涘簲鍟嗕氦鏈熷洖澶�') { + option.cols[0][i + 1]["width"] = 120; + } else { + option.cols[0][i + 1]["width"] = dataCols[3]; + } + } + //璁剧疆鍐呭瀛椾綋澶у皬 + if (data1.data[0].HFontSize != 0) { + option.cols[0][i + 1]["style"] = "font-size:" + data1.data[0].HFontSize + "px;"; + } else { + option.cols[0][i + 1]["style"] = "font-size:100%"; + } + //璁剧疆鍒楀 + //if (data1.data[0].HColumnWidth != 0) { + // option.cols[0][i + 1]["width"] = data1.data[0].HColumnWidth + "px;"; + //} else { + // option.cols[0][i + 1]["width"] = ""; + //} + + //瀛椾綋鎵�鍦ㄤ綅缃�(宸� 灞呬腑 鍙�) + switch (dataCols[2]) { + case "L": + option.cols[0][i + 1]["align"] = "left"; + break; + case "M": + option.cols[0][i + 1]["align"] = "center"; + break; + case "R": + option.cols[0][i + 1]["align"] = "right"; + break; + } + } + //鍙栨秷鍐荤粨鍒� + for (var i = 1; i < option.cols[0].length - 1; i++) { + if (option.cols[0][i]["fixed"] != null) { + option.cols[0][i]["fixed"] = null; + } + else { + break; + } + } + //鍐荤粨鍒� + if (data1.data[0].HFixCols != 0) { + for (var i = 0; i < data1.data[0].HFixCols; i++) { + if ($.inArray(option.cols[0][i + 1]["title"], titleData) != -1) { + data1.data[0].HFixCols += 1; + } + option.cols[0][i + 1]["fixed"] = "left"; + } + } + table.render(option); + } else { + table.render(option); + } + }, error: function () { + layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 }); + } + }) + } + table.on('edit(mainTable)', function (obj) { //娉細edit鏄浐瀹氫簨浠跺悕锛宼est鏄痶able鍘熷瀹瑰櫒鐨勫睘鎬� lay-filter="瀵瑰簲鐨勫��" var value = obj.value //寰楀埌淇敼鍚庣殑鍊� , data = obj.data //寰楀埌鎵�鍦ㄨ鎵�鏈夐敭鍊� -- Gitblit v1.9.1