This commit is contained in:
赵正易 2024-08-16 16:06:55 +08:00
parent d7830d29ba
commit 9f269ac667
2 changed files with 370 additions and 329 deletions

View File

@ -2,8 +2,8 @@
"name" : "干巷仓库APP",
"appid" : "__UNI__A67E78B",
"description" : "",
"versionName" : "2.2.6",
"versionCode" : 226,
"versionName" : "2.2.7",
"versionCode" : 227,
"transformPx" : false,
"app-plus" : {
"usingComponents" : true,

View File

@ -3,7 +3,10 @@
<view class="title-box">
<!-- <span class="title-text">入库</span> -->
<view class="warehoseInfo-box">
<view>仓库编号{{ warehouseInfo.warehouse + ' ' + warehouseInfo.location }} <span></span></view>
<view>
仓库编号{{ warehouseInfo.warehouse + ' ' + warehouseInfo.location }}
<span></span>
</view>
<view class="row">
<view class="col">层号{{ warehouseInfo.layer }}</view>
<view class="col">货架{{ warehouseInfo.shelf }}</view>
@ -17,377 +20,415 @@
<view v-if="searchType === 2" class="color2 aciton-box">请扫箱码</view>
<!-- 扫描操作 -->
<view class="pda-search-box">
<PdaScanInput @getInfo="handleGetInfo" :type="searchType" :warehouseInfo="warehouseInfo">
</PdaScanInput>
<PdaScanInput @getInfo="handleGetInfo" :type="searchType" :warehouseInfo="warehouseInfo"></PdaScanInput>
</view>
</view>
</view>
</view>
<!-- 货物列表 -->
<view class="scroll-view-box">
<view class="scroll-view-title">{{this.isStrict?'':'外协'}}入库清单</view>
<view class="scroll-view-last" v-if="newMaterialList.length > 1">
上次批次号{{ newMaterialList[newMaterialList.length - 2].patchCode }}</view>
<view class="scroll-view-title">{{ this.isStrict ? '' : '外协' }}入库清单</view>
<view class="scroll-view-last" v-if="newMaterialList.length > 1">上次批次号{{ newMaterialList[newMaterialList.length - 2].patchCode }}</view>
<view class="scroll-view-last" v-if="newMaterialList.length === 1">上次批次号</view>
<packageCard v-if="newMaterialList.length > 0" :packageInfo="newMaterialList[newMaterialList.length - 1]">
</packageCard>
<packageCard v-if="newMaterialList.length > 0" :packageInfo="newMaterialList[newMaterialList.length - 1]"></packageCard>
</view>
<!-- 底部按钮 -->
<view class="button-box">
<u-button style="width: 40%" type="error" @click="clear" :disabled="loading"
:loading="loading">全部重置</u-button>
<u-button style="width: 40%" type="success" @click="handlerSubmit" :disabled="loading"
:loading="loading">入库</u-button>
<u-button style="width: 40%" type="error" @click="clear" :disabled="loading" :loading="loading">全部重置</u-button>
<u-button style="width: 40%" type="success" @click="handlerSubmit" :disabled="loading" :loading="loading">入库</u-button>
</view>
</view>
</template>
<script>
import materialItem from '@/components/material-item/material-item.vue';
import packageCard from '@/components/package-card/package-card.vue';
import * as WarehoseApi from '@/api/warehouse/warehose.js';
//
export default {
components: {
materialItem,
packageCard
},
data() {
return {
// true false
isStrict: false,
loading: false,
//
touchNum: 0,
clearData: {},
//
warehouseInfo: {
id: '',
warehouse: '',
warehouse_num: '',
location: '',
shelf: '',
layer: '',
number: 0
},
//
lastPackageInfo: {
//
workoderID: '',
// (++)
patchCode: '',
//
partNumner: '',
//
productionDescribe: '',
// /
productionTime: '',
//
quantity: 0
},
//
oldMaterialList: [],
//
newMaterialList: [],
// 1- 2-
searchType: 1
};
},
watch: {},
onLoad(e) {
if (e.isStrict === "true") {
this.isStrict = true;
} else {
this.isStrict = false;
import materialItem from '@/components/material-item/material-item.vue';
import packageCard from '@/components/package-card/package-card.vue';
import * as WarehoseApi from '@/api/warehouse/warehose.js';
//
export default {
components: {
materialItem,
packageCard
},
data() {
return {
// true false
isStrict: false,
loading: false,
//
touchNum: 0,
clearData: {},
//
warehouseInfo: {
id: '',
warehouse: '',
warehouse_num: '',
location: '',
shelf: '',
layer: '',
number: 0
},
//
lastPackageInfo: {
//
workoderID: '',
// (++)
patchCode: '',
//
partNumner: '',
//
productionDescribe: '',
// /
productionTime: '',
//
quantity: 0
},
//
oldMaterialList: [],
//
newMaterialList: [],
// 1- 2-
searchType: 1
};
},
watch: {},
onLoad(e) {
if (e.isStrict === 'true') {
this.isStrict = true;
} else {
this.isStrict = false;
}
},
created() {
this.init();
},
computed: {
quantityTotal() {
let num = 0;
for (let index = 0; index < this.newMaterialList.length; index++) {
num += this.newMaterialList[index].quantity * 1;
}
return num;
}
},
methods: {
init() {
// [](35233201041) () +(BNW240312023_18B1)
//
this.clearData.warehouseInfo = JSON.parse(JSON.stringify(this.warehouseInfo));
this.clearData.oldMaterialList = JSON.parse(JSON.stringify(this.oldMaterialList));
this.clearData.newMaterialList = JSON.parse(JSON.stringify(this.newMaterialList));
this.searchType = 1;
},
created() {
this.init();
clear() {
this.warehouseInfo = JSON.parse(JSON.stringify(this.clearData.warehouseInfo));
this.oldMaterialList = JSON.parse(JSON.stringify(this.clearData.oldMaterialList));
this.newMaterialList = JSON.parse(JSON.stringify(this.clearData.newMaterialList));
this.searchType = 1;
},
computed: {
quantityTotal() {
let num = 0;
for (let index = 0; index < this.newMaterialList.length; index++) {
num += this.newMaterialList[index].quantity * 1;
handleGetInfo(data, type) {
if (type === 1) {
//
this.searchType = 2;
this.warehouseInfo = data?.warehoseInfo;
this.newMaterialList = [];
this.loading = false;
} else if (type === 2) {
if (this.loading) {
uni.showModal({
title: '提示',
content: '请等待加载完成!',
showCancel: false,
confirmText: '确定'
});
}
return num;
}
},
methods: {
init() {
// [](35233201041) () +(BNW240312023_18B1)
//
this.clearData.warehouseInfo = JSON.parse(JSON.stringify(this.warehouseInfo));
this.clearData.oldMaterialList = JSON.parse(JSON.stringify(this.oldMaterialList));
this.clearData.newMaterialList = JSON.parse(JSON.stringify(this.newMaterialList));
this.searchType = 1;
},
clear() {
this.warehouseInfo = JSON.parse(JSON.stringify(this.clearData.warehouseInfo));
this.oldMaterialList = JSON.parse(JSON.stringify(this.clearData.oldMaterialList));
this.newMaterialList = JSON.parse(JSON.stringify(this.clearData.newMaterialList));
this.searchType = 1;
},
handleGetInfo(data, type) {
if (type === 1) {
//
this.searchType = 2;
this.warehouseInfo = data?.warehoseInfo;
this.newMaterialList = [];
this.loading = false;
} else if (type === 2) {
if (this.loading) {
//
//
//
if (this.newMaterialList.length > 0) {
// for (let item of this.newMaterialList) {
// if (item.patchCode === data.patchCode) {
// uni.showModal({
// title: '',
// content: '!',
// showCancel: false,
// confirmText: ''
// });
// this.loading = false;
// return;
// }
// }
if (this.newMaterialList[this.newMaterialList.length - 1].workoderID !== data.workoderID) {
uni.showModal({
title: '提示',
content: '请等待加载完成!',
content: '已更换入库批次!',
showCancel: false,
confirmText: '确定'
});
}
//
//
//
if (this.newMaterialList.length > 0) {
for (let item of this.newMaterialList) {
if (item.patchCode === data.patchCode) {
uni.showModal({
title: '提示',
content: '此货物已录入过!',
showCancel: false,
confirmText: '确定'
});
this.loading = false;
return;
}
}
if (this.newMaterialList[this.newMaterialList.length - 1].workoderID !== data.workoderID) {
uni.showModal({
title: '提示',
content: '已更换入库批次!',
showCancel: false,
confirmText: '确定'
});
}
}
const checkData = {
production_packcode: data.originalCode,
location: this.warehouseInfo.location,
//
isStrict: this.isStrict
};
this.loading = true;
setTimeout(() => {
this.loading = false;
}, 10000)
WarehoseApi.checkWarehousing(checkData).then((res) => {
if (res.code === 200 && res.data) {
this.newMaterialList.push(data);
this.loading = false;
} else {
uni.showModal({
title: '提示',
content: '不可入库:' + res.msg,
showCancel: false,
confirmText: '确定'
});
this.loading = false;
}
});
}
},
//
handleDeleteItem(item, index) {
//
this.touchNum++;
setTimeout(() => {
if (this.touchNum >= 2) {
uni.showModal({
title: '删除提示',
content: '是否从列表中删除此货物?',
showCancel: true,
cancelText: '取消',
confirmText: '删除',
success: (res) => {
if (res.confirm) {
this.newMaterialList.splice(index, 1);
}
}
});
}
this.touchNum = 0;
}, 250);
},
//
handlerSubmit() {
if (this.newMaterialList.length === 0) {
uni.showModal({
title: '提示',
content: '无入库货物!',
showCancel: false,
confirmText: '确定'
});
return;
}
const checkData = {
production_packcode: data.originalCode,
location: this.warehouseInfo.location,
//
isStrict: this.isStrict
};
this.loading = true;
setTimeout(() => {
this.loading = false;
}, 30000)
uni.showModal({
title: '入库操作',
content: '是否确认入库?',
showCancel: true,
cancelText: '取消',
confirmText: '确认入库',
success: (res) => {
if (res.confirm) {
let list = [];
for (let item of this.newMaterialList) {
list.push(item.originalCode);
}
const data = {
location: this.warehouseInfo.location,
packagelist: list
};
uni.$u.throttle(() => {
WarehoseApi.handlerIntoProductWarehouse(data).then((res) => {
if (res.code === 200) {
if (res.data === 0 || !res.data) {
uni.showModal({
title: '提示',
content: '入库失败:' + res.msg,
showCancel: false,
confirmText: '确定'
});
this.loading = false;
return;
}
uni.showToast({
icon: 'none',
title: '入库成功!' + res.msg
});
this.loading = false;
this.oldMaterialList = JSON.parse(JSON.stringify(this
.clearData
.oldMaterialList));
this.newMaterialList = JSON.parse(JSON.stringify(this
.clearData
.newMaterialList));
// this.clear();
} else {
uni.showToast({
icon: 'error',
title: '入库失败!'
});
this.loading = false;
}
});
}, 5000)
} else {
this.loading = false;
}
}, 10000);
WarehoseApi.checkWarehousing(checkData).then((res) => {
if (res.code === 200 && res.data) {
this.newMaterialList.push(data);
this.loading = false;
} else {
uni.showModal({
title: '提示',
content: '不可入库:' + res.msg,
showCancel: false,
confirmText: '确定'
});
this.loading = false;
}
});
}
},
//
handleDeleteItem(item, index) {
//
this.touchNum++;
setTimeout(() => {
if (this.touchNum >= 2) {
uni.showModal({
title: '删除提示',
content: '是否从列表中删除此货物?',
showCancel: true,
cancelText: '取消',
confirmText: '删除',
success: (res) => {
if (res.confirm) {
this.newMaterialList.splice(index, 1);
}
}
});
}
this.touchNum = 0;
}, 250);
},
//
handlerSubmit() {
if (this.newMaterialList.length === 0) {
uni.showModal({
title: '提示',
content: '无入库货物!',
showCancel: false,
confirmText: '确定'
});
return;
}
// this.isPackageRepeat()
if (this.isPackageRepeat()) {
uni.showModal({
title: '重复箱校验',
content: '检测到存在重复箱,是否自动清除?',
showCancel: true,
cancelText: '取消',
confirmText: '确认清除',
success: (res) => {
if (res.confirm) {
this.clearRepeatPackage();
}
}
});
return;
}
this.loading = true;
setTimeout(() => {
this.loading = false;
}, 30000);
uni.showModal({
title: '入库操作',
content: '是否确认入库?',
showCancel: true,
cancelText: '取消',
confirmText: '确认入库',
success: (res) => {
if (res.confirm) {
let list = [];
for (let item of this.newMaterialList) {
list.push(item.originalCode);
}
const data = {
location: this.warehouseInfo.location,
packagelist: list
};
uni.$u.throttle(() => {
WarehoseApi.handlerIntoProductWarehouse(data).then((res) => {
if (res.code === 200) {
if (res.data === 0 || !res.data) {
uni.showModal({
title: '提示',
content: '入库失败:' + res.msg,
showCancel: false,
confirmText: '确定'
});
this.loading = false;
return;
}
uni.showToast({
icon: 'none',
title: '入库成功!' + res.msg
});
this.loading = false;
this.oldMaterialList = JSON.parse(JSON.stringify(this.clearData.oldMaterialList));
this.newMaterialList = JSON.parse(JSON.stringify(this.clearData.newMaterialList));
// this.clear();
} else {
uni.showToast({
icon: 'error',
title: '入库失败!'
});
this.loading = false;
}
});
}, 5000);
} else {
this.loading = false;
}
}
});
},
// ,
isPackageRepeat() {
let oldList = this.newMaterialList;
let newlist = [];
for (let item of oldList) {
newlist.push(item.originalCode);
}
return new Set(newlist).size !== oldList.length;
},
//
clearRepeatPackage() {
let oldArray = this.newMaterialList;
let newArray = [];
let seen = new Map();
let repeatPackage = [];
oldArray.forEach((item) => {
let itemStr = JSON.stringify(item);
if (!seen.has(itemStr)) {
seen.set(itemStr, true);
newArray.push(item);
} else {
repeatPackage.push(item.patchCode);
}
});
this.newMaterialList = newArray;
uni.showModal({
title: '提示',
content: '清除成功,原箱数' + oldArray.length + '现箱数:' + newArray.length + '重复箱:' + repeatPackage.join(','),
showCancel: false,
confirmText: '确定'
});
}
};
}
};
</script>
<style scoped>
.title-box {
margin-top: 54px;
margin-bottom: 20px;
height: 60px;
font-size: 26px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.title-box {
margin-top: 54px;
margin-bottom: 20px;
height: 60px;
font-size: 26px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.warehoseInfo-box {
font-size: 20px;
width: 94%;
margin: 0 auto;
padding-left: 10px;
padding-right: 10px;
background-color: aliceblue;
border-radius: 10px;
display: flex;
flex-direction: column;
}
.warehoseInfo-box {
font-size: 20px;
width: 94%;
margin: 0 auto;
padding-left: 10px;
padding-right: 10px;
background-color: aliceblue;
border-radius: 10px;
display: flex;
flex-direction: column;
}
.warehoseInfo-box .row {
display: flex;
flex-direction: row;
}
.warehoseInfo-box .row {
display: flex;
flex-direction: row;
}
.warehoseInfo-box .row .col {
width: 50%;
}
.warehoseInfo-box .row .col {
width: 50%;
}
.aciton-box {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.aciton-box {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.color1 {
color: brown;
}
.color1 {
color: brown;
}
.color2 {
color: orange;
}
.color2 {
color: orange;
}
.pda-search-box {
margin-bottom: 5px;
}
.pda-search-box {
margin-bottom: 5px;
}
.list-box {
width: 100%;
}
.list-box {
width: 100%;
}
.scroll-view-title {
font-size: 24px;
display: flex;
align-items: center;
justify-content: center;
color: #151515;
}
.scroll-view-title {
font-size: 24px;
display: flex;
align-items: center;
justify-content: center;
color: #151515;
}
.scroll-view-box {
width: 94%;
margin: 0 auto;
margin-top: 30px;
height: 400px;
padding: 10px;
background-color: rgba(179, 179, 179, 0.7);
border-radius: 5px;
}
.scroll-view-box {
width: 94%;
margin: 0 auto;
margin-top: 30px;
height: 400px;
padding: 10px;
background-color: rgba(179, 179, 179, 0.7);
border-radius: 5px;
}
.scroll-view-last {
width: 100%;
height: 60px;
font-size: 20px;
color: rgba(0, 9, 0, 0.7);
display: flex;
flex-direction: column;
justify-content: center;
margin-top: 10px;
padding-left: 10px;
padding-right: 10px;
border-radius: 10px;
background-color: white;
}
.scroll-view-last {
width: 100%;
height: 60px;
font-size: 20px;
color: rgba(0, 9, 0, 0.7);
display: flex;
flex-direction: column;
justify-content: center;
margin-top: 10px;
padding-left: 10px;
padding-right: 10px;
border-radius: 10px;
background-color: white;
}
.button-box {
width: 80%;
margin: 10px auto;
display: flex;
align-items: center;
justify-content: center;
}
</style>
.button-box {
width: 80%;
margin: 10px auto;
display: flex;
align-items: center;
justify-content: center;
}
</style>