From e7a284af780e1b09deb599215cbe0735b119a5f3 Mon Sep 17 00:00:00 2001 From: 李金换 <lijinhuan@prec-tech.com> Date: 星期三, 30 十一月 2022 16:07:13 +0800 Subject: [PATCH] opd备品取消逻辑 --- force-app/main/default/classes/OPDPlanCancelPostponePlanLogicBatch.cls | 38 ++++++++++++++++++++++++++++++++------ 1 files changed, 32 insertions(+), 6 deletions(-) diff --git a/force-app/main/default/classes/OPDPlanCancelPostponePlanLogicBatch.cls b/force-app/main/default/classes/OPDPlanCancelPostponePlanLogicBatch.cls index bc46d1e..ce3a52f 100644 --- a/force-app/main/default/classes/OPDPlanCancelPostponePlanLogicBatch.cls +++ b/force-app/main/default/classes/OPDPlanCancelPostponePlanLogicBatch.cls @@ -1,6 +1,7 @@ //褰撳墠鏃ユ湡澶т簬OPD璁″垝瀹炴柦鏃ユ湡 and 鐘舵�佷笉绛変簬鍙栨秷鎴栧畬姣� and 锛坥pd璁″垝涓嬫病鏈変换浣曞緱澶囧搧鍊熷嚭鐢宠 or 鎴栬�呭搴斿鍝佸�熷嚭鐘舵�佹槸鑽夋涓�,鐢宠涓�,鍙栨秷鏃讹級 //闇�瑕佸垱寤篛PD璁″垝鍙栨秷寤舵湡,鏇存柊opd璁″垝 //1.OPD璁″垝鍙栨秷寤舵湡.鍙栨秷鐞嗙敱鏄彇娑堟垚鍔�,2.闇�瑕佽�冭檻opd璁″垝鎵�鏈変汉鏄惁宸茬鑱岋紝鑻ョ鑱岋紝鍙栨秷/寤舵湡鐞嗙敱涓烘媴褰撶鑱岋紝鍚﹀垯涓烘病瀹屾垚澶囧搧鐢宠 +// OPD璁″垝寤舵湡涓�娆″悗锛屽湪绗簩涓湀浠嶆病鏈夊垎閰嶅鍝佺殑锛孫PD璁″垝鑷姩鍙栨秷锛屽師鍥犱负澶囧搧涓嶈冻锛屽悓鏃跺鍝佺敵璇疯嚜鍔ㄥ彇娑堛�� ljh 20220929 global class OPDPlanCancelPostponePlanLogicBatch implements Database.Batchable<sObject>, Database.Stateful { //鍔犳棩蹇� 涓轰簡鏇存柊鍘嗗彶鏁版嵁 鍋氫竴涓嬫棩蹇楁煡鐪� 20201124 you start private final Id TEST_ID = null; @@ -65,9 +66,8 @@ List<CancelPostponePlan__c> cppList = new List<CancelPostponePlan__c>(); List<OPDPlan__c> OpdRtlList = new List<OPDPlan__c>(); List<OPDPlan__c>OpdUpList = new List<OPDPlan__c>(); - system.debug('OPDPlanList' + OPDPlanList.size()); - + Set<Id> raIdSet = new Set<Id>();// 鏈変繚鏈夎澶� 鐨勪竴鐢宠涔� 20221107 ljh update SWAG-CHM5E4 for (OPDPlan__c op : OPDPlanList) { if (op.Rental_Apply2__c != null) { // 鎵�鏈夋湁澶囧搧鐨凮PD璁″垝 @@ -79,25 +79,51 @@ } //opdID涓嶰PD璁″垝鍙栨秷寤舵湡Map Map<id, Rental_Apply__c> rtlMap = new Map<id, Rental_Apply__c>(); + Set<Id> rtl3Set = new Set<Id>();//20221108 ljh update SWAG-CHM5E4 if (OpdRtlList.size() > 0) { //鑾峰彇OPD璁″垝涓嬬殑鍙栨秷寤舵湡鏁版嵁 + //20220920 ljh update SWAG-CHM5E4 start + List<Rental_Apply_Equipment_Set_Detail__c> raesList = + [select Rental_Apply__c from Rental_Apply_Equipment_Set_Detail__c where Asset__c != null and Rental_Apply__r.OPDPlan__c in :OpdRtlList]; + for(Rental_Apply_Equipment_Set_Detail__c raes:raesList){ + raIdSet.add(raes.Rental_Apply__c); + } + //20220920 ljh update SWAG-CHM5E4 end List<Rental_Apply__c> rtlList = [select id, RA_Status__c, OPDPlan__c from Rental_Apply__c where OPDPlan__c in :OpdRtlList]; //鍙栧嚭澶囧搧鍊熷嚭鐘舵�佷笉鏄崏妗堜腑,鐢宠涓�,鍙栨秷鐨勫彇娑堝欢鏈熸暟鎹斁鍏ap for (Rental_Apply__c rtl : rtlList) { - if (rtl.RA_Status__c != '鑽夋涓�' && rtl.RA_Status__c != '鐢宠涓�' && rtl.RA_Status__c != '鍙栨秷') { + //20221007 ljh update SWAG-CHM5E4 start + // if (rtl.RA_Status__c != '鑽夋涓�' && rtl.RA_Status__c != '鐢宠涓�' && rtl.RA_Status__c != '鍙栨秷') { + // // OPD璁″垝-鎵�鏈夊鍝丮ap + // rtlMap.put(rtl.OPDPlan__c, rtl); + // } + if (rtl.RA_Status__c == '鑽夋涓�' || rtl.RA_Status__c == '鐢宠涓�' || rtl.RA_Status__c == '鍙栨秷') { // OPD璁″垝-鎵�鏈夊鍝丮ap - rtlMap.put(rtl.OPDPlan__c, rtl); + rtl3Set.add(rtl.OPDPlan__c); } + if(raIdSet.contains(rtl.Id)){ + rtlMap.put(rtl.OPDPlan__c, rtl); + } + //20221007 ljh update SWAG-CHM5E4 end } } + Date dateToday1 = Date.today();//20221108 ljh update SWAG-CHM5E4 //鍙栧嚭鍙互鍙樻洿鐨勫鍝佸�熷嚭鐢宠 for (OPDPlan__c OpdRt : OpdRtlList) { - if (!rtlMap.containskey(OpdRt.Id)) { + //20221108 ljh update SWAG-CHM5E4 start + // if (!rtlMap.containskey(OpdRt.Id)) { + // OpdUpList.add(OpdRt); + // } + if (!rtlMap.containskey(OpdRt.Id) && rtl3Set.contains(OpdRt.Id)) { + OpdUpList.add(OpdRt); + }else if(!rtlMap.containskey(OpdRt.Id) && !rtl3Set.contains(OpdRt.Id) && OpdRt.OPDPlan_ImplementDate__c < dateToday1 && OpdRt.SystemDelayMark__c){ OpdUpList.add(OpdRt); } + //20221108 ljh update SWAG-CHM5E4 end } - Date dateToday1 = Date.today(); + // Date dateToday1 = Date.today(); + System.debug('OpdUpList涓暟:'+OpdUpList.size()); //璧嬪�奸渶瑕佽�冭檻鎷呭綋鑰呮槸鍚﹀湪鑱� for (OPDPlan__c op : OpdUpList) { CancelPostponePlan__c cpp = new CancelPostponePlan__c(); -- Gitblit v1.9.1