From c1da6d36b8133744017a4f1c5e97821b591f02fc Mon Sep 17 00:00:00 2001
From: admin <15939171744@163.com>
Date: 星期二, 30 七月 2024 13:57:21 +0800
Subject: [PATCH] -bug修改

---
 jcdm-ui/src/views/main/kb/preInstalledTerminal/index.vue |  160 +++++++++++++++++++++++++++++------------------------
 1 files changed, 87 insertions(+), 73 deletions(-)

diff --git a/jcdm-ui/src/views/main/kb/preInstalledTerminal/index.vue b/jcdm-ui/src/views/main/kb/preInstalledTerminal/index.vue
index 3cc833e..49ea7ba 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">
@@ -29,17 +30,19 @@
            <span slot="label"> <a class="el-icon-date"></a>棣栭〉</span>
            <el-col :span="24">
              <el-table height="500" :cell-style="rowStyle" :data="formulaChildList">
-               <el-table-column label="鎺掑簭" width="60" align="center" type="index">
+<!--               <el-table-column label="鎺掑簭" width="60" align="center" type="index">-->
+<!--               </el-table-column>-->
+               <el-table-column label="鎷х揣姝ュ彿" width="80" align="center" prop="stepSort">
                </el-table-column>
                <el-table-column label="鎿嶄綔鍐呭" :show-overflow-tooltip='true' align="center" prop="operationSteps">
                </el-table-column>
-               <el-table-column label="浜у搧缂栧彿" align="center" prop="productCode">
+               <el-table-column label="浜у搧缂栧彿" width="80" align="center" prop="productCode">
                </el-table-column>
-               <el-table-column label="鐗╂枡缂栫爜" align="center" prop="materialCode">
+               <el-table-column label="鐗╂枡缂栫爜" width="140" align="center" prop="materialCode">
                </el-table-column>
                <el-table-column label="閲囬泦鍊�" align="center" prop="collectData">
                </el-table-column>
-               <el-table-column label="缁撴灉" align="center" prop="results">
+               <el-table-column label="缁撴灉" width="60" align="center" prop="results">
                </el-table-column>
              </el-table>
            </el-col>
@@ -189,6 +192,9 @@
 <script>
 import {getIpv4, listStationConf} from "@/api/main/sc/stationConf";
 import {
+  checkMaterialCode,
+  clearWorkpieceRelease,
+  fistSetpNumber,
   noPageListFormulaChild,
   workpieceRelease,
   yzUpdateResults,
@@ -198,7 +204,7 @@
 import USBDevice from "@/utils/usb.json";
 import {addPassingStationCollection} from "@/api/main/da/passingStationCollection/passingStationCollection";
 import {
-  addTighteningParameters,
+  addTighteningParameters, preInstallOut,
   replaceAssemblyCode,
   saveCampaignTimeParameters,
   yzAddBasicParameters,
@@ -226,6 +232,7 @@
         processesName: '璐存爣鏈�-璐寸爜',
         sfcCode: '',
         yzSfcCode: '',
+        inboundTime: '',
       },
       workpieceInformation: {
         workOrderNo: null,
@@ -256,6 +263,8 @@
       },
       content: '',
       activeName: 'first',
+      // url: "ws://192.168.2.248:8080/websocket/message/",
+      // url: "ws://10.103.210.248:8080/websocket/message/",
       url: "ws://192.168.2.76:8080/websocket/message/",
       message: "",
       text_content: "",
@@ -324,20 +333,6 @@
     serialLink() {
       this.open1 = true
     },
-    bindYzSfc(){
-      if(this.headContent.sfcCode!==""&&this.headContent.yzSfcCode!==""){
-        let param = {
-          sfcCode: this.headContent.sfcCode,
-          locationCode: this.headContent.processesCode,
-          yzSfcCode: this.headContent.yzSfcCode
-        }
-        this.$message('鍙互缁戝畾锛�');
-        replaceAssemblyCode(param).then(response => {
-
-        });
-      }
-    },
-
     Release(){
       // this.$message('portsList锛�'+this.portsList.length);
       if(this.btnType === "danger"){
@@ -349,12 +344,26 @@
       }
 
     },
+
+    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 = {
         scanBarcode: value,
         sfcBarcode: this.headContent.sfcCode,
         workOrderNo: this.workpieceInformation.workOrderNo,
-        productCode: "1P102S",
+        productCode: "PE01B",
         locationCode: this.headContent.processesCode,
         collectionTime: new Date()
       }
@@ -372,7 +381,7 @@
     },
     /** 鏌ヨ閰嶆柟閰嶇疆瀛愪俊鎭垪琛� */
     getListFormulaChild() {
-      this.formulaChildParams.productCode = "1P102S"
+      this.formulaChildParams.productCode = "PE01B"
       this.formulaChildParams.processesCode = this.headContent.processesCode
       console.log(this.formulaChildParams)
       noPageListFormulaChild(this.formulaChildParams).then(response => {
@@ -405,8 +414,14 @@
       console.log(tab, event);
     },
     clearClick(){
-      this.$message('杩欐槸涓�鏉℃竻闄ゆ秷鎭彁绀�');
-      this.headContent.sfcCode = null
+      const param = {
+        productCode: 'PE01B',
+        locationCode: this.headContent.processesCode,
+      }
+      clearWorkpieceRelease(param).then(response => {});
+      this.headContent.sfcCode = ''
+      this.formulaChildList = [];
+      this.$message('娓呴櫎鎴愬姛锛�');
     },
     scanCompleted(){
       this.$message('鎵爜瀹屾垚'+this.content);
@@ -420,8 +435,12 @@
     },
     /** 鏌ヨ宸ュ崟鍒楄〃 */
     async getList() {
+      const param = {
+        processesCode: this.headContent.processesCode,
+      }
+      fistSetpNumber(param).then(response => {});
       this.getListFormulaChild()
-      this.addOverStationCollection()
+      // this.addOverStationCollection()
     },
 
     /** 鍏ョ珯澧炲姞杩囩珯閲囬泦璁板綍 **/
@@ -478,36 +497,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
@@ -524,27 +514,45 @@
             tightenTheArray: event.data,
             paramCode: formulaChilds.paramCode,
             // workOrderNo: self.workpieceInformation.workOrderNo,
-            productCode: "1P102S",
+            // productCode: "1P102S",
             locationCode: self.headContent.processesCode,
             productBarcode: self.headContent.sfcCode,
+            spareField2: formulaChilds.spareField2,
+            spareField3: formulaChilds.spareField3,
+            spareField4: formulaChilds.spareField4,
+            stepSort: formulaChilds.stepSort
           }
-          addTighteningParameters(param).then(response => {});
-          yzUpdateTighteningFormula(param).then(response => {
-            console.log(response.msg)
-            if(response.msg === "1"){
-                self.getListFormulaChild()
+          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('鏈壂鎻忕墿鏂欑爜瀹屾瘯锛�');
             }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 = '';
+              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,
+                    productCode: "PE01B"
+                  }
+                  preInstallOut(param).then(response => {});
+                  workpieceRelease(param).then(response => {});
+                  self.formulaChildList = [];
+                  self.headContent.sfcCode = '';
+                }
+              });
+              addTighteningParameters(param).then(response => {});
             }
           });
         }
@@ -561,12 +569,18 @@
         console.log("涓插彛鏀跺埌鏁版嵁-------------------"+scanValue)
 
         if(this.headContent.sfcCode !== ''){
-          this.$message('鎵弿鐗╂枡缂栫爜'+scanValue);
+          this.$message('棰勮宸ヤ綅鎵弿鐗╂枡缂栫爜'+scanValue);
           console.log(scanValue)
           this.serialPortMethod(scanValue)
         } else {
-          this.headContent.sfcCode = scanValue;
-          this.getList()
+          if(scanValue.includes("P9900183275") || scanValue.includes("P9900173252")){
+            this.headContent.sfcCode = scanValue;
+            this.headContent.inboundTime = this.getCurrentTime();
+            this.getList()
+          }else {
+            this.$message.error('鎬绘垚鐮佹壂鎻忛敊璇紒');
+          }
+
         }
 
       }

--
Gitblit v1.9.3