-
懒羊羊
2024-04-12 c5e9c5922da7de2bf6df6dce42e7162dbe5cdd2d
jcdm-ui/src/views/main/kb/stationTerminal/index.vue
@@ -106,7 +106,7 @@
         <el-tab-pane name="first">
           <span slot="label"> <a class="el-icon-date"></a>首页</span>
           <el-col :span="24">
             <el-table :cell-style="rowStyle" :data="formulaChildList">
             <el-table height="500" :cell-style="rowStyle" :data="formulaChildList">
               <el-table-column label="排序" width="60" align="center" type="index">
               </el-table-column>
               <el-table-column label="操作内容" :show-overflow-tooltip='true' align="center" prop="operationSteps">
@@ -294,6 +294,7 @@
import {listStationConf,getIpv4} from "@/api/main/sc/stationConf";
import {
  listFormulaChild,
  noPageListFormulaChild,
  releaseCheck,
  updateResults,
  updateTighteningFormula,
@@ -360,7 +361,7 @@
      },
      content: '',
      activeName: 'first',
      url: "ws://192.168.10.21:8080/websocket/message/",
      url: "ws://192.168.1.100:8080/websocket/message/",
      message: "",
      text_content: "",
      ws: null,
@@ -370,7 +371,7 @@
      input: "",
      keepReading: true,
      form1: {
        baudRate: "9600",
        baudRate: "115200",
        dataBits: "8",
        stopBits: "1",
        parity: "none",
@@ -478,6 +479,10 @@
        collectionTime: new Date()
      }
      updateResults(formulaChildParams).then(response => {
        console.log(response)
        if(response.msg === "3"){
          this.cakeLamp.release= 1 //允许放行
        }
        this.getListFormulaChild()
      });
    },
@@ -494,11 +499,24 @@
      // this.formulaChildList = []
      this.formulaChildParams.productCode = this.workpieceInformation.productCode
      this.formulaChildParams.processesCode = this.headContent.processesCode
      listFormulaChild(this.formulaChildParams).then(response => {
      console.log(this.formulaChildParams)
      noPageListFormulaChild(this.formulaChildParams).then(response => {
        this.formulaChildList = response.rows;
      });
    },
    endClear(){
      this.cakeLamp.InPlace= 0 //工件到位
      this.cakeLamp.scanFinish= 0
      this.cakeLamp.startWork= 0
      this.cakeLamp.release= 0 //允许放行
      this.formulaChildList = []
      this.headContent.sfcCode = null
      this.workpieceInformation.productCode = null;
      this.workpieceInformation.workOrderNo = null;
      this.workpieceInformation.productModel = null;
      this.workpieceInformation.productName = null;
    },
    changeMenu(tab, event) {
      console.log(tab, event);
    },
@@ -561,6 +579,7 @@
        alert("未连接到服务器");
      }
    },
    initStation: async function () {
      await getIpv4().then(response => {
        this.StationConfQueryParams.ipAddress = response.msg
@@ -577,6 +596,7 @@
        console.log('设置工位编码' + this.headContent.processesCode)
      });
      this.conCom()
      console.log('websocket连接工位为' + this.headContent.processesCode)
      const wsuri = this.url + this.headContent.processesCode;
      this.ws = new WebSocket(wsuri);
@@ -585,7 +605,6 @@
        this.$message('websocket连接成功!');
      };
      this.ws.onmessage = function (event) {
        const DELAY_TIME = 2000;
        if (event.data === "IN") {
          self.cakeLamp.InPlace = 1;
        } else if (event.data === "IN0") {
@@ -600,6 +619,8 @@
            productBarcode: self.headContent.sfcCode,
          }
          saveCampaignTimeParameters(param).then(response => {});
          self.cakeLamp.release = 1;
          self.endClear()
        } else if (event.data.includes("[")) {
          let formulaChilds = "";
@@ -632,6 +653,8 @@
      };
    },
    //接受数据的回调
    callBack(value) {
      if (this.form1.isShowHistory) this.form1.desc = this.readLi().join("");
@@ -640,9 +663,11 @@
        console.log("串口收到数据-------------------"+scanValue)
        // if(this.cakeLamp.InPlace=== 1){
          if(this.headContent.sfcCode !== ''){
            this.$message('扫描物料编码'+scanValue);
            console.log(scanValue)
            this.serialPortMethod(scanValue)
          }else {
            this.$message('扫码识别产品序列号'+scanValue);
            this.headContent.sfcCode = scanValue;
            this.queryParams.productNum = scanValue;
            this.getList()
@@ -701,6 +726,22 @@
        return body;
      });
    },
    conCom(){
      try {
        this.myserialport.state.baudRate = this.form1.baudRate;
        this.myserialport.state.dataBits = this.form1.dataBits;
        this.myserialport.state.stopBits = this.form1.stopBits;
        this.myserialport.state.parity = this.form1.parity;
        this.myserialport.state.flowControl = this.form1.flowControl;
        this.myserialport.openPort(0, true, this.callBack);
        console.log(this.form1.port)
      } catch (error) {
        this.$message.error("串口连接失败!请检查串口是否已被占用");
      }
      if (this.myserialport.state.isOpen) {
        this.$message.success("串口连接成功");
      }
    },
    //连接
    async connectBtn() {
      if (this.btnType === "primary") {