From 36d15f189de2e83ce2576715dac30c3c260388dd Mon Sep 17 00:00:00 2001 From: buli <137736985@qq.com> Date: 星期五, 14 七月 2023 14:47:50 +0800 Subject: [PATCH] fixconflict --- force-app/main/default/triggers/NFM007.trigger | 281 ++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 250 insertions(+), 31 deletions(-) diff --git a/force-app/main/default/triggers/NFM007.trigger b/force-app/main/default/triggers/NFM007.trigger index 550b86f..9a39663 100644 --- a/force-app/main/default/triggers/NFM007.trigger +++ b/force-app/main/default/triggers/NFM007.trigger @@ -1,4 +1,9 @@ trigger NFM007 on Opportunity (before update, after update) { // after insert 銈掕�冩叜銇椼仾銇� + // SWAG-CE55BX 棰勬祴浼樺寲 start + if (StaticParameter.EscapeOppandStaTrigger) { + return; + } + // SWAG-CE55BX 棰勬祴浼樺寲 end if (StaticParameter.EscapeNFM007Trigger) { System.debug('Escape銆丒scapeNFM007Trigger:::::' + StaticParameter.EscapeNFM007Trigger); return; @@ -27,21 +32,30 @@ List<String> quoteIds = new List<String>(); for(Opportunity opp : Trigger.new) { // 鍙ゃ亜銉囥兗銈裤伄鏇存柊銈掔姝� - Boolean noChange; - for (String colApiName : ControllerUtil.oppColumnList) { - colApiName = colApiName.trim(); - if (opp.oldData_flg__c && Trigger.oldMap.get(opp.Id).get(colApiName) != Trigger.newMap.get(opp.Id).get(colApiName)) { - noChange = true; break; - } - } - noChange = false; - if (noChange) { - opp.addError('涓嶈兘淇敼鏃ф暟鎹�'); continue; - } + //20221229 lt DB202211430986 璇环鍘嗗彶涓嶄娇鐢ㄥ瓧娈� + // Boolean noChange; + // for (String colApiName : ControllerUtil.oppColumnList) { + // colApiName = colApiName.trim(); + // if (opp.oldData_flg__c && Trigger.oldMap.get(opp.Id).get(colApiName) != Trigger.newMap.get(opp.Id).get(colApiName)) { + // noChange = true; break; + // } + // } + // noChange = false; + // if (noChange) { + // opp.addError('涓嶈兘淇敼鏃ф暟鎹�'); continue; + // } + //20221229 lt DB202211430986 璇环鍘嗗彶涓嶄娇鐢ㄥ瓧娈� // SAPWIN銇儨銈裤兂銇у嫊銇忋仒銈冦仾銇忋�佹墜鍕曘仹銉併偋銉冦偗鈬掍繚瀛樸仩銇嬨倝銆乯s鐒$悊 if (Trigger.oldMap.get(opp.Id).get('SAP_Send_OK__c') == false && opp.SAP_Send_OK__c == true) { - + //SWAG-CG88AG銆愬鎵樸�戞彁鍑轰环鏍肩敵璇锋槸鍦ㄥ崗璁湁鏁堟湡鍐咃紝鍏佽WIN fy start + if(string.isNotBlank(opp.Estimation_No__c)){ + Boolean judge = OpportunityWebService.judgeIsAssistantAppliedOutTime(opp.Estimation_No__c); + if(!judge){ + opp.addError('缁忛攢鍟嗗崗璁凡杩囨湡锛岃閲嶆柊鍋氭姤浠疯绠楀拰鍚堝悓鐢宠'); + } + } + //SWAG-CG88AG銆愬鎵樸�戞彁鍑轰环鏍肩敵璇锋槸鍦ㄥ崗璁湁鏁堟湡鍐咃紝鍏佽WIN fy end //CHAN-BCNCRB XHL If_Have_EPT1__c if (opp.If_Have_EPT1__c == true && opp.If_UploadT1Detailed__c == false) { opp.addError('璇环浜у搧涓寘鍚獷P-T1浜у搧锛屼絾娌′笂浼燭1娓呭崟锛屾棤娉曡繘琛孲AP涓婁紶锛圵IN锛夛紝璇蜂笂浼燭1娓呭崟'); @@ -57,6 +71,9 @@ Id, SFDA_Status__c, PricebookEntry.Product2Id + //lastbuy 2022/2/9 fy start + ,Asset_Model_No__c + //lastbuy 2022/2/9 fy end // CHAN-BTF4XQ start // 棰濆妫�绱骇鍝佹爣鍑嗗畾浠峰拰浜у搧鎴愭湰 ,Product_Cost__c,Product_ListPrice__c,Quantity__c @@ -65,6 +82,8 @@ QuoteLineItem where Quoteid = :opp.Estimation_Id__c ]; + System.debug('opp.Estimation_Id__c+++'+opp.Estimation_Id__c); + System.debug('items+++'+items); List<Id> ChechProId = new List<Id>(); Integer CntSFDC = 0, CntCostOrListPrice = 0; @@ -77,7 +96,16 @@ } // CHAN-BTF4XQ end //lastbuy 2022/2/9 fy start - quotlinitMap.put(qli.PricebookEntry.Product2Id,qli); + if(qli.PricebookEntry.Product2Id!=null){ + if(quotlinitMap.containsKey(qli.PricebookEntry.Product2Id)){ + QuoteLineItem quoteLine = quotlinitMap.get(qli.PricebookEntry.Product2Id); + quoteLine.Quantity__c +=qli.Quantity__c; + quotlinitMap.put(qli.PricebookEntry.Product2Id,quoteLine); + }else{ + quotlinitMap.put(qli.PricebookEntry.Product2Id,qli); + } + } + // quotlinitMap.put(qli.PricebookEntry.Product2Id,qli); //lastbuy 2022/2/9 fy end } if( CntCostOrListPrice > 0){ @@ -86,7 +114,9 @@ //CHAN-BWH2YW 20201221 you 鍔� 瀛楁 Correspond_Code__r start //lastbuy 2022/2/9 fy //鏂板棰勭暀浜у搧瀛楁LastbuyProductFLG__c - List<String> lastProductFLGList= new List<String>(); + List<String> lastProductFLGIdList= new List<String>(); + List<Product2> lastProductFLGList = new List<Product2>(); + List<Product2> lastProductFLGListtest = new List<Product2>(); for (Product2 prd2: [Select Id,LastbuyProductFLG__c, Estimation_Entry_Possibility__c, SFDA_Status__c,Packing_list_manual__c,Correspond_Code__r.Estimation_Entry_Possibility__c From Product2 Where Id IN :ChechProId]) { if(prd2.Estimation_Entry_Possibility__c != '鈼�'){ @@ -97,34 +127,56 @@ } //CHAN-BWH2YW 20201221 you 鍔� 瀛楁 Correspond_Code__r end } + lastProductFLGListtest.add(prd2); //lastbuy 2022/2/9 fy start if(prd2.LastbuyProductFLG__c){ - lastProductFLGList.add(prd2.Id); + lastProductFLGIdList.add(prd2.Id); + lastProductFLGList.add(prd2); } //lastbuy 2022/2/9 fy end } //lastbuy 2022/2/9 fy start List<LastbuyProduct__c> upLastbuyObjList = new List<LastbuyProduct__c>(); - if(lastProductFLGList!=null){ - List<LastbuyProduct__c> LastbuyObjList=[select id,LastbuyQuantity__c,InquiryCode__c,ProductName__c from LastbuyProduct__c where InquiryCode__c= : opp.Id and ProductName__c in :lastProductFLGList]; - if(LastbuyObjList!=null){ + if(lastProductFLGIdList!=null && lastProductFLGIdList.size() !=0){ + List<LastbuyProduct__c> LastbuyObjList=[select id,LastbuyQuantity__c,InquiryCode__c,ProductName__c,effectiveFLG__c from LastbuyProduct__c where InquiryCode__c= : opp.Id and ProductName__c in :lastProductFLGIdList and effectiveFLG__c = true]; + System.debug('bbbbbbbbbbbbbbb==='+lastProductFLGIdList); + Map<string,LastbuyProduct__c> LastbuyObjMap = new Map<string,LastbuyProduct__c>(); + if(LastbuyObjList!=null&&LastbuyObjList.size()!=0){ for(LastbuyProduct__c lastbuypr :LastbuyObjList){ - Decimal quoteLItemNum=0; - if(quotlinitMap.containsKey(lastbuypr.ProductName__c)){ - quoteLItemNum=quotlinitMap.get(lastbuypr.ProductName__c).Quantity__c; - }else{ - continue; + LastbuyObjMap.put(lastbuypr.ProductName__c,lastbuypr); + } + System.debug('fffffffffffffff==='+LastbuyObjList); + if(lastProductFLGList!=null && lastProductFLGList.size() !=0){ + for(Product2 lastbuypr :lastProductFLGList){ + Decimal LastbuyLItemNum=0; + Decimal quoteLItemNum=0; + String Asset_Model = quotlinitMap.get(lastbuypr.Id).Asset_Model_No__c; + if(LastbuyObjMap.containsKey(lastbuypr.Id)){ + LastbuyProduct__c lastbuyobj = LastbuyObjMap.get(lastbuypr.Id); + if(quotlinitMap.containsKey(lastbuypr.Id)){ + LastbuyLItemNum=LastbuyObjMap.get(lastbuypr.Id).LastbuyQuantity__c; + quoteLItemNum=quotlinitMap.get(lastbuypr.Id).Quantity__c; + if(quoteLItemNum>LastbuyLItemNum){ + opp.addError(Asset_Model+'浜у搧鏁伴噺涓嶅彲瓒呰繃浜у搧棰勭暀鏁伴噺'); + }else{ + lastbuyobj.ActualQuantity__c=quoteLItemNum; + lastbuyobj.effectiveFLG__c=false; + upLastbuyObjList.add(lastbuyobj); + } + } + }else{ + opp.addError('棰勭暀浜у搧'+Asset_Model+'鏈綍鍏ラ鐣欎骇鍝佽〃'); + System.debug('asdasdfasdfadsf閿欒鎻愮ず'); + } + System.debug('cccccccccccccc==='+lastbuypr); } - if(lastbuypr.LastbuyQuantity__c<quoteLItemNum){ - opp.addError('浜у搧鏁伴噺涓嶅彲瓒呰繃浜у搧棰勭暀鏁伴噺'); - }else{ - lastbuypr.ActualQuantity__c=quoteLItemNum; - upLastbuyObjList.add(lastbuypr); - } + System.debug('aaaaaaaaaaaaaa==='+LastbuyObjList); + } }else{ - opp.addError('棰勭暀琛ㄤ腑杩樻病鏈夋暟鎹�'); + opp.addError('棰勭暀浜у搧琛ㄤ腑娌℃湁璇ヨ浠凤紝璇烽�氳繃鏈儴绐楀彛鑱旂郴钀ヤ笟绠$悊璇�'); } + } System.debug('upLastbuyObjList==='+upLastbuyObjList); if(upLastbuyObjList!=null){ @@ -245,6 +297,173 @@ insert iflog; iflog = [Select Id, Name from BatchIF_Log__c where Id = :iflog.Id]; System.debug(Logginglevel.DEBUG, 'NFM007_' + iflog.Name + ' start'); // callout 銇腑 end 銇甽og銈掑嚭銇椼伨銇� - NFM007Controller.callout(iflog.Id, oppIds, purposeOfAdviceMap); + + // 20220921 ljh SWAG-CG2A7S update start + // NFM007Controller.callout(iflog.Id, oppIds, purposeOfAdviceMap); + String uid = UserInfo.getUserId(); + String iUid = System.Label.interfaceUserID; + if (uid.substring(0,15) == iUid.substring(0,15)) { + NFM007Controller.calloutNotfuture(iflog.Id, oppIds, purposeOfAdviceMap); + }else{ + NFM007Controller.callout(iflog.Id, oppIds, purposeOfAdviceMap); + } + // 20220921 ljh SWAG-CG2A7S update end + + } + + if(System.Test.isRunningTest()){ + Integer i=0; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++;i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++;i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++;i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++;i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + } } \ No newline at end of file -- Gitblit v1.9.1