| | |
| | | //2021-08-13 mzy SWAG-C5RAZV 事件——计划 延期 调查 start |
| | | delayReason__c, |
| | | //2021-08-13 mzy SWAG-C5RAZV 事件——计划 延期 调查 end |
| | | Subject from Event where Opd_Plan__c in: oSetIdSet]; |
| | | Subject from Event where Opd_Plan__c in: oSetIdSet and EventStatus__c in ('02 接受','01 分配')];//2022-4-28 yjk 排除掉已经完成的事件 |
| | | } |
| | | |
| | | if (eventList.size() > 0) { |
| | |
| | | insert eveCloneList; |
| | | update taskList; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | // 取得User审批人 |
| | | List<User> uList = new List<User>(); |
| | | if (userFlg) { |
| | | uList = [select Id, SalesManager__c, SalesManager__r.Name from user where SalesManager__r.IsActive = true And id = :UserInfo.getUserId()]; |
| | | //2022-07-20 zyh update SWAG-CGG7X9 start |
| | | // uList = [select Id, SalesManager__c, SalesManager__r.Name from user where SalesManager__r.IsActive = true And id = :UserInfo.getUserId()]; |
| | | uList = [select Id, |
| | | SalesManager__c, |
| | | SalesManager__r.Name, |
| | | BuchangApprovalManagerSales__c, |
| | | BuchangApprovalManagerSales__r.Name, |
| | | Buzhang_Equipment_Manager__c, |
| | | // Buzhang_Equipment_Manager__r.Name, |
| | | ZongjianApprovalManager__c, |
| | | // ZongjianApprovalManager__r.Name, |
| | | TongkuoZongjian__c, |
| | | TongkuoZongjianHD__c, |
| | | // TongkuoZongjian__r.Name, |
| | | SalesManager__r.IsActive, |
| | | BuchangApprovalManagerSales__r.IsActive, |
| | | Buzhang_Equipment_Manager__r.IsActive, |
| | | ZongjianApprovalManager__r.IsActive, |
| | | TongkuoZongjian__r.IsActive, |
| | | TongkuoZongjianHD__r.IsActive, |
| | | Salesdepartment__c |
| | | from user where id = :UserInfo.getUserId()]; |
| | | //2022-07-20 zyh update SWAG-CGG7X9 end |
| | | } |
| | | |
| | | // 设置审批人 |
| | |
| | | && (String.isBlank(oldMap.get(n.Id).Status__c) || oldMap.get(n.Id).Status__c.equals('草案中'))) |
| | | || ((String.isNotBlank(n.noReportStatus__c) && n.noReportStatus__c.equals('提交') |
| | | && (String.isBlank(oldMap.get(n.Id).noReportStatus__c) || oldMap.get(n.Id).noReportStatus__c.equals('已保存'))))) { |
| | | |
| | | if (uList.size() > 0) { |
| | | //2022-07-20 zyh update SWAG-CGG7X9 start |
| | | if (uList[0].SalesManager__r.IsActive == true || String.isNotBlank(uList[0].SalesManager__c)) { |
| | | n.SalesManager__c = uList[0].SalesManager__c; |
| | | n.SalesManager_Txt__c = uList[0].SalesManager__r.Name; |
| | | } |
| | | if ('OPD'.equals(n.RentalReson__c) && String.isBlank(n.Related_Opportunity1_Name__c) && String.isBlank(n.Related_Opportunity2_Name__c)) { |
| | | if (uList[0].BuchangApprovalManagerSales__r.IsActive == true || String.isNotBlank(uList[0].BuchangApprovalManagerSales__c)) { |
| | | n.BuchangApprovalManagerSales__c = uList[0].BuchangApprovalManagerSales__c; |
| | | n.BuchangApprovalManagerSales_Txt__c = uList[0].BuchangApprovalManagerSales__r.Name; |
| | | } |
| | | if (uList[0].Buzhang_Equipment_Manager__r.IsActive == true || String.isNotBlank(uList[0].Buzhang_Equipment_Manager__c)) { |
| | | n.Buzhang_Equipment_Manager__c = uList[0].Buzhang_Equipment_Manager__c; |
| | | } |
| | | if (uList[0].ZongjianApprovalManager__r.IsActive == true || String.isNotBlank(uList[0].ZongjianApprovalManager__c)) { |
| | | n.ZongjianApprovalManager__c = uList[0].ZongjianApprovalManager__c; |
| | | } |
| | | // 20230420 ljh DB202304312550 start |
| | | // if (uList[0].Salesdepartment__c == '1.华北' || uList[0].Salesdepartment__c == '2.东北') { |
| | | // if (uList[0].TongkuoZongjianHD__r.IsActive == true || String.isNotBlank(uList[0].TongkuoZongjianHD__c)) { |
| | | // n.TongkuoZongjian__c = uList[0].TongkuoZongjianHD__c; |
| | | // } |
| | | // }else{ |
| | | // if (uList[0].TongkuoZongjian__r.IsActive == true || String.isNotBlank(uList[0].TongkuoZongjian__c)) { |
| | | // n.TongkuoZongjian__c = uList[0].TongkuoZongjian__c; |
| | | // } |
| | | // } |
| | | if (uList[0].TongkuoZongjian__r.IsActive == true || String.isNotBlank(uList[0].TongkuoZongjian__c)) { |
| | | n.TongkuoZongjian__c = uList[0].TongkuoZongjian__c; |
| | | } |
| | | // 20230420 ljh DB202304312550 end |
| | | } |
| | | /*if (uList.size() > 0) { |
| | | String MId = uList[0].SalesManager__c; |
| | | if (String.isBlank(MId)) { |
| | | n.addError('经理无效,请联系管理员。'); |
| | |
| | | } |
| | | }else { |
| | | n.addError('经理无效/离职,请联系管理员。'); |
| | | } |
| | | }*/ //2022-07-20 zyh update |
| | | //2022-07-20 zyh update SWAG-CGG7X9 end |
| | | }else |
| | | //推广经理发生变化赋值文本字段 |
| | | if(oldMap.get(n.Id).SalesManager__c != n.SalesManager__c){ |
| | |
| | | } |
| | | } |
| | | |
| | | } |
| | | }else //2022-07-22 zyh add start |
| | | //推广总监发生变化赋值文本字段 |
| | | if(oldMap.get(n.Id).BuchangApprovalManagerSales__c != n.BuchangApprovalManagerSales__c){ |
| | | //推广总监 等于空 |
| | | if(String.isBlank(n.BuchangApprovalManagerSales__c)){ |
| | | n.SalesManager_Txt__c = ''; |
| | | }else { |
| | | List<User> tempUList = new List<User>(); |
| | | tempUList = [select Id, Name from user where IsActive = true And id = :n.BuchangApprovalManagerSales__c]; |
| | | if(tempUList.size() > 0){ |
| | | n.BuchangApprovalManagerSales_Txt__c = tempUList[0].Name; |
| | | }else { |
| | | n.addError('总监无效/离职,请联系管理员。'); |
| | | } |
| | | } |
| | | |
| | | }//2022-07-22 zyh add end |
| | | } |
| | | } |
| | | |
| | |
| | | if(t.OPDType__c=='学会'){ |
| | | OpdTargetLastAcc.put(t.id,an.Id+'');//上财年 dcListMap.keySet() dcListMap.values() |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | Integer buffer = Integer.valueOf(System.Label.opd_oldDate_update);//为了刷新prod上的老数据 |
| | | //存放模型出借配套的id |
| | | List<OPDPlan__c> opdModelLendList = new List<OPDPlan__c> (); |
| | | Map<Id,Id> opdTaskIdMap = new Map<Id,Id>();//2022-6-24 yjk 延期时opd未对应延期任务 |
| | | for (OPDPlan__c t : newList) { |
| | | |
| | | if (Trigger.isUpdate && (oldMap.get(t.id).Status__c != t.Status__c && t.Status__c == '审批中' || buffer==1)) { |
| | |
| | | |
| | | // SWAG-BXW4AH XHL 20210312 因OPD计划 系统自动延期 后 会清空 备品出借优先度与排序日期 |
| | | // 因此 注掉 End |
| | | |
| | | //2022-6-24 yjk 延期时opd未对应延期任务 start |
| | | opdTaskIdMap.put(t.Task_ID__c,t.id); |
| | | //2022-6-24 yjk 延期时opd未对应延期任务 end |
| | | |
| | | } |
| | | |
| | | //2022-6-24 yjk 延期时opd未对应延期任务 start |
| | | List<Task__c> taskList = [select id,delayTask__c from Task__c where id in :opdTaskIdMap.keySet()]; |
| | | for(Task__c tsk : taskList){ |
| | | if(tsk != null && tsk.delayTask__c != null){ |
| | | newMap.get(opdTaskIdMap.get(tsk.id)).Task_ID__c = taskList.get(0).delayTask__c; |
| | | |
| | | } |
| | | } |
| | | |
| | | //2022-6-24 yjk 延期时opd未对应延期任务 end |
| | | |
| | | if(opdModelLendList.size()>0){ |
| | | updateModelLending(opdModelLendList); |
| | | } |