涂煌豪
2022-04-14 80b96f2bc9614b3d215a7a8b2bed08bbf7a2a51e
force-app/main/default/classes/SelectAssetEstimateVMController.cls
@@ -1,3 +1,4 @@
/*gzw 优化Maximum view state size limit 追加 Transient */
global class SelectAssetEstimateVMController {
    //test
    private String targetHospitalId = null;                                    // 今後系列病院用
@@ -25,7 +26,7 @@
    public Asset ass { get; set; }
    // 2021、8、26 合同报价页面的优化,无保有设备点检对象选择框变黑 fxk end
    // 病院配下の納入機器の情報を格納する。
    private List<Asset> assetRecords;                                               // TODO 系列病院の場合、この配列は固定できないです。
    private Transient List<Asset> assetRecords;                                               // TODO 系列病院の場合、この配列は固定できないです。
    public List<AssetInfo> checkedAssets { get; set; }
    private List<AssetInfo> unCheckedAssets = new List<AssetInfo>();
    
@@ -236,7 +237,7 @@
            }
        }
        //2021-11-30 fy add LJPH-C8W8FV 置顶 start OwnershipMachine_No__c Product2.ProductURF__c
        //tcm 添加 Management_Code__c  20211201 start
        //tcm 添加 Management_Code__c  20211201 start
        String soql = 'SELECT Id, Name,OwnershipMachine_No__c, Asset_situation__c, SerialNumber, Department_Name__c, Installation_Site__c, '
                      + 'Posting_Date__c,Management_Code__c,IF_Warranty__c,Reson_Can_not_Warranty__c, InstallDate,isNewDate_use__c, '
                      + 'Asset_Owner__c, Accumulation_Repair_Amount__c, Maintenance_Price_Month__c, Final_Examination_Date__c, '
@@ -730,7 +731,7 @@
        // 納入機器の情報を取得
        if (!String.isBlank(this.targetHospitalId) && (this.targetHospitalId.length() == 15 || this.targetHospitalId.length() == 18)) {
            //2021-11-30 fy add LJPH-C8W8FV 置顶 start OwnershipMachine_No__c Product2.ProductURF__c
                  //tcm 添加 Management_Code__c  20211201 start
            //tcm 添加 Management_Code__c  20211201 start
            assetRecords = [SELECT Id, Name,OwnershipMachine_No__c,Product2.ProductURF__c, Asset_situation__c, SerialNumber, Department_Name__c, Installation_Site__c, Posting_Date__c, Management_Code__c, IF_Warranty__c, Reson_Can_not_Warranty__c,
                            InstallDate, isNewDate_use__c, Asset_Owner__c, Accumulation_Repair_Amount__c, Maintenance_Price_Month__c, Final_Examination_Date__c, CurrentContract_End_Date__c, EquipmentGuaranteeFlg__c,
                            CurrentContract_F__c, CurrentContract_F__r.Maintenance_Contract_No_F__c,CurrentContract_F__r.Management_Code__c, CurrentContract_F__r.RecordType_DeveloperName__c, CurrentContract_F__r.Estimate_Num__c, CurrentContract_F__r.Contract_End_Date__c, CurrentContract_F__r.Estimate_Contract_endDate__c,
@@ -738,6 +739,9 @@
                            CurrentContract_F__r.First_Estimate_Date__c,
                            CurrentContract_F__r.Contract_Consumption_rate__c, CurrentContract_F__r.First_contract_usage_Rate__c,
                            CurrentContract_F__r.Contract_Range__c, AssetMark__c,
                            //WLIG-CDFBV3 开通续签报价为true的可以开放续签报价 thh 20220414 start
                            CurrentContract_F__r.Open_RenewalQuotation__c,
                            //WLIG-CDFBV3 开通续签报价为true的可以开放续签报价 thh 20220414 end
                            // 2021-01-29 LJPH-BX9CVX mzy   add  合同报价时判断零件风险
                            NoPartRiskDate_F__c, NoPartRiskDate__c, SignableFlag__c,
                            Product2.PartSupplyFinishDate__c, Product2.PartSupplyFinishDateExp__c
@@ -778,7 +782,10 @@
                Asset__r.CurrentContract_F__r.Estimate_Contract_endDate__c,
                Asset__r.CurrentContract_F__r.Contract_Range__c,
                Asset__r.CurrentContract_F__r.Contract_End_Date__c,
                Asset__r.CurrentContract_F__r.Gurantee_Estimate_startDate__c
                Asset__r.CurrentContract_F__r.Gurantee_Estimate_startDate__c,
                //WLIG-CDFBV3 开通续签报价为true的可以开放续签报价 thh 20220414 start
                Asset__r.CurrentContract_F__r.Open_RenewalQuotation__c
                //WLIG-CDFBV3 开通续签报价为true的可以开放续签报价 thh 20220414 end
                from Maintenance_Contract_Asset__c
                where Maintenance_Contract__c = :this.targetMaintenanceContractId
            ];
@@ -846,6 +853,9 @@
                                                                Asset__r.CurrentContract_F__r.Contract_Range__c,
                                                                Asset__r.CurrentContract_F__r.Contract_End_Date__c,
                                                                Asset__r.CurrentContract_F__r.Gurantee_Estimate_startDate__c,
                                                                //WLIG-CDFBV3 开通续签报价为true的可以开放续签报价 thh 20220414 start
                                                                Asset__r.CurrentContract_F__r.Open_RenewalQuotation__c,
                                                                //WLIG-CDFBV3 开通续签报价为true的可以开放续签报价 thh 20220414 end
                                                                LastMContract_Price__c,
                                                                Asset__r.CurrentContract_F_asset__r.Estimate_Cost_Month_formula__c,
                                                                Asset__r.CurrentContract_F_asset__r.endDateGurantee_Text__c,
@@ -1081,12 +1091,12 @@
            }
            notInId += '\')';
            //2021-11-30 fy add LJPH-C8W8FV 置顶 start OwnershipMachine_No__c Product2.ProductURF__c
                //tcm 添加 Management_Code__c  20211201 start
            //tcm 添加 Management_Code__c  20211201 start
            String sqlStr = 'SELECT Id, Name,OwnershipMachine_No__c, Asset_situation__c, SerialNumber, Department_Name__c, Installation_Site__c, '
                            + 'Posting_Date__c,Management_Code__c,IF_Warranty__c,Reson_Can_not_Warranty__c, InstallDate,isNewDate_use__c, '
                            + 'Asset_Owner__c, Accumulation_Repair_Amount__c, Maintenance_Price_Month__c, Final_Examination_Date__c, '
                            + 'CurrentContract_End_Date__c, Extend_Gurantee_DateTo__c,EquipmentGuaranteeFlg__c, '
                            + 'CurrentContract_F__c,CurrentContract_F__r.Maintenance_Contract_No_F__c,CurrentContract_F__r.Management_Code__c,CurrentContract_F__r.RecordType_DeveloperName__c,CurrentContract_F__r.Estimate_Num__c,CurrentContract_F__r.Contract_End_Date__c,'
                            + 'CurrentContract_F__c,CurrentContract_F__r.Maintenance_Contract_No_F__c,CurrentContract_F__r.Management_Code__c,CurrentContract_F__r.RecordType_DeveloperName__c, CurrentContract_F__r.Estimate_Num__c,CurrentContract_F__r.Contract_End_Date__c,'
                            + 'CurrentContract_F_asset__c,CurrentContract_F_asset__r.Estimate_Cost_Month_formula__c,CurrentContract_F_asset__r.endDateGurantee_Text__c,CurrentContract_F__r.Gurantee_Estimate_startDate__c, '
                            + 'CurrentContract_F__r.First_Estimate_Date__c,CurrentContract_F__r.Estimate_Contract_endDate__c,'
                            + 'CurrentContract_F__r.Contract_Consumption_rate__c,CurrentContract_F__r.First_contract_usage_Rate__c,'
@@ -2542,14 +2552,16 @@
            t = this.estimate.Contract_Start_Date__c.addMonths(Integer.valueOf(this.estimate.Contract_Range__c));
            t = t.addDays(-1);
            this.estimate.Contract_End_Date__c = t;
            //以提交报价的时点,锁定经销商的先款状态,decide时不再更新经销商的性质 thh 20220407 start
            //add      wangweipeng                   2021/12/26                     start
            if(String.isNotBlank(this.estimate.Dealer__c)){
                checkDealerId = this.estimate.Dealer__c;
                onChDealerUpdate();
            }else{
                this.estimate.Is_RecognitionModel__c = false;
            }
            // if(String.isNotBlank(this.estimate.Dealer__c)){
            //     checkDealerId = this.estimate.Dealer__c;
            //     onChDealerUpdate();
            // }else{
            //     this.estimate.Is_RecognitionModel__c = false;
            // }
            //add      wangweipeng                   2021/12/26                     end
            //以提交报价的时点,锁定经销商的先款状态,decide时不再更新经销商的性质 thh 20220407 end
            System.debug('---------345----'+this.estimate.Dealer__c+'-------'+this.estimate.Dealer__r.FirstParagraphEnd__c);
            // 位置调整 在1951 line
            // Date createdDate = this.estimate.CreatedDate == null ? System.today() : this.estimate.CreatedDate.date();
@@ -3033,8 +3045,10 @@
                //1.合同期不满一年时,合同期超过一半才可开始续签报价。(eg:11个月的合同从6个月后才可报价。)
                //2.一年以上的合同,在结束前6个月开始可以开放续签报价。
                //3.管理员跳过,
                if (UserInfo.getProfileId() != System.Label.ProfileId_SystemAdmin && String.isNotBlank(input.rec.CurrentContract_F__c) && input.rec.CurrentContract_F__r.RecordType_DeveloperName__c != 'VM_Contract') {
                //WLIG-CDFBV3 开通续签报价为true的可以开放续签报价 thh 20220413
                if (input.rec.CurrentContract_F__r.Open_RenewalQuotation__c == false && UserInfo.getProfileId() != System.Label.ProfileId_SystemAdmin &&
                        String.isNotBlank(input.rec.CurrentContract_F__c) && input.rec.CurrentContract_F__r.RecordType_DeveloperName__c != 'VM_Contract') {
                    Integer noOfDays = today.daysBetween(input.rec.CurrentContract_F__r.Contract_End_Date__c);
                    Decimal monthCon = (Decimal)noOfDays / 365 * 12;
                    // 可开始报价的月数限制
@@ -3050,7 +3064,7 @@
                    }
                }
                // 多年保判断
                if ( String.isNotBlank(input.rec.CurrentContract_F__c) && input.rec.CurrentContract_F__r.RecordType_DeveloperName__c == 'VM_Contract') {
                if (String.isNotBlank(input.rec.CurrentContract_F__c) && input.rec.CurrentContract_F__r.RecordType_DeveloperName__c == 'VM_Contract') {
                    //if (UserInfo.getProfileId() != System.Label.ProfileId_SystemAdmin && String.isNotBlank(input.rec.CurrentContract_F__c) && input.rec.CurrentContract_F__r.RecordType_DeveloperName__c == 'VM_Contract') {
    
                    //Integer noOfDays = today.daysBetween(input.rec.CurrentContract_F_asset__r.endDateGurantee_Text__c);
@@ -3179,16 +3193,16 @@
    public Asset rec { get; set; }
    public Maintenance_Contract_Asset_Estimate__c mcae { get; set; }
    public Boolean isManual { get; set; }
    public Decimal orgPrice {get; private set;}
    public Decimal orgPrice12 {get; private set;}
    public Transient Decimal orgPrice {get; private set;}
    public Transient Decimal orgPrice12 {get; private set;}
    // add by fxk 2021/9/9 控制点检对象是否可选 Star
    public Boolean CheckRows {get; private set;}
    // add by fxk 2021/9/9 控制点检对象是否可选 End
    
    //add by rentx 2020-11-12 LJPH-BV93RZ start
    public String proName;
    public String proSerialNumber;
    public String proSerialName;
    public Transient String proName;
    public Transient String proSerialNumber;
    public Transient String proSerialName;
    //add by rentx 2020-11-12 LJPH-BV93RZ end
    //add by mzy 2020-11-12 LJPH-BX9CVX start
    //public Date NoPartRiskDate;
@@ -3543,4 +3557,4 @@
    // return returnValue;
    // 2021-09-10 tcm 排序逻辑调整 end
    }
    }
}