仓库管理-拼箱功能完成

This commit is contained in:
赵正易
2024-04-18 17:03:36 +08:00
parent 0589f11d0e
commit 4a49ca5524
2 changed files with 262 additions and 248 deletions

View File

@@ -6,7 +6,7 @@ import request from '@/utils/request'
*/ */
export function doConsolidationGoods(data) { export function doConsolidationGoods(data) {
return request({ return request({
url: '/mes/wm/doConsolidationGoods', url: '/mes/wm/WmGoodsAction/doConsolidationGoods',
method: 'post', method: 'post',
data: data, data: data,
}) })
@@ -18,7 +18,7 @@ export function doConsolidationGoods(data) {
*/ */
export function doUnpackingGoods(data) { export function doUnpackingGoods(data) {
return request({ return request({
url: '/mes/wm/doUnpackingGoods', url: '/mes/wm/WmGoodsAction/doUnpackingGoods',
method: 'post', method: 'post',
data: data, data: data,
}) })

View File

@@ -21,7 +21,8 @@
<view class="scroll-view-title">拼箱清单</view> <view class="scroll-view-title">拼箱清单</view>
<scroll-view class="scroll-view-box" :scroll-y="true"> <scroll-view class="scroll-view-box" :scroll-y="true">
<view v-for="(item, index) in newMaterialList"> <view v-for="(item, index) in newMaterialList">
<materialItem style="background-color: whitesmoke" :index="index" :materialInfo="item" @click.native="handleDeleteItem(item, index)"></materialItem> <materialItem style="background-color: whitesmoke" :index="index" :materialInfo="item"
@click.native="handleDeleteItem(item, index)"></materialItem>
</view> </view>
</scroll-view> </scroll-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> -->
@@ -35,270 +36,283 @@
</template> </template>
<script> <script>
import materialItem from '@/components/material-item/material-item.vue'; import materialItem from '@/components/material-item/material-item.vue';
import packageCard from '@/components/package-card/package-card.vue'; import packageCard from '@/components/package-card/package-card.vue';
import * as WarehoseApi from '@/api/warehouse/warehose.js'; import * as WarehoseApi from '@/api/warehouse/warehose.js';
import * as GoodsNowApi from '@/api/warehouse/wmGoodsNowProduction.js'; import * as GoodsActionApi from '@/api/warehouse/wmGoodsAction.js';
// 拼箱 // 拼箱
export default { export default {
components: { components: {
materialItem, materialItem,
packageCard packageCard
},
data() {
return {
loading: false,
// 双击判定
touchNum: 0,
clearData: {},
// 货物信息
packageInfo: {
// id
id: '',
// 工单号
workoderID: '',
// 批次号(工单号+箱号+班组)
patchCode: '',
// 零件号
partNumner: '',
// 标签数量
goodsNumLogic: 0,
// 盘点数量(实际)
goodsNumAction: 0,
// 描述
productionDescribe: '',
// 出厂日期/生产日期
productionTime: '',
// 此箱数量
quantity: 0
},
// 新录入货物信息
newMaterialList: [],
// 1-仓库扫码 2-货物扫码 3-出货单扫码
searchType: 2
};
},
watch: {},
created() {
this.init();
},
computed: {
quantityTotal() {
let num = 0;
for (let index = 0; index < this.newMaterialList.length; index++) {
let _num = parseInt(this.newMaterialList[index].quantity);
_num = _num || 0;
num += _num * 1;
}
return num;
}
},
methods: {
init() {
// 需要展示的参数:【零件号[物料号](35233201041) 描述(鲨鱼鳍) 箱号+班组(BNW240312023_18B1) 数量 时间 】
// 初始化,并且清空数据
this.clearData.packageInfo = JSON.parse(JSON.stringify(this.packageInfo));
this.clearData.newMaterialList = JSON.parse(JSON.stringify(this.newMaterialList));
this.searchType = 2;
}, },
clear() { data() {
this.packageInfo = JSON.parse(JSON.stringify(this.clearData.packageInfo)); return {
this.newMaterialList = JSON.parse(JSON.stringify(this.clearData.newMaterialList)); loading: false,
this.searchType = 2; // 双击判定
touchNum: 0,
clearData: {},
// 货物信息
packageInfo: {
// id
id: '',
// 工单号
workoderID: '',
// 批次号(工单号+箱号+班组)
patchCode: '',
// 零件号
partNumner: '',
// 标签数量
goodsNumLogic: 0,
// 盘点数量(实际)
goodsNumAction: 0,
// 描述
productionDescribe: '',
// 出厂日期/生产日期
productionTime: '',
// 此箱数量
quantity: 0
},
// 新录入货物信息
newMaterialList: [],
// 1-仓库扫码 2-货物扫码 3-出货单扫码
searchType: 2
};
}, },
// 长按弹出删除 watch: {},
handleDeleteItem(item, index) { created() {
// 双击判定 this.init();
this.touchNum++; },
setTimeout(() => { computed: {
if (this.touchNum >= 2) { quantityTotal() {
uni.showModal({ let num = 0;
title: '删除提示', for (let index = 0; index < this.newMaterialList.length; index++) {
content: '是否从拼箱列表中删除此货物?', let _num = parseInt(this.newMaterialList[index].quantity);
showCancel: true, _num = _num || 0;
cancelText: '取消', num += _num * 1;
confirmText: '删除',
success: (res) => {
if (res.confirm) {
this.newMaterialList.splice(index, 1);
}
}
});
} }
this.touchNum = 0; return num;
}, 250); }
}, },
// 扫码信息录入 methods: {
handleGetInfo(data, type) { init() {
if (type === 2) { // 需要展示的参数:【零件号[物料号](35233201041) 描述(鲨鱼鳍) 箱号+班组(BNW240312023_18B1) 数量 时间 】
// 此时扫描的是箱号 // 初始化,并且清空数据
// if (this.newMaterialList.length > 1) { this.clearData.packageInfo = JSON.parse(JSON.stringify(this.packageInfo));
// uni.showModal({ this.clearData.newMaterialList = JSON.parse(JSON.stringify(this.newMaterialList));
// title: '提示', this.searchType = 2;
// content: '盘点仅支持单个货物盘点', },
// showCancel: false, clear() {
// confirmText: '确定' this.packageInfo = JSON.parse(JSON.stringify(this.clearData.packageInfo));
// }); this.newMaterialList = JSON.parse(JSON.stringify(this.clearData.newMaterialList));
// return; this.searchType = 2;
// } },
const checkData = { // 长按弹出删除
originalCode: data.originalCode handleDeleteItem(item, index) {
}; // 双击判定
// 是否在库 this.touchNum++;
WarehoseApi.isExistedWarehouse(checkData).then((res) => { setTimeout(() => {
if (res.code !== 200 || !res.data) { if (this.touchNum >= 2) {
uni.showModal({ uni.showModal({
title: '提示', title: '删除提示',
content: '货物异常或未入库!', content: '是否从拼箱列表中删除此货物?',
showCancel: false, showCancel: true,
confirmText: '确定' cancelText: '取消',
confirmText: '删除',
success: (res) => {
if (res.confirm) {
this.newMaterialList.splice(index, 1);
}
}
}); });
return;
} }
this.newMaterialList.push(data); this.touchNum = 0;
const searchInfoData = { }, 250);
patchCode: data.patchCode },
// 扫码信息录入
handleGetInfo(data, type) {
if (type === 2) {
// 此时扫描的是箱号
// if (this.newMaterialList.length > 1) {
// uni.showModal({
// title: '提示',
// content: '盘点仅支持单个货物盘点',
// showCancel: false,
// confirmText: '确定'
// });
// return;
// }
const checkData = {
originalCode: data.originalCode
}; };
// 获取解析结果 // 是否在库
WarehoseApi.getInfoByPatchCode(searchInfoData).then((res) => { WarehoseApi.isExistedWarehouse(checkData).then((res) => {
if (res.code === 200) { if (res.code !== 200 || !res.data) {
this.packageInfo = res.data;
} else {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '货物数据异常', content: '货物异常或未入库!',
showCancel: false, showCancel: false,
confirmText: '确定' confirmText: '确定'
}); });
return; return;
} }
this.newMaterialList.push(data);
const searchInfoData = {
patchCode: data.patchCode
};
// 获取解析结果
WarehoseApi.getInfoByPatchCode(searchInfoData).then((res) => {
if (res.code === 200) {
this.packageInfo = res.data;
} else {
uni.showModal({
title: '提示',
content: '货物数据异常',
showCancel: false,
confirmText: '确定'
});
return;
}
});
}); });
}
},
// 点击拼箱
handlerSubmit() {
uni.showModal({
title: '操作',
content: '是否确认此修改',
showCancel: true,
cancelText: '取消',
confirmText: '拼箱',
success: (res) => {
if (res.confirm) {
let data = {
packageList: this.newMaterialList,
createBy: "admin"
};
GoodsActionApi.doConsolidationGoods(data).then((res) => {
if (res.code === 200) {
uni.showModal({
title: '提示',
content: '拼箱成功!',
showCancel: false,
confirmText: '确认'
});
this.clear();
} else {
uni.showToast({
icon: 'error',
title: '拼箱失败!'
});
}
});
}
}
}); });
} }
},
// 点击拼箱
handlerSubmit() {
uni.showModal({
title: '操作',
content: '是否确认此修改',
showCancel: true,
cancelText: '取消',
confirmText: '拼箱',
success: (res) => {
if (res.confirm) {
let data = {
id: this.packageInfo.id,
goodsNumAction: this.packageInfo.goodsNumAction
};
// GoodsNowApi.updateWmGoodsNowProduction(data).then((res) => {
// if (res.code === 200) {
// uni.showModal({
// title: '提示',
// content: '盘点已完成',
// showCancel: false,
// confirmText: '确认'
// });
// this.clear();
// } else {
// uni.showToast({
// icon: 'error',
// title: '盘点失败!'
// });
// }
// });
}
}
});
} }
} };
};
</script> </script>
<style scoped> <style scoped>
.title-box { .title-box {
margin-top: 54px; margin-top: 54px;
margin-bottom: 20px; margin-bottom: 20px;
height: 60px; height: 60px;
font-size: 26px; font-size: 26px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.warehoseInfo-box {
font-size: 20px; .warehoseInfo-box {
width: 94%; font-size: 20px;
margin: 0 auto; width: 94%;
padding-left: 10px; margin: 0 auto;
padding-right: 10px; padding-left: 10px;
background-color: aliceblue; padding-right: 10px;
border-radius: 10px; background-color: aliceblue;
display: flex; border-radius: 10px;
flex-direction: column; display: flex;
} flex-direction: column;
.warehoseInfo-box .row { }
display: flex;
flex-direction: row; .warehoseInfo-box .row {
} display: flex;
.warehoseInfo-box .row .col { flex-direction: row;
width: 50%; }
}
.aciton-box { .warehoseInfo-box .row .col {
display: flex; width: 50%;
flex-direction: column; }
justify-content: center;
align-items: center; .aciton-box {
} display: flex;
.color1 { flex-direction: column;
color: yellowgreen; justify-content: center;
} align-items: center;
.color2 { }
color: orange;
} .color1 {
.pda-search-box { color: yellowgreen;
margin-bottom: 5px; }
}
.list-box { .color2 {
width: 100%; color: orange;
} }
.scroll-view-title {
font-size: 24px; .pda-search-box {
display: flex; margin-bottom: 5px;
align-items: center; }
justify-content: center;
} .list-box {
.scroll-view-box { width: 100%;
width: 94%; }
margin: 0 auto;
margin-top: 50px; .scroll-view-title {
height: 360px; font-size: 24px;
padding: 10px; display: flex;
background-color: rgba(179, 179, 179, 0.7); align-items: center;
border-radius: 5px; justify-content: center;
} }
.scroll-view-last {
width: 100%; .scroll-view-box {
height: 60px; width: 94%;
font-size: 20px; margin: 0 auto;
color: rgba(0, 9, 0, 0.7); margin-top: 50px;
display: flex; height: 360px;
flex-direction: column; padding: 10px;
justify-content: center; background-color: rgba(179, 179, 179, 0.7);
margin-top: 10px; border-radius: 5px;
padding-left: 10px; }
padding-right: 10px;
border-radius: 10px; .scroll-view-last {
background-color: white; width: 100%;
} height: 60px;
.button-box { font-size: 20px;
width: 80%; color: rgba(0, 9, 0, 0.7);
margin: 10px auto; display: flex;
display: flex; flex-direction: column;
flex-direction: row; justify-content: center;
} margin-top: 10px;
.changeInput { padding-left: 10px;
font-size: 20px; padding-right: 10px;
background-color: gainsboro; border-radius: 10px;
border:1px solid grey; background-color: white;
} }
</style>
.button-box {
width: 80%;
margin: 10px auto;
display: flex;
flex-direction: row;
}
.changeInput {
font-size: 20px;
background-color: gainsboro;
border: 1px solid grey;
}
</style>