1.PDA界面:货架位置绑定解绑界面支持手动输入

2.PDA界面:物料绑定
This commit is contained in:
hehaibing-1996
2025-03-11 13:58:11 +08:00
parent ae24d73e81
commit d9d7d2108d
6 changed files with 154 additions and 123 deletions

View File

@ -54,7 +54,8 @@
<button class="mini-btn" type="warn" size="mini" @click="callEmptyShelf">呼叫货架</button>
</view>
</view>
<view style="border-bottom: 1rpx solid #e0e0e0; /* 分隔线的颜色和粗细 */"></view>
<view style="border-bottom: 1rpx solid black; /* 分隔线的颜色和粗细 */"></view>
<view class="diy-flex-inforow" style="flex: 1;">
<view style="flex: 5;"></view>
@ -62,10 +63,6 @@
<view style="flex: 35;">工位编码</view>
<view style="flex: 90;overflow:hidden;">{{locationCode}}</view>
<!--
<view style="flex: 30;">
<button class="mini-btn" type="warn" size="mini" @click="callEmptyShelf">呼叫货架</button>
</view> -->
</view>
<view class="diy-flex-inforow" style="flex: 1;">
@ -136,26 +133,26 @@
</view>
<view style="flex: 40;">
<button @click="bind" class="mini-btn" style="margin-left: 10rpx;" type="warn"
size="mini">绑定</button>
<button @click="bind" class="mini-btn" style="margin-left: 11rpx;font-size: 28rpx;" type="warn"
size="mini">&nbsp;&nbsp;</button>
</view>
</view>
<view style="border-bottom: 1rpx solid #e0e0e0; /* 分隔线的颜色和粗细 */"></view>
<view style="border-bottom: 1rpx solid black; /* 分隔线的颜色和粗细 */"></view>
<view style="flex: 1;">
<view style="flex: 40;text-align: center;">
<view class="picker-container">
<view> 点击选择送回区域</view>
<view> 选择送回区域</view>
<picker ref="shelfAreaPicker" :range="shelfAreaOptions" range-key="locationAreaName"
:value="selectedShelfAreaIndex" @change="onShelfAreaChange" style="font-size: 35rpx;">
<view class="uni-input">{{shelfAreaOptions[selectedShelfAreaIndex].locationAreaName}}</view>
</picker>
</view>
<button style="font-size: 40rpx;margin: 15rpx;background-color: green;" size="mini"
@click="sendShelfBack"></button>
<button style="font-size: 40rpx;margin: 15rpx;background-color: green;color: aliceblue;" size="mini"
@click="sendShelfBack">&nbsp;&nbsp;</button>
</view>
</view>
</view>
@ -312,12 +309,7 @@
if (index + 1 < this.shelfAreaOptions.length) {
this.selectedShelfAreaIndex = index;
}
// if (this.shelfId == null) {
// this.shelfCode = '(工位无货架,请呼叫!)';
// this.isNeedScanLocationCode = false;
// this.isNeedCallShelfCode = true;
// this.placeholderText = '请呼叫货架';
// } else
if (this.shelfId != null && this.shelfCode != null && this
.shelfCode.includes('运输中')) {
this.placeholderText = '请等待货架运输';

View File

@ -458,8 +458,6 @@
console.log('请求完成', event);
}
});
},
queryMatList: function() {

View File

@ -12,7 +12,7 @@
<view class="uni-input-wrapper" style="flex: 60;">
<input id="inputMatCode" class="uni-input" style="font-size: 50rpx; padding: 10rpx;"
:placeholder="placeholderText" v-model="shelfCodeCondition" @blur="queryMatList"></input>
:placeholder="placeholderText" v-model="shelfCodeCondition" @blur="blur"></input>
</view>
<view style="flex: 3;">
@ -121,7 +121,7 @@
const self = this; // 保存this的引用
recive(function(res) {
if (self.shelfId == 0) {
self.analysisScanCode(res.data);
self.analysisScanCode(res.data, true);
} else {
self.saveScanedShelfCode(res.data);
}
@ -130,13 +130,21 @@
});
},
methods: {
//输入框失去焦点
blur() {
if (this.shelfId == 0) {
this.analysisScanCode(this.shelfCodeCondition, true);
} else {
this.saveScanedShelfCode(this.shelfCodeCondition);
}
},
//摄像头扫码
cameraScanCode() {
uni.scanCode({
success: (res) => {
console.log('扫码结果:', res.result);
if (this.shelfId == 0) {
this.analysisScanCode(res.result);
this.analysisScanCode(res.result, true);
} else {
this.saveScanedShelfCode(res.result);
}
@ -147,10 +155,10 @@
}
});
},
analysisScanCode: function(encodedString) {
analysisScanCode: function(encodedString, isTip) {
// 去除末尾的逗号和"..."(如果有的话)
encodedString = encodedString.replace(/,\s*\.\.\.$/, '');
this.shelfCodeCondition = encodedString;
//this.shelfCodeCondition = encodedString;
//调用接口获取当前货架信息,查看当前货架的工位绑定情况
var serverIPAndPort = getServerIPAndPort();
@ -173,11 +181,13 @@
if (res.data.code == 200) {
//未查询到信息
if (res.data.data == null || res.data.data.count == 0) {
uni.showToast({
title: '获取失败,请重试!',
icon: 'none',
duration: 1500
});
if (isTip) {
uni.showToast({
title: '获取失败,请重试!',
icon: 'none',
duration: 2000
});
}
return;
}
//有物料信息
@ -190,38 +200,49 @@
this.destinationLocaiotnCode = res.data.data.destinationLocaiotnCode;
this.transStatusStr = res.data.data.transStatusStr;
this.scanedShelfCode = '';
uni.showToast({
title: '获取成功!',
icon: 'none',
duration: 100
});
this.shelfCodeCondition = '';
this.placeholderText = '请扫描地码';
if (isTip) {
uni.showToast({
title: '获取成功!',
icon: 'none',
duration: 800
});
}
} else {
uni.showToast({
title: '获取失败:' + res.data.message,
icon: 'none',
duration: 3500
});
if (isTip) {
uni.showToast({
title: '获取失败:' + res.data.message,
icon: 'none',
duration: 3500
});
}
this.clear();
}
} else {
uni.showToast({
title: '服务器返回错误状态码' + res.statusCode,
icon: 'none',
duration: 3000
});
if (isTip) {
uni.showToast({
title: '服务器返回错误状态码' + res.statusCode,
icon: 'none',
duration: 3000
});
}
this.clear();
}
},
fail: (err) => {
console.log(err.errMsg);
// 请求失败的回调
uni.showToast({
title: '请求失败' + err.errMsg,
icon: 'none',
duration: 3000
});
if (isTip) {
// 请求失败的回调
uni.showToast({
title: '请求失败' + err.errMsg,
icon: 'none',
duration: 3000
});
}
this.clear();
},
complete: (event) => {
@ -234,6 +255,7 @@
// 去除末尾的逗号和"..."(如果有的话)
encodedString = encodedString.replace(/,\s*\.\.\.$/, '');
this.scanedShelfCode = encodedString;
this.shelfCodeCondition = '';
},
bind: function() {
if (this.shelfId == 0 || this.shelfId == null) {
@ -277,10 +299,10 @@
uni.showToast({
title: '绑定成功!',
icon: 'none',
duration: 3000
duration: 4000
});
//绑定成功
this.analysisScanCode(this.shelfCode);
this.analysisScanCode(this.shelfCode, false);
} else {
uni.showToast({
title: '绑定失败:' + res.data.message,
@ -351,10 +373,10 @@
uni.showToast({
title: '解绑成功!',
icon: 'none',
duration: 3000
duration: 4000
});
//解绑成功
this.analysisScanCode(this.shelfCode);
this.analysisScanCode(this.shelfCode, false);
} else {
uni.showToast({
title: '解绑失败:' + res.data.message,

View File

@ -820,36 +820,36 @@ if (uni.restoreGlobal) {
this.userName = getConfig("userName", "admin");
const self = this;
recive(function(res) {
formatAppLog("log", "at pages/bind/bind.vue:236", "Success:" + res.data);
formatAppLog("log", "at pages/bind/bind.vue:233", "Success:" + res.data);
self.analysisScanCode(res.data);
}, function(err) {
formatAppLog("log", "at pages/bind/bind.vue:239", "Error:", JSON.stringify(err));
formatAppLog("log", "at pages/bind/bind.vue:236", "Error:", JSON.stringify(err));
});
},
methods: {
handleFocus() {
formatAppLog("log", "at pages/bind/bind.vue:244", "foucus");
formatAppLog("log", "at pages/bind/bind.vue:241", "foucus");
this.isMatConditionFoucused = true;
},
handleBlur() {
formatAppLog("log", "at pages/bind/bind.vue:248", "bulur");
formatAppLog("log", "at pages/bind/bind.vue:245", "bulur");
this.isMatConditionFoucused = false;
},
//摄像头扫码
cameraScanCode() {
uni.scanCode({
success: (res) => {
formatAppLog("log", "at pages/bind/bind.vue:255", "扫码结果:", res.result);
formatAppLog("log", "at pages/bind/bind.vue:252", "扫码结果:", res.result);
this.analysisScanCode(res.result);
},
fail: (err) => {
formatAppLog("error", "at pages/bind/bind.vue:259", "扫码失败:", err);
formatAppLog("error", "at pages/bind/bind.vue:256", "扫码失败:", err);
}
});
},
//扫码枪扫码
analysisScanCode: function(encodedString) {
formatAppLog("log", "at pages/bind/bind.vue:266", this.isMatConditionFoucused);
formatAppLog("log", "at pages/bind/bind.vue:263", this.isMatConditionFoucused);
if (this.isMatConditionFoucused) {
return;
}
@ -938,12 +938,12 @@ if (uni.restoreGlobal) {
}
},
complete: (event) => {
formatAppLog("log", "at pages/bind/bind.vue:373", "请求完成", event);
formatAppLog("log", "at pages/bind/bind.vue:366", "请求完成", event);
}
});
},
bindSelectedMat: function(item) {
formatAppLog("log", "at pages/bind/bind.vue:379", "用户选择了项目:", item);
formatAppLog("log", "at pages/bind/bind.vue:372", "用户选择了项目:", item);
this.matCode = item.matCode;
this.matName = item.matName;
this.matSpec = item.matSpec;
@ -1008,7 +1008,7 @@ if (uni.restoreGlobal) {
});
},
complete: (event) => {
formatAppLog("log", "at pages/bind/bind.vue:448", "请求完成", event);
formatAppLog("log", "at pages/bind/bind.vue:441", "请求完成", event);
}
});
},
@ -1113,7 +1113,7 @@ if (uni.restoreGlobal) {
});
},
complete: (event) => {
formatAppLog("log", "at pages/bind/bind.vue:562", "请求完成", event);
formatAppLog("log", "at pages/bind/bind.vue:555", "请求完成", event);
}
});
},
@ -1204,7 +1204,7 @@ if (uni.restoreGlobal) {
});
},
complete: (event) => {
formatAppLog("log", "at pages/bind/bind.vue:664", "请求完成", event);
formatAppLog("log", "at pages/bind/bind.vue:657", "请求完成", event);
}
});
},
@ -1232,7 +1232,7 @@ if (uni.restoreGlobal) {
this.matQty = 0;
},
handlePopupClose() {
formatAppLog("log", "at pages/bind/bind.vue:696", "弹出层已关闭");
formatAppLog("log", "at pages/bind/bind.vue:689", "弹出层已关闭");
}
}
};
@ -1332,7 +1332,7 @@ if (uni.restoreGlobal) {
}, "呼叫货架")
])
]),
vue.createElementVNode("view", { style: { "border-bottom": "1rpx solid #e0e0e0" } }),
vue.createElementVNode("view", { style: { "border-bottom": "1rpx solid black" } }),
vue.createElementVNode("view", {
class: "diy-flex-inforow",
style: { "flex": "1" }
@ -1345,8 +1345,7 @@ if (uni.restoreGlobal) {
vue.toDisplayString($data.locationCode),
1
/* TEXT */
),
vue.createCommentVNode(' \r\n <view style="flex: 30;">\r\n <button class="mini-btn" type="warn" size="mini" @click="callEmptyShelf">呼叫货架</button>\r\n </view> ')
)
]),
vue.createElementVNode("view", {
class: "diy-flex-inforow",
@ -1461,17 +1460,17 @@ if (uni.restoreGlobal) {
vue.createElementVNode("button", {
onClick: _cache[9] || (_cache[9] = (...args) => $options.bind && $options.bind(...args)),
class: "mini-btn",
style: { "margin-left": "10rpx" },
style: { "margin-left": "11rpx", "font-size": "28rpx" },
type: "warn",
size: "mini"
}, "绑定")
}, "绑  定")
])
]),
vue.createElementVNode("view", { style: { "border-bottom": "1rpx solid #e0e0e0" } }),
vue.createElementVNode("view", { style: { "border-bottom": "1rpx solid black" } }),
vue.createElementVNode("view", { style: { "flex": "1" } }, [
vue.createElementVNode("view", { style: { "flex": "40", "text-align": "center" } }, [
vue.createElementVNode("view", { class: "picker-container" }, [
vue.createElementVNode("view", null, " 点击选择送回区域:"),
vue.createElementVNode("view", null, " 选择送回区域:"),
vue.createElementVNode("picker", {
ref: "shelfAreaPicker",
range: $data.shelfAreaOptions,
@ -1490,10 +1489,10 @@ if (uni.restoreGlobal) {
], 40, ["range", "value"])
]),
vue.createElementVNode("button", {
style: { "font-size": "40rpx", "margin": "15rpx", "background-color": "green" },
style: { "font-size": "40rpx", "margin": "15rpx", "background-color": "green", "color": "aliceblue" },
size: "mini",
onClick: _cache[11] || (_cache[11] = (...args) => $options.sendShelfBack && $options.sendShelfBack(...args))
}, "送架")
}, "送 货 架")
])
])
])
@ -3179,7 +3178,7 @@ if (uni.restoreGlobal) {
this.clear();
},
complete: (event) => {
formatAppLog("log", "at pages/queryBindList/queryBindList.vue:544", "请求完成", event);
formatAppLog("log", "at pages/queryBindList/queryBindList.vue:542", "请求完成", event);
}
});
},
@ -4054,7 +4053,7 @@ if (uni.restoreGlobal) {
const self = this;
recive(function(res) {
if (self.shelfId == 0) {
self.analysisScanCode(res.data);
self.analysisScanCode(res.data, true);
} else {
self.saveScanedShelfCode(res.data);
}
@ -4063,25 +4062,32 @@ if (uni.restoreGlobal) {
});
},
methods: {
//输入框失去焦点
blur() {
if (this.shelfId == 0) {
this.analysisScanCode(this.shelfCodeCondition, true);
} else {
this.saveScanedShelfCode(this.shelfCodeCondition);
}
},
//摄像头扫码
cameraScanCode() {
uni.scanCode({
success: (res) => {
formatAppLog("log", "at pages/shelfLocationBindUnbind/shelfLocationBindUnbind.vue:137", "扫码结果:", res.result);
formatAppLog("log", "at pages/shelfLocationBindUnbind/shelfLocationBindUnbind.vue:145", "扫码结果:", res.result);
if (this.shelfId == 0) {
this.analysisScanCode(res.result);
this.analysisScanCode(res.result, true);
} else {
this.saveScanedShelfCode(res.result);
}
},
fail: (err) => {
formatAppLog("error", "at pages/shelfLocationBindUnbind/shelfLocationBindUnbind.vue:145", "扫码失败:", err);
formatAppLog("error", "at pages/shelfLocationBindUnbind/shelfLocationBindUnbind.vue:153", "扫码失败:", err);
}
});
},
analysisScanCode: function(encodedString) {
analysisScanCode: function(encodedString, isTip) {
encodedString = encodedString.replace(/,\s*\.\.\.$/, "");
this.shelfCodeCondition = encodedString;
var serverIPAndPort = getServerIPAndPort();
uni.request({
url: "http://" + serverIPAndPort + "/pdaShelfLocationBindUnbind/getLocationInfoByShelfCode",
@ -4101,11 +4107,13 @@ if (uni.restoreGlobal) {
if (res.statusCode === 200) {
if (res.data.code == 200) {
if (res.data.data == null || res.data.data.count == 0) {
uni.showToast({
title: "获取失败,请重试!",
icon: "none",
duration: 1500
});
if (isTip) {
uni.showToast({
title: "获取失败,请重试!",
icon: "none",
duration: 2e3
});
}
return;
}
this.shelfId = res.data.data.shelfId;
@ -4116,45 +4124,56 @@ if (uni.restoreGlobal) {
this.destinationLocaiotnCode = res.data.data.destinationLocaiotnCode;
this.transStatusStr = res.data.data.transStatusStr;
this.scanedShelfCode = "";
uni.showToast({
title: "获取成功!",
icon: "none",
duration: 100
});
this.shelfCodeCondition = "";
this.placeholderText = "请扫描地码";
if (isTip) {
uni.showToast({
title: "获取成功!",
icon: "none",
duration: 800
});
}
} else {
uni.showToast({
title: "获取失败:" + res.data.message,
icon: "none",
duration: 3500
});
if (isTip) {
uni.showToast({
title: "获取失败:" + res.data.message,
icon: "none",
duration: 3500
});
}
this.clear();
}
} else {
uni.showToast({
title: "服务器返回错误状态码" + res.statusCode,
icon: "none",
duration: 3e3
});
if (isTip) {
uni.showToast({
title: "服务器返回错误状态码" + res.statusCode,
icon: "none",
duration: 3e3
});
}
this.clear();
}
},
fail: (err) => {
formatAppLog("log", "at pages/shelfLocationBindUnbind/shelfLocationBindUnbind.vue:218", err.errMsg);
uni.showToast({
title: "请求失败" + err.errMsg,
icon: "none",
duration: 3e3
});
formatAppLog("log", "at pages/shelfLocationBindUnbind/shelfLocationBindUnbind.vue:237", err.errMsg);
if (isTip) {
uni.showToast({
title: "请求失败" + err.errMsg,
icon: "none",
duration: 3e3
});
}
this.clear();
},
complete: (event) => {
formatAppLog("log", "at pages/shelfLocationBindUnbind/shelfLocationBindUnbind.vue:229", "请求完成", event);
formatAppLog("log", "at pages/shelfLocationBindUnbind/shelfLocationBindUnbind.vue:250", "请求完成", event);
}
});
},
saveScanedShelfCode: function(encodedString) {
encodedString = encodedString.replace(/,\s*\.\.\.$/, "");
this.scanedShelfCode = encodedString;
this.shelfCodeCondition = "";
},
bind: function() {
if (this.shelfId == 0 || this.shelfId == null) {
@ -4197,9 +4216,9 @@ if (uni.restoreGlobal) {
uni.showToast({
title: "绑定成功!",
icon: "none",
duration: 3e3
duration: 4e3
});
this.analysisScanCode(this.shelfCode);
this.analysisScanCode(this.shelfCode, false);
} else {
uni.showToast({
title: "绑定失败:" + res.data.message,
@ -4225,7 +4244,7 @@ if (uni.restoreGlobal) {
this.clear();
},
complete: (event) => {
formatAppLog("log", "at pages/shelfLocationBindUnbind/shelfLocationBindUnbind.vue:314", "请求完成", event);
formatAppLog("log", "at pages/shelfLocationBindUnbind/shelfLocationBindUnbind.vue:336", "请求完成", event);
}
});
},
@ -4263,9 +4282,9 @@ if (uni.restoreGlobal) {
uni.showToast({
title: "解绑成功!",
icon: "none",
duration: 3e3
duration: 4e3
});
this.analysisScanCode(this.shelfCode);
this.analysisScanCode(this.shelfCode, false);
} else {
uni.showToast({
title: "解绑失败:" + res.data.message,
@ -4291,7 +4310,7 @@ if (uni.restoreGlobal) {
this.clear();
},
complete: (event) => {
formatAppLog("log", "at pages/shelfLocationBindUnbind/shelfLocationBindUnbind.vue:388", "请求完成", event);
formatAppLog("log", "at pages/shelfLocationBindUnbind/shelfLocationBindUnbind.vue:410", "请求完成", event);
}
});
},
@ -4338,7 +4357,7 @@ if (uni.restoreGlobal) {
style: { "font-size": "50rpx", "padding": "10rpx" },
placeholder: $data.placeholderText,
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $data.shelfCodeCondition = $event),
onBlur: _cache[2] || (_cache[2] = (...args) => _ctx.queryMatList && _ctx.queryMatList(...args))
onBlur: _cache[2] || (_cache[2] = (...args) => $options.blur && $options.blur(...args))
}, null, 40, ["placeholder"]), [
[vue.vModelText, $data.shelfCodeCondition]
])

View File

@ -93,7 +93,7 @@ namespace WCS.BLL.Services.Service
return new ResponseCommon()
{
Code = 205,
Message = $"绑定失败:货架参数异常,请重新扫描货架码!",
Message = $"货架参数异常,请重新扫描货架码!",
};
}
//校验参数 传入数据为扫描的位置码
@ -102,7 +102,7 @@ namespace WCS.BLL.Services.Service
return new ResponseCommon()
{
Code = 201,
Message = $"绑定失败:货架码参数异常,请重新扫描位置码!",
Message = $"货架码参数异常,请重新扫描位置码!",
};
}
@ -116,7 +116,7 @@ namespace WCS.BLL.Services.Service
return new ResponseCommon()
{
Code = 201,
Message = $"绑定失败:货架{request.ShelfCode}不存在或已被禁用!",
Message = $"货架{request.ShelfCode}不存在或已被禁用!",
};
}
@ -130,7 +130,7 @@ namespace WCS.BLL.Services.Service
return new ResponseCommon()
{
Code = 201,
Message = $"绑定失败:位置{request.LocationCode}不存在或已被禁用!",
Message = $"位置{request.LocationCode}不存在或已被禁用!",
};
}
//查询该位置是否已绑定货架
@ -143,7 +143,7 @@ namespace WCS.BLL.Services.Service
return new ResponseCommon()
{
Code = 201,
Message = $"绑定失败:位置{request.LocationCode}已绑定货架{request.ShelfCode}\r\n请扫描位置码解绑后再进行绑定",
Message = $"位置{request.LocationCode}已绑定货架{request.ShelfCode}\r\n请扫描位置码解绑后再进行绑定",
};
}

View File

@ -53,7 +53,7 @@ namespace WCS.WebApi.Controllers
return new ResponseCommon()
{
Code = 201,
Message = "绑定失败:" + ex.Message,
Message = "发生异常," + ex.Message,
Data = null,
};
}