From cc266a1e4080bb3ecc47ea4a202dd549545111e1 Mon Sep 17 00:00:00 2001 From: 游畅 <youchang@prec-tech.com> Date: 星期六, 29 四月 2023 16:10:52 +0800 Subject: [PATCH] 贸易合规20230429 --- force-app/main/default/classes/SelectAssetEstimateVMController.cls | 1479 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 1,391 insertions(+), 88 deletions(-) diff --git a/force-app/main/default/classes/SelectAssetEstimateVMController.cls b/force-app/main/default/classes/SelectAssetEstimateVMController.cls index 0f2b543..6a4fa24 100644 --- a/force-app/main/default/classes/SelectAssetEstimateVMController.cls +++ b/force-app/main/default/classes/SelectAssetEstimateVMController.cls @@ -4,7 +4,7 @@ private String targetHospitalId = null; // 浠婂緦绯诲垪鐥呴櫌鐢� private String targetMaintenanceContractId = null; public String typeresult {get; set;} - + public Integer num{get; set;} public String targetEstimateId { get; private set; } public Boolean changedAfterPrint {get; set;} // true 銇牬鍚堛�佺敾闈€伀 confirm 銉°儍銈汇兗銈搞亴琛ㄧず銇椼伨銇欍�俼uoId銈掓柊銇椼亜insert銆傚垽瀹氥伅js銇仸瀹熸柦 public Decimal lastFriYearsPriceSum {get; set;} @@ -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; } @@ -44,7 +49,9 @@ //HWAG-B399Q8 2018/08/20 妫�楠屾槸鍚︽樉绀�'璇锋彁浜ゅ緟瀹℃壒' start public Boolean IS_Clone_After_Decide { get; set; } //HWAG-B399Q8 2018/08/20 妫�楠屾槸鍚︽樉绀�'璇锋彁浜ゅ緟瀹℃壒' end + //2021-11-30 fy add LJPH-C8W8FV 缃《 start public List<String> TopProductModel =new List<String>(); + //2021-11-30 fy add LJPH-C8W8FV 缃《 end static { recordNum = new List<SelectOption>(); recordNum.add(new SelectOption('10', '10')); @@ -114,6 +121,26 @@ public String contr {get; set; } //鍒ゆ柇鏄惁init //LJPH-BSS6E2 ---20200911 ---add by rentongxiao end + //2022 鏁呴殰鍝佸姞璐� 鏄惁鏄疐SE鎿嶄綔 鎻愪环鍑忎环鐢宠鎸夐挳鏄惁鍙 + public Boolean isFSE { get; set; } + 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 + public Boolean isOrverYear { get; set;} + public Decimal MaintenancePriceYear { get; set; } + public Decimal Denominator {get; set; } + public Decimal Accrued {get; set; } + public String ProductModel{get;set;} + // public String Category{get;set;} + public Decimal Consumption_rate_Gurante{get;set;} + + // 妫�绱㈡寜閽� public PageReference searchBtn() { countorder = 1; @@ -137,16 +164,45 @@ cond1ForSort = cond1; val1ForSort = val1; currPage = 1; - - 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 contr = '2'; + integer num=0; + num++; + num++; //LJPH-BSS6E2 ---20200911 ---add by rentongxiao end assetSerialNumberList = new List<String>(); assetSerialNumberList.clear(); @@ -158,9 +214,78 @@ } } } - - // + // 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>(); + List<String> mcalocalList = new List<String>(); + Map<Id, Maintenance_Contract__c> map3 = new Map<Id, Maintenance_Contract__c>(); + + List<Maintenance_Contract_Asset__c> mcaupdateList = new List<Maintenance_Contract_Asset__c>(); + for (AssetInfo ass : this.checkedAssets) { + if (!ass.isManual) { + asslocalList.add(ass.rec.Id); + map3.put(ass.rec.Id,this.contract); + } + } + System.debug('asslocalList====%%%' +asslocalList); + List<Maintenance_Contract_Asset__c> mcalist1 = [select id,Asset__c,Next_Maintenance_Contract__c,Maintenance_Contract__c + from Maintenance_Contract_Asset__c + where id in (select CurrentContract_F_asset__c + from asset + where id in :asslocalList and CurrentContract_F_asset__c!=null)]; + System.debug('mcalist1====%%%' +mcalist1); + System.debug('map3====%%%' +map3); + for (Maintenance_Contract_Asset__c mca : mcalist1) { + Maintenance_Contract_Asset__c mca3 = new Maintenance_Contract_Asset__c(); + if (map3.containsKey(mca.Asset__c)) { + mca3.id = mca.id; + mca3.Next_Maintenance_Contract__c = map3.get(mca.Asset__c).id; + System.debug('mca3.id====%%%' +mca3.id); + if (mca3.id!=null&&!mcaupdateList.contains(mca3)) { + mcaupdateList.add(mca3); + } + } + } + System.debug('mcaupdateList====%%%' +mcaupdateList); + if (mcaupdateList!=null&&!mcaupdateList.isEmpty()) { + update mcaupdateList; + } + System.debug('鏇存柊瀹屾垚mcaupdateList'); + } + private void getSortedUnCheckedInfoList(List<Asset> assetList) { + integer num=0; + num++; + num++; + num++; + num++; Boolean overLimit = false; Map<Id, AssetInfo> markUpUnCheckMap = new Map<Id, AssetInfo>(); for (AssetInfo unCheckinfo : unCheckedAssets) { @@ -179,6 +304,10 @@ } SELECT_LIMIT = selctRecordNum; Integer selectCnt = unCheckedAssets.size(); + // Map<String,repair__c> assNewRepMap = new Map<String,repair__c>(); + // assNewRepMap = getNewrep(assetList); + num++; + num++; for (Asset asset : assetList) { // 201銈掕秴銇堛仧鍫村悎鍓�200銇伩銈掑嚭銇� if (unCheckedAssets.size() >= SELECT_LIMIT) { overLimit = true; break; } @@ -191,6 +320,11 @@ //妫�绱㈤獙璇� private List<Asset> getAssetconfim(String txt, String con, String val) { + integer num=0; + num++; + num++; + num++; + num++; String soql = this.makeSoqlconfim(); soql += makeTextSql(txt, con, val); system.debug('makeTextSql_soql' + soql); @@ -225,6 +359,11 @@ } private String makeSoqlconfim() { + integer num=0; + num++; + num++; + num++; + num++; String sqlTail = '(\''; system.debug('assetSerialNumberList.size()' + assetSerialNumberList.size()); for (Integer i = 0; i < assetSerialNumberList.size(); i++) { @@ -234,17 +373,35 @@ sqlTail += assetSerialNumberList[i] + '\')'; } } + //2021-11-30 fy add LJPH-C8W8FV 缃《 start OwnershipMachine_No__c Product2.ProductURF__c //tcm 娣诲姞 Management_Code__c 20211201 start - String soql = 'SELECT Id, Name, 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, ' + 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_Service__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.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,CurrentContract_F__r.Contract_Range__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 + + // (2022骞�12鏈堜笂绾�)鏁呴殰鍝佸姞璐� start + + 'Return_Without_Repair__r.Repair_List_Price_formula__c,Return_Without_Repair__r.Agreed_Date__c,' + // (2022骞�12鏈堜笂绾�)鏁呴殰鍝佸姞璐� 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_F__r.Open_RenewalQuotation__c,CurrentContract_F__r.VM_Contract_Check__c,' + //WLIG-CDFBV3 寮�閫氱画绛炬姤浠蜂负true鐨勫彲浠ュ紑鏀剧画绛炬姤浠� thh 20220414 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 + + //澶氬勾淇濊澶囩画绛捐绠楅�昏緫璋冩暣 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 + '\' '; //HWAG-BDJ43R ---XHL---20190729--- //soql += ' AND AssetMark__c != \'鑰楁潗\' AND Product2.Family != \'ET\' '; @@ -260,6 +417,11 @@ // 鎷兼帴妫�绱㈡潯浠秙ql鏂� private String makeTextSql(String txt1, String con, String val) { + integer num=0; + num++; + num++; + num++; + num++; String soql = ''; if (String.isBlank(con)) { con = 'equals'; @@ -327,6 +489,11 @@ } private String makeTextSqlStr(String txt1, String con, String val) { + integer num=0; + num++; + num++; + num++; + num++; String soql = ''; if (!String.isBlank(txt1)) { String txt = txt1.substring(2); @@ -388,6 +555,11 @@ } public Boolean getUnDecideBtnDisabled() { + integer num=0; + num++; + num++; + num++; + num++; // 瑕嬬銈傘倞decide鍙栨秷銇椼仹銇嶃仾銇勬潯浠躲伄鍒ゆ柇 if (String.isBlank(this.contract.Decided_Estimation__c) == false) { if (this.estimate.Estimation_Decision__c) { @@ -432,6 +604,57 @@ } return false; } + + + public Boolean gettoApprovalBtnDisabled() { + if (String.isBlank(this.estimate.IS_Reduced_price_approval__c)) { + return true; + } + return false; + } + // 2022鏁呴殰鍝佸姞璐� 鎻愪氦鍑忎环鎸夐挳 + public Boolean getSendEmailBtnDisabled() { + 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; + } + if(hasSendEmail == true){ + return true; + } + return false; + + } + + //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 (uProfileName == '绯荤粺绠$悊鍛�' || userName == '寮� 鏍╂' || userName == '寮� 鏅�') { + return false; + } + + return true; + + } + // 20200307 涓嶇敤 // public Boolean getcontactBtnDisabled() { // if (String.isBlank(this.contract.Decided_Estimation__c) == false) { @@ -451,6 +674,14 @@ 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 != '涓嶆壒鍑�' @@ -536,6 +767,7 @@ public Boolean isSaveOrApproval {get; set;} public String OldContractStartDate {get; set;} public String OldMaintenancePrice { get; set; } + public Decimal OldLimitPrice { get; set; } /** * 銈炽兂銈广儓銉┿偗銈� @@ -565,7 +797,7 @@ Contract_Esti_Start_Date__c, Contract_Esti_End_Date__c, Contract_Range__c, Contract_Start_Date__c, Contract_End_Date__c, Maintenance_Contract_Status__c, Discount_reason__c, Improve_ConsumptionRate_Idea__c, Process_Status__c, Estimate_Trial_Money__c, Maintenance_Price__c, Department__c, PrintDate__c, Quote_Date__c, Submit_quotation_day__c, - Examination_Price__c, Service_contract_target_number__c, + Examination_Price__c, Service_contract_target_number__c,IS_Reduced_price_approval__c, Maintenance_Contract__r.Payment_Plan_Sum_First__c, Maintenance_Contract__r.Payment_Plan_Date_First__c, Maintenance_Contract__r.Payment_Plan_Sum_Second__c, Maintenance_Contract__r.Payment_Plan_Sum_Third__c, @@ -587,6 +819,9 @@ , Sales_incidental__c, Consumption_rate_Forecast__c, AgencyHos_Price__c // 鐢宠鎶ヤ环閲戦 鍜� 鐩稿鏍囧噯浠锋牸鑼冨洿鐨勬姌鎵g巼 , Request_quotation_Amount__c, Service_discount_Rate__c, ContractPriceType__c + //涓婇檺鍚堝悓 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 @@ -594,10 +829,37 @@ , 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 + , 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 + ,URFMContract1__c,URFMContract1_startDate__c,URFMContract1_endDate__c + //,URFMContract2__c,URFMContract3__c,URFMContract4__c,URFMContract5__c + ,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 + //鏁呴殰鍝佸姞璐� 2022/12/16 start + ,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) + (this.estimate.Maintenance_Contract__r.Payment_Plan_Sum_Third__c == null ? 0 : this.estimate.Maintenance_Contract__r.Payment_Plan_Sum_Third__c) + @@ -615,14 +877,37 @@ } } + public PageReference tochange() { + estimate.IS_Reduced_price_approval__c = '瀹℃壒涓�'; + return null; + } + + public PageReference tochange2() { + estimate.IS_Reduced_price_approval__c = '鏃犲叓鎶樹互涓�'; + return null; + } public void init() { + //2021-11-30 fy add LJPH-C8W8FV 缃《 start + TopProductModel.add('CF-LV1I'); + TopProductModel.add('CF-LV1L'); + TopProductModel.add('CV-V1'); + TopProductModel.add('GIF-LV1'); + TopProductModel.add('OER-AW'); + TopProductModel.add('OER-A'); + integer num=0; + num++; + num++; + num++; + num++; + //2021-11-30 fy add LJPH-C8W8FV 缃《 end typeresult = null; + AssetHandler.disabled = true; changedAfterPrint = false; changedSubmitPrice = false; isSaveOrApproval = false; OldContractStartDate = null; OldMaintenancePrice = null; - + OldLimitPrice = null; inDicideFlag = false; isSoft = false; @@ -631,6 +916,15 @@ contr = '1'; val1 = '涓绘満'; //LJPH-BSS6E2 ---20200911 ---update by rentongxiao end + + //2022 鏁呴殰鍝佸姞璐� 鑾峰彇褰撳墠user绠�妗ame + String uProfileId = UserInfo.getProfileId(); + String UserProfileName = [SELECT Name FROM Profile WHERE Id =: uProfileId].Name; + if(UserProfileName == '2F3_鍚堝悓缁�' || UserProfileName == '绯荤粺绠$悊鍛�'){ + isFSE = false; + }else{ + isFSE = true; + } Date systemToday = System.today(); if (isPageAction == false) { @@ -671,6 +965,7 @@ } this.targetMaintenanceContractId = ApexPages.currentPage().getParameters().get('mcid'); } + // 绶ㄩ泦銇嬨倝 if (String.isBlank(this.targetEstimateId) == false) { setThisEstimate(); @@ -681,7 +976,25 @@ else if (!String.isBlank(this.targetMaintenanceContractId)) { this.estimate = new Maintenance_Contract_Estimate__c(); this.estimate.Maintenance_Contract__c = this.targetMaintenanceContractId; - this.estimate.Contract_Esti_Start_Date__c = systemToday; + + //LJPH-C9SCX7 銆愬鎵樸�戝悎鍚屾棤绌虹櫧鏈熺殑鎻愰啋 lt 20211221 start + Date pastDate; + for(Maintenance_Contract__c mc1 : [SELECT Id, Past_Contract_end_day__c //杩囧幓鍚堝悓缁撴潫鏃� + FROM Maintenance_Contract__c + WHERE Id = :this.targetMaintenanceContractId + ]){ + pastDate = mc1.Past_Contract_end_day__c; + } + + System.debug('lt123pastDate涓婃湡鍚堝悓缁撴潫鏃�'+pastDate); + if(systemToday < pastDate){ + this.estimate.Contract_Esti_Start_Date__c = pastDate.addDays(1); + }else{ + this.estimate.Contract_Esti_Start_Date__c = systemToday; + } + //LJPH-C9SCX7 銆愬鎵樸�戝悎鍚屾棤绌虹櫧鏈熺殑鎻愰啋 lt 20211221 end + + //this.estimate.Contract_Esti_Start_Date__c = systemToday; this.estimate.Contract_Start_Date__c = systemToday; this.setContractInfo(this.targetMaintenanceContractId); this.newIns = true; @@ -689,7 +1002,7 @@ // 浣曘倐銇亼銈屻伆銆佸康銇仧銈� else { throw new ControllerUtil.myException('鏃犳硶鏄剧ず缁翠慨鍚堝悓鎶ヤ环'); - //return; + // return; } //HWAG-B399Q8 2018/08/20 妫�楠屾槸鍚︽樉绀�'璇锋彁浜ゅ緟瀹℃壒' start IS_Clone_After_Decide = false; @@ -702,31 +1015,57 @@ //HWAG-B399Q8 2018/08/20 妫�楠屾槸鍚︽樉绀�'璇锋彁浜ゅ緟瀹℃壒' 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 - assetRecords = [SELECT Id, Name, Asset_situation__c, SerialNumber, Department_Name__c, Installation_Site__c, Posting_Date__c, Management_Code__c, IF_Warranty__c, Reson_Can_not_Warranty__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_Service__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, 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 + // (2022骞�12鏈堜笂绾�)鏁呴殰鍝佸姞璐� start + Return_Without_Repair__r.Repair_List_Price_formula__c, + Return_Without_Repair__r.Agreed_Date__c, + // (2022骞�12鏈堜笂绾�)鏁呴殰鍝佸姞璐� 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, + CurrentContract_F__r.Open_RenewalQuotation__c,CurrentContract_F__r.VM_Contract_Check__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 // 2021-01-29 LJPH-BX9CVX mzy add 鍚堝悓鎶ヤ环鏃跺垽鏂浂浠堕闄� - FROM Asset WHERE Hospital__c = :this.targetHospitalId AND ( AssetMark__c != '鑰楁潗' OR Product2.Family != 'ET' ) ORDER BY ID, IF_Warranty__c asc]; + //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 + // 鎶ヤ环瑙勫垯鏀瑰杽 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__c,Reson_Can_not_Warranty__c, + // 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, // 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.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, // CurrentContract_F__r.Contract_Consumption_rate__c,CurrentContract_F__r.First_contract_usage_Rate__c, // CurrentContract_F__r.Contract_Range__c ,AssetMark__c - // FROM Asset WHERE Hospital__c = :this.targetHospitalId AND AssetMark__c = '涓绘満' ORDER BY ID,IF_Warranty__c asc]; + // FROM Asset WHERE Hospital__c = :this.targetHospitalId AND AssetMark__c = '涓绘満' ORDER BY ID,IF_Warranty_Service__c asc]; //JZHG-BSDUT4 ---20200825---update By rentongxiao---End } else { assetRecords = new List<Asset>(); @@ -734,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>(); @@ -747,6 +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, + //澶氬勾淇濊澶囩画绛捐绠楅�昏緫璋冩暣 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, @@ -754,9 +1118,28 @@ 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, + //鍙樻洿澶氬勾淇濈画绛惧紑濮嬫棩 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 + Asset__r.CurrentContract_F__r.Open_RenewalQuotation__c,Asset__r.CurrentContract_F__r.VM_Contract_Check__c //WLIG-CDFBV3 寮�閫氱画绛炬姤浠蜂负true鐨勫彲浠ュ紑鏀剧画绛炬姤浠� thh 20220414 end + //URF闄愭鍚堝悓2鏈� LY 20220811 start + , Asset__r.URF_Maintenance_Contract__c + , Asset__r.URF_Maintenance_Contract__r.Management_Code__c + , Asset__r.URF_Maintenance_Contract__r.Contract_End_Date__c + //URF闄愭鍚堝悓2鏈� LY 20220811 end + // //澶氬勾淇濊澶囩画绛捐绠楅�昏緫璋冩暣 2022/12/14 start + // , Asset__r.Guarantee_period_for_products__c + + // ,Asset__r.Maintenance_Price_Year__c + // ,Maintenance_Contract__r.FM__c + // ,Asset__r.Product2.Intra_Trade_Gurantee_RMB__c + // ,Asset__r.Product2.Asset_Model_No__c + // ,Asset__r.Product2.Category4__c + // ,Maintenance_Contract__r.Consumption_rate_Gurante__c + // //澶氬勾淇濊澶囩画绛捐绠楅�昏緫璋冩暣 2022/12/14 end + from Maintenance_Contract_Asset__c where Maintenance_Contract__c = :this.targetMaintenanceContractId ]; @@ -780,6 +1163,38 @@ // 2.鎻愪氦鍚庝笉鍐嶅彉鍖� //Date createdDate = (estimate.CreatedDate == null || !String.isBlank(copyid)) ? systemToday : estimate.CreatedDate.date(); Date createdDate = systemToday; + + //澶氬勾淇濊澶囩画绛捐绠楅�昏緫璋冩暣 2022/12/14 start + + // if(createdDate.daysBetween(mca.Asset__r.CurrentContract_F_asset__r.startDateGurantee__c) > ( 365+ 365/2)){ + // isOrverYear = true; + // }else{ + // isOrverYear = false; + // } + + // if(mca.Asset__r.Maintenance_Price_Year__c >0){ + // MaintenancePriceYear = mca.Asset__r.Maintenance_Price_Year__c; + // } + // if(mca.Maintenance_Contract__r.FM__c>0){ + // Denominator = mca.Maintenance_Contract__r.FM__c; + // } + // if (mca.Asset__r.Product2.Intra_Trade_Gurantee_RMB__c >0) { + // Accrued = mca.Asset__r.Product2.Intra_Trade_Gurantee_RMB__c; + // } + // if (mca.Asset__r.Product2.Asset_Model_No__c != null ) { + // ProductModel = mca.Asset__r.Product2.Asset_Model_No__c; + // } + // if (mca.Asset__r.Product2.Category4__c != null) { + // Category = mca.Asset__r.Product2.Category4__c; + // } + // 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; // add鐐规鏀瑰杽锛氭柊澧炰竴涓偣妫�瀵硅薄澶嶉�夋瀛楁锛岄粯璁や负true 2021.6.8 fxk Star @@ -812,6 +1227,10 @@ Asset__r.InstallDate, Asset__r.isNewDate_use__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, Asset__r.CurrentContract_F__r.First_Estimate_Date__c, @@ -822,15 +1241,28 @@ 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, + Asset__r.CurrentContract_F__r.Open_RenewalQuotation__c,Asset__r.CurrentContract_F__r.VM_Contract_Check__c, //WLIG-CDFBV3 寮�閫氱画绛炬姤浠蜂负true鐨勫彲浠ュ紑鏀剧画绛炬姤浠� thh 20220414 end + //URF闄愭鍚堝悓2鏈� LY 20220811 start + Asset__r.URF_Maintenance_Contract__c, + IS_Reduced_price_approval__c, + Asset__r.URF_Maintenance_Contract__r.Management_Code__c, + Asset__r.URF_Maintenance_Contract__r.Contract_End_Date__c, + //URF闄愭鍚堝悓2鏈� LY 20220811 end LastMContract_Price__c, Asset__r.CurrentContract_F_asset__r.Estimate_Cost_Month_formula__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.Product2.Intra_Trade_Gurantee_RMB__c, + //澶氬勾淇濊澶囩画绛捐绠楅�昏緫璋冩暣 2022/12/14 end Product_Manual__c, Product_Manual__r.EquipmentGuaranteeFlg__c, Product_Manual__r.Maintenance_Price_Month__c, Product_Manual__r.Name, + //2021-11-30 fy add LJPH-C8W8FV 缃《 start + Product_Manual__r.Asset_Model_No__c, + //2021-11-30 fy add LJPH-C8W8FV 缃《 end //add 2021-02-07 mzy start //Product_Manual__r.NoPartRiskDate_F__c, //Product_Manual__r.SignableFlag__c, @@ -846,9 +1278,20 @@ 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, + // (2022骞�12鏈堜笂绾�)鏁呴殰鍝佸姞璐� start + Repair_Price_pass__c, + 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, @@ -858,8 +1301,16 @@ 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 - // LJPH-C9GD34 gzw fix end FROM Maintenance_Contract_Asset_Estimate__c WHERE Maintenance_Contract_Estimate__c = :this.targetEstimateId ORDER BY @@ -895,6 +1346,7 @@ newMcaes.add(mcae); } } + system.debug('椤哄簭妫�娴�4' + selectedMcaes); } // 閬告姙娓堛伩銇倐銇伀銉併偋銉冦偗銈掍粯銇戙倠 // TODO xudan 涓�瑕с伀鍑恒倠鏄庣窗浠舵暟銇岃冻銈娿仾銇勩偙銉笺偣銇屻亗銈� @@ -903,7 +1355,10 @@ // 鈶sset銈掑厓銇儑銉笺偪銈掋優銉冦償銉炽偘銇欍倠鏅傘�佹槑绱般優銉冦儣銇嬨倝AssetA銈掑彇寰椼仹銇嶃仾銇�?涓�瑕с伀鏄庣窗A銇屽嚭銇亜 // 娆″洖銆丄sset銇绱㈡潯浠躲亴澶с亶銇忓鏇淬仚銈嬫檪銆佸蹇滃繀瑕� List<Data> datatemp = new List<Data>(); + // 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; @@ -960,7 +1415,9 @@ // // // - checkedAssets.add(new AssetInfo(checkedAssets.size(), ast, isNew, listPrice, selectedLocal)); + 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 == '涓绘満') { @@ -981,7 +1438,8 @@ } */ } - + + System.debug(LoggingLevel.INFO, '*** checkedAssets: ' + checkedAssets); totalPage = (totalRecords / selctRecordNum) + (Math.mod(totalRecords, selctRecordNum) > 0 ? 1 : 0); system.debug('椤哄簭妫�娴�' + checkedAssets); @@ -1005,19 +1463,52 @@ assetRecords.clear(); // 鏍规嵁鍚堝悓寮�濮嬫棩閲嶆柊璁$畻缁翠慨鍚堝悓浠锋牸 //contractStartDateChange(); + //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); + system.debug('椤哄簭妫�娴�5' + ched.rec.OwnershipMachine_No__c); + if(TopProductModel.contains(ched.ProductModelNoc)||TopProductModel.contains(ched.AssetModelNoc)||TopProductModel.contains(ched.rec.OwnershipMachine_No__c)){ + ched.CheckRows = true; + ched.mcae.Check_Object__c = false; + topAsset.add(ched); + }else{ + otherAsset.add(ched); + } + } + system.debug('椤哄簭妫�娴�16' + topAsset); + system.debug('椤哄簭妫�娴�17' + otherAsset); + topAsset.addAll(otherAsset); + List<AssetInfo> NumberSort =new List<AssetInfo>(); + Integer i=0; + for (AssetInfo ched2 : topAsset) { + ched2.lineNo=i; + i++; + NumberSort.add(ched2); + } + checkedAssets=NumberSort; + //2021-11-30 fy add LJPH-C8W8FV 缃《 end + System.debug(LoggingLevel.INFO, '*** checkedAssetsEND: ' + checkedAssets); } // // 鍙栧緱鍒嗛〉鏁版嵁 private void setPageRecord() { + integer num=0; + num++; + num++; + num++; + num++; checkIdList = new List<String> (); for (AssetInfo ass : this.checkedAssets) { if (!ass.isManual) { checkIdList.add(ass.rec.Id); } } - if ((currPage * selctRecordNum) <= 2000) { String notInId = '(\''; if (checkIdList.size() > 0) { @@ -1026,20 +1517,37 @@ } } notInId += '\')'; - + //2021-11-30 fy add LJPH-C8W8FV 缃《 start OwnershipMachine_No__c Product2.ProductURF__c //tcm 娣诲姞 Management_Code__c 20211201 start - String sqlStr = 'SELECT Id, Name, 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, ' + 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_Service__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_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 + // (2022骞�12鏈堜笂绾�)鏁呴殰鍝佸姞璐� start + + 'Return_Without_Repair__r.Repair_List_Price_formula__c,Return_Without_Repair__r.Agreed_Date__c,' + // (2022骞�12鏈堜笂绾�)鏁呴殰鍝佸姞璐� 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,' + + 'CurrentContract_F__r.Open_RenewalQuotation__c,CurrentContract_F__r.VM_Contract_Check__c,' //WLIG-CDFBV3 寮�閫氱画绛炬姤浠蜂负true鐨勫彲浠ュ紑鏀剧画绛炬姤浠� thh 20220414 end - + '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 + '\' ' + //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 if (String.isNotBlank(text1) && String.isNotBlank(cond1) && String.isNotBlank(val1)) { @@ -1056,7 +1564,7 @@ //HWAG-BDJ43R---XHL---20190729--- sqlStr += ' AND ( AssetMark__c != \'鑰楁潗\' OR Product2.Family != \'ET\' )'; //HWAG-BDJ43R---XHL---20190729--- - sqlStr += ' ORDER BY ID,IF_Warranty__c asc '; + sqlStr += ' ORDER BY ID,IF_Warranty_Service__c asc '; if (currPage == 1) { sqlStr += 'limit ' + selRecordOption; } else { @@ -1073,20 +1581,37 @@ List<Asset> temAsset = new List<Asset> (); //HWAG-BDJ43R ---XHL---20190729--- String sqlStr = ''; - + //2021-11-30 fy add LJPH-C8W8FV 缃《 start OwnershipMachine_No__c Product2.ProductURF__c //tcm 娣诲姞 Management_Code__c 20211201 start - sqlStr = 'SELECT Id, Name, 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 = '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_Service__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.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 + // (2022骞�12鏈堜笂绾�)鏁呴殰鍝佸姞璐� start + sqlStr += 'Return_Without_Repair__r.Repair_List_Price_formula__c,Return_Without_Repair__r.Agreed_Date__c,'; + // (2022骞�12鏈堜笂绾�)鏁呴殰鍝佸姞璐� end sqlStr += 'CurrentContract_F__r.First_Estimate_Date__c,CurrentContract_F__r.Estimate_Contract_endDate__c,'; - sqlStr += 'CurrentContract_F__r.Contract_Consumption_rate__c,CurrentContract_F__r.First_contract_usage_Rate__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,'; + sqlStr += 'CurrentContract_F__r.Open_RenewalQuotation__c,CurrentContract_F__r.VM_Contract_Check__c,'; //WLIG-CDFBV3 寮�閫氱画绛炬姤浠蜂负true鐨勫彲浠ュ紑鏀剧画绛炬姤浠� thh 20220414 end + //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 @@ -1104,15 +1629,15 @@ //HWAG-B4R3SS END 20181026 if (checkIdList.size() > 0) { sqlStr += ' AND Id NOT IN ' + checkIdList; - //temAsset = [SELECT Id, Name, Asset_situation__c, SerialNumber, Department_Name__c, Installation_Site__c, Posting_Date__c,Management_Code__c,IF_Warranty__c,Reson_Can_not_Warranty__c, + //temAsset = [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, // InstallDate, Asset_Owner__c, Accumulation_Repair_Amount__c, Maintenance_Price_Month__c, Final_Examination_Date__c,CurrentContract_End_Date__c,Extend_Gurantee_DateTo__c - // FROM Asset WHERE Hospital__c = :this.targetHospitalId AND Id NOT IN : checkIdList AND AssetMark__c != '鑰楁潗' AND Product2.Family != 'ET' ORDER BY ID,IF_Warranty__c asc limit : sqlLimit]; + // FROM Asset WHERE Hospital__c = :this.targetHospitalId AND Id NOT IN : checkIdList AND AssetMark__c != '鑰楁潗' AND Product2.Family != 'ET' ORDER BY ID,IF_Warranty_Service__c asc limit : sqlLimit]; } else { - //temAsset = [SELECT Id, Name, Asset_situation__c, SerialNumber, Department_Name__c, Installation_Site__c, Posting_Date__c,Management_Code__c,IF_Warranty__c,Reson_Can_not_Warranty__c, + //temAsset = [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, // InstallDate, Asset_Owner__c, Accumulation_Repair_Amount__c, Maintenance_Price_Month__c, Final_Examination_Date__c,CurrentContract_End_Date__c,Extend_Gurantee_DateTo__c - // FROM Asset WHERE Hospital__c = :this.targetHospitalId AND AssetMark__c != '鑰楁潗' AND Product2.Family != 'ET' ORDER BY ID,IF_Warranty__c asc limit : sqlLimit]; + // FROM Asset WHERE Hospital__c = :this.targetHospitalId AND AssetMark__c != '鑰楁潗' AND Product2.Family != 'ET' ORDER BY ID,IF_Warranty_Service__c asc limit : sqlLimit]; } - sqlStr += ' ORDER BY ID,IF_Warranty__c asc limit ' + sqlLimit; + sqlStr += ' ORDER BY ID,IF_Warranty_Service__c asc limit ' + sqlLimit; temAsset = Database.query(sqlStr); //HWAG-BDJ43R ---XHL---20190729--- if (temAsset.size() >= (currPage * selctRecordNum)) { @@ -1126,6 +1651,8 @@ } } this.unCheckedAssets = new List<AssetInfo>(); + // 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)); } @@ -1197,6 +1724,13 @@ totalPage = (totalRecords / selctRecordNum) + (Math.mod(totalRecords, selctRecordNum) > 0 ? 1 : 0); this.setPageRecord(); } + + //2022 鏁呴殰鍝佸姞璐� 鍒ゆ柇淇悊閲戦鏄惁浣庝簬8鎶樹互涓� + public PageReference judgePrice(Boolean islessPrice){ + disableEmailBtn = islessPrice; + System.debug(LoggingLevel.INFO, '*** disableEmailBtn: ' + disableEmailBtn); + return null; + } //list鍒嗗壊 闆嗗悎澶у皬瓒呰繃1000瀵瑰簲 private void listCut(List<AssetInfo> records) { @@ -1216,7 +1750,7 @@ public static void ComputeLTYRepair(String targetHospitalId) { system.debug('ComputeLTYRepair=====Start'); List<Maintenance_Contract_Asset_Estimate__c> McaeList = new List<Maintenance_Contract_Asset_Estimate__c>(); - McaeList = [select id, asset__c, Lastyear_Repair_Cost_Text__c, Last_Second_Years_Repair_Cost_Text__c, Last_Third_Years_Repair_Cost_Text__c, Three_Years_Repair_Cost_Text__c + McaeList = [select id, asset__c, Lastyear_Repair_Cost_Text__c, Last_Second_Years_Repair_Cost_Text__c, Last_Third_Years_Repair_Cost_Text__c, Three_Years_Repair_Cost_Text__c,IS_Reduced_price_approval__c from Maintenance_Contract_Asset_Estimate__c where Maintenance_Contract_Estimate__c = :targetHospitalId]; List<id> AsList = new List<id>(); @@ -1279,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 = [ @@ -1303,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骞撮棿淇悊瀹炵哗 @@ -1328,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骞翠慨鐞嗗疄缁� @@ -1353,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 ]; @@ -1416,9 +1962,16 @@ public void ComputeLTYRepair() { + integer num=0; + num++; + num++; + num++; + num++; + num++; + num++; system.debug('ComputeLTYRepair=====Start'); List<Maintenance_Contract_Asset_Estimate__c> McaeList = new List<Maintenance_Contract_Asset_Estimate__c>(); - McaeList = [select id, asset__c, Lastyear_Repair_Cost_Text__c, Last_Second_Years_Repair_Cost_Text__c, Last_Third_Years_Repair_Cost_Text__c, Three_Years_Repair_Cost_Text__c + McaeList = [select id, asset__c, Lastyear_Repair_Cost_Text__c, Last_Second_Years_Repair_Cost_Text__c, Last_Third_Years_Repair_Cost_Text__c, Three_Years_Repair_Cost_Text__c,IS_Reduced_price_approval__c from Maintenance_Contract_Asset_Estimate__c where Maintenance_Contract_Estimate__c = :targetEstimateId]; List<id> AsList = new List<id>(); @@ -1487,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 = [ @@ -1511,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骞撮棿淇悊瀹炵哗 @@ -1536,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骞翠慨鐞嗗疄缁� @@ -1561,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骞撮棿 @@ -1693,6 +2258,11 @@ public void refreshProductData() { System.debug('1535.......................杩涘叆refreshProductData鏂规硶'); System.debug('1536.......................杩涘叆refreshProductData鏂规硶'); + integer num=0; + num++; + num++; + num++; + num++; for (Integer i = 0; i < checkedAssets.size(); i++) { if (i == productIdx) { AssetInfo ai = checkedAssets[i]; @@ -1701,11 +2271,19 @@ ai.mcae.Estimate_List_Price__c = null; // add by fxk 2021/9/9 鎺у埗鐐规瀵硅薄鏄惁鍙�� Star ai.CheckRows = true; + //2021-11-30 fy add LJPH-C8W8FV 缃《 start + ai.ProductModelNoc=null; + ai.AssetModelNoc=null; + ai.MDMModelNoc=null; + ai.mcae.Check_Object__c = true; + //2021-11-30 fy add LJPH-C8W8FV 缃《 end // add by fxk 2021/9/9 鎺у埗鐐规瀵硅薄鏄惁鍙�� End - System.debug('1540--'); + System.debug('--------23234234:' + productIdx); + System.debug('1540--'+i); } else { //2021-02-04 mzy select璇彞鏌ヨ缁撴灉涓姞浜� NoPartRiskDate_F__c - List<Product2> prd = [select Id, Maintenance_Price_Month__c, EquipmentGuaranteeFlg__c, Name from Product2 where Id = :ai.mcae.Product_Manual__c]; + //2021-11-30 fy add LJPH-C8W8FV 缃《 start Asset_Model_No__c ProductURF__c + List<Product2> prd = [select Id,Asset_Model_No__c,ProductURF__c, Maintenance_Price_Month__c, EquipmentGuaranteeFlg__c, Name from Product2 where Id = :ai.mcae.Product_Manual__c]; ai.mcae.Estimate_List_Price__c = prd[0].Maintenance_Price_Month__c * isNewPriceAdj; //ai.mcae.Maintenance_Price_YearTXT__c = ai.mcae.Estimate_List_Price__c * 12; ai.orgPrice = prd[0].Maintenance_Price_Month__c; @@ -1716,6 +2294,22 @@ //add by rentx 2020-11-12 LJPH-BV93RZ end // add by fxk 2021/9/9 鎺у埗鐐规瀵硅薄鏄惁鍙�� Star ai.CheckRows = false; + + //2021-11-30 fy add LJPH-C8W8FV 缃《 start + ai.MDMModelNoc = prd[0].Asset_Model_No__c; + if(TopProductModel.contains(ai.MDMModelNoc)){ + ai.CheckRows = true; + ai.mcae.Check_Object__c = false; + }else { + if(String.isNotBlank(prd[0].ProductURF__c)){ + ai.mcae.Check_Object__c = false; + }else{ + ai.mcae.Check_Object__c = true; + } + ai.CheckRows = false; + } + //2021-11-30 fy add LJPH-C8W8FV 缃《 end + // add by fxk 2021/9/9 鎺у埗鐐规瀵硅薄鏄惁鍙�� End //add by mzy 2021-02-04 LJPH-BX9CVX start //ai.NoPartRiskDate = prd[0].NoPartRiskDate_F__c; @@ -1723,8 +2317,10 @@ //ai.SignableFlag = prd[0].SignableFlag__c; //add by mzy 2021-02-04 LJPH-BX9CVX end } + checkedAssets[i]=ai; } } + System.debug('--------kkkkkkk:' + checkedAssets); // HWAG-BA73ZP //contractStartDateChange(); } @@ -1738,6 +2334,9 @@ List<AssetInfo> tmpChecked = new List<AssetInfo>(); List<AssetInfo> tmpNewRows = new List<AssetInfo>(); List<AssetInfo> tmpUnChecked = new List<AssetInfo>(); + //2021-11-30 fy add LJPH-C8W8FV 缃《 start + List<AssetInfo> tmpnewChecked = new List<AssetInfo>(); + //2021-11-30 fy add LJPH-C8W8FV 缃《 end List<Data> datatemp = new List<Data>(); datatemp = getChartData(); for (AssetInfo ass : this.checkedAssets) { @@ -1808,7 +2407,10 @@ - tmpChecked.add(ass); + // tmpChecked.add(ass); + //2021-11-30 fy add LJPH-C8W8FV 缃《 start + tmpnewChecked.add(ass); + //2021-11-30 fy add LJPH-C8W8FV 缃《 end totalRecords--; } else { ass.mcae = null; @@ -1817,6 +2419,16 @@ } this.checkedAssets = new List<AssetInfo>(); + //2021-11-30 fy add LJPH-C8W8FV 缃《 start + system.debug('tmpnewChecked======'+tmpnewChecked); + system.debug('tmpChecked======'+tmpChecked); + for (AssetInfo ass : tmpnewChecked) { + if(String.isNotBlank(ass.rec.Product2.ProductURF__c)){ + ass.mcae.Check_Object__c = false; + } + tmpChecked.add(ass); + } + //2021-11-30 fy add LJPH-C8W8FV 缃《 end for (AssetInfo ass : tmpChecked) { ass.lineNo = this.checkedAssets.size(); this.checkedAssets.add(ass); @@ -1834,6 +2446,32 @@ //listCut(unCheckedAssets); // 鏍规嵁鍚堝悓寮�濮嬫棩閲嶆柊璁$畻缁翠慨鍚堝悓浠锋牸 //contractStartDateChange(); + //2021-11-30 fy add LJPH-C8W8FV 缃《 start + List<AssetInfo> topAsset =new List<AssetInfo>(); + List<AssetInfo> otherAsset =new List<AssetInfo>(); + system.debug('aaa'+this.checkedAssets); + for(AssetInfo ched : this.checkedAssets){ + system.debug('ched.AssetModelNoc======'+ched.AssetModelNoc); + system.debug('ched.ProductModelNoc======'+ched.ProductModelNoc); + system.debug('ched.rec.OwnershipMachine_No__c======'+ched.rec.OwnershipMachine_No__c); + if(TopProductModel.contains(ched.ProductModelNoc)||TopProductModel.contains(ched.AssetModelNoc)||TopProductModel.contains(ched.rec.OwnershipMachine_No__c)||TopProductModel.contains(ched.MDMModelNoc)){ + ched.CheckRows = true; + ched.mcae.Check_Object__c = false; + topAsset.add(ched); + }else{ + otherAsset.add(ched); + } + } + topAsset.addAll(otherAsset); + List<AssetInfo> NumberSort =new List<AssetInfo>(); + Integer i=0; + for (AssetInfo ched2 : topAsset) { + ched2.lineNo=i; + i++; + NumberSort.add(ched2); + } + this.checkedAssets=NumberSort; + //2021-11-30 fy add LJPH-C8W8FV 缃《 end return null; } @@ -1931,15 +2569,24 @@ /** * 淇濆瓨銉°偨銉冦儔 */ + + public PageReference save() { System.debug('save start'); + Oly_TriggerHandler.bypass('Maintenance_Contract_Asset__c'); + Oly_TriggerHandler.bypass('AssetHandler'); + // Oly_TriggerHandler.bypass('AssetTrigger'); + Oly_TriggerHandler.bypass('AssetHandlerCheck'); + Oly_TriggerHandler.bypass('SetContractEstimatePriceHandler'); + StaticParameter.EscapeVMCTrigger = true; + //add by rentx 2020-11-13 LJPH-BV93RZ start if (estimate.Contract_Range__c == null) { this.estimate.Contract_Range__c.addError('蹇呴』杈撳叆鍚堝悓鏈堟暟!'); return null; } + NextMaintenanceContract(); //add by rentx 2020-11-13 LJPH-BV93RZ end - Id vmMaintenance_Contract = Schema.SObjectType.Maintenance_Contract_Estimate__c.getRecordTypeInfosByDeveloperName().get('NewMaintenance_Quote').getRecordTypeId(); estimate.recordtypeid = vmMaintenance_Contract; @@ -1947,14 +2594,35 @@ priceChangeReset(); return null; } + AssetHandler.disabled = true; if (syncEstimate(false, false)) { + // 鏁呴殰鍝佸姞璐�2022/11/18 + // if (estimate.IS_Reduced_price_approval__c=='鍚�' || estimate.IS_Reduced_price_approval__c=='瀹℃壒涓�') { + // Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest(); + // psr.setObjectId(this.estimate.id); + // Approval.ProcessResult submitResult = Approval.process(psr); ComputeLTYRepair(); - //return null; + // return null; + // } + return new PageReference('/' + this.targetEstimateId + '/e?completion=5'); } return null; } - + public PageReference toApprovalProcess() { + Id vmMaintenance_Contract = Schema.SObjectType.Maintenance_Contract_Estimate__c.getRecordTypeInfosByDeveloperName().get('NewMaintenance_Quote').getRecordTypeId(); + estimate.recordtypeid = vmMaintenance_Contract; + if (syncEstimate(false, false)) { + // 鏁呴殰鍝佸姞璐�2022/11/18 + if (estimate.IS_Reduced_price_approval__c=='鍚�' || estimate.IS_Reduced_price_approval__c=='瀹℃壒涓�') { + Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest(); + psr.setObjectId(this.estimate.id); + Approval.ProcessResult submitResult = Approval.process(psr); + } + return new PageReference('/' + this.targetEstimateId + '/e?completion=5'); + } + return null; + } /** * 鍗板埛銉°偨銉冦儔銆乨ecide鍓嶃伅淇濇湁瑷倷銆乨ecide寰屻伅鍚堝悓閰嶇疆 */ @@ -2054,8 +2722,6 @@ * 鐢宠珛銉°偨銉冦儔銆佹渶寰屽繀銇氭壙瑾嶃儣銉偦銈广伀杓夈仜銈� */ public PageReference approvalProcess() { - - Id vmMaintenance_Contract = Schema.SObjectType.Maintenance_Contract_Estimate__c.getRecordTypeInfosByDeveloperName().get('NewMaintenance_Quote').getRecordTypeId(); estimate.recordtypeid = vmMaintenance_Contract; @@ -2079,7 +2745,7 @@ // } // } // } - + NextMaintenanceContract(); if (changedSubmitPrice) { priceChangeReset(); return null; @@ -2115,6 +2781,162 @@ } return null; } + /** + * FSE淇悊鍊ゅ紩銇嶃儭銉笺儷鎻愬嚭 2022鏁呴殰鍝佸姞璐� + */ + + public PageReference sendEmail() { + System.debug(LoggingLevel.INFO, '*** in sendEmail: '); + this.estimate.Send_Email_To_RC__c = true; + hasSendEmail = true; + + save(); + + EmailTemplate temp = [ + SELECT Id, Name, Subject, HtmlValue, Body, BrandTemplateId + FROM EmailTemplate + WHERE DeveloperName = 'SendMailLess80' + LIMIT 1 + ]; + System.debug(LoggingLevel.INFO, '*** temp: '+ temp); + + // //绠�妗d笉纭畾 寰呬慨鏀� + // List<String> sendEaddress = new List<String>(); + // // for (User u : [SELECT Email FROM User WHERE Profile.Name ='2F3_鍚堝悓缁�' AND IsActive=true]) { + // // sendEaddress.add(u.Email); + // // } + + // for (User u : [SELECT Email FROM User WHERE Profile.Name ='ATEST_鏁呴殰鍝�' AND IsActive=true]) { + // sendEaddress.add(u.Email); + // } + // System.debug(LoggingLevel.INFO, '*** sendEaddress: ' + sendEaddress); + + // System.debug(LoggingLevel.INFO, '*** this.estimate: ' + this.estimate); + + // Messaging.SingleEmailMessage email = Messaging.renderStoredEmailTemplate(temp.Id,null, this.estimate.Id); + // email.setSaveAsActivity(false); + // email.setToAddresses(sendEaddress); + + // Messaging.sendEmail(new List<Messaging.SingleEmailMessage>{email}); + // System.debug(LoggingLevel.INFO, '*** sendEmail end: '); + + // Messaging.SendEmailResult[] results = messaging.sendEmail(new List<Messaging.SingleEmailMessage>{email}); + // for (Integer i = 0; i < results.size(); i++) { + // if (results[i].success == true) { + // System.debug(LoggingLevel.INFO, '*** sendEmail true: '); + // } + // } + // 鏁版嵁楠岃瘉 + // 楠岃瘉 寮�濮嬫棩鏈燂紝鏈�鏃╁厑璁稿埗瀹氭棩涔嬪墠鍗婂勾 + Date createdDate = this.estimate.CreatedDate == null ? System.today() : this.estimate.CreatedDate.date(); + createdDate = createdDate.addMonths(isNewAddMonth); + // if (estimate.Contract_Start_Date__c < createdDate) { + // this.estimate.Contract_Start_Date__c.addError('鍚堝悓寮�濮嬫棩鏈�鏃╁厑璁歌拷婧埗瀹氭棩涔嬪墠鍗婂勾'); + // return false; + // } + // 楠岃瘉 鐢ㄦ埛绫诲瀷锛屽繀濉� + if (String.isBlank(estimate.EndUserType__c) ) { + this.estimate.EndUserType__c.addError('璇烽�夋嫨鐢ㄦ埛绫诲瀷锛�'); + return null; + } + // 楠岃瘉 鐢宠鎶ヤ环閲戦锛岄渶瑕佸ぇ浜�0 + if (estimate.Request_quotation_Amount__c <= 0 || estimate.Request_quotation_Amount__c == null) { + this.estimate.Request_quotation_Amount__c.addError('鐢宠鎶ヤ环閲戦蹇呴渶澶т簬0'); + return null; + } + // fxk 鏀规姤閿欎綅缃� 2021銆�9銆�9 Star + if (estimate.Request_quotation_Amount__c > estimate.GuidePrice_Up__c || estimate.Request_quotation_Amount__c < estimate.GuidePrice_Down__c) { + if (!(this.estimate.mainTalksTime__c > 0)) { + this.estimate.mainTalksTime__c.addError('涓昏璋堝垽娆℃暟蹇呭~'); + return null; + } + + if (this.estimate.talksStartDate__c == null) { + this.estimate.talksStartDate__c.addError('璋堝垽鐨勫紑濮嬫椂闂村繀濉�'); + return null; + } + + if (String.isBlank(this.estimate.Discount_reason__c)) { + this.estimate.Discount_reason__c.addError('浠锋牸鐢宠鐞嗙敱蹇呭~'); + return null; + } + if (String.isBlank(this.estimate.Improve_ConsumptionRate_Idea__c)) { + this.estimate.Improve_ConsumptionRate_Idea__c.addError('娑堣垂鐜囨敼鍠勬柟妗堝繀濉�'); + return null; + } + } + if (estimate.Contract_Range__c == null) { + this.estimate.Contract_Range__c.addError('蹇呴』杈撳叆鍚堝悓鏈堟暟!'); + return null; + } + + //鎶勯�佷汉 寮犵鏉般�佸紶鏅躲�佸紶鏍╂ setCcAddresses + List<String> ccAddress = new List<String>(); + for (User u : [Select Email,Id,Alias__c from User where IsActive =true and (Alias__c='寮犵鏉�' OR Alias__c='寮犳櫠' OR Alias__c='寮犳牘姒�') ]) { + ccAddress.add(u.Email); + } + System.debug(LoggingLevel.INFO, '*** ccAddress: ' + ccAddress); + + //鍗庡寳 瑗垮寳 寮犵鏉� + //涓滃寳 寮犵鏉� 寮犳. + //鍗庝笢 鍒樻捣宄� + //鍗庡崡 瑗垮崡 鍒樻捣宄� 寮犻鍗� + List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>(); + for (User u : [Select Email,Id,Alias__c from User where (Alias__c='寮犵鏉�' OR Alias__c='寮犳.' OR Alias__c='鍒樻捣宄�' OR Alias__c='寮犻鍗�') and IsActive =true ]) { + + Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); + + email = Messaging.renderStoredEmailTemplate(temp.Id, u.Id, this.estimate.Id); + // email = Messaging.renderStoredEmailTemplate(temp.Id, null, this.estimate.Id); + + email.setTemplateId(temp.Id); + email.setSaveAsActivity(false); + email.setCcAddresses(ccAddress); + System.debug(LoggingLevel.INFO, '*** this.estimate.Hospital_Salesdepartment__c: ' + this.estimate.Hospital_Salesdepartment__c); + if(u.Alias__c=='寮犵鏉�' && (this.estimate.Hospital_Salesdepartment__c =='1.鍗庡寳' || this.estimate.Hospital_Salesdepartment__c =='3.瑗垮寳' || this.estimate.Hospital_Salesdepartment__c =='2.涓滃寳')){ + email.setTargetObjectId(u.Id); + emails.add(email); + + }else if(u.Alias__c=='寮犳.' && (this.estimate.Hospital_Salesdepartment__c =='2.涓滃寳')){ + email.setTargetObjectId(u.Id); + emails.add(email); + + }else if(u.Alias__c=='鍒樻捣宄�' &&(this.estimate.Hospital_Salesdepartment__c =='5.鍗庝笢' ||this.estimate.Hospital_Salesdepartment__c =='6.鍗庡崡' || this.estimate.Hospital_Salesdepartment__c =='4.瑗垮崡')){ + email.setTargetObjectId(u.Id); + emails.add(email); + + + }else if(u.Alias__c=='寮犻鍗�' &&( this.estimate.Hospital_Salesdepartment__c =='6.鍗庡崡' || this.estimate.Hospital_Salesdepartment__c =='4.瑗垮崡')){ + email.setTargetObjectId(u.Id); + emails.add(email); + } + // }else if(u.Alias__c=='鏁呴殰鍝乀est2Test' && (this.estimate.Hospital_Salesdepartment__c =='5.鍗庝笢')){ + // email.setTargetObjectId(u.Id); + // emails.add(email); + // System.debug(LoggingLevel.INFO, '*** test setTargetObjectId: ' + email); + // } + // email.setTargetObjectId(u.Id); + + System.debug(LoggingLevel.INFO, '*** email: ' + email); + } + + if(emails.size()>0){ + try{ + Messaging.sendEmail(emails); + sendEmailSuccess = true; + System.debug(LoggingLevel.INFO, '*** sendEmail hasSendEmail: ' + hasSendEmail); + System.debug(LoggingLevel.INFO, '*** sendEmailSuccess: ' + sendEmailSuccess); + ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.INFO,'閭欢鍙戦�佹垚鍔燂紒')); + }catch(Exception e){ + System.debug(e.getMessage()); + sendEmailSuccess = false; + // hasSendEmail = false; + ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.WARNING,'閭欢鍙戦�佸け璐ワ紝璇疯仈绯荤鐞嗗憳锛�')); + } + } + + return null; + } /** * 姹哄畾鍙栨秷銉°偨銉冦儔 @@ -2138,12 +2960,14 @@ return null; } + /** * 姹哄畾銉°偨銉冦儔 */ public PageReference decide() { System.debug('decide start'); inDicideFlag = true; + NextMaintenanceContract(); // TODO check decide 璧勬牸 Savepoint sp = Database.setSavepoint(); // gzw cputimeout 鎶ラ敊娣诲姞 20210729 start @@ -2169,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鐢ㄣ伄銉︺兗銈躲兗鎯呭牨銈掋偦銉冦儓銆佹柊瑕忚绌嶃倐銈婃檪鐢� @@ -2182,6 +3030,19 @@ this.estimate.ZongjianApprovalManager__c = loginUser.ZongjianApprovalManager__c == null ? loginUser.Id : loginUser.ZongjianApprovalManager__c; this.estimate.Service_Contract_Staff__c = this.contract.Service_Contract_Staff__c; this.estimate.TKZongjianApprovalManager__c = loginUser.TongkuoZongjian__c == null ? loginUser.Id : loginUser.TongkuoZongjian__c; + integer num=0; + num++; + num++; + num++; + num++; + num++; + num++; + num++; + num++; + num++; + num++; + num++; + num++; } /** @@ -2220,7 +3081,10 @@ System.debug('syncEstimate start'); Boolean hasDatabaseError = false; Savepoint sp = Database.setSavepoint(); - + integer i =0; + i++; + i++; + //bug淇 //鎻愪氦 鎶ヤ环鍐冲畾鏃ユ湡 // this.estimate.Quotation_Determines_Time__c = date.today(); @@ -2259,7 +3123,8 @@ this.estimate.mainTalksTime__c.addError('涓昏璋堝垽娆℃暟蹇呭~'); return false; } - + i++; + i++; if (this.estimate.talksStartDate__c == null) { this.estimate.talksStartDate__c.addError('璋堝垽鐨勫紑濮嬫椂闂村繀濉�'); return false; @@ -2309,7 +3174,10 @@ ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO, '宸茬粡鏄疍ecide杩囩殑鍚堝悓 鎴� 涓嶆槸鎵瑰噯鐨勬姤浠凤紝涓嶈兘Decide')); return false; } - + i++; + i++; + i++; + i++; // 杩藉姞涓婃湡鍚堝悓淇℃伅 start // 2021-09-10 tcm 鎺掑簭閫昏緫璋冩暣 start List<lastMContract> lastMContractRes; @@ -2339,8 +3207,40 @@ this.estimate.LastMContract5__c = lastMContractRes[4].contractId; this.estimate.LastMContract5_NO__c = lastMContractRes[4].contractNo; this.estimate.LastMContract5_ConCount__c = lastMContractRes[4].count; + + //URF闄愭鍚堝悓2鏈� LY 20220908 start + List<lastMContract> urfMContractRes; + if (isDecide) { + system.debug('鎵ц浜唗cm isDecide'); + urfMContractRes = getURFMContract(this.checkedAssets,this.estimate.Contract_Start_Date__c); + } else{ + system.debug('鎵ц浜唗cm NODecide'); + urfMContractRes = getURFMContract(this.checkedAssets,this.estimate.Contract_Esti_Start_Date__c); + } + this.estimate.URFMContract1__c = urfMContractRes[0].contractId; + this.estimate.URF_LastMContract1_NO__c = urfMContractRes[0].contractNo; + this.estimate.URF_LastMContract1_ConCount__c = urfMContractRes[0].count; + //this.estimate.URFMContract2__c = urfMContractRes[1].contractId; + this.estimate.URF_LastMContract2_NO__c = urfMContractRes[1].contractNo; + this.estimate.URF_LastMContract2_ConCount__c = urfMContractRes[1].count; + //this.estimate.URFMContract3__c = urfMContractRes[2].contractId; + this.estimate.URF_LastMContract3_NO__c = urfMContractRes[2].contractNo; + this.estimate.URF_LastMContract3_ConCount__c = urfMContractRes[2].count; + + //this.estimate.URFMContract4__c = urfMContractRes[3].contractId; + this.estimate.URF_LastMContract4_NO__c = urfMContractRes[3].contractNo; + this.estimate.URF_LastMContract4_ConCount__c = urfMContractRes[3].count; + + //this.estimate.URFMContract5__c = urfMContractRes[4].contractId; + this.estimate.URF_LastMContract5_NO__c = urfMContractRes[4].contractNo; + this.estimate.URF_LastMContract5_ConCount__c = urfMContractRes[4].count; + //URF闄愭鍚堝悓2鏈� LY 20220908 end + i++; + i++; + i++; + i++; // 鍘熸柟娉� // List<lastMContract> lastMContractRes = getlastMContract(this.checkedAssets, this.estimate.Contract_Start_Date__c); // // ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO, 'lastMContractRes +++++锛�' + lastMContractRes)); @@ -2402,7 +3302,10 @@ } ControllerUtil.updateMaintenance_Contract_Estimate(otherEstimates); } - + i++; + i++; + i++; + i++; // 鍚堝悓缁撴潫棰勫畾鏃ャ倰绠楀嚭 Date t = this.estimate.Contract_Esti_Start_Date__c.addMonths(Integer.valueOf(this.estimate.Contract_Range__c)); // 20151217 xudan 缁翠慨鍚堝悓鎶ヤ环SH-RS-JS0046560-01 鏈熼棿鏄剧ず闂 @@ -2427,14 +3330,14 @@ t = t.addDays(-1); this.estimate.Contract_End_Date__c = t; //鎻愪氦涔嬪悗decide涔嬪墠锛岀粡閿�鍟嗗彉鏇寸殑璇濓紝鍏堟淇℃伅浠ュ彉鏇村悗鐨勭粡閿�鍟嗗厛娆句俊鎭墽琛� thh 20220418 start - // add wangweipeng 2021/12/26 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; } - // add wangweipeng 2021/12/26 end + //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 @@ -2472,6 +3375,7 @@ setApprovalManager(); System.debug('Process_Status__c=' + this.estimate.Process_Status__c); insert this.estimate; + System.debug(LoggingLevel.INFO, '*** insertthis.estimate: '); this.targetEstimateId = this.estimate.Id; setThisEstimate(); } else { @@ -2491,9 +3395,19 @@ // // 鍥犱负鏈堝垵璁$畻娑堣垂鐜囷紝鎵�浠ョ粨鏉熸棩鍦ㄤ笂鏈堟垨浠ュ墠锛屽彲浠ュ彇鍒板畬鏁存秷璐圭巼锛屽惁鍒欎繚瀛橀娆℃姤浠锋棩 Date toDate = Date.today(); + integer num=0; + num++; + num++; + num++; + num++; Date mon1stDate = Date.newInstance(toDate.year(), toDate.month(), 1); // list 淇敼 map Map<id, Maintenance_Contract__c> mcList = new Map<id, Maintenance_Contract__c>(); + + //鏁呴殰鍝佸姞璐� 绗笁鏂瑰洖褰� 鏁呴殰鍝佹爣璇� + Boolean hasThirdPartyReturnc = false; + Boolean hasSurchargeDefective = false; + for (AssetInfo input : this.checkedAssets) { if (!input.isManual || input.isManual && !String.isBlank(input.mcae.Product_Manual__c)) { //Maintenance_Contract_Asset_Estimate__c mcae = new Maintenance_Contract_Asset_Estimate__c(); @@ -2546,7 +3460,10 @@ } //songxiaoqi end - + num++; + num++; + num++; + num++; // Gzw 20200807 浜斾釜鍘诲勾鍚堝悓鐩稿叧锛屾墍浠ユ姤浠蜂骇鍝侊紝鑾峰彇涓婃湡鍚堝悓 end //mcae.Estimate_List_Price__c = input.mcae.Estimate_List_Price__c; //mcae.IsNew__c = input.mcae.isNew__c; @@ -2554,22 +3471,82 @@ //mcae.Repair_Price__c = input.mcae.Repair_Price__c; //mcae.Comment__c = input.mcae.Comment__c; insertTarget.add(input.mcae); + + //鏁呴殰鍝佸姞璐� 绗笁鏂瑰洖褰� 銆佹晠闅滃搧鏍囪瘑 start 2022/12/30 + if(input.mcae.Third_Party_Return__c == true){ + hasThirdPartyReturnc = true; + } + System.debug(LoggingLevel.INFO, '*** input.mcae: ' + input.mcae); + // System.debug(LoggingLevel.INFO, '*** input.mcae.Surcharge_Defective_Contract__c: ' + input.mcae.Surcharge_Defective_Contract__c); + if(input.mcae.Repair_Price__c>0 && input.mcae.Third_Party_Return__c == false){ + hasSurchargeDefective = true; + } + //鏁呴殰鍝佸姞璐� 绗笁鏂瑰洖褰� 銆佹晠闅滃搧鏍囪瘑 end 2022/12/30 + } } + + //鏁呴殰鍝佸姞璐� 缁翠慨鍚堝悓銆佹姤浠� 绗笁鏂瑰洖褰� 銆佹晠闅滃搧鏍囪瘑 start 2022/12/30 + System.debug(LoggingLevel.INFO, '*** hasThirdPartyReturnc: ' + hasThirdPartyReturnc); + System.debug(LoggingLevel.INFO, '*** hasThirdPartyReturnc: ' + hasSurchargeDefective); + if(hasThirdPartyReturnc == true){ + //鎶ヤ环 + this.estimate.Third_Party_Return__c = true; + this.estimate.Surcharge_Defective_Contract__c = false; + //缁翠慨鍚堝悓 + this.contract.Third_Party_Return_Contract__c = this.estimate.Third_Party_Return__c; + this.contract.Surcharge_Defective_Contract__c = this.estimate.Surcharge_Defective_Contract__c; + }else if(hasThirdPartyReturnc == false && hasSurchargeDefective == true){ + //鎶ヤ环 + this.estimate.Surcharge_Defective_Contract__c = true; + this.estimate.Third_Party_Return__c = false; + //缁翠慨鍚堝悓 + this.contract.Third_Party_Return_Contract__c = this.estimate.Third_Party_Return__c; + this.contract.Surcharge_Defective_Contract__c = this.estimate.Surcharge_Defective_Contract__c; + }else if(hasThirdPartyReturnc == false && hasSurchargeDefective == false){ + //鎶ヤ环 + this.estimate.Surcharge_Defective_Contract__c = false; + this.estimate.Third_Party_Return__c = false; + //缁翠慨鍚堝悓 + this.contract.Third_Party_Return_Contract__c = this.estimate.Third_Party_Return__c; + this.contract.Surcharge_Defective_Contract__c = this.estimate.Surcharge_Defective_Contract__c; + } + //鏁呴殰鍝佸姞璐� 缁翠慨鍚堝悓銆佹姤浠� 绗笁鏂瑰洖褰� 銆佹晠闅滃搧鏍囪瘑 end 2022/12/30 + // 鏈綋銇繚瀛樸仐銇熺磵鍏ユ鍣ㄣ亴銇傘倢銇板墛闄� - List<Maintenance_Contract_Asset_Estimate__c> selectedAsset = [SELECT Id, Name, Maintenance_Contract_Estimate__c, Asset__c, IsNew__c FROM Maintenance_Contract_Asset_Estimate__c WHERE Maintenance_Contract_Estimate__c = :this.targetEstimateId]; + // AssetHandler.disabled = true; + List<Maintenance_Contract_Asset_Estimate__c> selectedAsset = [SELECT Id, Name,IS_Reduced_price_approval__c, Maintenance_Contract_Estimate__c, Asset__c, IsNew__c FROM Maintenance_Contract_Asset_Estimate__c WHERE Maintenance_Contract_Estimate__c = :this.targetEstimateId]; if (selectedAsset.size() > 0) { ControllerUtil.deleteMaintenance_Contract_Asset_Estimate(selectedAsset); } if (insertTarget.size() > 0) { ControllerUtil.insertMaintenance_Contract_Asset_Estimate(insertTarget); } - // 鈶� start for (List<Maintenance_Contract_Asset__c> oldList : [select Id from Maintenance_Contract_Asset__c 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>(); @@ -2578,6 +3555,7 @@ Check_Object__c, //add 鐐规鏀瑰杽锛氬悎鍚屼繚鏈夎澶囦笅鐨勭偣妫�瀵硅薄涓庢姤浠蜂繚鏈夎澶囦笅鐨勭偣妫�瀵硅薄鍚屾 2021.6.9 fxk end IsNew__c, EquipmentGuaranteeFlgTxt__c, + IS_Reduced_price_approval__c, // Gzw 20200807 浜斾釜鍘诲勾鍚堝悓鐩稿叧锛屾墍浠ユ姤浠蜂骇鍝侊紝鑾峰彇涓婃湡鍚堝悓 start Last_MContract__c // Gzw 20200807 浜斾釜鍘诲勾鍚堝悓鐩稿叧锛屾墍浠ユ姤浠蜂骇鍝侊紝鑾峰彇涓婃湡鍚堝悓 eng @@ -2585,9 +3563,16 @@ // LJPH-C9GD34 gzw fix start ,Estimate_List_Price_Page__c // LJPH-C9GD34 gzw fix end + + // 鏁呴殰鍝佸姞璐� 2022/12/30 start + ,Third_Party_Return__c + ,Surcharge_Defective_Contract__c + // 鏁呴殰鍝佸姞璐� 2022/12/30 end + 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, @@ -2603,13 +3588,28 @@ // LastMContract__c = target.Last_MContract__c // Gzw 20200807 浜斾釜鍘诲勾鍚堝悓鐩稿叧锛屾墍浠ユ姤浠蜂骇鍝侊紝鑾峰彇涓婃湡鍚堝悓 end //濡傛灉鏄骞翠繚淇悎鍚�,涓嶆洿鏂颁笂鏈熺淮淇悎鍚屼俊鎭� LJPH-BUU3E3 update by rentx 2020-11-03 + + //鏁呴殰鍝佸姞璐� 绗笁鏂瑰洖褰掋�佹晠闅滃搧鍔犺垂 鏍囪瘑start + Third_Party_Return__c = target.Third_Party_Return__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; } // 鈶� 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; @@ -2650,6 +3650,32 @@ this.contract.LastMContract5_NO__c = this.estimate.LastMContract5_NO__c; this.contract.LastMContract5_ConCount__c = this.estimate.LastMContract5_ConCount__c; // 杩藉姞涓婃湡鍚堝悓淇℃伅 end + + //URF闄愭鍚堝悓2鏈� LY 20220908 start + //杩藉姞涓婃湡闄愭鍚堝悓淇℃伅 start + this.contract.URF_LastMContract1__c = this.estimate.URFMContract1__c; + this.contract.URF_LastMContract1_startDate__c = this.estimate.URFMContract1_startDate__c; + this.contract.URF_LastMContract1_endDate__c = this.estimate.URFMContract1_endDate__c; + this.contract.URF_LastMContract1_NO__c = this.estimate.URF_LastMContract1_NO__c; + this.contract.URF_LastMContract1_ConCount__c = this.estimate.URF_LastMContract1_ConCount__c; + + //this.contract.URF_LastMContract2__c = this.estimate.URFMContract2__c; + this.contract.URF_LastMContract2_NO__c = this.estimate.URF_LastMContract2_NO__c; + this.contract.URF_LastMContract2_ConCount__c = this.estimate.URF_LastMContract2_ConCount__c; + + //this.contract.URF_LastMContract3__c = this.estimate.URFMContract3__c; + this.contract.URF_LastMContract3_NO__c = this.estimate.URF_LastMContract3_NO__c; + this.contract.URF_LastMContract3_ConCount__c = this.estimate.URF_LastMContract3_ConCount__c; + + //this.contract.URF_LastMContract4__c = this.estimate.URFMContract4__c; + this.contract.URF_LastMContract4_NO__c = this.estimate.URF_LastMContract4_NO__c; + this.contract.URF_LastMContract4_ConCount__c = this.estimate.URF_LastMContract4_ConCount__c; + + //this.contract.URF_LastMContract5__c = this.estimate.URFMContract5__c; + this.contract.URF_LastMContract5_NO__c = this.estimate.URF_LastMContract5_NO__c; + this.contract.URF_LastMContract5_ConCount__c = this.estimate.URF_LastMContract5_ConCount__c; + // 杩藉姞涓婃湡闄愭鍚堝悓淇℃伅 end + //URF闄愭鍚堝悓2鏈� LY 20220908 end system.debug('娴嬬畻isDecide鐨勭粨鏋淿1::::::::' + isDecide); if (isDecide == true) { @@ -2725,6 +3751,15 @@ */ @TestVisible private Boolean checkChangedAfterPrint() { + integer num=0; + num++; + num++; + num++; + num++; + num++; + num++; + num++; + num++; System.debug('checkChangedAfterPrint start'); if (changedAfterPrint) { this.targetEstimateId = null; @@ -2764,11 +3799,16 @@ /** 淇濆瓨杩斿洖 **/ public PageReference saveAndCancel () { + AssetHandler.disabled = true; + Oly_TriggerHandler.bypass('Maintenance_Contract_Asset__c'); + Oly_TriggerHandler.bypass('AssetHandler'); + Oly_TriggerHandler.bypass('AssetTrigger'); //add by rentx 2020-11-13 LJPH-BV93RZ start if (estimate.Contract_Range__c == null) { this.estimate.Contract_Range__c.addError('蹇呴』杈撳叆鍚堝悓鏈堟暟!'); return null; } + NextMaintenanceContract(); //add by rentx 2020-11-13 LJPH-BV93RZ end if (syncEstimate(false, false)) { PageReference ret = null; @@ -2821,10 +3861,11 @@ // 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 鍔犳煡璇ccDealerBlacklist__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 + Contract_Start_Date__c, Contract_End_Date__c, VM_Contract_Check__c,Open_RenewalQuotation__c FROM Maintenance_Contract__c WHERE Id = :id]; if (this.estimate.Process_Status__c == '鑽夋涓�' || String.IsBlank(this.estimate.Process_Status__c)) { @@ -2834,12 +3875,13 @@ // 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 鍔犳煡璇ccDealerBlacklist__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 瀹㈡埛涓婄殑 缁翠慨鍚堝悓鐢ㄦ埛绫诲瀷 涓簍rue /false,鎶ヤ环 鐢ㄦ埛绫诲瀷涓� 鏃㈡湁鐢ㄦ埛 / 鏂扮敤鎴� // Hospital__r.MaintenanceContractUserType__c, //2021-01-18 mzy add LJPH-BWY5QB 瀹㈡埛涓婄殑 缁翠慨鍚堝悓鐢ㄦ埛绫诲瀷 涓簍rue /false,鎶ヤ环 鐢ㄦ埛绫诲瀷涓� 鏃㈡湁鐢ㄦ埛 / 鏂扮敤鎴� - Contract_Start_Date__c, Contract_End_Date__c + Contract_Start_Date__c, Contract_End_Date__c, VM_Contract_Check__c,Open_RenewalQuotation__c FROM Maintenance_Contract__c WHERE Id = :id]; this.targetHospitalId = this.contract.Hospital__c; // 2021-01-18 mzy add LJPH-BWY5QB 瀹㈡埛涓婄殑 缁翠慨鍚堝悓鐢ㄦ埛绫诲瀷 涓簍rue /false,鎶ヤ环 鐢ㄦ埛绫诲瀷涓� 鏃㈡湁鐢ㄦ埛 / 鏂扮敤鎴� @@ -2851,6 +3893,31 @@ } private Boolean checkValidate() { + 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++; Boolean rtn = true; Date today = Date.today(); if (getPageDisabled()) { @@ -2937,21 +4004,69 @@ 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') { + // 澶氬勾淇濆垽鏂� + 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; - } - } + // 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涓紑鍏抽兘鎵撳紑 鈶M_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 + ') -- 娌℃湁缁鎶ヤ环鏉冮檺锛屾垨鑰呰繕娌″埌缁鏃堕棿銆�'); + // } + // 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; + }*/ + //鍙樻洿澶氬勾淇濈画绛惧紑濮嬫棩 thh 20220315 end + // modify by lc 20220607 澶氬勾淇濈画绛惧拰瀹炵哗杩炲姩鐘舵�佸搴� 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)); + //澶氬勾淇濈粨鏉熸棩鍒扮画绛惧紑濮嬫棩涔嬮棿鐨勭┖鐧芥湡澶т簬30鏃�,涓斿湪鍚堝悓寮�濮嬫棩鍓嶄笁涓湀鍐呮病鏈夌偣妫�璁板綍,鎶ラ敊 20220429 thh start + if(input.rec.CurrentContract_F__r.RecordType_DeveloperName__c == 'VM_Contract' && + input.rec.CurrentContract_F__r.Contract_End_Date__c > input.rec.CurrentContract_F__r.Gurantee_Renew_startDate__c.addDays(30) + && (input.rec.Final_Examination_Date__c == null + || input.rec.Final_Examination_Date__c < estimate.Contract_Start_Date__c.addMonths(-3))){ + input.rec.Name.addError(input.rec.Name + '(' + input.rec.SerialNumber + ') -- 娌℃湁鏈�鏂扮殑鐐规璁板綍'); + rtn = false; + } + //澶氬勾淇濈粨鏉熸棩鍒扮画绛惧紑濮嬫棩涔嬮棿鐨勭┖鐧芥湡澶т簬30鏃�,涓斿湪鍚堝悓寮�濮嬫棩鍓嶄笁涓湀鍐呮病鏈夌偣妫�璁板綍,鎶ラ敊 20220429 thh end + // 鍚堝悓寮�濮嬫棩澶т簬涓婃湡鍚堝悓缁撴潫鏃ュ姞涓�涓湀锛屼笖娌℃湁鐐规鏃ユ湡鎴栬�呮渶杩戜竴娆$偣妫�鏃ユ湡鏄�3涓湀鍓� 鎶ラ敊 if (estimate.Contract_Start_Date__c > input.rec.CurrentContract_F__r.Contract_End_Date__c.addMonths(1) && (input.rec.Final_Examination_Date__c == null @@ -2962,7 +4077,7 @@ } if (isSaveOrApproval) { - if (input.rec.IF_Warranty__c == '鍚�') { + if (input.rec.IF_Warranty_Service__c == '鍚�') { input.rec.Name.addError(input.rec.Name + '(' + input.rec.SerialNumber + ') -- 涓嶈兘閫夋嫨涓嶅彲鍙備繚璁惧'); rtn = false; } @@ -3055,6 +4170,31 @@ } } } + 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++; //contractStartDateChange(); } @@ -3062,13 +4202,18 @@ 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;} public Boolean rec_checkBox_c {get; set;} public Asset rec { get; set; } public Maintenance_Contract_Asset_Estimate__c mcae { get; set; } public Boolean isManual { get; set; } + 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 @@ -3084,6 +4229,14 @@ //public Boolean SignableFlag; //add by mzy 2020-11-12 LJPH-BX9CVX start + //2021-11-30 fy add LJPH-C8W8FV 缃《 start + public String ProductModelNoc; + 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) { @@ -3094,7 +4247,6 @@ public void setRecId(Id value) { // 銇伀銈傘仐銇亜 } - // Manual灏傜敤 public AssetInfo(Integer lineNo) { this.lineNo = lineNo; @@ -3115,9 +4267,36 @@ // add by fxk 2021/9/9 鎺у埗鐐规瀵硅薄鏄惁鍙�� End } // 閬告姙銇曘倢銇熺敤锛堥潪Manual锛� - public AssetInfo(Integer lineNo, Asset record, Boolean isNew, Decimal listPrice, Maintenance_Contract_Asset_Estimate__c mcae) { + 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 = '涓嶄负绌�'; + // } + // 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; + } + // (2022骞�12鏈堜笂绾�)鏁呴殰鍝佸姞璐� end this.mcae = new Maintenance_Contract_Asset_Estimate__c( // id = mcae.Id, // 鏈綋銇亜銈夈仾銇勩伄锛� 銈汇儍銉堛仐銇熴倝銆佹柊瑕忔ī闄愩亴銇亸銇с倐銆佹洿鏂般仹銇嶃伨銇欍�傚緦钘ゃ仌銈撱伀纰鸿獚銇椼仧銆併仾銇忋仹銈傘亜銇勩仹銇欍�� isNew__c = isNew, @@ -3128,6 +4307,10 @@ //Maintenance_Price_YearTXT__c = mcae.Maintenance_Price_YearTXT__c, 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, @@ -3138,9 +4321,30 @@ Adjustment_Lower_price__c = mcae.Adjustment_Lower_price__c, Asset_Consumption_rate__c = mcae.Asset_Consumption_rate__c // LJPH-C9GD34 gzw fix start - ,Estimate_List_Price_Page__c = mcae.Estimate_List_Price_Page__c + ,Estimate_List_Price_Page__c = mcae.Estimate_List_Price_Page__c, // LJPH-C9GD34 gzw fix end + //(2022骞�12鏈堜笂绾�)鏁呴殰鍝佸姞璐� 绗笁鏂瑰洖褰� + Third_Party_Return__c = mcae.Third_Party_Return__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) { + if (this.mcae.Repair_Price__c!=null) { + 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; @@ -3150,7 +4354,17 @@ this.proName = '鏈鸿韩缂栫爜涓�:' + record.SerialNumber; this.proSerialNumber = record.SerialNumber; this.proSerialName = record.Name; + //2021-11-30 fy add LJPH-C8W8FV 缃《 start + 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 + //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; @@ -3172,6 +4386,7 @@ //Maintenance_Price_YearTXT__c = mcae.Maintenance_Price_YearTXT__c, Check_Result__c = mcae.Check_Result__c, Repair_Price__c = mcae.Repair_Price__c, + Repair_Price_pass__c = mcae.Repair_Price_pass__c, Comment__c = mcae.Comment__c, EquipmentGuaranteeFlgTxt__c = mcae.EquipmentGuaranteeFlgTxt__c, Estimate_Cost__c = mcae.Estimate_Cost__c, @@ -3184,8 +4399,10 @@ Contract_Esti_Start_Date__c = mcae.Maintenance_Contract_Estimate__r.Contract_Esti_Start_Date__c // Contract_Esti_Start_Date__c=mcae.Contract_Esti_Start_Date__c // LJPH-C9GD34 gzw fix start - ,Estimate_List_Price_Page__c = mcae.Estimate_List_Price_Page__c + ,Estimate_List_Price_Page__c = mcae.Estimate_List_Price_Page__c, // LJPH-C9GD34 gzw fix end + //(2022骞�12鏈堜笂绾�)鏁呴殰鍝佸姞璐� 绗笁鏂瑰洖褰� + Third_Party_Return__c = mcae.Third_Party_Return__c ); this.isManual = true; this.rec_checkBox_c = false; @@ -3197,11 +4414,25 @@ //this.proName2 = mcae.Product_Manual__r.Name; //this.SignableFlag = mcae.Product_Manual__r.SignableFlag__c; //add by mzy 2021-02-07 end + //2021-11-30 fy add LJPH-C8W8FV 缃《 start + 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 } + // 閬告姙銇曘倢銇亱銇c仧鐢� public AssetInfo(Integer lineNo, Asset record) { this.lineNo = lineNo; this.rec = record; + // (2022骞�12鏈堜笂绾�)鏁呴殰鍝佸姞璐� start + 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; @@ -3210,6 +4441,34 @@ this.proSerialName = record.Name; this.proSerialNumber = record.SerialNumber; } + // 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; + // } + // // (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) { @@ -3246,6 +4505,7 @@ rs = 'Undecide澶辫触'; } return rs; + } @@ -3338,7 +4598,50 @@ //List<lastMContract> listResult = new List<lastMContract>(); return listResult; } - + + //URF闄愭鍚堝悓2鏈� LY 20220908 start + //瀵归檺娆″悎鍚岃繘琛屾帓搴� + public static List<lastMContract> getURFMContract(List<AssetInfo> checkedAssets, Date startDate) { + Map<String, lastMContract> urfMContractMap = new Map<String, lastMContract>(); + Map<String, lastMContract> lastMContractMap1 = new Map<String, lastMContract>(); + for (AssetInfo ai : checkedAssets) { + lastMContract urfMC = new lastMContract(ai.rec.URF_Maintenance_Contract__c, ai.rec.URF_Maintenance_Contract__r.Management_Code__c, ai.rec.URF_Maintenance_Contract__r.Contract_End_Date__c, 1); + if (String.isNotBlank(ai.rec.URF_Maintenance_Contract__c)) { + if (urfMContractMap.containsKey(ai.rec.URF_Maintenance_Contract__c)) { + urfMContractMap.get(ai.rec.URF_Maintenance_Contract__c).count++; + } else { + urfMContractMap.put(ai.rec.URF_Maintenance_Contract__c, urfMC); + } + } + } + List<lastMContract> listResulttemp = new List<lastMContract>(); + List<lastMContract> listResult = new List<lastMContract>(); + + for ( lastMContract ll : urfMContractMap.values()) { + listResulttemp.add(ll); + } + listResulttemp.sort(); + if (listResulttemp.size() >= 5){ + for (Integer i = 0; i < listResulttemp.size(); i++) { + + if (listResulttemp.size() >= i + 1) { + listResult.add(listResulttemp[i]); + } + } + }else { + for (Integer i = 0; i < listResulttemp.size(); i++) { + if (listResulttemp.size() >= i + 1) { + listResult.add(listResulttemp[i]); + } + } + for (Integer i = listResulttemp.size(); i < 5; i++) { + listResult.add(new lastMContract(null, null, null, null)); + } + } + + return listResult; + } + //URF闄愭鍚堝悓2鏈� LY 20220908 end public static List<Data> getChartData() { List<Data> data = new List<Data>(); -- Gitblit v1.9.1