出库-添加批量出库功能

This commit is contained in:
2024-04-24 16:42:51 +08:00
parent 38cfe0f3b7
commit 7d410d5bdb
2 changed files with 134 additions and 17 deletions

View File

@@ -30,10 +30,33 @@
<u-button @click="show = true">选择物料号</u-button>
<u-picker :show="show" :columns="columns" @cancel="pick_cancel" @confirm="pick_confirm"></u-picker>
</view>
<!-- 功能切换 -->
<u-subsection :list="subsectionList" :current="subsectionCurrent" @change="subsectionChange"
fontSize="36"></u-subsection>
<!-- 货物列表 -->
<view class="scroll-view-box">
<view class="scroll-view-box" v-if="subsectionCurrent === 0">
<view class="scroll-view-title">出库清单</view>
<packageCard v-if="newMaterialList.length > 0" :packageInfo="newMaterialList[newMaterialList.length - 1]"></packageCard>
<view v-if="newMaterialList.length === 1">
<uni-card is-full :title="'批次号:'+newMaterialList[0].patchCode"
:extra="'数量:'+newMaterialList[0].quantity" @click="handleDeleteItem(0)">
<u--text size="26"
:text="'描述:'+ (newMaterialList[0].productionDescribe?newMaterialList[0].productionDescribe:'无描述,请检查零件号是否对应')"></u--text>
</uni-card>
</view>
</view>
<view class="scroll-view-box" v-if="subsectionCurrent === 1">
<view class="scroll-view-title">多箱出库清单</view>
<view>
<u-list height="260px">
<u-list-item v-for="(item, index) in newMaterialList" :key="index">
<uni-card is-full :title="'批次号:'+item.patchCode" :extra="'数量:'+item.quantity"
@click="handleDeleteItem(index)">
<u--text size="26"
:text="'描述:'+ (item.productionDescribe?item.productionDescribe:'无描述,请检查零件号是否对应')"></u--text>
</uni-card>
</u-list-item>
</u-list>
</view>
</view>
<!-- 底部按钮 -->
<view class="button-box">
@@ -90,7 +113,8 @@
outOrderPlan: [],
// 1-仓库扫码 2-货物扫码 3-出货单扫码
searchType: 3,
subsectionList: ['单箱出库', '多箱出库'],
subsectionCurrent: 0,
show: false,
columns: [
['无物料号']
@@ -142,10 +166,14 @@
this.outInfo.materialList.forEach((item) => {
arry.push(item.partnumber);
});
this.columns.push(arry);
this.material_id = this.outInfo.materialList[0].partnumber;
if (arry.length > 0) {
this.columns.push(arry);
this.material_id = this.outInfo.materialList[0].partnumber;
} else {
this.columns.push(['无物料号']);
}
} else if (type === 2) {
if (this.newMaterialList.length > 0) {
if (this.subsectionCurrent === 0 && this.newMaterialList.length > 0) {
uni.showModal({
title: '提示',
content: '当前货物未确认出库,请先点击下方出库按钮,出库当前货物!',
@@ -154,6 +182,28 @@
});
return;
}
if (this.subsectionCurrent === 1 && this.newMaterialList.length > 0) {
if(this.newMaterialList.length > 50){
uni.showModal({
title: '提示',
content: '批量出库数量已达到50箱请先出库此50箱',
showCancel: false,
confirmText: '确定'
});
return;
}
for (let item of this.newMaterialList) {
if (item.patchCode === data.patchCode) {
uni.showModal({
title: '提示',
content: '此货物已录入过!',
showCancel: false,
confirmText: '确定'
});
return;
}
}
}
const checkData = {
production_packcode: data.originalCode,
shipment_num: this.outInfo.shipmentNum,
@@ -210,7 +260,8 @@
});
return;
}
if (this.newMaterialList.length === 0) {
const length = this.newMaterialList.length;
if (length === 0) {
uni.showModal({
title: '提示',
content: '当前未扫描货物!',
@@ -221,16 +272,46 @@
}
uni.showModal({
title: '操作',
content: '是否确认执行出库操作?',
content: '当前已扫描:' + length + '箱货物,是否确认执行出库操作?',
showCancel: true,
cancelText: '取消',
confirmText: '确认出库',
success: (res) => {
if (res.confirm) {
const data = {
let data = {
shipmentNum: this.outInfo.shipmentNum,
patchCode: [this.newMaterialList[0].patchCode]
patchCode: []
};
if (this.subsectionCurrent === 0) {
data.patchCode = [this.newMaterialList[0].patchCode];
} else if (this.subsectionCurrent === 1) {
// 提取货物patchCode
let patchCodeList = uni.$u.deepClone(this.newMaterialList);
let newPatchCodeList = [];
for (let item of patchCodeList) {
if (item.patchCode === "" || item.patchCode === null) {
uni.showModal({
title: '提示',
content: '箱数据有异常:' + item.originalCode,
showCancel: false,
confirmText: '确认'
});
return;
} else {
newPatchCodeList.push(item.patchCode)
}
}
data.patchCode = newPatchCodeList;
}
if (data.patchCode.length === 0) {
uni.showModal({
title: '提示',
content: '无出库箱,不可出库!',
showCancel: false,
confirmText: '确认'
});
}
WarehoseApi.doMaterialOut(data).then((res) => {
if (res.code !== 200) {
uni.showModal({
@@ -239,7 +320,6 @@
showCancel: false,
confirmText: '确认'
});
return;
} else {
if (res.data.item1 == 100) {
@@ -261,7 +341,7 @@
} else {
uni.showModal({
title: '提示',
content: '出库成功',
content: '出库成功!已成功出库' + res.data.item2 + '箱',
showCancel: false,
confirmText: '确认'
});
@@ -319,6 +399,40 @@
this.material_id = e.value[0];
console.log(this.material_id);
this.show = false;
},
// 长按弹出删除
handleDeleteItem(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);
},
subsectionChange(index) {
if (this.newMaterialList.length > 0) {
uni.showModal({
title: '提示',
content: '当前货物列表有货物!可双击删除对应货物,全删除后可切换!',
showCancel: false,
confirmText: '确认'
});
return;
}
this.subsectionCurrent = index;
}
}
};
@@ -376,6 +490,7 @@
.scroll-view-title {
font-size: 24px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
@@ -384,9 +499,10 @@
.scroll-view-box {
width: 98%;
margin: 0 auto;
margin-top: 50px;
height: 200px;
padding: 10px;
margin-top: 10px;
padding-left: 10px;
padding-right: 10px;
height: 300px;
background-color: rgba(179, 179, 179, 0.3);
border-radius: 5px;
}