From 2c65c31aceb16c1d06c692266e3fb555ecafdfb5 Mon Sep 17 00:00:00 2001 From: wujian <14790700720@163.com> Date: 星期三, 23 十月 2024 09:10:47 +0800 Subject: [PATCH] change-4 --- jcdm-ui/src/views/main/cfkb/connectingRodUp/index.vue | 319 ++++++++++++++++++++++++++++++++--------------------- 1 files changed, 192 insertions(+), 127 deletions(-) diff --git a/jcdm-ui/src/views/main/cfkb/connectingRodUp/index.vue b/jcdm-ui/src/views/main/cfkb/connectingRodUp/index.vue index 6961117..03ecb28 100644 --- a/jcdm-ui/src/views/main/cfkb/connectingRodUp/index.vue +++ b/jcdm-ui/src/views/main/cfkb/connectingRodUp/index.vue @@ -8,38 +8,29 @@ </div> </template> </el-card> - <el-row :gutter="3"> - <el-col :span="6"> - <el-card shadow="always" class="boxSize"> - <div class="centerImg"> - <img style="width: 140px;height: 30px;" src="@/assets/logo/jcdm2.png" alt="dark"> - </div> - - </el-card> - </el-col> - <el-col :span="3"> - <el-card shadow="always" class="boxSize"> - <span class="centerText" style="height: 60px">{{locationCode}}</span> - </el-card> - </el-col> - <el-col :span="15"> - <el-card shadow="always" class="boxSize"> - <span class="centerText" >{{locationName}}</span> - </el-card> - </el-col> - </el-row> - <el-card class="box-card" > - <el-form :model="from" size="large" :inline="true" label-width="68px" @submit.native.prevent> - <el-form-item label-width="200" label="娲诲杩炴潌鎵樼洏鐮�" :prop="from.scanObject2" style="align-content: center"> - <input v-model="from.scanObject2" - ref="inputdata" - style="height: 39px; width: 300px" - placeholder="璇疯緭鍏ユ椿濉炶繛鏉嗘墭鐩樼爜" - /> - </el-form-item> -<!-- <el-button type="primary" icon="el-icon-refresh" @click="handleQuery">鏌ヨ</el-button>--> - </el-form> - </el-card> +<!-- <el-card class="query-card" >--> +<!-- <el-form :model="from" size="large" :inline="true" label-width="78px" @submit.native.prevent>--> +<!-- <el-form-item label-width="200" label="杩炴潌鐮�" :prop="from.connectCode" style="align-content: center">--> +<!-- <input v-model="from.connectCode"--> +<!-- ref="inputdata1"--> +<!-- style="height: 39px; width: 300px"--> +<!-- placeholder="璇锋壂鎻忚繛鏉嗙爜"--> +<!-- />--> +<!-- </el-form-item>--> +<!-- </el-form>--> +<!-- </el-card>--> + <!-- <el-card class="box-card" >--> + <!-- <el-form :model="from" size="large" :inline="true" label-width="68px" @submit.native.prevent>--> + <!-- <el-form-item label-width="200" label="娲诲杩炴潌鎵樼洏鐮�" :prop="from.scanObject2" style="align-content: center">--> + <!-- <input v-model="from.scanObject2"--> + <!-- ref="inputdata"--> + <!-- style="height: 39px; width: 300px"--> + <!-- placeholder="璇疯緭鍏ユ椿濉炶繛鏉嗘墭鐩樼爜"--> + <!-- />--> + <!-- </el-form-item>--> + <!--<!– <el-button type="primary" icon="el-icon-refresh" @click="handleQuery">鏌ヨ</el-button>–>--> + <!-- </el-form>--> + <!-- </el-card>--> <el-col :span="24" > <el-card class="bottom-card"> <div slot="header" class="clearfix"> @@ -50,10 +41,10 @@ <el-descriptions-item label="鏈哄瀷"> <span>{{queryParams.productSeries}}</span> </el-descriptions-item> - <el-descriptions-item label="绠变綋鐮�"> + <el-descriptions-item label="绠变綋瀵瑰簲SN鐮�"> <span>{{queryParams.scanObject1}}</span> </el-descriptions-item> - <el-descriptions-item label="鏇茶酱鐮�"> + <el-descriptions-item label="鏇茶酱瀵瑰簲SN鐮�"> <span>{{queryParams.scanObject2}}</span> </el-descriptions-item> <el-descriptions-item label="缁撴灉"> @@ -70,7 +61,11 @@ import VueQr from 'vue-qr' import { listTileMatchRules, getTileMatchRules, delTileMatchRules, addTileMatchRules, updateTileMatchRules } from "@/api/main/bs/tileMatchRules/tileMatchRules"; import {listStationConf,getIp} from "@/api/main/sc/stationConf"; -import {setBarcodeup} from "@/api/main/da/tileMatchMiddleware/tileMatchMiddleware"; +import {setBarcodeup, outSign, getDetailData} from "@/api/main/da/tileMatchMiddleware/tileMatchMiddleware"; +import {getUrl} from "@/api/main/bs/orderScheduling/orderScheduling"; +import WebSocketReconnect from "@/utils/WebsocketTool"; +import result from "../../../../components/Crontab/result.vue"; +import {getSfcCodeByConnectCode} from "../../../../api/main/da/tileMatchMiddleware/tileMatchMiddleware"; export default { name: "index", dicts: ['colour_hex','productseries','axisname','neckname','tilename'], @@ -87,6 +82,7 @@ qrCode: '', // 鏌ヨ鍙傛暟 from:{ + connectCode:'', pageNum: 1, pageSize: 10, productSeries: null, @@ -130,59 +126,147 @@ } }, mounted() { - this.setFocus() + // this.setFocus1() + // this.$refs.inputdata1.addEventListener('keydown',this.handleScannerInput1) this.getStationConf() - //this.getNowTime() - this.$refs.inputdata.addEventListener('keydown',this.handleScannerInput) + this.getWebUrl() + this.getDetailMessage() }, - beforeDestroy() { - this.$refs.inputdata.removeEventListener('keydown',this.handleScannerInput) - }, + // beforeDestroy() { + // this.$refs.inputdata1.removeEventListener('keydown',this.handleScannerInput1) + // }, methods:{ - refresh() { - location.reload(); - }, - setFocus(){ - this.$nextTick(()=>{ - this.$refs.inputdata.focus() + // setFocus1(){ + // this.$nextTick(()=>{ + // this.$refs.inputdata1.focus() + // }) + // }, + // handleScannerInput1(event) { + // if (this.scannerFlag) { + // this.$refs.inputdata1.value = '' + // this.scannerFlag = false + // } + // const input = event.target + // const inputValue = input.value + // this.from.connectCode = inputValue + // if (event.key === 'Enter') { + // this.scannerFlag = true + // //鎵弿瀹屾垚 + // console.log('sssss', this.from.connectCode) + // getSfcCodeByConnectCode({connectCode:this.from.connectCode}).then(res => { + // console.log('res',res) + // if (res.code === 200){ + // this.queryParams.scanObject2 = res.data.sfcCode + // + // if (this.queryParams.scanObject1 !== null && this.queryParams.scanObject1 !== '' + // && this.queryParams.scanObject2 !== null && this.queryParams.scanObject2 !== ''){ + // if (this.queryParams.scanObject1 === this.queryParams.scanObject2){ + // this.queryParams.words = "閰嶅鎴愬姛" + // this.queryParams.tileColor = "#3dcc1d" + // //璇锋眰鍑虹珯 + // // this.passStation() + // }else { + // this.queryParams.words = "閰嶅澶辫触" + // this.queryParams.tileColor = "#f50909" + // } + // } + // this.$message({ + // message: '鏌ヨ鎴愬姛', + // type: 'success' + // }); + // } else { + // this.$message({ + // message: '鏌ヨ澶辫触', + // type: 'error' + // }); + // } + // }) + // } + // }, + getWebUrl(){ + getUrl().then(res=>{ + this.websocketUrl = res+"OP050" + console.log('websocketUrl锛�',this.websocketUrl) + this.initWebSocket() }) }, - handleScannerInput(event){ - if (this.scannerFlag){ - this.from.scanObject2 = '' - this.$refs.inputdata.value = '' - this.scannerFlag = false - } - const input = event.target - const inputValue = input.value - this.from.scanObject2 = inputValue - if (event.key === 'Enter'){ - this.scannerFlag = true - //鎵弿瀹屾垚 - if (typeof this.from.scanObject2 !== 'undefined'&& typeof this.locationCode !== 'undefined' ) { - setBarcodeup({barcode:this.from.scanObject2,locationCode:this.locationCode}).then(res => { - if (res===''){ - this.$message({ - message:res.msg, - type:'warning' - }) - }else { - this.$message({ - message:'鎿嶄綔鎴愬姛', - type:'success' - }) - console.log('杩斿洖锛�',res) - this.queryParams.productSeries=res.sfcCode; - this.queryParams.scanObject1=res.connectingRodNo; - this.queryParams.scanObject2=res.PalletNo; - this.queryParams.words="鎵爜鎴愬姛"; - this.queryParams.tileColor='#00FF00'; + initWebSocket: function (){ + //鍒ゆ柇褰撳墠娴忚鍣ㄦ槸鍚︽敮鎸乄ebSocket + if ('WebSocket' in window) { + //杩炴帴WebSocket鑺傜偣 + this.websocket = new WebSocketReconnect(this.websocketUrl); + //鎺ユ敹鍒版秷鎭殑鍥炶皟鏂规硶 + this.websocket.socket.onmessage = (event) => { + let data = event.data; + if (data != null && data !== ''){ + this.result = JSON.parse(data); + const resultMessage = this.result.server_message.split("*"); + console.log('resultMessage',resultMessage) + if (resultMessage.length >=2){ + if (resultMessage[1] === "sfcCode"){ + this.queryParams.scanObject1 = resultMessage[0] + this.queryParams.productSeries = resultMessage[2] + this.queryParams.scanObject2 = resultMessage[3] + } else if (resultMessage[1] === "rodCode"){ + this.queryParams.scanObject2 = resultMessage[0] + this.queryParams.productSeries = resultMessage[2] + } else if (resultMessage[1] === "clean"){ + this.queryParams.productSeries = '' + this.queryParams.scanObject1 = "" + this.queryParams.scanObject2 = "" + this.queryParams.words = "" + this.queryParams.tileColor = "" + } } - }) + if (this.queryParams.scanObject1 !== null && this.queryParams.scanObject1 !== '' + && this.queryParams.scanObject2 !== null && this.queryParams.scanObject2 !== ''){ + if (this.queryParams.scanObject1 === this.queryParams.scanObject2){ + this.queryParams.words = "閰嶅鎴愬姛" + this.queryParams.tileColor = "#3dcc1d" + //璇锋眰鍑虹珯 + // this.passStation() + }else { + this.queryParams.words = "閰嶅澶辫触" + this.queryParams.tileColor = "#f50909" + } + } + + + // const parts3 = this.result.server_message.split("*"); + // if (parts3.length >= 2) { + // this.from.scanObject2=parts3[0]; + // this.queryParams.words=parts3[1]; + // this.queryParams.tileColor= parts3[2]; + // this.handleQuery(); + // } + } } + //鐩戝惉绐楀彛鍏抽棴浜嬩欢锛屽綋绐楀彛鍏抽棴鏃讹紝涓诲姩鍘诲叧闂瓀ebsocket杩炴帴锛岄槻姝㈣繛鎺ヨ繕娌℃柇寮�灏卞叧闂獥鍙o紝server绔細鎶涘紓甯搞�� + window.onbeforeunload = function () { + this.websocket.close() + } + //鍏抽棴杩炴帴 + function closeWebSocket() { + this.websocket.close() + } + //鍙戦�佹秷鎭� + function send() { + this.websocket.socket.send({ kk: 123 }) + } + } else { + alert('娴忚鍣ㄤ笉鏀寔webSocket') } }, - + //鍒锋柊鑾峰彇淇℃伅 + getDetailMessage(){ + getDetailData().then(res => { + if (res.data == 200){ + console.log('res200',res) + this.queryParams.scanObject1 = res.SfcCode + this.queryParams.productSeries = res.productSeries + } + }) + }, /** 鏌ヨ宸ヤ綅缁堢閰嶇疆鍒楄〃 */ getStationConf() { getIp().then(response => { @@ -195,35 +279,33 @@ }); }); }, + passStation(){ + outSign().then(res =>{ + console.log("res",res) + if (res.code === 200){ + console.log('1212121') + this.$message({ + message: '鍖归厤鎴愬姛锛屽凡杩囩珯', + type: 'success', + duration:3000 + }); + this.queryParams.productSeries = '' + this.queryParams.scanObject1 = '' + this.queryParams.scanObject2 = '' + this.queryParams.words = '' + this.queryParams.tileColor = '' + + } + }) + }, /** 鎼滅储鎸夐挳鎿嶄綔 */ handleQuery() { this.clear(); - if(this.from.scanObject1 !== null && this.from.scanObject2 !== null - && this.from.axisName !== null && this.from.axisName !== "" - && this.from.neckName !== null && this.from.neckName !== "" - && this.from.tileName !== null && this.from.tileName !== "" - && this.from.productSeries !== null && this.from.productSeries !== "") + if(this.from.scanObject2 !== null) { - this.axisValueextracted(); - this.neckValueextracted(); - if(this.queryParams.axisValue !== null && this.queryParams.neckValue !== null){ - this.insetFromToQueryParams(); - this.getList(); - } - else{ - const h = this.$createElement; - this.$message({ - message: h('p',null, [ - h('span', null, '璀﹀憡 '), - h('i', { style: 'color: black' }, '绠变綋鐮佹垨鏇茶酱鐮佽緭鍏ユ湁璇�'), - h()]), - type: 'error', - center: true, - offset:300 - }); - } - } - else{ + this.insetFromToQueryParams(); + //this.getList(); + } else{ const h = this.$createElement; this.$message({ message: h('p',null, [ @@ -236,26 +318,12 @@ }); } }, - - // 鍙栫浣撶爜绗笁娈典负閰嶇摝鍊� - axisValueextracted() { - const parts1 = this.from.scanObject1.split(";"); - if (parts1.length >= 3) { - //const axisValueextracted = parts1[2].substring(3,4); - const axisValueextracted = parts1[2]; - return this.queryParams.axisValue= axisValueextracted; - - } - }, - - //鍙栨洸杞寸爜绗笁娈典负閰嶇摝鍊� - neckValueextracted() { - const parts2 = this.from.scanObject2.split(";"); - if (parts2.length >= 3) { - //const neckValueextracted = parts2[2].substring(3,4); - const neckValueextracted = parts2[2]; - return this.queryParams.neckValue= neckValueextracted; - } + cleanForm(){ + this.queryParams.productSeries = "" + this.queryParams.scanObject1 = "" + this.queryParams.scanObject2 = "" + this.queryParams.words = "" + this.queryParams.tileColor = "" }, //鍙栭厤鐡﹂鑹� getList() { @@ -278,10 +346,7 @@ }, insetFromToQueryParams(){ this.queryParams.productSeries=this.from.productSeries; - this.queryParams.axisName=this.from.axisName; - this.queryParams.neckName=this.from.neckName; this.queryParams.tileName=this.from.tileName; - this.queryParams.scanObject1=this.from.scanObject1; this.queryParams.scanObject2=this.from.scanObject2; } -- Gitblit v1.9.3