yangle
2024-09-25 a4b33d7b8dadde16b41213c1c062979cbda4c6dd
WebTM/views/³µ¼ä¹ÜÀí/¹¤ÐòÁ÷ת¿¨/Sc_ProcessExchangeBill_BatchSplit.html
@@ -16,6 +16,7 @@
    <script src="../../../layuiadmin/PubCustom.js"></script>
    <script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
    <script src="../../../layuiadmin/PageTitle.js"></script>
    <script src="../../../layuiadmin/grwebapp.js"></script>
    <style type="text/css">
        .layui-form-item .layui-inline {
            margin-right: 0;
@@ -51,7 +52,8 @@
                    <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" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Exit" style="margin-left:50px !important;">退出</button>
                        </div>
                    </div>
@@ -239,10 +241,15 @@
            });
            //打印
            form.on('submit(get_Print)', function () {
                get_Print();
            })
            //批量打印
            form.on('submit(get_BatchPrint)', function () {
                get_BatchPrint();
            })
            //退出按钮
            form.on('submit(Exit)', function () {
                if (params[1] != null) {
@@ -267,7 +274,8 @@
                        , { 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 }
@@ -291,7 +299,7 @@
                //初始表格数据
                var rowdata = [{
                    "HICMOInterID": 0, "HICMOEntryID": 0, "HICMOBillNo": "", "HMaterID": 0, "物料代码": ""
                    "HICMOInterID": 0, "HICMOEntryID": 0, "HICMOBillNo": "", "HWorkShopID": 0, "HMaterID": 0, "物料代码": ""
                    , "物料名称": "", "规格型号": "", "HQty": 0, "HFinishQty": 0, "HUsableQty": 0
                    , "HProQty": 0, "HRoutingInterID": 0, "HRoutingName": "", "HSheetQty": 0
                    , "HInterID": 0, "HBillNo": "", "HBatchNo": "", "HBatchManager": "", "HGroupNumber": ""
@@ -332,7 +340,8 @@
                                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)
@@ -352,6 +361,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 }
@@ -439,6 +449,7 @@
                        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);//批量打印按钮启用
                            layer.close(index);
                        }
                        else {
@@ -499,7 +510,7 @@
            }
            //打印
            function get_BatchPrint() {
            function get_Print() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length >= 1) {
@@ -525,6 +536,91 @@
                }
            }
            //批量打印
            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);
                        }, 1000);
                        //关闭当前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.单据号,case when ISNULL(a.生产规格,'')='' then a.产品规格 else a.生产规格 end äº§å“è§„æ ¼,a.产品名称,a.日期,a.单据号,b.工序代码,b.工序名称,a.批号,b.工艺工作中心,b.工艺工艺参数,a.生产车间,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++;
                                }
                            } 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) {
                var data = obj.data;