yusijie
2023-06-25 1cbf77d8ff416802d313d55d78e6de0e60b42d9d
WebTM/views/²Ö´æ¹ÜÀí/ÌõÂëÉú³É/Gy_BarCodeBill.html
@@ -87,12 +87,10 @@
                                                        <option value="3">采购订单</option>
                                                        <option value="4">收料通知单</option>
                                                        <option value="5">委外订单</option>
                                                        <option value="6">退货通知单</option>
                                                        <option value="7">其他入库单</option>
                                                        <option value="8">直接调拨单</option>
                                                        <option value="9">采购退料单</option>
                                                        <option value="10">生产退料单</option>
                                                        <option value="11">组装拆卸单</option>
                                                        <option value="6">生产入库单</option>
                                                        <option value="7">采购入库单</option>
                                                        <option value="8">销售退货单</option>
                                                        <option value="9">生产退料单</option>
                                                    </select>
                                                </div>
                                            </div>
@@ -220,6 +218,10 @@
            var HBatchNo = "";
            var BatchNoArray; //用来存储获取到的批号,在批次按钮功能中用到
            var HMinQty2 = 0; //用来存储输入的最小包装数,在批次按钮功能中用到
            var HMaterInfo = "";  //存储物料信息
            var HBarInfo = ""; //存储条码信息
            var HFileList = "";  //存储档案列表
            //#endregion           
            //监听当前处于哪一个页签,传 HModName å€¼
@@ -229,17 +231,25 @@
                    HModName = "Gy_BarCodeBill";
                    //刷新表格数据
                    DisPlay_HideColumn();
                    table.reload('mainTable', {
                        data: HMaterInfo // è°ƒç”¨table.reload é‡æ–°æ¸²æŸ“显示加载追加了数据的表格
                    });
                    
                } else if (cur_title == "条码信息") {
                    HModName = "Gy_BarCodeBill_1";
                    //刷新表格数据
                    DisPlay_HideColumn1();
                    table.reload('mainTable1', {
                        data: HBarInfo // è°ƒç”¨table.reload é‡æ–°æ¸²æŸ“显示加载追加了数据的表格
                    });
                } else if (cur_title == "档案列表") {
                    HModName = "Gy_BarCodeBill_2";
                    //刷新表格数据
                    DisPlay_HideColumn2();
                    //加载档案列表
                    table.reload('mainTable2', {
                        data: HFileList // è°ƒç”¨table.reload é‡æ–°æ¸²æŸ“显示加载追加了数据的表格
                    });
                }
            })
@@ -253,6 +263,10 @@
            //加载条码类型数据
            set_HBarCodeType();                      
            var rowdata = [{
                "HMaterID": 0, "HMaterCode": "", "HMaterNumber": "", "HMaterName": "", "HMaterModel": "", "HMaterSpec": "", "HBatchNo": "", "HUnitID": 0, "HUnitNumber": "", "HUnitName": "", "HDesignLife": 0, "HLeaveLife": 0, "HUseLife": 0, "HQtyMust": 0, "HQty": 0, "HBQty": 0, "HMinQty": 0, "HPackQty": 0, "HPrice": 0, "HMoney": 0, "HWHID": 0, "HWHCode": "", "HWHName": "", "HSPID": 0, "HSPCode": "", "HSPName": "", "HStockOrgID": sessionStorage["OrganizationID"], "HRemark": "", "HCoilNO": "", "HFurnaceNO": "", "HFactory": "",
                "HAuxQty": 0, "HheatNO": "", "HProduceDate": Format(new Date(), "yyyy-MM-dd"), "HExpiryDate": Format(new Date(), "yyyy-MM-dd"), "HExpirationDateFlag": 0
            }];
            //初始化表格
            set_InitGrid();
            set_CountGrid();
@@ -272,12 +286,7 @@
            else {
                layer.alert("未知操作类型!", { icon: 5 });
            }
            //#endregion
            var rowdata = [{
                "HMaterID": 0, "HMaterCode": "", "HMaterNumber": "", "HMaterName": "", "HMaterModel": "", "HMaterSpec": "", "HBatchNo": "", "HUnitID": 0, "HUnitNumber": "", "HUnitName": "", "HDesignLife": 0, "HLeaveLife": 0, "HUseLife": 0, "HQtyMust": 0, "HQty": 0, "HPrice": 0, "HMoney": 0, "HWHID": 0, "HWHCode": "", "HWHName": "", "HSPID": 0, "HSPCode": "", "HSPName": "", "HStockOrgID": sessionStorage["OrganizationID"], "HRemark": "", "HCoilNO": "", "HFurnaceNO": "", "HFactory": "",
                "HAuxQty": 0, "HheatNO": "", "HProduceDate": Format(new Date(), "yyyy-MM-dd"), "HExpiryDate": Format(new Date(), "yyyy-MM-dd"), "HExpirationDateFlag": 0
            }];
            //#endregion
            //#region ç‚¹å‡»äº‹ä»¶ï¼ŒåŒ…括on和form事件
            //头工具栏
@@ -287,7 +296,7 @@
                var AddRow = table.cache['mainTable'];       
                var NewRow = {
                    "HMaterID": 0, "HMaterCode": "", "HMaterNumber": "", "HMaterName": "", "HMaterModel": "", "HMaterSpec": "", "HBatchNo": "", "HUnitID": 0, "HUnitNumber": "", "HUnitName": "", "HDesignLife": 0, "HLeaveLife": 0, "HUseLife": 0, "HQtyMust": 0, "HQty": 0, "HPrice": 0, "HMoney": 0, "HWHID": 0, "HWHCode": "", "HWHName": "", "HSPID": 0, "HSPCode": "", "HSPName": "", "HStockOrgID": sessionStorage["OrganizationID"], "HRemark": "", "HCoilNO": "", "HFurnaceNO": "", "HFactory": "",
                    "HMaterID": 0, "HMaterCode": "", "HMaterNumber": "", "HMaterName": "", "HMaterModel": "", "HMaterSpec": "", "HBatchNo": "", "HUnitID": 0, "HUnitNumber": "", "HUnitName": "", "HDesignLife": 0, "HLeaveLife": 0, "HUseLife": 0, "HQtyMust": 0, "HQty": 0, "HBQty": 0, "HMinQty": 0, "HPackQty": 0, "HPrice": 0, "HMoney": 0, "HWHID": 0, "HWHCode": "", "HWHName": "", "HSPID": 0, "HSPCode": "", "HSPName": "", "HStockOrgID": sessionStorage["OrganizationID"], "HRemark": "", "HCoilNO": "", "HFurnaceNO": "", "HFactory": "",
                    "HAuxQty": 0, "HheatNO": "", "HProduceDate": Format(new Date(), "yyyy-MM-dd"), "HExpiryDate": Format(new Date(), "yyyy-MM-dd"), "HExpirationDateFlag": 0
                };                   
                //console.log(NewRow);
@@ -444,6 +453,18 @@
                    case '5':
                        return "委外订单";
                        break;
                    case '6':
                        return "生产入库单";
                        break;
                    case '7':
                        return "采购入库单";
                        break;
                    case '8':
                        return "销售退货单";
                        break;
                    case '9':
                        return "生产退料单";
                        break;
                }
            }
@@ -506,12 +527,17 @@
                                    HMaterID = result.list[0].HMaterID;
                                    HBatchNo = result.list[0].HBatchNo;
                                    if (result.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                                        BatchNoArray = result.list;  //获取批号,用来给批次按钮功能中的批号赋值
                                        for (let i = 0; i < result.list.length; i++) {
                                            result.list[i].HMinQty = '';//点击单元格的时候默认值0不会清除,客户看了会觉得很怪,所以先用空字符串取代;
                                            result.list[i].HQty = result.list[i].HQty.toString().match(/^\d+(?:\.\d{0,6})?/)[0]  //保留小数点后六位小数
                                            if (result.list[i].HMinQty != 0) {
                                                result.list[i].HBQty = Math.ceil(result.list[i].HQty / result.list[i].HMinQty)
                                            }
                                        }
                                        BatchNoArray = result.list;  //获取批号,用来给批次按钮功能中的批号赋值
                                        //for (let i = 0; i < result.list.length; i++) {
                                        //    result.list[i].HMinQty = '';//点击单元格的时候默认值0不会清除,客户看了会觉得很怪,所以先用空字符串取代;
                                        //}
                                        table.reload('mainTable', {
                                            data: result.list // è°ƒç”¨table.reload é‡æ–°æ¸²æŸ“显示加载追加了数据的表格
                                        });
@@ -558,6 +584,7 @@
            form.on('submit(ToolCreate)', function (data) {
                $('#ToolCreate').addClass("layui-btn-disabled").attr("disabled", true);//生成按钮禁用
                var sSubStr = JSON.stringify(table.cache['mainTable']);
                HMaterInfo = table.cache['mainTable'];
                //物料明细信息不为空判断
                if (!AllowLoadData(sSubStr))//数据验证
                {
@@ -638,7 +665,7 @@
                        if (checkStatus.data.length === 0) {
                            return layer.msg('请选择数据');
                        }
                        var arr = [{ HBillNo: '', HMaterNumber: checkStatus.data[0].物料代码, HMaterName: checkStatus.data[0].物料名称, HMaterModel: '', HAuxPropNumber: '', HAuxPropName: '', HUnitNumber: checkStatus.data[0].计量单位代码, HUnitName: checkStatus.data[0].计量单位, HBatchNo: '', HGiveAwayFlag: '0', HQty: checkStatus.data[0].数量, HMinQty: '0', HPackQty: '0', HBQty: '0', HDate: '', HCusNumber: '', HCusName: '', HSeOrderBillNo: '', HRemark: '' }]
                        var arr = [{ HBillNo: '', HMaterNumber: checkStatus.data[0].物料代码, HMaterName: checkStatus.data[0].物料名称, HMaterModel: '', HAuxPropNumber: '', HAuxPropName: '', HUnitNumber: checkStatus.data[0].计量单位代码, HUnitName: checkStatus.data[0].计量单位, HBatchNo: '', HGiveAwayFlag: '0', HQty: checkStatus.data[0].数量.toString("#0.00"), HMinQty: checkStatus.data[0].最小包装数, HPackQty: '0', HBQty: '0', HDate: '', HCusNumber: '', HCusName: '', HSeOrderBillNo: '', HRemark: '' }]
                        //同步更新表格和缓存对应的值
                        table.reload('mainTable', {
                            data: arr // è°ƒç”¨table.reload é‡æ–°æ¸²æŸ“显示加载追加了数据的表格
@@ -793,7 +820,7 @@
            function set_InitGrid() {
                columns = [
                    { type: 'checkbox', fixed: 'left' }
                    , { templet: '#xuhao', title: '序号', sort: true, fixed: 'left', event: "qwe", width: 100 }
                    , { templet: '#xuhao', title: '序号', sort: true, fixed: 'left', event: "qwe", width: 75 }
                    , { field: 'HMainID', title: '源单主内码',  width: 100, hide: true }
                    , { field: 'HSubID', title: '源单子内码',  width: 100, hide: true }
                    , { field: 'HBillNo', title: '源单单号', width: 200 }
@@ -801,34 +828,32 @@
                    , { field: 'HMaterNumber', title: '物料代码', edit: 'text', event: 'HMaterNumber', width: 200 }
                    , { field: 'HMaterName', title: '物料名称',  width: 200 }
                    , { field: 'HMaterModel', title: '规格型号', width: 200 }
                    , { field: 'HBatchNo', title: '批号', edit: 'text', width: 100 }
                    , { field: 'HQty', title: '数量', edit: 'text', width: 100 }
                    , { field: 'HMinQty', title: '最小包装数', edit: 'text', width: 100 }
                    , { field: 'HBQty', title: '箱数', width: 100 }
                    , { field: 'HPackQty', title: '外箱数', edit: 'text', width: 100 }
                    , { field: 'HCoilNO', title: '钢卷捆包号', edit: 'text', width: 100 }
                    , { field: 'HFurnaceNO', title: '炉号', edit: 'text', width: 100 }
                    , { field: 'HFactory', title: '厂商', edit: 'text', width: 100 }
                    , { field: 'HCusID', title: '客户ID',  width: 100, hide: true }
                    , { field: 'HCusNumber', title: '客户代码', edit: 'text', event: 'HCusNumber', width: 120 }
                    , { field: 'HCusName', title: '客户名称', width: 120 }
                    , { field: 'HSeOrderBillNo', title: '销售订单号', width: 200 }
                    , { field: 'HRemark', title: '备注', edit: 'text', width: 100 }
                    , { field: 'HProduceDate', title: '生产日期', event: 'HProduceDate', width: 100 }
                    , { field: 'HExpiryDate', title: '保质期至', event: 'HExpiryDate', width: 100 }
                    , { field: 'HheatNO', title: '热处理', edit: 'text', width: 100 }
                    , { field: 'HAuxPropID', title: '辅助属性ID',  width: 100, hide: true }
                    , { field: 'HAuxPropNumber', title: '辅助属性代码', edit: 'text', event: 'HAuxPropNumber', width: 100 }
                    , { field: 'HAuxPropName', title: '辅助属性名称',  width: 100 }
                    , { field: 'HUnitID', title: '计量单位ID', width: 100, hide: true }
                    , { field: 'HUnitNumber', title: '计量单位代码', edit: 'text', event: 'HUnitNumber', width: 100 }
                    , { field: 'HUnitName', title: '计量单位',width: 100 }
                    , { field: 'HBatchNo', title: '批号', edit: 'text', width: 100 }
                    , { field: 'HCoilNO', title: '钢卷捆包号', edit: 'text', width: 100 }
                    , { field: 'HFurnaceNO', title: '炉号', edit: 'text', width: 100 }
                    , { field: 'HFactory', title: '厂商', edit: 'text', width: 100 }
                    , { field: 'HAuxQty', title: '辅单位数量', edit: 'text', width: 100 }
                    , { field: 'HheatNO', title: '热处理', edit: 'text', width: 100 }
                    , { field: 'HProduceDate', title: '生产日期', event: 'HProduceDate', width: 100 }
                    , { field: 'HExpiryDate', title: '保质期至', event: 'HExpiryDate', width: 100 }
                    , { field: 'HExpirationDateFlag', title: '是否启用保质期', width: 100, templet: '#switchTp3', unresize: false }
                    , { field: 'HGiveAwayFlag', title: '是否赠品', width: 100, templet: '#switchTpl', unresize: false }
                    , { field: 'HQty', title: '数量', edit: 'text', width: 100 }
                    , { field: 'HMinQty', title: '最小包装数', edit: 'text', width: 100 }
                    , { field: 'HBQty', title: '箱数', width: 100 }
                    , { field: 'HPackQty', title: '外箱数', edit: 'text', width: 100 }
                    , { field: 'HDate', title: '进料日期',  width: 100 }
                    , { field: 'HCusID', title: '客户ID',  width: 100, hide: true }
                    , { field: 'HCusNumber', title: '客户代码', edit: 'text', event: 'HCusNumber', width: 120 }
                    , { field: 'HCusName', title: '客户名称', width: 120 }
                    , { field: 'HSeOrderBillNo', title: '销售订单号', width: 200 }
                    , { field: 'HRemark', title: '备注', edit: 'text', width: 100 }
                    , { fixed: 'right', title: '操作', toolbar: '#barDemo' }
                ];
                option = {
@@ -836,7 +861,7 @@
                    , elem: '#mainTable'
                    , toolbar: '#toolbarDemo'
                    , page: false
                    , cellMinWidth: 120
                    , cellMinWidth: 75
                    , height: 'full-325'
                    , cols: [columns]
                    , limit: 500 //每页默认显示的数量
@@ -1411,6 +1436,13 @@
                                        HUnitName: checkStatus.data[0].HUnitName
                                    });
                                    if ($("#HBarCodeType").find("option:selected").html() == '托盘条码') {
                                        obj.update({
                                            HQty: 1,    //数量
                                            HMinQty: 1, //最小包装数量
                                            HBQty: 1    //箱数
                                        });
                                    }
                                    layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                                }
                                , btn2: function (index, layero) {
@@ -1570,12 +1602,14 @@
                                table.reload('mainTable1', {
                                    data: result.list // è°ƒç”¨table.reload é‡æ–°æ¸²æŸ“显示加载追加了数据的表格
                                });
                                HBarInfo = result.list;
                                //生成成功跳转到条码信息标签页
                                element.tabChange('tab-TabTest', '3'); 
                                //加载档案列表
                                table.reload('mainTable2', {
                                    data: result.data // è°ƒç”¨table.reload é‡æ–°æ¸²æŸ“显示加载追加了数据的表格
                                });
                                });
                                HFileList = result.data;
                            }
                            else {
                                $('#ToolCreate').removeClass("layui-btn-disabled").attr("disabled", false);//生成按钮启用