From 44fb5831b2e7b4dd652aef3f1a27788a9b9cb760 Mon Sep 17 00:00:00 2001 From: hehaibing-1996 Date: Tue, 25 Feb 2025 18:58:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A7=E6=9E=B6=E7=BB=91=E5=AE=9A=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E4=BC=98=E5=8C=96=20=E5=91=BC=E5=8F=AB=E7=A9=BA?= =?UTF-8?q?=E8=B4=A7=E6=9E=B6=E9=80=89=E6=8B=A9=E8=B4=A7=E6=9E=B6=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=20=E9=80=81=E5=9B=9E=E8=B4=A7=E6=9E=B6=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=8C=BA=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PDA/PDA/pages/bind/bind.vue | 278 +++++++++++++---- .../dist/dev/app-plus/app-service.js | 283 ++++++++++++++---- WCS.BLL/DbModels/STZL/LocationInfo.cs | 2 +- WCS.BLL/DbModels/STZL/MatBaseInfo.cs | 6 + .../Services/IService/IPDAMatBindService.cs | 1 + WCS.BLL/Services/Service/PDAMatBindService.cs | 124 +++++++- .../PDAShelfLocationBindUnbindService.cs | 2 +- .../ApiModel/MatBaseInfo/MatBaseInfoModel.cs | 5 + .../PDAMatBind/BindMatDetailRequest.cs | 9 + .../GetShelfInfoByLocationReturnData.cs | 12 + .../Controllers/PDAMatBindController.cs | 51 ++++ 11 files changed, 653 insertions(+), 120 deletions(-) diff --git a/PDA/PDA/pages/bind/bind.vue b/PDA/PDA/pages/bind/bind.vue index 3931fdb..3bc8204 100644 --- a/PDA/PDA/pages/bind/bind.vue +++ b/PDA/PDA/pages/bind/bind.vue @@ -34,15 +34,35 @@ - 工位编码: + 货架类型: + + + + {{shelfTypeOptions[selectedShelfTypeIndex].shelfTypeName}} + + + - {{locationCode}} + - + + + + + 工位编码: + + {{locationCode}} + + + @@ -111,7 +131,8 @@ - + @@ -171,6 +192,13 @@ }], selectedShelfAreaIndex: 0, // 选择的货架区域索引 + // 需要的空货架类型选项 + shelfTypeOptions: [{ + id: 1, + shelfTypeName: '请先获取工位码' + }], + selectedShelfTypeIndex: 0, // 选择的货架类型索引 + userName: '', //当前登录的用户名 } }, @@ -189,25 +217,10 @@ analysisScanCode: function(encodedString) { // 去除末尾的逗号和"..."(如果有的话) encodedString = encodedString.replace(/,\s*\.\.\.$/, ''); - // // 分割字符串并转换为字节数组 - // let byteStrings = encodedString.split(','); - // let byteArray = []; - // for (let byteString of byteStrings) { - // byteArray.push(parseInt(byteString, 10)); // 将字符串转换为十进制整数 - // } - // // 将字节数组转换为UTF-8字符串 - // // 注意:这里使用了一个简单的循环来构建字符串,因为String.fromCharCode.apply可能在大数据上性能不佳 - // let originalString = ''; - // for (let i = 0; i < byteArray.length; i++) { - // // 对于每个字节,使用fromCharCode转换为对应的字符 - // // 注意:这里假设你的字节数组已经是正确的UTF-8编码,并且不需要额外的处理来组合多字节字符 - // originalString += String.fromCharCode(byteArray[i]); - // } this.locationCode = encodedString; - this.getShelfInfoByLocationCode(); - + this.getShelfInfoByLocationCode(true); }, - getShelfInfoByLocationCode: function() { + getShelfInfoByLocationCode: function(isTip) { //调用接口获取当前工位信息 当前工位是否有货架 var serverIPAndPort = getServerIPAndPort(); uni.request({ @@ -231,6 +244,11 @@ this.locationCode = res.data.data.locationCode; this.shelfId = res.data.data.shelfId; this.shelfCode = res.data.data.shelfCode; + this.shelfTypeOptions = res.data.data.shelfTypes; + this.selectedShelfTypeIndex = getConfig("bindSelectedShelfTypeIndex", 0); + + this.shelfAreaOptions = res.data.data.locationArea; + this.selectedShelfAreaIndex = getConfig("bindSelectedShelfAreaIndex", 0); if (this.shelfId == null) { this.shelfCode = '(工位无货架,请呼叫!)'; @@ -246,40 +264,47 @@ this.isNeedCallShelfCode = false; this.placeholderText = '输入编码或名称'; } - - uni.showToast({ - title: '获取成功!', - icon: 'none', - duration: 1500 - }); + if (isTip) { + uni.showToast({ + title: '获取成功!', + icon: 'none', + duration: 1500 + }); + } } else { - uni.showToast({ - title: '获取失败:' + res.data.message, - icon: 'none', - duration: 3600 - }); - this.clear(); + if (isTip) { + uni.showToast({ + title: '获取失败:' + res.data.message, + icon: 'none', + duration: 3600 + }); + this.clear(); + } } } else { - uni.showToast({ - title: '服务器返回错误状态码' + res.statusCode, - icon: 'none', - duration: 3000 - }); - this.clear(); + if (isTip) { + uni.showToast({ + title: '服务器返回错误状态码' + res.statusCode, + icon: 'none', + duration: 3000 + }); + this.clear(); + } } }, fail: (err) => { // 请求失败的回调函数 - uni.showToast({ - title: '请求失败' + err, - icon: 'none', - duration: 3000 - }); + if (isTip) { + uni.showToast({ + title: '请求失败' + err.errMsg, + icon: 'none', + duration: 3000 + }); - this.clear(); + this.clear(); + } }, complete: (event) => { // 请求完成的回调函数(无论成功或失败都会调用) @@ -293,6 +318,7 @@ this.matCode = item.matCode; this.matName = item.matName; this.matSpec = item.matSpec; + this.matQty = item.matDefaultQty; this.matBaseInfoId = item.id; }, @@ -349,9 +375,9 @@ fail: (err) => { // 请求失败的回调函数 uni.showToast({ - title: '绑定失败:请求失败' + err, + title: '请求失败' + err.errMsg, icon: 'none', - duration: 1500 + duration: 3000 }); }, complete: (event) => { @@ -378,7 +404,7 @@ duration: 1000 }); - this.getShelfInfoByLocationCode(); + this.getShelfInfoByLocationCode(false); return; } if (this.matCodeCondition == null || this.matCodeCondition == '') { @@ -395,8 +421,27 @@ } }, - //物料绑定 + //呼叫空货架 callEmptyShelf: function() { + if (this.isNeedScanLocationCode) { + uni.showToast({ + title: '请先扫描工位码!', + icon: 'none', + duration: 3000 + }); + return; + } + + if (this.selectedShelfTypeIndex == 0) { + uni.showToast({ + title: '请选择需要呼叫的货架类型!', + icon: 'none', + duration: 3000 + }); + return; + } + + saveConfig("bindSelectedShelfTypeIndex", this.selectedShelfTypeIndex); this.userName = getConfig('userName', ''); var serverIPAndPort = getServerIPAndPort(); uni.request({ @@ -405,6 +450,8 @@ data: { "locationId": this.locationId, "locationCode": this.locationCode, + 'needShelfTypeId': this.shelfTypeOptions[this.selectedShelfTypeIndex].id, + 'needShelfTypeName': this.shelfTypeOptions[this.selectedShelfTypeIndex].shelfTypeName, "userName": this.userName, "deviceType": "PDA" }, @@ -419,14 +466,14 @@ uni.showToast({ title: '呼叫成功,请等待!', icon: 'none', - duration: 1500 + duration: 2500 }); - + this.getShelfInfoByLocationCode(false); } else { uni.showToast({ title: '呼叫失败:' + res.data.message, icon: 'none', - duration: 1500 + duration: 2500 }); } @@ -434,16 +481,16 @@ uni.showToast({ title: '呼叫失败:服务器返回错误状态码' + res.statusCode, icon: 'none', - duration: 1500 + duration: 2500 }); } }, fail: (err) => { // 请求失败的回调函数 uni.showToast({ - title: '呼叫失败:http请求失败' + err, + title: 'http请求失败' + err.errMsg, icon: 'none', - duration: 1500 + duration: 2500 }); }, complete: (event) => { @@ -454,6 +501,107 @@ }, + //送回货架 + sendShelfBack: function() { + if (this.isNeedScanLocationCode) { + uni.showToast({ + title: '请先扫描工位码!', + icon: 'none', + duration: 3000 + }); + return; + } + + if (this.shelfId == null) { + uni.showToast({ + title: '当前工位无货架!无法送货架!', + icon: 'none', + duration: 3000 + }); + return; + } else if (this.shelfId != null && this.shelfCode != null && this + .shelfCode.includes('运输中')) { + uni.showToast({ + title: '当前工位无货架!无法送货架!', + icon: 'none', + duration: 3000 + }); + return; + } + + + if (this.selectedShelfAreaIndex == 0) { + uni.showToast({ + title: '请选择需要送回的位置区域', + icon: 'none', + duration: 3000 + }); + return; + } + + saveConfig("bindSelectedShelfAreaIndex", this.selectedShelfAreaIndex); + this.userName = getConfig('userName', ''); + var serverIPAndPort = getServerIPAndPort(); + uni.request({ + url: 'http://' + serverIPAndPort + '/pdaMatBind/bindSendBackShelf', // 请求的接口地址 + method: 'POST', // 设置请求方式为 POST + data: { + "locationId": this.locationId, + "locationCode": this.locationCode, + "shelfId": this.shelfId, + "shelfCode": this.shelfCode, + 'sendBackLocationAreaId': this.shelfAreaOptions[this.selectedShelfAreaIndex].id, + 'sendBackLocationAreaName': this.shelfAreaOptions[this.selectedShelfAreaIndex] + .locationAreaName, + "userName": this.userName, + "deviceType": "PDA" + }, + header: { + 'Content-Type': 'application/json', // 如果需要以JSON格式发送数据 + }, + success: (res) => { + // 请求成功的回调函数 + if (res.statusCode === 200) { + //接口返回数据为200 表示获取成功! + if (res.data.code == 200) { + uni.showToast({ + title: '送货架呼叫成功,请等待!', + icon: 'none', + duration: 2500 + }); + this.getShelfInfoByLocationCode(false); + + } else { + uni.showToast({ + title: '送货架呼叫失败:' + res.data.message, + icon: 'none', + duration: 2500 + }); + } + + } else { + uni.showToast({ + title: '送货架呼叫失败:服务器返回错误状态码' + res.statusCode, + icon: 'none', + duration: 2500 + }); + } + }, + fail: (err) => { + // 请求失败的回调函数 + uni.showToast({ + title: 'http请求失败' + err.errMsg, + icon: 'none', + duration: 2500 + }); + }, + complete: (event) => { + // 请求完成的回调函数(无论成功或失败都会调用) + console.log('请求完成', event); + } + }); + + }, //清空当前界面所有内容 clear: function() { @@ -465,6 +613,13 @@ this.isNeedScanLocationCode = true; this.placeholderText = '请先扫描工位码'; }, + shelfTypeOptionChange(e) { + this.selectedShelfTypeIndex = e.detail.value; + }, + onShelfAreaChange(e) { + this.selectedShelfAreaIndex = e.detail.value; + }, + clearMatInfo: function() { this.matCode = ''; this.matName = ''; @@ -480,6 +635,7 @@