From 039f8973fee9e598c548816a991b875538435f03 Mon Sep 17 00:00:00 2001
From: admin <15939171744@163.com>
Date: 星期一, 12 八月 2024 14:27:57 +0800
Subject: [PATCH] 打印bug优化

---
 jcdm-ui/src/views/main/kb/stationTerminal/index.vue |  188 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 185 insertions(+), 3 deletions(-)

diff --git a/jcdm-ui/src/views/main/kb/stationTerminal/index.vue b/jcdm-ui/src/views/main/kb/stationTerminal/index.vue
index 6013748..d9a29e0 100644
--- a/jcdm-ui/src/views/main/kb/stationTerminal/index.vue
+++ b/jcdm-ui/src/views/main/kb/stationTerminal/index.vue
@@ -76,6 +76,140 @@
              <span>&nbsp;鍏佽鏀捐</span>
            </el-col>
          </el-row>
+         <el-row v-show="printFlag" style="margin-top: 20px">
+           <el-button id="print" v-print="'#printMe'" type="primary">鎵撳嵃</el-button>
+           <div style="display: none">
+             <div id="printMe">
+               <div style="text-align: center;margin-top: 64px">
+                 <span style="font-size: 29px;">鐢甸┍绯荤粺鎬绘垚</span>
+               </div>
+               <div style="display: flex;margin-top: 2px;margin-left: 37px;font-size: 15px">
+                 <div class="div1">
+                   <div >
+                     <span>鐢垫満鍨嬪彿锛�</span><span>TZ180XSDSZX01</span><br>
+                   </div>
+                   <div style="margin-top: 4px">
+                     <span>棰濆畾鍔熺巼锛�</span><span>30KW</span><br>
+                   </div>
+                   <div style="margin-top: 4px">
+                     <span>棰濆畾鎵煩锛�</span><span>70N.m</span><br>
+                   </div>
+                   <div style="margin-top: 4px">
+                     <span>棰濆畾鐢靛帇锛�</span><span>336VDS</span><br>
+                   </div>
+                   <div style="margin-top: 4px">
+                     <span>棰濆伐浣滃埗锛�</span><span>S9</span><br>
+                   </div>
+                   <div style="margin-top: 4px">
+                     <span>鎸佺画宸ヤ綔鐢垫祦锛�</span><span>115A</span><br>
+                   </div>
+                   <div style="margin-top: 4px">
+                     <span>鐩告暟锛�</span><span>3</span><br>
+                   </div>
+                   <div style="margin-top: 4px">
+                     <span>闆朵欢鍙凤細</span><span>9900200461</span><br>
+                   </div>
+                 </div>
+
+                 <div class="div2" style="font-size: 15px;margin-left: 17px">
+                   <div>
+                     <span>鎺у埗鍣ㄥ瀷鍙凤細</span><span>KTZ34X23SZX07</span><br>
+                   </div>
+                   <div style="margin-top: 4px">
+                     <span>宄板�煎姛鐜囷細</span><span>60KW</span><br>
+                   </div>
+                   <div style="margin-top: 4px">
+                     <span>宄板�艰浆鐭╋細</span><span>175N.m</span><br>
+                   </div>
+                   <div style="margin-top: 4px">
+                     <span>鏈�楂樿浆閫燂細</span><span>12000rpm</span><br>
+                   </div>
+                   <div style="margin-top: 4px">
+                     <span>闃叉姢绛夌骇锛�</span><span>IP68</span><br>
+                   </div>
+                   <div style="margin-top: 4px">
+                     <span>宄板�煎伐浣滅數娴侊細</span><span>230A</span><br>
+                   </div>
+                   <div style="margin-top: 4px">
+                     <span>缁濈紭绛夌骇锛�</span><span>H</span><br>
+                   </div>
+                   <div style="margin-top: 4px">
+                     <span>鍑哄巶缂栧彿锛�</span><span>2407190000002</span><br>
+                   </div>
+                 </div>
+               </div>
+               <div style="margin-top: 2px;margin-left: 80px">
+                 <span style="font-size: 29px;">婀栧窞鏅鸿姱鍔ㄥ姏鍙戝睍鏈夐檺鍏徃</span>
+               </div>
+
+
+               <div style="text-align: center;margin-top: 97px;font-size: 20px">
+                 <div style="margin-top: 8px">
+                   <span style="font-size: 22px">TZ180XSDSZX01</span><br>
+
+                 </div>
+                 <div style="margin-top: 4px">
+                   <span style="font-size: 22px">KTZ34X23SZX07</span><br>
+
+                 </div>
+                 <div style="margin-top: 4px">
+                   <span style="font-size: 22px">993083</span><br>
+
+                 </div>
+                 <div style="margin-top: 4px">
+                   <span style="font-size: 22px">9900166410</span><br>
+
+                 </div>
+                 <div style="margin-top: 4px">
+                   <span style="font-size: 22px">2407190000002</span>
+
+                 </div>
+               </div>
+
+               <div style="margin-top: 56px;display: flex;margin-left: 32px">
+                 <div ref="canvasWrapper" id="canvasWrapper1" style="width: 30%;flex: 1"></div>
+                 <div style="width: 70%;flex: 1;margin-top: 18px;margin-right: 26px">
+                        <span style="margin-left: -80px;font-size: 19px;font-family: FangSong">
+                          P9900166410#T{{headContent.sfcCode}}
+                        </span><br>
+                   <span style="margin-left: -80px;font-size: 19px;font-family: FangSong">
+                          #V993983#SSW002.005#HHW001.001#NMCU
+                        </span>
+                   <!--                      <span style="font-size: 10px;word-break: break-all;display: flex;justify-content: center;width: 155px;margin-left: 9px">P9900166410#T{{text1}}#V993983#SSW002.005#HHW001.001#NBMS#</span>-->
+                 </div>
+               </div>
+
+               <div style="margin-top: 42px;display: flex;margin-left: 32px">
+                 <div ref="canvasWrapper" id="canvasWrapper2" style="width: 30%;flex: 1"></div>
+                 <div style="width: 70%;flex: 1;margin-top: 18px;margin-right: 26px">
+                        <span style="margin-left: -80px;font-size: 19px;font-family: FangSong">
+                          P9900166410#T{{headContent.sfcCode}}
+                        </span><br>
+                   <span style="margin-left: -80px;font-size: 19px;font-family: FangSong">
+                          #V993983#SSW002.005#HHW001.001#NMCU
+                        </span>
+                   <!--                      <span style="font-size: 10px;word-break: break-all;display: flex;justify-content: center;width: 155px;margin-left: 9px">P9900166410#T{{text1}}#V993983#SSW002.005#HHW001.001#NBMS#</span>-->
+                 </div>
+               </div>
+
+               <div style="text-align: center;margin-left: -190px;margin-top: 45px">
+                 <div style="margin-top: 4px">
+                   <span>9900200461</span><br>
+                 </div>
+                 <div style="margin-top: 8px">
+                   <span>MCU</span><br>
+                 </div>
+                 <div style="margin-top: 8px">
+                   <span>HW 001.001</span><br>
+                 </div>
+                 <div style="margin-top: 8px">
+                   <span>SW 001.001</span><br>
+                 </div>
+               </div>
+
+             </div>
+           </div>
+         </el-row>
          <el-row v-show="orderFlag" style="margin-top: 20px">
 <!--           <el-button @click="getWorkOrders" type="warning" size="mini">鎺ユ敹宸ュ崟</el-button>-->
          </el-row>
@@ -141,6 +275,7 @@
   replaceAssemblyCode, checkRecordDataDone,
 } from "@/api/main/da/paramCollection/paramCollection";
 import {addFormula} from "@/api/main/bs/formula/formula";
+import QRCode from "qrcodejs2";
 
 export default {
   name: "stationTerminal",
@@ -206,6 +341,7 @@
       passingStationForm: {},
       originalArray: [],
       orderFlag: true,
+      printFlag: false,
       activeName: 'first',
 
     }
@@ -341,10 +477,13 @@
         locationCode: this.headContent.processesCode,
         productBarcode: this.headContent.sfcCode,
       }
-      this.endClear()
+      // this.endClear()
       clearWorkpieceRelease(param).then(response => {});
-      this.headContent.sfcCode = ''
+      // this.headContent.sfcCode = ''
       this.$message('娓呴櫎鎴愬姛锛�');
+      this.setFocus();
+      this.getList()
+
     },
     /** 鏌ヨ宸ュ崟鍒楄〃 */
     async getList() {
@@ -398,6 +537,32 @@
         this.ws = null;
       }
     },
+    test1(){
+      document.getElementById('canvasWrapper1').innerHTML = '';
+      this.$nextTick(() => {
+          let qrCode = new QRCode('canvasWrapper1',{
+            width: 83,
+            height: 83,
+            text: 'P9900166410#T'+ this.headContent.sfcCode +'#V993983#SSW002.005#HHW001.001#NMCU#',
+            colorDark: '#000',
+            colorLight: '#fff'
+          })
+        }
+      )
+    },
+    test2(){
+      document.getElementById('canvasWrapper2').innerHTML = '';
+      this.$nextTick(() => {
+          let qrCode = new QRCode('canvasWrapper2',{
+            width: 83,
+            height: 83,
+            text: 'P9900166410#T'+ this.headContent.sfcCode +'#V993983#SSW002.005#HHW001.001#NMCU#',
+            colorDark: '#000',
+            colorLight: '#fff'
+          })
+        }
+      )
+    },
     send() {
       if (this.ws) {
         this.ws.send(this.message);
@@ -420,6 +585,9 @@
         this.headContent.processesName = rows.processesName
         this.headContent.processesCode = rows.processesCode
         this.initializedData()
+        if(this.headContent.processesCode === 'OP010'){
+          this.printFlag = true
+        }
 
       });
       console.log('websocket杩炴帴宸ヤ綅涓�' + this.headContent.processesCode)
@@ -433,7 +601,10 @@
 
       //socket浠庡悗鍙板悜鍓嶅彴鎺ㄩ�佹暟鎹�
       this.ws.onmessage = function (event) {
-        if (event.data === "IN") {
+        if (event.data === "print") {
+          self.$message('postman璋冪敤鎵撳嵃鏂规硶鎵撳嵃锛�');
+          document.getElementById('print').click();
+        }else if (event.data === "IN") {
           self.cakeLamp.InPlace = 1;
         } else if (event.data === "OUT") {
           self.cakeLamp.release = 1;
@@ -486,6 +657,8 @@
           fistSetpNumber(param).then(response => {
             console.log("fistSetpNumber------"+response.msg)
           });
+          self.test1()
+          self.test2()
 
         }else if (event.data.includes("[")) {//鎷х揣
           let formulaChilds = "";
@@ -550,6 +723,15 @@
 
 </script>
 <style scoped>
+.div1, .div2 {
+  flex: 1; /* 涓や釜div骞冲垎瀹瑰櫒瀹藉害 */
+}
+.span{
+  font-family: 'Microsoft YaHei', sans-serif;
+}
+.div2{
+  margin-left: 30px;
+}
 .bottom-card{
   height: 600px;
 }

--
Gitblit v1.9.3