From 80f74bc1dfbf4a6f2fa358efe027590d2cdb5b99 Mon Sep 17 00:00:00 2001
From: GWY <guweiyiscp096@foxmail.com>
Date: 星期二, 19 四月 2022 10:39:16 +0800
Subject: [PATCH] 代理商公共小组,无影响。
---
force-app/main/default/classes/OrderTriggerHandler.cls | 289 +++++++++++++++++----------------------------------------
1 files changed, 85 insertions(+), 204 deletions(-)
diff --git a/force-app/main/default/classes/OrderTriggerHandler.cls b/force-app/main/default/classes/OrderTriggerHandler.cls
index a6a92a0..cc066e7 100644
--- a/force-app/main/default/classes/OrderTriggerHandler.cls
+++ b/force-app/main/default/classes/OrderTriggerHandler.cls
@@ -108,7 +108,7 @@
system.debug('2222222'+getModelQuantityMap);
String accountDealerErrorMessage = RadiationUtil.updateCertificationDetails(oliList[0].Opportunity.DealerId__c, null, getModelQuantityMap, false);
String olympusDealerErrorMessage = RadiationUtil.updateCertificationDetails(olympusAccountId, null, getModelQuantityMap, false) == '' ? '' : '浠櫙閫氬彲閿�鍞暟閲忎笉瓒�';
- //result = accountDealerErrorMessage + (olympusDealerErrorMessage == '' ? '' : '濂ユ灄宸存柉鍙攢鍞暟閲忎笉瓒�') ;
+ //result = accountDealerErrorMessage + (olympusDealerErrorMessage == '' ? '' : '浠櫙閫氬彲閿�鍞暟閲忎笉瓒�') ;
Boolean temp = accountDealerErrorMessage.startsWith('浣犱笉鑳�');
String strOly = LicenseCheckUtil.LicenseCheckOly();
if(temp){
@@ -170,8 +170,6 @@
}*/
}
-
-
List<AggregateResult> orderCnt = [select Count(Id) ocnt, OpportunityId from Order where OpportunityId = :oppIdList and Status__c = 'Active' group by OpportunityId];
Map<String, Integer> orderCntMap = new Map<String, Integer>();
for (AggregateResult temp : orderCnt) {
@@ -191,12 +189,14 @@
}
//鐜嬮箯浼� 鏂板缓鍜屽悓鏃�,鍜岃浠峰姣斿鎴枫�佹渶缁堢敤鎴�
//鎴村畤锛屾坊鍔犲悎鍚屽叧鑱旈�昏緫
- List<Opportunity> oppList = [select id,Association_Opportunity__c,CrossCooperativeProject__c,HeadOfCooperationArea__c,CrossCooperativeDealer__r.ManagementCode_F__c,CrossCooperativeDealer__r.Name,SyncedQuoteId, SyncedQuote.PaymentTerms__c, TradeType__c, Quote_PaymentTerms__c,AccountId,customerType__c,useing__c,compo_opp__c,RecordTypeId from Opportunity where id = :oppidList];
+ List<Opportunity> oppList = [select id,Association_Opportunity__c,CrossCooperativeProject__c,HeadOfCooperationArea__c,CrossCooperativeDealer__r.ManagementCode_F__c,CrossCooperativeDealer__r.Name,SyncedQuoteId, SyncedQuote.PaymentTerms__c, TradeType__c, Quote_PaymentTerms__c,AccountId,customerType__c,useing__c,compo_opp__c from Opportunity where id = :oppidList];
Map<String, String> syncedQuoteIdMap = new Map<String, String>();
Map<String, String> paymentTermsMap = new Map<String, String>();
Map<String, String> tradeTypeMap = new Map<String, String>();
Map<String,String> oppAccountMap = new Map<String,String>();
Map<String,Opportunity> oppMap = new Map<String,Opportunity>();
+
+
for (Opportunity opp : oppList) {
syncedQuoteIdMap.put(opp.id, opp.SyncedQuoteId);
@@ -212,9 +212,6 @@
if(newOrd.ProductSegment__c == 'IE' && newOrd.IE_SP8_D__c != oppMap.get(newOrd.OpportunityId).compo_opp__c){
newOrd.addError('涓嶈兘淇敼鐗规畩鏉′欢COMPO');
}
-
-
-
/*if(newOrd.ProductSegment__c == 'BS'){
String temp = oppMap.get(newOrd.OpportunityId).useing__c;
if(newOrd.SP_61D__c != (temp == ''?false:true)){
@@ -244,7 +241,7 @@
newOrd.CrossCooperativeDealerCode__c = oppMap.get(newOrd.OpportunityId) == null ? '' :oppMap.get(newOrd.OpportunityId).CrossCooperativeDealer__r.ManagementCode_F__c;
newOrd.HeadOfCooperationArea__c = oppMap.get(newOrd.OpportunityId) == null ? null :oppMap.get(newOrd.OpportunityId).HeadOfCooperationArea__c;
newOrd.CrossCooperativeDealerText__c = oppMap.get(newOrd.OpportunityId) == null ? null :oppMap.get(newOrd.OpportunityId).CrossCooperativeDealer__r.Name;
- newOrd.is_Direct__c = oppMap.get(newOrd.OpportunityId) == null ? false : (oppMap.get(newOrd.OpportunityId).RecordTypeId == '0120T0000003Ser' ? true : false);
+
//鐜嬮箯浼熸柊鍔狅紝鍚堝悓涓甫鍏� 璇环 璐告槗绠$悊瀹㈡埛鍒嗙被 寮�濮�
newOrd.TradeMagCategory__c = oppMap.get(newOrd.OpportunityId) == null ? '' :oppMap.get(newOrd.OpportunityId).customerType__c;
@@ -269,7 +266,7 @@
newOrd.RecordTypeId == System.Label.RT_Contract_IndividualCase_NDT ||
newOrd.RecordTypeId == System.Label.RT_Contract_IndividualCase_RVI;
- if (UserInfo.getUserType() == 'PowerPartner' || newOrd.RecordTypeId == System.Label.RT_ServiceContract || newOrd.RecordTypeId == '0120T0000003nka'
+ if (UserInfo.getUserType() == 'PowerPartner' || newOrd.RecordTypeId == System.Label.RT_ServiceContract
|| newOrd.RecordTypeId == System.Label.RT_ServiceContractIE || newOrd.RecordTypeId == System.Label.RT_ServiceContractRVI || individualCase) {
// 澶栬锤閫佽揪鏂归粯璁や负澶栬锤鍏徃
if (tradeTypeMap.get(newOrd.OpportunityId) == System.Label.Trade_Type) {
@@ -428,6 +425,7 @@
}
public static void setPriceBook(List<Order> newList, Map<Id, Order> newMap, List<Order> oldList, Map<Id, Order> oldMap) {
+
List<String> oppidList = new List<String>();
for (Order o : newList) {
oppidList.add(o.OpportunityId);
@@ -444,18 +442,11 @@
public static void addItem(List<Order> newList, Map<Id, Order> newMap, List<Order> oldList, Map<Id, Order> oldMap) {
List<String> oppidList = new List<String>();
+// Map<String, String> order2oppMap = new Map<String, String>();
Boolean hasBS = false;
- List<OrderShare> salesOwnershareList = new List<OrderShare>();
for (Order o : newList) {
oppidList.add(o.OpportunityId);
- // 璺ㄧ渷浠藉悎浣滈」鐩� 涓虹湡 骞朵笖 鍚堝悓瀹℃壒浜轰笉鏄┖锛屽皢鍚堝悓鍏变韩缁欏鎵逛汉 Start
- if (o.CrossCooperativeProject__c && String.isNotBlank(o.SalesOwner_BS__c)) {
- salesOwnershareList.add(DataAssembly(o.Id,o.SalesOwner_BS__c));
- }
- // 璺ㄧ渷浠藉悎浣滈」鐩� 涓虹湡 骞朵笖 鍚堝悓瀹℃壒浜轰笉鏄┖锛屽皢鍚堝悓鍏变韩缁欏鎵逛汉 End
- }
- if (salesOwnershareList.size() > 0) {
- insert salesOwnershareList;
+// order2oppMap.put(o.Id, o.OpportunityId);
}
// XHL20210830
List<OpportunityTeamMember> oppTM = new List<OpportunityTeamMember>();
@@ -696,12 +687,8 @@
//鏂扮殑鑾峰彇绠�妗D calendarUtil.getMemberProfileID 杩欓噷鐢ㄥ埌鐨勪汉鍛業D 鍜岃幏鍙栧埌鐨勭畝妗D閮芥槸15浣嶇殑
//String new_profileId = calendarUtil.getMemberProfileID(UserInfo.getUserId().subString(0,15));
String new_profileId = calendarUtil.getMemberProfileID(UserInfo.getUserId().subString(0,15));
-
for (Order newOrd : newList) {
Order oldOrd = oldMap.get(newOrd.Id);
- if(newOrd.CrossCooperativeProject__c && CherkCrossComperativeChanged(newOrd,oldOrd)){
- newOrd.addError('鍒涘缓鍚堝悓鍚庝笉鑳戒慨鏀笰浠g悊鍟嗗拰B浠g悊鍟�');
- }
/* if(newOrd.SubDealer__c == '鏃�'){
newOrd.SubDealer__c = '';
}*/
@@ -1484,12 +1471,12 @@
*/
public static void setOrderShare (List<Order> newList, Map<Id, Order> newMap, List<Order> oldList, Map<Id, Order> oldMap) {
List<OrderShare> insertOrderShareList = new List<OrderShare>();
- BatchIF_Log__c iflog = new BatchIF_Log__c();
+ /*BatchIF_Log__c iflog = new BatchIF_Log__c();
iflog.Type__c = 'OrderShare';
String datetimeStr = String.valueOf(Datetime.now()).replace('-','').replace(' ','').replace(':','');
iflog.MessageGroupNumber__c = datetimeStr;
iflog.Log__c = '';
- Boolean errrorFlag = false;
+ Boolean errrorFlag = false;*/
for (Order newOrd : newList) {
Order oldOrd = oldMap == null ? new Order() : oldMap.get(newOrd.Id);
@@ -1504,7 +1491,7 @@
if (newOrd.SharedFlag__c != oldOrd.SharedFlag__c && newOrd.SharedFlag__c && newOrd.OwnerId != oldOrd.OwnerId) {
String userId = oldOrd.OwnerId;
insertOrderShareList.add(DataAssembly(newOrd.Id,userId));
- } else {
+ } /*else {
if (newOrd.SharedFlag__c != oldOrd.SharedFlag__c && newOrd.SharedFlag__c) {
iflog.Log__c += 'Order Id --->'+ newOrd.Id + '\n';
@@ -1512,7 +1499,7 @@
iflog.Log__c += 'oldOrd.OwnerId--->'+oldOrd.OwnerId + '\n';
errrorFlag = true;
}
- }
+ }*/
}
if (insertOrderShareList.size() > 0) {
@@ -1520,9 +1507,9 @@
insert insertOrderShareList;
}
- if (errrorFlag) {
+ /*if (errrorFlag) {
insert iflog;
- }
+ }*/
}
@@ -1537,18 +1524,8 @@
// }
// XHL20210830
if (newOrd.SharedFlag__c != oldOrd.SharedFlag__c && newOrd.SharedFlag__c && newOrd.OwnerId != newOrd.OpportunityOwnerId__c && newOrd.OpportunityOwnerId__c <> null && newOrd.OpportunityOwnerId__c <> '') {
- newOrd.OwnerId = newOrd.OpportunityOwnerId__c;
+ newOrd.OwnerId = newOrd.OpportunityOwnerId__c;
}
-
- if (newOrd.SharedFlag__c != oldOrd.SharedFlag__c && newOrd.SharedFlag__c){
- // 璺ㄧ渷浠藉悎浣滈」鐩� 涓虹湡 骞朵笖 鍚堝悓瀹℃壒浜轰笉鏄┖锛屽皢瀹℃壒浜鸿祴鍊肩粰鎵�鏈変汉 Start
- if (newOrd.CrossCooperativeProject__c && String.isNotBlank(newOrd.SalesOwner_BS__c)) {
- newOrd.OwnerId = newOrd.SalesOwner_BS__c;
- }
- // 璺ㄧ渷浠藉悎浣滈」鐩� 涓虹湡 骞朵笖 鍚堝悓瀹℃壒浜轰笉鏄┖锛屽皢瀹℃壒浜鸿祴鍊肩粰鎵�鏈変汉 End
- }
-
- //
if (newOrd.ApproveStatus__c != oldOrd.ApproveStatus__c) {
if (newOrd.ApproveStatus__c == 'Pass' && newOrd.IsCopy__c == false) {
newOrd.IsSpPassed__c = true;
@@ -1874,12 +1851,7 @@
if (oldOrder.ApproveStatus__c != newOrder.ApproveStatus__c && (newOrder.ApproveStatus__c == 'Completed' || newOrder.ApproveStatus__c == 'Completed2' || newOrder.ApproveStatus__c == 'CompletedC' || newOrder.ApproveStatus__c == 'CompletedS' )) {
ownerIdList.add(newOrder.OpportunityOwnerId__c);
- ownerIdList.add(newOrder.SalesOwner_BS__c);
- if(newOrder.CrossCooperativeProject__c){
- orderToOwner.put(newOrder.Id, newOrder.SalesOwner_BS__c);
- }else{
- orderToOwner.put(newOrder.Id, newOrder.OpportunityOwnerId__c);
- }
+ orderToOwner.put(newOrder.Id, newOrder.OpportunityOwnerId__c);
}
if (newOrder.Description != null && newOrder.Description.length() > 0) {
@@ -2019,12 +1991,14 @@
}
//鏄惧井闀滈檷绾�
- levelMap = levelCheck(ordIdList);
+ if(OrderDivisionController.OrderDivision == false){
+ levelMap = levelCheck(ordIdList);
+ }
//for()
Map<Id, User> copyUserMap = new Map<Id, User>([
SELECT Id, Name, SalesAsistManager__c, BusinessDepOwner_Tax__c, BusinessDepOwner_WithoutTax__c, SalesManager__c, AsistGenManger__c, CRM_Owner__c,
- BS_AsistGenManger__c,BS_AsistBGenManger__c,Department__c,BS_BDepartment__c,BS_GeneralManager__c,BS_INDepartment__c,BS_Department__c,BS_Manager__c
+ BS_AsistGenManger__c,BS_AsistBGenManger__c,BS_BDepartment__c,BS_GeneralManager__c,BS_INDepartment__c,BS_Department__c,BS_Manager__c
FROM User WHERE Id IN :ownerIdList
]);
@@ -2054,11 +2028,8 @@
User u = copyUserMap.get(orderToOwner.get(newOrder.Id));
- if (u != null && (u.SalesAsistManager__c != null || u.Department__c != null || u.BusinessDepOwner_Tax__c != null || u.BusinessDepOwner_WithoutTax__c != null || u.SalesManager__c != null || u.AsistGenManger__c != null)) {
- if(newOrder.CrossCooperativeProject__c == false){
- newOrder.SalesOwner_BS__c = newOrder.OpportunityOwnerId__c;
- }
-
+ if (u != null && (u.SalesAsistManager__c != null || u.BusinessDepOwner_Tax__c != null || u.BusinessDepOwner_WithoutTax__c != null || u.SalesManager__c != null || u.AsistGenManger__c != null)) {
+ newOrder.SalesOwner_BS__c = newOrder.OpportunityOwnerId__c;
newOrder.SalesAsistManager_BS__c = u.SalesAsistManager__c == null ? u.Id : u.SalesAsistManager__c;
// 褰撻粍骞虫睙鐨処E瀹岀◣鍚堝悓锛屼互涓嬬渷浠戒笟鍔¢儴瀹℃壒浜轰负閮戣蕉鐩� 2018/11/30
if (newOrder.ProductSegment__c == 'IE' && u.Id == '00528000000YVFs' && (newOrder.Province__c == '娌冲崡' || newOrder.Province__c == '灞变笢'
@@ -2112,12 +2083,13 @@
newOrder.OrderUpdateUser__c = UserInfo.getUserId();
}
//if (newOrder.RecordTypeId == '01228000000NJt8') {
- //gwy 2022-02-18 绛夌骇绫诲埆瀛楁娣诲姞鎺у埗,鏅�氬悎鍚屽拰鍙樻洿鐨勫悎鍚屻��
if ((newOrder.ProductSegment__c == 'BS' && newOrder.Is_TAX__c == true && newOrder.AccoutMatketD__c == 'Clinical') &&
(newOrder.confirm__c == false || (newOrder.confirm__c && String.isNotBlank(newOrder.original_order__c) && !'OrderPass'.equals(newOrder.ApproveStatus__c)))) {
//鏄惧井闀滈檷绾�
- newOrder.Level_Category__c = levelMap.get(newOrder.id);
- }
+ if(OrderDivisionController.OrderDivision == false){
+ newOrder.Level_Category__c = levelMap.get(newOrder.id);
+ }
+ }
//}
}
}
@@ -2395,7 +2367,7 @@
hasBS = true;
}
}
- if (updateOrderAccount) {
+ if (updateOrderAccount && OrderDivisionController.OrderDivision == false) {
// WLIG-C3M68P XHL 20210607 Start
// 鏂板缓涓庡彉鏇村悎鍚屽鎴枫�佹渶缁堢敤鎴锋椂,鍜岃浠峰姣斿鎴枫�佹渶缁堢敤鎴凤紝鑻ヤ笉鐩稿悓鐩存帴鎶ラ敊鎻愰啋
CustomerConsistency(oppidList,oppAccountMap,newList);
@@ -2538,15 +2510,10 @@
(odr.RecordTypeId == System.Label.RT_Contract_BS_Tax ||
odr.RecordTypeId == System.Label.RT_Contract_BS_Tax_Approval ||
odr.RecordTypeId == System.Label.RT_Contract_BS_WithoutTax ||
- odr.RecordTypeId == System.Label.RT_Contract_BS_WithoutTax_Approval ||
- odr.RecordTypeId == System.Label.RT_Contract_BS_Tax_kua ||
- odr.RecordTypeId == System.Label.RT_Contract_BS_Tax_Approval_kua ||
- odr.RecordTypeId == System.Label.RT_Contract_BS_WithoutTax_kua ||
- odr.RecordTypeId == System.Label.RT_Contract_BS_WithoutTax_Approval_kua )) {
+ odr.RecordTypeId == System.Label.RT_Contract_BS_WithoutTax_Approval)) {
odrIds.add(odr.Id);
}
}
- system.debug('111111+' + odrIds.size());
if (odrIds.size() == 0) return;
Map<String, boolean> hiddenFlagMap = new Map<String, boolean>();
@@ -2568,9 +2535,6 @@
system.debug('hiddenFlagMap'+hiddenFlagMap);
for (Order odr : newList) {
Order oldOrd = oldMap == null ? new Order() : oldMap.get(odr.Id);
- system.debug(odr.RecordTypeId + '@@@' + oldOrd.RecordTypeId);
- system.debug(odr.CrossCooperativeProject__c + '!!!!!' + hiddenFlagMap.get(odr.Id));
- //濡傛灉鍚堝悓鐨勮褰曠被鍨嬫槸LS鐩稿叧鐨勮褰曠被鍨嬶紝闇�瑕佹牴鎹殣钘忔爣璁扮‘璁ゆ槸鍚︿慨鏀逛负瀵瑰簲鐨勮褰曠被鍨�
if (odr.RecordTypeId != oldOrd.RecordTypeId &&
(odr.RecordTypeId == System.Label.RT_Contract_BS_Tax ||
odr.RecordTypeId == System.Label.RT_Contract_BS_Tax_Approval ||
@@ -2578,77 +2542,23 @@
odr.RecordTypeId == System.Label.RT_Contract_BS_WithoutTax_Approval)) {
if (hiddenFlagMap.get(odr.Id) == true) {
if (odr.RecordTypeId == System.Label.RT_Contract_BS_Tax) {
- if(odr.CrossCooperativeProject__c == true){
- odr.RecordTypeId = System.Label.RT_Contract_BS_Tax_hidden_kua;
- }else{
- odr.RecordTypeId = System.Label.RT_Contract_BS_Tax_hidden;
- }
+ odr.RecordTypeId = System.Label.RT_Contract_BS_Tax_hidden;
} else if (odr.RecordTypeId == System.Label.RT_Contract_BS_Tax_Approval) {
- if(odr.CrossCooperativeProject__c == true){
- odr.RecordTypeId = System.Label.RT_Contract_BS_Tax_Approval_hidden_kua;
- }else{
- odr.RecordTypeId = System.Label.RT_Contract_BS_Tax_Approval_hidden;
- }
-
+ odr.RecordTypeId = System.Label.RT_Contract_BS_Tax_Approval_hidden;
} else if (odr.RecordTypeId == System.Label.RT_Contract_BS_WithoutTax) {
- if(odr.CrossCooperativeProject__c == true){
- odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax_hidden_kua;
- }else{
- odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax_hidden;
- }
-
+ odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax_hidden;
} else if (odr.RecordTypeId == System.Label.RT_Contract_BS_WithoutTax_Approval) {
- if(odr.CrossCooperativeProject__c == true){
- odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax_hidden_Approval_kua;
- }else{
- odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax_hidden_Approval;
- }
-
+ odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax_hidden_Approval;
}
} else if (hiddenFlagMap.get(odr.Id) == false) {
if (odr.RecordTypeId == System.Label.RT_Contract_BS_Tax_hidden) {
- if(odr.CrossCooperativeProject__c == true){
- odr.RecordTypeId = System.Label.RT_Contract_BS_Tax_kua;
- }else{
- odr.RecordTypeId = System.Label.RT_Contract_BS_Tax;
- }
-
+ odr.RecordTypeId = System.Label.RT_Contract_BS_Tax;
} else if (odr.RecordTypeId == System.Label.RT_Contract_BS_Tax_Approval_hidden) {
- if(odr.CrossCooperativeProject__c == true){
- odr.RecordTypeId = System.Label.RT_Contract_BS_Tax_Approval_kua;
- }else{
- odr.RecordTypeId = System.Label.RT_Contract_BS_Tax_Approval;
- }
-
+ odr.RecordTypeId = System.Label.RT_Contract_BS_Tax_Approval;
} else if (odr.RecordTypeId == System.Label.RT_Contract_BS_WithoutTax_hidden) {
- if(odr.CrossCooperativeProject__c == true){
- odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax_kua;
- }else{
- odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax;
- }
-
+ odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax;
} else if (odr.RecordTypeId == System.Label.RT_Contract_BS_WithoutTax_hidden_Approval) {
- if(odr.CrossCooperativeProject__c == true){
- odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax_Approval_kua;
- }else{
- odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax_hidden;
- }
- } else if (odr.RecordTypeId == System.Label.RT_Contract_BS_Tax) {
- if(odr.CrossCooperativeProject__c == true){
- odr.RecordTypeId = System.Label.RT_Contract_BS_Tax_kua;
- }
- } else if (odr.RecordTypeId == System.Label.RT_Contract_BS_Tax_Approval) {
- if(odr.CrossCooperativeProject__c == true){
- odr.RecordTypeId = System.Label.RT_Contract_BS_Tax_Approval_kua;
- }
- } else if (odr.RecordTypeId == System.Label.RT_Contract_BS_WithoutTax) {
- if(odr.CrossCooperativeProject__c == true){
- odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax_kua;
- }
- } else if (odr.RecordTypeId == System.Label.RT_Contract_BS_WithoutTax_Approval) {
- if(odr.CrossCooperativeProject__c == true){
- odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax_Approval_kua;
- }
+ odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax_hidden;
}
}
}
@@ -2718,6 +2628,13 @@
// 鍚堝悓-鍙樻洿鐢宠-鍘熷悎鍚屾棤鏁堟垨鑰呮墜鍔ㄤ慨鏀瑰鑷村悎鍚屾棤鏁�
if (!approveStatus && status) {
+ if(newOrd.oldOrder__c){
+ RadiationUtil.oldOrder = true;
+ if (updateFlag) {
+ newOrd.oldOrder__c = false;
+ }
+
+ }
RadiationUtil.updateRadiationTypeQuantity(newOrd.Id,orderFounder , newOrd.DealerId__c, true,'鏃犳晥鎴栧彉鏇存棤鏁�',newOrd.LastModifiedById );
}
@@ -2734,6 +2651,12 @@
if (RadiationUtil.EscapeOrderTriggerHandler) {
RadiationUtil.EscapeOrderTriggerHandler = false;
+ if(newOrd.oldOrder__c){
+ RadiationUtil.oldOrder = true;
+ if (updateFlag) {
+ newOrd.oldOrder__c = false;
+ }
+ }
RadiationUtil.updateRadiationTypeQuantity(newOrd.Id,orderFounder , newOrd.DealerId__c, true,'鍚堝悓鍙樻洿鑽夋涓�',newOrd.LastModifiedById );
}
@@ -2747,20 +2670,43 @@
Boolean status = newOrd.Status__c != oldOrd.Status__c && newOrd.Status__c == 'Inactive';
// 鍚堝悓鎻愪氦鐘舵�佸彉鎴愭棤鏁�
if ( status ) {
+ if(newOrd.oldOrder__c){
+ RadiationUtil.oldOrder = true;
+ if (updateFlag) {
+ newOrd.oldOrder__c = false;
+ }
+ }
RadiationUtil.updateRadiationTypeQuantity(newOrd.Id,orderFounder , newOrd.DealerId__c, true,'鍚堝悓鎻愪氦鍙樻棤鏁�',newOrd.LastModifiedById );
}
} else if (newOrd.ApproveStatus__c == 'CancelPass' && newOrd.Status__c == 'Active') {
// 鍚堝悓-鍚堝悓鎵瑰噯鈫掆啋鈫掑悎鍚屽彇娑�
if ( approveStatus && newOrd.BeforeSubmitStatus__c == 'OrderPass') {
-
+ if(newOrd.oldOrder__c){
+ RadiationUtil.oldOrder = true;
+ if (updateFlag) {
+ newOrd.oldOrder__c = false;
+ }
+ }
RadiationUtil.updateRadiationTypeQuantity(newOrd.Id,orderFounder , newOrd.DealerId__c, true,'鍚堝悓鍙栨秷',newOrd.LastModifiedById );
}
} else if (oldOrd.ApproveStatus__c == 'OrderSubmit' && newOrd.ApproveStatus__c == 'OrderReject' && newOrd.Status__c == 'Active') {
// 鍚堝悓鎻愪氦鈫掆啋鈫掑悎鍚岄┏鍥�
+ if(newOrd.oldOrder__c){
+ RadiationUtil.oldOrder = true;
+ if (updateFlag) {
+ newOrd.oldOrder__c = false;
+ }
+ }
RadiationUtil.updateRadiationTypeQuantity(newOrd.Id,orderFounder , newOrd.DealerId__c, true,'鍚堝悓椹冲洖',newOrd.LastModifiedById );
} else if (oldOrd.ApproveStatus__c == 'OrderSubmit' && newOrd.ApproveStatus__c == 'OrderDraft' && newOrd.Status__c == 'Active') {
// 鍚堝悓鎻愪氦鈫掆啋鈫掑悎鍚岃皟鍥�
+ if(newOrd.oldOrder__c){
+ RadiationUtil.oldOrder = true;
+ if (updateFlag) {
+ newOrd.oldOrder__c = false;
+ }
+ }
RadiationUtil.updateRadiationTypeQuantity(newOrd.Id,orderFounder , newOrd.DealerId__c, true,'鍚堝悓璋冨洖',newOrd.LastModifiedById );
}
@@ -2883,7 +2829,11 @@
String errMessage = '瀹㈡埛鍚嶆垨鏈�缁堢敤鎴蜂笌璇环涓嶄竴鑷达紒';
for(Order orOne:newList){
if (oppAccountMap.containsKey(orOne.OpportunityId)) {
- if(oppAccountMap.get(orOne.OpportunityId) != orOne.AccountId || !roleMap.containsKey(orOne.OpportunityId) || orOne.EndUserD__c != roleMap.get(orOne.OpportunityId)){
+ System.debug(oppAccountMap.get(orOne.OpportunityId) != orOne.AccountId);
+ System.debug( !roleMap.containsKey(orOne.OpportunityId));
+ System.debug(orOne.EndUserD__c + '++'+ roleMap.get(orOne.OpportunityId));
+
+ /*if(oppAccountMap.get(orOne.OpportunityId) != orOne.AccountId || !roleMap.containsKey(orOne.OpportunityId) || orOne.EndUserD__c != roleMap.get(orOne.OpportunityId)){
// 鑾峰彇鐢ㄦ埛Id
String userId = UserInfo.getUserId().subString(0,15);
if (String.isNotBlank(getUserId)) {
@@ -2892,23 +2842,22 @@
throw new ControllerUtil.myException('鍚堝悓Id:'+orOne.Id+'_'+errMessage);
} else {
//璁㈠崟ID娌℃湁鍙栧埌
- orOne.addError(errMessage);
+ orOne.addError(errMessage+'1'+orOne.Id);
}
} else {
//鑷畾涔夋爣绛鹃噷闈㈡病鏈夊綋鍓嶇敤鎴风殑ID
- orOne.addError(errMessage);
+ orOne.addError(errMessage + '2');
}
} else {
//鑷畾涔夋爣绛炬病鏈夊唴瀹�
- orOne.addError(errMessage);
+ orOne.addError(errMessage + '3');
}
- }
+ }*/
}
}
-
}
//妫�鏌ュ悎鍚屼笂鐨勭瓑绾х被鍒槸浜岀被锛屼竴绫伙紝闈炵洃绠�(绛夌骇鐢遍珮鍒板簳)锛屽崟鐙竴鏉¤褰曢噷闈㈢殑鎵�鏈変骇鍝侊紝鏀惧埌涓�涓猯ist閲岄潰銆�
@@ -2937,7 +2886,7 @@
}
}
- //寮�濮嬮�昏緫鍒ゆ柇锛岃鍗曚骇鍝佸搴旂殑浜у搧鐨勭瓑绾х被鍒彧瑕佹湁涓�绫伙紝璁㈠崟涓婄殑绛夌骇绫诲埆璧嬪�间竴绫�(涓�绫�>浜岀被>闈炵洃绠★紝渚濇绫绘帹)
+ //寮�濮嬮�昏緫鍒ゆ柇锛岃鍗曚骇鍝佸搴旂殑浜у搧鐨勭瓑绾х被鍒彧瑕佹湁浜岀被锛岃鍗曚笂鐨勭瓑绾х被鍒祴鍊间簩绫�(浜岀被>涓�绫�>闈炵洃绠★紝渚濇绫绘帹)
for (String oe : newList) {
if (orditemMap.containsKey(oe)) {
if (orditemMap.get(oe).contains('浜岀被')) {
@@ -3002,80 +2951,12 @@
return returnMap;
}
*/
-
-
-
- /**
- * 妫�鏌ュ悎鍚屽鎵逛汉鏄惁濉啓瀹屾暣
- * @author Dai Y
- * @date 2022-01-12
- * @param ordList 寰呮鏌ュ悎鍚孡ist
- * @return 濉啓瀹屾暣杩斿洖true锛屼笉瀹屾暣杩斿洖false
- */
- private static Boolean CheckSalesOwner(List<Order> ordList){
- Boolean flag = true;
- for (Order order : ordList) {
- //鍒ゆ柇鍚堝悓瀹℃壒浜烘槸鍚︿负绌猴紝
- if(String.isBlank(order.SalesOwner_BS__c)){
- //order.SalesOwner_BS__c.addError('璇峰~鍐欏鎵逛汉');
- flag = false;
- }
- }
- return flag;
- }
- /**
- * 妫�鏌ヨ法鍖洪攢鍞浉鍏虫暟鎹槸鍚﹀~鍐欏畬鏁�
- * @author Dai Y
- * @date 2022-01-12
- * @param ordList 寰呮鏌ュ悎鍚孡ist
- * @return 濉啓瀹屾暣杩斿洖true锛屼笉瀹屾暣杩斿洖false
- */
-
- private static Boolean CheckCrossComperativeData(List<Order> ordList){
- Boolean flag = true;
- for (Order order : ordList) {
- //鍒ゆ柇鍚堜綔鍖哄煙浠g悊鍟嗭紝涓讳唬鐞嗗晢鍜屽悎浣滃尯鍩熻礋璐d汉
- if(String.isBlank(order.CrossCooperativeDealerText__c) || String.isBlank(order.HeadOfCooperationArea__c) || false){
- flag = false;
- }
- }
- return flag;
- }
- /**
- * 鍒ゆ柇AB浠g悊鍟嗘槸鍚︿慨鏀�
- * @author Dai Y
- * @date 2022-01-20
- * @param newOrd 淇敼鍚庡悎鍚�
- * @param oldOrd 淇敼鍓嶅悎鍚�
- * @return 濡傛灉杩涜淇敼杩斿洖true锛屾病淇繃楗悗false
- */
- public static Boolean CherkCrossComperativeChanged(Order newOrd ,Order oldOrd){
- Boolean flag = false;
- if(newOrd.Dealer_A__c != oldOrd.Dealer_A__c || newOrd.Dealer_B__c != oldOrd.Dealer_B__c ){
- flag = true;
- }
- return flag;
- }
-
- /**
- * 蹇呭~閫夐」妫�鏌�
- * @author Dai Y
- * @date 2022-01-13
- * @param ordList 寰呮鏌ュ悎鍚孡ist
- * @return 妫�鏌ラ�氳繃杩斿洖true锛屼笉閫氳繃杩斿洖false
- */
- private static Boolean Check(List<Order> ordList){
- Boolean flag = true;
-
-
- return flag;
- }
public static void asd() {
Integer i = 1;
i++;
i++;
- i++;
+ i++;
i++;
i++;
i++;
--
Gitblit v1.9.1