From 49c784e6ac7d71c5eaf7352e0a215842b4ca5456 Mon Sep 17 00:00:00 2001
From: 懒羊羊 <15939171744@163.com>
Date: 星期五, 15 三月 2024 08:26:26 +0800
Subject: [PATCH] 操作看板

---
 jcdm-ui/src/views/main/kb/stationTerminal/index.vue |  103 ++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 69 insertions(+), 34 deletions(-)

diff --git a/jcdm-ui/src/views/main/kb/stationTerminal/index.vue b/jcdm-ui/src/views/main/kb/stationTerminal/index.vue
index e138770..8ff6692 100644
--- a/jcdm-ui/src/views/main/kb/stationTerminal/index.vue
+++ b/jcdm-ui/src/views/main/kb/stationTerminal/index.vue
@@ -34,7 +34,7 @@
            <el-descriptions-item label="宸ュ崟缂栧彿">
                <span>{{workpieceInformation.workOrderNo}}</span>
            </el-descriptions-item>
-           <el-descriptions-item label="浜у搧搴忓垪鍙�">
+           <el-descriptions-item label="浜у搧缂栧彿">
              <span>{{workpieceInformation.productCode}}</span>
            </el-descriptions-item>
            <el-descriptions-item label="浜у搧鍨嬪彿">
@@ -291,7 +291,11 @@
 import USBDevice from "@/utils/usb.json";
 import {listProductionOrde} from "@/api/main/om/productionOrde/productionOrde";
 import {addPassingStationCollection} from "@/api/main/da/passingStationCollection/passingStationCollection";
-import {addBasicParameters, addParamCollection} from "@/api/main/da/paramCollection/paramCollection";
+import {
+  addBasicParameters,
+  addParamCollection,
+  addTighteningParameters
+} from "@/api/main/da/paramCollection/paramCollection";
 
 export default {
   name: "stationTerminal",
@@ -312,7 +316,7 @@
       headContent: {
         processesCode: 'OP1010',
         processesName: '璐存爣鏈�-璐寸爜',
-        sfcCode: '10',
+        sfcCode: '',
       },
       workpieceInformation: {
         workOrderNo: null,
@@ -343,7 +347,7 @@
       },
       content: '',
       activeName: 'first',
-      url: "ws://192.168.11.134:8080/websocket/message/",
+      url: "ws://192.168.11.76:8080/websocket/message/",
       message: "",
       text_content: "",
       ws: null,
@@ -371,6 +375,7 @@
       title: "",
 
       passingStationForm: {},
+      originalArray: [],
     }
   },
   beforeDestroy() {
@@ -441,7 +446,8 @@
     },
     serialPortMethod(value){
       let formulaChildParams = {
-        materialCode: value,
+        scanBarcode: value,
+        sfcBarcode: this.headContent.sfcCode,
         workOrderNo: this.workpieceInformation.workOrderNo,
         productCode: this.workpieceInformation.productCode,
         locationCode: this.headContent.processesCode,
@@ -571,23 +577,23 @@
         alert("鏈繛鎺ュ埌鏈嶅姟鍣�");
       }
     },
-    async initStation(){
+    initStation: async function () {
       await getIpv4().then(response => {
         this.StationConfQueryParams.ipAddress = response.msg
-        console.log('鏌ヨ鍒版湰宸ヤ綅IP涓�'+this.StationConfQueryParams.ipAddress)
+        console.log('鏌ヨ鍒版湰宸ヤ綅IP涓�' + this.StationConfQueryParams.ipAddress)
       });
       await listStationConf(this.StationConfQueryParams).then(response => {
         let rows = response.rows[0]
-        if(response.rows.length===0){
+        if (response.rows.length === 0) {
           this.$message('璇ュ伐浣嶆病鏈夐厤缃甀P锛岃鑱旂郴绠$悊鍛橀厤缃甀P');
           return
         }
         this.headContent.processesName = rows.processesName
         this.headContent.processesCode = rows.processesCode
-        console.log('璁剧疆宸ヤ綅缂栫爜'+this.headContent.processesCode)
+        console.log('璁剧疆宸ヤ綅缂栫爜' + this.headContent.processesCode)
 
       });
-      console.log('websocket杩炴帴宸ヤ綅涓�'+this.headContent.processesCode)
+      console.log('websocket杩炴帴宸ヤ綅涓�' + this.headContent.processesCode)
       const wsuri = this.url + this.headContent.processesCode;
       this.ws = new WebSocket(wsuri);
       const self = this;
@@ -596,33 +602,62 @@
       };
       this.ws.onmessage = function (event) {
         const DELAY_TIME = 2000;
-        switch (event.data) {
-          case "IN":
-            self.cakeLamp.InPlace = 1;
-            break;
-          case "IN0":
+        if (event.data === "IN") {
+          self.cakeLamp.InPlace = 1;
+        } else if (event.data === "IN0") {
+          self.cakeLamp.InPlace = 0;
+        } else if (event.data === "OUT") {
+          self.cakeLamp.release = 1;
+          setTimeout(() => {
             self.cakeLamp.InPlace = 0;
-            break;
-          case "OUT":
-            self.cakeLamp.release = 1;
-            setTimeout(() => {
-              self.cakeLamp.InPlace = 0;
-              self.cakeLamp.release = 0;
-              self.cakeLamp.startWork = 0;
-              self.cakeLamp.scanFinish = 0;
-              self.Release();
-            }, DELAY_TIME);
-            break;
-          case "TIGHTEN":
-            this.formulaChildList = [];
-            self.getListFormulaChild();
-            break;
-          default:
-            break;
+            self.cakeLamp.release = 0;
+            self.cakeLamp.startWork = 0;
+            self.cakeLamp.scanFinish = 0;
+            self.Release();
+          }, DELAY_TIME);
+        } else if (event.data === "TIGHTEN") {
+          this.formulaChildList = [];
+          self.getListFormulaChild();
+        } else if (event.data.includes("[")) {
+          // 杩欓噷鏄� default 鍒嗘敮锛屽鏋滈渶瑕佹墽琛屾煇浜涙搷浣滐紝鍙互鏀惧湪杩欓噷
+          // console.log('鎺ユ敹鍒版暟鎹細', event.data)
+          // const arr = JSON.parse(event.data)
+          // console.log(arr)
+          const param = {
+            tightenTheArray: event.data,
+            workOrderNo: self.workpieceInformation.workOrderNo,
+            productCode: self.workpieceInformation.productCode,
+            locationCode: self.headContent.processesCode,
+            productBarcode: self.headContent.sfcCode,
+          }
+          addTighteningParameters(param).then(response => {});
         }
+        // switch (event.data) {
+        //   case "IN":
+        //     self.cakeLamp.InPlace = 1;
+        //     break;
+        //   case "IN0":
+        //     self.cakeLamp.InPlace = 0;
+        //     break;
+        //   case "OUT":
+        //     self.cakeLamp.release = 1;
+        //     setTimeout(() => {
+        //       self.cakeLamp.InPlace = 0;
+        //       self.cakeLamp.release = 0;
+        //       self.cakeLamp.startWork = 0;
+        //       self.cakeLamp.scanFinish = 0;
+        //       self.Release();
+        //     }, DELAY_TIME);
+        //     break;
+        //   case "TIGHTEN":
+        //     this.formulaChildList = [];
+        //     self.getListFormulaChild();
+        //     break;
+        //   default:
+        //     break;
+        // }
       };
     },
-
 
     //鎺ュ彈鏁版嵁鐨勫洖璋�
     callBack(value) {
@@ -638,7 +673,7 @@
         } else {
           console.log('瀛楃涓蹭笉鍖呭惈瀛楁瘝"T"');
           this.headContent.sfcCode = scanValue;
-          this.queryParams.sfcCode = scanValue;
+          this.queryParams.productNum = scanValue;
           this.getList()
           // this.getListFormulaChild()
           this.cakeLamp.scanFinish = 1

--
Gitblit v1.9.3