diff --git a/src/views/basic/collectPoint/timerSetting.vue b/src/views/basic/collectPoint/timerSetting.vue
index a84927e2..b4da87b1 100644
--- a/src/views/basic/collectPoint/timerSetting.vue
+++ b/src/views/basic/collectPoint/timerSetting.vue
@@ -210,6 +210,7 @@
type='number'
splaceholder="请输入内容"
v-model="formData.fixedCount"
+ @input="handleInput"
>
@@ -384,6 +385,9 @@ export default {
ShelfDisplay
},
methods: {
+ handleInput() {
+ this.formData.fixedCount = Math.max(0, this.formData.fixedCount);
+ },
handleSlotClick(slot) {
// 在这里处理被点击的货位信息
console.log('被点击的货位:', slot);
diff --git a/src/views/collect/IoCreateOrder.vue b/src/views/collect/IoCreateOrder.vue
index 25cceb13..f5e63d1a 100644
--- a/src/views/collect/IoCreateOrder.vue
+++ b/src/views/collect/IoCreateOrder.vue
@@ -20,7 +20,7 @@
style="display: flex; margin-top: 5px; float: right"
>
拍照解码
diff --git a/src/views/collect/IoSplitFifoRemove.vue b/src/views/collect/IoSplitFifoRemove.vue
index e739c0ff..76414d3b 100644
--- a/src/views/collect/IoSplitFifoRemove.vue
+++ b/src/views/collect/IoSplitFifoRemove.vue
@@ -21,10 +21,14 @@
- 拍照解码
+
+ 回退
- 放弃
@@ -230,6 +234,7 @@ import { deleteCode, deleteCodes, fallbackCode, getCodeListByRelId } from '@/api
import { splitFifoDetail } from '@/api/inout/splitCode'
import { batchAddCode, batchVailCode, enterCodeWeb } from '@/api/inout/order'
import { getSet } from '@/api/collect/collectSet'
+import A from '@/plugins/KeyScaner'
const SLOT_CODE_PREFIX = 'DMQ'
@@ -297,7 +302,10 @@ export default {
isSuccess: false,
//自动设置
collectSet: {},
- valiCodes: []
+ valiCodes: [],
+ //weksolket
+ sitcomScan: false,
+ sictomText: '',
}
},
methods: {
@@ -410,6 +418,7 @@ export default {
if (res.code == 20000) {
//删除码成功
//刷新列表
+ this.sictomText = ''
this.printCodeResult(res.data)
this.getCodes()
this.getSplitCodes()
@@ -603,8 +612,8 @@ export default {
fallbackCode() {
// fallbackCode()
// this.firstGroupNumber
- if (this.queueCodes.length == 0){
- return this.$message.error("当前上货队列不足")
+ if (this.queueCodes.length == 0) {
+ return this.$message.error('当前上货队列不足')
}
this.$confirm('是否确定回退上药队列?', '提示', {
confirmButtonText: '确定',
@@ -633,6 +642,16 @@ export default {
})
})
},
+ paizhao(){
+ if (this.ws && this.ws.readyState === WebSocket.OPEN) {
+ // const data = JSON.stringify({ action: "subscribe", channel: "updates" }); // 发送的参数
+ var sendData = "ManualClick=1"
+ this.ws.send(sendData); // 发送数据
+ console.log("Data sent:", sendData);
+ } else {
+ console.error("WebSocket is not connected.");
+ }
+ },
init() {
this.scanCode = ''
this.$refs.inputRef.focus()
@@ -659,7 +678,119 @@ export default {
this.collectSet = response.data
}
})
- }
+ },
+ //处理事件
+ getDMHotskeyValue(str) {
+ console.log(str)
+ if (str.includes("DMQ")) {
+ if (!isBlank(this.curQueueName)) {
+ this.scanCode = ''
+ return this.$message.warning("当前已录入槽位")
+ }
+ let query = {
+ code: this.scanCode
+ }
+ if (str != null) {
+ query.code = str
+ query.workPlaceIdFk = this.workplaceId
+ }
+ this.handleSlotCodeScan()
+ return true
+ }else if (str.includes("DMOENTER")) {
+ return true
+ }else if (str.includes("DMOCANCEL")) {
+ return true
+ }else if (str.includes("DMODEL")) {
+ return true
+ }
+ return false
+ },
+ handleScanComplete(fullScanData) {
+ if (!this.curQueue.code) {
+ if (fullScanData != null && fullScanData[0].includes("DMQ")) {
+ this.getDMHotskeyValue(fullScanData[0])
+ return;
+ }
+ } else if (this.curQueue.code != null) {
+ if (fullScanData != null && fullScanData[0].includes("DMQ")) {
+ this.$message.warning('已绑定取货槽,请勿重复绑定!');
+ return;
+ }
+ }
+ const verify = this.verifyScanCount(fullScanData)
+ if (verify){
+ let params = {
+ codeList: fullScanData
+ }
+ this.batchVailCode(params)
+ }
+ },
+ handleRecCodesEvent(event) {
+ console.log('接收 recCodes event:', event.detail.recCodes)
+ const verify = this.verifyScanCount(event.detail.recCodes)
+ if (verify) {
+ let params = {
+ codeList: event.detail.recCodes
+ }
+ this.batchVailCode(params)
+ }
+
+ },
+ socketListener() {
+ let lastScanTime = Date.now()
+ let scanBuffer = []
+ let scanTimeout = null
+ const SCAN_TIMEOUT = 1000 // 1秒间隔,表示扫码结束的判定标准
+ const self = this
+ console.log('启用监听')
+ this.ws.onmessage = function (event) {
+ let scanData = event.data // 获取扫码数据
+ let currentTime = Date.now()
+ console.log(scanData + "33333")
+ // 如果时间间隔超过预设的阈值,表示这是一次新的扫码
+ if (currentTime - lastScanTime > SCAN_TIMEOUT) {
+ // 处理上一次完整的扫码数据
+ if (scanBuffer.length > 0) {
+ self.handleScanComplete(scanBuffer)
+ }
+ // 清空缓冲区,开始新的扫码
+ scanBuffer = []
+ }
+ // 重置上一次扫码的时间
+ lastScanTime = currentTime
+ // 将数据添加到缓冲区
+ scanBuffer.push(scanData)
+
+ // 如果已经有一个定时器在等待,可以清除它
+ if (scanTimeout) {
+ clearTimeout(scanTimeout)
+ }
+ // 设置新的定时器,等待指定的时间后执行扫码结束处理
+ scanTimeout = setTimeout(() => {
+ // 定时器到时,处理扫码结束
+ self.handleScanComplete(scanBuffer)
+ scanBuffer = []
+ }, SCAN_TIMEOUT)
+ }
+ },
+ handleVisibilityChange() {
+ if (document.visibilityState === 'visible') {
+ console.log('用户切回到了工位页面')
+ if (this.ws == null || this.ws.readyState === WebSocket.CLOSED) {
+ this.ws = new WebSocket('ws://127.0.0.1:9988')
+ const self = this
+ this.ws.onopen = function (evt) {
+ console.log('工位剔除WebSocket 连接中 ...')
+ self.socketListener()
+ }
+ }
+ } else {
+ if (this.ws && this.ws.readyState === WebSocket.OPEN) {
+ this.ws.close()
+ console.log('关闭工位剔除websocket成功')
+ }
+ }
+ },
},
computed: {
// 计算每个分组的合并信息
@@ -690,12 +821,54 @@ export default {
}
},
mounted() {
+ // this.$refs.inputRef.focus()
+ // this.$refs.inputRef.select()
+ document.body.ondrop = function(event) {
+ event.preventDefault()
+ event.stopPropagation()
+ }
+ var that = this
+ var inputer = document.getElementById('inputer')
+ window.sc = new A.KeyScaner(inputer) //传入要监听的DOM节点
+ sc.onInput = function(text) {
+ if (text.includes('delete')) {
+ that.scanCode = ''
+ that.sictomText = ''
+ that.originCode = ''
+ return
+ }
+ if (that.sitcomScan) {
+ let tempTxt = text
+ let str = tempTxt.replace(/[\r]/g, '')
+ that.sictomText = that.sictomText + str
+ that.scanCode = that.sictomText
+ } else {
+ that.scanCode = text
+ }
+ }
+ inputer.focus()
this.$refs.inputRef.focus()
- this.$refs.inputRef.select()
+ //环境判断
+ if (window.navigator.userAgent.indexOf('GLXP_PC') != -1) {
+ this.scanDisabled = true
+ window.removeEventListener('gwsh', this.handleRecCodesEvent)
+ window.addEventListener('gwsh', this.handleRecCodesEvent)
+ }
+ document.addEventListener('visibilitychange', this.handleVisibilityChange)
+ this.handleVisibilityChange()
+
},
created() {
this.workplaceId = this.$route.query.workplaceId
this.selectSysParam()
+ },
+ beforeDestroy() {
+ window.removeEventListener('gwsh', this.handleRecCodesEvent)
+ this.ws.close()
+ this.ws.onclose = function(evt) {
+ console.log('工位剔除Connection closed.')
+ }
+ document.removeEventListener('visibilitychange', this.handleVisibilityChange)
}
}