wtt
2025-11-03 486cb9f344acc45ecf0ce652fab7fbcf0f2bc45a
WebTM/views/Éú²ú¹ÜÀí/Éú²ú»ã±¨µ¥/Sc_Add_ICMOReportBillList.html
@@ -14,6 +14,7 @@
    <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
    <script src="../../../layuiadmin/PubCustom.js"></script>
    <script src="../../../layuiadmin/PageTitle.js"></script>
    <script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
    <style type="text/css">
        /*begin æ­¤æ ·å¼ç”¨äºŽæ¶ˆé™¤è¡Œå…ƒç´ ä¸­å¸ƒå±€å®½åº¦ä¸å¤Ÿçš„问题*/
        .layui-form-item .layui-inline {
@@ -37,7 +38,7 @@
                            <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="set_CheckBill" id="set_CheckBill">审核</button>
                            <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="set_AbandonCheck" id="set_AbandonCheck">反审核</button>
                            <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="set_DeleteBill" id="set_DeleteBill">删除</button>
                            <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="get_PrintReport" id="get_PrintReport">预览</button>
                            <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="get_PrintReport" id="get_PrintReport">打印</button>
                            <button type="button" id="add-btn" 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="Exit">退出</button>
                        </div>
@@ -124,8 +125,8 @@
                                        </div>
                                        <div class="layui-col-xs8 layui-inline">
                                            <label class="layui-form-label" style="width: 6.5%;">备注</label>
                                            <div class="layui-input-block">
                                                <input class="layui-input" name="HRemark" id="HRemark" autocomplete="off" style=" width: 75%;">
                                            <div class="layui-input-inline">
                                                <input class="layui-input" name="HRemark" id="HRemark" autocomplete="off" style=" width: 75%;">
                                            </div>
                                        </div>
                                    </div>
@@ -263,6 +264,7 @@
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
    </script>
    <script>
        var OptionData = [];
        //#region æŠ˜å æ³¨é‡Š
        //#endregion
        layui.config({
@@ -289,6 +291,7 @@
            //};
            var Sctag = "0";
            var columns = "";
            var HIsCheck = false;
            //#endregion
@@ -345,6 +348,26 @@
                set_EditFromGrid();
                //get_file();
            }
            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 });
            }
@@ -383,6 +406,26 @@
            table.on('tool(mainTable)', function (obj) {
                set_GridDelete(obj);   //行内删除
                set_GridCellCheck(obj); //行内快捷键筛选
                //#region ä¿®æ”¹è¡Œ æ—¶é—´
                var data = obj.data;
                //生产日期
                if (obj.event == 'HProduceDate') {
                    var field = $(this).data('field');
                    laydate.render({
                        elem: this.firstChild
                        , show: true //直接显示
                        , closeStop: this
                        , done: function (nowDate) {
                            //时间选择完成,行数据更新
                            data[field] = nowDate;
                            obj.update(data);
                            //刷新复选框
                            //checkRefresh();
                        }
                    });
                }
                //#endregion
            });
            //#endregion
@@ -403,7 +446,7 @@
                    shift: 2,
                    area: ['80%', '80%'],
                    maxmin: true,
                    content: ['../../基础资料/工资基础资料/Gy_Group.html', 'yes'],
                    content: ['../../基础资料/工资基础资料/Gy_Group.html?type=HGroup&openType=2', 'yes'],
                    btn: ['确定', '取消']
                    , btn1: function (index, layero) {
@@ -449,13 +492,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"
@@ -477,30 +513,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 {
@@ -532,7 +560,7 @@
            //#region æäº¤ä¿å­˜
            form.on('submit(Saver)', function (data) {//保存
                var refSav = "";
                if (OperationType == 1 || OperationType == 2) {
                if (OperationType == 1 || OperationType == 2 || OperationType == 4 || OperationType == 5) {
                    refSav = "Add";
                }
                if (OperationType == 3) {
@@ -543,6 +571,13 @@
                var row = [];
                for (var i = 0; i < table.cache['mainTable'].length; i++) {
                    if (table.cache['mainTable'][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.replaceAll("\"", "”").replaceAll(";", ";")
                        }
                        if (table.cache["mainTable"][i].HMaterSpec.indexOf("\"") != -1 || table.cache["mainTable"][i].HMaterSpec.indexOf(";") != -1) {
                            table.cache["mainTable"][i].HMaterSpec = table.cache["mainTable"][i].HMaterSpec.replaceAll("\"", "”").replaceAll(";", ";")
                        }
                        row.push(table.cache['mainTable'][i])
                    }
                }
@@ -606,6 +641,26 @@
            //#region åˆ é™¤
            form.on('submit(set_DeleteBill)', function (data) {
            });
            //#endregion
            //#region æ‰“印
            form.on('submit(get_PrintReport)', function (data) {
                if (HIsCheck == true) {
                    layer.open({
                        type: 2
                        , area: ['50%', '50%']
                        , title: '打印模版选择'
                        , shade: 0.6 //遮罩透明度
                        , maxmin: false //允许全屏最小化
                        , anim: 0 //0-6的动画形式,-1不开启
                        , content: ['../../BaseSet/SRM_OpenTmpList.html?linterid=' + $("#HInterID").val().toString() + '&MyMsg=' + $("#HInterID").val().toString() + '&Type=HICMOReport2', 'yes']
                        , resize: false
                    })
                }
                else {
                    layer.msg('请审核单据成功后打印!');
                }
            });
            //#endregion
@@ -684,6 +739,7 @@
                    data: { "HInterID": InterID, "IsAudit": 0, "CurUserName": sessionStorage["HUserName"] },
                    success: function (result) {
                        if (result.count == 1) {
                            HIsCheck = true;
                            layer.msg(result.Message, { time: 1 * 10000, icon: 1 }, function () {
                                // å¾—到frame索引
                                var index = layer.getFrameIndex(window.name);
@@ -718,7 +774,7 @@
                                shift: 2,
                                area: ['90%', '90%'],
                                maxmin: true,
                                content: ['../../基础资料/公用基础资料/Gy_Material.html', 'yes'],
                                content: ['../../基础资料/公用基础资料/Gy_Material.html?openType=2', 'yes'],
                                btn: ['确定', '取消']
                                , btn1: function (index, layero) {
                                    //按钮【按钮一】的回调
@@ -727,20 +783,68 @@
                                    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 () {
                                }, end: function () {
                                    if (OptionData != "" && OptionData != []) {
                                        //更新表格缓存的数据
                                        obj.update({
                                            HMaterID: OptionData.HItemID,
                                            HMaterCode: OptionData.物料代码,
                                            HMaterName: OptionData.物料名称,
                                            HMaterSpec: OptionData.规格型号,
                                            HUnitID: OptionData.HUnitID,
                                            HUnitCode: OptionData.计量单位代码,
                                            HUnitName: OptionData.计量单位名称,
                                        });
                                        OptionData = [];
                                    }
                                }
                            });
                        }
@@ -756,7 +860,7 @@
                                shift: 2,
                                area: ['90%', '90%'],
                                maxmin: true,
                                content: ['../../基础资料/公用基础资料/Gy_Unit.html', 'yes'],
                                content: ['../../基础资料/公用基础资料/Gy_Unit.html?Type=HUnitList', 'yes'],
                                btn: ['确定', '取消']
                                , btn1: function (index, layero) {
@@ -779,9 +883,16 @@
                                , btn2: function (index, layero) {
                                    //按钮【按钮二】的回调
                                    //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                                },
                                end: function () {
                                }, end: function () {
                                    if (OptionData != "" && OptionData != []) {
                                        //更新表格缓存的数据
                                        obj.update({
                                            HUnitID: OptionData.HItemID,
                                            HUnitCode: OptionData.计量单位代码,
                                            HUnitName: OptionData.计量单位名称
                                        });
                                        OptionData = [];
                                    }
                                }
                            });
                        }
@@ -797,7 +908,7 @@
                                shift: 2,
                                area: ['90%', '90%'],
                                maxmin: true,
                                content: ['../../基础资料/生产基础资料/Gy_Source.html', 'yes'],
                                content: ['../../基础资料/生产基础资料/Gy_Source.html?Htype=&openType=2', 'yes'],
                                btn: ['确定', '取消']
                                , btn1: function (index, layero) {
@@ -820,9 +931,16 @@
                                , btn2: function (index, layero) {
                                    //按钮【按钮二】的回调
                                    //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                                },
                                end: function () {
                                }, end: function () {
                                    if (OptionData.length > 0) {
                                        //更新表格缓存的数据
                                        obj.update({
                                            HSourceID: OptionData[0][0].HItemID,
                                            HSourceCode: OptionData[0][0].生产资源代码,
                                            HSourceName: OptionData[0][0].生产资源名称
                                        });
                                        OptionData = [];
                                    }
                                }
                            });
                        }
@@ -838,7 +956,7 @@
                                shift: 2,
                                area: ['90%', '90%'],
                                maxmin: true,
                                content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html', 'yes'],
                                content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?type=HManager', 'yes'],
                                btn: ['确定', '取消']
                                , btn1: function (index, layero) {
@@ -861,9 +979,16 @@
                                , btn2: function (index, layero) {
                                    //按钮【按钮二】的回调
                                    //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                                },
                                end: function () {
                                }, end: function () {
                                    if (OptionData.length > 0) {
                                        //更新表格缓存的数据
                                        obj.update({
                                            HWorkerid: OptionData[0].HItemID,
                                            HWorkerCode: OptionData[0].职员代码,
                                            HWorkerName: OptionData[0].职员名称
                                        });
                                        OptionData = [];
                                    }
                                }
                            });
                        }
@@ -882,23 +1007,24 @@
                    , { 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: 'HPRODUCEDATE', title: '生产日期', event: 'HProduceDate', width: 100 }
                    , { field: 'HSourceInterID', title: '源单内码', edit: 'text', width: 100, hide: true }
                    , { field: 'HSourceEntryID', title: '源单子内码', edit: 'text', width: 100, hide: true }
                    , { field: 'HSourceBillNo', title: '源单单号', edit: 'text', width: 100, hide: true }
@@ -1031,7 +1157,7 @@
                                        "HSourceName": data[i].生产资源名称, "HWorkerid": data[i].操作员ID, "HWorkerCode": data[i].操作员代码,
                                        "HWorkerName": data[i].操作员名称, "HQty": data[i].产量, "HBadQty": data[i].不良数量 == '' ? 0 : data[i].不良数量, "HICMOBillNo": data[i].生产订单号,
                                        "HICMOInterID": data[i].HICMOInterID, "HICMOEntryID": data[i].HICMOEntryID, "HRemark": "", "HSourceInterID": data[i].HICMOInterID, "HSourceEntryID": data[i].HICMOEntryID, "HSourceBillNo": data[i].生产订单号,
                                        "HSourceBillType": 3710, "HICMOTempID": data[i].HICMOTempID
                                        "HSourceBillType": 3710, "HICMOTempID": data[i].HICMOTempID,"HPRODUCEDATE": data[i].生产日期
                                    });
                                }
@@ -1075,12 +1201,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
@@ -1091,6 +1217,7 @@
                $.ajax({
                    url: GetWEBURL() + "Sc_ICMOReportBill/Sc_GetICMOReportBillListCheckDetai",
                    type: "GET",
                    async: false,
                    data: {
                        "HID": linterid
                    },
@@ -1109,8 +1236,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();
@@ -1132,6 +1259,7 @@
                $.ajax({
                    url: GetWEBURL() + 'Sc_ICMOReportBill/Sc_ICMOReportBillListProjectDetai',
                    type: "GET",
                    async: false,
                    data: { "sqlWhere": "and hmainid=" + linterid },
                    success: function (result) {
                        if (result.count == 1) {
@@ -1245,6 +1373,10 @@
                            layer.msg("明细记录第" + (i + 1) + "行,生产数量不能为空或0或者小于0!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            return Result = false;
                        }
                        //if (sSubStr[i].HPRODUCEDATE == "" || sSubStr[i].HPRODUCEDATE == null || sSubStr[i].HPRODUCEDATE == "undefined") {
                        //    layer.msg("明细记录第" + (i + 1) + "行,生产日期不允许为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                        //    return Result = false;
                        //}
                    }
                }
                else {
@@ -1272,7 +1404,7 @@
                    , area: ['90%', '90%']//大小
                    , title: '职员列表'//标题
                    , shift: 2//弹出动画
                    , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html', 'yes']
                    , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?type=HEmp', 'yes']
                    , btn: ['确定', '取消']
                    , btn1: function (index, layero) {//按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
@@ -1297,7 +1429,7 @@
                    , area: ['90%', '90%']//大小
                    , title: '部门列表'//标题
                    , shift: 2//弹出动画
                    , content: ['../../基础资料/公用基础资料/Gy_DepartmentList.html', 'yes']
                    , content: ['../../基础资料/公用基础资料/Gy_DepartmentList.html?openType=2&HOrgName=' + sessionStorage["Organization"], 'yes']
                    , btn: ['确定', '取消']
                    , btn1: function (index, layero) {//按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
@@ -1417,7 +1549,126 @@
                }
            }
            //#region ä¸‹æŽ¨é¡µé¢åˆå§‹åŒ–
            function setInit_PushBill() {
                //生成单据号和内码
                get_MAXNum();
                //初始化日期、制单人、制单日期
                $("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
                $("#HMaker").val(sessionStorage["HUserName"]);
                $("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd hh:mm:ss"));
                $("#HGroupID").val(sessionStorage["HGroupID"]); //根据登录用户带出班组ID
                $("#HGroupName").val(sessionStorage["HGroup"]); //根据登录用户带出班组
                $("#HEmpID").val(sessionStorage["HEmpID"]); //根据登录用户带出操作员ID
                $("#HEmpName").val(sessionStorage["HEmpName"]); //根据登录用户带出操作员
                var temp = HSouceBillType;
                if (temp == "3710") {
                    //获取
                    var data = getUrlVars_JSON().data;
                    var dataArray = [];
                    for (var i = 0; i < data.length; i++) {
                        var temp = getPushSource_ICMOBillInit(data[i].hmainid, data[i].hsubid);
                        if (temp != "none") {
                            dataArray.push(temp);
                        } else {
                            return;
                        }
                    }
                    form.val("component-form-group", { //formTest å³ class="layui-form" æ‰€åœ¨å…ƒç´ å±žæ€§ lay-filter="" å¯¹åº”的值
                        "HMainSourceInterID": "0"
                        , "HMainSourceEntryID": "0"
                        , "HMainSourceBillNo": ""
                        , "HMainSourceBillType": temp
                        , "HDeptID": dataArray[0].HDeptID
                        , "HDeptName": dataArray[0].生产车间
                        , "HMainSourceBillType": 2
                    });
                    $('#XDHList').addClass("layui-btn-disabled").attr("disabled", true);
                    $('#HMainSourceBillNo').addClass("layui-btn-disabled").attr("disabled", true);
                    document.getElementById('HMainSourceBillNo').style.backgroundColor = '#efefef4d'
                    //子表  èµ‹å€¼
                    var rowdata = [];
                    for (var i = 0; i < dataArray.length; i++) {
                        rowdata.push(
                            {
                                "HMaterID": dataArray[i].HMaterID
                                , "HMaterCode": dataArray[i].产品代码
                                , "HMaterName": dataArray[i].产品名称
                                , "HMaterSpec": dataArray[i].规格型号
                                , "HUnitID": dataArray[i].HUnitID
                                , "HUnitCode": dataArray[i].计量单位代码
                                , "HUnitName": dataArray[i].计量单位
                                , "HSourceID": sessionStorage["HSourceID"] == "" ? 0 : sessionStorage["HSourceID"]
                                , "HSourceCode": ""
                                , "HSourceName": sessionStorage["HSource"]
                                , "HWorkerid": sessionStorage["HEmpID"] == "" ? 0 : sessionStorage["HEmpID"]
                                , "HWorkerCode": sessionStorage["HEmpNumber"]
                                , "HWorkerName": sessionStorage["HEmpName"]
                                , "HQty": dataArray[i].未关联数量
                                , "HBadQty": 0
                                , "HICMOBillNo": dataArray[i].单据号
                                , "HICMOInterID": dataArray[i].hmainid
                                , "HICMOEntryID": dataArray[i].HEntryID
                                , "HSourceInterID": dataArray[i].hmainid
                                , "HSourceEntryID": dataArray[i].HEntryID
                                , "HSourceBillNo": dataArray[i].单据号
                                , "HSourceBillType": dataArray[i].单据类型
                                , 'HICMOTempID': "0"
                                , 'HRemark': ""
                                , 'HPRODUCEDATE': dataArray[i].生产日期
                            }
                        );
                    }
                    option.data = rowdata;
                    table.render(option);
                }
                else {
                    return layer.msg('当前不支持该源单下推!!');
                }
            }
            //#endregion
            //#region æ ¹æ®ä¸»å†…码与子内码获取源单生产订单数据
            function getPushSource_ICMOBillInit(HSourceInterID, HSourceEntryID) {
                var res = "none";
                $.ajax({
                    url: GetWEBURL() + "/Sc_ICMOBill/loadSc_ICMOBill_Push",
                    async: false,
                    type: "GET",
                    data: {
                        "HInterID": HSourceInterID
                        , "HSubID": HSourceEntryID
                    },
                    success: function (result) {
                        if (result.code == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            res = result.data[0];
                        } else {
                            res = result.data;
                            //layer.alert(result.msg, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        }
                    }, error: function () {
                        res = "none";
                        layer.alert("发生错误!", { icon: 5 });
                    }
                });
                return res;
            }
            //#endregion
            //#region èŽ·å–å‚æ•°_传递的JSON格式参数
            function getUrlVars_JSON() {
                var datajson;
                var str = window.location.search; //获取链接中传递的参数
                var arr = str.substring(str.lastIndexOf("=") + 1);
                datajson = $.parseJSON(decodeURI(arr));
                return datajson;
            }
            //#endregion
            //#endregion
@@ -1467,7 +1718,38 @@
            /*window.location.href = url;*/
            window.open(url)
        }
        //生产车间
        function GetHDeptNameValue(obj) {
            $("#HDeptName").val(obj[0].部门名称);
            $("#HDeptID").val(obj[0].HItemID);
            $("#HDeptNumber").val(obj[0].部门代码);
        }
        //生产班组
        function GetHGroupValue(obj) {
            $("#HGroupName").val(obj[0].班组名称);
            $("#HGroupID").val(obj[0].HItemID);
        }
        //统计员
        function GetHEmpValue(obj) {
            $("#HEmpName").val(obj[0].职员名称);
            $("#HEmpID").val(obj[0].HItemID);
        }
        //物料
        function GetGyMaterial(obj) {
            OptionData = obj;
        }
        //单位
        function GetHUnitListValue(obj) {
            OptionData = obj;
        }
        //生产资源
        function GetGySource(obj) {
            OptionData[0] = obj;
        }
        //操作员
        function GetHManagerValue(obj) {
            OptionData = obj;
        }
    </script>
</body>
</html>