1
wtt
2025-12-29 3425237a2b54ca28fc3e3c5f7c35a7fbef4e15fa
WebTM/views/³µ¼ä¹ÜÀí/¹¤ÐòÁ÷ת¿¨/Sc_ProcessExchangeBill_BatchSplit.html
@@ -8,32 +8,39 @@
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
    <script src="../../../layuiadmin/layui/layui.js"></script>
    <script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
    <script src="../../../layuiadmin/layui/layui.js"></script>
    <script src="../../../layuiadmin/Scripts/json2.js"></script>
    <script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
    <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
    <script src="../../../layuiadmin/PubCustom.js"></script>
    <script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
    <script src="../../../layuiadmin/PageTitle.js"></script>
    <style type="text/css">
        .layui-form-item .layui-inline {
            margin-right: 0;
        }
        html {
            background-color: white;
            color: white;
        }
        .layui-table-cell {
    <script src="../../../layuiadmin/grwebapp.js"></script>
    <script src="../../CreateControl.js"></script>
    <style>
        td:has(select) .layui-table-cell {
            overflow: visible !important;
            padding: 0;
        }
        /* ä½¿å¾—下拉框与单元格刚好合适 */
        td .layui-form-select {
            margin-top: -10px;
            margin-left: -15px;
            margin-right: -15px;
            /*  margin-left: -15px;
            margin-right: -15px;*/
        }
        .layui-form-item .layui-inline {
            margin-top: 5px;
            margin-bottom: 5px;
            margin-right: 0px;
        }
        .layui-form-label {
            width: 25%;
        }
        .layui-table th, .layui-table td {
            white-space: nowrap; /* ä¸æ¢è¡Œ */
            text-overflow: ellipsis; /* æ˜¾ç¤ºçœç•¥å· */
        }
    </style>
</head>
@@ -41,33 +48,58 @@
    <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" lay-filter="component-form-group" action="">
                <form class="layui-form" action="" lay-filter="formData" style="background-color:white;">
                    <div class="layui-card-header">
                        <div class="layui-btn-group">
                            <button type="button" id="add-btn" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Saver">保存</button>
                            <button type="button" id="print-btn" class="layui-btn layui-btn-normal layui-btn-radius layui-btn-disabled" lay-submit="" lay-filter="get_BatchPrint" disabled>打印</button>
                            <button type="button" id="print-btn" class="layui-btn layui-btn-normal layui-btn-radius layui-btn-disabled" lay-submit="" lay-filter="get_Print" disabled>打印</button>
                            <!--<button type="button" id="batchPrint-btn" class="layui-btn layui-btn-normal layui-btn-radius layui-btn-disabled" lay-submit="" lay-filter="get_BatchPrint" disabled>批量打印</button>-->
                            <button type="button" id="batchPrint-btn1" class="layui-btn layui-btn-normal layui-btn-radius layui-btn-disabled" lay-submit="" lay-filter="get_BatchPrint_CMR_ZS" disabled>注塑批量打印</button>
                            <button type="button" id="batchPrint-btn2" class="layui-btn layui-btn-normal layui-btn-radius layui-btn-disabled" lay-submit="" lay-filter="get_BatchPrint_CMR_JR" disabled>卷绕批量打印</button>
                            <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Exit" style="margin-left:50px !important;">退出</button>
                        </div>
                    </div>
                    <div class="layui-tab" lay-filter="tab-BatchSplit">
                        <h1 style="text-align: center; padding: 10px 0;"><b>流转卡批量拆分</b></h1>
                    </div>
                    <table class="layui-hide" id="mainTable" lay-filter="mainTable" style="margin-top:5px;"></table>
                    <script type="text/html" id="xuhao">
                        {{d.LAY_TABLE_INDEX+1}}
                    </script>
                    <script type="text/html" id="toolbarDemo">
                        <div class="layui-btn-container">
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-CopyLine"><i class="layui-icon layui-icon-form"></i>复制一行</button>
                    <div class="layui-tab" lay-filter="tab-BatchSplit">
                        <div class="layui-tab-content">
                            <div class="layui-tab-item layui-show">
                                <table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
                                <script type="text/html" id="toolbarDemo">
                                    <div class="layui-btn-container">
                                        <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-CopyLine"><i class="layui-icon layui-icon-form"></i>复制一行</button>
                                    </div>
                                </script>
                            </div>
                        </div>
                    </script>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <!--选择框-->
    <script type="text/html" id="HMouldNum-select">
        <select name="HMouldNum" lay-filter="HMouldNum" id="HMouldNum{{d.LAY_TABLE_INDEX+1}}">
            <option value="0#" selected>0#</option>
            <option value="1#">1#</option>
            <option value="2#" >2#</option>
            <option value="3#">3#</option>
            <option value="4#">4#</option>
            <option value="5#">5#</option>
            <option value="6#">6#</option>
            <option value="7#">7#</option>
            <option value="8#">8#</option>
            <option value="9#">9#</option>
            <option value="10#">10#</option>
        </select>
    </script>
    <script type="text/html" id="barDemo">
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
    </script>
    <script>
        //#region æŠ˜å æ³¨é‡Š
        //#endregion
@@ -75,16 +107,17 @@
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'laydate', 'table', 'element', 'laydate'], function () {
            //#region å…¬ç”¨å˜é‡
        }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
            //#region å…¬å…±å˜é‡
            var $ = layui.$
                , admin = layui.admin
                , layer = layui.layer
                , table = layui.table
                , form = layui.form
                , laydate = layui.laydate
                , element = layui.element;
            var sWhere = "";
            var option;
            //#endregion
@@ -138,13 +171,13 @@
                        else {
                            //获取新流转卡单号,内码
                            $.ajax({
                                url: GetWEBURL() + "/Web/GetMAXNumPDA",
                                url: GetWEBURL() + "/Web/GetMAXNum_ProcExchange",
                                type: "GET",
                                data: { "HBillType": '3772' },
                                async: false,
                                success: function (d) {
                                    data[0].HInterID = d.data[0].HInterID;
                                    data[0].HBillNo = d.data[0].HBillNo;
                                    data[0].HBillNo = data[0].HBillNo.substring(0, 13) + '-' + String(Number(data[0].HSheetQty)).padStart(2, '0');
                                }
                            });
                            var copydata = JSON.stringify(data);
@@ -157,6 +190,7 @@
                                    HArrIndex = i;
                                    option.data[i].HSheetQty = Number(option.data[i].HSheetQty) + Number(1);
                                }
                                $('#HMouldNum' + i + '').find("option[value='" + option.data[i].HMouldNum + "']").attr("selected", true);
                            }
                            if (HArrIndex != -1) {
                                option.data.splice(HArrIndex + 1, 0, JSON.parse(copyrow))
@@ -165,6 +199,7 @@
                            //table.cache["mainTable"].push(JSON.parse(copyrow));//将复制的行强转成json追加到表格上
                            //option.data = table.cache["mainTable"];//将数据绑定到data上
                            table.render(option);//将数据渲染到表格上
                            form.render('select');
                        }
                        break;
                }
@@ -225,6 +260,18 @@
                table.render(option);
            });
            //#region è¡¨æ ¼è¡Œé€‰æ‹©å¤„理
            form.on('select(HMouldNum)', function (data) {
                //获取下拉框选中的值
                var elem = data.othis.parents('tr');
                var dataindex = elem.attr("data-index");
                $.each(option.data, function (index, value) {
                    if (value.LAY_TABLE_INDEX == dataindex) {
                        value.HMouldNum = data.value;//把选中下拉框id值赋值给表格缓存
                    }
                });
            });
            //保存按钮
            form.on('submit(Saver)', function (data) {
                if (AllowLoadData(data)) {
@@ -233,8 +280,21 @@
            });
            //打印
            form.on('submit(get_Print)', function () {
                get_Print();
            })
            //批量打印
            form.on('submit(get_BatchPrint)', function () {
                get_BatchPrint();
            })
            //斯莫尔 æ³¨å¡‘批量打印
            form.on('submit(get_BatchPrint_CMR_ZS)', function () {
                get_BatchPrint1(1);
            })
            //斯莫尔 å·ç»•组装批量打印
            form.on('submit(get_BatchPrint_CMR_JR)', function () {
                get_BatchPrint1(2);
            })
            //退出按钮
@@ -255,13 +315,13 @@
                    , toolbar: '#toolbarDemo'
                    , limit: 500
                    , height: 500
                    , loading: false
                    , cols: [[ //子表
                        { type: 'checkbox', totalRowText: '合计行' }
                        , { type: 'numbers', title: '序号', width: 100, totalRow: true }
                        , { field: 'HICMOInterID', title: '生产订单内码', width: 100, hide: true }//生产订单内码
                        , { field: 'HICMOEntryID', title: '生产订单子内码', width: 100, hide: true }//生产订单子内码
                        , { field: 'HICMOBillNo', title: '生产订单', width: 120 }//生产订单号
                        , { field: 'HICMOBillNo', title: '生产订单内码', width: 120 }//生产订单号
                        , { field: 'HWorkShopID', title: '生产车间', width: 100, hide: true }//生产车间内码
                        , { field: 'HMaterID', title: 'HMaterID', width: 100, hide: true }
                        , { field: '物料代码', title: '物料代码', width: 150 }
                        , { field: '物料名称', title: '物料名称', width: 150 }
@@ -269,8 +329,14 @@
                        , { field: 'HQty', title: '订单总数', width: 110 }
                        , { field: 'HFinishQty', title: '已生成流转卡数', width: 130 }
                        , { field: 'HUsableQty', title: '剩余可用数量', width: 130 }
                        , { field: 'HLotcardQty', title: '单张流转卡数', width: 130 }
                        , { field: 'HProQty', title: '流转卡数量', width: 110, edit: 'text' }
                        , { field: 'HBatchNo', title: '批号', width: 110, edit: 'text' }
                        , { field: 'HBatchNo', title: '批次号', width: 110, edit: 'text' }
                        , { field: 'HProjectNum', title: '项目编号', width: 110, edit: 'text' }
                        , { field: 'HMateOutBatchNo', title: '原料批次', width: 110, edit: 'text' }
                        , { field: 'HMouldNum', title: '模穴号', width: 110, templet: '#HMouldNum-select' }
                        , { field: 'HGroupNumber', title: '班组', width: 110, edit: 'text' }
                        , { field: 'HBatchManager', title: '启用批次', width: 110, hide: true }
                        , { field: 'HRoutingInterID', title: '工艺路线内码', width: 150, hide: true }
                        , { field: 'HRoutingName', title: '工艺路线', width: 170, edit: 'text', event: "HRoutingName" }
                        , { field: 'HSheetQty', title: '拆分流转卡张数', width: 130 }
@@ -283,14 +349,18 @@
                //初始表格数据
                var rowdata = [{
                    "HICMOInterID": 0, "HICMOEntryID": 0, "HICMOBillNo": "", "HMaterID": 0, "物料代码": ""
                    , "物料名称": "", "规格型号": "", "HQty": 0, "HFinishQty": 0, "HUsableQty": 0
                    "HICMOInterID": 0, "HICMOEntryID": 0, "HICMOBillNo": "", "HWorkShopID": 0, "HMaterID": 0, "物料代码": ""
                    , "物料名称": "", "规格型号": "", "HQty": 0, "HFinishQty": 0, "HUsableQty": 0, "HLotcardQty": 0
                    , "HProQty": 0, "HRoutingInterID": 0, "HRoutingName": "", "HSheetQty": 0
                    , "HInterID": 0, "HBillNo": "", "HBatchNo": ""
                    , "HInterID": 0, "HBillNo": "", "HBatchNo": "", "HProjectNum": "", "HMateOutBatchNo": "", "HMouldNum": "0#", "HBatchManager": "", "HGroupNumber": ""
                }];
                option.data = rowdata;
                table.render(option);
                for (var i = 1; i <= option.data.length; i++) {
                    $('#HMouldNum' + i + '').find("option[value='" + option.data[i - 1].HMouldNum + "']").attr("selected", true);
                }
                form.render('select');
            }
            //批量拆分生产订单生成流转卡
@@ -307,28 +377,73 @@
                            var rowdata = [];
                            var HInterID = 0;
                            var HBillNo = "";
                            var HSourceInterID = 0;
                            var HSourceEntryID = 0;
                            var k = 01;
                            for (var i = 0; i < subdata.length; i++) {
                                //获取流转卡单号,内码
                                $.ajax({
                                    url: GetWEBURL() + "/Web/GetMAXNumPDA",
                                    type: "GET",
                                    data: { "HBillType": '3772' },
                                    async: false,
                                    success: function (d) {
                                        HInterID = d.data[0].HInterID;
                                        HBillNo = d.data[0].HBillNo;
                                    }
                                });
                                //首次进入,获取流转卡单号
                                if (i == 0) {
                                    //获取流转卡单号,内码
                                    $.ajax({
                                        url: GetWEBURL() + "/Web/GetMAXNumPDA",
                                        type: "GET",
                                        data: { "HBillType": '3772' },
                                        async: false,
                                        success: function (d) {
                                            HInterID = d.data[0].HInterID;
                                            HBillNo = d.data[0].HBillNo;
                                        }
                                    });
                                    HBillNo = HBillNo + '-' + String(k).padStart(2, '0');
                                    HSourceInterID = subdata[i].HICMOInterID;
                                    HSourceEntryID = subdata[i].HICMOEntryID;
                                }
                                else if (HSourceInterID == subdata[i].HICMOInterID && HSourceEntryID == subdata[i].HICMOEntryID) {
                                    //获取流转卡单号,内码
                                    $.ajax({
                                        url: GetWEBURL() + "/Web/GetMAXNum_ProcExchange",
                                        type: "GET",
                                        data: { "HBillType": '3772' },
                                        async: false,
                                        success: function (d) {
                                            HInterID = d.data[0].HInterID;
                                        }
                                    });
                                    HBillNo = HBillNo.substring(0, 13);
                                    k = Number(k) + Number(1);
                                    HBillNo = HBillNo + '-' + String(k).padStart(2, '0');
                                } else if (HSourceInterID != subdata[i].HICMOInterID || HSourceEntryID != subdata[i].HICMOEntryID) {
                                    //获取流转卡单号,内码
                                    $.ajax({
                                        url: GetWEBURL() + "/Web/GetMAXNumPDA",
                                        type: "GET",
                                        data: { "HBillType": '3772' },
                                        async: false,
                                        success: function (d) {
                                            HInterID = d.data[0].HInterID;
                                            HBillNo = d.data[0].HBillNo;
                                        }
                                    });
                                    HBillNo = HBillNo.substring(0, 13);
                                    k = 01;
                                    HBillNo = HBillNo + '-' + String(k).padStart(2, '0');
                                    HSourceInterID = subdata[i].HICMOInterID;
                                    HSourceEntryID = subdata[i].HICMOEntryID;
                                }
                                rowdata.push(
                                    {
                                        "HICMOInterID": subdata[i].HICMOInterID, "HICMOEntryID": subdata[i].HICMOEntryID, "HICMOBillNo": subdata[i].HICMOBillNo
                                        , "HMaterID": subdata[i].HMaterID, "物料代码": subdata[i].物料代码, "物料名称": subdata[i].物料名称
                                        , "HWorkShopID": subdata[i].HWorkShopID, "HMaterID": subdata[i].HMaterID, "物料代码": subdata[i].物料代码
                                        , "物料名称": subdata[i].物料名称
                                        , "规格型号": subdata[i].规格型号, "HQty": subdata[i].HQty, "HFinishQty": subdata[i].HFinishQty
                                        , "HUsableQty": subdata[i].HUsableQty, "HProQty": subdata[i].HProQty, "HRoutingInterID": subdata[i].HRoutingInterID
                                        , "HRoutingName": subdata[i].HRoutingName, "HSheetQty": subdata[i].HSheetQty, "HDate": formatDate(subdata[i].HDate)
                                        , "HInterID": HInterID, "HBillNo": HBillNo, "HBatchNo": ""
                                        , "HUsableQty": subdata[i].HUsableQty, "HLotcardQty": subdata[i].HLotcardQty, "HProQty": subdata[i].HProQty
                                        , "HRoutingInterID": subdata[i].HRoutingInterID, "HRoutingName": subdata[i].HRoutingName, "HSheetQty": subdata[i].HSheetQty
                                        , "HDate": formatDate(subdata[i].HDate), "HInterID": HInterID, "HBillNo": HBillNo, "HBatchNo": subdata[i].HBatchNo
                                        , "HBatchManager": subdata[i].是否启用批次, "HGroupNumber": "", "HProjectNum": "", "HMateOutBatchNo": "", "HMouldNum": "0#"
                                    }
                                )
                            }
@@ -344,6 +459,7 @@
                                    , { field: 'HICMOInterID', title: '生产订单内码', width: 100, hide: true }//生产订单内码
                                    , { field: 'HICMOEntryID', title: '生产订单子内码', width: 100, hide: true }//生产订单子内码
                                    , { field: 'HICMOBillNo', title: '生产订单', width: 120 }//生产订单号
                                    , { field: 'HWorkShopID', title: '生产车间内码', width: 100, hide: true }//生产车间内码
                                    , { field: 'HMaterID', title: 'HMaterID', width: 100, hide: true }
                                    , { field: '物料代码', title: '物料代码', width: 150 }
                                    , { field: '物料名称', title: '物料名称', width: 150 }
@@ -351,8 +467,14 @@
                                    , { field: 'HQty', title: '订单总数', width: 110 }
                                    , { field: 'HFinishQty', title: '已生成流转卡数', width: 130 }
                                    , { field: 'HUsableQty', title: '剩余可用数量', width: 130 }
                                    , { field: 'HLotcardQty', title: '单张流转卡数', width: 130 }
                                    , { field: 'HProQty', title: '流转卡数量', width: 110, edit: 'text' }
                                    , { field: 'HBatchNo', title: '批号', width: 110, edit: 'text' }
                                    , { field: 'HBatchNo', title: '批次号', width: 110, edit: 'text' }
                                    , { field: 'HProjectNum', title: '项目编号', width: 110, edit: 'text' }
                                    , { field: 'HMateOutBatchNo', title: '原料批次', width: 110, edit: 'text' }
                                    , { field: 'HMouldNum', title: '模穴号', width: 110, templet: '#HMouldNum-select' }
                                    , { field: 'HGroupNumber', title: '班组', width: 110, edit: 'text' }
                                    , { field: 'HBatchManager', title: '启用批次', width: 110, hide: true }
                                    , { field: 'HRoutingInterID', title: '工艺路线内码', width: 150, hide: true }
                                    , { field: 'HRoutingName', title: '工艺路线', width: 170, edit: 'text', event: "HRoutingName" }
                                    , { field: 'HSheetQty', title: '拆分流转卡张数', width: 130 }
@@ -391,11 +513,16 @@
                            }
                            option.data = rowdata;
                            table.render(option);
                            for (var i = 1; i <= option.data.length; i++) {
                                $('#HMouldNum' + i).find("option[value='" + option.data[i - 1].HMouldNum + "']").attr("selected", true).trigger("change");
                            }
                            form.render('select');
                            layer.close(ajaxLoad);
                        } else {
                            layer.close(ajaxLoad);
                            layer.alert(result.msg, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                            layer.alert(result.Message, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        }
                    }, error: function () {
                        layer.close(ajaxLoad);
@@ -414,6 +541,12 @@
                        table.cache["mainTable"][i].LAY_TABLE_INDEX = i;
                        sSubTable.push(table.cache["mainTable"][i])
                    }
                    if (table.cache["mainTable"][i].物料名称.indexOf("\"") != -1 || table.cache["mainTable"][i].物料名称.indexOf(";") != -1) {
                        table.cache["mainTable"][i].物料名称 = table.cache["mainTable"][i].物料名称.replace("\"", "”").replace(";", ";")
                    }
                    if (table.cache["mainTable"][i].规格型号.indexOf("\"") != -1 || table.cache["mainTable"][i].规格型号.indexOf(";") != -1) {
                        table.cache["mainTable"][i].规格型号 = table.cache["mainTable"][i].规格型号.replace("\"", "”").replace(";", ";")
                    }
                }
                var sSubStr = JSON.stringify(sSubTable);
                var sMainSub = sSubStr + ";" + sessionStorage["HUserName"];
@@ -429,6 +562,9 @@
                        if (data.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            layer.msg(data.Message, { icon: 1 });
                            $('#print-btn').removeClass("layui-btn-disabled").attr("disabled", false);//打印按钮启用
                            $('#batchPrint-btn').removeClass("layui-btn-disabled").attr("disabled", false);//批量打印按钮启用
                            $('#batchPrint-btn1').removeClass("layui-btn-disabled").attr("disabled", false);//批量打印按钮启用
                            $('#batchPrint-btn2').removeClass("layui-btn-disabled").attr("disabled", false);//批量打印按钮启用
                            layer.close(index);
                        }
                        else {
@@ -461,7 +597,7 @@
                                , shift: 2 //弹出动画
                                , area: ["90%", "90%"] //窗体大小
                                , maxmin: true //设置最大最小按钮是否显示
                                , content: ["../../计划管理/工艺路线/Gy_RoutingBillList.html", "yes"]
                                , content: ['../../计划管理/工艺路线/Gy_RoutingBillList.html?HMaterID=' + obj.data.HMaterID + '&HProID=' + 0, 'yes']
                                , btn: ["确定", "取消"]
                                , btn1: function (index, laero) {
                                    //按钮一  çš„回调
@@ -489,7 +625,7 @@
            }
            //打印
            function get_BatchPrint() {
            function get_Print() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length >= 1) {
@@ -501,7 +637,7 @@
                    layer.open({
                        type: 2
                        , area: ['50%', '50%']
                        , area: ['40%', '80%']
                        , title: '打印模版选择'
                        , shade: 0.6 //遮罩透明度
                        , maxmin: false //允许全屏最小化
@@ -514,6 +650,187 @@
                    layer.msg('请选择要打印的流转卡!');
                }
            }
            //批量打印
            var time;
            var num = 0;
            function get_BatchPrint() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length > 0) {
                    //逻辑删除方法
                    layer.confirm("确认要批量打印吗?", { title: "确认" }, function (index) {
                        time = setInterval(function () {
                            dy_PL(data);
                        }, 2500);
                        //关闭当前frame
                        layer.close(index);
                    })
                }
                else {
                    layer.msg('请选择数据打印!');
                }
            }
            function dy_PL(rest) {
                var HInterID = rest[num].HInterID.toString();
                var sWhere = "select cast( b.流水号 as float) æµæ°´å·,生产订单号,a.销售订单号,a.生产数量,a.流转卡数量,a.产品代码,a.单据号,case when ISNULL(a.生产规格,'')='' then a.产品规格 else a.生产规格 end äº§å“è§„æ ¼,a.产品名称,a.日期,a.单据号,b.工序代码,b.工序名称,a.批号,b.工艺工作中心,b.工艺工艺参数,a.生产车间,b.工段名称,b.生产订单数量 from h_v_Sc_ProcessExchangeBillQuery a left join h_v_Sc_ProcessExchangeBillQuerySub b on a.hmainid=b.hmainid   where b.hmainid in(" + HInterID + ") and b.工序代码 != '9999' order by cast(b.流水号 as int)"
                $.ajax({
                    type: "GET",
                    url: GetWEBURL() + "/Gy_SOPBillList/WindowPrintList", //方法所在页面和方法名
                    async: false,
                    data: { "sWhere": sWhere },
                    success: function (data) {
                        if (data.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            if (data.data.length != 0) {
                                var dataPrint = [];
                                for (var i = 0; i < data.data.length; i++) {
                                    data.data[i]["流水号"] = data.data[i]["流水号"].toFixed(1);
                                    dataPrint.push(data.data[i])
                                }
                                var Customer = {
                                    "Table": dataPrint
                                }
                                var args = {
                                    type: "print",//打印模式
                                    //type: "preview",//预览模式
                                    showOptionDlg: false, //如果不显示打印对话框而直接打印,将此行注释去掉即可
                                    report: urlAddRandomNo("../../grf/流转卡JSON.grf"),
                                    data: Customer
                                };
                                console.log(data.data[0].单据号);
                                //var args = {
                                //    report: urlAddRandomNo("../../grf/cs10.grf"),
                                //    data: Customer
                                //};
                                webapp_ws_ajax_run(args);
                                if (rest.length <= num + 1) {
                                    num = 0;
                                    clearInterval(time);
                                } else {
                                    num++;
                                }
                                var sql = "update a set HPrintDate = getdate() from Sc_ProcessExchangeBillMain a with(nolock) where HInterID = " + HInterID + " and HPrintDate is null";
                                $.ajax({
                                    type: "GET",
                                    url: GetWEBURL() + "/Gy_SOPBillList/UpDelSQL", //方法所在页面和方法名
                                    async: false,
                                    data: { "sWhere": sql },
                                    success: function (result) {
                                        if (result.data.code != 1) {
                                            layer.alert("更新打印日期异常:" + result.data.Message);
                                        }
                                    }
                                })
                            } else {
                                layer.msg("查无数据!");
                            }
                        }
                        else {
                            layer.msg(data.Message, { icon: 5 });
                        }
                        layer.closeAll("loading");
                    },
                    error: function (err) {
                        layer.msg("错误:" + err, { icon: 5 });
                    }
                })
            }
            function get_BatchPrint1(tyep) {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length > 0) {
                    //逻辑删除方法
                    layer.confirm("确认要批量打印吗?", { title: "确认" }, function (index) {
                        time = setInterval(function () {
                            dy_PL1(data, tyep);
                        }, 2500);
                        //关闭当前frame
                        layer.close(index);
                    })
                }
                else {
                    layer.msg('请选择数据打印!');
                }
            }
            function dy_PL1(rest, tyep) {
                var HInterID = rest[num].HInterID.toString();
                var sWhere = "select  a.HBillNo æµè½¬å¡ç¼–号 ,a.HMateOutBatchNo åŽŸæ–™æ‰¹æ¬¡,a.HICMOBillNo ä»»åŠ¡å•å·,m2.HNumber äº§å“ä»£ç ,CAST(a.HQty AS dec(18, 0)) æµè½¬å¡æ•°é‡,a.HProjectNum é¡¹ç›®å·,m2.HName äº§å“åç§°,CAST(a.HPlanQty AS dec(18, 0)) ç”Ÿäº§æ•°é‡,m2.HModel äº§å“è§„æ ¼,ltrim(b.HProcNo) æµæ°´å· ,p.HName å·¥åºåç§°,c.HName ç”Ÿäº§èµ„源,convert(varchar(16),getdate(),20) æ£€æµ‹æ—¶é—´ from Sc_ProcessExchangeBillMain a inner join Sc_ProcessExchangeBillSub b on a.HInterID=b.HInterID left join Gy_Material m2 on a.HMaterID2=m2.hitemid left join Gy_Process p on b.HProcID=p.hitemid left join Gy_Source s on b.HSourceID=s.HItemID  left join(select b1.HInterID,s.HName  from Sc_ProcessExchangeBillSub b1 left join Gy_Process p on b1.HProcID=p.hitemid left join Gy_Source s on b1.HSourceID=s.HItemID  where p.HName='注塑定型') c on a.HInterID=c.HInterID  where b.HInterID in(" + Request.Params["linterid"] + ") order by cast(b.HProcNo as int)"
                $.ajax({
                    type: "GET",
                    url: GetWEBURL() + "/Gy_SOPBillList/WindowPrintList", //方法所在页面和方法名
                    async: false,
                    data: { "sWhere": sWhere },
                    success: function (data) {
                        if (data.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            if (data.data.length != 0) {
                                var dataPrint = [];
                                for (var i = 0; i < data.data.length; i++) {
                                    data.data[i]["流水号"] = data.data[i]["流水号"].toFixed(1);
                                    dataPrint.push(data.data[i])
                                }
                                var Customer = {
                                    "Table": dataPrint
                                }
                                var report1 = "";
                                if (tyep==1) {
                                    report1 = urlAddRandomNo("../../grf/质量流转卡cmr.grf");
                                } else if (tyep==2) {
                                    report1 = urlAddRandomNo("../../grf/卷绕质量流转卡.grf");
                                }
                                var args = {
                                    type: "print",
                                    showOptionDlg: false, //如果不显示打印对话框而直接打印,将此行注释去掉即可
                                    report: report1,
                                    data: Customer
                                };
                                console.log(data.data[0].单据号);
                                webapp_ws_ajax_run(args);
                                if (rest.length <= num + 1) {
                                    num = 0;
                                    clearInterval(time);
                                } else {
                                    num++;
                                }
                            } else {
                                layer.msg("查无数据!");
                            }
                        }
                        else {
                            layer.msg(data.Message, { icon: 5 });
                        }
                        layer.closeAll("loading");
                    },
                    error: function (err) {
                        layer.msg("错误:" + err, { icon: 5 });
                    }
                })
            }
            //表格行内事件删除
            function set_GridDelete(obj) {
@@ -532,9 +849,11 @@
                                if (option.data[i].HICMOInterID == data.HICMOInterID && option.data[i].HICMOEntryID == data.HICMOEntryID) {
                                    option.data[i].HSheetQty = Number(option.data[i].HSheetQty) - Number(1);
                                }
                                $('#HMouldNum' + i).find("option[value='" + oldData[i].HMouldNum + "']").attr("selected", true);
                            }
                            table.render(option);
                            form.render('select');
                            layer.close(index);
                        }
                    });
@@ -564,6 +883,10 @@
                            layer.msg("明细记录第" + (i + 1) + "行,生产订单主内码获取异常,请联系管理员处理!", { icon: 5, btn: ['确认'], time: 4000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            return Result = false;
                        }
                        if (sSubStr[i].HBatchManager == "是" && sSubStr[i].HBatchNo == "") {
                            layer.msg("明细记录第" + (i + 1) + "行,物料启用批次管理,请输入批号信息!", { icon: 5, btn: ['确认'], time: 4000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            return Result = false;
                        }
                    }
                }