From 0f07997d64a3e56afea01c04777c3e6a1954f407 Mon Sep 17 00:00:00 2001
From: GWY <guweiyiscp096@foxmail.com>
Date: 星期三, 16 三月 2022 13:47:41 +0800
Subject: [PATCH] PJ1降类逻辑取最新入库日修改。
---
force-app/main/default/classes/Product2TriggerHandler.cls | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/force-app/main/default/classes/Product2TriggerHandler.cls b/force-app/main/default/classes/Product2TriggerHandler.cls
index 79b7947..2b34f41 100644
--- a/force-app/main/default/classes/Product2TriggerHandler.cls
+++ b/force-app/main/default/classes/Product2TriggerHandler.cls
@@ -55,7 +55,7 @@
//瀛樻斁鏌ユ壘鐨剆oql鏂�
List<Product_Register_Link__c> pro2List = new List<Product_Register_Link__c>();
- pro2List = [select Product2__r.id,Product2__r.demoteer_Sap__c,Product2__r.Diedatvanink__c,Product_Register__r.Stelsedag__c,Product_Register__r.MedPrdClass__c,Product_Register__r.ValidTo__c,Product_Register__r.ValidFrom__c
+ pro2List = [select Product2__r.id,Product2__r.demoteer_Sap__c,Product2__r.Diedatvanink__c,Product_Register__r.Stelsedag__c,Product_Register__r.MedPrdClass__c,Product_Register__r.ValidTo__c,Product_Register__r.ValidFrom__c,Product_Register__c,Product2__c
from Product_Register_Link__c
where Product2__r.Id in : p2ids];
System.debug('pro2List='+pro2List);
@@ -109,9 +109,9 @@
for (Product_Register_Link__c pr: pro2List) {
if (pro2Map.containsKey(pr.Product2__r.Id) && (prSteMap.containsKey(pr.Product2__r.Id) || prSte1Map.containsKey(pr.Product2__r.Id))) {
stedate = prSteMap.get(pr.Product2__r.Id)==null?prSte1Map.get(pr.Product2__r.Id)==null?null:prSte1Map.get(pr.Product2__r.Id):prSte1Map.get(pr.Product2__r.Id);
- if (newMap.get(pr.Product2__r.Id).demoteer_Sap__c <> null && pr.Product2__r.Diedatvanink__c <> null) {
+ if (newMap.get(pr.Product2__r.Id).demoteer_Sap__c <> null && newMap.get(pr.Product2__r.Id).Diedatvanink__c <> null) {
if (pr.Product_Register__r.Stelsedag__c <> null) {
- if (pr.Product2__r.Diedatvanink__c <= stedate) {
+ if (newMap.get(pr.Product2__r.Id).Diedatvanink__c <= stedate) {
if (newMap.get(pr.Product2__r.Id).demoteer_Sap__c <= pr.Product_Register__r.ValidTo__c && newMap.get(pr.Product2__r.Id).demoteer_Sap__c >= pr.Product_Register__r.ValidFrom__c
&& pr.Product_Register__r.MedPrdClass__c == '2' || pr.Product_Register__r.MedPrdClass__c == '3') {
System.debug('2');
@@ -142,7 +142,7 @@
prlMap.put(pr.Product2__r.Id, Lins);
}
}
- }else if (pr.Product2__r.Diedatvanink__c > stedate) {
+ }else if (newMap.get(pr.Product2__r.Id).Diedatvanink__c > stedate) {
if (newMap.get(pr.Product2__r.Id).demoteer_Sap__c <= pr.Product_Register__r.ValidTo__c && newMap.get(pr.Product2__r.Id).demoteer_Sap__c >= pr.Product_Register__r.ValidFrom__c
&& pr.Product_Register__r.MedPrdClass__c == '1') {
if (prl1Map.get(pr.Product2__r.Id) == null) {
@@ -178,6 +178,8 @@
}
}
}
+
+ System.debug('stedate='+stedate);
System.debug('prlMap='+prlMap);
System.debug('prl1Map='+prl1Map);
--
Gitblit v1.9.1