|  | @@ -855,12 +855,31 @@ rationItemDAO.prototype.batchAddFromExcel = async function(rationRepId, data) {
 | 
	
		
			
				|  |  |      const existCodeList = await this.getRationItemByCondition(condition, ['code'], 'code');
 | 
	
		
			
				|  |  |      // 过滤插入数据
 | 
	
		
			
				|  |  |      let insertData = [];
 | 
	
		
			
				|  |  | +    //已存在定额,则更新价格及rationGLjList字段
 | 
	
		
			
				|  |  | +    let updateData = [];
 | 
	
		
			
				|  |  |      for (const ration of rationData) {
 | 
	
		
			
				|  |  |          if (existCodeList[ration.code] !== undefined) {
 | 
	
		
			
				|  |  | +            updateData.push(ration);
 | 
	
		
			
				|  |  |              continue;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          insertData.push(ration);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +    //更新定额
 | 
	
		
			
				|  |  | +    let updateBulk = [];
 | 
	
		
			
				|  |  | +    for(let ration of updateData){
 | 
	
		
			
				|  |  | +        this.calcForRation(stdGLJListByID, ration);
 | 
	
		
			
				|  |  | +        updateBulk.push({
 | 
	
		
			
				|  |  | +            updateOne: {
 | 
	
		
			
				|  |  | +                filter: {rationRepId: rationRepId, code: ration.code},
 | 
	
		
			
				|  |  | +                update: {$set: {rationGljList: ration.rationGljList, labourPrice: ration.labourPrice, materialPrice: ration.materialPrice,
 | 
	
		
			
				|  |  | +                    machinePrice: ration.machinePrice, basePrice: ration.basePrice}}
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    //更新数据库
 | 
	
		
			
				|  |  | +    if(updateBulk.length > 0){
 | 
	
		
			
				|  |  | +        await rationItemModel.bulkWrite(updateBulk);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |      // 如果都已经存在,直接返回
 | 
	
		
			
				|  |  |      if (insertData.length <= 0) {
 | 
	
		
			
				|  |  |          return true;
 |