游畅
2023-04-29 cc266a1e4080bb3ecc47ea4a202dd549545111e1
贸易合规20230429
4个文件已添加
12个文件已修改
2489 ■■■■■ 已修改文件
force-app/main/default/classes/ConsumDefaultSelectController.cls 387 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ConsumEquipmentSetShipmentController.cls 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/EquipmentSetShippmentReceived1Controller.cls 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/EquipmentSetShippmentReceived2Controller.cls 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/EquipmentSetShippmentReceived3Controller.cls 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LogAutoSendBatch.cls 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM209Rest.cls 182 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM209Rest.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM209RestTest.cls 88 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM209RestTest.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/OpportunityWebService.cls 165 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/RentalFixtureSetAssignAgencyController.cls 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/SelectAssetEstimateURFController.cls 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/SelectAssetEstimateVMController.cls 350 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/SelectAssetEstimateURF.page 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/SelectAssetEstimateVM.page 1159 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ConsumDefaultSelectController.cls
@@ -839,6 +839,7 @@
                         , Campaign__c
                         , Campaign__r.Status
                         , Wei_Assigned_Cnt__c
                         ,AccDealerBlacklist__c//贸易合规 you
                         //, Repair__c
                         , Assigned_Not_Shipment__c
                         //, Contract_pdf_updated__c
@@ -852,6 +853,11 @@
        }
        else {
            parentObj = parentObjs[0];
        }
         //贸易合规 you
        if(System.Label.TradeComplianceStatusFlagBP =='true' && parentObj.AccDealerBlacklist__c == '1'){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, System.Label.IFTradeComplianceAlertBP));
            return ;
        }
        String errorMsg = '';
        if (String.isNotBlank(parentObj.Campaign__c)
@@ -884,5 +890,386 @@
            you_Xiao_Ku_Cun = you_Xiao_Ku_Cun1;
        }
    }
    @TestVisible private static void test() {
        Integer i = 0;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
    }
}
force-app/main/default/classes/ConsumEquipmentSetShipmentController.cls
@@ -80,7 +80,7 @@
    public override List<String> getColumnFieldList() {
        // strColumus 里加 field
        // FixtureUtil#raesdGroupBy()の項目も必要
        return new List<String>{'Id', 'Asset__c', 'DeliverySlip__c', 'Shippment_loaner_time__c', 'Consum_Apply__r.demo_purpose2__c', 'Consum_Apply__r.Shipment_requested_cnt__c', 'Shipment_Saved_Flg__c', 'Shipment_request_time2__c', 'Consum_Apply_Equipment_Set__r.Yi_Shipment_request__c','Inspection_Cnt_Jia__c','EquipmentManagementCode__c','ManagementCode__c','boxbarcodeforReceipt__c'};
        return new List<String>{'Id', 'Asset__c','Consum_Apply__r.AccDealerBlacklist__c', 'DeliverySlip__c', 'Shippment_loaner_time__c', 'Consum_Apply__r.demo_purpose2__c', 'Consum_Apply__r.Shipment_requested_cnt__c', 'Shipment_Saved_Flg__c', 'Shipment_request_time2__c', 'Consum_Apply_Equipment_Set__r.Yi_Shipment_request__c','Inspection_Cnt_Jia__c','EquipmentManagementCode__c','ManagementCode__c','boxbarcodeforReceipt__c'};
    }
    //隐藏的字段只能显示,不能赋值
    public override List<String> getHiddenFieldList() {
@@ -406,6 +406,12 @@
            }
            //add       wangweipeng              2022/01/28                   end
            **/
            //贸易合规 you
            if(System.Label.TradeComplianceStatusFlagBP =='true' && caesd.Consum_Apply__r.AccDealerBlacklist__c == '1'){
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, System.Label.IFTradeComplianceAlertBP));
                return ;
            }
            String guaranteen_end = '';
            if (caesd.Consumable_Guaranteen_end_F__c != null) {
                guaranteen_end = caesd.Consumable_Guaranteen_end_F__c.format();                     
force-app/main/default/classes/EquipmentSetShippmentReceived1Controller.cls
@@ -186,6 +186,8 @@
                                        repair__r.Return_Without_Repair_Date__c,Repair__r.Repair_Final_Inspection_Date__c,Repair__r.Repair_Shipped_Date__c,
                                        Campaign__r.IF_Approved__c,
                                        Campaign__r.Meeting_Approved_No__c,
                                        AccDealerBlacklist__c,//贸易合规 you
                                        EquipmentGuaranteeFlg__c,//贸易合规 you
                                        Campaign__r.Approved_Status__c      //20220315 sx obpm备品决裁状态相关修改
                                    from Rental_Apply__c 
                                    where id=:Raid];
@@ -193,7 +195,11 @@
        // 20230215 ljh DB202301265636 学会取消申请也拦截 start
        // if( RaTar.Campaign__r.Status == '取消'){
        //         ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '学会已取消,不能继续操作了'));
        if( RaTar.Campaign__r.Status == '取消' || RaTar.Campaign__r.Status == '取消申请中' ){
        //贸易合规 you
        if(System.Label.TradeComplianceStatusFlagBP =='true' && RaTar.AccDealerBlacklist__c == '1' && RaTar.EquipmentGuaranteeFlg__c==false){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, System.Label.IFTradeComplianceAlertBP));
            return null;
        }else if( RaTar.Campaign__r.Status == '取消' || RaTar.Campaign__r.Status == '取消申请中' ){
            String tempS = '';
            if(RaTar.Campaign__r.Status == '取消'){
                tempS = '已取消';
force-app/main/default/classes/EquipmentSetShippmentReceived2Controller.cls
@@ -205,6 +205,8 @@
        Rental_Apply__c RaTar = [select Campaign__c,Repair__c,next_action__c,QIS_number__r.ReplaceDeliveryDate__c,demo_purpose2__c,Follow_UP_Opp__r.Shipping_Finished_Day_Func__c,
                                                Campaign__r.Status,repair__r.Return_Without_Repair_Date__c,Repair__r.Repair_Final_Inspection_Date__c,Repair__r.Repair_Shipped_Date__c,
                                                Campaign__r.IF_Approved__c, Campaign__r.Meeting_Approved_No__c,
                                                AccDealerBlacklist__c,//贸易合规 you
                                                EquipmentGuaranteeFlg__c,//贸易合规 you
                                                Campaign__r.Approved_Status__c      //20220315 sx obpm备品决裁状态相关修改
                                            from Rental_Apply__c 
                                            where id=:Raid];
@@ -212,7 +214,11 @@
        // 20230215 ljh DB202301265636 学会取消申请也拦截 start
        // if( RaTar.Campaign__r.Status == '取消'){
        //     ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '学会已取消,不能继续操作了'));
        if( RaTar.Campaign__r.Status == '取消' || RaTar.Campaign__r.Status == '取消申请中' ){
         //贸易合规 you
        if(System.Label.TradeComplianceStatusFlagBP =='true' && RaTar.AccDealerBlacklist__c == '1' && RaTar.EquipmentGuaranteeFlg__c==false){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, System.Label.IFTradeComplianceAlertBP));
            return null;
        }else if( RaTar.Campaign__r.Status == '取消' || RaTar.Campaign__r.Status == '取消申请中' ){
            String tempS = '';
            if(RaTar.Campaign__r.Status == '取消'){
                tempS = '已取消';
force-app/main/default/classes/EquipmentSetShippmentReceived3Controller.cls
@@ -334,6 +334,10 @@
    // 保存按钮
    public PageReference save() {
        // 备品优化临时验证追加 20230409 lc Start
        /*StaticParameter.EscapeVMCTrigger = true;
        Oly_TriggerHandler.bypass('AssetHandler');*/
        // 备品优化临时验证追加 20230409 lc End
        List<String> raids = Raid.split(':');
        //检查是否可以继续
@@ -346,6 +350,8 @@
                                                ,Campaign__r.Approved_Status__c     // 20220315 ljh obpm备品决裁状态相关修改
                                                ,repair__r.Return_Without_Repair_Date__c
                                                ,Repair__r.Repair_Final_Inspection_Date__c
                                                ,AccDealerBlacklist__c//贸易合规 you
                                                ,EquipmentGuaranteeFlg__c//贸易合规 you
                                                ,Repair__r.Repair_Shipped_Date__c
                                            from Rental_Apply__c 
                                            where id in :raids];//20210602 ljh update 增加查询Name SFDC-C3LBNL 
@@ -379,13 +385,18 @@
        String message6 = '';
        String message7 = '';// 20220315 ljh obpm备品决裁状态相关修改 end
        String message8 = '';//add lc 20220927 SFDC-CJ48VE 备品预计出库日逻辑调整
        String message9 = '';//贸易合规 you
        // 要判断决裁状态不能是草稿/驳回/终止申请/取消/删除
        List<String> statusList = System.Label.StatusProcessState.split(',');
        Map<Id, Rental_Apply__c> RaMap = new Map<Id, Rental_Apply__c>();
        for (Rental_Apply__c RaTar : RaTarList) {
            // 20230215 ljh DB202301265636 学会取消申请也拦截 start
            // if( RaTar.Campaign__r.Status == '取消'){
            if( RaTar.Campaign__r.Status == '取消' || RaTar.Campaign__r.Status == '取消申请中'){
            //贸易合规 you
            if(System.Label.TradeComplianceStatusFlagBP =='true' && RaTar.AccDealerBlacklist__c == '1' && RaTar.EquipmentGuaranteeFlg__c==false){
                errorFlag = true;
                message9 += RaTar.Name+'、';
            }else if( RaTar.Campaign__r.Status == '取消' || RaTar.Campaign__r.Status == '取消申请中'){
            // 20230215 ljh DB202301265636 学会取消申请也拦截 end
                // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '学会已取消,不能继续操作了'));
                // return null;
@@ -486,6 +497,10 @@
            }
            // add lc 20220927 SFDC-CJ48VE 备品预计出库日逻辑调整 end
            if(String.isNotBlank(message9)){
                message += '单号No.'+ message9.removeEnd('、')+ System.Label.IFTradeComplianceAlertBP;
            }
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,message));
            return null;
        }
@@ -575,6 +590,8 @@
                                        , Campaign__r.IF_Approved__c         // 20220315 ljh obpm备品决裁状态相关修改
                                        , Campaign__r.Meeting_Approved_No__r.Name // 20220315 ljh obpm备品决裁状态相关修改
                                        , Campaign__r.Approved_Status__c     // 20220315 ljh obpm备品决裁状态相关修改
                                        , Hospital__r.TradeComplianceStatus__c//贸易合规 you
                                        //, Outbound_TradeStatus__c//贸易合规 you
                                        from Rental_Apply__c where Id in :raSet];
        Savepoint sp = Database.setSavepoint();
        try {
@@ -667,7 +684,7 @@
                    //wangweipeng   是否是重点产品       2021/08/30        start
                    ra.Is_keyPoint_Product__c = keyPointProduct.get(ra.Id);
                    //wangweipeng   是否是重点产品       2021/08/30        start
                    //ra.Outbound_TradeStatus__c = ra.Hospital__r.TradeComplianceStatus__c;//贸易合规 you
                    // 20220315 ljh obpm备品决裁状态相关修改 update start
                    //20220217 sx add 备品借出申请-决裁控制 No.4 出库成功时,把此时点的决裁编号和决裁状态写到决裁编号(出库)和决裁状态(出库)上
                    // if (!campMap.isEmpty() && campMap.containsKey(ra.Campaign__c) && campMap.get(ra.Campaign__c).IF_Approved__c){
force-app/main/default/classes/LogAutoSendBatch.cls
@@ -5,6 +5,11 @@
    private Datetime times;
    private Boolean isForecast;// 20220318 ljh SWAG-CC54R2 add
    private String loginId;
     //20230203 lt 计划的作业优化  一小时两次 start
     // private BatchEmailUtil.ScBean scB1;
     //20230203 lt 计划的作业优化  一小时两次 end
    /**
     * コンスタント
     */
@@ -38,6 +43,16 @@
     */
    public Integer max_cnt = Integer.valueOf(System.Label.batch_retry_max_cnt);
    global Database.QueryLocator start(Database.BatchableContext BC) {
        //20230203 lt 计划的作业优化  一小时两次 start
        /*scB1 = BatchEmailUtil.setSc1('LogAutoSendSchedule', 0, 23, 0, '0 30 *', null);
        if (System.Test.isRunningTest() == false) {
            for(CronTrigger ct : [SELECT Id FROM CronTrigger WHERE CronJobDetail.Name =: scB1.scName]) {
                System.abortJob(ct.Id);
            }
            system.schedule(scB1.scName, scB1.scTime, new LogAutoSendSchedule());
        }*/
        //20230203 lt 计划的作业优化  一小时两次 end
        String profileId = UserInfo.getProfileId();
        // 20220318 ljh SWAG-CC54R2 add start
@@ -101,12 +116,15 @@
                 retry_cnt__c, NFM501Future_Count__c, NFM501_Web_Annex_Count__c
                 FROM BatchIF_Log__c
                 WHERE RowDataFlg__c = true
                 // AND Unexecuted__c > 0 // 2023-4-10   ZYH   ADD
                                         AND Type__c != 'NFM007'  // 2023-01-18   ZYH   ADD
                                        AND ((retry_cnt__c != null AND retry_cnt__c > 0 AND retry_cnt__c < : max_cnt)
                                            OR (NFM501Future_Count__c != null
                                                AND NFM501Future_Count__c > 0 AND NFM501Future_Count__c < : max_cnt)
                                            OR(NFM501_Web_Annex_Count__c != null
                                               AND NFM501_Web_Annex_Count__c > 0 AND NFM501_Web_Annex_Count__c < : max_cnt))]
                                               AND NFM501_Web_Annex_Count__c > 0 AND NFM501_Web_Annex_Count__c < : max_cnt)
                                            OR Unexecuted__c > 0 // 2023-4-10   ZYH   ADD
                                            )]
                );
        }else {
            return Database.getQueryLocator(
@@ -115,12 +133,15 @@
                 retry_cnt__c, NFM501Future_Count__c, NFM501_Web_Annex_Count__c
                 FROM BatchIF_Log__c
                 WHERE RowDataFlg__c = true
                 // AND Unexecuted__c > 0 // 2023-4-10   ZYH   ADD
                                         AND Type__c != 'NFM007'  // 2023-01-18   ZYH   ADD
                                        AND ((retry_cnt__c != null AND retry_cnt__c > 0 AND retry_cnt__c < : max_cnt)
                                            OR (NFM501Future_Count__c != null
                                                AND NFM501Future_Count__c > 0 AND NFM501Future_Count__c < : max_cnt)
                                            OR(NFM501_Web_Annex_Count__c != null
                                               AND NFM501_Web_Annex_Count__c > 0 AND NFM501_Web_Annex_Count__c < : max_cnt))
                                               AND NFM501_Web_Annex_Count__c > 0 AND NFM501_Web_Annex_Count__c < : max_cnt)
                                            OR Unexecuted__c > 0 // 2023-4-10   ZYH   ADD
                                            )
                                       AND ownerId = : UserInfo.getUserId()
                                       ORDER BY CreatedDate // 2023-02-04   ZYH   ADD
                                       ]
@@ -248,6 +269,11 @@
            if (strType_c == 'NFM207') {
                NFM207Controller.execute(rowData, null);
            }
            // 贸易合规 you 20230321 start
            if (strType_c == 'NFM209') {
                NFM209Rest.main(rowData.Id);
            }
            // 贸易合规 you 20230321  end
            if (strType_c == 'NFM009') {
                NFM009Controller.execute(rowData, null);
            }
@@ -302,6 +328,11 @@
            if (strType_c == 'NFM612') {
                NFM612Rest.main(rowData.Id);
            }
            // 2023-3-6   zyh   add   报修子单发送接口测试用
            /*if (strType_c == 'NFM612S') {
                NFM612Controller.ManualExecute(rowData.Id);
            }*/
            // 2023-3-6   zyh   add   报修子单发送接口测试用
            if (strType_c == 'NFM620') {
                NFM620Rest.main(rowData.Id);
            }
@@ -519,6 +550,8 @@
    }
    global void finish(Database.BatchableContext BC) {
        // BatchEmailUtil.removeOtherSc('LogAutoSendSchedule', scB1.scName);  //20230203 lt 计划的作业优化
        // 今回はやることないです
        // 20220318 ljh SWAG-CC54R2 add start
        if(String.isNotBlank(typeNFM) && typeNFM == 'NFM010' && isForecast){
force-app/main/default/classes/NFM209Rest.cls
New file
@@ -0,0 +1,182 @@
/**********************************************************************
 *
 *
 * @url: /services/apexrest/NFM209/execute
 *
 *
*************************************************************************/
@RestResource(urlMapping='/NFM209/*')
global with sharing class NFM209Rest {
    //新增NFM209Rest 合规状态  you start
    global class GeDatas {
        public NFMUtil.Monitoring Monitoring;
        public  GeData[] GeData;
    }
    global class GeData {
        public String custCode;                    // 客户管理编码
        public String complStatus;                 // 零合规状态
        public String orgSysId;                    // 发起系统
        public String glbBusiNo;                   // 报文流水号
        public String custTp;                      // 对象类型
        public String entityTp;                    // 实体类型
        public String custName;                    // 客户名称
    }
    @HttpPost
    global static void execute() {
        // 取得接口传输内容
        String strData = RestContext.request.requestBody.toString();
        GeDatas ges = (GeDatas) JSON.deserializeStrict(strData, GeDatas.class);
        system.debug('rquest----'+strData);
        if (ges == null ) {
            return;
        }
        NFMUtil.Monitoring Monitoring = ges.Monitoring;
        if (Monitoring == null) {
            return;
        }
        BatchIF_Log__c rowData = NFMUtil.saveRowData(Monitoring, 'NFM209', ges.GeData);
        if (String.isBlank(rowData.Log__c) == false) {
            executefuture(rowData.Id);
        }
        // JSONを戻す
        RestResponse res = RestContext.response;
        res.addHeader('Content-Type', 'application/json');
        res.statusCode = 200;
        String jsonResponse = '{"Result": {"Result": "00", "Message":""}}';
        res.responseBody = blob.valueOf(jsonResponse);
        return;
    }
    @future
    global static void executefuture(String rowData_Id) {
        main(rowData_Id);
    }
    global static void main (String rowData_Id) {
        Map<String, String> transferMap = new Map<String, String>();
        List<BatchIF_Transfer__c> transferList = [select Table__c,
                                  Column__c,
                                  External_value__c,
                                  Internal_value__c
                                  from BatchIF_Transfer__c
                                  where Dropped_Flag__c = false
                                          and (Table__c = 'Account')
                                          ];
        for (BatchIF_Transfer__c t : transferList) {
            transferMap.put(t.Column__c + t.External_value__c, t.Internal_value__c);
        }
        Integer batch_retry_max_cnt = Integer.valueOf(System.Label.batch_retry_max_cnt);
        BatchIF_Log__c rowData = [Select Id, Name, retry_cnt__c, Log__c, ErrorLog__c, Log2__c, Log3__c, Log4__c, Log5__c, Log6__c, Log7__c, Log8__c, Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c from BatchIF_Log__c where RowDataFlg__c = true and Id = :rowData_Id];
        String logstr = rowData.MessageGroupNumber__c + ' start\n';
        BatchIF_Log__c iflog = new BatchIF_Log__c();
        iflog.Type__c = 'NFM209';
        iflog.MessageGroupNumber__c = rowData.MessageGroupNumber__c;
        iflog.Log__c = logstr;
        iflog.ErrorLog__c = '';
        insert iflog;
        String rowDataStr = NFMUtil.getRowDataStr(rowData);
        List<GeData> geDataList = (List<GeData>) JSON.deserialize(rowDataStr, List<GeData>.class);
        if (geDataList == null || geDataList.size() == 0) {
            return;
        }
        Savepoint sp = Database.setSavepoint();
        try {
            List<Account> accInsList = new List<Account>();
            //将客户管理编码、合规状态存入List
            List<String> custCodeList = new List<String>();
            List<String> complStatusList = new List<String>();
            for (GeData geData : geDataList) {
                if (String.isBlank(geData.custCode)) {
                    iflog.ErrorLog__c += '管理编码不能为空。\n';
                    continue;
                } else {
                    custCodeList.add(geData.custCode);
                }
                if (String.isBlank(geData.complStatus)) {
                    iflog.ErrorLog__c += geData.custCode+':合规状态为空。\n';
                    continue;
                }
            }
            //客户管理编码和合规状态日期存入Map
            Map<String, Account> accInfoMap = new Map<String, Account>();
            if (custCodeList.size() > 0) {
                List<Account> accList = [select ID,Parent_Management_CodeClean__c,TradeComplianceStatus__c  from Account where Parent_Management_CodeClean__c in :custCodeList and (RecordType.DeveloperName = 'HP' or RecordType.DeveloperName = 'Agency')];
                if (accList.size() > 0) {
                    for (Account accInfo : accList) {
                        accInfoMap.put(accInfo.Parent_Management_CodeClean__c, accInfo);
                    }
                }
            }
            // 将XML的合规状态存入客户对象中
            for (GeData geData : geDataList) {
                Account acc = new Account();
                if (!accInfoMap.containsKey(geData.custCode)){
                    iflog.ErrorLog__c += '客户管理编码:' +geData.custCode +':未找到。\n';
                    continue;
                }
                acc.Id = (accInfoMap.get(geData.custCode)).ID;
                acc.TradeComplianceStatus__c = NFMUtil.getMapValue(transferMap, 'TradeComplianceStatus__c', string.valueof(geData.complStatus), iflog);             //合规状态
                accInsList.add(acc);
                logstr += '客户管理编码:' +geData.custCode +':获取成功。\n';
            }
            if (accInsList.size() > 0) {
                upsert accInsList;
                logstr += '更新成功。\n';
            }
            logstr += '\nend';
            rowData.retry_cnt__c = 0;
        } catch (Exception ex) {
            // エラーが発生した場合
            Database.rollback(sp);
            System.debug(Logginglevel.ERROR, 'NFM209_' + rowData.MessageGroupNumber__c + ':' + ex.getMessage());
            System.debug(Logginglevel.ERROR, 'NFM209_' + rowData.MessageGroupNumber__c + ':' + ex.getStackTraceString());
            logstr += '\n' + ex.getMessage();
            iflog.ErrorLog__c = ex.getMessage() + '\n' + ex.getStackTraceString() + '\n' + iflog.ErrorLog__c;
            if (rowData.retry_cnt__c == null) rowData.retry_cnt__c = 0;
            if (rowData.retry_cnt__c < batch_retry_max_cnt) {
                rowData.retry_cnt__c++;
                LogAutoSendSchedule.assignOneMinute();
            }
            if (rowData.retry_cnt__c >= batch_retry_max_cnt) {
                rowData.ErrorLog__c = ex.getMessage() + '\n' + ex.getStackTraceString() + '\n' + rowData.ErrorLog__c + '错误次数已经超过自动收信设定的最大次数,请手动收信';
            }
        }
        update rowData;
        iflog.Log__c = logstr;
        if (iflog.Log__c.length() > 131072) {
            iflog.Log__c = iflog.Log__c.subString(0, 131065) + ' ...';
        }
        if (iflog.ErrorLog__c.length() > 32768) {
            iflog.ErrorLog__c = iflog.ErrorLog__c.subString(0, 32760) + ' ...';
        }
        update iflog;
    }
    //新增NFM209Rest 合规状态 you end
}
force-app/main/default/classes/NFM209Rest.cls-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>46.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/NFM209RestTest.cls
New file
@@ -0,0 +1,88 @@
@isTest
public with sharing class NFM209RestTest {
     static testMethod void testMethod1() {
        // テストデータ
        List<BatchIF_Transfer__c> transfers = new List<BatchIF_Transfer__c>();
        BatchIF_Transfer__c transfer = new BatchIF_Transfer__c();
        transfer.Table__c          = 'Account';
        transfer.Column__c         = 'TradeComplianceStatus__c';
        transfer.External_Value__c = 'W';
        transfer.Internal_Value__c = '白名单';
        transfers.add(transfer);
        transfer = new BatchIF_Transfer__c();
        transfer.Table__c          = 'Account';
        transfer.Column__c         = 'TradeComplianceStatus__c';
        transfer.External_Value__c = 'B';
        transfer.Internal_Value__c = '黑名单';
        transfers.add(transfer);
        insert transfers;
        // テストデータ
        Account company = new Account();
        company.RecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('HP').getRecordTypeId();
        company.Name         = 'NFM209TestCompany';
        upsert company;
        Account section = new Account();
        section.RecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Department_Class_GI').getRecordTypeId();
        section.Name         = '*';
        section.Department_Class_Label__c = '消化科';
        section.ParentId                  = company.Id;
        section.Hospital_Department_Class__c = company.Id;
        upsert section;
        StaticParameter.EscapeSyncProduct2Trigger = true;
        StaticParameter.EscapeAccountTrigger = true;
        Account depart = new Account();
        depart.RecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Department_GI').getRecordTypeId();
        depart.Name         = '*';
        depart.Department_Name__c  = 'NFM209TestDepart';
        depart.ParentId            = section.Id;
        depart.Department_Class__c = section.Id;
        depart.Hospital__c         = company.Id;
        upsert depart;
        company = [select Id, Name,Management_Code_Auto__c from Account
                                where Id = :company.Id];
        NFM209Rest.GeDatas GeDatas = new NFM209Rest.GeDatas();
        NFM209Rest.GeData GeData = new NFM209Rest.GeData();
        GeDatas.GeData = new NFM209Rest.GeData[]{GeData};
        Datetime nowDT = Datetime.now();
        String nowStr = nowDT.format('yyyyMMddHHmm');
        GeDatas.Monitoring = new NFMUtil.Monitoring();
        GeDatas.Monitoring.MessageGroupNumber = nowStr + '01';
        GeData.custCode = company.Management_Code_Auto__c;
        GeData.complStatus = 'B';
        GeData.orgSysId='123';
        GeData.glbBusiNo='123';
        GeData.custTp='123';
        GeData.entityTp='123';
        GeData.custName='123';
        //System.Test.startTest();
        NFMUtil.Monitoring Monitoring = GeDatas.Monitoring;
        BatchIF_Log__c rowData = NFMUtil.saveRowData(Monitoring, 'NFM209', GeDatas.GeData);
        NFM209Rest.executefuture(rowData.Id);
        rowData = NFMUtil.saveRowData(Monitoring, 'NFM209', GeDatas.GeData);
        NFM209Rest.executefuture(rowData.Id);
}
 static testMethod void testMethod2() {
        //Test.startTest();
        RestRequest req = new RestRequest();
        RestResponse res = new RestResponse();
        String JsonMsg = '{"Monitoring":{"TransmissionDateTime":"201812201320","Text":"","Tag":"MSGH","Sender":"SAP","Receiver":"SFDC","NumberOfRecord":"1","MessageType":"NFM117","MessageGroupNumber":"20210000005088"},"GeData":[{"custCode":"8098008","complStatus":"黑名单","orgSysId":"00987","glbBusiNo":"001","custTp":"Person","entityTp":"经销商","custName":"大连东控睿康医疗管理有限公司"}]}';
        req.requestURI = 'services/apexrest/NFM209/execute';
        req.httpMethod = 'POST';
        req.requestBody = Blob.valueof(JsonMsg);
        RestContext.request = req;
        RestContext.response= res;
        NFM209Rest.execute();
        //Test.stopTest();
    }
}
force-app/main/default/classes/NFM209RestTest.cls-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>46.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/OpportunityWebService.cls
@@ -416,4 +416,169 @@
        return true;
    }
    //SWAG-CG88AG【委托】提出价格申请是在协议有效期内,允许WIN fy end 
    //贸易合规 20230307 you start
    //营业拦截提醒
    WebService static Boolean accSendEmail(String  AccDealerBlacklist,String accname,String angency1,String angency2,String ownerids,String ddid,String oppid) {
      //发送邮件
        List<Messaging.SingleEmailMessage> sendMails = new List<Messaging.SingleEmailMessage>();
        List<String>  MailsList = new List<String>();
        List<String> userIdList = new List<String>();
        if(String.isNotBlank(ownerids)){
            userIdList.add(ownerids);
        }
        if(String.isNotBlank(ddid)){
            userIdList.add(ddid);
        }
         //询价所有人,产品担当,发邮件
        List<User> UsrList = [SELECT email FROM user WHERE id in :userIdList];
        //获取各个用户的email
        for (User u : UsrList){
            MailsList.add(u.email);
        }
        system.debug('111===:'+MailsList);
        if (MailsList!=null&&MailsList.size()>0){
            String title = '';
            String body = '';
            title = ' 新建询价医院/经销商涉及黑名单';
            if(AccDealerBlacklist=='123'){
                body += '黑名单的客户为:' + accname+ '<br/>';
                body += '黑名单的经销商1为:' + angency1+ '<br/>';
                body += '黑名单的经销商2为:' + angency2+ '<br/>';
            }else if(AccDealerBlacklist=='12'){
                body += '黑名单的客户为:' + accname+ '<br/>';
                body += '黑名单的经销商1为:' + angency1+ '<br/>';
            }else if(AccDealerBlacklist=='23'){
                body += '黑名单的经销商1为:' + angency1+ '<br/>';
                body += '黑名单的经销商2为:' + angency2+ '<br/>';
            }else if(AccDealerBlacklist=='13'){
                body += '黑名单的客户为:' + accname+ '<br/>';
                body += '黑名单的经销商2为:' + angency2+ '<br/>';
            }else if(AccDealerBlacklist=='1'){
                body += '黑名单的客户为:' + accname+ '<br/>';
            }else if(AccDealerBlacklist=='2'){
                body += '黑名单的经销商1为:' + angency1+ '<br/>';
            }else if(AccDealerBlacklist=='3'){
                body += '黑名单的经销商2为:' + angency2+ '<br/>';
            }
            body += '<a href="' + System.Label.Environment_Url + oppid + '">'
                    + System.Label.Environment_Url+ oppid +'</a><br/>';
            body += '谢谢!';
            Messaging.SingleEmailMessage messageNEW = new Messaging.SingleEmailMessage();
            messageNEW.setSubject(title);
            messageNEW.setHtmlBody(body);
            messageNEW.setCharset('UTF-8');
            messageNEW.setToAddresses(MailsList);
            //List<String> toCcMailsList = new List<String>();
            //toCcMailsList.add('youchang@prec-tech.com');
            //messageNEW.setCcAddresses(toCcMailsList);
            sendMails.add(messageNEW);
        }
        boolean rs = true;
        if (sendMails.size() > 0) {
            Messaging.Email[] allMails = new Messaging.Email[]{};
            for(Integer j = 0; j < sendMails.size(); j++) {
                allMails.add(sendMails.get(j));
            }
            system.debug('222===:'+allMails);
            Messaging.SendEmailResult[] results = Messaging.sendEmail(allMails);
            System.debug('results 结果 :'+results);
            for (Integer i = 0; i < results.size(); i++) {
                if (results[i].success == false) {
                    system.debug('=====send mail error:' + results[i].errors[0].message);
                    rs = false;
                }
            }
        }
        return rs;
    }
    //服务拦截提醒
    //【新建询价】检查点仅通知合同组 sendalert=Main_Con
    //【报价Decide】检查点邮件通知人员:合同组、FSE领导、服务助理(标签) sendalert=decide_con
    WebService static Boolean accSendEmailFW(String  AccDealerBlacklist,String accname,String angency,String mcid,String sendalert,String[] FSEStr) {
      //发送邮件
        List<Messaging.SingleEmailMessage> sendMails = new List<Messaging.SingleEmailMessage>();
        List<String>  MailsList = new List<String>();
        List<String> userIdList = new List<String>();
        //合同组
        List<GroupMember> groupmemberList = [SELECT GroupId,Id,UserOrGroupId FROM GroupMember where Group.DeveloperName = 'TradeComplianceGroup'];
        Set<String> GroupMap = new Set<String>();
        List<GroupMember> gmInsertList = new List<GroupMember>();
        if(groupmemberList != null && groupmemberList.size()>0){
            for (GroupMember gm : groupmemberList) {
               GroupMap.add(gm.UserOrGroupId);
            }
        }
         //询价所有人,产品担当,发邮件
        List<User> UsrList = [SELECT email FROM user WHERE id in :GroupMap or id in :FSEStr];
        //获取各个用户的email
        for (User u : UsrList){
            MailsList.add(u.email);
        }
        ////decide 进来服务助理 6个人
        //if(sendalert=='decide_con'){
        //    String toEmailAddress = System.Label.TradeComplianceStatusSendEmailFW;
        //    String[] toAddresses = toEmailAddress.split(',');
        //    for(String toa:toAddresses){
        //       MailsList.add(toa);
        //    }
        //}
        //MailsList.add('youchang@prec-tech.com');
        system.debug('111===:'+MailsList);
        if (MailsList!=null&&MailsList.size()>0){
            String title = '';
            String body = '';
            title = '医院/经销商涉及黑名单';
            String accname1 = accname==null ? '' :accname;
            String angency1 = angency==null ? '' :angency;
            if(AccDealerBlacklist=='1' || AccDealerBlacklist=='intercept'){
                body += '黑名单的客户为:' + accname1 + '<br/>';
                body += '黑名单的经销商为:' + angency1 + '<br/>';
            }
            body += '<a href="' + System.Label.Environment_Url + mcid + '">'
                    + System.Label.Environment_Url+ mcid +'</a><br/>';
            body += '谢谢!';
            Messaging.SingleEmailMessage messageNEW = new Messaging.SingleEmailMessage();
            messageNEW.setSubject(title);
            messageNEW.setHtmlBody(body);
            messageNEW.setCharset('UTF-8');
            messageNEW.setToAddresses(MailsList);
            sendMails.add(messageNEW);
        }
        boolean rs = true;
        if (sendMails.size() > 0) {
            Messaging.Email[] allMails = new Messaging.Email[]{};
            for(Integer j = 0; j < sendMails.size(); j++) {
                allMails.add(sendMails.get(j));
            }
            system.debug('222===:'+allMails);
            Messaging.SendEmailResult[] results = Messaging.sendEmail(allMails);
            System.debug('results 结果 :'+results);
            for (Integer i = 0; i < results.size(); i++) {
                if (results[i].success == false) {
                    system.debug('=====send mail error:' + results[i].errors[0].message);
                    rs = false;
                }
            }
        }
        return rs;
    }
    //贸易合规 20230307 you end
}
force-app/main/default/classes/RentalFixtureSetAssignAgencyController.cls
@@ -52,6 +52,7 @@
                         + ', Campaign__r.IF_Approved__c' // 20220315 ljh add
                         + ', Campaign__r.Meeting_Approved_No__r.Name' // 20220315 ljh add 
                         + ', Campaign__r.Approved_Status__c' // 20220315 ljh add 
                         //+ ', Hospital__r.TradeComplianceStatus__c' // 贸易合规 you
                         + ' FROM Rental_Apply__c'
                         + ' WHERE Id=\'' + taId + '\'';
            List<Rental_Apply__c>  raList = (List<Rental_Apply__c>) Consum_ApplyUtil.withoutQueryList(rasql);
@@ -450,6 +451,8 @@
                 , demo_purpose2__c //1822 yc 20211025 已购待货目的,新品已有发货日不能出库
                 , Follow_UP_Opp__r.Shipping_Finished_Day_Func__c //1822 yc 20211025 已购待货目的,新品已有发货日不能出库
                 , next_action__c //1822 yc 20211108
                 ,AccDealerBlacklist__c//贸易合规 you
                 ,EquipmentGuaranteeFlg__c//贸易合规 you
                 , QIS_number__r.ReplaceDeliveryDate__c //1822 yc 20211108
              FROM Rental_Apply__c
             WHERE id =:taId
@@ -458,7 +461,11 @@
            // 20230215 ljh DB202301265636 学会取消申请也拦截 start
            // if( RaTar.Campaign__r.Status == '取消'){
            //     ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '学会已取消,不能继续操作了'));
            if( RaTar.Campaign__r.Status == '取消' || RaTar.Campaign__r.Status == '取消申请中' ){
             //贸易合规 you
            if(System.Label.TradeComplianceStatusFlagBP =='true' && RaTar.AccDealerBlacklist__c == '1' && RaTar.EquipmentGuaranteeFlg__c==false){
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, System.Label.IFTradeComplianceAlertBP));
                return false;
            }else if( RaTar.Campaign__r.Status == '取消' || RaTar.Campaign__r.Status == '取消申请中' ){
                String tempS = '';
                if(RaTar.Campaign__r.Status == '取消'){
                    tempS = '已取消';
@@ -1938,6 +1945,7 @@
                ra.DeliverySlip__c = slip.Id;
                ra.Delivery_Agency__c = parentObj.Delivery_Agency__c; 
                ra.Agency_Address_Id__c = addressId;
                //ra.Outbound_TradeStatus__c = parentObj.Hospital__r.TradeComplianceStatus__c;//贸易合规 you
                // 20210624 ljh update SFDC-C448GR end
                //20220217 sx add 备品借出申请-决裁控制 No.4 出库成功时,把此时点的决裁编号和决裁状态写到决裁编号(出库)和决裁状态(出库)上
force-app/main/default/classes/SelectAssetEstimateURFController.cls
@@ -1532,6 +1532,12 @@
                        ,URF_LastMContract1_NO__c,URF_LastMContract2_NO__c,URF_LastMContract3_NO__c,URF_LastMContract4_NO__c,URF_LastMContract5_NO__c
                        ,URF_LastMContract1_ConCount__c,URF_LastMContract2_ConCount__c,URF_LastMContract3_ConCount__c,URF_LastMContract4_ConCount__c,URF_LastMContract5_ConCount__c
                        // URF限次合同2期 LY 20220811 end
                        //贸易合规 you start
                        ,Maintenance_Contract__r.AccDealerBlacklist__c
                        ,Maintenance_Contract__r.Hospital__r.Name
                        ,Maintenance_Contract__r.Dealer__r.Name
                        ,CreatedById
                        //贸易合规 you end
                         FROM Maintenance_Contract_Estimate__c WHERE Id = :this.targetEstimateId];
        //HWAG-B399Q8 2018/08/20  添加一额外字段 IS_Clone_After_Decide__c end
        decimal PriceSum =  (this.estimate.Maintenance_Contract__r.Payment_Plan_Sum_First__c == null ? 0 : this.estimate.Maintenance_Contract__r.Payment_Plan_Sum_First__c) +
@@ -3413,6 +3419,29 @@
        return new PageReference('/' + this.targetEstimateId + '/e?completion=4');
    
    }
    //贸易合规 you start
    public PageReference interceptsend(){
        //String BuchangApprovalManager = this.estimate.BuchangApprovalManager__c;
        //String JingliApprovalManager = this.estimate.JingliApprovalManager__c;
        String fseid = this.estimate.CreatedById;
        String AccDealerBlacklist = this.estimate.Maintenance_Contract__r.AccDealerBlacklist__c;
        String accname = this.estimate.Maintenance_Contract__r.Hospital__r.Name;
        String deaname = this.estimate.Maintenance_Contract__r.Dealer__r.Name;
        //FSE领导
        String[] FSEStr = new String[] {};
        //if(String.isNotBlank(BuchangApprovalManager)){
        //    FSEStr.add(BuchangApprovalManager);
        //}
        //if(String.isNotBlank(JingliApprovalManager)){
        //    FSEStr.add(JingliApprovalManager);
        //}
        FSEStr.add(fseid);
        system.debug('==jinlaile====='+FSEStr);
        Boolean reflag = OpportunityWebService.accSendEmailFW(AccDealerBlacklist,accname,deaname,this.targetEstimateId,'decide_con',FSEStr);
        system.debug('==fawanle====='+FSEStr);
        return null;
    }
    //贸易合规 you end
    
    /**
     * Process用のユーザー情報をセット、新規見積もり時用
@@ -4170,7 +4199,8 @@
    
    // 2021-02-07  gzw add  LJPH-BWY5QB start
    private void setEndUserType(String id) {
        this.contract = [SELECT Id, Name, Status__c, Decided_Estimation__c, Service_Contract_Staff__c,
        //贸易合规 you 20230414 加查询AccDealerBlacklist__c
        this.contract = [SELECT Id, Name,AccDealerBlacklist__c, Status__c, Decided_Estimation__c, Service_Contract_Staff__c,
                         Estimate_Num__c, Management_Code__c, Hospital__c,
                         Hospital__r.MaintenanceContractUserType__c,
                         Contract_Start_Date__c, Contract_End_Date__c
@@ -4183,7 +4213,8 @@
    // 2021-02-07  gzw add  LJPH-BWY5QB end
    
    private void setContractInfo(String id) {
        this.contract = [SELECT Id, Name, Status__c, Decided_Estimation__c, Service_Contract_Staff__c,
        //贸易合规 you 20230414 加查询AccDealerBlacklist__c
        this.contract = [SELECT Id, Name,AccDealerBlacklist__c, Status__c, Decided_Estimation__c, Service_Contract_Staff__c,
                         Estimate_Num__c, Management_Code__c, Hospital__c,
                         //2021-01-18  mzy add  LJPH-BWY5QB   客户上的 维修合同用户类型 为true /false,报价 用户类型为 既有用户 / 新用户
                         // Hospital__r.MaintenanceContractUserType__c,
force-app/main/default/classes/SelectAssetEstimateVMController.cls
@@ -18,6 +18,11 @@
    public Boolean printAgent { get; private set; }
    public boolean inDicideFlag {get; set;}                         //作为补充,对应报价决定之后,却未能讲合同起止日期传递给合同的问题
    public String isPaymentSet {get; set;}
    // 报价规则改善 20230309 start
    // public Boolean Is_Blank_period {get; set;}
    // public String Cost_rate_ForecastF{get;set;}
    // public String PastContractendday{get;set;}
    // 报价规则改善 20230309 end
    //public String PaymentSet {get;set;}
    // 引数のサービス契約の情報を格納する。
    public Maintenance_Contract__c contract { get; private set; }
@@ -121,8 +126,9 @@
    public Boolean disableEmailBtn { get; set; }
    public Boolean sendEmailSuccess { get; set; }
    public Boolean hasSendEmail { get; set; }
    // 上限合同 hql 20230216 start
    public Boolean isLimitPrice { get; set; }
    // 上限合同 hql 20230216 end
    public Boolean isNotFSE { get; set; }
    //多年保设备续签计算逻辑调整 2022/12/14
@@ -131,7 +137,7 @@
    public Decimal Denominator {get; set; }
    public Decimal Accrued {get; set; }
    public String ProductModel{get;set;}
    public String Category{get;set;}
    // public String Category{get;set;}
    public Decimal Consumption_rate_Gurante{get;set;}
@@ -161,7 +167,35 @@
        totalPage = (totalRecords / selctRecordNum) + (Math.mod(totalRecords, selctRecordNum) > 0 ? 1 : 0);
        return null;
    }
    public void  test() {
        integer i = 0;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
    }
    // 取已选择资产的机身编码
    public void getAssetSerialNumber() {
        //LJPH-BSS6E2  ---20200911 ---add by rentongxiao start
@@ -362,8 +396,10 @@
                      + 'URF_Maintenance_Contract__c,URF_Maintenance_Contract__r.Management_Code__c,URF_Maintenance_Contract__r.Contract_End_Date__c,'
                      //URF限次合同2期 LY 20220811 end
                      //多年保设备续签计算逻辑调整 2022/12/14 start
                      // +'Guarantee_period_for_products__c,'
                      //多年保设备续签计算逻辑调整 2022/12/14 start 消费率
                      +'CurrentContract_F_asset__r.Asset_Consumption_Rate__c,Product2.Category4__c,Product2.Asset_Model_No__c,CurrentContract_F_asset__r.Maintenance_Price_Year__c,'
                      +'CurrentContract_F_asset__r.IS_VMContract_Asset__c,'
                      +'CurrentContract_F__r.endDateGurantee__c,'
                      //多年保设备续签计算逻辑调整 2022/12/14 end
                      + 'CurrentContract_End_Date__c, Extend_Gurantee_DateTo__c,EquipmentGuaranteeFlg__c,AssetMark__c,NoPartRiskDate_F__c,NoPartRiskDate__c,SignableFlag__c FROM Asset WHERE Hospital__c = \'' + this.targetHospitalId + '\' ';
@@ -597,6 +633,17 @@
    //2022/12/27 故障品加费 新增提交修理减价 按钮仅对 张晶 张栩榕及 管理员可见
    public Boolean getApprovalBtnNewDisabled() {
        // 見積もり申請できない条件の判断
        if (String.isBlank(this.contract.Decided_Estimation__c) == false) {
            // TODO 特別資格があれば 申請可能にする
            return true;
        }
        if (String.isBlank(this.estimate.Process_Status__c) == false
            && this.estimate.Process_Status__c != '草案中'
            //&& this.estimate.Process_Status__c != '不批准'
            ) {
            return true;
        }
        String userName =  UserInfo.getName();
        String uProfileId = UserInfo.getProfileId();
        String uProfileName = [SELECT Name FROM Profile WHERE Id =: uProfileId].Name;
@@ -627,12 +674,17 @@
        if (String.isBlank(this.contract.Decided_Estimation__c) == false) {
            return true;
        }
        //上限合同 hql 20230113 start
        if (this.isFSE == false
            && this.isLimitPrice == true
            && String.isBlank(this.estimate.Process_Status__c) == false
            && this.estimate.Process_Status__c == '申请中') {
            return false;
        }
         //上限合同 hql 20230113 end
        if (String.isBlank(this.estimate.Process_Status__c) == false
            && this.estimate.Process_Status__c != '草案中'
            //&& this.estimate.Process_Status__c != '不批准'
            //上限合同 LY 20230113 start
            // && this.estimate.Process_Status__c != '申请中'
            //上限合同 LY 20230113 start
            ) {
            return true;
        }
@@ -715,6 +767,7 @@
    public Boolean isSaveOrApproval {get; set;}
    public String OldContractStartDate {get; set;}
    public String OldMaintenancePrice { get; set; }
    public Decimal OldLimitPrice { get; set; }
    
    /**
     * コンストラクタ
@@ -766,9 +819,9 @@
                         , Sales_incidental__c, Consumption_rate_Forecast__c, AgencyHos_Price__c
                         // 申请报价金额 和 相对标准价格范围的折扣率
                         , Request_quotation_Amount__c, Service_discount_Rate__c, ContractPriceType__c
                         //上限合同 20230103 LY start
                         // ,Limit_Price_Amount__c
                         //上限合同 20230103 LY end
                         //上限合同 20230103 hql start
                         ,Limit_Price_Amount__c
                         //上限合同 20230103 hql end
                         , LastMContract1__c, LastMContract2__c, LastMContract3__c, LastMContract4__c, LastMContract5__c
                         , LastMContract1_ConCount__c, LastMContract2_ConCount__c, LastMContract3_ConCount__c, LastMContract4_ConCount__c, LastMContract5_ConCount__c,
                         LastMContract1_NO__c, LastMContract2_NO__c, LastMContract3_NO__c, LastMContract4_NO__c, LastMContract5_NO__c
@@ -779,7 +832,10 @@
                         , Maintenance_Contract__r.Open_RenewalQuotation__c,Maintenance_Contract__r.VM_Contract_Check__c
                         //WLIG-CDFBV3 开通续签报价为true的可以开放续签报价 thh 20220419 end'
                        //LJPH-C9SCX7 【委托】合同无空白期的提醒  lt  20211221  start
                         // 报价规则改善20230314 start
                        //, Maintenance_Contract__r.Past_Contract_end_day__c //过去合同结束日
                        // ,renewTen_OFF__c
                         // 报价规则改善20230314 end
                        //LJPH-C9SCX7 【委托】合同无空白期的提醒  lt  20211221  end
                        // URF限次合同2期 LY 20220811 start
                        ,URF_P_MaxRepairCount__c,URF_V_MaxRepairCount__c
@@ -792,11 +848,17 @@
                        ,Hospital_Salesdepartment__c
                        ,Send_Email_To_RC__c
                        //故障品加费  2022/12/16 end
                        //贸易合规 you start
                        ,Maintenance_Contract__r.AccDealerBlacklist__c
                        ,Maintenance_Contract__r.Hospital__r.Name
                        ,Maintenance_Contract__r.Dealer__r.Name
                        ,CreatedById
                        //贸易合规 you end
                         FROM Maintenance_Contract_Estimate__c WHERE Id = :this.targetEstimateId];
        //HWAG-B399Q8 2018/08/20  添加一额外字段 IS_Clone_After_Decide__c end
        //故障品加费 2023/1/3 start
        hasSendEmail = this.estimate.Send_Email_To_RC__c;
        OldLimitPrice = this.estimate.Limit_Price_Amount__c;
        //故障品加费 2023/1/3 end
        decimal PriceSum =  (this.estimate.Maintenance_Contract__r.Payment_Plan_Sum_First__c == null ? 0 : this.estimate.Maintenance_Contract__r.Payment_Plan_Sum_First__c) +
                           (this.estimate.Maintenance_Contract__r.Payment_Plan_Sum_Second__c == null ? 0 : this.estimate.Maintenance_Contract__r.Payment_Plan_Sum_Second__c) +
@@ -845,7 +907,7 @@
        isSaveOrApproval = false;
        OldContractStartDate = null;
        OldMaintenancePrice = null;
        OldLimitPrice = null;
        inDicideFlag = false;
    
        isSoft = false;
@@ -903,6 +965,7 @@
            }
            this.targetMaintenanceContractId = ApexPages.currentPage().getParameters().get('mcid');
        }
        // 編集から
        if (String.isBlank(this.targetEstimateId) == false) {
            setThisEstimate();
@@ -980,11 +1043,19 @@
                            , URF_Maintenance_Contract__r.Management_Code__c
                            , URF_Maintenance_Contract__r.Contract_End_Date__c
                            //URF限次合同2期 LY 20220811 end
                            // //多年保设备续签计算逻辑调整 2022/12/14 start
                            // ,Maintenance_Price_Year__c
                            // //多年保设备续签计算逻辑调整 2022/12/14 end
                            // 报价规则改善 20230315 start
                            // ,IS_StandardPricing__c
                            // 报价规则改善 20230315 end
                            //多年保设备续签计算逻辑调整 2023/1/17 start
                            ,CurrentContract_F_asset__r.Asset_Consumption_Rate__c
                            ,CurrentContract_F_asset__r.Maintenance_Price_Year__c
                            ,CurrentContract_F_asset__r.IS_VMContract_Asset__c
                            ,Product2.Asset_Model_No__c
                            ,Product2.Category4__c
                            ,CurrentContract_F__r.endDateGurantee__c
                            //添加是否服务多年保修,多年保维修期至
                            ,IS_Extend_Gurantee__c,Extend_Gurantee_DateTo__c
                             //多年保设备续签计算逻辑调整 2023/1/17 end
                            FROM Asset WHERE Hospital__c = :this.targetHospitalId AND ( AssetMark__c != '耗材' OR Product2.Family != 'ET' ) ORDER BY ID, IF_Warranty_Service__c asc];
            //JZHG-BSDUT4 ---20200825---update By rentongxiao---Start
            // assetRecords = [SELECT Id, Name, Asset_situation__c, SerialNumber, Department_Name__c, Installation_Site__c, Posting_Date__c,Management_Code__c,IF_Warranty_Service__c,Reson_Can_not_Warranty__c,
@@ -1002,7 +1073,24 @@
        //sqlStr += ' AND AssetMark__c != \'耗材\' AND Product2.Family != \'ET\' ';
        this.checkedAssets = new List<AssetInfo>();
        this.unCheckedAssets = new List<AssetInfo>();
        // 上限合同 hql 20230216 start
            Boolean isLimitPriceOne = [SELECT id,Limit_Price__c FROM Maintenance_Contract__c  WHERE Id =: this.targetMaintenanceContractId].Limit_Price__c;
            if(isLimitPriceOne){
                this.isLimitPrice = true;
            }else{
                this.isLimitPrice = false;
            }
        // 上限合同 hql 20230216 end
        // 报价规则改善 20230309 start
            // Maintenance_Contract__c mc1 = [SELECT id,Is_Blank_period__c,Cost_rate_ForecastF__c FROM Maintenance_Contract__c  WHERE Id =: this.targetMaintenanceContractId];
            // Boolean IsBlankperiod = mc1.Is_Blank_period__c;
            // this.Cost_rate_ForecastF = mc1.Cost_rate_ForecastF__c;
            // if(IsBlankperiod){
            //     this.Is_Blank_period = true;
            // }else{
            //     this.Is_Blank_period = false;
            // }
        // 报价规则改善 20230309 end
        // 選択済みの納入機器情報を取得
        Map<Id, Integer> selectedAssetIds = new Map<Id, Integer>();
        List<Maintenance_Contract_Asset_Estimate__c> selectedMcaes = new List<Maintenance_Contract_Asset_Estimate__c>();
@@ -1015,9 +1103,14 @@
                Asset__r.EquipmentGuaranteeFlg__c,
                Asset__r.CurrentContract_F_asset__r.Estimate_Cost_Month_formula__c,
                Asset__r.CurrentContract_F_asset__r.endDateGurantee_Text__c,
                //多年保设备续签计算逻辑调整 2022/12/14 start
                // Asset__r.CurrentContract_F_asset__r.startDateGurantee__c,
                //多年保设备续签计算逻辑调整 2022/12/14 end
                //多年保设备续签计算逻辑调整 2023/1/18 start 设备消费率
                Asset__r.CurrentContract_F_asset__r.Asset_Consumption_Rate__c,
                Asset__r.CurrentContract_F_asset__r.IS_VMContract_Asset__c,
                Asset__r.CurrentContract_F_asset__r.Maintenance_Price_Year__c,
                Asset__r.Product2.Asset_Model_No__c,
                Asset__r.Product2.Category4__c,
                Asset__r.CurrentContract_F__r.endDateGurantee__c,
                //多年保设备续签计算逻辑调整 2022/1/18 end
                Asset__r.CurrentContract_F__r.First_Estimate_Date__c,
                Asset__r.CurrentContract_F__r.Contract_Consumption_rate__c,
                Asset__r.CurrentContract_F__r.First_contract_usage_Rate__c,
@@ -1097,7 +1190,10 @@
                // if (mca.Maintenance_Contract__r.Consumption_rate_Gurante__c != null) {
                //     Consumption_rate_Gurante = mca.Maintenance_Contract__r.Consumption_rate_Gurante__c;
                // }
                // if(mca.Asset_Consumption_Rate__c!=null){
                //     Consumption_rate_Gurante = mca.Asset_Consumption_Rate__c;
                // }
                //多年保设备续签计算逻辑调整 2022/12/14 end
                if (createdDate.addMonths(isNewAddMonth) < mca.Asset__r.isNewDate_use__c) {
                    isNew = true;
@@ -1133,6 +1229,7 @@
                                                                Asset__r.EquipmentGuaranteeFlg__c,
                                                                //2021-11-30 fy add LJPH-C8W8FV 置顶 start
                                                                Asset__r.OwnershipMachine_No__c,
                                                                Product_Manual__r.Category4__c,
                                                                //2021-11-30 fy add LJPH-C8W8FV 置顶 end
                                                                Asset_Consumption_rate__c,
                                                                Asset__r.CurrentContract_F__c,
@@ -1155,8 +1252,8 @@
                                                                LastMContract_Price__c,
                                                                Asset__r.CurrentContract_F_asset__r.Estimate_Cost_Month_formula__c,
                                                                Asset__r.CurrentContract_F_asset__r.endDateGurantee_Text__c,
                                                                //多年保设备续签计算逻辑调整 2022/12/14 start
                                                                // Asset__r.CurrentContract_F_asset__r.startDateGurantee__c,
                                                                //多年保设备续签计算逻辑调整 2023/1/18 start  设备消费率
                                                                // Asset__r.CurrentContract_F_asset__r.Asset_Consumption_Rate__c,
                                                                // Asset__r.Product2.Intra_Trade_Gurantee_RMB__c,
                                                                //多年保设备续签计算逻辑调整 2022/12/14 end
                                                                Product_Manual__c,
@@ -1181,6 +1278,9 @@
                                                                Adjustment_ratio_Lower__c,
                                                                Adjustment_Lower_price__c,
                                                                Adjustment_Upper_price__c,
                                                                // 服务合同报价规则改善 20230227 start
                                                                // IS_StandardPricing__c,
                                                                // 服务合同报价规则改善 20230227 end
                                                                Last_inspection_day__c,
                                                                Check_Result__c,
                                                                Repair_Price__c,
@@ -1189,6 +1289,9 @@
                                                                Repair_Price_Auto__c,
                                                                Third_Party_Return__c,
                                                                 //   (2022年12月上线)故障品加费 end 
                                                                // 报价规则改善 20230308 start
                                                                 // Blank_period__c,
                                                                // 报价规则改善 20230308 end
                                                                Comment__c,
                                                                Asset__r.Posting_Date__c,
                                                                EquipmentGuaranteeFlgTxt__c,
@@ -1198,6 +1301,15 @@
                                                                Last_MContract__c
                                                                // Gzw 20200807 五个去年合同相关,所以报价产品,获取上期合同 eng
                                                                // LJPH-C9GD34 gzw fix start
                                                                //市场多年保修价格开发 2023/01/28 start
                                                                ,Asset__r.Product2.Asset_Model_No__c
                                                                ,Asset__r.Product2.Category4__c
                                                                ,Asset__r.CurrentContract_F_asset__r.Asset_Consumption_Rate__c
                                                                ,Asset__r.CurrentContract_F_asset__r.Maintenance_Price_Year__c
                                                                ,Asset__r.CurrentContract_F_asset__r.IS_VMContract_Asset__c
                                                                ,Asset__r.CurrentContract_F__r.endDateGurantee__c
                                                                //市场多年保修价格开发 2023/01/28 end
                                                                ,Estimate_List_Price_Page__c
                                                                FROM Maintenance_Contract_Asset_Estimate__c
                                                                WHERE Maintenance_Contract_Estimate__c = :this.targetEstimateId
@@ -1246,6 +1358,7 @@
        // Map<String,repair__c> assNewRepMap  = new Map<String,repair__c>();
        // assNewRepMap = getNewrep(this.assetRecords);
        datatemp = getChartData();
        System.debug(LoggingLevel.INFO, '*** this.assetRecords: ' + this.assetRecords);
        for (Asset ast : this.assetRecords) {
            Boolean isNew = false;
            Decimal listPrice = ast.Maintenance_Price_Month__c;
@@ -1302,7 +1415,9 @@
                //
                //
                //
                ast.CurrentContract_End_Date__c = ast.CurrentContract_F_asset__r.IS_VMContract_Asset__c ? ast.Extend_Gurantee_DateTo__c : ast.CurrentContract_End_Date__c;
                checkedAssets.add(new AssetInfo(checkedAssets.size(), ast, isNew, listPrice, selectedLocal,estimate));
            } else {
                //update by rentongxiao 2020-09-23 start
                if (ast.AssetMark__c == '主机') {
@@ -1323,6 +1438,8 @@
               }
             */
        }
            System.debug(LoggingLevel.INFO, '*** checkedAssets: ' + checkedAssets);
        totalPage = (totalRecords / selctRecordNum) + (Math.mod(totalRecords, selctRecordNum) > 0 ? 1 : 0);
    
        system.debug('顺序检测' + checkedAssets);
@@ -1349,7 +1466,7 @@
        //2021-11-30 fy add LJPH-C8W8FV 置顶 start
        List<AssetInfo> topAsset =new List<AssetInfo>();
        List<AssetInfo> otherAsset =new List<AssetInfo>();
        System.debug(LoggingLevel.INFO, '*** 顺序: ' + checkedAssets);
        for(AssetInfo ched : checkedAssets){
            system.debug('顺序检测2' + ched.ProductModelNoc);
            system.debug('顺序检测3' + ched.AssetModelNoc);
@@ -1374,6 +1491,7 @@
        }
        checkedAssets=NumberSort;
        //2021-11-30 fy add LJPH-C8W8FV 置顶 end
    System.debug(LoggingLevel.INFO, '*** checkedAssetsEND: ' + checkedAssets);
    }
    
    //
@@ -1421,6 +1539,14 @@
                            //URF限次合同2期 LY 20220811 start
                            + 'URF_Maintenance_Contract__c,URF_Maintenance_Contract__r.Management_Code__c,URF_Maintenance_Contract__r.Contract_End_Date__c,'
                            //URF限次合同2期 LY 20220811 end
                            //市场多年保价格开发 start DC 2023/01/17 设备消费率 产品型号 第四分类 是否为多年保设备
                            + 'CurrentContract_F_asset__r.Asset_Consumption_Rate__c,'
                            + 'CurrentContract_F_asset__r.Maintenance_Price_Year__c,'
                            + 'CurrentContract_F_asset__r.IS_VMContract_Asset__c,'
                            + 'Product2.Asset_Model_No__c,'
                            + 'Product2.Category4__c,'
                            + 'CurrentContract_F__r.endDateGurantee__c,'
                            //市场多年保价格开发 end DC 2023/01/17
                            + 'Product2.ProductURF__c,CurrentContract_F__r.Contract_Range__c,AssetMark__c,NoPartRiskDate__c,NoPartRiskDate_F__c,Product2.PartSupplyFinishDate__c,SignableFlag__c FROM Asset WHERE Hospital__c = \'' + this.targetHospitalId + '\' '
                            + 'AND Id NOT IN ' + notInId;
            //HWAG-B4R3SS  START 20181026
@@ -1477,7 +1603,15 @@
            //URF限次合同2期 LY 20220811 start
            sqlStr += 'URF_Maintenance_Contract__c,URF_Maintenance_Contract__r.Management_Code__c,URF_Maintenance_Contract__r.Contract_End_Date__c,';
            //URF限次合同2期 LY 20220811 end
            //市场多年保价格开发 start DC 2023/01/17 设备消费率
            sqlStr += 'CurrentContract_F_asset__r.Asset_Consumption_Rate__c,CurrentContract_F_asset__r.IS_VMContract_Asset__c,CurrentContract_F_asset__r.Maintenance_Price_Year__c,Product2.Asset_Model_No__c,Product2.Category4__c,CurrentContract_F__r.endDateGurantee__c,';
            //市场多年保价格开发 start DC 2023/01/17
            sqlStr += ' CurrentContract_F__r.Contract_Range__c,AssetMark__c,NoPartRiskDate__c,NoPartRiskDate_F__c,Product2.PartSupplyFinishDate__c,SignableFlag__c FROM Asset WHERE Hospital__c = \'' + this.targetHospitalId + '\'';
            //JZHG-BSDUT4 ---20200825---update By rentongxiao---Start
            // sqlStr += '  AND ( AssetMark__c != \'耗材\' OR Product2.Family != \'ET\' ) ';
            //JZHG-BSDUT4 ---20200825---update By rentongxiao---End
@@ -1679,6 +1813,9 @@
            and Agreed_Date__c != null
            and Agreed_Date__c > :LastYearDate
            and Agreed_Date__c <= :today
            // DB202302544421 LHJ add
            and Status2__c !='00.删除'
            and Status2__c !='00.取消'
            group by Delivered_Product__c
        ];
        List<AggregateResult> SecRepairList = [
@@ -1703,6 +1840,9 @@
            and Agreed_Date__c != null
            and Agreed_Date__c <= :LastYearDate
            and Agreed_Date__c > :LastSecondYearDate
            // DB202302544421 LHJ add
            and Status2__c !='00.删除'
            and Status2__c !='00.取消'
            group by Delivered_Product__c
        ];
        // 过去3年间修理实绩
@@ -1728,6 +1868,9 @@
            and Agreed_Date__c != null
            and Agreed_Date__c <= :LastSecondYearDate
            and Agreed_Date__c > :LastThirdYearDate
            // DB202302544421 LHJ add
            and Status2__c !='00.删除'
            and Status2__c !='00.取消'
            group by Delivered_Product__c
        ];
        // 过去3年修理实绩
@@ -1753,6 +1896,9 @@
            and Agreed_Date__c != null
            and Agreed_Date__c <= :today
            and Agreed_Date__c > :LastThirdYearDate
            // DB202302544421 LHJ add
            and Status2__c !='00.删除'
            and Status2__c !='00.取消'
            group by Delivered_Product__c
        ];
    
@@ -1894,6 +2040,9 @@
            and Agreed_Date__c != null
            and Agreed_Date__c > :LastYearDate
            and Agreed_Date__c <= :today
            // DB202302544421 LHJ add
            and Status2__c !='00.删除'
            and Status2__c !='00.取消'
            group by Delivered_Product__c
        ];
        List<AggregateResult> SecRepairList = [
@@ -1918,6 +2067,9 @@
            and Agreed_Date__c != null
            and Agreed_Date__c <= :LastYearDate
            and Agreed_Date__c > :LastSecondYearDate
            // DB202302544421 LHJ add
            and Status2__c !='00.删除'
            and Status2__c !='00.取消'
            group by Delivered_Product__c
        ];
        // 过去3年间修理实绩
@@ -1943,6 +2095,9 @@
            and Agreed_Date__c != null
            and Agreed_Date__c <= :LastSecondYearDate
            and Agreed_Date__c > :LastThirdYearDate
            // DB202302544421 LHJ add
            and Status2__c !='00.删除'
            and Status2__c !='00.取消'
            group by Delivered_Product__c
        ];
        // 过去3年修理实绩
@@ -1968,6 +2123,9 @@
            and Agreed_Date__c != null
            and Agreed_Date__c <= :today
            and Agreed_Date__c > :LastThirdYearDate
            // DB202302544421 LHJ add
            and Status2__c !='00.删除'
            and Status2__c !='00.取消'
            group by Delivered_Product__c
        ];
        // 过去1年间
@@ -2835,6 +2993,30 @@
        return new PageReference('/' + this.targetEstimateId + '/e?completion=4');
    
    }
    //贸易合规 you start
    public PageReference interceptsend(){
        //String BuchangApprovalManager = this.estimate.BuchangApprovalManager__c;
        //String JingliApprovalManager = this.estimate.JingliApprovalManager__c;
        String fseid = this.estimate.CreatedById;
        String AccDealerBlacklist = this.estimate.Maintenance_Contract__r.AccDealerBlacklist__c;
        String accname = this.estimate.Maintenance_Contract__r.Hospital__r.Name;
        String deaname = this.estimate.Maintenance_Contract__r.Dealer__r.Name;
        //FSE领导
        String[] FSEStr = new String[] {};
        //if(String.isNotBlank(BuchangApprovalManager)){
        //    FSEStr.add(BuchangApprovalManager);
        //}
        //if(String.isNotBlank(JingliApprovalManager)){
        //    FSEStr.add(JingliApprovalManager);
        //}
        FSEStr.add(fseid);
        system.debug('==jinlaile====='+FSEStr);
        Boolean reflag = OpportunityWebService.accSendEmailFW(AccDealerBlacklist,accname,deaname,this.targetEstimateId,'decide_con',FSEStr);
        system.debug('==fawanle====='+FSEStr);
        return null;
    }
    //贸易合规 you end
    
    /**
     * Process用のユーザー情報をセット、新規見積もり時用
@@ -3345,6 +3527,26 @@
                                                                where Maintenance_Contract__c = :this.estimate.Maintenance_Contract__c]) {
                delete oldList;
            }
            //市场多年保价格开发 DC 2023/02/08 start
            // Map<String,Decimal> contractAssetFZ = new Map<String,Decimal>();
            // List<Maintenance_Contract_Asset__c> oldListMA = new List<Maintenance_Contract_Asset__c>();
            // for (Maintenance_Contract_Asset__c oldmc : [select Id
            //                                                     // ,Summary_FM_Year__c
            //                                                     // ,Asset_Consumption_Rate__c
            //                                                     ,Summary_FZ__c
            //                                                     ,Asset__c
            //                                                     // ,Over_FM_Year__c
            //                                                     // ,Summary_FM_Months__c
            //                                                     from Maintenance_Contract_Asset__c
            //                                                     where Maintenance_Contract__c = :this.estimate.Maintenance_Contract__c]) {
            //     oldListMA.add(oldmc);
            //     contractAssetFZ.put(oldmc.Asset__c, oldmc.Summary_FZ__c);
            // }
            // delete oldListMA;
            //市场多年保价格开发 DC 2023/02/08 end
            // ② start
            {
                List<Maintenance_Contract_Asset__c> newValue = new List<Maintenance_Contract_Asset__c>();
@@ -3370,6 +3572,7 @@
                                                                      from Maintenance_Contract_Asset_Estimate__c
                                                                      where Maintenance_Contract_Estimate__c = :this.estimate.Id and Asset__c <> null]) {
    
                    Maintenance_Contract_Asset__c newVal = new Maintenance_Contract_Asset__c(
                        Maintenance_Contract__c = this.estimate.Maintenance_Contract__c,
                        Asset__c = target.Asset__c,
@@ -3391,13 +3594,22 @@
                        Surcharge_Defective_Contract__c = target.Surcharge_Defective_Contract__c,
                        //故障品加费  第三方回归、故障品加费 标识end
                        //市场多年保价格开发 start DC 2023/02/09
                        // Summary_FZ__c = contractAssetFZ.get(target.Asset__c),
                        //市场多年保价格开发 end DC 2023/02/09
                        LastMContract__c = target.Last_MContract__r.RecordType_DeveloperName__c == 'VM_Contract' ? null : target.Last_MContract__c
                        );
                    // System.debug(LoggingLevel.INFO, '*** contractAssetFZ.get(target.Asset__c): ' + contractAssetFZ.get(target.Asset__c));
                    newValue.add(newVal);
                }
                if (newValue.size() > 0) insert newValue;
            }
            // ④ start
            // 报价规则改善 20230309 start
            // this.contract.Is_Blank_period__c = this.Is_Blank_period;
            // 报价规则改善 20230309 end
            this.contract.Estimation_Id__c = this.targetEstimateId;     
            this.contract.Contract_Esti_Start_Date__c = this.estimate.Contract_Esti_Start_Date__c;
            this.contract.Contract_Range__c = this.estimate.Contract_Range__c;
@@ -3649,7 +3861,8 @@
    
    // 2021-02-07  gzw add  LJPH-BWY5QB start
    private void setEndUserType(String id) {
        this.contract = [SELECT Id, Name, Status__c, Decided_Estimation__c, Service_Contract_Staff__c,
        //贸易合规 you 20230414 加查询AccDealerBlacklist__c
        this.contract = [SELECT Id, Name,AccDealerBlacklist__c, Status__c, Decided_Estimation__c, Service_Contract_Staff__c,
                         Estimate_Num__c, Management_Code__c, Hospital__c,
                         Hospital__r.MaintenanceContractUserType__c,
                         Contract_Start_Date__c, Contract_End_Date__c, VM_Contract_Check__c,Open_RenewalQuotation__c
@@ -3662,7 +3875,8 @@
    // 2021-02-07  gzw add  LJPH-BWY5QB end
    
    private void setContractInfo(String id) {
        this.contract = [SELECT Id, Name, Status__c, Decided_Estimation__c, Service_Contract_Staff__c,
        //贸易合规 you 20230414 加查询AccDealerBlacklist__c
        this.contract = [SELECT Id, Name,AccDealerBlacklist__c, Status__c, Decided_Estimation__c, Service_Contract_Staff__c,
                         Estimate_Num__c, Management_Code__c, Hospital__c,
                         //2021-01-18  mzy add  LJPH-BWY5QB   客户上的 维修合同用户类型 为true /false,报价 用户类型为 既有用户 / 新用户
                         // Hospital__r.MaintenanceContractUserType__c,
@@ -3797,21 +4011,41 @@
            // modify by lc 20220607 多年保续签和实绩连动状态对应 start
            Integer noOfDays = today.daysBetween(input.rec.CurrentContract_F_asset__r.endDateGurantee_Text__c);
            Decimal monthCon = (Decimal)noOfDays/365*12;
            //市场多年保修价格开发 DC 2023/02/02 Start  结束日空白期大于6个月 报错提示 新的合同报价开始日期和上一期合同
            Date endDate6Month = input.rec.CurrentContract_F_asset__r.endDateGurantee_Text__c.addMonths(6);
            Date cotractEndDay = input.rec.CurrentContract_F__r.endDateGurantee__c;
            System.debug(LoggingLevel.INFO, '*** endDate6Month: ' + endDate6Month);
            System.debug(LoggingLevel.INFO, '*** cotractEndDay: ' + cotractEndDay);
            System.debug(LoggingLevel.INFO, '*** this.estimate.Contract_Esti_Start_Date__c: ' + this.estimate.Contract_Esti_Start_Date__c);
            if(this.estimate.Contract_Esti_Start_Date__c >endDate6Month && cotractEndDay < this.estimate.Contract_Esti_Start_Date__c){
                System.debug(LoggingLevel.INFO, '*** meet error: ' );
                input.rec.Name.addError(input.rec.Name + '(' + input.rec.SerialNumber + ') -- 市场多年保结束已超过6个月,由于空白期过长,请先联系服务管理部评估。');
                rtn = false;
            }
            //市场多年保修价格开发 DC 2023/02/02 end
            // 可开始报价的月数限制
            //变更多年保续签开始日 thh 20220315 start
            //if (input.rec.CurrentContract_F__r.Gurantee_Estimate_startDate__c > Date.today()) {
            // gzw 20220630 开通续签报价权限后,超过6个月也可以续签
            // 续签情况 ① 上期合同 Open_RenewalQuotation__c & 6个月以内  ② VM_Contract_Check__c Open_RenewalQuotation__c 2个都打钩
            // ① 2个开关都打开 ②VM_Contract_Check__c打开 小于6个月
            if (!((this.contract.Open_RenewalQuotation__c && input.rec.CurrentContract_F__r.VM_Contract_Check__c) || (input.rec.CurrentContract_F__r.VM_Contract_Check__c && monthCon < 6))) {
                if(monthCon < 6){
                    input.rec.Name.addError(input.rec.Name + '(' + input.rec.SerialNumber + ') -- 可以加入服务合同,加入价格请联系服务管理部。');
                }else{
                    input.rec.Name.addError(input.rec.Name + '(' + input.rec.SerialNumber + ') -- 没有续签报价权限,或者还没到续签时间。');
                }
            // if (!((this.contract.Open_RenewalQuotation__c && input.rec.CurrentContract_F__r.VM_Contract_Check__c) || (input.rec.CurrentContract_F__r.VM_Contract_Check__c && monthCon < 6))) {
            //     if(monthCon < 6){
            //         input.rec.Name.addError(input.rec.Name + '(' + input.rec.SerialNumber + ') -- 可以加入服务合同,加入价格请联系服务管理部。');
            //     }else{
                //input.rec.Name.addError(input.rec.Name + '(' + input.rec.SerialNumber + ') -- 没有续签报价权限,或者还没到续签时间。');
                rtn = false;
            }
            //     }
            //     System.debug(LoggingLevel.INFO, '*** this.contract.Open_RenewalQuotation__c: ' + this.contract.Open_RenewalQuotation__c);
            //     System.debug(LoggingLevel.INFO, '*** : input.rec.CurrentContract_F__r.VM_Contract_Check__c' + input.rec.CurrentContract_F__r.VM_Contract_Check__c);
            //     System.debug(LoggingLevel.INFO, '*** monthCon: ' + monthCon);
            //     //input.rec.Name.addError(input.rec.Name + '(' + input.rec.SerialNumber + ') -- 没有续签报价权限,或者还没到续签时间。');
            //     rtn = false;
            // }
            /*if (input.rec.CurrentContract_F__r.Gurantee_Renew_startDate__c > Date.today()) {
                input.rec.Name.addError(input.rec.Name + '(' + input.rec.SerialNumber + ') -- 第一个设备结束后可以制作报价。');
                rtn = false;
@@ -3968,6 +4202,7 @@
    public class AssetInfo {
    // 新合同备品确保提供 当前标记
    public Boolean etGFlg {get; set;}
    public String ISStandardPricing{get; set;}
    public Integer lineNo {get; private set;}
    public Decimal Repair_Price_Auto {get; set;}
    public String Agreed_Date{get; set;}
@@ -3978,6 +4213,7 @@
    public Maintenance_Contract_Estimate__c estimate {get; set;}
    public Transient Decimal orgPrice {get; private set;}
    public Transient Decimal orgPrice12 {get; private set;}
    public String Blank_period {get;  set;}
    // add by fxk 2021/9/9 控制点检对象是否可选 Star
    public Boolean CheckRows {get; private set;}
    // add by fxk 2021/9/9 控制点检对象是否可选 End
@@ -3998,7 +4234,9 @@
    public String AssetModelNoc;
    public String MDMModelNoc;
    //2021-11-30 fy add LJPH-C8W8FV 置顶 end
    //市场多年保 价格开发 start 2023/01/17
    public String Category;
    //市场多年保 价格开发 end 2023/01/17
    public Id getRecId() {
        Id rtn = null;
        if (rec != null) {
@@ -4032,8 +4270,16 @@
    public AssetInfo(Integer lineNo, Asset record, Boolean isNew, Decimal listPrice, Maintenance_Contract_Asset_Estimate__c mcae,Maintenance_Contract_Estimate__c estimate) {
        this.lineNo = lineNo;
        this.rec = record;
        this.rec.CurrentContract_End_Date__c = record.CurrentContract_End_Date__c;
        // this.rec.CurrentContract_End_Date__c = record.IS_Extend_Gurantee__c ? record.Extend_Gurantee_DateTo__c : record.CurrentContract_End_Date__c;
        // this.ISStandardPricing = record.IS_StandardPricing__c;
        this.estimate = new Maintenance_Contract_Estimate__c();
        this.estimate.IS_Reduced_price_approval__c = estimate.IS_Reduced_price_approval__c;
         // 报价规则改善 20230308 start
        // this.estimate.Contract_Esti_Start_Date__c = estimate.Contract_Esti_Start_Date__c;
        // this.estimate.renewTen_OFF__c = estimate.renewTen_OFF__c;
         // 报价规则改善 20230308 end
        //   (2022年12月上线)故障品加费 start
        // if (record.Asset_situation__c == '修理中' && record.Return_Without_Repair__r.Agreed_Date__c!=null) {
        //     this.Agreed_Date = '不为空';
@@ -4062,6 +4308,9 @@
            Check_Result__c = mcae.Check_Result__c,
            Repair_Price__c = mcae.Repair_Price__c,
            Repair_Price_pass__c = mcae.Repair_Price_pass__c,
            // 报价规则改善 20230308 start
            // Blank_period__c = mcae.Blank_period__c,
            // 报价规则改善 20230308 end
            Comment__c = mcae.Comment__c,
            EquipmentGuaranteeFlgTxt__c = mcae.EquipmentGuaranteeFlgTxt__c,
            Estimate_Cost__c = mcae.Estimate_Cost__c,
@@ -4085,6 +4334,17 @@
                this.mcae.Repair_Price_pass__c = this.mcae.Repair_Price__c;
            }
        }
         // 报价规则改善 20230308 start
            // if (this.estimate.Contract_Esti_Start_Date__c!=null  && this.rec.CurrentContract_End_Date__c != null) {
            //        this.mcae.Blank_period__c = String.valueof(this.rec.CurrentContract_End_Date__c.daysbetween(this.estimate.Contract_Esti_Start_Date__c));
            // }
            // if (this.estimate.Contract_Esti_Start_Date__c==null && this.rec.CurrentContract_End_Date__c != null) {
            //        this.mcae.Blank_period__c = String.valueof(this.rec.CurrentContract_End_Date__c.daysbetween(system.today()));
            // }
            // if (this.mcae.Blank_period__c!=null&&integer.valueOf(this.mcae.Blank_period__c)<15 ) {
            //         this.mcae.Blank_period__c = '无缝续签';
            // }
        // 报价规则改善 20230308 end
        this.isManual = false;
        this.rec_checkBox_c = true;
        this.orgPrice = record.Maintenance_Price_Month__c;
@@ -4100,6 +4360,11 @@
        //2021-11-30 fy add LJPH-C8W8FV 置顶 end
    
        //add by rentx 2020-11-12 LJPH-BV93RZ end
        //市场多年保 价格开发 start 2023/01/17
        this.Category = mcae.Product_Manual__r.Category4__c;
        //市场多年保 价格开发 end 2023/01/17
        //add by mzy 2021-02-07 start
        //this.NoPartRiskDate = mcae.Product_Manual__r.NoPartRiskDate_F__c;
        //this.proName2 = mcae.Product_Manual__r.Name;
@@ -4153,6 +4418,10 @@
        this.ProductModelNoc = mcae.Product_Manual__r.Asset_Model_No__c;
        this.AssetModelNoc = mcae.Asset__r.OwnershipMachine_No__c;
        //2021-11-30 fy add LJPH-C8W8FV 置顶 end
        //市场多年保 价格开发 start 2023/01/17
        this.Category = mcae.Product_Manual__r.Category4__c;
        //市场多年保 价格开发 end 2023/01/17
    }
    
    // 選択されなかった用
@@ -4160,11 +4429,6 @@
        this.lineNo = lineNo;
        this.rec = record;
        //   (2022年12月上线)故障品加费 start
        // if (record.Return_Without_Repair__r.Agreed_Date__c!=null) {
        //     this.Agreed_Date = '不为空';
        // }else{
        //     this.Agreed_Date = '为空';
        // }
        if (record.Return_Without_Repair__r.Repair_List_Price_formula__c!=null) {
            this.Repair_Price_Auto = record.Return_Without_Repair__r.Repair_List_Price_formula__c;
        }
@@ -4177,7 +4441,7 @@
        this.proSerialName = record.Name;
        this.proSerialNumber = record.SerialNumber;
    }
    // public AssetInfo(Integer lineNo, Asset record, Map<String,repair__c> assNewRepMap) {
    // public AssetInfo(Integer lineNo, Asset record) {
    //     this.lineNo = lineNo;
    //     this.rec = record;
    //     //   (2022年12月上线)故障品加费 start
force-app/main/default/pages/SelectAssetEstimateURF.page
@@ -1232,6 +1232,24 @@
            var dayStr = '00' + contractDate.getDate();
            dayStr = dayStr.substring(dayStr.length-2, dayStr.length);
            var contractDateStr = contractDate.getFullYear() + '/' + monthStr + '/' + dayStr;
            //贸易合规 you 20230414 start
            var AccDealerBlacklist = j$(escapeVfId('allPage:allForm:AccDealerBlacklist')).value();//黑名单,警示名单
            var TradeComplianceStatusFlagFW = '{!$Label.TradeComplianceStatusFlagFW}';//贸易合规开关
            var IFTradeComplianceAlert = '{!$Label.IFTradeComplianceAlert}';//贸易合规提醒
            if(TradeComplianceStatusFlagFW=='true'){
            if(AccDealerBlacklist =='1'){
               alert('您所选择的客户(医院/经销商)存在贸易合规风险,无法签订服务合同,建议您向客户做好不签约说明,'+IFTradeComplianceAlert);
               var reflag = interceptsend();
               unblockUI();
               return null;
            }else if(AccDealerBlacklist =='2'){
               if (!confirm('您所选择的客户(医院/经销商)存在贸易合规警示风险,不建议签订服务合同,请您确认是否继续申请,'+IFTradeComplianceAlert)) {
                    unblockUI();
                    return null;
                }
            }
            }
            //贸易合规 you 20230414 end
            //var neDt = contractDate.getFullYear() + contractDate.getMonth() + contractDate.getDate();
            //monthStr = '00' + (oldDate.getMonth()+1);
@@ -1400,6 +1418,9 @@
    <apex:inputHidden id="changedAfterPrint" value="{!changedAfterPrint}"/>
    <apex:inputHidden id="changedSubmitPrice" value="{!changedSubmitPrice}"/>
    <apex:inputHidden id="isSaveOrApproval" value="{!isSaveOrApproval}"/>
    <!-- 贸易合规 you 20230414-->
    <apex:inputHidden id="AccDealerBlacklist" value="{!contract.AccDealerBlacklist__c}"/>
    <apex:actionFunction name="interceptsend" action="{!interceptsend}"  oncomplete="unblockUI();"/>
    <!-- HWAG-B4R3SS  START 20181026-->
    <apex:actionFunction name="searchfunc" action="{!searchBtn}" rerender="Form,Block,assetSection2,pageMessages,allBlock" onComplete="unblockUI();"></apex:actionFunction>
force-app/main/default/pages/SelectAssetEstimateVM.page
@@ -42,13 +42,8 @@
var RCbottonChanged = 0;
// 2022故障品加费 start
// var RCButtonDisable = document.getElementById("emailSend");
// RCButtonDisable.style.display = "none";
// 2022故障品加费 end
var hasSendEmail = {!hasSendEmail};
console.log('***hasSendEmail',hasSendEmail);
// if(hasSendEmail == true){
//     j$(escapeVfId('allPage:allForm:emailSend')).attr("disabled", true);
//     j$(escapeVfId('allPage:allForm:emailSend')).attr("class", 'btnDisabled');
@@ -161,6 +156,7 @@
    // if(!ResonCannotWarranty.contains("弃修")){
    //     j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Repair_Price_Auto')).attr("display", none);
    // }
    if (isDisabled) {
        j$(escapeVfId('allPage:allForm:allBlock:contract:depart')).attr("disabled", true);
@@ -169,7 +165,6 @@
        j$(escapeVfId('allPage:allForm:allBlock:contract:estimateTarget')).attr("disabled", true);
        j$(escapeVfId('allPage:allForm:allBlock:contract:EndUserType')).attr("disabled", true);
        var rowCnt = {!productCount};
        console.log('isDisabled='+isDisabled);
        for (var i = 0; i < rowCnt; i++) {
            // alert(11111111111111 +rowCnt);
            var isManual = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':IsManual')).text();
@@ -250,8 +245,35 @@
    // disable1();
    // 2021、8、26 合同报价页面的优化,无保有设备点检对象选择框变黑 fxk end
    console.log('ApprovalBtnDisabled=='+{!ApprovalBtnDisabled});
    pageSetDisabled();
    refreshAsset({!productCount});
    //上限合同 20230103 hql start
    // console.log('Limit_PriceHidden2=='+Limit_PriceHidden2);
    var RequestquotationAmount = j$(escapeVfId('allPage:allForm:allBlock:contractInfo:quotation_Amount')).val();
    console.log('申请报价金额='+RequestquotationAmount);
    var AssetRepairSumPrice    = j$(escapeVfId('allPage:allForm:allBlock:contractInfo:assetRepairSumPrice')).text();
    console.log('合同设备修理总额='+AssetRepairSumPrice);
    Limit_Price_Amount = (localParseFloat(AssetRepairSumPrice)+localParseFloat(RequestquotationAmount))*1.3;
    Limit_Price_Amount = Math.round(Limit_Price_Amount);
    // console.log('Limit_Price_Amount'+Limit_Price_Amount);
    Limit_Price_AmountOne =  j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Limit_Price_Amount')).value();
    Limit_PriceHidden =  j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Limit_PriceHidden')).value();
    if (Limit_PriceHidden*1==0) {
        j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Limit_Price_Amount')).val(Limit_Price_Amount);
    }
    Limit_PriceHidden2 =  j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Limit_Price2Hidden')).value();
    if (Limit_PriceHidden2 == 'false') {
        // lpa =  document.getElementById('allPage:allForm:allBlock:contractInfo:Limit_Price_Amount');
        // lpa.style.display = "none";
        // console.log('隐藏完毕');
        j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Limit_Price_Amount')).val('');
    }
    Price111 = j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Limit_Price_Amount')).val();
    // console.log('上限金额为'+Limit_Price_Amount);
    // console.log('原有上限金额为'+Limit_PriceHidden);
    // console.log('不是上限合同的金额为'+Price111);
    //上限合同 20230103 hql end
    pageSetDisabled();
    var createdDate = new Date('{!estimate.CreatedDate}');
    // 报价中设备的机身编码为空时的新品合同有效期延长 20200710 gzw
    var aLLManual = 'true';
@@ -340,6 +362,7 @@
    }
    
    if ('{!DecideBtnDisabled}' == 'false') {
        // console.log('oldMainteReal修改完成');
        j$(escapeVfId('allPage:allForm:allBlock:contractInfo:oldMainteReal')).val(j$(escapeVfId('allPage:allForm:allBlock:contractInfo:mainteReal')).text());
    }
}
@@ -370,6 +393,7 @@
}
function checkDiscount(val) {
    // var alerts = 0;
    if (val == null || val == "") {
        j$(escapeVfId('allPage:allForm:allBlock:contractInfo:quotation_Amount')).val("");
        j$(escapeVfId('allPage:allForm:allBlock:contractInfo:discount_Rate')).text("");
@@ -381,10 +405,53 @@
        j$(escapeVfId('allPage:allForm:allBlock:contractInfo:quotation_Amount')).val(0.00);
        return;
    }
    // 报价金额改善 20230314 start
    // var startime1 =  new Date(j$(escapeVfId('allPage:allForm:allBlock:contractInfo:PastContractendday')).value());
    // var startime2 = new Date(j$(escapeVfId('allPage:allForm:allBlock:contract:startdate')).value());
    // var result = (startime2-startime1)/(3600*24*1000);
    // Is_Blank_period1 =  j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Is_Blank_period')).value();
    // Cost_rate_ForecastF =  j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Cost_rate_ForecastF')).value();
    // downprice = j$(escapeVfId('allPage:allForm:allBlock:contractInfo:GuidePriceDown')).value();
    // var renewTenOFF = j$(escapeVfId('allPage:allForm:allBlock:contractInfo:renewTenOFF')).value();
    // if (Is_Blank_period1 == 'true' && ((parseFloat(Cost_rate_ForecastF)<100)||Cost_rate_ForecastF.length == 0) && result <=1 && downprice > val ) {
    //    alerts = 1;
    // }
    // if (alerts == 1 && renewTenOFF == 'false') {
    //     if (confirm("本单可以继续申请10%折扣,请确认是否申请,申请后合同开始日自动锁定为合同预定开始日,后续无法更改合同开始日")) {
    //         j$(escapeVfId('allPage:allForm:allBlock:contractInfo:renewTenOFF')).val(true);
    //         val = val*0.9;
    //         j$(escapeVfId('allPage:allForm:allBlock:contract:startdate')).attr("disabled", true);
    //     } else {
    //     }
    // }
    // 报价金额改善 20230314 end
    val = localParseFloat(val);
    //val = Math.round(val * 100) / 100;
    val = Math.round(val);
    j$(escapeVfId('allPage:allForm:allBlock:contractInfo:quotation_Amount')).val(toNumComma(val));
    //上限合同 20230117 HQL start
    var RequestquotationAmount = j$(escapeVfId('allPage:allForm:allBlock:contractInfo:quotation_Amount')).val();
    console.log('申请报价金额='+RequestquotationAmount);
    var AssetRepairSumPrice    = j$(escapeVfId('allPage:allForm:allBlock:contractInfo:assetRepairSumPrice')).text();
    console.log('合同设备修理总额='+AssetRepairSumPrice);
    Limit_Price_Amount = (localParseFloat(AssetRepairSumPrice)+localParseFloat(RequestquotationAmount))*1.3;
    Limit_Price_Amount = Math.round(Limit_Price_Amount);
    Limit_Price_AmountOne =  j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Limit_Price_Amount')).value();
    Limit_PriceHidden =  j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Limit_PriceHidden')).value();
    // if (Limit_PriceHidden*1==0) {
        j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Limit_Price_Amount')).val(Limit_Price_Amount);
    // }
    Limit_PriceHidden2 =  j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Limit_Price2Hidden')).value();
    if (Limit_PriceHidden2 == 'false') {
        // lpa =  document.getElementById('allPage:allForm:allBlock:contractInfo:Limit_Price_Amount');
        // lpa.style.display = "none";
        // console.log('隐藏完毕');
        j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Limit_Price_Amount')).val('');
    }
    amount = j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Limit_Price_Amount')).value();
    console.log('上限金额填入:'+amount);
    //上限合同 20230117 HQL end
   makeRealPrice(1);
}
@@ -418,7 +485,189 @@
    ISReducedpriceapproval = j$(escapeVfId('allPage:allForm:allBlock:ISReducedpriceapproval')).val();
    console.log('方法2是否审批通过=='+ISReducedpriceapproval+'==============');
}
var number1 = 0;
// function seamlessRenew(cnt){
//     // 报价规则改善 20230309 start
//     var isSeamlessRenew = 0;
//     var isSeamlessRenew1 = 0;
//     var isSeamlessRenew3 = 0;
//     var isSeamlessRenew4 = 0;
//     // 报价规则改善 20230309 end
//     // 报价规则改善 20230310 start
//     var downPriceSum = 0;
//     var upPriceSum = 0;
//     var downPriceSum1 = 0;
//     var upPriceSum1 = 0;
//     var downPriceSum3 = 0;
//     var upPriceSum3 = 0;
//     var downPriceSum4 = 0;
//     var upPriceSum4 = 0;
//     // 报价规则改善 20230310 end
//     // 报价规则改善 20230310 start
//     var renewTenOFF = j$(escapeVfId('allPage:allForm:allBlock:contractInfo:renewTenOFF')).value();
//     if (renewTenOFF == 'true') {
//         j$(escapeVfId('allPage:allForm:allBlock:contract:startdate')).attr("disabled", true);
//     }
//         document.getElementById("startdateaddsix1").value = addMonths(j$(escapeVfId('allPage:allForm:allBlock:contractInfo:PastContractendday')).value(),6);
//         document.getElementById("startdateaddsix2").value = addMonths(j$(escapeVfId('allPage:allForm:allBlock:contractInfo:PastContractendday')).value(),6);
//         document.getElementById("startdateaddsix3").value = addMonths(j$(escapeVfId('allPage:allForm:allBlock:contractInfo:PastContractendday')).value(),12);
//     // 报价规则改善 20230310 end
//     for (var i = 0; i < cnt; i++) {
//         // 报价规则改善 20230310 start
//         var  downPrice1 = 0;
//         var  upPrice1 = 0;
//         var  downPrice3 = 0;
//         var  upPrice3 = 0;
//         var  downPrice4 = 0;
//         var  upPrice4 = 0;
//          var Price_YearTXT = 0;
//         var LastMContract_Price = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':LastMContract_Price')).val());
//         var isnew = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetNewHidden')).val();
//         // 合同月数乗算
//         var month = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:contract:monthRange')).val());
//         if (month == undefined || month == "") {
//             month = 1;
//         }
//         var month2 = 0;
//         if (month > 12) {
//             month2 = month - 12;
//             month = 12;
//         }
//         var b = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Contract_No')).value();
//         var LastMContractRecord = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':LastMContractRecord')).value();
//         if(b != ''){
//                     // var lastendDate = new Date(j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':End_Date')).value());
//                     var lastContRange = 0;
//                     if(LastMContractRecord == 'VM_Contract'){
//                         // lastendDate = new Date(j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':endDateGurantee_Text')).value());
//                         lastContRange = 36;
//                     }else{
//                         lastContRange = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':lastContRange')).value();
//                     }
//         }
//         var Punish = calculateNtoMRatio( lastContRange,(month + month2));
//          // 报价规则改善 20230310 end
//         if (!isDisabled) {
//             var Adjustment_ratio_Lower = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_ratio_Lower')).val());
//             var Adjustment_ratio_Upper = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_ratio_Upper')).val());
//              strMoney = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPriceHidden')).val();
//                 Price_YearTXT = strMoney * 12;
//                 if (isnew == 'true') {
//                     strMoney = month * strMoney + month2 * strMoney / {!isNewPriceAdj};
//                 } else {
//                     strMoney = month * strMoney + month2 * strMoney;
//                 }
//             // 服务合同报价规则改善 20230227 start
//                     var LastMContractID = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':LastMContractID')).value();
//                     // var ISStandardPricing = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':ISStandardPricing')).value();
//                     // 缺少首签设备逻辑
//                     if (LastMContractID == '') {
//                         console.log('新签设备');
//                         j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Lower_price')).text(toNumComma(strMoney));
//                         j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Lower_priceHidden')).val(strMoney);
//                         j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Upper_price')).text(toNumComma(strMoney));
//                         j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Upper_priceHidden')).val(strMoney);
//                     }
//             // 服务合同报价规则改善 20230227 end
//             var startdate11 = j$(escapeVfId('allPage:allForm:allBlock:contractInfo:PastContractendday')).value();
//             var startdate1 = j$(escapeVfId('allPage:allForm:allBlock:contract:startdate')).value();
//             var startdate = new Date(startdate1);
//             var startdatesix1 = new Date(addMonths(startdate11,6));
//             startdatesix1.setDate(startdatesix1.getDate()-1);
//             var startdatesix2 = new Date(addMonths(startdate11,6));
//             startdatesix2.setDate(startdatesix2.getDate()+1);
//             var startdatesix3 = new Date(addMonths(startdate11,12));
//             startdatesix3.setDate(startdatesix3.getDate()+1);
//             // 第一个日期
//             var result1 = Blankperiod(startdate,i,LastMContract_Price,Punish,Adjustment_ratio_Upper,Adjustment_ratio_Lower,strMoney,1);
//             var arr=result1.split( '/');
//             downPrice=parseInt(arr[0]);
//             upPrice=parseInt(arr[1]);
//             isSeamlessRenew=isSeamlessRenew+parseInt(arr[2]);
//             // console.log('result1='+result1);
//             // 第二个日期
//             var result2 = Blankperiod(startdatesix1,i,LastMContract_Price,Punish,Adjustment_ratio_Upper,Adjustment_ratio_Lower,strMoney,2);
//             var arr2=result2.split( '/');
//             downPrice1=parseInt(arr2[0]);
//             upPrice1=parseInt(arr2[1]);
//             isSeamlessRenew1=isSeamlessRenew1+parseInt(arr2[2]);
//             // console.log('result2='+result2);
//             // 第三个日期
//             var result3 = Blankperiod(startdatesix2,i,LastMContract_Price,Punish,Adjustment_ratio_Upper,Adjustment_ratio_Lower,strMoney,2);
//             var arr3=result3.split( '/');
//             downPrice3=parseInt(arr3[0]);
//             upPrice3=parseInt(arr3[1]);
//             isSeamlessRenew3=isSeamlessRenew3+parseInt(arr3[2]);
//             // console.log('result3='+result3);
//             // 第四个日期
//             var result4 = Blankperiod(startdatesix3,i,LastMContract_Price,Punish,Adjustment_ratio_Upper,Adjustment_ratio_Lower,strMoney,2);
//             var arr4=result4.split( '/');
//             downPrice4=parseInt(arr4[0]);
//             upPrice4=parseInt(arr4[1]);
//             isSeamlessRenew4=isSeamlessRenew4+parseInt(arr4[2]);
//             // console.log('result4='+result4);
//             // 报价规则改善 20230308 end
//             // 报价规则改善 20230310 start
//             downPriceSum = downPriceSum + localParseFloat(toNum(downPrice));
//             upPriceSum =  upPriceSum + localParseFloat(toNum(upPrice));
//             downPriceSum1 = downPriceSum1 + localParseFloat(toNum(downPrice1));
//             upPriceSum1 =  upPriceSum1 + localParseFloat(toNum(upPrice1));
//             downPriceSum3 = downPriceSum3 + localParseFloat(toNum(downPrice3));
//             upPriceSum3=  upPriceSum3 + localParseFloat(toNum(upPrice3));
//             downPriceSum4 = downPriceSum4 + localParseFloat(toNum(downPrice4));
//             upPriceSum4=  upPriceSum4 + localParseFloat(toNum(upPrice4));
//             // 报价规则改善 20230310 end
//         }
//     }
//     // 报价规则改善 20230309 start
//     // console.log('isSeamlessRenew='+isSeamlessRenew);
//         if (isSeamlessRenew==0) {
//             j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Is_Blank_period')).val(true);
//         }else{
//             j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Is_Blank_period')).val(false);
//         }
//         var startime1 =  new Date(j$(escapeVfId('allPage:allForm:allBlock:contractInfo:PastContractendday')).value());
//         var startime2 = new Date(j$(escapeVfId('allPage:allForm:allBlock:contract:startdate')).value());
//         var result = (startime2-startime1)/(3600*24*1000);
//         Is_Blank_period1 =  j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Is_Blank_period')).value();
//         Cost_rate_ForecastF =  j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Cost_rate_ForecastF')).value();
//         // 5.当预测成本率为空时实绩连动价格是否享受9折优惠
//         if (isSeamlessRenew==0 && ((parseFloat(Cost_rate_ForecastF)<100)||Cost_rate_ForecastF.length == 0)) {
//             downPriceSum = downPriceSum*0.9;
//             upPriceSum = upPriceSum*0.9;
//         }
//         if (isSeamlessRenew1==0) {
//             downPriceSum1 = downPriceSum1*0.9;
//             upPriceSum1 = upPriceSum1*0.9;
//         }
//         if (isSeamlessRenew3==0) {
//             downPriceSum3 = downPriceSum3*0.9;
//             upPriceSum3 = upPriceSum3*0.9;
//         }
//         if (isSeamlessRenew4==0) {
//             downPriceSum4 = downPriceSum4*0.9;
//             upPriceSum4 = upPriceSum4*0.9;
//         }
//         if (!isDisabled) {
//         j$(escapeVfId('allPage:allForm:allBlock:contractInfo:GuidePriceUp')).text(toNumComma(Math.round(upPriceSum)));
//         j$(escapeVfId('allPage:allForm:allBlock:contractInfo:GuidePriceUpHidden')).val(toNum(Math.round(upPriceSum)));
//         j$(escapeVfId('allPage:allForm:allBlock:contractInfo:GuidePriceDown')).text(toNumComma(Math.round(downPriceSum)));
//         j$(escapeVfId('allPage:allForm:allBlock:contractInfo:GuidePriceDownHidden')).val(toNum(Math.round(downPriceSum)));
//         }
//         document.getElementById("GuidePriceDown5").value = toNumComma(Math.round(downPriceSum));
//         document.getElementById("GuidePriceUp5").value = toNumComma(Math.round(upPriceSum));
//         document.getElementById("GuidePriceDown4").value = toNumComma(Math.round(downPriceSum1));
//         document.getElementById("GuidePriceUp4").value = toNumComma(Math.round(upPriceSum1));
//         document.getElementById("GuidePriceDown3").value = toNumComma(Math.round(downPriceSum3));
//         document.getElementById("GuidePriceUp3").value = toNumComma(Math.round(upPriceSum3));
//         document.getElementById("GuidePriceDown2").value = toNumComma(Math.round(downPriceSum4));
//         document.getElementById("GuidePriceUp2").value = toNumComma(Math.round(upPriceSum4));
//     // 报价规则改善 20230309 end
// }
function refreshAsset(cnt) {
    console.log('执行refreshAsset');
    console.log('decide==='+{!DecideBtnDisabled});
     // alert(cnt);
    // 提交后就页面不计算了
    var isDisabled = {!PageDisabled};
@@ -434,25 +683,31 @@
    // 新品合同 判断
    var newCon = true;
    var contractStartDate = new Date(j$(escapeVfId('allPage:allForm:contractstartdate')).value());
    //上限合同 20230103 LY start
    // var mainteReal = j$(escapeVfId('allPage:allForm:allBlock:contractInfo:mainteReal')).text();
    // Limit_Price_Amount = localParseFloat(mainteReal)*1.3;
    // console.log('Limit_Price_Amount'+Limit_Price_Amount);
    // j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Limit_Price_Amount')).val(Limit_Price_Amount);
    //上限合同 20230103 LY end
    //多年保续签合同数量 thh 20220316 start
    var GuranteeCount = 0;
    //多年保续签合同数量 thh 20220316 end
    //2022故障品加费 获取userInfo简档名称 是否为FSE start
    var isFSE = {!isFSE};
    // var isFSE = true;
    console.log('***isFSE',isFSE);
    //2022故障品加费 获取userInfo简档名称 end
    //20230208 上限合同开发 hql start
    if (isFSE) {
        // lpa =  document.getElementById('allPage:allForm:allBlock:contractInfo:Limit_Price_Amount');
        // lpa.style.display = "none";
        j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Limit_Price_Amount')).attr("disabled", true);
        console.log('上限金额隐藏');
    }
    //20230208 上限合同开发 hql end
    // 预定开始日
    var startdate = new Date(j$(escapeVfId('allPage:allForm:allBlock:contract:startdate')).value());
    // 报价规则改善
    // document.getElementById("startdateaddsix4").value = j$(escapeVfId('allPage:allForm:allBlock:contract:startdate')).value();
    // 报价规则改善
    // 预定开始日-6个月
    startdate.setMonth(startdate.getMonth() - 6);
    // 申请日 当前日期
@@ -479,6 +734,7 @@
        month = 12;
    }
    for (var i = 0; i < cnt; i++) {
        // console.log('第'+i+'个设备');
        var strMoney = 0;
        var repairMoney = 0;
        // 行项目 最高、最低价格合计
@@ -487,14 +743,19 @@
        var downPrice = 0;
        // 上线价格
        var upPrice = 0;
        // 12个月合同金额
        var Price_YearTXT = 0;
        
        var isManual = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':IsManual')).text();
        var isnew = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetNewHidden')).val();
        var assetListmonth = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPriceHidden')).val();
        console.log('***isManual=:'+isManual);
        //市场多年保修价格开发 DC 2023/02/09 start
        var VMassetListmonth = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Maintenance_Price_Year__c')).val();
        // console.log('***合同定价:'+VMassetListmonth);
        //市场多年保修价格开发 DC 2023/02/09 end
        // console.log('***isManual=:'+isManual);
        if (isManual == 'true') {
            var a = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Assert')).value();
            if (a != '') {
@@ -506,17 +767,21 @@
                //}
                strMoney = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPriceHidden')).val();
                // alert(strMoney);
                Price_YearTXT = strMoney * 12;
                if (isnew == 'true') {
                    newCount ++;
                    strMoney = month * strMoney + month2 * strMoney / {!isNewPriceAdj};
                } else {
                    newCon = false;
                    strMoney = month * strMoney + month2 * strMoney;
                }
                var b = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Contract_No')).value();
                var LastMContractRecord = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':LastMContractRecord')).value();
                // console.log('***维修合同记录类型1'+LastMContractRecord);
                if(b != ''){
                    conCCount ++;
                    // 1.合同期不满一年时,合同期超过一半才可开始续签报价。(eg:11个月的合同从6个月后才可报价。)
@@ -560,26 +825,132 @@
                            var nowdate = new Date();
                            lastendDate = new Date(j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':endDateGurantee_Text')).value());
                            nowdate = nowdate.setMonth(nowdate.getMonth() + 6);
                            //市场多年保修价格开发 DC 2023/1/30 start
                            var Maxcoefficient =0;
                            var Mincoefficient =0;
                            var ContractMonth = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:contract:monthRange')).val());
                            var AssetRate = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':AssetConsumptionRateNew')).val());
                            // console.log('***消费率:'+AssetRate);
                             j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Contractrate')).text(AssetRate +'%');
                            if(AssetRate<= 50){
                                Maxcoefficient = (1-0.3);
                                Mincoefficient = (1-0.4);
                            }else if(AssetRate>50 &&AssetRate<=60){
                                Maxcoefficient = (1-0.2);
                                Mincoefficient = (1-0.3);
                            }else if(AssetRate>60 &&AssetRate<=70){
                                Maxcoefficient = (1-0.15);
                                Mincoefficient = (1-0.25);
                            }else if(AssetRate>70 &&AssetRate<=80){
                                Maxcoefficient = (1-0.1);
                                Mincoefficient = (1-0.2);
                            }else if(AssetRate>80 &&AssetRate<=90){
                                Maxcoefficient = (1-0.05);
                                Mincoefficient = (1-0.15);
                            }else if(AssetRate>90 &&AssetRate<=100){
                                Maxcoefficient = 1;
                                Mincoefficient = (1-0.05);
                            }else if(AssetRate>100 &&AssetRate<=110){
                                Maxcoefficient = (1+0.05);
                                Mincoefficient = 1;
                            }else if(AssetRate>110 &&AssetRate<=120){
                                Maxcoefficient = (1+0.1);
                                Mincoefficient = 1;
                            }else if(AssetRate>120 &&AssetRate<=130){
                                Maxcoefficient = (1+0.2);
                                Mincoefficient = (1+0.1);
                            }else if(AssetRate>130 &&AssetRate<=140){
                                Maxcoefficient = (1+0.25);
                                Mincoefficient = (1+0.15);
                            }else if(AssetRate>140){
                                Maxcoefficient = (1+0.3);
                                Mincoefficient = (1+0.2);
                            }
                            //市场多年保修价格开发 DC 2023/1/30 end
                            // console.log('***最高系数'+Maxcoefficient);
                            // console.log('***最低系数'+Mincoefficient);
                            if(nowdate < Date.parse(lastendDate)){
                                upPrice = strMoney;
                                downPrice = strMoney * 0.8;
                            //设备小于两年半
                            // upPrice = strMoney;
                            // downPrice = strMoney * 0.8;
                        // console.log('***小于2年半')
                        // 市场多年保修价格开发 start DC 2023/01/19
                            //市场多年保设备小于2年半
                            var AssetModelNo = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Asset_Model_No__c')).value();
                            var Category4 = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Category4__c')).value();
                            // console.log('***设备型号'+AssetModelNo);
                            // console.log('***产品类型'+Category4);
                            //设备设备消费率小于1.4
                            if(AssetRate<140){
                                upPrice = VMassetListmonth * ContractMonth /12;
                                // console.log('消费率小于1.4 upPrice = 定价 *经历月数 /12'+ upPrice);
                                // if((AssetModelNo.includes('290')&&( Category4 =='BF'|| Category4=='BF扇扫'||Category4=='CF'))|| Category4 =='URF'){
                                //     downPrice = upPrice;
                                //     // console.log('消费率小于1.4 产品无最低价 downPrice '+ downPrice);
                                // }else{
                                    downPrice = upPrice * 0.8;
                                    // console.log('消费率小于1.4 产品最低价 downPrice = upPrice* 0.8:'+ downPrice);
                                // }
                            }else{
                                upPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Upper/100);
                                downPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Lower/100);
                                upPrice = VMassetListmonth * ContractMonth *Maxcoefficient / 12;
                                downPrice = VMassetListmonth * ContractMonth * Mincoefficient / 12;
                                // console.log('消费率大于1.4 upPrice'+ upPrice);
                                // console.log('消费率大于1.4 downPrice'+ downPrice);
                            }
                            // 市场多年保修价格开发 end DC 2023/01/19
                            }else{
                                // upPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Upper/100);
                                // downPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Lower/100);
                                //市场多年保修价格开发 DC 2023/1/30 start  设备大于2年半 续签价格 = 定价 *消费率对应系数 / 12 *合同月数
                                upPrice = VMassetListmonth * ContractMonth *Maxcoefficient / 12;
                                downPrice = VMassetListmonth * ContractMonth * Mincoefficient / 12;
                                // console.log('设备大于2年半 续签价格 = 定价 *消费率对应系数 / 12 *合同月数 upPrice'+ upPrice);
                                // console.log('设备大于2年半 续签价格 = 定价 *消费率对应系数 / 12 *合同月数 downPrice'+ downPrice);
                                //市场多年保修价格开发 DC 2023/1/30 end
                            }
                            // gzw 20220630  实际联动6个月价格区分
                        }else{
                            upPrice = strMoney;
                            downPrice = strMoney * 0.8;
                            console.log('选择1');
                        }
                    }else{
                        upPrice = (LastMContract_Price * Punish) * (1 + Adjustment_ratio_Upper/100);
                        downPrice = (LastMContract_Price * Punish) * (1 + Adjustment_ratio_Lower/100);
                        console.log('选择2');
                    }
                }else{
                    //firstCCount ++;
                    upPrice = strMoney;
                    downPrice = strMoney * 0.8;
                    console.log('选择3');
                }
                // 上下限四舍五入
                upPrice = upPrice.toFixed(2);
@@ -626,14 +997,19 @@
                newCon = false;
            }
            strMoney = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPriceHidden')).val();
            Price_YearTXT = strMoney * 12;
            if (isnew == 'true') {
                strMoney = month * strMoney + month2 * strMoney / {!isNewPriceAdj};
            } else {
                strMoney = month * strMoney + month2 * strMoney;
            }
            var b = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Contract_No')).value(); 
            var LastMContractRecord = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':LastMContractRecord')).value();
            // console.log('***维修合同记录类型2'+LastMContractRecord);
            if(b != ''){
                conCCount ++;
                // 1.合同期不满一年时,合同期超过一半才可开始续签报价。(eg:11个月的合同从6个月后才可报价。)
@@ -679,21 +1055,124 @@
                        var nowdate = new Date();
                        lastendDate = new Date(j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':endDateGurantee_Text')).value());
                        nowdate = nowdate.setMonth(nowdate.getMonth() + 6);
                        // console.log('**结束日',lastendDate);
                        //市场多年保修价格开发 DC 2023/1/30 start
                            var Maxcoefficient =0;
                            var Mincoefficient =0;
                            var ContractMonth = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:contract:monthRange')).val());
                            // console.log('***经历月数'+ContractMonth);
                            var AssetRate = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':AssetConsumptionRateNew')).val());
                            // console.log('***消费率:'+AssetRate);
                             j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Contractrate')).text(AssetRate +'%');
                            if(AssetRate<= 50){
                                Maxcoefficient = (1-0.3);
                                Mincoefficient = (1-0.4);
                            }else if(AssetRate>50 &&AssetRate<=60){
                                Maxcoefficient = (1-0.2);
                                Mincoefficient = (1-0.3);
                            }else if(AssetRate>60 &&AssetRate<=70){
                                Maxcoefficient = (1-0.15);
                                Mincoefficient = (1-0.25);
                            }else if(AssetRate>70 &&AssetRate<=80){
                                Maxcoefficient = (1-0.1);
                                Mincoefficient = (1-0.2);
                            }else if(AssetRate>80 &&AssetRate<=90){
                                Maxcoefficient = (1-0.05);
                                Mincoefficient = (1-0.15);
                            }else if(AssetRate>90 &&AssetRate<=100){
                                Maxcoefficient = 1;
                                Mincoefficient = (1-0.05);
                            }else if(AssetRate>100 &&AssetRate<=110){
                                Maxcoefficient = (1+0.05);
                                Mincoefficient = 1;
                            }else if(AssetRate>110 &&AssetRate<=120){
                                Maxcoefficient = (1+0.1);
                                Mincoefficient = 1;
                            }else if(AssetRate>120 &&AssetRate<=130){
                                Maxcoefficient = (1+0.2);
                                Mincoefficient = (1+0.1);
                            }else if(AssetRate>130 &&AssetRate<=140){
                                Maxcoefficient = (1+0.25);
                                Mincoefficient = (1+0.15);
                            }else if(AssetRate>140){
                                Maxcoefficient = (1+0.3);
                                Mincoefficient = (1+0.2);
                            }
                            // 市场多年保修价格开发 DC 2023/1/30 end
                            console.log('***最高系数'+Maxcoefficient);
                            console.log('***最低系数'+Mincoefficient);
                        if(nowdate < Date.parse(lastendDate)){
                            upPrice = strMoney;
                            downPrice = strMoney * 0.8;
                            //设备小于两年半
                            // upPrice = strMoney;
                            // downPrice = strMoney * 0.8;
                        // 市场多年保修价格开发 start DC 2023/01/19
                            //市场多年保设备小于2年半
                            var AssetModelNo = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Asset_Model_No__c')).value();
                            var Category4 = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Category4__c')).value();
                            // console.log('***设备型号'+AssetModelNo);
                            // console.log('***产品类型'+Category4);
                            //设备设备消费率小于1.4
                            if(AssetRate<140){
                                upPrice = VMassetListmonth *ContractMonth / 12;
                                // console.log('消费率小于1.4 upPrice = VMassetListmonth *month /12'+ upPrice);
                                // if((AssetModelNo.includes('290')&&( Category4 =='BF'|| Category4=='BF扇扫'||Category4=='CF'))|| Category4 =='URF'){
                                //     downPrice = upPrice;
                                //     // console.log('消费率小于1.4 产品无最低价 downPrice '+ downPrice);
                                // }else{
                                    downPrice = upPrice * 0.8;
                                    // console.log('消费率小于1.4 产品最低价 downPrice = upPrice* 0.8:'+ downPrice);
                                // }
                        }else{
                            upPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Upper/100);
                            downPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Lower/100);
                                upPrice = VMassetListmonth * ContractMonth *Maxcoefficient / 12;
                                downPrice = VMassetListmonth * ContractMonth * Mincoefficient / 12;
                                // console.log('消费率大于1.4 upPrice'+ upPrice);
                                // console.log('消费率大于1.4 downPrice'+ downPrice);
                            }
                        // 市场多年保修价格开发 end DC 2023/01/19
                        }else{
                            //设备大于两年半
                            // upPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Upper/100);
                            // downPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Lower/100);
                            //市场多年保修价格开发 DC 2023/1/30 start  设备大于2年半 续签价格 = 定价 *消费率对应系数 / 12 *合同月数
                            upPrice = VMassetListmonth * ContractMonth *Maxcoefficient / 12;
                            downPrice = VMassetListmonth * ContractMonth * Mincoefficient / 12;
                            // console.log('设备大于2年半 续签价格 = 定价 *消费率对应系数 / 12 *合同月数 upPrice'+ upPrice);
                            // console.log('设备大于2年半 续签价格 = 定价 *消费率对应系数 / 12 *合同月数 downPrice'+ downPrice);
                            //市场多年保修价格开发 DC 2023/1/30 end
                        }
                        // gzw 20220630  实际联动6个月价格区分
                    }else{
                        upPrice = strMoney;
                        downPrice = strMoney * 0.8;
                        console.log('选择4');
                    }
                }else{
                    upPrice = (LastMContract_Price * Punish) * (1 + Adjustment_ratio_Upper/100);
                    downPrice = (LastMContract_Price * Punish) * (1 + Adjustment_ratio_Lower/100);
                    // console.log('选择5');
                }
            }else{
                if (isnew == 'true') {
@@ -712,39 +1191,42 @@
            //j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPriceTXT')).text(toNumComma(Price_YearTXT));
            //j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPriceTXTHidden')).val(Price_YearTXT);
            if (!isDisabled) {
                // else{
                // 实际联动价格 start
                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Lower_price')).text(toNumComma(downPrice));
                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Lower_priceHidden')).val(downPrice);
                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Upper_price')).text(toNumComma(upPrice));
                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Upper_priceHidden')).val(upPrice);
                // 实际联动价格 end
                // }
            }
            //j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPrice')).text(toNumComma(strMoney));
            j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPricePageHidden')).val(strMoney);
            //<!-- (2022年12月上线)故障品加费 start -->
            //<!-- (2022年12月上线)故障品加费 start -->
            Repair_Price_AutoPrice = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Repair_Price_Auto'));
            Repair_Price_Auto = Repair_Price_AutoPrice.value();
            repairMoney = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':repairPrice')).value();
            Repair_Price_pass = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Repair_Price_pass')).val();
            console.log((i+1)+'号repairMoney='+repairMoney);
            console.log((i+1)+'号Repair_Price_Auto='+Repair_Price_Auto);
            // console.log((i+1)+'号repairMoney='+repairMoney);
            // console.log((i+1)+'号Repair_Price_Auto='+Repair_Price_Auto);
            if ((repairMoney+1)==1) {
                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':repairPrice')).val(Repair_Price_Auto);
                console.log('repairMoney修改成功');
                // console.log('repairMoney修改成功');
            }
            if ((Repair_Price_pass+1)==1) {
                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Repair_Price_pass')).val(Repair_Price_Auto);
                console.log('Repair_Price_pass修改成功');
                // console.log('Repair_Price_pass修改成功');
            }
            repairMoney1 = localParseFloat(repairMoney);
            ISReducedpriceapproval = j$(escapeVfId('allPage:allForm:allBlock:ISReducedpriceapproval')).val();
            console.log('ISReducedpriceapproval=='+ISReducedpriceapproval);
            // console.log('ISReducedpriceapproval=='+ISReducedpriceapproval);
            var isDisabled = {!PageDisabled};
            if (ISReducedpriceapproval =='有八折以下待审批' || ISReducedpriceapproval =='是'|| isDisabled) {
                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':repairPrice')).attr("disabled", true);
            }else{
                console.log('无八折以下待审批和是的金额');
                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':repairPrice')).attr("disabled", false);
            }
            ISReducedpriceapproval1 = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':ISReducedpriceapproval1')).val();
@@ -754,21 +1236,26 @@
                isresduce = isresduce+1;
            }
          
            console.log('初始化isresduce='+isresduce);
            ResonCannotWarranty = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':ResonCannotWarranty')).value();
            // console.log('初始化isresduce='+isresduce);
            rppa =  document.getElementById('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Repair_Price_Auto');
            ResonCannotWarranty = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':ResonCannotWarranty')).value();
            // console.log('不可参保原因为:'+ResonCannotWarranty);
            // console.log('repairMoney执行次数为'+repairMoney);
            if(!(ResonCannotWarranty.indexOf("弃修") != -1)&&(repairMoney+1)==1){
                // if (!(situation.indexOf("修理中")!=-1)&& !(Agreed_Date.indexOf("为空")!=-1)) {
                    rppa.style.display = "none";
                    j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':repairPrice')).val('');
                    // console.log('###修改成功');
                // }
            }
            situation = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Asset_situation')).value();
            // Agreed_Date =  j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Agreed_Date')).value();
            console.log('situation='+situation);
            // console.log('situation='+situation);
            // console.log('Agreed_Date1='+Agreed_Date);
            if(!(ResonCannotWarranty.indexOf("弃修") != -1)&&(repairMoney+1)==1){
                    rppa.style.display = "none";
                    j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':repairPrice')).val('');
                    console.log('###修改成功');
            }
            console.log('判断1'+(situation.indexOf("修理中")!=-1));
            // console.log('判断'+(Agreed_Date.indexOf("不为空")!=-1));
            // if ((situation.indexOf("修理中")!=-1)&& (Agreed_Date.indexOf("不为空")!=-1)) {
            //     console.log('开始操作2');
@@ -782,6 +1269,7 @@
        listSum = listSum + localParseFloat(toNum(strMoney));
        downPriceSum = downPriceSum + localParseFloat(toNum(downPrice));
        upPriceSum =  upPriceSum + localParseFloat(toNum(upPrice));
    }
    
   
@@ -790,6 +1278,7 @@
    
    //j$(escapeVfId('allPage:allForm:allBlock:contractInfo:assetSumPrice')).text(toNumComma(listSum));
    //j$(escapeVfId('allPage:allForm:allBlock:contractInfo:assetSumPriceHidden')).val(toNum(listSum));
    if (!isDisabled) {
        j$(escapeVfId('allPage:allForm:allBlock:contractInfo:GuidePriceUp')).text(toNumComma(Math.round(upPriceSum)));
        j$(escapeVfId('allPage:allForm:allBlock:contractInfo:GuidePriceUpHidden')).val(toNum(Math.round(upPriceSum)));
@@ -821,16 +1310,21 @@
    }else{
        result = '续签合同';
    }
    console.log(result);
    // console.log(result);
    document.getElementById("allPage:allForm:allBlock:contractInfo:Contract_TypeTXT").innerHTML = result;
    document.getElementById("allPage:allForm:allBlock:contractInfo:Contract_TypeTXTHidden").value = result;
    // 取消酸化水
    //NotUseOxygenatedWaterAmount(1);
    examinationPriceCal(cnt);
    getLastContractRate();
    // 报价规则改善 20230315 start
    // seamlessRenew(cnt);
    // 报价规则改善 20230315 end
    number1++;
}
function changeAsset(cnt) {
    console.log('执行了changeAsset');
    // alert(cnt);
    // 提交后就页面不计算了
    var isDisabled = {!PageDisabled};
@@ -910,6 +1404,10 @@
        var isManual = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':IsManual')).text();
        var isnew = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetNewHidden')).val();
        var assetListmonth = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPriceHidden')).val();
        //市场多年保修价格开发 DC 2023/02/09 start
        var VMassetListmonth = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Maintenance_Price_Year__c')).val();
        //市场多年保修价格开发 DC 2023/02/09 end
        if (isManual == 'true') {
            var a = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Assert')).value();
            if (a != '') {
@@ -921,17 +1419,22 @@
                //}
                strMoney = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPriceHidden')).val();
                // alert(strMoney);
                var LastMContractRecord = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':LastMContractRecord')).value();
                // // alert(strMoney);
                // console.log('***维修合同记录类型3'+LastMContractRecord);
                Price_YearTXT = strMoney * 12;
                if (isnew == 'true') {
                    newCount ++;
                    strMoney = month * strMoney + month2 * strMoney / {!isNewPriceAdj};
                } else {
                    newCon = false;
                    strMoney = month * strMoney + month2 * strMoney;
                }
                var b = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Contract_No')).value();
                var LastMContractRecord = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':LastMContractRecord')).value();
                // var LastMContractRecord = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':LastMContractRecord')).value();
                if(b != ''){
                    conCCount ++;
                    // 1.合同期不满一年时,合同期超过一半才可开始续签报价。(eg:11个月的合同从6个月后才可报价。)
@@ -975,12 +1478,108 @@
                            var nowdate = new Date();
                            lastendDate = new Date(j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':endDateGurantee_Text')).value());
                            nowdate = nowdate.setMonth(nowdate.getMonth() + 6);
                            //市场多年保修价格开发 DC 2023/1/30 start
                            var Maxcoefficient =0;
                            var Mincoefficient =0;
                            var AssetRate = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':AssetConsumptionRateNew')).val());
                            console.log('***消费率:'+AssetRate);
                            var ContractMonth = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:contract:monthRange')).val());
                             j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Contractrate')).text(AssetRate +'%');
                            if(AssetRate<= 50){
                                Maxcoefficient = (1-0.3);
                                Mincoefficient = (1-0.4);
                            }else if(AssetRate>50 &&AssetRate<=60){
                                Maxcoefficient = (1-0.2);
                                Mincoefficient = (1-0.3);
                            }else if(AssetRate>60 &&AssetRate<=70){
                                Maxcoefficient = (1-0.15);
                                Mincoefficient = (1-0.25);
                            }else if(AssetRate>70 &&AssetRate<=80){
                                Maxcoefficient = (1-0.1);
                                Mincoefficient = (1-0.2);
                            }else if(AssetRate>80 &&AssetRate<=90){
                                Maxcoefficient = (1-0.05);
                                Mincoefficient = (1-0.15);
                            }else if(AssetRate>90 &&AssetRate<=100){
                                Maxcoefficient = 1;
                                Mincoefficient = (1-0.05);
                            }else if(AssetRate>100 &&AssetRate<=110){
                                Maxcoefficient = (1+0.05);
                                Mincoefficient = 1;
                            }else if(AssetRate>110 &&AssetRate<=120){
                                Maxcoefficient = (1+0.1);
                                Mincoefficient = 1;
                            }else if(AssetRate>120 &&AssetRate<=130){
                                Maxcoefficient = (1+0.2);
                                Mincoefficient = (1+0.1);
                            }else if(AssetRate>130 &&AssetRate<=140){
                                Maxcoefficient = (1+0.25);
                                Mincoefficient = (1+0.15);
                            }else if(AssetRate>140){
                                Maxcoefficient = (1+0.3);
                                Mincoefficient = (1+0.2);
                            }
                            //市场多年保修价格开发 DC 2023/1/30 end
                            // console.log('***最高系数'+Maxcoefficient);
                            // console.log('***最低系数'+Mincoefficient);
                            if(nowdate < Date.parse(lastendDate)){
                                upPrice = strMoney;
                                downPrice = strMoney * 0.8;
                            //设备小于两年半
                            // upPrice = strMoney;
                            // downPrice = strMoney * 0.8;
                        // console.log('***小于2年半')
                        // 市场多年保修价格开发 start DC 2023/01/19
                            //市场多年保设备小于2年半
                            var AssetModelNo = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Asset_Model_No__c')).value();
                            var Category4 = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Category4__c')).value();
                            // console.log('***设备型号'+AssetModelNo);
                            // console.log('***产品类型'+Category4);
                            //设备设备消费率小于1.4
                            if(AssetRate<140){
                                upPrice = VMassetListmonth * ContractMonth / 12 ;
                                // console.log('消费率小于1.4 upPrice = VMassetListmonth *ContractMonth / 12'+ upPrice);
                                // if((AssetModelNo.includes('290')&&( Category4 =='BF'|| Category4=='BF扇扫'||Category4=='CF'))|| Category4 =='URF'){
                                //     downPrice = upPrice;
                                //     // console.log('消费率小于1.4 产品无最低价 downPrice '+ downPrice);
                                // }else{
                                    downPrice = upPrice * 0.8;
                                    // console.log('消费率小于1.4 产品最低价 downPrice = upPrice* 0.8:'+ downPrice);
                                // }
                            }else{
                                upPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Upper/100);
                                downPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Lower/100);
                                upPrice = VMassetListmonth * ContractMonth *Maxcoefficient / 12;
                                downPrice = VMassetListmonth * ContractMonth * Mincoefficient / 12;
                                    // console.log('消费率大于1.4 upPrice'+ upPrice);
                                    // console.log('消费率大于1.4 downPrice'+ downPrice);
                            }
                            // 市场多年保修价格开发 end DC 2023/01/19
                            }else{
                                // upPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Upper/100);
                                // downPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Lower/100);
                                //市场多年保修价格开发 DC 2023/1/30 start  设备大于2年半 续签价格 =定价*消费率对应系数 / 12 *合同月数
                                upPrice = VMassetListmonth * ContractMonth *Maxcoefficient / 12;
                                downPrice = VMassetListmonth * ContractMonth * Mincoefficient / 12;
                                //市场多年保修价格开发 DC 2023/1/30 end
                            }
                            // gzw 20220630  实际联动6个月价格区分
                        }else{
@@ -1041,14 +1640,17 @@
                newCon = false;
            }
            strMoney = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPriceHidden')).val();
            Price_YearTXT = strMoney * 12;
            if (isnew == 'true') {
                strMoney = month * strMoney + month2 * strMoney / {!isNewPriceAdj};
            } else {
                strMoney = month * strMoney + month2 * strMoney;
            }
            var b = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Contract_No')).value(); 
            var LastMContractRecord = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':LastMContractRecord')).value();
            console.log('***维修合同记录类型4'+LastMContractRecord);
            if(b != ''){
                conCCount ++;
                // 1.合同期不满一年时,合同期超过一半才可开始续签报价。(eg:11个月的合同从6个月后才可报价。)
@@ -1094,12 +1696,108 @@
                        var nowdate = new Date();
                        lastendDate = new Date(j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':endDateGurantee_Text')).value());
                        nowdate = nowdate.setMonth(nowdate.getMonth() + 6);
                         //市场多年保修价格开发 DC 2023/1/30 start
                            var Maxcoefficient =0;
                            var Mincoefficient =0;
                            var AssetRate = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':AssetConsumptionRateNew')).val());
                            console.log('***消费率:'+AssetRate);
                            var ContractMonth = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:contract:monthRange')).val());
                             j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Contractrate')).text(AssetRate +'%');
                            if(AssetRate<= 50){
                                Maxcoefficient = (1-0.3);
                                Mincoefficient = (1-0.4);
                            }else if(AssetRate>50 &&AssetRate<=60){
                                Maxcoefficient = (1-0.2);
                                Mincoefficient = (1-0.3);
                            }else if(AssetRate>60 &&AssetRate<=70){
                                Maxcoefficient = (1-0.15);
                                Mincoefficient = (1-0.25);
                            }else if(AssetRate>70 &&AssetRate<=80){
                                Maxcoefficient = (1-0.1);
                                Mincoefficient = (1-0.2);
                            }else if(AssetRate>80 &&AssetRate<=90){
                                Maxcoefficient = (1-0.05);
                                Mincoefficient = (1-0.15);
                            }else if(AssetRate>90 &&AssetRate<=100){
                                Maxcoefficient = 1;
                                Mincoefficient = (1-0.05);
                            }else if(AssetRate>100 &&AssetRate<=110){
                                Maxcoefficient = (1+0.05);
                                Mincoefficient = 1;
                            }else if(AssetRate>110 &&AssetRate<=120){
                                Maxcoefficient = (1+0.1);
                                Mincoefficient = 1;
                            }else if(AssetRate>120 &&AssetRate<=130){
                                Maxcoefficient = (1+0.2);
                                Mincoefficient = (1+0.1);
                            }else if(AssetRate>130 &&AssetRate<=140){
                                Maxcoefficient = (1+0.25);
                                Mincoefficient = (1+0.15);
                            }else if(AssetRate>140){
                                Maxcoefficient = (1+0.3);
                                Mincoefficient = (1+0.2);
                            }
                            //市场多年保修价格开发 DC 2023/1/30 end
                            // console.log('***最高系数'+Maxcoefficient);
                            // console.log('***最低系数'+Mincoefficient);
                        if(nowdate < Date.parse(lastendDate)){
                            upPrice = strMoney;
                            downPrice = strMoney * 0.8;
                            //设备小于两年半
                            // upPrice = strMoney;
                            // downPrice = strMoney * 0.8;
                        // console.log('***小于2年半')
                        // 市场多年保修价格开发 start DC 2023/01/19
                            //市场多年保设备小于2年半
                            var AssetModelNo = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Asset_Model_No__c')).value();
                            var Category4 = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Category4__c')).value();
                            // console.log('***设备型号'+AssetModelNo);
                            // console.log('***产品类型'+Category4);
                            //设备设备消费率小于1.4
                            if(AssetRate<140){
                                upPrice = VMassetListmonth * ContractMonth /12;
                                // console.log('消费率小于1.4 upPrice = VMassetListmonth *ContractMonth /12'+ upPrice);
                               // if((AssetModelNo.includes('290')&&( Category4 =='BF'|| Category4=='BF扇扫'||Category4=='CF'))|| Category4 =='URF'){
                                //     downPrice = upPrice;
                                //     // console.log('消费率小于1.4 产品无最低价 downPrice '+ downPrice);
                                // }else{
                                    downPrice = upPrice * 0.8;
                                    // console.log('消费率小于1.4 产品最低价 downPrice = upPrice* 0.8:'+ downPrice);
                                // }
                        }else{
                            upPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Upper/100);
                            downPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Lower/100);
                                upPrice = VMassetListmonth * ContractMonth *Maxcoefficient / 12;
                                downPrice = VMassetListmonth * ContractMonth * Mincoefficient / 12;
                                // console.log('消费率大于1.4 upPrice'+ upPrice);
                                // console.log('消费率大于1.4 downPrice'+ downPrice);
                            }
                            // 市场多年保修价格开发 end DC 2023/01/19
                        }else{
                            // upPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Upper/100);
                            // downPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Lower/100);
                            //市场多年保修价格开发 DC 2023/1/30 start  设备大于2年半 续签价格 = 定价 *消费率对应系数 / 12 *合同月数
                            upPrice = VMassetListmonth * ContractMonth *Maxcoefficient / 12;
                            downPrice = VMassetListmonth * ContractMonth * Mincoefficient / 12;
                            //市场多年保修价格开发 DC 2023/1/30 end
                        }
                        // gzw 20220630  实际联动6个月价格区分
                    }else{
@@ -1145,16 +1843,16 @@
            repairMoney1 = localParseFloat(repairMoney);
            ISReducedpriceapproval1 = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':ISReducedpriceapproval1')).val();
            ISReduced = j$(escapeVfId('allPage:allForm:allBlock:ISReducedpriceapproval')).val();
            console.log('ISReduced='+ISReduced);
            // console.log('ISReduced='+ISReduced);
            
            console.log('Repair_Price_Auto='+Repair_Price_Auto);
            console.log('第'+(i+1)+'个设备ISReducedpriceapproval1='+ISReducedpriceapproval1);
            console.log('repairMoney1='+repairMoney1);
            // console.log('Repair_Price_Auto='+Repair_Price_Auto);
            // console.log('第'+(i+1)+'个设备ISReducedpriceapproval1='+ISReducedpriceapproval1);
            // console.log('repairMoney1='+repairMoney1);
            
            Repair_Price_pass1 = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Repair_Price_pass')).val();
            Repair_Price_pass2 = localParseFloat(Repair_Price_pass1);
            console.log('结果='+(repairMoney1<Repair_Price_pass2));
            console.log('Repair_Price_pass2='+Repair_Price_pass2);
            // console.log('结果='+(repairMoney1<Repair_Price_pass2));
            // console.log('Repair_Price_pass2='+Repair_Price_pass2);
            if (repairMoney1> 0 && repairMoney1<(Repair_Price_Auto*0.80) && Repair_Price_Auto != null && isFSE == true) {
                 if (Repair_Price_pass1!=null && repairMoney1<Repair_Price_pass2) {
                    alert('由于存在折扣率超过20%以上的修理加费减价申请,请先点击“提交RC评估”按钮,待RC评估后服务管理部会推进审批');
@@ -1183,12 +1881,12 @@
            situation = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Asset_situation')).value();
            // Agreed_Date =  j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Agreed_Date')).value();
            console.log('situation='+situation);
            // console.log('situation='+situation);
            // console.log('Agreed_Date1='+Agreed_Date);
            //if(ResonCannotWarranty!=null&&!(ResonCannotWarranty.indexOf("弃修") != -1)){
            // if(!(ResonCannotWarranty.indexOf("弃修") != -1)){
           //         rppa.style.display = "none";
            //        j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':repairPrice')).val('');
            //       console.log('###修改成功');
            //         // j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':repairPrice')).val('');
            //         // console.log('###修改成功');
           // }
            // if ((situation.indexOf("修理中")!=-1)&& (Agreed_Date.indexOf("为空")!=-1)) {
            //     console.log('开始操作1');
@@ -1207,7 +1905,7 @@
        downPriceSum = downPriceSum + localParseFloat(toNum(downPrice));
        upPriceSum =  upPriceSum + localParseFloat(toNum(upPrice));
    }
    console.log('改变金额isresduce='+isresduce);
    // console.log('改变金额isresduce='+isresduce);
     if (isresduce!=0) {
                toChange1();
        }else{
@@ -1252,6 +1950,33 @@
     
    examinationPriceCal(cnt);
    getLastContractRate();
    //上限合同 20230214 hql start
    var RequestquotationAmount = j$(escapeVfId('allPage:allForm:allBlock:contractInfo:quotation_Amount')).val();
    console.log('申请报价金额='+RequestquotationAmount);
    var AssetRepairSumPrice    = j$(escapeVfId('allPage:allForm:allBlock:contractInfo:assetRepairSumPrice')).text();
    console.log('合同设备修理总额='+AssetRepairSumPrice);
    Limit_Price_Amount = (localParseFloat(AssetRepairSumPrice)+localParseFloat(RequestquotationAmount))*1.3;
    Limit_Price_Amount = Math.round(Limit_Price_Amount);
    // console.log('取整1='+Math.round(124.5));
    // console.log('取整2='+Math.round(124.4));
    // console.log('取整3='+Math.round(124.6));
    Limit_Price_AmountOne =  j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Limit_Price_Amount')).value();
    Limit_PriceHidden =  j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Limit_PriceHidden')).value();
    // if (Limit_PriceHidden*1==0) {
        j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Limit_Price_Amount')).val(Limit_Price_Amount);
    // }
    Limit_PriceHidden2 =  j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Limit_Price2Hidden')).value();
    if (Limit_PriceHidden2 == 'false') {
        // lpa =  document.getElementById('allPage:allForm:allBlock:contractInfo:Limit_Price_Amount');
        // lpa.style.display = "none";
        // console.log('隐藏完毕');
        j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Limit_Price_Amount')).val('');
    }
    console.log('上限金额为'+Limit_Price_Amount);
    //上限合同 20230214 hql end
    // 报价规则改善 20230315 start
    // seamlessRenew(cnt);
    // 报价规则改善 20230315 end
}
@@ -1481,8 +2206,136 @@
    //     return true;
    // }
}
// 报价规则改善 20230310 start
// function addMonths(yearMonthDay ,monthNum){
//     var arr=yearMonthDay.split( '/');
//     var year=parseInt(arr[0]);
//     var month=parseInt(arr[1]);
//     var day=parseInt(arr[2]);
//     month=month+monthNum;
//     if(month>12){//月份加
//         var yearNum=parseInt( (month-1)/12);
//         month=month%12==0?12 :month%12;
//         year+=yearNum;
//         }else if(month<=0){//月份减
//             month=Math.abs( month);
//             var yearNum=parseInt( (month+12)/12);
//             year-=yearNum;
//         }
//         month=month<10?"0"+month :month;
//         return year+"/"+month+"/"+day;
// }
// function Blankperiod(startdate,i,LastMContract_Price,Punish,Adjustment_ratio_Upper,Adjustment_ratio_Lower,strMoney,type){
//             var  downPrice = 0;
//             var  upPrice = 0;
//             var  isSeamlessRenew = 0;
//             Blank_period = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Blank_period')).value();
//             var lastendDate1= j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':End_Date')).value()
//             var lastendDate = new Date(j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':End_Date')).value());
//             // console.log("lastendDate1="+lastendDate1);
//             var today = new Date();
//             if (lastendDate1.length !=0) {
//                 if (startdate == null) {
//                     // console.log(1);
//                      Blank_period=(today-lastendDate)/(3600*24*1000);
//                 }else{
//                     // console.log(2);
//                     Blank_period=(startdate-lastendDate)/(3600*24*1000);
//                 }
//                 j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Blank_period')).val(Blank_period);
//             }
//             if (Number(Blank_period)<15&&Blank_period.length != 0) {
//                 // console.log(3);
//                 j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Blank_period')).val('无缝续签');
//             }
//             Blank_period1 = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Blank_period')).value();
//             // console.log('Blank_period1='+Blank_period1);
//             // 2.无空白期设备是否算无缝续签设备 是否包含在无缝续签的报价判断中(首签的设备)?
//             if (Blank_period1 != '无缝续签' && Blank_period.length != 0) {
//                 isSeamlessRenew++;
//             }
//             // 1.实绩连动价格和设备参保定价 逻辑查看
//             upPrice1 = (LastMContract_Price * Punish) * (1 + Adjustment_ratio_Upper/100);
//             downPrice1 = (LastMContract_Price * Punish) * (1 + Adjustment_ratio_Lower/100);
//             // 定价8折
//             downPrice2 = strMoney * 0.8;
//             upPrice1 = upPrice1.toFixed(2);
//             upPrice2 = strMoney.toFixed(2);
//             downPrice1 = downPrice1.toFixed(2);
//             downPrice2 = downPrice2.toFixed(2);
//             // console.log('LastMContract_Price='+LastMContract_Price);
//             // console.log('upPrice1='+upPrice1);
//             // console.log('downPrice1='+downPrice1);
//             // console.log('upPrice2='+upPrice2);
//             // console.log('downPrice2='+downPrice2);
//             if (!isDisabled) {
//                 if (Blank_period1.length==0) {
//                     downPrice = downPrice2;
//                     upPrice = upPrice2;
//                 }
//                 if (Blank_period1.length!=0 && Number(Blank_period1)<180 || Blank_period1 == '无缝续签' ) {
//                     if (type == 1) {
//                         console.log('续签设备小于6个月');
//                         j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Lower_price')).text(toNumComma(downPrice1));
//                         j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Upper_price')).text(toNumComma(upPrice1));
//                     }
//                      downPrice = downPrice1;
//                      upPrice = upPrice1;
//                 }
//                 if (Blank_period1 != '无缝续签' && Number(Blank_period1)>180 && Number(Blank_period1)<365) {
//                     if (downPrice1<downPrice2) {
//                         if (type == 1) {
//                             console.log('续签设备6-12个月1');
//                             j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Lower_price')).text(toNumComma(downPrice2));
//                             j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Upper_price')).text(toNumComma(upPrice2));
//                         }
//                         downPrice = downPrice2;
//                         upPrice = upPrice2;
//                     }else{
//                          if (type == 1) {
//                             console.log('续签设备6-12个月2');
//                             j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Lower_price')).text(toNumComma(downPrice1));
//                             j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Upper_price')).text(toNumComma(upPrice1));
//                           }
//                         downPrice = downPrice1;
//                         upPrice = upPrice1;
//                     }
//                 }
//                 if (Blank_period1 != '无缝续签' && Number(Blank_period1)>365) {
//                     if (downPrice1<upPrice2) {
//                         if (type == 1) {
//                             console.log('续签设备12个月1');
//                             j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Lower_price')).text(toNumComma(upPrice2));
//                             j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Upper_price')).text(toNumComma(upPrice2));
//                         }
//                         downPrice = upPrice2;
//                         upPrice = upPrice2;
//                     }else{
//                         if (type == 1) {
//                             console.log('续签设备12个月2');
//                             j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Lower_price')).text(toNumComma(downPrice1));
//                             j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Upper_price')).text(toNumComma(upPrice1));
//                         }
//                         downPrice = downPrice1;
//                         upPrice = upPrice1;
//                     }
//                 }
//             }
//         return downPrice+"/"+upPrice+"/"+isSeamlessRenew;
// }
// 报价规则改善 20230310 end
function changeEstiStartdate(val) {
    // 报价规则改善 20230310 start
       // var startday = addMonths(val,6);
       // var startday1 = addMonths(val,12);
       //  document.getElementById("startdateaddsix1").value = startday;
       //  document.getElementById("startdateaddsix2").value = startday;
       //  document.getElementById("startdateaddsix3").value = startday1;
       //  document.getElementById("startdateaddsix4").value = val;
    // 报价规则改善 20230310 end
    if ('{!SaveBtnDisabled}' == 'false') {
        j$(escapeVfId('allPage:allForm:contractstartdate')).val(val);
        changeContractStartdate(val);
@@ -1654,6 +2507,25 @@
            var dayStr = '00' + contractDate.getDate();
            dayStr = dayStr.substring(dayStr.length-2, dayStr.length);
            var contractDateStr = contractDate.getFullYear() + '/' + monthStr + '/' + dayStr;
            //贸易合规 you 20230414 start
            var AccDealerBlacklist = j$(escapeVfId('allPage:allForm:AccDealerBlacklist')).value();//黑名单,警示名单
            var TradeComplianceStatusFlagFW = '{!$Label.TradeComplianceStatusFlagFW}';//贸易合规开关
            var IFTradeComplianceAlert = '{!$Label.IFTradeComplianceAlert}';//贸易合规提醒
            if(TradeComplianceStatusFlagFW=='true'){
            if(AccDealerBlacklist =='1'){
               alert('您所选择的客户(医院/经销商)存在贸易合规风险,无法签订服务合同,建议您向客户做好不签约说明,'+IFTradeComplianceAlert);
               var reflag = interceptsend();
               unblockUI();
               return null;
            }else if(AccDealerBlacklist =='2'){
               if (!confirm('您所选择的客户(医院/经销商)存在贸易合规警示风险,不建议签订服务合同,请您确认是否继续申请,'+IFTradeComplianceAlert)) {
                unblockUI();
                return null;
                }
            }
            }
            //贸易合规 you 20230414 end
            //var neDt = contractDate.getFullYear() + contractDate.getMonth() + contractDate.getDate();
            //monthStr = '00' + (oldDate.getMonth()+1);
@@ -1667,7 +2539,8 @@
            } else {
                var oldp = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:contractInfo:oldMainteReal')).value());
                var newp = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:contractInfo:mainteReal')).text());
                // console.log('oldp='+oldp);
                //  console.log('newp='+newp);
                if (oldp != newp) {
                    // 20201106 高章伟 提醒消息修改 start
                    j$(escapeVfId('allPage:allForm:changedAfterPrint')).val('true');
@@ -1858,6 +2731,10 @@
    <apex:inputHidden id="changedAfterPrint" value="{!changedAfterPrint}"/>
    <apex:inputHidden id="changedSubmitPrice" value="{!changedSubmitPrice}"/>
    <apex:inputHidden id="isSaveOrApproval" value="{!isSaveOrApproval}"/>
    <!-- 贸易合规 you 20230414-->
    <apex:inputHidden id="AccDealerBlacklist" value="{!contract.AccDealerBlacklist__c}"/>
    <apex:actionFunction name="interceptsend" action="{!interceptsend}"  oncomplete="unblockUI();"/>
    <!-- HWAG-B4R3SS  START 20181026-->
    <apex:actionFunction name="searchfunc" action="{!searchBtn}" rerender="Form,Block,assetSection2,pageMessages,allBlock" onComplete="unblockUI();"></apex:actionFunction>
@@ -2084,8 +2961,22 @@
                        <th style="width:70px" class="headerRow  booleanColumn">{!$ObjectType.Asset.fields.Department_Name__c.label}</th>
                        
                        <th style="width:70px" class="headerRow  booleanColumn">{!$ObjectType.Asset.fields.Management_Code__c.label}</th>
                        <!-- <th style="width:70px" class="headerRow  booleanColumn">{!$ObjectType.Maintenance_Contract_Asset_Estimate__c.fields.Asset_Consumption_rate__c.label}</th> -->
                        <!-- <th style="width:70px" class="headerRow  booleanColumn">{!$ObjectType.Asset.fields.CurrentContract_End_Date__c.label}</th> -->
                        <!-- 市场多年保修价格开发 DC 2023/02/20  start-->
                        <th style="width:70px" class="headerRow  booleanColumn">{!$ObjectType.Maintenance_Contract_Asset__c.fields.IS_VMContract_Asset__c.label}</th>
                        <!-- 市场多年保修价格开发 DC 2023/02/20  end-->
                        <th style="width:70px" class="headerRow  booleanColumn">{!$ObjectType.Maintenance_Contract_Asset_Estimate__c.fields.Asset_Consumption_rate__c.label}</th>
                        <th style="width:70px" class="headerRow  booleanColumn">{!$ObjectType.Asset.fields.CurrentContract_End_Date__c.label}</th>
                        <!-- 市场多年保修价格开发 DC 2023/1/30 start -->
                        <!-- <th style="width:70px" class="headerRow  booleanColumn">{!$ObjectType.Maintenance_Contract_Asset_Estimate__c.fields.Asset_Consumption_rate__c.label}</th>
 -->
                        <!-- 市场多年保修价格开发 DC 2023/1/30 end -->
                        <th style="width:70px" class="headerRow  booleanColumn">
                            <!-- 最近一期维修合同结束 -->
                            {!$ObjectType.Asset.fields.CurrentContract_End_Date__c.label}
                        </th>
                        <!-- 实绩联动价格计算 start -->
                        <th style="width:35px" class="headerRow  booleanColumn">{!$ObjectType.Maintenance_Contract_Asset_Estimate__c.fields.Adjustment_Upper_price__c.label}</th>
                        <th style="width:35px" class="headerRow  booleanColumn">{!$ObjectType.Maintenance_Contract_Asset_Estimate__c.fields.Adjustment_Lower_price__c.label}</th>
@@ -2173,17 +3064,53 @@
                               
                                <td class="dataCell" width="70px">
                                    <apex:outputField value="{!ar.rec.CurrentContract_F__r.Maintenance_Contract_No_F__c}" rendered="{!Not(ar.IsManual)}" id="Contract_No"/>
                                    <apex:inputHidden value="{!ar.rec.CurrentContract_F__r.RecordType_DeveloperName__c}" id="LastMContractRecord"/>
                                    <apex:inputField value="{!ar.rec.CurrentContract_F_asset__r.endDateGurantee_Text__c}" id="endDateGurantee_Text" style="display: none" showDatePicker="false"/>
                                    <apex:inputHidden value="{!ar.rec.CurrentContract_F__c}" id="LastMContractID"/>
                                    <!-- 市场多年保价格开发 start 20223/01/17 维修合同/保有设备 设备消费率 -->
                                    <!-- <apex:outputField value="{!ar.rec.CurrentContract_F_asset__r.IS_VMContract_Asset__c}" rendered="{!Not(ar.IsManual)}" id="IS_VMContract_Asset"/> -->
                                    <apex:inputHidden value="{!ar.rec.CurrentContract_F_asset__r.Asset_Consumption_Rate__c}" id="AssetConsumptionRateNew"/>
                                    <apex:inputHidden value="{!ar.rec.CurrentContract_F_asset__r.Maintenance_Price_Year__c}" id="Maintenance_Price_Year__c"/>
                                 <!--    <apex:inputField value="{!ar.rec.CurrentContract_F_asset__r.Asset_Consumption_Rate__c}" id="AssetConsumptionRateNew2" style="display: none" showDatePicker="false" />
                                    <apex:outputText value="{!ar.rec.CurrentContract_F_asset__r.Asset_Consumption_Rate__c}" id="AssetConsumptionRateNew3" rendered="{!Not(ar.IsManual)}" style="display: none"/> -->
                                    <apex:inputField value="{!ar.rec.Product2.Asset_Model_No__c}" id="Asset_Model_No__c" style="display: none" showDatePicker="false"/>
                                    <apex:inputField value="{!ar.rec.Product2.Category4__c}" id="Category4__c" style="display: none" showDatePicker="false"/>
                                    <!-- 市场多年保价格开发 end 20223/01/17 设备消费率 -->
                                </td>
                                 <!-- <td class="dataCell" width="70px"> -->
                                    <!-- old: 直接拿保有设备的最近一期维修合同 -->
                                    <!-- <apex:outputField value="{!ar.rec.CurrentContract_F__r.Contract_End_Date__c}" rendered="{!(Not(ar.IsManual)&& ar.rec.CurrentContract_F__c != null)}" id="End_Date" /> -->
                                    <!-- new: 在获取保有设备信息时直接判断保有设备的字段时间(保修期至/最近一期维修合同结束日) -->
                                   <!--  <apex:outputField value="{!ar.rec.CurrentContract_End_Date__c}" rendered="{!(Not(ar.IsManual) && ar.rec.CurrentContract_F__c != null )}" id="End_Date" />
                                </td> -->
                                 <!-- 市场多年保价格开发 end 20223/02/20 是否多年保设备 start -->
                                <td class="dataCell" width="90px" style="text-align:center">
                                    <apex:outputField value="{!ar.rec.CurrentContract_F_asset__r.IS_VMContract_Asset__c}" rendered="{!Not(ar.IsManual)}" id="IS_VMContract_Asset"/>
                                </td>
                                 <!-- 市场多年保价格开发 end 20223/02/20 是否多年保设备 end -->
                                <td class="dataCell" width="90px" style="text-align:right" >
                                    <apex:outputField value="{!ar.mcae.Asset_Consumption_rate__c}" rendered="{!Not(ar.IsManual)}" id="Contractrate"/>
                                    <apex:inputHidden value="{!ar.rec.CurrentContract_F__r.Contract_Range__c}" id="lastContRange"/>
                                </td>
                                <!-- 2023/03/21  !ar.rec.CurrentContract_F_asset__r.IS_VMContract_Asset__c 为true  保有设备结束时间:true:多年保:保修期至;false.最近一期维修合同结束日 -->
                                <td class="dataCell" width="70px">
                                    <apex:outputField value="{!ar.rec.CurrentContract_F__r.Contract_End_Date__c}" rendered="{!(Not(ar.IsManual)&& ar.rec.CurrentContract_F__c != null)}" id="End_Date" />
                                    <!-- old: 直接拿保有设备的最近一期维修合同 -->
                                    <!-- <apex:outputField value="{!ar.rec.CurrentContract_F__r.Contract_End_Date__c}" rendered="{!(Not(ar.IsManual)&& ar.rec.CurrentContract_F__c != null)}" id="End_Date" /> -->
                                    <!-- new: 在获取保有设备信息时直接判断保有设备的字段时间(保修期至/最近一期维修合同结束日) -->
                                    <apex:outputField value="{!ar.rec.CurrentContract_End_Date__c}" rendered="{!(Not(ar.IsManual) && ar.rec.CurrentContract_F__c != null )}" id="End_Date" />
                                </td>
                                 <!-- 实绩联动价格计算 start -->
                                <td class="dataCell" width="35px">
                                    <apex:outputText value="{!ar.mcae.Adjustment_Upper_price__c}" id="Adjustment_Upper_price"/>
@@ -2192,6 +3119,10 @@
                                </td>
                                <td class="dataCell" width="35px" >
                                    <apex:outputText value="{!ar.mcae.Adjustment_Lower_price__c}" id="Adjustment_Lower_price"/>
                                  <!--   // 服务合同报价规则改善 20230227 start -->
                                      <!-- <apex:inputHidden value="{!ar.ISStandardPricing}" id="ISStandardPricing" /> -->
                                  <!-- // 服务合同报价规则改善 20230227 end -->
                                    <apex:inputHidden value="{!ar.mcae.LastMContract_Price__c}" id="LastMContract_Price"/>
                                    <apex:inputHidden value="{!ar.mcae.Adjustment_ratio_Lower__c}" id="Adjustment_ratio_Lower"/>
                                    <apex:inputHidden value="{!ar.mcae.Adjustment_Lower_price__c}" id="Adjustment_Lower_priceHidden"/>
@@ -2216,7 +3147,10 @@
                                </td>
                               <!-- (2022年12月上线)故障品加费 start -->
                                <td class="dataCell" width="35px" style="text-align:right" >
                                    <apex:outputText value="{!ar.Repair_Price_Auto}" id="Repair_Price_Auto" style="width:95%; disabled:disabled;"/>
                                     <!-- // 报价规则改善 20230308 start -->
                                  <!--   <apex:inputField value="{!ar.mcae.Blank_period__c}" id="Blank_period" style="display:none"/> -->
                                     <!-- // 报价规则改善 20230308 start -->
                                    <apex:outputText value="{!ar.Repair_Price_Auto}" id="Repair_Price_Auto" style="width:95%; "/>
                                    <!-- <apex:inputHiddenalue="{!ar.rec.Reson_Can_not_Warranty__c}" id="ResonCannotWarranty"/> -->
                                    <!-- <apex:outputText value="{!ar.Agreed_Date}" id="Agreed_Date" style="width:95%;display: none;"/> -->
                                    <apex:inputField value="{!ar.mcae.Repair_Price_pass__c}" id="Repair_Price_pass" style="width:95%;display: none;"/>
@@ -2434,9 +3368,9 @@
                        <th style="text-align: center">申请报价金额</th>
                        <th style="text-align: center">合同设备修理总额</th>
                        <th style="text-align: center">合同总金额</th>
                        <!-- 上限合同 20230103 LY start -->
                        <!-- <th style="text-align: center">上限金额</th> -->
                        <!-- 上限合同 20230103 LY end -->
                        <!-- 上限合同 20230103 hql start -->
                        <th style="text-align: center">上限金额</th>
                        <!-- 上限合同 20230103 hql end -->
                    </tr>
                    <tr>
                        <td style="text-align: center">
@@ -2461,11 +3395,19 @@
                            <apex:inputHidden value="{!estimate.Maintenance_Price__c}" id="mainteRealHidden"/>
                            <apex:inputHidden value="{!OldMaintenancePrice}" id="oldMainteReal"/>
                        </td>
                        <!-- 上限合同 20230103 LY start -->
                       <!--  <td style="text-align: center">
                        <!-- 上限合同 20230103 hql start -->
                        <td style="text-align: center">
                            <apex:inputField value="{!estimate.Limit_Price_Amount__c}" style="ime-mode: disabled; text-align: right; width:100px" id="Limit_Price_Amount" />
                        </td> -->
                        <!-- 上限合同 20230103 LY end -->
                            <apex:inputHidden value="{!isLimitPrice}" id="Limit_Price2Hidden" />
                            <apex:inputHidden value="{!OldLimitPrice}" id="Limit_PriceHidden" />
                            <!-- // 报价规则改善 20230309 start  -->
                            <!-- <apex:inputHidden value="{!Is_Blank_period}" id="Is_Blank_period" />
                            <apex:inputField value="{!estimate.Maintenance_Contract__r.Past_Contract_end_day__c}" style="display:none"  id="PastContractendday" />
                            <apex:inputHidden value="{!estimate.renewTen_OFF__c}" id="renewTenOFF" />
                            <apex:inputHidden value="{!Cost_rate_ForecastF}" id="Cost_rate_ForecastF" /> -->
                            <!-- // 报价规则改善 20230309 end  -->
                        </td>
                        <!-- 上限合同 20230103 hql end -->
                    </tr>
                    <tr>
                        <th style="text-align: center">{!$ObjectType.Maintenance_Contract_Estimate__c.fields.Service_discount_Rate__c.label}</th>
@@ -2511,6 +3453,71 @@
                        <td style="text-align: center"></td>
                    </tr>
                </table>
                <!-- // 报价规则改善 20230309 start  -->
               <!--  <table style="width:100%">
                    <tr>
                        <th style="text-align: center" colspan="3">请结合实际可以签约的日期,选择恰当的申请金额,以免后续空白期变化导致标准金额变化,再次申请价格延误时间</th>
                        <th style="text-align: center"></th>
                        <th style="text-align: center"></th>
                    </tr>
                    <tr>
                        <th style="text-align: center">本次计划【合同预定开始日】:<input type="text" id="startdateaddsix4" readonly="readonly" style="border: none;width:70px"></input> </th>
                        <th style="text-align: center">标准价格的最低价总额</th>
                        <th style="text-align: center">标准价格的最高价总额</th>
                    </tr>
                    <tr>
                        <td style="text-align: center"></td>
                        <td style="text-align: center">
                            CNY<input type="text" id="GuidePriceDown5" readonly="readonly" style="border: none;width:70px"></input>
                        </td>
                        <td style="text-align: center">
                            CNY<input type="text" id="GuidePriceUp5" readonly="readonly" style="border: none;width:70px"></input>
                        </td>
                    </tr>
                    <tr>
                        <th style="text-align: center">当【合同预定开始日】在<input type="text" id="startdateaddsix1" readonly="readonly" style="border: none;width:70px"></input> 之前</th>
                        <th style="text-align: center">标准价格的最低价总额</th>
                        <th style="text-align: center">标准价格的最高价总额</th>
                    </tr>
                    <tr>
                        <td style="text-align: center"></td>
                        <td style="text-align: center">
                            CNY<input type="text" id="GuidePriceDown4" readonly="readonly" style="border: none;width:70px"></input>
                        </td>
                        <td style="text-align: center">
                            CNY<input type="text" id="GuidePriceUp4" readonly="readonly" style="border: none;width:70px"></input>
                        </td>
                    </tr>
                    <tr>
                        <th style="text-align: center">当【合同预定开始日】在<input type="text" id="startdateaddsix2" readonly="readonly" style="border: none;width:70px"></input> 之后</th>
                        <th style="text-align: center">标准价格的最低价总额</th>
                        <th style="text-align: center">标准价格的最高价总额</th>
                    </tr>
                    <tr>
                        <td style="text-align: center"></td>
                        <td style="text-align: center">
                            CNY<input type="text" id="GuidePriceDown3" readonly="readonly" style="border: none;width:70px"></input>
                        </td>
                        <td style="text-align: center">
                            CNY<input type="text" id="GuidePriceUp3" readonly="readonly" style="border: none;width:70px"></input>
                        </td>
                    </tr>
                    <tr>
                        <th style="text-align: center">当【合同预定开始日】在<input type="text" id="startdateaddsix3" readonly="readonly" style="border: none;width:70px"></input> 之后</th>
                        <th style="text-align: center">标准价格的最低价总额</th>
                        <th style="text-align: center">标准价格的最高价总额</th>
                    </tr>
                    <tr>
                        <td style="text-align: center"></td>
                        <td style="text-align: center">
                            CNY<input type="text" id="GuidePriceDown2" readonly="readonly" style="border: none;width:70px"></input>
                        </td>
                        <td style="text-align: center">
                            CNY<input type="text" id="GuidePriceUp2" readonly="readonly" style="border: none;width:70px"></input>
                        </td>
                    </tr>
                </table> -->
                <!-- // 报价规则改善 20230309 end  -->
            </apex:outputPanel>
        </apex:pageblocksection>