From f455c37efbe2ddd8d6bc1bec67ca079bb7373402 Mon Sep 17 00:00:00 2001
From: unknown <sunxia@prec-tech.com>
Date: 星期三, 19 七月 2023 17:43:39 +0800
Subject: [PATCH] button-lexLoanerArrangedEmail

---
 force-app/main/default/classes/LexLoanerArrangedEmailController.cls-meta.xml |    5 ++
 force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js  |    4 +-
 force-app/main/default/classes/LexLoanerArrangedEmailController.cls          |   99 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 106 insertions(+), 2 deletions(-)

diff --git a/force-app/main/default/classes/LexLoanerArrangedEmailController.cls b/force-app/main/default/classes/LexLoanerArrangedEmailController.cls
new file mode 100644
index 0000000..a119248
--- /dev/null
+++ b/force-app/main/default/classes/LexLoanerArrangedEmailController.cls
@@ -0,0 +1,99 @@
+/**
+ * *
+    ODescription:
+    GAuthor: sun xia
+    @Date: 2023-07-11 15:31:56
+    GIastEditors: sun xia
+    @IastEditTime: 2023-07-11 15:31:56
+ * */
+public with sharing class LexLoanerArrangedEmailController {
+    @AuraEnabled
+    public static InitData init(String recordId) {
+        String statusSting = Label.StatusProcessState;
+        List<String> status = statusSting.split(',');
+        InitData res = new InitData();
+        try {
+            List<Rental_Apply__c> racList = [SELECT Id, Status__c, RA_Status__c, Campaign__c, RC_return_to_office__c, Repair_Final_Inspection_Date_F__c, Repair__c, Assigned_Not_Shipment__c, Demo_purpose1__c, Contract_pdf_updated__c, Wei_Assigned_Cnt__c from Rental_Apply__c where Id = :recordId];
+            if(racList.size()>0){
+                Rental_Apply__c rac = racList[0];
+                if( rac.Campaign__c != null ){
+                    //鑾峰彇瀛︿細瀵硅薄
+                    Campaign camp = [select Id, Status, Rental_Apply_Flag__c,IF_Approved__c,Approved_Status__c, Meeting_Approved_No__c from Campaign where id = :rac.Campaign__c];
+                    res.campaignId = camp.Id;
+                    res.campaignStatus = camp.Status;
+                    res.iFApproved = camp.IF_Approved__c;
+                    res.meetingApprovedNo = camp.Meeting_Approved_No__c;
+                    res.approvedStatus = camp.Approved_Status__c;
+                }   
+                res.id = recordId;   
+                res.raStatus = rac.RA_Status__c;
+                res.weiAssignedCnt = Integer.valueOf(rac.Wei_Assigned_Cnt__c);
+                res.assignedNotShipment = Integer.valueOf(rac.Assigned_Not_Shipment__c);
+                res.demoPurpose1 = rac.Demo_purpose1__c;
+                res.contractPdfUpdated = rac.Contract_pdf_updated__c;
+                res.repairId = rac.Repair__c;
+                res.repairFinalInspectionDateF = rac.Repair_Final_Inspection_Date_F__c;
+                res.rCReturnToOffice = rac.RC_return_to_office__c;
+                res.statusList = status;
+            }
+        }
+        catch (Exception e) {
+            System.debug(LoggingLevel.INFO, '****e:' + e);
+        }
+        system.debug('res======'+res);
+        return res;
+    }
+
+    
+    //鑾峰彇澶囧搧鍊熷嚭涓�鏍�
+    @AuraEnabled
+    public static Integer getRentalApplyEquipmentSet(String recordId) {
+        Rental_Apply__c tempRa = [SELECT Id, Bollow_Date__c from Rental_Apply__c where Id = :recordId];
+        List<Rental_Apply_Equipment_Set__c> tempRaEquipSetList = new List<Rental_Apply_Equipment_Set__c>();
+        Integer pageLength ;
+        if(tempRa.Bollow_Date__c != null) {
+            tempRaEquipSetList = [SELECT Id from Rental_Apply_Equipment_Set__c where Rental_Apply__c = :recordId AND Shippment_loaner_time__c != null and RAES_Status__c != '宸插垎閰�' and RAES_Status__c != '鍙栨秷鍒嗛厤'];
+        }else {
+            tempRaEquipSetList = [SELECT Id from Rental_Apply_Equipment_Set__c where Rental_Apply__c = :recordId AND RAES_Status__c != '宸插垎閰�' and RAES_Status__c != '鍙栨秷鍒嗛厤'];
+        }
+        //
+        if(tempRaEquipSetList.size()>0) {
+            Integer setLength = tempRaEquipSetList.size();
+            pageLength = Math.mod(setLength,10) == 0 ? setLength/10 : Math.round(setLength) + 1;
+        }
+        return pageLength;
+    }
+
+    public class InitData{
+        @AuraEnabled
+        public String id;
+        @AuraEnabled
+        public String campaignStatus;   //瀛︿細鐘舵��
+        @AuraEnabled
+        public String campaignId;   //瀛︿細Id
+        @AuraEnabled
+        public String raStatus;     //澶囧搧鍊熷嚭鐢宠鐘舵��
+        @AuraEnabled
+        public Integer weiAssignedCnt;      //鏈垎閰嶄欢鏁�  Wei_Assigned_Cnt__c
+        @AuraEnabled
+        public Integer assignedNotShipment; //宸插垎閰嶆湭鍑哄簱鎸囩ず  Assigned_Not_Shipment__c
+        @AuraEnabled
+        public String demoPurpose1;         //浣跨敤鐩殑1  Demo_purpose1__c
+        @AuraEnabled
+        public Boolean contractPdfUpdated;  //鍚堝悓涔﹀凡涓婁紶    Contract_pdf_updated__c
+        @AuraEnabled
+        public String repairId;             //瀛︿細.淇悊Id
+        @AuraEnabled
+        public Date repairFinalInspectionDateF;     //淇悊鏈�缁堟娴嬫棩F      Repair_Final_Inspection_Date_F__c
+        @AuraEnabled
+        public Date rCReturnToOffice;       //RC淇悊鍝佽繑閫佹棩      RC_return_to_office__c
+        @AuraEnabled
+        public Boolean iFApproved;          //瀛︿細.鏄惁闇�瑕佺敵璇峰喅瑁�
+        @AuraEnabled
+        public String meetingApprovedNo;    //瀛︿細.浼氳鍐宠缂栫爜
+        @AuraEnabled
+        public String approvedStatus;       //瀛︿細.鍐宠鐘舵��   Approved_Status__c
+        @AuraEnabled
+        public List<String> statusList;
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexLoanerArrangedEmailController.cls-meta.xml b/force-app/main/default/classes/LexLoanerArrangedEmailController.cls-meta.xml
new file mode 100644
index 0000000..9662499
--- /dev/null
+++ b/force-app/main/default/classes/LexLoanerArrangedEmailController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>50.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js b/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js
index 45073e5..4e09ac0 100644
--- a/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js
+++ b/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js
@@ -4,8 +4,8 @@
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 import { updateRecord } from 'lightning/uiRecordApi';
 
-import init from '@salesforce/apex/LoanerArrangedEmailController.init';
-import getRentalApplyEquipmentSet from '@salesforce/apex/LoanerArrangedEmailController.getRentalApplyEquipmentSet';
+import init from '@salesforce/apex/LexLoanerArrangedEmailController.init';
+import getRentalApplyEquipmentSet from '@salesforce/apex/LexLoanerArrangedEmailController.getRentalApplyEquipmentSet';
 import approvalCheck from '@salesforce/apex/RentalApplyWebService.approvalCheck';
 import setShipment_request from '@salesforce/apex/RentalApplyWebService.setShipment_request';
 export default class lexLoanerArrangedEmail extends LightningElement {

--
Gitblit v1.9.1