From eeb7c0a2d6f037d515bb822d739036b69c4dc73a Mon Sep 17 00:00:00 2001
From: 沙世明 <shashiming@prec-tech.com>
Date: 星期五, 08 四月 2022 17:14:12 +0800
Subject: [PATCH] Merge branch 'master' of http://47.92.229.245:8089/r/OlyMEBG
---
force-app/main/default/classes/NewQuoteEntryController.cls | 273 +++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 198 insertions(+), 75 deletions(-)
diff --git a/force-app/main/default/classes/NewQuoteEntryController.cls b/force-app/main/default/classes/NewQuoteEntryController.cls
index 122d346..0994ce1 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;
@@ -155,6 +161,7 @@
}
} else {
quoId = System.currentPageReference().getParameters().get('copyid');
+ system.debug('copyid++++++++++++'+quoId);
if (quoId != null) {
// 銈炽償銉笺伄銉囥兗銈裤亴寰屻仹浣滄垚銇欍倠
} else {
@@ -405,6 +412,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
@@ -414,12 +423,17 @@
From QuoteLineItem where Quoteid = :quoId Order by Item_Order__c, Id];
String copyQuoId = System.currentPageReference().getParameters().get('copyid');
+ system.debug('copyid2++++++++++++'+copyQuoId);
CheckItem = items;
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) {
//娣诲姞琛�
@@ -900,6 +914,8 @@
//澶栬锤澶氬勾淇� 2021/01/04 绮剧悽鎶�鏈� wql start
//缁翠慨鍚堝悓鎶ヤ环锛圲SD锛�
,Repair_Contract_USD__c
+ //fy 棰勭暀浜у搧鏍囪瘑
+ ,LastbuyProductFLG__c
//璁℃彁閲戦锛堜笉鍚◣锛孶SD锛�
,Intra_Trade_Foreign_RMB__c
//NoDiscount 閲戦锛圲SD锛�
@@ -1779,9 +1795,20 @@
errormessage = null;
//20220214 fy lastbuy start
if(!ReservedProductVerification()){
- errorflg = true;
- errormessage = '浜у搧鏁伴噺涓嶅彲瓒呰繃浜у搧棰勭暀鏁伴噺' ;
- return null;
+ 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
@@ -1808,60 +1835,70 @@
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();
- }
}
+ if(SkipQuotefilg){
+ errorflg = true;
+ errormessage = '鐢婚潰閰嶇疆鍙樻洿锛屽凡鐢熸垚鏂扮殑鎶ヤ环鍗曪紝璇烽噸鏂板仛鎶ヤ环璁$畻';
+ quo.IsQuoteTrial__c = false;
+ return null;
+ }
+ //寮曞悎銇绌嶆焙瀹氥倰銈兂
+ 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();
+ }
+ // 2022-04-06 SWAG-CC6AFQ銆愬鎵樸�戝張鏈夎浠疯烦杩囦簡鎶ヤ环璁$畻 ssm end
} catch (DmlException de) {
Database.rollback(sp);
errorflg = true;
@@ -2082,7 +2119,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 != '鈼�') {
@@ -2537,6 +2576,7 @@
//SWAG-C9JCS8 銆愬鎵樸�戙�愮揣鎬ャ�戣浠稧Z-SP-GD0757135鎶ヤ环鍗曢棶棰� fy end
public boolean dataEntry() {
+ system.debug('activities++++----****3'+activities);
//SWAG-C9JCS8 銆愬鎵樸�戙�愮揣鎬ャ�戣浠稧Z-SP-GD0757135鎶ヤ环鍗曢棶棰� fy start
// Boolean ifdecide=false;
// List<Opportunity> oppsde = [Select Id, Estimation_Decision__c From Opportunity Where Id = : oppId];
@@ -2581,6 +2621,7 @@
errormessage = System.Label.Error_Message3;
}
//decimal temSalesAmount1 = 0; // 2018/09/28 CHAN-B4YAB8 缁忛攢鍟嗗皬璁″悎璁� end
+ system.debug('activities++++----****2'+activities);
for (QELine a : activities) {
if ((a.Asset_Model != null) && (a.Asset_Model != '')) {
if (a.PageObject.Quantity__c == null || a.PageObject.Quantity__c == 0) {
@@ -2692,22 +2733,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))
||
@@ -2718,7 +2780,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;
@@ -2782,6 +2848,7 @@
// 20150302 jo 瑕嬬銇富鏈哄畨瑁呭湴鐐广倰瑷畾
List<String> pIds = new List<String>();
+ system.debug('activities++++----****1'+activities);
for (QELine s : activities) {
if (String.isBlank(s.PageObject.Id__c) == false) {
pIds.add(s.PageObject.Id__c);
@@ -2858,6 +2925,7 @@
//Sap閫佷俊,Print銇悎銈忋仜銇�1锝�
Integer i = 1;
if (activities.size() > 0) {
+ system.debug('activities++++----****'+activities);
for (QELine s : activities) {
if (s.Asset_Model != null && s.Asset_Model != '') {
if (s.pageObject.PricebookEntryId != null) {
@@ -2903,6 +2971,7 @@
}
}
System.debug('start save quote lines at: ' + System.currentTimeMillis());
+ system.debug('qlist+++---+++'+qlist);
insert qlist;
System.debug('finished save quote lines at: ' + System.currentTimeMillis());
@@ -3115,28 +3184,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);
+ }
}
- if(lastProductFLGList!=null){
- List<LastbuyProduct__c> LastbuyObjList=[select id,LastbuyQuantity__c,InquiryCode__c,ProductName__c from LastbuyProduct__c where InquiryCode__c= : oppId and ProductName__c in :lastProductFLGList];
- 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;
- }
+ 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!!!'+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);
--
Gitblit v1.9.1