添加标签扫码功能

This commit is contained in:
2024-05-15 11:08:12 +08:00
parent 42de9a8fc8
commit 205d38d57f
6 changed files with 170 additions and 3 deletions

View File

@@ -126,6 +126,13 @@
type: 3,
index: 10
},
{
name: '标签扫码',
icon: 'scan',
url: '/pages/scan/scan',
type: 3,
index: 14
},
{
name: '拼箱',
icon: 'grid-fill',

96
pages/scan/scan.vue Normal file
View File

@@ -0,0 +1,96 @@
<template>
<!-- 扫码查看信息 -->
<view class="common-nav-container">
<view style="padding: 10px;">
<u-input prefixIcon="scan" prefixIconStyle="font-size: 22px;color: #909399" placeholder="请扫箱标签"
border="surround" v-model.trim="formData.query" @change="queryChange" clearable></u-input>
</view>
<u-list height="500px">
<u-list-item v-for="(item, index) in packageData" :key="index">
<u-cell :title="packageTitle[index]">
<u--text slot="value" type="info" :text="item" bold size="36"></u--text>
</u-cell>
</u-list-item>
</u-list>
</view>
</template>
<script>
import * as WarehoseApi from '@/api/warehouse/warehose.js';
export default {
data() {
return {
formData: {
query: ""
},
// 扫码类型
type: 0,
packageTitle: {
"workoderID": "工单号:",
"patchCode": "批次号:",
"partNumner": "零件号:",
"productionDescribe": "描述:",
"productionTime": "生产日期:",
"quantity": "数量:",
"team": "组:",
"remark": "备注:",
"originalCode": "扫码结果:",
},
packageData: {
"workoderID": "",
"patchCode": "",
"partNumner": "",
"productionDescribe": "",
"productionTime": "",
"quantity": null,
"team": "",
"remark": "",
"originalCode": "",
}
}
},
methods: {
// 扫标签码时,自动进行翻译
async queryChange(value) {
if (value === null || value === "") {
return;
}
if (value.length < 40) {
return;
}
let package_code = value;
let resolutionData = {
code: package_code
};
const emitRes = await WarehoseApi.resolutionPackage(resolutionData);
if (emitRes.code !== 200 || emitRes.data === null) {
uni.showModal({
title: '提示',
content: '该箱号数据解析异常!',
showCancel: false,
confirmText: '确定'
});
return;
}
setTimeout(() => {
this.formData.query = "";
this.packageData = {
"workoderID": emitRes.data.workoderID,
"patchCode": emitRes.data.patchCode,
"partNumner": emitRes.data.partNumner,
"productionDescribe": emitRes.data.productionDescribe,
"productionTime": emitRes.data.productionTime,
"quantity": emitRes.data.quantity,
"team": emitRes.data.team,
"remark": emitRes.data.remark,
"originalCode": emitRes.data.originalCode,
}
}, 100)
}
}
}
</script>
<style>
</style>

View File

@@ -3,7 +3,7 @@
<u-subsection :list="typeOptions" :current="queryForm.type" key-name="label" @change="subsectionChange"
fontSize="36"></u-subsection>
<u-input v-model="queryForm.description" placeholder="请输入模糊批次号" clearable prefixIcon="search"
prefixIconStyle="font-size: 22px;color: #909399">
prefixIconStyle="font-size: 22px;color: #909399" @change="queryChange">
<template slot="suffix">
<u-button @click="getList" type="primary" size="mini">搜索</u-button>
</template>
@@ -57,6 +57,7 @@
<script>
import * as goodsChangeLogApi from '@/api/warehouse/wmGoodsChangeLog.js';
import * as WarehoseApi from '@/api/warehouse/warehose.js';
export default {
data() {
return {
@@ -212,6 +213,33 @@
if (page * size < total) {
this.getList(true);
}
},
// 扫标签码时,自动进行翻译
async queryChange(value) {
if (value === null || value === "") {
return;
}
if (value.length < 40) {
return;
}
let package_code = value;
let resolutionData = {
code: package_code
};
const emitRes = await WarehoseApi.resolutionPackage(resolutionData);
if (emitRes.code !== 200 || emitRes.data === null) {
uni.showModal({
title: '提示',
content: '该箱号数据解析异常!',
showCancel: false,
confirmText: '确定'
});
return;
}
setTimeout(() => {
this.queryForm.description = emitRes.data.patchCode;
this.getList();
}, 100)
}
}
}

View File

@@ -3,7 +3,7 @@
<u-list height="640px">
<u-list-item v-for="(item, index) in dataList" :key="index">
<u-cell :title="'批次号:'+item.packageCodeClient"
:label="'零件号:'+item.partnumber + '\n库位:'+item.locationCode + '\n入库时间:'+item.entryWarehouseTime + '\n备注:'+item.remark"
:label="'零件号:'+item.partnumber + '\n描述:'+item.description + '\n库位:'+item.locationCode + '\n入库时间:'+item.entryWarehouseTime + '\n备注:'+item.remark"
:value="'零件数:'+item.goodsNumAction">
</u-cell>
</u-list-item>

View File

@@ -1,7 +1,7 @@
<template>
<view class="common-nav-container">
<u-search placeholder="请填写零件号或批次号" borderColor="#c8c9cc" v-model.trim="formData.query" bgColor="#f4f4f5"
shape="square" searchIconSize="48" @search="getList()" @custom="getList()"></u-search>
shape="square" searchIconSize="48" @search="getList()" @custom="getList()" @change="queryChange"></u-search>
<u-list @scrolltolower="scrolltolower" height="590px">
<u-list-item v-for="(item, index) in dataList" :key="index">
<u-cell :title="'批次号:'+item.shortPackageCode" :label="'零件号:'+item.partnumber"
@@ -51,6 +51,7 @@
<script>
import * as watchGoodsApi from '@/api/watchGoods/watchGoods.js';
import * as WarehoseApi from '@/api/warehouse/warehose.js';
export default {
data() {
return {
@@ -127,6 +128,33 @@
uni.navigateTo({
url: '/pages/watchGoods/goodsdetail/goodsdetail?shortpatchcode=' + item.name
})
},
// 扫标签码时,自动进行翻译
async queryChange(value) {
if (value === null || value === "") {
return;
}
if (value.length < 40) {
return;
}
let package_code = value;
let resolutionData = {
code: package_code
};
const emitRes = await WarehoseApi.resolutionPackage(resolutionData);
if (emitRes.code !== 200 || emitRes.data === null) {
uni.showModal({
title: '提示',
content: '该箱号数据解析异常!',
showCancel: false,
confirmText: '确定'
});
return;
}
setTimeout(()=>{
this.formData.query = emitRes.data.patchCode;
this.getList();
},100)
}
}
};