From 0b14225915932f0f5c88bc3e44302bf1c309de1a Mon Sep 17 00:00:00 2001 From: yyt <306727702@qq.com> Date: 星期一, 19 二月 2024 04:23:38 +0800 Subject: [PATCH] CVT看板介面,新增SNCode写入功能,扫码功能更新. --- jcdm-ui/src/views/main/kb/cvt/index.vue | 50 +++++++++++++++- jcdm-main/src/main/java/com/jcdm/main/da/opcuaconfig/controller/DaOpcuaConfigController.java | 19 ++++++ jcdm-ui/src/api/main/da/opcuaconfig/opcuaconfig.js | 8 ++ jcdm-ui/src/views/main/kb/cvt/cs.vue | 83 +++++++++++++++++++++++++++ 4 files changed, 156 insertions(+), 4 deletions(-) diff --git a/jcdm-main/src/main/java/com/jcdm/main/da/opcuaconfig/controller/DaOpcuaConfigController.java b/jcdm-main/src/main/java/com/jcdm/main/da/opcuaconfig/controller/DaOpcuaConfigController.java index 98a9bce..23d2e95 100644 --- a/jcdm-main/src/main/java/com/jcdm/main/da/opcuaconfig/controller/DaOpcuaConfigController.java +++ b/jcdm-main/src/main/java/com/jcdm/main/da/opcuaconfig/controller/DaOpcuaConfigController.java @@ -3,7 +3,9 @@ import java.util.List; import javax.servlet.http.HttpServletResponse; +import com.jcdm.main.da.opcuaconfig.client.ClientHandler; import com.jcdm.main.da.opcuaconfig.domain.DaOpcuaConfig; +import com.jcdm.main.da.opcuaconfig.domain.NodeEntity; import com.jcdm.main.da.opcuaconfig.service.IDaOpcuaConfigService; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; @@ -102,4 +104,21 @@ { return toAjax(daOpcuaConfigService.deleteDaOpcuaConfigByIds(ids)); } + + /** + * 鑾峰彇浜や簰淇″彿閰嶇疆璇︾粏淇℃伅 + */ + @PreAuthorize("@ss.hasPermi('da:opcuaconfig:query')") + @GetMapping(value = "/SNCode/{SNCode}/{locationCode}") + public AjaxResult setSNCode(@PathVariable("SNCode") String SNCode,@PathVariable("locationCode") String locationCode) { + NodeEntity node= NodeEntity.builder().index(2).identifier("CFL4CVT"+"."+locationCode+".SNCode").value(SNCode).type("string").build(); + Boolean out= null; + try { + out = ClientHandler.write(node); + } catch (Exception e) { + throw new RuntimeException(e); + } + + return toAjax(out); + } } diff --git a/jcdm-ui/src/api/main/da/opcuaconfig/opcuaconfig.js b/jcdm-ui/src/api/main/da/opcuaconfig/opcuaconfig.js index ffa9dab..548cecc 100644 --- a/jcdm-ui/src/api/main/da/opcuaconfig/opcuaconfig.js +++ b/jcdm-ui/src/api/main/da/opcuaconfig/opcuaconfig.js @@ -17,6 +17,14 @@ }) } +// 鏌ヨ浜や簰淇″彿閰嶇疆璇︾粏 +export function setSNCode(SNCode,locationCode) { + return request({ + url: '/da/opcuaconfig/SNCode/' + SNCode+'/'+locationCode, + method: 'get' + }) +} + // 鏂板浜や簰淇″彿閰嶇疆 export function addOpcuaconfig(data) { return request({ diff --git a/jcdm-ui/src/views/main/kb/cvt/cs.vue b/jcdm-ui/src/views/main/kb/cvt/cs.vue new file mode 100644 index 0000000..9e98dd8 --- /dev/null +++ b/jcdm-ui/src/views/main/kb/cvt/cs.vue @@ -0,0 +1,83 @@ +<template> + <el-input + 慰nkeyup="this.value=this.value.replace(/\D|/g,'')" + clearable + maxlength="116" + v-model="codeValue" + placeholder="璇疯緭鍏ユ潯褰㈢爜" + /> +</template> +<script> +export default { + data(){ + return { + codeValue: "", + code: "", + lastTime: "", + nextTime: "", + lastCode: "", + nextCode: "", + dtmainId: "", + }; + }, + created() { + window.document.onkeypress = (e) => { + if (window.event) { + // IE + this.nextCode = e.keyCode; + } else if (e.which) { + // Netscape/Firefox/Opera + this.nextCode = e.which; + } + if (e.which === 13) { + // 閿洏鍥炶溅浜嬩欢 + if (this.code.length < 3) return; // 鎵爜鏋殑閫熷害寰堝揩锛屾墜鍔ㄨ緭鍏ョ殑鏃堕棿涓嶄細璁ヽode鐨勯暱搴﹀ぇ浜�2锛屾墍浠ヨ繖閲屼笉浼氬鎵爜鏋湁鏁� + + //console.log("鎵爜缁撴潫銆�"); + //console.log("鏉″舰鐮侊細", this.code); + this.parseQRCode(this.code); // 鑾峰彇鍒版壂鐮佹灙杈撳叆鐨勫唴瀹癸紝鍋氬埆鐨勬搷浣� + this.lastCode = ""; + this.lastTime = ""; + return; + } + this.nextTime = new Date().getTime(); + if (!this.lastTime && !this.lastCode) { + this.code = ""; // 娓呯┖涓婃鐨勬潯褰㈢爜 + this.code += e.key; + //console.log("鎵爜寮�濮�---", this.code); + } + if (this.lastCode && this.lastTime && this.nextTime - this.lastTime > 500) { + // 褰撴壂鐮佸墠鏈塳eypress浜嬩欢鏃�,闃叉棣栧瓧缂哄け + this.code = e.key; + //console.log("闃叉棣栧瓧缂哄け銆傘�傘��", this.code); + } else if (this.lastCode && this.lastTime) { + this.code += e.key; + //console.log("鎵爜涓�傘�傘��", this.code); + } + this.lastCode = this.nextCode; + this.lastTime = this.nextTime; + }; + }, + methods: { + parseQRCode(code) { + // if (code.length === 16) { + // console.log(code); + // } else if (code.length === 0) { + // console.log("璇疯緭鍏ユ潯鐮侊紒"); + // } else { + // alert("鏉$爜涓嶅悎娉曪細" + code); + // } + this.codeValue = code; + // 鍙戦�佺綉缁滆姹� + }, + }, +} +</script> +<style scoped lang="scss"> + +</style> + + + + + diff --git a/jcdm-ui/src/views/main/kb/cvt/index.vue b/jcdm-ui/src/views/main/kb/cvt/index.vue index fe2341d..af3c07e 100644 --- a/jcdm-ui/src/views/main/kb/cvt/index.vue +++ b/jcdm-ui/src/views/main/kb/cvt/index.vue @@ -27,7 +27,7 @@ <el-form ref="form" :model="form" label-width="25%" > <el-form-item prop="engineNo" style="margin-top: 16px"> <span slot="label" style="font-size:22px;color:black;"><strong>鍙戝姩鏈哄彿</strong></span> - <el-input style="font-size:20px" v-model="form.engineNo" placeholder="璇疯緭鍏ュ彂鍔ㄦ満鍙�" clearable @keyup.enter.native="EngineNohandleChange"> + <el-input style="font-size:20px" v-model="form.engineNo" placeholder="璇疯緭鍏ュ彂鍔ㄦ満鍙�" clearable @input="EngineNohandleChange"> <el-button slot="append" plain type="info" @click="EngineNohandleChange" icon="el-icon-search"></el-button> </el-input> </el-form-item> @@ -80,6 +80,7 @@ import { listOrderScheduling, getOrderScheduling, delOrderScheduling, addOrderScheduling, updateOrderScheduling } from "@/api/main/bs/orderScheduling/orderScheduling"; import { listPassingStationCollection, getPassingStationCollection, delPassingStationCollection, addPassingStationCollection, updatePassingStationCollection } from "@/api/main/da/passingStationCollection/passingStationCollection"; import {listLineInfo} from "@/api/main/bs/lineInfo/lineInfo"; +import { setSNCode } from "@/api/main/da/opcuaconfig/opcuaconfig"; import {getIp, listStationConf} from "@/api/main/sc/stationConf"; export default { @@ -95,6 +96,15 @@ buttondisabled:true, locationCode: "鏈厤缃�", locationName: "鏈厤缃伐浣�", + + codeValue: "", + code: "", + lastTime: "", + nextTime: "", + lastCode: "", + nextCode: "", + dtmainId: "", + // 鏌ヨ鍙傛暟 queryParams: { pageNum: 1, @@ -122,7 +132,36 @@ }, computed: {}, watch: {}, - created() {}, + created() { + window.document.onkeypress = (e) => { + if (window.event) { + this.nextCode = e.keyCode; + } else if (e.which) { + this.nextCode = e.which; + } + if (e.which === 13) { + // 閿洏鍥炶溅浜嬩欢 + if (this.code.length < 3) return; // 鎵爜鏋殑閫熷害寰堝揩锛屾墜鍔ㄨ緭鍏ョ殑鏃堕棿涓嶄細璁ヽode鐨勯暱搴﹀ぇ浜�2锛屾墍浠ヨ繖閲屼笉浼氬鎵爜鏋湁鏁� + this.parseQRCode(this.code); // 鑾峰彇鍒版壂鐮佹灙杈撳叆鐨勫唴瀹癸紝鍋氬埆鐨勬搷浣� + this.lastCode = ""; + this.lastTime = ""; + return; + } + this.nextTime = new Date().getTime(); + if (!this.lastTime && !this.lastCode) { + this.code = ""; // 娓呯┖涓婃鐨勬潯褰㈢爜 + this.code += e.key; + } + if (this.lastCode && this.lastTime && this.nextTime - this.lastTime > 500) { + // 褰撴壂鐮佸墠鏈塳eypress浜嬩欢鏃�,闃叉棣栧瓧缂哄け + this.code = e.key; + } else if (this.lastCode && this.lastTime) { + this.code += e.key; + } + this.lastCode = this.nextCode; + this.lastTime = this.nextTime; + }; + }, mounted() { this.getStationConf(); }, @@ -154,7 +193,8 @@ }, EngineNohandleChange(){ if(this.form.engineNo !== null && this.form.engineNo !== undefined){ - let OrderSchedulingParam = {engineNo: null} + //let OrderSchedulingParam = {engineNo: null} + setSNCode(this.form.engineNo,this.locationCode) //OrderSchedulingParam.engineNo = this.form.engineNo; /* listOrderScheduling(OrderSchedulingParam).then(response => { if(response.total === 1 ){ @@ -202,7 +242,9 @@ } }, - + parseQRCode(code) { + this.form.engineNo = code; + }, }, } -- Gitblit v1.9.3