From de62b11fd2203816306ba94226874b2e62420e83 Mon Sep 17 00:00:00 2001
From: GWY <guweiyiscp096@foxmail.com>
Date: 星期五, 15 四月 2022 09:42:05 +0800
Subject: [PATCH] Merge branch 'master' of http://47.92.229.245:8089/r/OlympusSSBG
---
force-app/main/default/classes/Product2TriggerHandler.cls | 111 ++++++++++++++++++++++++++++---------------------------
1 files changed, 57 insertions(+), 54 deletions(-)
diff --git a/force-app/main/default/classes/Product2TriggerHandler.cls b/force-app/main/default/classes/Product2TriggerHandler.cls
index 0d7da62..56fff4f 100644
--- a/force-app/main/default/classes/Product2TriggerHandler.cls
+++ b/force-app/main/default/classes/Product2TriggerHandler.cls
@@ -65,7 +65,7 @@
Map<Id,List<String>> pro2Map = new Map<Id,List<String>>();
//瀛樻斁娉ㄥ唽璇佷笂鏈�鍓嶇殑缁存姢鏃�,涓�绫昏瘉浼樺厛,鍚﹀垯浜岀被璇併��
Map<Id,Date> prSteMap = new Map<Id,Date>();//瀛樹竴绫荤淮鎶ゆ棩
- Map<Id,Date> prSte1Map = new Map<Id,Date>();//瀛樹簩绫荤淮鎶ゆ棩
+ //Map<Id,Date> prSte1Map = new Map<Id,Date>();//瀛樹簩绫荤淮鎶ゆ棩
if (pro2List.size()>0) {
for (Product_Register_Link__c prl: pro2List) {
//鏈夊尰鐤楀櫒姊板垎绫诲氨澧炲姞,娌℃湁灏辨斁杩涘幓
@@ -92,7 +92,7 @@
prSteMap.put(prl.Product2__r.Id,null);
}
}
- //鍜屼笂闈竴鏍�
+ /*//鍜屼笂闈竴鏍�
if ((prl.Product_Register__r.MedPrdClass__c == '2' || prl.Product_Register__r.MedPrdClass__c == '3') && prl.Product_Register__r.Stelsedag__c <> null &&
(newMap.get(prl.Product2__r.Id).demoteer_Sap__c <= prl.Product_Register__r.ValidTo__c && newMap.get(prl.Product2__r.Id).demoteer_Sap__c >= prl.Product_Register__r.ValidFrom__c)) {
System.debug(prSte1Map.containsKey(prl.Product2__r.Id));
@@ -109,7 +109,7 @@
if (!prSte1Map.containsKey(prl.Product2__r.Id) || prSte1Map.get(prl.Product2__r.Id) == null) {
prSte1Map.put(prl.Product2__r.Id,null);
}
- }
+ }*/
}
}
@@ -117,76 +117,77 @@
Map<Id,String> prlMap = new Map<Id,String>();
Map<Id,String> prl1Map = new Map<Id,String>();
Map<Id,String> prl2Map = new Map<Id,String>();
+ Map<Id,String> prl3Map = new Map<Id,String>();
System.debug('pro2Map='+pro2Map);
System.debug('prSteMap='+prSteMap);
- System.debug('prSte1Map='+prSte1Map);
+ /*System.debug('prSte1Map='+prSte1Map);*/
Date stedate;
//閫氳繃涓婇潰鐨勫惊鐜紝鎶婂叧绯昏〃杩囪幏鍙栫殑鏁版嵁璇诲嚭鏉ワ紝浼犵粰map锛屼竴鍏卞垎涓�3涓猰ap锛岃娉ㄦ剰
if (pro2Map.size()>0) {
for (Product_Register_Link__c pr: pro2List) {
//淇濊瘉id鍦ㄤ笂闈㈢殑map閲屽瓨鍦�,浣嗘槸杩欎竴姝ユ湁娌℃湁濂藉儚娌″暐鍖哄埆,鍙堟病閿欒,绱㈡�т笉鍒犳帀
- if (pro2Map.containsKey(pr.Product2__r.Id) && (prSteMap.containsKey(pr.Product2__r.Id) || prSte1Map.containsKey(pr.Product2__r.Id))) {
+ //&& (prSteMap.containsKey(pr.Product2__r.Id)) || prSte1Map.containsKey(pr.Product2__r.Id)
+ if (pro2Map.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)):prSteMap.get(pr.Product2__r.Id);
- if (stedate <> null) {
- //淇濊瘉浜у搧涓婄殑鐢熶骇鏃ユ湁鍊�
- if (newMap.get(pr.Product2__r.Id).demoteer_Sap__c <> null) {
- //娉ㄥ唽璇佺淮鎶ゆ棩鏈夊��
- if (pr.Product_Register__r.Stelsedag__c <> null) {
- //鍏ュ簱鏃ュ皬浜庣瓑浜庣淮鎶ゆ棩
- if (newMap.get(pr.Product2__r.Id).Diedatvanink__c == null || 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');
+ /*stedate = prSteMap.get(pr.Product2__r.Id)==null?(prSte1Map.get(pr.Product2__r.Id)==null?null:prSte1Map.get(pr.Product2__r.Id)):prSteMap.get(pr.Product2__r.Id);*/
+ stedate = prSteMap.get(pr.Product2__r.Id);
+ //淇濊瘉浜у搧涓婄殑鐢熶骇鏃ユ湁鍊�
+ if (newMap.get(pr.Product2__r.Id).demoteer_Sap__c <> null) {
+ //娉ㄥ唽璇佺淮鎶ゆ棩鏈夊��
+ if (stedate <> null) {
+ //鍏ュ簱鏃ュ皬浜庣瓑浜庣淮鎶ゆ棩,鍏ュ簱鏃ユ病鏈夋寜鐓у叆搴撴棩鍦ㄧ淮鎶ゆ棩涔嬪墠鍒ゆ柇
+ if (newMap.get(pr.Product2__r.Id).Diedatvanink__c == null || 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');
+ if (prlMap.get(pr.Product2__r.Id) == null || !prlMap.containsKey(pr.Product2__r.Id)) {
+ prlMap.put(pr.Product2__r.Id, '浜岀被');
+ }else {
+ String Lins = prlMap.get(pr.Product2__r.Id);
+ Lins += '浜岀被';
+ prlMap.put(pr.Product2__r.Id, Lins);
+ }
+ }else 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') {
+ System.debug('1');
if (prlMap.get(pr.Product2__r.Id) == null || !prlMap.containsKey(pr.Product2__r.Id)) {
- prlMap.put(pr.Product2__r.Id, '浜岀被');
+ prlMap.put(pr.Product2__r.Id, '涓�绫�');
}else {
String Lins = prlMap.get(pr.Product2__r.Id);
- Lins += '浜岀被';
+ Lins += '涓�绫�';
prlMap.put(pr.Product2__r.Id, Lins);
}
- }else 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')) {
- System.debug('1');
- if (prlMap.get(pr.Product2__r.Id) == null || !prlMap.containsKey(pr.Product2__r.Id)) {
- prlMap.put(pr.Product2__r.Id, '涓�绫�');
- }else {
- String Lins = prlMap.get(pr.Product2__r.Id);
- Lins += '涓�绫�';
- prlMap.put(pr.Product2__r.Id, Lins);
- }
+ }
+ //鍏ュ簱鏃ュぇ浜庣淮鎶ゆ棩
+ }else if (newMap.get(pr.Product2__r.Id).Diedatvanink__c <> null && 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 || !prl1Map.containsKey(pr.Product2__r.Id)) {
+ prl1Map.put(pr.Product2__r.Id, '涓�绫�');
+ }else {
+ String Lins = prl1Map.get(pr.Product2__r.Id);
+ Lins += '涓�绫�';
+ prl1Map.put(pr.Product2__r.Id, Lins);
}
- //鍏ュ簱鏃ュぇ浜庣淮鎶ゆ棩
- }else if (newMap.get(pr.Product2__r.Id).Diedatvanink__c <> null && 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 || !prl1Map.containsKey(pr.Product2__r.Id)) {
- prl1Map.put(pr.Product2__r.Id, '涓�绫�');
- }else {
- String Lins = prl1Map.get(pr.Product2__r.Id);
- Lins += '涓�绫�';
- prl1Map.put(pr.Product2__r.Id, Lins);
- }
- }else 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') {
- if (prl1Map.get(pr.Product2__r.Id) == null || !prl1Map.containsKey(pr.Product2__r.Id)) {
- prl1Map.put(pr.Product2__r.Id, '浜岀被');
- }else {
- String Lins = prl1Map.get(pr.Product2__r.Id);
- Lins += '浜岀被';
- prl1Map.put(pr.Product2__r.Id, Lins);
- }
+ }else 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') {
+ if (prl1Map.get(pr.Product2__r.Id) == null || !prl1Map.containsKey(pr.Product2__r.Id)) {
+ prl1Map.put(pr.Product2__r.Id, '浜岀被');
+ }else {
+ String Lins = prl1Map.get(pr.Product2__r.Id);
+ Lins += '浜岀被';
+ prl1Map.put(pr.Product2__r.Id, Lins);
}
}
- }else {
- //缁存姢鏃ョ┖锛岃繖涓猰ap缃┖
- prl2Map.put(pr.Product2__r.Id, '绌�');
}
+ }else if (stedate == null && 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')) {
+ prl3Map.put(pr.Product2__r.Id, '浜岀被');
+ }else {
+ //缁存姢鏃ョ┖锛屼篃娌℃湁浜岀被璇侊紝杩欎釜map缃┖
+ prl2Map.put(pr.Product2__r.Id, '绌�');
}
- }else {
- //鍓嶉潰map鏃犲�硷紝杩欎釜map缃┖
- prl2Map.put(pr.Product2__r.Id, '绌�');
}
}
}
@@ -210,6 +211,8 @@
}else if (prl1Map.get(pr2.Id).contains('浜岀被') && !prl1Map.get(pr2.Id).contains('涓�绫�')) {
pr2.Level_Category__c = '浜岀被';
}
+ }else if (prl3Map.containsKey(pr2.Id)) {
+ pr2.Level_Category__c = '浜岀被';
}else if (prl2Map.containsKey(pr2.Id)) {
//涓轰簡閬垮厤楹荤儲涓庡悗缁慨鏀癸紝缁熶竴闈炵洃绠′簡銆�
pr2.Level_Category__c = '闈炵洃绠�';
--
Gitblit v1.9.1