|  |  |  | 
|---|
|  |  |  | // LHJ 多年保修 20190627 Start | 
|---|
|  |  |  | Gurantee_Period__c,DecideQuoteDate__c, | 
|---|
|  |  |  | // LHJ 多年保修 20190627 End | 
|---|
|  |  |  | STMS_Package_Sale__c, Equipment_Order_Flg__c | 
|---|
|  |  |  | STMS_Package_Sale__c, Equipment_Order_Flg__c, | 
|---|
|  |  |  | //【是否需要价格申请】为是的场合,才要检查做没做过报价试算 thh 2021-11-03 start | 
|---|
|  |  |  | If_Need_PriceApply__c | 
|---|
|  |  |  | //【是否需要价格申请】为是的场合,才要检查做没做过报价试算 thh 2021-11-03 end | 
|---|
|  |  |  | from Opportunity where Id IN :oppIds]; | 
|---|
|  |  |  | System.debug(Logginglevel.DEBUG, 'NFM007_ oppList.size()=' + oppList.size()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | quotation.Detail = new List<Detail_element>(); | 
|---|
|  |  |  | //CHAN-BDPBVY 20190703 end | 
|---|
|  |  |  | // 20211101 gzw 报价试算  fix  试算行项目有值,发试算信息,否则发询价行项目 end | 
|---|
|  |  |  | if (promotionSalesProductsList != null && promotionSalesProductsList.size() > 0) { | 
|---|
|  |  |  | //询价上的【是否需要价格申请】为是的场合,才要检查做没做过报价试算 thh 2021-11-03 | 
|---|
|  |  |  | if (opp.If_Need_PriceApply__c && promotionSalesProductsList != null && promotionSalesProductsList.size() > 0) { | 
|---|
|  |  |  | for(Integer i = 0; i < promotionSalesProductsList.size(); i++){ | 
|---|
|  |  |  | Detail_element detail = new Detail_element(); | 
|---|
|  |  |  | quotation.Detail.add(detail); | 
|---|
|  |  |  | 
|---|
|  |  |  | detail.PROCODE = '8888'; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | system.debug(' detail.PROCODE=='+detail.PROCODE); | 
|---|
|  |  |  | detail.GuaranteeType = promotionSalesProductsList.get(i).latestWarrantyType__c;  // 保修类别 | 
|---|
|  |  |  | //WLIG-CCT9UG 【委托】关于市场多年保计提金调整 fy start | 
|---|
|  |  |  | if(opp.Trade__c == '外貿'){ | 
|---|
|  |  |  | detail.GuaranteeType = promotionSalesProductsList.get(i).latestWarrantyType__c+',';// 保修类别 | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | Date nowDate = Date.today(); | 
|---|
|  |  |  | // Date baojidate = Date.valueOf('2022-4-1'); | 
|---|
|  |  |  | Date baojidate = Date.newInstance(2022,3,30); | 
|---|
|  |  |  | if(baojidate<=nowDate){ | 
|---|
|  |  |  | detail.GuaranteeType = promotionSalesProductsList.get(i).latestWarrantyType__c+',new'; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | detail.GuaranteeType = promotionSalesProductsList.get(i).latestWarrantyType__c+','; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //WLIG-CCT9UG 【委托】关于市场多年保计提金调整 fy end | 
|---|
|  |  |  | // detail.GuaranteeType = promotionSalesProductsList.get(i).latestWarrantyType__c;  // 保修类别 | 
|---|
|  |  |  | if (!oldDate) { | 
|---|
|  |  |  | if (promotionSalesProductsList.get(i).latestProvistonPeriod__c != null) { | 
|---|
|  |  |  | detail.ProvistonPeriod = String.valueOf(promotionSalesProductsList.get(i).latestProvistonPeriod__c).leftPad(2,'0'); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //保修类别 | 
|---|
|  |  |  | if(oppLiList.get(i).latestWarrantyType__c != null){ | 
|---|
|  |  |  | detail.GuaranteeType = oppLiList.get(i).latestWarrantyType__c;  // 保修类别 | 
|---|
|  |  |  | //WLIG-CCT9UG 【委托】关于市场多年保计提金调整 fy start | 
|---|
|  |  |  | if(opp.Trade__c == '外貿'){ | 
|---|
|  |  |  | detail.GuaranteeType = oppLiList.get(i).latestWarrantyType__c+',';// 保修类别 | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | Date nowDate = Date.today(); | 
|---|
|  |  |  | // Date baojidate = Date.valueOf('2022-4-1'); | 
|---|
|  |  |  | Date baojidate = Date.newInstance(2022,3,30); | 
|---|
|  |  |  | if(baojidate<=nowDate){ | 
|---|
|  |  |  | detail.GuaranteeType = oppLiList.get(i).latestWarrantyType__c+',new'; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | detail.GuaranteeType = oppLiList.get(i).latestWarrantyType__c+','; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //WLIG-CCT9UG 【委托】关于市场多年保计提金调整 fy end | 
|---|
|  |  |  | // detail.GuaranteeType = oppLiList.get(i).latestWarrantyType__c;  // 保修类别 | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | detail.GuaranteeType = null; | 
|---|
|  |  |  | //WLIG-CCT9UG 【委托】关于市场多年保计提金调整 fy start | 
|---|
|  |  |  | if(opp.Trade__c == '外貿'){ | 
|---|
|  |  |  | detail.GuaranteeType = ','; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | Date nowDate = Date.today(); | 
|---|
|  |  |  | Date baojidate = Date.newInstance(2022,3,30); | 
|---|
|  |  |  | if(baojidate<=nowDate){ | 
|---|
|  |  |  | detail.GuaranteeType = ',new'; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | detail.GuaranteeType = ','; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //WLIG-CCT9UG 【委托】关于市场多年保计提金调整 fy end | 
|---|
|  |  |  | // detail.GuaranteeType = null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //计提金额 | 
|---|
|  |  |  | detail.GuaranteePrice = oppLiList.get(i).latestGuranteePrice__c; | 
|---|
|  |  |  | 
|---|
|  |  |  | // detail.GuaranteePeriod = null; | 
|---|
|  |  |  | // detail.GuaranteeType = null; | 
|---|
|  |  |  | //外贸多年保修未上线前 保修类别 传null | 
|---|
|  |  |  | detail.GuaranteeType = null; | 
|---|
|  |  |  | //WLIG-CCT9UG 【委托】关于市场多年保计提金调整 fy start | 
|---|
|  |  |  | if(opp.Trade__c == '外貿'){ | 
|---|
|  |  |  | detail.GuaranteeType = ','; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | Date nowDate = Date.today(); | 
|---|
|  |  |  | Date baojidate = Date.newInstance(2022,3,30); | 
|---|
|  |  |  | if(baojidate<=nowDate){ | 
|---|
|  |  |  | detail.GuaranteeType = ',new'; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | detail.GuaranteeType = ','; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //WLIG-CCT9UG 【委托】关于市场多年保计提金调整 fy end | 
|---|
|  |  |  | // detail.GuaranteeType = null; | 
|---|
|  |  |  | //外贸多年保修未上线前  计提金额 传0 | 
|---|
|  |  |  | detail.GuaranteePrice = 0; | 
|---|
|  |  |  | //外贸多年保修未上线前 nodiscount 传0 | 
|---|
|  |  |  | 
|---|
|  |  |  | //③decide在20191001 之前  老数据 | 
|---|
|  |  |  | else if(oldDate){ | 
|---|
|  |  |  | detail.GuaranteePeriod = null; | 
|---|
|  |  |  | detail.GuaranteeType = null; | 
|---|
|  |  |  | //WLIG-CCT9UG 【委托】关于市场多年保计提金调整 fy start | 
|---|
|  |  |  | if(opp.Trade__c == '外貿'){ | 
|---|
|  |  |  | detail.GuaranteeType = ','; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | Date nowDate = Date.today(); | 
|---|
|  |  |  | Date baojidate = Date.newInstance(2022,3,30); | 
|---|
|  |  |  | if(baojidate<=nowDate){ | 
|---|
|  |  |  | detail.GuaranteeType = ',new'; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | detail.GuaranteeType = ','; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //WLIG-CCT9UG 【委托】关于市场多年保计提金调整 fy end | 
|---|
|  |  |  | // detail.GuaranteeType = null; | 
|---|
|  |  |  | detail.ProvistonPeriod = null; | 
|---|
|  |  |  | detail.GuaranteePrice = null; | 
|---|
|  |  |  | detail.ServicePrice = null; | 
|---|