From ea6a4eec81a6a74e214aefc5971d701242c3e7d3 Mon Sep 17 00:00:00 2001
From: Thhto <997058689@qq.com>
Date: 星期四, 17 十一月 2022 14:40:04 +0800
Subject: [PATCH]  SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy

---
 force-app/main/default/pages/NewQuoteEntry.page               |   29 ++
 force-app/main/default/classes/NewQuoteIraiController.cls     |  120 +++++++++-
 force-app/main/default/classes/NewQuoteEntryController.cls    |  267 ++++++++++++++++++++---
 force-app/main/default/classes/SI_NewQuoteEntryController.cls |   38 ++
 force-app/main/default/pages/NewQuoteIrai.page                |  163 ++++++++++----
 force-app/main/default/pages/SI_NewQuoteEntry.page            |   39 +++
 6 files changed, 530 insertions(+), 126 deletions(-)

diff --git a/force-app/main/default/classes/NewQuoteEntryController.cls b/force-app/main/default/classes/NewQuoteEntryController.cls
index 0994ce1..0d9face 100644
--- a/force-app/main/default/classes/NewQuoteEntryController.cls
+++ b/force-app/main/default/classes/NewQuoteEntryController.cls
@@ -220,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 = '澶栬部';
@@ -362,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,
@@ -442,6 +448,7 @@
         }
         if (copyQuoId == null) {
           quo = quoList[0];
+          
           quo.QuoteName__c = quo.Name;
           // 澶氬勾淇濅慨 start
           quoteGurantee_Period = quo.Gurantee_Period__c;
@@ -813,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
@@ -1254,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 澧炲姞瀛楁
@@ -1286,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);
@@ -1542,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涓嶅彲閿�鍞殑鏃跺�欙紝閮芥槸鎶ラ敊鐨勶紝鍏朵腑涓嶅彲閿�鍞骇鍝佹樉绀虹孩瀛楋紝涓嶅簲璇ヤ繚瀛樸��
@@ -1555,7 +1586,6 @@
           errormessage = '璇锋洿鏂颁笉鍙攢鍞殑浜у搧銆�';
           return null;
         }
-
         System.debug('checkSFDAStatus1 finished at: ' + System.currentTimeMillis());
 
         //銉囥兗銈裤儊銈с儍銈�
@@ -1737,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 = '浜у搧鐘舵�佸彂鐢熷彉鍖栵紝璇锋洿鏂�';
@@ -1794,20 +1840,22 @@
       errorflg = false;
       errormessage = null;
       //20220214 fy lastbuy start 
-      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;
+      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
@@ -1843,12 +1891,14 @@
       if (dataEntry() == false) {
         return null;
       }
+      //SWAG-CC6AFQ銆愬鎵樸�戝張鏈夎浠疯烦杩囦簡鎶ヤ环璁$畻 fy start
       if(SkipQuotefilg){
         errorflg = true;
-        errormessage =  '鐢婚潰閰嶇疆鍙樻洿锛屽凡鐢熸垚鏂扮殑鎶ヤ环鍗曪紝璇烽噸鏂板仛鎶ヤ环璁$畻';
+        errormessage =  '浜у搧閰嶇疆鎴栬�呯粡閿�鍟嗕俊鎭彂鐢熷彉鍖栵紝宸茬粡鐢熸垚鏂扮殑鎶ヤ环鍗曪紝璇烽噸鏂版搷浣滄姤浠疯绠�';
         quo.IsQuoteTrial__c = false;
         return null;
       }
+      //SWAG-CC6AFQ銆愬鎵樸�戝張鏈夎浠疯烦杩囦簡鎶ヤ环璁$畻 fy end
       //寮曞悎銇绌嶆焙瀹氥倰銈兂
       if (oppId == null) {
         system.debug('Error is Opportunityid null!!!');
@@ -1859,7 +1909,12 @@
           /*鈫撯啌鈫撹绌嶅悓鏈熲啌鈫撯啌2012/11/28 鏈娇鐢�
           opps[0].SyncedQuoteId = quoId;
           鈫戔啈鈫戙��銆�銆�銆�鈫戔啈鈫�*/
-          ControllerUtil.updOpp(opps[0]);
+          // SWAG-CER5R4 浼樺寲淇濆瓨閫熷害 start
+          // ControllerUtil.updOpp(opps[0]);
+          StaticParameter.EscapeOppandStaTrigger = true;
+          update opps[0];
+          StaticParameter.EscapeOppandStaTrigger = false;
+          // SWAG-CER5R4 浼樺寲淇濆瓨閫熷害 end
         }
 
         errorflg = true;
@@ -1994,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]);
@@ -2143,7 +2203,11 @@
       }
 
     }
-
+    //SWAG-CER5R4 銆愬鎵樸�戞姤浠峰悎鍚岄噾棰濆鍔犻檺鍒� fy start
+    if(ContractAmountLimitJudge()){
+      return false;
+    }
+    //SWAG-CER5R4 銆愬鎵樸�戞姤浠峰悎鍚岄噾棰濆鍔犻檺鍒� fy end
     if (error == true && WinOrDecideAlert == false) {
       PageArrange();
       errorflg = true;
@@ -2211,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;
     }
@@ -2574,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
@@ -2600,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;
@@ -2687,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;
@@ -2807,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,
@@ -2894,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鈼嬧棆鈼嬧棆鈼�');
@@ -2989,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];
@@ -3008,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;
@@ -3024,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;
@@ -3031,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鈼嬧棆鈼嬧棆鈼�');
@@ -3041,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);
@@ -3055,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 璇环鎶ヤ环鐢婚潰瑙勫垯鍙樻洿
@@ -3287,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;
@@ -3300,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銈儢銈搞偋銈儓杩藉姞
diff --git a/force-app/main/default/classes/NewQuoteIraiController.cls b/force-app/main/default/classes/NewQuoteIraiController.cls
index 359a7ce..aad5885 100644
--- a/force-app/main/default/classes/NewQuoteIraiController.cls
+++ b/force-app/main/default/classes/NewQuoteIraiController.cls
@@ -6,6 +6,9 @@
     public Id quoId {get;set;}
     public String oppid;
     public String leadid;
+    //SWAG-CKDATG銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start
+    public String tenderid;
+    //SWAG-CKDATG銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy end
     public Boolean productStatusUpdated {get;set;}               // 鐘舵厠鏇存柊銆亄!$Label.Status_Update} 銈掓娂涓嬨仐銇熴亱銇┿亞銇�
     public Boolean changedAfterPrint {get;set;}                  // true 銇牬鍚堛�佺敾闈€伀 confirm 銉°儍銈汇兗銈搞亴琛ㄧず銇椼伨銇欍�俼uoId銈掓柊銇椼亜insert銆傚垽瀹氥伅js銇仸瀹熸柦
 
@@ -15,7 +18,9 @@
     public String errorProductmodel { get; set; }
     public Boolean is_changed_opp { get; set; }
     //lastbuy  2022/3/10 fy end
-
+    //SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 start
+    public String erroraxsdmodel { get; set; }
+    //SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 end
     public String excel_text {get;set;}
     public Integer select_index {get;set;}                       // excelImport灏傜敤銇с仚銇屻�乯s銇仸鍒跺尽銇欍倠銇撱仺銇仾銈嬨伄銇с�乀ODO katsu 鍓婇櫎浜堝畾
     public String Product_text {get;set;}
@@ -161,13 +166,20 @@
 
         // 鎷涙姇鏍囨姤浠峰鎵� 2021-06-21 update by gzw start
         // 鎷涙姇鏍�
-        String tenderid = System.currentPageReference().getParameters().get('tenderid');
+        //SWAG-CKDATG銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start
+        // String tenderid = System.currentPageReference().getParameters().get('tenderid');
+        tenderid = System.currentPageReference().getParameters().get('tenderid');
+        //SWAG-CKDATG銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy end
+
         // 鎷涙姇鏍囨姤浠峰鎵� 2021-06-21 update by gzw start
 
         // 璇环id
         oppid = System.currentPageReference().getParameters().get('oppid');
         QuoteIrai__c quoteiraiobj = new QuoteIrai__c();
-        if(oppid==null&&tenderid==null&&quoId!=null&&leadid==null&&agencyoppid==null){
+        //SWAG-CKDATG銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start
+        if(oppid==null&&quoId!=null&&leadid==null&&agencyoppid==null){
+            // if(oppid==null&&tenderid==null&&quoId!=null&&leadid==null&&agencyoppid==null){
+        //SWAG-CKDATG銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy end
             //XLIU-CFE8M7 銆愬鎵樸�戙�怭-OBSAP銆戞姤浠峰鎵樹换鍔℃敼鍠� fy  Noteplus__c
             quoteiraiobj = [select id,Note__c,Noteplus__c from QuoteIrai__c where id=:quoId];
             if(quoteiraiobj.Note__c!=null){
@@ -179,6 +191,8 @@
             }
         }
         system.debug('oppid:++++'+oppid);
+        system.debug('leadid:++++'+leadid);
+        system.debug('tenderid:++++'+tenderid);
         // 鎶ヤ环id
         String oppquoid = System.currentPageReference().getParameters().get('oppquoid');
         //灏嗘姤浠峰鎵樼殑甯佺涓庡璐稿竵绉嶄竴鑷� 闃叉鍚庣画澶栬锤鏈夐渶瑕佺敤USD鍒ゆ柇鏄剧ず鐨勫湴鏂� 绮剧悽鎶�鏈� wql 2021/01/06 start
@@ -207,7 +221,10 @@
             }
             // 缁忛攢鍟嗚浠锋姤浠峰鎵� 2020-02-28 update by vivek end
             // 鎷涙姇鏍囨姤浠峰鎵� 2021-06-21 update by gzw start
-            if (String.isNotBlank(tenderid)) {
+            // SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start
+            // if (String.isNotBlank(tenderid)) {
+            if (String.isNotBlank(tenderid)&&String.isBlank(leadid)) {
+            // SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start
                 quo.Note__c = Tender_information__c.sObjectType.getDescribe().getLabel() + '锛�' + baseUrl + '/' + tenderid;
             }
             // 鎷涙姇鏍囨姤浠峰鎵� 2021-06-21 update by gzw end
@@ -405,17 +422,17 @@
             // CHAN-BJQ4VZ 绮剧悽鎶�鏈� 2019/12/11 Start
             //XLIU-CFE8M7 銆愬鎵樸�戙�怭-OBSAP銆戞姤浠峰鎵樹换鍔℃敼鍠� fy  Noteplus__c
             //SWAG-CF589P銆愬鎵樸�戙�怭:OBSAP銆戞姤浠峰鎵樼浉鍏虫柊闇�姹傝瘎浼� fy Lead__c,Opportunity__c,
-            List<QuoteIrai__c> quoList = //obsap 鏂板缁忛攢鍟�1瀛楁 fy satrt Agency1_entrust__c ,
-                [ SELECT Id,Name,Cancel_Decide__c,Agency_Hospital_Link__c,CreatedDate, PriceRefreshDate__c,Quote_Print_Date__c,Agency1_entrust__c,
+            List<QuoteIrai__c> quoList = //obsap 鏂板缁忛攢鍟�1瀛楁 fy satrt Agency1_entrust__c ,SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start cancelMultiyearInsurance__c,
+                [ SELECT Id,Name,Cancel_Decide__c,Agency_Hospital_Link__c,CreatedDate, PriceRefreshDate__c,Quote_Print_Date__c,Agency1_entrust__c,cancelMultiyearInsurance__c,
                         Quote_Date__c,QuoteToName__c,Quote_Expiration_Date__c,Quote_Comment__c,Tender_information__c,Noteplus__c,Lead__c,Opportunity__c,
                         TOTAL__c,Discount__c,Pricing__c,Preferential_Trading_Price__c,Contract__c,LastIraiUser__c,MultiYearWarrantyTotalPrice__c,QuoteTotal_Page__c,Estimation_List_Price__c,
                         Print_HP_Name__c,Account__c,IraiUser__c,IraiSubject__c,CurrencyIsoCode,IraiName__c,QuoteIrai_Status__c,QuoteProportion__c,Note__c,IraiComment__c
                         FROM QuoteIrai__c Where Id =:quoId];
             // CHAN-BJQ4VZ 绮剧悽鎶�鏈� 2019/12/11 End
             // CHAN-BHNBX6 2019/11/20 START
-            List<QuoteIraiLineItem__c> items = //lastbuy  2022/3/10 fy start LastbuyProductFLG__c
+            List<QuoteIraiLineItem__c> items = //lastbuy  2022/3/10 fy start LastbuyProductFLG__c //SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 start Is_DangerousChemicals__c
                 [Select Id,Asset_Model_No__c,SFDA_Status__c,Name__c,BSS_Category__c,QuoteIrai__r.Quote_Print_Date__c,
-                    Qty_Unit__c,Quantity__c,Product2__r.SFDA_Status__c,ProductCode__c,ListPrice__c,Product2__r.LastbuyProductFLG__c,
+                    Qty_Unit__c,Quantity__c,Product2__r.SFDA_Status__c,ProductCode__c,ListPrice__c,Product2__r.LastbuyProductFLG__c,Product2__r.Is_DangerousChemicals__c,
                     Product2__r.Sales_Possibility__c,Product2__r.Name,Product2__c,ServicePrice__c,NoDiscountTotal__c,GuaranteePeriod__c
                     From QuoteIraiLineItem__c where QuoteIrai__c = :quoId Order by Item_Order__c, Id];
             // CHAN-BHNBX6 2019/11/20 END
@@ -499,7 +516,15 @@
             quo.Quote_Expiration_Date__c = Date.today() + 30;
         }
         //--Savebutton
-        Save_button=true;
+        // SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start
+        this.Save_button=false;
+        if(quo.QuoteIrai_Status__c != '鑽夋涓�'&& String.isNotBlank(quo.QuoteIrai_Status__c)){
+            this.Save_button=true;
+        }
+        // Save_button=true;
+        // SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy end
+        system.debug('===fff==='+quo.QuoteIrai_Status__c);
+        system.debug('===ccc==='+this.Save_button);
         //XLIU-CFE8M7 銆愬鎵樸�戙�怭-OBSAP銆戞姤浠峰鎵樹换鍔℃敼鍠� fy start
         // if( quo.Note__c!=''){
         if(String.isNotBlank(quo.Note__c)){
@@ -1060,6 +1085,11 @@
             if (!String.isBlank(quo.Agency1_entrust__c)) {
                 description += '\r\n' + '绗竴缁忛攢鍟�' + '锛�' + baseUrl + '/' + quo.Agency1_entrust__c;
             }
+            //SWAG-CKDATG銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start
+            if (!String.isBlank(tenderid)&&!description.contains('鎷涙爣椤圭洰') ) {
+                description += '\r\n' + '鎷涙爣椤圭洰' + '锛�' + baseUrl + '/' + tenderid;
+            }
+            //SWAG-CKDATG銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy end
             //obsap 鏂板缁忛攢鍟�1瀛楁 fy end
             // 鎷涙姇鏍囨姤浠峰鎵� 2020-06-21 update by gzw start
             // if (!String.isBlank(quo.Tender_information__c)) {
@@ -1111,6 +1141,14 @@
             if (quo.QuoteProportion__c != null) {
                 todoSubject += '锛� ' + quo.QuoteProportion__c + '%';
             }
+            // SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start
+            todoSubject += quo.cancelMultiyearInsurance__c=='涓嶈' ?'锛屽彇娑堝骞翠繚':'锛岄渶瑕佸骞翠繚';
+            // if (quo.cancelMultiyearInsurance__c=='涓嶈') {
+            //     todoSubject += '锛屽彇娑堝骞翠繚';
+            // }else{
+            //     todoSubject += '锛岄渶瑕佸骞翠繚';
+            // }
+            // SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy end
             // String taskid = '';
             // 鏀规垚瀵瑰浜虹殑
             // if (tasks.size() > 0) {
@@ -1191,8 +1229,8 @@
                 // CHAN-BJQ4VZ 绮剧悽鎶�鏈� 2019/12/11 Start
             //XLIU-CFE8M7 銆愬鎵樸�戙�怭-OBSAP銆戞姤浠峰鎵樹换鍔℃敼鍠� fy  Noteplus__c
             //SWAG-CF589P銆愬鎵樸�戙�怭:OBSAP銆戞姤浠峰鎵樼浉鍏虫柊闇�姹傝瘎浼� fy Lead__c,Opportunity__c,
-                quo =[ SELECT Id,Name,Cancel_Decide__c,CreatedDate, PriceRefreshDate__c,Quote_Print_Date__c,//obsap 鏂板缁忛攢鍟�1瀛楁 fy satrt Agency1_entrust__c,
-                        Quote_Date__c,QuoteToName__c,Quote_Expiration_Date__c,Quote_Comment__c,Tender_information__c,Agency1_entrust__c,Noteplus__c,Lead__c,Opportunity__c,
+                quo =[ SELECT Id,Name,Cancel_Decide__c,CreatedDate, PriceRefreshDate__c,Quote_Print_Date__c,//obsap 鏂板缁忛攢鍟�1瀛楁 fy satrt Agency1_entrust__c,SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start cancelMultiyearInsurance__c,
+                        Quote_Date__c,QuoteToName__c,Quote_Expiration_Date__c,Quote_Comment__c,Tender_information__c,Agency1_entrust__c,Noteplus__c,Lead__c,Opportunity__c,cancelMultiyearInsurance__c,
                         TOTAL__c,Discount__c,Pricing__c,Preferential_Trading_Price__c,Contract__c,LastIraiUser__c,MultiYearWarrantyTotalPrice__c,QuoteTotal_Page__c,Estimation_List_Price__c,
                         Print_HP_Name__c,Account__c,Agency_Hospital_Link__c,IraiUser__c,IraiSubject__c,CurrencyIsoCode,IraiName__c,QuoteIrai_Status__c,QuoteProportion__c,Note__c,IraiComment__c
                         FROM QuoteIrai__c Where Id =:quoId];
@@ -1207,7 +1245,8 @@
             // 鎷涙姇鏍囨姤浠峰鎵� 2020-06-21 update by gzw end
             errorflg = true;
             errorMessage = '閭欢鍙戦�佸畬鎴愩��';
-
+            // SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start
+            this.Save_button=true;
             //XLIU-CHY4KW 20220907 lt start  --- 鎶ヤ环濮旀墭鍙戦�侀偖浠舵垚鍔熶箣鍚� 鍙嶅悜鏇存柊鎰忓悜  鎶ヤ环濮旀墭瀛楁涓�1
             Lead lea = new Lead();
             if(String.isNotBlank(leadid)){
@@ -1416,6 +1455,14 @@
         }
       
       //20220310 fy lastbuy end
+        //SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 start
+        String resalt = assdproductCheck();
+        if(resalt!='OK'){
+            errorflg = true;
+            errormessage = resalt ;
+            return false;
+        }
+        //SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 end
         system.debug('鈼嬧棆鈼嬧棆鈼嬧棆鈼嬧棆鈼嬧棆鈼嬧棆Welcome to dataCheck class!!鈼嬧棆鈼嬧棆鈼嬧棆鈼嬧棆鈼嬧棆鈼嬧棆');
         errorflg = false;
         errormessage = null;
@@ -1440,8 +1487,8 @@
             if (error == true){
                 if (quoId != null) {
                     Map<String,QuoteIraiLineItem__c> itemmap = new Map<String,QuoteIraiLineItem__c>();
-                    for (QuoteIraiLineItem__c item : [//lastbuy  2022/3/10 fy start LastbuyProductFLG__c
-                        Select Id,Product2__r.SFDA_Status__c,Product2__r.Name,Product2__c,Product2__r.LastbuyProductFLG__c
+                    for (QuoteIraiLineItem__c item : [//lastbuy  2022/3/10 fy start LastbuyProductFLG__c //SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 start Product2__r.Is_DangerousChemicals__c
+                        Select Id,Product2__r.SFDA_Status__c,Product2__r.Name,Product2__c,Product2__r.LastbuyProductFLG__c,Product2__r.Is_DangerousChemicals__c
                         From QuoteIraiLineItem__c where QuoteIrai__c = :quoId Order by Item_Order__c, Id]) {
                         itemmap.put(item.Product2__c,item);
                     }
@@ -1542,10 +1589,10 @@
             q = New QuoteIrai__c();
         }else{
             // CHAN-BJQ4VZ 绮剧悽鎶�鏈� 2019/12/11 Start
-            List<QuoteIrai__c> qs = New List<QuoteIrai__c>();//obsap 鏂板缁忛攢鍟�1瀛楁 fy satrt Agency1_entrust__c,
+            List<QuoteIrai__c> qs = New List<QuoteIrai__c>();//obsap 鏂板缁忛攢鍟�1瀛楁 fy satrt Agency1_entrust__c,SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start cancelMultiyearInsurance__c,
             //XLIU-CFE8M7 銆愬鎵樸�戙�怭-OBSAP銆戞姤浠峰鎵樹换鍔℃敼鍠� fy  Noteplus__c
             //SWAG-CF589P銆愬鎵樸�戙�怭:OBSAP銆戞姤浠峰鎵樼浉鍏虫柊闇�姹傝瘎浼� fy Lead__c,Opportunity__c,
-            qs = [select Id,Account__c,Agency_Hospital_Link__c,Name,IraiUser__c,IraiSubject__c,Tender_information__c,Agency1_entrust__c,Noteplus__c,Lead__c,Opportunity__c,
+            qs = [select Id,Account__c,Agency_Hospital_Link__c,Name,IraiUser__c,IraiSubject__c,Tender_information__c,Agency1_entrust__c,Noteplus__c,Lead__c,Opportunity__c,cancelMultiyearInsurance__c,
                 Preferential_Trading_Price__c,Discount__c,Pricing__c,Unit_Price__c,Offer_Amount__c,TOTAL__c,MultiYearWarrantyTotalPrice__c,QuoteTotal_Page__c,Estimation_List_Price__c,
                 Contract__c,Print_HP_Name__c,Quote_Expiration_Date__c,Quote_Comment__c,IraiName__c,QuoteIrai_Status__c,QuoteProportion__c,Note__c,IraiComment__c
                 From QuoteIrai__c Where Id =:quoId];
@@ -1574,6 +1621,9 @@
         //obsap 鏂板缁忛攢鍟�1瀛楁 fy staty
         q.Agency1_entrust__c = quo.Agency1_entrust__c;
         //obsap 鏂板缁忛攢鍟�1瀛楁 fy staty
+        // SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start
+        q.cancelMultiyearInsurance__c = quo.cancelMultiyearInsurance__c;
+        // SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy end
         q.QuoteProportion__c = quo.QuoteProportion__c;
         q.CurrencyIsoCode = quo.CurrencyIsoCode;
         //XLIU-CFE8M7 銆愬鎵樸�戙�怭-OBSAP銆戞姤浠峰鎵樹换鍔℃敼鍠� fy start
@@ -1609,8 +1659,8 @@
         }
         //XLIU-CFE8M7 銆愬鎵樸�戙�怭-OBSAP銆戞姤浠峰鎵樹换鍔℃敼鍠� fy  Noteplus__c
         //SWAG-CF589P銆愬鎵樸�戙�怭:OBSAP銆戞姤浠峰鎵樼浉鍏虫柊闇�姹傝瘎浼� fy Lead__c,Opportunity__c,
-        quo =[ SELECT Id,Name,Cancel_Decide__c,CreatedDate, PriceRefreshDate__c,Quote_Print_Date__c,//obsap 鏂板缁忛攢鍟�1瀛楁 fy satrt Agency1_entrust__c,
-                    Quote_Date__c,QuoteToName__c,Quote_Expiration_Date__c,Quote_Comment__c,Tender_information__c,Agency1_entrust__c,Noteplus__c,Lead__c,Opportunity__c,
+        quo =[ SELECT Id,Name,Cancel_Decide__c,CreatedDate, PriceRefreshDate__c,Quote_Print_Date__c,//obsap 鏂板缁忛攢鍟�1瀛楁 fy satrt Agency1_entrust__c,SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start cancelMultiyearInsurance__c,
+                    Quote_Date__c,QuoteToName__c,Quote_Expiration_Date__c,Quote_Comment__c,Tender_information__c,Agency1_entrust__c,Noteplus__c,Lead__c,Opportunity__c,cancelMultiyearInsurance__c,
                     TOTAL__c,Discount__c,Pricing__c,Preferential_Trading_Price__c,Contract__c,LastIraiUser__c,MultiYearWarrantyTotalPrice__c,QuoteTotal_Page__c,Estimation_List_Price__c,
                     Print_HP_Name__c,Account__c,Agency_Hospital_Link__c,IraiUser__c,IraiSubject__c,CurrencyIsoCode,IraiName__c,QuoteIrai_Status__c,QuoteProportion__c,Note__c,IraiComment__c
                     FROM QuoteIrai__c Where Id =:q.Id];
@@ -1785,6 +1835,40 @@
     system.debug('filg====='+filg);
     return filg;
   }
+ //SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 start
+  //闃胯タ璧涘楠岃瘉
+  public String assdproductCheck(){
+    Boolean falg = false;
+    String str = 'OK';
+    List<Product2> axsdQuoteIItem = new List<Product2>();
+    List<Product2> QuoteIItem = new List<Product2>();
+    List<Id> Product2List = new List<Id>();
+    System.debug('activities111111!!!'+activities);
+    for(QELine aaa :activities){
+     if(String.isNotBlank(aaa.pageObject.Product2__c)){
+        Product2List.add(aaa.pageObject.Product2__c);
+     }
+    }
+    List<Product2> productlist = [select id,Is_DangerousChemicals__c from Product2 where id in:Product2List];  
+    for(Product2 pro :productlist){
+        System.debug('Is_DangerousChemicals__c111111!!!'+pro.Is_DangerousChemicals__c);
+        if(pro.Is_DangerousChemicals__c){
+            falg = true;
+            axsdQuoteIItem.add(pro);
+        }else if(!pro.Is_DangerousChemicals__c){
+            QuoteIItem.add(pro);
+        }
+    }
+    if(QuoteIItem.size() > 0 && axsdQuoteIItem.size() > 0){
+        str = '闃胯タ璧涘浜у搧涓嶈兘鍜屽叾浠栦骇鍝佷竴璧锋姤浠�';
+    }else{
+        if(falg){
+            str = OpportunityWebService.checkDangerItem(quo.Agency1_entrust__c);
+        }
+    }
+    return str;
+  }
+  //SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 end
 
     // CHAN-BJQ4VZ 绮剧悽鎶�鏈� 2019/12/11 Start
     public class QuoteBean {
diff --git a/force-app/main/default/classes/SI_NewQuoteEntryController.cls b/force-app/main/default/classes/SI_NewQuoteEntryController.cls
index 04bda2a..9d2c622 100644
--- a/force-app/main/default/classes/SI_NewQuoteEntryController.cls
+++ b/force-app/main/default/classes/SI_NewQuoteEntryController.cls
@@ -367,8 +367,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,
                         CreatedByid,Queto_Confirm_Date__c,
                         QuoteToName,Quote_Expiration_Date__c,Quote_Comment__c,Stocking_Price__c,Unit_Price__c,
@@ -433,6 +433,7 @@
             if (copyQuoId == null) {
                     quo = quoList[0];
                     quoteOwner = quo.CreatedByid;
+                   
                     //SWAG-C5DBAL  銆愬鎵樸�� [绱ф�SI璇环鑲栧瘨鏃犳硶淇敼鎶ヤ环鍗�  绮剧悽鎶�鏈�  2021/07/30 start
                     //娉ㄩ噴鍘熼�昏緫
                     if(quo.Queto_Confirm_Date__c != null ||
@@ -717,6 +718,11 @@
         }
         // vivek end
         system.debug('鍒濆鍖栨椂鐨勯泦鍚堬細'+activities);
+         //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;
      }
 
@@ -2017,7 +2023,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;
         }
@@ -2289,11 +2301,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;
@@ -2470,8 +2482,8 @@
             }
 
         } else {
-            List<Quote> qs = New List<Quote>();
-            qs = [select Id,OpportunityId,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,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,
@@ -2558,6 +2570,12 @@
         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 = '';
diff --git a/force-app/main/default/pages/NewQuoteEntry.page b/force-app/main/default/pages/NewQuoteEntry.page
index 7bdd385..eb484ac 100644
--- a/force-app/main/default/pages/NewQuoteEntry.page
+++ b/force-app/main/default/pages/NewQuoteEntry.page
@@ -1,6 +1,6 @@
 <!--<apex:page standardController="Quote" extensions="NewQuoteEntryController" sidebar="false" action="{!init}" id="Page">
 -->
-<apex:page controller="NewQuoteEntryController" sidebar="false" action="{!init}" id="Page">
+<apex:page controller="NewQuoteEntryController" sidebar="false" action="{!init}" id="Page" >
     <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
     <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
     <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
@@ -300,11 +300,12 @@
                     <tr>
                         <th style="text-align:right">{!IF(displayFlg,'浜у搧鏍囧噯瀹氫环鎬婚','')}</th>
                         <td style="text-align:right;"><apex:outputText id="Estimation_List_Price" style="display:{!IF(displayFlg, '', 'none')}" value="{0, number, ###,##0.00}"><apex:param value="{!qb.Estimation_List_Price}" /></apex:outputText></td>
-                        <th style="text-align:right;">{!IF(displayFlg,$Label.Total_Price,'')}</th>
-                        <td><apex:inputField id="quoTotalPrice" value="{!quo.QuoteTotal_Page__c}" style="text-align:right;" rendered="{!displayFlg}" onchange="quoteTotalPriceAction()"/></td>
+                        <th style="text-align:right;">{!IF(displayFlg,$Label.Total_Price,'')}</th><!--obsap 缁忛攢鍟�1鍚堝悓閲戦璁$畻 fy  html-disabled="true" -->
+                        <td><apex:inputField id="quoTotalPrice" value="{!quo.QuoteTotal_Page__c}" style="text-align:right;" rendered="{!displayFlg}" onchange="quoteTotalPriceAction()" html-disabled="true"/></td>
                         <th style="text-align:right;">{!IF(displayFlg,$Label.Contact_Price,'')}</th>
                             <!--    2018/09/28 CHAN-B4YAB8 缁忛攢鍟嗗崟浠疯绠� start -->
-                        <td><div class="requiredInput"><div class="requiredBlock"></div><apex:inputField id="Dealer_Final_Price" value="{!quo.Dealer_Final_Price_Page__c}" style="text-align:right;" rendered="{!displayFlg}" onChange="calFromContactPrice();setOCMAmount();quoteAgencyTotalPriceAction1('OCM鐩存帴閿�鍞�');"/></div></td>
+                             <!-- fy obsap  <div class="requiredBlock"> </div>-->
+                        <td><div class="requiredInput"><apex:inputField id="Dealer_Final_Price" value="{!quo.Dealer_Final_Price_Page__c}" style="text-align:right;" rendered="{!displayFlg}" onChange="calFromContactPrice();setOCMAmount();quoteAgencyTotalPriceAction1('OCM鐩存帴閿�鍞�');"/></div></td>
                             <!--    2018/09/28 CHAN-B4YAB8 缁忛攢鍟嗗崟浠疯绠� end -->
                         <th style="text-align:right;">{!IF(displayFlg,$Label.Forecast_Amounts,'')}</th>
                         <td style="text-align:right;"><apex:outputLabel id="Wholesale_Price" value="{!oppInfo.Wholesale_Price}" style="display:{!IF(displayFlg, '', 'none')}"/></td>
@@ -408,6 +409,21 @@
                     </apex:variable>
                     <!-- 澶栬锤澶氬勾淇� 鍙栨秷nodiscount 鍚堣  绮剧悽鎶�鏈� wql 2021/01/18 end -->
                 </tr>
+                <!-- SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start -->
+                <tr>
+                    <th style="text-align:right;width:30px;">&nbsp;</th>
+                    <th style="text-align:left;width:50px;">{!$ObjectType.Quote.fields.QuotationChange__c.label}:&nbsp;</th>
+                    <td style="width:190px;"><apex:inputField id="QuotationChange" value="{!quo.QuotationChange__c}"  style="width:205px; text-align:left;" />
+                    </td>
+                    <th style="text-align:right;width:50px;">{!$ObjectType.Quote.fields.MainEngineWithoutMonitor__c.label}:&nbsp;</th>
+                    <td style="width:50px;"><apex:inputField id="RemarksOnChanges" value="{!quo.MainEngineWithoutMonitor__c}"  style=" text-align:center;" />
+                    </td>
+                    <th style="text-align:right;width:50px;">
+                        {!$ObjectType.Quote.fields.Interdepartmental__c.label}
+                    :&nbsp;</th>
+                    <td style="width:200px;"><apex:inputField id="Interdepartmental" value="{!quo.Interdepartmental__c}" onchange="callFromCancelgurantee_MD();" style="text-align:right;width:30px;" /></td>
+                </tr>
+                <!-- SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy end -->
                 <tr>
                     <td>&nbsp;</td>
                 </tr>
@@ -491,7 +507,10 @@
                         <apex:outputLabel id="indexNo" value="{!IF(s.PageObject.Id__c==null,null,s.lineNo + 1)}" style="width:10px;"/>
                     </td>
                     <td class="dataCell" style="text-align:center;width:125px;">
-                        <apex:inputText id="Assert" style="width:95%;" value="{!s.Asset_Model}" onclick="searchProduct('{!s.lineNo}',this.value)" />
+                        <!-- Celon璇环淇敼 2022-04-24 ssm start -->
+                        <!-- <apex:inputText id="Assert" style="width:95%;" value="{!s.Asset_Model}" onclick="searchProduct('{!s.lineNo}',this.value)" /> -->
+                        <apex:inputText id="Assert" style="width:95%;" value="{!s.Asset_Model}" onclick="searchProduct('{!s.lineNo}',this.value,'{!oppInfo.CelonOpportunity}')" />
+                        <!-- Celon璇环淇敼 2022-04-24 ssm end -->
                     </td>
                     <td class="dataCell" id="{!Text(cnt-1)}:td_Status__c" style="width:70px;text-align: center;">
                         <apex:outputField style="width:75px;" id="Status__c" value="{!s.PageObject.SFDA_Status__c}"/>
diff --git a/force-app/main/default/pages/NewQuoteIrai.page b/force-app/main/default/pages/NewQuoteIrai.page
index 8c32313..b55d6d4 100644
--- a/force-app/main/default/pages/NewQuoteIrai.page
+++ b/force-app/main/default/pages/NewQuoteIrai.page
@@ -1,4 +1,4 @@
-<apex:page controller="NewQuoteIraiController" sidebar="false" action="{!init}" id="Page">
+<apex:page controller="NewQuoteIraiController" sidebar="false" action="{!init}" id="Page" >
     <apex:stylesheet value="{!URLFOR($Resource.jquerysuggestcss)}"/>
     <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
     <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
@@ -85,11 +85,19 @@
         }
         
         function iraiJs() {
-            var username = j$(escapeVfId("Page:mainForm:block:IraiUser")).val();
-            var userid = j$(escapeVfId("Page:mainForm:block:IraiUser_lkid")).val();
-            
+            // var username = j$(escapeVfId("Page:mainForm:block:IraiUser")).val();
+            // var userid = j$(escapeVfId("Page:mainForm:block:IraiUser_lkid")).val();
+            var username1 = j$(escapeVfId("Page:mainForm:block:j_id43:IraiUser")).val();
+            var userid = j$(escapeVfId("Page:mainForm:block:j_id43:IraiUser_lkid")).val();
+            var username2 = j$(escapeVfId("Page:mainForm:block:j_id46:IraiUser")).val();
+            //obsap 鏂板缁忛攢鍟�1瀛楁 fy start
+            var Agency1entrustc = j$(escapeVfId("Page:mainForm:block:SalesName1")).val();
+            debugger
+            //obsap 鏂板缁忛攢鍟�1瀛楁 fy end
             sforce.connection.sessionId = Session_ID;
-            
+            if(!userid&&username2){
+                userid=username2;
+            }
             var resultSet = sforce.connection.query( "SELECT Email,SFDCPosition_C__c FROM User WHERE Id = '" + userid + "'");
             var records = resultSet.getArray("records");
             
@@ -100,20 +108,38 @@
                 mail = iraiUser.Email;
                 SFDCPosition = iraiUser.SFDCPosition_C__c;
             }
-            if (mail != null && mail.length > 0) {
-               if (SFDCPosition != '钀ヤ笟鍔╃悊'){
-                   alert('璇烽�夋嫨瀵瑰簲鐨勮惀涓氬姪鐞�.');
-                   unblockUI();              
-               }
-               else if (window.confirm('纭畾瑕佸鎵樿浜哄憳鍚楋紵\n' + mail)) {
-                    QuoteIrai();
-                    } else {
-                       unblockUI();
+            //obsap 鏂板缁忛攢鍟�1瀛楁 fy start
+            if(Agency1entrustc != null&&Agency1entrustc !=""&&Agency1entrustc.length > 0){
+                if (mail != null && mail.length > 0) {
+                    // var Salesdepartment = '{!loginUser.Salesdepartment_text__c}';
+                    //fy 20220512
+                    var Salesdepartment = {!obsflag};
+                    console.log('Salesdepartment:' + Salesdepartment);
+                    var positioncheck = true;
+                    // if (Salesdepartment == '5.鍗庝笢' || Salesdepartment == '6.鍗庡崡') {
+                    //fy 20220512
+                    if (Salesdepartment) {
+                        mail = '{!obsap_mail}';
+                        positioncheck = false;
                     }
-            } else {
-                alert('璇烽�夋嫨濮旀墭浜哄憳.');
+                    if (positioncheck && SFDCPosition != '钀ヤ笟鍔╃悊'){
+                        alert('璇烽�夋嫨瀵瑰簲鐨勮惀涓氬姪鐞�.');
+                        unblockUI();              
+                    }
+                    else if (window.confirm('纭畾瑕佸鎵樿浜哄憳鍚楋紵\n' + mail)) {
+                        QuoteIrai();
+                    } else {
+                        unblockUI();
+                    }
+                } else {
+                    alert('璇烽�夋嫨濮旀墭浜哄憳.');
+                    unblockUI();
+                }
+            }else {
+                alert('璇烽�夋嫨绗竴缁忛攢鍟�.');
                 unblockUI();
             }
+            //obsap 鏂板缁忛攢鍟�1瀛楁 fy end
         }
         
         function openpdf(type) {
@@ -289,18 +315,32 @@
                 <!-- CHAN-BJQ4VZ 绮剧悽鎶�鏈� 2019/12/10 End -->
                 <table border="0">
                     <tr>
-                        <th style="width:40px;">&nbsp;</th>
+                        <th style="width:50px;">&nbsp;</th>
                         <!-- 浜у搧閰嶅妫�绱㈡寜閽� -->
-                        <td style="width:150px;"><apex:commandButton id="SetProduct" onclick="searchSetProduct();return false;" value="{!$Label.Set_Product}" rerender="dummy"/></td>
+                        <td style="width:100px;"><apex:commandButton id="SetProduct" onclick="searchSetProduct();return false;" value="{!$Label.Set_Product}" rerender="dummy"/></td>
                         <!-- excel 瀵煎嚭鎸夐挳 -->
-                        <td style="width:150px;"><apex:commandButton onclick="openQuoteExcelImport(event);return false;" value="{!$Label.Excel_Import}" rerender="dummy"/></td>
+                        <td style="width:100px;"><apex:commandButton onclick="openQuoteExcelImport(event);return false;" value="{!$Label.Excel_Import}" rerender="dummy"/></td>
                         <td style="text-align:right;width:80px;"><apex:commandButton rerender="dummy" id="Btn_RowDelete" onclick="radioChecker2('del');return false;" value="{!$Label.deleteLabel}" style="width:60px;"/></td>
                         <td style="width:150px;">
                             <apex:commandButton rerender="dummy" id="Btn_RowUp" onclick="radioChecker2('up');return false;" value="{!$Label.Row_Up}" style="width:60px;"/>
                             <apex:commandButton rerender="dummy" id="Btn_RowDown" onclick="radioChecker2('down');return false;" value="{!$Label.Row_Down}" style="width:60px;"/>
                         </td>
                         <th style="text-align:right;width:80px;">{!$ObjectType.QuoteIrai__c.fields.IraiUser__c.Label}</th>
+                        <!-- fy 20220512 -->
+                        <!-- <apex:variable value="identif1" var="identif1" rendered="{!!(loginUser !=null&&loginUser.Salesdepartment_text__c != null&&loginUser.Salesdepartment_text__c != ''&&(loginUser.Salesdepartment_text__c == '5.鍗庝笢' || loginUser.Salesdepartment_text__c == '6.鍗庡崡'))}"  > -->
+                        <apex:variable value="identif1" var="identif1" rendered="{!!(loginUser !=null&&loginUser.Salesdepartment_text__c != null&&loginUser.Salesdepartment_text__c != ''&& obsflag)}"  >
+
                         <td style="width:150px;"><apex:outputPanel id="IraiUserId"><apex:inputField id="IraiUser" value="{!quo.IraiUser__c}"/></apex:outputPanel></td>
+                        </apex:variable>
+                        <!-- fy 20220512 -->
+                        <!-- <apex:variable value="identif" var="identif" rendered="{!loginUser !=null&&loginUser.Salesdepartment_text__c != null&&loginUser.Salesdepartment_text__c != ''&&(loginUser.Salesdepartment_text__c == '5.鍗庝笢' || loginUser.Salesdepartment_text__c == '6.鍗庡崡')}"  > -->
+                        <apex:variable value="identif" var="identif" rendered="{!loginUser !=null&&loginUser.Salesdepartment_text__c != null&&loginUser.Salesdepartment_text__c != ''&& obsflag}"  >
+
+                        <!-- <th style="text-align:right;width:20px;">obsap浜哄憳</th> -->
+                        <td style="text-align:center;width:20px;"><apex:selectList value="{!quo.IraiUser__c}" size="1" style="width:120px" id="IraiUser" onchange="ObsapUsersChange()"><apex:selectOptions value="{!ObsapUsers}" id="obsapUsersList"/></apex:selectList></td>
+                        </apex:variable>
+
+
                         <th style="text-align:right;width:80px;">{!$ObjectType.QuoteIrai__c.fields.LastIraiUser__c.Label}</th>
                         <td style="text-align:center;width:70px;"><apex:outputField id="LastIraiUser" value="{!quo.LastIraiUser__c}"/></td>
                         <!-- 2020/02/18  绮剧悽鎶�鏈�  闊╅儴闀挎彁鍑哄厛闅愯棌 娌″繀瑕�  Start-->
@@ -318,33 +358,58 @@
                     <td>&nbsp;&nbsp;</td>
                 </tr>
                 <tr>
-                     <td style="text-align:right;width:100px;"></td>
-                     <th style="text-align:right;width:50px;">
-                        {!$ObjectType.QuoteIrai__c.fields.MultiYearWarrantyTotalPrice__c.Label}
-                    :&nbsp;</th>
-                    <td style="width:470px;">
-                        <apex:outputtext id="MultiYearWarrantyTotalPrice_out" value="{0, number, ###,##0.00}" 
-                        style="text-align:right;width:180px;">
-                            <apex:param value="{!qb.MultiYearWarrantyTotalPrice}"/>
-                        </apex:outputtext>
-                    </td>
-                    <!-- <apex:variable id="contractWarranty" value="{!1}" var="abc" rendered="{!IF(trade   == '鍐呰部',true,false)}">
-                    
-                    <th style="text-align:right;width:50px;">
-                        {!$ObjectType.Quote.fields.MultiYearWarrantyTotalPrice__c.label}
-                    :&nbsp;</th>
-                    <td style="width:470px;">
-                        <apex:outputtext id="MultiYearWarrantyTotalPrice_out" value="{0, number, ###,##0.00}" 
-                        style="text-align:right;width:180px;">
-                            <apex:param value="{!quo.MultiYearWarrantyTotalPrice__c}"/>
-                        </apex:outputtext>
-                    </td>
-                    <th style="text-align:right;width:50px;">
-                        {!$ObjectType.Quote.fields.multiYearWarranty__c.label}
-                    :&nbsp;</th>
-                    <td style="width:200px;"><apex:inputField id="multiYearWarranty" value="{!quo.multiYearWarranty__c}" onchange="callFromCancelgurantee_MD();" style="text-align:right;width:30px;" /></td>
-                    </apex:variable> -->
+                    <td style="text-align:right;width:50px;"></td>
+                    <th style="text-align:right;width:50px;" rowspan="2">
+                       {!$ObjectType.QuoteIrai__c.fields.MultiYearWarrantyTotalPrice__c.Label}
+                   :&nbsp;</th>
+                   <!-- <td style="width:470px;"> -->
+                       <!--obsap 鏂板缁忛攢鍟�1瀛楁 fy start-->
+                   <td style="width:10px;" rowspan="2">
+                       <!--obsap 鏂板缁忛攢鍟�1瀛楁 fy end-->
+                       <apex:outputtext id="MultiYearWarrantyTotalPrice_out" value="{0, number, ###,##0.00}" 
+                       >
+                       <!--obsap 鏂板缁忛攢鍟�1瀛楁 fy start-->
+                       <!-- style="text-align:right;width:180px;"> -->
+                       <!--obsap 鏂板缁忛攢鍟�1瀛楁 fy end-->
+                           <apex:param value="{!qb.MultiYearWarrantyTotalPrice}"/>
+                       </apex:outputtext>
+                   </td>
+                   <!--obsap 鏂板缁忛攢鍟�1瀛楁 fy start-->
+                   <th style="width:100px;">&nbsp;</th>
+                   <td style="text-align:right;width:50px;"></td>
+                   <td style="text-align:right;width:50px;"></td>
+                   <th colspan="2" style="width:260px;text-align:center;">{!$Label.Sales_Name}</th>
+                   <!--obsap 鏂板缁忛攢鍟�1瀛楁 fy end-->
+                   <!-- <apex:variable id="contractWarranty" value="{!1}" var="abc" rendered="{!IF(trade   == '鍐呰部',true,false)}">
+                   
+                   <th style="text-align:right;width:50px;">
+                       {!$ObjectType.Quote.fields.MultiYearWarrantyTotalPrice__c.label}
+                   :&nbsp;</th>
+                   <td style="width:470px;">
+                       <apex:outputtext id="MultiYearWarrantyTotalPrice_out" value="{0, number, ###,##0.00}" 
+                       style="text-align:right;width:180px;">
+                           <apex:param value="{!quo.MultiYearWarrantyTotalPrice__c}"/>
+                       </apex:outputtext>
+                   </td>
+                   <th style="text-align:right;width:50px;">
+                       {!$ObjectType.Quote.fields.multiYearWarranty__c.label}
+                   :&nbsp;</th>
+                   <td style="width:200px;"><apex:inputField id="multiYearWarranty" value="{!quo.multiYearWarranty__c}" onchange="callFromCancelgurantee_MD();" style="text-align:right;width:30px;" /></td>
+                   </apex:variable> -->
+               </tr>
+               <!--obsap 鏂板缁忛攢鍟�1瀛楁 fy start-->
+               <tr>
+                <td ></td>
+                <td ></td>
+                <td ></td>
+                <th style="width:100px;text-align:right;">{!$Label.Sales_Name1}</th>
+                <td colspan="2" style="width:260px;text-align:right;"><apex:inputField style="width:230px;" id="SalesName1"  value="{!quo.Agency1_entrust__c}"   onChange=""/></td>
+                <!-- SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start -->
+                <th style="width:100px;text-align:right;">鍙栨秷澶氬勾淇�</th>
+                <td colspan="2" style="text-align:left;"><apex:inputField id="cancelMultiyearInsurance"  value="{!quo.cancelMultiyearInsurance__c}"   /></td>
+                <!-- SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy end -->
                 </tr>
+                <!--obsap 鏂板缁忛攢鍟�1瀛楁 fy end-->
                 <tr>
                     <td>&nbsp;</td>
                 </tr>
@@ -473,9 +538,11 @@
                         <table border="0">
                             <tr>
                                 <th style="width:15px">&nbsp;</th>
-                                <td style="width:100px;" align="right"><apex:commandButton id="QuoteIraiBtn" action="{!checkIraiUser}" reRender="IraiUserId,message1" onclick="blockme();" oncomplete="iraiJs();return false;" value="鍙戦�佸鎵橀偖浠�" style="width:90px;"/></td>
-                                <td style="width:100px;" align="right"><apex:commandButton action="{!checkIraiUser}" reRender="IraiUserId,hiddenQuoid,message1" onclick="blockme();" oncomplete="save2btn();return false;" value="{!$Label.Save_Button}" style="width:90px;" disabled="{Save_button}" /></td>
-                                <td style="width:100px;" align="right"><apex:commandButton onclick="oppReflection2btn();return false;" rerender="hiddenQuoid" value="{!$Label.Opp_Button}" style="width:90px;" disabled="{Save_button}"/></td>
+                                <!-- SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start -->
+                                <td style="width:100px;" align="right"><apex:commandButton id="QuoteIraiBtn" action="{!checkIraiUser}" reRender="IraiUserId,message1" onclick="blockme();" oncomplete="iraiJs();return false;" value="鍙戦�佸鎵橀偖浠�" style="width:90px;" disabled="{!Save_button}"/></td>
+                                <!-- SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy end -->
+                                <td style="width:100px;" align="right"><apex:commandButton action="{!checkIraiUser}" reRender="IraiUserId,hiddenQuoid,message1" onclick="blockme();" oncomplete="save2btn();return false;" value="{!$Label.Save_Button}" style="width:90px;" disabled="{!Save_button}" /></td>
+                                <td style="width:100px;" align="right"><apex:commandButton onclick="oppReflection2btn();return false;" rerender="hiddenQuoid" value="{!$Label.Opp_Button}" style="width:90px;" disabled="{!Save_button}"/></td>
                                 <td style="width:100px;" align="right"><apex:commandButton action="{!Back}" rerender="hiddenQuoid" value="涓嶄繚瀛橈紙杩斿洖锛�" style="width:90px;"/></td>
                                 <td style="width:100px;" align="right"><apex:commandButton value="浜у搧璇曠敤璇勪环OPD" style="width:95px;" onclick="openpdf('OPD');return false;" disabled="{!pdf_button}"/></td>
                                 <td style="width:100px;" align="right"><apex:commandButton value="浜у搧璇曠敤璇勪环SIS" style="width:95px;" onclick="openpdf('SIS');return false;" disabled="{!pdf_button}"/></td>
diff --git a/force-app/main/default/pages/SI_NewQuoteEntry.page b/force-app/main/default/pages/SI_NewQuoteEntry.page
index a08a769..4205ed6 100644
--- a/force-app/main/default/pages/SI_NewQuoteEntry.page
+++ b/force-app/main/default/pages/SI_NewQuoteEntry.page
@@ -85,6 +85,7 @@
             window.open('/apex/SI_CsvModel?id='+encodeURI(a),'name','features','replace');
         }
         function QuoteConfirmJs() {
+            debugger
             // body...
             blockme();
             //SWAG-C5DBAL  銆愬鎵樸�� [绱ф�SI璇环鑲栧瘨鏃犳硶淇敼鎶ヤ环鍗� 绮剧悽鎶�鏈� 2021/07/30 start 
@@ -92,9 +93,22 @@
             var profileId = '{!$User.profileId}';
             //鑾峰彇鑷畾涔夋爣绛� 绯荤粺绠$悊鍛樼畝妗�
             var adminId = '{!$Label.ProfileId_SystemAdmin}';
+            //XLIU-CHRD8P銆愬鎵樸�戙�怬BSAP銆戣缁橭BSAP绠�妗BA2_璇环绠$悊 SI璇环鎶ヤ环鍗曠‘璁ゆ潈闄� fy start 
+            var adminId2 = '{!$Label.ProfileId_SystemAdmin2}';
+            var flag=true;
+            var profileId15=profileId;
+            if(profileId&&profileId.length>15){
+                profileId15=profileId.substring(0,15);
+            }
+            if(adminId2.includes(profileId15)){
+                flag=false;
+            }else{
+                flag=true;
+            }
+            //XLIU-CHRD8P銆愬鎵樸�戙�怬BSAP銆戣缁橭BSAP绠�妗BA2_璇环绠$悊 SI璇环鎶ヤ环鍗曠‘璁ゆ潈闄� fy end 
             //鍙湁绯荤粺绠$悊鍛樺彲浠ョ偣鍑�
-            if(profileId!=adminId){
-                alert('鍙湁绯荤粺绠$悊鍛樻湁鏉冮檺纭鎶ヤ环锛�');
+            if(profileId!=adminId&&flag){
+                alert('鍙湁绯荤粺绠$悊鍛樺拰钀ヤ笟鍔╃悊鏈夋潈闄愮‘璁ゆ姤浠凤紒');
                 unblockUI();
             }else{
                 QuoteConfirm();
@@ -340,8 +354,8 @@
                     <tr>
                         <th style="text-align:right">{!IF(displayFlg,$Label.Total_ListPrice,'')}</th>
                         <td style="text-align:right;"><apex:outputText id="Estimation_List_Price" style="display:{!IF(displayFlg, '', 'none')}" value="{0, number, ###,##0.00}"><apex:param value="{!qb.Estimation_List_Price}" /></apex:outputText></td>
-                        <th style="text-align:right;">{!IF(displayFlg,$Label.Total_Price,'')}</th>
-                        <td><apex:inputField id="quoTotalPrice" value="{!quo.QuoteTotal_Page__c}" style="text-align:right;" rendered="{!displayFlg}" onchange="quoteTotalPriceAction()"/></td>
+                        <th style="text-align:right;">{!IF(displayFlg,$Label.Total_Price,'')}</th><!--obsap 缁忛攢鍟�1鍚堝悓閲戦璁$畻 fy  html-disabled="true" -->
+                        <td><apex:inputField id="quoTotalPrice" value="{!quo.QuoteTotal_Page__c}" style="text-align:right;" rendered="{!displayFlg}" onchange="quoteTotalPriceAction()" html-disabled="true"/></td>
                         <th style="text-align:right;">{!IF(displayFlg,$Label.Contact_Price,'')}</th>
 
                             <!--    2018/09/28 CHAN-B4YAB8 缁忛攢鍟嗗崟浠疯绠� start -->
@@ -449,6 +463,21 @@
                         </center>
                     </div>
                     </td>
+                    <!-- SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start -->
+                    <tr>
+                        <th style="text-align:right;width:30px;">&nbsp;</th>
+                        <th style="text-align:left;width:50px;">{!$ObjectType.Quote.fields.QuotationChange__c.label}:&nbsp;</th>
+                        <td style="width:190px;"><apex:inputField id="QuotationChange" value="{!quo.QuotationChange__c}"  style="width:80px; text-align:right;" />
+                        </td>
+                        <th style="text-align:left;width:50px;">{!$ObjectType.Quote.fields.MainEngineWithoutMonitor__c.label}:&nbsp;</th>
+                        <td style="width:500px;"><apex:inputField id="RemarksOnChanges" value="{!quo.MainEngineWithoutMonitor__c}"  style="width:450px; text-align:left;" />
+                        </td>
+                        <th style="text-align:right;width:50px;">
+                            {!$ObjectType.Quote.fields.Interdepartmental__c.label}
+                        :&nbsp;</th>
+                        <td style="width:200px;"><apex:inputField id="Interdepartmental" value="{!quo.Interdepartmental__c}"  style="text-align:right;width:30px;" /></td>
+                    </tr>
+                    <!-- SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy end -->
                 <tr>
                     <td>&nbsp;</td>
                 </tr>
@@ -532,7 +561,7 @@
                                         <apex:outputLabel id="indexNo" value="{!IF(s.PageObject.Id__c==null,null,s.lineNo + 1)}" style="width:10px;"/>
                                     </td>
                                     <td class="dataCell" style="text-align:center;width:150px;">
-                                        <apex:inputText id="Assert" style="width:120px;" value="{!s.Asset_Model}" onclick="searchProduct('{!s.lineNo}',this.value)" />
+                                        <apex:inputText id="Assert" style="width:120px;" value="{!s.Asset_Model}" onclick="searchProduct('{!s.lineNo}',this.value, '')" />
                                     </td>
                                     <td class="dataCell" id="{!Text(cnt-1)}:td_Status__c" style="width:100px;">
                                         <apex:outputField style="width:75px;" id="Status__c" value="{!s.PageObject.SFDA_Status__c}"/>

--
Gitblit v1.9.1