From 1f2005541e2c5dbb6837bb96e9b7a141145fe94b Mon Sep 17 00:00:00 2001
From: 南骏 池 <chiffly@163.com>
Date: 星期三, 07 五月 2025 17:00:31 +0800
Subject: [PATCH] 1.产品绑定送检优化 2.生产领料拆分无线打印机打条码自定义打印机

---
 H5/Scll.aspx    |    2 
 H5/Js/Scll.js   |  127 +++++++++++++++++++++++++++++++
 H5/Js/Cpbdsj.js |    2 
 H5/Cpdbsj.aspx  |    2 
 H5/Config.aspx  |    8 +
 H5/Js/Config.js |   57 +++++--------
 6 files changed, 158 insertions(+), 40 deletions(-)

diff --git a/H5/Config.aspx b/H5/Config.aspx
index 8835d6f..0469f9b 100644
--- a/H5/Config.aspx
+++ b/H5/Config.aspx
@@ -11,6 +11,12 @@
     <br />
     <br />
     <br />
+        <van-nav-bar
+  title="鍦ㄥ簱鍒嗘枡"
+  left-text="杩斿洖"
+  left-arrow
+  @click-left="GoBack()"
+></van-nav-bar>
     <div class="padding">
         <van-button plain type="info" @click="sendMessage">娴嬭瘯鎵撳嵃</van-button>
     </div>
@@ -52,6 +58,6 @@
             }, 200);
         }
     </script>
-    <script src="Js/Config.js?<%=1511 %>"></script>
+    <script src="Js/Config.js?<%=15111 %>"></script>
 
 </asp:Content>
diff --git a/H5/Cpdbsj.aspx b/H5/Cpdbsj.aspx
index 22f0f91..4ea12d2 100644
--- a/H5/Cpdbsj.aspx
+++ b/H5/Cpdbsj.aspx
@@ -219,5 +219,5 @@
 </asp:Content>
 
 <asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder4" Runat="Server">
-    <script src="Js/Cpbdsj.js?<%=121111111 %>"></script>
+    <script src="Js/Cpbdsj.js?<%=121111112 %>"></script>
 </asp:Content>
\ No newline at end of file
diff --git a/H5/Js/Config.js b/H5/Js/Config.js
index 4eeffc6..008839d 100644
--- a/H5/Js/Config.js
+++ b/H5/Js/Config.js
@@ -13,48 +13,37 @@
     },
     methods: {
 		sendMessage(obj) {
-			var detail = ["绗竴缁勬寚浠�"+
-                "! 0 203 203 480 1\r\n" +
-                "PREFEED 0\n\r" +
-                "POSTFEED 0\n\r" +
-                "PAGE - WIDTH 640\r\n" +
-
-                // 鍙充笂瑙掓斁缃竴涓柟鍨嬩簩缁寸爜锛�80*80锛夛紝鎵弿鍚庣殑鍊间负鈥�123456鈥�
-                "BOX 560 10 640 90 2\r\n" + // 缁樺埗浜岀淮鐮佺殑鏂规
-                "TEXT 570 20 5 \"鏉$爜\"\r\n" + // 鍦ㄦ柟妗嗕腑涓婃柟鏄剧ず鈥滄潯鐮佲��
-                "QRCODE 570 40 M 4 U 0 \"" + obj.qrcode+"\"\r\n" + // 鍒涘缓浜岀淮鐮�
-
-                // 鍙充笅瑙掓樉绀轰竴涓潯褰㈢爜锛屾渶宸﹀湪320浣嶇疆锛岄暱搴︿负100锛屽悓鏃惰繖涓潯褰㈢爜灏嗗叾鎵弿鐨勫�兼樉绀哄湪鏉″舰鐮佷笅渚э紝鏉″舰鐮佺殑鍊间负鈥�987654鈥�
-                "BARCODE 320 350 100 50 1 \"987654\"\r\n" + // 鏄剧ず鏉″舰鐮佺殑浣嶇疆鍜屽ぇ灏�
-                "TEXT 320 410 5 \"987654\"\r\n" + // 
-                "GAP-SENSE\r\n" +
+            var detail = ["! 0 200 200 210 1\r\n" +
+                "PAGE - WIDTH 700 \r\n" +
+                "BOX 0 0 700 180 2 \r\n" +
+                "T 16 0 200 10  鏉$爜1" + "\r\n" + // 娣诲姞瀛椾綋鍚嶇О
+                "BARCODE 128 1 1 20 0 80 " + '123456' + "\r\n" +
+                "TEXT 7 0 50 80 SIMSUN.GB2312 " + '123456' + "\r\n" + // 娣诲姞瀛椾綋鍚嶇О
+                //"B QR 500 10 M 1 U 9 \r\n" +  
+                //"MA," + '001' + "\r\n" +
+                "B QR 580 15 M 2 U 4" + "\r\n" +
+                "MA,QR code ABC123" + "\r\n" +
                 "ENDQR\r\n" +
                 "FORM\r\n" +
                 "PRINT\r\n",
-				"绗簩缁勬寚浠�" + "! 0 400 400 480 1\r\n" +
-				"PREFEED 0\n\r" +
-				"POSTFEED 0\n\r" +
-				"PAGE - WIDTH 640\r\n" +
-				"GAP-SENSE\r\n" +
-				"BOX 5 10 620 450 2\r\n" +
-				"LINE 5 60 620 60 1\r\n" + // 妯嚎1  
-				"LINE 5 110 620 110 1\r\n" + // 妯嚎2  
-				"LINE 5 160 620 160 1\r\n" + // 妯嚎3  
-				"LINE 5 210 620 210 1\r\n" + // 妯嚎4  
-				"LINE 5 260 620 260 1\r\n" + // 妯嚎5  
-				"LINE 120 10 120 260 1\r\n" + // 瀛楁鍚嶇О鍙充晶绔栫嚎  
-				"LINE 240 260 240 450 1\r\n" + // 瑙勬牸鍨嬪彿宸︿晶绔栫嚎  
-				"LINE 285 210 285 450 1\r\n" + // 瑙勬牸鍨嬪彿鍙充晶绔栫嚎  
-				"LINE 410 210 410 260 1\r\n" + // 鍒拌揣鏃ユ湡鍙充晶绔栫嚎  
-				"ENDQR\r\n" +
-				"FORM\r\n" +
-				"PRINT\r\n" ];
+                "! 0 200 200 210 1\r\n" +
+                "PAGE - WIDTH 700 \r\n" +
+                "BOX 0 0 700 180 2 \r\n" +
+                "T 16 0 200 10 鏉$爜2" + "\r\n" + // 娣诲姞瀛椾綋鍚嶇О
+                "BARCODE 128 1 1 20 0 80 " + '123456' + "\r\n" +
+                "TEXT270 10 0 200 50 10#鏍煎紡澶у皬娴嬭瘯" + "\r\n" +
+                "TEXT 7 0 50 80 SIMSUN.GB2312 " + '123456' + "\r\n" + // 娣诲姞瀛椾綋鍚嶇О
+                "B QR 580 15 M 2 U 4" + "\r\n" +
+                "MA,QR code ABC123" + "\r\n" +
+                "ENDQR\r\n" +
+                "FORM\r\n" +
+                "PRINT\r\n" ];
 
             let sendData = {
                 Type: 'Bar',
                 Barcode: 'TM250304-000104-2',
 				Detail: detail,
-				Ip: '192.168.38.25',
+				Ip: '192.168.38.135',
 				Port: '9100',
             }
             console.log('sendMessage 寮�濮�1:')
diff --git a/H5/Js/Cpbdsj.js b/H5/Js/Cpbdsj.js
index 2d92457..d75d54c 100644
--- a/H5/Js/Cpbdsj.js
+++ b/H5/Js/Cpbdsj.js
@@ -258,7 +258,7 @@
                 .then(function (res) {
                     var json = res;
                     if (json.status == 0) {
-                        that.$notify({ type: 'success', message: json.tbBillList.message });
+                        that.$notify({ type: 'success', message: json.message });
                         // 娓呯┖鏁版嵁
                         that.KbBar = "";
                         that.XbarInfo = [];
diff --git a/H5/Js/Scll.js b/H5/Js/Scll.js
index ee502a5..34e441b 100644
--- a/H5/Js/Scll.js
+++ b/H5/Js/Scll.js
@@ -10,6 +10,10 @@
             modeInfo: { daa001: "", planNo: "" },
             scanInfo: { barcodeNum: "", splitNum: "", barcode: "" },
             ItemDetail: [],
+            ip: "",
+            port: "",
+            oldBarInfo: [],
+            cfBarInfo: [],
             //isPrinterPopupVisible: false, // 鎺у埗寮圭獥鏄剧ず/闅愯棌
             //selectedPrinter: '', // 褰撳墠閫夋嫨鐨勬墦鍗版満缂栧彿
             //printerList: [
@@ -59,6 +63,11 @@
                 });
         },
         getScan() {
+
+            if (this.isLoading) {
+                return;
+            }
+
             var that = this;
             if (that.modeInfo.daa001.length <= 0) {
                 that.$toast.fail("宸ュ崟鍗曞彿涓嶈兘涓虹┖锛�");
@@ -80,6 +89,7 @@
                     if (json.status == 0) {
                         // that.scanInfo = json.data.tbBillList;
                         that.$notify({ type: 'success', message: json.message });
+                        that.$playSound('success');
                         that.getModel();
                         that.$refs.barcode.focus();
                         that.scanInfo.barcode = null;
@@ -91,6 +101,7 @@
                     }
                     else {
                         that.$toast.fail(json.message);
+                        that.$playSound('error');
                         that.$refs.barcode.focus();
                     }
                     
@@ -99,12 +110,16 @@
                 .catch(function (error) {
                     that.isLoading = false;
                     that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
-                    console.log(error);
+                    that.$playSound('error');
                     that.$refs.barcode.focus();
                 });
         },
         getChaiFen() {
             //this.isPrinterPopupVisible = true; // 鏄剧ず寮圭獥
+
+            if (this.isLoading) {
+                return;
+            }
 
             var that = this;
             if (that.modeInfo.daa001.length <= 0) {
@@ -119,6 +134,16 @@
                 that.$toast.fail("鐗╂枡鏉$爜涓嶈兘涓虹┖锛�");
                 return;
             }
+            //that.ip = "";
+            //that.prot = "";
+            //that.getPrintInfo();
+
+            //if (that.ip.length <= 0 || that.prot.length <= 0) {
+            //    alert(that.ip);
+            //    alert(that.prot);
+            //    return;
+            //}
+
             that.isLoading = true;
             that.AxiosHttp("post", 'Womdaa/ScanCodeCF', {
                 daa001: that.modeInfo.daa001,
@@ -134,21 +159,119 @@
                         that.scanInfo.barcodeNum = null;
                         that.scanInfo.barcode = null;
                         that.$notify({ type: 'success', message: json.message });
+                        that.$playSound('success');
+
+                        that.sendMessage(json.data.tbBillList);
+
                         that.$refs.barcode.focus();
                         that.getModel();
                     }
                     else {
                         that.$toast.fail(json.message);
+                        that.$playSound('error');
                     }
                     that.isLoading = false;
                 })
                 .catch(function (error) {
                     that.isLoading = false;
                     that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
-                    console.log(error);
+                    that.$playSound('error');
                 });
         },
 
+
+        sendMessage(tbBillList) {
+            const cfDetails = tbBillList.cfBarInfo.map(item => {
+                return "! 0 200 200 210 1\r\n" +
+                    "PAGE - WIDTH 700 \r\n" +
+                    "BOX 0 0 700 180 0 \r\n" +
+                    `T 16 0 10 10 鐗╂枡缂栫爜锛歕r\n` +
+                    `T 55 3 120 10 ${item.iteM_NO}\r\n` +
+                    `T 16 0 310 10 ${item.item_name}\r\n` +
+                    "T 55 2 10 42 鐗╂枡瑙勬牸锛歕r\n" +
+                    `T 55 2 110 42 ${item.item_model}\r\n` +
+                    "T 16 0 10 78 鏁伴噺锛歕r\n" +
+                    `T 0 5 90 78 ${item.quantity}\r\n` +
+                    `T 16 5 180 78 ${item.barType}\r\n` +
+                    `BARCODE 128 1 25 35 350 130 ${item.iteM_BARCODE}\r\n` +
+                    `T 0 1 350 130 ${item.iteM_BARCODE}\r\n` +
+                    "T 55 0 10 125 鍒涘缓鏃堕棿锛歕r\n" +
+                    `T 55 0 120 125 ${item.creatE_DATE}\r\n` +
+                    "T 55 0 10 150 鎵撳嵃鏃堕棿锛歕r\n" +
+                    `T 55 0 120 150 ${item.print_date}\r\n` +
+                    "B QR 580 12 M 2 U 4\r\n" +
+                    `MA,${item.iteM_BARCODE}\r\n` +
+                    "ENDQR\r\nFORM\r\nPRINT\r\n";
+            });
+            //alert(cfDetails);
+            let sendData = {
+                Type: 'Bar',
+                Barcode: tbBillList.cfBarInfo[0].iteM_BARCODE,
+                Detail: cfDetails,
+                Ip: tbBillList.printInfo[0].ip,
+                Port: tbBillList.printInfo[0].port,
+            }
+            console.log('sendMessage 寮�濮�1:')
+            console.log('sendMessage 寮�濮�2:' + JSON.stringify(sendData))
+            uni.webView.postMessage({
+                data: JSON.stringify(sendData)
+            })
+        },
+
+        //getPrintInfo() {
+        //    var that = this;
+
+        //    that.AxiosHttp("post", 'MesPrint/getPrintInfo', {
+        //        userName: that.userInfo.loginAccount,
+        //    }, false)
+        //        .then(function (res) {
+        //            var json = res;
+        //            if (json.status == 0) {
+        //                alert(json.data.tbBillList[0].port);
+        //                alert(json.data.tbBillList[0].ip);
+        //                that.port = json.data.tbBillList[0].port;
+        //                that.ip = json.data.tbBillList[0].ip;
+        //            }
+        //            else {
+        //                that.$toast.fail(json.message);
+        //                that.$playSound('error');
+        //            }
+        //            that.isLoading = false;
+        //        })
+        //        .catch(function (error) {
+        //            that.isLoading = false;
+        //            that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+        //        });
+
+        //},
+        //printCfBar(cfBar) {  
+        //    var that = this;
+
+        //    that.AxiosHttp("post", 'MesPrint/getCfInfo', {
+        //        userName: that.userInfo.loginAccount,
+        //        cfBar: cfBar,  
+        //        oldBar: that.scanInfo.barcode  
+        //    }, false)
+        //        .then(function (res) {
+        //            var json = res;
+        //            if (json.status == 0) {
+        //                that.$notify({ type: 'success', message: '鎵撳嵃璇锋眰宸插彂閫�' });
+        //                that.$playSound('success');
+        //            }
+        //            else {
+        //                that.$toast.fail(json.message);
+        //                that.$playSound('error');
+        //            }
+        //            that.isLoading = false;
+        //        })
+        //        .catch(function (error) {
+        //            that.isLoading = false;
+        //            that.$toast.fail("鎵撳嵃鏈嶅姟寮傚父锛�" + error.message);
+        //            that.$playSound('error');
+        //        });
+        //},
+
+
         //鎵撳嵃鏈烘敞閲�
         //selectPrinter(printer) {
         //    this.selectedPrinter = printer.printerId; // 鏇存柊閫変腑鐨勬墦鍗版満缂栧彿
diff --git a/H5/Scll.aspx b/H5/Scll.aspx
index 8579263..c268196 100644
--- a/H5/Scll.aspx
+++ b/H5/Scll.aspx
@@ -125,5 +125,5 @@
 </asp:Content>
 
 <asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder4" Runat="Server">
-    <script src="Js/Scll.js?<%=123336 %>"></script>
+    <script src="Js/Scll.js?<%=123336153 %>"></script>
 </asp:Content>
\ No newline at end of file

--
Gitblit v1.9.3