diff --git a/src/common/detail.js b/src/common/detail.js index 59722ec2..35ef4ba1 100644 --- a/src/common/detail.js +++ b/src/common/detail.js @@ -85,7 +85,24 @@ export function getThreeDataSource(data) { return items; } - +export function getDataSourceBatch(subList) { + let items = []; + subList.forEach(detail => { + var item = items.find(r => + r.itemCode == detail.itemCode ) + if (item == undefined) { + item = createItemInfo(detail); + let newDetail = createDetailInfo(detail); // + item.subList.push(newDetail); + items.push(item) + } else { + item.qty = calc.add(item.qty, detail.qty) + let newDetail = createDetailInfo(detail); // + item.subList.push(newDetail); + } + }) + return items; +} export function getDataSource(subList) { let items = [];