| | |
| | | <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"> |
| | |
| | | <!--<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> |
| | |
| | | <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> |
| | |
| | | <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({ |
| | |
| | | // } |
| | | //}); |
| | | } |
| | | |
| | | 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: '物料代码', width: 120, hide: true } |
| | | , { field: 'HSubjoin', title: '物料代码', width: 120, hide: true } |
| | | , { field: 'HMaterName', title: '物料名称', width: 120 } |
| | | , { field: 'HMaterModel', title: '规格型号', width: 120 } |
| | | , { field: 'HUnitName', title: '计量单位', width: 100 } |
| | | , { field: 'HUnitNumber', title: '计量单位代码', 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: '供应商ID', 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; |
| | |
| | | } |
| | | } |
| | | } |
| | | 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和sDate2是2002-12-18格式 |
| | | var aDate, oDate1, oDate2, iDays |
| | |
| | | } |
| | | return vars; |
| | | } |
| | | //判断是否为小数 |
| | | function isDecimal(days) { |
| | | return days % 1 != 0 |
| | | } |
| | | var params = getUrlVars(); |
| | | var linterid = params[params[0]]; |
| | | var lentryid = params[params[1]]; |
| | | var type = params[params[2]]; |
| | | var mergeTags = params[params[3]]; |
| | | //原生成条码方法(送货单默认) |
| | | var mainUrl = "GetHBarCodeShowBillMain"; //表头数据加载ajax |
| | | var subUrl = "GetHBarCodeShowBillSub";//表体数据加载ajax h_v_SRM_POInStockBillSub_ForWeb2 |
| | | var saveBarCode = "GetBarcodeSaveBillBox";//条码生成保存方法ajax GetBarcodeSaveBillBox |
| | | var saveBarCode = "GetBarcodeSaveBillBox";//条码生成保存方法ajax GetBarcodeSaveBillBox GetBarcodeSaveBillOnlyInnerBox |
| | | var openTmpListType = "HBarCodePrint"; //条码打印按钮 弹出界面 |
| | | //采购订单条码生成规则 |
| | | if (type == 'SRM_POOrderBillList') { |
| | |
| | | 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); |
| | |
| | | , laydate = layui.laydate |
| | | , element = layui.element; //Tab的切换功能,切换事件监听等,需要依赖element模块 |
| | | |
| | | var option; |
| | | |
| | | option = { |
| | | elem: '#mainTable' |
| | | , toolbar: '#toolbarDemo' |
| | | , limit: 500 |
| | | , height: 500 |
| | | , totalRow: true |
| | | , loading: false |
| | | , cols: [[ |
| | | { type: 'checkbox', fixed: 'left', totalRowText: '合计' } |
| | | , { field: 'HMaterID', title: '物料ID', width: 100, hide: true } |
| | | , { field: 'HMaterNumber', title: '物料编码', width: 120 } |
| | | , { field: 'HOldMaterNumber', title: '旧物料编码', width: 120, hide: true } |
| | | , { field: 'HMaterShortNumber', title: '物料代码', width: 120, hide: true } |
| | | , { field: 'HSubjoin', title: '物料代码', width: 120, hide: true } |
| | | , { field: 'HMaterName', title: '物料名称', width: 120 } |
| | | , { field: 'HMaterModel', title: '规格型号', width: 120 } |
| | | , { field: 'HUnitName', title: '计量单位', width: 100 } |
| | | , { field: 'HUnitNumber', title: '计量单位代码', 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, totalRow: true} |
| | | , { field: 'HQty', title: '本次生成条码数量', width: 135, edit: 'text', event: "inputHQty", totalRow: true} |
| | | , { field: 'HMinQty', title: '内箱包装数', width: 100, edit: 'text', event: "inputHMinQty", totalRow: true} |
| | | , { field: 'HBQty', title: '内箱数', width: 100, totalRow: true} |
| | | , { field: 'HWXQty', title: '外箱包装数', width: 100, edit: 'text', event: "inputHWXQty", totalRow: true} |
| | | , { field: 'HWBQty', title: '外箱数', width: 100, totalRow: true} |
| | | , { 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: '供应商ID', width: 150, hide: true } |
| | | , { field: 'HSupName', title: '供应商名称', width: 150, hide: true } |
| | | , { field: 'HIsSplit', title: '是否拆分', width: 150, hide: true } //0否,1是 |
| | | |
| | | ]] |
| | | } |
| | | |
| | | //生成品种码 |
| | | form.on('submit(HBarcodeSaverPZ)', function (data) {//保存 |
| | | //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( |
| | |
| | | , 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: '物料代码', width: 200 } |
| | | , { field: 'HMaterName', title: '物料名称', width: 200 } |
| | |
| | | //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( |
| | |
| | | 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; |
| | | |
| | | for (var i = 0; i < table.cache["mainTable"].length; i++) { |
| | | if (table.cache["mainTable"][i].HMaterName.indexOf("\"") != -1 || table.cache["mainTable"][i].HMaterName.indexOf(";") != -1) { |
| | | table.cache["mainTable"][i].HMaterName = table.cache["mainTable"][i].HMaterName.replace("\"", "”").replace(";", ";") |
| | | } |
| | | if (table.cache["mainTable"][i].HMaterModel.indexOf("\"") != -1 || table.cache["mainTable"][i].HMaterModel.indexOf(";") != -1) { |
| | | table.cache["mainTable"][i].HMaterModel = table.cache["mainTable"][i].HMaterModel.replace("\"", "”").replace(";", ";") |
| | | } |
| | | } |
| | | |
| | | 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].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) { |
| | | //如果数组中有和当前数据中物料代码、规格型号一致的信息,则将他们的数量累加 |
| | | 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( |
| | | { |
| | |
| | | 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: '外箱条码' |
| | | , content: '<table class="layui-hide" id="subTable" lay-filter="subTable"></table>' //支持传入(html代码)不持支直接传入html页面 |
| | |
| | | , { 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代码)不持支直接传入html页面 |
| | |
| | | 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 = ''; |
| | |
| | | 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%'] |
| | | , area: ['40%', '80%'] |
| | | , title: '打印模版选择' |
| | | , 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["linterid"] + '&HBarcode=&Type=SRM_POOrderBillList', 'yes'] |
| | | , resize: false |
| | | //, cancel: function () { |
| | | // $(".layui-btn").removeClass("layui-btn-disabled"); |
| | |
| | | }) |
| | | } |
| | | }); |
| | | |
| | | //内箱打印 |
| | | 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); //先得到当前iframe层的索引 |
| | | parent.layer.close(index); //再执行关闭 |
| | | }); |
| | | |
| | | //监听提交 |
| | | form.verify({ |
| | | numberOrEmpty: function (value, item) { |
| | |
| | | //} |
| | | } |
| | | }); |
| | | layer.load(3) |
| | | |
| | | table.render({ |
| | | elem: '#mainTable' |
| | | , url: GetWEBURL() + subUrl |
| | | , toolbar: '#toolbarDemo' //开启头部工具栏,并为其绑定左侧模板 |
| | | , defaultToolbar: ['filter', 'exports'] |
| | | , where: { sMsg: linterid, sMsg2: lentryid } |
| | | , cols: [[ |
| | | , { field: 'HMaterID', title: '物料ID', width: 100, hide: true } |
| | | , { field: 'HMaterNumber', title: '物料编码', width: 120 } |
| | | , { field: 'HMaterShortNumber', title: '物料代码', width: 120 } |
| | | , { field: 'HMaterName', title: '物料名称', width: 120 } |
| | | , { field: 'HMaterModel', title: '规格型号', width: 120 } |
| | | , { field: 'HUnitName', title: '计量单位', width: 100 } |
| | | , { field: 'HUnitNumber', title: '计量单位代码', 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, 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 } |
| | | , { field: 'HBatchNo', 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 } |
| | | , { 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 } |
| | | , { 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: '供应商ID', width: 150, hide: true } |
| | | , { field: 'HSupName', title: '供应商名称', width: 150, hide: true } |
| | | //进入页面查询表体物料信息 |
| | | if (mergeTags != 1) { |
| | | layer.load(3) |
| | | table.render({ |
| | | elem: '#mainTable' |
| | | , url: GetWEBURL() + subUrl |
| | | , toolbar: '#toolbarDemo' //开启头部工具栏,并为其绑定左侧模板 |
| | | , 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, hide: true } |
| | | , { field: 'HMaterShortNumber', title: '物料代码', width: 120, hide: true } |
| | | , { field: 'HSubjoin', title: '物料代码', width: 120, hide: true } |
| | | , { field: 'HMaterName', title: '物料名称', width: 120 } |
| | | , { field: 'HMaterModel', title: '规格型号', width: 120 } |
| | | , { field: 'HUnitName', title: '计量单位', width: 100 } |
| | | , { field: 'HUnitNumber', title: '计量单位代码', 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: '供应商ID', 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) { |
| | | console.log(res); |
| | | layer.closeAll("loading"); |
| | | } |
| | | }); |
| | | ]] |
| | | , done: function (res, curr, count) { |
| | | layer.closeAll("loading"); |
| | | } |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | //合并数量生成条码 |
| | | layer.load(3) |
| | | $.ajax({ |
| | | type: "GET", |
| | | url: GetWEBURL() + "/GetHBarCodeShowBillSub_Merge", |
| | | async: true, |
| | | data: { HInterID: linterid }, |
| | | dataType: "json", |
| | | success: function (data) { |
| | | if (data.count == 10000) { |
| | | var data = data.data; |
| | | var rowdata = []; |
| | | |
| | | for (var i = 0; i < data.length; i++) { |
| | | rowdata.push({ |
| | | "HMaterID": data[i].HMaterID, "HMaterNumber": data[i].HMaterNumber, "HOldMaterNumber": "" |
| | | , "HMaterShortNumber": "", "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": 0, "HBarcodeCount": data[i].HBarcodeCount |
| | | , "HNotBarcodeCount": data[i].HNotBarcodeCount, "HQty": data[i].HQty, "HMinQty": data[i].HQty, "HBQty": data[i].HBQty |
| | | , "HWXQty": data[i].HQty, "HWBQty": data[i].HWBQty, "HPrice": data[i].HPrice, "HMoney": data[i].HMoney, "HMTONO": "" |
| | | , "HBatchNo": data[i].HBatchNo, "HBatchManager": data[i].HBatchManager, "HISKFPERIOD": data[i].HISKFPERIOD |
| | | , "HEXPUNIT": data[i].HEXPUNIT, "HKFDate": data[i].HKFDate, "HKFPeriod": data[i].HKFPeriod, "HKFDQDate": data[i].HKFDQDate |
| | | , "HSupMaterNumber": data[i].HSupMaterNumber, "HSupBatchNo": data[i].HSupBatchNo, "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": "", "HIsSplit": data[i].HIsSplit |
| | | }); |
| | | } |
| | | |
| | | option.data = rowdata; |
| | | |
| | | table.render(option); |
| | | |
| | | } |
| | | else { |
| | | // $("#verifycode").click(); |
| | | f_alert(data.Message); |
| | | } |
| | | layer.closeAll("loading"); |
| | | }, |
| | | error: function (err) { |
| | | f_alert("错误:" + err); |
| | | 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({ |
| | |
| | | } |
| | | }); |
| | | break; |
| | | |
| | | |
| | | }; |
| | | }); |
| | | //监听行工具事件 |
| | |
| | | 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 //直接显示 |
| | |
| | | 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, |
| | | }); |
| | |
| | | $(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(parseInt(val.replace(/[^\d*\.?\d*]/g, ''))); |
| | | //}); |
| | | |
| | | $(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(parseInt(val.replace(/[^\d*\.?\d*]/g, ''))); |
| | | //}); |
| | | |
| | | $(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(parseInt(val.replace(/[^\d*\.?\d*]/g, ''))); |
| | | //}); |
| | | |
| | | $(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, '')); |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | //显示列数据 |
| | | //隐藏列设置 |
| | | 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是固定事件名,test是table原始容器的属性 lay-filter="对应的值" |
| | | var value = obj.value //得到修改后的值 |
| | | , data = obj.data //得到所在行所有键值 |