出库问题修改

master
zhangdi 3 days ago
parent 45beafffa0
commit a64e391e8b
  1. 33
      src/views/firstOrder/components/outDialog.vue

@ -423,36 +423,41 @@ export default {
} }
}, },
getStatistics() { getStatistics() {
let arr = JSON.parse(JSON.stringify(this.sizeForm.inTableData)); let arr = this.sizeForm.inTableData;
arr.forEach((row) => { arr.forEach((row) => {
row.id = row.oneFormId; row.id = row.oneFormId;
}); });
getStatistics(arr).then((res) => { getStatistics(arr).then((res) => {
this.statisticsList = res.data.result; // this.statisticsList = res.data.result;
this.statisticsList = this.statisticsList.map((stat) => { let data_ = res.data.result
// this.statisticsList =
console.log('批量易耗品', this.sizeForm.inTableData, data_)
data_.forEach((stat,index) => {
const detail = this.sizeForm.inTableData.find( const detail = this.sizeForm.inTableData.find(
(item) => item.materialCode === stat.materialCode (item) => item.materialCode === stat.materialCode
); );
//
if (detail) {
// console.log(99999,index, detail, stat.materialCode)
if ( if (
(this.sizeForm.options == 1 && (this.sizeForm.options == 1 &&
this.inBatchForm.optionType == "NY") || this.inBatchForm.optionType == "NY") ||
(this.sizeForm.options == 2 && this.sizeForm.optionType == "NY") (this.sizeForm.options == 2 && this.sizeForm.optionType == "NY")
) { ) {
const detailList = this.sizeForm.inTableData.filter( const detailList = this.sizeForm.inTableData.filter(
(item) => (item) =>
item.materialCode === stat.materialCode && item.materialCode === stat.materialCode &&
item.materialName === stat.materialName item.materialName === stat.materialName
); );
console.log(8989898989, detailList)
detail.theOutboundQuantity = detailList.reduce( detail.theOutboundQuantity = detailList.reduce(
(acc, cur) => acc + cur.theOutboundQuantity, (acc, cur) => cur.theOutboundQuantity,
0 0
); );
} }
this.statisticsList.push({
return {
...stat, ...stat,
theOutboundQuantity: detail.theOutboundQuantity, // theOutboundQuantity: detail.theOutboundQuantity, //
unitPrice: detail.unitPrice, unitPrice: detail.unitPrice,
@ -461,8 +466,12 @@ export default {
departmentName: departmentName:
detail.departmentName || detail.departmentName ||
this.getDepartmentName(detail.department), this.getDepartmentName(detail.department),
}; })
}
}); });
console.log('detail', this.statisticsList)
}); });
}, },
changeDepartment() { changeDepartment() {
@ -638,7 +647,7 @@ export default {
} }
if (res.data && res.data.result) { if (res.data && res.data.result) {
this.sizeForm.inTableData = res.data.result; // this.sizeForm.inTableData = res.data.result;
const selectedDept = this.departmentList.find( const selectedDept = this.departmentList.find(
(dept) => dept.departmentId === this.inBatchForm.department (dept) => dept.departmentId === this.inBatchForm.department
); );
@ -648,6 +657,7 @@ export default {
// 0 // 0
const appQty = Number(item.applicationQuantity || 0); const appQty = Number(item.applicationQuantity || 0);
const outQty = Number(item.outboundQuantity || 0); const outQty = Number(item.outboundQuantity || 0);
const defaultQty = appQty - outQty; const defaultQty = appQty - outQty;
if (this.inBatchForm.optionType === "YH") { if (this.inBatchForm.optionType === "YH") {
item.department = selectedDept.departmentId item.department = selectedDept.departmentId
@ -661,8 +671,9 @@ export default {
theOutboundQuantity: defaultQty > 0 ? defaultQty : 0, theOutboundQuantity: defaultQty > 0 ? defaultQty : 0,
}; };
}); });
this.sizeForm.inTableData = processedData;
this.sizeForm.inTableData = processedData;
//
// //
this.inBatchDialogVisible = false; this.inBatchDialogVisible = false;

Loading…
Cancel
Save