From 2b6adf750ca9ae5d0094029b25ba474635558109 Mon Sep 17 00:00:00 2001
From: 游畅 <youchang@prec-tech.com>
Date: 星期二, 29 三月 2022 17:30:38 +0800
Subject: [PATCH] opd计划提交审批报错

---
 force-app/main/default/classes/OPDPlanHandlerTest.cls |   16 ++++++++--------
 force-app/main/default/classes/OPDPlanHandler.cls     |    9 +++++----
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/force-app/main/default/classes/OPDPlanHandler.cls b/force-app/main/default/classes/OPDPlanHandler.cls
index 623c89a..7b036ff 100644
--- a/force-app/main/default/classes/OPDPlanHandler.cls
+++ b/force-app/main/default/classes/OPDPlanHandler.cls
@@ -174,7 +174,7 @@
                             nobj.SkipValidationRulesAndWorkflows__c = true;//璺宠繃楠岃瘉瑙勫垯鎴栧伐浣滄祦
                             nObj.supplementaryApplication__c = true;
                             nobj.originalOpdRentalApply__c = originalOpdPlanApplication.Rental_Apply2__c;
-                            nobj.originalOpdRentalApplyName__c = originalOpdPlanApplication.Rental_Apply2__r.Name;
+                            //nobj.originalOpdRentalApplyName__c = originalOpdPlanApplication.Rental_Apply2__r.Name;
                             if (nObj.Account_Laboratory__c != originalOpdPlanApplication.Account_Laboratory__c) {
                                 nObj.Account_Laboratory__c.addError('琛ュ厖鐢宠鐨凮PD璁″垝,涓嶅彲淇敼绉戝鐨勫��');
 
@@ -865,6 +865,7 @@
 
                     from Account_Number_of_target__c
                     where id in :OpdTargetAcc.values()]);//鏌ヨ鐩爣瀹㈡埛 鏈储骞寸殑 
+            system.debug('==鏈储骞�' + acctarList.size());
             Map<id, Account_Number_of_target__c> acctarlastList = new Map<id, Account_Number_of_target__c>([select id,
                     OPD_amount_290MiroBF__c,
                     OPD_amount_290MiroGI__c,
@@ -924,7 +925,7 @@
                     OPDPlan__c opdplan = new OPDPlan__c();
                     for (String opd : OpdPlanDetail) {
                         opdplan.id = t.id;
-                        if(acctarList !=null){
+                        if(acctarList !=null && acctarList.size() >0){
                         if (column != null) {
                             for (Integer i = 0; i < column.size(); i++) { //鏄惁浜у搧OPD鐩爣瀹㈡埛
                                 List<String>  titleAccout = tempImportantProduct.get(column[i]);
@@ -1041,7 +1042,7 @@
                             for (Integer i = 0; i < columnOPDAmount.size(); i++) { //鏈湡OPD娆℃暟
                                 String  titleAccout5 = tempImportantOPDAmount.get(columnOPDAmount[i]);
                                 if (opd == titleAccout5) {
-                                    if(acctarList !=null){
+                                    if(acctarList !=null && acctarList.size()>0){
                                         if (acctarList.containskey(opdct) && acctarList.get(opdct).get(columnOPDAmount[i]) != null && acctarList.get(opdct).get(columnOPDAmount[i]) != 0) {
                                             system.debug('=columnOPDAmount[i]==' + columnOPDAmount[i] + '=鏈湡OPD娆℃暟=' + acctarList.get(opdct).get(columnOPDAmount[i]));
                                             Decimal aa = acctarList.get(opdct).get(columnOPDAmount[i]) == null ? 0 : Decimal.valueOf(String.valueOf(acctarList.get(opdct).get(columnOPDAmount[i])));
@@ -1058,7 +1059,7 @@
                                             }
                                         }
                                     }
-                                    if(acctarlastList !=null){
+                                    if(acctarlastList !=null && acctarlastList.size()>0){
                                         if (acctarlastList.containskey(opdla) && acctarlastList.get(opdla).get(columnOPDAmount[i]) != null && acctarlastList.get(opdla).get(columnOPDAmount[i]) != 0) {
                                             system.debug('=columnOPDAmount[i]==' + columnOPDAmount[i] + '=涓婃湡OPD娆℃暟=' + acctarlastList.get(opdla).get(columnOPDAmount[i]));
                                             Decimal bb = acctarlastList.get(opdla).get(columnOPDAmount[i]) == null ? 0 : Decimal.valueOf(String.valueOf(acctarlastList.get(opdla).get(columnOPDAmount[i])));
diff --git a/force-app/main/default/classes/OPDPlanHandlerTest.cls b/force-app/main/default/classes/OPDPlanHandlerTest.cls
index ceef407..3cbb147 100644
--- a/force-app/main/default/classes/OPDPlanHandlerTest.cls
+++ b/force-app/main/default/classes/OPDPlanHandlerTest.cls
@@ -27,28 +27,28 @@
         Event insertTarget = new Event();
         
         ApexPages.StandardController sc = new ApexPages.standardController( insertTarget);
-        SimpleEventRegisterController target = new SimpleEventRegisterController( sc);
+        //SimpleEventRegisterController target = new SimpleEventRegisterController( sc);
         
-        target.targetEvent.Subject = 'test';   //涓婚
+        /*target.targetEvent.Subject = 'test';   //涓婚
         target.targetEvent.StartDateTime = Datetime.now().addDays(1);   //寮�濮嬫棩鏈�
         target.targetEvent.DurationInMinutes = 60;          //鎸佺画鏃堕棿
         target.targetEvent.Activity_Type2__c = '鐥呴櫌';   //鎷滆鍖哄垎
         target.targetEvent.Activity_PurposeFSE__c = '瀹㈡埛鍩硅';   //鎷滆鐩殑
         target.targetEvent.OPDPlan_Flag__c = true ;   //OPD璁″垝
-        target.targetEvent.Location = dep.Name;  //绉戝
-        target.init();
+        target.targetEvent.Location = dep.Name;  //绉戝*/
+        //target.init();
         //2020/10/29  MZY  start
         Map<String,String> tempMap = new Map<String,String>();
         tempMap.put('GI-290闀滃瓙', '1');
         tempMap.put('EU-ME2', '2');
         tempMap.put('OTV-S300', '4');
-        target.planProducts = tempMap;   //璁″垝鍑哄�熷鍝�
-        target.targetEvent.noOpp_Reason__c = 'HCP瀵瑰簲';  //鏃犺浠风敵璇风悊鐢�
+        //target.planProducts = tempMap;   //璁″垝鍑哄�熷鍝�
+        //target.targetEvent.noOpp_Reason__c = 'HCP瀵瑰簲';  //鏃犺浠风敵璇风悊鐢�
         //2020/10/29  MZY  end
-        target.init();
+        //target.init();
        // target.saveAndNew();
         //2020/10/30  mzy  start
-        insert target.targetEvent;
+        //insert target.targetEvent;
        // target.saveOPDPlan(target.targetEvent);
         //2020/10/30  mzy   end
         /**

--
Gitblit v1.9.1