Thhto
2022-11-17 ea6a4eec81a6a74e214aefc5971d701242c3e7d3
 SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy
6个文件已修改
560 ■■■■ 已修改文件
force-app/main/default/classes/NewQuoteEntryController.cls 239 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NewQuoteIraiController.cls 120 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/SI_NewQuoteEntryController.cls 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/NewQuoteEntry.page 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/NewQuoteIrai.page 97 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/SI_NewQuoteEntry.page 39 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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 【委托】【OBSAP-报价委托】报价委托项目改善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 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start
quo.Offer_Amount__c = true;
quo.TOTAL__c = true;
quo.Preferential_Gurantee_Period__c = true;
//SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy end
    return null;
  }
  //Search Events============================================================
  // TODO ManualEntryと同様、jsにて解決できる、ここでwebserviceだけを実装、今後 by katsu
@@ -1254,6 +1264,8 @@
    for (QELine t : tmpactivities) {
      if (i == j) {
        Map<String, Product2> mpProduct2 = new Map<String, Product2>();                     // keyがProductCodeです。
        // 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,6 +1840,7 @@
      errorflg = false;
      errormessage = null;
      //20220214 fy lastbuy start 
      if (!oppInfo.is_changed_opp) {
      if(!ReservedProductVerification()){
        system.debug('flglastbuy++++'+flglastbuy);
        if(flglastbuy==1){
@@ -1808,6 +1855,7 @@
          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 【委托】【紧急】询价GZ-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 【委托】【紧急】询价GZ-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 【委托】【OBSAP-报价委托】报价委托项目改善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 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start
      q.QuotationChange__c = quo.QuotationChange__c;
      q.MainEngineWithoutMonitor__c = quo.MainEngineWithoutMonitor__c;
      q.Interdepartmental__c = quo.Interdepartmental__c;
      //SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善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('○○○○○Save1○○○○○');
@@ -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【FY23询价改善】-统计主机台数 start
            ,StageName ,OlyNumberHosts__c
            // lt 20221008 SWAG-CHL5XA【FY23询价改善】-统计主机台数 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【FY23询价改善】-统计主机台数 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【FY23询价改善】-统计主机台数 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('○○○○○Save3○○○○○');
@@ -3041,7 +3211,10 @@
        //価格、単位、小計、OCM売上予測金額(税抜)、価格表
        List<OpportunityLineItem> ols = New List<OpportunityLineItem>();
        OpportunityLineItem ol = New OpportunityLineItem();
        ols = [select Id from OpportunityLineItem Where OpportunityId = :oppid];
        // lt 20221008 SWAG-CHL5XA【FY23询价改善】-统计主机台数 end
        ols = [select Id, Quantity from OpportunityLineItem Where OpportunityId = :oppid];  //update
        System.debug('lt123询价产品: ' + ols);
        // lt 20221008 SWAG-CHL5XA【FY23询价改善】-统计主机台数 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【FY23询价改善】
                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オブジェクト追加
force-app/main/default/classes/NewQuoteIraiController.cls
@@ -6,6 +6,9 @@
    public Id quoId {get;set;}
    public String oppid;
    public String leadid;
    //SWAG-CKDATG【委托】【OBSAP-报价委托】报价委托项目改善1 fy start
    public String tenderid;
    //SWAG-CKDATG【委托】【OBSAP-报价委托】报价委托项目改善1 fy end
    public Boolean productStatusUpdated {get;set;}               // 状態更新、{!$Label.Status_Update} を押下したかどうか
    public Boolean changedAfterPrint {get;set;}                  // true の場合、画面に confirm メッセージが表示します。quoIdを新しい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 【委托】【OBSAP-报价委托】报价委托项目改善1 start
    public String erroraxsdmodel { get; set; }
    //SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 end
    public String excel_text {get;set;}
    public Integer select_index {get;set;}                       // excelImport専用ですが、jsにて制御することになるので、TODO 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【委托】【OBSAP-报价委托】报价委托项目改善1 fy start
        // String tenderid = System.currentPageReference().getParameters().get('tenderid');
        tenderid = System.currentPageReference().getParameters().get('tenderid');
        //SWAG-CKDATG【委托】【OBSAP-报价委托】报价委托项目改善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【委托】【OBSAP-报价委托】报价委托项目改善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【委托】【OBSAP-报价委托】报价委托项目改善1 fy end
            //XLIU-CFE8M7 【委托】【P-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 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start
            // if (String.isNotBlank(tenderid)) {
            if (String.isNotBlank(tenderid)&&String.isBlank(leadid)) {
            // SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善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 【委托】【P-OBSAP】报价委托任务改善 fy  Noteplus__c
            //SWAG-CF589P【委托】【P: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 【委托】【OBSAP-报价委托】报价委托项目改善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 【委托】【OBSAP-报价委托】报价委托项目改善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 【委托】【OBSAP-报价委托】报价委托项目改善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 【委托】【OBSAP-报价委托】报价委托项目改善1 fy end
        system.debug('===fff==='+quo.QuoteIrai_Status__c);
        system.debug('===ccc==='+this.Save_button);
        //XLIU-CFE8M7 【委托】【P-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【委托】【OBSAP-报价委托】报价委托项目改善1 fy start
            if (!String.isBlank(tenderid)&&!description.contains('招标项目') ) {
                description += '\r\n' + '招标项目' + ':' + baseUrl + '/' + tenderid;
            }
            //SWAG-CKDATG【委托】【OBSAP-报价委托】报价委托项目改善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 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start
            todoSubject += quo.cancelMultiyearInsurance__c=='不要' ?',取消多年保':',需要多年保';
            // if (quo.cancelMultiyearInsurance__c=='不要') {
            //     todoSubject += ',取消多年保';
            // }else{
            //     todoSubject += ',需要多年保';
            // }
            // SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy end
            // String taskid = '';
            // 改成对多人的
            // if (tasks.size() > 0) {
@@ -1191,8 +1229,8 @@
                // CHAN-BJQ4VZ 精琢技术 2019/12/11 Start
            //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy  Noteplus__c
            //SWAG-CF589P【委托】【P: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 【委托】【OBSAP-报价委托】报价委托项目改善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 【委托】【OBSAP-报价委托】报价委托项目改善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 【委托】【OBSAP-报价委托】报价委托项目改善1 start
        String resalt = assdproductCheck();
        if(resalt!='OK'){
            errorflg = true;
            errormessage = resalt ;
            return false;
        }
        //SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善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 【委托】【OBSAP-报价委托】报价委托项目改善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 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start cancelMultiyearInsurance__c,
            //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy  Noteplus__c
            //SWAG-CF589P【委托】【P: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 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start
        q.cancelMultiyearInsurance__c = quo.cancelMultiyearInsurance__c;
        // SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy end
        q.QuoteProportion__c = quo.QuoteProportion__c;
        q.CurrencyIsoCode = quo.CurrencyIsoCode;
        //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy start
@@ -1609,8 +1659,8 @@
        }
        //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy  Noteplus__c
        //SWAG-CF589P【委托】【P: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 【委托】【OBSAP-报价委托】报价委托项目改善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 【委托】【OBSAP-报价委托】报价委托项目改善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 【委托】【OBSAP-报价委托】报价委托项目改善1 end
    // CHAN-BJQ4VZ 精琢技术 2019/12/11 Start
    public class QuoteBean {
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 【委托】【OBSAP-报价委托】报价委托项目改善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 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start
         quo.Offer_Amount__c = true;
         quo.TOTAL__c = true;
         quo.Preferential_Gurantee_Period__c = true;
         //SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善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 【委托】【OBSAP-报价委托】报价委托项目改善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 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start
        q.QuotationChange__c = quo.QuotationChange__c;
        q.MainEngineWithoutMonitor__c = quo.MainEngineWithoutMonitor__c;
        q.Interdepartmental__c = quo.Interdepartmental__c;
        //SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy end
        /*
        if (hasType3Machine) {
            q.Installation_location__c = '';
force-app/main/default/pages/NewQuoteEntry.page
@@ -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 【委托】【OBSAP-报价委托】报价委托项目改善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 【委托】【OBSAP-报价委托】报价委托项目改善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}"/>
force-app/main/default/pages/NewQuoteIrai.page
@@ -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,8 +108,21 @@
                mail = iraiUser.Email;
                SFDCPosition = iraiUser.SFDCPosition_C__c;
            }
            //obsap 新增经销商1字段 fy start
            if(Agency1entrustc != null&&Agency1entrustc !=""&&Agency1entrustc.length > 0){
            if (mail != null && mail.length > 0) {
               if (SFDCPosition != '营业助理'){
                    // 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;
                    }
                    if (positioncheck && SFDCPosition != '营业助理'){
                   alert('请选择对应的营业助理.');
                   unblockUI();              
               }
@@ -114,6 +135,11 @@
                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,16 +358,28 @@
                    <td>&nbsp;&nbsp;</td>
                </tr>
                <tr>
                     <td style="text-align:right;width:100px;"></td>
                     <th style="text-align:right;width:50px;">
                    <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;">
                   <!-- <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}" 
                        style="text-align:right;width:180px;">
                       >
                       <!--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;">
@@ -345,6 +397,19 @@
                    <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 【委托】【OBSAP-报价委托】报价委托项目改善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 【委托】【OBSAP-报价委托】报价委托项目改善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 【委托】【OBSAP-报价委托】报价委托项目改善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 【委托】【OBSAP-报价委托】报价委托项目改善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>
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【委托】【OBSAP】请给OBSAP简档OBA2_询价管理 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【委托】【OBSAP】请给OBSAP简档OBA2_询价管理 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 【委托】【OBSAP-报价委托】报价委托项目改善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 【委托】【OBSAP-报价委托】报价委托项目改善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}"/>