From 91ff4da4131f2664997de95ac866999057a4186a Mon Sep 17 00:00:00 2001
From: 付煜 <fuyu3103346691@163.com>
Date: 星期四, 31 三月 2022 18:19:49 +0800
Subject: [PATCH] 【委托】【重要-询价】询价等级和询价金额计算点问题007

---
 force-app/main/default/classes/NFM007Controller.cls |   85 +++++++++++++++++++++++++++++++++++++++---
 1 files changed, 78 insertions(+), 7 deletions(-)

diff --git a/force-app/main/default/classes/NFM007Controller.cls b/force-app/main/default/classes/NFM007Controller.cls
index e72c566..e21d6cd 100644
--- a/force-app/main/default/classes/NFM007Controller.cls
+++ b/force-app/main/default/classes/NFM007Controller.cls
@@ -169,7 +169,10 @@
                                                 // LHJ 澶氬勾淇濅慨 20190627 Start
                                                 Gurantee_Period__c,DecideQuoteDate__c,
                                                 // LHJ 澶氬勾淇濅慨 20190627 End
-                                                STMS_Package_Sale__c, Equipment_Order_Flg__c
+                                                STMS_Package_Sale__c, Equipment_Order_Flg__c,
+                                                //銆愭槸鍚﹂渶瑕佷环鏍肩敵璇枫�戜负鏄殑鍦哄悎,鎵嶈妫�鏌ュ仛娌″仛杩囨姤浠疯瘯绠� thh 2021-11-03 start
+                                                If_Need_PriceApply__c 
+                                                //銆愭槸鍚﹂渶瑕佷环鏍肩敵璇枫�戜负鏄殑鍦哄悎,鎵嶈妫�鏌ュ仛娌″仛杩囨姤浠疯瘯绠� thh 2021-11-03 end
                                            from Opportunity where Id IN :oppIds];
             System.debug(Logginglevel.DEBUG, 'NFM007_ oppList.size()=' + oppList.size());
 
@@ -323,7 +326,8 @@
                 quotation.Detail = new List<Detail_element>();
                 //CHAN-BDPBVY 20190703 end
                 // 20211101 gzw 鎶ヤ环璇曠畻  fix  璇曠畻琛岄」鐩湁鍊硷紝鍙戣瘯绠椾俊鎭紝鍚﹀垯鍙戣浠疯椤圭洰 end
-                if (promotionSalesProductsList != null && promotionSalesProductsList.size() > 0) {
+                //璇环涓婄殑銆愭槸鍚﹂渶瑕佷环鏍肩敵璇枫�戜负鏄殑鍦哄悎,鎵嶈妫�鏌ュ仛娌″仛杩囨姤浠疯瘯绠� thh 2021-11-03 
+                if (opp.If_Need_PriceApply__c && promotionSalesProductsList != null && promotionSalesProductsList.size() > 0) {
                     for(Integer i = 0; i < promotionSalesProductsList.size(); i++){
                         Detail_element detail = new Detail_element();
                         quotation.Detail.add(detail);
@@ -366,7 +370,21 @@
                             detail.PROCODE = '8888';
                         }
                         system.debug(' detail.PROCODE=='+detail.PROCODE);
-                        detail.GuaranteeType = promotionSalesProductsList.get(i).latestWarrantyType__c;  // 淇濅慨绫诲埆
+                        //WLIG-CCT9UG 銆愬鎵樸�戝叧浜庡競鍦哄骞翠繚璁℃彁閲戣皟鏁� fy start
+                        if(opp.Trade__c == '澶栬部'){
+                            detail.GuaranteeType = promotionSalesProductsList.get(i).latestWarrantyType__c+',';// 淇濅慨绫诲埆
+                        }else{
+                            Date nowDate = Date.today();
+                            // Date baojidate = Date.valueOf('2022-4-1');
+                            Date baojidate = Date.newInstance(2022,3,30);
+                            if(baojidate<=nowDate){
+                                detail.GuaranteeType = promotionSalesProductsList.get(i).latestWarrantyType__c+',new';
+                            }else{
+                                detail.GuaranteeType = promotionSalesProductsList.get(i).latestWarrantyType__c+',';
+                            }
+                        }
+                        //WLIG-CCT9UG 銆愬鎵樸�戝叧浜庡競鍦哄骞翠繚璁℃彁閲戣皟鏁� fy end
+                        // detail.GuaranteeType = promotionSalesProductsList.get(i).latestWarrantyType__c;  // 淇濅慨绫诲埆
                         if (!oldDate) {
                             if (promotionSalesProductsList.get(i).latestProvistonPeriod__c != null) {
                                 detail.ProvistonPeriod = String.valueOf(promotionSalesProductsList.get(i).latestProvistonPeriod__c).leftPad(2,'0');
@@ -468,9 +486,36 @@
                             
                             //淇濅慨绫诲埆
                             if(oppLiList.get(i).latestWarrantyType__c != null){
-                                detail.GuaranteeType = oppLiList.get(i).latestWarrantyType__c;  // 淇濅慨绫诲埆
+                                //WLIG-CCT9UG 銆愬鎵樸�戝叧浜庡競鍦哄骞翠繚璁℃彁閲戣皟鏁� fy start
+                                if(opp.Trade__c == '澶栬部'){
+                                    detail.GuaranteeType = oppLiList.get(i).latestWarrantyType__c+',';// 淇濅慨绫诲埆
+                                }else{
+                                    Date nowDate = Date.today();
+                                    // Date baojidate = Date.valueOf('2022-4-1');
+                                    Date baojidate = Date.newInstance(2022,3,30);
+                                    if(baojidate<=nowDate){
+                                        detail.GuaranteeType = oppLiList.get(i).latestWarrantyType__c+',new';
+                                    }else{
+                                        detail.GuaranteeType = oppLiList.get(i).latestWarrantyType__c+',';
+                                    }
+                                }
+                                //WLIG-CCT9UG 銆愬鎵樸�戝叧浜庡競鍦哄骞翠繚璁℃彁閲戣皟鏁� fy end
+                                // detail.GuaranteeType = oppLiList.get(i).latestWarrantyType__c;  // 淇濅慨绫诲埆
                             }else{
-                                detail.GuaranteeType = null;
+                                //WLIG-CCT9UG 銆愬鎵樸�戝叧浜庡競鍦哄骞翠繚璁℃彁閲戣皟鏁� fy start
+                                if(opp.Trade__c == '澶栬部'){
+                                    detail.GuaranteeType = ',';
+                                }else{
+                                    Date nowDate = Date.today();
+                                    Date baojidate = Date.newInstance(2022,3,30);
+                                    if(baojidate<=nowDate){
+                                        detail.GuaranteeType = ',new';
+                                    }else{
+                                        detail.GuaranteeType = ',';
+                                    }
+                                }
+                                //WLIG-CCT9UG 銆愬鎵樸�戝叧浜庡競鍦哄骞翠繚璁℃彁閲戣皟鏁� fy end
+                                // detail.GuaranteeType = null;
                             }
                             //璁℃彁閲戦
                             detail.GuaranteePrice = oppLiList.get(i).latestGuranteePrice__c;
@@ -488,7 +533,20 @@
                             // detail.GuaranteePeriod = null;
                             // detail.GuaranteeType = null;
                             //澶栬锤澶氬勾淇濅慨鏈笂绾垮墠 淇濅慨绫诲埆 浼爊ull
-                            detail.GuaranteeType = null;
+                            //WLIG-CCT9UG 銆愬鎵樸�戝叧浜庡競鍦哄骞翠繚璁℃彁閲戣皟鏁� fy start
+                            if(opp.Trade__c == '澶栬部'){
+                                detail.GuaranteeType = ',';
+                            }else{
+                                Date nowDate = Date.today();
+                                Date baojidate = Date.newInstance(2022,3,30);
+                                if(baojidate<=nowDate){
+                                    detail.GuaranteeType = ',new';
+                                }else{
+                                    detail.GuaranteeType = ',';
+                                }
+                            }
+                            //WLIG-CCT9UG 銆愬鎵樸�戝叧浜庡競鍦哄骞翠繚璁℃彁閲戣皟鏁� fy end
+                            // detail.GuaranteeType = null;
                             //澶栬锤澶氬勾淇濅慨鏈笂绾垮墠  璁℃彁閲戦 浼�0 
                             detail.GuaranteePrice = 0;
                             //澶栬锤澶氬勾淇濅慨鏈笂绾垮墠 nodiscount 浼�0
@@ -502,7 +560,20 @@
                         //鈶ecide鍦�20191001 涔嬪墠  鑰佹暟鎹�
                         else if(oldDate){
                             detail.GuaranteePeriod = null;
-                            detail.GuaranteeType = null;
+                            //WLIG-CCT9UG 銆愬鎵樸�戝叧浜庡競鍦哄骞翠繚璁℃彁閲戣皟鏁� fy start
+                            if(opp.Trade__c == '澶栬部'){
+                                detail.GuaranteeType = ',';
+                            }else{
+                                Date nowDate = Date.today();
+                                Date baojidate = Date.newInstance(2022,3,30);
+                                if(baojidate<=nowDate){
+                                    detail.GuaranteeType = ',new';
+                                }else{
+                                    detail.GuaranteeType = ',';
+                                }
+                            }
+                            //WLIG-CCT9UG 銆愬鎵樸�戝叧浜庡競鍦哄骞翠繚璁℃彁閲戣皟鏁� fy end
+                            // detail.GuaranteeType = null;
                             detail.ProvistonPeriod = null;
                             detail.GuaranteePrice = null;
                             detail.ServicePrice = null;

--
Gitblit v1.9.1