admin
2024-10-15 6d313a4a6f9f9d7ea65ec50ab0d4491e595edb97
jcdm-ui/src/views/main/kb/stationTerminal/index.vue
@@ -91,42 +91,65 @@
               <div ref="canvasWrapper" id="canvasWrapper3" style="display: flex;justify-content: center;"></div>
               <p style="font-size: 10px;word-break: break-all;display: flex;justify-content: center;">{{packCode}}</p>
             </div>
             <el-button @click="print">打印</el-button>
<!--             <el-button @click="print">打印</el-button>-->
             <el-button @click="test1">生成二维码</el-button>
           </div>
         </el-row>
         <el-row v-show="offlineFlag" style="margin-top: 20px">
           <el-button @click="print1" type="primary">打印三联码</el-button>
           <el-button id="printBack" v-print="'#printMeBack'" type="primary">打印一联码</el-button><br>
           <el-button style="margin-top: 20px" id="print" v-print="'#printMe'" type="primary">打印三联码</el-button>
           <el-button style="display: none" @click="test1">生成二维码</el-button>
           <el-button style="display: none" @click="test2">生成二维码</el-button>
           <div>
             <div style="display: none" id="printMe">
           <el-button style="display: none" @click="test2">生成
             <span style="font-size: 10px;margin-left: 52px">MADE IN CHINA</span><br>
             <br>
             <br>二维码</el-button>
           <el-button style="display: none" @click="test4">生成二维码</el-button>
           <el-button style="display: none" @click="test5">生成
             <span style="font-size: 10px;margin-left: 52px">MADE IN CHINA</span><br>
             <br>
             <br>二维码</el-button>
           <div style="display: none">
             <div  id="printMe">
               <br>
               <p style="margin-left: 43px">{{printInfoData.partNumber}}</p>
               <p style="margin-left: 43px">{{printInfoData.hardwareVersion}}</p>
               <p style="margin-left: 43px">{{printInfoData.softwareVersion}}</p>
               <p style="margin-left: 53px">{{printInfoData.partNumber}}</p>
               <p style="margin-left: 53px">{{printInfoData.hardwareVersion}}</p>
               <p style="margin-left: 53px">{{printInfoData.softwareVersion}}</p>
               <br>
               <br>
               <!--                  <span style="font-size: 30px;font-weight: bold;margin-left: 40px;">GEELY</span><br>-->
               <img style="width: 140px;height: 20px;margin-left: 25px" :src="require('@/assets/images/a8963a24920640508e96150a053fc41.png')">
               <span style="margin-left: 60px">{{printInfoData.printModel}}</span><br>
               <span style="margin-left: 63px">{{printInfoData.supplierCode}}</span><br>
               <span style="margin-left: 40px">{{printInfoData.partNumber}}</span><br>
               <span style="font-size: 10px;margin-left: 17px;">{{headContent.sfcCode}}</span><br>
               <span style="font-size: 10px;margin-left: 52px">MADE IN CHINA</span><br>
               <br>
               <br>
               <img style="width: 140px;height: 20px;margin-left: 30px" :src="require('@/assets/images/a8963a24920640508e96150a053fc41.png')"/>
               <span style="margin-left: 72px">{{printInfoData.printModel}}</span><br>
               <span style="margin-left: 73px">{{printInfoData.supplierCode}}</span><br>
               <span style="margin-left: 55px">{{printInfoData.partNumber}}</span><br>
               <span style="font-size: 10px;margin-left: 28px;">{{headContent.sfcCode}}</span><br>
               <span style="font-size: 10px;margin-left: 60px">MADE IN CHINA</span><br>
               <br>
               <br>
               <br>
               <div ref="canvasWrapper" id="canvasWrapper1" style="display: flex;justify-content: center;margin-top: -27px;"></div>
               <span style="font-size: 10px;word-break: break-all;display: flex;justify-content: center;width: 155px;margin-left: 9px">P{{printInfoData.partNumber}}#T{{headContent.sfcCode}}#V{{printInfoData.supplierCode}}#S{{printInfoData.softwareVersion}}#H{{printInfoData.hardwareVersion}}#NBMS#</span>
               <!--                  <span style="font-size: 10px;word-break: break-all;display: flex;justify-content: center;width: 155px;margin-left: 9px">P{{printInfoData.partNumber}}#T{{text1}}#V{{printInfoData.supplierCode}}#S{{// printInfoData.softwareVersion}}#H{{printInfoData.hardwareVersion}}#NBMS#</span>-->
               <span style="font-size: 10px;word-break: break-all;display: flex;justify-content: center;width: 155px;margin-left: 20px;margin-top: 3px">P{{printInfoData.partNumber}}#T{{headContent.sfcCode}}#V{{printInfoData.supplierCode}}#S{{printInfoData.softwareVersion}}#H{{printInfoData.hardwareVersion}}#NBMS#</span>
               <br>
               <br>
               <div ref="canvasWrapper" id="canvasWrapper2" style="display: flex;justify-content: center;margin-top: -27px"></div>
               <span style="font-size: 10px;word-break: break-all;display: flex;justify-content: center;width: 155px;margin-left: 9px">P{{printInfoData.partNumber}}#T{{headContent.sfcCode}}#V{{printInfoData.supplierCode}}#S{{printInfoData.softwareVersion}}#H{{printInfoData.hardwareVersion}}#NBMS#</span>
               <!--                  <span style="font-size: 10px;word-break: break-all;display: flex;justify-content: center;width: 155px;margin-left: 9px">P{{printInfoData.partNumber}}#T{{text1}}#V{{printInfoData.supplierCode}}#S{{// printInfoData.softwareVersion}}#H{{printInfoData.hardwareVersion}}#NBMS#</span>-->
               <span style="font-size: 10px;word-break: break-all;display: flex;justify-content: center;width: 155px;margin-left: 20px;margin-top: 3px">P{{printInfoData.partNumber}}#T{{headContent.sfcCode}}#V{{printInfoData.supplierCode}}#S{{printInfoData.softwareVersion}}#H{{printInfoData.hardwareVersion}}#NBMS#</span>
             </div>
           </div>
           <div style="display: none">
             <div  id="printMeBack">
               <br>
               <br>
               <div ref="canvasWrapper" id="canvasWrapper4" style="display: flex;justify-content: center;margin-top: -27px"></div>
               <span style="font-size: 10px;word-break: break-all;display: flex;justify-content: center;width: 155px;margin-left: 20px;margin-top: 3px">P{{printInfoData.partNumber}}#T{{headContent.sfcCode}}#V{{printInfoData.supplierCode}}#S{{printInfoData.softwareVersion}}#H{{printInfoData.hardwareVersion}}#NBMS#</span>
               <br>
               <br>
               <div ref="canvasWrapper" id="canvasWrapper5" style="display: flex;justify-content: center;margin-top: -27px"></div>
               <span style="font-size: 10px;word-break: break-all;display: flex;justify-content: center;width: 155px;margin-left: 20px;margin-top: 3px">P{{printInfoData.partNumber}}#T{{headContent.sfcCode}}#V{{printInfoData.supplierCode}}#S{{printInfoData.softwareVersion}}#H{{printInfoData.hardwareVersion}}#NBMS#</span>
             </div>
           </div>
         </el-row>
       </el-card>
@@ -327,6 +350,7 @@
  replaceAssemblyCode, checkRecordDataDone, enterWeighing,
} from "@/api/main/da/paramCollection/paramCollection";
import QRCode from "qrcodejs2";
import {listEquipmentArchives} from "@/api/main/em/equipmentArchives/equipmentArchives";
export default {
  name: "stationTerminal",
@@ -427,8 +451,7 @@
      originalArray: [],
      yzSfcFlag: 1,
      endYz: false,
      packCode: 'test111',
      packCode: 'test111'
    }
  },
  beforeDestroy() {
@@ -462,7 +485,7 @@
  computed: {
    isDisable() {
      return this.btnType === "danger";
    },
    }
  },
  methods: {
@@ -504,6 +527,16 @@
    //接收工单-------结束
    //下线打印-------开始
    initializePrintInfoData(){
      listEquipmentArchives().then(response => {
        this.printInfoData.softwareVersion = response.rows[0].equipmentCode
        this.printInfoData.hardwareVersion = response.rows[0].equipmentName
        this.printInfoData.supplierCode = response.rows[0].equipmentSpec
        this.printInfoData.printModel = response.rows[0].equipmentBrand
        this.printInfoData.partNumber = response.rows[0].equipmentTypeName
        console.log(response.rows[0])
      });
    },
    test1(){
      document.getElementById('canvasWrapper1').innerHTML = '';
      this.$nextTick(() => {
@@ -530,21 +563,57 @@
        }
      )
    },
    test4(){
      document.getElementById('canvasWrapper4').innerHTML = '';
      this.$nextTick(() => {
          let qrCode = new QRCode('canvasWrapper4',{
            width: 120,
            height: 120,
            text: 'P'+this.printInfoData.partNumber+'#T'+ this.headContent.sfcCode +'#V'+this.printInfoData.supplierCode+'#S'+this.printInfoData.softwareVersion+'#H'+this.printInfoData.hardwareVersion+'#NBMS#',
            colorDark: '#000',
            colorLight: '#fff'
          })
        }
      )
    },
    test5(){
      document.getElementById('canvasWrapper5').innerHTML = '';
      this.$nextTick(() => {
          let qrCode = new QRCode('canvasWrapper5',{
            width: 120,
            height: 120,
            text: 'P'+this.printInfoData.partNumber+'#T'+ this.headContent.sfcCode +'#V'+this.printInfoData.supplierCode+'#S'+this.printInfoData.softwareVersion+'#H'+this.printInfoData.hardwareVersion+'#NBMS#',
            colorDark: '#000',
            colorLight: '#fff'
          })
        }
      )
    },
    print1() {
      if(this.headContent.sfcCode!==''&&this.headContent.sfcCode!==null){
        // 新开页面打印
        let newStr = document.getElementById('printMe').innerHTML;
        const printFrame = document.createElement('iframe');
        printFrame.style.display = 'none';
        document.body.appendChild(printFrame);
        const content = document.getElementById('printMe').innerHTML;
        printFrame.contentDocument.write(content);
        printFrame.contentWindow.print();
        document.body.removeChild(printFrame);
        return false;
      }else {
        this.$message.error('未扫描总成码禁止打印!');
      }
      // 使用插件打印方式
      // this.$print(this.$refs.printMe)
      // this.initializePrintInfoData()
      // if(this.headContent.sfcCode){
      //   //新页面打印
      //   // let newStr = document.getElementById('printMe').innerHTML;
      //   // let newWin = window.open('', '_blank',st);
      //   // newWin.document.body.innerHTML = newStr;
      //   // newWin.print();
      //   // 本页面打印
      //   let newStr = document.getElementById('printMe').innerHTML;
      //   const printFrame = document.createElement('iframe');
      //   printFrame.style.display = 'none';
      //   document.body.appendChild(printFrame);
      //   const content = document.getElementById('printMe').innerHTML;
      //   printFrame.contentDocument.write(content);
      //   printFrame.contentWindow.print();
      //   console.log(printFrame)
      //   // document.body.removeChild(printFrame);
      //   console.log(printFrame)
      //   return false;
      // }else {
      //   this.$message.error('未扫描总成码禁止打印!');
      // }
    },
    //下线打印-------截止
    bindcardCode(scanValue){
@@ -693,6 +762,7 @@
    },
    /** 查询工单列表 */
    async getList() {
      this.initializePrintInfoData()
      await listProductionOrde(this.queryParams).then(response => {
        let rowsData = response.rows[0];
        console.log(rowsData)
@@ -706,6 +776,8 @@
      if(this.headContent.processesCode === 'POP430'){
        this.test1()
        this.test2()
        this.test4()
        this.test5()
      }
      this.getListFormulaChild()
      // this.addOverStationCollection()
@@ -798,11 +870,19 @@
      this.ws = new WebSocket(wsuri);
      const self = this;
      this.ws.onopen = function (event) {
        this.$message('websocket连接成功!');
        self.$message('websocket连接成功!');
      };
      this.ws.onmessage = function (event) {
        if (event.data === "IN") {
        if (event.data === "reportError") {
          self.$message.error('下线报工异常失败!');
        }else if (event.data === "reportSuccess") {
          self.$message('下线报工成功!');
        }else if (event.data === "print") {
          self.$message('postman调用打印方法打印!');
          // self.print1()
          document.getElementById('print').click();
        }else if (event.data === "IN") {
          self.cakeLamp.InPlace = 1;
        } else if (event.data === "NG") {
          //给plc发下线信号