|
|
@@ -1448,49 +1448,49 @@ const treeUtils = {
|
|
|
if (helper._.isMatch(cb, b)) return node;
|
|
|
}
|
|
|
return null;
|
|
|
- for (const change of changes) {
|
|
|
- for (const changeBills of change.bills) {
|
|
|
- const node = changeBills.gcl_id
|
|
|
- ? tree.nodes.find(x => {return x.id === changeBills.gcl_id})
|
|
|
- : findEmptyBills(tree, change, changeBills);
|
|
|
+ };
|
|
|
+ for (const change of changes) {
|
|
|
+ for (const changeBills of change.bills) {
|
|
|
+ const node = changeBills.gcl_id
|
|
|
+ ? tree.nodes.find(x => {return x.id === changeBills.gcl_id})
|
|
|
+ : findEmptyBills(tree, change, changeBills);
|
|
|
|
|
|
- if (!node) continue;
|
|
|
- if (!node.changeBills) node.changeBills = [];
|
|
|
- node.tz_qc_qty = helper.add(node.tz_qc_qty, changeBills.checked_amount);
|
|
|
- if (tenderInfo.calc_type === 'up') {
|
|
|
- node.tz_qc_tp = helper.add(node.tz_qc_tp, changeBills.checked_price);
|
|
|
- } else {
|
|
|
- node.tz_qc_tp = helper.add(node.tz_qc_tp, changeBills.tp);
|
|
|
- }
|
|
|
+ if (!node) continue;
|
|
|
+ if (!node.changeBills) node.changeBills = [];
|
|
|
+ node.tz_qc_qty = helper.add(node.tz_qc_qty, changeBills.checked_amount);
|
|
|
+ if (tenderInfo.calc_type === 'up') {
|
|
|
+ node.tz_qc_tp = helper.add(node.tz_qc_tp, changeBills.checked_price);
|
|
|
+ } else {
|
|
|
+ node.tz_qc_tp = helper.add(node.tz_qc_tp, changeBills.tp);
|
|
|
+ }
|
|
|
|
|
|
- const posData = pos ? pos.getLedgerPos(node.id) : undefined;
|
|
|
- if (posData && posData.length > 0) {
|
|
|
- for (const p of changeBills.pos) {
|
|
|
- const changePos = p.bwmx ? posData.find(x => { return x.name === p.bwmx; }) : posData[0];
|
|
|
- if (changePos) {
|
|
|
- changePos.tz_qc_qty = helper.add(changePos.tz_qc_qty, p.checked_amount);
|
|
|
- if (!changePos.changeBills) changePos.changeBills = [];
|
|
|
- changePos.changeBills.push({
|
|
|
- code: change.code || '', name: change.name || '', is_valuation: p.is_valuation,
|
|
|
- qty: p.checked_amount || 0, tp: p.checked_price || 0, pos: changePos.name,
|
|
|
- });
|
|
|
- node.changeBills.push({
|
|
|
- code: change.code || '', name: change.name || '', is_valuation: p.is_valuation,
|
|
|
- qty: p.checked_amount || 0, tp: p.checked_price || 0, pos: changePos.name,
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- for (const p of changeBills.pos) {
|
|
|
+ const posData = pos ? pos.getLedgerPos(node.id) : undefined;
|
|
|
+ if (posData && posData.length > 0) {
|
|
|
+ for (const p of changeBills.pos) {
|
|
|
+ const changePos = p.bwmx ? posData.find(x => { return x.name === p.bwmx; }) : posData[0];
|
|
|
+ if (changePos) {
|
|
|
+ changePos.tz_qc_qty = helper.add(changePos.tz_qc_qty, p.checked_amount);
|
|
|
+ if (!changePos.changeBills) changePos.changeBills = [];
|
|
|
+ changePos.changeBills.push({
|
|
|
+ code: change.code || '', name: change.name || '', is_valuation: p.is_valuation,
|
|
|
+ qty: p.checked_amount || 0, tp: p.checked_price || 0, pos: changePos.name,
|
|
|
+ });
|
|
|
node.changeBills.push({
|
|
|
code: change.code || '', name: change.name || '', is_valuation: p.is_valuation,
|
|
|
- qty: p.checked_amount || 0, tp: p.checked_price || 0, pos: '',
|
|
|
+ qty: p.checked_amount || 0, tp: p.checked_price || 0, pos: changePos.name,
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
+ } else {
|
|
|
+ for (const p of changeBills.pos) {
|
|
|
+ node.changeBills.push({
|
|
|
+ code: change.code || '', name: change.name || '', is_valuation: p.is_valuation,
|
|
|
+ qty: p.checked_amount || 0, tp: p.checked_price || 0, pos: '',
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
|