优化绑定查询功能

This commit is contained in:
hehaibing-1996
2025-02-13 10:02:49 +08:00
parent b23d568bb1
commit f3d825333c
6 changed files with 162 additions and 82 deletions

View File

@ -16,17 +16,13 @@
<text>数量:</text> <text>数量:</text>
<text>{{item.matQty}}</text> <text>{{item.matQty}}</text>
</view> </view>
<view class="content-item" style="font-weight: 600;">
<text>盘点数量:</text>
<text>{{item.stocktakingQty}}</text>
</view>
<view class="content-combined"> <view class="content-combined">
<view class="content-item" style="font-weight: 600;color: firebrick;"> <view class="content-item" style="font-weight: 400;color: firebrick;">
<text>库位:</text> <text>库位:</text>
<text>{{item.locationCode}}</text> <text>{{item.locationCode}}</text>
</view> </view>
<view class="content-item" style="font-weight: 600;color: firebrick;"> <view class="content-item" style="font-weight: 400;color: firebrick;">
<text>货架编码:</text> <text>货架:</text>
<text>{{item.shelfCode}}</text> <text>{{item.shelfCode}}</text>
</view> </view>
</view> </view>

View File

@ -27,7 +27,7 @@
<text>{{item.locationCode}}</text> <text>{{item.locationCode}}</text>
</view> </view>
<view class="content-item" style="font-weight: 600;color: firebrick;"> <view class="content-item" style="font-weight: 600;color: firebrick;">
<text>货架编码:</text> <text>货架:</text>
<text>{{item.shelfCode}}</text> <text>{{item.shelfCode}}</text>
</view> </view>
</view> </view>

View File

@ -62,6 +62,34 @@
</view> </view>
<view style="flex: 1;"></view> <view style="flex: 1;"></view>
</view> </view>
<view style="display: flex;flex-direction: row;margin-bottom: 10rpx;margin-top: 30rpx;">
<view style="flex: 1;"></view>
<view class="uni-flex uni-column" style="flex: 5;">
<navigator url="../bind/bind" hover-class="navigator-hover">
<view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;">
<image class="function-image" src="/static/shelfLocation.png" />
</view>
<view class="function-text">货架位置</view>
</navigator>
</view>
<view class="uni-flex uni-column" style="flex: 5;">
<!-- <navigator url="../stockTaking/stockTaking" hover-class="navigator-hover">
<view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;">
<image class="function-image" src="/static/stockTaking.png" />
</view>
<view class="function-text">库存盘点</view>
</navigator> -->
</view>
<view class="uni-flex uni-column" style="flex: 5;">
<!-- <view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;">
<image class="function-image" src="/static/task.png" />
</view>
<view class="function-text">任务管理</view> -->
</view>
<view style="flex: 1;"></view>
</view>
</view> </view>
</template> </template>

View File

@ -69,7 +69,8 @@
<view class="diy-flex-column" style="margin-top: 5rpx;"> <view class="diy-flex-column" style="margin-top: 5rpx;">
<scroll-view class="scroll-view" scroll-y="true"> <scroll-view class="scroll-view" scroll-y="true">
<view v-for="(item, index) in cardData" :key="index" @longpress="longpress(item)"> <view v-for="(item, index) in cardData" :key="index" @touchstart="cardTouchStart"
@touchmove="cardTouchMove" @longpress="longpress(item)">
<Card :item="item" :currentIndex="index" :cardData="cardData" /> <Card :item="item" :currentIndex="index" :cardData="cardData" />
</view> </view>
</scroll-view> </scroll-view>
@ -108,6 +109,9 @@
nextTick nextTick
} from 'vue'; } from 'vue';
import uniPopup from '@/node_modules/@dcloudio/uni-ui/lib/uni-popup/uni-popup'; import uniPopup from '@/node_modules/@dcloudio/uni-ui/lib/uni-popup/uni-popup';
import {
getCurrentInstance
} from 'vue';
export default { export default {
components: { components: {
@ -115,6 +119,9 @@
Card Card
}, },
setup() { setup() {
const {
proxy
} = getCurrentInstance();
// 不能修改的信息 // 不能修改的信息
const fixedInfo = { const fixedInfo = {
infoId: 0, infoId: 0,
@ -136,9 +143,6 @@
inputValue.value = info.matQty; inputValue.value = info.matQty;
popup.value.open(); popup.value.open();
// nextTick(() => {
// inputRef.value.focus();
// });
}; };
const hidePopup = () => { const hidePopup = () => {
@ -175,7 +179,8 @@
//调用接口进行数量的修改 //调用接口进行数量的修改
uni.request({ uni.request({
url: 'http://' + serverIPAndPort +'/matDetailCurrenInfo/updateMatDetailCurrentInfoById', // 请求的接口地址 url: 'http://' + serverIPAndPort +
'/matDetailCurrenInfo/updateMatDetailCurrentInfoById', // 请求的接口地址
method: 'POST', // 设置请求方式为 POST method: 'POST', // 设置请求方式为 POST
data: { data: {
"matQty": inputValue.value, "matQty": inputValue.value,
@ -191,13 +196,14 @@
if (res.statusCode === 200) { if (res.statusCode === 200) {
//接口返回数据为200 表示获取成功! //接口返回数据为200 表示获取成功!
if (res.data.code == 200) { if (res.data.code == 200) {
hidePopup();
uni.showToast({ uni.showToast({
title: '修改成功!', title: '修改成功!',
icon: 'none', icon: 'none',
duration: 1200 duration: 2000
}); });
hidePopup();
proxy.queryMatList();
} else { } else {
uni.showToast({ uni.showToast({
title: '修改失败:' + res.data.message, title: '修改失败:' + res.data.message,
@ -257,6 +263,11 @@
placeholderText: '请先扫描货架码', placeholderText: '请先扫描货架码',
matCodeCondition: '', //物料编码搜索条件 matCodeCondition: '', //物料编码搜索条件
cardData: null, cardData: null,
//监控滑动的位置
touchStartX: 0,
touchStartY: 0,
isMove: false, //滑动标识 是否滑动
} }
}, },
onShow: function() { onShow: function() {
@ -274,21 +285,21 @@
analysisScanCode: function(encodedString) { analysisScanCode: function(encodedString) {
// 去除末尾的逗号和"..."(如果有的话) // 去除末尾的逗号和"..."(如果有的话)
encodedString = encodedString.replace(/,\s*\.\.\.$/, ''); encodedString = encodedString.replace(/,\s*\.\.\.$/, '');
// 分割字符串并转换为字节数组 // // 分割字符串并转换为字节数组
let byteStrings = encodedString.split(','); // let byteStrings = encodedString.split(',');
let byteArray = []; // let byteArray = [];
for (let byteString of byteStrings) { // for (let byteString of byteStrings) {
byteArray.push(parseInt(byteString, 10)); // 将字符串转换为十进制整数 // byteArray.push(parseInt(byteString, 10)); // 将字符串转换为十进制整数
} // }
// 将字节数组转换为UTF-8字符串 // // 将字节数组转换为UTF-8字符串
// 注意这里使用了一个简单的循环来构建字符串因为String.fromCharCode.apply可能在大数据上性能不佳 // // 注意这里使用了一个简单的循环来构建字符串因为String.fromCharCode.apply可能在大数据上性能不佳
let originalString = ''; // let originalString = '';
for (let i = 0; i < byteArray.length; i++) { // for (let i = 0; i < byteArray.length; i++) {
// 对于每个字节使用fromCharCode转换为对应的字符 // // 对于每个字节使用fromCharCode转换为对应的字符
// 注意这里假设你的字节数组已经是正确的UTF-8编码并且不需要额外的处理来组合多字节字符 // // 注意这里假设你的字节数组已经是正确的UTF-8编码并且不需要额外的处理来组合多字节字符
originalString += String.fromCharCode(byteArray[i]); // originalString += String.fromCharCode(byteArray[i]);
} // }
this.shelfCode = originalString; this.shelfCode = encodedString;
//调用接口获取当前工位信息 当前工位是否有货架 //调用接口获取当前工位信息 当前工位是否有货架
var serverIPAndPort = getServerIPAndPort(); var serverIPAndPort = getServerIPAndPort();
uni.request({ uni.request({
@ -301,7 +312,7 @@
"userName": this.userName, "userName": this.userName,
"deviceType": "PDA", "deviceType": "PDA",
"pageNumber": 1, "pageNumber": 1,
"pageSize": 100 "pageSize": 300,
}, },
header: { header: {
'Content-Type': 'application/json', // 如果需要以JSON格式发送数据 'Content-Type': 'application/json', // 如果需要以JSON格式发送数据
@ -375,8 +386,6 @@
}); });
return; return;
} }
var serverIPAndPort = getServerIPAndPort(); var serverIPAndPort = getServerIPAndPort();
uni.request({ uni.request({
url: 'http://' + serverIPAndPort + url: 'http://' + serverIPAndPort +
@ -388,7 +397,7 @@
"userName": this.userName, "userName": this.userName,
"deviceType": "PDA", "deviceType": "PDA",
"pageNumber": 1, "pageNumber": 1,
"pageSize": 100 "pageSize": 300
}, },
header: { header: {
'Content-Type': 'application/json', // 如果需要以JSON格式发送数据 'Content-Type': 'application/json', // 如果需要以JSON格式发送数据
@ -459,18 +468,24 @@
this.cardData = null; this.cardData = null;
this.recordCount = 0; this.recordCount = 0;
}, },
//解决长按和滑动冲突的问题
cardTouchStart(e) {
this.isMove = false;
this.touchStartX = e.touches[0].clientX;
this.touchStartY = e.touches[0].clientY;
},
cardTouchMove(e) {
var deltaX = e.changedTouches[0].clientX - this.touchStartX;
var deltaY = e.changedTouches[0].clientY - this.touchStartY;
if (Math.abs(deltaX) > 5 || Math.abs(deltaY) > 5) {
this.isMove = true;
}
},
//长按 //长按
longpress(item) { longpress(item) {
// uni.showToast({ if (this.isMove == false) {
// title: '您长按了' + item.matCode, this.showPopup(item);
// icon: 'none', }
// duration: 1500
// });
this.showPopup(item);
//this.$refs.popup.open();
}, },
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -381,6 +381,7 @@ if (uni.restoreGlobal) {
const _imports_4 = "/static/callOut.png"; const _imports_4 = "/static/callOut.png";
const _imports_5 = "/static/stockTaking.png"; const _imports_5 = "/static/stockTaking.png";
const _imports_6 = "/static/task.png"; const _imports_6 = "/static/task.png";
const _imports_7 = "/static/shelfLocation.png";
const _sfc_main$a = { const _sfc_main$a = {
data() { data() {
return {}; return {};
@ -520,6 +521,42 @@ if (uni.restoreGlobal) {
vue.createElementVNode("view", { class: "function-text" }, "任务管理") vue.createElementVNode("view", { class: "function-text" }, "任务管理")
]), ]),
vue.createElementVNode("view", { style: { "flex": "1" } }) vue.createElementVNode("view", { style: { "flex": "1" } })
]),
vue.createElementVNode("view", { style: { "display": "flex", "flex-direction": "row", "margin-bottom": "10rpx", "margin-top": "30rpx" } }, [
vue.createElementVNode("view", { style: { "flex": "1" } }),
vue.createElementVNode("view", {
class: "uni-flex uni-column",
style: { "flex": "5" }
}, [
vue.createElementVNode("navigator", {
url: "../bind/bind",
"hover-class": "navigator-hover"
}, [
vue.createElementVNode("view", {
class: "uni-flex uni-row",
style: { "-webkit-justify-content": "center", "justify-content": "center" }
}, [
vue.createElementVNode("image", {
class: "function-image",
src: _imports_7
})
]),
vue.createElementVNode("view", { class: "function-text" }, "货架位置")
])
]),
vue.createElementVNode("view", {
class: "uni-flex uni-column",
style: { "flex": "5" }
}, [
vue.createCommentVNode(' <navigator url="../stockTaking/stockTaking" hover-class="navigator-hover">\r\n <view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;">\r\n <image class="function-image" src="/static/stockTaking.png" />\r\n </view>\r\n <view class="function-text">库存盘点</view>\r\n </navigator> ')
]),
vue.createElementVNode("view", {
class: "uni-flex uni-column",
style: { "flex": "5" }
}, [
vue.createCommentVNode(' <view class="uni-flex uni-row" style="-webkit-justify-content: center;justify-content: center;">\r\n <image class="function-image" src="/static/task.png" />\r\n </view>\r\n <view class="function-text">任务管理</view> ')
]),
vue.createElementVNode("view", { style: { "flex": "1" } })
]) ])
]); ]);
} }
@ -1877,23 +1914,10 @@ if (uni.restoreGlobal) {
/* TEXT */ /* TEXT */
) )
]), ]),
vue.createElementVNode("view", {
class: "content-item",
style: { "font-weight": "600" }
}, [
vue.createElementVNode("text", null, "盘点数量:"),
vue.createElementVNode(
"text",
null,
vue.toDisplayString($props.item.stocktakingQty),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "content-combined" }, [ vue.createElementVNode("view", { class: "content-combined" }, [
vue.createElementVNode("view", { vue.createElementVNode("view", {
class: "content-item", class: "content-item",
style: { "font-weight": "600", "color": "firebrick" } style: { "font-weight": "400", "color": "firebrick" }
}, [ }, [
vue.createElementVNode("text", null, "库位:"), vue.createElementVNode("text", null, "库位:"),
vue.createElementVNode( vue.createElementVNode(
@ -1906,9 +1930,9 @@ if (uni.restoreGlobal) {
]), ]),
vue.createElementVNode("view", { vue.createElementVNode("view", {
class: "content-item", class: "content-item",
style: { "font-weight": "600", "color": "firebrick" } style: { "font-weight": "400", "color": "firebrick" }
}, [ }, [
vue.createElementVNode("text", null, "货架编码:"), vue.createElementVNode("text", null, "货架:"),
vue.createElementVNode( vue.createElementVNode(
"text", "text",
null, null,
@ -2367,6 +2391,9 @@ if (uni.restoreGlobal) {
Card Card
}, },
setup() { setup() {
const {
proxy
} = vue.getCurrentInstance();
const fixedInfo = { const fixedInfo = {
infoId: 0, infoId: 0,
matCode: "示例名称", matCode: "示例名称",
@ -2433,12 +2460,13 @@ if (uni.restoreGlobal) {
success: (res) => { success: (res) => {
if (res.statusCode === 200) { if (res.statusCode === 200) {
if (res.data.code == 200) { if (res.data.code == 200) {
hidePopup();
uni.showToast({ uni.showToast({
title: "修改成功!", title: "修改成功!",
icon: "none", icon: "none",
duration: 1200 duration: 2e3
}); });
hidePopup(); proxy.queryMatList();
} else { } else {
uni.showToast({ uni.showToast({
title: "修改失败:" + res.data.message, title: "修改失败:" + res.data.message,
@ -2487,32 +2515,28 @@ if (uni.restoreGlobal) {
placeholderText: "请先扫描货架码", placeholderText: "请先扫描货架码",
matCodeCondition: "", matCodeCondition: "",
//物料编码搜索条件 //物料编码搜索条件
cardData: null cardData: null,
//监控滑动的位置
touchStartX: 0,
touchStartY: 0,
isMove: false
//滑动标识 是否滑动
}; };
}, },
onShow: function() { onShow: function() {
this.userName = getConfig("userName", "admin"); this.userName = getConfig("userName", "admin");
const self = this; const self = this;
recive(function(res) { recive(function(res) {
formatAppLog("log", "at pages/queryBindList/queryBindList.vue:267", "Success:" + res.data); formatAppLog("log", "at pages/queryBindList/queryBindList.vue:278", "Success:" + res.data);
self.analysisScanCode(res.data); self.analysisScanCode(res.data);
}, function(err) { }, function(err) {
formatAppLog("log", "at pages/queryBindList/queryBindList.vue:270", "Error:", JSON.stringify(err)); formatAppLog("log", "at pages/queryBindList/queryBindList.vue:281", "Error:", JSON.stringify(err));
}); });
}, },
methods: { methods: {
analysisScanCode: function(encodedString) { analysisScanCode: function(encodedString) {
encodedString = encodedString.replace(/,\s*\.\.\.$/, ""); encodedString = encodedString.replace(/,\s*\.\.\.$/, "");
let byteStrings = encodedString.split(","); this.shelfCode = encodedString;
let byteArray = [];
for (let byteString of byteStrings) {
byteArray.push(parseInt(byteString, 10));
}
let originalString = "";
for (let i = 0; i < byteArray.length; i++) {
originalString += String.fromCharCode(byteArray[i]);
}
this.shelfCode = originalString;
var serverIPAndPort = getServerIPAndPort(); var serverIPAndPort = getServerIPAndPort();
uni.request({ uni.request({
url: "http://" + serverIPAndPort + "/matDetailCurrenInfo/getMatDetailCurrentInfos", url: "http://" + serverIPAndPort + "/matDetailCurrenInfo/getMatDetailCurrentInfos",
@ -2525,7 +2549,7 @@ if (uni.restoreGlobal) {
"userName": this.userName, "userName": this.userName,
"deviceType": "PDA", "deviceType": "PDA",
"pageNumber": 1, "pageNumber": 1,
"pageSize": 100 "pageSize": 300
}, },
header: { header: {
"Content-Type": "application/json" "Content-Type": "application/json"
@ -2575,7 +2599,7 @@ if (uni.restoreGlobal) {
this.clear(); this.clear();
}, },
complete: (event) => { complete: (event) => {
formatAppLog("log", "at pages/queryBindList/queryBindList.vue:362", "请求完成", event); formatAppLog("log", "at pages/queryBindList/queryBindList.vue:373", "请求完成", event);
} }
}); });
}, },
@ -2600,7 +2624,7 @@ if (uni.restoreGlobal) {
"userName": this.userName, "userName": this.userName,
"deviceType": "PDA", "deviceType": "PDA",
"pageNumber": 1, "pageNumber": 1,
"pageSize": 100 "pageSize": 300
}, },
header: { header: {
"Content-Type": "application/json" "Content-Type": "application/json"
@ -2650,7 +2674,7 @@ if (uni.restoreGlobal) {
this.clear(); this.clear();
}, },
complete: (event) => { complete: (event) => {
formatAppLog("log", "at pages/queryBindList/queryBindList.vue:449", "请求完成", event); formatAppLog("log", "at pages/queryBindList/queryBindList.vue:458", "请求完成", event);
} }
}); });
}, },
@ -2660,9 +2684,24 @@ if (uni.restoreGlobal) {
this.cardData = null; this.cardData = null;
this.recordCount = 0; this.recordCount = 0;
}, },
//解决长按和滑动冲突的问题
cardTouchStart(e) {
this.isMove = false;
this.touchStartX = e.touches[0].clientX;
this.touchStartY = e.touches[0].clientY;
},
cardTouchMove(e) {
var deltaX = e.changedTouches[0].clientX - this.touchStartX;
var deltaY = e.changedTouches[0].clientY - this.touchStartY;
if (Math.abs(deltaX) > 5 || Math.abs(deltaY) > 5) {
this.isMove = true;
}
},
//长按 //长按
longpress(item) { longpress(item) {
this.showPopup(item); if (this.isMove == false) {
this.showPopup(item);
}
} }
} }
}; };
@ -2829,6 +2868,8 @@ if (uni.restoreGlobal) {
vue.renderList($data.cardData, (item, index) => { vue.renderList($data.cardData, (item, index) => {
return vue.openBlock(), vue.createElementBlock("view", { return vue.openBlock(), vue.createElementBlock("view", {
key: index, key: index,
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) onLongpress: ($event) => $options.longpress(item)
}, [ }, [
vue.createVNode(_component_Card, { vue.createVNode(_component_Card, {
@ -2946,7 +2987,7 @@ if (uni.restoreGlobal) {
class: "content-item", class: "content-item",
style: { "font-weight": "600", "color": "firebrick" } style: { "font-weight": "600", "color": "firebrick" }
}, [ }, [
vue.createElementVNode("text", null, "货架编码:"), vue.createElementVNode("text", null, "货架:"),
vue.createElementVNode( vue.createElementVNode(
"text", "text",
null, null,