From d8dc84a3d56df839895f1c417a4d9cbee763d262 Mon Sep 17 00:00:00 2001
From: 高章伟 <gaozhangwei@prec-tech.com>
Date: 星期五, 03 三月 2023 14:50:59 +0800
Subject: [PATCH] gzw 测试环境代码更新
---
force-app/main/default/classes/LostCancelReportOppBatch.cls | 81 ++++++++++++++++++++++++++--------------
1 files changed, 53 insertions(+), 28 deletions(-)
diff --git a/force-app/main/default/classes/LostCancelReportOppBatch.cls b/force-app/main/default/classes/LostCancelReportOppBatch.cls
index f8a4b65..5ea2249 100644
--- a/force-app/main/default/classes/LostCancelReportOppBatch.cls
+++ b/force-app/main/default/classes/LostCancelReportOppBatch.cls
@@ -31,7 +31,8 @@
// query += ' where Id in :IdList';
// }
// 2022-01-18 淇敼 浠庡け鍗曟姤鍛婂彇鍊�
- String query = 'SELECT Id FROM Lost_cancel_report__c WHERE Report_Status__c = \'鎵瑰噯\' AND LostType__c in (\'澶卞崟\', \'閮ㄥ垎澶卞崟\') ';
+ String query = 'SELECT Id, Opportunity__c FROM Lost_cancel_report__c WHERE Report_Status__c = \'鎵瑰噯\' AND LostType__c in (\'澶卞崟\', \'閮ㄥ垎澶卞崟\') ';
+ //20230215 lt DB202302247719 add , Opportunity__c
if (start_date != null) {
query += ' AND Submit_Day__c >= :start_date';
}
@@ -138,10 +139,13 @@
// 2022-01-18 淇敼 浠庡け鍗曟姤鍛婂彇鍊�
global void execute(Database.BatchableContext BC, List<Lost_cancel_report__c> scope) {
+
+ // List<String> reportIdList=new List<String>();//20230215 lt DB202302247719 娉ㄩ噴
+ Set<String> reportIdList = new Set<String>();//20230215 lt DB202302247719
- List<String> reportIdList=new List<String>();
for (Lost_cancel_report__c report : scope) {
- reportIdList.add(report.Id);
+ // reportIdList.add(report.Id); //20230215 lt DB202302247719 娉ㄩ噴
+ reportIdList.add(report.Opportunity__c); //20230215 lt DB202302247719
}
List<PCLLostProduct__c> pclLpList=[select
@@ -157,12 +161,15 @@
PCLLostBrand__r.AgencyMannual__c, // 涓爣缁忛攢鍟嗭紙鎵嬪姩锛�
PCLLostBrand__r.Lost_cancel_report__r.LostType__c, // 澶卞崟绫诲瀷
PCLLostBrand__r.Lost_cancel_report__r.LostTotalAmount__c, // 澶卞崟鎬婚噾棰�
+ PCLLostBrand__r.Lost_cancel_report__r.TotalAmountLost__c, // 澶卞崟鎬婚噾棰濓紙涓嶅惈绋庯級 //20230215 lt DB202302247719
PCLLostBrand__r.Lost_cancel_report__r.of_lost_system_processor__c, // 澶卞崟涓绘満鍙版暟
PCLLostBrand__r.Lost_cancel_report__r.Opportunity__c
from
PCLLostProduct__c
where
- PCLLostBrand__r.Lost_cancel_report__c in :reportIdList];
+ PCLLostBrand__r.Lost_cancel_report__r.Opportunity__c in :reportIdList];
+ //20230215 lt DB202302247719 PCLLostBrand__r.Lost_cancel_report__c ---update--- PCLLostBrand__r.Lost_cancel_report__r.Opportunity__c
+
// 鍒濆鍖栦繚瀛樺弬鏁�
Map<String, Opportunity> opp_map = new Map<String, Opportunity>();
@@ -185,32 +192,42 @@
opp.of_lost_system_processor__c = 0;
opp_map.put(opp_id, opp);
}
+
+ //20230215 lt DB202302247719 start
+ opp.LostPrices__c += lost.PCLLostBrand__r.Lost_cancel_report__r.TotalAmountLost__c; // 澶卞崟閲戦
+
+ //DB202302247719 娉ㄩ噴 lt 娉ㄩ噴鍘熷洜锛欴B202302247719璇鹃鍒峰け鍗曟姤鍛婃暟鎹彧鍒峰け鍗曢噾棰�
// 璧嬪��
- opp.LostTypeText__c = lost.PCLLostBrand__r.Lost_cancel_report__r.LostType__c; // 澶卞崟绫诲瀷
- opp.LostPrices__c = lost.PCLLostBrand__r.Lost_cancel_report__r.LostTotalAmount__c; // 澶卞崟閲戦
- opp.Lost_reason_main__c = lost.PCLLostBrand__r.Lost_reason_main__c; // 澶卞崟鍘熷洜锛堜富锛�
- opp.Lost_Reason_Sub__c = lost.PCLLostBrand__r.Lost_Reason_Sub__c; // 澶卞崟鐞嗙敱锛堟锛�
- opp.of_lost_system_processor__c += lost.Quantity__c; // 澶卞崟涓绘満鍙版暟锛堢疮鍔狅級
+ // opp.LostTypeText__c = lost.PCLLostBrand__r.Lost_cancel_report__r.LostType__c; // 澶卞崟绫诲瀷
+ // //opp.LostPrices__c = lost.PCLLostBrand__r.Lost_cancel_report__r.LostTotalAmount__c; // 澶卞崟閲戦
+ // opp.Lost_reason_main__c = lost.PCLLostBrand__r.Lost_reason_main__c; // 澶卞崟鍘熷洜锛堜富锛�
+ // opp.Lost_Reason_Sub__c = lost.PCLLostBrand__r.Lost_Reason_Sub__c; // 澶卞崟鐞嗙敱锛堟锛�
+ // opp.of_lost_system_processor__c += lost.Quantity__c; // 澶卞崟涓绘満鍙版暟锛堢疮鍔狅級
+
// 澶卞崟浜у搧123 start
- if (opp.CompetitorProduct1__c == null) {
- opp.CompetitorProduct1__c = lost_product_name(lost.LostProductName__c, lost.LostProductMannual__c);
- }else if (opp.CompetitorProduct2__c == null) {
- opp.CompetitorProduct2__c = lost_product_name(lost.LostProductName__c, lost.LostProductMannual__c);
- }else if (opp.CompetitorProduct3__c == null) {
- opp.CompetitorProduct3__c = lost_product_name(lost.LostProductName__c, lost.LostProductMannual__c);
- }
+ // if (opp.CompetitorProduct1__c == null) {
+ // opp.CompetitorProduct1__c = lost_product_name(lost.LostProductName__c, lost.LostProductMannual__c);
+ // }else if (opp.CompetitorProduct2__c == null) {
+ // opp.CompetitorProduct2__c = lost_product_name(lost.LostProductName__c, lost.LostProductMannual__c);
+ // }else if (opp.CompetitorProduct3__c == null) {
+ // opp.CompetitorProduct3__c = lost_product_name(lost.LostProductName__c, lost.LostProductMannual__c);
+ // }
// 澶卞崟浜у搧123 end
// 澶卞崟鍝佺墝
- opp.PCLLostBrands__c = lost_brand_name(opp.PCLLostBrands__c, lost.PCLLostBrand__r.Lost_By_Company__c, lost.PCLLostBrand__r.Lost_By_Company_Mannual__c);
+ // opp.PCLLostBrands__c = lost_brand_name(opp.PCLLostBrands__c, lost.PCLLostBrand__r.Lost_By_Company__c, lost.PCLLostBrand__r.Lost_By_Company_Mannual__c);
// 涓爣缁忛攢鍟�
- opp.Agencies__c = lost_agency_name(opp.Agencies__c, lost.PCLLostBrand__r.Agency__r.Name, lost.PCLLostBrand__r.AgencyMannual__c);
+ // opp.Agencies__c = lost_agency_name(opp.Agencies__c, lost.PCLLostBrand__r.Agency__r.Name, lost.PCLLostBrand__r.AgencyMannual__c);
+ //DB202302247719 娉ㄩ噴 lt
+ //20230215 lt DB202302247719 end
}
System.debug(opp_map);
+ StaticParameter.EscapeOppandStaTrigger = true; //20230215 lt DB202302247719
update opp_map.values();
+ StaticParameter.EscapeOppandStaTrigger = true; //20230215 lt DB202302247719
}
// 澶卞崟瀵规墜鍨嬪彿
@@ -226,11 +243,15 @@
// 鍒濆鍖栧弬鏁�
String plus = '';
// 鍒ゆ柇
- if ('鍏朵粬'.equals(lost_brand) && String.isNotBlank(lost_brand_mannual)) {
- plus = lost_brand_mannual;
- } else {
- plus = lost_brand;
- }
+ // SWAG-CCC6F6 2022-04-22 ssm start
+ // 璇环涓婇兘鍙樉绀洪�夐」鍒楄〃鐨勫�硷紝涓嶉渶瑕佹墜鍔ㄧ殑鍊�
+ // if ('鍏朵粬'.equals(lost_brand) && String.isNotBlank(lost_brand_mannual)) {
+ // plus = lost_brand_mannual;
+ // } else {
+ // plus = lost_brand;
+ // }
+ plus = lost_brand;
+ // SWAG-CCC6F6 2022-04-22 ssm end
// 鍒濆鍖栬繑鍥炲��
if (String.isBlank(lost_brand_in_opp)) {
lost_brand_in_opp = '';
@@ -251,11 +272,15 @@
// 鍒濆鍖栧弬鏁�
String plus = '';
// 鍒ゆ柇
- if ('瀵规墜缁忛攢鍟�'.equals(lost_agency) && String.isNotBlank(lost_agency_mannual)) {
- plus = lost_agency_mannual;
- } else {
- plus = lost_agency;
- }
+ // SWAG-CCC6F6 2022-04-22 ssm start
+ // 璇环涓婇兘鍙樉绀洪�夐」鍒楄〃鐨勫�硷紝涓嶉渶瑕佹墜鍔ㄧ殑鍊�
+ // if ('瀵规墜缁忛攢鍟�'.equals(lost_agency) && String.isNotBlank(lost_agency_mannual)) {
+ // plus = lost_agency_mannual;
+ // } else {
+ // plus = lost_agency;
+ // }
+ plus = lost_agency;
+ // SWAG-CCC6F6 2022-04-22 ssm end
// 鍒濆鍖栬繑鍥炲��
if (String.isBlank(lost_agency_in_opp)) {
lost_agency_in_opp = '';
--
Gitblit v1.9.1