From ba1c90575c47f9cb5c2ce0a20da90d3b1739b5fa Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期二, 26 四月 2022 11:47:45 +0800
Subject: [PATCH] 0425 Commit
---
force-app/main/default/classes/RadiationUtil.cls | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 55 insertions(+), 4 deletions(-)
diff --git a/force-app/main/default/classes/RadiationUtil.cls b/force-app/main/default/classes/RadiationUtil.cls
index cfd9051..02ebb2f 100644
--- a/force-app/main/default/classes/RadiationUtil.cls
+++ b/force-app/main/default/classes/RadiationUtil.cls
@@ -2,6 +2,8 @@
public static Boolean oldOrder = false;
+ public static BOolean is_oly = false;
+
public static Boolean EscapeOrderTriggerHandler = true;
/**
* [updateRadiationTypeQuantity description]鏇存柊浠g悊鍟嗚瘉鐓ф槑缁嗭紝鏇存柊濂ユ灄宸存柉浠g悊鍟嗙殑璇佺収鏄庣粏
@@ -13,7 +15,7 @@
public static void updateRadiationTypeQuantity (String Id, String orderFounder, String dealerId, Boolean toloseFlag, String operationType, String operator) {
- String olympusAccountId = oldOrder ? System.label.Olympus_Id : System.label.newOlympus_Id;
+ String olympusAccountId = System.label.Olympus_Id ;
String orderId = Id;
//鑾峰彇鍚堝悓鐨勮緪灏勭被鍨嬪拰鏁伴噺
@@ -23,7 +25,9 @@
//鏌ヤ唬鐞嗗晢鐨勪唬鐞嗗晢璐拱鏄庣粏
Map<String, PurchaseDetails__c> dealerModelQuantityMap = GetPurchaseDetailsMap(dealerId);
//鏌ュゥ鏋楀反鏂殑浠g悊鍟嗚喘涔版槑缁�
+ is_oly = true;
Map<String, PurchaseDetails__c> olympusModelQuantityMap = GetPurchaseDetailsMap(olympusAccountId);
+ is_oly = false;
// 鏌ユ壘 鍚堝悓鎻愪氦瀵瑰簲鐨勪唬鐞嗗晢璐拱鏄庣粏
Map<String, PurchaseDetails__c> dealerResult = new Map<String, PurchaseDetails__c>();
Map<String, PurchaseDetails__c> olympusResult = new Map<String, PurchaseDetails__c>();
@@ -117,7 +121,9 @@
} else {//澧炲姞宸插敭浜у搧鏁伴噺
reportMap.putAll(upsertChangedReport(olympusAccountId, radiationType, operationType, orderId, quantity, operator));
+ is_oly = true;
olympusModelQuantityMap = insertPurchaseDetail(olympusModelQuantityMap, olympusAccountId, radiationType, radiationTypeQuantityMap);
+ is_oly = false;
}
} else {//鍑忓幓宸插敭浜у搧鏁伴噺
if (toloseFlag) {
@@ -125,7 +131,9 @@
olympusResult.get(radiationType).SoldNumber__c -= quantity;
} else {//澧炲姞宸插敭浜у搧鏁伴噺
reportMap.putAll(upsertChangedReport(olympusAccountId, radiationType, operationType, orderId, quantity, operator));
+ is_oly = true;
olympusModelQuantityMap = insertPurchaseDetail(olympusModelQuantityMap, olympusAccountId, radiationType, radiationTypeQuantityMap);
+ is_oly = false;
}
}
@@ -140,7 +148,9 @@
if ( olympusResult.size() > 0 && olympusResult != null) {
upsert olympusResult.values();
+ is_oly = true;
insertReportMap.putAll(insertChangedReport(olympusResult, reportMap));
+ is_oly = false;
}
} else {
@@ -151,7 +161,9 @@
if ( olympusModelQuantityMap.size() > 0 && olympusModelQuantityMap != null) {
upsert olympusModelQuantityMap.values();
+ is_oly = true;
insertReportMap.putAll(insertChangedReport(olympusModelQuantityMap, reportMap));
+ is_oly = false;
}
}
@@ -161,7 +173,9 @@
Map<String, Integer> radiationMap = new Map<String, Integer>();
String accountDealerErrorMessage = updateCertificationDetails(dealerId, orderFounder, radiationMap, true);
+ is_oly = true;
String olympusDealerErrorMessage = updateCertificationDetails(olympusAccountId, orderFounder, radiationMap, true);
+ is_oly = false;
}
}
@@ -178,6 +192,7 @@
String accountId = detail.PurchaseAccount__c;
//String accountIdafter = accountId.subString(0,15);
String key = accountId.subString(0, 15) + detail.PurProductModel__c;
+
if (reportMap.containsKey(key)) {
reportMap.get(key).ChangedPurchase__c = detail.Id;
}
@@ -194,9 +209,11 @@
* @return [description]
*/
public static String updateCertificationDetails( String accountId, String orderFounder, Map<String, Decimal> dataMap, Boolean updateFlag) {
-
+
Map<String, CertificationDetails__c> certificationDetailMap = GetAccountCertificationDetail(accountId);
+
Map<String, CertificationDetails__c> temporaryCertificationDetailMap = GetAccountCertificationDetail(accountId);
+
Map<String, PurchaseDetails__c> purchaseDetailMap = GetPurchaseDetailsMap(accountId);
Map<String, CertificationDetails__c> updatecertificationDetailMap = new Map<String, CertificationDetails__c>();
@@ -370,7 +387,19 @@
*/
public static Map<String, CertificationDetails__c> GetAccountCertificationDetail (String accountId) {
Map<String, CertificationDetails__c> result = new Map<String, CertificationDetails__c>();
- List<CertificationDetails__c> certificationDetailsList = [ select Id, Name, ProdustionType__c,
+ List<CertificationDetails__c> certificationDetailsList = new List<CertificationDetails__c>();
+ if (oldOrder && is_oly) {
+ certificationDetailsList = [ select Id, Name, ProdustionType__c,
+ ProductModelNumber__c, Ceiling80__c, Record80__c, Ceiling90__c, Record90__c ,
+ CertificationDetailAccount__c, CertificationDetailAccountName__c,
+ LicenseInformation__r.IfQuantityCtrl__c,AccountRecordType__c,Record100__c,
+ Ceiling100__c
+ from CertificationDetails__c
+ where CertificationDetailAccount__c = :accountId
+ and ActivitieTypes__c = '閿�鍞�' and IsActive__c = false];
+
+ }else{
+ certificationDetailsList = [ select Id, Name, ProdustionType__c,
ProductModelNumber__c, Ceiling80__c, Record80__c, Ceiling90__c, Record90__c ,
CertificationDetailAccount__c, CertificationDetailAccountName__c,
LicenseInformation__r.IfQuantityCtrl__c,AccountRecordType__c,Record100__c,
@@ -378,6 +407,8 @@
from CertificationDetails__c
where CertificationDetailAccount__c = :accountId
and ActivitieTypes__c = '閿�鍞�' and IsActive__c = true];
+ }
+
for (CertificationDetails__c detail : certificationDetailsList) {
result.put(detail.ProdustionType__c, detail);
@@ -407,6 +438,11 @@
purchaseDetail.PurProductModel__c = productModel;
purchaseDetail.PurchaseAccount__c = id;
purchaseDetail.TakeEffectInYear__c = effectiveYear;
+ if (oldOrder && is_oly) {
+ purchasedetail.company__c = '濂ユ灄宸存柉';
+ }else if(is_oly){
+ purchaseDetail.company__c = '浠櫙閫氬厜瀛︾鎶�';
+ }
for (String model:certificationDetailMap.keySet()) {
if ('Delta鍜孷anta'.equals(model)) {
@@ -463,10 +499,25 @@
public static Map<String, PurchaseDetails__c> GetPurchaseDetailsMap( String accountId) {
String effectiveYear = String.valueOf(Date.today().year());
Map<String, PurchaseDetails__c> result = new Map<String, PurchaseDetails__c>();
- List<PurchaseDetails__c> purchaseDetailsList = [select Id, Name, RemainingNumber__c, SoldNumber__c,
+ List<PurchaseDetails__c> purchaseDetailsList = new List<PurchaseDetails__c>();
+ if(is_oly == false){
+ purchaseDetailsList = [select Id, Name, RemainingNumber__c, SoldNumber__c,
PurProductModel__c, PurchaseAccount__c
from PurchaseDetails__c
where TakeEffectInYear__c = :effectiveYear and PurchaseAccount__c = :accountId];
+ }else{
+ if (oldOrder) {
+ purchaseDetailsList = [select Id, Name, RemainingNumber__c, SoldNumber__c,
+ PurProductModel__c, PurchaseAccount__c
+ from PurchaseDetails__c
+ where TakeEffectInYear__c = :effectiveYear and PurchaseAccount__c = :accountId and company__c = '濂ユ灄宸存柉'];
+ }else{
+ purchaseDetailsList = [select Id, Name, RemainingNumber__c, SoldNumber__c,
+ PurProductModel__c, PurchaseAccount__c
+ from PurchaseDetails__c
+ where TakeEffectInYear__c = :effectiveYear and PurchaseAccount__c = :accountId and company__c = '浠櫙閫氬厜瀛︾鎶�'];
+ }
+ }
if (purchaseDetailsList.size() > 0) {
for (PurchaseDetails__c purchaseDetail : purchaseDetailsList) {
result.put(purchaseDetail.PurProductModel__c, purchaseDetail);
--
Gitblit v1.9.1