1
zrg
2026-01-15 6d9b89c7528c6fffc79c8c6a24757e7bc4b5c1f7
WebTM/views/³µ¼ä¹ÜÀí/µ¥Æ·¹ýÕ¾_СÎÀ/Cj_SachetBarCodePrint.html
@@ -14,6 +14,7 @@
    <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
    <script src="../../../layuiadmin/PubCustom.js"></script>
    <script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
    <script src="../../../layuiadmin/grwebapp.js"></script>
    <style type="text/css">
        /*begin æ­¤æ ·å¼ç”¨äºŽæ¶ˆé™¤è¡Œå…ƒç´ ä¸­å¸ƒå±€å®½åº¦ä¸å¤Ÿçš„问题*/
@@ -42,6 +43,8 @@
                            <div class="layui-input-block">
                                <!--<button type="button" class="layui-btn" id="ToolPrint" lay-submit="" lay-filter="ToolPrint">预览打印</button>-->
                                <button type="button" class="layui-btn" id="ToolCreate" lay-submit="" lay-filter="ToolCreate">生成</button>
                                <button type="button" class="layui-btn" id="PausePrint" lay-submit="" lay-filter="PausePrint">暂停打印</button>
                                <button type="button" class="layui-btn" id="ContinuePrint" lay-submit="" lay-filter="ContinuePrint">继续打印</button>
                                <button type="button" class="layui-btn" id="ToolExit" lay-submit="" lay-filter="ToolExit">退出</button>
                            </div>
                        </div>
@@ -51,7 +54,6 @@
                                <div class="layui-tab-content">
                                    <div class="layui-tab-item layui-show">
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <label class="layui-form-label">生产订单</label>
                                                <div class="layui-input-inline">
@@ -91,10 +93,16 @@
                                            <div class="layui-inline">
                                                <label class="layui-form-label">打印间隔(秒)</label>
                                                <div class="layui-input-inline">
                                                    <input class="layui-input" name="HTime" id="HTime" autocomplete="off" value="3">
                                                    <input class="layui-input" name="HTime" id="HTime" autocomplete="off" value="3" onfocus="this.select();">
                                                </div>
                                            </div>
                                            <div class="layui-inline">
                                                <label class="layui-form-label">条码编号</label>
                                                <div class="layui-input-inline" style="width:600px;">
                                                    <input class="layui-input" name="HBarCode" id="HBarCode" autocomplete="off" style="float:left;width:410px;" onfocus="this.select();" placeholder="请输入单个补打条码编号,不支持批量补打">
                                                    <button type="button" class="layui-btn" id="PrintBarCode" lay-submit="" lay-filter="PrintBarCode" style="float:left;">补打条码</button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
@@ -155,6 +163,7 @@
            var sWhere = "";
            var HModName = "Cj_SachetBarCodePrint";
            var titleData = [];//不需要显示的字段 å¯æ‰©å±•
            var HWhetherToPrint = true; //是否打印
       
            //#endregion                       
         
@@ -273,10 +282,59 @@
            //条码生成
            form.on('submit(ToolCreate)', function (data) {
                if (Number($("#HTime").val()) < Number(3)) {
                    layer.msg("打印间隔不允许小于3秒!")
                    return;
                }
                $('#ToolCreate').addClass("layui-btn-disabled").attr("disabled", true);//生成按钮禁用
                SaveBarCodeCreate();
            })
            })
            //暂停打印
            form.on('submit(PausePrint)', function (data) {
                layer.confirm("是否确认暂停打印?", {
                    btn: ["确定", "取消"]
                    , btn1: function (index) {
                        layer.close(index);
                        HWhetherToPrint = false;
                    }
                })
            })
            //继续打印
            form.on('submit(ContinuePrint)', function (data) {
                if (Number($("#HTime").val()) < Number(3)) {
                    layer.msg("打印间隔不允许小于3秒!")
                    return;
                }
                layer.confirm("是否继续打印?", {
                    btn: ["确定", "取消"]
                    , btn1: function (index) {
                        layer.close(index);
                        HWhetherToPrint = true;
                        var HICMOInterID = $("#HICMOInterID").val();
                        var HICMOEntryID = $("#HICMOEntryID").val();
                        //调用打印方法
                        get_BatchPrint(HICMOInterID, HICMOEntryID);
                    }
                })
            })
            //补打条码
            form.on('submit(PrintBarCode)', function (data) {
                PrintBarCode();
            })
            //条码编号回车方法
            $('#HBarCode').on('keydown', function (event) {
                if (event.keyCode == 13) {
                    PrintBarCode();
                }
            });
            //退出
            form.on('submit(ToolExit)', function (data) {
                if (linterid == undefined) {
@@ -350,7 +408,7 @@
                                //自动打印
                                if (option.data.length > 0) {
                                    get_BatchPrint();
                                    get_BatchPrint(HICMOInterID, HICMOEntryID);
                                }                                
                            }
                            else {
@@ -368,18 +426,18 @@
            //批量打印
            var time;
            var num = 0;
            function get_BatchPrint() {
            function get_BatchPrint(HICMOInterID, HICMOEntryID) {
                //打印间隔
                var HTime = $("#HTime").val();
                time = setInterval(function () {
                    dy_PL(option.data);
                    dy_PL(HICMOInterID, HICMOEntryID, option.data);
                }, HTime*1000);
            }
            function dy_PL(rest) {
                var HInterID = rest[num].HBarCodeID.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)"
            function dy_PL(HICMOInterID, HICMOEntryID,rest) {
                //var HItemID = rest[num].HBarCodeID.toString();
                var sWhere = "select top 1 a.HItemID,HBarCode æ¡ç ç¼–号,isnull(ms.HCusRelationNumber,'') SKU from Gy_BarCodeBill a with(nolock) left join Gy_Material m with(nolock) on a.HMaterID = m.HItemID left join Gy_MateNumRelation_Sec ms with(nolock) on m.HMASTERID = ms.HMaterID where a.HSourceInterID = " + HICMOInterID + " and a.HSourceEntryID = " + HICMOEntryID + " and a.HPrintQty = 0 order by a.HItemID asc";
                $.ajax({
                    type: "GET",
@@ -390,6 +448,11 @@
                        if (data.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            if (data.data.length != 0) {
                                if (data.data[0].SKU == "") {
                                    layer.msg("物料SKU未维护,请联系管理员确认!");
                                    return;
                                }
                                var dataPrint = [];
                                for (var i = 0; i < data.data.length; i++) {
                                    dataPrint.push(data.data[i])
@@ -403,36 +466,39 @@
                                    type: "print",//打印模式
                                    //type: "preview",//预览模式
                                    showOptionDlg: false, //如果不显示打印对话框而直接打印,将此行注释去掉即可
                                    report: urlAddRandomNo("../../grf/流转卡JSON.grf"),
                                    report: urlAddRandomNo("../../grf/香囊标签JSON3.grf"),
                                    data: Customer
                                };
                                console.log(data.data[0].单据号);
                                console.log("打印香囊条码:" + data.data[0].条码编号);
                                //var args = {
                                //    report: urlAddRandomNo("../../grf/cs10.grf"),
                                //    data: Customer
                                //};
                                webapp_ws_ajax_run(args);
                                if (rest.length <= num + 1) {
                                if (rest.length <= num + 1 || HWhetherToPrint == false) {
                                    num = 0;
                                    clearInterval(time);
                                } else {
                                    num++;
                                }
                                //var sql = "update a set HPrintQty = HPrintQty + 1 from Gy_BarCodeBill a with(nolock) where HItemID = " + HInterID ;
                                //$.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);
                                //        }
                                //    }
                                //})
                                var sql = "update a set HPrintQty = HPrintQty + 1 from Gy_BarCodeBill a with(nolock) where HItemID = " + data.data[0].HItemID;
                                $.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);
                                        //}
                                    }
                                })
                                //过站记录保存
                                txtHBarCodeSN_KeyDown(data.data[0].条码编号);
                            } else {
                                layer.msg("查无数据!");
@@ -450,6 +516,120 @@
            }
            //补打条码
            function PrintBarCode() {
                var HBarCode = $("#HBarCode").val();
                var sWhere = "select top 1 a.HItemID,HBarCode æ¡ç ç¼–号,isnull(ms.HCusRelationNumber,'') SKU from Gy_BarCodeBill a with(nolock) left join Gy_Material m with(nolock) on a.HMaterID = m.HItemID left join Gy_MateNumRelation_Sec ms with(nolock) on m.HMASTERID = ms.HMaterID where a.HBarCode = '" + HBarCode + "'";
                $.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) {
                                if (data.data[0].SKU == "") {
                                    layer.msg("物料SKU未维护,请联系管理员确认!");
                                    return;
                                }
                                var dataPrint = [];
                                for (var i = 0; i < data.data.length; i++) {
                                    dataPrint.push(data.data[i])
                                }
                                var Customer = {
                                    "Table": dataPrint
                                }
                                var args = {
                                    type: "print",//打印模式
                                    //type: "preview",//预览模式
                                    showOptionDlg: false, //如果不显示打印对话框而直接打印,将此行注释去掉即可
                                    report: urlAddRandomNo("../../grf/香囊标签JSON3.grf"),
                                    data: Customer
                                };
                                console.log("打印香囊条码:" + data.data[0].条码编号);
                                //var args = {
                                //    report: urlAddRandomNo("../../grf/cs10.grf"),
                                //    data: Customer
                                //};
                                webapp_ws_ajax_run(args);
                                var sql = "update a set HPrintQty = HPrintQty + 1 from Gy_BarCodeBill a with(nolock) where HItemID = " + data.data[0].HItemID;
                                $.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 });
                    }
                })
            }
            /**
            * é¦™å›Šä¿¡æ¯è¿‡ç«™
            * @param HBarCode
            */
            //镭雕码回车查询
            function txtHBarCodeSN_KeyDown(HBarCode) {
                var data = {
                    "field": {
                        "HProcID": "183340", "HBatchNo": "",
                        "HGroupID": "119", "HSourceID": 0,
                        "HPRDOrgID": sessionStorage["OrganizationID"],
                        "HEmpID": 0, "HDeptID": 0
                    }
                };
                var sMainStr = JSON.stringify(data.field);
                var sSubStr = HBarCode;
                var sMainSub = sMainStr + ';' + sSubStr + ';' + sessionStorage["HUserName"];
                $.ajax({
                    type: "POST",
                    url: GetWEBURL() + "/Cj_SingleStation/AddStationOutBillList",
                    async: false,
                    data: { "sMainSub": sMainSub },
                    dataType: "json",
                    success: function (data1) {
                        if (data1.count == 1) {
                        }
                        else {
                            layer.msg(data1.Message, { icon: 5, btn: ["确认"], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "出现错误" });
                        }
                    },
                    error: function (err) {
                        layer.msg(get_MessageError("错误:" + err, sessionStorage["HTranSlate"]), { icon: 5, btn: [get_MessageError('[0000-2-008]确认', sessionStorage["HTranSlate"])], time: 100000, offset: 't', skin: 'layui-layer-lan', title: get_MessageError("[0000-2-009]温馨提示", sessionStorage["HTranSlate"]) });
                    }
                });
            }
            //非空验证
            function AllowLoadData(sSubStr) {
                var Result = true;