From d8dc84a3d56df839895f1c417a4d9cbee763d262 Mon Sep 17 00:00:00 2001
From: 高章伟 <gaozhangwei@prec-tech.com>
Date: 星期五, 03 三月 2023 14:50:59 +0800
Subject: [PATCH] gzw 测试环境代码更新

---
 force-app/main/default/triggers/RepairQuoteTrigger.trigger |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/force-app/main/default/triggers/RepairQuoteTrigger.trigger b/force-app/main/default/triggers/RepairQuoteTrigger.trigger
index 422638b..bc19ce8 100644
--- a/force-app/main/default/triggers/RepairQuoteTrigger.trigger
+++ b/force-app/main/default/triggers/RepairQuoteTrigger.trigger
@@ -52,6 +52,23 @@
                 local.ZongjianApprovalServiceManager__c = loginUser.ZongjianApprovalManager__c==null?local.BuchangApprovalServiceManager__c:loginUser.ZongjianApprovalManager__c;
             }
             //20200102 HWAG-BJZ6AQ 鏈嶅姟鏈儴鍑忎环鐢宠 end
+
+            //add by lc 20220923 WLIG-CJ46ET 澶囧搧绾夸笂瀹℃壒 start 
+            if ((Trigger.isInsert
+                    || old.Rental_Apply_Discount_Status__c  != local.Rental_Apply_Discount_Status__c 
+                )
+                && local.Rental_Apply_Discount_Status__c  == '宸叉彁浜�'
+            ) {
+                local.Loaner_Discount_Price__c = local.Loaner_repair__c;
+                // 鍙栧緱澶囧搧淇悊(40) 瀛楁鐨凩abel
+                Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
+                Schema.SObjectType leadSchema = schemaMap.get('Repair_Quotation__c');
+                Map<String, Schema.SObjectField> fieldMap = leadSchema.getDescribe().fields.getMap();
+                local.Rental_Apply_Discount_Reason__c = fieldMap.get('Loaner_repair__c').getDescribe().getLabel();
+                local.RentalApplyDiscountApplyPerson__c = UserInfo.getUserId();
+            }
+            //add by lc 20220923 WLIG-CJ46ET 澶囧搧绾夸笂瀹℃壒 end
+
             if (Trigger.isUpdate
                 && ((local.Discount_request_approval_date__c != null
                     && (Trigger.oldMap.get(local.id).Discount_request_approval_date__c == null 
@@ -65,7 +82,7 @@
         }
         if (rprIdList.size() > 0) {
             Map<Id, Repair__c> rprMap = new Map<Id, Repair__c>([
-                    Select Id, RC_Mail_Address__c,RC_Mail_Address1__c,Assistant_Mail_Address__c,Incharge_Staff_EMail__c,CreatedById
+                    Select Id, RC_Mail_Address__c,RC_Mail_Address1__c,Assistant_Mail_Address__c,Incharge_Staff_EMail__c,CreatedById,Failure_Source__c
                       from Repair__c
                      where Id IN :rprIdList.values()
             ]);
@@ -76,6 +93,7 @@
                     local.Assistant_Mail_Address__c = rprMap.get(local.Repair__c).Assistant_Mail_Address__c;
                     local.Incharge_Staff_EMail__c =  rprMap.get(local.Repair__c).Incharge_Staff_EMail__c;
                     local.RepairCreator__c = rprMap.get(local.Repair__c).CreatedById;
+                    local.Failure_Source__c = rprMap.get(local.Repair__c).Failure_Source__c;
                 }
             }
         }
@@ -84,5 +102,9 @@
 
     if(Trigger.isAfter && (Trigger.isInsert || Trigger.isUpdate)){
         RepairQuoteTrigger.ChangeRepair(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap);
+        //add by lc 20220923 WLIG-CJ46ET 澶囧搧绾夸笂瀹℃壒 start 
+        // 澶囧搧鍑忎环鐢宠瀹℃壒閫氳繃鍚庯紝缁欏搴擱C缇ょ粍鎴栬�呭姙浜嬪缇ょ粍鍙戦偖浠堕�氱煡
+        RepairQuoteTrigger.SendEmailForRentalApproval(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap);
+        //add by lc 20220923 WLIG-CJ46ET 澶囧搧绾夸笂瀹℃壒 end
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1