From 025703fe9421ccf5ea4f50c196fd9edd6ad10612 Mon Sep 17 00:00:00 2001 From: hehaibing-1996 Date: Wed, 26 Feb 2025 19:40:17 +0800 Subject: [PATCH] =?UTF-8?q?1.PDA=E7=AB=AF=E9=80=81=E5=9B=9E=E8=B4=A7?= =?UTF-8?q?=E6=9E=B6=E5=8A=9F=E8=83=BD=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2.选择默认区域功能优化(若选择区域索引小于选项值时会界面会跳到空白) --- PDA/PDA/pages/bind/bind.vue | 28 +++--- .../productionLineCallOut.vue | 85 +++++++++-------- .../dist/dev/app-plus/app-service.js | 78 ++++++++-------- .../PDAProductionLineCallOut/CallInRequest.cs | 4 +- .../PDAProductionLineCallOutController.cs | 91 ++++++++++++++----- 5 files changed, 173 insertions(+), 113 deletions(-) diff --git a/PDA/PDA/pages/bind/bind.vue b/PDA/PDA/pages/bind/bind.vue index be159ca..61ebb98 100644 --- a/PDA/PDA/pages/bind/bind.vue +++ b/PDA/PDA/pages/bind/bind.vue @@ -216,17 +216,17 @@ methods: { //摄像头扫码 cameraScanCode() { - uni.scanCode({ - success: (res) => { - console.log('扫码结果:', res.result); - this.analysisScanCode(res.result); - }, - fail: (err) => { - console.error('扫码失败:', err); - // 处理扫码失败的情况 - } - }); - }, + uni.scanCode({ + success: (res) => { + console.log('扫码结果:', res.result); + this.analysisScanCode(res.result); + }, + fail: (err) => { + console.error('扫码失败:', err); + // 处理扫码失败的情况 + } + }); + }, //扫码枪扫码 analysisScanCode: function(encodedString) { // 去除末尾的逗号和"..."(如果有的话) @@ -262,7 +262,11 @@ this.selectedShelfTypeIndex = getConfig("bindSelectedShelfTypeIndex", 0); this.shelfAreaOptions = res.data.data.locationArea; - this.selectedShelfAreaIndex = getConfig("bindSelectedShelfAreaIndex", 0); + + var index = getConfig("bindSelectedShelfAreaIndex", 0); + if (index + 1 < this.shelfAreaOptions.length) { + this.selectedShelfAreaIndex = index; + } if (this.shelfId == null) { this.shelfCode = '(工位无货架,请呼叫!)'; diff --git a/PDA/PDA/pages/productionLineCallOut/productionLineCallOut.vue b/PDA/PDA/pages/productionLineCallOut/productionLineCallOut.vue index e262b16..1099879 100644 --- a/PDA/PDA/pages/productionLineCallOut/productionLineCallOut.vue +++ b/PDA/PDA/pages/productionLineCallOut/productionLineCallOut.vue @@ -72,9 +72,10 @@ + style="position: fixed; bottom: 5rpx; left: 0; width: 100%; display: flex; justify-content: space-between; align-items: center; z-index: 100;"> + 点击选择送回区域: {{shelfAreaOptions[selectedShelfAreaIndex].locationAreaName}} @@ -83,8 +84,9 @@ + 点击选择: + @change="onShelfTypeChange" style="font-size: 35rpx;width: 200rpx;font-weight: ;"> {{shelfTypeOptions[selectedShelfTypeIndex].text}} @@ -337,7 +339,7 @@ return; } //货架送回区域是否选择 - if (shelfAreaOptions[selectedShelfAreaIndex].locationAreaName = '请先扫货架码') { + if (this.shelfAreaOptions[this.selectedShelfAreaIndex].locationAreaName == '请先扫货架码' || this.shelfAreaOptions[this.selectedShelfAreaIndex].locationAreaName == '请选择') { uni.showToast({ title: '请选择货架送回区域!', icon: 'none', @@ -345,14 +347,25 @@ }); return; } + //保存选择的区域信息 + saveConfig("callOutSelectedShelfAreaIndex", this.selectedShelfAreaIndex); //请求送回货架 var serverIPAndPort = getServerIPAndPort(); uni.request({ url: 'http://' + serverIPAndPort + - '/pdaProductionLineCallOut/getShelfInfoForCallOut', // 请求的接口地址 + '/pdaProductionLineCallOut/callOut', // 请求的接口地址 method: 'POST', // 设置请求方式为 POST data: { + "locationId": this.locationId, + "locationCode": this.locationCode, + "shelfId": this.shelfId, "shelfCode": this.shelfCode, + + "destinationLocationAreaId": this.shelfAreaOptions[this.selectedShelfAreaIndex].id, + "destinationLocationAreaName": this.shelfAreaOptions[this.selectedShelfAreaIndex].locationAreaName, + + "ShelfTypeStr": this.shelfTypeOptions[this.selectedShelfTypeIndex].text, + "userName": this.userName, "deviceType": "PDA" }, @@ -364,35 +377,20 @@ if (res.statusCode === 200) { //接口返回数据为200 表示获取成功! if (res.data.code == 200) { - //未查询到信息 - if (res.data.data == null) { - uni.showToast({ - title: '获取失败,请扫码重试!', - icon: 'none', - duration: 1500 - }); - return; - } - //绑定货架等信息 - this.shelfId = res.data.data.shelfId; - this.shelfCode = res.data.data.shelfCode; - - this.locationId = res.data.data.locationId; - this.locationCode = res.data.data.locationCode; - - this.shelfAreaOptions = res.data.data.locationAreas; - - //获取数据 - this.getCurrentMatInfo(); + uni.showToast({ + title: '送回货架呼叫成功!', + icon: 'none', + duration: 1500 + }); + return; - } else { uni.showToast({ - title: '获取失败:' + res.data.message, + title: '送回货架呼叫失败:' + res.data.message, icon: 'none', duration: 3500 }); - this.clear(); + //this.clear(); } } else { @@ -401,7 +399,7 @@ icon: 'none', duration: 3000 }); - this.clear(); + //this.clear(); } }, fail: (err) => { @@ -412,7 +410,7 @@ duration: 3000 }); - this.clear(); + //this.clear(); }, complete: (event) => { // 请求完成的回调函数(无论成功或失败都会调用) @@ -422,17 +420,17 @@ }, //摄像头扫码 cameraScanCode() { - uni.scanCode({ - success: (res) => { - console.log('扫码结果:', res.result); - this.analysisScanCode(res.result); - }, - fail: (err) => { - console.error('扫码失败:', err); - // 处理扫码失败的情况 - } - }); - }, + uni.scanCode({ + success: (res) => { + console.log('扫码结果:', res.result); + this.analysisScanCode(res.result); + }, + fail: (err) => { + console.error('扫码失败:', err); + // 处理扫码失败的情况 + } + }); + }, //扫码枪扫码 analysisScanCode: function(encodedString) { // 去除末尾的逗号和"..."(如果有的话) @@ -476,6 +474,11 @@ this.shelfAreaOptions = res.data.data.locationAreas; + var index = getConfig("callOutSelectedShelfAreaIndex", 0); + if (index + 1 < this.shelfAreaOptions.length) { + this.selectedShelfAreaIndex = index; + } + //获取数据 this.getCurrentMatInfo(); return; @@ -631,6 +634,7 @@