| 
					
				 | 
			
			
				@@ -65,12 +65,12 @@ class loadStageExcelTree { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (!sp) continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 contract_qty = this.ctx.helper.add(contract_qty, p.contract_qty); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                let ssp = sourceStagePos.find(x => { return x.lid === sp.id; }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                let ssp = sourceStagePos.find(x => { return x.pid === sp.id; }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 sourceStagePos.splice(sourceStagePos.indexOf(ssp), 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (ssp) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     this.updatePos.push({ id: ssp.id, contract_qty: p.contract_qty }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    this.insertPos.push({ tid: this.default.tid, sid: this.default.sid, said: this.default.said, times: 1, order: 0, lid: source.id, contract_qty: p.contract_qty }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this.insertPos.push({ tid: this.default.tid, sid: this.default.sid, said: this.default.said, times: 1, order: 0, lid: source.id, pid:sp.id, contract_qty: p.contract_qty }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for (const ssp of sourceStagePos) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -80,7 +80,7 @@ class loadStageExcelTree { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (curStageBills) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 this.updateBills.push({ id: curStageBills.id, contract_qty, contract_tp }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                this.insertBills.push({ tid: this.default.tid, sid: this.default.sid, said: this.default.said, times: 1, order: 0, lid: source.id, contract_qty, contract_tp }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (contract_qty) this.insertBills.push({ tid: this.default.tid, sid: this.default.sid, said: this.default.said, times: 1, order: 0, lid: source.id, contract_qty, contract_tp }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (!node.contract_qty && !node.contract_tp) return; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -314,8 +314,8 @@ module.exports = app => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     columns: ['id', 'lid', 'name', 'porder'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     where: { tid: stage.tid }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                const stageBills = await this.ctx.service.stageBills.getAllDataByCondition({ where: { tid: stage.tid }}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                const stagePos = await this.ctx.service.stagePos.getAllDataByCondition({ where: { tid: stage.tid }}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const stageBills = await this.ctx.service.stageBills.getAllDataByCondition({ where: { sid: stage.id }}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const stagePos = await this.ctx.service.stagePos.getAllDataByCondition({ where: { sid: stage.id }}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 const loadModal = new loadStageExcelTree(this.ctx); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 loadModal.load(cacheTree, {ledgerData, posData, stageBills, stagePos, default: { tid: stage.tid, sid: stage.id, said: this.ctx.session.sessionUser.accountId } }); 
			 |