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 | 356 +++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 310 insertions(+), 46 deletions(-) diff --git a/force-app/main/default/classes/SelectAssetEstimateVMController.cls b/force-app/main/default/classes/SelectAssetEstimateVMController.cls index 1df5be2..6a4fa24 100644 --- a/force-app/main/default/classes/SelectAssetEstimateVMController.cls +++ b/force-app/main/default/classes/SelectAssetEstimateVMController.cls @@ -18,6 +18,11 @@ public Boolean printAgent { get; private set; } public boolean inDicideFlag {get; set;} //浣滀负琛ュ厖锛屽搴旀姤浠峰喅瀹氫箣鍚庯紝鍗存湭鑳借鍚堝悓璧锋鏃ユ湡浼犻�掔粰鍚堝悓鐨勯棶棰� public String isPaymentSet {get; set;} + // 鎶ヤ环瑙勫垯鏀瑰杽 20230309 start + // public Boolean Is_Blank_period {get; set;} + // public String Cost_rate_ForecastF{get;set;} + // public String PastContractendday{get;set;} + // 鎶ヤ环瑙勫垯鏀瑰杽 20230309 end //public String PaymentSet {get;set;} // 寮曟暟銇偟銉笺儞銈瑰绱勩伄鎯呭牨銈掓牸绱嶃仚銈嬨�� public Maintenance_Contract__c contract { get; private set; } @@ -121,8 +126,9 @@ public Boolean disableEmailBtn { get; set; } public Boolean sendEmailSuccess { get; set; } public Boolean hasSendEmail { get; set; } - - + // 涓婇檺鍚堝悓 hql 20230216 start + public Boolean isLimitPrice { get; set; } + // 涓婇檺鍚堝悓 hql 20230216 end public Boolean isNotFSE { get; set; } //澶氬勾淇濊澶囩画绛捐绠楅�昏緫璋冩暣 2022/12/14 @@ -131,7 +137,7 @@ public Decimal Denominator {get; set; } public Decimal Accrued {get; set; } public String ProductModel{get;set;} - public String Category{get;set;} + // public String Category{get;set;} public Decimal Consumption_rate_Gurante{get;set;} @@ -161,7 +167,35 @@ totalPage = (totalRecords / selctRecordNum) + (Math.mod(totalRecords, selctRecordNum) > 0 ? 1 : 0); return null; } - + public void test() { + integer i = 0; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + } // 鍙栧凡閫夋嫨璧勪骇鐨勬満韬紪鐮� public void getAssetSerialNumber() { //LJPH-BSS6E2 ---20200911 ---add by rentongxiao start @@ -362,8 +396,10 @@ + 'URF_Maintenance_Contract__c,URF_Maintenance_Contract__r.Management_Code__c,URF_Maintenance_Contract__r.Contract_End_Date__c,' //URF闄愭鍚堝悓2鏈� LY 20220811 end - //澶氬勾淇濊澶囩画绛捐绠楅�昏緫璋冩暣 2022/12/14 start - // +'Guarantee_period_for_products__c,' + //澶氬勾淇濊澶囩画绛捐绠楅�昏緫璋冩暣 2022/12/14 start 娑堣垂鐜� + +'CurrentContract_F_asset__r.Asset_Consumption_Rate__c,Product2.Category4__c,Product2.Asset_Model_No__c,CurrentContract_F_asset__r.Maintenance_Price_Year__c,' + +'CurrentContract_F_asset__r.IS_VMContract_Asset__c,' + +'CurrentContract_F__r.endDateGurantee__c,' //澶氬勾淇濊澶囩画绛捐绠楅�昏緫璋冩暣 2022/12/14 end + 'CurrentContract_End_Date__c, Extend_Gurantee_DateTo__c,EquipmentGuaranteeFlg__c,AssetMark__c,NoPartRiskDate_F__c,NoPartRiskDate__c,SignableFlag__c FROM Asset WHERE Hospital__c = \'' + this.targetHospitalId + '\' '; @@ -597,6 +633,17 @@ //2022/12/27 鏁呴殰鍝佸姞璐� 鏂板鎻愪氦淇悊鍑忎环 鎸夐挳浠呭 寮犳櫠 寮犳牘姒曞強 绠$悊鍛樺彲瑙� public Boolean getApprovalBtnNewDisabled() { + // 瑕嬬銈傘倞鐢宠珛銇с亶銇亜鏉′欢銇垽鏂� + if (String.isBlank(this.contract.Decided_Estimation__c) == false) { + // TODO 鐗瑰垾璩囨牸銇屻亗銈屻伆 鐢宠珛鍙兘銇仚銈� + return true; + } + if (String.isBlank(this.estimate.Process_Status__c) == false + && this.estimate.Process_Status__c != '鑽夋涓�' + //&& this.estimate.Process_Status__c != '涓嶆壒鍑�' + ) { + return true; + } String userName = UserInfo.getName(); String uProfileId = UserInfo.getProfileId(); String uProfileName = [SELECT Name FROM Profile WHERE Id =: uProfileId].Name; @@ -627,12 +674,17 @@ if (String.isBlank(this.contract.Decided_Estimation__c) == false) { return true; } + //涓婇檺鍚堝悓 hql 20230113 start + if (this.isFSE == false + && this.isLimitPrice == true + && String.isBlank(this.estimate.Process_Status__c) == false + && this.estimate.Process_Status__c == '鐢宠涓�') { + return false; + } + //涓婇檺鍚堝悓 hql 20230113 end if (String.isBlank(this.estimate.Process_Status__c) == false && this.estimate.Process_Status__c != '鑽夋涓�' //&& this.estimate.Process_Status__c != '涓嶆壒鍑�' - //涓婇檺鍚堝悓 LY 20230113 start - // && this.estimate.Process_Status__c != '鐢宠涓�' - //涓婇檺鍚堝悓 LY 20230113 start ) { return true; } @@ -715,6 +767,7 @@ public Boolean isSaveOrApproval {get; set;} public String OldContractStartDate {get; set;} public String OldMaintenancePrice { get; set; } + public Decimal OldLimitPrice { get; set; } /** * 銈炽兂銈广儓銉┿偗銈� @@ -766,9 +819,9 @@ , Sales_incidental__c, Consumption_rate_Forecast__c, AgencyHos_Price__c // 鐢宠鎶ヤ环閲戦 鍜� 鐩稿鏍囧噯浠锋牸鑼冨洿鐨勬姌鎵g巼 , Request_quotation_Amount__c, Service_discount_Rate__c, ContractPriceType__c - //涓婇檺鍚堝悓 20230103 LY start - // ,Limit_Price_Amount__c - //涓婇檺鍚堝悓 20230103 LY end + //涓婇檺鍚堝悓 20230103 hql start + ,Limit_Price_Amount__c + //涓婇檺鍚堝悓 20230103 hql end , LastMContract1__c, LastMContract2__c, LastMContract3__c, LastMContract4__c, LastMContract5__c , LastMContract1_ConCount__c, LastMContract2_ConCount__c, LastMContract3_ConCount__c, LastMContract4_ConCount__c, LastMContract5_ConCount__c, LastMContract1_NO__c, LastMContract2_NO__c, LastMContract3_NO__c, LastMContract4_NO__c, LastMContract5_NO__c @@ -779,7 +832,10 @@ , Maintenance_Contract__r.Open_RenewalQuotation__c,Maintenance_Contract__r.VM_Contract_Check__c //WLIG-CDFBV3 寮�閫氱画绛炬姤浠蜂负true鐨勫彲浠ュ紑鏀剧画绛炬姤浠� thh 20220419 end' //LJPH-C9SCX7 銆愬鎵樸�戝悎鍚屾棤绌虹櫧鏈熺殑鎻愰啋 lt 20211221 start - //, Maintenance_Contract__r.Past_Contract_end_day__c //杩囧幓鍚堝悓缁撴潫鏃� + // 鎶ヤ环瑙勫垯鏀瑰杽20230314 start + // , Maintenance_Contract__r.Past_Contract_end_day__c //杩囧幓鍚堝悓缁撴潫鏃� + // ,renewTen_OFF__c + // 鎶ヤ环瑙勫垯鏀瑰杽20230314 end //LJPH-C9SCX7 銆愬鎵樸�戝悎鍚屾棤绌虹櫧鏈熺殑鎻愰啋 lt 20211221 end // URF闄愭鍚堝悓2鏈� LY 20220811 start ,URF_P_MaxRepairCount__c,URF_V_MaxRepairCount__c @@ -792,11 +848,17 @@ ,Hospital_Salesdepartment__c ,Send_Email_To_RC__c //鏁呴殰鍝佸姞璐� 2022/12/16 end - + //璐告槗鍚堣 you start + ,Maintenance_Contract__r.AccDealerBlacklist__c + ,Maintenance_Contract__r.Hospital__r.Name + ,Maintenance_Contract__r.Dealer__r.Name + ,CreatedById + //璐告槗鍚堣 you end FROM Maintenance_Contract_Estimate__c WHERE Id = :this.targetEstimateId]; //HWAG-B399Q8 2018/08/20 娣诲姞涓�棰濆瀛楁 IS_Clone_After_Decide__c end //鏁呴殰鍝佸姞璐� 2023/1/3 start hasSendEmail = this.estimate.Send_Email_To_RC__c; + OldLimitPrice = this.estimate.Limit_Price_Amount__c; //鏁呴殰鍝佸姞璐� 2023/1/3 end decimal PriceSum = (this.estimate.Maintenance_Contract__r.Payment_Plan_Sum_First__c == null ? 0 : this.estimate.Maintenance_Contract__r.Payment_Plan_Sum_First__c) + (this.estimate.Maintenance_Contract__r.Payment_Plan_Sum_Second__c == null ? 0 : this.estimate.Maintenance_Contract__r.Payment_Plan_Sum_Second__c) + @@ -845,7 +907,7 @@ isSaveOrApproval = false; OldContractStartDate = null; OldMaintenancePrice = null; - + OldLimitPrice = null; inDicideFlag = false; isSoft = false; @@ -903,6 +965,7 @@ } this.targetMaintenanceContractId = ApexPages.currentPage().getParameters().get('mcid'); } + // 绶ㄩ泦銇嬨倝 if (String.isBlank(this.targetEstimateId) == false) { setThisEstimate(); @@ -980,11 +1043,19 @@ , URF_Maintenance_Contract__r.Management_Code__c , URF_Maintenance_Contract__r.Contract_End_Date__c //URF闄愭鍚堝悓2鏈� LY 20220811 end - - // //澶氬勾淇濊澶囩画绛捐绠楅�昏緫璋冩暣 2022/12/14 start - // ,Maintenance_Price_Year__c - - // //澶氬勾淇濊澶囩画绛捐绠楅�昏緫璋冩暣 2022/12/14 end + // 鎶ヤ环瑙勫垯鏀瑰杽 20230315 start + // ,IS_StandardPricing__c + // 鎶ヤ环瑙勫垯鏀瑰杽 20230315 end + //澶氬勾淇濊澶囩画绛捐绠楅�昏緫璋冩暣 2023/1/17 start + ,CurrentContract_F_asset__r.Asset_Consumption_Rate__c + ,CurrentContract_F_asset__r.Maintenance_Price_Year__c + ,CurrentContract_F_asset__r.IS_VMContract_Asset__c + ,Product2.Asset_Model_No__c + ,Product2.Category4__c + ,CurrentContract_F__r.endDateGurantee__c + //娣诲姞鏄惁鏈嶅姟澶氬勾淇濅慨锛屽骞翠繚缁翠慨鏈熻嚦 + ,IS_Extend_Gurantee__c,Extend_Gurantee_DateTo__c + //澶氬勾淇濊澶囩画绛捐绠楅�昏緫璋冩暣 2023/1/17 end FROM Asset WHERE Hospital__c = :this.targetHospitalId AND ( AssetMark__c != '鑰楁潗' OR Product2.Family != 'ET' ) ORDER BY ID, IF_Warranty_Service__c asc]; //JZHG-BSDUT4 ---20200825---update By rentongxiao---Start // assetRecords = [SELECT Id, Name, Asset_situation__c, SerialNumber, Department_Name__c, Installation_Site__c, Posting_Date__c,Management_Code__c,IF_Warranty_Service__c,Reson_Can_not_Warranty__c, @@ -1002,7 +1073,24 @@ //sqlStr += ' AND AssetMark__c != \'鑰楁潗\' AND Product2.Family != \'ET\' '; this.checkedAssets = new List<AssetInfo>(); this.unCheckedAssets = new List<AssetInfo>(); - + // 涓婇檺鍚堝悓 hql 20230216 start + Boolean isLimitPriceOne = [SELECT id,Limit_Price__c FROM Maintenance_Contract__c WHERE Id =: this.targetMaintenanceContractId].Limit_Price__c; + if(isLimitPriceOne){ + this.isLimitPrice = true; + }else{ + this.isLimitPrice = false; + } + // 涓婇檺鍚堝悓 hql 20230216 end + // 鎶ヤ环瑙勫垯鏀瑰杽 20230309 start + // Maintenance_Contract__c mc1 = [SELECT id,Is_Blank_period__c,Cost_rate_ForecastF__c FROM Maintenance_Contract__c WHERE Id =: this.targetMaintenanceContractId]; + // Boolean IsBlankperiod = mc1.Is_Blank_period__c; + // this.Cost_rate_ForecastF = mc1.Cost_rate_ForecastF__c; + // if(IsBlankperiod){ + // this.Is_Blank_period = true; + // }else{ + // this.Is_Blank_period = false; + // } + // 鎶ヤ环瑙勫垯鏀瑰杽 20230309 end // 閬告姙娓堛伩銇磵鍏ユ鍣ㄦ儏鍫便倰鍙栧緱 Map<Id, Integer> selectedAssetIds = new Map<Id, Integer>(); List<Maintenance_Contract_Asset_Estimate__c> selectedMcaes = new List<Maintenance_Contract_Asset_Estimate__c>(); @@ -1015,9 +1103,14 @@ Asset__r.EquipmentGuaranteeFlg__c, Asset__r.CurrentContract_F_asset__r.Estimate_Cost_Month_formula__c, Asset__r.CurrentContract_F_asset__r.endDateGurantee_Text__c, - //澶氬勾淇濊澶囩画绛捐绠楅�昏緫璋冩暣 2022/12/14 start - // Asset__r.CurrentContract_F_asset__r.startDateGurantee__c, - //澶氬勾淇濊澶囩画绛捐绠楅�昏緫璋冩暣 2022/12/14 end + //澶氬勾淇濊澶囩画绛捐绠楅�昏緫璋冩暣 2023/1/18 start 璁惧娑堣垂鐜� + Asset__r.CurrentContract_F_asset__r.Asset_Consumption_Rate__c, + Asset__r.CurrentContract_F_asset__r.IS_VMContract_Asset__c, + Asset__r.CurrentContract_F_asset__r.Maintenance_Price_Year__c, + Asset__r.Product2.Asset_Model_No__c, + Asset__r.Product2.Category4__c, + Asset__r.CurrentContract_F__r.endDateGurantee__c, + //澶氬勾淇濊澶囩画绛捐绠楅�昏緫璋冩暣 2022/1/18 end Asset__r.CurrentContract_F__r.First_Estimate_Date__c, Asset__r.CurrentContract_F__r.Contract_Consumption_rate__c, Asset__r.CurrentContract_F__r.First_contract_usage_Rate__c, @@ -1097,7 +1190,10 @@ // if (mca.Maintenance_Contract__r.Consumption_rate_Gurante__c != null) { // Consumption_rate_Gurante = mca.Maintenance_Contract__r.Consumption_rate_Gurante__c; // } + // if(mca.Asset_Consumption_Rate__c!=null){ + // Consumption_rate_Gurante = mca.Asset_Consumption_Rate__c; + // } //澶氬勾淇濊澶囩画绛捐绠楅�昏緫璋冩暣 2022/12/14 end if (createdDate.addMonths(isNewAddMonth) < mca.Asset__r.isNewDate_use__c) { isNew = true; @@ -1133,6 +1229,7 @@ Asset__r.EquipmentGuaranteeFlg__c, //2021-11-30 fy add LJPH-C8W8FV 缃《 start Asset__r.OwnershipMachine_No__c, + Product_Manual__r.Category4__c, //2021-11-30 fy add LJPH-C8W8FV 缃《 end Asset_Consumption_rate__c, Asset__r.CurrentContract_F__c, @@ -1155,8 +1252,8 @@ LastMContract_Price__c, Asset__r.CurrentContract_F_asset__r.Estimate_Cost_Month_formula__c, Asset__r.CurrentContract_F_asset__r.endDateGurantee_Text__c, - //澶氬勾淇濊澶囩画绛捐绠楅�昏緫璋冩暣 2022/12/14 start - // Asset__r.CurrentContract_F_asset__r.startDateGurantee__c, + //澶氬勾淇濊澶囩画绛捐绠楅�昏緫璋冩暣 2023/1/18 start 璁惧娑堣垂鐜� + // Asset__r.CurrentContract_F_asset__r.Asset_Consumption_Rate__c, // Asset__r.Product2.Intra_Trade_Gurantee_RMB__c, //澶氬勾淇濊澶囩画绛捐绠楅�昏緫璋冩暣 2022/12/14 end Product_Manual__c, @@ -1181,6 +1278,9 @@ Adjustment_ratio_Lower__c, Adjustment_Lower_price__c, Adjustment_Upper_price__c, + // 鏈嶅姟鍚堝悓鎶ヤ环瑙勫垯鏀瑰杽 20230227 start + // IS_StandardPricing__c, + // 鏈嶅姟鍚堝悓鎶ヤ环瑙勫垯鏀瑰杽 20230227 end Last_inspection_day__c, Check_Result__c, Repair_Price__c, @@ -1189,6 +1289,9 @@ Repair_Price_Auto__c, Third_Party_Return__c, // (2022骞�12鏈堜笂绾�)鏁呴殰鍝佸姞璐� end + // 鎶ヤ环瑙勫垯鏀瑰杽 20230308 start + // Blank_period__c, + // 鎶ヤ环瑙勫垯鏀瑰杽 20230308 end Comment__c, Asset__r.Posting_Date__c, EquipmentGuaranteeFlgTxt__c, @@ -1198,6 +1301,15 @@ Last_MContract__c // Gzw 20200807 浜斾釜鍘诲勾鍚堝悓鐩稿叧锛屾墍浠ユ姤浠蜂骇鍝侊紝鑾峰彇涓婃湡鍚堝悓 eng // LJPH-C9GD34 gzw fix start + //甯傚満澶氬勾淇濅慨浠锋牸寮�鍙� 2023/01/28 start + ,Asset__r.Product2.Asset_Model_No__c + ,Asset__r.Product2.Category4__c + ,Asset__r.CurrentContract_F_asset__r.Asset_Consumption_Rate__c + ,Asset__r.CurrentContract_F_asset__r.Maintenance_Price_Year__c + ,Asset__r.CurrentContract_F_asset__r.IS_VMContract_Asset__c + ,Asset__r.CurrentContract_F__r.endDateGurantee__c + //甯傚満澶氬勾淇濅慨浠锋牸寮�鍙� 2023/01/28 end + ,Estimate_List_Price_Page__c FROM Maintenance_Contract_Asset_Estimate__c WHERE Maintenance_Contract_Estimate__c = :this.targetEstimateId @@ -1246,6 +1358,7 @@ // Map<String,repair__c> assNewRepMap = new Map<String,repair__c>(); // assNewRepMap = getNewrep(this.assetRecords); datatemp = getChartData(); + System.debug(LoggingLevel.INFO, '*** this.assetRecords: ' + this.assetRecords); for (Asset ast : this.assetRecords) { Boolean isNew = false; Decimal listPrice = ast.Maintenance_Price_Month__c; @@ -1302,7 +1415,9 @@ // // // + ast.CurrentContract_End_Date__c = ast.CurrentContract_F_asset__r.IS_VMContract_Asset__c ? ast.Extend_Gurantee_DateTo__c : ast.CurrentContract_End_Date__c; checkedAssets.add(new AssetInfo(checkedAssets.size(), ast, isNew, listPrice, selectedLocal,estimate)); + } else { //update by rentongxiao 2020-09-23 start if (ast.AssetMark__c == '涓绘満') { @@ -1323,6 +1438,8 @@ } */ } + + System.debug(LoggingLevel.INFO, '*** checkedAssets: ' + checkedAssets); totalPage = (totalRecords / selctRecordNum) + (Math.mod(totalRecords, selctRecordNum) > 0 ? 1 : 0); system.debug('椤哄簭妫�娴�' + checkedAssets); @@ -1349,7 +1466,7 @@ //2021-11-30 fy add LJPH-C8W8FV 缃《 start List<AssetInfo> topAsset =new List<AssetInfo>(); List<AssetInfo> otherAsset =new List<AssetInfo>(); - + System.debug(LoggingLevel.INFO, '*** 椤哄簭: ' + checkedAssets); for(AssetInfo ched : checkedAssets){ system.debug('椤哄簭妫�娴�2' + ched.ProductModelNoc); system.debug('椤哄簭妫�娴�3' + ched.AssetModelNoc); @@ -1374,6 +1491,7 @@ } checkedAssets=NumberSort; //2021-11-30 fy add LJPH-C8W8FV 缃《 end + System.debug(LoggingLevel.INFO, '*** checkedAssetsEND: ' + checkedAssets); } // @@ -1421,6 +1539,14 @@ //URF闄愭鍚堝悓2鏈� LY 20220811 start + 'URF_Maintenance_Contract__c,URF_Maintenance_Contract__r.Management_Code__c,URF_Maintenance_Contract__r.Contract_End_Date__c,' //URF闄愭鍚堝悓2鏈� LY 20220811 end + //甯傚満澶氬勾淇濅环鏍煎紑鍙� start DC 2023/01/17 璁惧娑堣垂鐜� 浜у搧鍨嬪彿 绗洓鍒嗙被 鏄惁涓哄骞翠繚璁惧 + + 'CurrentContract_F_asset__r.Asset_Consumption_Rate__c,' + + 'CurrentContract_F_asset__r.Maintenance_Price_Year__c,' + + 'CurrentContract_F_asset__r.IS_VMContract_Asset__c,' + + 'Product2.Asset_Model_No__c,' + + 'Product2.Category4__c,' + + 'CurrentContract_F__r.endDateGurantee__c,' + //甯傚満澶氬勾淇濅环鏍煎紑鍙� end DC 2023/01/17 + 'Product2.ProductURF__c,CurrentContract_F__r.Contract_Range__c,AssetMark__c,NoPartRiskDate__c,NoPartRiskDate_F__c,Product2.PartSupplyFinishDate__c,SignableFlag__c FROM Asset WHERE Hospital__c = \'' + this.targetHospitalId + '\' ' + 'AND Id NOT IN ' + notInId; //HWAG-B4R3SS START 20181026 @@ -1477,7 +1603,15 @@ //URF闄愭鍚堝悓2鏈� LY 20220811 start sqlStr += 'URF_Maintenance_Contract__c,URF_Maintenance_Contract__r.Management_Code__c,URF_Maintenance_Contract__r.Contract_End_Date__c,'; //URF闄愭鍚堝悓2鏈� LY 20220811 end + + //甯傚満澶氬勾淇濅环鏍煎紑鍙� start DC 2023/01/17 璁惧娑堣垂鐜� + sqlStr += 'CurrentContract_F_asset__r.Asset_Consumption_Rate__c,CurrentContract_F_asset__r.IS_VMContract_Asset__c,CurrentContract_F_asset__r.Maintenance_Price_Year__c,Product2.Asset_Model_No__c,Product2.Category4__c,CurrentContract_F__r.endDateGurantee__c,'; + //甯傚満澶氬勾淇濅环鏍煎紑鍙� start DC 2023/01/17 + sqlStr += ' CurrentContract_F__r.Contract_Range__c,AssetMark__c,NoPartRiskDate__c,NoPartRiskDate_F__c,Product2.PartSupplyFinishDate__c,SignableFlag__c FROM Asset WHERE Hospital__c = \'' + this.targetHospitalId + '\''; + + + //JZHG-BSDUT4 ---20200825---update By rentongxiao---Start // sqlStr += ' AND ( AssetMark__c != \'鑰楁潗\' OR Product2.Family != \'ET\' ) '; //JZHG-BSDUT4 ---20200825---update By rentongxiao---End @@ -1679,6 +1813,9 @@ and Agreed_Date__c != null and Agreed_Date__c > :LastYearDate and Agreed_Date__c <= :today + // DB202302544421 LHJ add + and Status2__c !='00.鍒犻櫎' + and Status2__c !='00.鍙栨秷' group by Delivered_Product__c ]; List<AggregateResult> SecRepairList = [ @@ -1703,6 +1840,9 @@ and Agreed_Date__c != null and Agreed_Date__c <= :LastYearDate and Agreed_Date__c > :LastSecondYearDate + // DB202302544421 LHJ add + and Status2__c !='00.鍒犻櫎' + and Status2__c !='00.鍙栨秷' group by Delivered_Product__c ]; // 杩囧幓3骞撮棿淇悊瀹炵哗 @@ -1728,6 +1868,9 @@ and Agreed_Date__c != null and Agreed_Date__c <= :LastSecondYearDate and Agreed_Date__c > :LastThirdYearDate + // DB202302544421 LHJ add + and Status2__c !='00.鍒犻櫎' + and Status2__c !='00.鍙栨秷' group by Delivered_Product__c ]; // 杩囧幓3骞翠慨鐞嗗疄缁� @@ -1753,6 +1896,9 @@ and Agreed_Date__c != null and Agreed_Date__c <= :today and Agreed_Date__c > :LastThirdYearDate + // DB202302544421 LHJ add + and Status2__c !='00.鍒犻櫎' + and Status2__c !='00.鍙栨秷' group by Delivered_Product__c ]; @@ -1894,6 +2040,9 @@ and Agreed_Date__c != null and Agreed_Date__c > :LastYearDate and Agreed_Date__c <= :today + // DB202302544421 LHJ add + and Status2__c !='00.鍒犻櫎' + and Status2__c !='00.鍙栨秷' group by Delivered_Product__c ]; List<AggregateResult> SecRepairList = [ @@ -1918,6 +2067,9 @@ and Agreed_Date__c != null and Agreed_Date__c <= :LastYearDate and Agreed_Date__c > :LastSecondYearDate + // DB202302544421 LHJ add + and Status2__c !='00.鍒犻櫎' + and Status2__c !='00.鍙栨秷' group by Delivered_Product__c ]; // 杩囧幓3骞撮棿淇悊瀹炵哗 @@ -1943,6 +2095,9 @@ and Agreed_Date__c != null and Agreed_Date__c <= :LastSecondYearDate and Agreed_Date__c > :LastThirdYearDate + // DB202302544421 LHJ add + and Status2__c !='00.鍒犻櫎' + and Status2__c !='00.鍙栨秷' group by Delivered_Product__c ]; // 杩囧幓3骞翠慨鐞嗗疄缁� @@ -1968,6 +2123,9 @@ and Agreed_Date__c != null and Agreed_Date__c <= :today and Agreed_Date__c > :LastThirdYearDate + // DB202302544421 LHJ add + and Status2__c !='00.鍒犻櫎' + and Status2__c !='00.鍙栨秷' group by Delivered_Product__c ]; // 杩囧幓1骞撮棿 @@ -2835,6 +2993,30 @@ return new PageReference('/' + this.targetEstimateId + '/e?completion=4'); } + //璐告槗鍚堣 you start + public PageReference interceptsend(){ + //String BuchangApprovalManager = this.estimate.BuchangApprovalManager__c; + //String JingliApprovalManager = this.estimate.JingliApprovalManager__c; + String fseid = this.estimate.CreatedById; + String AccDealerBlacklist = this.estimate.Maintenance_Contract__r.AccDealerBlacklist__c; + String accname = this.estimate.Maintenance_Contract__r.Hospital__r.Name; + String deaname = this.estimate.Maintenance_Contract__r.Dealer__r.Name; + //FSE棰嗗 + String[] FSEStr = new String[] {}; + //if(String.isNotBlank(BuchangApprovalManager)){ + // FSEStr.add(BuchangApprovalManager); + //} + //if(String.isNotBlank(JingliApprovalManager)){ + // FSEStr.add(JingliApprovalManager); + //} + FSEStr.add(fseid); + + system.debug('==jinlaile====='+FSEStr); + Boolean reflag = OpportunityWebService.accSendEmailFW(AccDealerBlacklist,accname,deaname,this.targetEstimateId,'decide_con',FSEStr); + system.debug('==fawanle====='+FSEStr); + return null; + } + //璐告槗鍚堣 you end /** * Process鐢ㄣ伄銉︺兗銈躲兗鎯呭牨銈掋偦銉冦儓銆佹柊瑕忚绌嶃倐銈婃檪鐢� @@ -3345,6 +3527,26 @@ where Maintenance_Contract__c = :this.estimate.Maintenance_Contract__c]) { delete oldList; } + + //甯傚満澶氬勾淇濅环鏍煎紑鍙� DC 2023/02/08 start + // Map<String,Decimal> contractAssetFZ = new Map<String,Decimal>(); + // List<Maintenance_Contract_Asset__c> oldListMA = new List<Maintenance_Contract_Asset__c>(); + // for (Maintenance_Contract_Asset__c oldmc : [select Id + // // ,Summary_FM_Year__c + // // ,Asset_Consumption_Rate__c + // ,Summary_FZ__c + // ,Asset__c + // // ,Over_FM_Year__c + // // ,Summary_FM_Months__c + // from Maintenance_Contract_Asset__c + // where Maintenance_Contract__c = :this.estimate.Maintenance_Contract__c]) { + // oldListMA.add(oldmc); + // contractAssetFZ.put(oldmc.Asset__c, oldmc.Summary_FZ__c); + // } + // delete oldListMA; + + //甯傚満澶氬勾淇濅环鏍煎紑鍙� DC 2023/02/08 end + // 鈶� start { List<Maintenance_Contract_Asset__c> newValue = new List<Maintenance_Contract_Asset__c>(); @@ -3369,7 +3571,8 @@ from Maintenance_Contract_Asset_Estimate__c where Maintenance_Contract_Estimate__c = :this.estimate.Id and Asset__c <> null]) { - + + Maintenance_Contract_Asset__c newVal = new Maintenance_Contract_Asset__c( Maintenance_Contract__c = this.estimate.Maintenance_Contract__c, Asset__c = target.Asset__c, @@ -3391,13 +3594,22 @@ Surcharge_Defective_Contract__c = target.Surcharge_Defective_Contract__c, //鏁呴殰鍝佸姞璐� 绗笁鏂瑰洖褰掋�佹晠闅滃搧鍔犺垂 鏍囪瘑end + //甯傚満澶氬勾淇濅环鏍煎紑鍙� start DC 2023/02/09 + // Summary_FZ__c = contractAssetFZ.get(target.Asset__c), + //甯傚満澶氬勾淇濅环鏍煎紑鍙� end DC 2023/02/09 + + LastMContract__c = target.Last_MContract__r.RecordType_DeveloperName__c == 'VM_Contract' ? null : target.Last_MContract__c ); + // System.debug(LoggingLevel.INFO, '*** contractAssetFZ.get(target.Asset__c): ' + contractAssetFZ.get(target.Asset__c)); newValue.add(newVal); } if (newValue.size() > 0) insert newValue; } // 鈶� start + // 鎶ヤ环瑙勫垯鏀瑰杽 20230309 start + // this.contract.Is_Blank_period__c = this.Is_Blank_period; + // 鎶ヤ环瑙勫垯鏀瑰杽 20230309 end this.contract.Estimation_Id__c = this.targetEstimateId; this.contract.Contract_Esti_Start_Date__c = this.estimate.Contract_Esti_Start_Date__c; this.contract.Contract_Range__c = this.estimate.Contract_Range__c; @@ -3649,7 +3861,8 @@ // 2021-02-07 gzw add LJPH-BWY5QB start private void setEndUserType(String id) { - this.contract = [SELECT Id, Name, Status__c, Decided_Estimation__c, Service_Contract_Staff__c, + //璐告槗鍚堣 you 20230414 鍔犳煡璇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, VM_Contract_Check__c,Open_RenewalQuotation__c @@ -3662,7 +3875,8 @@ // 2021-02-07 gzw add LJPH-BWY5QB end private void setContractInfo(String id) { - this.contract = [SELECT Id, Name, Status__c, Decided_Estimation__c, Service_Contract_Staff__c, + //璐告槗鍚堣 you 20230414 鍔犳煡璇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, @@ -3797,21 +4011,41 @@ // modify by lc 20220607 澶氬勾淇濈画绛惧拰瀹炵哗杩炲姩鐘舵�佸搴� start Integer noOfDays = today.daysBetween(input.rec.CurrentContract_F_asset__r.endDateGurantee_Text__c); Decimal monthCon = (Decimal)noOfDays/365*12; + + + //甯傚満澶氬勾淇濅慨浠锋牸寮�鍙� DC 2023/02/02 Start 缁撴潫鏃ョ┖鐧芥湡澶т簬6涓湀 鎶ラ敊鎻愮ず 鏂扮殑鍚堝悓鎶ヤ环寮�濮嬫棩鏈熷拰涓婁竴鏈熷悎鍚� + + Date endDate6Month = input.rec.CurrentContract_F_asset__r.endDateGurantee_Text__c.addMonths(6); + Date cotractEndDay = input.rec.CurrentContract_F__r.endDateGurantee__c; + System.debug(LoggingLevel.INFO, '*** endDate6Month: ' + endDate6Month); + System.debug(LoggingLevel.INFO, '*** cotractEndDay: ' + cotractEndDay); + System.debug(LoggingLevel.INFO, '*** this.estimate.Contract_Esti_Start_Date__c: ' + this.estimate.Contract_Esti_Start_Date__c); + if(this.estimate.Contract_Esti_Start_Date__c >endDate6Month && cotractEndDay < this.estimate.Contract_Esti_Start_Date__c){ + System.debug(LoggingLevel.INFO, '*** meet error: ' ); + input.rec.Name.addError(input.rec.Name + '(' + input.rec.SerialNumber + ') -- 甯傚満澶氬勾淇濈粨鏉熷凡瓒呰繃6涓湀锛岀敱浜庣┖鐧芥湡杩囬暱锛岃鍏堣仈绯绘湇鍔$鐞嗛儴璇勪及銆�'); + rtn = false; + } + + //甯傚満澶氬勾淇濅慨浠锋牸寮�鍙� DC 2023/02/02 end + // 鍙紑濮嬫姤浠风殑鏈堟暟闄愬埗 //鍙樻洿澶氬勾淇濈画绛惧紑濮嬫棩 thh 20220315 start //if (input.rec.CurrentContract_F__r.Gurantee_Estimate_startDate__c > Date.today()) { // gzw 20220630 寮�閫氱画绛炬姤浠锋潈闄愬悗锛岃秴杩�6涓湀涔熷彲浠ョ画绛� // 缁鎯呭喌 鈶� 涓婃湡鍚堝悓 Open_RenewalQuotation__c & 6涓湀浠ュ唴 鈶� VM_Contract_Check__c Open_RenewalQuotation__c 2涓兘鎵撻挬 // 鈶� 2涓紑鍏抽兘鎵撳紑 鈶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 + ') -- 娌℃湁缁鎶ヤ环鏉冮檺锛屾垨鑰呰繕娌″埌缁鏃堕棿銆�'); - } - //input.rec.Name.addError(input.rec.Name + '(' + input.rec.SerialNumber + ') -- 娌℃湁缁鎶ヤ环鏉冮檺锛屾垨鑰呰繕娌″埌缁鏃堕棿銆�'); - rtn = false; - } + // 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; @@ -3968,6 +4202,7 @@ public class AssetInfo { // 鏂板悎鍚屽鍝佺‘淇濇彁渚� 褰撳墠鏍囪 public Boolean etGFlg {get; set;} + public String ISStandardPricing{get; set;} public Integer lineNo {get; private set;} public Decimal Repair_Price_Auto {get; set;} public String Agreed_Date{get; set;} @@ -3978,6 +4213,7 @@ public Maintenance_Contract_Estimate__c estimate {get; set;} public Transient Decimal orgPrice {get; private set;} public Transient Decimal orgPrice12 {get; private set;} + public String Blank_period {get; set;} // add by fxk 2021/9/9 鎺у埗鐐规瀵硅薄鏄惁鍙�� Star public Boolean CheckRows {get; private set;} // add by fxk 2021/9/9 鎺у埗鐐规瀵硅薄鏄惁鍙�� End @@ -3998,7 +4234,9 @@ public String AssetModelNoc; public String MDMModelNoc; //2021-11-30 fy add LJPH-C8W8FV 缃《 end - + //甯傚満澶氬勾淇� 浠锋牸寮�鍙� start 2023/01/17 + public String Category; + //甯傚満澶氬勾淇� 浠锋牸寮�鍙� end 2023/01/17 public Id getRecId() { Id rtn = null; if (rec != null) { @@ -4032,8 +4270,16 @@ public AssetInfo(Integer lineNo, Asset record, Boolean isNew, Decimal listPrice, Maintenance_Contract_Asset_Estimate__c mcae,Maintenance_Contract_Estimate__c estimate) { this.lineNo = lineNo; this.rec = record; + this.rec.CurrentContract_End_Date__c = record.CurrentContract_End_Date__c; + // this.rec.CurrentContract_End_Date__c = record.IS_Extend_Gurantee__c ? record.Extend_Gurantee_DateTo__c : record.CurrentContract_End_Date__c; + // this.ISStandardPricing = record.IS_StandardPricing__c; this.estimate = new Maintenance_Contract_Estimate__c(); this.estimate.IS_Reduced_price_approval__c = estimate.IS_Reduced_price_approval__c; + // 鎶ヤ环瑙勫垯鏀瑰杽 20230308 start + // this.estimate.Contract_Esti_Start_Date__c = estimate.Contract_Esti_Start_Date__c; + // this.estimate.renewTen_OFF__c = estimate.renewTen_OFF__c; + // 鎶ヤ环瑙勫垯鏀瑰杽 20230308 end + // (2022骞�12鏈堜笂绾�)鏁呴殰鍝佸姞璐� start // if (record.Asset_situation__c == '淇悊涓�' && record.Return_Without_Repair__r.Agreed_Date__c!=null) { // this.Agreed_Date = '涓嶄负绌�'; @@ -4062,6 +4308,9 @@ Check_Result__c = mcae.Check_Result__c, Repair_Price__c = mcae.Repair_Price__c, Repair_Price_pass__c = mcae.Repair_Price_pass__c, + // 鎶ヤ环瑙勫垯鏀瑰杽 20230308 start + // Blank_period__c = mcae.Blank_period__c, + // 鎶ヤ环瑙勫垯鏀瑰杽 20230308 end Comment__c = mcae.Comment__c, EquipmentGuaranteeFlgTxt__c = mcae.EquipmentGuaranteeFlgTxt__c, Estimate_Cost__c = mcae.Estimate_Cost__c, @@ -4085,6 +4334,17 @@ this.mcae.Repair_Price_pass__c = this.mcae.Repair_Price__c; } } + // 鎶ヤ环瑙勫垯鏀瑰杽 20230308 start + // if (this.estimate.Contract_Esti_Start_Date__c!=null && this.rec.CurrentContract_End_Date__c != null) { + // this.mcae.Blank_period__c = String.valueof(this.rec.CurrentContract_End_Date__c.daysbetween(this.estimate.Contract_Esti_Start_Date__c)); + // } + // if (this.estimate.Contract_Esti_Start_Date__c==null && this.rec.CurrentContract_End_Date__c != null) { + // this.mcae.Blank_period__c = String.valueof(this.rec.CurrentContract_End_Date__c.daysbetween(system.today())); + // } + // if (this.mcae.Blank_period__c!=null&&integer.valueOf(this.mcae.Blank_period__c)<15 ) { + // this.mcae.Blank_period__c = '鏃犵紳缁'; + // } + // 鎶ヤ环瑙勫垯鏀瑰杽 20230308 end this.isManual = false; this.rec_checkBox_c = true; this.orgPrice = record.Maintenance_Price_Month__c; @@ -4100,6 +4360,11 @@ //2021-11-30 fy add LJPH-C8W8FV 缃《 end //add by rentx 2020-11-12 LJPH-BV93RZ end + + //甯傚満澶氬勾淇� 浠锋牸寮�鍙� start 2023/01/17 + this.Category = mcae.Product_Manual__r.Category4__c; + //甯傚満澶氬勾淇� 浠锋牸寮�鍙� end 2023/01/17 + //add by mzy 2021-02-07 start //this.NoPartRiskDate = mcae.Product_Manual__r.NoPartRiskDate_F__c; //this.proName2 = mcae.Product_Manual__r.Name; @@ -4153,6 +4418,10 @@ this.ProductModelNoc = mcae.Product_Manual__r.Asset_Model_No__c; this.AssetModelNoc = mcae.Asset__r.OwnershipMachine_No__c; //2021-11-30 fy add LJPH-C8W8FV 缃《 end + + //甯傚満澶氬勾淇� 浠锋牸寮�鍙� start 2023/01/17 + this.Category = mcae.Product_Manual__r.Category4__c; + //甯傚満澶氬勾淇� 浠锋牸寮�鍙� end 2023/01/17 } // 閬告姙銇曘倢銇亱銇c仧鐢� @@ -4160,11 +4429,6 @@ this.lineNo = lineNo; this.rec = record; // (2022骞�12鏈堜笂绾�)鏁呴殰鍝佸姞璐� start - // if (record.Return_Without_Repair__r.Agreed_Date__c!=null) { - // this.Agreed_Date = '涓嶄负绌�'; - // }else{ - // this.Agreed_Date = '涓虹┖'; - // } if (record.Return_Without_Repair__r.Repair_List_Price_formula__c!=null) { this.Repair_Price_Auto = record.Return_Without_Repair__r.Repair_List_Price_formula__c; } @@ -4177,7 +4441,7 @@ this.proSerialName = record.Name; this.proSerialNumber = record.SerialNumber; } - // public AssetInfo(Integer lineNo, Asset record, Map<String,repair__c> assNewRepMap) { + // public AssetInfo(Integer lineNo, Asset record) { // this.lineNo = lineNo; // this.rec = record; // // (2022骞�12鏈堜笂绾�)鏁呴殰鍝佸姞璐� start -- Gitblit v1.9.1