pda操作优化 支持手输货架编码和地码

This commit is contained in:
hehaibing-1996
2025-03-11 16:04:28 +08:00
parent d9d7d2108d
commit 9b885235d5
6 changed files with 172 additions and 110 deletions

View File

@ -205,10 +205,8 @@
},
data() {
return {
placeholderText: '请先扫描工位码',
isMatConditionFoucused : false,
isMatConditionFoucused: false,
matCodeCondition: '', //物料编码搜索条件
//工位ID 工位码
locationId: 0,
@ -263,8 +261,7 @@
},
//扫码获取工位信息
analysisScanCode: function(encodedString) {
if(this.isMatConditionFoucused)
{
if (this.isMatConditionFoucused) {
return;
}
// 去除末尾的逗号和"..."(如果有的话)
@ -350,6 +347,23 @@
//搜索获取物料信息
queryMatList: function(isTip) {
//手输入工位码
const regex = /^\d{6}XY\d{6}$/;
if (regex.test(this.matCodeCondition)) {
this.locationCode = this.matCodeCondition;
this.matCodeCondition = '';
this.analysisScanCode(this.locationCode);
return;
}
const regex1 = /^\d{6}xy\d{6}$/;
if (regex1.test(this.matCodeCondition)) {
this.locationCode = this.matCodeCondition.toUpperCase();
this.matCodeCondition = '';
this.analysisScanCode(this.locationCode);
return;
}
if (this.locationCode == null || this.locationCode == '') {
if (isTip) {
uni.showToast({

View File

@ -41,7 +41,7 @@
<view class="uni-input-wrapper" style="flex: 60;">
<input ref="inputMatCode" class="uni-input" style="font-size: 50rpx; padding: 10rpx;"
:placeholder="placeholderText" v-model="matCodeCondition" @blur="queryMatList"></input>
:placeholder="placeholderText" v-model="matCodeCondition"></input>
</view>
<view style="flex: 3;">
@ -445,6 +445,13 @@
encodedString = encodedString.replace(/,\s*\.\.\.$/, '');
this.shelfCode = encodedString;
//支持手动输入货架编码
const regex = /^[1-9]\d{5}$/;
if (regex.test(this.matCodeCondition)) {
this.shelfCode = this.matCodeCondition;
this.matCodeCondition = '';
}
//获取当前货架和所在工位的信息
var serverIPAndPort = getServerIPAndPort();
uni.request({
@ -562,7 +569,7 @@
uni.showToast({
title: '该货架不存在绑定的物料信息!',
icon: 'none',
duration: 1500
duration: 2500
});
return;
}
@ -579,7 +586,7 @@
uni.showToast({
title: '获取失败:' + res.data.message,
icon: 'none',
duration: 3500
duration: 3800
});
this.clear();
}
@ -615,6 +622,7 @@
this.placeholderText = '请先扫描货架码';
this.cardData = null;
this.recordCount = 0;
this.shelfCode = '';
},
//解决长按和滑动冲突的问题

View File

@ -45,7 +45,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="matCodeCondition" @blur="queryMatList"></input>
:placeholder="placeholderText" v-model="matCodeCondition"></input>
</view>
<view style="flex: 3;">
@ -136,7 +136,7 @@
matCode: '示例名称',
matName: '这是一段示例描述',
matSpec: '',
matBatch:'',
matBatch: '',
matQty: 0,
};
const popup = ref(null);
@ -369,20 +369,6 @@
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.shelfCode = encodedString;
//调用接口获取当前工位信息 当前工位是否有货架
var serverIPAndPort = getServerIPAndPort();
@ -461,6 +447,11 @@
},
queryMatList: function() {
const regex = /^[1-9]\d{5}$/;
if (regex.test(this.matCodeCondition)) {
this.shelfCode = this.matCodeCondition;
this.matCodeCondition = '';
}
if (this.shelfCode == null || this.shelfCode == '') {
uni.showToast({
title: '请先扫描货架码!',
@ -495,7 +486,7 @@
uni.showToast({
title: '该货架不存在绑定的物料信息!',
icon: 'none',
duration: 1500
duration: 3000
});
this.clear();
return;
@ -506,7 +497,7 @@
uni.showToast({
title: '获取成功!',
icon: 'none',
duration: 100
duration: 500
});
} else {

View File

@ -45,7 +45,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="matCodeCondition" @blur="queryMatList"></input>
:placeholder="placeholderText" v-model="matCodeCondition"></input>
</view>
<view style="flex: 3;">
@ -161,19 +161,6 @@
};
const saveData = () => {
// console.log('fixedInfo.stocktakingQty' + fixedInfo.value.stocktakingQty);
// console.log('inputValue.value' + inputValue.value);
// console.log('fixedInfo.matQty' + fixedInfo.value.matQty);
// if (fixedInfo.value.stocktakingQty == -1 && inputValue.value == fixedInfo.value.matQty) {
// uni.showToast({
// title: '本次修改未修改数量',
// icon: 'none',
// duration: 1500
// });
// hidePopup();
// return;
// }
if (fixedInfo.value.stocktakingQty != -1 && inputValue.value == fixedInfo.value.stocktakingQty) {
uni.showToast({
title: '本次修改未修改数量',
@ -319,6 +306,24 @@
// 去除末尾的逗号和"..."(如果有的话)
encodedString = encodedString.replace(/,\s*\.\.\.$/, '');
this.shelfCode = encodedString;
//支持手动输入货架编码
const regex = /^[1-9]\d{5}$/;
if (regex.test(this.matCodeCondition)) {
this.shelfCode = this.matCodeCondition;
this.matCodeCondition = '';
}
if(this.shelfCode == null || this.shelfCode == '')
{
uni.showToast({
title: '请先扫描货架码!',
icon: 'none',
duration: 2500
});
return;
}
//调用接口获取当前工位信息 当前工位是否有货架
var serverIPAndPort = getServerIPAndPort();
uni.request({

View File

@ -3102,11 +3102,16 @@ if (uni.restoreGlobal) {
this.clear();
},
complete: (event) => {
formatAppLog("log", "at pages/queryBindList/queryBindList.vue:458", "请求完成", event);
formatAppLog("log", "at pages/queryBindList/queryBindList.vue:444", "请求完成", event);
}
});
},
queryMatList: function() {
const regex = /^[1-9]\d{5}$/;
if (regex.test(this.matCodeCondition)) {
this.shelfCode = this.matCodeCondition;
this.matCodeCondition = "";
}
if (this.shelfCode == null || this.shelfCode == "") {
uni.showToast({
title: "请先扫描货架码!",
@ -3140,7 +3145,7 @@ if (uni.restoreGlobal) {
uni.showToast({
title: "该货架不存在绑定的物料信息!",
icon: "none",
duration: 1500
duration: 3e3
});
this.clear();
return;
@ -3150,7 +3155,7 @@ if (uni.restoreGlobal) {
uni.showToast({
title: "获取成功!",
icon: "none",
duration: 100
duration: 500
});
} else {
uni.showToast({
@ -3178,7 +3183,7 @@ if (uni.restoreGlobal) {
this.clear();
},
complete: (event) => {
formatAppLog("log", "at pages/queryBindList/queryBindList.vue:542", "请求完成", event);
formatAppLog("log", "at pages/queryBindList/queryBindList.vue:533", "请求完成", event);
}
});
},
@ -3334,16 +3339,15 @@ if (uni.restoreGlobal) {
class: "uni-input",
style: { "font-size": "50rpx", "padding": "10rpx" },
placeholder: $data.placeholderText,
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => $data.matCodeCondition = $event),
onBlur: _cache[6] || (_cache[6] = (...args) => $options.queryMatList && $options.queryMatList(...args))
}, null, 40, ["placeholder"]), [
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => $data.matCodeCondition = $event)
}, null, 8, ["placeholder"]), [
[vue.vModelText, $data.matCodeCondition]
])
]),
vue.createElementVNode("view", { style: { "flex": "3" } }),
vue.createElementVNode("view", { style: { "flex": "30" } }, [
vue.createElementVNode("button", {
onClick: _cache[7] || (_cache[7] = (...args) => $options.queryMatList && $options.queryMatList(...args))
onClick: _cache[6] || (_cache[6] = (...args) => $options.queryMatList && $options.queryMatList(...args))
}, "查询")
])
])
@ -3389,8 +3393,8 @@ if (uni.restoreGlobal) {
vue.renderList($data.cardData, (item, index) => {
return vue.openBlock(), vue.createElementBlock("view", {
key: index,
onTouchstart: _cache[8] || (_cache[8] = (...args) => $options.cardTouchStart && $options.cardTouchStart(...args)),
onTouchmove: _cache[9] || (_cache[9] = (...args) => $options.cardTouchMove && $options.cardTouchMove(...args)),
onTouchstart: _cache[7] || (_cache[7] = (...args) => $options.cardTouchStart && $options.cardTouchStart(...args)),
onTouchmove: _cache[8] || (_cache[8] = (...args) => $options.cardTouchMove && $options.cardTouchMove(...args)),
onLongpress: ($event) => $options.longpress(item)
}, [
vue.createVNode(_component_Card, {
@ -3704,10 +3708,10 @@ if (uni.restoreGlobal) {
this.userName = getConfig("userName", "admin");
const self = this;
recive(function(res) {
formatAppLog("log", "at pages/stockTaking/stockTaking.vue:291", "Success:" + res.data);
formatAppLog("log", "at pages/stockTaking/stockTaking.vue:278", "Success:" + res.data);
self.analysisScanCode(res.data);
}, function(err) {
formatAppLog("log", "at pages/stockTaking/stockTaking.vue:294", "Error:", JSON.stringify(err));
formatAppLog("log", "at pages/stockTaking/stockTaking.vue:281", "Error:", JSON.stringify(err));
});
},
methods: {
@ -3721,11 +3725,11 @@ if (uni.restoreGlobal) {
cameraScanCode() {
uni.scanCode({
success: (res) => {
formatAppLog("log", "at pages/stockTaking/stockTaking.vue:308", "扫码结果:", res.result);
formatAppLog("log", "at pages/stockTaking/stockTaking.vue:295", "扫码结果:", res.result);
this.analysisScanCode(res.result);
},
fail: (err) => {
formatAppLog("error", "at pages/stockTaking/stockTaking.vue:312", "扫码失败:", err);
formatAppLog("error", "at pages/stockTaking/stockTaking.vue:299", "扫码失败:", err);
}
});
},
@ -3733,6 +3737,19 @@ if (uni.restoreGlobal) {
analysisScanCode: function(encodedString) {
encodedString = encodedString.replace(/,\s*\.\.\.$/, "");
this.shelfCode = encodedString;
const regex = /^[1-9]\d{5}$/;
if (regex.test(this.matCodeCondition)) {
this.shelfCode = this.matCodeCondition;
this.matCodeCondition = "";
}
if (this.shelfCode == null || this.shelfCode == "") {
uni.showToast({
title: "请先扫描货架码!",
icon: "none",
duration: 2500
});
return;
}
var serverIPAndPort = getServerIPAndPort();
uni.request({
url: "http://" + serverIPAndPort + "/pdaStocktaking/getStocktakingInfosByShelfCode",
@ -3794,7 +3811,7 @@ if (uni.restoreGlobal) {
this.clear();
},
complete: (event) => {
formatAppLog("log", "at pages/stockTaking/stockTaking.vue:391", "请求完成", event);
formatAppLog("log", "at pages/stockTaking/stockTaking.vue:396", "请求完成", event);
}
});
},
@ -3954,16 +3971,15 @@ if (uni.restoreGlobal) {
class: "uni-input",
style: { "font-size": "50rpx", "padding": "10rpx" },
placeholder: $data.placeholderText,
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => $data.matCodeCondition = $event),
onBlur: _cache[5] || (_cache[5] = (...args) => _ctx.queryMatList && _ctx.queryMatList(...args))
}, null, 40, ["placeholder"]), [
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => $data.matCodeCondition = $event)
}, null, 8, ["placeholder"]), [
[vue.vModelText, $data.matCodeCondition]
])
]),
vue.createElementVNode("view", { style: { "flex": "3" } }),
vue.createElementVNode("view", { style: { "flex": "30" } }, [
vue.createElementVNode("button", {
onClick: _cache[6] || (_cache[6] = ($event) => $options.analysisScanCode(this.shelfCode))
onClick: _cache[5] || (_cache[5] = ($event) => $options.analysisScanCode(this.shelfCode))
}, "查询")
])
])
@ -4009,8 +4025,8 @@ if (uni.restoreGlobal) {
vue.renderList($data.cardData, (item, index) => {
return vue.openBlock(), vue.createElementBlock("view", {
key: index,
onTouchstart: _cache[7] || (_cache[7] = (...args) => $options.cardTouchStart && $options.cardTouchStart(...args)),
onTouchmove: _cache[8] || (_cache[8] = (...args) => $options.cardTouchMove && $options.cardTouchMove(...args)),
onTouchstart: _cache[6] || (_cache[6] = (...args) => $options.cardTouchStart && $options.cardTouchStart(...args)),
onTouchmove: _cache[7] || (_cache[7] = (...args) => $options.cardTouchMove && $options.cardTouchMove(...args)),
onLongpress: ($event) => $options.longpress(item)
}, [
vue.createVNode(_component_StocktakingCard, {
@ -4582,30 +4598,30 @@ if (uni.restoreGlobal) {
this.userName = getConfig("userName", "admin");
const self = this;
recive(function(res) {
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:235", "Success:" + res.data);
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:233", "Success:" + res.data);
self.analysisScanCode(res.data);
}, function(err) {
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:239", "Error:", JSON.stringify(err));
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:237", "Error:", JSON.stringify(err));
});
},
methods: {
handleFocus() {
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:244", "foucus");
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:242", "foucus");
this.isMatConditionFoucused = true;
},
handleBlur() {
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:248", "bulur");
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:246", "bulur");
this.isMatConditionFoucused = false;
},
//摄像头扫码
cameraScanCode() {
uni.scanCode({
success: (res) => {
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:255", "扫码结果:", res.result);
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:253", "扫码结果:", res.result);
this.analysisScanCode(res.result);
},
fail: (err) => {
formatAppLog("error", "at pages/productionLineCallIn/productionLineCallIn.vue:259", "扫码失败:", err);
formatAppLog("error", "at pages/productionLineCallIn/productionLineCallIn.vue:257", "扫码失败:", err);
}
});
},
@ -4673,12 +4689,26 @@ if (uni.restoreGlobal) {
this.clearLocation();
},
complete: (event) => {
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:344", "请求完成", event);
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:341", "请求完成", event);
}
});
},
//搜索获取物料信息
queryMatList: function(isTip) {
const regex = /^\d{6}XY\d{6}$/;
if (regex.test(this.matCodeCondition)) {
this.locationCode = this.matCodeCondition;
this.matCodeCondition = "";
this.analysisScanCode(this.locationCode);
return;
}
const regex1 = /^\d{6}xy\d{6}$/;
if (regex1.test(this.matCodeCondition)) {
this.locationCode = this.matCodeCondition.toUpperCase();
this.matCodeCondition = "";
this.analysisScanCode(this.locationCode);
return;
}
if (this.locationCode == null || this.locationCode == "") {
if (isTip) {
uni.showToast({
@ -4765,7 +4795,7 @@ if (uni.restoreGlobal) {
}
},
complete: (event) => {
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:448", "请求完成", event);
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:462", "请求完成", event);
}
});
},
@ -5210,6 +5240,11 @@ if (uni.restoreGlobal) {
analysisScanCode: function(encodedString) {
encodedString = encodedString.replace(/,\s*\.\.\.$/, "");
this.shelfCode = encodedString;
const regex = /^[1-9]\d{5}$/;
if (regex.test(this.matCodeCondition)) {
this.shelfCode = this.matCodeCondition;
this.matCodeCondition = "";
}
var serverIPAndPort = getServerIPAndPort();
uni.request({
url: "http://" + serverIPAndPort + "/pdaProductionLineCallOut/getShelfInfoForCallOut",
@ -5274,7 +5309,7 @@ if (uni.restoreGlobal) {
this.clear();
},
complete: (event) => {
formatAppLog("log", "at pages/productionLineCallOut/productionLineCallOut.vue:524", "请求完成", event);
formatAppLog("log", "at pages/productionLineCallOut/productionLineCallOut.vue:531", "请求完成", event);
}
});
},
@ -5312,7 +5347,7 @@ if (uni.restoreGlobal) {
uni.showToast({
title: "该货架不存在绑定的物料信息!",
icon: "none",
duration: 1500
duration: 2500
});
return;
}
@ -5327,7 +5362,7 @@ if (uni.restoreGlobal) {
uni.showToast({
title: "获取失败:" + res.data.message,
icon: "none",
duration: 3500
duration: 3800
});
this.clear();
}
@ -5349,7 +5384,7 @@ if (uni.restoreGlobal) {
this.clear();
},
complete: (event) => {
formatAppLog("log", "at pages/productionLineCallOut/productionLineCallOut.vue:607", "请求完成", event);
formatAppLog("log", "at pages/productionLineCallOut/productionLineCallOut.vue:614", "请求完成", event);
}
});
},
@ -5358,6 +5393,7 @@ if (uni.restoreGlobal) {
this.placeholderText = "请先扫描货架码";
this.cardData = null;
this.recordCount = 0;
this.shelfCode = "";
},
//解决长按和滑动冲突的问题
cardTouchStart(e) {
@ -5499,16 +5535,15 @@ if (uni.restoreGlobal) {
class: "uni-input",
style: { "font-size": "50rpx", "padding": "10rpx" },
placeholder: $data.placeholderText,
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => $data.matCodeCondition = $event),
onBlur: _cache[5] || (_cache[5] = (...args) => _ctx.queryMatList && _ctx.queryMatList(...args))
}, null, 40, ["placeholder"]), [
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => $data.matCodeCondition = $event)
}, null, 8, ["placeholder"]), [
[vue.vModelText, $data.matCodeCondition]
])
]),
vue.createElementVNode("view", { style: { "flex": "3" } }),
vue.createElementVNode("view", { style: { "flex": "30" } }, [
vue.createElementVNode("button", {
onClick: _cache[6] || (_cache[6] = ($event) => $options.analysisScanCode(this.shelfCode))
onClick: _cache[5] || (_cache[5] = ($event) => $options.analysisScanCode(this.shelfCode))
}, "查询")
])
])
@ -5554,8 +5589,8 @@ if (uni.restoreGlobal) {
vue.renderList($data.cardData, (item, index) => {
return vue.openBlock(), vue.createElementBlock("view", {
key: index,
onTouchstart: _cache[7] || (_cache[7] = (...args) => $options.cardTouchStart && $options.cardTouchStart(...args)),
onTouchmove: _cache[8] || (_cache[8] = (...args) => $options.cardTouchMove && $options.cardTouchMove(...args)),
onTouchstart: _cache[6] || (_cache[6] = (...args) => $options.cardTouchStart && $options.cardTouchStart(...args)),
onTouchmove: _cache[7] || (_cache[7] = (...args) => $options.cardTouchMove && $options.cardTouchMove(...args)),
onLongpress: ($event) => $options.longpress(item)
}, [
vue.createVNode(_component_Card, {
@ -5582,7 +5617,7 @@ if (uni.restoreGlobal) {
range: $data.shelfAreaOptions,
"range-key": "locationAreaName",
value: $data.selectedShelfAreaIndex,
onChange: _cache[9] || (_cache[9] = (...args) => $options.onShelfAreaChange && $options.onShelfAreaChange(...args)),
onChange: _cache[8] || (_cache[8] = (...args) => $options.onShelfAreaChange && $options.onShelfAreaChange(...args)),
style: { "font-size": "35rpx" }
}, [
vue.createElementVNode(
@ -5605,7 +5640,7 @@ if (uni.restoreGlobal) {
range: $data.shelfTypeOptions,
"range-key": "text",
value: $data.selectedShelfTypeIndex,
onChange: _cache[10] || (_cache[10] = (...args) => $options.onShelfTypeChange && $options.onShelfTypeChange(...args)),
onChange: _cache[9] || (_cache[9] = (...args) => $options.onShelfTypeChange && $options.onShelfTypeChange(...args)),
style: { "font-size": "35rpx", "width": "200rpx", "font-weight": "" }
}, [
vue.createElementVNode(
@ -5620,7 +5655,7 @@ if (uni.restoreGlobal) {
vue.createCommentVNode(" 货架送回按钮 "),
vue.createElementVNode("button", {
style: { "width": "200rpx", "margin": "2rpx", "background": "green", "color": "white" },
onClick: _cache[11] || (_cache[11] = (...args) => $options.sendBackShelf && $options.sendBackShelf(...args))
onClick: _cache[10] || (_cache[10] = (...args) => $options.sendBackShelf && $options.sendBackShelf(...args))
}, "货架送回")
])
]);

View File

@ -154,7 +154,6 @@ namespace WCS.WebApi.Controllers
if (shelfInfo.TransStatus == TransStatusEnum.)
{
shelfInfo.ShelfCode = shelfInfo.ShelfCode + "(运输中)";
}
return new ResponseCommon()
{
Code = 301,
@ -162,6 +161,16 @@ namespace WCS.WebApi.Controllers
Data = null,
};
}
else
{
return new ResponseCommon()
{
Code = 301,
Message = $"当前工位[{locationInfo.LocationCode}]\r\n已被货架[{shelfInfo.ShelfCode}]占用\r\n请尝试解绑地码上的货架!",
Data = null,
};
}
}
#endregion
#region