1
zrg
2025-06-09 f0892b93ea156d99b908d2620d330c4b765fa50d
WebTM/views/Éú²ú¹ÜÀí/Éú²ú»ã±¨µ¥/Sc_Add_ICMOReportBillList.html
@@ -351,6 +351,23 @@
            else if (OperationType == 4) {//下推
                setInit_PushBill();
            }
            else if (OperationType == 5) {//复制
                set_EditFromGrid();
                //获取最大单据号
                get_MAXNum();
                //初始化制单人和制单时间
                $("#HMaker").val(sessionStorage["HUserName"]);
                $("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd"));
                $("#HUpDater").val();
                $("#HUpDateDate").val();
                $("#HChecker").val();
                $("#HCheckDate").val();
                $("#HCloseMan").val();
                $("#HCloseDate").val();
                $("#HDeleteMan").val();
                $("#HDeleteDate").val();
                //get_file();
            }
            else {
                layer.alert("未知操作类型!", { icon: 5 });
            }
@@ -455,13 +472,6 @@
                    content: ['../../PublicPage/ProductionOrder.html', 'yes'],
                    btn: ['确定', '取消']
                    , btn1: function (index, layero) {
                        option.data = [{
                            "HMaterID": 0, "HMaterCode": "", "HMaterName": "", "HMaterSpec": "", "HUnitID": 0, "HUnitCode": "", "HUnitName": "",
                            "HSourceID": 0, "HSourceCode": "", "HSourceName": "", "HWorkerid": 0, "HWorkerCode": "", "HWorkerName": "", "HQty": 0, "HBadQty": 0,
                            "HICMOBillNo": "", "HICMOInterID": "0", "HICMOEntryID": "0", "HRemark": "", "HSourceInterID": 0, "HSourceEntryID": 0, "HSourceBillNo": "",
                            "HSourceBillType": 0, "HICMOTempID": 0
                        }];
                        table.render(option);
                        //按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                        var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
@@ -483,30 +493,22 @@
                        if (isAllEqual(list))  //相同单号
                        {
                            //console.log(checkStatus.data);
                            if (checkStatus.data.length > 1) {
                                for (var i = 0; i < checkStatus.data.length - 1; i++) //补行
                                {
                                    //var NewRow = { "HMaterID": 0, "HMaterCode": "", "HMaterName": "", "HMaterSpec": "", "HUnitID": 0, "HUnitCode": "", "HUnitName": "", "HSourceID": 0, "HSourceCode": "", "HSourceName": "", "HWorkerid": 0, "HWorkerCode": "", "HWorkerName": "", "HQty": 0, "HRemark": "" };
                                    table.cache["mainTable"].push({
                                        "HMaterID": 0, "HMaterCode": "", "HMaterName": "", "HMaterSpec": "", "HUnitID": 0, "HUnitCode": "", "HUnitName": "",
                                        "HSourceID": 0, "HSourceCode": "", "HSourceName": "", "HWorkerid": 0, "HWorkerCode": "", "HWorkerName": "", "HQty": 0, "HBadQty": 0, "HICMOBillNo": "", "HICMOInterID": "0", "HICMOEntryID": "0", "HRemark": "", "HSourceInterID": 0, "HSourceEntryID": 0, "HSourceBillNo": "",
                                        "HSourceBillType": 0, "HICMOTempID": 0
                                    });
                                    option.data = table.cache["mainTable"];
                                    table.render(option);
                                }
                            var optionData = [];
                            for (var i = 0; i < checkStatus.data.length; i++) //补行
                            {
                                var NewRow = {
                                    "HMaterID": checkStatus.data[0].HMaterID, "HMaterCode": checkStatus.data[0].HMaterCode, "HMaterName": checkStatus.data[0].HMaterName, "HMaterSpec": checkStatus.data[0].HMaterSpec, "HUnitID": checkStatus.data[0].HUnitID, "HUnitCode": checkStatus.data[0].HUnitCode, "HUnitName": checkStatus.data[0].HUnitName,
                                    "HSourceID": 0, "HSourceCode": "", "HSourceName": "", "HWorkerid": 0, "HWorkerCode": "", "HWorkerName": "", "HQty": 0, "HBadQty": 0,
                                    "HICMOBillNo": checkStatus.data[0].单据号, "HICMOInterID": checkStatus.data[0].hmainid, "HICMOEntryID": checkStatus.data[0].HEntryID, "HRemark": "", "HSourceInterID": checkStatus.data[0].hmainid, "HSourceEntryID": checkStatus.data[0].HEntryID, "HSourceBillNo": checkStatus.data[0].单据号,
                                    "HSourceBillType": 3710
                                };
                                optionData.push(NewRow);
                            }
                            option.data = checkStatus.data;
                            table.render(option);
                            //for (var i = 0; i < checkStatus.data.length; i++) {
                            //    $('.layui-table-view[lay-id="mainTable"]').children('.layui-table-box').children('.layui-table-body').find('table tbody tr[data-index="' + i + '"]').find('td[data-field="HMaterID"] .layui-table-cell').text(checkStatus.data[i].HMaterID);
                            //    $('.layui-table-view[lay-id="mainTable"]').children('.layui-table-box').children('.layui-table-body').find('table tbody tr[data-index="' + i + '"]').find('td[data-field="HMaterCode"] .layui-table-cell').text(checkStatus.data[i].HMaterCode);
                            //    $('.layui-table-view[lay-id="mainTable"]').children('.layui-table-box').children('.layui-table-body').find('table tbody tr[data-index="' + i + '"]').find('td[data-field="HMaterName"] .layui-table-cell').text(checkStatus.data[i].HMaterName);
                            //    $('.layui-table-view[lay-id="mainTable"]').children('.layui-table-box').children('.layui-table-body').find('table tbody tr[data-index="' + i + '"]').find('td[data-field="HMaterSpec"] .layui-table-cell').text(checkStatus.data[i].HMaterSpec);
                            //    $('.layui-table-view[lay-id="mainTable"]').children('.layui-table-box').children('.layui-table-body').find('table tbody tr[data-index="' + i + '"]').find('td[data-field="HUnitID"] .layui-table-cell').text(checkStatus.data[i].HUnitID);
                            //    $('.layui-table-view[lay-id="mainTable"]').children('.layui-table-box').children('.layui-table-body').find('table tbody tr[data-index="' + i + '"]').find('td[data-field="HUnitCode"] .layui-table-cell').text(checkStatus.data[i].HUnitCode);
                            //    $('.layui-table-view[lay-id="mainTable"]').children('.layui-table-box').children('.layui-table-body').find('table tbody tr[data-index="' + i + '"]').find('td[data-field="HUnitName"] .layui-table-cell').text(checkStatus.data[i].HUnitName);
                            //}
                            table.reload("mainTable", {
                                data: optionData    //将数据重新载入表格
                            })
                            layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                        }
                        else {
@@ -538,7 +540,7 @@
            //#region æäº¤ä¿å­˜
            form.on('submit(Saver)', function (data) {//保存
                var refSav = "";
                if (OperationType == 1 || OperationType == 2 || OperationType == 4) {
                if (OperationType == 1 || OperationType == 2 || OperationType == 4 || OperationType == 5) {
                    refSav = "Add";
                }
                if (OperationType == 3) {
@@ -761,26 +763,65 @@
                                    if (checkStatus.data.length === 0) {
                                        return layer.msg('请选择数据');
                                    }
                                    //同步更新表格和缓存对应的值
                                    obj.update({
                                        HMaterID: checkStatus.data[0].HItemID,
                                        HMaterCode: checkStatus.data[0].物料代码,
                                        HMaterName: checkStatus.data[0].物料名称,
                                        HMaterSpec: checkStatus.data[0].规格型号,
                                    });
                                    //选中多行时
                                    if (checkStatus.data.length > 1) {
                                        var rowIndex = $(obj.tr).attr("data-index") * 1;  //attr("data-index")用于获取该tr元素上data-index属性的值*1转换类型然后赋值给rowIndex
                                        for (var i = 0; i < checkStatus.data.length; i++) {  //判断选中的数据的长度  ç”¨äºŽéåކcheckStatus.data数组中的每个元素
                                            if (rowIndex + i >= option.data.length) {           //判断rowIndex + i的索引超出了option.data数组的长度,说明option.data数组需要扩展以包含更多行
                                                var NewRow = {
                                                    "HMaterID": 0, "HMaterCode": "", "HMaterName": "", "HMaterSpec": "", "HUnitID": 0, "HUnitCode": "", "HUnitName": "",
                                                    "HSourceID": 0, "HSourceCode": "", "HSourceName": "", "HWorkerid": 0, "HWorkerCode": "", "HWorkerName": "", "HQty": 0, "HBadQty": 0,
                                                    "HICMOBillNo": "", "HICMOInterID": "0", "HICMOEntryID": "0", "HRemark": "", "HSourceInterID": 0, "HSourceEntryID": 0, "HSourceBillNo": "",
                                                    "HSourceBillType": 0
                                                };
                                                table.cache["mainTable"].push(NewRow);    //创建新的包含数组  ä¼ å…¥table.cache["mainTable"]数组
                                                option.data = table.cache["mainTable"];  //把传入 table.cache["mainTable"]数组的值赋值给option.data çš„属性
                                                table.render(option);//渲染界面
                                            }
                                            option.data[rowIndex + i].HMaterID = checkStatus.data[i].HItemID;  //将option.data数组中对应行的HMaterID属性更新为从resultData对象中获取的物料ID
                                            option.data[rowIndex + i].HMaterCode = checkStatus.data[i].物料代码; //将option.data数组中对应行的 ç‰©æ–™ä»£ç  å±žæ€§æ›´æ–°ä¸ºä»ŽresultData对象中获取的物料ID
                                            option.data[rowIndex + i].HMaterName = checkStatus.data[i].物料名称; //将option.data数组中对应行的  ç‰©æ–™åç§°  å±žæ€§æ›´æ–°ä¸ºä»ŽresultData对象中获取的物料ID
                                            option.data[rowIndex + i].HMaterSpec = checkStatus.data[i].规格型号; //将option.data数组中对应行的  è§„格型号  å±žæ€§æ›´æ–°ä¸ºä»ŽresultData对象中获取的物料ID
                                            option.data[rowIndex + i].HUnitID = checkStatus.data[i].HUnitID; //将option.data数组中对应行的 HUnitID å±žæ€§æ›´æ–°ä¸ºä»ŽresultData对象中获取的物料ID
                                            option.data[rowIndex + i].HUnitCode = checkStatus.data[i].计量单位代码;
                                            option.data[rowIndex + i].HUnitName = checkStatus.data[i].计量单位名称; //将option.data数组中对应行的 è®¡é‡å•位 å±žæ€§æ›´æ–°ä¸ºä»ŽresultData对象中获取的物料ID   æ›´æ–°è®¡é‡å•位属性
                                        }
                                        table.render(option); //重新渲染表格以显示更新后的数据
                                    } else {
                                        //同步更新表格和缓存对应的值
                                        obj.update({
                                            HMaterID: checkStatus.data[0].HItemID,
                                            HMaterCode: checkStatus.data[0].物料代码,
                                            HMaterName: checkStatus.data[0].物料名称,
                                            HMaterSpec: checkStatus.data[0].规格型号,
                                            HUnitID: checkStatus.data[0].HUnitID,
                                            HUnitCode: checkStatus.data[0].计量单位代码,
                                            HUnitName: checkStatus.data[0].计量单位名称,
                                        });
                                    }
                                    layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                                }
                                , btn2: function (index, layero) {
                                    //按钮【按钮二】的回调
                                    //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                                }, end: function () {
                                    if (OptionData.length > 0) {
                                    if (OptionData != "" && OptionData != []) {
                                        //更新表格缓存的数据
                                        obj.update({
                                            HMaterID: OptionData[0].HItemID,
                                            HMaterCode: OptionData[0].物料代码,
                                            HMaterName: OptionData[0].物料名称,
                                            HMaterSpec: OptionData[0].规格型号,
                                            HMaterID: OptionData.HItemID,
                                            HMaterCode: OptionData.物料代码,
                                            HMaterName: OptionData.物料名称,
                                            HMaterSpec: OptionData.规格型号,
                                            HUnitID: OptionData.HUnitID,
                                            HUnitCode: OptionData.计量单位代码,
                                            HUnitName: OptionData.计量单位名称,
                                        });
                                        OptionData = [];
                                    }
@@ -799,7 +840,7 @@
                                shift: 2,
                                area: ['90%', '90%'],
                                maxmin: true,
                                content: ['../../基础资料/公用基础资料/Gy_Unit.html?Type=HUnitList&openType=2', 'yes'],
                                content: ['../../基础资料/公用基础资料/Gy_Unit.html?Type=HUnitList', 'yes'],
                                btn: ['确定', '取消']
                                , btn1: function (index, layero) {
@@ -823,12 +864,12 @@
                                    //按钮【按钮二】的回调
                                    //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                                }, end: function () {
                                    if (OptionData.length > 0) {
                                    if (OptionData != "" && OptionData != []) {
                                        //更新表格缓存的数据
                                        obj.update({
                                            HUnitID: OptionData[0].HItemID,
                                            HUnitCode: OptionData[0].计量单位代码,
                                            HUnitName: OptionData[0].计量单位名称
                                            HUnitID: OptionData.HItemID,
                                            HUnitCode: OptionData.计量单位代码,
                                            HUnitName: OptionData.计量单位名称
                                        });
                                        OptionData = [];
                                    }
@@ -874,9 +915,9 @@
                                    if (OptionData.length > 0) {
                                        //更新表格缓存的数据
                                        obj.update({
                                            HSourceID: OptionData[0].HItemID,
                                            HSourceCode: OptionData[0].生产资源代码,
                                            HSourceName: OptionData[0].生产资源名称
                                            HSourceID: OptionData[0][0].HItemID,
                                            HSourceCode: OptionData[0][0].生产资源代码,
                                            HSourceName: OptionData[0][0].生产资源名称
                                        });
                                        OptionData = [];
                                    }
@@ -946,22 +987,22 @@
                    , { templet: '#xuhao', title: '序号', sort: true, fixed: 'left', event: "qwe", width: 100 }
                    , { field: 'HMaterID', title: 'HMaterID', edit: 'text', width: 100, hide: true }
                    , { field: 'HMaterCode', title: '物料代码', edit: 'text', event: 'HMaterCode', width: 100 }
                    , { field: 'HMaterName', title: '物料名称', edit: 'text', width: 100 }
                    , { field: 'HMaterSpec', title: '规格型号', edit: 'text', width: 100 }
                    , { field: 'HMaterName', title: '物料名称', style: 'background-color:#efefef4d;', width: 100 }
                    , { field: 'HMaterSpec', title: '规格型号', style: 'background-color:#efefef4d;', width: 100 }
                    , { field: 'HUnitID', title: 'HUnitID', edit: 'text', width: 100, hide: true }
                    , { field: 'HUnitCode', title: '单位代码', edit: 'text', event: 'HUnitCode', width: 100 }
                    , { field: 'HUnitName', title: '单位名称', edit: 'text', width: 100 }
                    , { field: 'HUnitName', title: '单位名称', style: 'background-color:#efefef4d;', width: 100 }
                    , { field: 'HSourceID', title: 'HSourceID', edit: 'text', width: 100, hide: true }
                    , { field: 'HSourceCode', title: '资源代码', edit: 'text', event: 'HSourceCode', width: 100 }
                    , { field: 'HSourceName', title: '资源名称', edit: 'text', width: 100 }
                    , { field: 'HSourceName', title: '资源名称', style: 'background-color:#efefef4d;', width: 100 }
                    , { field: 'HWorkerid', title: 'HWorkerid', edit: 'text', width: 100, hide: true }
                    , { field: 'HWorkerCode', title: '操作员代码', edit: 'text', event: 'HWorkerCode', width: 100 }
                    , { field: 'HWorkerName', title: '操作员名称', edit: 'text', width: 100 }
                    , { field: 'HWorkerName', title: '操作员名称', style: 'background-color:#efefef4d;', width: 100 }
                    , { field: 'HQty', title: '生产数量', edit: 'text', width: 100, totalRow: true }
                    , { field: 'HBadQty', title: '不良数量', edit: 'text', width: 100, totalRow: true }
                    , { field: 'HICMOBillNo', title: '生产订单', edit: 'text', width: 100 }
                    , { field: 'HICMOInterID', title: '生产订单内码', edit: 'text', width: 100, hide: true }
                    , { field: 'HICMOEntryID', title: '生产订单子内码', edit: 'text', width: 100, hide: true }
                    , { field: 'HICMOBillNo', title: '生产订单', style: 'background-color:#efefef4d;', width: 100 }
                    , { field: 'HICMOInterID', title: '生产订单内码', style: 'background-color:#efefef4d;', width: 100, hide: true }
                    , { field: 'HICMOEntryID', title: '生产订单子内码', style: 'background-color:#efefef4d;', width: 100, hide: true }
                    , { field: 'HSourceInterID', title: '源单内码', edit: 'text', width: 100, hide: true }
                    , { field: 'HSourceEntryID', title: '源单子内码', edit: 'text', width: 100, hide: true }
@@ -1139,12 +1180,12 @@
            function set_EditFromGrid() {
                set_EditForm(linterid);  //编辑获取表头
                set_EditGrid(linterid);  //编辑获取表体
                option.data = [{
                    "HMaterID": 0, "HMaterCode": "", "HMaterName": "", "HMaterSpec": "", "HUnitID": 0, "HUnitCode": "", "HUnitName": "",
                    "HSourceID": 0, "HSourceCode": "", "HSourceName": "", "HWorkerid": 0, "HWorkerCode": "", "HWorkerName": "", "HQty": 0, "HBadQty": 0,
                    "HICMOBillNo": "", "HICMOInterID": "0", "HICMOEntryID": "0", "HRemark": "", "HSourceInterID": 0, "HSourceEntryID": 0, "HSourceBillNo": "",
                    "HSourceBillType": 0, "HICMOTempID": 0
                }];
                //option.data = [{
                //    "HMaterID": 0, "HMaterCode": "", "HMaterName": "", "HMaterSpec": "", "HUnitID": 0, "HUnitCode": "", "HUnitName": "",
                //    "HSourceID": 0, "HSourceCode": "", "HSourceName": "", "HWorkerid": 0, "HWorkerCode": "", "HWorkerName": "", "HQty": 0, "HBadQty": 0,
                //    "HICMOBillNo": "", "HICMOInterID": "0", "HICMOEntryID": "0", "HRemark": "", "HSourceInterID": 0, "HSourceEntryID": 0, "HSourceBillNo": "",
                //    "HSourceBillType": 0, "HICMOTempID": 0
                //}];
                table.render(option);
            }
            //#endregion
@@ -1155,6 +1196,7 @@
                $.ajax({
                    url: GetWEBURL() + "Sc_ICMOReportBill/Sc_GetICMOReportBillListCheckDetai",
                    type: "GET",
                    async: false,
                    data: {
                        "HID": linterid
                    },
@@ -1173,8 +1215,8 @@
                            $("#HEmpID").val(data.HEmpID);
                            $("#HEmpName").val(data.统计员);
                            $("#HMainSourceBillNo").val(data.HMainSourceBillNo);
                            $("#HMainSourceInterID").val(data.HMainSourceInterID);
                            $("#HMainSourceEntryID").val(data.HMainSourceEntryID);
                            $("#HMainSourceInterID").val(data.HMainSourceInterID == null ? 0 : data.HMainSourceInterID);
                            $("#HMainSourceEntryID").val(data.HMainSourceEntryID == null ? 0 : data.HMainSourceEntryID);
                            $("#HExplanation").val("");
                            $("#HRemark").val(data.表头备注);
                            PicUpload();
@@ -1196,6 +1238,7 @@
                $.ajax({
                    url: GetWEBURL() + 'Sc_ICMOReportBill/Sc_ICMOReportBillListProjectDetai',
                    type: "GET",
                    async: false,
                    data: { "sqlWhere": "and hmainid=" + linterid },
                    success: function (result) {
                        if (result.count == 1) {
@@ -1666,7 +1709,7 @@
            $("#HEmpID").val(obj[0].HItemID);
        }
        //物料
        function GetMaterValue(obj) {
        function GetGyMaterial(obj) {
            OptionData = obj;
        }
        //单位