From d77b6353ca9b59a6398df3eae9912f9fd766946d Mon Sep 17 00:00:00 2001
From: zhangzhengmei <zhangzhengmei@prec-tech.com>
Date: 星期六, 05 八月 2023 17:04:22 +0800
Subject: [PATCH] fix: lightning 页面确认
---
force-app/main/default/classes/buttonAssetCtl.cls | 140 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 140 insertions(+), 0 deletions(-)
diff --git a/force-app/main/default/classes/buttonAssetCtl.cls b/force-app/main/default/classes/buttonAssetCtl.cls
new file mode 100644
index 0000000..8e8152d
--- /dev/null
+++ b/force-app/main/default/classes/buttonAssetCtl.cls
@@ -0,0 +1,140 @@
+public with sharing class buttonAssetCtl {
+ public buttonAssetCtl() {
+
+ }
+
+ @AuraEnabled
+ public static InitData init(String recordId){
+ InitData res = new initData();
+ try{
+ Asset report = [SELECT Id,NoPartRiskDate_F__c,Product_ID__c,AccountId,HP_Id__c,Hospital__c,Hospital__r.Id,Department_Class__c,Department_Class__r.Id,Name FROM Asset WHERE Id =: recordId LIMIT 1];
+ System.debug(LoggingLevel.INFO, '*** opp: ' + report);
+ res.Id = report.Id;
+ res.Name = report.Name;
+ res.NoPartRiskDateFC = report.NoPartRiskDate_F__c;
+ res.ProductIDC = report.Product_ID__c;
+ res.AccountId = report.AccountId;
+ res.HPIdC = report.HP_Id__c;
+ res.HospitalC = report.Hospital__c;
+ res.DepartmentClassC = report.Department_Class__c;
+ res.HospitalId = report.Hospital__r.Id;
+ res.DepartmentClassId = report.Department_Class__r.Id;
+
+ res.userID = UserInfo.getUserId();
+
+ res.day = Date.today();
+ res.day1 = Date.today().addDays(-10);
+ res.day2 = Date.today().addDays(+365);
+ res.notCreateRepairFromAssetButton= System.Label.notCreateRepairFromAssetButton;
+ res.notCreateRepairFromAssetButton02= System.Label.notCreateRepairFromAssetButton02;
+
+ System.debug(LoggingLevel.INFO, '*** res: ' + res);
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+
+ // 鏌ユ壘UserName
+ @AuraEnabled
+ public static List<User> initUserName(String userId){
+ List<User> res = new List<User>();
+ try{
+ res = [SELECT Id,name,RepairSalesPoint_Province_China__c,Employee_No__c FROM User WHERE Id=: userId ];
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+
+ //鏌ヨAccount淇悊鐢婚潰鈥滀慨鐞嗗搧杩旈�佸湴鈥濋棶棰樿皟鏌�-鍚庣画
+ @AuraEnabled
+ public static List<Account> selecctAccountBySegmentId(String segmentId){
+ try {
+ List<Account> accounts = [SELECT id,ParentId,Parent.RecordTypeId, Parent.Parent.FSE_GI_Main_Leader__r.Work_Location__c,Parent.Parent.FSE_SP_Main_Leader__r.Work_Location__c FROM Account WHERE Id=:segmentId];
+ return accounts;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ }
+
+ //鏌ヨProduct2
+ @AuraEnabled
+ public static List<Product2> selecctProduct2ById(String Id){
+ try {
+ List<Product2> accounts = [SELECT id,Name,Can_Repair__c from Product2 where ID=:Id];
+ return accounts;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ }
+
+ //鏌ヨQIS_Report__c
+ @AuraEnabled
+ public static List<QIS_Report__c> selecctQISReportByFomatToday(String AssetId,Date fomatToday){
+ try {
+ List<QIS_Report__c> accounts = [SELECT id,Name,QIS_Submit_day__c from QIS_Report__c where nonyushohin__c=:AssetId and QIS_Submit_day__c != null and QIS_Submit_day__c >=:fomatToday];
+ return accounts;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ }
+
+ //鏌ヨRepair__c
+ @AuraEnabled
+ public static List<Repair__c> selecctRepairByFomatToday(String AssetId, Date fomatToday){
+ try {
+ List<Repair__c> accounts = [SELECT Name from Repair__c where Delivered_Product__c =:AssetId and Status2__c!='00.鍒犻櫎' and Status2__c!='00.鍙栨秷' and FSE_ApplyForRepair_Day__c >=: fomatToday order by FSE_ApplyForRepair_Day__c desc limit 1];
+ return accounts;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ }
+
+ //鏌ヨRepair__c
+ @AuraEnabled
+ public static List<Account> selecctAccountByAccountId(String AccountId){
+ try {
+ List<Account> accounts = [SELECT id,Parent.RecordTypeId, Parent.RecordType_DeveloperName__c ,Parent.Parent.FSE_GI_Main_Leader__c, Parent.Parent.FSE_GI_Main_Leader__r.Name,Parent.Parent.FSE_SP_Main_Leader__r.Name,Parent.Parent.FSE_SP_Main_Leader__c,Parent.Parent.FSE_GI_Main_Leader__r.Work_Location__c,Parent.Parent.FSE_SP_Main_Leader__r.Work_Location__c FROM Account WHERE ID=: AccountId];
+ return accounts;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ }
+
+ public class InitData{
+ @AuraEnabled
+ public String Id;
+ @AuraEnabled
+ public String userID;
+ @AuraEnabled
+ public Date day;
+ @AuraEnabled
+ public Date day2;
+ @AuraEnabled
+ public Date day1;
+ @AuraEnabled
+ public String Name;
+ @AuraEnabled
+ public Date NoPartRiskDateFC;
+ @AuraEnabled
+ public String ProductIDC;
+ @AuraEnabled
+ public String AccountId;
+ @AuraEnabled
+ public String HPIdC;
+ @AuraEnabled
+ public String HospitalC;
+ @AuraEnabled
+ public String DepartmentClassC;
+ @AuraEnabled
+ public String HospitalId;
+ @AuraEnabled
+ public String DepartmentClassId;
+ @AuraEnabled
+ public String notCreateRepairFromAssetButton;
+ @AuraEnabled
+ public String notCreateRepairFromAssetButton02;
+
+ }
+}
\ No newline at end of file
--
Gitblit v1.9.1