<template>
|
<view class="wrap">
|
<u-form class="form" label-position="left">
|
<u-form-item label="至库位号" label-width="180">
|
<picker @change="bindPackLocationChange($event,locationNo)" :value="locationIndex" :range="locationNo"
|
range-key="value">
|
<view>
|
<text>{{locationIndex==null ? "请选择":locationNo[locationIndex].value}}</text>
|
</view>
|
</picker>
|
</u-form-item>
|
</u-form>
|
<scroll-view class="scroll-list" scroll-y="true">
|
<view class="list" :border="false" style="margin-top: 20rpx;">
|
<view class="title">
|
<view>
|
<u-icon class="grid-icon" name="column-line" :size="40" :style="{ color: '#0081ff' }"></u-icon>
|
</view>
|
<view class="text-black text-bold basis-xl">包装信息</view>
|
</view>
|
<view class="content" style="background: #fff;">
|
<view class="row-list">
|
<view class="_label">
|
编号:
|
</view>
|
<view class="_content">
|
{{ packingInfo.no }}
|
</view>
|
</view>
|
<view class="row-list">
|
<view class="_label">
|
物料编码:
|
</view>
|
<view class="_content">
|
{{ packingInfo.cusMaterialCode }}
|
</view>
|
</view>
|
<view class="row-list">
|
<view class="_label">
|
包装尺寸:
|
</view>
|
<view class="_content">
|
{{ packingInfo.packSize }}
|
</view>
|
</view>
|
<view class="row-list">
|
<view class="_label">
|
包装:
|
</view>
|
<view class="_content">
|
{{ packingInfo.packMaterial }}
|
</view>
|
</view>
|
<view class="row-list">
|
<view class="_label">
|
包装重量:
|
</view>
|
<view class="_content">
|
{{ packingInfo.packWeight }}
|
</view>
|
</view>
|
</view>
|
</view>
|
<u-cell-group class="list" :border="false">
|
<view class="title">
|
<view>
|
<u-icon class="grid-icon" name="column-line" :size="40" :style="{ color: '#0081ff' }"></u-icon>
|
</view>
|
<view class="text-black text-bold basis-xl">包装移库信息</view>
|
</view>
|
<view class="content" v-for="(item, index) in list" :key="item.id" :index="index">
|
<view class="row-img" @click="deleteHandle(item)">
|
<u-image width="18px" height="18px" src="@/static/custom/delete.png"></u-image>
|
</view>
|
<view class="row-list" style="padding-top: 8px;">
|
<view class="_label">
|
零件号:
|
</view>
|
<view class="_content">
|
{{ item.partNo }}
|
</view>
|
</view>
|
<view class="row-list">
|
<view class="_label">
|
零件名称:
|
</view>
|
<view class="_content">
|
{{ item.partName }}
|
</view>
|
</view>
|
<view class="row-list">
|
<view class="_label">
|
系统编号:
|
</view>
|
<view class="_content">
|
{{ item.systemNo }}
|
</view>
|
</view>
|
<view class="row-list">
|
<view class="_label">
|
SN:
|
</view>
|
<view class="_content">
|
{{ item.partBatchNo }}
|
</view>
|
</view>
|
<view class="row-list">
|
<view class="_label">
|
IFS批次号:
|
</view>
|
<view class="_content">
|
{{ item.ifsBatchNo }}
|
</view>
|
</view>
|
<view class="row-list">
|
<view class="_label">
|
单位:
|
</view>
|
<view class="_content">
|
{{ item.unit }}
|
</view>
|
</view>
|
<view class="row-list">
|
<view class="_label">
|
从库位号:
|
</view>
|
<view class="_content">
|
{{ item.locationNo }}
|
</view>
|
</view>
|
<view class="row-list">
|
<view class="_label">
|
至库位号:
|
</view>
|
<view class="_content">
|
{{ item.inLocationNo }}
|
</view>
|
</view>
|
<view class="row-list">
|
<view class="_label">
|
可用库存数量:
|
</view>
|
<view class="_content">
|
{{ item.availableStockQuantity }}
|
</view>
|
</view>
|
</view>
|
</u-cell-group>
|
</scroll-view>
|
<scan></scan>
|
</view>
|
</template>
|
<script>
|
import scan from "@/components/scan/scan.vue";
|
export default {
|
components: {
|
scan
|
},
|
data() {
|
return {
|
list: [],
|
packingInfo: {},
|
locationNo: [],
|
tolocationNo: "", //至库位号
|
tolocationId: undefined, //至库位号id
|
locationIndex: null,
|
};
|
},
|
onReady() {
|
let that = this
|
//获取至库位号
|
that.$u.api.pigxPacking.packHeadBasicInfoList().then(res => {
|
let locationNoList = res.data.locationNoList
|
locationNoList.map((item, index) => {
|
|
let location = {
|
lable: item,
|
value: item
|
}
|
that.locationNo.push(location)
|
});
|
|
});
|
|
},
|
onLoad(option) {
|
if (option.item) {
|
let obj = JSON.parse(decodeURIComponent(option.item));
|
this.packingInfo = obj
|
}
|
this.loadList()
|
},
|
onShow() {
|
|
let that = this
|
|
uni.$off('scan') // 每次进来先 移除全局自定义事件监听器
|
uni.$on('scan', function(data) {
|
console.log('onscan');
|
//扫码成功后的回调,你可以写自己的逻辑代码在这里
|
console.log('扫码结果:', data.code);
|
|
if (data.code != "" && (that.tolocationNo == "")) {
|
uni.showToast({
|
title: '请选择至库位号',
|
icon: 'none'
|
})
|
return
|
}
|
|
that.scanHandler(data.code);
|
})
|
},
|
onNavigationBarButtonTap(e) {
|
uni.scanCode({
|
success: res => {
|
try {
|
const result = JSON.parse(res.result)
|
|
} catch (e) {}
|
}
|
});
|
},
|
methods: {
|
//扫码操作
|
scanHandler(scanCode) {
|
let that = this
|
let data = {
|
partBatchNo: scanCode
|
}
|
that.$u.api.pigxPacking.getStockInfoByBatchNo(data).then(res => {
|
|
let resList = []
|
resList = res.data.records
|
|
if (resList.length > 0) {
|
let paramObj = {
|
stockList: resList,
|
inLocationId: that.tolocationId, //至库位id
|
id: that.packingInfo.id
|
}
|
|
that.$u.api.pigxPacking.addPackagingItem(paramObj).then(res1 => {
|
|
setTimeout(() => {
|
uni.showModal({
|
title: '提示',
|
content: '包装移库成功',
|
showCancel: false,
|
success: function() {
|
that.loadList();
|
}
|
})
|
}, 200)
|
|
})
|
|
}
|
|
});
|
},
|
async loadList() {
|
|
let that = this
|
that.list = []
|
|
let paramObj = {
|
packagingId: that.packingInfo.id
|
}
|
|
let res = await that.$u.api.pigxPacking.getPackagingItemList(paramObj);
|
let reList = res.data.records
|
|
for (let i = 0; i < reList.length; i++) {
|
|
//库存信息
|
let data = {
|
systemNo: reList[i].systemNo
|
}
|
let resStock = await that.$u.api.pigxPacking.getStockInfo(data)
|
let stockList = resStock.data.records
|
//判断数组中是否存在
|
let stockInfoList = stockList.filter(item => item.id == reList[i].stockId)
|
|
//包装信息
|
let item = {
|
id: reList[i].id,
|
partNo: reList[i].partNo,
|
partName: reList[i].partName,
|
partBatchNo: "",
|
ifsBatchNo: "",
|
unit: "",
|
locationNo: "",
|
availableStockQuantity: "",
|
inLocationNo: reList[i].inLocationNo,
|
systemNo: reList[i].systemNo
|
}
|
|
//库存信息
|
if (stockInfoList.length > 0) {
|
item.partBatchNo = stockInfoList[0].partBatchNo
|
item.ifsBatchNo = stockInfoList[0].ifsBatchNo
|
item.unit = stockInfoList[0].unit
|
item.locationNo = stockInfoList[0].locationNo
|
item.availableStockQuantity = stockInfoList[0].availableStockQuantity
|
}
|
|
that.list.push(item)
|
|
}
|
},
|
//至库位号
|
bindPackLocationChange(e, storage) {
|
|
if (storage.length <= 0) {
|
this.locationIndex = null
|
return
|
}
|
this.locationIndex = e.target.value
|
this.tolocationNo = storage[this.locationIndex].value
|
|
//获取至库位号对应的id基础数据
|
let data = {
|
locNo: this.tolocationNo
|
}
|
this.$u.api.pigxPacking.getBasicLocation(data).then(res => {
|
|
let reList = res.data.records
|
if (reList.length > 0) {
|
this.tolocationId = reList[0].id
|
//测试用
|
// this.scanHandler("KC000006");
|
}
|
});
|
|
},
|
deleteHandle(obj) {
|
let that = this
|
|
uni.showModal({
|
title: '提示',
|
content: '此操作将永久删除系统号:' + obj.systemNo + ', 是否继续?',
|
success: function(res) {
|
if (res.confirm) {
|
|
that.$u.api.pigxPacking.delPackagingItem(obj).then(res => {
|
that.loadList();
|
})
|
}
|
}
|
});
|
}
|
}
|
};
|
</script>
|
<style lang="scss" scoped>
|
.wrap .form {
|
padding: 0px 13px;
|
;
|
}
|
|
.list .content {
|
font-size: 12px;
|
background-color: #efefef;
|
box-sizing: border-box;
|
border-radius: 14rpx;
|
margin: 8px;
|
padding: 5px 10px;
|
box-shadow: none;
|
position: relative;
|
}
|
|
.list .title {
|
display: flex;
|
flex-direction: row;
|
}
|
|
.row-list {
|
display: flex;
|
flex-direction: row;
|
}
|
|
.row-list ._label {
|
flex: 0.8;
|
color: #909399;
|
}
|
|
.row-list ._content {
|
flex: 1.5;
|
text-align: right;
|
}
|
|
.row-img {
|
position: absolute;
|
right: 2px;
|
top: 0px;
|
}
|
</style>
|