From fd1234ddc5be42b9ec2fad9d9286cd2aa58eb0ef Mon Sep 17 00:00:00 2001
From: unknown <sunxia@prec-tech.com>
Date: 星期二, 11 四月 2023 14:29:54 +0800
Subject: [PATCH] Merge branch 'LEX_dev' of http://47.92.229.245:8089/r/lightningupdate into LEX_dev

---
 force-app/main/default/classes/otherButtonRepairController.cls |  281 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 275 insertions(+), 6 deletions(-)

diff --git a/force-app/main/default/classes/otherButtonRepairController.cls b/force-app/main/default/classes/otherButtonRepairController.cls
index 76a3a39..f244964 100644
--- a/force-app/main/default/classes/otherButtonRepairController.cls
+++ b/force-app/main/default/classes/otherButtonRepairController.cls
@@ -7,13 +7,68 @@
     public static InitData init(String recordId){
         InitData res = new initData();
         try{
-            Repair__c report =  [SELECT OCSMAdministrativeReportStatus__c,Incharge_Staff_Email__c,Name,HP_Name__c,Delivered_Product__c,
+            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_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.Status1C = report.Status1__c;
+            res.ProblemOccurredSelectC = report.ProblemOccurredSelect__c;
+            res.Delay15MinC = report.Delay15Min__c;
+            res.ProductFailureRelatedC = report.ProductFailureRelated__c;
+            res.RepairSubOrderC = report.RepairSubOrder__c;
+            res.OnCallIDC = report.On_Call_ID__c;
+            res.QISIDC = report.QIS_ID__c;
+            res.InsReportC = report.InsReport__c;
+            res.MBCAwareDateC = report.MBC_AwareDate__c;
+            res.CFDANoHandC = report.CFDA_No_Hand__c;
+            res.ProduceCompanyHandC = report.ProduceCompany_hand__c;
+            res.OfferRentalNewC = report.Offer_Rental_New__c;
+            res.ifRentalApplyC = report.if_Rental_Apply__c;
+            res.LatestCollectDatePriorityC = report.Latest_Collect_Date_Priority__c;
+            res.RentalApplyEquipmentSetDetailIdC = report.Rental_Apply_Equipment_Set_Detail_Id__c;
+            res.RentalApplyEquipmentSetDetailC = report.Rental_Apply_Equipment_Set_Detail__c;
+            res.PaperRepairRequestNoC = report.PaperRepairRequestNo__c;
+            res.HospitalC = report.Hospital__c;
+            res.DepartmentClassC = report.Department_Class__c;
+            res.AccountC = report.Account__c;
+            res.RepairCostTypeC = report.RepairCostType__c;
+            res.DealerC  = report.Dealer__c ;
+            res.InchargeStaffC  = report.Incharge_Staff__c ;
+            res.InchargeStaffContactC  = report.Incharge_Staff_Contact__c ;
+            res.SalesOfficeCodeSelectionC  = report.SalesOfficeCode_selection__c ;
+            res.OnSiteRepairC  = report.On_site_repair__c ;
+            res.workLocationSelectC  = report.work_location_select__c ;
+            res.ReturnsProductWayC  = report.Returns_Product_way__c ;
+            res.RepairDetailC  = report.Repair_Detail__c ;
+            res.RepairApplicantC  = report.RepairApplicant__c ;
+            res.RepairApplicantHospitalC  = report.RepairApplicantHospital__c ;
+            res.RepairApplicantDepartmentC  = report.RepairApplicantDepartment__c ;
+            res.DeliveryLogisticsModeC  = report.DeliveryLogisticsMode__c ;
+            res.engineerSendDateC  = report.engineerSendDate__c ;
+            res.DeliveryLogisticsNoC  = report.DeliveryLogisticsNo__c ;
+            res.DeliveryLogisticsAnnotationC  = report.DeliveryLogisticsAnnotation__c ;
+            res.DateReceiptQuestionsC  = report.DateReceiptQuestions__c ;
+            res.BreakORFallOffC  = report.BreakORFallOff__c ;
+            res.DelayReportReasonC  = report.DelayReportReason__c ;
+            res.UseFailProductFinishC  = report.UseFailProductFinish__c ;
+            res.ifDeadHurtC = report.ifDeadHurt__c ;
+            res.SupportingProductsC = report.SupportingProducts__c ;
+            res.ProblemOccurredC = report.ProblemOccurred__c ;
+            res.AfterFailureInformationC = report.AfterFailureInformation__c ;
+            res.InformationFromC = report.InformationFrom__c ;
+            res.ReportAdverseEventsC = report.ReportAdverseEvents__c ;
+            res.FailureQInHospitalC = report.FailureQInHospital__c ;
+            res.WhatProjectC = report.WhatProject__c ;
+            res.OperationOrExaminationNameC = report.OperationOrExaminationName__c ;
+            res.MaintenanceContractTypeC = report.MaintenanceContractType__c ;
+            res.FailureOccurrenceDateC = report.Failure_Occurrence_Date__c ;
+            res.RepairSourceC = report.Repair_Source__c ;
             res.Id = report.Id;
+            res.partArrangementCompleteC = report.part_arrangement_complete__c;
+            res.RepairShippedDateC = report.Repair_Shipped_Date__c;
             res.OCSMAdministrativeReportNumberC = report.OCSMAdministrativeReportNumber__c;
             res.OCSMAdministrativeReportDateC = report.OCSMAdministrativeReportDate__c;
             res.AwareDateC = report.Aware_date__c;
@@ -23,7 +78,6 @@
             res.PAEDetermineACC = report.PAE_DetermineAC__c;
             res.RepairInspectionDateC = report.Repair_Inspection_Date__c;
             res.ContainUseRSAC = report.Contain_UseRSA__c;
-
             res.InchargeStaffEmailC = report.Incharge_Staff_Email__c;
             res.Name = report.Name;
             res.HPNameC = report.HP_Name__c;
@@ -34,6 +88,10 @@
             res.RepairEstimatedDateC = report.Repair_Estimated_Date__c;
             res.RCInformationC = report.RC_information__c;
             res.OCSMAdministrativeReportStatusC = report.OCSMAdministrativeReportStatus__c;
+            res.userID = UserInfo.getUserId();
+            res.profileId = UserInfo.getProfileId();
+            res.userEmail = UserInfo.getUserEmail();
+
 
             System.debug(LoggingLevel.INFO, '*** res: ' + res);
         }catch(Exception e){
@@ -42,6 +100,7 @@
         return res;
     }   
 
+    // 鏍规嵁ID鏌ユ壘淇悊琛�
     @AuraEnabled
     public static List<Repair__c> selectRecords(String recordId){
         List<Repair__c> res = new List<Repair__c>();
@@ -53,6 +112,7 @@
         return res;
     }
 
+    // 鏍规嵁ID淇敼淇悊
     @AuraEnabled
     public static void updateRepair(String recordId){
         try {
@@ -65,18 +125,147 @@
         }
     }
 
+    // 淇敼楠屾敹鍗�
+    @AuraEnabled
+    public static String updateYanshoudan(String recordId){
+        String res;
+        try {
+            Repair__c repair = new Repair__c();
+            repair.Id = recordid;
+            repair.Request_yanshoudan_PDF__c = true;
+            repair.Facility_Return_Receipt_Collection_reque__c = Datetime.now().date();
+            
+            update repair;
+        } catch (Exception e) {
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+            res = e.getMessage();
+        }
+        return res;
+    }
+
+    // 鏌ユ壘PAE鍒ゅ畾璁板綍
     @AuraEnabled
     public static List<PAE_DecisionRecord__c> selectPAEDecisionRecord(String recordId,String recordTypeId){
-        List<PAE_DecisionRecord__c> res = new List<PAE_DecisionRecord__c>();
+        List<PAE_DecisionRecord__c > res = new List<PAE_DecisionRecord__c >();
         try{
-            res = [SELECT LastModifiedDate, Id, Name, LastModifiedById,RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_Repair__c =: recordId And RecordType.DeveloperName =: recordTypeId Order by LastModifiedDate desc];
+            res = [SELECT LastModifiedDate, Id, Name, LastModifiedById,RecordType.DeveloperName FROM PAE_DecisionRecord__c  where PAE_Repair__c =: recordId And RecordType.DeveloperName =: recordTypeId Order by LastModifiedDate desc];
         }catch(Exception e){
             System.debug(LoggingLevel.INFO, '*** e: ' + e);
         }
         return res;
     }
 
+    // 鍙戦�侀偖浠�
+    @AuraEnabled
+    public static String sendToETQ(String iflog_Id,BatchIF_Log__c rowDataSFDC, List<String> repairIds,String statu){
+        List<QIS_Report__c> temp = [select id from QIS_Report__c where id in :repairIds ];
+        if(temp != null && temp.size() > 0){
+            try {
+                Database.executeBatch(new QISToPDFBatch(iflog_Id, rowDataSFDC,repairIds,statu),50); //鐢熸垚PDF
+            }
+            catch (Exception e) {
+                return '鏇存柊QIS鎶ラ敊:'+ e.getMessage();
+            }
+        }else{
+            BatchIF_Log__c iflog = new BatchIF_Log__c();
+            iflog.Type__c = 'sendToETQ';
+            iflog.ErrorLog__c = '';
+            iflog.Log__c = 'NFM401WebService start--';
+
+            Repair__c updateRe = new Repair__c();
+            updateRe.Id = repairIds[0];
+            updateRe.INTERFACE_RECORD_ID__c = null; 
+            updateRe.ETQ_UPLOAD_STATUS__c = null; 
+            updateRe.ETQ_UPLOAD_MESSAGE__c = null; 
+            updateRe.OSH_ConfirmationDate__c = Date.today(); 
+            updateRe.OSH_Affirmant__c = UserInfo.getUserId(); 
+            updateRe.AWS_Interface_Time__c = Datetime.now();
+            updateRe.AsyncData__c = true; 
+            try{
+                update updateRe;
+                Database.executeBatch(new RepairToPDFBatch(iflog_Id, rowDataSFDC,repairIds,statu)); //鐢熸垚PDF
+                iflog.Log__c += '\n淇悊:'+updateRe+' 鏇存柊鎴愬姛';
+                iflog.Log__c = '\nNFM401WebService end--';
+                insert iflog;
+            }catch(Exception ex){
+                iflog.ErrorLog__c += '淇悊:'+updateRe+' 鏇存柊澶辫触,鍥犱负::'+ex.getMessage();
+                iflog.Log__c = '\nNFM401WebService end--';
+                insert iflog;
+                return '鏇存柊淇悊鎶ラ敊:'+ ex.getMessage();
+            }
+        }
+        return '鍙戦�佹垚鍔�!';
+    }
+
+    // 鏌ユ壘AssetID
+    @AuraEnabled
+    public static String selectAssetID(String recordId){
+        List<Repair__c> res = new List<Repair__c>();
+        try{
+            res = [SELECT Delivered_Product__c from Repair__c WHERE Id =: recordId];
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+        }
+        return res[0].Delivered_Product__c;
+    }
+
+    // 鏌ユ壘鍒犻櫎ID
+    @AuraEnabled
+    public static List<Repair__c> selectCustomDeleteById(String recordId){
+        List<Repair__c > res = new List<Repair__c >();
+        try{
+            res = [SELECT Id, Status__c,SAP_Transfer_time__c, Repair_Ordered_Date__c, CreatedById, Acc_OwnerId__c,FSE_ownerid__c FROM Repair__c WHERE Id =: recordId];
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+        }
+        return res;
+    }
+
+     // 鏌ユ壘鍒犻櫎ID
+     @AuraEnabled
+     public static String deleteRepair(String rid) {
+        try {
+            Repair__c r = new Repair__c(Id = rid);
+            delete r;
+            return 'OK';
+        } catch (Exception e) {
+            return e.getMessage();
+        }
+    }
+
     public class InitData{
+        @AuraEnabled
+        public String Status1C;
+        @AuraEnabled
+        public String RepairSubOrderC;
+        @AuraEnabled
+        public String OnCallIDC;
+        @AuraEnabled
+        public String QISIDC;
+        @AuraEnabled
+        public String InsReportC;
+        @AuraEnabled
+        public Datetime MBCAwareDateC;
+        @AuraEnabled
+        public String CFDANoHandC;
+        @AuraEnabled
+        public String ProduceCompanyHandC;
+        @AuraEnabled
+        public Boolean OfferRentalNewC;
+        @AuraEnabled
+        public Boolean ifRentalApplyC;
+        @AuraEnabled
+        public Datetime LatestCollectDatePriorityC;
+        @AuraEnabled
+        public String RentalApplyEquipmentSetDetailIdC;
+        @AuraEnabled
+        public String RentalApplyEquipmentSetDetailC;
+        @AuraEnabled
+        public String ProblemOccurredSelectC;
+         @AuraEnabled
+        public String Delay15MinC;
+         @AuraEnabled
+        public String ProductFailureRelatedC;
         @AuraEnabled
         public String Id;
         @AuraEnabled
@@ -97,7 +286,6 @@
         public Datetime RepairInspectionDateC;
         @AuraEnabled
         public boolean ContainUseRSAC;
-
          @AuraEnabled
         public String InchargeStaffEmailC;
          @AuraEnabled
@@ -118,6 +306,87 @@
         public String RCInformationC;
         @AuraEnabled
         public String OCSMAdministrativeReportStatusC;
-
+        @AuraEnabled
+        public Datetime RepairShippedDateC;
+        @AuraEnabled
+        public Datetime partArrangementCompleteC;
+        @AuraEnabled
+        public String userID;
+        @AuraEnabled
+        public String profileId;
+        @AuraEnabled
+        public String userEmail;
+        @AuraEnabled
+        public String PaperRepairRequestNoC;
+        @AuraEnabled
+        public String HospitalC;
+        @AuraEnabled
+        public String AccountC;
+        @AuraEnabled
+        public String DepartmentClassC;
+        @AuraEnabled
+        public String RepairCostTypeC;
+        @AuraEnabled
+        public String DealerC;
+        @AuraEnabled
+        public String InchargeStaffC;
+        @AuraEnabled
+        public String InchargeStaffContactC;
+        @AuraEnabled
+        public String SalesOfficeCodeSelectionC;
+        @AuraEnabled
+        public String OnSiteRepairC;
+        @AuraEnabled
+        public String workLocationSelectC;
+        @AuraEnabled
+        public String ReturnsProductWayC;
+        @AuraEnabled
+        public String RepairDetailC;
+        @AuraEnabled
+        public String RepairApplicantC;
+        @AuraEnabled
+        public String RepairApplicantHospitalC;
+        @AuraEnabled
+        public String RepairApplicantDepartmentC;
+        @AuraEnabled
+        public String DeliveryLogisticsModeC;
+        @AuraEnabled
+        public Datetime engineerSendDateC;
+        @AuraEnabled
+        public String DeliveryLogisticsNoC;
+        @AuraEnabled
+        public String DeliveryLogisticsAnnotationC;
+        @AuraEnabled
+        public Datetime DateReceiptQuestionsC;
+        @AuraEnabled
+        public String BreakORFallOffC;
+        @AuraEnabled
+        public String DelayReportReasonC;
+        @AuraEnabled
+        public String UseFailProductFinishC;
+        @AuraEnabled
+        public String ifDeadHurtC;
+        @AuraEnabled
+        public String SupportingProductsC;
+        @AuraEnabled
+        public String ProblemOccurredC;
+        @AuraEnabled
+        public String AfterFailureInformationC;
+        @AuraEnabled
+        public String InformationFromC;
+        @AuraEnabled
+        public String ReportAdverseEventsC;
+        @AuraEnabled
+        public String FailureQInHospitalC;
+        @AuraEnabled
+        public String WhatProjectC;
+        @AuraEnabled
+        public String OperationOrExaminationNameC;
+        @AuraEnabled
+        public String MaintenanceContractTypeC;
+        @AuraEnabled
+        public Datetime FailureOccurrenceDateC;
+        @AuraEnabled
+        public String RepairSourceC;
      }
 }
\ No newline at end of file

--
Gitblit v1.9.1