From f24a5026dbfb2981e234ce46ed503584c03ce420 Mon Sep 17 00:00:00 2001
From: 涂煌豪 <tuhuanghao@prec-tech.com>
Date: 星期一, 18 四月 2022 17:49:35 +0800
Subject: [PATCH] SelectAssetEstimateVMController
---
force-app/main/default/classes/OpportunityTrigger.cls | 99 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 99 insertions(+), 0 deletions(-)
diff --git a/force-app/main/default/classes/OpportunityTrigger.cls b/force-app/main/default/classes/OpportunityTrigger.cls
index 8c82041..710d1af 100644
--- a/force-app/main/default/classes/OpportunityTrigger.cls
+++ b/force-app/main/default/classes/OpportunityTrigger.cls
@@ -38,6 +38,20 @@
if (newOpp.SAP_Send_OK__c != oldOpp.SAP_Send_OK__c && newOpp.SAP_Send_OK__c == false ) {
if (String.isNotBlank(newOpp.Estimation_Id__c) && newOpp.Estimation_Id__c.StartsWith('a2K'))newOpp.StageName = '鍓婇櫎';
if (String.isNotBlank(newOpp.Opportunity_No__c)) orderIds.add(newOpp.Opportunity_No__c);
+ //lastbuy 2022/2/9 fy start
+ List<LastbuyProduct__c> upLastbuyObjList = new List<LastbuyProduct__c>();
+ List<LastbuyProduct__c> LastbuyObjList=[select id,LastbuyQuantity__c,InquiryCode__c,ProductName__c,effectiveFLG__c from LastbuyProduct__c where InquiryCode__c= : newOpp.Id];
+ if(LastbuyObjList!=null){
+ for(LastbuyProduct__c lastbuypr :LastbuyObjList){
+ lastbuypr.ActualQuantity__c=0;
+ lastbuypr.effectiveFLG__c=true;
+ upLastbuyObjList.add(lastbuypr);
+ }
+ }
+ if(upLastbuyObjList!=null){
+ upsert upLastbuyObjList;
+ }
+ //lastbuy 2022/2/9 fy end
}
}
@@ -246,4 +260,89 @@
}
}
// SWAG-C7P4XB end
+
+ //LastBuy 棰勭暀浜у搧 lt 20220315 start
+ //璇环澶卞崟鎴栧彇娑堟椂锛岄鐣欎骇鍝佺殑"鏄惁鏈夋晥"璁剧疆涓哄惁
+ public static void ReservedProFlg(List<Opportunity> newList, Map<Id, Opportunity> newMap, List<Opportunity> oldList, Map<Id, Opportunity> oldMap){
+ List<Id> oppList = new List<Id>();
+ List<LastbuyProduct__c> lbpflgList = new List<LastbuyProduct__c>();
+
+ for (Opportunity lbOpp : newList){
+ Opportunity OldLbOpp = oldMap.get(lbOpp.Id);
+ if(OldLbOpp.StageName != lbOpp.StageName){
+ if(lbOpp.StageName == '鏁楁垿' || lbOpp.StageName == '鍓婇櫎'){
+ oppList.add(lbOpp.Id);
+ }
+ }
+ }
+
+ if(oppList.size() > 0){
+ List<LastbuyProduct__c> lbpList = [select id, effectiveFLG__c,InquiryCode__c from LastbuyProduct__c where InquiryCode__c in :oppList];
+ if(lbpList.size() > 0){
+ for(LastbuyProduct__c lbp : lbpList){
+ if(lbp.effectiveFLG__c == true){
+ lbp.effectiveFLG__c = false;
+ lbpflgList.add(lbp);
+ }
+ }
+ }
+ }
+
+ if(lbpflgList.size() > 0){
+ update lbpflgList;
+ }
+ }
+ public static void intI(){
+ Integer i=0;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ }
+ //LastBuy 棰勭暀浜у搧 lt 20220315 end
+
}
\ No newline at end of file
--
Gitblit v1.9.1