|
|
|
@ -45,14 +45,14 @@
|
|
|
|
|
</view>
|
|
|
|
|
<view class="number-right">
|
|
|
|
|
<view class="number-right-title">{{ $t('message.Cumulative') }}</view>
|
|
|
|
|
<u-input v-model="Cumulative" :type="type" :border="border" class="input" disabled />
|
|
|
|
|
<u-input v-model="every.receiptAmount" :type="type" :border="border" class="input" disabled />
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<!-- 库位 -->
|
|
|
|
|
<view class="library">
|
|
|
|
|
<view class="library-left">
|
|
|
|
|
<view>{{ $t('message.CommissionedLocation') }}</view>
|
|
|
|
|
<jPicker sureColor="#ff0000" style="width: 230rpx" @bindpicker="LocationChoice" showKey="value" valKey="value" :val="wlCode" class="search" :options="Location" />
|
|
|
|
|
<jPicker sureColor="#ff0000" style="width: 230rpx" @bindpicker="LocationChoice" showKey="value" valKey="value" :val="wl.value" class="search" :options="Location" />
|
|
|
|
|
</view>
|
|
|
|
|
<view class="library-right">
|
|
|
|
|
<view class="library-right-title">{{ $t('message.CommissionedThisNumber') }}</view>
|
|
|
|
@ -111,31 +111,29 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
|
form: any = {
|
|
|
|
|
documentNo: '',
|
|
|
|
|
};
|
|
|
|
|
material: any = {};
|
|
|
|
|
// 原始物料列表(这里不准确,要修改)
|
|
|
|
|
material: any = [];
|
|
|
|
|
poList: any = [];
|
|
|
|
|
materialList: any = [];
|
|
|
|
|
every: any = '';
|
|
|
|
|
// 当前被选择中原材料
|
|
|
|
|
every: any = {};
|
|
|
|
|
value = '';
|
|
|
|
|
type = 'text';
|
|
|
|
|
border = true;
|
|
|
|
|
//累计数量
|
|
|
|
|
Cumulative: any = 0;
|
|
|
|
|
//判断要添加的库位和已添加的库位是否相等
|
|
|
|
|
sendSpotList: any = [];
|
|
|
|
|
//本次数量
|
|
|
|
|
receiptAmount: any = '';
|
|
|
|
|
//库位
|
|
|
|
|
Location: any = [];
|
|
|
|
|
//添加库位和数量的列表
|
|
|
|
|
//添加的库位和数量的列表
|
|
|
|
|
LocationList: any = [];
|
|
|
|
|
//所选择的库位
|
|
|
|
|
wlCode: any = '';
|
|
|
|
|
//所选择的库位对象
|
|
|
|
|
wl: any = {
|
|
|
|
|
value: null,
|
|
|
|
|
};
|
|
|
|
|
//所选择的采购单号
|
|
|
|
|
poNo: any = '';
|
|
|
|
|
poNo: any = null;
|
|
|
|
|
// 需求数量
|
|
|
|
|
requestAmount = null;
|
|
|
|
|
//上传
|
|
|
|
|
upload: any = [];
|
|
|
|
|
requestAmount: number = null;
|
|
|
|
|
//页面初始化
|
|
|
|
|
async onReady() {
|
|
|
|
|
//页面初始化 获取可选库位
|
|
|
|
@ -165,9 +163,6 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// 1.查询获取物料列表
|
|
|
|
|
// 2.根据物料列表中的poNo过滤返回新列表为采购单
|
|
|
|
|
// 3.物料选择根据poNo过滤返回
|
|
|
|
|
await this.model.queryOrderInInfo(this.form.documentNo);
|
|
|
|
|
let list: any = localStorage.getItem('list');
|
|
|
|
|
localStorage.removeItem('list');
|
|
|
|
@ -214,16 +209,16 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
|
//选择物料后触发的回调事件 本次数量:receiptAmount 需求数量:requestAmount
|
|
|
|
|
materialChoice(e: any) {
|
|
|
|
|
// 待放入新增中的公共对象
|
|
|
|
|
this.every = e.pickerName;
|
|
|
|
|
this.every = { ...e.pickerName };
|
|
|
|
|
}
|
|
|
|
|
//选择库位后触发的回调事件
|
|
|
|
|
LocationChoice(e: any) {
|
|
|
|
|
this.wlCode = e.pickerName.value;
|
|
|
|
|
this.wl = e.pickerName;
|
|
|
|
|
}
|
|
|
|
|
//点击添加
|
|
|
|
|
Add() {
|
|
|
|
|
const count = this.totalLocation(this.LocationList);
|
|
|
|
|
if (this.receiptAmount == '' || this.wlCode == '') {
|
|
|
|
|
if (this.receiptAmount == '' || this.wl.value == '') {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
icon: 'none',
|
|
|
|
|
title: this.$t('message.Commission_tips2') as any,
|
|
|
|
@ -245,7 +240,7 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// 判断已添加库位和新添加库位是否相同,不相同return
|
|
|
|
|
let isTrue = this.LocationList.some((item) => item.wlCode !== this.wlCode);
|
|
|
|
|
let isTrue = this.LocationList.some((item) => item.wlCode !== this.wl.label);
|
|
|
|
|
|
|
|
|
|
if (isTrue) {
|
|
|
|
|
uni.showToast({
|
|
|
|
@ -254,39 +249,48 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const loc = this.Location.find((item) => item.value === this.wlCode);
|
|
|
|
|
this.LocationList.push({
|
|
|
|
|
...loc,
|
|
|
|
|
...this.every,
|
|
|
|
|
wlCode: this.wl.label,
|
|
|
|
|
receiptAmount: this.receiptAmount,
|
|
|
|
|
wlCode: this.wlCode,
|
|
|
|
|
});
|
|
|
|
|
this.every.wllist = this.LocationList;
|
|
|
|
|
this.receiptAmount = '';
|
|
|
|
|
isTrue = true;
|
|
|
|
|
this.business();
|
|
|
|
|
}
|
|
|
|
|
deleteItem(index: any) {
|
|
|
|
|
this.LocationList.splice(index, 1);
|
|
|
|
|
this.every.wllist.splice(index, 1);
|
|
|
|
|
console.log('表格数据', this.LocationList);
|
|
|
|
|
console.log('要上传的数据', this.every);
|
|
|
|
|
this.business();
|
|
|
|
|
}
|
|
|
|
|
// 重置页面数据
|
|
|
|
|
resetForm() {
|
|
|
|
|
// 清空 add table
|
|
|
|
|
this.LocationList = [];
|
|
|
|
|
this.poNo = '';
|
|
|
|
|
// 清空 当前选择的库位对象
|
|
|
|
|
this.wl = {
|
|
|
|
|
value: null,
|
|
|
|
|
};
|
|
|
|
|
// 清空 物料对象
|
|
|
|
|
this.every = {};
|
|
|
|
|
// 清空 去重后的物料列表
|
|
|
|
|
this.materialList = [];
|
|
|
|
|
// 清空 当前累计数量
|
|
|
|
|
this.receiptAmount = null;
|
|
|
|
|
}
|
|
|
|
|
async onSubmit() {
|
|
|
|
|
if (this.every.wllist == null || this.every.wllist.length == 0) {
|
|
|
|
|
this.resetForm();
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (this.LocationList.length === 0) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
icon: 'none',
|
|
|
|
|
title: this.$t('message.Commission_tips5') as any,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
this.upload.push(this.every);
|
|
|
|
|
await this.model.submitOrderInEnter(this.upload);
|
|
|
|
|
this.LocationList = [];
|
|
|
|
|
this.wlCode = '';
|
|
|
|
|
this.receiptAmount = '';
|
|
|
|
|
this.Cumulative = 0;
|
|
|
|
|
this.every = '';
|
|
|
|
|
this.materialList = [];
|
|
|
|
|
this.every.wllist = this.LocationList;
|
|
|
|
|
console.log('new this.every :::: ', this.every);
|
|
|
|
|
// await this.model.submitOrderInEnter([this.every]);
|
|
|
|
|
}
|
|
|
|
|
async bill() {
|
|
|
|
|
if (this.form.documentNo == '') {
|
|
|
|
@ -306,12 +310,7 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
|
}
|
|
|
|
|
//添加和删除操作的时候 计算累计收货数量
|
|
|
|
|
business() {
|
|
|
|
|
let num = 0;
|
|
|
|
|
this.LocationList.forEach((item: any) => {
|
|
|
|
|
num += parseFloat(item.receiptAmount);
|
|
|
|
|
});
|
|
|
|
|
this.Cumulative = num;
|
|
|
|
|
this.every.receiptAmount = num;
|
|
|
|
|
this.every.receiptAmount = this.totalLocation(this.LocationList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|