From 962519811b7c4be07f30d09e791798b0ea79d3ae Mon Sep 17 00:00:00 2001
From: 黄千龙 <huangqianlong@prec-tech.com>
Date: 星期三, 08 三月 2023 09:54:02 +0800
Subject: [PATCH] 同步代码
---
force-app/main/default/classes/SelectAssetEstimateVMController.cls | 380 +++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 260 insertions(+), 120 deletions(-)
diff --git a/force-app/main/default/classes/SelectAssetEstimateVMController.cls b/force-app/main/default/classes/SelectAssetEstimateVMController.cls
index 9216d38..68a4d7a 100644
--- a/force-app/main/default/classes/SelectAssetEstimateVMController.cls
+++ b/force-app/main/default/classes/SelectAssetEstimateVMController.cls
@@ -121,8 +121,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
@@ -161,7 +162,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
@@ -180,33 +209,33 @@
}
}
}
- public Map<String,repair__c> getNewrep(List<Asset> assetRecords) {
- List<String> assnoList = new List<String>();
- // 鏁呴殰鍝佸姞璐�20221226
- for (Asset ast : assetRecords) {
- if (ast.Return_Without_Repair__r.Agreed_Date__c == null) {
- if (!assnoList.contains(ast.id)) {
- assnoList.add(ast.id);
- }
- }
- }
- List<repair__c> repairs2 = [SELECT Id,name,Repair_List_Price_formula__c,Delivered_Product__r.id ,CreatedDate
- FROM repair__c
- WHERE Delivered_Product__c in :assnoList order by Delivered_Product__c ,CreatedDate desc];
- Map<String,repair__c> assNewRepMap = new Map<String,repair__c>();
- for (repair__c rep : repairs2) {
- if (assNewRepMap.get(rep.Delivered_Product__r.id)==null){
- assNewRepMap.put(rep.Delivered_Product__r.id,rep);
- }
- if (assNewRepMap.get(rep.Delivered_Product__r.id)!=null) {
- if (assNewRepMap.get(rep.Delivered_Product__r.id).CreatedDate < rep.CreatedDate) {
- assNewRepMap.remove(rep.Delivered_Product__r.id);
- assNewRepMap.put(rep.Delivered_Product__r.id,rep);
- }
- }
- }
- return assNewRepMap;
- }
+ // public Map<String,repair__c> getNewrep(List<Asset> assetRecords) {
+ // List<String> assnoList = new List<String>();
+ // // 鏁呴殰鍝佸姞璐�20221226
+ // for (Asset ast : assetRecords) {
+ // if (ast.Return_Without_Repair__r.Agreed_Date__c == null) {
+ // if (!assnoList.contains(ast.id)) {
+ // assnoList.add(ast.id);
+ // }
+ // }
+ // }
+ // List<repair__c> repairs2 = [SELECT Id,name,Repair_List_Price_formula__c,Delivered_Product__r.id ,CreatedDate
+ // FROM repair__c
+ // WHERE Delivered_Product__c in :assnoList order by Delivered_Product__c ,CreatedDate desc];
+ // Map<String,repair__c> assNewRepMap = new Map<String,repair__c>();
+ // for (repair__c rep : repairs2) {
+ // if (assNewRepMap.get(rep.Delivered_Product__r.id)==null){
+ // assNewRepMap.put(rep.Delivered_Product__r.id,rep);
+ // }
+ // if (assNewRepMap.get(rep.Delivered_Product__r.id)!=null) {
+ // if (assNewRepMap.get(rep.Delivered_Product__r.id).CreatedDate < rep.CreatedDate) {
+ // assNewRepMap.remove(rep.Delivered_Product__r.id);
+ // assNewRepMap.put(rep.Delivered_Product__r.id,rep);
+ // }
+ // }
+ // }
+ // return assNewRepMap;
+ // }
public void NextMaintenanceContract() {
// 20220810 璇环2鏈熷紑鍙�
List<String> asslocalList = new List<String>();
@@ -270,8 +299,8 @@
}
SELECT_LIMIT = selctRecordNum;
Integer selectCnt = unCheckedAssets.size();
- Map<String,repair__c> assNewRepMap = new Map<String,repair__c>();
- assNewRepMap = getNewrep(assetList);
+ // Map<String,repair__c> assNewRepMap = new Map<String,repair__c>();
+ // assNewRepMap = getNewrep(assetList);
num++;
num++;
for (Asset asset : assetList) {
@@ -279,7 +308,7 @@
if (unCheckedAssets.size() >= SELECT_LIMIT) { overLimit = true; break; }
if (markUpUnCheckMap.containsKey(asset.Id) == false) {
//unCheckedInfoList.add(unCheckMap.get(asset.Id));
- unCheckedAssets.add(new AssetInfo(unCheckedAssets.size(), asset,assNewRepMap));
+ unCheckedAssets.add(new AssetInfo(unCheckedAssets.size(), asset));
}
}
}
@@ -363,7 +392,9 @@
//URF闄愭鍚堝悓2鏈� LY 20220811 end
//澶氬勾淇濊澶囩画绛捐绠楅�昏緫璋冩暣 2022/12/14 start 娑堣垂鐜�
- +'CurrentContract_F_asset__r.Asset_Consumption_Rate__c,Product2.Category4__c,Product2.Asset_Model_No__c,'
+ +'CurrentContract_F_asset__r.Asset_Consumption_Rate__c,Product2.Category4__c,Product2.Asset_Model_No__c,CurrentContract_F_asset__r.Maintenance_Price_Year__c,'
+ +'CurrentContract_F_asset__r.IS_VMContract_Asset__c,'
+ +'CurrentContract_F__r.endDateGurantee__c,'
//澶氬勾淇濊澶囩画绛捐绠楅�昏緫璋冩暣 2022/12/14 end
+ 'CurrentContract_End_Date__c, Extend_Gurantee_DateTo__c,EquipmentGuaranteeFlg__c,AssetMark__c,NoPartRiskDate_F__c,NoPartRiskDate__c,SignableFlag__c FROM Asset WHERE Hospital__c = \'' + this.targetHospitalId + '\' ';
@@ -597,6 +628,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 +669,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 +762,7 @@
public Boolean isSaveOrApproval {get; set;}
public String OldContractStartDate {get; set;}
public String OldMaintenancePrice { get; set; }
+ public Decimal OldLimitPrice { get; set; }
/**
* 銈炽兂銈广儓銉┿偗銈�
@@ -766,9 +814,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
+ //涓婇檺鍚堝悓 20230103 hql start
,Limit_Price_Amount__c
- //涓婇檺鍚堝悓 20230103 LY end
+ //涓婇檺鍚堝悓 20230103 hql end
, LastMContract1__c, LastMContract2__c, LastMContract3__c, LastMContract4__c, LastMContract5__c
, LastMContract1_ConCount__c, LastMContract2_ConCount__c, LastMContract3_ConCount__c, LastMContract4_ConCount__c, LastMContract5_ConCount__c,
LastMContract1_NO__c, LastMContract2_NO__c, LastMContract3_NO__c, LastMContract4_NO__c, LastMContract5_NO__c
@@ -797,6 +845,7 @@
//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 +894,7 @@
isSaveOrApproval = false;
OldContractStartDate = null;
OldMaintenancePrice = null;
-
+ OldLimitPrice = null;
inDicideFlag = false;
isSoft = false;
@@ -903,6 +952,7 @@
}
this.targetMaintenanceContractId = ApexPages.currentPage().getParameters().get('mcid');
}
+
// 绶ㄩ泦銇嬨倝
if (String.isBlank(this.targetEstimateId) == false) {
setThisEstimate();
@@ -983,8 +1033,11 @@
//澶氬勾淇濊澶囩画绛捐绠楅�昏緫璋冩暣 2023/1/17 start
,CurrentContract_F_asset__r.Asset_Consumption_Rate__c
+ ,CurrentContract_F_asset__r.Maintenance_Price_Year__c
+ ,CurrentContract_F_asset__r.IS_VMContract_Asset__c
,Product2.Asset_Model_No__c
,Product2.Category4__c
+ ,CurrentContract_F__r.endDateGurantee__c
//澶氬勾淇濊澶囩画绛捐绠楅�昏緫璋冩暣 2023/1/17 end
FROM Asset WHERE Hospital__c = :this.targetHospitalId AND ( AssetMark__c != '鑰楁潗' OR Product2.Family != 'ET' ) ORDER BY ID, IF_Warranty_Service__c asc];
//JZHG-BSDUT4 ---20200825---update By rentongxiao---Start
@@ -1003,7 +1056,14 @@
//sqlStr += ' AND AssetMark__c != \'鑰楁潗\' AND Product2.Family != \'ET\' ';
this.checkedAssets = new List<AssetInfo>();
this.unCheckedAssets = new List<AssetInfo>();
-
+ // 涓婇檺鍚堝悓 hql 20230216 start
+ Boolean isLimitPriceOne = [SELECT id,Limit_Price__c FROM Maintenance_Contract__c WHERE Id =: this.targetMaintenanceContractId].Limit_Price__c;
+ if(isLimitPriceOne){
+ this.isLimitPrice = true;
+ }else{
+ this.isLimitPrice = false;
+ }
+ // 涓婇檺鍚堝悓 hql 20230216 start
// 閬告姙娓堛伩銇磵鍏ユ鍣ㄦ儏鍫便倰鍙栧緱
Map<Id, Integer> selectedAssetIds = new Map<Id, Integer>();
List<Maintenance_Contract_Asset_Estimate__c> selectedMcaes = new List<Maintenance_Contract_Asset_Estimate__c>();
@@ -1018,8 +1078,11 @@
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,
@@ -1139,6 +1202,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,
@@ -1187,6 +1251,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,
@@ -1208,6 +1275,9 @@
,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
@@ -1255,8 +1325,8 @@
// 鈶sset銈掑厓銇儑銉笺偪銈掋優銉冦償銉炽偘銇欍倠鏅傘�佹槑绱般優銉冦儣銇嬨倝AssetA銈掑彇寰椼仹銇嶃仾銇�?涓�瑕с伀鏄庣窗A銇屽嚭銇亜
// 娆″洖銆丄sset銇绱㈡潯浠躲亴澶с亶銇忓鏇淬仚銈嬫檪銆佸蹇滃繀瑕�
List<Data> datatemp = new List<Data>();
- Map<String,repair__c> assNewRepMap = new Map<String,repair__c>();
- assNewRepMap = getNewrep(this.assetRecords);
+ // Map<String,repair__c> assNewRepMap = new Map<String,repair__c>();
+ // assNewRepMap = getNewrep(this.assetRecords);
datatemp = getChartData();
for (Asset ast : this.assetRecords) {
Boolean isNew = false;
@@ -1314,13 +1384,13 @@
//
//
//
- checkedAssets.add(new AssetInfo(checkedAssets.size(), ast, isNew, listPrice, selectedLocal,estimate,assNewRepMap));
+ checkedAssets.add(new AssetInfo(checkedAssets.size(), ast, isNew, listPrice, selectedLocal,estimate));
} else {
//update by rentongxiao 2020-09-23 start
if (ast.AssetMark__c == '涓绘満') {
totalRecords++;
if (unCheckedAssets.size() < selctRecordNum) {
- unCheckedAssets.add(new AssetInfo(unCheckedAssets.size(), ast,assNewRepMap));
+ unCheckedAssets.add(new AssetInfo(unCheckedAssets.size(), ast));
}
}
//update by rentongxiao 2020-09-23 end
@@ -1433,11 +1503,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 璁惧娑堣垂鐜� 浜у搧鍨嬪彿 绗洓鍒嗙被
+ //甯傚満澶氬勾淇濅环鏍煎紑鍙� start DC 2023/01/17 璁惧娑堣垂鐜� 浜у搧鍨嬪彿 绗洓鍒嗙被 鏄惁涓哄骞翠繚璁惧
+ 'CurrentContract_F_asset__r.Asset_Consumption_Rate__c,'
+ + 'CurrentContract_F_asset__r.Maintenance_Price_Year__c,'
+ + 'CurrentContract_F_asset__r.IS_VMContract_Asset__c,'
+ 'Product2.Asset_Model_No__c,'
+ 'Product2.Category4__c,'
- //甯傚満澶氬勾淇濅环鏍煎紑鍙� start DC 2023/01/17
+ + 'CurrentContract_F__r.endDateGurantee__c,'
+ //甯傚満澶氬勾淇濅环鏍煎紑鍙� end DC 2023/01/17
+ 'Product2.ProductURF__c,CurrentContract_F__r.Contract_Range__c,AssetMark__c,NoPartRiskDate__c,NoPartRiskDate_F__c,Product2.PartSupplyFinishDate__c,SignableFlag__c FROM Asset WHERE Hospital__c = \'' + this.targetHospitalId + '\' '
+ 'AND Id NOT IN ' + notInId;
//HWAG-B4R3SS START 20181026
@@ -1496,7 +1569,7 @@
//URF闄愭鍚堝悓2鏈� LY 20220811 end
//甯傚満澶氬勾淇濅环鏍煎紑鍙� start DC 2023/01/17 璁惧娑堣垂鐜�
- sqlStr += 'CurrentContract_F_asset__r.Asset_Consumption_Rate__c,Asset__r.Product2.Asset_Model_No__c,Asset__r.Product2.Category4__c,';
+ sqlStr += 'CurrentContract_F_asset__r.Asset_Consumption_Rate__c,CurrentContract_F_asset__r.IS_VMContract_Asset__c,CurrentContract_F_asset__r.Maintenance_Price_Year__c,Product2.Asset_Model_No__c,Product2.Category4__c,CurrentContract_F__r.endDateGurantee__c,';
//甯傚満澶氬勾淇濅环鏍煎紑鍙� start DC 2023/01/17
sqlStr += ' CurrentContract_F__r.Contract_Range__c,AssetMark__c,NoPartRiskDate__c,NoPartRiskDate_F__c,Product2.PartSupplyFinishDate__c,SignableFlag__c FROM Asset WHERE Hospital__c = \'' + this.targetHospitalId + '\'';
@@ -1542,10 +1615,10 @@
}
}
this.unCheckedAssets = new List<AssetInfo>();
- Map<String,repair__c> assNewRepMap = new Map<String,repair__c>();
- assNewRepMap = getNewrep(this.assetRecords);
+ // Map<String,repair__c> assNewRepMap = new Map<String,repair__c>();
+ // assNewRepMap = getNewrep(this.assetRecords);
for (Asset ast : assetRecords) {
- this.unCheckedAssets.add(new AssetInfo(unCheckedAssets.size(), ast,assNewRepMap));
+ this.unCheckedAssets.add(new AssetInfo(unCheckedAssets.size(), ast));
}
listCut(unCheckedAssets);
// 鏍规嵁鍚堝悓寮�濮嬫棩閲嶆柊璁$畻缁翠慨鍚堝悓浠锋牸
@@ -1684,7 +1757,7 @@
// 20191210 Gzw 鏈嶅姟鍚堝悓杩囧幓3骞翠慨鐞嗗疄缁╁悎骞�
List<AggregateResult> FriRepairList = [
select
- sum(Repair_List_Price_formula__c) SumPrice,
+ sum(Discount_Price_formula__c) SumPrice,
//2019/1娣诲姞
sum(Repair_Quotation_Id__r.sales_discount__c) sales_discount,
sum(Repair_Quotation_Id__r.Contract_target__c) contract_target,
@@ -1704,11 +1777,14 @@
and Agreed_Date__c != null
and Agreed_Date__c > :LastYearDate
and Agreed_Date__c <= :today
+ // DB202302544421 LHJ add
+ and Status2__c !='00.鍒犻櫎'
+ and Status2__c !='00.鍙栨秷'
group by Delivered_Product__c
];
List<AggregateResult> SecRepairList = [
select
- sum(Repair_List_Price_formula__c) SumPrice,
+ sum(Discount_Price_formula__c) SumPrice,
//2019/1娣诲姞
sum(Repair_Quotation_Id__r.sales_discount__c) sales_discount,
sum(Repair_Quotation_Id__r.Contract_target__c) contract_target,
@@ -1728,12 +1804,15 @@
and Agreed_Date__c != null
and Agreed_Date__c <= :LastYearDate
and Agreed_Date__c > :LastSecondYearDate
+ // DB202302544421 LHJ add
+ and Status2__c !='00.鍒犻櫎'
+ and Status2__c !='00.鍙栨秷'
group by Delivered_Product__c
];
// 杩囧幓3骞撮棿淇悊瀹炵哗
List<AggregateResult> ThiRepairList = [
select
- sum(Repair_List_Price_formula__c) SumPrice,
+ sum(Discount_Price_formula__c) SumPrice,
//2019/1娣诲姞
sum(Repair_Quotation_Id__r.sales_discount__c) sales_discount,
sum(Repair_Quotation_Id__r.Contract_target__c) contract_target,
@@ -1753,12 +1832,15 @@
and Agreed_Date__c != null
and Agreed_Date__c <= :LastSecondYearDate
and Agreed_Date__c > :LastThirdYearDate
+ // DB202302544421 LHJ add
+ and Status2__c !='00.鍒犻櫎'
+ and Status2__c !='00.鍙栨秷'
group by Delivered_Product__c
];
// 杩囧幓3骞翠慨鐞嗗疄缁�
List<AggregateResult> ThreeyearList = [
select
- sum(Repair_List_Price_formula__c) SumPrice,
+ sum(Discount_Price_formula__c) SumPrice,
//2019/1娣诲姞
sum(Repair_Quotation_Id__r.sales_discount__c) sales_discount,
sum(Repair_Quotation_Id__r.Contract_target__c) contract_target,
@@ -1778,6 +1860,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
];
@@ -1899,7 +1984,7 @@
// 20191210 Gzw 鏈嶅姟鍚堝悓杩囧幓3骞翠慨鐞嗗疄缁╁悎骞�
List<AggregateResult> FriRepairList = [
select
- sum(Repair_List_Price_formula__c) SumPrice,
+ sum(Discount_Price_formula__c) SumPrice,
//2019/1娣诲姞
sum(Repair_Quotation_Id__r.sales_discount__c) sales_discount,
sum(Repair_Quotation_Id__r.Contract_target__c) contract_target,
@@ -1919,11 +2004,14 @@
and Agreed_Date__c != null
and Agreed_Date__c > :LastYearDate
and Agreed_Date__c <= :today
+ // DB202302544421 LHJ add
+ and Status2__c !='00.鍒犻櫎'
+ and Status2__c !='00.鍙栨秷'
group by Delivered_Product__c
];
List<AggregateResult> SecRepairList = [
select
- sum(Repair_List_Price_formula__c) SumPrice,
+ sum(Discount_Price_formula__c) SumPrice,
//2019/1娣诲姞
sum(Repair_Quotation_Id__r.sales_discount__c) sales_discount,
sum(Repair_Quotation_Id__r.Contract_target__c) contract_target,
@@ -1943,12 +2031,15 @@
and Agreed_Date__c != null
and Agreed_Date__c <= :LastYearDate
and Agreed_Date__c > :LastSecondYearDate
+ // DB202302544421 LHJ add
+ and Status2__c !='00.鍒犻櫎'
+ and Status2__c !='00.鍙栨秷'
group by Delivered_Product__c
];
// 杩囧幓3骞撮棿淇悊瀹炵哗
List<AggregateResult> ThiRepairList = [
select
- sum(Repair_List_Price_formula__c) SumPrice,
+ sum(Discount_Price_formula__c) SumPrice,
//2019/1娣诲姞
sum(Repair_Quotation_Id__r.sales_discount__c) sales_discount,
sum(Repair_Quotation_Id__r.Contract_target__c) contract_target,
@@ -1968,12 +2059,15 @@
and Agreed_Date__c != null
and Agreed_Date__c <= :LastSecondYearDate
and Agreed_Date__c > :LastThirdYearDate
+ // DB202302544421 LHJ add
+ and Status2__c !='00.鍒犻櫎'
+ and Status2__c !='00.鍙栨秷'
group by Delivered_Product__c
];
// 杩囧幓3骞翠慨鐞嗗疄缁�
List<AggregateResult> ThreeyearList = [
select
- sum(Repair_List_Price_formula__c) SumPrice,
+ sum(Discount_Price_formula__c) SumPrice,
//2019/1娣诲姞
sum(Repair_Quotation_Id__r.sales_discount__c) sales_discount,
sum(Repair_Quotation_Id__r.Contract_target__c) contract_target,
@@ -1993,6 +2087,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骞撮棿
@@ -3370,6 +3467,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>();
@@ -3394,7 +3511,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,
@@ -3416,8 +3534,14 @@
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;
@@ -3798,23 +3922,23 @@
//2.涓�骞翠互涓婄殑鍚堝悓锛屽湪缁撴潫鍓�6涓湀寮�濮嬪彲浠ュ紑鏀剧画绛炬姤浠枫��
//3.绠$悊鍛樿烦杩囷紝
//WLIG-CDFBV3 寮�閫氱画绛炬姤浠蜂负true鐨勫彲浠ュ紑鏀剧画绛炬姤浠� thh 20220413
- if (input.rec.CurrentContract_F__r.Open_RenewalQuotation__c == false && UserInfo.getProfileId() != System.Label.ProfileId_SystemAdmin &&
- String.isNotBlank(input.rec.CurrentContract_F__c) && input.rec.CurrentContract_F__r.RecordType_DeveloperName__c != 'VM_Contract') {
+ // if (input.rec.CurrentContract_F__r.Open_RenewalQuotation__c == false && UserInfo.getProfileId() != System.Label.ProfileId_SystemAdmin &&
+ // String.isNotBlank(input.rec.CurrentContract_F__c) && input.rec.CurrentContract_F__r.RecordType_DeveloperName__c != 'VM_Contract') {
- Integer noOfDays = today.daysBetween(input.rec.CurrentContract_F__r.Contract_End_Date__c);
- Decimal monthCon = (Decimal)noOfDays / 365 * 12;
- // 鍙紑濮嬫姤浠风殑鏈堟暟闄愬埗
- if (input.rec.CurrentContract_F__r.Contract_Range__c >= 12 && monthCon > 6) {
- input.rec.Name.addError(input.rec.Name + '(' + input.rec.SerialNumber + ') -- 鍚堝悓缁撴潫鍓�6涓湀寮�濮嬪彲浠ュ埗浣滄姤浠枫��');
- rtn = false;
- }
- //ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO, '---' + monthCon + ' +++ ' + Math.floor(input.rec.CurrentContract_F__r.Contract_Range__c/2)));
- //rtn = false;
- if (input.rec.CurrentContract_F__r.Contract_Range__c < 12 && monthCon > Math.floor(input.rec.CurrentContract_F__r.Contract_Range__c / 2)) {
- input.rec.Name.addError(input.rec.Name + '(' + input.rec.SerialNumber + ') -- 缁忓巻鏈堟暟杩囧崐鏂瑰彲鍒朵綔鎶ヤ环');
- rtn = false;
- }
- }
+ // Integer noOfDays = today.daysBetween(input.rec.CurrentContract_F__r.Contract_End_Date__c);
+ // Decimal monthCon = (Decimal)noOfDays / 365 * 12;
+ // // 鍙紑濮嬫姤浠风殑鏈堟暟闄愬埗
+ // if (input.rec.CurrentContract_F__r.Contract_Range__c >= 12 && monthCon > 6) {
+ // input.rec.Name.addError(input.rec.Name + '(' + input.rec.SerialNumber + ') -- 鍚堝悓缁撴潫鍓�6涓湀寮�濮嬪彲浠ュ埗浣滄姤浠枫��');
+ // rtn = false;
+ // }
+ // //ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO, '---' + monthCon + ' +++ ' + Math.floor(input.rec.CurrentContract_F__r.Contract_Range__c/2)));
+ // //rtn = false;
+ // if (input.rec.CurrentContract_F__r.Contract_Range__c < 12 && monthCon > Math.floor(input.rec.CurrentContract_F__r.Contract_Range__c / 2)) {
+ // input.rec.Name.addError(input.rec.Name + '(' + input.rec.SerialNumber + ') -- 缁忓巻鏈堟暟杩囧崐鏂瑰彲鍒朵綔鎶ヤ环');
+ // rtn = false;
+ // }
+ // }
// 澶氬勾淇濆垽鏂�
if ( String.isNotBlank(input.rec.CurrentContract_F__c) && input.rec.CurrentContract_F__r.RecordType_DeveloperName__c == 'VM_Contract') {
//if (UserInfo.getProfileId() != System.Label.ProfileId_SystemAdmin && String.isNotBlank(input.rec.CurrentContract_F__c) && input.rec.CurrentContract_F__r.RecordType_DeveloperName__c == 'VM_Contract') {
@@ -3822,21 +3946,39 @@
// modify by lc 20220607 澶氬勾淇濈画绛惧拰瀹炵哗杩炲姩鐘舵�佸搴� start
Integer noOfDays = today.daysBetween(input.rec.CurrentContract_F_asset__r.endDateGurantee_Text__c);
Decimal monthCon = (Decimal)noOfDays/365*12;
+
+
+ //甯傚満澶氬勾淇濅慨浠锋牸寮�鍙� DC 2023/02/02 Start 缁撴潫鏃ョ┖鐧芥湡澶т簬6涓湀 鎶ラ敊鎻愮ず
+
+ Date endDate6Month = input.rec.CurrentContract_F_asset__r.endDateGurantee_Text__c.addMonths(6);
+ Date cotractEndDay = input.rec.CurrentContract_F__r.endDateGurantee__c;
+
+
+ if(today>endDate6Month && cotractEndDay <today){
+ input.rec.Name.addError(input.rec.Name + '(' + input.rec.SerialNumber + ') -- 寤鸿绌虹櫧鏈熸帶鍒跺湪1涓湀浠ュ唴锛屽涓嶅緱宸辩┖鐧芥湡鍦�6涓湀浠ヤ笂锛岃鍏堣仈缁滄湇鍔$鐞嗛儴璇勪及銆�');
+
+ }
+
+ //甯傚満澶氬勾淇濅慨浠锋牸寮�鍙� DC 2023/02/02 end
+
// 鍙紑濮嬫姤浠风殑鏈堟暟闄愬埗
//鍙樻洿澶氬勾淇濈画绛惧紑濮嬫棩 thh 20220315 start
//if (input.rec.CurrentContract_F__r.Gurantee_Estimate_startDate__c > Date.today()) {
// gzw 20220630 寮�閫氱画绛炬姤浠锋潈闄愬悗锛岃秴杩�6涓湀涔熷彲浠ョ画绛�
// 缁鎯呭喌 鈶� 涓婃湡鍚堝悓 Open_RenewalQuotation__c & 6涓湀浠ュ唴 鈶� VM_Contract_Check__c Open_RenewalQuotation__c 2涓兘鎵撻挬
// 鈶� 2涓紑鍏抽兘鎵撳紑 鈶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;
@@ -3993,6 +4135,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;}
@@ -4056,9 +4199,10 @@
// add by fxk 2021/9/9 鎺у埗鐐规瀵硅薄鏄惁鍙�� End
}
// 閬告姙銇曘倢銇熺敤锛堥潪Manual锛�
- public AssetInfo(Integer lineNo, Asset record, Boolean isNew, Decimal listPrice, Maintenance_Contract_Asset_Estimate__c mcae,Maintenance_Contract_Estimate__c estimate, Map<String,repair__c> assNewRepMap) {
+ public AssetInfo(Integer lineNo, Asset record, Boolean isNew, Decimal listPrice, Maintenance_Contract_Asset_Estimate__c mcae,Maintenance_Contract_Estimate__c estimate) {
this.lineNo = lineNo;
this.rec = record;
+ this.ISStandardPricing = mcae.IS_StandardPricing__c;
this.estimate = new Maintenance_Contract_Estimate__c();
this.estimate.IS_Reduced_price_approval__c = estimate.IS_Reduced_price_approval__c;
// (2022骞�12鏈堜笂绾�)鏁呴殰鍝佸姞璐� start
@@ -4104,7 +4248,7 @@
//(2022骞�12鏈堜笂绾�)鏁呴殰鍝佸姞璐� 绗笁鏂瑰洖褰�
Third_Party_Return__c = mcae.Third_Party_Return__c
);
- if ((this.mcae.Repair_Price__c==null&&this.Repair_Price_Auto!=null)||(this.estimate.IS_Reduced_price_approval__c == '鍚�')) {
+ if ((this.mcae.Repair_Price__c==null&&this.Repair_Price_Auto!=null&&this.rec.Reson_Can_not_Warranty__c!=null&&this.rec.Reson_Can_not_Warranty__c.indexof('寮冧慨')!=-1)||(this.estimate.IS_Reduced_price_approval__c == '鍚�')) {
this.mcae.Repair_Price__c = this.Repair_Price_Auto;
}
if (this.estimate.IS_Reduced_price_approval__c=='鏄�'||this.estimate.IS_Reduced_price_approval__c==null) {
@@ -4142,6 +4286,7 @@
public AssetInfo(Integer lineNo, Maintenance_Contract_Asset_Estimate__c mcae) {
this.lineNo = lineNo;
this.rec = null;
+ this.ISStandardPricing = mcae.IS_StandardPricing__c;
this.mcae = new Maintenance_Contract_Asset_Estimate__c(
// id = mcae.Id, // 鏈綋銇亜銈夈仾銇勩伄锛� 銈汇儍銉堛仐銇熴倝銆佹柊瑕忔ī闄愩亴銇亸銇с倐銆佹洿鏂般仹銇嶃伨銇欍�傚緦钘ゃ仌銈撱伀纰鸿獚銇椼仧銆併仾銇忋仹銈傘亜銇勩仹銇欍��
isNew__c = mcae.IsNew__c,
@@ -4196,11 +4341,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;
}
@@ -4213,34 +4353,34 @@
this.proSerialName = record.Name;
this.proSerialNumber = record.SerialNumber;
}
- public AssetInfo(Integer lineNo, Asset record, Map<String,repair__c> assNewRepMap) {
- this.lineNo = lineNo;
- this.rec = record;
- // (2022骞�12鏈堜笂绾�)鏁呴殰鍝佸姞璐� start
- // if (record.Asset_situation__c == '淇悊涓�' && record.Return_Without_Repair__r.Agreed_Date__c!=null) {
- // this.Agreed_Date = '涓嶄负绌�';
- // }
- // if (record.Asset_situation__c == '淇悊涓�' && record.Return_Without_Repair__r.Agreed_Date__c==null) {
- // this.Agreed_Date = '涓虹┖';
- // if (assNewRepMap.get(record.id)!=null) {
- // this.Repair_Price_Auto = assNewRepMap.get(record.id).Repair_List_Price_formula__c;
- // }
- // }
- // if (record.Return_Without_Repair__r.Repair_List_Price_formula__c!=null&&record.Asset_situation__c != '淇悊涓�') {
- // 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;
- }
+ // 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) {
--
Gitblit v1.9.1