懒羊羊
2024-03-15 b773030f37dc06a92bdb80e8af9a408843d5b317
jcdm-ui/src/views/main/kb/stationTerminal/index.vue
@@ -111,11 +111,11 @@
               </el-table-column>
               <el-table-column label="操作内容" :show-overflow-tooltip='true' align="center" prop="operationSteps">
               </el-table-column>
               <el-table-column label="产品编号" width="150" align="center" prop="productCode">
               <el-table-column label="产品编号" align="center" prop="productCode">
               </el-table-column>
               <el-table-column label="采集值" width="150" align="center" prop="productCode">
               <el-table-column label="采集值" align="center" prop="collectData">
               </el-table-column>
               <el-table-column label="结果" width="150" align="center" prop="results">
               <el-table-column label="结果" align="center" prop="results">
               </el-table-column>
             </el-table>
           </el-col>
@@ -292,7 +292,13 @@
<script>
import {listWorkReport} from "@/api/main/om/workReport/workReport";
import {listStationConf,getIpv4} from "@/api/main/sc/stationConf";
import {listFormulaChild, releaseCheck, updateResults, workpieceRelease} from "@/api/main/bs/formulaChild/formulaChild";
import {
  listFormulaChild,
  releaseCheck,
  updateResults,
  updateTighteningFormula,
  workpieceRelease
} from "@/api/main/bs/formulaChild/formulaChild";
import MySerialPort from "@/utils/MySerialPort";
import USBDevice from "@/utils/usb.json";
import {listProductionOrde} from "@/api/main/om/productionOrde/productionOrde";
@@ -451,30 +457,28 @@
      // });
    },
    serialPortMethod(value){
      console.log(value.includes('C'));
      let formulaChilds = '';
      console.log(this.formulaChildList)
      this.formulaChildList.forEach((formulaChild) => {
        formulaChilds = formulaChild;
        let operationType = formulaChild.operationType;
        let results = formulaChild.results;
        let materialCode = formulaChild.materialCode;
        if(operationType === '2' && value.includes(materialCode) && (results === '' || results === null || results === 'NG')){
          return; // 使用return代替break
        }
      });
      console.log(formulaChilds)
      // let formulaChildParams = {
      //   scanBarcode: value,
      //   sfcBarcode: this.headContent.sfcCode,
      //   workOrderNo: this.workpieceInformation.workOrderNo,
      //   productCode: this.workpieceInformation.productCode,
      //   locationCode: this.headContent.processesCode,
      //   collectionTime: new Date()
      // }
      // updateResults(formulaChildParams).then(response => {
      //   this.getListFormulaChild()
      // let formulaChilds = "";
      // this.formulaChildList.forEach((formulaChild) => {
      //   let operationType = formulaChild.operationType;
      //   let results = formulaChild.results;
      //   let materialCode = formulaChild.materialCode;
      //   if(operationType === '2' && value.includes(materialCode) && (results === "" || results === null || results === 'NG')){
      //     formulaChilds = formulaChild;
      //     return; // 使用return代替break
      //   }
      // });
      // console.log(formulaChilds)
      let formulaChildParams = {
        scanBarcode: value,
        sfcBarcode: this.headContent.sfcCode,
        workOrderNo: this.workpieceInformation.workOrderNo,
        productCode: this.workpieceInformation.productCode,
        locationCode: this.headContent.processesCode,
        collectionTime: new Date()
      }
      updateResults(formulaChildParams).then(response => {
        this.getListFormulaChild()
      });
    },
    rowStyle({ row }) {
      if (row.results === 'OK') {
@@ -638,27 +642,21 @@
          this.formulaChildList = [];
          self.getListFormulaChild();
        } else if (event.data.includes("[")) {
          // console.log('event.data'+event.data)
          // let eventArr = event.data.split("[")[1].split("]")[0].split(", ");
          // let eventArr1 = event.data.replace('[', '').replace(']', '').trim().split(', ');
          // console.log(eventArr1)
          // console.log(Array.isArray(eventArr))
          let formulaChilds = "";
          // for(let i=0;i<self.formulaChildList.length;i++){
          //   formulaChilds = self.formulaChildList[i];
          //   let operationType = formulaChild.operationType;
          //   let results = formulaChild.results;
          //   if(operationType === '1' &&
          //     (results === '' || results === null ||results === 'NG')){
          //         break;
          //   }
          // }
          self.formulaChildList.forEach((formulaChild) => {
            formulaChilds = formulaChild;
            let operationType = formulaChild.operationType;
            let results = formulaChild.results;
            if(operationType === '1' && (results === '' || results === null || results === 'NG')){
              formulaChilds = formulaChild;
              return; // 使用return代替break
            }
            // 执行其他操作
          });
          console.log(formulaChilds)
          console.log(formulaChilds.paramCode)
          const param = {
            tightenTheArray: event.data,
            paramCode: formulaChilds.paramCode,
@@ -668,6 +666,9 @@
            productBarcode: self.headContent.sfcCode,
          }
          addTighteningParameters(param).then(response => {});
          updateTighteningFormula(param).then(response => {
          });
          self.getListFormulaChild()
        }
      };
    },