|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // SWAG-C7P4XB end | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //LastBuy 预留产品 lt 20220315 start | 
|---|
|  |  |  | //询价失单或取消时,预留产品的"是否有效"设置为否 | 
|---|
|  |  |  | public static void ReservedProFlg(List<Opportunity> newList, Map<Id, Opportunity> newMap, List<Opportunity> oldList, Map<Id, Opportunity> oldMap){ | 
|---|
|  |  |  | List<Id> oppList = new List<Id>(); | 
|---|
|  |  |  | List<LastbuyProduct__c> lbpflgList = new List<LastbuyProduct__c>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for (Opportunity lbOpp : newList){ | 
|---|
|  |  |  | Opportunity OldLbOpp = oldMap.get(lbOpp.Id); | 
|---|
|  |  |  | if(OldLbOpp.StageName != lbOpp.StageName){ | 
|---|
|  |  |  | if(lbOpp.StageName == '敗戦' || lbOpp.StageName == '削除'){ | 
|---|
|  |  |  | oppList.add(lbOpp.Id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(oppList.size() > 0){ | 
|---|
|  |  |  | List<LastbuyProduct__c> lbpList = [select id, effectiveFLG__c,InquiryCode__c from LastbuyProduct__c where InquiryCode__c in :oppList]; | 
|---|
|  |  |  | if(lbpList.size() > 0){ | 
|---|
|  |  |  | for(LastbuyProduct__c lbp : lbpList){ | 
|---|
|  |  |  | if(lbp.effectiveFLG__c == true){ | 
|---|
|  |  |  | lbp.effectiveFLG__c = false; | 
|---|
|  |  |  | lbpflgList.add(lbp); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(lbpflgList.size() > 0){ | 
|---|
|  |  |  | update lbpflgList; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //LastBuy 预留产品 lt 20220315 end | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|