|  | @@ -25,7 +25,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |              this.qtyFields = ['contract_qty', 'qc_qty']
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        _getPosFilterSql(where, asTable) {
 | 
	
		
			
				|  |  | +        _getPosFilterSql(where, asTable = '') {
 | 
	
		
			
				|  |  |              let whereSql = '';
 | 
	
		
			
				|  |  |              if (!where) return whereSql;
 | 
	
		
			
				|  |  |              if (where.pid) {
 | 
	
	
		
			
				|  | @@ -54,7 +54,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |           */
 | 
	
		
			
				|  |  |          async getLastestStageData(tid, sid, where) {
 | 
	
		
			
				|  |  |              const filterSql = this._getPosFilterSql(where);
 | 
	
		
			
				|  |  | -            const sql = 'SELECT Pos.lid, Pos.pid, Pos.contract_qty, Pos.qc_qty, Pos.postil FROM ' +
 | 
	
		
			
				|  |  | +            const sql = 'SELECT Pos.lid, Pos.pid, Pos.contract_qty, Pos.qc_qty, Pos.postil, Pos.times, Pos.order FROM ' +
 | 
	
		
			
				|  |  |                  '  (SELECT * FROM ' + this.tableName + ' WHERE tid = ? And sid = ?) As Pos ' +
 | 
	
		
			
				|  |  |                  '  INNER JOIN ( ' +
 | 
	
		
			
				|  |  |                  '    SELECT MAX(`times` * ' + timesLen + ' + `order`) As `flow`, `tid`, `sid`, `pid` From ' + this.tableName +
 | 
	
	
		
			
				|  | @@ -76,7 +76,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |           */
 | 
	
		
			
				|  |  |          async getAuditorStageData(tid, sid, times, order, where) {
 | 
	
		
			
				|  |  |              const filterSql = this._getPosFilterSql(where);
 | 
	
		
			
				|  |  | -            const sql = 'SELECT Pos.pid, Pos.lid, Pos.contract_qty, Pos.qc_qty, Pos.postil FROM ' +
 | 
	
		
			
				|  |  | +            const sql = 'SELECT Pos.pid, Pos.lid, Pos.contract_qty, Pos.qc_qty, Pos.postil, Pos.times, Pos.order FROM ' +
 | 
	
		
			
				|  |  |                  '  (SELECT * FROM '+ this.tableName + ' WHERE tid = ? And sid = ?) As Pos ' +
 | 
	
		
			
				|  |  |                  '  INNER JOIN ( ' +
 | 
	
		
			
				|  |  |                  '    SELECT MAX(`times` * ' + timesLen + ' + `order`) As `flow`, `pid`, `sid` From ' + this.tableName +
 | 
	
	
		
			
				|  | @@ -315,7 +315,12 @@ module.exports = app => {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          async updateChangeQuantity(transaction, pos, qty) {
 | 
	
		
			
				|  |  | -            const orgPos = await this.getLastestStageData(this.ctx.tender.id, this.ctx.stage.id, {pid: pos.id})[0];
 | 
	
		
			
				|  |  | +            let orgPos = await this.getLastestStageData(this.ctx.tender.id, this.ctx.stage.id, {pid: pos.id});
 | 
	
		
			
				|  |  | +            if (orgPos.length > 1) {
 | 
	
		
			
				|  |  | +                throw '数据错误';
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                orgPos = orgPos[0];
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |              if (orgPos && orgPos.times === this.ctx.stage.curTimes && orgPos.order === this.ctx.stage.curOrder) {
 | 
	
		
			
				|  |  |                  await transaction.update(this.tableName, {id: orgPos.id, qc_qty: qty});
 | 
	
		
			
				|  |  |              } else {
 |