From 6d313a4a6f9f9d7ea65ec50ab0d4491e595edb97 Mon Sep 17 00:00:00 2001 From: admin <15939171744@163.com> Date: 星期二, 15 十月 2024 09:47:26 +0800 Subject: [PATCH] -打印bug修改 --- jcdm-ui/src/views/main/kb/stationTerminal/index.vue | 764 +++++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 592 insertions(+), 172 deletions(-) diff --git a/jcdm-ui/src/views/main/kb/stationTerminal/index.vue b/jcdm-ui/src/views/main/kb/stationTerminal/index.vue index e138770..ed56f0d 100644 --- a/jcdm-ui/src/views/main/kb/stationTerminal/index.vue +++ b/jcdm-ui/src/views/main/kb/stationTerminal/index.vue @@ -34,18 +34,15 @@ <el-descriptions-item label="宸ュ崟缂栧彿"> <span>{{workpieceInformation.workOrderNo}}</span> </el-descriptions-item> - <el-descriptions-item label="浜у搧搴忓垪鍙�"> + <el-descriptions-item label="浜у搧鍨嬪彿"> <span>{{workpieceInformation.productCode}}</span> </el-descriptions-item> - <el-descriptions-item label="浜у搧鍨嬪彿"> - <span>{{workpieceInformation.productModel}}</span> + <el-descriptions-item label="灏忚溅鐮�"> + <span>{{headContent.cardCode}}</span> </el-descriptions-item> - <el-descriptions-item label="浜у搧鍚嶇О"> - <span>{{workpieceInformation.productName}}</span> + <el-descriptions-item label="寮�濮嬫椂闂�"> + <span>{{workpieceInformation.inboundTime}}</span> </el-descriptions-item> -<!-- <el-descriptions-item label="鑺傛媿">--> -<!-- <span>{{workpieceInformation.beat}}</span>--> -<!-- </el-descriptions-item>--> </el-descriptions> <el-divider></el-divider> <el-row> @@ -85,18 +82,74 @@ </el-col> </el-row> -<!-- <el-row style="margin-top: 20px">--> -<!-- <el-col :span="12">--> -<!-- <el-input v-model="serialPortContent" style="width: 150px;" placeholder="璇疯緭鍏ュ唴瀹�"></el-input>--> -<!-- </el-col>--> -<!-- <el-col :span="12">--> -<!-- <el-button @click="serialPortMethod" type="primary">涓插彛鑾峰彇鏁版嵁</el-button>--> + <el-row v-show="goOnlineFlag" style="margin-top: 20px"> + <el-button @click="getWorkOrders" type="primary">鎺ユ敹宸ュ崟</el-button> -<!-- </el-col>--> -<!-- </el-row>--> - <el-row style="margin-top: 20px"> - <el-button @click="Release" type="primary">鏀捐</el-button> + <div style="display: none"> + <div id="getWorkOrdersPrintPrintMe" style="width: 500px;"> + <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="test1">鐢熸垚浜岀淮鐮�</el-button> + </div> + </el-row> + + <el-row v-show="offlineFlag" style="margin-top: 20px"> + <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">鐢熸垚 + <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: 53px">{{printInfoData.partNumber}}</p> + <p style="margin-left: 53px">{{printInfoData.hardwareVersion}}</p> + <p style="margin-left: 53px">{{printInfoData.softwareVersion}}</p> + <br> + <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: 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: 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> @@ -105,41 +158,23 @@ <el-tabs type="border-card" style="height: 600px" v-model="activeName" @tab-click="changeMenu"> <el-tab-pane name="first"> <span slot="label"> <a class="el-icon-date"></a>棣栭〉</span> - <el-col :span="10"> - <el-table :cell-style="rowStyle" :data="formulaChildList"> - <el-table-column label="鎺掑簭" width="60" align="center" prop="stepSort"> + <el-col :span="24"> + <el-table height="500" :cell-style="rowStyle" :data="formulaChildList"> + <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 label="鎿嶄綔鍐呭" align="center" prop="operationSteps"> </el-table-column> + <el-table-column label="浜у搧缂栧彿" width="80" align="center" prop="productCode"> + </el-table-column> + <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="缁撴灉" width="60" align="center" prop="results"> + </el-table-column> + </el-table> </el-col> - <el-col :span="14"> - <el-image style="height: 520px;width: 100%" :src="imgSrc"></el-image> - </el-col> - </el-tab-pane> - <el-tab-pane name="second"> - <span slot="label"> <b class="el-icon-date"></b>鐗╂枡BOM</span> - <el-empty> - <span slot="description">鏆傛棤鏁版嵁</span> - </el-empty> - </el-tab-pane> - <el-tab-pane name="third"> - <span slot="label"> <b class="el-icon-date"></b>閲囬泦娓呭崟</span> - <el-empty> - <span slot="description">鏆傛棤鏁版嵁</span> - </el-empty> - </el-tab-pane> - <el-tab-pane name="fourth"> - <span slot="label"> <b class="el-icon-date"></b>瀹夌伅鐘舵��</span> - <el-empty> - <span slot="description">鏆傛棤鏁版嵁</span> - </el-empty> - </el-tab-pane> - <el-tab-pane name="fifth"> - <span slot="label"> <b class="el-icon-date"></b>宸ヨ壓閰嶆柟</span> - <el-empty> - <span slot="description">鏆傛棤鏁版嵁</span> - </el-empty> </el-tab-pane> </el-tabs> </el-col> @@ -286,17 +321,53 @@ <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 { + clearWorkpieceRelease, + fistSetpNumber, inPlaceInspection, + listFormulaChild, manualNgOffline, + noPageListFormulaChild, + releaseCheck, unfinishedProcess, + 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"; +import { + bindYzSfcFlag, + checkCarCode, checkYzSfcCode, + findBytrolleyYardGetOne, + listProductionOrde, + receivingWorkOrders, + trolleyYardBinDing +} from "@/api/main/om/productionOrde/productionOrde"; import {addPassingStationCollection} from "@/api/main/da/passingStationCollection/passingStationCollection"; -import {addBasicParameters, addParamCollection} from "@/api/main/da/paramCollection/paramCollection"; +import { + addBasicParameters, + addParamCollection, + addTighteningParameters, + saveCampaignTimeParameters, + 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", data() { return { + printInfoData: { + softwareVersion: 'SW001.001', //杞欢鐗堟湰鍙� + hardwareVersion: 'HW001.001', //纭欢鐗堟湰鍙� + printModel: 'H2155D', //鍨嬪彿 + partNumber: '9900200136', //闆堕儴浠跺彿 + supplierCode: '993983', //渚涘簲鍟嗙紪鐮� + }, + carCode: '', + goOnlineFlag: false, + offlineFlag: false, + + serialPortContent: '', // 鏌ヨ鍙傛暟 formulaChildParams: { @@ -304,6 +375,8 @@ pageSize: 10, productCode: null, processesCode: null, + artificialNgFlag: null, + sfcBarcode: null, }, // 閰嶆柟閰嶇疆瀛愪俊鎭〃鏍兼暟鎹� formulaChildList: [], @@ -312,14 +385,16 @@ headContent: { processesCode: 'OP1010', processesName: '璐存爣鏈�-璐寸爜', - sfcCode: '10', + sfcCode: '', + yzSfcCode: '', + cardCode: '', }, workpieceInformation: { workOrderNo: null, productCode: null, productModel: null, productName: null, - beat: null, + inboundTime: null, }, // 鏌ヨ鍙傛暟 queryParams: { @@ -343,7 +418,9 @@ }, content: '', activeName: 'first', - url: "ws://192.168.11.134:8080/websocket/message/", + // 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: "", ws: null, @@ -353,7 +430,7 @@ input: "", keepReading: true, form1: { - baudRate: "9600", + baudRate: "115200", dataBits: "8", stopBits: "1", parity: "none", @@ -371,6 +448,10 @@ title: "", passingStationForm: {}, + originalArray: [], + yzSfcFlag: 1, + endYz: false, + packCode: 'test111' } }, beforeDestroy() { @@ -404,11 +485,167 @@ computed: { isDisable() { return this.btnType === "danger"; - }, + } }, methods: { + + //鎺ユ敹宸ュ崟-------寮�濮� + getWorkOrdersPrint() { + let newStr = document.getElementById('getWorkOrdersPrintPrintMe').innerHTML; + const printFrame = document.createElement('iframe'); + printFrame.style.display = 'none'; + document.body.appendChild(printFrame); + const content = document.getElementById('getWorkOrdersPrintPrintMe').innerHTML; + printFrame.contentDocument.write(content); + printFrame.contentWindow.print(); + document.body.removeChild(printFrame); + return false; + }, + async getWorkOrders(){ + await receivingWorkOrders().then(response => { + this.packCode = response.msg; + this.getWorkOrdersTest1() + }); + setTimeout(() => { + this.getWorkOrdersPrint() + },50) + }, + getWorkOrdersTest1(){ + document.getElementById('canvasWrapper3').innerHTML = '' + this.$nextTick(() => { + let qrCode = new QRCode('canvasWrapper3',{ + width: 80, + height: 80, + padding: 0, + margin: 0, + text: this.packCode, + colorDark: '#000', + colorLight: '#fff' + }) + }) + }, + //鎺ユ敹宸ュ崟-------缁撴潫 + + //涓嬬嚎鎵撳嵃-------寮�濮� + 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(() => { + let qrCode = new QRCode('canvasWrapper1',{ + 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' + }) + } + ) + }, + test2(){ + document.getElementById('canvasWrapper2').innerHTML = ''; + this.$nextTick(() => { + let qrCode = new QRCode('canvasWrapper2',{ + 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' + }) + } + ) + }, + 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() { + // 浣跨敤鎻掍欢鎵撳嵃鏂瑰紡 + // 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){ + // this.$message('缁戝畾鎴愬姛锛�'); + let param = { + productNum: this.headContent.sfcCode, + trolleyYard: scanValue, + } + trolleyYardBinDing(param).then(response => { + }); + + }, 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 + } + const orderParam = { + productNum: this.headContent.sfcCode, + } + replaceAssemblyCode(param).then(response => { + this.$message('缁戝畾鎴愬姛锛�'); + bindYzSfcFlag(orderParam).then(response => { + this.yzSfcFlag = 1 + }); + }); + } }, Release(){ // this.$message('portsList锛�'+this.portsList.length); @@ -419,35 +656,23 @@ this.$message('mei杩炴帴浜嗭紒'); } - - // //鍒ゆ柇鏄惁鍙互閲婃斁 - // let formulaChildParams = { - // productCode: this.workpieceInformation.productCode, - // processesCode: this.headContent.processesCode - // } - // releaseCheck(formulaChildParams).then(response => { - // if(response.data === 0){ - // //鏀瑰彉鐘舵�� - // workpieceRelease(formulaChildParams).then(response => { - // }); - // this.$message('鏀捐鎴愬姛锛�'); - // this.formulaChildList = [] - // this.getListFormulaChild() - // // this.resetting() - // }else { - // this.$message('姝ラ鏈畬鎴愪笉璁告斁琛岋紒'); - // } - // }); }, serialPortMethod(value){ let formulaChildParams = { - materialCode: value, + 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 => { + console.log(response) + if(response.msg === "3"){ + this.cakeLamp.release= 1 //鍏佽鏀捐 + }else if(response.msg === "2"){ + this.$message.error('鎵爜閲嶅璇烽噸鏂版壂鐮侊紒'); + } this.getListFormulaChild() }); }, @@ -461,18 +686,69 @@ }, /** 鏌ヨ閰嶆柟閰嶇疆瀛愪俊鎭垪琛� */ getListFormulaChild() { + // this.formulaChildList = [] this.formulaChildParams.productCode = this.workpieceInformation.productCode this.formulaChildParams.processesCode = this.headContent.processesCode - listFormulaChild(this.formulaChildParams).then(response => { + if(this.formulaChildParams.artificialNgFlag !== null){ + this.formulaChildParams.sfcBarcode = this.headContent.sfcCode + } + console.log("getListFormulaChild"+this.formulaChildParams.artificialNgFlag) + noPageListFormulaChild(this.formulaChildParams).then(response => { this.formulaChildList = response.rows; + if (this.formulaChildList.length >0){ + let pos = 0 + const tempArr = this.formulaChildList.filter(x=> 'OK' === x.results) + if (tempArr.length>0){ + pos = tempArr.length + this.$nextTick(() => { + let temp33 = document.getElementsByClassName('el-table__row') + console.log('temp33',temp33) + console.log('len',temp33.item(pos)) + if (temp33.length > 0){ + console.log('1111111111111111') + let arr = temp33[pos-1] + console.log('srr',arr) + arr.scrollIntoView({ block: 'center' }) + } + }) + } + + } + }); + }, + endClear(){ + this.cakeLamp.InPlace= 0 //宸ヤ欢鍒颁綅 + this.cakeLamp.scanFinish= 0 + this.cakeLamp.startWork= 0 + this.cakeLamp.release= 0 //鍏佽鏀捐 + + this.formulaChildList = [] + this.workpieceInformation.productCode = null; + this.workpieceInformation.workOrderNo = null; + this.workpieceInformation.productModel = null; + this.workpieceInformation.productName = null; + this.workpieceInformation.inboundTime = null; + this.headContent.sfcCode = ''; + this.headContent.yzSfcCode = ''; + this.headContent.cardCode = ''; + this.formulaChildParams.artificialNgFlag = null + this.formulaChildParams.sfcBarcode = null }, changeMenu(tab, event) { console.log(tab, event); }, clearClick(){ - this.$message('杩欐槸涓�鏉℃竻闄ゆ秷鎭彁绀�'); - this.headContent.sfcCode = null + const param = { + workOrderNo: this.workpieceInformation.workOrderNo, + productCode: this.workpieceInformation.productCode, + locationCode: this.headContent.processesCode, + productBarcode: this.headContent.sfcCode, + } + this.endClear() + clearWorkpieceRelease(param).then(response => {}); + this.headContent.sfcCode = '' + this.$message('娓呴櫎鎴愬姛锛�'); }, scanCompleted(){ this.$message('鎵爜瀹屾垚'+this.content); @@ -486,6 +762,7 @@ }, /** 鏌ヨ宸ュ崟鍒楄〃 */ async getList() { + this.initializePrintInfoData() await listProductionOrde(this.queryParams).then(response => { let rowsData = response.rows[0]; console.log(rowsData) @@ -493,12 +770,42 @@ this.workpieceInformation.productCode = rowsData.productCode; this.workpieceInformation.productModel = rowsData.productModel; this.workpieceInformation.productName = rowsData.productName; - this.timer = setInterval(() => { - this.workpieceInformation.beat++; - }, 1000); + this.headContent.cardCode = rowsData.trolleyYard; + this.formulaChildParams.artificialNgFlag = rowsData.artificialNgFlag; }); + if(this.headContent.processesCode === 'POP430'){ + this.test1() + this.test2() + this.test4() + this.test5() + } this.getListFormulaChild() - this.addOverStationCollection() + // this.addOverStationCollection() + this.workpieceInformation.inboundTime = this.getCurrentTime() + const param = { + processesCode: this.headContent.processesCode, + productCode: this.workpieceInformation.productCode + } + fistSetpNumber(param).then(response => { + console.log("fistSetpNumber------"+response.msg) + }); + }, + + 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'); + }, + addBaseData(){ + addBasicParameters(this.passingStationForm).then(response => {}); }, /** 鍏ョ珯澧炲姞杩囩珯閲囬泦璁板綍 **/ @@ -510,54 +817,12 @@ locationCode: this.headContent.processesCode, model: this.workpieceInformation.productModel, productBarcode: this.headContent.sfcCode, + sfcCode: this.headContent.sfcCode, inboundTime: new Date() } - addPassingStationCollection(this.passingStationForm).then(response => { - }); - addBasicParameters(this.passingStationForm).then(response => { - }); + addPassingStationCollection(this.passingStationForm).then(response => {}); + // addBasicParameters(this.passingStationForm).then(response => {}); }, - allowRelease(){ - clearInterval(this.timer); - this.$message('淇濆瓨鑺傛媿涓�'+this.workpieceInformation.beat+'绉�'); - }, - /** 鏌ヨ宸ヤ綅缁堢閰嶇疆鍒楄〃 */ - // async getStationConfList() { - // await getIpv4().then(response => { - // this.StationConfQueryParams.ipAddress = response.msg - // console.log('鏌ヨ鍒版湰宸ヤ綅IP涓�'+this.StationConfQueryParams.ipAddress) - // }); - // listStationConf(this.StationConfQueryParams).then(response => { - // let rows = response.rows[0] - // if(response.rows.length===0){ - // this.$message('璇ュ伐浣嶆病鏈夐厤缃甀P锛岃鑱旂郴绠$悊鍛橀厤缃甀P'); - // return - // } - // this.headContent.processesName = rows.processesName - // this.headContent.processesCode = rows.processesCode - // console.log('璁剧疆宸ヤ綅缂栫爜'+this.headContent.processesCode) - // - // }); - // }, - // connectWebsocket() { - // console.log('websocket杩炴帴宸ヤ綅涓�'+this.headContent.processesCode) - // const wsuri = this.url + this.headContent.processesCode; - // this.ws = new WebSocket(wsuri); - // const self = this; - // this.ws.onopen = function (event) { - // // self.text_content = self.text_content + "宸茬粡鎵撳紑杩炴帴!" + "\n"; - // this.$message('websocket杩炴帴鎴愬姛锛�'); - // }; - // this.ws.onmessage = function (event) { - // self.text_content = event.data + "\n"; - // console.log(event.data) - // if(event.data === "IN"){ - // self.cakeLamp.InPlace = "1" - // }else if(event.data === "OUT"){ - // self.cakeLamp.outRsSign = "1" - // } - // }; - // }, exit() { if (this.ws) { this.ws.close(); @@ -571,79 +836,217 @@ alert("鏈繛鎺ュ埌鏈嶅姟鍣�"); } }, - async initStation(){ + + initStation: async function () { await getIpv4().then(response => { this.StationConfQueryParams.ipAddress = response.msg - console.log('鏌ヨ鍒版湰宸ヤ綅IP涓�'+this.StationConfQueryParams.ipAddress) + console.log('鏌ヨ鍒版湰宸ヤ綅IP涓�' + this.StationConfQueryParams.ipAddress) }); await listStationConf(this.StationConfQueryParams).then(response => { let rows = response.rows[0] - if(response.rows.length===0){ + if (response.rows.length === 0) { this.$message('璇ュ伐浣嶆病鏈夐厤缃甀P锛岃鑱旂郴绠$悊鍛橀厤缃甀P'); return } this.headContent.processesName = rows.processesName this.headContent.processesCode = rows.processesCode - console.log('璁剧疆宸ヤ綅缂栫爜'+this.headContent.processesCode) + console.log('璁剧疆宸ヤ綅缂栫爜' + this.headContent.processesCode) + inPlaceInspection({processesCode: this.headContent.processesCode}).then(response => { + console.log(response) + this.cakeLamp.InPlace = response.data + }); + + if(this.headContent.processesCode === 'POP230'){ + this.goOnlineFlag = true + } + if(this.headContent.processesCode === 'POP430'){ + this.offlineFlag = true + } }); - console.log('websocket杩炴帴宸ヤ綅涓�'+this.headContent.processesCode) + this.conCom() + console.log('websocket杩炴帴宸ヤ綅涓�' + this.headContent.processesCode) const wsuri = this.url + this.headContent.processesCode; this.ws = new WebSocket(wsuri); const self = this; this.ws.onopen = function (event) { - this.$message('websocket杩炴帴鎴愬姛锛�'); + self.$message('websocket杩炴帴鎴愬姛锛�'); + }; this.ws.onmessage = function (event) { - const DELAY_TIME = 2000; - switch (event.data) { - case "IN": - self.cakeLamp.InPlace = 1; - break; - case "IN0": - self.cakeLamp.InPlace = 0; - break; - case "OUT": - self.cakeLamp.release = 1; - setTimeout(() => { - self.cakeLamp.InPlace = 0; - self.cakeLamp.release = 0; - self.cakeLamp.startWork = 0; - self.cakeLamp.scanFinish = 0; - self.Release(); - }, DELAY_TIME); - break; - case "TIGHTEN": - this.formulaChildList = []; - self.getListFormulaChild(); - break; - default: - break; + 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") { + //缁檖lc鍙戜笅绾夸俊鍙� + //娓呴櫎鏁版嵁 + self.$confirm('鎷х揣涓夋NG锛岃纭涓嬬嚎锛侊紒锛�', '娑堟伅', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + showCancelButton: false, + type: 'warning' + }).then(() => { + self.ngFunction(); + this.$message({ + type: 'success', + message: '纭鎴愬姛!' + }); + }); + + } else if (event.data === "OUT") { + self.cakeLamp.release = 1; + } else if (event.data === "END") { + + const formulaChildIndex = self.formulaChildList.length-1 + + if(self.headContent.sfcCode=== ''||self.headContent.sfcCode=== null){ + unfinishedProcess({processesCode: self.headContent.processesCode,recordDataDone: 26}).then(response => {}); + self.$message('鎬绘垚鐮佷负绌猴紝璇锋壂鐮侊紒') + return; + } + + if(self.formulaChildList[formulaChildIndex].results !== 'OK'){ + self.$message('鏈仛瀹屽伐搴忕姝㈡斁琛�'); + unfinishedProcess({processesCode: self.headContent.processesCode,recordDataDone: 25}).then(response => {}); + return; + } + + const param = { + workOrderNo: self.workpieceInformation.workOrderNo, + productCode: self.workpieceInformation.productCode, + locationCode: self.headContent.processesCode, + productBarcode: self.headContent.sfcCode, + inboundTime: self.workpieceInformation.inboundTime, + formulaChildEntity: self.formulaChildList[formulaChildIndex] + } + + console.log("杩涘叆鏈�缁堟柟娉�") + self.endSaveData(param) + } else if (event.data.includes("[")) { + let formulaChilds = ""; + self.formulaChildList.sort((a, b) => a.stepSort - b.stepSort); + self.formulaChildList + .filter((formulaChild) => formulaChild.operationType === '1'); + for (let i = 0; i < self.formulaChildList.length; i++) { + let formulaChild = self.formulaChildList[i]; + let results = formulaChild.results; + + if (results === '' || results === null || results === 'NG') { + formulaChilds = formulaChild; + break; + } + } + if(formulaChilds === ""){ + self.$message.error('鏈伐浣嶅凡宸ヤ綔瀹屾垚锛�'); + return; + } + const param = { + id: formulaChilds.id, + tightenTheArray: event.data, + paramCode: formulaChilds.paramCode, + workOrderNo: self.workpieceInformation.workOrderNo, + productCode: self.workpieceInformation.productCode, + locationCode: self.headContent.processesCode, + productBarcode: self.headContent.sfcCode, + spareField1: formulaChilds.spareField1, + spareField2: formulaChilds.spareField2, + spareField3: formulaChilds.spareField3, + spareField4: formulaChilds.spareField4, + stepSort: formulaChilds.stepSort, + ngTimes: formulaChilds.ngTimes, + } + if(formulaChilds.paramCode === null||formulaChilds.paramCode ===''){ + self.$message('鏈壘鍒板弬鏁扮爜锛岃妫�鏌ュ弬鏁扮爜鏄惁姝g‘'); + return; + } + self.formulaChildParams.artificialNgFlag = null + console.log("self.formulaChildParams.artificialNgFlag"+self.formulaChildParams.artificialNgFlag) + if(self.headContent.sfcCode!==null||self.headContent.sfcCode!==''){ + updateTighteningFormula(param).then(response => { + //addTighteningParameters(param).then(response => {}); + self.getListFormulaChild() + }).catch(error =>{ + self.getListFormulaChild() + }); + } } }; }, + endSaveData(param){ + saveCampaignTimeParameters(param).then(response => { + this.cakeLamp.release = 1; + this.endClear() + workpieceRelease(param).then(response => {}); + }); + }, + + ngFunction(){ + const param = { + locationCode: this.headContent.processesCode, + sfcBarcode: this.headContent.sfcCode, + productCode: this.workpieceInformation.productCode, + } + manualNgOffline(param).then(response => {}); + clearWorkpieceRelease(param).then(releaseCheck =>{}); + this.endClear() + }, //鎺ュ彈鏁版嵁鐨勫洖璋� callBack(value) { if (this.form1.isShowHistory) this.form1.desc = this.readLi().join(""); else { const scanValue = this.myserialport.hex2atostr(value).replace(/[\r\n]/g, ''); - // if (value.length > 0) - // this.form1.desc = this.myserialport.hex2atostr(value); - this.$message('鎵爜瀹屾垚'+this.content); - if (/T/.test(scanValue)) { - console.log('瀛楃涓插寘鍚瓧姣�"T"'); - this.serialPortMethod(scanValue) + console.log("涓插彛鏀跺埌鏁版嵁-------------------"+scanValue) + console.log("sfc=--"+this.headContent.sfcCode+"--") + if(this.headContent.sfcCode !== '' && this.headContent.sfcCode !== null + && this.headContent.sfcCode !== undefined){ + if(scanValue.includes("0RSP1TE") && this.headContent.processesCode === 'POP230'){ + this.headContent.cardCode = scanValue + this.bindcardCode(scanValue); + this.serialPortMethod(scanValue) + }else { + this.$message('宸ヤ綅缁堢鎵弿鐗╂枡缂栫爜'+scanValue); + console.log(scanValue) + this.serialPortMethod(scanValue) + } } else { - console.log('瀛楃涓蹭笉鍖呭惈瀛楁瘝"T"'); - this.headContent.sfcCode = scanValue; - this.queryParams.sfcCode = scanValue; - this.getList() - // this.getListFormulaChild() - this.cakeLamp.scanFinish = 1 - this.cakeLamp.startWork = 1 + if(this.headContent.processesCode === 'POP230'){ + this.headContent.sfcCode = scanValue; + this.queryParams.productNum = scanValue; + this.getList() + this.cakeLamp.scanFinish = 1 + this.cakeLamp.startWork = 1 + }else { + let param = { + trolleyYard: scanValue + } + findBytrolleyYardGetOne(param).then(response => { + if(response.msg !== '2'){ + this.headContent.sfcCode = response.msg; + this.queryParams.productNum = response.msg; + this.$message('鎵爜璇嗗埆浜у搧搴忓垪鍙�'+scanValue); + // this.headContent.sfcCode = scanValue; + // this.queryParams.productNum = scanValue; + this.getList() + this.cakeLamp.scanFinish = 1 + this.cakeLamp.startWork = 1 + }else { + this.$message('娌℃湁搴忓垪鍙�'+scanValue); + return + } + }); + } + } + } }, clearHistory() { @@ -692,6 +1095,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("涓插彛杩炴帴澶辫触锛佽妫�鏌ヤ覆鍙f槸鍚﹀凡琚崰鐢�"); + } + if (this.myserialport.state.isOpen) { + this.$message.success("涓插彛杩炴帴鎴愬姛"); + } + }, //杩炴帴 async connectBtn() { if (this.btnType === "primary") { @@ -702,6 +1121,7 @@ this.myserialport.state.parity = this.form1.parity; this.myserialport.state.flowControl = this.form1.flowControl; await this.myserialport.openPort(this.form1.port, true, this.callBack); + console.log(this.form1.port) } catch (error) { this.$message.error("涓插彛杩炴帴澶辫触锛佽妫�鏌ヤ覆鍙f槸鍚﹀凡琚崰鐢�"); } -- Gitblit v1.9.3