From b9055688b13a23f8e445de2bc3d5d0d2b85fec30 Mon Sep 17 00:00:00 2001
From: 李彤 <litong@prec-tech.com>
Date: 星期三, 17 五月 2023 19:27:19 +0800
Subject: [PATCH] 包含超声

---
 force-app/main/default/classes/Product2Handler.cls |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/force-app/main/default/classes/Product2Handler.cls b/force-app/main/default/classes/Product2Handler.cls
index 061c194..89d3df3 100644
--- a/force-app/main/default/classes/Product2Handler.cls
+++ b/force-app/main/default/classes/Product2Handler.cls
@@ -32,6 +32,7 @@
     //SFDC鍋滄棰勮  lt  20210922 add start
     protected override void afterUpdate(){
         Calculate_AverageMonthSales(this.newList, this.oldMap);
+        AssignmentUltrasonic(this.newList, this.oldMap);  //20230506 lt DB202304618804  鍖呭惈瓒呭0 add
     }
     //SFDC鍋滄棰勮  lt  20210922 add end
 
@@ -466,4 +467,33 @@
         }
     }
 
+    //20230506 lt DB202304618804  鍖呭惈瓒呭0 start
+    private static void AssignmentUltrasonic(List<Product2> newList,Map<Id, Product2> oldMap){
+        List<String> proIdList = new List<String>();
+        List<PCLLostProduct__c> updateplpList = new List<PCLLostProduct__c>();
+
+        for(Product2 pro : newList){
+            if(pro.RecordTypeId == System.Label.Pro_RecordType && 
+            (pro.Lost_Product_Differ__c != oldMap.get(pro.Id).Lost_Product_Differ__c || 
+            pro.Lost_Product_Category__c != oldMap.get(pro.Id).Lost_Product_Category__c)){
+                proIdList.add(pro.Id);
+            }
+        }
+
+        List<PCLLostProduct__c> plpList = [Select Id, LostProduct__c, ProductClass__c, ProductCategory__c
+                                           From PCLLostProduct__c
+                                           Where LostProduct__c in: proIdList ];
+        if(plpList.size() > 0 ){
+            for(PCLLostProduct__c plp : plpList){
+                plp.ProductClass__c = '涓绘満';
+                plp.ProductCategory__c = '瓒呭0涓绘満';
+                updateplpList.add(plp);
+            }
+        }
+
+        update updateplpList;
+
+    }
+    //20230506 lt DB202304618804  鍖呭惈瓒呭0 end
+
 }
\ No newline at end of file

--
Gitblit v1.9.1