Files
shanghaiganxiangtuzhuangwor…/pages/relocation/relocation.vue
2024-03-28 13:33:33 +08:00

311 lines
7.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="content">
<view class="title-box">
<!-- <span class="title-text">移库</span> -->
<view class="warehoseInfo-box">
<view>待移库仓库编号{{ warehouseInfo.warehouse + ' ' + warehouseInfo.location }}</view>
<view class="row">
<view class="col">层号{{ warehouseInfo.layer }}</view>
<view class="col">货架{{ warehouseInfo.shelf }}</view>
</view>
<!-- <view class="row">
<span class="col">总货物数{{ quantityTotal }}</span>
<span class="col">总箱数{{ newMaterialList.length }}</span>
</view> -->
<view>
<view v-if="searchType === 1" class="color1 aciton-box">操作指示-请扫仓库码</view>
<view v-if="searchType === 2" class="color2 aciton-box">操作指示-请扫货物码</view>
<!-- 扫描操作 -->
<view class="pda-search-box">
<PdaScanInput @getInfo="handleGetInfo" :type="searchType"></PdaScanInput>
</view>
</view>
</view>
</view>
<!-- 货物列表 -->
<view class="scroll-view-box">
<view class="scroll-view-title">移库清单</view>
<view class="scroll-view-last" v-if="newMaterialList.length === 1">货物仓库地址{{packageInfo.locationCode}}</view>
<packageCard v-if="newMaterialList.length > 0" :packageInfo="newMaterialList[newMaterialList.length - 1]"></packageCard>
</view>
<!-- 底部按钮 -->
<view class="button-box">
<button type="default" @click="handlerSubmit">移库</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';
import * as GoodsNowApi from '@/api/warehouse/wmGoodsNowProduction.js';
// 移库
export default {
components: {
materialItem,
packageCard
},
data() {
return {
loading: false,
// 双击判定
touchNum: 0,
clearData: {},
// 仓库信息
warehouseInfo: {
id: '',
warehouse: '',
warehouse_num: '',
location: '',
shelf: '',
layer: '',
number: 0
},
// 货物信息
packageInfo: {
// id
id:'',
// 工单号
workoderID: '',
// 批次号(工单号+箱号+班组)
patchCode: '',
// 零件号
partNumner: '',
// 仓库地址
locationCode:'',
// 标签数量
goodsNumLogic:0,
// 盘点数量(实际)
goodsNumAction:0,
// 描述
productionDescribe: '',
// 出厂日期/生产日期
productionTime: '',
// 此箱数量
quantity: 0
},
// 库位历史信息
oldMaterialList: [],
// 库位新录入货物信息
newMaterialList: [],
// 1-仓库扫码 2-货物扫码
searchType: 2
};
},
watch: {},
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 = 2;
},
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 = 2;
},
// 移库操作
handleGetInfo(data, type) {
// 先扫箱号,再扫库位
if (type === 1) {
// this.searchType = 2;
this.warehouseInfo = data?.warehoseInfo;
// this.newMaterialList = [];
} else if (type === 2) {
// 1.先扫货物编码
this.warehouseInfo = JSON.parse(JSON.stringify(this.clearData.warehouseInfo));
const checkData = {
originalCode: data.originalCode
};
// 是否在库
WarehoseApi.isExistedWarehouse(checkData).then((res) => {
if (res.code !== 200 || !res.data) {
uni.showModal({
title: '提示',
content: '货物异常或未入库,不可移库!',
showCancel: false,
confirmText: '确定'
});
return;
}
if (this.newMaterialList.length > 1) {
uni.showModal({
title: '提示',
content: '仅支持一个货物移库!',
showCancel: false,
confirmText: '确定'
});
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;
}
})
uni.showModal({
title: '提示',
content: '接下来请扫需要移动到的仓库编码!',
showCancel: false,
confirmText: '确定'
});
this.searchType = 1;
});
}
},
// 移库提交
handlerSubmit() {
if (this.newMaterialList.length === 0) {
uni.showModal({
title: '提示',
content: '无待移库货物!',
showCancel: false,
confirmText: '确定'
});
return;
}
uni.showModal({
title: '操作',
content: '是否确认移动' + this.newMaterialList[0].patchCode + '至' + this.warehouseInfo.location + '仓库?',
showCancel: true,
cancelText: '取消',
confirmText: '确认移库',
success: (res) => {
if (res.confirm) {
let data = {
id: this.packageInfo.id,
locationCode: this.warehouseInfo.location
};
GoodsNowApi.updateWmGoodsNowProduction(data).then((res) => {
if (res.code === 200) {
uni.showToast({
icon: 'success',
title: '移库成功!'
});
this.clear();
} else {
uni.showToast({
icon: 'error',
title: '移库失败!'
});
}
});
}
}
});
}
}
};
</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;
}
.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 .col {
width: 50%;
}
.aciton-box {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.color1 {
color: brown;
}
.color2 {
color: orange;
}
.pda-search-box {
margin-bottom: 5px;
}
.list-box {
width: 100%;
}
.scroll-view-title {
font-size: 24px;
display: flex;
align-items: center;
justify-content: center;
}
.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;
}
.button-box {
width: 80%;
margin: 10px auto;
}
</style>