From 8badb57ea2c82557850ad5b39281c3e8714eb119 Mon Sep 17 00:00:00 2001
From: liuyan <liuyan@prec-tech.com>
Date: 星期四, 24 十一月 2022 10:08:31 +0800
Subject: [PATCH] 科室信息漏传SPO问题
---
force-app/main/default/classes/NewQuoteEntryController.cls | 504 ++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 402 insertions(+), 102 deletions(-)
diff --git a/force-app/main/default/classes/NewQuoteEntryController.cls b/force-app/main/default/classes/NewQuoteEntryController.cls
index 2547ecc..0d9face 100644
--- a/force-app/main/default/classes/NewQuoteEntryController.cls
+++ b/force-app/main/default/classes/NewQuoteEntryController.cls
@@ -11,8 +11,12 @@
//public Id qlistId { get; set; }
//lastbuy 2022/2/9 fy start
public Boolean filg { get; set; }
+ public Integer flglastbuy { get; set; }
+ public String errorProductmodel { get; set; }
//lastbuy 2022/2/9 fy end
-
+ //SWAG-CC6AFQ銆愬鎵樸�戝張鏈夎浠疯烦杩囦簡鎶ヤ环璁$畻 fy start
+ public Boolean SkipQuotefilg { get; set; }
+ //SWAG-CC6AFQ銆愬鎵樸�戝張鏈夎浠疯烦杩囦簡鎶ヤ环璁$畻 fy end
public String excel_text { get; set; }
public Integer select_index { get; set; } // excelImport灏傜敤銇с仚銇屻�乯s銇仸鍒跺尽銇欍倠銇撱仺銇仾銈嬨伄銇с�乀ODO katsu 鍓婇櫎浜堝畾
public String Product_text { get; set; }
@@ -125,7 +129,9 @@
}
public PageReference init() {
-
+ //SWAG-CC6AFQ銆愬鎵樸�戝張鏈夎浠疯烦杩囦簡鎶ヤ环璁$畻 fy start
+ SkipQuotefilg = false;
+ //SWAG-CC6AFQ銆愬鎵樸�戝張鏈夎浠疯烦杩囦簡鎶ヤ环璁$畻 fy end
system.debug('============start init==============');
boolean quoteflg = true;
WinOrDecideAlert = false;
@@ -214,6 +220,12 @@
//銆愭槸鍚﹂渶瑕佷环鏍肩敵璇枫�� thh start
If_Need_PriceApply__c
//銆愭槸鍚﹂渶瑕佷环鏍肩敵璇枫�� thh end
+ // Celon璇环淇敼 2022-04-24 ssm start
+ ,CelonOpportunity__c
+ // Celon璇环淇敼 2022-04-24 ssm end
+ // lastbuy鍒ゆ柇鍙樻洿鐢ㄦ埛璇环 start
+ , If_Account_Change__c
+ // lastbuy鍒ゆ柇鍙樻洿鐢ㄦ埛璇环 end
FROM Opportunity Where Id = :oppId];
// 澶氬勾淇濅慨 start
trade = '澶栬部';
@@ -356,8 +368,8 @@
}
} else {
//娣诲姞琛�
- List<Quote> quoList =
- [ SELECT Id, Name, Cancel_Decide__c, CreatedDate, PriceRefreshDate__c, Quote_Print_Date__c,
+ List<Quote> quoList =//SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start QuotationChange__c,MainEngineWithoutMonitor__c,Interdepartmental__c,
+ [ SELECT Id, Name, Cancel_Decide__c, CreatedDate, PriceRefreshDate__c, Quote_Print_Date__c,QuotationChange__c,MainEngineWithoutMonitor__c,Interdepartmental__c,
Dealer_Final_Price__c, TotalPrice__c, Estimation_List_Price__c, QuoteNumber,
QuoteToName, Quote_Expiration_Date__c, Quote_Comment__c, Stocking_Price__c, Unit_Price__c,
Offer_Amount__c, TOTAL__c, Discount__c, Pricing__c, Preferential_Trading_Price__c, Contract__c,
@@ -406,6 +418,8 @@
,PricebookEntry.Product2.Intra_Trade_Foreign_RMB__c
//NoDiscount 閲戦锛圲SD锛�
,PricebookEntry.Product2.NoDiscount_Foreign__c
+ //fy 棰勭暀浜у搧鏍囪瘑
+ ,PricebookEntry.Product2.LastbuyProductFLG__c
,Quote.Opportunity.Trade__c
//澶栬锤澶氬勾淇� 2021/01/04 绮剧悽鎶�鏈� wql end
@@ -421,7 +435,11 @@
if (copyQuoId == null) {
} else {
// copy銇牬鍚堛�乹uoId銈抧ull銇埢銇�
+ system.debug('id绌�6锛�');
quoId = null;
+ //SWAG-CC6AFQ銆愬鎵樸�戝張鏈夎浠疯烦杩囦簡鎶ヤ环璁$畻 fy start
+ SkipQuotefilg = true;
+ //SWAG-CC6AFQ銆愬鎵樸�戝張鏈夎浠疯烦杩囦簡鎶ヤ环璁$畻 fy end
}
if (quoList.size() > 0) {
//娣诲姞琛�
@@ -430,6 +448,7 @@
}
if (copyQuoId == null) {
quo = quoList[0];
+
quo.QuoteName__c = quo.Name;
// 澶氬勾淇濅慨 start
quoteGurantee_Period = quo.Gurantee_Period__c;
@@ -801,10 +820,13 @@
// CHAN-AVG3PW 璇环鎶ヤ环鐢婚潰瑙勫垯鍙樻洿
Datetime cDate = quo.CreatedDate;
over3month = cDate != null && cDate.date().addMonths(3) < Date.today();
-
+//SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start
+quo.Offer_Amount__c = true;
+quo.TOTAL__c = true;
+quo.Preferential_Gurantee_Period__c = true;
+//SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy end
return null;
}
-
//Search Events============================================================
// TODO ManualEntry銇ㄥ悓妲樸�乯s銇仸瑙f焙銇с亶銈嬨�併亾銇撱仹webservice銇犮亼銈掑疅瑁呫�佷粖寰� by katsu
@@ -902,6 +924,8 @@
//澶栬锤澶氬勾淇� 2021/01/04 绮剧悽鎶�鏈� wql start
//缁翠慨鍚堝悓鎶ヤ环锛圲SD锛�
,Repair_Contract_USD__c
+ //fy 棰勭暀浜у搧鏍囪瘑
+ ,LastbuyProductFLG__c
//璁℃彁閲戦锛堜笉鍚◣锛孶SD锛�
,Intra_Trade_Foreign_RMB__c
//NoDiscount 閲戦锛圲SD锛�
@@ -1240,6 +1264,8 @@
for (QELine t : tmpactivities) {
if (i == j) {
Map<String, Product2> mpProduct2 = new Map<String, Product2>(); // key銇孭roductCode銇с仚銆�
+ // Celon璇环淇敼 20220513 ssm start
+ String celon_type = String.isNotBlank(oppInfo.CelonOpportunity) ? oppInfo.CelonOpportunity : null;
List<Product2> items = [select Id, Name, ProductCode,
Foreign_Trade_Cost_US__c, Foreign_Trade_List_US__c, Intra_Trade_Cost_RMB__c, Intra_Trade_List_RMB__c,
//CHAN-BKU3XH 妫�鏌ユ槸鍚﹀瓨鍦ㄤ笉鏄悓涓�涓緵閿�鍟嗗悕绉� 绮剧悽鎶�鏈� 2020/02/17 Start 澧炲姞瀛楁
@@ -1272,6 +1298,9 @@
//SFDC鍋滄棰勮 lt 20211009 end
FROM Product2 Where ProductCode In :codelist
+ // Celon璇环
+ And Celon_Product__c = :celon_type
+ // Celon璇环
And Manual_Entry__c = false];
for (Product2 prd : items) {
system.debug('prd.ProductCode:::::' + prd.ProductCode);
@@ -1528,6 +1557,22 @@
errorMessagechack = null;
Savepoint sp = Database.setSavepoint();
try {
+ // 2022-04-19 钀ヤ笟閮ㄩ棬闇�姹� 娌℃湁琛岄」鐩笉鑳戒繚瀛� ssm start
+ if (activities != null && activities.size() > 0) {
+ QELine line1 = activities[0];
+ // System.debug('Save() line1: ' + line1);
+ // System.debug('line1 != null: ' + (line1 != null));
+ // System.debug('line1.pageObject.PricebookEntryId != null: ' + (line1.pageObject.PricebookEntryId != null));
+ // System.debug('isNotBlank(line1.pageObject.PricebookEntryId): ' + (String.isNotBlank(line1.pageObject.PricebookEntryId)));
+ // System.debug('Save() line1 flag: ' + (!(line1 != null && String.isNotBlank(line1.pageObject.PricebookEntryId))));
+ if (!(line1 != null && String.isNotBlank(line1.pageObject.PricebookEntryId))) {
+ errorflg = true;
+ errorMessage = '涓嶅厑璁镐繚瀛樼┖鐨勬姤浠峰崟锛岃閫夋嫨浜у搧';
+ return null;
+ }
+ }
+ // 2022-04-19 ssm end
+
// CHAN-AVG3PW 璇环鎶ヤ环鐢婚潰瑙勫垯鍙樻洿
// 鎶ヤ环鍒涘缓鏃ヨ秴杩囦笁涓湀鏃讹紝鐐逛繚瀛樻椂寮哄埗鏇存柊
// CHAN-AZG864 涓嶇鍦ㄤ笉鍦ㄦ姤浠锋湁鏁堟湡鍐咃紝CFDA涓嶅彲閿�鍞殑鏃跺�欙紝閮芥槸鎶ラ敊鐨勶紝鍏朵腑涓嶅彲閿�鍞骇鍝佹樉绀虹孩瀛楋紝涓嶅簲璇ヤ繚瀛樸��
@@ -1541,7 +1586,6 @@
errormessage = '璇锋洿鏂颁笉鍙攢鍞殑浜у搧銆�';
return null;
}
-
System.debug('checkSFDAStatus1 finished at: ' + System.currentTimeMillis());
//銉囥兗銈裤儊銈с儍銈�
@@ -1723,6 +1767,22 @@
// 鎶ヤ环鍒涘缓鏃ヨ秴杩囦笁涓湀鏃讹紝鐐逛繚瀛樻椂寮哄埗鏇存柊
// CHAN-AZG864 涓嶇鍦ㄤ笉鍦ㄦ姤浠锋湁鏁堟湡鍐咃紝CFDA涓嶅彲閿�鍞殑鏃跺�欙紝閮芥槸鎶ラ敊鐨勶紝鍏朵腑涓嶅彲閿�鍞骇鍝佹樉绀虹孩瀛楋紝涓嶅簲璇ヤ繚瀛樸��
+ // 2022-04-19 XYOU-CDLCMM 娌℃湁琛岄」鐩笉鑳戒繚瀛� ssm start
+ if (activities != null && activities.size() > 0) {
+ QELine line1 = activities[0];
+ // System.debug('Save() line1: ' + line1);
+ // System.debug('line1 != null: ' + (line1 != null));
+ // System.debug('line1.pageObject.PricebookEntryId != null: ' + (line1.pageObject.PricebookEntryId != null));
+ // System.debug('isNotBlank(line1.pageObject.PricebookEntryId): ' + (String.isNotBlank(line1.pageObject.PricebookEntryId)));
+ // System.debug('Save() line1 flag: ' + (!(line1 != null && String.isNotBlank(line1.pageObject.PricebookEntryId))));
+ if (!(line1 != null && String.isNotBlank(line1.pageObject.PricebookEntryId))) {
+ errorflg = true;
+ errorMessage = '涓嶅厑璁镐繚瀛樼┖鐨勬姤浠峰崟锛岃閫夋嫨浜у搧';
+ return null;
+ }
+ }
+ // 2022-04-19 ssm end
+
if (WinOrDecideAlert && (!productStatusUpdated)) {
errorflg = true;
errorMessage = '浜у搧鐘舵�佸彂鐢熷彉鍖栵紝璇锋洿鏂�';
@@ -1780,10 +1840,23 @@
errorflg = false;
errormessage = null;
//20220214 fy lastbuy start
- if(!ReservedProductVerification()){
- errorflg = true;
- errormessage = '浜у搧鏁伴噺涓嶅彲瓒呰繃浜у搧棰勭暀鏁伴噺' ;
- return null;
+ if (!oppInfo.is_changed_opp) {
+ if(!ReservedProductVerification()){
+ system.debug('flglastbuy++++'+flglastbuy);
+ if(flglastbuy==1){
+ errorflg = true;
+ errormessage = '棰勭暀浜у搧琛ㄤ腑娌℃湁璇ヨ浠凤紝璇烽�氳繃鏈儴绐楀彛鑱旂郴钀ヤ笟绠$悊璇�' ;
+ return null;
+ }else if(flglastbuy==2){
+ errorflg = true;
+ errormessage = errorProductmodel+'浜у搧鏁伴噺涓嶅彲瓒呰繃浜у搧棰勭暀鏁伴噺' ;
+ return null;
+ }else if(flglastbuy==3){
+ errorflg = true;
+ errormessage = '棰勭暀浜у搧'+errorProductmodel+'鏈綍鍏ラ鐣欎骇鍝佽〃';
+ return null;
+ }
+ }
}
//20220214 fy lastbuy end
// 2022-01-12 ssm 鎶ヤ环璁$畻check
@@ -1810,60 +1883,77 @@
if (dataCheck() == false) {
return null;
}
-
+ // 2022-04-06 SWAG-CC6AFQ銆愬鎵樸�戝張鏈夎浠疯烦杩囦簡鎶ヤ环璁$畻 ssm start
+ // 鍒ゆ柇鏉′欢淇敼
+ // 1.濡傛灉淇濆瓨鏂规硶杩斿洖false锛宺eturn
+ // 2.濡傛灉淇濆瓨閫氳繃浣嗗垱寤轰簡鏂版姤浠凤紝return
+ // 3.缁х画鍋歞ecide
if (dataEntry() == false) {
return null;
- } else {
- //寮曞悎銇绌嶆焙瀹氥倰銈兂
- if (oppId == null) {
- system.debug('Error is Opportunityid null!!!');
- } else {
- List<Opportunity> opps = [Select Id, Estimation_Decision__c From Opportunity Where Id = : oppId];
- if (opps.size() > 0) {
- opps[0].Estimation_Decision__c = true;
- /*鈫撯啌鈫撹绌嶅悓鏈熲啌鈫撯啌2012/11/28 鏈娇鐢�
- opps[0].SyncedQuoteId = quoId;
- 鈫戔啈鈫戙��銆�銆�銆�鈫戔啈鈫�*/
- ControllerUtil.updOpp(opps[0]);
- }
-
- errorflg = true;
- errorMessage = System.Label.Message_002;
-
- // cic 134906 start
- Quote q = [select Id from Quote where Id = :quoId];
- q.Quote_Decision_Date__c = date.Today();
- update q;
- // cic 134906 end
-
- QuoteDecision = true;
- enableContract = true;
- //--Savebutton
- Save_button = true;
- //--Decisionbutton鍒ゅ畾
- if (verified == true) {
- Decision_button = false;
- } else if (QuoteCorrect == false) {
- Decision_button = true;
- } else if (QuoteDecision == true) {
- Decision_button = true;
- } else {
- Decision_button = false;
- }
- //--SAPButton
- if (QuoteDecision == false) {
- sap_button = true;
- } else if (specialAuthority == false) {
- sap_button = true;
- } else {
- sap_button = false;
- }
- //--姹哄畾銉溿偪銉充娇銇堛仾銇勩倛銇嗐伀銇欍倠
- Decision_button = true;
-
- pageArrange();
- }
}
+ //SWAG-CC6AFQ銆愬鎵樸�戝張鏈夎浠疯烦杩囦簡鎶ヤ环璁$畻 fy start
+ if(SkipQuotefilg){
+ errorflg = true;
+ errormessage = '浜у搧閰嶇疆鎴栬�呯粡閿�鍟嗕俊鎭彂鐢熷彉鍖栵紝宸茬粡鐢熸垚鏂扮殑鎶ヤ环鍗曪紝璇烽噸鏂版搷浣滄姤浠疯绠�';
+ quo.IsQuoteTrial__c = false;
+ return null;
+ }
+ //SWAG-CC6AFQ銆愬鎵樸�戝張鏈夎浠疯烦杩囦簡鎶ヤ环璁$畻 fy end
+ //寮曞悎銇绌嶆焙瀹氥倰銈兂
+ if (oppId == null) {
+ system.debug('Error is Opportunityid null!!!');
+ } else {
+ List<Opportunity> opps = [Select Id, Estimation_Decision__c From Opportunity Where Id = : oppId];
+ if (opps.size() > 0) {
+ opps[0].Estimation_Decision__c = true;
+ /*鈫撯啌鈫撹绌嶅悓鏈熲啌鈫撯啌2012/11/28 鏈娇鐢�
+ opps[0].SyncedQuoteId = quoId;
+ 鈫戔啈鈫戙��銆�銆�銆�鈫戔啈鈫�*/
+ // SWAG-CER5R4 浼樺寲淇濆瓨閫熷害 start
+ // ControllerUtil.updOpp(opps[0]);
+ StaticParameter.EscapeOppandStaTrigger = true;
+ update opps[0];
+ StaticParameter.EscapeOppandStaTrigger = false;
+ // SWAG-CER5R4 浼樺寲淇濆瓨閫熷害 end
+ }
+
+ errorflg = true;
+ errorMessage = System.Label.Message_002;
+
+ // cic 134906 start
+ Quote q = [select Id from Quote where Id = :quoId];
+ q.Quote_Decision_Date__c = date.Today();
+ update q;
+ // cic 134906 end
+
+ QuoteDecision = true;
+ enableContract = true;
+ //--Savebutton
+ Save_button = true;
+ //--Decisionbutton鍒ゅ畾
+ if (verified == true) {
+ Decision_button = false;
+ } else if (QuoteCorrect == false) {
+ Decision_button = true;
+ } else if (QuoteDecision == true) {
+ Decision_button = true;
+ } else {
+ Decision_button = false;
+ }
+ //--SAPButton
+ if (QuoteDecision == false) {
+ sap_button = true;
+ } else if (specialAuthority == false) {
+ sap_button = true;
+ } else {
+ sap_button = false;
+ }
+ //--姹哄畾銉溿偪銉充娇銇堛仾銇勩倛銇嗐伀銇欍倠
+ Decision_button = true;
+
+ pageArrange();
+ }
+ // 2022-04-06 SWAG-CC6AFQ銆愬鎵樸�戝張鏈夎浠疯烦杩囦簡鎶ヤ环璁$畻 ssm end
} catch (DmlException de) {
Database.rollback(sp);
errorflg = true;
@@ -1959,7 +2049,12 @@
if (quos[0].Quote_Date__c == null) {
quos[0].Quote_Date__c = date.Today();
opps[0].Estimation_Proposal_Date__c = date.Today();
- ControllerUtil.updOpp(opps[0]);
+ // SWAG-CER5R4 浼樺寲淇濆瓨閫熷害 start
+ // ControllerUtil.updOpp(opps[0]);
+ StaticParameter.EscapeOppandStaTrigger = true;
+ update opps[0];
+ StaticParameter.EscapeOppandStaTrigger = false;
+ // SWAG-CER5R4 浼樺寲淇濆瓨閫熷害 end
}
quos[0].Quote_Print_Date__c = date.Today();
ControllerUtil.updQuote(quos[0]);
@@ -2084,7 +2179,9 @@
// 銇撱亾銈掍慨姝c仐銇熴倝銆丯FM007.trigger銈傝纰鸿獚
prd2LatestValMap = new Map<Id, Product2>();
integer cntPrd2 = 0;
- for (Product2 prd2 : [Select Id, Estimation_Entry_Possibility__c, SFDA_Status__c, Packing_list_manual__c
+ for (Product2 prd2 : [Select Id, Estimation_Entry_Possibility__c, SFDA_Status__c, Packing_list_manual__c,
+ //fy 棰勭暀浜у搧鏍囪瘑
+ LastbuyProductFLG__c
From Product2 Where Id IN :product2Ids]) {
cntPrd2 = cntPrd2 + 1;
if (prd2.Estimation_Entry_Possibility__c != '鈼�') {
@@ -2106,7 +2203,11 @@
}
}
-
+ //SWAG-CER5R4 銆愬鎵樸�戞姤浠峰悎鍚岄噾棰濆鍔犻檺鍒� fy start
+ if(ContractAmountLimitJudge()){
+ return false;
+ }
+ //SWAG-CER5R4 銆愬鎵樸�戞姤浠峰悎鍚岄噾棰濆鍔犻檺鍒� fy end
if (error == true && WinOrDecideAlert == false) {
PageArrange();
errorflg = true;
@@ -2174,7 +2275,13 @@
Boolean error = false;
errorflg = false;
errormessage = null;
-
+ //obsap 鏈�缁堢敤鎴峰悎鍚岄噾棰濋獙璇� fy start
+ if (quo.Dealer_Final_Price_Page__c == null) {
+ quo.Dealer_Final_Price__c.addError(System.Label.Error_Message3);
+ error = true;
+ errormessage = System.Label.Error_Message3;
+ }
+ //obsap 鏈�缁堢敤鎴峰悎鍚岄噾棰濋獙璇� fy end
if (checkAgentsDeleteFlag() == false) {
return false;
}
@@ -2537,7 +2644,55 @@
return false;
}
//SWAG-C9JCS8 銆愬鎵樸�戙�愮揣鎬ャ�戣浠稧Z-SP-GD0757135鎶ヤ环鍗曢棶棰� fy end
-
+ //SWAG-CER5R4 銆愬鎵樸�戞姤浠峰悎鍚岄噾棰濆鍔犻檺鍒� fy start
+ private boolean ContractAmountLimitJudge(){
+ system.debug('oppInfo.Sales_Root+++='+oppInfo.Sales_Root);
+ if(oppInfo.Sales_Root =='OCM鐩存帴閿�鍞�'){
+ return false;
+ }
+ Boolean error = false;
+ // List<QuoteLineItem> act = new List<QuoteLineItem>();
+ // List<QuoteLineItem> act2 = new List<QuoteLineItem>();
+ Double AccrualTotal=0;
+ Double sumContractAmount =0;
+ for(QELine aaa :activities){
+ // 2022-06-14 绱ф�ヤ慨澶� ssm
+ if (String.isBlank(aaa.Asset_Model)) {
+ continue;
+ }
+ if(aaa.pageObject.PricebookEntry.Product2Id!=null){
+ if(aaa.GuranteePrice==null){
+ aaa.GuranteePrice=0;
+ }
+ AccrualTotal += aaa.pageObject.Quantity__c*aaa.GuranteePrice;
+ // act.add(aaa.pageObject);
+ }
+ }
+ // act2=act.deepClone();
+ // Double AccrualTotal=0;
+ // Double sumContractAmount =0;
+ // for(QuoteLineItem pspsc :act2){
+ // AccrualTotal += pspsc.Quantity__c*pspsc.GuranteePrice__c;
+ // }
+ if(quo.MultiYearWarrantyTotalPrice__c==null){
+ quo.MultiYearWarrantyTotalPrice__c=0;
+ }
+ sumContractAmount = AccrualTotal+quo.MultiYearWarrantyTotalPrice__c;
+ if(quo.OCM_Agent1_Price_Page__c<=sumContractAmount){
+ error = true;
+ errorflg = true;
+ errormessage = '棰勬祴閲戦涓鸿礋鏁帮紝璇锋纭~鍐欏悎鍚岄噾棰濄��';
+ }
+ if(quo.multiYearWarranty__c){
+ if(quo.OCM_Agent1_Price_Page__c<=0){
+ error = true;
+ errorflg = true;
+ errormessage = '棰勬祴閲戦涓鸿礋鏁帮紝璇锋纭~鍐欏悎鍚岄噾棰濄��';
+ }
+ }
+ return error;
+ }
+ //SWAG-CER5R4 銆愬鎵樸�戞姤浠峰悎鍚岄噾棰濆鍔犻檺鍒� fy end
public boolean dataEntry() {
system.debug('activities++++----****3'+activities);
//SWAG-C9JCS8 銆愬鎵樸�戙�愮揣鎬ャ�戣浠稧Z-SP-GD0757135鎶ヤ环鍗曢棶棰� fy start
@@ -2563,11 +2718,11 @@
error = true;
errormessage = System.Label.Error_Message3;
}
- if (quo.Dealer_Final_Price_Page__c == null) {
- quo.Dealer_Final_Price__c.addError(System.Label.Error_Message3);
- error = true;
- errormessage = System.Label.Error_Message3;
- }
+ // if (quo.Dealer_Final_Price_Page__c == null) {
+ // quo.Dealer_Final_Price__c.addError(System.Label.Error_Message3);
+ // error = true;
+ // errormessage = System.Label.Error_Message3;
+ // }
if (qb.Quote_Adjust_Calculate == null) {
quo.Quote_Adjust_Calculate__c.addError(System.Label.Error_Message3);
error = true;
@@ -2650,10 +2805,10 @@
}
- if (DisCalculation >= 1000 || DisCalculation <= -1000) {
- error = true;
- errormessage = System.Label.Error_Message38;
- }
+ // if (DisCalculation >= 1000 || DisCalculation <= -1000) {
+ // error = true;
+ // errormessage = System.Label.Error_Message38;
+ // }
if (qb.SalesCalculation1 >= 1000 || qb.SalesCalculation1 <= -1000) {
error = true;
errormessage = System.Label.Error_Message38;
@@ -2696,22 +2851,43 @@
oppNo = oppNo.substring(oppNo.length() - 2);
Quote q = New Quote();
+ System.debug('quoId: ' + quoId);
+ System.debug('changedAfterPrint: ' + changedAfterPrint);
if (changedAfterPrint) {
system.debug('id绌�1锛�');
quoId = null;
+ //SWAG-CC6AFQ銆愬鎵樸�戝張鏈夎浠疯烦杩囦簡鎶ヤ环璁$畻 fy start
+ SkipQuotefilg = true;
+ //SWAG-CC6AFQ銆愬鎵樸�戝張鏈夎浠疯烦杩囦簡鎶ヤ环璁$畻 fy end
}
// false浼濈エ銇嬨倝鏂拌浣滄垚
+ System.debug('changedAfterBid: ' + changedAfterBid);
if (changedAfterBid) {
system.debug('id绌�2锛�');
quoId = null;
+ //SWAG-CC6AFQ銆愬鎵樸�戝張鏈夎浠疯烦杩囦簡鎶ヤ环璁$畻 fy start
+ SkipQuotefilg = true;
+ //SWAG-CC6AFQ銆愬鎵樸�戝張鏈夎浠疯烦杩囦簡鎶ヤ环璁$畻 fy end
}
// CHAN-AVG3PW 璇环鎶ヤ环鐢婚潰瑙勫垯鍙樻洿
+ System.debug('newQuoteFlag: ' + newQuoteFlag);
if (newQuoteFlag) {
system.debug('id绌�3锛�');
quoId = null;
+ //SWAG-CC6AFQ銆愬鎵樸�戝張鏈夎浠疯烦杩囦簡鎶ヤ环璁$畻 fy start
+ SkipQuotefilg = true;
+ //SWAG-CC6AFQ銆愬鎵樸�戝張鏈夎浠疯烦杩囦簡鎶ヤ环璁$畻 fy end
}
// 澶氬勾淇濅慨 start
//鎶ヤ环璇曠畻 澧炲姞缁忛攢鍟嗗墠鍚庡姣� 绮剧悽鎶�鏈� wql 20210508 start
+ System.debug('quoteGurantee_Period: ' + quoteGurantee_Period);
+ System.debug('quo.Gurantee_Period__c: ' + quo.Gurantee_Period__c);
+ System.debug('quotemultiYearWarranty: ' + quotemultiYearWarranty);
+ System.debug('quo.multiYearWarranty__c: ' + quo.multiYearWarranty__c);
+ System.debug('agency1Name: ' + agency1Name);
+ System.debug('quo.Agency1__c: ' + quo.Agency1__c);
+ System.debug('agency2Name: ' + agency2Name);
+ System.debug('quo.Agency2__c: ' + quo.Agency2__c);
if ((quoteGurantee_Period != null &&
!quoteGurantee_Period.equals(quo.Gurantee_Period__c))
||
@@ -2722,7 +2898,11 @@
||
(agency2Name !=null &&!agency2Name.equals(quo.Agency2__c))
) {
+ system.debug('id绌�8锛�');
quoId = null;
+ //SWAG-CC6AFQ銆愬鎵樸�戝張鏈夎浠疯烦杩囦簡鎶ヤ环璁$畻 fy start
+ SkipQuotefilg = true;
+ //SWAG-CC6AFQ銆愬鎵樸�戝張鏈夎浠疯烦杩囦簡鎶ヤ环璁$畻 fy end
}
agency1Name = quo.Agency1__c;
agency2Name = quo.Agency2__c;
@@ -2745,8 +2925,8 @@
}
} else {
- List<Quote> qs = New List<Quote>();
- qs = [select Id, OpportunityId, CreatedDate, Pricebook2Id, Name, Estimation_List_Price__c, Dealer_Final_Price__c,
+ List<Quote> qs = New List<Quote>();//SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start QuotationChange__c,MainEngineWithoutMonitor__c,Interdepartmental__c,
+ qs = [select Id, OpportunityId, CreatedDate, Pricebook2Id, Name, Estimation_List_Price__c, Dealer_Final_Price__c,QuotationChange__c,MainEngineWithoutMonitor__c,Interdepartmental__c,
Stocking_Price__c, Discount_Amount__c, Discount_Amount_Calculate__c, Quote_Adjust_Amount__c, Quote_Adjust_Calculate__c,
Agency1__c, OCM_Agent1_Price__c, Agency1_Profit__c, Agency1_Profit_Rate__c, Quote_No__c,
Agency2__c, Agent1_Agent2_Price__c, Agency2_Profit__c, Agency2_Profit_Rate__c,
@@ -2832,18 +3012,29 @@
q.Quote_Comment__c = quo.Quote_Comment__c;
q.Installation_location__c = quo.Installation_location__c;
+
+ //SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start
+ q.QuotationChange__c = quo.QuotationChange__c;
+ q.MainEngineWithoutMonitor__c = quo.MainEngineWithoutMonitor__c;
+ q.Interdepartmental__c = quo.Interdepartmental__c;
+ //SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy end
/*
if (hasType3Machine) {
q.Installation_location__c = '';
}
*/
- System.debug('start save quote at: ' + System.currentTimeMillis());
+ System.debug('q.QuotationChange__c+++'+q.QuotationChange__c);
+ System.debug('quo.QuotationChange__c++' + quo.QuotationChange__c);
+ System.debug('quo.MainEngineWithoutMonitor__c++' + quo.MainEngineWithoutMonitor__c);
if (quoId == null) {
insert q;
quo.Quote_No__c = q.Quote_No__c;
} else {
update q;
}
+ System.debug('q.QuotationChange__c2+++'+q.QuotationChange__c);
+ System.debug('quo.QuotationChange__c2++' + quo.QuotationChange__c);
+ System.debug('quo.MainEngineWithoutMonitor__c2++' + quo.MainEngineWithoutMonitor__c);
System.debug('finished save quote at: ' + System.currentTimeMillis());
system.debug('鈼嬧棆鈼嬧棆鈼婼ave1鈼嬧棆鈼嬧棆鈼�');
@@ -2927,6 +3118,9 @@
os = [select Id, Estimation_List_Price__c, Dealer_Final_Price__c, Estimation_List_Price_Without_Tax__c,
Agency1__c, OCM_Agent1_Price__c, Agency1_Profit__c, Agency1_Profit_Rate__c, Stocking_Price__c,
Agency2__c, Agent1_Agent2_Price__c, Agency2_Profit__c, Agency2_Profit_Rate__c, Quote_Update_Sum__c , Hospital__c,Is_Corrosion__c
+ // lt 20221008 SWAG-CHL5XA銆怓Y23璇环鏀瑰杽銆�-缁熻涓绘満鍙版暟 start
+ ,StageName ,OlyNumberHosts__c
+ // lt 20221008 SWAG-CHL5XA銆怓Y23璇环鏀瑰杽銆�-缁熻涓绘満鍙版暟 end
From Opportunity Where Id = :oppid];
if (os.size() > 0) {
o = os[0];
@@ -2946,7 +3140,7 @@
o.Stocking_Price__c = quo.Stocking_Price__c;
- o.Estimation_No__c = quo.Quote_No__c;
+ o.Estimation_No__c = q.Quote_No__c; // quo.Quote_No__c;
//o.Estimation_Name__c = quo.Name;
o.Estimation_Name__c = q.Name;
o.Estimation_Id__c = q.Id;
@@ -2962,6 +3156,40 @@
o.quoteSavedDate__c = Date.today();
// 澶氬勾淇濅慨 end
+ // lt 20221008 SWAG-CHL5XA銆怓Y23璇环鏀瑰杽銆�-缁熻涓绘満鍙版暟 start
+ System.debug('lt123璇环鐘舵��(闃舵): ' + o.StageName);
+ System.debug('lt123activities: ' + activities);
+ o.OlyNumberHosts__c = 0;
+ System.debug('lt123涓绘満鏁�: ' + o.OlyNumberHosts__c);
+ List<String> oppIds = New List<String>();
+ List<String> product2Ids = New List<String>();
+ Map<String,Decimal> product2IdsMap = new Map<String,Decimal>();
+ if (activities.size() > 0) {
+ for (QELine a : activities) {
+ if (String.isBlank(a.PageObject.Id__c) == false) {
+ product2Ids.add(a.PageObject.Id__c);
+ product2IdsMap.put(a.PageObject.Id__c,a.PageObject.Quantity__c);
+ }
+ }
+
+ for (Product2 prod : [Select Id,ProductClass__c
+ From Product2 Where Id IN :product2Ids]) {
+ System.debug('lt123浜у搧甯傚満绫诲埆: ' + prod.ProductClass__c);
+
+ if(o.StageName == '寮曞悎' || o.StageName == '娉ㄦ畫' || o.StageName == '鍑鸿嵎' || o.StageName == '瀹屼簡'){
+ if(prod.ProductClass__c == '涓绘満'){
+ if(product2IdsMap.containsKey(prod.Id)){
+ o.OlyNumberHosts__c += product2IdsMap.get(prod.Id);
+ oppIds.add(o.Id);
+ ControllerUtil.UpdateBiddingFlag(oppIds);
+ }
+ }else{
+ o.OlyNumberHosts__c += 0;
+ }
+ }
+ }
+ }
+ // lt 20221008 SWAG-CHL5XA銆怓Y23璇环鏀瑰杽銆�-缁熻涓绘満鍙版暟 end
if (o.Quote_Update_Sum__c == null) {
o.Quote_Update_Sum__c = 1;
@@ -2969,7 +3197,11 @@
o.Quote_Update_Sum__c = o.Quote_Update_Sum__c + 1;
}
System.debug('start 1st save Opportunity at: ' + System.currentTimeMillis());
- ControllerUtil.updOpp(o);
+ // SWAG-CER5R4 浼樺寲淇濆瓨閫熷害 start
+ // ControllerUtil.updOpp(o);
+ StaticParameter.EscapeOppandStaTrigger = true;
+ update o;
+ // SWAG-CER5R4 浼樺寲淇濆瓨閫熷害 end
System.debug('finished 1st save Opportunity at: ' + System.currentTimeMillis());
system.debug('鈼嬧棆鈼嬧棆鈼婼ave3鈼嬧棆鈼嬧棆鈼�');
@@ -2979,7 +3211,10 @@
//渚℃牸銆佸崢浣嶃�佸皬瑷堛�丱CM澹蹭笂浜堟脯閲戦锛堢◣鎶滐級銆佷尽鏍艰〃
List<OpportunityLineItem> ols = New List<OpportunityLineItem>();
OpportunityLineItem ol = New OpportunityLineItem();
- ols = [select Id from OpportunityLineItem Where OpportunityId = :oppid];
+ // lt 20221008 SWAG-CHL5XA銆怓Y23璇环鏀瑰杽銆�-缁熻涓绘満鍙版暟 end
+ ols = [select Id, Quantity from OpportunityLineItem Where OpportunityId = :oppid]; //update
+ System.debug('lt123璇环浜у搧: ' + ols);
+ // lt 20221008 SWAG-CHL5XA銆怓Y23璇环鏀瑰杽銆�-缁熻涓绘満鍙版暟 end
if (ols.size() > 0) {
//delete
ControllerUtil.delOppLine(ols);
@@ -2993,6 +3228,7 @@
if (s.Asset_Model != null && s.Asset_Model != '') {
if (s.PageObject.PricebookEntryId != null) {
ol = New OpportunityLineItem();
+ System.debug('lt123璇环浜у搧鏁伴噺: ' + ol.Quantity); //lt CHL5XA銆怓Y23璇环鏀瑰杽銆�
ol.OpportunityId = oppid;
ol.Id__c = s.PageObject.Id__c;
// CHAN-AVG3PW 璇环鎶ヤ环鐢婚潰瑙勫垯鍙樻洿
@@ -3122,31 +3358,82 @@
}
//lastbuy 2022/2/9 fy start
public boolean ReservedProductVerification() {
+
filg=true;
Map<string,QuoteLineItem> quotlinitMap = new Map<string,QuoteLineItem>();
- List<Id> lastProductFLGList = new List<Id>();
- for(QELine qli : activities){
- lastProductFLGList.add(qli.pageObject.PricebookEntry.Product2Id);
- quotlinitMap.put(qli.pageObject.PricebookEntry.Product2Id,qli.pageObject);
+ List<Id> lastProductFLGListId = new List<Id>();
+ List<QuoteLineItem> lastProductFLGList = new List<QuoteLineItem>();
+ List<QuoteLineItem> act = new List<QuoteLineItem>();
+ List<QuoteLineItem> act2 = new List<QuoteLineItem>();
+ for(QELine aaa :activities){
+ if(aaa.pageObject.PricebookEntry.Product2Id!=null){
+ act.add(aaa.pageObject);
+ }
}
- System.debug('activities!!!'+activities);
+ act2=act.deepClone();
+ Map<String,QuoteLineItem> map1 = new Map<String,QuoteLineItem>();
+ System.debug('activities1111111111112涓烘墍褰撲负澶氬!!!'+activities);
+ integer i =0;
+ for(QuoteLineItem pspsc :act2){
+ if(pspsc.PricebookEntry.Product2Id!=null){
+ if(map1.containsKey(pspsc.PricebookEntry.Product2Id)){
+ QuoteLineItem quoteLine = map1.get(pspsc.PricebookEntry.Product2Id);
+ quoteLine.Quantity__c =quoteLine.Quantity__c+pspsc.Quantity__c;
+ map1.put(pspsc.PricebookEntry.Product2Id,quoteLine);
+ }else{
+ map1.put(pspsc.PricebookEntry.Product2Id,pspsc);
+ }
+ System.debug('34499879!!!'+activities);
+ }
+ }
+ System.debug('3434343!!!'+activities);
+ System.debug('5656565!!!'+map1);
+ for (QuoteLineItem value : map1.values()) {
+ if(value.PricebookEntry.Product2.LastbuyProductFLG__c){
+ lastProductFLGListId.add(value.PricebookEntry.Product2Id);
+ quotlinitMap.put(value.PricebookEntry.Product2Id,value);
+ lastProductFLGList.add(value);
+ }
+ }
+ System.debug('activities++++!!!'+activities);
+ System.debug('activities!!!'+map1.values());
System.debug('oppId!!!'+oppId);
- System.debug('lastProductFLGList!!!'+lastProductFLGList);
- if(lastProductFLGList!=null){
- List<LastbuyProduct__c> LastbuyObjList=[select id,LastbuyQuantity__c,InquiryCode__c,ProductName__c,effectiveFLG__c from LastbuyProduct__c where InquiryCode__c= : oppId and ProductName__c in :lastProductFLGList and effectiveFLG__c = true];
- if(LastbuyObjList!=null){
- for(LastbuyProduct__c lastbuypr :LastbuyObjList){
- Decimal quoteLItemNum=0;
- if(quotlinitMap.containsKey(lastbuypr.ProductName__c)){
- quoteLItemNum=quotlinitMap.get(lastbuypr.ProductName__c).Quantity__c;
- }else{
- continue;
- }
- if(lastbuypr.LastbuyQuantity__c<quoteLItemNum){
- filg=false;
- break;
- }
+ System.debug('lastProductFLGList!!!'+lastProductFLGListId);
+ if(lastProductFLGListId!=null&&lastProductFLGListId.size()!=0){
+ List<LastbuyProduct__c> LastbuyObjList=[select id,LastbuyQuantity__c,InquiryCode__c,ProductName__c,effectiveFLG__c from LastbuyProduct__c where InquiryCode__c= : oppId and ProductName__c in :lastProductFLGListId and effectiveFLG__c = true];
+ Map<string,LastbuyProduct__c> LastbuyObjMap = new Map<string,LastbuyProduct__c>();
+ System.debug('LastbuyObjList+++++!!!'+LastbuyObjList);
+ if(LastbuyObjList!=null&&LastbuyObjList.size()!=0){
+ for(LastbuyProduct__c lastbuypr :LastbuyObjList){
+ LastbuyObjMap.put(lastbuypr.ProductName__c,lastbuypr);
+ }
+ }else{
+ flglastbuy=1;
+ filg=false;
+ return filg;
+ }
+ System.debug('LastbuyObjMap!!!'+LastbuyObjMap);
+ System.debug('lastProductFLGList+++++++!!!'+lastProductFLGList);
+ if(lastProductFLGList!=null&&lastProductFLGList.size()!=0){
+ for(QuoteLineItem lastbuypr :lastProductFLGList){
+ Decimal quoteLItemNum=0;
+ if(LastbuyObjMap.containsKey(lastbuypr.PricebookEntry.Product2Id)){
+ quoteLItemNum=LastbuyObjMap.get(lastbuypr.PricebookEntry.Product2Id).LastbuyQuantity__c;
+ System.debug('quoteLItemNum!!!'+quoteLItemNum);
+ System.debug('lastbuypr.pageObject.Quantity__c+++!!!'+lastbuypr.Quantity__c);
+ if(lastbuypr.Quantity__c>quoteLItemNum){
+ errorProductmodel=lastbuypr.Asset_Model_No__c;
+ flglastbuy=2;
+ filg=false;
+ break;
+ }
+ }else{
+ errorProductmodel=lastbuypr.Asset_Model_No__c;
+ flglastbuy=3;
+ filg=false;
+ break;
}
+ }
}
}
system.debug('filg====='+filg);
@@ -3174,6 +3461,13 @@
public String Authorized_DB_No { get; set; }
// LHJ End
+ // Celon璇环淇敼 2022-04-24 ssm start
+ public String CelonOpportunity { get; set; }
+ // Celon璇环淇敼 2022-04-24 ssm end
+ // lastbuy鍒ゆ柇鍙樻洿鐢ㄦ埛璇环 start
+ public Boolean is_changed_opp { get; set; }
+ // lastbuy鍒ゆ柇鍙樻洿鐢ㄦ埛璇环 end
+
public OppInfo(Opportunity opp) {
Account_RecordType_DeveloperName = opp.Account.RecordType.DeveloperName;
Direct_Separate = opp.Direct_Separate__c;
@@ -3187,6 +3481,12 @@
If_Need_Authorize = opp.If_Need_Authorize__c;
Authorized_DB_No = opp.Authorized_DB_No__c;
// LHJ End
+ // Celon璇环淇敼 2022-04-24 ssm start
+ CelonOpportunity = opp.CelonOpportunity__c;
+ // Celon璇环淇敼 2022-04-24 ssm end
+ // lastbuy鍒ゆ柇鍙樻洿鐢ㄦ埛璇环 start
+ is_changed_opp = opp.If_Account_Change__c != null ? opp.If_Account_Change__c : false;
+ // lastbuy鍒ゆ柇鍙樻洿鐢ㄦ埛璇环 end
}
}
//TODO 1.Quote銈儢銈搞偋銈儓杩藉姞
--
Gitblit v1.9.1