| | |
| | | } |
| | | } |
| | | } |
| | | //DB202304056706 you 20230406 清空 打标识,重新执行batch |
| | | if(String.isBlank(op.ConfirmationofAward__c) && op.ConfirmationofAward__c!=oldopp.ConfirmationofAward__c){ |
| | | for (Tender_Opportunity_Link__c link : links) { |
| | | if (link.Opportunity__c == op.Id) { |
| | | Tender_information__c temptender = new Tender_information__c(); |
| | | temptender.Id = link.Tender_information__c; |
| | | temptender.IsReactionOpp__c = true; |
| | | tenderMap.put(temptender.id ,temptender); |
| | | } |
| | | } |
| | | } |
| | | //20221017 lt SWAG-CHL5XA【FY23询价改善】-统计主机台数 start |
| | | // System.debug('lt123 oly主机'+op.OlyNumberHosts__c); |
| | | // System.debug('lt123 老oly主机'+oldopp.OlyNumberHosts__c); |
| | | // System.debug('lt123 对手主机'+op.RivalHostsNumber__c); |
| | | // System.debug('lt123 老对手主机'+oldopp.RivalHostsNumber__c); |
| | | |
| | | if(op.OlyNumberHosts__c != oldopp.OlyNumberHosts__c || op.RivalHostsNumber__c != oldopp.RivalHostsNumber__c){ |
| | | for (Tender_Opportunity_Link__c link : links){ |
| | | if (link.Opportunity__c == op.Id){ |
| | | Tender_information__c temptender = new Tender_information__c(); |
| | | temptender.Id = link.Tender_information__c; |
| | | temptender.IsReactionOpp__c = true; |
| | | tenderMap.put(temptender.id ,temptender); |
| | | } |
| | | } |
| | | } |
| | | //20221017 lt SWAG-CHL5XA【FY23询价改善】-统计主机台数 end |
| | | |
| | | // }else { |
| | | // //新建时判断询价的招标项目是不是从无到有 |
| | |
| | | } |
| | | |
| | | Set<Id> oppoIds = new Set<Id>(); |
| | | Map<Id,String> mapoppid = new Map<Id,String>(); |
| | | list<task__c> taskUpdateList = new list<task__c>(); |
| | | for(Opportunity op : newList){ |
| | | Opportunity oldopp = oldMap.get(op.Id); |
| | | //询价中标结果确认竞争对手中标时实时创建失单任务 且 询价状态1等于询价 |
| | | if (oldopp.ConfirmationofAward__c != '竞争对手中标' && op.ConfirmationofAward__c == '竞争对手中标' && op.StageName__c == '询价' && op.LeakageNumber__c !=1){ |
| | | if (oldopp.ConfirmationofAward__c != '竞争对手中标' && op.ConfirmationofAward__c == '竞争对手中标' && op.StageName__c == '询价' && !op.DirectLossFLG__c ){ |
| | | oppoIds.add(op.Id); |
| | | } |
| | | //20220929 you SWAG-CJP7TL 手动更改询价所有人,同步修改任务所有人 |
| | | if(String.isNotBlank(op.OwnerId) && op.OwnerId !=oldopp.OwnerId){ |
| | | mapoppid.put(op.id,op.OwnerId); |
| | | } |
| | | } |
| | | if(mapoppid.size() > 0){ |
| | | List<Task__c> taskList = [ |
| | | SELECT Id,OpportunityId__c,taskStatus__c |
| | | FROM task__c |
| | | WHERE OpportunityId__c in :mapoppid.keySet() |
| | | AND (RecordType.Name = '中标结果确认' OR RecordType.Name = '失单报告任务') |
| | | AND taskStatus__c = '02 接受']; |
| | | system.debug(mapoppid.keySet()+'test1-----'+taskList); |
| | | for(Task__c t: taskList){ |
| | | if(mapoppid.containsKey(t.OpportunityId__c)){ |
| | | t.Ownerid = mapoppid.get(t.OpportunityId__c); |
| | | t.assignee__c = mapoppid.get(t.OpportunityId__c); |
| | | taskUpdateList.add(t); |
| | | } |
| | | |
| | | } |
| | | if (taskUpdateList != null && taskUpdateList.size() > 0) { |
| | | update taskUpdateList; |
| | | } |
| | | } |
| | | |
| | | if (!oppoIds.isEmpty()) { |
| | | // 有效失单状态一览 |
| | | List<String> validStatus = new List<String>{'申请中', '提交', '批准'}; |
| | | // 询价失单/取消报告查询 |
| | | List<Lost_cancel_report__c> lostCancelReportList = [SELECT Id, Opportunity__c from Lost_cancel_report__c WHERE Opportunity__c in :oppoIds and Report_Status__c in: validStatus]; |
| | | // 20221206 DB202211594688 start |
| | | // // 有效失单状态一览 |
| | | // List<String> validStatus = new List<String>{'申请中', '提交', '批准'}; |
| | | // // 询价失单/取消报告查询 |
| | | // List<Lost_cancel_report__c> lostCancelReportList = [SELECT Id, Opportunity__c from Lost_cancel_report__c WHERE Opportunity__c in :oppoIds and Report_Status__c in: validStatus]; |
| | | |
| | | // List<Lost_cancel_report__c> lostCancelReportList1 = [SELECT Id, Opportunity__c,DeveloperName__c from Lost_cancel_report__c WHERE Opportunity__c in :oppoIds and Report_Status__c ='草案']; |
| | | |
| | | // //<询价Id, 失单报告> |
| | | // Map<String, Lost_cancel_report__c> lostCancelReportMap = new Map<String, Lost_cancel_report__c>(); |
| | | // for(Lost_cancel_report__c lcr : lostCancelReportList){ |
| | | // if (!lostCancelReportMap.isEmpty() && lostCancelReportMap.containsKey(lcr.Opportunity__c)) { |
| | | // // no action |
| | | // } else { |
| | | // lostCancelReportMap.put(lcr.Opportunity__c, lcr); |
| | | // } |
| | | // } |
| | | |
| | | //有效失单状态一览 |
| | | List<String> validStatus = new List<String>{'申请中', '提交', '批准'}; |
| | | List<String> allStatus = new List<String>{'申请中', '提交', '批准','草案'}; |
| | | // 询价失单/取消报告查询 |
| | | List<Lost_cancel_report__c> lostCancelReportList = [SELECT Id, Opportunity__c,Report_Status__c,DeveloperName__c from Lost_cancel_report__c WHERE Opportunity__c in :oppoIds and Report_Status__c in: allStatus]; |
| | | |
| | | //<询价Id, 失单报告> |
| | | Map<String, Lost_cancel_report__c> lostCancelReportMap = new Map<String, Lost_cancel_report__c>(); |
| | | Map<String, Lost_cancel_report__c> lostCancelReportMap1 = new Map<String, Lost_cancel_report__c>(); |
| | | for(Lost_cancel_report__c lcr : lostCancelReportList){ |
| | | if (!lostCancelReportMap.isEmpty() && lostCancelReportMap.containsKey(lcr.Opportunity__c)) { |
| | | if(validStatus.contains(lcr.Report_Status__c)){ |
| | | if (!lostCancelReportMap.isEmpty() && lostCancelReportMap.containsKey(lcr.Opportunity__c)) { |
| | | // no action |
| | | } else { |
| | | lostCancelReportMap.put(lcr.Opportunity__c, lcr); |
| | | } |
| | | }else{ |
| | | // 草案 |
| | | if (!lostCancelReportMap1.isEmpty() && lostCancelReportMap1.containsKey(lcr.Opportunity__c)) { |
| | | // no action |
| | | } else { |
| | | lostCancelReportMap.put(lcr.Opportunity__c, lcr); |
| | | } |
| | | } |
| | | |
| | | } else { |
| | | lostCancelReportMap1.put(lcr.Opportunity__c, lcr); |
| | | } |
| | | } |
| | | } |
| | | // 20221206 DB202211594688 start |
| | | List<Task__c> insTaskList = new List<Task__c>(); |
| | | |
| | | // 定义需要更新的询价任务 |
| | |
| | | Opportunity uopp = new Opportunity(); |
| | | uopp.Id = opp.Id; |
| | | uopp.LostTask_createTime__c = Date.today(); |
| | | //20221205 you DB202211594688 部分失单派发任务,但是中标结果不赋值 |
| | | |
| | | if(null!=lostCancelReportMap1.get(opp.Id) && lostCancelReportMap1.get(opp.Id).DeveloperName__c =='PCL_PartLost_report'){ |
| | | |
| | | uopp.ConfirmationofAward__c = ''; |
| | | uopp.ConfirmationofAward_createTime__c = null; |
| | | uopp.Is_ConfirmationofAward__c =null; |
| | | }else{ |
| | | if(oldMap.get(opp.Id).ConfirmationofAward__c != '竞争对手中标' && opp.ConfirmationofAward__c == '竞争对手中标'){ |
| | | uopp.Closing_Bid_Date__c = null; |
| | | } |
| | | } |
| | | updateOpportunity.add(uopp); |
| | | } |
| | | } |
| | |
| | | |
| | | //20220628会议新需求 对手中标 7.中标日清空 |
| | | if(oldopp.ConfirmationofAward__c != '竞争对手中标' && op.ConfirmationofAward__c == '竞争对手中标'){ |
| | | op.Closing_Bid_Date__c = null; |
| | | //op.Closing_Bid_Date__c = null; // 20221206 you |
| | | op.ConfirmationofAward_createTime__c = Date.today(); |
| | | if(op.Task_createTime__c!=null){ |
| | | |
| | |
| | | |
| | | if(!oppoIds.isEmpty()){ |
| | | |
| | | list<Tender_Opportunity_Link__c> toppLinkList = [Select Id, Opportunity__c, Tender_information__c,Tender_information__r.ResultDate__c FROM Tender_Opportunity_Link__c WHERE Opportunity__c in :oppoIds]; |
| | | // 2022-12-02 ssm DB202211552746 增加流标废标时清空结果记录日的逻辑,需要判断不是流标废标的结果数据才更新中标日 |
| | | list<Tender_Opportunity_Link__c> toppLinkList = [Select Id, Opportunity__c, Tender_information__c,Tender_information__r.ResultDate__c,Tender_information__r.InfoType__c |
| | | FROM Tender_Opportunity_Link__c |
| | | WHERE Opportunity__c in :oppoIds |
| | | and Tender_information__r.InfoType__c = '3:结果' |
| | | and Tender_information__r.subInfoType__c != '3-1:废标公告' |
| | | and Tender_information__r.subInfoType__c != '3-2:流标公告']; |
| | | Map<String, Tender_Opportunity_Link__c> toopLinkMap = new Map<String, Tender_Opportunity_Link__c>(); |
| | | |
| | | for(Tender_Opportunity_Link__c tol : toppLinkList){ |
| | | toopLinkMap.put(tol.Opportunity__c, tol); |
| | | Opportunity oppoTemp = newMap.get(tol.Opportunity__c); |
| | | //询价关联到招标项目才进行操作 |
| | | if(oppoTemp.Bidding_Project_Name_Bid__c == tol.Tender_information__c){ |
| | | toopLinkMap.put(tol.Opportunity__c, tol); |
| | | } |
| | | |
| | | } |
| | | |
| | | for (String key : toopLinkMap.keySet()) { |
| | | Opportunity oppoTemp = newMap.get(key); |
| | | |
| | | //20220628会议新需求 OLY中标 7.中标日(结果记录日)= 招标项目.结果记录日 |
| | | oppoTemp.Closing_Bid_Date__c = toopLinkMap.get(key).Tender_information__r.ResultDate__c; |
| | | System.debug('============'+toopLinkMap.get(key).Tender_information__r.ResultDate__c); |
| | | |
| | | |
| | | //是否按时确认:3个工作日内按时1,不按时0 |
| | | //String inttemp = CalendarUtil.getWorkDayNum(String.valueOf(oppoTemp.Task_createTime__c), String.valueOf(oppoTemp.ConfirmationofAward_createTime__c)); |