|  | @@ -125,11 +125,12 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                  if (!od) continue;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  const nd = {id: od.id};
 | 
	
		
			
				|  |  | -                if (d.name !== undefined) {
 | 
	
		
			
				|  |  | -                    if (od.pre_used) throw '往期已使用,不可修改名称';
 | 
	
		
			
				|  |  | -                    nd.name = d.name;
 | 
	
		
			
				|  |  | +                if (d.name !== undefined) nd.name = d.name;
 | 
	
		
			
				|  |  | +                if (d.unit !== undefined) {
 | 
	
		
			
				|  |  | +                    if (od.pre_used) throw '往期已使用,不可修改单位';
 | 
	
		
			
				|  |  | +                    nd.unit = d.unit;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -                if (d.unit !== undefined) nd.unit = d.unit;
 | 
	
		
			
				|  |  | +                if (d.unit_price !== undefined && od.pre_used) throw '往期已使用,不可修改单价';
 | 
	
		
			
				|  |  |                  nd.unit_price = d.unit_price !== undefined ? this.ctx.helper.round(d.unit_price, info.decimal.up) : od.unit_price;
 | 
	
		
			
				|  |  |                  const precision = this.ctx.helper.findPrecision(info.precision, d.unit);
 | 
	
		
			
				|  |  |                  if (d.order !== undefined) nd.order = d.order;
 | 
	
	
		
			
				|  | @@ -137,7 +138,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                      if (od.pre_used) throw '往期已使用,不可修改数量';
 | 
	
		
			
				|  |  |                      nd.quantity = this.ctx.helper.round(d.quantity, precision.value);
 | 
	
		
			
				|  |  |                      nd.total_price = this.ctx.helper.mul(nd.unit_price, nd.quantity, tpDecimal);
 | 
	
		
			
				|  |  | -                } else if(d.unit_price !== undefined) {
 | 
	
		
			
				|  |  | +                } else if(d.unit_price !== undefined && !od.pre_used) {
 | 
	
		
			
				|  |  |                      nd.total_price = this.ctx.helper.mul(nd.unit_price, od.quantity, tpDecimal);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  if (d.qty !== undefined) {
 | 
	
	
		
			
				|  | @@ -171,12 +172,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  return result;
 | 
	
		
			
				|  |  |              } catch (err) {
 | 
	
		
			
				|  |  | -                if (err.stack) {
 | 
	
		
			
				|  |  | -                    throw err;
 | 
	
		
			
				|  |  | -                } else {
 | 
	
		
			
				|  |  | -                    result.err = err.toString();
 | 
	
		
			
				|  |  | -                    return result;
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | +                throw err;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 |