|
|
@ -23,14 +23,14 @@
|
|
|
|
<view class="Purchase-title">
|
|
|
|
<view class="Purchase-title">
|
|
|
|
<view class="Purchase">
|
|
|
|
<view class="Purchase">
|
|
|
|
<view>{{ $t('message.Purchase') }}</view>
|
|
|
|
<view>{{ $t('message.Purchase') }}</view>
|
|
|
|
<jPicker sureColor="#ff0000" style="width: 260rpx" @bindpicker="poListChoice" showKey="value" valKey="value" :val="poNoCode" class="search" :options="poList" />
|
|
|
|
<jPicker sureColor="#ff0000" style="width: 260rpx" @bindpicker="poListChoice" showKey="value" valKey="value" :val="poNo" class="search" :options="poList" />
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<!-- 物料 -->
|
|
|
|
<!-- 物料 -->
|
|
|
|
<view class="material">
|
|
|
|
<view class="material">
|
|
|
|
<view class="material-left">
|
|
|
|
<view class="material-left">
|
|
|
|
<view>{{ $t('message.Materiel') }}</view>
|
|
|
|
<view>{{ $t('message.Materiel') }}</view>
|
|
|
|
<jPicker sureColor="#ff0000" style="width: 260rpx" @bindpicker="materialChoice" showKey="value" valKey="value" :val="wlCode" class="search" :options="materialList" />
|
|
|
|
<jPicker sureColor="#ff0000" style="width: 260rpx" @bindpicker="materialChoice" showKey="value" valKey="value" :val="every.materialCode" class="search" :options="materialList" />
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="material-right">
|
|
|
|
<view class="material-right">
|
|
|
|
<view class="material-right-title">{{ $t('message.CommissionedMaterielDesc') }}</view>
|
|
|
|
<view class="material-right-title">{{ $t('message.CommissionedMaterielDesc') }}</view>
|
|
|
@ -89,7 +89,7 @@
|
|
|
|
<u-button type="primary" @click="onSubmit">{{ $t('message.po_Submit') }}</u-button>
|
|
|
|
<u-button type="primary" @click="onSubmit">{{ $t('message.po_Submit') }}</u-button>
|
|
|
|
</u-col>
|
|
|
|
</u-col>
|
|
|
|
<u-col :span="4">
|
|
|
|
<u-col :span="4">
|
|
|
|
<u-button type="error" @click="back">{{ $t('message.po_Return') }}</u-button>
|
|
|
|
<u-button type="error" @click="uni.navigateBack({})">{{ $t('message.po_Return') }}</u-button>
|
|
|
|
</u-col>
|
|
|
|
</u-col>
|
|
|
|
</u-row>
|
|
|
|
</u-row>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
@ -132,7 +132,8 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
wlCode: any = '';
|
|
|
|
wlCode: any = '';
|
|
|
|
//所选择的采购单号
|
|
|
|
//所选择的采购单号
|
|
|
|
poNo: any = '';
|
|
|
|
poNo: any = '';
|
|
|
|
poNoCode: any = '';
|
|
|
|
// 需求数量
|
|
|
|
|
|
|
|
requestAmount = null;
|
|
|
|
//上传
|
|
|
|
//上传
|
|
|
|
upload: any = [];
|
|
|
|
upload: any = [];
|
|
|
|
//页面初始化
|
|
|
|
//页面初始化
|
|
|
@ -172,7 +173,7 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
localStorage.removeItem('list');
|
|
|
|
localStorage.removeItem('list');
|
|
|
|
this.material = JSON.parse(list);
|
|
|
|
this.material = JSON.parse(list);
|
|
|
|
this.poList = [...this.material]; //结构
|
|
|
|
this.poList = [...this.material]; //结构
|
|
|
|
let arr = this.removeDuplicates(this.poList);
|
|
|
|
let arr = this.removeDuplicates(this.poList, 'poNo');
|
|
|
|
// 组装下拉结构
|
|
|
|
// 组装下拉结构
|
|
|
|
arr.forEach((item: any) => {
|
|
|
|
arr.forEach((item: any) => {
|
|
|
|
item.label = item.poNo;
|
|
|
|
item.label = item.poNo;
|
|
|
@ -181,27 +182,28 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
this.poList = arr;
|
|
|
|
this.poList = arr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 去除重复 方法
|
|
|
|
// 去除重复 方法
|
|
|
|
removeDuplicates(list) {
|
|
|
|
// 传入数组 list 及要去重的属性 valueKey
|
|
|
|
|
|
|
|
// 返回去重后的数组对象
|
|
|
|
|
|
|
|
removeDuplicates(list, valueKey: string) {
|
|
|
|
let temp = {};
|
|
|
|
let temp = {};
|
|
|
|
let arr = [];
|
|
|
|
let arr = [];
|
|
|
|
arr = list.reduce(function (item, next) {
|
|
|
|
arr = list.reduce(function (item, next) {
|
|
|
|
temp[next.poNo] ? '' : (temp[next.poNo] = true && item.push(next));
|
|
|
|
temp[next[valueKey]] ? '' : (temp[next[valueKey]] = true && item.push(next));
|
|
|
|
return item;
|
|
|
|
return item;
|
|
|
|
}, []);
|
|
|
|
}, []);
|
|
|
|
return arr;
|
|
|
|
return arr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ADD方法后的库存数量检测
|
|
|
|
|
|
|
|
totalLocation(list: []) {
|
|
|
|
|
|
|
|
const receiptAmount = list.reduce((total: number, nextItem: any): any => {
|
|
|
|
|
|
|
|
return total + +nextItem.receiptAmount;
|
|
|
|
|
|
|
|
}, 0);
|
|
|
|
|
|
|
|
return receiptAmount;
|
|
|
|
|
|
|
|
}
|
|
|
|
//选择采购单后触发的回调事件
|
|
|
|
//选择采购单后触发的回调事件
|
|
|
|
poListChoice(e: any) {
|
|
|
|
poListChoice(e: any) {
|
|
|
|
console.log('选择采购单后触发的回调事件::', 'poListChoice:::', e);
|
|
|
|
|
|
|
|
// 赋值采购单号
|
|
|
|
|
|
|
|
this.poList.some((item, index) => {
|
|
|
|
|
|
|
|
if (item.poNo === e.pickerName.value) {
|
|
|
|
|
|
|
|
this.poNoCode = index;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
this.poNo = e.pickerName.value;
|
|
|
|
this.poNo = e.pickerName.value;
|
|
|
|
this.materialList = this.removeDuplicates(this.material);
|
|
|
|
this.materialList = JSON.parse(JSON.stringify(this.removeDuplicates(this.material, 'materialCode')));
|
|
|
|
this.materialList.forEach((item: any) => {
|
|
|
|
this.materialList.forEach((item: any) => {
|
|
|
|
if (item.poNo == e.pickerName.value) {
|
|
|
|
if (item.poNo == e.pickerName.value) {
|
|
|
|
item.label = item.materialCode;
|
|
|
|
item.label = item.materialCode;
|
|
|
@ -211,21 +213,16 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//选择物料后触发的回调事件 本次数量:receiptAmount 需求数量:requestAmount
|
|
|
|
//选择物料后触发的回调事件 本次数量:receiptAmount 需求数量:requestAmount
|
|
|
|
materialChoice(e: any) {
|
|
|
|
materialChoice(e: any) {
|
|
|
|
|
|
|
|
// 待放入新增中的公共对象
|
|
|
|
this.every = e.pickerName;
|
|
|
|
this.every = e.pickerName;
|
|
|
|
this.materialList.some((item, index) => {
|
|
|
|
|
|
|
|
if (item.poNo === e.pickerName.value) {
|
|
|
|
|
|
|
|
this.wlCode = index;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//选择库位后触发的回调事件
|
|
|
|
//选择库位后触发的回调事件
|
|
|
|
LocationChoice(e: any) {
|
|
|
|
LocationChoice(e: any) {
|
|
|
|
console.log('e>>>>>>>>>>>>>>>>>>>>>>>>', e);
|
|
|
|
this.wlCode = e.pickerName.value;
|
|
|
|
this.wlCode = e.pickerName;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//点击添加
|
|
|
|
//点击添加
|
|
|
|
Add() {
|
|
|
|
Add() {
|
|
|
|
|
|
|
|
const count = this.totalLocation(this.LocationList);
|
|
|
|
if (this.receiptAmount == '' || this.wlCode == '') {
|
|
|
|
if (this.receiptAmount == '' || this.wlCode == '') {
|
|
|
|
uni.showToast({
|
|
|
|
uni.showToast({
|
|
|
|
icon: 'none',
|
|
|
|
icon: 'none',
|
|
|
@ -240,40 +237,30 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (parseFloat(this.receiptAmount) > this.every.requestAmount) {
|
|
|
|
if (parseFloat(this.receiptAmount) > this.every.requestAmount || +this.receiptAmount + count > this.every.requestAmount) {
|
|
|
|
uni.showToast({
|
|
|
|
uni.showToast({
|
|
|
|
icon: 'none',
|
|
|
|
icon: 'none',
|
|
|
|
title: this.$t('message.Commission_tips4') as any,
|
|
|
|
title: this.$t('message.Commission_tips4') as any,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let isTrue = true;
|
|
|
|
// 判断已添加库位和新添加库位是否相同,不相同return
|
|
|
|
if (this.sendSpotList.length != 0) {
|
|
|
|
let isTrue = this.LocationList.some((item) => item.wlCode !== this.wlCode);
|
|
|
|
this.sendSpotList.forEach((item: any) => {
|
|
|
|
|
|
|
|
if (this.wlCode.sendSpot != item) {
|
|
|
|
if (isTrue) {
|
|
|
|
isTrue = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isTrue != true) {
|
|
|
|
|
|
|
|
uni.showToast({
|
|
|
|
uni.showToast({
|
|
|
|
icon: 'none',
|
|
|
|
icon: 'none',
|
|
|
|
title: this.$t('message._tips5') as any,
|
|
|
|
title: this.$t('message._tips5') as any,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let objString = JSON.stringify(this.every);
|
|
|
|
const loc = this.Location.find((item) => item.value === this.wlCode);
|
|
|
|
let TEM = JSON.parse(objString);
|
|
|
|
this.LocationList.push({
|
|
|
|
TEM.wllist = null;
|
|
|
|
...loc,
|
|
|
|
TEM.receiptAmount = this.receiptAmount;
|
|
|
|
receiptAmount: this.receiptAmount,
|
|
|
|
TEM.wlCode = this.wlCode.label;
|
|
|
|
wlCode: this.wlCode,
|
|
|
|
this.sendSpotList.push(this.wlCode.sendSpot);
|
|
|
|
});
|
|
|
|
console.log('this.sendSpotList', this.sendSpotList);
|
|
|
|
|
|
|
|
console.log('TEM', TEM);
|
|
|
|
|
|
|
|
this.LocationList.push(TEM);
|
|
|
|
|
|
|
|
this.every.wllist = this.LocationList;
|
|
|
|
this.every.wllist = this.LocationList;
|
|
|
|
console.log('表格数据', this.LocationList);
|
|
|
|
|
|
|
|
console.log('要上传的数据', this.every);
|
|
|
|
|
|
|
|
this.receiptAmount = '';
|
|
|
|
this.receiptAmount = '';
|
|
|
|
isTrue = true;
|
|
|
|
isTrue = true;
|
|
|
|
this.business();
|
|
|
|
this.business();
|
|
|
@ -315,7 +302,7 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
dnNo: this.form.documentNo,
|
|
|
|
dnNo: this.form.documentNo,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
await this.model.querydetaildlist(content);
|
|
|
|
await this.model.querydetaildlist(content);
|
|
|
|
this.redirectTo(this.page.raw.ingoods.dnReceipt.Local);
|
|
|
|
this.toPage(this.page.raw.ingoods.dnReceipt.Local);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//添加和删除操作的时候 计算累计收货数量
|
|
|
|
//添加和删除操作的时候 计算累计收货数量
|
|
|
|
business() {
|
|
|
|
business() {
|
|
|
@ -325,7 +312,6 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
this.Cumulative = num;
|
|
|
|
this.Cumulative = num;
|
|
|
|
this.every.receiptAmount = num;
|
|
|
|
this.every.receiptAmount = num;
|
|
|
|
console.log('this.every', this.every);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|