| | |
| | | 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); |
| | | } |
| | | } |
| | | |
| | |
| | | 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; |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | 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 |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | 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 |