| 
					
				 | 
			
			
				@@ -137,7 +137,7 @@ class revisePriceCalc { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 加载树结构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         const bills = await this.ctx.service.ledger.getData(stage.tid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.ctx.helper.assignRelaData(bills, [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            { data: curBillsData, fields: ['id', 'contract_qty', 'qc_qty', 'positive_qc_qty', 'negative_qc_qty', 'postil', 'times', 'order'], prefix: 'cur_', relaId: 'lid' }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { data: curBillsData, fields: ['id', 'contract_qty', 'qc_qty', 'positive_qc_qty', 'negative_qc_qty', 'postil', 'times', 'order', 'ex_stage_qty1'], prefix: 'cur_', relaId: 'lid' }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { data: preBillsData, fields: ['id', 'contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'unit_price', 'positive_qc_qty', 'negative_qc_qty', 'positive_qc_tp', 'negative_qc_tp'], prefix: 'pre_', relaId: 'lid' }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         const billsTree = new Ledger.billsTree(this.ctx, { id: 'ledger_id', pid: 'ledger_pid', order: 'order', level: 'level', rootId: -1, calcFields: [] }); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -154,12 +154,13 @@ class revisePriceCalc { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (node.children && node.children.length > 0) return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // const priceDiff = helper.sub(node.unit_price, node.pre_unit_price); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // if (!priceDiff) return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (node.cur_id && (node.cur_contract_qty || node.cur_qc_qty)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (node.cur_id && (node.cur_contract_qty || node.cur_qc_qty || node.cur_ex_stage_qty1)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 const cur_contract_tp = helper.mul(node.cur_contract_qty, node.unit_price, decimal.tp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 const cur_qc_tp = helper.mul(node.cur_qc_qty, node.unit_price, decimal.tp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 const cur_positive_qc_tp = helper.mul(node.cur_positive_qc_qty, node.unit_price, decimal.tp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 const cur_negative_qc_tp = helper.mul(node.cur_negative_qc_qty, node.unit_price, decimal.tp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (cur_contract_tp !== node.cur_contract_tp || cur_qc_tp !== node.cur_qc_tp || cur_positive_qc_tp !== node.cur_positive_qc_tp || cur_negative_qc_tp !== node.cur_positive_qc_tp) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const cur_ex_stage_tp1 = helper.mul(node.cur_ex_stage_qty1, node.unit_price, decimal.tp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (cur_contract_tp !== node.cur_contract_tp || cur_qc_tp !== node.cur_qc_tp || cur_positive_qc_tp !== node.cur_positive_qc_tp || cur_negative_qc_tp !== node.cur_positive_qc_tp || cur_ex_stage_tp1 !== node.cur_ex_stage_tp1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     result.ibData.push({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         tid: stage.tid, sid: stage.id, said, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         lid: node.id, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -168,6 +169,7 @@ class revisePriceCalc { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         qc_qty: node.cur_qc_qty, qc_tp: cur_qc_tp, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         positive_qc_qty: node.cur_positive_qc_qty, positive_qc_tp: cur_positive_qc_tp, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         negative_qc_qty: node.cur_negative_qc_qty, negative_qc_tp: cur_negative_qc_tp, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        ex_stage_qty1: node.cur_ex_stage_qty1, ex_stage_tp1: cur_ex_stage_tp1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         postil: node.postil, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -334,7 +336,7 @@ class revisePriceCalc { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 加载树结构 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.ctx.helper.assignRelaData(bills, [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            { data: curBillsData, fields: ['id', 'contract_qty', 'qc_qty', 'positive_qc_qty', 'negative_qc_qty', 'times', 'order', 'postil'], prefix: 'cur_', relaId: 'lid' }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { data: curBillsData, fields: ['id', 'contract_qty', 'qc_qty', 'positive_qc_qty', 'negative_qc_qty', 'times', 'order', 'postil', 'ex_stage_qty1', 'ex_stage_tp1'], prefix: 'cur_', relaId: 'lid' }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { data: preBillsData, fields: ['id', 'contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'unit_price', 'positive_qc_qty', 'negative_qc_qty', 'positive_qc_tp', 'negative_qc_tp'], prefix: 'pre_', relaId: 'lid' }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ], 'id', true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         const billsTree = new Ledger.billsTree(this.ctx, { id: 'ledger_id', pid: 'ledger_pid', order: 'order', level: 'level', rootId: -1, calcFields: [] }); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -348,17 +350,19 @@ class revisePriceCalc { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         const said = this.ctx.session.sessionUser.accountId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         billsTree.calculateAll(node => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (node.children && node.children.length > 0) return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (node.cur_id && (node.cur_contract_qty || node.cur_qc_qty)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (node.cur_id && (node.cur_contract_qty || node.cur_qc_qty || node.cur_ex_stage_qty1)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 const cur_contract_tp = helper.mul(node.cur_contract_qty, node.unit_price, decimal.tp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 const cur_qc_tp = helper.mul(node.cur_qc_qty, node.unit_price, decimal.tp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 const cur_positive_qc_tp = helper.mul(node.cur_positive_qc_qty, node.unit_price, decimal.tp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 const cur_negative_qc_tp = helper.mul(node.cur_negative_qc_qty, node.unit_price, decimal.tp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (cur_contract_tp !== node.cur_contract_tp || cur_qc_tp !== node.cur_qc_tp || cur_positive_qc_tp !== node.cur_positive_qc_tp || cur_negative_qc_tp !== node.cur_positive_qc_tp) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const cur_ex_stage_tp1 = helper.mul(node.cur_ex_stage_qty1, node.unit_price, decimal.tp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (cur_contract_tp !== node.cur_contract_tp || cur_qc_tp !== node.cur_qc_tp || cur_positive_qc_tp !== node.cur_positive_qc_tp || cur_negative_qc_tp !== node.cur_positive_qc_tp || cur_ex_stage_tp1 !== node.cur_ex_stage_tp1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if (node.cur_times === stage.times && node.cur_order === 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         result.ubData.push({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             id: node.cur_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             contract_tp: cur_contract_tp, qc_tp: cur_qc_tp, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             positive_qc_tp: cur_positive_qc_tp, negative_qc_tp: cur_negative_qc_tp, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            ex_stage_tp1: cur_ex_stage_tp1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         result.ibData.push({ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -368,6 +372,7 @@ class revisePriceCalc { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             qc_qty: node.cur_qc_qty, qc_tp: cur_qc_tp, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             positive_qc_qty: node.cur_positive_qc_qty, positive_qc_tp: cur_positive_qc_tp, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             negative_qc_qty: node.cur_negative_qc_qty, negative_qc_tp: cur_negative_qc_tp, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            ex_stage_qty1: node.cur_ex_stage_qty1, ex_stage_tp1: cur_ex_stage_tp1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             postil: node.cur_postil, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 |