From 428f42fab44b654c69fbc461513203830743d7de Mon Sep 17 00:00:00 2001
From: 黄千龙 <huangqianlong@prec-tech.com>
Date: 星期二, 18 七月 2023 10:55:50 +0800
Subject: [PATCH] hql20230718更新lightning按钮

---
 force-app/main/default/classes/QISReportController.cls |   99 ++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 88 insertions(+), 11 deletions(-)

diff --git a/force-app/main/default/classes/QISReportController.cls b/force-app/main/default/classes/QISReportController.cls
index 1344bd0..8463989 100644
--- a/force-app/main/default/classes/QISReportController.cls
+++ b/force-app/main/default/classes/QISReportController.cls
@@ -19,8 +19,8 @@
         
         String recordTypeId = LightingButtonConstant.DEVELOPER_NAME_ASAC_DECISION;
         try{
-            PAE_DecisionRecord__c rCPAEDIdList = [SELECT LastModifiedDate, Id, Name, LastModifiedById,RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_QIS__c = :qisReportId  And RecordType.DeveloperName =  :recordTypeId limit 1]; 
-            res.pAEid = rCPAEDIdList.id;
+            PAE_DecisionRecord__c RCPAEDIdList = [SELECT LastModifiedDate, Id, Name, LastModifiedById,RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_QIS__c = :qisReportId  And RecordType.DeveloperName =  :recordTypeId limit 1]; 
+            res.pAEid = RCPAEDIdList.id;
             System.debug(LoggingLevel.INFO, '*** res: ' + res);
         }catch(Exception e){
             System.debug(LoggingLevel.INFO, '*** e: ' + e);
@@ -48,8 +48,8 @@
         
         String recordTypeId = LightingButtonConstant.DEVELOPER_NAME_ASRC_DECISION;
         try{
-            PAE_DecisionRecord__c aSRCDIdList = [SELECT LastModifiedDate, Id, Name, LastModifiedById,RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_QIS__c = :qisReportId  And RecordType.DeveloperName =  :recordTypeId Limit 1]; 
-            res.pAEid = aSRCDIdList.id;
+            PAE_DecisionRecord__c ASRCDIdList = [SELECT LastModifiedDate, Id, Name, LastModifiedById,RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_QIS__c = :qisReportId  And RecordType.DeveloperName =  :recordTypeId Limit 1]; 
+            res.pAEid = ASRCDIdList.id;
             System.debug(LoggingLevel.INFO, '*** res: ' + res);
         }catch(Exception e){
             System.debug(LoggingLevel.INFO, '*** e: ' + e);
@@ -528,6 +528,10 @@
     public static InitData initForlexCreateRepairButton (String recordId){
         InitData res = new initData();
         ID myUserID = UserInfo.getUserId();
+        List<RecordType> RecordTypeList = [select id,name from RecordType where name = '2.OCSM' or name = '1.FSE' or name = '鎴︾暐绉戝鍒嗛 娑堝寲绉�'
+                                            or name = '鎴︾暐绉戝鍒嗛 娑堝寲绉�' or name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�' or name = '鎴︾暐绉戝鍒嗛ET' 
+                                            or name = '鎴︾暐绉戝鍒嗛 鏅绉�' or name = '鎴︾暐绉戝鍒嗛 娉屽翱绉�' or name = '鎴︾暐绉戝鍒嗛 鑰抽蓟鍠夌' 
+                                            or name = '鎴︾暐绉戝鍒嗛 濠︿汉绉�' or name = '鎴︾暐绉戝鍒嗛 銇濄伄浠�'];
         User userinfo = [SELECT id,RepairSalesPoint_Province_China__c FROM User WHERE Id = :myUserID LIMIT 1];
         QIS_Report__c report = [SELECT  id,Owner.name,FailureQInHospital__c,InformationFrom__c,Delay15Min__c,
                                 AfterFailureInformation__c,Set_usage_product__c,BreakORFallOff__c,Opera_Name__c,
@@ -541,7 +545,39 @@
                         Parent.Parent.FSE_GI_Main_Leader__r.Work_Location__c,
                         Parent.Parent.FSE_SP_Main_Leader__r.Work_Location__c FROM Account WHERE id = :report.Hospital_Department__c limit 1];
         try{
-            
+            for (RecordType rec :RecordTypeList) {
+                if (rec.name == '1.FSE') {
+                    res.oneFSE = rec.id.to15();
+                }
+                if (rec.name == '2.OCSM') {
+                    res.twoOCSM = rec.id.to15();
+                }
+                if (rec.name == '鎴︾暐绉戝鍒嗛 娑堝寲绉�') {
+                    res.xiaohua = rec.id.to15();
+                }
+                if (rec.name == '鎴︾暐绉戝鍒嗛 鍛煎惛绉�') {
+                    res.huxi = rec.id.to15();
+                }
+                if (rec.name == '鎴︾暐绉戝鍒嗛ET') {
+                    res.eT = rec.id.to15();
+                }
+                if (rec.name == '鎴︾暐绉戝鍒嗛 鏅绉�') {
+                    res.puwai = rec.id.to15();
+                }
+                if (rec.name == '鎴︾暐绉戝鍒嗛 娉屽翱绉�') {
+                    res.miniao = rec.id.to15();
+                }
+                if (rec.name == '鎴︾暐绉戝鍒嗛 鑰抽蓟鍠夌') {
+                    res.erbihou = rec.id.to15();
+                }
+                if (rec.name == '鎴︾暐绉戝鍒嗛 濠︿汉绉�') {
+                    res.fuke = rec.id.to15();
+                }
+                if (rec.name == '鎴︾暐绉戝鍒嗛 銇濄伄浠�') {
+                    res.qita = rec.id.to15();
+                }
+                
+            }
             res.Id = report.Id;
             res.qisRecordTypeId = report.RecordType_ID__c;
             res.oCMjudgement = report.OCM_judgement__c;
@@ -739,9 +775,30 @@
         }
          return re;
     }
+
+     // 鏂板缓QIS
+    @AuraEnabled
+    public static InitData initForlexCreateQISFromAssetButton (String recordId){
+        InitData res = new initData();
+        ID myUserID = UserInfo.getUserId();
+        Asset ass = [SELECT id,AssetMark__c FROM Asset WHERE Id = :recordId LIMIT 1];
+        try{
+            Date fomatToday = Date.today().addDays(-10);
+            QIS_Report__c report = [SELECT id,QIS_Submit_day__c FROM QIS_Report__c WHERE nonyushohin__c=:recordId and QIS_Submit_day__c != null and QIS_Submit_day__c >= :fomatToday];
+            Repair__c rep = [SELECT id,Name FROM Repair__c WHERE Delivered_Product__c = :recordId and Status2__c!='00.鍒犻櫎' and Status2__c!='00.鍙栨秷' and FSE_ApplyForRepair_Day__c >= :fomatToday  order by FSE_ApplyForRepair_Day__c desc limit 1];
+            res.Id = report.id;
+            res.repId = rep.id;
+            System.debug(LoggingLevel.INFO, '*** res: ' + res);
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+        }
+        return res;
+    }
     public class InitData{
         @AuraEnabled
         public String Id;
+        @AuraEnabled
+        public String repId;
         @AuraEnabled
         public String qISSCReport;
         @AuraEnabled
@@ -769,23 +826,23 @@
         @AuraEnabled
         public String failuerSituation;
         @AuraEnabled
-        public String sourceOnCall;
+        public ID sourceOnCall;
         @AuraEnabled
         public String sourceOnCallname;
         @AuraEnabled
-        public String hospitalId;
+        public ID hospitalId;
         @AuraEnabled
         public String hospitalname;
         @AuraEnabled
-        public String departmentClassId;
+        public ID departmentClassId;
         @AuraEnabled
         public String departmentClassname;
         @AuraEnabled
-        public String hospitalDepartment;
+        public ID hospitalDepartment;
         @AuraEnabled
         public String hospitalDepartmentname;
         @AuraEnabled
-        public String nonyushohinId;
+        public ID nonyushohinId;
         @AuraEnabled
         public String nonyushohinIdname;
         @AuraEnabled
@@ -815,7 +872,7 @@
         @AuraEnabled
         public String failureQInHospital;
         @AuraEnabled
-        public String ownerId;
+        public ID ownerId;
         @AuraEnabled
         public String ownername;
         @AuraEnabled
@@ -853,6 +910,26 @@
         @AuraEnabled
         public String contractnumber;
         @AuraEnabled
+        public String oneFSE;
+        @AuraEnabled
+        public String twoOCSM;
+        @AuraEnabled
+        public String huxi;
+        @AuraEnabled
+        public String xiaohua;
+        @AuraEnabled
+        public String eT;
+        @AuraEnabled
+        public String puwai;
+        @AuraEnabled
+        public String miniao;
+        @AuraEnabled
+        public String erbihou;
+        @AuraEnabled
+        public String fuke;
+        @AuraEnabled
+        public String qita;
+        @AuraEnabled
         public Date rCinspectionDate;
         @AuraEnabled
         public Date qISReplyDay;

--
Gitblit v1.9.1