diff --git a/klp-ui/src/views/wms/print/scaner.vue b/klp-ui/src/views/wms/print/scaner.vue
index ec83c05c..69cb3a23 100644
--- a/klp-ui/src/views/wms/print/scaner.vue
+++ b/klp-ui/src/views/wms/print/scaner.vue
@@ -41,12 +41,14 @@
-
+
+
+
+
+
+
+
+
@@ -99,7 +101,7 @@
-
+
@@ -166,15 +168,15 @@ export default {
initSocket() {
// 处理WebSocket连接
this.socket = new WebSocket("ws://localhost:9000/ws");
-
+
this.socket.onopen = () => {
console.log("Socket 连接已建立");
};
-
+
this.socket.onmessage = (event) => {
try {
const data = JSON.parse(event.data);
-
+
// 处理设备列表数据
if (data.type === "allDevices") {
console.log("获取设备列表", data);
@@ -183,7 +185,7 @@ export default {
totalCount: data.totalCount || 0,
activeCount: data.activeCount || 0
};
- }
+ }
// 处理扫描消息
else if (data.type === "scanMessage") {
console.log("获取扫描消息", data);
@@ -203,7 +205,7 @@ export default {
console.error("解析WebSocket消息失败", error);
}
};
-
+
this.socket.onclose = () => {
console.log("Socket 连接已关闭");
// 连接关闭后尝试重连
@@ -211,12 +213,12 @@ export default {
this.initSocket();
}, 5000);
};
-
+
this.socket.onerror = (error) => {
console.error("Socket 错误", error);
};
},
-
+
// 刷新设备列表
refreshDevices() {
if (this.socket && this.socket.readyState === WebSocket.OPEN) {
@@ -227,7 +229,7 @@ export default {
this.initSocket();
}
},
-
+
fetchMaster() {
listStockIo({ pageSize: 9999, pageNum: 1 }).then(res => {
console.log("获取挂载单据", res);
@@ -237,7 +239,7 @@ export default {
this.$message.error("获取挂载单据失败");
});
},
-
+
handleDeviceChange(item) {
this.socket.send(
JSON.stringify({
@@ -246,7 +248,7 @@ export default {
})
);
},
-
+
handleBatchConfirm() {
// 汇总会导致的库存变更,需要确认
console.log("批量确认", this.selectedList);
@@ -254,7 +256,7 @@ export default {
this.$message.warning("请选择需要确认的记录");
return;
}
-
+
// 批量处理逻辑
Promise.all(this.selectedList.map(item => this.processRecord(item)))
.then(() => {
@@ -270,15 +272,15 @@ export default {
this.$message.error("批量确认失败");
});
},
-
+
handleSelectionChange(selection) {
this.selectedList = selection;
},
-
+
handleDelete(row) {
this.messageList = this.messageList.filter(item => item.time !== row.time);
},
-
+
async handleConfirm(row) {
try {
await this.processRecord(row);
@@ -289,7 +291,7 @@ export default {
this.$message.error('确认失败');
}
},
-
+
// 处理单条记录的确认逻辑
async processRecord(row) {
// 插入记录
@@ -297,11 +299,11 @@ export default {
// 更新库存
await this.updateStock(row);
},
-
+
insertRecord(row) {
return addStockIoDetail(row);
},
-
+
updateStock(row) {
if (row.ioType === 'in') {
return scanInStock(row);
@@ -485,4 +487,4 @@ export default {
.el-table td, .el-table th {
padding: 12px 0;
}
-
\ No newline at end of file
+