| | |
| | | } |
| | | } |
| | | //2021-11-30 fy add LJPH-C8W8FV 置顶 start OwnershipMachine_No__c Product2.ProductURF__c |
| | | //tcm 添加 Management_Code__c 20211201 start |
| | | //20220325 ljh LJPH-C8FB4P【委托】配合PBI设备覆盖率的数据准备 add CurrentContract_F__r.Is_Renewal__c |
| | | //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, ' |
| | | + '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.Is_Renewal__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,' |
| | | //变更多年保续签开始日 thh 20220315 start |
| | | + 'CurrentContract_F__r.Gurantee_Renew_startDate__c' |
| | | //变更多年保续签开始日 thh 20220315 end |
| | | + 'Product2.ProductURF__c,CurrentContract_F__r.Contract_Consumption_rate__c,CurrentContract_F__r.First_contract_usage_Rate__c,CurrentContract_F__r.Contract_Range__c,' |
| | | //WLIG-CDFBV3 开通续签报价为true的可以开放续签报价 thh 20220414 start |
| | | + 'CurrentContract_F__r.Open_RenewalQuotation__c,' |
| | | //WLIG-CDFBV3 开通续签报价为true的可以开放续签报价 thh 20220414 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 + '\' '; |
| | | //HWAG-BDJ43R ---XHL---20190729--- |
| | | //soql += ' AND AssetMark__c != \'耗材\' AND Product2.Family != \'ET\' '; |
| | |
| | | //跳过点检标记 2021/07/28 gzw start |
| | | , Skip_DJ__c |
| | | //跳过点检标记 2021/07/28 gzw start |
| | | |
| | | //WLIG-CDFBV3 开通续签报价为true的可以开放续签报价 thh 20220419 start |
| | | , Maintenance_Contract__r.Open_RenewalQuotation__c |
| | | //WLIG-CDFBV3 开通续签报价为true的可以开放续签报价 thh 20220419 end' |
| | | //LJPH-C9SCX7 【委托】合同无空白期的提醒 lt 20211221 start |
| | | //, Maintenance_Contract__r.Past_Contract_end_day__c //过去合同结束日 |
| | | //LJPH-C9SCX7 【委托】合同无空白期的提醒 lt 20211221 end |
| | |
| | | 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 |
| | | //20220325 ljh LJPH-C8FB4P【委托】配合PBI设备覆盖率的数据准备 add CurrentContract_F__r.Is_Renewal__c |
| | | 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.Is_Renewal__c, CurrentContract_F__r.Estimate_Num__c, CurrentContract_F__r.Contract_End_Date__c, CurrentContract_F__r.Estimate_Contract_endDate__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, |
| | | 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, |
| | | //变更多年保续签开始日 thh 20220315 start |
| | | CurrentContract_F__r.Gurantee_Renew_startDate__c, |
| | | //变更多年保续签开始日 thh 20220315 end |
| | | 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 |
| | |
| | | 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, |
| | | //变更多年保续签开始日 thh 20220315 start |
| | | Asset__r.CurrentContract_F__r.Gurantee_Renew_startDate__c, |
| | | //变更多年保续签开始日 thh 20220315 end |
| | | //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 |
| | | ]; |
| | |
| | | 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, |
| | |
| | | } |
| | | checkedAssets=NumberSort; |
| | | //2021-11-30 fy add LJPH-C8W8FV 置顶 end |
| | | System.debug('thh:' + checkedAssets); |
| | | } |
| | | |
| | | // |
| | |
| | | notInId += '\')'; |
| | | //2021-11-30 fy add LJPH-C8W8FV 置顶 start OwnershipMachine_No__c Product2.ProductURF__c |
| | | //tcm 添加 Management_Code__c 20211201 start |
| | | //20220325 ljh LJPH-C8FB4P【委托】配合PBI设备覆盖率的数据准备 add CurrentContract_F__r.Is_Renewal__c |
| | | 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.Is_Renewal__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, ' |
| | | //变更多年保续签开始日 thh 20220315 start |
| | | + 'CurrentContract_F__r.Gurantee_Renew_startDate__c' |
| | | //变更多年保续签开始日 thh 20220315 end |
| | | + '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,' |
| | | //WLIG-CDFBV3 开通续签报价为true的可以开放续签报价 thh 20220414 start |
| | | + 'CurrentContract_F__r.Open_RenewalQuotation__c,' |
| | | //WLIG-CDFBV3 开通续签报价为true的可以开放续签报价 thh 20220414 end |
| | | + '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 |
| | |
| | | String sqlStr = ''; |
| | | //2021-11-30 fy add LJPH-C8W8FV 置顶 start OwnershipMachine_No__c Product2.ProductURF__c |
| | | //tcm 添加 Management_Code__c 20211201 start |
| | | //20220325 ljh LJPH-C8FB4P【委托】配合PBI设备覆盖率的数据准备 add CurrentContract_F__r.Is_Renewal__c |
| | | sqlStr = 'SELECT Id, Name,OwnershipMachine_No__c, Asset_situation__c, SerialNumber, Department_Name__c, Installation_Site__c,'; |
| | | sqlStr += 'Posting_Date__c,Management_Code__c,IF_Warranty__c,Reson_Can_not_Warranty__c,InstallDate,isNewDate_use__c,'; |
| | | sqlStr += 'Asset_Owner__c, Accumulation_Repair_Amount__c, Maintenance_Price_Month__c, Final_Examination_Date__c,'; |
| | | sqlStr += 'CurrentContract_End_Date__c,Extend_Gurantee_DateTo__c,EquipmentGuaranteeFlg__c,'; |
| | | sqlStr += '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.Is_Renewal__c,CurrentContract_F__r.Estimate_Num__c,CurrentContract_F__r.Contract_End_Date__c,'; |
| | | sqlStr += '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,'; |
| | | sqlStr += '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,'; |
| | | //变更多年保续签开始日 thh 20220315 start |
| | | sqlStr += 'CurrentContract_F__r.Gurantee_Renew_startDate__c'; |
| | | //变更多年保续签开始日 thh 20220315 end |
| | | sqlStr += 'CurrentContract_F__r.First_Estimate_Date__c,CurrentContract_F__r.Estimate_Contract_endDate__c,'; |
| | | sqlStr += 'Product2.ProductURF__c,CurrentContract_F__r.Contract_Consumption_rate__c,CurrentContract_F__r.First_contract_usage_Rate__c,'; |
| | | //WLIG-CDFBV3 开通续签报价为true的可以开放续签报价 thh 20220414 start |
| | | sqlStr += 'CurrentContract_F__r.Open_RenewalQuotation__c,'; |
| | | //WLIG-CDFBV3 开通续签报价为true的可以开放续签报价 thh 20220414 end |
| | | 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\' ) '; |
| | |
| | | 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 20220418 start |
| | | //add wangweipeng 2021/12/26 start |
| | | if(String.isNotBlank(this.estimate.Dealer__c)){ |
| | | checkDealerId = this.estimate.Dealer__c; |
| | |
| | | this.estimate.Is_RecognitionModel__c = false; |
| | | } |
| | | //add wangweipeng 2021/12/26 end |
| | | //提交之后decide之前,经销商变更的话,先款信息以变更后的经销商先款信息执行 thh 20220418 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(); |
| | |
| | | //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; |
| | | // 可开始报价的月数限制 |
| | |
| | | rtn = false; |
| | | } |
| | | } |
| | | // 多年保判断 |
| | | 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); |
| | | //Decimal monthCon = (Decimal)noOfDays/365*12; |
| | | // 可开始报价的月数限制 |
| | | if (input.rec.CurrentContract_F__r.Gurantee_Estimate_startDate__c > Date.today()) { |
| | | input.rec.Name.addError(input.rec.Name + '(' + input.rec.SerialNumber + ') -- 合同结束前6个月开始可以制作报价。'); |
| | | rtn = false; |
| | | } |
| | | } |
| | | // 多年保判断 |
| | | 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); |
| | | //Decimal monthCon = (Decimal)noOfDays/365*12; |
| | | // 可开始报价的月数限制 |
| | | //变更多年保续签开始日 thh 20220315 start |
| | | // if (input.rec.CurrentContract_F__r.Gurantee_Estimate_startDate__c > Date.today()) { |
| | | // input.rec.Name.addError(input.rec.Name + '(' + input.rec.SerialNumber + ') -- 合同结束前6个月开始可以制作报价。'); |
| | | // 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; |
| | | } |
| | | //变更多年保续签开始日 thh 20220315 end |
| | | |
| | | } |
| | | //ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO, '---' + input.rec.CurrentContract_F__r.Contract_End_Date__c)); |
| | | if (inDicideFlag && String.isNotBlank(input.rec.CurrentContract_F__c) && estimate.Skip_DJ__c == false ) { |
| | | //ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO, '+++' + input.rec.CurrentContract_F__r.Contract_End_Date__c)); |
| | |
| | | // return returnValue; |
| | | // 2021-09-10 tcm 排序逻辑调整 end |
| | | } |
| | | } |
| | | } |