| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | } |
| | | } |
| | | } |
| | | public Map<String,repair__c> getNewrep(List<Asset> assetRecords) { |
| | | List<String> assnoList = new List<String>(); |
| | | // 故障品加费20221226 |
| | | for (Asset ast : assetRecords) { |
| | | if (ast.Return_Without_Repair__r.Agreed_Date__c == null) { |
| | | if (!assnoList.contains(ast.id)) { |
| | | assnoList.add(ast.id); |
| | | } |
| | | } |
| | | } |
| | | List<repair__c> repairs2 = [SELECT Id,name,Repair_List_Price_formula__c,Delivered_Product__r.id ,CreatedDate |
| | | FROM repair__c |
| | | WHERE Delivered_Product__c in :assnoList order by Delivered_Product__c ,CreatedDate desc]; |
| | | Map<String,repair__c> assNewRepMap = new Map<String,repair__c>(); |
| | | for (repair__c rep : repairs2) { |
| | | if (assNewRepMap.get(rep.Delivered_Product__r.id)==null){ |
| | | assNewRepMap.put(rep.Delivered_Product__r.id,rep); |
| | | } |
| | | if (assNewRepMap.get(rep.Delivered_Product__r.id)!=null) { |
| | | if (assNewRepMap.get(rep.Delivered_Product__r.id).CreatedDate < rep.CreatedDate) { |
| | | assNewRepMap.remove(rep.Delivered_Product__r.id); |
| | | assNewRepMap.put(rep.Delivered_Product__r.id,rep); |
| | | } |
| | | } |
| | | } |
| | | return assNewRepMap; |
| | | } |
| | | // public Map<String,repair__c> getNewrep(List<Asset> assetRecords) { |
| | | // List<String> assnoList = new List<String>(); |
| | | // // 故障品加费20221226 |
| | | // for (Asset ast : assetRecords) { |
| | | // if (ast.Return_Without_Repair__r.Agreed_Date__c == null) { |
| | | // if (!assnoList.contains(ast.id)) { |
| | | // assnoList.add(ast.id); |
| | | // } |
| | | // } |
| | | // } |
| | | // List<repair__c> repairs2 = [SELECT Id,name,Repair_List_Price_formula__c,Delivered_Product__r.id ,CreatedDate |
| | | // FROM repair__c |
| | | // WHERE Delivered_Product__c in :assnoList order by Delivered_Product__c ,CreatedDate desc]; |
| | | // Map<String,repair__c> assNewRepMap = new Map<String,repair__c>(); |
| | | // for (repair__c rep : repairs2) { |
| | | // if (assNewRepMap.get(rep.Delivered_Product__r.id)==null){ |
| | | // assNewRepMap.put(rep.Delivered_Product__r.id,rep); |
| | | // } |
| | | // if (assNewRepMap.get(rep.Delivered_Product__r.id)!=null) { |
| | | // if (assNewRepMap.get(rep.Delivered_Product__r.id).CreatedDate < rep.CreatedDate) { |
| | | // assNewRepMap.remove(rep.Delivered_Product__r.id); |
| | | // assNewRepMap.put(rep.Delivered_Product__r.id,rep); |
| | | // } |
| | | // } |
| | | // } |
| | | // return assNewRepMap; |
| | | // } |
| | | public void NextMaintenanceContract() { |
| | | // 20220810 询价2期开发 |
| | | List<String> asslocalList = new List<String>(); |
| | |
| | | } |
| | | SELECT_LIMIT = selctRecordNum; |
| | | Integer selectCnt = unCheckedAssets.size(); |
| | | Map<String,repair__c> assNewRepMap = new Map<String,repair__c>(); |
| | | assNewRepMap = getNewrep(assetList); |
| | | // Map<String,repair__c> assNewRepMap = new Map<String,repair__c>(); |
| | | // assNewRepMap = getNewrep(assetList); |
| | | num++; |
| | | num++; |
| | | for (Asset asset : assetList) { |
| | |
| | | if (unCheckedAssets.size() >= SELECT_LIMIT) { overLimit = true; break; } |
| | | if (markUpUnCheckMap.containsKey(asset.Id) == false) { |
| | | //unCheckedInfoList.add(unCheckMap.get(asset.Id)); |
| | | unCheckedAssets.add(new AssetInfo(unCheckedAssets.size(), asset,assNewRepMap)); |
| | | unCheckedAssets.add(new AssetInfo(unCheckedAssets.size(), asset)); |
| | | } |
| | | } |
| | | } |
| | |
| | | //URF限次合同2期 LY 20220811 end |
| | | |
| | | //多年保设备续签计算逻辑调整 2022/12/14 start 消费率 |
| | | +'CurrentContract_F_asset__r.Asset_Consumption_Rate__c,Product2.Category4__c,Product2.Asset_Model_No__c,' |
| | | +'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 + '\' '; |
| | |
| | | |
| | | //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; |
| | |
| | | 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; |
| | | } |
| | |
| | | public Boolean isSaveOrApproval {get; set;} |
| | | public String OldContractStartDate {get; set;} |
| | | public String OldMaintenancePrice { get; set; } |
| | | public Decimal OldLimitPrice { get; set; } |
| | | |
| | | /** |
| | | * コンストラクタ |
| | |
| | | , Sales_incidental__c, Consumption_rate_Forecast__c, AgencyHos_Price__c |
| | | // 申请报价金额 和 相对标准价格范围的折扣率 |
| | | , Request_quotation_Amount__c, Service_discount_Rate__c, ContractPriceType__c |
| | | //上限合同 20230103 LY start |
| | | //上限合同 20230103 hql start |
| | | ,Limit_Price_Amount__c |
| | | //上限合同 20230103 LY end |
| | | //上限合同 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 |
| | |
| | | //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) + |
| | |
| | | isSaveOrApproval = false; |
| | | OldContractStartDate = null; |
| | | OldMaintenancePrice = null; |
| | | |
| | | OldLimitPrice = null; |
| | | inDicideFlag = false; |
| | | |
| | | isSoft = false; |
| | |
| | | } |
| | | this.targetMaintenanceContractId = ApexPages.currentPage().getParameters().get('mcid'); |
| | | } |
| | | |
| | | // 編集から |
| | | if (String.isBlank(this.targetEstimateId) == false) { |
| | | setThisEstimate(); |
| | |
| | | |
| | | //多年保设备续签计算逻辑调整 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 |
| | | //多年保设备续签计算逻辑调整 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 |
| | |
| | | //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 start |
| | | // 選択済みの納入機器情報を取得 |
| | | Map<Id, Integer> selectedAssetIds = new Map<Id, Integer>(); |
| | | List<Maintenance_Contract_Asset_Estimate__c> selectedMcaes = new List<Maintenance_Contract_Asset_Estimate__c>(); |
| | |
| | | Asset__r.CurrentContract_F_asset__r.endDateGurantee_Text__c, |
| | | //多年保设备续签计算逻辑调整 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.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, |
| | |
| | | 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, |
| | |
| | | ,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 |
| | |
| | | // ③Assetを元にデータをマッピングする時、明細マップからAssetAを取得できない?一覧に明細Aが出ない |
| | | // 次回、Assetの検索条件が大きく変更する時、対応必要 |
| | | List<Data> datatemp = new List<Data>(); |
| | | Map<String,repair__c> assNewRepMap = new Map<String,repair__c>(); |
| | | assNewRepMap = getNewrep(this.assetRecords); |
| | | // Map<String,repair__c> assNewRepMap = new Map<String,repair__c>(); |
| | | // assNewRepMap = getNewrep(this.assetRecords); |
| | | datatemp = getChartData(); |
| | | for (Asset ast : this.assetRecords) { |
| | | Boolean isNew = false; |
| | |
| | | // |
| | | // |
| | | // |
| | | checkedAssets.add(new AssetInfo(checkedAssets.size(), ast, isNew, listPrice, selectedLocal,estimate,assNewRepMap)); |
| | | checkedAssets.add(new AssetInfo(checkedAssets.size(), ast, isNew, listPrice, selectedLocal,estimate)); |
| | | } else { |
| | | //update by rentongxiao 2020-09-23 start |
| | | if (ast.AssetMark__c == '主机') { |
| | | totalRecords++; |
| | | if (unCheckedAssets.size() < selctRecordNum) { |
| | | unCheckedAssets.add(new AssetInfo(unCheckedAssets.size(), ast,assNewRepMap)); |
| | | unCheckedAssets.add(new AssetInfo(unCheckedAssets.size(), ast)); |
| | | } |
| | | } |
| | | //update by rentongxiao 2020-09-23 end |
| | |
| | | //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 设备消费率 产品型号 第四分类 |
| | | //市场多年保价格开发 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,' |
| | | //市场多年保价格开发 start DC 2023/01/17 |
| | | + '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 |
| | |
| | | //URF限次合同2期 LY 20220811 end |
| | | |
| | | //市场多年保价格开发 start DC 2023/01/17 设备消费率 |
| | | sqlStr += 'CurrentContract_F_asset__r.Asset_Consumption_Rate__c,Asset__r.Product2.Asset_Model_No__c,Asset__r.Product2.Category4__c,'; |
| | | 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 + '\''; |
| | |
| | | } |
| | | } |
| | | this.unCheckedAssets = new List<AssetInfo>(); |
| | | Map<String,repair__c> assNewRepMap = new Map<String,repair__c>(); |
| | | assNewRepMap = getNewrep(this.assetRecords); |
| | | // Map<String,repair__c> assNewRepMap = new Map<String,repair__c>(); |
| | | // assNewRepMap = getNewrep(this.assetRecords); |
| | | for (Asset ast : assetRecords) { |
| | | this.unCheckedAssets.add(new AssetInfo(unCheckedAssets.size(), ast,assNewRepMap)); |
| | | this.unCheckedAssets.add(new AssetInfo(unCheckedAssets.size(), ast)); |
| | | } |
| | | listCut(unCheckedAssets); |
| | | // 根据合同开始日重新计算维修合同价格 |
| | |
| | | // 20191210 Gzw 服务合同过去3年修理实绩合并 |
| | | List<AggregateResult> FriRepairList = [ |
| | | select |
| | | sum(Repair_List_Price_formula__c) SumPrice, |
| | | sum(Discount_Price_formula__c) SumPrice, |
| | | //2019/1添加 |
| | | sum(Repair_Quotation_Id__r.sales_discount__c) sales_discount, |
| | | sum(Repair_Quotation_Id__r.Contract_target__c) contract_target, |
| | |
| | | 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 = [ |
| | | select |
| | | sum(Repair_List_Price_formula__c) SumPrice, |
| | | sum(Discount_Price_formula__c) SumPrice, |
| | | //2019/1添加 |
| | | sum(Repair_Quotation_Id__r.sales_discount__c) sales_discount, |
| | | sum(Repair_Quotation_Id__r.Contract_target__c) contract_target, |
| | |
| | | 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年间修理实绩 |
| | | List<AggregateResult> ThiRepairList = [ |
| | | select |
| | | sum(Repair_List_Price_formula__c) SumPrice, |
| | | sum(Discount_Price_formula__c) SumPrice, |
| | | //2019/1添加 |
| | | sum(Repair_Quotation_Id__r.sales_discount__c) sales_discount, |
| | | sum(Repair_Quotation_Id__r.Contract_target__c) contract_target, |
| | |
| | | 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年修理实绩 |
| | | List<AggregateResult> ThreeyearList = [ |
| | | select |
| | | sum(Repair_List_Price_formula__c) SumPrice, |
| | | sum(Discount_Price_formula__c) SumPrice, |
| | | //2019/1添加 |
| | | sum(Repair_Quotation_Id__r.sales_discount__c) sales_discount, |
| | | sum(Repair_Quotation_Id__r.Contract_target__c) contract_target, |
| | |
| | | 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 |
| | | ]; |
| | | |
| | |
| | | // 20191210 Gzw 服务合同过去3年修理实绩合并 |
| | | List<AggregateResult> FriRepairList = [ |
| | | select |
| | | sum(Repair_List_Price_formula__c) SumPrice, |
| | | sum(Discount_Price_formula__c) SumPrice, |
| | | //2019/1添加 |
| | | sum(Repair_Quotation_Id__r.sales_discount__c) sales_discount, |
| | | sum(Repair_Quotation_Id__r.Contract_target__c) contract_target, |
| | |
| | | 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 = [ |
| | | select |
| | | sum(Repair_List_Price_formula__c) SumPrice, |
| | | sum(Discount_Price_formula__c) SumPrice, |
| | | //2019/1添加 |
| | | sum(Repair_Quotation_Id__r.sales_discount__c) sales_discount, |
| | | sum(Repair_Quotation_Id__r.Contract_target__c) contract_target, |
| | |
| | | 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年间修理实绩 |
| | | List<AggregateResult> ThiRepairList = [ |
| | | select |
| | | sum(Repair_List_Price_formula__c) SumPrice, |
| | | sum(Discount_Price_formula__c) SumPrice, |
| | | //2019/1添加 |
| | | sum(Repair_Quotation_Id__r.sales_discount__c) sales_discount, |
| | | sum(Repair_Quotation_Id__r.Contract_target__c) contract_target, |
| | |
| | | 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年修理实绩 |
| | | List<AggregateResult> ThreeyearList = [ |
| | | select |
| | | sum(Repair_List_Price_formula__c) SumPrice, |
| | | sum(Discount_Price_formula__c) SumPrice, |
| | | //2019/1添加 |
| | | sum(Repair_Quotation_Id__r.sales_discount__c) sales_discount, |
| | | sum(Repair_Quotation_Id__r.Contract_target__c) contract_target, |
| | |
| | | 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年间 |
| | |
| | | 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>(); |
| | |
| | | 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, |
| | |
| | | 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; |
| | |
| | | //2.一年以上的合同,在结束前6个月开始可以开放续签报价。 |
| | | //3.管理员跳过, |
| | | //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') { |
| | | // 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; |
| | | // 可开始报价的月数限制 |
| | | if (input.rec.CurrentContract_F__r.Contract_Range__c >= 12 && monthCon > 6) { |
| | | input.rec.Name.addError(input.rec.Name + '(' + input.rec.SerialNumber + ') -- 合同结束前6个月开始可以制作报价。'); |
| | | rtn = false; |
| | | } |
| | | //ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO, '---' + monthCon + ' +++ ' + Math.floor(input.rec.CurrentContract_F__r.Contract_Range__c/2))); |
| | | // Integer noOfDays = today.daysBetween(input.rec.CurrentContract_F__r.Contract_End_Date__c); |
| | | // Decimal monthCon = (Decimal)noOfDays / 365 * 12; |
| | | // // 可开始报价的月数限制 |
| | | // if (input.rec.CurrentContract_F__r.Contract_Range__c >= 12 && monthCon > 6) { |
| | | // input.rec.Name.addError(input.rec.Name + '(' + input.rec.SerialNumber + ') -- 合同结束前6个月开始可以制作报价。'); |
| | | //rtn = false; |
| | | if (input.rec.CurrentContract_F__r.Contract_Range__c < 12 && monthCon > Math.floor(input.rec.CurrentContract_F__r.Contract_Range__c / 2)) { |
| | | input.rec.Name.addError(input.rec.Name + '(' + input.rec.SerialNumber + ') -- 经历月数过半方可制作报价'); |
| | | rtn = false; |
| | | } |
| | | } |
| | | // } |
| | | // //ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO, '---' + monthCon + ' +++ ' + Math.floor(input.rec.CurrentContract_F__r.Contract_Range__c/2))); |
| | | // //rtn = false; |
| | | // if (input.rec.CurrentContract_F__r.Contract_Range__c < 12 && monthCon > Math.floor(input.rec.CurrentContract_F__r.Contract_Range__c / 2)) { |
| | | // input.rec.Name.addError(input.rec.Name + '(' + input.rec.SerialNumber + ') -- 经历月数过半方可制作报价'); |
| | | // 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') { |
| | |
| | | // 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; |
| | | |
| | | |
| | | if(today>endDate6Month && cotractEndDay <today){ |
| | | input.rec.Name.addError(input.rec.Name + '(' + input.rec.SerialNumber + ') -- 建议空白期控制在1个月以内,如不得己空白期在6个月以上,请先联络服务管理部评估。'); |
| | | |
| | | } |
| | | |
| | | //市场多年保修价格开发 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; |
| | |
| | | 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;} |
| | |
| | | // add by fxk 2021/9/9 控制点检对象是否可选 End |
| | | } |
| | | // 選択された用(非Manual) |
| | | public AssetInfo(Integer lineNo, Asset record, Boolean isNew, Decimal listPrice, Maintenance_Contract_Asset_Estimate__c mcae,Maintenance_Contract_Estimate__c estimate, Map<String,repair__c> assNewRepMap) { |
| | | 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.ISStandardPricing = mcae.IS_StandardPricing__c; |
| | | this.estimate = new Maintenance_Contract_Estimate__c(); |
| | | this.estimate.IS_Reduced_price_approval__c = estimate.IS_Reduced_price_approval__c; |
| | | // (2022年12月上线)故障品加费 start |
| | |
| | | //(2022年12月上线)故障品加费 第三方回归 |
| | | Third_Party_Return__c = mcae.Third_Party_Return__c |
| | | ); |
| | | if ((this.mcae.Repair_Price__c==null&&this.Repair_Price_Auto!=null)||(this.estimate.IS_Reduced_price_approval__c == '否')) { |
| | | if ((this.mcae.Repair_Price__c==null&&this.Repair_Price_Auto!=null&&this.rec.Reson_Can_not_Warranty__c!=null&&this.rec.Reson_Can_not_Warranty__c.indexof('弃修')!=-1)||(this.estimate.IS_Reduced_price_approval__c == '否')) { |
| | | this.mcae.Repair_Price__c = this.Repair_Price_Auto; |
| | | } |
| | | if (this.estimate.IS_Reduced_price_approval__c=='是'||this.estimate.IS_Reduced_price_approval__c==null) { |
| | |
| | | public AssetInfo(Integer lineNo, Maintenance_Contract_Asset_Estimate__c mcae) { |
| | | this.lineNo = lineNo; |
| | | this.rec = null; |
| | | this.ISStandardPricing = mcae.IS_StandardPricing__c; |
| | | this.mcae = new Maintenance_Contract_Asset_Estimate__c( |
| | | // id = mcae.Id, // 本当にいらないの? セットしたら、新規権限がなくでも、更新できます。後藤さんに確認した、なくでもいいです。 |
| | | isNew__c = mcae.IsNew__c, |
| | |
| | | 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; |
| | | } |
| | |
| | | this.proSerialName = record.Name; |
| | | this.proSerialNumber = record.SerialNumber; |
| | | } |
| | | public AssetInfo(Integer lineNo, Asset record, Map<String,repair__c> assNewRepMap) { |
| | | this.lineNo = lineNo; |
| | | this.rec = record; |
| | | // (2022年12月上线)故障品加费 start |
| | | // if (record.Asset_situation__c == '修理中' && record.Return_Without_Repair__r.Agreed_Date__c!=null) { |
| | | // this.Agreed_Date = '不为空'; |
| | | // } |
| | | // if (record.Asset_situation__c == '修理中' && record.Return_Without_Repair__r.Agreed_Date__c==null) { |
| | | // this.Agreed_Date = '为空'; |
| | | // if (assNewRepMap.get(record.id)!=null) { |
| | | // this.Repair_Price_Auto = assNewRepMap.get(record.id).Repair_List_Price_formula__c; |
| | | // } |
| | | // } |
| | | // if (record.Return_Without_Repair__r.Repair_List_Price_formula__c!=null&&record.Asset_situation__c != '修理中') { |
| | | // public AssetInfo(Integer lineNo, Asset record) { |
| | | // this.lineNo = lineNo; |
| | | // this.rec = record; |
| | | // // (2022年12月上线)故障品加费 start |
| | | // // if (record.Asset_situation__c == '修理中' && record.Return_Without_Repair__r.Agreed_Date__c!=null) { |
| | | // // this.Agreed_Date = '不为空'; |
| | | // // } |
| | | // // if (record.Asset_situation__c == '修理中' && record.Return_Without_Repair__r.Agreed_Date__c==null) { |
| | | // // this.Agreed_Date = '为空'; |
| | | // // if (assNewRepMap.get(record.id)!=null) { |
| | | // // this.Repair_Price_Auto = assNewRepMap.get(record.id).Repair_List_Price_formula__c; |
| | | // // } |
| | | // // } |
| | | // // if (record.Return_Without_Repair__r.Repair_List_Price_formula__c!=null&&record.Asset_situation__c != '修理中') { |
| | | // // this.Repair_Price_Auto = record.Return_Without_Repair__r.Repair_List_Price_formula__c; |
| | | // // } |
| | | // 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; |
| | | // } |
| | | 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; |
| | | } |
| | | // (2022年12月上线)故障品加费 end |
| | | this.isManual = false; |
| | | this.rec_checkBox_c = false; |
| | | this.orgPrice = record.Maintenance_Price_Month__c; |
| | | this.orgPrice12 = this.orgPrice * 12; |
| | | this.etGFlg = record.EquipmentGuaranteeFlg__c; |
| | | this.proSerialName = record.Name; |
| | | this.proSerialNumber = record.SerialNumber; |
| | | } |
| | | // // (2022年12月上线)故障品加费 end |
| | | // this.isManual = false; |
| | | // this.rec_checkBox_c = false; |
| | | // this.orgPrice = record.Maintenance_Price_Month__c; |
| | | // this.orgPrice12 = this.orgPrice * 12; |
| | | // this.etGFlg = record.EquipmentGuaranteeFlg__c; |
| | | // this.proSerialName = record.Name; |
| | | // this.proSerialNumber = record.SerialNumber; |
| | | // } |
| | | } |
| | | |
| | | WebService static String pageDecide(String strId) { |