| | |
| | | <!--<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/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; |
| | |
| | | , 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 } |
| | |
| | | //} |
| | | } |
| | | }); |
| | | |
| | | //进入页面查询表体物料信息 |
| | | layer.load(3) |
| | | table.render({ |
| | |
| | | , { 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: '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: '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) { |
| | | layer.closeAll("loading"); |
| | | } |
| | | }, |
| | | }); |
| | | |
| | | //头工具栏事件 |
| | | table.on('toolbar(mainTable)', function (obj) { |
| | | var checkStatus = table.checkStatus(obj.config.id); |
| | |
| | | }); |
| | | } |
| | | 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; |
| | | |
| | | |
| | | }; |
| | | }); |
| | | //监听行工具事件 |
| | |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | //显示列数据 |
| | | //隐藏列设置 |
| | | 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 //得到所在行所有键值 |