From dc6cc6f10fe0a5718ea71033dd39898471eabc3e Mon Sep 17 00:00:00 2001
From: twysparks <twysparks@163.com>
Date: 星期四, 20 四月 2023 14:07:25 +0800
Subject: [PATCH] TT
---
force-app/main/default/classes/otherButtonRepairController.cls | 231 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 229 insertions(+), 2 deletions(-)
diff --git a/force-app/main/default/classes/otherButtonRepairController.cls b/force-app/main/default/classes/otherButtonRepairController.cls
index f244964..7e007a7 100644
--- a/force-app/main/default/classes/otherButtonRepairController.cls
+++ b/force-app/main/default/classes/otherButtonRepairController.cls
@@ -7,13 +7,40 @@
public static InitData init(String recordId){
InitData res = new initData();
try{
- Repair__c report = [SELECT Status1__c,Rental_Apply_Equipment_Set_Detail__c,Rental_Apply_Equipment_Set_Detail_Id__c,Latest_Collect_Date_Priority__c,if_Rental_Apply__c,Offer_Rental_New__c,ProduceCompany_hand__c,CFDA_No_Hand__c,MBC_AwareDate__c,InsReport__c,QIS_ID__c,On_Call_ID__c,RepairSubOrder__c,ProductFailureRelated__c,Delay15Min__c,ProblemOccurredSelect__c,Repair_Source__c ,Failure_Occurrence_Date__c ,MaintenanceContractType__c ,OperationOrExaminationName__c ,WhatProject__c ,FailureQInHospital__c ,ReportAdverseEvents__c ,InformationFrom__c ,AfterFailureInformation__c ,ProblemOccurred__c ,SupportingProducts__c ,ifDeadHurt__c ,UseFailProductFinish__c ,DelayReportReason__c ,BreakORFallOff__c ,DateReceiptQuestions__c ,DeliveryLogisticsAnnotation__c ,DeliveryLogisticsNo__c ,engineerSendDate__c ,DeliveryLogisticsMode__c ,RepairApplicantDepartment__c ,RepairApplicantHospital__c ,RepairApplicant__c ,Repair_Detail__c ,Returns_Product_way__c ,work_location_select__c ,On_site_repair__c ,SalesOfficeCode_selection__c ,Incharge_Staff_Contact__c ,Incharge_Staff__c ,Dealer__c ,RepairCostType__c ,Account__c,Department_Class__c ,Hospital__c ,PaperRepairRequestNo__c ,part_arrangement_complete__c,Repair_Shipped_Date__c,OCSMAdministrativeReportStatus__c,Incharge_Staff_Email__c,Name,HP_Name__c,Delivered_Product__c,
+ Repair__c report = [SELECT AWS_Data_Id__c,SAP_condition__c,DOJ_Status__c,DW_Sign__c,Incharge_Staff__r.Id,URF_Reapir__c,Recall_Correspondence__c,Day_later_30__c,Dealer__r.Id,Status__c,URFLimitSerial__c,Maintenance_Contract__r.Id,FSE_ApplyForRepair_time__c,Delivered_Product__r.Id,Asset_Owner__c,State_Hospital__c,is_aohui_product__c,Sales_Dept_HP__c,RCCD__c,Quick_Repair_Sign__c,RepairSource__c,FSE_State__c,VM_Maintenance_Contract__c,Maintenance_Contract__c,NewProductGuarante_Txt__c,Number_of_EffectiveContract__c,Detailed_Address__c,Status1__c,Rental_Apply_Equipment_Set_Detail__c,Rental_Apply_Equipment_Set_Detail_Id__c,Latest_Collect_Date_Priority__c,if_Rental_Apply__c,Offer_Rental_New__c,ProduceCompany_hand__c,CFDA_No_Hand__c,MBC_AwareDate__c,InsReport__c,QIS_ID__c,On_Call_ID__c,RepairSubOrder__c,ProductFailureRelated__c,Delay15Min__c,ProblemOccurredSelect__c,Repair_Source__c ,Failure_Occurrence_Date__c ,MaintenanceContractType__c ,OperationOrExaminationName__c ,WhatProject__c ,FailureQInHospital__c ,ReportAdverseEvents__c ,InformationFrom__c ,AfterFailureInformation__c ,ProblemOccurred__c ,SupportingProducts__c ,ifDeadHurt__c ,UseFailProductFinish__c ,DelayReportReason__c ,BreakORFallOff__c ,DateReceiptQuestions__c ,DeliveryLogisticsAnnotation__c ,DeliveryLogisticsNo__c ,engineerSendDate__c ,DeliveryLogisticsMode__c ,RepairApplicantDepartment__c ,RepairApplicantHospital__c ,RepairApplicant__c ,Repair_Detail__c ,Returns_Product_way__c ,work_location_select__c ,On_site_repair__c ,SalesOfficeCode_selection__c ,Incharge_Staff_Contact__c ,Incharge_Staff__c ,Dealer__c ,RepairCostType__c ,Account__c,Department_Class__c ,Hospital__c ,PaperRepairRequestNo__c ,part_arrangement_complete__c,Repair_Shipped_Date__c,OCSMAdministrativeReportStatus__c,Incharge_Staff_Email__c,Name,HP_Name__c,Delivered_Product__c,
Repair_Product_Serial_No__c,Service_Repair_No__c,Repair_Firstestimated_Date__c,
Repair_Estimated_Date__c,RC_information__c,Id,OCSMAdministrativeReportNumber__c,
OCSMAdministrativeReportDate__c,Aware_date__c,PAE_Determine__c,ETQ_UPLOAD_STATUS__c,
AE_DetermineResult__c,PAE_DetermineAC__c,Repair_Inspection_Date__c,Contain_UseRSA__c FROM Repair__c WHERE Id =: recordId LIMIT 1];
System.debug(LoggingLevel.INFO, '*** opp: ' + report);
-
+ res.detailedAddress = report.Detailed_Address__c;
+ res.numberofEffectiveContract = report.Number_of_EffectiveContract__c;
+ res.newProductGuaranteTxt = report.NewProductGuarante_Txt__c;
+ res.maintenanceContract = report.Maintenance_Contract__c;
+ res.VMMaintenanceContract = report.VM_Maintenance_Contract__c;
+ res.FSEState = report.FSE_State__c;
+ res.repairSource = report.RepairSource__c;
+ res.quickRepairSign = report.Quick_Repair_Sign__c;
+ res.RCCD = report.RCCD__c;
+ res.salesDeptHP = report.Sales_Dept_HP__c;
+ res.isAohuiProduct = report.is_aohui_product__c;
+ res.stateHospital = report.State_Hospital__c;
+ res.assetOwner = report.Asset_Owner__c;
+ res.deliveredProductId = report.Delivered_Product__r.Id;
+ res.FSEApplyForRepairTime = report.FSE_ApplyForRepair_time__c;
+ res.maintenanceContractId = report.Maintenance_Contract__r.Id;
+ res.URFLimitSerial = report.URFLimitSerial__c;
+ res.status = report.Status__c;
+ res.dealerId = report.Dealer__r.Id;
+ res.dayLater30 = report.Day_later_30__c;
+ res.recallCorrespondence = report.Recall_Correspondence__c;
+ res.URFReapir = report.URF_Reapir__c;
+ res.inchargeStaffId = report.Incharge_Staff__r.Id;
+ res.DWSign = report.DW_Sign__c;
+ res.DOJStatus = report.DOJ_Status__c;
+ res.SAPcondition = report.SAP_condition__c;
+ res.AWSDataId = report.AWS_Data_Id__c;
+
res.Status1C = report.Status1__c;
res.ProblemOccurredSelectC = report.ProblemOccurredSelect__c;
res.Delay15MinC = report.Delay15Min__c;
@@ -233,8 +260,208 @@
}
}
+ //閫氳繃deliveredProductId浣滀负Id鏌ヨAsset鐨勮褰曞苟杩斿洖
+ @AuraEnabled
+ public static List<Asset> queryForEquipments(String deliveredProductId){
+ try {
+ List<Asset> assets = [SELECT Id, Status FROM Asset WHERE Id = :deliveredProductId];
+ return assets;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ }
+
+ //閫氳繃Maintenance_Contract__c鍜孉sset__c瀛楁鏌ヨMaintenance_Contract_Asset__c鐨勮褰曞苟杩斿洖
+ @AuraEnabled
+ public static List<Maintenance_Contract_Asset__c> queryForUrfAsset(String maintenanceContractId,String deliveredProductId){
+ try {
+ List<Maintenance_Contract_Asset__c> assets = [SELECT Id,URF_Series_F__c,Series_MaxRepairCount_F__c,Series_RepairCount_F__c FROM Maintenance_Contract_Asset__c WHERE Maintenance_Contract__c =:maintenanceContractId and Asset__c=:deliveredProductId];
+ return assets;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ }
+
+ //閫氳繃URFLimitSerial浣滀负Id鏌ヨProductURF__c鐨勮褰曞苟杩斿洖
+ @AuraEnabled
+ public static List<ProductURF__c> queryForUrfSeriesInfo(String URFLimitSerial){
+ try {
+ List<ProductURF__c> urfs = [SELECT Id,URFLimitSerial__c FROM ProductURF__c WHERE ID=:URFLimitSerial];
+ return urfs;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ }
+
+ //閫氳繃Maintenance_Contract__c锛孲tatus1__c鍜孌elivered_Product__r.Product2.ProductURF__r.URFLimitSerial__c瀛楁鏌ヨRepair__c涓殑璁板綍骞惰繑鍥�
+ @AuraEnabled
+ public static List<Repair__c> queryForRepairCount(String maintenanceContractId,String status1,String URFLimitSerial){
+ try {
+ List<Repair__c> repairs = [SELECT Id,name FROM Repair__c WHERE Maintenance_Contract__c=:maintenanceContractId AND Status1__c=:status1 AND Delivered_Product__r.Product2.ProductURF__r.URFLimitSerial__c = :URFLimitSerial];
+ return repairs;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ }
+
+ //閫氳繃Is_Validity__c鍜孖d瀛楁鏌ヨAccount鐨勮褰曞苟杩斿洖
+ @AuraEnabled
+ public static List<Account> queryForFindInvalidLicense(Boolean isValidity,String dealerId){
+ try {
+ List<Account> accounts = [select Id,Is_Validity__c from Account where Is_Validity__c = false And Id = :dealerId];
+ return accounts;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ }
+
+ //閫氳繃inchargeStaffId浣滀负Id鏌ヨUser涓殑璁板綍骞惰繑鍥�
+ @AuraEnabled
+ public static List<User> queryForReocrds(String inchargeStaffId){
+ try {
+ List<User> users = [SELECT Id, JingliApprovalManager__c, BuchangApprovalManager__c, ZongjianApprovalManager__c FROM User WHERE Id = :inchargeStaffId];
+ return users;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ }
+
+ //閫氳繃Id鏌ヨRepair__c涓殑璁板綍骞惰繑鍥�
+ @AuraEnabled
+ public static List<Repair__c> queryForRds(String recordId){
+ try {
+ List<Repair__c> res = [SELECT Id,NewProductGuarante_Formula__c,ProductGuarante_Create__c FROM Repair__c WHERE Id = :recordId];
+ return res;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ }
+
+ //閫氳繃Id鏌ヨRepair__c涓殑Dealer__c锛屽啀鏍规嵁Dealer__c鏌ヨAccount涓殑璁板綍骞惰繑鍥�
+ @AuraEnabled
+ public static List<Account> queryForrecords3(String recordId){
+ try {
+ Repair__c repair = [select Repair__c.Dealer__c from Repair__c where Id =:recordId];
+ List<Account> accounts = [select id, FirstParagraph__c from Account where name =:repair.Dealer__c];
+ return accounts;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ }
+
+ //鏇存柊Repair__c涓殑璁板綍锛屽皢Maintenance_Contract__c鍜孧aintenanceContractType__c瀛楁鏇存柊涓虹┖锛岃嫢鎹曡幏鍒板紓甯稿垯杩斿洖閿欒淇℃伅
+ @AuraEnabled
+ public static String updateForRepair1(String recordId){
+ try {
+ Repair__c repair = new Repair__c();
+ repair.ID = recordId;
+ repair.Maintenance_Contract__c = null;
+ repair.MaintenanceContractType__c = null;
+ update repair;
+ return null;
+ } catch (Exception e) {
+ String eMessage = e.getMessage();
+ Integer left = eMessage.indexOf(',') + 1;
+ Integer right = eMessage.length();
+ return eMessage.substring(left,right);
+ }
+ }
+
+ //鏇存柊Repair__c涓殑璁板綍锛岃嫢鎹曡幏鍒板紓甯稿垯杩斿洖閿欒淇℃伅
+ @AuraEnabled
+ public static String updateRepair2(String recordId,User staff,Boolean DWSign,String statusc,String DOJStatus,String SAPcondition){
+ try {
+ Repair__c repair = new Repair__c();
+ repair.Id = recordId;
+ repair.JingliApprovalManager__c =
+ staff.JingliApprovalManager__c == null
+ ? staff.Id
+ : staff.JingliApprovalManager__c;
+ repair.BuchangApprovalManager__c =
+ staff.BuchangApprovalManager__c == null
+ ? staff.Id
+ : staff.BuchangApprovalManager__c;
+ repair.ZongjianApprovalManager__c =
+ staff.ZongjianApprovalManager__c == null
+ ? staff.Id
+ : staff.ZongjianApprovalManager__c;
+ repair.FSE_ApplyForRepair_time__c = Datetime.now();
+ repair.DW_Sign_Txt__c = DWSign; //20210608 ljh SFDC-C3CCN4 end
+ repair.Status__c = statusc;
+ repair.Service_contract_judege_day__c = Date.today();
+ if (
+ DOJStatus == LightingButtonConstant.REPAIR_FIELD_DOJ_STATUS_NOT_OBJECT &&
+ SAPcondition == LightingButtonConstant.REPAIR_FIELD_SAP_CONDITION_IS_TRUE
+ ) {
+ repair.SAP_Transfer_time__c = Datetime.now();
+ }
+ update repair;
+ return null;
+ } catch (Exception e) {
+ String eMessage = e.getMessage();
+ Integer left = eMessage.indexOf(',') + 1;
+ Integer right = eMessage.length();
+ return eMessage.substring(left,right);
+ }
+ }
+
public class InitData{
@AuraEnabled
+ public String detailedAddress;
+ @AuraEnabled
+ public String numberofEffectiveContract;
+ @AuraEnabled
+ public String newProductGuaranteTxt;
+ @AuraEnabled
+ public String maintenanceContract;
+ @AuraEnabled
+ public String VMMaintenanceContract;
+ @AuraEnabled
+ public String FSEState;
+ @AuraEnabled
+ public String repairSource;
+ @AuraEnabled
+ public Boolean quickRepairSign;
+ @AuraEnabled
+ public String RCCD;
+ @AuraEnabled
+ public String salesDeptHP;
+ @AuraEnabled
+ public Boolean isAohuiProduct;
+ @AuraEnabled
+ public String stateHospital;
+ @AuraEnabled
+ public String assetOwner;
+ @AuraEnabled
+ public String deliveredProductId;
+ @AuraEnabled
+ public Datetime FSEApplyForRepairTime;
+ @AuraEnabled
+ public String maintenanceContractId;
+ @AuraEnabled
+ public String URFLimitSerial;
+ @AuraEnabled
+ public String status;
+ @AuraEnabled
+ public String dealerId;
+ @AuraEnabled
+ public String dayLater30;
+ @AuraEnabled
+ public Boolean recallCorrespondence;
+ @AuraEnabled
+ public Boolean URFReapir;
+ @AuraEnabled
+ public String inchargeStaffId;
+ @AuraEnabled
+ public Boolean DWSign;
+ @AuraEnabled
+ public String DOJStatus;
+ @AuraEnabled
+ public String SAPcondition;
+ @AuraEnabled
+ public String AWSDataId;
+
+ @AuraEnabled
public String Status1C;
@AuraEnabled
public String RepairSubOrderC;
--
Gitblit v1.9.1