|
@@ -181,10 +181,26 @@ export default {
|
|
|
if (this.formDialogType == 0) {
|
|
|
row['specsName'] = res?.specsName
|
|
|
row['unit'] = res?.unit
|
|
|
- row['insideQty'] = Number(res?.insideQty) * Number(row?.qty)
|
|
|
- row['outQty'] = Number(res?.outQty) * Number(row?.qty)
|
|
|
- row['partsQty'] = Number(res?.partsQty) * Number(row?.qty)
|
|
|
row['stockQty'] = res?.stockQty
|
|
|
+ row['insideQty'] =
|
|
|
+ [
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ ...res.items.filter(item => item.type === 'INSIDE').map(item => item.qty)
|
|
|
+ ].reduce((accumulator, currentValue) => accumulator + currentValue, 0) * Number(row?.qty)
|
|
|
+ row['outQty'] =
|
|
|
+ [0, 0, 0, ...res.items.filter(item => item.type === 'OUT').map(item => item.qty)].reduce(
|
|
|
+ (accumulator, currentValue) => accumulator + currentValue,
|
|
|
+ 0
|
|
|
+ ) * Number(row?.qty)
|
|
|
+ row['partsQty'] =
|
|
|
+ [
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ ...res.items.filter(item => item.type === 'PARTS').map(item => item.qty)
|
|
|
+ ].reduce((accumulator, currentValue) => accumulator + currentValue, 0) * Number(row?.qty)
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
@@ -259,9 +275,27 @@ export default {
|
|
|
.find(item => item.id == row.goodsMaterialId),
|
|
|
res => {
|
|
|
if (this.formDialogType == 0) {
|
|
|
- row['insideQty'] = Number(res?.insideQty) * row[column.columnAttributes.prop]
|
|
|
- row['outQty'] = Number(res?.outQty) * row[column.columnAttributes.prop]
|
|
|
- row['partsQty'] = Number(res?.partsQty) * row[column.columnAttributes.prop]
|
|
|
+ row['insideQty'] =
|
|
|
+ [
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ ...res.items.filter(item => item.type === 'INSIDE').map(item => item.qty)
|
|
|
+ ].reduce((accumulator, currentValue) => accumulator + currentValue, 0) *
|
|
|
+ row[column.columnAttributes.prop]
|
|
|
+ row['outQty'] =
|
|
|
+ [0, 0, 0, ...res.items.filter(item => item.type === 'OUT').map(item => item.qty)].reduce(
|
|
|
+ (accumulator, currentValue) => accumulator + currentValue,
|
|
|
+ 0
|
|
|
+ ) * row[column.columnAttributes.prop]
|
|
|
+ row['partsQty'] =
|
|
|
+ [
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ ...res.items.filter(item => item.type === 'PARTS').map(item => item.qty)
|
|
|
+ ].reduce((accumulator, currentValue) => accumulator + currentValue, 0) *
|
|
|
+ row[column.columnAttributes.prop]
|
|
|
}
|
|
|
}
|
|
|
)
|