yxj
2024-01-05 fdb3bd9783ed41c8f7ef82732e3aa1ada3d28f37
WebTM/views/Éú²ú¹ÜÀí/Éú²ú»ã±¨µ¥/Sc_Add_ICMOReportBillList.html
@@ -14,7 +14,6 @@
    <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
    <script src="../../../layuiadmin/PubCustom.js"></script>
    <style type="text/css">
        /*begin æ­¤æ ·å¼ç”¨äºŽæ¶ˆé™¤è¡Œå…ƒç´ ä¸­å¸ƒå±€å®½åº¦ä¸å¤Ÿçš„问题*/
        .layui-form-item .layui-inline {
            margin-top: 5px;
@@ -29,7 +28,7 @@
    <div class="layui-fluid" style="padding: 0;">
        <div class="layui-card" style="padding: 15px;">
            <div class="layui-card-body" style="padding: 1px;">
                <form class="layui-form" action="" lay-filter="formData" style="background-color:white;">
                <form class="layui-form" action="" lay-filter="component-form-group" style="background-color:white;">
                    <div class="layui-card-header">
                        <div class="layui-btn-group">
                            <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="set_AddNew" id="set_AddNew">新增</button>
@@ -115,8 +114,8 @@
                                            <label class="layui-form-label">选单号</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="HMainSourceBillNo" id="HMainSourceBillNo" class="layui-input" value="" style="float:left;width:150px;">
                                                <input type="hidden" name="HMainSourceInterID" id="HMainSourceInterID" class="layui-input" value="" style="float:left;width:150px;">
                                                <input type="hidden" name="HMainSourceEntryID" id="HMainSourceEntryID" class="layui-input" value="" style="float:left;width:150px;">
                                                <input type="hidden" name="HMainSourceInterID" id="HMainSourceInterID" class="layui-input" value="0" style="float:left;width:150px;">
                                                <input type="hidden" name="HMainSourceEntryID" id="HMainSourceEntryID" class="layui-input" value="0" style="float:left;width:150px;">
                                                <button type="button" lay-submit="" class="layui-btn" lay-filter="XDHList" id="XDHList" style="width:40px;">
                                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
                                                </button>
@@ -228,7 +227,22 @@
                            </div>
                        </div>
                    </div>
                    <table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
                    <div class="layui-tab layui-tab-card">
                        <ul class="layui-tab-title">
                            <li class="layui-this">生产汇报单</li>
                            <li>产量汇报单明细</li>
                        </ul>
                        <div class="layui-tab-content">
                            <div class="layui-tab-item layui-show">
                                <!--生产汇报单明细-->
                                <table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
                            </div>
                            <div class="layui-tab-item">
                                <!--产量汇报单-->
                                <table class="layui-hide" id="mainTable_prodReport" lay-filter="mainTable_prodReport"></table>
                            </div>
                        </div>
                    </div>
                    <script type="text/html" id="toolbarDemo">
                        <div class="layui-btn-container">
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-AddLine" id="btn-AddLine"><i class="layui-icon layui-icon-form"></i>增加一行</button>
@@ -255,8 +269,8 @@
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'laydate', 'table', 'element', 'upload'], function () {
        //#region å…¬ç”¨å˜é‡
            //#region å…¬ç”¨å˜é‡
            var $ = layui.$
                , admin = layui.admin
                , layer = layui.layer
@@ -266,17 +280,18 @@
                , laydate = layui.laydate
                , element = layui.element;
            var option;
            var option_prodReport;
            var sBillType = "3711";
            var TabRow = {
                "HMaterID": 0, "HMaterCode": "", "HMaterName": "", "HMaterSpec": "", "HUnitID": 0, "HUnitCode": "", "HUnitName": "",
                "HSourceID": 0, "HSourceCode": "", "HSourceName": "", "HWorkerid": 0, "HWorkerCode": "", "HWorkerName": "", "HQty": 0, "HRemark": ""
            };
            //var TabRow = {
            //    "HMaterID": 0, "HMaterCode": "", "HMaterName": "", "HMaterSpec": "", "HUnitID": 0, "HUnitCode": "", "HUnitName": "",
            //    "HSourceID": 0, "HSourceCode": "", "HSourceName": "", "HWorkerid": 0, "HWorkerCode": "", "HWorkerName": "", "HQty": 0,"HBadQty":0, "HRemark": ""
            //};
            var Sctag = "0";
            var columns = "";
        //#endregion
            //#endregion
        //#region è¿›å…¥é¡µé¢å³åŠ è½½
            //#region è¿›å…¥é¡µé¢å³åŠ è½½
            //判断是否登录 æœªç™»å½•则跳到登录页
            get_LoginIs();
@@ -301,24 +316,36 @@
            }
            //判断操作类型
            if (OperationType == 1) {//无源单新增
                $("#HDeptID").val(sessionStorage["HDeptID"]); //根据登录用户带出部门ID
                $("#HDeptName").val(sessionStorage["HDept"]); //根据登录用户带出部门
                $("#HGroupID").val(sessionStorage["HGroupID"]); //根据登录用户带出班组ID
                $("#HGroupName").val(sessionStorage["HGroup"]); //根据登录用户带出班组
                $("#HEmpID").val(sessionStorage["HEmpID"]); //根据登录用户带出操作员ID
                $("#HEmpName").val(sessionStorage["HEmpName"]); //根据登录用户带出操作员
                set_AddFNew();
            }
            else if (OperationType == 2) {//有源单新增
                $("#HDeptID").val(sessionStorage["HDeptID"]); //根据登录用户带出部门ID
                $("#HDeptName").val(sessionStorage["HDept"]); //根据登录用户带出部门
                $("#HGroupID").val(sessionStorage["HGroupID"]); //根据登录用户带出班组ID
                $("#HGroupName").val(sessionStorage["HGroup"]); //根据登录用户带出班组
                $("#HEmpID").val(sessionStorage["HEmpID"]); //根据登录用户带出操作员ID
                $("#HEmpName").val(sessionStorage["HEmpName"]); //根据登录用户带出操作员
                set_AddNew();
            }
            else if (OperationType == 3) {//编辑
                set_EditFromGrid();
                get_file();
                //get_file();
            }
            else {
                layer.alert("未知操作类型!", { icon: 5 });
            }
        //#endregion
            //#endregion
        //#region è§¦å‘事件:包括form.on(){}格式的所有点击事件、选择事件等
            //#region è§¦å‘事件:包括form.on(){}格式的所有点击事件、选择事件等
            //#region å¤´å·¥å…·æ äº‹ä»¶
            table.on('toolbar(mainTable)', function (obj) {
@@ -326,7 +353,13 @@
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;;
                var AddRow = table.cache['mainTable'];
                var NewRow = TabRow;
                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
                };
                switch (obj.event) {
                    //新增一行
                    case 'btn-AddLine': btnAddLine(NewRow);
@@ -408,7 +441,12 @@
                    content: ['../../PublicPage/ProductionOrder.html', 'yes'],
                    btn: ['确定', '取消']
                    , btn1: function (index, layero) {
                        option.data = [TabRow];
                        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
                        }];
                        table.render(option);
                        //按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
@@ -430,25 +468,31 @@
                        }
                        if (isAllEqual(list))  //相同单号
                        {
                            console.log(checkStatus.data);
                            //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(TabRow);
                                    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
                                    });
                                    option.data = table.cache["mainTable"];
                                    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);
                            }
                            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);
                            //}
                            layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                        }
                        else {
@@ -480,16 +524,23 @@
            //#region æäº¤ä¿å­˜
            form.on('submit(Saver)', function (data) {//保存
                var refSav = "";
                if (linterid == "" || linterid == null) {
                if (OperationType == 1 || OperationType == 2) {
                    refSav = "Add";
                }
                if (linterid != "" && linterid != null) {
                if (OperationType == 3) {
                    refSav = "Update";
                }
                data.field.HMaker = sessionStorage["HUserName"];//制单人
                //筛选删除之后不为空的数据组
                var row = [];
                for (var i = 0; i < table.cache['mainTable'].length; i++) {
                    if (table.cache['mainTable'][i] != "") {
                        row.push(table.cache['mainTable'][i])
                    }
                }
                var sMainStr = JSON.stringify(data.field);
                var sSubStr = JSON.stringify(table.cache['mainTable']);
                var sMainSub = sMainStr + ';' + sSubStr + ';' + refSav;
                var sSubStr = JSON.stringify(row);
                var sMainSub = sMainStr + ';' + sSubStr + ';' + refSav + ";" + sessionStorage["HUserName"];
                if (!AllowLoadData(sSubStr))//数据验证
                {
                    return false;
@@ -503,9 +554,10 @@
                    success: function (data) {
                        if (data.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            layer.msg(data.Message, { time: 1 * 1000, icon: 1 }, function () {
                                $('#add-btn').addClass("layui-btn-disabled").attr("disabled", true);
                                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                parent.layer.close(index); //再执行关闭 Â  Â  Â  Â  Â Â  Â Â Â  Â 
                                $('#add-btn').addClass("layui-btn-disabled").attr("disabled", true);//保存按钮禁用
                                $('#set_CheckBill').removeClass("layui-btn-disabled").attr("disabled", false);//审核按钮启用
                                //var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                //parent.layer.close(index); //再执行关闭 Â  Â  Â  Â  Â Â  Â Â Â  Â 
                            });
                        }
                        else {
@@ -533,7 +585,7 @@
            //#region å®¡æ ¸
            form.on('submit(set_CheckBill)', function (data) {
                set_CheckBill()
            });
            //#endregion
@@ -549,10 +601,10 @@
            });
            //#endregion
        //#endregion
            //#endregion
        //#region æœ¬é¡µé¢æ‰€æœ‰è¢«è°ƒç”¨çš„æ–¹æ³•
            //#region æœ¬é¡µé¢æ‰€æœ‰è¢«è°ƒç”¨çš„æ–¹æ³•
            //#region åˆå§‹åŒ–表单
            function set_InitFrom() {
@@ -564,9 +616,15 @@
            //#region è¡¨æ ¼å¢žåŠ è¡Œäº‹ä»¶
            function btnAddLine(NewRow) {
                table.cache["mainTable"].push(NewRow);
                option.data = table.cache["mainTable"];
                table.render(option);
                var tableBak = table.cache["mainTable"]; //获取之前编辑过的表格数据
                buttonArr = [];//清空数组
                for (var i = 0; i < tableBak.length; i++) {
                    buttonArr.push(tableBak[i]);  //将之前的数据存储
                }
                buttonArr.push(NewRow);  //在尾部加一行
                table.reload("mainTable", {
                    data: buttonArr    //将数据重新载入表格
                })
            }
            //#endregion
@@ -605,6 +663,35 @@
                        }
                    });
                }
            }
            //#endregion
            //#region å®¡æ ¸
            function set_CheckBill() {
                var InterID = $("#HInterID").val();
                //逻辑审核方法
                $.ajax({
                    type: "GET",
                    url: GetWEBURL() + "/Sc_ICMOReportBill/AuditProcessReportList", //方法所在页面和方法名
                    data: { "HInterID": InterID, "IsAudit": 0, "CurUserName": sessionStorage["HUserName"] },
                    success: function (result) {
                        if (result.count == 1) {
                            layer.msg(result.Message, { time: 1 * 10000, icon: 1 }, function () {
                                // å¾—到frame索引
                                var index = layer.getFrameIndex(window.name);
                                //关闭当前frame
                                layer.close(index);
                                //修改为功后刷新界面
                                $("#btnSearch").trigger('click');
                            });
                        } else {
                            layer.alert(result.code + result.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            }
            //#endregion
@@ -799,6 +886,16 @@
                    , { field: 'HWorkerCode', title: '操作员代码', edit: 'text', event: 'HWorkerCode', width: 100 }
                    , { field: 'HWorkerName', title: '操作员名称', edit: 'text', width: 100 }
                    , { field: 'HQty', title: '生产数量', edit: 'text', width: 100 }
                    , { field: 'HBadQty', title: '不良数量', edit: 'text', width: 100 }
                    , { 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: '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 }
                    , { field: 'HSourceBillType', title: '源单类型', edit: 'text', width: 100, hide: true }
                    , { field: 'HRemark', title: '表体备注', edit: 'text', width: 100 }
                    , { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 150 }
                ];
@@ -810,6 +907,39 @@
                    , cellMinWidth: 120
                    , height: 500
                    , cols: [columns]
                    , done: function (res, curr, count) {
                    }
                };
                columns_prodReport = [
                    { type: 'checkbox', fixed: 'left' }
                    , { 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: '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: '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: 'HQty', title: '生产数量', edit: 'text', width: 100 }
                    , { field: 'HBadQty', title: '不良数量', edit: 'text', width: 100 }
                    , { field: 'HICMOBillNo', title: '生产订单', edit: 'text', width: 100 }
                    , { field: 'HRemark', title: '表体备注', edit: 'text', width: 100 }
                    , { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 150 }
                ];
                option_prodReport = {
                    id: 'mainTable_prodReport'
                    , elem: '#mainTable_prodReport'
                    , page: true
                    , limit: 1000
                    , limits: [500, 1000, 1500, 2000, 3000]
                    , cellMinWidth: 120
                    , height: 500
                    , cols: [columns_prodReport]
                    , done: function (res, curr, count) {
                    }
@@ -833,7 +963,7 @@
                    success: function (d) {
                        //console.log(d.data);
                        $("#HBillNo").val(d.data[0].HBillNo);
                        $("#HInterID").val(0);
                        $("#HInterID").val(d.data[0].HInterID);
                        $("#HDate").val(Pub_Format(new Date(), "yyyy-MM-dd"));
                        $("#HMakeDate").val(Pub_Format(new Date(), "yyyy-MM-dd"));
                        $("#HMaker").val(sessionStorage["HUserName"]);
@@ -853,7 +983,12 @@
                $('#set_AbandonCheck').addClass("layui-btn-disabled").attr("disabled", true);
                $('#set_DeleteBill').addClass("layui-btn-disabled").attr("disabled", true);
                $('#get_PrintReport').addClass("layui-btn-disabled").attr("disabled", true);
                option.data = [TabRow];
                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
                }];
                table.render(option);
            }
            //#endregion
@@ -862,8 +997,66 @@
            function set_AddNew() {
                //获取最大单据号
                get_MAXNum();
                option.data = [TabRow];
                table.render(option);
                if (linterid.length > 0 && HSouceBillType == 3724) {
                    var arr = [];
                    var arr_detail = [];
                    $.ajax({
                        url: GetWEBURL() + "Sc_ICMOReportBill/GetProdReportBillList",
                        type: "GET",
                        data: {
                            "HInterID": linterid,
                            "user": sessionStorage["HUserName"]
                        },
                        async: false,
                        success: function (result) {
                            if (result.code == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                                var data = result.data.h_p_Sc_ICMOBillWorkQtyStatus_TmpList1; //汇总信息
                                var data_detail = result.data.h_p_Sc_ICMOBillWorkQtyStatus_TmpList; //明细信息
                                for (let i = 0; i < data.length; i++) {
                                    arr.push({
                                        "HMaterID": data[i].物料ID, "HMaterCode": data[i].物料代码, "HMaterName": data[i].物料名称, "HMaterSpec": data[i].规格型号,
                                        "HUnitID": 0, "HUnitCode": "", "HUnitName": "", "HSourceID": data[i].生产资源ID, "HSourceCode": data[i].生产资源代码,
                                        "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
                                    });
                                }
                                for (let j = 0; j < data_detail.length; j++) {
                                    arr_detail.push({
                                        "HMaterID": data_detail[j].物料ID, "HMaterCode": data_detail[j].物料代码, "HMaterName": data_detail[j].物料名称,
                                        "HMaterSpec": data_detail[j].规格型号, "HUnitID": 0, "HUnitCode": "", "HUnitName": "", "HSourceID": data_detail[j].生产资源ID,
                                        "HSourceCode": data_detail[j].生产资源代码, "HSourceName": data_detail[j].生产资源名称, "HWorkerid": data_detail[j].操作员ID,
                                        "HWorkerCode": data_detail[j].操作员代码, "HWorkerName": data_detail[j].操作员名称, "HQty": data_detail[j].产量,
                                        "HBadQty": data_detail[j].不良数量, "HICMOBillNo": data_detail[j].生产订单号, "HRemark": ""
                                    })
                                }
                            } else {
                                layer.alert(result.msg, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                            }
                        }, error: function () {
                            layer.alert("发生错误!", { icon: 5 });
                        }
                    });
                    option.data = arr;
                    console.log(option.data);
                    table.render(option);
                    option_prodReport.data = arr_detail;
                    table.render(option_prodReport);
                } else {
                    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
                    }];
                    table.render(option);
                }
            }
            //#endregion
@@ -871,7 +1064,12 @@
            function set_EditFromGrid() {
                set_EditForm(linterid);  //编辑获取表头
                set_EditGrid(linterid);  //编辑获取表体
                option.data = [TabRow];
                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
                }];
                table.render(option);
            }
            //#endregion
@@ -894,6 +1092,7 @@
                            $("#HInnerBillNo").val(data.内部单据号);
                            $("#HDeptID").val(data.HDeptID);
                            $("#HDeptName").val(data.部门);
                            $("#HDeptNumber").val(data.部门代码);
                            $("#HGroupID").val(data.HGroupID);
                            $("#HGroupName").val(data.班组);
                            $("#HEmpID").val(data.HEmpID);
@@ -904,6 +1103,7 @@
                            $("#HExplanation").val("");
                            $("#HRemark").val(data.表头备注);
                            PicUpload();
                            get_file();
                        } else {
                            layer.alert(result.msg, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        }
@@ -1061,7 +1261,7 @@
                    , area: ['90%', '90%']//大小
                    , title: '职员列表'//标题
                    , shift: 2//弹出动画
                    ,content: ['../../PublicPage/UserInformation.html', 'yes']
                    , content: ['../../PublicPage/UserInformation.html', 'yes']
                    , btn: ['确定', '取消']
                    , btn1: function (index, layero) {//按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
@@ -1171,6 +1371,7 @@
            //获取编辑时,已上传的文件列表
            function get_file() {
                var HBillNo = $("#HBillNo").val()
                if (HBillNo != null || HBillNo != undefined) {
                    var ProImgByList = $('#ProImgByList')
                    $.ajax({
@@ -1193,7 +1394,6 @@
                                        , '<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete" type="button" id="deltefile" onclick="javascript:toManager(this)"><i class="layui-icon layui-icon-delete layuiadmin-button-btn"></i>删除</button>'
                                        , '</td>'
                                        , '</tr>'].join(''));
                                    $('#ProImgByList').append(tr);
                                }
                            } else {
@@ -1207,54 +1407,56 @@
            }
            //删除文件
            function toManager(r) {
                //得到当前所在行
                var rows = r.parentNode.parentNode.rowIndex;
                //得到所在行的第一列的内容:主键ID
                var HItemID = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(0)").html();
                //得到所在行的第二列的内容:单据号
                var HSourceBillNo = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(1)").html();
                //得到所在行的第三列的内容:文件名称
                var HFileName = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(2)").html();
                layer.confirm("确认要删除吗,删除后不能恢复", { title: "删除确认" }, function (index) {
                    //删除已上传文件
                    $.ajax({
                        url: GetWEBURL() + '/Cj_StationOutBill/DeleteFilelist',
                        type: "GET",
                        data: { "HItemID": HItemID, "HSourceBillNo": HSourceBillNo, "HFileName": HFileName },
                        success: function (data1) {
                            if (data1.count == 1) {
                                layer.alert(data1.Message, { icon: 1 });
                                $("#ProImgByList tr").eq((rows - 1)).remove();
                            }
                            else {
                                layer.alert(data1.code + data1.Message, { icon: 5 });
                            }
                        }, error: function () {
                            layer.alert("接口请求失败!", { icon: 5 });
                        }
                    });
                })
            }
            //#endregion
            //下载文件
            function dowload(r) {
                //得到当前所在行
                var rows = r.parentNode.parentNode.rowIndex;
                //得到所在行的第五列的内容:文件地址
                var url = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(5)").html();
                /*window.location.href = url;*/
                window.open(url)
            }
        //#endregion
        });
        //删除文件
        function toManager(r) {
            //得到当前所在行
            var rows = r.parentNode.parentNode.rowIndex;
            //得到所在行的第一列的内容:主键ID
            var HItemID = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(0)").html();
            //得到所在行的第二列的内容:单据号
            var HSourceBillNo = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(1)").html();
            //得到所在行的第三列的内容:文件名称
            var HFileName = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(2)").html();
            layer.confirm("确认要删除吗,删除后不能恢复", { title: "删除确认" }, function (index) {
                //删除已上传文件
                $.ajax({
                    url: GetWEBURL() + '/Cj_StationOutBill/DeleteFilelist',
                    type: "GET",
                    data: { "HItemID": HItemID, "HSourceBillNo": HSourceBillNo, "HFileName": HFileName },
                    success: function (data1) {
                        if (data1.count == 1) {
                            layer.alert(data1.Message, { icon: 1 });
                            $("#ProImgByList tr").eq((rows - 1)).remove();
                        }
                        else {
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            })
        }
        //下载文件
        function dowload(r) {
            //得到当前所在行
            var rows = r.parentNode.parentNode.rowIndex;
            //得到所在行的第五列的内容:文件地址
            var url = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(5)").html();
            /*window.location.href = url;*/
            window.open(url)
        }
    </script>
</body>
</html>