库存问题修改

master
zhangdi 2 weeks ago
parent beb09ad270
commit 701a54e4b6
  1. 32
      src/views/firstOrder/components/outDialog.vue

@ -563,7 +563,11 @@ export default {
} }
}, },
getStatistics() { getStatistics() {
getStatistics(this.sizeForm.inTableData).then((res) => { let arr = JSON.parse(JSON.stringify(this.sizeForm.inTableData));
arr.forEach((row) => {
row.id = row.oneFormId;
});
getStatistics(arr).then((res) => {
this.statisticsList = res.data.result; this.statisticsList = res.data.result;
this.statisticsList = this.statisticsList.map((stat) => { this.statisticsList = this.statisticsList.map((stat) => {
const detail = this.sizeForm.inTableData.find( const detail = this.sizeForm.inTableData.find(
@ -580,8 +584,9 @@ export default {
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.num, (acc, cur) => acc + cur.theOutboundQuantity,
0 0
); );
} }
@ -600,7 +605,6 @@ export default {
}); });
}, },
changeDepartment() { changeDepartment() {
this.getStatistics(); this.getStatistics();
}, },
batchclose() { batchclose() {
@ -917,14 +921,15 @@ export default {
} }
} }
} }
if(this.sizeForm.options==2 ){ if (this.sizeForm.options == 2) {
console.log(898989,'易耗是否选择部门!') console.log(898989, "易耗是否选择部门!");
const invalidRow = this.sizeForm.inTableData.find(row => !row.department); const invalidRow = this.sizeForm.inTableData.find(
(row) => !row.department
);
if (invalidRow) { if (invalidRow) {
this.$message.error("存在未选择部门的物资,请补充完整"); this.$message.error("存在未选择部门的物资,请补充完整");
return; return;
} }
} }
// status == 1 2 // status == 1 2
this.sizeForm.status = index; this.sizeForm.status = index;
@ -941,11 +946,8 @@ export default {
let select = this.sizeForm.inTableData.find( let select = this.sizeForm.inTableData.find(
(item) => item.materialId === row.materialId (item) => item.materialId === row.materialId
); );
console.log(99999,select,this.sizeForm.inTableData) console.log(99999, select, this.sizeForm.inTableData);
const oneFormId = const oneFormId = row.oneFormId
this.sizeForm.options === 1 && this.outDialogTiltle == "编辑"
? row.oneFormId
: select.id;
return { return {
...row, ...row,
@ -1001,13 +1003,11 @@ export default {
this.sizeForm.options = Number(ldOneOutStorage.options); this.sizeForm.options = Number(ldOneOutStorage.options);
this.sizeForm.optionType = ldOneOutStorage.optionType; this.sizeForm.optionType = ldOneOutStorage.optionType;
this.batchSelectionVisible = false; this.batchSelectionVisible = false;
this.inBatchForm.optionType = ldOneOutStorage.optionType this.inBatchForm.optionType = ldOneOutStorage.optionType;
if (this.sizeForm.options == 2 && this.sizeForm.optionType == "YH") { if (this.sizeForm.options == 2 && this.sizeForm.optionType == "YH") {
this.getMaterialList(); this.getMaterialList();
} }
this.sizeForm.inTableData.forEach((row) => {
row.id = row.oneFormId;
});
this.$set(this.sizeForm, "inTableData", ldOneOutStorageDetails); this.$set(this.sizeForm, "inTableData", ldOneOutStorageDetails);
this.getStatistics(); this.getStatistics();
}); });

Loading…
Cancel
Save