库存问题修改

master
zhangdi 2 weeks ago
parent beb09ad270
commit 701a54e4b6
  1. 48
      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,12 +584,13 @@ 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
); );
} }
return { return {
...stat, ...stat,
theOutboundQuantity: detail.theOutboundQuantity, // theOutboundQuantity: detail.theOutboundQuantity, //
@ -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(
if (invalidRow) { (row) => !row.department
this.$message.error("存在未选择部门的物资,请补充完整"); );
return; if (invalidRow) {
} this.$message.error("存在未选择部门的物资,请补充完整");
return;
}
} }
// status == 1 2 // status == 1 2
this.sizeForm.status = index; this.sizeForm.status = index;
@ -937,15 +942,12 @@ export default {
(row) => { (row) => {
const deptId = row.department; const deptId = row.department;
const dept = this.list.find((item) => item.departmentId === deptId); const dept = this.list.find((item) => item.departmentId === deptId);
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,
@ -962,7 +964,7 @@ export default {
if (this.sizeForm.options == 1) { if (this.sizeForm.options == 1) {
this.sizeForm.optionType = this.inBatchForm.optionType; this.sizeForm.optionType = this.inBatchForm.optionType;
} }
try { try {
console.log(this.sizeForm, "提交数据"); console.log(this.sizeForm, "提交数据");
this.saveLoading = true; this.saveLoading = true;
@ -992,7 +994,7 @@ export default {
const { ldOneOutStorage, ldOneOutStorageDetails } = const { ldOneOutStorage, ldOneOutStorageDetails } =
res.data.result || {}; res.data.result || {};
// this.sizeForm = res.data.result.ldOneOutStorage // this.sizeForm = res.data.result.ldOneOutStorage
// this.sizeForm.id = // this.sizeForm.id =
this.sizeForm.inTableData = res.data.result.ldOneOutStorageDetails; this.sizeForm.inTableData = res.data.result.ldOneOutStorageDetails;
this.sizeForm.orderNo = ldOneOutStorage.orderNo; this.sizeForm.orderNo = ldOneOutStorage.orderNo;
this.sizeForm.reason = ldOneOutStorage.reason; this.sizeForm.reason = ldOneOutStorage.reason;
@ -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