|  |  | 
 |  |  |         public String IncorrectDataComment; | 
 |  |  |         public String ReturnType; | 
 |  |  |         public String InspectType; | 
 |  |  |         //WLIG-CC78MX 【委托】NFM105接口增加OTS运单号字段 thh 20220307 start | 
 |  |  |         // public String OTSRepairOrder; | 
 |  |  |         //WLIG-CC78MX 【委托】NFM105接口增加OTS运单号字段 thh 20220307 end | 
 |  |  |         public InspectionResultInformation[] InspectionResultInformation; | 
 |  |  |         public FailureInformation[] FailureInformation; | 
 |  |  |     } | 
 |  |  | 
 |  |  |                                     , Return_Without_Repair_IF__c, Return_Without_Repair_Reason__c | 
 |  |  |                                     , Repair_Quotation_Id__c, NFM105_MessageGroupNumber__c, Repair_List_Price_formula__c | 
 |  |  |                                     , ReturnType__c, InspectType__c | 
 |  |  |                                     ,Maintenance_Contract__r.URF_Contract__c | 
 |  |  |                                     , Maintenance_Contract__r.URF_Contract__c | 
 |  |  |                                     ,Maintenance_Contract__c | 
 |  |  |                                     ,SerialNumber__c | 
 |  |  |                                     ,Agreed_Date__c  | 
 |  |  | 
 |  |  |                     //                        continue; | 
 |  |  |                     //                    } | 
 |  |  |                     logstr += ' '; | 
 |  |  |                     System.debug('rpr1:' + rpr); | 
 |  |  |                     rprUpdateMap.put(rpr.SAPRepairNo__c, rpr); | 
 |  |  |                 } else { | 
 |  |  |                     logstr += quoteInfo.SAPRepairNo + ':' + quoteInfo.RepairOrderStatusCode + '(' + quoteInfo.SAPQuotationNo + ') '; | 
 |  |  | 
 |  |  |                     // L60-SORC修理品出库 | 
 |  |  |                     // L65-OGZ修理品出库 | 
 |  |  |                     // L80-RC修理品出库 | 
 |  |  |                     //WLIG-CC78MX 【委托】NFM105接口增加OTS运单号字段 thh 20220307 start | 
 |  |  |                     // if(String.isNotBlank(quoteInfo.OTSRepairOrder)){ | 
 |  |  |                     //     rpr.OTSRepairOrder__c = quoteInfo.OTSRepairOrder; | 
 |  |  |                     // } | 
 |  |  |                     //WLIG-CC78MX 【委托】NFM105接口增加OTS运单号字段 thh 20220307 end | 
 |  |  |                     Asset ast = getAstUpdate(astUpdateMap, rpr); | 
 |  |  |                     if (rpr.Return_Without_Repair_IF__c == true) { | 
 |  |  |                         rpr.Return_Without_Repair_Date__c = statusUpdateDateTime.date(); | 
 |  |  | 
 |  |  |             3.根据限次合同查到该合同下的所有修理  | 
 |  |  |             */ | 
 |  |  |             logstr += '\n rprList::'+rprList; | 
 |  |  |             if (rprList.size() > 0) { | 
 |  |  |             // 20220321 ljh 限次合同异常数据 update start | 
 |  |  |             /*if (rprList.size() > 0) { | 
 |  |  |                 //需要知道当前修理对应的设备的系列号 | 
 |  |  |                 Map<String,String> reurfMap = new Map<String,String>(); | 
 |  |  |                 //限次合同Id集合 | 
 |  |  | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |             } | 
 |  |  |             }*/ | 
 |  |  |             //add by rentx 2021-3-4 end | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             if (rprList.size() > 0) { | 
 |  |  |                 //contractAssetUrfMap<维修合同+保有设备,限次系列> | 
 |  |  |                 Map<String,String> contractAssetUrfMap = new Map<String,String>(); | 
 |  |  |                 //限次合同Id集合 | 
 |  |  |                 List<Id> contractIds = new List<Id>(); | 
 |  |  |                 //限次合同下的修理集合 | 
 |  |  |                 List<Repair__c> reList = new List<Repair__c>(); | 
 |  |  |                 // 限次合同 map | 
 |  |  |                 Map<String,Map<String,List<Repair__c>>> contractMap = new Map<String,Map<String,List<Repair__c>>>(); | 
 |  |  |                 //维修合同保有设备集合 | 
 |  |  |                 List<Maintenance_Contract_Asset__c> maassList = new List<Maintenance_Contract_Asset__c>(); | 
 |  |  |                 // 需要更新的 维修合同报价/保有设备 | 
 |  |  |                 List<Maintenance_Contract_Asset_Estimate__c> updateList = new List<Maintenance_Contract_Asset_Estimate__c>(); | 
 |  |  |                 //查询当前修理对应的维修合同是否为限次合同 && 大修 | 
 |  |  |                 for (Repair__c rep : rprList) { | 
 |  |  |                     if (rep.Maintenance_Contract__c != null && rep.Maintenance_Contract__r.URF_Contract__c == true && (rep.Repair_Rank__c == 'A' || rep.Repair_Rank__c == 'B' || rep.Repair_Rank__c == 'C') && rep.Agreed_Date__c != null) {  | 
 |  |  |                         contractIds.add(rep.Maintenance_Contract__c); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 //查询当前限次合同下的所有维修合同保有设备 | 
 |  |  |                 maassList = [SELECT id , Series_RepairCount_F__c | 
 |  |  |                                 , Maintenance_Contract_Asset_Estimate__c | 
 |  |  |                                 , Asset__c | 
 |  |  |                                 , Maintenance_Contract__c | 
 |  |  |                                 , URF_Series_F__c | 
 |  |  |                                 FROM Maintenance_Contract_Asset__c  | 
 |  |  |                                 WHERE Maintenance_Contract__c in :contractIds]; | 
 |  |  |                 for (Maintenance_Contract_Asset__c maAss : maassList) { | 
 |  |  |                     // contractAssetUrfMap<维修合同+保有设备,限次系列> | 
 |  |  |                     String keyV = maAss.Maintenance_Contract__c +';'+ maAss.Asset__c; | 
 |  |  |                     if (!contractAssetUrfMap.containsKey(keyV) && String.isNotBlank(maAss.URF_Series_F__c)) { | 
 |  |  |                         contractAssetUrfMap.put(keyV, maAss.URF_Series_F__c); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 //查询维修合同下的所有修理 | 
 |  |  |                 reList = [select id,Maintenance_Contract__c,Delivered_Product__c,Usage_Ratio_Price_Service__c from Repair__c where (Repair_Rank__c = 'A' OR Repair_Rank__c = 'B' OR Repair_Rank__c = 'C') and Agreed_Date__c <> null and Maintenance_Contract__c in :contractIds ]; | 
 |  |  |                 system.debug('zheli:'+reList.size()); | 
 |  |  |                 for (Repair__c rep : reList) { | 
 |  |  |                     List<Repair__c> tempRepL00; | 
 |  |  |                     List<Repair__c> tempRepL01; | 
 |  |  |                     List<Repair__c> tempRepL02; | 
 |  |  |                     List<Repair__c> tempRepL03; | 
 |  |  |                     Map<String,List<Repair__c>> tempRepM; | 
 |  |  |                     String keyV = rep.Maintenance_Contract__c +';'+rep.Delivered_Product__c; | 
 |  |  |                     if(contractMap.containsKey(rep.Maintenance_Contract__c)){ | 
 |  |  |                         tempRepM = contractMap.get(rep.Maintenance_Contract__c); | 
 |  |  |                         // 保有设备 和 限次系列 | 
 |  |  |                         if(tempRepM.containsKey(rep.Delivered_Product__c)){ | 
 |  |  |                             tempRepL02 = tempRepM.get(rep.Delivered_Product__c); | 
 |  |  |                         }else{ | 
 |  |  |                             tempRepL02 = new List<Repair__c>(); | 
 |  |  |                         } | 
 |  |  |                         tempRepL02.add(rep); | 
 |  |  |                         tempRepM.put(rep.Delivered_Product__c,tempRepL02); | 
 |  |  |                         if(contractAssetUrfMap.containsKey(keyV)){ | 
 |  |  |                             if(tempRepM.containsKey(contractAssetUrfMap.get(keyV))){ | 
 |  |  |                                 tempRepL03 = tempRepM.get(contractAssetUrfMap.get(keyV)); | 
 |  |  |                             }else{ | 
 |  |  |                                 tempRepL03 = new List<Repair__c>(); | 
 |  |  |                             } | 
 |  |  |                             tempRepL03.add(rep); | 
 |  |  |                             tempRepM.put(contractAssetUrfMap.get(keyV),tempRepL03); | 
 |  |  |                         } | 
 |  |  |                     }else{ | 
 |  |  |                         tempRepM = new Map<String,List<Repair__c>>(); | 
 |  |  |                         tempRepL00 = new List<Repair__c>();  | 
 |  |  |                         tempRepL00.add(rep); | 
 |  |  |                         tempRepL01 = new List<Repair__c>();  | 
 |  |  |                         tempRepL01.add(rep);             | 
 |  |  |                         tempRepM.put(rep.Delivered_Product__c,tempRepL00); | 
 |  |  |                         if(contractAssetUrfMap.containsKey(keyV)){ | 
 |  |  |                             tempRepM.put(contractAssetUrfMap.get(keyV),tempRepL01); | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                     contractMap.put(rep.Maintenance_Contract__c,tempRepM);   | 
 |  |  |                 } | 
 |  |  |                 if (contractMap.size() > 0) { | 
 |  |  |                     for (Maintenance_Contract_Asset__c maAss : maassList) { | 
 |  |  |                         // 判断已维修次数是否发生改变 | 
 |  |  |                         if (contractMap.get(maAss.Maintenance_Contract__c) != null | 
 |  |  |                             && contractMap.get(maAss.Maintenance_Contract__c).size() != 0 | 
 |  |  |                             && contractMap.get(maAss.Maintenance_Contract__c).containsKey(maAss.URF_Series_F__c) | 
 |  |  |                             && maAss.Series_RepairCount_F__c != contractMap.get(maAss.Maintenance_Contract__c).get(maAss.URF_Series_F__c).size()) { | 
 |  |  |                             //如果发生改变.设置新的值; | 
 |  |  |                             Maintenance_Contract_Asset_Estimate__c mcae = new Maintenance_Contract_Asset_Estimate__c(); | 
 |  |  |                             mcae.Id = maAss.Maintenance_Contract_Asset_Estimate__c; | 
 |  |  |                             mcae.Series_RepairCount__c = contractMap.get(maAss.Maintenance_Contract__c).get(maAss.URF_Series_F__c).size(); | 
 |  |  |                             //设置系列修理金额 | 
 |  |  |                             mcae.Seriesrepairamount__c = 0; | 
 |  |  |                             for (Repair__c rep : contractMap.get(maAss.Maintenance_Contract__c).get(maAss.URF_Series_F__c)) { | 
 |  |  |                                  mcae.Seriesrepairamount__c += rep.Usage_Ratio_Price_Service__c; | 
 |  |  |                             } | 
 |  |  |                             mcae.Asset_RepairCount__c = 0; | 
 |  |  |                             mcae.Equipmentrepairamount__c = 0; | 
 |  |  |                             if (contractMap.get(maAss.Maintenance_Contract__c).containsKey(maAss.Asset__c)) { | 
 |  |  |                                 mcae.Asset_RepairCount__c = contractMap.get(maAss.Maintenance_Contract__c).get(maAss.Asset__c).size();     | 
 |  |  |                                 //设置设备修理金额 | 
 |  |  |                                 for (Repair__c rep: contractMap.get(maAss.Maintenance_Contract__c).get(maAss.Asset__c)) { | 
 |  |  |                                     mcae.Equipmentrepairamount__c += rep.Usage_Ratio_Price_Service__c; | 
 |  |  |                                 } | 
 |  |  |                             } | 
 |  |  |                             updateList.add(mcae); | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                     if (updateList.size() > 0) { | 
 |  |  |                         // system.debug('zheli:'+updateList); | 
 |  |  |                         update updateList; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             // 20220321 ljh 限次合同异常数据 update end | 
 |  |  |             //gzozw-add | 
 |  |  |             logstr += '\nend'; | 
 |  |  |             rowData.retry_cnt__c = 0; |