From 2d0c3e982b4dbd9192a6d717488653a54afebcb2 Mon Sep 17 00:00:00 2001
From: 黄千龙 <huangqianlong@prec-tech.com>
Date: 星期四, 13 四月 2023 17:15:29 +0800
Subject: [PATCH] QIS按钮(发送QIS到SPO,OCSM服务本部收到实物)

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

diff --git a/force-app/main/default/classes/QISReportController.cls b/force-app/main/default/classes/QISReportController.cls
index 3b375e1..3d6a036 100644
--- a/force-app/main/default/classes/QISReportController.cls
+++ b/force-app/main/default/classes/QISReportController.cls
@@ -413,15 +413,114 @@
         }
          return re;
     }
+    //鍙戦�丵IS鍒癝PO
+    @AuraEnabled
+    public static InitData initForlexSendQISButton (String recordId){
+        InitData res = new initData();
+        ID myUserID = UserInfo.getUserId();
+        User userinfo = [SELECT id,Profile.name FROM User WHERE Id = :myUserID LIMIT 1];
+        try{
+            QIS_Report__c report = [SELECT  id ,RecordTypeId,IsSendQIS__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+            RecordType rec = [SELECT id,name FROM RecordType where  Id = :report.RecordTypeId];
+            res.Id = report.Id;
+            res.qisRecordTypeId = report.RecordTypeId;
+            res.qisRecordName = rec.name;
+            res.profileName = userinfo.Profile.name;
+            res.IsSendQIS = report.IsSendQIS__c;
+            System.debug(LoggingLevel.INFO, '*** res: ' + res);
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+        }
+        return res;
+    }
+
+    @AuraEnabled
+    public static String updateQisForSendQIS (String recordId){
+        String re = '鎴愬姛'; 
+        QIS_Report__c report = [SELECT Id,Name,IsSendQIS__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+        if(report == null ){
+            return '娌℃湁QIS锛�' + recordId + '鐨勬暟鎹��';
+        }
+        Savepoint sp = Database.setSavepoint(); 
+        try{    
+                
+                QIS_Report__c rac  = new QIS_Report__c();   
+                rac.id = recordId;
+                rac.IsSendQIS__c = true;
+                update rac;
+        }catch(Exception e){
+            Database.rollback(sp);
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+            re = e.getMessage();
+        }
+         return re;
+    }
+    // OCSM鏈嶅姟鏈儴鏀跺埌瀹炵墿
+    @AuraEnabled
+    public static InitData initForlexRCRecievedButton (String recordId){
+        InitData res = new initData();
+        ID myUserID = UserInfo.getUserId();
+        User userinfo = [SELECT id,Profile.name FROM User WHERE Id = :myUserID LIMIT 1];
+        try{
+            QIS_Report__c report = [SELECT  id ,isAE_Profile__c,QIS_Status__c,isPAE_Profile__c,is_CNBuy__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+            res.Id = report.Id;
+            res.isAEProfile = report.isAE_Profile__c;
+            res.isPAEProfile = report.isPAE_Profile__c;
+            res.QIStatus = report.QIS_Status__c;
+            res.isCNBuy = report.is_CNBuy__c;
+            System.debug(LoggingLevel.INFO, '*** res: ' + res);
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+        }
+        return res;
+    }
+
+    @AuraEnabled
+    public static String updateQisForRCRecieved (String recordId){
+        String re = '鎴愬姛'; 
+        ID myUserID = UserInfo.getUserId();
+        User userinfo = [SELECT id,Alias,BuchangApprovalManagerSales__c,JingliApprovalManager__c, BuchangApprovalManager__c, ZongjianApprovalManager__c FROM User WHERE Id = :myUserID LIMIT 1];
+
+        try{    
+                QIS_Report__c rac  = new QIS_Report__c();   
+                rac.id = recordId;
+
+                rac.QIS_Status__c = 'RC妫�娴嬩腑';
+                rac.OCM_RC_RecievedDate__c = Date.today();
+                rac.RC__c = myUserID;
+                rac.RC_Receive_staff__c = userinfo.Alias;
+
+                if (userinfo != null  && userinfo.BuchangApprovalManagerSales__c!= null) {
+                    rac.RC_Manager__c = userinfo.BuchangApprovalManagerSales__c;
+                } else {
+                    rac.RC_Manager__c = myUserID;
+                }
+                update rac;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+            re = e.getMessage();
+        }
+         return re;
+    }
     public class InitData{
         @AuraEnabled
         public String Id;
+        @AuraEnabled
+        public String qISSCReport;
+        @AuraEnabled
+        public String name;
+        @AuraEnabled
+        public String qISSCId;
         @AuraEnabled
         public String ownerId;
         @AuraEnabled
         public String qisRecordTypeId;
         @AuraEnabled
         public String qisRecordName;
+        @AuraEnabled
+        public String nextaction;
+        @AuraEnabled
+        public String qISMarketCategory;
         @AuraEnabled
         public String profileName;
         @AuraEnabled
@@ -455,6 +554,8 @@
         @AuraEnabled
         public Date qISInstallDate;
         @AuraEnabled
+        public Date oSHInspectionDate;
+        @AuraEnabled
         public Date cdsdate;
         @AuraEnabled
         public Date awaredate;

--
Gitblit v1.9.1