llj
2026-01-15 2cb9b601f823d9e512126de5cf2504cd6add8c7a
WebTM/views/³µ¼ä¹ÜÀí/µ¥Æ·¹ýÕ¾_СÎÀ/Cj_SachetBarCodePrint.html
@@ -43,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>
@@ -52,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">
@@ -92,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>
@@ -156,6 +163,7 @@
            var sWhere = "";
            var HModName = "Cj_SachetBarCodePrint";
            var titleData = [];//不需要显示的字段 å¯æ‰©å±•
            var HWhetherToPrint = true; //是否打印
       
            //#endregion                       
         
@@ -281,8 +289,52 @@
                $('#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) {
@@ -425,7 +477,7 @@
                                //};
                                webapp_ws_ajax_run(args);
                                if (rest.length <= num + 1) {
                                if (rest.length <= num + 1 || HWhetherToPrint == false) {
                                    num = 0;
                                    clearInterval(time);
                                } else {
@@ -464,6 +516,79 @@
            }
            //补打条码
            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