From 768498719683f85e5ed19c73eb3d14cdbf420df4 Mon Sep 17 00:00:00 2001
From: admin <15939171744@163.com>
Date: 星期一, 01 七月 2024 14:03:01 +0800
Subject: [PATCH] 绑定小车码,预装总成码,手动工位扫码,拧紧逻辑优化

---
 jcdm-ui/src/views/main/kb/preInstalledTerminal/index.vue |  110 +++++++++++++++++++++++++------------------------------
 1 files changed, 50 insertions(+), 60 deletions(-)

diff --git a/jcdm-ui/src/views/main/kb/preInstalledTerminal/index.vue b/jcdm-ui/src/views/main/kb/preInstalledTerminal/index.vue
index 68e47eb..8aeedb5 100644
--- a/jcdm-ui/src/views/main/kb/preInstalledTerminal/index.vue
+++ b/jcdm-ui/src/views/main/kb/preInstalledTerminal/index.vue
@@ -4,6 +4,7 @@
      <el-col :span="7">
        <el-card shadow="never">
          <span class="head-font">宸ヤ綅缂栧彿 : {{headContent.processesCode}}</span>
+         <span hidden>{{headContent.inboundTime}}</span>
        </el-card>
      </el-col>
      <el-col :span="7">
@@ -201,7 +202,7 @@
 import USBDevice from "@/utils/usb.json";
 import {addPassingStationCollection} from "@/api/main/da/passingStationCollection/passingStationCollection";
 import {
-  addTighteningParameters,
+  addTighteningParameters, preInstallOut,
   replaceAssemblyCode,
   saveCampaignTimeParameters,
   yzAddBasicParameters,
@@ -229,6 +230,7 @@
         processesName: '璐存爣鏈�-璐寸爜',
         sfcCode: '',
         yzSfcCode: '',
+        inboundTime: '',
       },
       workpieceInformation: {
         workOrderNo: null,
@@ -259,7 +261,8 @@
       },
       content: '',
       activeName: 'first',
-      url: "ws://192.168.2.76:8080/websocket/message/",
+      url: "ws://10.103.210.248:8080/websocket/message/",
+      // url: "ws://192.168.2.76:8080/websocket/message/",
       message: "",
       text_content: "",
       ws: null,
@@ -337,6 +340,20 @@
 
       }
 
+    },
+
+    getCurrentTime() {
+      const now = new Date();
+      const year = now.getFullYear();
+      const month = this.padTimeUnit(now.getMonth() + 1); // 鏈堜唤鏄粠0寮�濮嬬殑
+      const day = this.padTimeUnit(now.getDate());
+      const hours = this.padTimeUnit(now.getHours());
+      const minutes = this.padTimeUnit(now.getMinutes());
+      const seconds = this.padTimeUnit(now.getSeconds());
+      return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+    },
+    padTimeUnit(value) {
+      return value.toString().padStart(2, '0');
     },
     serialPortMethod(value){
       let formulaChildParams = {
@@ -420,7 +437,7 @@
       }
       fistSetpNumber(param).then(response => {});
       this.getListFormulaChild()
-      this.addOverStationCollection()
+      // this.addOverStationCollection()
     },
 
     /** 鍏ョ珯澧炲姞杩囩珯閲囬泦璁板綍 **/
@@ -477,36 +494,7 @@
         this.$message('websocket杩炴帴鎴愬姛锛�');
       };
       this.ws.onmessage = function (event) {
-        if (event.data === "IN") {
-          self.cakeLamp.InPlace = 1;
-        } else if (event.data === "IN0") {
-          self.cakeLamp.InPlace = 0;
-        } else if (event.data === "OUT") {
-          console.log("out")
-
-          const param = {
-            workOrderNo: self.workpieceInformation.workOrderNo,
-            productCode: "1P102S",
-            locationCode: self.headContent.processesCode,
-            productBarcode: self.headContent.sfcCode,
-          }
-          // saveCampaignTimeParameters(param).then(response => {});
-          // self.cakeLamp.release = 1;
-          workpieceRelease(param).then(response => {});
-          self.formulaChildList = [];
-          self.headContent.sfcCode = '';
-          console.log(self.formulaChildList)
-        } else if (event.data === "END") {
-          // const param = {
-          //   workOrderNo: self.workpieceInformation.workOrderNo,
-          //   productCode: self.workpieceInformation.productCode,
-          //   locationCode: self.headContent.processesCode,
-          //   productBarcode: self.headContent.sfcCode,
-          // }
-          // saveCampaignTimeParameters(param).then(response => {});
-          // self.endClear()
-          // workpieceRelease(param).then(response => {});
-        } else if (event.data.includes("[")) {
+        if(event.data.includes("[")) {
           let formulaChilds = "";
           self.formulaChildList.sort((a, b) => a.stepSort - b.stepSort);
           self.formulaChildList
@@ -523,45 +511,46 @@
             tightenTheArray: event.data,
             paramCode: formulaChilds.paramCode,
             // workOrderNo: self.workpieceInformation.workOrderNo,
-            productCode: "1P102S",
+            // productCode: "1P102S",
             locationCode: self.headContent.processesCode,
             productBarcode: self.headContent.sfcCode,
-          }
-          if(formulaChilds.paramCode === null||formulaChilds.paramCode ===''){
-            self.$message('鏈壘鍒板弬鏁扮爜锛岃妫�鏌ュ弬鏁扮爜鏄惁姝g‘');
-            return;
+            spareField2: formulaChilds.spareField2,
+            spareField3: formulaChilds.spareField3,
+            spareField4: formulaChilds.spareField4,
+            stepSort: formulaChilds.stepSort
           }
           if(self.headContent.sfcCode === null||self.headContent.sfcCode ===''){
             self.$message('鏈壘鍒版�绘垚鐮侊紝璇峰厛鎵爜锛�');
             return;
           }
+          if(formulaChilds.paramCode === null||formulaChilds.paramCode ===''){
+            self.$message('鏈壘鍒板弬鏁扮爜锛岃妫�鏌ュ弬鏁扮爜鏄惁姝g‘');
+            return;
+          }
+
           checkMaterialCode(param).then(response => {
             if(response.msg === "2"){
               self.$message('鏈壂鎻忕墿鏂欑爜瀹屾瘯锛�');
-              return;
+            }else {
+              yzUpdateTighteningFormula(param).then(response => {
+                console.log(response)
+                if(response.msg === "1" || response.msg === "3"){
+                  self.getListFormulaChild()
+                }else {
+                  const param = {
+                    locationCode: self.headContent.processesCode,
+                    productBarcode: self.headContent.sfcCode,
+                    inboundTime: self.headContent.inboundTime
+                  }
+                  preInstallOut(param).then(response => {});
+                  workpieceRelease(param).then(response => {});
+                  self.formulaChildList = [];
+                  self.headContent.sfcCode = '';
+                }
+              });
+              addTighteningParameters(param).then(response => {});
             }
           });
-
-          yzUpdateTighteningFormula(param).then(response => {
-          console.log(response)
-          if(response.msg === "1" || response.msg === "3"){
-              self.getListFormulaChild()
-          }else {
-            const param = {
-              workOrderNo: self.workpieceInformation.workOrderNo,
-              productCode: "1P102S",
-              locationCode: self.headContent.processesCode,
-              productBarcode: self.headContent.sfcCode,
-            }
-            saveCampaignTimeParameters(param).then(response => {});
-            workpieceRelease(param).then(response => {});
-            self.formulaChildList = [];
-            self.headContent.sfcCode = '';
-          }
-        });
-        addTighteningParameters(param).then(response => {});
-        // self.getListFormulaChild()
-
         }
       };
     },
@@ -581,6 +570,7 @@
           this.serialPortMethod(scanValue)
         } else {
           this.headContent.sfcCode = scanValue;
+          this.headContent.inboundTime = this.getCurrentTime();
           this.getList()
         }
 

--
Gitblit v1.9.3