From 8e39e511f1a272ee05b53ff68a985464a8c7ccf9 Mon Sep 17 00:00:00 2001
From: 涂煌豪 <tuhuanghao@prec-tech.com>
Date: 星期二, 22 三月 2022 17:53:45 +0800
Subject: [PATCH] 先款后修-修理上增加先款标识

---
 force-app/main/default/triggers/Repair.trigger |   34 +++++++++++++++++++++++++---------
 1 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/force-app/main/default/triggers/Repair.trigger b/force-app/main/default/triggers/Repair.trigger
index a4449e4..1daa2f0 100644
--- a/force-app/main/default/triggers/Repair.trigger
+++ b/force-app/main/default/triggers/Repair.trigger
@@ -25,7 +25,11 @@
     // ----------------------------------------------------------------------
     // 銇撱亾銈堛倞銆佷慨鐞嗐伄銈点兗銉撱偣銈炽兂銉堛儵銈儓闋呯洰銈掕嚜鍕曠殑銇洿鏂般仚銈嬨儹銈搞儍銈�
     // ----------------------------------------------------------------------
-    if ( Trigger.isBefore && (Trigger.isInsert || Trigger.isUpdate)) {
+    if (Trigger.isBefore && (Trigger.isInsert || Trigger.isUpdate)) {
+        //鍏堟鍚庝慨-淇悊澧炲姞鍏堟鏍囪瘑 thh 20220322 start
+        RepairTrigger.AdvancePaymentFlagUpsert(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap);
+        //鍏堟鍚庝慨-淇悊澧炲姞鍏堟鏍囪瘑 thh 20220322 end
+
         // 绱嶅叆姗熷櫒ID銈掍竴鎰忋伀鏍肩磵銇欍倠 Set銇с仚銆�
         Set<ID> assetIds = new Set<Id>();
 
@@ -66,8 +70,17 @@
             boolean defaultFlag = true;
             //add     wangweipeng               2021/12/09          end
             // 鑽夋涓慨鐞嗐仩銇戞洿鏂�
+            // GZW 鐗规畩澶勭悊 璺宠繃缁翠慨涓績鑷姩璧嬪�硷紝浠ユ墜閫変负鍑� start
+            // 鍒ゆ柇鏉′欢杩藉姞   && repair.Exc_work_location__c == false
+            if(repair.Exc_work_location__c){
+                defaultFlag = false;
+            }
+            // GZW 鐗规畩澶勭悊 璺宠繃缁翠慨涓績鑷姩璧嬪�硷紝浠ユ墜閫変负鍑� start
+
             if ((repair.Status__c == '鑽夋涓�' || String.isBlank(repair.Status__c)) == false) {
-                if (Trigger.isUpdate && repair.SAP_Transfer_time__c == null) {
+                // if (Trigger.isUpdate && repair.SAP_Transfer_time__c == null) {
+                if (Trigger.isUpdate && repair.SAP_Transfer_time__c == null && repair.Exc_work_location__c == false) {
+                
                     repair = RepairTrigger.updateWorkLocationSelect(repair, null);
                     defaultFlag = false;
                 }
@@ -79,7 +92,8 @@
 
             Boolean needsetnull = true;
             System.debug( '-----:鑷姩甯﹀嚭缁翠慨鍚堝悓11111' + middleTableList);
-            if (middleTableList == null) {
+            // if (middleTableList == null) {
+            if (middleTableList == null  && repair.Exc_work_location__c == false) {
                 if ((repair.NewProductGuarante_Txt__c == '2: 澶氬勾淇濅慨'
                         || repair.NewProductGuarante_Txt__c == '2: 鏈嶅姟澶氬勾淇濅慨'
                         || repair.NewProductGuarante_Txt__c == '8: 甯傚満澶氬勾淇濅慨')
@@ -114,7 +128,8 @@
                             repair.repairPlace__c = middleTable.Maintenance_Contract__r.SalesOfficeCode_selection__c;
                             //鏂板閫昏緫 HWAG-BKP5FB 绮剧悽绉戞妧 2020/03/19 Start
                             //wangweipeng   鍙戠敓鏁版嵁鍒癝AP浠ュ悗锛屼慨鐞嗙殑缁翠慨涓績涓嶈兘鍋氫慨鏀�
-                            if(repair.SAP_Transfer_time__c == null){
+                            // if(repair.SAP_Transfer_time__c == null){
+                            if(repair.SAP_Transfer_time__c == null  && repair.Exc_work_location__c == false){
                                 repair = RepairTrigger.updateWorkLocationSelect(repair, middleTable);    
                                 defaultFlag = false;
                             }
@@ -159,7 +174,8 @@
             // Boolean needsetnull = true;
             System.debug( '-----:鑷姩甯﹀嚭铏氭嫙缁翠慨鍚堝悓');
             System.debug( '-----:鑷姩甯﹀嚭铏氭嫙缁翠慨鍚堝悓' + middleTableVMList);
-            if (middleTableVMList == null) {
+            // if (middleTableVMList == null) {
+            if (middleTableVMList == null  && repair.Exc_work_location__c == false) {
                 if ((repair.NewProductGuarante_Txt__c == '2: 澶氬勾淇濅慨'
                         || repair.NewProductGuarante_Txt__c == '2: 鏈嶅姟澶氬勾淇濅慨'
                         || repair.NewProductGuarante_Txt__c == '8: 甯傚満澶氬勾淇濅慨')
@@ -180,7 +196,8 @@
                         repair.VM_Maintenance_Contract__c = middleTable.Maintenance_Contract__c;
                         needsetnull = false;
                         //鏂板閫昏緫 SLIU-BMMDWK 绮剧悽绉戞妧 2020/03/17 Start
-                        if (repair.VM_Maintenance_Contract__c != null) {
+                        // if (repair.VM_Maintenance_Contract__c != null) {
+                        if (repair.VM_Maintenance_Contract__c != null  && repair.Exc_work_location__c == false) {
                             repair = RepairTrigger.updateWorkLocationSelect(repair, middleTable);
                             defaultFlag = false;
                         }
@@ -257,13 +274,12 @@
                 //杩佺Щ杩涚▼鐢熸垚鍣ㄤ腑repair Alltime鍔熻兘       End
                 /****************************************************************************************************/
             }
-        }
+        }       
     }
     // ----------------------------------------------------------------------
     // 銇撱亾銇俱仹銆併偟銉笺儞銈广偝銉炽儓銉┿偗銉堥爡鐩倰鑷嫊鐨勩伀鏇存柊銇欍倠銉偢銉冦偗
     // ----------------------------------------------------------------------
-
-
+    
 
     // ----------------------------------------------------------------------
     // 銇撱倢銈堛倞銆丱n-Call銇�孫n-Call璺熻繘缁撴灉銆嶃倰鏇存柊銇欍倠銉偢銉冦偗

--
Gitblit v1.9.1