From 19ae52ae3e06c44c646ae6b45dc2b0d7f2cead88 Mon Sep 17 00:00:00 2001 From: 李彤 <litong@prec-tech.com> Date: 星期一, 15 五月 2023 18:55:53 +0800 Subject: [PATCH] 招标项目终止 --- force-app/main/default/classes/TenderOpportunityLinkHandler.cls | 85 +++++++++++++++++++++++++++++++++++------- 1 files changed, 70 insertions(+), 15 deletions(-) diff --git a/force-app/main/default/classes/TenderOpportunityLinkHandler.cls b/force-app/main/default/classes/TenderOpportunityLinkHandler.cls index c52d66e..128094a 100644 --- a/force-app/main/default/classes/TenderOpportunityLinkHandler.cls +++ b/force-app/main/default/classes/TenderOpportunityLinkHandler.cls @@ -10,12 +10,13 @@ this.newList = (List<Tender_Opportunity_Link__c>) Trigger.new; this.oldList = (List<Tender_Opportunity_Link__c>) Trigger.old; } - + protected override void afterInsert() { // 鍒ゆ柇鏄惁璺宠繃 + updateTerminateTender(this.newList); //lt 20230419 椤圭洰缁堟娴佺▼寮�鍙� add if (!StaticParameter.EscapeTOLinkTrigger) { updateTender(this.newList); - updateOppotunityByInsert(this.newList); + updateOppotunityByInsert(this.newList); } } @@ -39,6 +40,48 @@ if (link.Tender_Opportunity_Uniq__c == null || link.Tender_Opportunity_Uniq__c == '') { link.Tender_Opportunity_Uniq__c = link.Tender_information__c + '' + link.Opportunity__c; } + } + } +} + +//lt 20230419 椤圭洰缁堟娴佺▼寮�鍙� 缁堟鐢宠鐘舵�佹竻闄� add +//椤圭洰缁堟娴佺▼寮�鍙� -- 娓呴櫎鎷涙爣椤圭洰缁堟鐢宠鐨勪俊鎭紝椤圭洰閲嶅惎鏍囪瘑鎵撳嬀 +public void updateTerminateTender(List<Tender_Opportunity_Link__c> records){ + + if (records != null && records.size() > 0){ + List<String> tenders = new List<String>(); + // 鑾峰緱瑕佹洿鏂扮殑鎷涙爣椤圭洰 + for (Tender_Opportunity_Link__c record: records) { + if (!tenders.contains(record.Tender_information__c)) { + tenders.add(record.Tender_information__c); + } + } + + List<Tender_information__c> UpdateTenders = new List<Tender_information__c>(); + + if (tenders.size() > 0){ + List<Tender_information__c> tenderList = [SELECT id, status__c, TerminateReason__c, IsTerminate__c, + TerminateApprovalStatus__c, TerminateApprovalTime__c, + ProjectRestartFLG__c,subInfoType__c + FROM Tender_information__c + WHERE id in :tenders]; + + if(tenderList.size() > 0){ + for (Tender_information__c tender : tenderList){ + //if(tender.status__c == '09.缁堟' && tender.TerminateReason__c != '缁忛攢鍟嗗師鍥�' && tender.subInfoType__c != '3-1锛氬簾鏍囧叕鍛�' && tender.subInfoType__c != '3-2锛氭祦鏍囧叕鍛�') + if(tender.status__c == '09.缁堟'){ + tender.ProjectRestartFLG__c = true; + tender.IsTerminate__c = null; + tender.TerminateApprovalTime__c = null; + tender.TerminateApprovalStatus__c = null; + + UpdateTenders.add(tender); + } + } + } + } + if(UpdateTenders.size() > 0){ + update UpdateTenders; } } } @@ -351,27 +394,37 @@ } } if (null!=oppTens && oppTens.size()>0) { + //20221208 you DB202211594688 鏈夌‘璁や换鍔$殑璇环涓嶆竻绌轰腑鏍囦俊鎭� taskStatus__c <> '瀹屾垚' List<Opportunity> opportunities = [select id, Bidding_Project_Name_Bid__c,Opp_Order__c from Opportunity where id in :oppIds]; - List<task__c> taskList = [select id,taskStatus__c,Tender_information_Task__c,OpportunityId__c from task__c where (RecordType.Name ='澶卞崟鎶ュ憡浠诲姟' and OpportunityId__c in:oppIds) or (RecordType.Name ='涓爣缁撴灉纭' and Opp_Tender__c in :oppTens)]; + List<task__c> taskList = [select id,taskStatus__c,RecordType.Name,Tender_information_Task__c,OpportunityId__c from task__c where ((RecordType.Name ='澶卞崟鎶ュ憡浠诲姟' and OpportunityId__c in:oppIds) or (RecordType.Name ='涓爣缁撴灉纭' and Opp_Tender__c in :oppTens)) and taskStatus__c <> '03 瀹屾垚']; for(task__c tsk : taskList){ - tsk.taskStatus__c = '04 鍙栨秷'; - tsk.cancelDate__c = date.today(); - tsk.cancelReasonSelect__c = '鍙栨秷璇环鍏宠仈'; + if(tsk.RecordType.Name =='澶卞崟鎶ュ憡浠诲姟' && oppIds.contains(tsk.OpportunityId__c) && tsk.taskStatus__c !='03 瀹屾垚'){ + //涓嶅仛鎿嶄綔 + }else{ + tsk.taskStatus__c = '04 鍙栨秷'; + tsk.cancelDate__c = date.today(); + tsk.cancelReasonSelect__c = '鍙栨秷璇环鍏宠仈'; + } + } update taskList; if(taskList.size() > 0){ for (task__c tlink : taskList) { for (Opportunity opp : opportunities) { if (opp.Id == tlink.OpportunityId__c) { - //20220718 you 璇环浠诲姟 start - opp.ConfirmationofAward__c = null; - opp.Task_createTime__c = null; - opp.ConfirmationofAward_createTime__c =null; - opp.LostTask_comfirmTime__c =null; - opp.Is_ConfirmationofAward__c =null; - opp.LostTask_createTime__c =null; - opp.Closing_Bid_Date__c = null; - //20220718 you 璇环浠诲姟 end + if(tlink.RecordType.Name =='澶卞崟鎶ュ憡浠诲姟' && tlink.taskStatus__c !='03 瀹屾垚'){ + //涓嶅仛鎿嶄綔 + }else{ + //20220718 you 璇环浠诲姟 start + opp.ConfirmationofAward__c = null; + opp.Task_createTime__c = null; + opp.ConfirmationofAward_createTime__c =null; + opp.LostTask_comfirmTime__c =null; + opp.Is_ConfirmationofAward__c =null; + opp.LostTask_createTime__c =null; + //opp.Closing_Bid_Date__c = null; + //20220718 you 璇环浠诲姟 end + } } } } @@ -423,6 +476,7 @@ opp.Bidding_Project_Name_Bid__c = null; //opp.TenderBeginDate_Text__c = null; opp.InfoTypeBid_text__c = null; + /** 20221208 you DB202211594688 鏃犱换鍔¤浠凤紝涓嶆竻绌烘嫑鏍囦俊鎭� //20220718 you 璇环浠诲姟 start opp.ConfirmationofAward__c = null; opp.Task_createTime__c = null; @@ -431,6 +485,7 @@ opp.Is_ConfirmationofAward__c =null; opp.Closing_Bid_Date__c = null; //20220718 you 璇环浠诲姟 end + **/ // 20221028 ljh SWAG-CKL5UC start opp.LeakageNumber__c = null; // 20221028 ljh SWAG-CKL5UC end -- Gitblit v1.9.1