From 8532fb6e9d278f8dbd88e12bbe250c9c0a636556 Mon Sep 17 00:00:00 2001
From: sunxia <sunxia@prec-tech.com>
Date: 星期三, 16 三月 2022 10:29:56 +0800
Subject: [PATCH] obpm新需求修改

---
 force-app/main/default/classes/RentalFixtureSetAssignController.cls |   32 ++++++++++++++++++++++++++------
 1 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/force-app/main/default/classes/RentalFixtureSetAssignController.cls b/force-app/main/default/classes/RentalFixtureSetAssignController.cls
index dcd2a3f..dd42ffe 100644
--- a/force-app/main/default/classes/RentalFixtureSetAssignController.cls
+++ b/force-app/main/default/classes/RentalFixtureSetAssignController.cls
@@ -77,11 +77,9 @@
     }
     // 20211203 ljh add end
     // 鐢婚潰閲岀洿鎺ュ彲浠ヨ緭鍏ョ殑闋呯洰 List
-    // 20220211 ljh update FY23璇鹃01 start
-    // public override List<String> getWritableColumnFieldList() { 
-    //     return new List<String>{'Rental_Start_Date__c', 'Rental_End_Date__c'};    
-    // }
-    // 20220211 ljh update FY23璇鹃01 end;
+    public override List<String> getWritableColumnFieldList() { 
+        return new List<String>{'Rental_Start_Date__c', 'Rental_End_Date__c'};    
+    }
     // getObjName 杩� getOriginObjName 鐨� FK
     public override String getFKColumnField() {
         return null;
@@ -292,13 +290,18 @@
         // update銇犮亼浣跨敤銇欍倠
         List<Rental_Apply_Equipment_Set__c> mfUpdate = new List<Rental_Apply_Equipment_Set__c>();
         Savepoint sp = Database.setSavepoint();
+        List<String> statusList = System.Label.StatusProcessState.split(',');
 
         try {
             Boolean updRAFlg = false;
             Rental_Apply__c raUpd = [
                     SELECT Id, Shipment_request_Cnt__c,
                            Asset_loaner_start_day__c,
-                           Asset_loaner_closed_day__c
+                           Asset_loaner_closed_day__c,
+                           Campaign__c,
+                           Campaign__r.IF_Approved__c,
+                           Campaign__r.Meeting_Approved_No__c,
+                           Campaign__r.Approved_Status__c   //2022 sx obpm澶囧搧鍐宠鐘舵�佺浉鍏充慨鏀�
                       FROM Rental_Apply__c
                      WHERE Id = :parentId
                        FOR Update];
@@ -313,6 +316,15 @@
                 }
             }
 
+            //20220228 sx obpm淇敼 鏄惁鐢宠鍐宠鍕剧潃娌℃湁鍐宠缂栧彿涓嶈兘杩涜鎿嶄綔
+            if( raUpd.Campaign__c!= null && raUpd.Campaign__r.IF_Approved__c && raUpd.Campaign__r.Meeting_Approved_No__c == null){
+                throw new ControllerUtil.myException('宸茬敵璇峰喅瑁佷絾鍐宠缂栫爜涓虹┖');
+            }
+            //20220315 sx obpm obpm澶囧搧鍐宠鐘舵�佺浉鍏充慨鏀� start
+            else if( raUpd.Campaign__c!= null && raUpd.Campaign__r.IF_Approved__c && raUpd.Campaign__r.Meeting_Approved_No__c != null && statusList.contains(raUpd.Campaign__r.Approved_Status__c) ){
+                throw new ControllerUtil.myException('宸茬敵璇峰喅瑁佷絾鍐宠缂栫爜鐘舵�佷笉绗﹀悎闇�姹�');
+            }
+            //20220315 sx obpm obpm澶囧搧鍐宠鐘舵�佺浉鍏充慨鏀� end
             Integer indexNum = 1;
             // 20210708 ljh SFDC-C47CLV add start
             Set<Id> raeIdset = new Set<Id>();
@@ -324,6 +336,7 @@
                     raeIdset.add(robj.Id);    
                 }
             }
+
             List<Rental_Apply_Equipment_Set__c> raeList = [SELECT Id, Name,Rental_Apply__c,Cancel_Select__c,LastModifiedDate FROM Rental_Apply_Equipment_Set__c where Id in :raeIdset];
             // 20210906  ljh SFDC-C6D9C2 add LastModifiedDate
             for(Rental_Apply_Equipment_Set__c rae:raeList){
@@ -346,6 +359,7 @@
                         hasError = true;
                         throw new ControllerUtil.myException('绗�' + indexNum +'琛屾暟鎹凡琚垎鍓茬敵璇峰崟锛岃鍒锋柊鍚庨噸璇曪紒');
                     }
+
                     // 20210708 ljh update end
                     // 20210906  ljh SFDC-C6D9C2 add start
                     // 20210929 ljh SFDC-C6D9C2 娉ㄩ噴 鎭㈠鏀瑰叾浠栨柟妗� start
@@ -1538,6 +1552,7 @@
         return result;
     }
 
+
     public static List<String> transferStringToList(String str){
         // System.debug(LoggingLevel.INFO, '*** str: ' + str);
         List<String> strList = new List<String>();
@@ -1546,6 +1561,11 @@
         }else{
             strList.add(str);
         }
+        for(Integer i = strList.size()-1;i >= 0 ; i --){
+            if(String.isEmpty(strList.get(i))){
+                strList.remove(i);
+            }
+        }
         return strList;
     }
 

--
Gitblit v1.9.1