From 81cb8bc81b4c85b057be876dfb5829ccf5b0e68c Mon Sep 17 00:00:00 2001 From: 王 垚 <1402714037@qq.com> Date: 星期二, 19 七月 2022 13:47:00 +0800 Subject: [PATCH] 批次 字段锁定 --- WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_BarCodeBill.html | 144 ++++++++++++++++++++++++++--------------------- 1 files changed, 79 insertions(+), 65 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 f7e885b..97050be 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 @@ -181,6 +181,15 @@ var time = date.getFullYear() + "-" + month + "-" + day return time; } + function DateDiff(sDate1, sDate2) { //sDate1鍜宻Date2鏄�2002-12-18鏍煎紡 + var aDate, oDate1, oDate2, iDays + aDate = sDate1.split("-") + oDate1 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]) //杞崲涓�12-18-2002鏍煎紡 + aDate = sDate2.split("-") + oDate2 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]) + iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24) //鎶婄浉宸殑姣鏁拌浆鎹负澶╂暟 + return iDays + } function getUrlVars() { var vars = [], hash; var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); @@ -197,13 +206,13 @@ var type = params[params[2]]; //鍘熺敓鎴愭潯鐮佹柟娉�(閫佽揣鍗曢粯璁�) var mainUrl = "GetHBarCodeShowBillMain"; //琛ㄥご鏁版嵁鍔犺浇ajax - var subUrl = "GetHBarCodeShowBillSub";//琛ㄤ綋鏁版嵁鍔犺浇ajax + var subUrl = "GetHBarCodeShowBillSub";//琛ㄤ綋鏁版嵁鍔犺浇ajax h_v_SRM_POInStockBillSub_ForWeb2 var saveBarCode = "GetBarcodeSaveBillBox";//鏉$爜鐢熸垚淇濆瓨鏂规硶ajax - var openTmpListType = "SRM_POInStockBillList"; //鏉$爜鎵撳嵃鎸夐挳 寮瑰嚭鐣岄潰 + var openTmpListType = "HBarCodePrint"; //鏉$爜鎵撳嵃鎸夐挳 寮瑰嚭鐣岄潰 //閲囪喘璁㈠崟鏉$爜鐢熸垚瑙勫垯 if (type == 'SRM_POOrderBillList') { mainUrl = 'GetHBarCodeShowBillMainBycg'; - subUrl = "GetHBarCodeShowBillSubBycg"; + subUrl = "GetHBarCodeShowBillSubBycg"; //h_v_Cg_POOrderBillSub_ForWeb2 saveBarCode = "GetBarcodeSaveBillBoxBycg"; openTmpListType = 'SRM_POOrderBillList'; @@ -211,7 +220,7 @@ //濮斿璁㈠崟 else if (type == 'SRM_EntrustOrderBill') { mainUrl = 'GetHBarCodeShowBillMainBywy'; - subUrl = "GetHBarCodeShowBillSubBywy"; + subUrl = "GetHBarCodeShowBillSubBywy"; //h_v_srm_EntrustOrderBillSub_ForWeb2 saveBarCode = "GetBarcodeSaveBillBoxBycg";//璋冪敤閲囪喘鏁版嵁 openTmpListType = 'SRM_POOrderBillList'; } @@ -421,7 +430,7 @@ }); table.render({ elem: '#subTable' - , url: GetWEBURL() + 'GetHBarCodeShowBillSub3' + , url: GetWEBURL() + 'GetHBarCodeShowBillSub3' //h_v_Web_BarCodeBill_ForWeb1 , toolbar: '#toolbarDemo1' , defaultToolbar: ['filter', 'exports'] , where: { sMsg: linterid } @@ -506,6 +515,10 @@ , data2 = layui.table.cache["subTable2"]; var rows = ''; var rows2 = ''; + if (data1 == undefined || data2 == undefined) { + layer.msg("璇峰厛鐢熸垚鍐呭绠辨潯鐮侊紒") + return; + } for (var i = 0; i < data1.length; i++) { rows += data1[i].HItemID.toString() + ','; rows2 += data1[i].HBarCode.toString() + ','; @@ -518,6 +531,7 @@ rows2 = rows2.substring(rows2.length - 1, 0); if (rows == "") { layer.msg("鑷冲皯閫夋嫨涓�琛岃褰曪紒") + return; } else { layer.open({ @@ -527,7 +541,7 @@ , shade: 0.6 //閬僵閫忔槑搴� , maxmin: false //鍏佽鍏ㄥ睆鏈�灏忓寲 , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚� - , content: ['../../views/BaseSet/SRM_OpenTmpList.html?linterid=' + rows.toString() + '&HBarcode=' + rows2.toString() + '&Type=' + openTmpListType, 'yes'] + , content: ['../../views/BaseSet/SRM_OpenTmpList.html?linterid=' + rows.toString() + '&HBarcode=&Type=' + openTmpListType, 'yes'] , resize: false //, cancel: function () { // $(".layui-btn").removeClass("layui-btn-disabled"); @@ -560,17 +574,18 @@ , where: { sMsg: linterid, sMsg2: lentryid } , cols: [[ , { field: 'HMaterID', title: '鐗╂枡ID', width: 100, hide: true } - , { field: 'HMaterNumber', title: '鐗╂枡浠g爜', width: 100 } - , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', width: 200 } - , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿', width: 200 } + , { field: 'HMaterNumber', title: '鐗╂枡缂栫爜', width: 120 } + , { field: 'HMaterShortNumber', 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: 'HBQty', title: '鍐呯鏁�', width: 100 } - , { field: 'HWXQty', title: '澶栫鍖呰鏁�', width: 100 } - , { field: 'HWBQty', title: '澶栫鏁�', width: 100, edit: 'text' } + , { field: 'HWXQty', title: '澶栫鍖呰鏁�', width: 100, edit: 'text' } + , { field: 'HWBQty', title: '澶栫鏁�', width: 100 } , { field: 'HPrice', title: '鍗曚环', width: 100, hide: true } , { field: 'HMoney', title: '閲戦', width: 100, hide: true } , { field: 'HMTONO', title: '璁″垝璺熻釜鍗曞彿', width: 100 } @@ -733,7 +748,12 @@ , done: function (value, date) { data[field] = value; obj.update(data); - + if (obj.data.HKFDQDate != "" && obj.data.HKFDate != "") { + var days = DateDiff(obj.data.HKFDQDate, obj.data.HKFDate); + obj.update({ + HKFPeriod: days, + }); + } } }); } @@ -771,21 +791,11 @@ }); } }); - //table.on('tool(mainTable)', function (d) { - // switch (d.event) { - // case "inputHKFPeriod": - // $(d.tr).find(".layui-table-edit").keyup(function () { - // var $input = $(this), val = $input.val(); - // if (!val) val = "1"; - // $input.val(val.replace(/[^\d]/g, '')); - // }); - // break; - // } - //}); table.on('edit(mainTable)', function (obj) { //娉細edit鏄浐瀹氫簨浠跺悕锛宼est鏄痶able鍘熷瀹瑰櫒鐨勫睘鎬� lay-filter="瀵瑰簲鐨勫��" var value = obj.value //寰楀埌淇敼鍚庣殑鍊� , data = obj.data //寰楀埌鎵�鍦ㄨ鎵�鏈夐敭鍊� , field = obj.field; //寰楀埌瀛楁 + var HMinQty = 0; var HWXQty = 0; var HKFPeriod = 0; @@ -806,65 +816,69 @@ if (obj.data.HBQty != undefined) { HBQty = parseFloat(obj.data.HBQty); } + //HMinQty 鍐呯鍖呰鏁� + //HBQty 鍐呯鏁� + //HWXQty 澶栫鍖呰鏁� + //HWBQty 澶栫鏁� HWBQty switch (field) { - case "HMinQty": + case "HQty": + obj.update({ + HMinQty: 0, + HBQty: 0, + HWXQty: 0, + HWBQty: 0, + }); + break; + case "HMinQty": //鍐呯鍖呰鏁� if (HMinQty < 0) { f_alert("鍐呯鍖呰鏁颁笉鑳戒负璐熸暟!"); } - else if (HWBQty > HBQty) { - f_alert("澶栫鏁伴噺涓嶈兘瓒呭嚭鍐呯鏁伴噺") + else if (HWXQty > 0 && HMinQty > HWXQty) { + f_alert("鍐呯鍖呰鏁伴噺涓嶈兘瓒呭嚭澶栫鍖呰鏁伴噺") + obj.update({ + HBQty: Math.ceil(parseFloat(obj.data.HQty) / parseFloat(obj.value)), + HWXQty: 0, + HWBQty: 0, + }); return; } - else (HWXQty >= 0) + else (HWXQty > 0)//澶栫鍖呰鏁板ぇ浜�0鏃跺�� { obj.update({ //澶栫鍖呰鎬绘暟 = 鍐呯鏁伴噺/澶栫鏁伴噺 * 鍐呯鍖呰鏁伴噺 HBQty: Math.ceil(parseFloat(obj.data.HQty) / parseFloat(obj.value)), - HWXQty: Math.ceil(parseFloat(obj.data.HBQty) / parseFloat(obj.data.HWBQty)) * parseFloat(obj.data.HMinQty), + }); + if (parseFloat(obj.data.HWBQty) > 0) + obj.update({ + HWXQty: Math.ceil(parseFloat(obj.data.HBQty) / parseFloat(obj.data.HWBQty)) * parseFloat(obj.data.HMinQty), + }); } break; - case "HWBQty": //澶栫涓暟鍙戠敓鍙樺寲 - if (HWBQty < 0) { - f_alert("澶栫鏁伴噺涓嶈兘涓鸿礋鏁�") - return; - } - else if (HWBQty > HBQty) { - f_alert("澶栫鏁伴噺涓嶈兘瓒呭嚭鍐呯鏁伴噺") - return; + case "HWXQty": + if (HWXQty > 0) { + if (HMinQty >= 0) { + if (isPositiveIntegerTimes(HMinQty, parseFloat(obj.value))) //澶栫鍖呰鏁拌兘琚唴绠卞寘瑁呮暟鏁撮櫎 + { + obj.update({ + HWBQty: Math.ceil(parseFloat(obj.data.HQty) / parseFloat(obj.value)), + }); + } + else { + //obj.update({ + // HWXQty: 0, + //}); + f_alert("澶栫鍖呰鏁板繀椤绘槸鍐呯鍖呰鏁扮殑鏁存暟鍊�!"); + } + } } else { - obj.update({ - //澶栫鍖呰鎬绘暟 = 鍐呯鏁伴噺/澶栫鏁伴噺 * 鍐呯鍖呰鏁伴噺 - HWXQty: Math.ceil(parseFloat(obj.data.HBQty) / parseFloat(obj.data.HWBQty)) * parseFloat(obj.data.HMinQty), - //HWXQty: 12 - }); + //obj.update({ + // HWXQty: 0, + //}); + f_alert("澶栫鍖呰鏁颁笉鑳戒负璐熸暟!"); } break; - //case "HWXQty": - // if (HWXQty > 0) { - // if (HMinQty >= 0) { - // if (isPositiveIntegerTimes(HMinQty, parseFloat(obj.value))) //澶栫鍖呰鏁拌兘琚唴绠卞寘瑁呮暟鏁撮櫎 - // { - // obj.update({ - // HWBQty: Math.ceil(parseFloat(obj.data.HQty) / parseFloat(obj.value)), - // }); - // } - // else { - // //obj.update({ - // // HWXQty: 0, - // //}); - // f_alert("澶栫鍖呰鏁板繀椤绘槸鍐呯鍖呰鏁扮殑鏁存暟鍊�!"); - // } - // } - // } - // else { - // //obj.update({ - // // HWXQty: 0, - // //}); - // f_alert("澶栫鍖呰鏁颁笉鑳戒负璐熸暟!"); - // } - // break; case "HKFPeriod": if (HKFPeriod >= 0) { var sKFDQDate = addDate(obj.data.HKFDate, HKFPeriod); -- Gitblit v1.9.1