1.绑定页面支持扫描物料的二维码 返回搜索条件所有的物料

This commit is contained in:
hehaibing-1996
2025-03-10 15:43:33 +08:00
parent f8516a1a03
commit 04d5eeadba
4 changed files with 100 additions and 41 deletions

View File

@ -14,7 +14,8 @@
<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"></input>
:placeholder="placeholderText" v-model="matCodeCondition" @focus="handleFocus"
@blur="handleBlur"></input>
</view>
<view style="flex: 3;">
@ -191,6 +192,7 @@
},
data() {
return {
isMatConditionFoucused: false,
isNeedScanLocationCode: true,
isNeedCallShelfCode: true,
@ -238,6 +240,14 @@
});
},
methods: {
handleFocus() {
console.log('foucus');
this.isMatConditionFoucused = true;
},
handleBlur() {
console.log('bulur');
this.isMatConditionFoucused = false;
},
//摄像头扫码
cameraScanCode() {
uni.scanCode({
@ -253,6 +263,11 @@
},
//扫码枪扫码
analysisScanCode: function(encodedString) {
console.log(this.isMatConditionFoucused);
if (this.isMatConditionFoucused) {
return;
}
// 去除末尾的逗号和"..."(如果有的话)
encodedString = encodedString.replace(/,\s*\.\.\.$/, '');
this.locationCode = encodedString;
@ -284,13 +299,13 @@
this.locationCode = res.data.data.locationCode;
this.shelfId = res.data.data.shelfId;
this.shelfCode = res.data.data.shelfCode;
this.shelfTypeOptions = res.data.data.shelfTypes;
var typeIndex = getConfig("bindSelectedShelfTypeIndex", 0);
if (typeIndex + 1 < this.shelfTypeOptions.length) {
this.selectedShelfTypeIndex = typeIndex;
}
this.shelfAreaOptions = res.data.data.locationArea;
var index = getConfig("bindSelectedShelfAreaIndex", 0);
if (index + 1 < this.shelfAreaOptions.length) {

View File

@ -57,7 +57,7 @@
"MatSpec": "",
"IsEnable": null,
"PageNumber": 1,
"PageSize": 20,
"PageSize": 300,
"UserName": this.userName,
"DeviceType": "PDA"
},

View File

@ -26,7 +26,8 @@
<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" @focus="handleFocus"
@blur="handleBlur"></input>
</view>
<view style="flex: 3;">
@ -204,8 +205,10 @@
},
data() {
return {
placeholderText: '请先扫描工位码',
isMatConditionFoucused : false,
matCodeCondition: '', //物料编码搜索条件
//工位ID 工位码
locationId: 0,
@ -237,6 +240,14 @@
});
},
methods: {
handleFocus() {
console.log('foucus');
this.isMatConditionFoucused = true;
},
handleBlur() {
console.log('bulur');
this.isMatConditionFoucused = false;
},
//摄像头扫码
cameraScanCode() {
uni.scanCode({
@ -252,6 +263,10 @@
},
//扫码获取工位信息
analysisScanCode: function(encodedString) {
if(this.isMatConditionFoucused)
{
return;
}
// 去除末尾的逗号和"..."(如果有的话)
encodedString = encodedString.replace(/,\s*\.\.\.$/, '');
this.locationCode = encodedString;

View File

@ -182,7 +182,7 @@ if (uni.restoreGlobal) {
methods: {
login() {
var serverIPAndPort = getServerIPAndPort();
formatAppLog("log", "at pages/index/index.vue:92", "http://" + serverIPAndPort + "/user/userLogin");
formatAppLog("log", "at pages/index/index.vue:93", "http://" + serverIPAndPort + "/user/userLogin");
uni.request({
url: "http://" + serverIPAndPort + "/user/userLogin",
// 请求的接口地址
@ -207,7 +207,7 @@ if (uni.restoreGlobal) {
});
saveConfig("userName", this.userName);
saveConfig("passWord", this.passWord);
formatAppLog("log", "at pages/index/index.vue:118", res.data.data.getRoles[0].authNames);
formatAppLog("log", "at pages/index/index.vue:119", res.data.data.getRoles[0].authNames);
saveConfig("roleName", res.data.data.getRoles[0].authNames);
uni.redirectTo({
url: "/pages/main/main"
@ -231,7 +231,7 @@ if (uni.restoreGlobal) {
});
},
complete: (event) => {
formatAppLog("log", "at pages/index/index.vue:147", "请求完成", event);
formatAppLog("log", "at pages/index/index.vue:148", "请求完成", event);
}
});
}
@ -319,7 +319,8 @@ if (uni.restoreGlobal) {
vue.toDisplayString($data.serverIPAndPort),
1
/* TEXT */
)
),
vue.createElementVNode("view", null, "V1.0")
])
]);
}
@ -654,7 +655,7 @@ if (uni.restoreGlobal) {
"MatSpec": "",
"IsEnable": null,
"PageNumber": 1,
"PageSize": 20,
"PageSize": 300,
"UserName": this.userName,
"DeviceType": "PDA"
},
@ -779,6 +780,7 @@ if (uni.restoreGlobal) {
},
data() {
return {
isMatConditionFoucused: false,
isNeedScanLocationCode: true,
isNeedCallShelfCode: true,
placeholderText: "请先扫描工位码",
@ -818,27 +820,39 @@ if (uni.restoreGlobal) {
this.userName = getConfig("userName", "admin");
const self = this;
recive(function(res) {
formatAppLog("log", "at pages/bind/bind.vue:234", "Success:" + res.data);
formatAppLog("log", "at pages/bind/bind.vue:236", "Success:" + res.data);
self.analysisScanCode(res.data);
}, function(err) {
formatAppLog("log", "at pages/bind/bind.vue:237", "Error:", JSON.stringify(err));
formatAppLog("log", "at pages/bind/bind.vue:239", "Error:", JSON.stringify(err));
});
},
methods: {
handleFocus() {
formatAppLog("log", "at pages/bind/bind.vue:244", "foucus");
this.isMatConditionFoucused = true;
},
handleBlur() {
formatAppLog("log", "at pages/bind/bind.vue:248", "bulur");
this.isMatConditionFoucused = false;
},
//摄像头扫码
cameraScanCode() {
uni.scanCode({
success: (res) => {
formatAppLog("log", "at pages/bind/bind.vue:245", "扫码结果:", res.result);
formatAppLog("log", "at pages/bind/bind.vue:255", "扫码结果:", res.result);
this.analysisScanCode(res.result);
},
fail: (err) => {
formatAppLog("error", "at pages/bind/bind.vue:249", "扫码失败:", err);
formatAppLog("error", "at pages/bind/bind.vue:259", "扫码失败:", err);
}
});
},
//扫码枪扫码
analysisScanCode: function(encodedString) {
formatAppLog("log", "at pages/bind/bind.vue:266", this.isMatConditionFoucused);
if (this.isMatConditionFoucused) {
return;
}
encodedString = encodedString.replace(/,\s*\.\.\.$/, "");
this.locationCode = encodedString;
this.getShelfInfoByLocationCode(true);
@ -924,12 +938,12 @@ if (uni.restoreGlobal) {
}
},
complete: (event) => {
formatAppLog("log", "at pages/bind/bind.vue:358", "请求完成", event);
formatAppLog("log", "at pages/bind/bind.vue:373", "请求完成", event);
}
});
},
bindSelectedMat: function(item) {
formatAppLog("log", "at pages/bind/bind.vue:364", "用户选择了项目:", item);
formatAppLog("log", "at pages/bind/bind.vue:379", "用户选择了项目:", item);
this.matCode = item.matCode;
this.matName = item.matName;
this.matSpec = item.matSpec;
@ -994,7 +1008,7 @@ if (uni.restoreGlobal) {
});
},
complete: (event) => {
formatAppLog("log", "at pages/bind/bind.vue:433", "请求完成", event);
formatAppLog("log", "at pages/bind/bind.vue:448", "请求完成", event);
}
});
},
@ -1099,7 +1113,7 @@ if (uni.restoreGlobal) {
});
},
complete: (event) => {
formatAppLog("log", "at pages/bind/bind.vue:547", "请求完成", event);
formatAppLog("log", "at pages/bind/bind.vue:562", "请求完成", event);
}
});
},
@ -1190,7 +1204,7 @@ if (uni.restoreGlobal) {
});
},
complete: (event) => {
formatAppLog("log", "at pages/bind/bind.vue:649", "请求完成", event);
formatAppLog("log", "at pages/bind/bind.vue:664", "请求完成", event);
}
});
},
@ -1218,7 +1232,7 @@ if (uni.restoreGlobal) {
this.matQty = 0;
},
handlePopupClose() {
formatAppLog("log", "at pages/bind/bind.vue:681", "弹出层已关闭");
formatAppLog("log", "at pages/bind/bind.vue:696", "弹出层已关闭");
}
}
};
@ -1256,15 +1270,17 @@ if (uni.restoreGlobal) {
class: "uni-input",
style: { "font-size": "50rpx", "padding": "10rpx" },
placeholder: $data.placeholderText,
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $data.matCodeCondition = $event)
}, null, 8, ["placeholder"]), [
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $data.matCodeCondition = $event),
onFocus: _cache[2] || (_cache[2] = (...args) => $options.handleFocus && $options.handleFocus(...args)),
onBlur: _cache[3] || (_cache[3] = (...args) => $options.handleBlur && $options.handleBlur(...args))
}, null, 40, ["placeholder"]), [
[vue.vModelText, $data.matCodeCondition]
])
]),
vue.createElementVNode("view", { style: { "flex": "3" } }),
vue.createElementVNode("view", { style: { "flex": "30" } }, [
vue.createElementVNode("button", {
onClick: _cache[2] || (_cache[2] = (...args) => $options.queryMatList && $options.queryMatList(...args))
onClick: _cache[4] || (_cache[4] = (...args) => $options.queryMatList && $options.queryMatList(...args))
}, "查询")
])
])
@ -1289,7 +1305,7 @@ if (uni.restoreGlobal) {
}, [
vue.createElementVNode("picker", {
range: $data.shelfTypeOptions,
onChange: _cache[3] || (_cache[3] = (...args) => $options.shelfTypeOptionChange && $options.shelfTypeOptionChange(...args)),
onChange: _cache[5] || (_cache[5] = (...args) => $options.shelfTypeOptionChange && $options.shelfTypeOptionChange(...args)),
"range-key": "shelfTypeName",
value: $data.selectedShelfTypeIndex,
style: { "font-size": "35rpx" }
@ -1312,7 +1328,7 @@ if (uni.restoreGlobal) {
class: "mini-btn",
type: "warn",
size: "mini",
onClick: _cache[4] || (_cache[4] = (...args) => $options.callEmptyShelf && $options.callEmptyShelf(...args))
onClick: _cache[6] || (_cache[6] = (...args) => $options.callEmptyShelf && $options.callEmptyShelf(...args))
}, "呼叫货架")
])
]),
@ -1404,7 +1420,7 @@ if (uni.restoreGlobal) {
class: "uni-input",
style: { "font-size": "40rpx" },
placeholder: "请输入批次",
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => $data.matBatch = $event)
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => $data.matBatch = $event)
},
null,
512
@ -1432,7 +1448,7 @@ if (uni.restoreGlobal) {
type: "number",
style: { "font-size": "40rpx" },
placeholder: "请输入物料数量",
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => $data.matQty = $event)
"onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => $data.matQty = $event)
},
null,
512
@ -1443,7 +1459,7 @@ if (uni.restoreGlobal) {
]),
vue.createElementVNode("view", { style: { "flex": "40" } }, [
vue.createElementVNode("button", {
onClick: _cache[7] || (_cache[7] = (...args) => $options.bind && $options.bind(...args)),
onClick: _cache[9] || (_cache[9] = (...args) => $options.bind && $options.bind(...args)),
class: "mini-btn",
style: { "margin-left": "10rpx" },
type: "warn",
@ -1461,7 +1477,7 @@ if (uni.restoreGlobal) {
range: $data.shelfAreaOptions,
"range-key": "locationAreaName",
value: $data.selectedShelfAreaIndex,
onChange: _cache[8] || (_cache[8] = (...args) => $options.onShelfAreaChange && $options.onShelfAreaChange(...args)),
onChange: _cache[10] || (_cache[10] = (...args) => $options.onShelfAreaChange && $options.onShelfAreaChange(...args)),
style: { "font-size": "35rpx" }
}, [
vue.createElementVNode(
@ -1476,7 +1492,7 @@ if (uni.restoreGlobal) {
vue.createElementVNode("button", {
style: { "font-size": "40rpx", "margin": "15rpx", "background-color": "green" },
size: "mini",
onClick: _cache[9] || (_cache[9] = (...args) => $options.sendShelfBack && $options.sendShelfBack(...args))
onClick: _cache[11] || (_cache[11] = (...args) => $options.sendShelfBack && $options.sendShelfBack(...args))
}, "送货架")
])
])
@ -4522,6 +4538,7 @@ if (uni.restoreGlobal) {
data() {
return {
placeholderText: "请先扫描工位码",
isMatConditionFoucused: false,
matCodeCondition: "",
//物料编码搜索条件
//工位ID 工位码
@ -4546,27 +4563,38 @@ if (uni.restoreGlobal) {
this.userName = getConfig("userName", "admin");
const self = this;
recive(function(res) {
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:232", "Success:" + res.data);
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:235", "Success:" + res.data);
self.analysisScanCode(res.data);
}, function(err) {
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:236", "Error:", JSON.stringify(err));
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:239", "Error:", JSON.stringify(err));
});
},
methods: {
handleFocus() {
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:244", "foucus");
this.isMatConditionFoucused = true;
},
handleBlur() {
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:248", "bulur");
this.isMatConditionFoucused = false;
},
//摄像头扫码
cameraScanCode() {
uni.scanCode({
success: (res) => {
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:244", "扫码结果:", res.result);
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:255", "扫码结果:", res.result);
this.analysisScanCode(res.result);
},
fail: (err) => {
formatAppLog("error", "at pages/productionLineCallIn/productionLineCallIn.vue:248", "扫码失败:", err);
formatAppLog("error", "at pages/productionLineCallIn/productionLineCallIn.vue:259", "扫码失败:", err);
}
});
},
//扫码获取工位信息
analysisScanCode: function(encodedString) {
if (this.isMatConditionFoucused) {
return;
}
encodedString = encodedString.replace(/,\s*\.\.\.$/, "");
this.locationCode = encodedString;
var serverIPAndPort = getServerIPAndPort();
@ -4626,7 +4654,7 @@ if (uni.restoreGlobal) {
this.clearLocation();
},
complete: (event) => {
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:329", "请求完成", event);
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:344", "请求完成", event);
}
});
},
@ -4718,7 +4746,7 @@ if (uni.restoreGlobal) {
}
},
complete: (event) => {
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:433", "请求完成", event);
formatAppLog("log", "at pages/productionLineCallIn/productionLineCallIn.vue:448", "请求完成", event);
}
});
},
@ -4821,7 +4849,8 @@ if (uni.restoreGlobal) {
style: { "font-size": "50rpx", "padding": "10rpx" },
placeholder: $data.placeholderText,
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $data.matCodeCondition = $event),
onBlur: _cache[4] || (_cache[4] = (...args) => $options.queryMatList && $options.queryMatList(...args))
onFocus: _cache[4] || (_cache[4] = (...args) => $options.handleFocus && $options.handleFocus(...args)),
onBlur: _cache[5] || (_cache[5] = (...args) => $options.handleBlur && $options.handleBlur(...args))
}, null, 40, ["placeholder"]), [
[vue.vModelText, $data.matCodeCondition]
])
@ -4829,7 +4858,7 @@ if (uni.restoreGlobal) {
vue.createElementVNode("view", { style: { "flex": "3" } }),
vue.createElementVNode("view", { style: { "flex": "30" } }, [
vue.createElementVNode("button", {
onClick: _cache[5] || (_cache[5] = ($event) => $options.queryMatList(true))
onClick: _cache[6] || (_cache[6] = ($event) => $options.queryMatList(true))
}, "查询")
])
])
@ -4875,8 +4904,8 @@ if (uni.restoreGlobal) {
vue.renderList($data.cardData, (item, index) => {
return vue.openBlock(), vue.createElementBlock("view", {
key: index,
onTouchstart: _cache[6] || (_cache[6] = (...args) => $options.cardTouchStart && $options.cardTouchStart(...args)),
onTouchmove: _cache[7] || (_cache[7] = (...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, {