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

---
 force-app/main/default/classes/TransferApplyWebService.cls                                             |  214 +
 force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.html                              |    3 
 force-app/main/default/classes/OpportunityLightingButtonController.cls                                 |  204 +
 force-app/main/default/lwc/lexLoseReport/lexLoseReport.html                                            |    6 
 force-app/main/default/lwc/lexCancelReport/lexCancelReport.css                                         |   10 
 force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.js-meta.xml                                           |   11 
 force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.js                                          |   53 
 force-app/main/default/lwc/lexQuotationProductNew/__tests__/lexQuotationProductNew.test.js             |   25 
 force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.js-meta.xml |   11 
 force-app/main/default/staticresources/connection20.resource-meta.xml                                  |    5 
 force-app/main/default/staticresources/connection20.js                                                 | 1935 +++++++++++++++++
 force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.html                    |    5 
 force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.html                                                  |    5 
 force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.html                  |    5 
 force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.html                                        |    5 
 force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.js                                        |   47 
 force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.html                      |    5 
 force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js                                  |   92 
 force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.html                                        |    5 
 force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.js                                                    |   61 
 force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.css                 |   22 
 force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.html                                |    5 
 force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.css                                           |   22 
 force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.js-meta.xml                                     |   11 
 force-app/main/default/classes/TransferApplyWebService.cls-meta.xml                                    |    5 
 force-app/main/default/lwc/lexQISSC/lexQISSC.html                                                      |    5 
 force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js                        |  101 
 force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.css                                         |   11 
 force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.js-meta.xml         |   11 
 force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.js                                              |  100 
 force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js-meta.xml                   |   10 
 force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.js-meta.xml                                 |   11 
 force-app/main/default/classes/QISReportController.cls                                                 |  314 ++
 force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.html                                |    5 
 force-app/main/default/classes/TransferApplyController.cls                                             |   31 
 force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.js                                          |  158 +
 force-app/main/default/lwc/lexLoseReport/lexLoseReport.js                                              |  102 
 force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.css                   |   11 
 force-app/main/default/classes/RentalApplyESetRefreshStatusController.cls                              |  100 
 force-app/main/default/lwc/lexQuotationRequest/__tests__/lexQuotationRequest.test.js                   |   25 
 force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.js                      |   39 
 force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js-meta.xml               |   11 
 force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.css                                       |   22 
 force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.html                                  |   11 
 force-app/main/default/lwc/lexQISSC/lexQISSC.js                                                        |   96 
 force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.css                           |   11 
 force-app/main/default/lwc/lexCancelApply/lexCancelApply.js                                            |  100 
 force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.js-meta.xml                                 |   11 
 force-app/main/default/lwc/lexQISSC/lexQISSC.js-meta.xml                                               |   11 
 force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js                                  |   39 
 force-app/main/default/lwc/lexCancelApply/lexCancelApply.html                                          |    4 
 force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.css                     |   11 
 force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.html                          |    6 
 force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.css                                 |   10 
 force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.js                                    |  103 
 force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.html                |    5 
 force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.js          |   91 
 force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js-meta.xml                         |   11 
 force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.css                                             |   10 
 force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.html                                            |    5 
 force-app/main/default/lwc/lexStockApply/lexStockApply.js-meta.xml                                     |   11 
 force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.css                                 |   11 
 force-app/main/default/lwc/lexCancelReport/lexCancelReport.js                                          |  116 +
 force-app/main/default/classes/SelectSubstituteControllerLWT.cls                                       |  633 +++++
 force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.js-meta.xml                       |   11 
 force-app/main/default/classes/LightingButtonConstant.cls                                              |    7 
 force-app/main/default/lwc/lexLoseReport/__tests__/lexLoseReport.test.js                               |   25 
 force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.css                                                   |   22 
 force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.js                                          |  231 ++
 force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.html                                          |    5 
 force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js-meta.xml                         |   11 
 force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.js                            |   38 
 force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.js                                  |   73 
 force-app/main/default/lwc/lexLoseReport/lexLoseReport.css                                             |   10 
 force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.js-meta.xml                   |   11 
 force-app/main/default/lwc/lexStockApply/lexStockApply.css                                             |   10 
 force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.css                                 |   11 
 force-app/main/default/lwc/lexQISSC/lexQISSC.css                                                       |   22 
 force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.js-meta.xml                   |   11 
 force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.css                                         |   10 
 force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.html                                |   14 
 force-app/main/default/lwc/lexCancelApply/lexCancelApply.js-meta.xml                                   |   11 
 force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.js-meta.xml             |   11 
 force-app/main/default/classes/RentalApplyESetRefreshStatusController.cls-meta.xml                     |    5 
 force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.css                                         |   11 
 force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.html                          |    5 
 force-app/main/default/lwc/lexStockApply/lexStockApply.html                                            |    6 
 force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js                            |  332 ++
 force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.js-meta.xml                               |   11 
 force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.js                                |   35 
 force-app/main/default/classes/TransferApplyController.cls-meta.xml                                    |    5 
 force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.js-meta.xml           |   11 
 force-app/main/default/lwc/lexCancelReport/__tests__/lexCancelReport.test.js                           |   25 
 force-app/main/default/lwc/lexCancelReport/lexCancelReport.html                                        |    6 
 force-app/main/default/lwc/lexCancelReport/lexCancelReport.js-meta.xml                                 |   11 
 force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.js                    |  107 
 force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.html        |    5 
 force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.js-meta.xml                                 |   11 
 force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.js-meta.xml                                   |   11 
 force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.js                            |   67 
 force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.css                       |   11 
 force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.css         |   11 
 force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.js                                            |  101 
 force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.js-meta.xml                         |   11 
 force-app/main/default/lwc/lexStockApply/__tests__/lexStockApply.test.js                               |   25 
 force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.js                  |   98 
 /dev/null                                                                                              |    4 
 force-app/main/default/classes/SelectSubstituteControllerLWT.cls-meta.xml                              |    5 
 force-app/main/default/lwc/lexLoseReport/lexLoseReport.js-meta.xml                                     |   11 
 force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.html                                        |    5 
 force-app/main/default/lwc/lexStockApply/lexStockApply.js                                              |  114 +
 force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.html                                      |    5 
 112 files changed, 6,607 insertions(+), 147 deletions(-)

diff --git a/.husky/pre-commit b/.husky/pre-commit
deleted file mode 100644
index feac116..0000000
--- a/.husky/pre-commit
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-. "$(dirname "$0")/_/husky.sh"
-
-npm run precommit
\ No newline at end of file
diff --git a/force-app/main/default/classes/LightingButtonConstant.cls b/force-app/main/default/classes/LightingButtonConstant.cls
index c68ab80..dac8ac7 100644
--- a/force-app/main/default/classes/LightingButtonConstant.cls
+++ b/force-app/main/default/classes/LightingButtonConstant.cls
@@ -69,6 +69,13 @@
     public static final String USER_ACCESS_EDIT = '_Edit';
     //userAccess鍙傛暟鍚庣紑_Read
     public static final String USER_ACCESS_READ = '_Read';
+    //浠诲姟鐨勫悕瀛椻�樹腑鏍囩粨鏋滅‘璁も��
+    public static final String TASK_NAME_BY_CONFIRMATION_OF_WINNING_BID = '涓爣缁撴灉纭';
+    //璇环鐨凜onfirmationofAward__c瀛楁鍊尖�極LY涓爣鈥�
+    public static final String OPPORTUNITY_CONFIRMATION_OF_AWARD_OLY_WIN_BID = 'OLY涓爣';
+     //璇环鐨凜onfirmationofAward__c瀛楁鍊尖�樼珵浜夊鎵嬩腑鏍団��
+     public static final String OPPORTUNITY_CONFIRMATION_OF_AWARD_LOSE_BID = '绔炰簤瀵规墜涓爣';
+    public static final String PREDICTED_DATE_STATUS = '瀹℃壒涓�';
     public static final String CN_YES = '鏄�';
     public static final String CN_NO = '鍚�';
     public static final String VOC_NAME = 'VOC';
diff --git a/force-app/main/default/classes/OpportunityLightingButtonController.cls b/force-app/main/default/classes/OpportunityLightingButtonController.cls
index 45124f4..5c0b778 100644
--- a/force-app/main/default/classes/OpportunityLightingButtonController.cls
+++ b/force-app/main/default/classes/OpportunityLightingButtonController.cls
@@ -4,7 +4,7 @@
  * @Author: chen jing wu
  * @Date: 2023-04-12 11:16:07
  * @LastEditors: chen jing wu
- * @LastEditTime: 2023-04-13 17:02:46
+ * @LastEditTime: 2023-04-14 17:24:54
  */
 public with sharing class OpportunityLightingButtonController {
     @AuraEnabled
@@ -184,6 +184,127 @@
         return res;
     }
     @AuraEnabled
+    public static InitData initForCancelReportButton(String recordId){
+        InitData res = new InitData();
+        try {
+        Opportunity opportunity = [
+            select
+            StageName,
+            SAP_Send_OK__c,
+            Cnt_Lost_cancel_report__c,
+            Cnt_Lost_cancel_Draft__c,
+            Job_category__c,
+            Bidding_Project_Name_Bid__c,
+            Name,
+            Sales_assistant_name__c,
+            Sales_assistant_ID__c,
+            Manager_name__c,
+            Sales_manager_departmentID__c,
+            Sales_owner_buchang__c,
+            Sales_owner_buchangID__c
+            from Opportunity where Id =: recordId
+        ];
+        res.stageName = opportunity.StageName;
+        res.sapSendOK = opportunity.SAP_Send_OK__c;
+        res.cntLostCancelReport = opportunity.Cnt_Lost_cancel_report__c;
+        res.cntLostCancelDraft = opportunity.Cnt_Lost_cancel_Draft__c;
+        res.jobCategory = opportunity.Job_category__c;
+        res.biddingProjectNameBid = opportunity.Bidding_Project_Name_Bid__c;
+        res.name = opportunity.Name;
+        res.salesAssistantName = opportunity.Sales_assistant_name__c;
+        res.salesAssistantID = opportunity.Sales_assistant_ID__c;
+        res.managerName = opportunity.Manager_name__c;
+        res.salesManagerDepartmentID = opportunity.Sales_manager_departmentID__c;
+        res.salesOwnerBuchang = opportunity.Sales_owner_buchang__c;
+        res.salesOwnerBuchangID = opportunity.Sales_owner_buchangID__c;
+        } catch (Exception e) {
+            throw new AuraHandledException(e.getMessage());
+        }
+        return res;
+    }
+    @AuraEnabled
+    public static InitData initForLostReportButton(String recordId){
+        InitData res = new InitData();
+        try {
+            Opportunity opportunity = [
+                select
+                StageName,
+                SAP_Send_OK__c,
+                Cnt_Lost_cancel_report__c,
+                Name,
+                Sales_assistant_name__c,
+                Sales_assistant_ID__c,
+                Manager_name__c,
+                Sales_manager_departmentID__c,
+                Sales_owner_buchang__c,
+                Sales_owner_buchangID__c
+                from Opportunity where Id =: recordId
+            ];
+            res.stageName = opportunity.StageName;
+            res.sapSendOK = opportunity.SAP_Send_OK__c;
+            res.cntLostCancelReport = opportunity.Cnt_Lost_cancel_report__c;
+            res.name = opportunity.Name;
+            res.salesAssistantName = opportunity.Sales_assistant_name__c;
+            res.salesAssistantID = opportunity.Sales_assistant_ID__c;
+            res.managerName = opportunity.Manager_name__c;
+            res.salesManagerDepartmentID = opportunity.Sales_manager_departmentID__c;
+            res.salesOwnerBuchang = opportunity.Sales_owner_buchang__c;
+            res.salesOwnerBuchangID = opportunity.Sales_owner_buchangID__c;
+        } catch (Exception e) {
+            throw new AuraHandledException(e.getMessage());
+        }
+        return res;
+    }
+    @AuraEnabled
+    public static InitData initForQuotationRequestButton(String recordId){
+        InitData res = new InitData();
+        try {
+            Opportunity opportunity = [
+                select
+                Bidding_Project_Name_Bid__r.Id,
+                Estimation_Id__c
+                from Opportunity where Id =: recordId
+            ];
+            res.biddingProjectNameBidId = opportunity.Bidding_Project_Name_Bid__r.Id;
+            res.estimationId = opportunity.Estimation_Id__c;
+        } catch (Exception e) {
+            throw new AuraHandledException(e.getMessage());
+        }
+        return res;
+    }
+    @AuraEnabled
+    public static InitData initForStockApplyButton(String recordId){
+        InitData res = new InitData();
+        try {
+            Opportunity opportunity = [
+                select
+                Stock_apply_status__c,
+                Last_opportunity_file__r.Id
+                from Opportunity where Id =: recordId
+            ];
+            res.stockApplyStatus = opportunity.Stock_apply_status__c;
+            res.lastOpportunityFileId = opportunity.Last_opportunity_file__r.Id;
+        } catch (Exception e) {
+            throw new AuraHandledException(e.getMessage());
+        }
+        return res;
+    }
+    @AuraEnabled
+    public static InitData initForQuotationProductNewButton(String recordId){
+        InitData res = new InitData();
+        try {
+            Opportunity opportunity = [
+                select
+                CurrencyIsoCode
+                from Opportunity where Id =: recordId
+            ];
+            res.currencyIsoCode = opportunity.CurrencyIsoCode;
+        } catch (Exception e) {
+            throw new AuraHandledException(e.getMessage());
+        }
+        return res;
+    }
+    @AuraEnabled
     public static string updateForAgencyAuthorizeButton(String recordId){
         try {
             Opportunity opp = new Opportunity();
@@ -205,7 +326,7 @@
         try {
             Opportunity opp = new Opportunity();
             opp.Id = recordId;
-            opp.ConfirmationofAward__c = '绔炰簤瀵规墜涓爣';
+            opp.ConfirmationofAward__c = LightingButtonConstant.OPPORTUNITY_CONFIRMATION_OF_AWARD_LOSE_BID;
             update opp;
             return null;
         } catch (Exception e) {
@@ -219,9 +340,28 @@
     public static string updateForOLYwinBidButton(String recordId){
         try {
             Opportunity opp = [select ConfirmationofAward__c,Closing_Bid_Date__c from Opportunity where Id =: recordId];
-            opp.ConfirmationofAward__c = 'OLY涓爣';
+            opp.ConfirmationofAward__c = LightingButtonConstant.OPPORTUNITY_CONFIRMATION_OF_AWARD_OLY_WIN_BID;
             if (opp.Closing_Bid_Date__c == null) {
                 opp.Closing_Bid_Date__c = Date.today();
+            }
+            update opp;
+            return null;
+        } catch (Exception e) {
+            String eMessage = e.getMessage();
+            Integer left = eMessage.indexOf(',') + 1;
+            Integer right = eMessage.length();
+            return eMessage.substring(left,right);
+        }
+    }
+    @AuraEnabled
+    public static string updateForStockApplyButton(String recordId,Boolean flag){
+        try {
+            Opportunity opp = new Opportunity();
+            opp.Id = recordId;
+            if(flag){
+                opp.Stock_apply_status__c  = '濉啓瀹屾瘯';
+            }else {
+                opp.Stock_apply_status__c = '鑽夋涓�';
             }
             update opp;
             return null;
@@ -239,7 +379,7 @@
             rac = [
                 select 
                 id 
-                from InquiryPredictsDateChange__c where Predicted_Date_Status__c = '瀹℃壒涓�' and Opportunity__c =:recordId];
+                from InquiryPredictsDateChange__c where Predicted_Date_Status__c = :LightingButtonConstant.PREDICTED_DATE_STATUS and Opportunity__c =:recordId];
         } catch (Exception e) {
             System.debug('e:****' + e);
         }
@@ -249,10 +389,11 @@
     public static List<task__c> queryForLoseBidButton(String recordId){
         List<task__c> tasks = null;
         try {
+            String obscureName = '%' + LightingButtonConstant.TASK_NAME_BY_CONFIRMATION_OF_WINNING_BID + '%';
             tasks = [
                 select
                 taskStatus__c
-                from task__c where OpportunityId__c =: recordId and name like '%涓爣缁撴灉纭%'];
+                from task__c where OpportunityId__c =: recordId and name like :obscureName];
         } catch (Exception e) {
             System.debug('e:****' + e);
         }
@@ -262,14 +403,45 @@
     public static List<task__c> queryForOLYwinBidButton(String recordId){
         List<task__c> tasks = null;
         try {
+            String obscureName = '%' + LightingButtonConstant.TASK_NAME_BY_CONFIRMATION_OF_WINNING_BID + '%';
             tasks = [
                 select
                 taskStatus__c
-                from task__c where OpportunityId__c =: recordId and name like '%涓爣缁撴灉纭%'];
+                from task__c where OpportunityId__c =: recordId and name like :obscureName];
         } catch (Exception e) {
             System.debug('e:****' + e);
         }
         return tasks;
+    }
+    @AuraEnabled
+    public static List<Tender_Opportunity_Link__c> queryForCancelReportButton(String recordId){
+        List<Tender_Opportunity_Link__c> links = null;
+        try {
+            links = [
+                select id,
+                Tender_information__r.subInfoType__c
+                from Tender_Opportunity_Link__c 
+                where (Tender_information__r.subInfoType__c = '3-1锛氬簾鏍囧叕鍛�' OR Tender_information__r.subInfoType__c ='3-2锛氭祦鏍囧叕鍛�') and Opportunity__c =: recordId
+            ];
+        } catch (Exception e) {
+            System.debug('e:****' + e);
+        }
+        return links;
+    }
+    @AuraEnabled
+    public static List<QuoteIrai__c > queryForQuotationRequestButton(String recordId){
+        List<QuoteIrai__c> quotes = null;
+        try {
+            String opportunityId = '%' + recordId + '%';
+            quotes = [
+                select 
+                id 
+                from QuoteIrai__c where Note__c like :opportunityId and QuoteIrai_Status__c = '鑽夋涓�'
+            ];
+        } catch (Exception e) {
+            System.debug('e:****' + e);
+        }
+        return quotes;
     }
     public class InitData{
         @AuraEnabled
@@ -328,5 +500,25 @@
         public String salesAssistantName;
         @AuraEnabled
         public String salesAssistantID;
+        @AuraEnabled
+        public String jobCategory;
+        @AuraEnabled
+        public String biddingProjectNameBid;
+        @AuraEnabled
+        public String managerName;
+        @AuraEnabled
+        public String salesManagerDepartmentID;
+        @AuraEnabled
+        public String salesOwnerBuchang;
+        @AuraEnabled
+        public String salesOwnerBuchangID;
+        @AuraEnabled
+        public String biddingProjectNameBidId;
+        @AuraEnabled
+        public String stockApplyStatus;
+        @AuraEnabled
+        public String lastOpportunityFileId;
+        @AuraEnabled
+        public String currencyIsoCode;
     }
 }
\ No newline at end of file
diff --git a/force-app/main/default/classes/QISReportController.cls b/force-app/main/default/classes/QISReportController.cls
index 3d6a036..296a17c 100644
--- a/force-app/main/default/classes/QISReportController.cls
+++ b/force-app/main/default/classes/QISReportController.cls
@@ -350,7 +350,6 @@
         }
          return re;
     }
-
     //OCSM涓嶈鎶ュ憡
     @AuraEnabled
     public static InitData initForlexOCSMNoToReportLightingButton (String recordId){
@@ -413,6 +412,7 @@
         }
          return re;
     }
+
     //鍙戦�丵IS鍒癝PO
     @AuraEnabled
     public static InitData initForlexSendQISButton (String recordId){
@@ -502,6 +502,243 @@
         }
          return re;
     }
+    // QIS甯傚満閮ㄦ剰瑙�
+    @AuraEnabled
+    public static InitData initForlexQISSCButton (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,name,QIS_SC_Report__c,QIS_SC_Id__c,next_action__c,QIS_Market_Category__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+            res.Id = report.Id;
+            res.name = report.name;
+            res.profileName = userinfo.Profile.name;
+            res.qISSCId = report.QIS_SC_Id__c;
+            res.qISSCReport = report.QIS_SC_Report__c;
+            res.nextaction = report.next_action__c;
+            res.qISMarketCategory = report.QIS_Market_Category__c;
+            System.debug(LoggingLevel.INFO, '*** res: ' + res);
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+        }
+        return res;
+    }
+     // 鏂板缓淇悊
+    @AuraEnabled
+    public static InitData initForlexCreateRepairButton (String recordId){
+        InitData res = new initData();
+        ID myUserID = UserInfo.getUserId();
+        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,
+                                Which_Project__c,Report_For_Goz__c,Relation_With_The_Problem__c,Damage_For_Doc_Or_Pat__c,
+                                Trable_occur_daY_collect__c,source_for_repair__c,Faliour_date__c,OwnerId,nonyushohin__c,nonyushohin__r.name,
+                                Hospital_Department__c,Hospital_Department__r.name,Department_Class__c,Department_Class__r.name,Hospital__c,Hospital__r.name,name,Source_OnCall__c,Source_OnCall__r.name,
+                                failuer_situation__c,Comment__c,Is_Used_For_The_Opera__c,RecordType_ID__c,
+                                OCM_judgement__c,next_action__c,Special_follow__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+        Account acc = [SELECT id,ParentId,Parent.RecordTypeId, 
+                        Parent.Parent.FSE_GI_Main_Leader__c,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 = :report.Hospital_Department__c limit 1];
+        try{
+            
+            res.Id = report.Id;
+            res.qisRecordTypeId = report.RecordType_ID__c;
+            res.oCMjudgement = report.OCM_judgement__c;
+            res.nextaction = report.next_action__c;
+            res.comment = report.Comment__c;
+            res.sourceOnCall = report.Source_OnCall__c;
+            res.sourceOnCallname = report.Source_OnCall__r.name;
+            res.name = report.name;
+            res.hospitalId = report.Hospital__c;
+            res.hospitalname = report.Hospital__r.name;
+            res.departmentClassId = report.Department_Class__c;
+            res.departmentClassname = report.Department_Class__r.name;
+            res.hospitalDepartment = report.Hospital_Department__c;
+            res.hospitalDepartmentname = report.Hospital_Department__r.name;
+            res.nonyushohinId = report.nonyushohin__c;
+            res.nonyushohinIdname = report.nonyushohin__r.name;
+            res.ownerId = report.OwnerId;
+            res.faliourdate = report.Faliour_date__c;
+            res.sourceforrepair = report.source_for_repair__c;
+            res.repairSalesPointProvinceChina = userinfo.RepairSalesPoint_Province_China__c;
+            res.trableoccurdaYcollect = report.Trable_occur_daY_collect__c;
+            res.damageForDocOrPat = report.Damage_For_Doc_Or_Pat__c;
+            res.relationWithTheProblem = report.Relation_With_The_Problem__c;
+            res.reportForGoz = report.Report_For_Goz__c;
+            res.whichProject = report.Which_Project__c;
+            res.operaName = report.Opera_Name__c;
+            res.breakORFallOff = report.BreakORFallOff__c;
+            res.setusageproduct = report.Set_usage_product__c;
+            res.afterFailureInformation = report.AfterFailureInformation__c;
+            res.delay15Min = report.Delay15Min__c;
+            res.informationFrom = report.InformationFrom__c;
+            res.failureQInHospital = report.FailureQInHospital__c;
+            res.ownername = report.Owner.name;
+            res.failuerSituation = report.failuer_situation__c;
+            res.isUsedForTheOpera = report.Is_Used_For_The_Opera__c;
+            res.specialfollow = report.Special_follow__c;
+            res.accParentId = acc.ParentId;
+            res.accParentRecordTypeId = acc.Parent.RecordTypeId;
+            res.accParentParentFSEGIMainLeader = acc.Parent.Parent.FSE_GI_Main_Leader__c;
+            res.accParentParentFSEGIMainLeaderWorkLocation = acc.Parent.Parent.FSE_GI_Main_Leader__r.Work_Location__c;
+            res.accParentParentFSESPMainLeader = acc.Parent.Parent.FSE_SP_Main_Leader__c;
+            res.accParentParentFSESPMainLeaderWorkLocation = acc.Parent.Parent.FSE_SP_Main_Leader__r.Work_Location__c;
+            System.debug(LoggingLevel.INFO, '*** res: ' + res);
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+        }
+        return res;
+    }
+     // PDF(QIS鐢宠涔�)
+    @AuraEnabled
+    public static InitData initForlexPDFQISrequestButton (String recordId){
+        InitData res = new initData();
+        try{
+            QIS_Report__c report = [SELECT  id FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+            res.Id = report.Id;
+            System.debug(LoggingLevel.INFO, '*** res: ' + res);
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+        }
+        return res;
+    }
+
+    // OCSM鏈嶅姟鏈儴妫�娴嬪畬姣�
+    @AuraEnabled
+    public static InitData initForlexRCinspectioncompletedateButton (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 ,RC_inspection_date__c,QIS_Status__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+            res.Id = report.Id;
+            res.rCinspectionDate = report.RC_inspection_date__c;
+            res.QIStatus = report.QIS_Status__c;
+            System.debug(LoggingLevel.INFO, '*** res: ' + res);
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+        }
+        return res;
+    }
+
+    @AuraEnabled
+    public static String updateQisForRCinspectioncompletedate (String recordId){
+        String re = '鎴愬姛'; 
+        ID myUserID = UserInfo.getUserId();
+        User userinfo = [SELECT id,Alias FROM User WHERE Id = :myUserID LIMIT 1];
+
+        try{    
+                QIS_Report__c rac  = new QIS_Report__c();   
+                rac.id = recordId;
+                rac.RC_inspection_date__c  = Date.today();
+                rac.RC__c = myUserID;
+                rac.RC_Inspection_staff__c  = userinfo.Alias;
+                update rac;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+            re = e.getMessage();
+        }
+         return re;
+    }
+    // OSH妫�鏌ュ彈鐞�
+    @AuraEnabled
+    public static InitData initForlexOSHInspectButton (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 ,OSHInspectionDate__c,QIS_Status__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+            res.Id = report.Id;
+            res.oSHInspectionDate = report.OSHInspectionDate__c;
+            res.QIStatus = report.QIS_Status__c;
+            System.debug(LoggingLevel.INFO, '*** res: ' + res);
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+        }
+        return res;
+    }
+
+    @AuraEnabled
+    public static String updateQisForlexOSHInspect (String recordId){
+        String re = '鎴愬姛'; 
+        try{    
+                QIS_Report__c rac  = new QIS_Report__c();   
+                rac.id = recordId;
+                rac.OSHInspectionDate__c   = Date.today();
+                update rac;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+            re = e.getMessage();
+        }
+         return re;
+    }
+
+     //     澶嶅埗1
+   @AuraEnabled
+    public static InitData initForlexcopyQISButton (String recordId){
+        InitData res = new initData();
+        try{
+            QIS_Report__c report = [SELECT  id,Name,QIS_Status__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];  
+            res.Id = report.Id;
+            res.name = report.Name;
+            res.qIStatus = report.QIS_Status__c;
+            System.debug(LoggingLevel.INFO, '*** res: ' + res);
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+        }
+        return res;
+    }
+
+     // OCSM鏃犲疄鐗╅�佽揪
+    @AuraEnabled
+    public static InitData initForlexOCSMNogoodsButton (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 ,QIS_Status__c,isAE_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.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 updatelexOCSMNogoods (String recordId){
+        String re = '鎴愬姛'; 
+        ID myUserID = UserInfo.getUserId();
+        User userinfo = [SELECT Id,Alias__c,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;
+                if (userinfo != null) {
+                    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;
+                }
+                rac.CDS_date__c    = Date.today();
+                rac.RC_CDS_staff__c   = userinfo.Alias__c;
+                rac.OCSM_Nogoods__c   = true;
+                update rac;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+            re = e.getMessage();
+        }
+         return re;
+    }
     public class InitData{
         @AuraEnabled
         public String Id;
@@ -512,7 +749,75 @@
         @AuraEnabled
         public String qISSCId;
         @AuraEnabled
+        public String accParentId;
+        @AuraEnabled
+        public String accParentRecordTypeId;
+        @AuraEnabled
+        public String accParentParentFSEGIMainLeader;
+        @AuraEnabled
+        public String accParentParentFSEGIMainLeaderWorkLocation;
+        @AuraEnabled
+        public String accParentParentFSESPMainLeader;
+        @AuraEnabled
+        public String accParentParentFSESPMainLeaderWorkLocation;
+        @AuraEnabled
+        public String oCMjudgement;
+        @AuraEnabled
+        public String comment;
+        @AuraEnabled
+        public String isUsedForTheOpera;
+        @AuraEnabled
+        public String failuerSituation;
+        @AuraEnabled
+        public String sourceOnCall;
+        @AuraEnabled
+        public String sourceOnCallname;
+        @AuraEnabled
+        public String hospitalId;
+        @AuraEnabled
+        public String hospitalname;
+        @AuraEnabled
+        public String departmentClassId;
+        @AuraEnabled
+        public String departmentClassname;
+        @AuraEnabled
+        public String hospitalDepartment;
+        @AuraEnabled
+        public String hospitalDepartmentname;
+        @AuraEnabled
+        public String nonyushohinId;
+        @AuraEnabled
+        public String nonyushohinIdname;
+        @AuraEnabled
+        public String sourceforrepair;
+        @AuraEnabled
+        public String repairSalesPointProvinceChina;
+        @AuraEnabled
+        public String damageForDocOrPat;
+        @AuraEnabled
+        public String relationWithTheProblem;
+        @AuraEnabled
+        public String reportForGoz;
+        @AuraEnabled
+        public String whichProject;
+        @AuraEnabled
+        public String operaName;
+        @AuraEnabled
+        public String breakORFallOff;
+        @AuraEnabled
+        public String setusageproduct;
+        @AuraEnabled
+        public String afterFailureInformation;
+        @AuraEnabled
+        public String delay15Min;
+        @AuraEnabled
+        public String informationFrom;
+        @AuraEnabled
+        public String failureQInHospital;
+        @AuraEnabled
         public String ownerId;
+        @AuraEnabled
+        public String ownername;
         @AuraEnabled
         public String qisRecordTypeId;
         @AuraEnabled
@@ -556,6 +861,10 @@
         @AuraEnabled
         public Date oSHInspectionDate;
         @AuraEnabled
+        public Date faliourdate;
+        @AuraEnabled
+        public Date trableoccurdaYcollect;
+        @AuraEnabled
         public Date cdsdate;
         @AuraEnabled
         public Date awaredate;
@@ -567,6 +876,9 @@
         public Boolean isaohuiproduct;
         @AuraEnabled
         public Boolean isSendQIS;
+        @AuraEnabled
+        public Boolean specialfollow;
+        
     }
 
 }
\ No newline at end of file
diff --git a/force-app/main/default/classes/RentalApplyESetRefreshStatusController.cls b/force-app/main/default/classes/RentalApplyESetRefreshStatusController.cls
new file mode 100644
index 0000000..d809cbf
--- /dev/null
+++ b/force-app/main/default/classes/RentalApplyESetRefreshStatusController.cls
@@ -0,0 +1,100 @@
+public with sharing class RentalApplyESetRefreshStatusController {
+    public RentalApplyESetRefreshStatusController() {
+        
+    }
+    @AuraEnabled
+    public static String eSetRefreshStatus(String raeSetId) {
+        return eSetRefreshStatusBatch(new List<String> {raeSetId});
+    }
+  
+    public static String eSetRefreshStatusBatch(List<String> raeSetIds) {
+        List<Rental_Apply_Equipment_Set__c> updateList1 = new List<Rental_Apply_Equipment_Set__c>();
+
+        if (!raeSetIds.isEmpty()) {
+            for (Rental_Apply_Equipment_Set__c raes: [
+                    select Id,Repair_Status1__c,Repair_Status_Text__c,Final_reply_day__c,Final_reply_day_text__c,
+                            Received_Confirm_NG_Not_Return__c,Received_Confirm_NG_Not_Return_Text__c,
+                            Received_Confirm_Status_Text__c, Received_Confirm_Status_F__c
+                              , NG_Final_reply_day_Text__c
+                              , NG_Final_reply_day_F__c
+                              , Yizhouweixiu_Final_reply_day_Text__c
+                              , Yizhouweixiu_Final_reply_day_F__c
+                              , Extend_Final_reply_day_Text__c
+                              , Extend_Final_reply_day_F__c
+                              , QIS_Final_reply_day_Text__c
+                              , QIS_Final_reply_day_F__c
+                              , Repair_cancel_Final_reply_day_Text__c
+                              , Repair_cancel_Final_reply_day_F__c
+                              , Return_to_office_Final_reply_day_Text__c
+                              , Return_to_office_Final_reply_day_F__c
+                              , Repair_delete_Final_reply_day_Text__c
+                              , Repair_delete_Final_reply_day_F__c
+                              , Yigoudaihuo_Final_reply_day_Text__c
+                              , Yigoudaihuo_Final_reply_day_F__c
+                              , Guzhangpaicha_Final_reply_day_Text__c
+                              , Guzhangpaicha_Final_reply_day_F__c
+                              , Repair_Agreed_Quotation_Text__c
+                              , Repair_Agreed_Quotation_F__c
+                              , Return_to_office_Final_reply_day_U_RC__c
+                              , Return_to_office_Final_reply_day_U_RC_F__c
+                              , Extend_Date__c
+                              , Extend_Date_F__c
+                              , Received_NG_ReAssign_Text__c
+                              , Received_NG_ReAssign__c
+                        //銆怓Y23澶у強宸ㄥぇ璇鹃銆戦暱鍋囧鍝佸�熺敤寤舵湡寮�鍙� 2022/12/27 start xxf
+                              , Final_reply_day_Holiday_backup__c
+                              , NG_Final_reply_day_F_Holiday_backup__c
+                              , NG_Final_reply_day_Text_Holiday_backup__c
+                              , Yizhouweixiu_Final_reply_day_F_Holiday__c
+                              , Yizhouweixiu_Final_reply_day_TextHoliday__c
+                              , Extend_Final_reply_day_F_Holiday_backup__c
+                              , Extend_Final_reply_day_Text_Holiday_back__c
+                              , QIS_Final_reply_day_F_Holiday_backup__c
+                              , QIS_Final_reply_day_Text_Holiday_backup__c
+                              , Repair_cancel_Final_reply_day_F_Holiday__c
+                              , Repair_cancel_Final_reply_day_Text_Holid__c
+                              , Return_to_office_Final_reply_day_F_Ho__c
+                              , Return_to_office_Final_reply_day_Text_Ho__c
+                              , Repair_delete_Final_reply_day_F_Holiday__c
+                              , Repair_delete_Final_reply_day_Text_Ho__c
+                              , Yigoudaihuo_Final_reply_day_F_Holiday__c
+                              , Yigoudaihuo_Final_reply_day_Text_Holiday__c
+                              , FGuzhangpaicha_Final_reply_day_F_Holiday__c
+                              , Guzhangpaicha_Final_reply_day_Text_Holid__c
+                              , Return_to_office_Final_reply_day_U_RC_Ho__c
+                              , Return_to_office_Final_reply_day_U_RC_FH__c
+                        //銆怓Y23澶у強宸ㄥぇ璇鹃銆戦暱鍋囧鍝佸�熺敤寤舵湡寮�鍙� 2022/12/27 end xxf
+                      from Rental_Apply_Equipment_Set__c
+                     where Id IN :raeSetIds
+            ]) {
+                Rental_Apply_Equipment_Set__c upd = UpdateRentalApplyEquipmentSetBatch.setRAES(raes);
+                if (upd != null) {
+                    updateList1.add(upd);
+                }
+            }
+        }
+//bp2
+//        List<Equipment_Set_Detail__c> esdList = [
+//                select Id,Asset_condition__c,Asset_condition_Text__c,
+//                       Serial_Lot__c,Serial_Lot_text__c,
+//                       Asset__r.Loaner_accsessary__c, Loaner_accsessary_text__c,
+//                       Active_judgement__c,Active_judgement_select__c,Active_judgement_text__c,
+//                       Last_Reserve_RAES_Detail_RAES_F__c,Last_Reserve_RAES_Detail_RAES_Id__c,
+//                       Equipment_Set_Last_Reserve_RAES_F__c,Equipment_Set_Last_Reserve_RAES_Id__c
+//                  from Equipment_Set_Detail__c 
+//                 where Equipment_Set__c IN :eSetIds];
+//        List<Equipment_Set_Detail__c> updateList2 = UpdateRentalApplyEquipmentSetBatch.setESD(esdList);
+
+        Savepoint sp = Database.setSavepoint();
+        try {
+            if (!updateList1.isEmpty()) update updateList1;
+//bp2            if (updateList2.size() > 0) update updateList2;
+            return '1';
+        } catch (System.Exception e) {
+            Database.rollback(sp);
+            return e.getMessage();
+        }
+        // return '1';
+    }
+    
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/RentalApplyESetRefreshStatusController.cls-meta.xml b/force-app/main/default/classes/RentalApplyESetRefreshStatusController.cls-meta.xml
new file mode 100644
index 0000000..d75b058
--- /dev/null
+++ b/force-app/main/default/classes/RentalApplyESetRefreshStatusController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>51.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/SelectSubstituteControllerLWT.cls b/force-app/main/default/classes/SelectSubstituteControllerLWT.cls
new file mode 100644
index 0000000..e184b48
--- /dev/null
+++ b/force-app/main/default/classes/SelectSubstituteControllerLWT.cls
@@ -0,0 +1,633 @@
+public with sharing class SelectSubstituteControllerLWT {
+    public SelectSubstituteControllerLWT() {
+
+    }
+    @AuraEnabled
+    public static InitData initFromSelectSubstituteButton(String recordId){
+        InitData res = new InitData();
+        try{
+            Rental_Apply_Equipment_Set__c report=[select
+                    Id,Rental_Apply__r.Status__c,Rental_Apply__r.Id
+            from Rental_Apply_Equipment_Set__c
+            where Id= :recordId];
+            res.id=report.Id;
+            res.RentalApplyId=report.Rental_Apply__r.Id;
+            res.Status=report.Rental_Apply__r.Status__c;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e);
+        }
+        return res;
+    }
+
+    @AuraEnabled
+    public static Rental_Apply_Equipment_Set__c initFromCustomSubmitButton(String recordId){
+
+        try{
+            Rental_Apply_Equipment_Set__c report=[select
+                    Id,Request_extend_day__c
+                    ,Extend_request_reason__c
+                    ,Rental_End_Date__c,
+                    Rental_Apply__c
+            from Rental_Apply_Equipment_Set__c
+            where Id= :recordId];
+
+            return report;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+
+    @AuraEnabled
+    public static InitData initFromLoanerArrangedEmailLButton(String recordId){
+        InitData res = new InitData();
+        try{
+            Rental_Apply_Equipment_Set__c report=[select
+                    Id,Rental_Apply__r.Status__c,Rental_Apply__c,Rental_Apply__r.Wei_Assigned_Cnt__c,
+                    Assigned_Not_Shipment__c,Rental_Apply__r.Bollow_Date__c
+            from Rental_Apply_Equipment_Set__c
+            where Id= :recordId];
+            res.id=report.Id;
+            res.RentalApplyC=report.Rental_Apply__c;
+            res.Status=report.Rental_Apply__r.Status__c;
+            res.WeiAssignedCntC=report.Rental_Apply__r.Wei_Assigned_Cnt__c;
+            res.BollowDateC=report.Rental_Apply__r.Bollow_Date__c;
+            res.AssignedNotShipmentC=report.Assigned_Not_Shipment__c;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e);
+        }
+        return res;
+    }
+
+    @AuraEnabled
+    public static InitData initClearReturnDeliverySlipButton(String recordId){
+        InitData res = new InitData();
+        try{
+            Rental_Apply_Equipment_Set__c report=[select
+                    Id,Rental_Apply__r.Status__c,Rental_Apply__c,Rental_Apply__r.Wei_Assigned_Cnt__c,
+                    Assigned_Not_Shipment__c,Rental_Apply__r.Bollow_Date__c
+            from Rental_Apply_Equipment_Set__c
+            where Id= :recordId];
+            res.id=report.Id;
+            res.RentalApplyC=report.Rental_Apply__c;
+            res.Status=report.Rental_Apply__r.Status__c;
+            res.WeiAssignedCntC=report.Rental_Apply__r.Wei_Assigned_Cnt__c;
+            res.BollowDateC=report.Rental_Apply__r.Bollow_Date__c;
+            res.AssignedNotShipmentC=report.Assigned_Not_Shipment__c;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e);
+        }
+        return res;
+    }
+
+    @AuraEnabled
+    public static Rental_Apply_Equipment_Set__c selectRentalApplyEquipmentSetByID(String recordId){
+        try{
+            Rental_Apply_Equipment_Set__c report=[select
+                    Cancel_Select__c,Irreplaceable_flag__c,RAES_Status__c,Shippment_loaner_time2__c
+            from Rental_Apply_Equipment_Set__c
+            where Id=:recordId];
+            return report;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+
+    @AuraEnabled
+    public static list<Rental_Apply_Equipment_Set_Detail__c> selectRentalApplyEquipmentSetByRACID(String recordId){
+        try{
+            list<Rental_Apply_Equipment_Set_Detail__c> report=[select Allow_Adjust_Queue_Flag__c
+            from Rental_Apply_Equipment_Set_Detail__c
+            where Rental_Apply__c = :recordId ];
+            return report;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+
+
+    @AuraEnabled
+    public static list<Rental_Apply__c> selectRentalApplyCByName(String recordId){
+        try{
+            list<Rental_Apply__c> report=[select
+                    Id,Campaign__c,Repair__c,Status__c, Demo_purpose1__c,Contract_pdf_updated__c,Repair_Final_Inspection_Date_F__c,RC_return_to_office__c
+            from Rental_Apply__c
+            where id=:recordId ];
+            return report;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+    @AuraEnabled
+    public static list<Campaign> selectCampaignById(String recordId){
+        try{
+            list<Campaign> report=[select
+                    Status, Rental_Apply_Flag__c,IF_Approved__c,Meeting_Approved_No__c,Approved_Status__c
+            from Campaign
+            where id =:recordId ];
+            return report;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+    @AuraEnabled
+    public static String getSessionId(){
+        return UserInfo.getSessionId();
+    }
+
+
+    @AuraEnabled
+    public static list<Rental_Apply_Equipment_Set__c> selectRaesById1(String recordId){
+        try{
+            list<Rental_Apply_Equipment_Set__c> report=[select Id
+            from Rental_Apply_Equipment_Set__c
+            where Rental_Apply__c = :recordId
+            and Shippment_loaner_time2__c != null
+            and RAES_Status__c != '宸插垎閰�'
+            and RAES_Status__c != '鍙栨秷鍒嗛厤'
+            ];
+            return report;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+    @AuraEnabled
+    public static list<Rental_Apply_Equipment_Set__c> selectRaesById2(String recordId){
+        try{
+            list<Rental_Apply_Equipment_Set__c> report=[select Id
+            from Rental_Apply_Equipment_Set__c
+            where Rental_Apply__c = :recordId
+            and RAES_Status__c != '宸插垎閰�'
+            and RAES_Status__c != '鍙栨秷鍒嗛厤'
+            ];
+            return report;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+
+    @AuraEnabled
+    public static list<Rental_Apply__c> selectRacById(String recordId){
+        try{
+            list<Rental_Apply__c> report=[SELECT
+                    Id, JingliApprovalManager__c, SalesManager__c
+                    , BuchangApprovalManager__c
+                    , BuchangApprovalManagerSales__c
+                    , ZongjianApprovalManager__c
+            FROM Rental_Apply__c
+            WHERE Id = :recordId
+            ];
+            return report;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+
+    @AuraEnabled
+    public static UpdateResult updateRaesc(
+            String recordId,
+            String JingliApprovalManagerc,
+            String SalesManagerc,
+            String BuchangApprovalManagerc,
+            String BuchangApprovalManagerSalesc,
+            String ZongjianApprovalManagerc,
+            String ExtendStatusc
+    ) {
+        UpdateResult result = new UpdateResult();
+        result.recordId = recordId;
+        try{
+            // 鏇存柊璁板綍骞惰幏鍙栫粨鏋�
+            if(recordId==null) return null;
+            Rental_Apply_Equipment_Set__c rac = new Rental_Apply_Equipment_Set__c( id=recordId);
+
+            if(JingliApprovalManagerc!=null&& JingliApprovalManagerc != ''){
+                rac.JingliApprovalManager__c=JingliApprovalManagerc;
+            }
+            if(SalesManagerc!=null&&SalesManagerc!=''){
+                rac.SalesManager__c=SalesManagerc;
+            }
+            if(BuchangApprovalManagerc!=null&&BuchangApprovalManagerc!=''){
+                rac.BuchangApprovalManager__c=BuchangApprovalManagerc;
+            }
+            if(BuchangApprovalManagerSalesc!=null&&BuchangApprovalManagerSalesc!=''){
+                rac.BuchangApprovalManagerSales__c=BuchangApprovalManagerSalesc;
+            }
+
+            if(ZongjianApprovalManagerc!=null&&ZongjianApprovalManagerc!=''){
+                rac.ZongjianApprovalManager__c=ZongjianApprovalManagerc;
+            }
+            if(ExtendStatusc!=null&&ExtendStatusc!=''){
+                rac.Extend_Status__c=ExtendStatusc;
+            }
+            if(rac.id==null)return null;
+            update rac;
+            result.success = true;
+            result.errors = new List<String>();
+            return result;
+        }catch(Exception e){
+            result.success = false;
+            result.errors = new List<String>();
+            result.errors.add(e.getMessage());
+            System.debug(LoggingLevel.INFO,'Rental_Apply__c update Error : ' + e);
+        }
+        return result;
+    }
+
+    @AuraEnabled
+    public static UpdateResult updateRaescList(
+            list<Rental_Apply_Equipment_Set_Detail__c> updateList
+    ) {
+        UpdateResult result = new UpdateResult();
+        try{
+            for(Rental_Apply_Equipment_Set_Detail__c item : updateList) {
+                item.Return_DeliverySlip__c = null;
+                item.Asset_return_time__c = null;
+            }
+            update updateList;
+            result.success = true;
+            result.errors = new List<String>();
+            return result;
+        }catch(Exception e){
+            result.success = false;
+            result.errors = new List<String>();
+            result.errors.add(e.getMessage());
+            System.debug(LoggingLevel.INFO,'Rental_Apply__c update Error : ' + e);
+        }
+        return result;
+    }
+
+    @AuraEnabled
+    public static list<Rental_Apply_Equipment_Set_Detail__c> selectRaesdcId(String recordId){
+        try{
+            list<Rental_Apply_Equipment_Set_Detail__c> report=[Select
+                    Id
+            From Rental_Apply_Equipment_Set_Detail__c
+            Where Return_DeliverySlip__c != null
+            AND Check_lost_Item_F__c = null
+            AND Rental_Apply_Equipment_Set__c = :recordId AND Cancel_Select__c = false
+            ];
+            return report;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+
+    @AuraEnabled
+    public static String approvalCheck(String rentalApplyId) {
+        // check缁撴灉
+        String returnStr = '';
+
+        //1388 yc 20211021 璺ㄥ尯鍩熷垎閰嶄笉鑳藉嚭搴�  start
+        String rasdid = '';
+        system.debug(rentalApplyId+'==');
+        if(String.isNotBlank(rentalApplyId) && rentalApplyId.indexOf(';') >= 0){//璇存槑鏄粠涓�瑙堜笂瑙﹀彂鐨�
+            rasdid = rentalApplyId.subString(rentalApplyId.indexOf(';') + 1);
+            rentalApplyId = rentalApplyId.subString(0, rentalApplyId.indexOf(';'));
+        }
+        //1388 yc 20211021 璺ㄥ尯鍩熷垎閰嶄笉鑳藉嚭搴�  end
+        //澶囧搧鍊熷嚭鐢宠
+        Rental_Apply__c[] rentalApply = [select Id,repair__r.Repair_Final_Inspection_Date__c,Bollow_Date__c,repair__r.Return_Without_Repair_Date__c,
+                CreatedDate,Rental_Apply_Equipment_Set_Cnt__c,Prepare_Day__c,Cross_Region_Assign__c,
+                demo_purpose2__c,Follow_UP_Opp__r.Shipping_Finished_Day_Func__c,next_action__c,QIS_number__r.ReplaceDeliveryDate__c
+        from Rental_Apply__c
+        where Id = :rentalApplyId];
+        if (rentalApply.size() == 0) {
+            returnStr = '娌℃湁澶囧搧鍊熷嚭鐢宠锛岃纭銆�';
+            return returnStr;
+        }
+        Rental_Apply__c ra = rentalApply[0];
+        if (ra.Rental_Apply_Equipment_Set_Cnt__c <= 0) {
+            returnStr = '娌℃湁鍊熷嚭澶囧搧set涓�瑙堬紝璇风‘璁ゃ��';
+            return returnStr;
+        }
+        //1822 yc 20211111 start
+        if(ra.demo_purpose2__c=='宸茶喘寰呰揣' && ra.Follow_UP_Opp__r.Shipping_Finished_Day_Func__c!= null){
+            returnStr = '宸茶喘寰呰揣鐩殑锛屾柊鍝佸凡鏈夊彂璐ф棩锛屼笉鍙嚭搴撴寚绀�';
+            return returnStr;
+        }
+        if(ra.demo_purpose2__c=='绱㈣禂QIS' && ra.next_action__c=='鏃犲伩鏇存崲' && ra.QIS_number__r.ReplaceDeliveryDate__c!= null){
+            returnStr = '绱㈣禂QIS鐩殑锛孮IS宸叉湁鏂板搧鍙戣揣鏃ワ紝涓嶅彲鍑哄簱鎸囩ず';
+            return returnStr;
+        }
+        //1822 yc 20211111 end
+
+//*************************Insert 20160826 SWAG-AD59Z6 瓒欏境鑺� Start*************************//
+        if(Ra.repair__r.Repair_Final_Inspection_Date__c != null) {
+            return '淇悊鏈�缁堟娴嬫棩涓嶄负绌猴紝涓嶈兘鍋氬嚭搴撴寚绀�';
+        }
+        if(Ra.repair__c!=null&&Ra.repair__r.Return_Without_Repair_Date__c != null) {
+            return '鏈慨鐞嗗綊杩樻棩涓嶄负绌猴紝涓嶈兘鍋氬嚭搴撴寚绀�';
+        }
+//*************************Insert 20160826 SWAG-AD59Z6 瓒欏境鑺� End***************************//
+
+        //1388 yc 20211021 璺ㄥ尯鍩熷垎閰嶄笉鑳藉嚭搴� start
+        if(String.isNotBlank(ra.Cross_Region_Assign__c)){
+            String soql = 'select Id, Name,Rental_Apply__c,Internal_asset_location_before__c';
+            soql +=' from Rental_Apply_Equipment_Set_Detail__c';
+            soql +=' where Rental_Apply__c = \'' + ra.Id +'\'';
+            soql +=' and Internal_asset_location_before__c !=null and Internal_asset_location_before__c != \'' + ra.Cross_Region_Assign__c+ '\'';
+
+            if(String.isNotBlank(rasdid)){
+                soql +=' and Rental_Apply_Equipment_Set__c = :rasdid';
+            }
+            List<Rental_Apply_Equipment_Set_Detail__c> raesd = Database.query(soql);
+            if(raesd.size()>0){
+                returnStr = '鍒嗛厤鐨勫鍝佷笉鏄偍鎵�灞炲鍝佷腑蹇冪殑澶囧搧锛屼笉鑳藉仛鍑哄簱鎸囩ず';
+                return returnStr;
+            }
+
+        }
+        //1388 yc 20211021 璺ㄥ尯鍩熷垎閰嶄笉鑳藉嚭搴� end
+        // 20220211 ljh add 澶囧搧FY23璇鹃01 start
+        // AggregateResult[] resultsRas = [SELECT Rental_Start_Date__c,count(Id) cnt
+        //                              FROM Rental_Apply_Equipment_Set__c
+        //                              WHERE Rental_Apply__c = :rentalApplyId
+        //                              AND Cancel_Select__c = false
+        //                              group by Rental_Start_Date__c];
+        // If(resultsRas.size() > 1){
+        //  returnStr = '鎵�鏈変竴瑙堝鍝侀璁″嚭璐ф棩搴斾竴鑷达紝涓嶄竴鑷翠笉鑳藉仛鍑哄簱鎸囩ず';
+        //     return returnStr;
+        // }
+        // 20220211 ljh add 澶囧搧FY23璇鹃01 end
+
+//bp2        // 澶囧搧鍊熷嚭鍘嗗彶鍙栧緱
+//        List<String> equipmentSetList = new List<String>();
+//        Rental_Apply_Equipment_Set__c[] raes = [
+//            select Id, Name, Equipment_Set__c, Equipment_Set__r.Name, Rental_Start_Date__c, Rental_End_Date__c, Rental_Apply__c
+//              from Rental_Apply_Equipment_Set__c
+//             where Rental_Apply__c = :rentalApplyId and Cancel_Select__c = false];
+//        // 鏃ュ巻鑼冨洿锛屾渶灏忕殑鍊熷嚭寮�濮嬫棩鍒版渶澶х殑鍊熷嚭缁堜簡鏃�
+//        Date startDate = Date.today();
+//        Date endDate = Date.today();
+//        for (Rental_Apply_Equipment_Set__c r : raes) {
+//            equipmentSetList.add(r.Equipment_Set__c);
+//            if (r.Rental_Start_Date__c != null && r.Rental_Start_Date__c < startDate) {
+//                startDate = r.Rental_Start_Date__c;
+//            }
+//            if (r.Rental_End_Date__c != null && r.Rental_End_Date__c > endDate) {
+//                endDate = r.Rental_End_Date__c;
+//            }
+//        }
+//        Integer prepareDay = ra.Prepare_Day__c == null ? Integer.valueOf(System.Label.EquipmentRentalPrepare) : ra.Prepare_Day__c.intValue();
+//        Date minDate = getWD_addday(startDate, -1 * prepareDay);
+//        Date maxDate = getWD_addday(endDate, prepareDay);
+//        // 鍏朵粬澶囧搧鍊熷嚭鐢宠鍘嗗彶
+//        Rental_Apply_Equipment_Set__c[] others = [
+//                    select Id, Name, Rental_Start_Date__c, Rental_End_Date__c, Equipment_Set__c, Rental_Apply__r.Status__c ,Rental_Apply__r.Prepare_Day__c
+//                      from Rental_Apply_Equipment_Set__c
+//                     where Rental_Apply__c != :rentalApplyId
+//                       and Equipment_Set__c in :equipmentSetList
+//                       and Request_Status__c != '鍙栨秷'
+//                       and Request_Status__c != '鍒犻櫎'
+//                       and Cancel_Select__c = false
+//                       and ((Rental_Start_Date__c >= :minDate and Rental_Start_Date__c <= :maxDate)
+//                            or (Rental_End_Date__c >= :minDate and Rental_End_Date__c <= :maxDate)
+//                            or (Rental_Start_Date__c <= :startDate and Rental_End_Date__c >= :endDate))];
+
+//        Map<String, List<Rental_Apply_Equipment_Set__c>> othersMap = new Map<String,List<Rental_Apply_Equipment_Set__c>>();
+//        for (Rental_Apply_Equipment_Set__c other : others) {
+//            if (othersMap.containsKey(other.Equipment_Set__c)) {
+//                othersMap.get(other.Equipment_Set__c).add(other);
+//            } else {
+//                List<Rental_Apply_Equipment_Set__c> l = new List<Rental_Apply_Equipment_Set__c>();
+//                l.add(other);
+//                othersMap.put(other.Equipment_Set__c, l);
+//            }
+//        }
+
+//        for (Rental_Apply_Equipment_Set__c r : raes) {
+
+//            List<Rental_Apply_Equipment_Set__c> other = othersMap.get(r.Equipment_Set__c);
+
+//            Map<Date, Map<String, String>> dateMap= new Map<Date, Map<String, String>>();
+//            if (other != null) {
+//                Date sdate = startDate;
+//                Date edate = endDate;
+//                for (Rental_Apply_Equipment_Set__c o : other) {
+//                    if (o.Rental_Start_Date__c != null && (sdate == null || o.Rental_Start_Date__c < sdate)) {
+//                        sdate = o.Rental_Start_Date__c;
+//                    }
+//                    if (o.Rental_End_Date__c != null && (edate == null || o.Rental_End_Date__c > edate)) {
+//                        edate = o.Rental_End_Date__c;
+//                    }
+//                }
+//                if (sdate != null && edate != null) {
+//                    RentalApplyWebService raws = new RentalApplyWebService();
+//                    dateMap = raws.getDateMap(sdate, edate, prepareDay);
+//                }
+//            }
+
+//            if (r.Rental_Start_Date__c == null && r.Rental_End_Date__c == null) {
+//                // 娓呯┖璇ュ�熷嚭鍘嗗彶鐨勫嚭搴撳拰鍥炴敹鏃堕棿
+//            } else if (other == null || other.size() == 0) {
+//                // 涓庡叾浠栧�熷嚭鍘嗗彶娌℃湁鍐茬獊
+//            } else {
+//                Date fromDate = r.Rental_Start_Date__c;
+//                Date toDate = r.Rental_End_Date__c;
+//                for (Rental_Apply_Equipment_Set__c o : other) {
+//                    if (o.Rental_Apply__r.Status__c != '鑽夋涓�' && o.Rental_Apply__r.Status__c != '鐢宠涓�' && o.Rental_Apply__r.Status__c != null) {
+//                        Date startD = o.Rental_Start_Date__c;
+//                        Date endD = o.Rental_End_Date__c;
+//                        Integer prepare = prepareDay; //>= o.Rental_Apply__r.Prepare_Day__c || o.Rental_Apply__r.Prepare_Day__c == null ? prepareDay : o.Rental_Apply__r.Prepare_Day__c.intValue();
+//                        if ((dateMap.containsKey(fromDate) && Date.valueOf(dateMap.get(fromDate).get('Next')) > startD && dateMap.containsKey(endD) && fromDate < Date.valueOf(dateMap.get(endD).get('Next'))) ||
+//                            (dateMap.containsKey(toDate) && Date.valueOf(dateMap.get(toDate).get('Next')) > startD && dateMap.containsKey(endD) && toDate < Date.valueOf(dateMap.get(endD).get('Next'))) ||
+//                            (dateMap.containsKey(fromDate) && Date.valueOf(dateMap.get(fromDate).get('Next')) <= startD && dateMap.containsKey(endD) && toDate >= Date.valueOf(dateMap.get(endD).get('Next')))) {
+//                            returnStr = '澶囧搧' + r.Equipment_Set__r.Name + '鐨勫�熷嚭鏃ヤ笌澶囧搧鍊熷嚭鍘嗗彶' + o.Name + '鏈夊啿绐侊紝璇风‘璁ゃ��';
+//                            return returnStr;
+//                        }
+//                    }
+//                }
+//            }
+//        }
+        return '1';
+    }
+
+    @AuraEnabled
+    public static String setShipment_requests(String raid, String raesid) {
+        Savepoint sp = Database.setSavepoint();
+
+        try {
+            //涓�瑙堟儏鍐典笅妫�绱竴瑙堝搴旂殑鐢宠涔d锛宻oql瀛愭煡璇笉鑳藉拰涓绘煡璇㈡槸鍚屼竴涓〃锛屽崟鐙绱竴娆�
+            if (String.isBlank(raid)) {
+                List<Rental_Apply_Equipment_Set__c> raList = [select Id, Rental_Apply__c from Rental_Apply_Equipment_Set__c where id = :raesid];
+                if (raList.size() > 0) {
+                    raid = raList[0].Rental_Apply__c;
+                } else {
+                    //搴旇涓嶄細鍒拌繖閲�
+                    return '娌℃湁鍙互鍑哄簱鎸囩ず鐨勪竴瑙�';
+                }
+            }
+            String soql = 'SELECT Id'
+                    + ' FROM Rental_Apply_Equipment_Set__c '
+                    + ' WHERE Shippment_loaner_time2__c <> null '
+                    + ' AND Rental_Apply__c = :raid '
+                    + ' ORDER BY Id' ;
+            List<Rental_Apply_Equipment_Set__c> shippedRaesList = Database.query(soql);
+            String raesStrShipped = '';
+            for (Rental_Apply_Equipment_Set__c raes : shippedRaesList) {
+                raesStrShipped += raes.Id;
+            }
+
+            //Srring soql = "SELECT Id FROM Rental_Apply_Equipment_Set_Detail__c WHERE Rental_Apply__c = '{!Rental_Apply__c.Id}' AND Cancel_Select__c = false AND Rental_Num__c > 0 AND Rental_Apply_Equipment_Set__r.Wei_Assigned_Cnt__c = 0 AND Rental_Apply_Equipment_Set__r.Yi_Assigned_Cnt__c > 0 AND Shipment_request__c  = false";
+            soql = 'SELECT Id, Rental_Apply__c, Rental_Apply_Equipment_Set__c'
+                    + ' FROM Rental_Apply_Equipment_Set_Detail__c '
+                    + ' WHERE ' + (String.isNotBlank(raesid) ? 'Rental_Apply_Equipment_Set__c = :raesid ' : 'Rental_Apply__c = :raid ')
+                    + ' AND Cancel_Select__c = false '
+                    + ' AND Rental_Num__c > 0 '
+                    + ' AND Rental_Apply_Equipment_Set__r.Wei_Assigned_Cnt__c = 0 '
+                    + ' AND Rental_Apply_Equipment_Set__r.Yi_Assigned_Cnt__c > 0 '
+                    + ' AND Shipment_request__c  = false'
+                    + ' ORDER BY Rental_Apply_Equipment_Set__c, Id';
+            List<Rental_Apply_Equipment_Set_Detail__c> raesds = Database.query(soql);
+
+            Map<Id, List<String>> rental_Asset_SerialNumberMap = new Map<Id, List<String>>();
+
+            if (raesds.size() < 1) {
+                return '娌℃湁鍙互鍑哄簱鎸囩ず鐨勪竴瑙�';
+            } else {
+                Set<Id> raesSet = new Set<Id>();
+                String raesStrRequest = '';
+                for (Rental_Apply_Equipment_Set_Detail__c raesd : raesds) {
+                    if (false == raesSet.contains(raesd.Rental_Apply_Equipment_Set__c)) {
+                        raesSet.add(raesd.Rental_Apply_Equipment_Set__c);
+                        raesStrRequest += raesd.Rental_Apply_Equipment_Set__c;
+                    }
+                    raesd.Shipment_request_time2__c = Datetime.now();
+                    raesd.Shipment_request__c = true;
+                }
+                // 鍑哄簱鍚�, 鍐嶆鍋氬嚭搴撴寚绀虹殑涓�瑙�, 涓�瀹氳涓嚭杩囧簱鐨勪竴瑙堜竴鏍�
+                if (false == String.isBlank(raesStrShipped) && raesStrRequest != raesStrShipped) {
+                    return '涓嶈兘鍋氬嚭搴撴寚绀猴紝闇�瑕佸垎鍗曞悗鍐嶆搷浣�';
+                }
+            }
+
+            // add lc 20220927 SFDC-CJ48VE 澶囧搧棰勮鍑哄簱鏃ラ�昏緫璋冩暣 start
+            List<Rental_Apply_Equipment_Set__c> RAESRecords = [
+                    SELECT Id,Rental_Start_Date__c
+                    FROM Rental_Apply_Equipment_Set__c
+                    WHERE Rental_Apply__c = :raid
+                    AND Cancel_Select__c = False];
+
+            for (Integer i = 0; i < RAESRecords.size(); i++) {
+                // 澶囧搧棰勮鍑哄簱鏃ヤ笉涓�鑷达紝涓嶅彲鍑哄簱鎸囩ず
+                if (RAESRecords[i].Rental_Start_Date__c != RAESRecords[0].Rental_Start_Date__c) {
+                    return '澶囧搧棰勮鍑鸿揣鏃ヤ笉涓�鑷达紝涓嶅彲鍑哄簱鎸囩ず';
+                }
+            }
+            // add lc 20220927 SFDC-CJ48VE 澶囧搧棰勮鍑哄簱鏃ラ�昏緫璋冩暣 end
+
+            Rental_Apply__c ra = new Rental_Apply__c(Id = raesds[0].Rental_Apply__c, Status__c = '宸插嚭搴撴寚绀�');
+            update ra;
+            Database.SaveResult[] results = Database.update(raesds);
+            Database.SaveResult dmlResult = results[0];
+            if (dmlResult.isSuccess()) {
+                //鏄庣粏鏇存柊鎴愬姛鍚庢墠鏇存柊涓�瑙堢殑Rental_Asset_SerialNumber__c
+                soql = 'SELECT Id, SerialNumber_text__c, Rental_Apply_Equipment_Set__c '
+                        +'FROM Rental_Apply_Equipment_Set_Detail__c '
+                        +'WHERE Rental_Apply__c = \'' + raesds[0].Rental_Apply__c + '\''
+                        +'AND Shipment_request_time2__c != null '
+                        +'AND Shipment_request__c = true '
+                        +'AND SerialNumber_text__c != null '
+                        +'ORDER BY Rental_Apply_Equipment_Set__c ';
+
+
+                List<Rental_Apply_Equipment_Set_Detail__c> raesdSerialNumbers = Database.query(soql);
+
+                for (Rental_Apply_Equipment_Set_Detail__c raesd : raesdSerialNumbers) {
+
+                    if (!rental_Asset_SerialNumberMap.containsKey(raesd.Rental_Apply_Equipment_Set__c)) {
+                        // Asset__r.SerialNumber + ','
+                        rental_Asset_SerialNumberMap.put(raesd.Rental_Apply_Equipment_Set__c, new List<String>());
+                    }
+                    rental_Asset_SerialNumberMap.get(raesd.Rental_Apply_Equipment_Set__c).add(raesd.SerialNumber_text__c);
+                }
+
+                List<Rental_Apply_Equipment_Set__c> raess = new List<Rental_Apply_Equipment_Set__c>();
+                for (Id key : rental_Asset_SerialNumberMap.keySet()) {
+                    raess.add(new Rental_Apply_Equipment_Set__c(Id = key,
+                            Rental_Asset_SerialNumber__c = ',' + String.join(rental_Asset_SerialNumberMap.get(key), ',') + ','));
+                }
+                if (!raess.isEmpty()) {
+                    update raess;
+                }
+
+                return '鐘舵�佹洿鏂板埌宸插嚭搴撴寚绀�';
+            } else {
+                Database.rollback(sp);
+                Database.Error emsg = dmlResult.getErrors()[0];
+                return 'failed to update:' + emsg.getFields() +  ' ' + emsg.getMessage();
+            }
+        } catch (Exception ex) {
+            Database.rollback(sp);
+            return ex.getMessage();
+        }
+    }
+
+    @AuraEnabled
+    public static String postponeCheck(String endDate, Integer d) {
+        Date before5day = getWD_addday(date.parse(endDate), d);
+        if (Date.today() > before5day) {
+            return System.Label.EquipmentRentalPostponeOverDeadline;
+        }
+        return 'OK';
+    }
+
+    public static Date getWD_addday(Date d, Integer i) {
+        if (d == Date.valueOf('4000-12-31')) {
+            return d;
+        }
+        if (i >= 0) {
+            List<OlympusCalendar__c> workday = [
+                    select Id, Date__c, IsWorkDay__c
+                    from OlympusCalendar__c
+                    where Date__c >= :d
+                    and IsWorkDay__c = 1
+                    order by Date__c
+                    limit :(i+1)];
+            Date selectDate = workday[i].Date__c;
+            return selectDate;
+        } else {
+            i = Math.abs(i);
+            List<OlympusCalendar__c> workday = [
+                    select Id, Date__c, IsWorkDay__c
+                    from OlympusCalendar__c
+                    where Date__c <= :d
+                    and IsWorkDay__c = 1
+                    order by Date__c desc
+                    limit :(i+1)];
+            Date selectDate = workday[i].Date__c;
+            return selectDate;
+        }
+    }
+
+
+    public class UpdateResult {
+        @AuraEnabled public String recordId {get;set;}
+        @AuraEnabled public Boolean success {get;set;}
+        @AuraEnabled public List<String> errors {get;set;}
+    }
+    public class InitData{
+        @AuraEnabled
+        public String id;
+        @AuraEnabled
+        public String RentalApplyId;
+        @AuraEnabled
+        public String Status;
+        @AuraEnabled
+        public String RentalApplyC;
+        @AuraEnabled
+        public Decimal WeiAssignedCntC;
+        @AuraEnabled
+        public Date BollowDateC;
+        @AuraEnabled
+        public Decimal AssignedNotShipmentC;
+    }
+}
diff --git a/force-app/main/default/classes/SelectSubstituteControllerLWT.cls-meta.xml b/force-app/main/default/classes/SelectSubstituteControllerLWT.cls-meta.xml
new file mode 100644
index 0000000..d75b058
--- /dev/null
+++ b/force-app/main/default/classes/SelectSubstituteControllerLWT.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>51.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/TransferApplyController.cls b/force-app/main/default/classes/TransferApplyController.cls
new file mode 100644
index 0000000..864e606
--- /dev/null
+++ b/force-app/main/default/classes/TransferApplyController.cls
@@ -0,0 +1,31 @@
+public with sharing class TransferApplyController {
+    public TransferApplyController() {
+        
+    }
+    @AuraEnabled
+    public static list<TransferApplySummary__c> transferApplyPDF(string transferApplyId) {
+        
+        try {
+            // var sql = "select Id from TransferApplySummary__c where TransferApply__c = 
+            //'{!TransferApply__c.Id}' and ApprovalDetails__c > 0 and TAS_Status__c != '鍙栨秷'";
+            list<TransferApplySummary__c> reports = [
+                select id from TransferApplySummary__c 
+                where TransferApply__c = :transferApplyId
+                and ApprovalDetails__c > 0
+                and TAS_Status__c != '鍙栨秷'];
+            return reports;
+        }catch ( Exception e) {
+            System.debug(LoggingLevel.ERROR,'TransferApplySummary__c TransferApplyPDF Error : ' + e);
+        }
+        return null;
+        
+    }
+
+    @AuraEnabled
+    public static Boolean applyPermission()
+    {
+        Schema.DescribeSobjectResult schemaMap = Schema.describeSObjects(new String[]{'TransferApply__c'})[0];
+        return schemaMap.isCreateable();
+    }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/TransferApplyController.cls-meta.xml b/force-app/main/default/classes/TransferApplyController.cls-meta.xml
new file mode 100644
index 0000000..d75b058
--- /dev/null
+++ b/force-app/main/default/classes/TransferApplyController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>51.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/TransferApplyWebService.cls b/force-app/main/default/classes/TransferApplyWebService.cls
new file mode 100644
index 0000000..371adb6
--- /dev/null
+++ b/force-app/main/default/classes/TransferApplyWebService.cls
@@ -0,0 +1,214 @@
+global without sharing class TransferApplyWebService {
+    public TransferApplyWebService() {
+
+    }
+
+    @AuraEnabled
+    WebService static String submitApply(String taId) {
+        List<TransferApply__c> taList = [
+            SELECT Id
+                 , Status__c
+                 , Add_Approval_Status__c
+                 , RecordType.DeveloperName //20201202 ljh add
+                 , BeiPinWindow__c //20201202 ljh add
+                 , Add_Reason__c // 20210429 1831 you
+             FROM TransferApply__c
+            WHERE Id = :taId
+              FOR UPDATE
+        ];
+        if (taList.isEmpty()) {
+            return '璋冩嫧鍗曚笉瀛樺湪銆�';
+        }
+        TransferApply__c ta = taList[0];
+        if(ta.Status__c != '鑽夋涓�' && ta.Add_Approval_Status__c != '鑽夋涓�'){
+            return '璇风‘璁よ皟鎷ㄥ崟鐘舵�侊紝娌℃湁寰呭鎵圭殑鏄庣粏锛屼笉鑳芥彁浜�';
+        }
+        List<String> errorList = checkTransferCount(ta.Id);
+        if(!errorList.isEmpty()) {
+            return String.join(errorList, '\n');
+        }
+        if(ta.Status__c == '鑽夋涓�') {
+
+            ta.Status__c = '濉啓瀹屾瘯';
+        }
+        else {
+            
+            // 20210429 1831 you start
+            if(ta.Add_Approval_Status__c == '鑽夋涓�' && String.isBlank(ta.Add_Reason__c) ){
+                return '娌℃湁濉啓杩藉姞鐞嗙敱锛屼笉鑳芥彁浜�';
+            }else {// 20210429 1831 you end
+        
+                ta.Add_Approval_Status__c = '濉啓瀹屾瘯';
+            }
+        }
+        //20201202 ljh OCSM_BP5-76 add start
+        if(ta.RecordType.DeveloperName == 'AgencyToCenter' && ta.BeiPinWindow__c == null){
+            return '璇风‘璁ゅ鎵逛汉锛屾病鏈夊鎵逛汉锛堝鍝佹�荤獥鍙o級锛屼笉鑳芥彁浜�';
+        }
+        //20201202 ljh OCSM_BP5-76 add end
+        Savepoint sp = Database.setSavepoint();
+        try {
+            update ta;
+        }
+        catch (Exception e) {
+            Database.rollback(sp);
+            return e.getMessage();
+        }
+        return '1';
+    }
+    public static List<String> checkTransferCount(Id taId) {
+        List<TransferApplyDetail__c> tadList =  [
+            SELECT Id
+                 , Asset__r.Ji_Zhong_Guan_Li_Ku_Cun__c
+                 , Asset__r.TransferableAbandon_F__c
+                 , Asset__r.TransferableRepair_F__c
+                 , Asset__r.TransferableLost_F__c
+                 , Asset__r.Name
+                 , Asset__c
+                 , Approved_F__c
+                 , TransferType__c
+                 , OneToOneAccessory__c
+            FROM TransferApplyDetail__c
+            WHERE TransferApply__c=:taId
+                AND Cancel_Select__c = false
+        ];
+
+        Map<Id, Integer> assCountMap = new Map<Id, Integer>(); // assetId->鏈夋晥搴撳瓨
+        Map<Id, Integer> assetAbanCntMap = new Map<Id, Integer>(); // 闈炰竴瀵逛竴闄勫睘鍝佸緟搴熷純鏁扮粺璁★紝淇濇湁璁惧Id->寰呭簾寮冭皟鎷ㄦ暟閲�
+        Map<Id, Integer> assetRepairCntMap = new Map<Id, Integer>(); // 闈炰竴瀵逛竴闄勫睘鍝佸緟搴熷純鏁扮粺璁★紝淇濇湁璁惧Id->寰呭簾寮冭皟鎷ㄦ暟閲�
+        Map<Id, Integer> assetLostCntMap = new Map<Id, Integer>(); // 闈炰竴瀵逛竴闄勫睘鍝佸緟搴熷純鏁扮粺璁★紝淇濇湁璁惧Id->寰呭簾寮冭皟鎷ㄦ暟閲�
+
+        Boolean needApprove = false;
+        for(TransferApplyDetail__c tad: tadList) {
+            if(!tad.Approved_F__c && !tad.OneToOneAccessory__c) {
+                Integer cnt = 0;
+                if(tad.TransferType__c == '寰呭簾寮�') {
+                    if(assetAbanCntMap.containsKey(tad.Asset__c)){
+                        cnt = assetAbanCntMap.get(tad.Asset__c);
+                    }
+                    cnt += 1;
+                    assetAbanCntMap.put(tad.Asset__c, cnt);
+                }
+                else if(tad.TransferType__c == '寰呬慨鐞�'){
+                    if(assetRepairCntMap.containsKey(tad.Asset__c)){
+                        cnt = assetRepairCntMap.get(tad.Asset__c);
+                    }
+                    cnt += 1;
+                    assetRepairCntMap.put(tad.Asset__c, cnt);
+                }
+                else if(tad.TransferType__c == '涓㈠け鎵惧洖'){
+                    if(assetLostCntMap.containsKey(tad.Asset__c)){
+                        cnt = assetLostCntMap.get(tad.Asset__c);
+                    }
+                    cnt += 1;
+                    assetLostCntMap.put(tad.Asset__c, cnt);
+                }
+                else {
+                    if(assCountMap.containsKey(tad.Asset__c)) {
+                        cnt = assCountMap.get(tad.Asset__c);
+                    }
+                    cnt += 1;
+                    assCountMap.put(tad.Asset__c, cnt);
+                }
+                if(!tad.Approved_F__c) {
+                    needApprove = true;
+                }
+            }
+        }
+        Set<String> errorList = new Set<String>();
+        if(!needApprove) {
+            errorList.add('娌℃湁闇�瑕佸鎵圭殑鏄庣粏锛�');
+        }
+        for(TransferApplyDetail__c tad: tadList) {
+            if(assCountMap.containsKey(tad.Asset__c)
+                && assCountMap.get(tad.Asset__c) > intValueOf(tad.Asset__r.Ji_Zhong_Guan_Li_Ku_Cun__c)) {
+                String msg = tad.Asset__r.Name;
+                msg += '锛氭湁鏁堝簱瀛�=' +  intValueOf(tad.Asset__r.Ji_Zhong_Guan_Li_Ku_Cun__c);
+                msg += '锛岃皟鎷ㄦ暟閲�=' + assCountMap.get(tad.Asset__c) ;
+                msg += '锛岃纭鏁伴噺鍚庢彁浜�';
+                errorList.add(msg);
+            }
+            if(assetRepairCntMap.containsKey(tad.Asset__c)
+                && assetRepairCntMap.get(tad.Asset__c) > intValueOf(tad.Asset__r.TransferableRepair_F__c)) {
+                String msg = tad.Asset__r.Name;
+                msg += '锛氬彲璋冩嫧鏁癬寰呬慨鐞�=' +  intValueOf(tad.Asset__r.TransferableRepair_F__c);
+                msg += '锛屽緟淇悊璋冩嫧鏁伴噺=' + assetRepairCntMap.get(tad.Asset__c) ;
+                msg += '锛岃纭鏁伴噺鍚庢彁浜�';
+                errorList.add(msg);
+            }
+            if(assetAbanCntMap.containsKey(tad.Asset__c)
+                && assetAbanCntMap.get(tad.Asset__c) > intValueOf(tad.Asset__r.TransferableAbandon_F__c)) {
+                String msg = tad.Asset__r.Name;
+                msg += '锛氬彲璋冩嫧鏁癬寰呭簾寮�=' + intValueOf(tad.Asset__r.TransferableAbandon_F__c);
+                msg += '锛屽緟搴熷純璋冩嫧鏁伴噺=' + assetAbanCntMap.get(tad.Asset__c);
+                msg += '锛岃纭鏁伴噺鍚庢彁浜�';
+                errorList.add(msg);
+            }
+            if(assetLostCntMap.containsKey(tad.Asset__c)
+                && assetLostCntMap.get(tad.Asset__c) > intValueOf(tad.Asset__r.TransferableLost_F__c)) {
+                String msg = tad.Asset__r.Name;
+                msg += '锛氬彲璋冩嫧鏁癬涓㈠け鎵惧洖=' + intValueOf(tad.Asset__r.TransferableLost_F__c);
+                msg += '锛屽緟搴熷純璋冩嫧鏁伴噺=' + assetLostCntMap.get(tad.Asset__c);
+                msg += '锛岃纭鏁伴噺鍚庢彁浜�';
+                errorList.add(msg);
+            }
+        }
+        return new List<String>(errorList);
+    }
+
+    @AuraEnabled
+    WebService static String cancelApply(Id taId) {
+        List<TransferApply__c> taList = [
+            SELECT Id
+                 , Add_Approval_Status__c
+                 , Cancel_Reason__c
+                 , OwnerId
+                 , Status__c
+                 , TA_Status__c
+                 , Yi_loaner_arranged__c
+                 , RecordType.DeveloperName
+                 , Request_approval_time__c
+             FROM TransferApply__c
+            WHERE Id = :taId
+              FOR UPDATE
+        ];
+        if (taList.isEmpty()) {
+            return '璋冩嫧鍗曚笉瀛樺湪銆�';
+        }
+        TransferApply__c ta = taList[0];
+        if(ta.Status__c == '鍙栨秷') {
+            return '宸茬粡鍙栨秷锛屼笉鑳藉啀娆″彇娑�';
+        }
+        if(ta.Status__c == '鐢宠涓�' || ta.Add_Approval_Status__c == '鐢宠涓�'){
+            return '鐢宠涓笉鑳藉彇娑�';
+        }
+        if(ta.RecordType.DeveloperName == 'InsideCenter' && ta.Request_approval_time__c != null) {
+            return '鍚屽鍝佷腑蹇冨唴璋冩嫧鍦ㄦ渶缁堟壒鍑嗕箣鍚庝笉鍙互鍙栨秷';
+        }
+        if(ta.TA_Status__c == '宸插嚭搴�' || ta.Yi_loaner_arranged__c > 0) {
+            return '宸茬粡鍑哄簱锛屼笉鑳藉彇娑�';
+        }
+        if(UserInfo.getUserId() != ta.OwnerId) {
+            return '浠呭垱寤鸿�呭彲浠ュ彇娑�';
+        }
+        if(String.isBlank(ta.Cancel_Reason__c)) {
+            return '蹇呴』杈撳叆鍙栨秷鐞嗙敱';
+        }
+        Savepoint sp = Database.setSavepoint();
+        try {
+            ta.Status__c = '鍙栨秷';
+            update ta;
+        }
+        catch (Exception e) {
+            Database.rollback(sp);
+            return e.getMessage();
+        }
+        return '1';
+    }
+    private static Integer intValueOf(Decimal d) {
+        if(d == null) {
+            return 0;
+        }
+        return Integer.valueOf(d);
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/TransferApplyWebService.cls-meta.xml b/force-app/main/default/classes/TransferApplyWebService.cls-meta.xml
new file mode 100644
index 0000000..91b23b8
--- /dev/null
+++ b/force-app/main/default/classes/TransferApplyWebService.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>46.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.css b/force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.css
new file mode 100644
index 0000000..af18c76
--- /dev/null
+++ b/force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.css
@@ -0,0 +1,11 @@
+.Holder{
+	position: relative;
+	display: inline-block;
+	width: 80px;
+	height: 80px;
+	text-align: center;
+}
+
+.container .uiContainerManager{
+	display : none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.html b/force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.html
new file mode 100644
index 0000000..2ef2898
--- /dev/null
+++ b/force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.html
@@ -0,0 +1,5 @@
+<template>
+	<div class="Holder" if:true={IsLoading}>
+      	<lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+  	</div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.js b/force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.js
new file mode 100644
index 0000000..3b0f923
--- /dev/null
+++ b/force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.js
@@ -0,0 +1,38 @@
+import { LightningElement, track, wire, api } from 'lwc';
+import {CurrentPageReference} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+
+export default class lexAssetMaintainDetail extends LightningElement {
+	@api recordId;
+  
+
+    @wire(CurrentPageReference)
+	getStateParameters(currentPageReference){
+		console.log("杩涘叆椤甸潰");
+		console.log(currentPageReference);
+		if(currentPageReference){
+			const urvalue=currentPageReference.state.recordId;
+			if(urvalue){
+				let str=`${urvalue}`;
+				console.log('str');
+				console.log(str);
+				this.recordId=str;
+			}
+		}
+	}
+
+	connectedCallback(){
+
+		this.cancelSubmit().then(res=>{
+			this.IsLoading=false;
+			this.dispatchEvent(new CloseActionScreenEvent());
+		});
+	}
+
+	async cancelSubmit(){
+		window.open('/apex/AssetMaintainDetail?id='+this.recordId,'AssetMaintainDetail', 'width=600,height=200');
+	}
+}
+
+// old js
+// window.open('/apex/AssetMaintainDetail?id={! AssetMaintainHeader__c.Id }');
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.js-meta.xml b/force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.js-meta.xml
new file mode 100644
index 0000000..8d272e7
--- /dev/null
+++ b/force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexAssetMaintainDetail">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__AppPage</target>
+        <target>lightning__RecordPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.html b/force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.html
new file mode 100644
index 0000000..af9fa97
--- /dev/null
+++ b/force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.html
@@ -0,0 +1,3 @@
+<template>
+
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.js b/force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.js
new file mode 100644
index 0000000..75d71ca
--- /dev/null
+++ b/force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.js
@@ -0,0 +1,35 @@
+import { LightningElement, track, wire, api } from 'lwc';
+import {CurrentPageReference} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+
+export default class lexAssetMaintainPage extends LightningElement {
+	@api recordId;
+  
+
+    @wire(CurrentPageReference)
+	getStateParameters(currentPageReference){
+		console.log("杩涘叆椤甸潰");
+		console.log(currentPageReference);
+		if(currentPageReference){
+			const urvalue=currentPageReference.state.recordId;
+			if(urvalue){
+				let str=`${urvalue}`;
+				console.log('str');
+				console.log(str);
+				this.recordId=str;
+			}
+		}
+	}
+
+	connectedCallback(){
+
+		this.cancelSubmit().then(res=>{
+			this.IsLoading=false;
+			this.dispatchEvent(new CloseActionScreenEvent());
+		});
+	}
+
+	async cancelSubmit(){
+		window.open('/apex/AssetMaintain?id='+this.recordId,'lexAssetMaintainPage', 'width=600,height=200');
+	}
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.js-meta.xml b/force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.js-meta.xml
new file mode 100644
index 0000000..2de4fcc
--- /dev/null
+++ b/force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexAssetMaintainPage">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__AppPage</target>
+        <target>lightning__RecordPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.html b/force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.html
index d0f5bfb..159518b 100644
--- a/force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.html
+++ b/force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.html
@@ -1,6 +1,15 @@
+<!--
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-13 15:08:43
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-14 14:13:25
+-->
 <template>
     <div class="lexBeforeOPDPDFBtnHolder" if:true={IsLoading}>
         <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
-        <lightning-button label="Show Toast" onclick={showSuccess}></lightning-button>
+        <lightning-button label="Show Toast" onclick={showToast}></lightning-button>
+        <lightning-button onclick={handleConfirmClick} label="Open Confirm Modal"></lightning-button>
     </div>
 </template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.js b/force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.js
index e1ba4a1..babbb46 100644
--- a/force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.js
+++ b/force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.js
@@ -1,3 +1,11 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-13 15:08:43
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-14 15:37:35
+ */
 import { api, wire,LightningElement } from 'lwc';
 import { CurrentPageReference } from "lightning/navigation";
 import { CloseActionScreenEvent } from 'lightning/actions';
@@ -5,7 +13,7 @@
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 import selectCommonSequence from '@salesforce/apex/ControllerUtil.selectCommonSequence';
 import addReportOPWithEvaluationPDF from '@salesforce/apex/Add_Report.addReportOPWithEvaluationPDF';
-
+import LightningConfirm from 'lightning/confirm';
 export default class LexBeforeOPDPDFBtn extends LightningElement {
     @api recordId;
     accountId;
@@ -36,47 +44,7 @@
         })
     }
     beforeOPDPDFBtn(){
-        if (window.confirm('鏄惁鏂板缓OPD鎶ュ憡涔︼紵\n[纭畾] => 鏂板缓OPD\n[鍙栨秷] => 鍙敓鎴� 锛讳骇鍝佽瘯鐢ㄨ瘎浠凤冀')) {
-            try {
-            selectCommonSequence({
-                valueField: 'EvaluationPDF_NextValue__c',
-                formatField: 'EvaluationPDF_Format__c'
-            }).then(result=>{
-                var pdfno = result;
-                addReportOPWithEvaluationPDF({
-                    "repOwnerId": this.userId,
-                    "reportId": "",
-                    "dailyReportId": "",
-                    "eventId": "",
-                    "recordType": "OPD",
-                    "aId": this.accountId,
-                    "visitor1": "",
-                    "visitor2": "",
-                    "visitor3": "",
-                    "visitor4": "",
-                    "visitor5": "",
-                    "opp1": this.recordId,
-                    "opp2": "",
-                    "opp3": "",
-                    "opp4": "",
-                    "opp5": "",
-                    "reportDate": "",
-                    "evaluationPDFNumber": pdfno
-                }).then(()=>{
-                    // 20220913 ljh WLIG-CHMATN update end
-                    this.IsLoading = false;
-                    window.open('/apex/BeforeOPDPDF?oid=' + this.recordId + '&pdfNo=' + pdfno, 'BeforeOPDPDF');
-                    this.dispatchEvent(new CloseActionScreenEvent());
-                })
-            });
-            } catch(e) {
-                this.showToast(e,"error");
-                this.dispatchEvent(new CloseActionScreenEvent());
-            }
-        } else {
-            window.open('/apex/BeforeOPDPDF?oid=' + this.recordId, 'BeforeOPDPDF');
-            this.dispatchEvent(new CloseActionScreenEvent());
-        }
+        this.handleConfirmClick('鏄惁鏂板缓OPD鎶ュ憡涔︼紵\n[纭畾] => 鏂板缓OPD\n[鍙栨秷] => 鍙敓鎴� 锛讳骇鍝佽瘯鐢ㄨ瘎浠凤冀');
     }
     showToast(msg,type) {
         const event = new ShowToastEvent({
@@ -86,4 +54,55 @@
         });
         this.dispatchEvent(event);
     }
+
+   
+    async handleConfirmClick(msg) {
+        const result = await LightningConfirm.open({
+            message: msg,
+            variant: 'headerless',
+            label: 'this is the aria-label value',
+        });
+        console.log(result);
+        if(result){
+            try {
+                selectCommonSequence({
+                    valueField: 'EvaluationPDF_NextValue__c',
+                    formatField: 'EvaluationPDF_Format__c'
+                }).then(result=>{
+                    var pdfno = result;
+                    addReportOPWithEvaluationPDF({
+                        "repOwnerId": this.userId,
+                        "reportId": "",
+                        "dailyReportId": "",
+                        "eventId": "",
+                        "recordType": "OPD",
+                        "aId": this.accountId,
+                        "visitor1": "",
+                        "visitor2": "",
+                        "visitor3": "",
+                        "visitor4": "",
+                        "visitor5": "",
+                        "opp1": this.recordId,
+                        "opp2": "",
+                        "opp3": "",
+                        "opp4": "",
+                        "opp5": "",
+                        "reportDate": "",
+                        "evaluationPDFNumber": pdfno
+                    }).then(()=>{
+                        // 20220913 ljh WLIG-CHMATN update end
+                        this.IsLoading = false;
+                        window.open('/apex/BeforeOPDPDF?oid=' + this.recordId + '&pdfNo=' + pdfno, 'BeforeOPDPDF');
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                    })
+                });
+                } catch(e) {
+                    this.showToast(e,"error");
+                    this.dispatchEvent(new CloseActionScreenEvent());
+                }
+        }else{
+            window.open('/apex/BeforeOPDPDF?oid=' + this.recordId, 'BeforeOPDPDF');
+            this.dispatchEvent(new CloseActionScreenEvent());
+        }
+    }
 }
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancelApply/lexCancelApply.html b/force-app/main/default/lwc/lexCancelApply/lexCancelApply.html
new file mode 100644
index 0000000..66974ff
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelApply/lexCancelApply.html
@@ -0,0 +1,4 @@
+<template>
+
+    
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancelApply/lexCancelApply.js b/force-app/main/default/lwc/lexCancelApply/lexCancelApply.js
new file mode 100644
index 0000000..04cee1d
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelApply/lexCancelApply.js
@@ -0,0 +1,100 @@
+import { LightningElement, track, wire, api } from 'lwc';
+import LightningConfirm from 'lightning/confirm';
+import {CurrentPageReference,NavigationMixin} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+
+import cancelApply from '@salesforce/apex/TransferApplyWebService.cancelApply';
+
+export default class lexCancelApply extends LightningElement {
+	 @api recordId;
+	 IsLoading=true;
+	 cancelResult;
+  
+
+    @wire(CurrentPageReference)
+	getStateParameters(currentPageReference){
+		console.log("杩涘叆椤甸潰");
+		console.log(currentPageReference);
+		if(currentPageReference){
+			const urvalue=currentPageReference.state.recordId;
+			if(urvalue){
+				let str=`${urvalue}`;
+				console.log('str');
+				console.log(str);
+				this.recordId=str;
+				
+			}
+		}
+	}
+	connectedCallback() {
+		console.log('this.raeSetId:' + this.recordId);
+		
+		LightningConfirm.open({
+	        message: '纭畾鍙栨秷锛�',
+	        variant: 'headerless',
+	        label: 'this is the aria-label value',
+	        
+	    }).then(cancel=>{
+	  //   	this.IsLoading=false;
+			// this.dispatchEvent(new CloseActionScreenEvent());
+	    	if(cancel) {
+	    		cancelApply({
+					taId : this.recordId
+				}).then(result => {
+					this.cancelResult = result;
+					this.cancelSubmit().then(res=>{
+						this.IsLoading=false;
+						this.dispatchEvent(new CloseActionScreenEvent());
+					});	
+							
+				}).catch( error =>{
+					console.log(error);
+				}).finally(()=>{
+
+					
+				});
+	    	}
+	    	
+	    });
+		
+		
+	}
+
+	async cancelSubmit(){
+		if(this.cancelResult == '1') {
+			await this.showToast("",'鍙栨秷鎴愬姛',"success"); 
+			window.location.href = window.location;
+					
+		} else {
+			console.log("result:",this.cancelResult);
+			await this.showToast("",this.cancelResult,"warning"); 	
+		}
+			
+    }
+    showToast(_title,_message,_variant) {
+        const event = new ShowToastEvent({
+            title: _title,
+            message:_message,
+            variant: _variant,
+        });
+        this.dispatchEvent(event);
+    }
+	
+}
+
+//old js
+
+// {!REQUIRESCRIPT('/soap/ajax/51.0/connection.js')}
+// {!REQUIRESCRIPT('/soap/ajax/51.0/apex.js')}
+// if (confirm("纭畾鍙栨秷锛�")) {
+// var rs = sforce.apex.execute("TransferApplyWebService","cancelApply",{taId:'{!TransferApply__c.Id}'});
+// if(rs == '1'){
+// alert('鍙栨秷鎴愬姛');
+// window.location.href = window.location;
+// }
+// else{
+// alert(rs);
+// }
+// }
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancelApply/lexCancelApply.js-meta.xml b/force-app/main/default/lwc/lexCancelApply/lexCancelApply.js-meta.xml
new file mode 100644
index 0000000..f004c4d
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelApply/lexCancelApply.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexCancelApply">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__AppPage</target>
+        <target>lightning__RecordPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancelReport/__tests__/lexCancelReport.test.js b/force-app/main/default/lwc/lexCancelReport/__tests__/lexCancelReport.test.js
new file mode 100644
index 0000000..7171af0
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelReport/__tests__/lexCancelReport.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexCancelReport from 'c/lexCancelReport';
+
+describe('c-lex-cancel-report', () => {
+    afterEach(() => {
+        // The jsdom instance is shared across test cases in a single file so reset the DOM
+        while (document.body.firstChild) {
+            document.body.removeChild(document.body.firstChild);
+        }
+    });
+
+    it('TODO: test case generated by CLI command, please fill in test logic', () => {
+        // Arrange
+        const element = createElement('c-lex-cancel-report', {
+            is: LexCancelReport
+        });
+
+        // Act
+        document.body.appendChild(element);
+
+        // Assert
+        // const div = element.shadowRoot.querySelector('div');
+        expect(1).toBe(1);
+    });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancelReport/lexCancelReport.css b/force-app/main/default/lwc/lexCancelReport/lexCancelReport.css
new file mode 100644
index 0000000..a8fa542
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelReport/lexCancelReport.css
@@ -0,0 +1,10 @@
+.cancelReportHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancelReport/lexCancelReport.html b/force-app/main/default/lwc/lexCancelReport/lexCancelReport.html
new file mode 100644
index 0000000..c738dca
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelReport/lexCancelReport.html
@@ -0,0 +1,6 @@
+<template>
+    <div class="cancelReportHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancelReport/lexCancelReport.js b/force-app/main/default/lwc/lexCancelReport/lexCancelReport.js
new file mode 100644
index 0000000..0032022
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelReport/lexCancelReport.js
@@ -0,0 +1,116 @@
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init  from '@salesforce/apex/OpportunityLightingButtonController.initForCancelReportButton';
+import queryForCancelReportButton  from '@salesforce/apex/OpportunityLightingButtonController.queryForCancelReportButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class LexCancelReport extends LightningElement {
+    @api recordId;
+    stageName;
+    sapSendOK;
+    cntLostCancelReport;
+    cntLostCancelDraft;
+    jobCategory;
+    biddingProjectNameBid;
+    name;
+    salesAssistantName;
+    salesAssistantID;
+    managerName;
+    salesManagerDepartmentID;
+    salesOwnerBuchang;
+    salesOwnerBuchangID;
+    IsLoading = true;
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+            console.log(111);
+            console.log(currentPageReference);
+
+        if (currentPageReference) {
+          const urlValue = currentPageReference.state.recordId;
+          if (urlValue) {
+            let str = `${urlValue}`;
+            console.log("str");
+            console.log(str);
+            this.recordId = str;
+          }
+        }
+    }
+    connectedCallback(){
+        init({
+            recordId: this.recordId
+        }).then(result=>{
+            this.stageName = result.stageName;
+            this.sapSendOK = result.sapSendOK;
+            this.cntLostCancelDraft = result.cntLostCancelDraft;
+            this.cntLostCancelReport = result.cntLostCancelReport;
+            this.jobCategory = result.jobCategory;
+            this.biddingProjectNameBid = result.biddingProjectNameBid;
+            this.name = result.name;
+            this.salesAssistantID = result.salesAssistantID;
+            this.salesAssistantName = result.salesAssistantName;
+            this.managerName = result.managerName;
+            this.salesManagerDepartmentID = result.salesManagerDepartmentID;
+            this.salesOwnerBuchang = result.salesOwnerBuchang;
+            this.salesOwnerBuchangID = result.salesOwnerBuchangID;
+            this.cancelReport();
+        })
+    }
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            title: '',
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+    }
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+    cancelReport(){
+        //XLIU-CG98L5 銆愬鎵樸�戙�愯瘎浼般�戞柊闇�姹�-鎷涙爣椤圭洰/璇环瀵瑰簲娴佹爣銆佸簾鏍囨敼鍠� start
+        queryForCancelReportButton({
+            recordId: this.recordId
+        }).then(result=>{
+            var sqlResult = result;
+            // alert('娴嬭瘯+锛�'+sqlResult.size);
+            //XLIU-CG98L5 銆愬鎵樸�戙�愯瘎浼般�戞柊闇�姹�-鎷涙爣椤圭洰/璇环瀵瑰簲娴佹爣銆佸簾鏍囨敼鍠� end
+            // js銇牬鍚堛�佺炕瑷炽仌銈屻仧鍊ゃ亴銇с倠銇仹銆佽娉ㄦ剰
+            if (this.stageName != '寮曞悎'
+            && this.stageName != '璇环'
+            ) {
+                this.showToast("鐘舵��1:" + this.stageName + "銆佷笉鑳藉仛 鍙栨秷 浜嗭紒","error");
+                
+            }
+            else if (this.sapSendOK == '1') {
+                this.showToast("宸茬粡涓婁紶SAP銆佷笉鑳藉仛 鍙栨秷 浜嗭紒","");
+            }
+            else if (this.cntLostCancelReport - this.cntLostCancelDraft > 0) {
+                this.showToast("璇环宸茬粡鏈� 鍙栨秷锛忓け鍗曟姤鍛� 浜嗭紒","error");
+            }
+            else if (this.jobCategory == '鏀彺') {
+                this.showToast("璇环鎵�鏈変汉鏄姪鐞嗙殑锛屽厛璇蜂慨鏀瑰埌閿�鍞媴褰擄紒","");
+            }
+            //XLIU-CG98L5 銆愬鎵樸�戙�愯瘎浼般�戞柊闇�姹�-鎷涙爣椤圭洰/璇环瀵瑰簲娴佹爣銆佸簾鏍囨敼鍠� start
+            //else if({!NOT(ISBLANK(Opportunity.Bidding_Project_Name_Bid__c))}&& '{!Opportunity.subInfoType__c}' != '3-1锛氬簾鏍囧叕鍛�' &&'{!Opportunity.subInfoType__c}' != '3-2锛氭祦鏍囧叕鍛�'){
+            else if(this.biddingProjectNameBid != undefined && sqlResult.size == 0){
+                this.showToast("鏈夋嫑鎶曟爣椤圭洰鏃跺彧鑳藉仛澶卞崟鎴栭儴鍒嗗け鍗曟姤鍛婏紒","error");
+            }
+            //XLIU-CG98L5 銆愬鎵樸�戙�愯瘎浼般�戞柊闇�姹�-鎷涙爣椤圭洰/璇环瀵瑰簲娴佹爣銆佸簾鏍囨敼鍠� end
+            else {
+            location.href = '/a1U/e?retURL=%2F'+ this.recordId +
+            '&RecordType=01210000000R4hH' +
+            '&CF00N10000004lbGT=' + this.name +
+            '&CF00N10000004lbGT_lkid=' + this.recordId +
+            '&CF00N10000006QShg=' + this.salesAssistantName +
+            '&CF00N10000006QShg_lkid=' + this.salesAssistantID +
+            '&CF00N10000006QShq='+ this.managerName +
+            '&CF00N10000006QShq_lkid=' + this.salesManagerDepartmentID +
+            '&CF00N10000006QShb=' + this.salesOwnerBuchang +
+            '&CF00N10000006QShb_lkid=' + this.salesOwnerBuchangID +
+            '';
+        }
+        this.dispatchEvent(new CloseActionScreenEvent());
+        });  
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancelReport/lexCancelReport.js-meta.xml b/force-app/main/default/lwc/lexCancelReport/lexCancelReport.js-meta.xml
new file mode 100644
index 0000000..329e839
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelReport/lexCancelReport.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.css b/force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.css
new file mode 100644
index 0000000..e1fe560
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.css
@@ -0,0 +1,11 @@
+.Holder{
+	position: relative;
+	display: inline-block;
+	width: 80px;
+	height: 80px;
+	text-align: center;
+}
+
+.container .uiContainerManager{
+	display : none !important;
+}
diff --git a/force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.html b/force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.html
new file mode 100644
index 0000000..08c3ae1
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="Holder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
diff --git a/force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.js b/force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.js
new file mode 100644
index 0000000..193e3d7
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.js
@@ -0,0 +1,53 @@
+import { LightningElement,api, track, wire } from 'lwc';
+import {CurrentPageReference} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init from '@salesforce/apex/SelectSubstituteControllerLWT.initFromSelectSubstituteButton';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class lexCancelSelect extends LightningElement {
+	@api recordId;
+    IsLoading=true;
+    id;
+    RentalApplyId;
+    Status;
+    @wire(CurrentPageReference)
+	getStateParameters(currentPageReference){
+		console.log("杩涘叆椤甸潰");
+		console.log(currentPageReference);
+		if(currentPageReference){
+			const urvalue=currentPageReference.state.recordId;
+			if(urvalue){
+				let str=`${urvalue}`;
+				console.log('str');
+				console.log(str);
+				this.recordId=str;
+			}
+		}
+	}
+
+
+
+	connectedCallback(){
+		console.log(this.recordId);
+		init({recordId:this.recordId}).then(result=>{
+			console.log(result);
+			if(result!=null){
+				this.id=result.id;
+			    this.RentalApplyId=result.RentalApplyId;
+			    this.Status=result.Status;
+				this.cancelSubmit().then(res=>{
+					this.IsLoading=false;
+					this.dispatchEvent(new CloseActionScreenEvent());
+				});
+			}
+		}).catch(err=>{
+			console.log("error:");
+			console.log(err);
+		}).finally(()=>{
+
+		});
+	}
+
+    async cancelSubmit(){
+    	window.open("/apex/EquipmentRentalCancel?raid="+this.RentalApplyId,'cancelSelect','width=500,height=250');
+    }
+}
diff --git a/force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.js-meta.xml b/force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.js-meta.xml
new file mode 100644
index 0000000..4bb35f7
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexCancelSelect">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__AppPage</target>
+        <target>lightning__RecordPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
diff --git a/force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.css b/force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.css
new file mode 100644
index 0000000..e1fe560
--- /dev/null
+++ b/force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.css
@@ -0,0 +1,11 @@
+.Holder{
+	position: relative;
+	display: inline-block;
+	width: 80px;
+	height: 80px;
+	text-align: center;
+}
+
+.container .uiContainerManager{
+	display : none !important;
+}
diff --git a/force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.html b/force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.html
new file mode 100644
index 0000000..be2ae8c
--- /dev/null
+++ b/force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.html
@@ -0,0 +1,5 @@
+<template>
+  <div class="Holder" if:true={IsLoading}>
+              <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+  </div>
+</template>
diff --git a/force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.js b/force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.js
new file mode 100644
index 0000000..28012eb
--- /dev/null
+++ b/force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.js
@@ -0,0 +1,107 @@
+import { LightningElement,api, track, wire } from 'lwc';
+import {CurrentPageReference} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import getUserId from '@salesforce/apex/RentalApplyControllerLWT.getUserId';
+import init from '@salesforce/apex/SelectSubstituteControllerLWT.initClearReturnDeliverySlipButton';
+import updateRaescList from '@salesforce/apex/SelectSubstituteControllerLWT.updateRaescList';
+import selectRacById from '@salesforce/apex/SelectSubstituteControllerLWT.selectRacById';
+import selectRaesdcId from '@salesforce/apex/SelectSubstituteControllerLWT.selectRaesdcId';
+
+import { loadScript } from 'lightning/platformResourceLoader';
+import { submitForApproval } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+
+export default class lexClearReturnDeliverySlip extends LightningElement {
+
+	@api recordId;
+    id;
+    RentalApplyId;
+    Status;
+    IsLoading=true;
+    @wire(CurrentPageReference)
+	getStateParameters(currentPageReference){
+		console.log("杩涘叆椤甸潰");
+		console.log(currentPageReference);
+		if(currentPageReference){
+			const urvalue=currentPageReference.state.recordId;
+			if(urvalue){
+				let str=`${urvalue}`;
+				console.log('str');
+				console.log(str);
+				this.recordId=str;
+			}
+		}
+	}
+
+
+
+	connectedCallback(){
+		console.log(this.recordId);
+		init({recordId:this.recordId}).then(result=>{
+			console.log(result);
+			if(result!=null){
+				this.Rental_Apply_Equipment_Set__c=result;
+				this.cancelSubmit().then(res=>{
+					this.IsLoading=false;
+					this.dispatchEvent(new CloseActionScreenEvent());
+				});
+			}
+		}).catch(err=>{
+			console.log("error:");
+			console.log(err);
+		}).finally(()=>{
+
+		});
+	}
+
+
+
+    async cancelSubmit(){
+    	console.log("hhh1");
+    	var raesId = this.recordId;
+    	console.log("hhh2");
+		var result = await selectRaesdcId({recordId:this.recordId});
+		console.log("hhh3");
+		var objs = result;
+		if (objs.length< 1) {
+			// alert('娌℃湁闇�瑕佹竻绌虹殑涓�瑙堟槑缁�');
+			const event = new ShowToastEvent({
+	            title: '鎻愮ず淇℃伅',
+	            message:'娌℃湁闇�瑕佹竻绌虹殑涓�瑙堟槑缁�'
+	        });
+	        this.dispatchEvent(event);
+		} else {
+			console.log("hhh4");
+			var result;
+			console.log("hhh5");
+			await updateRaescList({updateList:objs})
+			.then(res=>{
+				console.log(res);
+				result=res;
+			});
+			console.log("hhh6");
+			if (result.success==true) {
+				console.log("hhh7");
+				// success
+				// alert("鍥炲瘎杩愯緭鍗曚俊鎭凡娓呯┖");
+				const event = new ShowToastEvent({
+		            title: '鎻愮ず淇℃伅',
+		            message:"鍥炲瘎杩愯緭鍗曚俊鎭凡娓呯┖"
+		        });
+		        this.dispatchEvent(event);
+				setTimeout(function() {
+					location.href = "/"+this.recordId;
+				}, 100);
+			} else {
+				console.log("hhh8");
+				// alert("failed to update:" + result.errors.fields + " " + result[0].errors.message);
+				const event = new ShowToastEvent({
+		            title: '鎻愮ず淇℃伅',
+		            message:"failed to update:" + result.errors.fields + " " + result[0].errors.message
+		        });
+		        this.dispatchEvent(event);
+			}
+		}
+	}
+}
diff --git a/force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.js-meta.xml b/force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.js-meta.xml
new file mode 100644
index 0000000..57176cb
--- /dev/null
+++ b/force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexClearReturnDeliverySlip">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__AppPage</target>
+        <target>lightning__RecordPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
diff --git a/force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.css b/force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.css
new file mode 100644
index 0000000..8d634cd
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.css
@@ -0,0 +1,10 @@
+.createEmailHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.html b/force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.html
new file mode 100644
index 0000000..61d9b05
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="createEmailHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.js b/force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.js
new file mode 100644
index 0000000..8a2f637
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.js
@@ -0,0 +1,231 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { NavigationMixin } from 'lightning/navigation';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import init  from '@salesforce/apex/QISReportController.initForlexCreateRepairButton';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { updateRecord } from 'lightning/uiRecordApi';
+
+export default class lexCreateRepair extends LightningElement {
+	@api recordId;
+	IsLoading = true;
+	typeflag = false;
+	newflag = false;
+	qisReportId='';
+	name='';
+	qisRecordTypeId='';
+    err='';
+    accParentId='';
+    accParentRecordTypeId='';
+    accParentParentFSEGIMainLeader='';
+    accParentParentFSEGIMainLeaderWorkLocation='';
+    accParentParentFSESPMainLeader='';
+    accParentParentFSESPMainLeaderWorkLocation='';
+    WorkLocation='';
+    accrecordId='';
+    oCMjudgement='';
+    nextaction='';
+    specialfollow='';
+    comment='';
+    isUsedForTheOpera='';
+    UseFailProductFinish='';
+    failuerSituation='';
+    sourceOnCall='';
+    hospitalId='';
+    departmentClassId='';
+    hospitalDepartment='';
+    nonyushohinId='';
+    ownerId='';
+    faliourdate='';
+    sourceforrepair='';
+    repairSalesPointProvinceChina='';
+    trableoccurdaYcollect='';
+    damageForDocOrPat='';
+    relationWithTheProblem='';
+    reportForGoz='';
+    whichProject='';
+    operaName='';
+    breakORFallOff='';
+    setusageproduct='';
+    afterFailureInformation='';
+    delay15Min='';
+    informationFrom='';
+    failureQInHospital='';
+    ownername='';
+    hospitalname = '';
+    departmentClassname = '';
+    hospitalDepartmentname = '';
+    nonyushohinIdname = '';
+    sourceOnCallname = '';
+
+	@wire(CurrentPageReference)
+     getStateParameters(currentPageReference) {
+             console.log(111);
+             console.log(currentPageReference);
+
+         if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             console.log("str");
+             console.log(str);
+             this.recordId = str;
+           }
+         }
+    }
+
+    connectedCallback () {
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            this.IsLoading = false;
+            this.qisReportId = result.Id;
+            this.oCMjudgement = result.oCMjudgement;
+            this.nextaction = result.nextaction;
+            this.ownername = result.ownername;
+            this.specialfollow = result.specialfollow;
+            this.qisRecordTypeId = result.qisRecordTypeId;
+            this.accParentId = result.accParentId;
+            this.comment = result.comment;
+            if (result.sourceOnCall!=null) {
+            	this.sourceOnCall = result.sourceOnCall;
+            	this.sourceOnCallname = result.sourceOnCallname;
+            }
+            this.name = result.name;
+            this.hospitalId = result.hospitalId;
+            this.hospitalname = result.hospitalname;
+            this.departmentClassname = result.departmentClassname;
+            this.departmentClassId = result.departmentClassId;
+            this.hospitalDepartment = result.hospitalDepartment;
+            this.nonyushohinId = result.nonyushohinId;
+            this.ownerId = result.ownerId;
+            this.faliourdate = result.faliourdate;
+            this.sourceforrepair = result.sourceforrepair;
+            this.repairSalesPointProvinceChina = result.repairSalesPointProvinceChina;
+            this.trableoccurdaYcollect = result.trableoccurdaYcollect;
+            this.damageForDocOrPat = result.damageForDocOrPat;
+            this.relationWithTheProblem = result.relationWithTheProblem;
+            this.reportForGoz = result.reportForGoz;
+            this.whichProject = result.whichProject;
+            this.operaName = result.operaName;
+            this.breakORFallOff = result.breakORFallOff;
+            this.setusageproduct = result.setusageproduct;
+            this.afterFailureInformation = result.afterFailureInformation;
+            this.delay15Min = result.delay15Min;
+            this.informationFrom = result.informationFrom;
+            this.failureQInHospital = result.failureQInHospital;
+            this.failuerSituation = result.failuerSituation;
+            this.isUsedForTheOpera = result.isUsedForTheOpera;
+            this.accParentRecordTypeId = result.accParentRecordTypeId;
+            this.accParentParentFSEGIMainLeader = result.accParentParentFSEGIMainLeader;
+            this.accParentParentFSEGIMainLeaderWorkLocation = result.accParentParentFSEGIMainLeaderWorkLocation;
+            this.accParentParentFSESPMainLeader = result.accParentParentFSESPMainLeader;
+            this.accParentParentFSESPMainLeaderWorkLocation = result.accParentParentFSESPMainLeaderWorkLocation;
+         	if (this.qisRecordTypeId != '01210000000RLWc' && this.qisRecordTypeId != '01210000000RLWh') {
+         		this.typeflag = true;
+         	}
+         	if (this.accParentId != null) {
+         		if (this.accParentRecordTypeId != null) {
+         			this.accrecordId = this.accParentRecordTypeId.substring(0,15);
+         			if (this.accrecordId == '01210000000QemL' || this.accrecordId == '01210000000QezZ' || this.accrecordId == '01210000000QemQ') {
+         				if (this.accParentParentFSEGIMainLeader != null) {
+         					this.WorkLocation = this.accParentParentFSEGIMainLeaderWorkLocation;
+         				}
+         			}else if(this.accrecordId == '01210000000Qeze' || this.accrecordId == '01210000000Qezj' || this.accrecordId == '01210000000Qezt'|| this.accrecordId == '01210000000Qezo'|| this.accrecordId == '01210000000Qezy'){
+         				if (this.accParentParentFSESPMainLeader != null) {
+         					this.WorkLocation = this.accParentParentFSESPMainLeaderWorkLocation;
+         				}
+         			}
+         		}
+         	}
+         	if ((this.oCMjudgement == '璐ㄩ噺闂' && this.nextaction == '鏃犲伩缁翠慨') ||
+         		(this.oCMjudgement == '璐ㄩ噺闂' && this.nextaction == '鏈夊伩缁翠慨' && this.specialfollow == '0') || 
+         		(this.oCMjudgement == '闈炶川閲忛棶棰�' && this.nextaction == '鏃犲伩缁翠慨' && this.specialfollow == '1') || 
+         		(this.oCMjudgement == '闈炶川閲忛棶棰�' && this.nextaction == '鏈夊伩缁翠慨' && this.specialfollow == '0') || 
+         		(this.oCMjudgement == '璐ㄩ噺闂+闈炶川閲忛棶棰�' && this.nextaction == '鏃犲伩缁翠慨' && this.specialfollow == '1') || 
+         		(this.oCMjudgement == '璐ㄩ噺闂+闈炶川閲忛棶棰�' && this.nextaction == '鏈夊伩缁翠慨+鏃犲伩缁翠慨' && this.specialfollow == '0') || 
+         		(this.oCMjudgement == '鐜拌薄鏈彂鐜�' && this.nextaction == '鏃犲伩缁翠慨' && this.specialfollow == '1') || 
+         		(this.oCMjudgement == '鐜拌薄鏈彂鐜�' && this.nextaction == '鏈夊伩缁翠慨' && this.specialfollow == '0')) {
+         		this.newflag = true;
+         	}
+         	console.log('this.newflag = '+this.newflag);
+         	console.log('this.typeflag = '+this.typeflag);
+         	if ( this.newflag && this.typeflag) {
+         		if (this.isUsedForTheOpera == 'YES') {
+         			this.UseFailProductFinish = '鏄�';
+         		}else if(this.isUsedForTheOpera == 'NO-鐢ㄦ浛浠e搧瀹屾垚浜�'){
+         			this.UseFailProductFinish = '鍚�-鐢ㄦ浛浠e搧瀹屾垚';
+         		}else if(this.isUsedForTheOpera == 'NO-鐢ㄥ叾浠栧叕鍙哥殑鍚岀被浜у搧瀹屾垚浜�'){
+         			this.UseFailProductFinish = '鍚�-鐢ㄥ叾浠栧叕鍙哥殑鍚岀被浜у搧瀹屾垚';
+         		}else if(this.isUsedForTheOpera == 'NO-鎵嬫湳涓'){
+         			this.UseFailProductFinish = '鍚�-鎵嬫湳涓';
+         		}
+         		if ('浣跨敤鍓嶅噯澶�' == this.failuerSituation) {
+         			this.failuerSituation = '浣跨敤鍓嶅噯澶�-鎮h�呮湭楹婚唹';
+         		}
+         		var url = '';
+         			url = "/a0J/e?" +
+						"CF00N10000002FIJU_lkid="+this.sourceOnCall+"&" +
+						"CF00N10000002FIJU="+this.sourceOnCallname+"&" +
+						"CF00N10000002FIJZ_lkid="+this.qisReportId+"&" +
+						"CF00N10000002FIJZ="+this.name+"&" +
+						"CF00N10000002Dx66_lkid="+this.hospitalId+"&" +
+						"CF00N10000002Dx66="+this.hospitalname+"&" +
+						"CF00N10000002Dx5t_lkid="+this.departmentClassId+"&" +
+						"CF00N10000002Dx5t="+this.departmentClassname+"&" +
+						"CF00N10000002Dx5n_lkid="+this.hospitalDepartment+"&" +
+						"CF00N10000002Dx5n="+this.hospitalDepartmentname+"&" +
+						"CF00N10000002Dx1X_lkid="+this.nonyushohinId+"&" +
+						"CF00N10000002Dx1X="+this.nonyushohinIdname+"&" +
+						"CF00N10000002EMHw_lkid="+this.ownerId+"&" +
+						"CF00N10000002EMHw="+this.ownername+"&" +
+						"00N10000002Dx5y="+this.faliourdate+"&" +
+						"00N10000002Dx6I="+this.comment+"&" +
+						"00N10000002FH86="+this.sourceforrepair+"&" +
+						"00N10000006P6Rn="+this.repairSalesPointProvinceChina+"&" +
+						"00N10000008rsVQ="+this.trableoccurdaYcollect+"&" +
+						"00N10000008rsW7="+this.damageForDocOrPat+"&"+
+						"00N10000008rsVw="+this.relationWithTheProblem+"&"+
+						"00N10000008rsW2="+this.reportForGoz+"&"+
+						"00N10000008rsW6="+this.whichProject+"&"+
+						"00N10000008rsVk="+this.operaName+"&" +
+						"00N10000008rsVN="+this.breakORFallOff+"&"+
+						"00N10000008rsW4="+this.setusageproduct+"&" +
+						"00N10000008rsVL="+this.afterFailureInformation+"&" +
+						"00N10000008rsVR="+this.delay15Min+"&"+
+						"00N10000008rsVZ="+this.informationFrom+"&"+
+						"00N10000008rsVT="+this.failureQInHospital+"&" +
+						"00N10000008rsVv="+this.failuerSituation+"&"+
+						"00N10000008rsW5="+this.UseFailProductFinish+ "&" +
+						"00N10000006P6SM="+this.WorkLocation+ "&" +
+						"retURL=%2F"+this.qisReportId;
+						window.open(url, "_blank");
+						this.dispatchEvent(new CloseActionScreenEvent());
+         	}else{
+         		const evt = new ShowToastEvent({
+                        title : '璇IS涓嶈兘鏂板缓淇悊',
+                        message: '',
+                        variant: 'error'
+                    });
+                    this.dispatchEvent(evt);
+                this.dispatchEvent(new CloseActionScreenEvent());
+         		return;
+         	}
+        }).catch(error => {
+            
+            const evt = new ShowToastEvent({
+                        title : '鍙戠敓閿欒',
+                        message: '',
+                        variant: 'error'
+                    });
+                    this.dispatchEvent(evt);
+
+            this.dispatchEvent(new CloseActionScreenEvent());
+            console.log('error='+error);
+         	return;
+        }).finally(() => {
+            
+        }); 
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.js-meta.xml b/force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.js-meta.xml
new file mode 100644
index 0000000..6cafb47
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexCreateRepair">
+   <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.css b/force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.css
new file mode 100644
index 0000000..e1fe560
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.css
@@ -0,0 +1,11 @@
+.Holder{
+	position: relative;
+	display: inline-block;
+	width: 80px;
+	height: 80px;
+	text-align: center;
+}
+
+.container .uiContainerManager{
+	display : none !important;
+}
diff --git a/force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.html b/force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.html
new file mode 100644
index 0000000..e811909
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.html
@@ -0,0 +1,5 @@
+<template>
+      <div class="Holder" if:true={IsLoading}>
+              <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+      </div>
+</template>
diff --git a/force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.js b/force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.js
new file mode 100644
index 0000000..46be221
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.js
@@ -0,0 +1,158 @@
+import { LightningElement,api, track, wire } from 'lwc';
+import {CurrentPageReference} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import getUserId from '@salesforce/apex/RentalApplyControllerLWT.getUserId';
+import init from '@salesforce/apex/SelectSubstituteControllerLWT.initFromCustomSubmitButton';
+import updateRaesc from '@salesforce/apex/SelectSubstituteControllerLWT.updateRaesc';
+import selectRacById from '@salesforce/apex/SelectSubstituteControllerLWT.selectRacById';
+import postponeCheck from '@salesforce/apex/SelectSubstituteControllerLWT.postponeCheck';
+
+import { loadScript } from 'lightning/platformResourceLoader';
+import { submitForApproval } from 'lightning/uiRecordApi';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class lexCustomSubmit extends LightningElement {
+
+	@api recordId;
+    id;
+    RentalApplyId;
+    Status;
+    IsLoading=true;
+    @wire(CurrentPageReference)
+	getStateParameters(currentPageReference){
+		console.log("杩涘叆椤甸潰");
+		console.log(currentPageReference);
+		if(currentPageReference){
+			const urvalue=currentPageReference.state.recordId;
+			if(urvalue){
+				let str=`${urvalue}`;
+				console.log('str');
+				console.log(str);
+				this.recordId=str;
+			}
+		}
+	}
+
+
+
+	connectedCallback(){
+		console.log(this.recordId);
+		init({recordId:this.recordId}).then(result=>{
+			console.log(result);
+			if(result!=null){
+				this.Rental_Apply_Equipment_Set__c=result;
+				this.cancelSubmit().then(res=>{
+					this.IsLoading=false;
+					this.dispatchEvent(new CloseActionScreenEvent());
+				});	
+			}
+		}).catch(err=>{
+			console.log("error:");
+			console.log(err);
+		}).finally(()=>{
+
+		});
+	}
+
+
+ 
+    async cancelSubmit(){
+    	console.log("hhh1");
+		if (this.Rental_Apply_Equipment_Set__c.Request_extend_day__c == ""
+		|| this.Rental_Apply_Equipment_Set__c.Request_extend_day__c == null
+		|| this.Rental_Apply_Equipment_Set__c.Extend_request_reason__c == ""
+		|| this.Rental_Apply_Equipment_Set__c.Extend_request_reason__c == null) {
+			// alert("蹇呴』濉啓寤舵湡甯屾湜缁撴潫鏃ワ紝寤舵湡鐢宠鐞嗙敱");
+			const event = new ShowToastEvent({
+	            title: '鎻愮ず淇℃伅',
+	            message:"蹇呴』濉啓寤舵湡甯屾湜缁撴潫鏃ワ紝寤舵湡鐢宠鐞嗙敱"
+	        });
+	        this.dispatchEvent(event);
+			return;
+		}
+		console.log("hhh2");
+		let rtn;
+		await postponeCheck({
+			endDate:this.Rental_Apply_Equipment_Set__c.Rental_End_Date__c,
+			d:-5
+		}).then(res=>{
+			console.log(res);
+			rtn=res;
+		}).catch(err=>{
+			console.log("err:",err.message);
+		})
+
+		console.log(rtn);
+		if (rtn != "OK") {
+			// alert(rtn);
+			const event = new ShowToastEvent({
+	            title: '鎻愮ず淇℃伅',
+	            message:rtn
+	        });
+	        this.dispatchEvent(event);
+			return;
+		}
+		console.log("hhh3");
+		let resultSet = await selectRacById({recordId:this.Rental_Apply_Equipment_Set__c.Rental_Apply__c})
+		;
+		let records = resultSet;
+		console.log("hhh4");
+		let result = await updateRaesc({
+			recordId:this.Rental_Apply_Equipment_Set__c.Id,
+			JingliApprovalManagerc:records[0].JingliApprovalManager__c,
+			BuchangApprovalManagerc:records[0].SalesManager__c,
+			BuchangApprovalManagerSalesc:records[0].BuchangApprovalManager__c,
+			ZongjianApprovalManagerc:records[0].BuchangApprovalManagerSales__c,
+			ExtendStatusc:'濉啓瀹屾瘯',
+		});
+		console.log("hhh5");
+		console.log(result);
+		// let messages = getConnectDMLErrorMessages(result);
+		if(result!=null&&result.length>0&&result.errors.length>0){
+			// alert(result.errors[0].split(",")[1]);
+			const event = new ShowToastEvent({
+	            title: '鎻愮ず淇℃伅',
+	            message:result.errors[0].split(",")[1]
+	        });
+	        this.dispatchEvent(event);
+		}
+		console.log("hhh7");
+
+		// let request = new sforce.ProcessSubmitRequest();
+		// request.objectId = this.recordId;
+		// let processResults = sforce.connection.process([request]);
+		console.log("hhh8");
+		// submitForApproval(this.Rental_Apply_Equipment_Set__c.Id).then(result => {
+        // 	console.log(result);
+        // 	if (processResults[0].errors != null) {
+		// 		alert(processResults[0].errors.message);
+		// 		return;
+		// 	}
+		// 	console.log("hhh9");
+		// 	window.location.reload();
+        // })
+        // .catch(error => {
+        //   console.error('Error submitting record for approval:', error.message);
+        // });
+
+        // await submitForApproval(this.recordId);
+	    const fields = {}
+	    const recordInput = { fields };
+		updateRecord({ fields: recordInput, recordId: this.recordId })
+	      .then(() => {
+	        console.log("鏇存柊鎴愬姛");
+	      })
+	      .catch(error => {
+	      	console.log(error.message);
+	      	console.log(error);
+	      	// alert(error.body.message);
+			const event = new ShowToastEvent({
+	            title: '鎻愮ず淇℃伅',
+	            message:error.body.message
+	        });
+	        this.dispatchEvent(event);
+			return;
+	        // 澶勭悊寮傚父鎯呭喌
+	      });
+	}
+}
diff --git a/force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.js-meta.xml b/force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.js-meta.xml
new file mode 100644
index 0000000..d737898
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexCustomSubmit">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__AppPage</target>
+        <target>lightning__RecordPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
diff --git a/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.css b/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.css
new file mode 100644
index 0000000..af18c76
--- /dev/null
+++ b/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.css
@@ -0,0 +1,11 @@
+.Holder{
+	position: relative;
+	display: inline-block;
+	width: 80px;
+	height: 80px;
+	text-align: center;
+}
+
+.container .uiContainerManager{
+	display : none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.html b/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.html
new file mode 100644
index 0000000..2ef2898
--- /dev/null
+++ b/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.html
@@ -0,0 +1,5 @@
+<template>
+	<div class="Holder" if:true={IsLoading}>
+      	<lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+  	</div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js b/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js
new file mode 100644
index 0000000..fedf726
--- /dev/null
+++ b/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js
@@ -0,0 +1,39 @@
+import { LightningElement, track, wire, api } from 'lwc';
+import {CurrentPageReference} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+
+export default class lexDetailBulkUpdate extends LightningElement {
+	@api recordId;
+  
+
+    @wire(CurrentPageReference)
+	getStateParameters(currentPageReference){
+		console.log("杩涘叆椤甸潰");
+		console.log(currentPageReference);
+		if(currentPageReference){
+			const urvalue=currentPageReference.state.recordId;
+			if(urvalue){
+				let str=`${urvalue}`;
+				console.log('str');
+				console.log(str);
+				this.recordId=str;
+			}
+		}
+	}
+
+	connectedCallback(){
+
+		this.cancelSubmit().then(res=>{
+			this.IsLoading=false;
+			this.dispatchEvent(new CloseActionScreenEvent());
+		});
+	}
+
+	async cancelSubmit(){
+		window.open('/apex/TransferApplySelectDetailSub?id='+this.recordId,'DetailBulkUpdateLWC', 'width=600,height=200');
+	}
+
+	//old js
+	// window.open("/apex/TransferApplySelectDetailSub?Id={!URLENCODE(TransferApply__c.Id)}");
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js-meta.xml b/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js-meta.xml
new file mode 100644
index 0000000..b41eb1f
--- /dev/null
+++ b/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexDetailBulkUpdate">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__AppPage</target>
+        <target>lightning__RecordPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ 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 3916190..d2dbda3 100644
--- a/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js
+++ b/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js
@@ -1,102 +1,258 @@
-import { LightningElement, track, wire, api } from 'lwc';
-import { CurrentPageReference,NavigationMixin } from 'lightning/navigation';
+import { LightningElement,api, track, wire } from 'lwc';
+import {CurrentPageReference} from 'lightning/navigation';
 import { CloseActionScreenEvent } from 'lightning/actions';
-
-import init from '@salesforce/apex/loanerArrangedEmailController.init';
-import getRentalApplyEquipmentSet from '@salesforce/apex/loanerArrangedEmailController.getRentalApplyEquipmentSet';
-import approvalCheck from '@salesforce/apex/RentalApplyWebService.approvalCheck';
-import setShipment_request from '@salesforce/apex/RentalApplyWebService.approvalCheck';
+import init from '@salesforce/apex/SelectSubstituteControllerLWT.initFromLoanerArrangedEmailLButton';
+import selectRentalApplyCByName from '@salesforce/apex/SelectSubstituteControllerLWT.selectRentalApplyCByName';
+import selectRaesById1 from '@salesforce/apex/SelectSubstituteControllerLWT.selectRaesById1';
+import selectRaesById2 from '@salesforce/apex/SelectSubstituteControllerLWT.selectRaesById2';
+import getSessionId from '@salesforce/apex/SelectSubstituteControllerLWT.getSessionId';
+import approvalCheck from '@salesforce/apex/SelectSubstituteControllerLWT.approvalCheck';
+import setShipment_requests from '@salesforce/apex/SelectSubstituteControllerLWT.setShipment_requests';
+// import { label } from '@salesforce/label';
+import STATUS_PROCESS_STATE from '@salesforce/label/c.StatusProcessState';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 export default class lexLoanerArrangedEmail extends LightningElement {
-	@api recordId;
-	IsLoading = true;
 
+	@api recordId;
+	id;
+	RentalApplyC;
+	Status;
+	Wei_Assigned_Cnt__c;
+	Bollow_Date__c;
+	Assigned_Not_Shipment__c;
+	IsLoading=true;
+	@track statusStringg = STATUS_PROCESS_STATE;
 	@wire(CurrentPageReference)
-	getStateParameters(currentPageReference) {
-		if(currentPageReference) {
-			const urlValue = currentPageReference.state.recordId;
-			if(urlValue) {
-				let str = `${urlValue}`;
-		        this.recordId = str;
+	getStateParameters(currentPageReference){
+		console.log("杩涘叆椤甸潰");
+		console.log(currentPageReference);
+		if(currentPageReference){
+			const urvalue=currentPageReference.state.recordId;
+			if(urvalue){
+				let str=`${urvalue}`;
+				console.log('str');
+				console.log(str);
+				this.recordId=str;
 			}
 		}
 	}
 
-	connectedCallback() {
-		init({
-			recordId: this.recordId
-		}).then(result => {
-			console.log(this.recordId);
-			console.log('result==='+JSON.stringify(result));
-			if(result != null) {
-				if( result.WeiAssignedCnt > 0 ) {
-					alert("鐢宠鍗曞唴瀛樺湪鏈垎閰嶇殑閰嶅锛岃鍒嗛厤澶囧搧鎴栧垎鍓茬敵璇峰崟");
-				}else if(result.CampaignStatus == "鍙栨秷") {
-					alert("瀛︿細鍙栨秷锛屼笉鍙嚭搴撴寚绀�"); 
-				}else if (result.RaStatus == "宸插嚭搴撴寚绀�" && result.AssignedNotShipment == 0){
-					alert("鎵�鏈夌殑鍊熷嚭澶囧搧Set涓�瑙堥兘杩涜杩囧嚭搴撴寚绀轰簡");
-				}else if (result.AssignedNotShipment == 0) {
-					alert("娌℃湁鍙互鍑哄簱鎸囩ず鐨勬槑缁�"); 
-				}else if (result.DemoPurpose1 == "闀挎湡鍊熷嚭" && result.ContractPdfUpdated == 0){
-					alert("闀挎湡鍊熷嚭鏃讹紝蹇呴』鍏堜笂浼犲绾︿功"); 
-				}else if (result.RepairId != '' && (result.RepairFinalInspectionDateF != null && result.RepairFinalInspectionDateF != '') || (result.RCReturnToOffice != null && result.RCReturnToOffice != '')){
-					alert("淇悊鏈夋渶缁堟娴嬫棩鎴栦慨鐞嗗搧杩旈�佹棩锛屼笉鍙嚭搴撴寚绀�"); 
-				}else if (result.IFApproved == "true" && (result.MeetingApprovedNo == null || result.MeetingApprovedNo == "")){
-					alert("娌℃湁鍐宠鍙风殑锛屾殏涓嶈兘鍑哄��,璇锋洿鏂拌鍐充俊鎭��"); 
-				}else if (result.IFApproved == "true" && result.MeetingApprovedNo != "" && result.StatusList.indexOf(records[0].Approved_Status__c) != -1){
-					alert("宸茬敵璇峰喅瑁佷絾鍐宠鐘舵�佷笉绗﹀悎鏉′欢銆�"); 
-				}else {
-					approvalCheck({
-						rentalApplyId: this.recordId
-					}).then(res=>{
-						if (res != '1') {
-							alert(rs1);
-						} else {
-							//bp2 var rs2 = sforce.apex.execute("RentalApplyWebService", "reserve", {rentalApplyId: raid});
-							//bp2 if (rs2 != '1') {
-							//bp2 alert(rs2);
-							//bp2 } else {
-							//var rs1 = sforce.apex.execute("RentalApplyWebService", "setShipment_request", {raid : "{!Rental_Apply__c.Id}"}); 
 
-							setShipment_request({
-								raid: this.recordId
-							}).then(res=>{
-								if (res == "鐘舵�佹洿鏂板埌宸插嚭搴撴寚绀�") { 
-									alert("鐘舵�佹洿鏂板埌宸插嚭搴撴寚绀�");
-									print();
-									setTimeout(function() {
-										location.href = "/{!Rental_Apply__c.Id}"; 
-									},100);
-								}else {
-									alert(res);
-								}
-							}).catch(e=>{
-								console.log('approvalCheck==='+e);
-							})
-						}
-					}).catch(e=>{
-						console.log('setShipment_request==='+e);
-					})				
-				}
-				this.dispatchEvent(new CloseActionScreenEvent());
+
+	connectedCallback(){
+		console.log(this.recordId);
+		init({recordId:this.recordId}).then(result=>{
+			console.log(result);
+			if(result!=null){
+				this.id=result.id;
+				this.RentalApplyC=result.RentalApplyC;
+				this.Status=result.Status;
+				this.Wei_Assigned_Cnt__c=result.WeiAssignedCntC;
+				this.Bollow_Date__c=result.BollowDateC;
+				this.Assigned_Not_Shipment__c=result.AssignedNotShipmentC;
+				this.cancelSubmit().then(res=>{
+					this.IsLoading=false;
+					this.dispatchEvent(new CloseActionScreenEvent());
+				});
 			}
-		})
+		}).catch(err=>{
+			console.log("error:");
+			console.log(err);
+		}).finally(()=>{
+
+		});
 	}
 
-	print() {
-		getRentalApplyEquipmentSet({
-			recordId: this.recordId
-		}).then(result => {
-			window.open("https://ocsm--partial.sandbox.lightning.force.com/apex/FixtureRentalPDF?raid=" + this.recordId + "&page=" + result);
-		})
-	}
 
-	fixDate(date){
-		var Month = fixTime(date.getMonth() + 1);
-		var Day = fixTime(date.getDate());
-		var UTC = date.toUTCString();
-		var Time = UTC.substring(UTC.indexOf(':')-2, UTC.indexOf(':')+6);
-		var Minutes = fixTime(date.getMinutes());
-		var Seconds = fixTime(date.getSeconds());
-		return date.getFullYear() + "-" + Month + "-" + Day + "T" + Time;
+
+	async cancelSubmit(){
+		let campaignStatus = '';
+		let records = null; // 20220217 ljh OBPM甯傚満娲诲姩鑱斿姩
+		console.log("Ff");
+		let statusSting = "{!$Label.StatusProcessState}"; // 20220322 ljh add
+		let statusList = statusSting.split(',');
+		console.log(statusSting);
+		console.log(statusList);
+		console.log(this.statusStringg);
+		let raliveryGood;
+		await selectRentalApplyCByName({recordId:this.RentalApplyC})
+			.then(res=>{
+				console.log(res);
+				if (res!=null) {
+					raliveryGood=res;
+				}
+			}).catch(err=>{
+				console.log("selectRentalApplyCByName err:")
+				console.log(err.message);
+			});
+		console.log(statusSting);
+		console.log(raliveryGood);
+		console.log("ddd");
+		let RentalApply = raliveryGood[0];
+		console.log(RentalApply);
+
+		if(RentalApply.Campaign__c != null&&RentalApply.Campaign__c != '' ) {
+			console.log();
+			let DeliveryGood;
+			// 20220217 ljh update OBPM甯傚満娲诲姩鑱斿姩 start
+			// DeliveryGood = sforce.connection.query("select Status, Rental_Apply_Flag__c from Campaign where id ='" + RentalApply.Campaign__c + "'");
+			// let records= DeliveryGood.getArray("records");
+			await selectCampaignById({recordId:RentalApply.Campaign__c}).then(res=>{
+				console.log(res);
+				DeliveryGood=res;
+			});
+			console.log(RentalApply);
+			records = DeliveryGood;
+			console.log(DeliveryGood);
+			// 20220217 ljh update OBPM甯傚満娲诲姩鑱斿姩 end
+
+			campaignStatus = records[0].Status;
+			console.log("hh3");
+		}
+		if(this.Wei_Assigned_Cnt__c > "0") {
+			// alert("鐢宠鍗曞唴瀛樺湪鏈垎閰嶇殑閰嶅锛岃鍒嗛厤澶囧搧鎴栧垎鍓茬敵璇峰崟");
+			const event = new ShowToastEvent({
+				title: '鎻愮ず淇℃伅',
+				message:"鐢宠鍗曞唴瀛樺湪鏈垎閰嶇殑閰嶅锛岃鍒嗛厤澶囧搧鎴栧垎鍓茬敵璇峰崟"
+			});
+			this.dispatchEvent(event);
+		}else if(campaignStatus == '鍙栨秷'){
+			// alert("瀛︿細鍙栨秷锛屼笉鍙嚭搴撴寚绀�");
+			const event = new ShowToastEvent({
+				title: '鎻愮ず淇℃伅',
+				message:"瀛︿細鍙栨秷锛屼笉鍙嚭搴撴寚绀�"
+			});
+			this.dispatchEvent(event);
+		}else if (this.Assigned_Not_Shipment__c == "0") {
+			// alert("娌℃湁鍙互鍑哄簱鎸囩ず鐨勬槑缁�");
+			const event = new ShowToastEvent({
+				title: '鎻愮ず淇℃伅',
+				message:"娌℃湁鍙互鍑哄簱鎸囩ず鐨勬槑缁�"
+			});
+			this.dispatchEvent(event);
+		} else if (RentalApply.Demo_purpose1__c == "闀挎湡鍊熷嚭" && RentalApply.Contract_pdf_updated__c == "0") {
+			// alert("闀挎湡鍊熷嚭鏃讹紝蹇呴』鍏堜笂浼犲绾︿功");
+			const event = new ShowToastEvent({
+				title: '鎻愮ず淇℃伅',
+				message:"闀挎湡鍊熷嚭鏃讹紝蹇呴』鍏堜笂浼犲绾︿功"
+			});
+			this.dispatchEvent(event);
+		} else if(RentalApply.Repair__c != '' && RentalApply.Repair__c != null && (RentalApply.Repair_Final_Inspection_Date_F__c != null && RentalApply.Repair_Final_Inspection_Date_F__c != '') || (RentalApply.RC_return_to_office__c != null && RentalApply.RC_return_to_office__c != '')) {
+			// alert("淇悊鏈夋渶缁堟娴嬫棩鎴栦慨鐞嗗搧杩旈�佹棩锛屼笉鍙嚭搴撴寚绀�");
+			const event = new ShowToastEvent({
+				title: '鎻愮ず淇℃伅',
+				message:"淇悊鏈夋渶缁堟娴嬫棩鎴栦慨鐞嗗搧杩旈�佹棩锛屼笉鍙嚭搴撴寚绀�"
+			});
+			this.dispatchEvent(event);
+			// 20220217 ljh add OBPM甯傚満娲诲姩鑱斿姩 start
+		} else if (records != null && records[0].IF_Approved__c == "true" && (records[0].Meeting_Approved_No__c == null || records[0].Meeting_Approved_No__c == "") ) {
+			// alert("娌℃湁鍐宠鍙风殑锛屾殏涓嶈兘鍑哄��,璇锋洿鏂拌鍐充俊鎭��");
+			const event = new ShowToastEvent({
+				title: '鎻愮ず淇℃伅',
+				message:"娌℃湁鍐宠鍙风殑锛屾殏涓嶈兘鍑哄��,璇锋洿鏂拌鍐充俊鎭��"
+			});
+			this.dispatchEvent(event);
+		} else if (records != null && records[0].IF_Approved__c == "true" && records[0].Meeting_Approved_No__c != "" && statusList.indexOf(records[0].Approved_Status__c) != -1 ) {
+			// alert("宸茬敵璇峰喅瑁佷絾鍐宠鐘舵�佷笉绗﹀悎鏉′欢銆�");
+			const event = new ShowToastEvent({
+				title: '鎻愮ず淇℃伅',
+				message:"宸茬敵璇峰喅瑁佷絾鍐宠鐘舵�佷笉绗﹀悎鏉′欢銆�"
+			});
+			this.dispatchEvent(event);
+			// 20220217 ljh add OBPM甯傚満娲诲姩鑱斿姩 end
+		} else {
+			console.log("hhhh3");
+			let t=await getSessionId();
+			console.log(t);
+			window.sforce = window.sforce || {};
+			window.sforce.connection = window.sforce.connection || {};
+			window.sforce.connection.sessionId =t;
+			//154p 1388 yc 20211020
+			console.log("hhhh4");
+			let raid = RentalApply.Id+";"+this.id;
+			console.log(raid);
+			let rs1 = await approvalCheck({rentalApplyId:raid});
+			console.log(rs1);
+			if (rs1 != '1') {
+				// alert(rs1);
+				const event = new ShowToastEvent({
+					title: '鎻愮ず淇℃伅',
+					message:rs1
+				});
+				this.dispatchEvent(event);
+			} else {
+				//bp2 let rs2 = sforce.apex.execute("RentalApplyWebService", "reserve", {rentalApplyId: raid});
+				//bp2 if (rs2 != '1') {
+				//bp2 alert(rs2);
+				//bp2 } else {
+				setShipment_requests({raid:null,raesid: this.id}).then(res=>{
+					if (res == "鐘舵�佹洿鏂板埌宸插嚭搴撴寚绀�") {
+						// alert("鐘舵�佹洿鏂板埌宸插嚭搴撴寚绀�");
+						const event = new ShowToastEvent({
+							title: '鎻愮ず淇℃伅',
+							message:"鐘舵�佹洿鏂板埌宸插嚭搴撴寚绀�"
+						});
+						this.dispatchEvent(event);
+						print().then(res=>{
+							setTimeout(function() {location.href = "/"+this.RentalApplyC;}, 100);
+						});
+					} else {
+						// alert(res);
+						const event = new ShowToastEvent({
+							title: '鎻愮ず淇℃伅',
+							message:res
+						});
+						this.dispatchEvent(event);
+					}
+				})
+				// sforce.apex.execute("RentalApplyWebService", "setRaesShipment_request",
+				//  {raesid: this.id}
+				// 	,function(res) {
+				// 		if (res == "鐘舵�佹洿鏂板埌宸插嚭搴撴寚绀�") {
+				// 			alert("鐘舵�佹洿鏂板埌宸插嚭搴撴寚绀�");
+				// 			print().then(res=>{
+				// 				setTimeout(function() {location.href = "/"+this.RentalApplyC;}, 100);
+				// 			});
+				// 		} else {
+				// 			alert(res);
+				// 		}
+				// });
+			}
+		}
+
+		async function print(){
+			let sqlResult;
+			if(this.Bollow_Date__c != ''){
+				await selectRaesById1({recordId:RentalApply.Id}).then(res=>{
+					sqlResult=res;
+				});
+			}else{
+				await selectRaesById2({recordId:RentalApply.Id}).then(res=>{
+					sqlResult=res;
+				});
+			}
+			let records = sqlResult;
+			let size =records.length;
+			let length = size%10 ==0? size/10 : parseInt(size/10) +1;
+			for(let i =0;i<length;i++){
+				window.open('/apex/FixtureRentalPDF?raid=' + RentalApply.Id + '&page=' + i);
+			}
+		}
+
+
+		// function fixTime(time){
+		// 	if(time < 10) {time = "0" + time};
+		// 		return time;
+		// }
+
+		// function fixDate(date){
+		// 	let Month = fixTime(date.getMonth() + 1);
+		// 	let Day = fixTime(date.getDate());
+		// 	let UTC = date.toUTCString();
+		// 	let Time = UTC.substring(UTC.indexOf(':')-2, UTC.indexOf(':')+6);
+		// 	let Minutes = fixTime(date.getMinutes());
+		// 	let Seconds = fixTime(date.getSeconds());
+		// 	return date.getFullYear() + "-" + Month + "-" + Day + "T" + Time;
+		// }
 	}
-}
\ No newline at end of file
+}
diff --git a/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js-meta.xml b/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js-meta.xml
index e261be9..0efa3b8 100644
--- a/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js-meta.xml
+++ b/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js-meta.xml
@@ -1,11 +1,11 @@
-<?xml version="1.0"?>
-<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
-    <apiVersion>54.0</apiVersion>
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexLoanerArrangedEmail">
+    <apiVersion>51.0</apiVersion>
     <isExposed>true</isExposed>
     <targets>
-        <target>lightning__RecordPage</target>
         <target>lightning__AppPage</target>
+        <target>lightning__RecordPage</target>
         <target>lightning__HomePage</target>
         <target>lightning__RecordAction</target>
     </targets>
-</LightningComponentBundle>
\ No newline at end of file
+</LightningComponentBundle>
diff --git a/force-app/main/default/lwc/lexLoseReport/__tests__/lexLoseReport.test.js b/force-app/main/default/lwc/lexLoseReport/__tests__/lexLoseReport.test.js
new file mode 100644
index 0000000..12c14ec
--- /dev/null
+++ b/force-app/main/default/lwc/lexLoseReport/__tests__/lexLoseReport.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexLoseReport from 'c/lexLoseReport';
+
+describe('c-lex-lose-report', () => {
+    afterEach(() => {
+        // The jsdom instance is shared across test cases in a single file so reset the DOM
+        while (document.body.firstChild) {
+            document.body.removeChild(document.body.firstChild);
+        }
+    });
+
+    it('TODO: test case generated by CLI command, please fill in test logic', () => {
+        // Arrange
+        const element = createElement('c-lex-lose-report', {
+            is: LexLoseReport
+        });
+
+        // Act
+        document.body.appendChild(element);
+
+        // Assert
+        // const div = element.shadowRoot.querySelector('div');
+        expect(1).toBe(1);
+    });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLoseReport/lexLoseReport.css b/force-app/main/default/lwc/lexLoseReport/lexLoseReport.css
new file mode 100644
index 0000000..93da52a
--- /dev/null
+++ b/force-app/main/default/lwc/lexLoseReport/lexLoseReport.css
@@ -0,0 +1,10 @@
+.lexLoseReportHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLoseReport/lexLoseReport.html b/force-app/main/default/lwc/lexLoseReport/lexLoseReport.html
new file mode 100644
index 0000000..d7e25f9
--- /dev/null
+++ b/force-app/main/default/lwc/lexLoseReport/lexLoseReport.html
@@ -0,0 +1,6 @@
+<template>
+    <div class="lexLoseReportHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLoseReport/lexLoseReport.js b/force-app/main/default/lwc/lexLoseReport/lexLoseReport.js
new file mode 100644
index 0000000..7b167ea
--- /dev/null
+++ b/force-app/main/default/lwc/lexLoseReport/lexLoseReport.js
@@ -0,0 +1,102 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-14 10:16:19
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-14 10:41:46
+ */
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import init  from '@salesforce/apex/OpportunityLightingButtonController.initForLostReportButton';
+export default class LexLoseReport extends LightningElement {
+    @api recordId;
+    stageName;
+    sapSendOK;
+    cntLostCancelReport;
+    name;
+    salesAssistantName;
+    salesAssistantID;
+    managerName;
+    salesManagerDepartmentID;
+    salesOwnerBuchang;
+    salesOwnerBuchangID;
+    IsLoading = true;
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+            console.log(111);
+            console.log(currentPageReference);
+
+        if (currentPageReference) {
+          const urlValue = currentPageReference.state.recordId;
+          if (urlValue) {
+            let str = `${urlValue}`;
+            console.log("str");
+            console.log(str);
+            this.recordId = str;
+          }
+        }
+    }
+    connectedCallback(){
+        init({
+            recordId: this.recordId
+        }).then(result=>{
+            this.stageName = result.stageName;
+            this.sapSendOK = result.sapSendOK;
+            this.cntLostCancelReport = result.cntLostCancelReport;
+            this.name = result.name;
+            this.salesAssistantID = result.salesAssistantID;
+            this.salesAssistantName = result.salesAssistantName;
+            this.managerName = result.managerName;
+            this.salesManagerDepartmentID = result.salesManagerDepartmentID;
+            this.salesOwnerBuchang = result.salesOwnerBuchang;
+            this.salesOwnerBuchangID = result.salesOwnerBuchangID;
+            this.loseReport();
+        })
+    }
+    loseReport(){
+        // js銇牬鍚堛�佺炕瑷炽仌銈屻仧鍊ゃ亴銇с倠銇仹銆佽娉ㄦ剰
+        if (this.stageName != '寮曞悎'
+        && this.stageName != '璇环'
+        ) {
+            this.showToast("鐘舵��1:" + this.stageName + "銆佷笉鑳藉仛 澶卞崟 浜嗭紒","error");
+        }
+        else if (this.sapSendOK == '1') {
+            this.showToast("宸茬粡涓婁紶SAP銆佷笉鑳藉仛 澶卞崟 浜嗭紒","error");
+        }
+        else if (this.cntLostCancelReport > 0) {
+            this.showToast("璇环宸茬粡鏈� 鍙栨秷锛忓け鍗曟姤鍛� 浜嗭紒","error");
+        }
+        //else if({!Not(ISBLANK(Opportunity.Bidding_Project_Name_Bid__c))} && //'{!Opportunity.InfoTypeBid__c}' != '3锛氱粨鏋�' ){
+        //alert("鍏宠仈鎷涙姇鏍囬」鐩殑璇环锛屽彧鑳藉湪鏈夌粨鏋滃悗鍋氬け鍗曟姤鍛婏紒");
+        //}
+        else {
+            location.href = '/a1U/e?retURL=%2F' + this.recordId +
+            '&RecordType=01210000000R4hM' +
+            '&CF00N10000004lbGT=' + this.name +
+            '&CF00N10000004lbGT_lkid=' + this.recordId +
+            '&CF00N10000006QShg=' + this.salesAssistantName +
+            '&CF00N10000006QShg_lkid=' + this.salesAssistantID +
+            '&CF00N10000006QShq=' + this.managerName +
+            '&CF00N10000006QShq_lkid=' + this.salesManagerDepartmentID +
+            '&CF00N10000006QShb=' + this.salesOwnerBuchang +
+            '&CF00N10000006QShb_lkid=' + this.salesOwnerBuchangID +
+            '';
+        }
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            title: '',
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+    }
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLoseReport/lexLoseReport.js-meta.xml b/force-app/main/default/lwc/lexLoseReport/lexLoseReport.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexLoseReport/lexLoseReport.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>54.0</apiVersion>
+	<isExposed>true</isExposed>
+	<targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.css b/force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.css
new file mode 100644
index 0000000..af18c76
--- /dev/null
+++ b/force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.css
@@ -0,0 +1,11 @@
+.Holder{
+	position: relative;
+	display: inline-block;
+	width: 80px;
+	height: 80px;
+	text-align: center;
+}
+
+.container .uiContainerManager{
+	display : none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.html b/force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.html
new file mode 100644
index 0000000..2ef2898
--- /dev/null
+++ b/force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.html
@@ -0,0 +1,5 @@
+<template>
+	<div class="Holder" if:true={IsLoading}>
+      	<lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+  	</div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.js b/force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.js
new file mode 100644
index 0000000..5d79272
--- /dev/null
+++ b/force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.js
@@ -0,0 +1,39 @@
+import { LightningElement, track, wire, api } from 'lwc';
+import {CurrentPageReference} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+
+export default class lexLostReturnDeliverySlip extends LightningElement {
+	@api recordId;
+  
+
+    @wire(CurrentPageReference)
+	getStateParameters(currentPageReference){
+		console.log("杩涘叆椤甸潰");
+		console.log(currentPageReference);
+		if(currentPageReference){
+			const urvalue=currentPageReference.state.recordId;
+			if(urvalue){
+				let str=`${urvalue}`;
+				console.log('str');
+				console.log(str);
+				this.recordId=str;
+			}
+		}
+	}
+
+	connectedCallback(){
+
+		this.cancelSubmit().then(res=>{
+			this.IsLoading=false;
+			this.dispatchEvent(new CloseActionScreenEvent());
+		});
+	}
+
+	async cancelSubmit(){
+		window.open('/apex/Lost_Return_DeliverySlip?id='+this.recordId,'LostReturnDeliverySlip', 'width=600,height=200');
+	}
+
+	//old js
+	// window.open('/apex/Lost_Return_DeliverySlip?id={!TransferApply__c.Id}');
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.js-meta.xml b/force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.js-meta.xml
new file mode 100644
index 0000000..d8dfadb
--- /dev/null
+++ b/force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexLostReturnDeliverySlip">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__AppPage</target>
+        <target>lightning__RecordPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.css b/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.css
new file mode 100644
index 0000000..635bc6c
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.css
@@ -0,0 +1,22 @@
+.outerBorderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    border-top : 3px solid #565959;
+}
+.borderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    margin-bottom : 7px;
+    border-top : 3px solid #565959;
+}
+.headerDorderCss{
+    border-top: 1px solid #565959;
+    border-bottom: 1px solid #D4D4D4;
+    padding:3px;
+}
+.centerCss{
+    text-align: center;
+}
+.centerCss .left{
+    margin-left: 100px;
+}/* sample css file */
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.html b/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.html
new file mode 100644
index 0000000..49a10f7
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="sisToOPDHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.js b/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.js
new file mode 100644
index 0000000..f7be272
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.js
@@ -0,0 +1,101 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { NavigationMixin } from 'lightning/navigation';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { updateRecord } from 'lightning/uiRecordApi';
+import init  from '@salesforce/apex/QISReportController.initForlexRCRecievedButton';
+import updateQis  from '@salesforce/apex/QISReportController.updateQisForRCRecieved';
+
+export default class lexOCSMNogoods extends LightningElement {
+	@api recordId;
+	err;
+	IsLoading = true;
+	qisReportId;
+	qisStatus;
+	isAEProfile;
+	isCNBuy;
+	 @wire(CurrentPageReference)
+     getStateParameters(currentPageReference) {
+             console.log(111);
+             console.log(currentPageReference);
+
+         if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             console.log("str");
+             console.log(str);
+             this.recordId = str;
+           }
+         }
+     }
+
+     connectedCallback () {
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            this.IsLoading = false;
+            this.qisReportId = result.Id;
+            this.qisStatus = result.qIStatus;
+            this.isAEProfile = result.isAEProfile;
+            this.isCNBuy = result.isCNBuy;
+            console.log('this.qisStatus='+this.qisStatus);   
+         	if (this.qisStatus!='RC妫�娴嬬敵璇�') {
+                const evt = new ShowToastEvent({
+                        title : 'OCM鏈嶅姟鏈儴宸茬粡鏀跺埌瀹炵墿',
+                        message: '',
+                        variant: 'error'
+                    });
+                this.dispatchEvent(evt);
+                this.dispatchEvent(new CloseActionScreenEvent());
+                return;
+         	}else{
+         		if (this.isAEProfile == null || this.isPAEProfile == null || this.isCNBuy != 'true') {
+         			const evt = new ShowToastEvent({
+                        title : '瀹夊叏淇℃伅鏈垽瀹氾紝璇疯仈绯昏川閲忔硶瑙勯儴',
+                        message: '',
+                        variant: 'error'
+                    });
+	                this.dispatchEvent(evt);
+	                this.dispatchEvent(new CloseActionScreenEvent());
+	                return;
+         		}else{
+         			this.updateQisSubmit();
+         		}
+         	}
+        }).catch(error => {
+            console.log('error='+error);
+        }).finally(() => {
+            
+        }); 
+    }
+
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+
+    updateQisSubmit(){
+        	updateQis({
+        		 recordId: this.recordId
+        		}).then(result =>{
+                    
+        			console.log('result'+result);
+        			this.err = result;
+        			if (result!='鎴愬姛') {
+                        const evt = new ShowToastEvent({
+                            title : '鏇存柊澶辫触',
+                            message: this.err,
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                    }
+                this.dispatchEvent(new CloseActionScreenEvent());
+                this.updateRecordView(this.recordId);
+        		}).catch(error => {
+           				 console.log('error='+error);
+		        }).finally(() => {
+		            
+		        });
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.js-meta.xml b/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.js-meta.xml
new file mode 100644
index 0000000..7881cfb
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexOCSMNogoods">
+     <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.css b/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.css
new file mode 100644
index 0000000..f708a55
--- /dev/null
+++ b/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.css
@@ -0,0 +1,10 @@
+.opdToSISHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}/* sample css file */
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.html b/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.html
new file mode 100644
index 0000000..cc6a015
--- /dev/null
+++ b/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="opdToSISHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.js b/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.js
new file mode 100644
index 0000000..55e5142
--- /dev/null
+++ b/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.js
@@ -0,0 +1,100 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { NavigationMixin } from 'lightning/navigation';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import init  from '@salesforce/apex/QISReportController.initForlexOSHInspectButton';
+import updateQis  from '@salesforce/apex/QISReportController.updateQisForlexOSHInspect';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { updateRecord } from 'lightning/uiRecordApi';
+
+export default class lexOSHInspect extends LightningElement {
+	@api recordId;
+	IsLoading = true;
+	qisReportId;
+	qisStatus;
+	oSHInspectionDate;
+    err;
+    @wire(CurrentPageReference)
+     getStateParameters(currentPageReference) {
+             console.log(111);
+             console.log(currentPageReference);
+
+         if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             console.log("str");
+             console.log(str);
+             this.recordId = str;
+           }
+         }
+     }
+
+
+    connectedCallback () {
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            this.IsLoading = false;
+            this.qisReportId = result.Id;
+            this.qisStatus = result.qIStatus;
+            this.oSHInspectionDate = result.oSHInspectionDate;
+         	if (this.qisStatus!='OSH妫�娴嬩腑') {
+         		const evt = new ShowToastEvent({
+                            title : '闇�瑕佸厛鐐瑰嚮锛籓SH鐜板搧鏀跺埌锛�',
+                            message: '',
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        return;
+         	}else if(this.oSHInspectionDate != null){
+         		const evt = new ShowToastEvent({
+                            title : 'OSH妫�娴嬪凡缁忓彈鐞�',
+                            message: '',
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        return;
+         	}else{
+         		this.updateQisSubmit();
+         	}
+         	
+    
+			
+        }).catch(error => {
+            console.log('error='+error);
+        }).finally(() => {
+            
+        }); 
+    }
+
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+
+    updateQisSubmit(){
+        	updateQis({
+        		 recordId: this.recordId
+        		}).then(result =>{
+        			console.log('result'+result);
+        			if (result!='鎴愬姛') {
+                        this.err = result;
+                        const evt = new ShowToastEvent({
+                            title : '鏇存柊澶辫触',
+                            message: this.err,
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                    }
+                this.dispatchEvent(new CloseActionScreenEvent());
+                this.updateRecordView(this.recordId);
+        		}).catch(error => {
+            console.log('error='+error);
+        }).finally(() => {
+            
+        });
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.js-meta.xml b/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.js-meta.xml
new file mode 100644
index 0000000..220e747
--- /dev/null
+++ b/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexOSHInspect">
+      <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.css b/force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.css
new file mode 100644
index 0000000..9acb129
--- /dev/null
+++ b/force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.css
@@ -0,0 +1,22 @@
+.outerBorderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    border-top : 3px solid #565959;
+}
+.borderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    margin-bottom : 7px;
+    border-top : 3px solid #565959;
+}
+.headerDorderCss{
+    border-top: 1px solid #565959;
+    border-bottom: 1px solid #D4D4D4;
+    padding:3px;
+}
+.centerCss{
+    text-align: center;
+}
+.centerCss .left{
+    margin-left: 100px;
+}/* sample css file *//* sample css file */
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.html b/force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.html
new file mode 100644
index 0000000..c8bdbfc
--- /dev/null
+++ b/force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.html
@@ -0,0 +1,5 @@
+<template>
+   <div class="sisToOPDHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.js b/force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.js
new file mode 100644
index 0000000..d442403
--- /dev/null
+++ b/force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.js
@@ -0,0 +1,47 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { NavigationMixin } from 'lightning/navigation';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import init  from '@salesforce/apex/QISReportController.initForlexPDFQISrequestButton';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { updateRecord } from 'lightning/uiRecordApi';
+
+export default class lexPDFQISrequest extends LightningElement {
+	@api recordId;
+	IsLoading = true;
+	qisReportId;
+    err;
+
+    @wire(CurrentPageReference)
+     getStateParameters(currentPageReference) {
+             console.log(111);
+             console.log(currentPageReference);
+
+         if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             console.log("str");
+             console.log(str);
+             this.recordId = str;
+           }
+         }
+    }
+
+    connectedCallback () {
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            this.IsLoading = false;
+            this.qisReportId = result.Id;
+            window.open('/apex/QISPDF?id='+this.qisReportId, 'QISPDF');
+            this.dispatchEvent(new CloseActionScreenEvent());
+        }).catch(error => {
+            console.log('error='+error);
+        }).finally(() => {
+            
+        }); 
+    }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.js-meta.xml b/force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.js-meta.xml
new file mode 100644
index 0000000..0030007
--- /dev/null
+++ b/force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexPDFQISrequest">
+    <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQISSC/lexQISSC.css b/force-app/main/default/lwc/lexQISSC/lexQISSC.css
new file mode 100644
index 0000000..9acb129
--- /dev/null
+++ b/force-app/main/default/lwc/lexQISSC/lexQISSC.css
@@ -0,0 +1,22 @@
+.outerBorderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    border-top : 3px solid #565959;
+}
+.borderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    margin-bottom : 7px;
+    border-top : 3px solid #565959;
+}
+.headerDorderCss{
+    border-top: 1px solid #565959;
+    border-bottom: 1px solid #D4D4D4;
+    padding:3px;
+}
+.centerCss{
+    text-align: center;
+}
+.centerCss .left{
+    margin-left: 100px;
+}/* sample css file *//* sample css file */
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQISSC/lexQISSC.html b/force-app/main/default/lwc/lexQISSC/lexQISSC.html
new file mode 100644
index 0000000..c8bdbfc
--- /dev/null
+++ b/force-app/main/default/lwc/lexQISSC/lexQISSC.html
@@ -0,0 +1,5 @@
+<template>
+   <div class="sisToOPDHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQISSC/lexQISSC.js b/force-app/main/default/lwc/lexQISSC/lexQISSC.js
new file mode 100644
index 0000000..2917728
--- /dev/null
+++ b/force-app/main/default/lwc/lexQISSC/lexQISSC.js
@@ -0,0 +1,96 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { NavigationMixin } from 'lightning/navigation';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import init  from '@salesforce/apex/QISReportController.initForlexQISSCButton';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { updateRecord } from 'lightning/uiRecordApi';
+
+export default class lexQISSC extends LightningElement {
+	@api recordId;
+	IsLoading = true;
+	qisReportId;
+	name;
+	profileName;
+	qISSCId;
+	qISSCReport;
+	nextaction;
+	qISMarketCategory;
+    err;
+
+    @wire(CurrentPageReference)
+     getStateParameters(currentPageReference) {
+             console.log(111);
+             console.log(currentPageReference);
+
+         if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             console.log("str");
+             console.log(str);
+             this.recordId = str;
+           }
+         }
+    }
+
+    connectedCallback () {
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            this.IsLoading = false;
+            this.qisReportId = result.Id;
+            this.name = result.name;
+            this.qISSCId = result.qISSCId;
+            this.qISSCReport = result.qISSCReport;
+            this.nextaction = result.nextaction;
+            this.qISMarketCategory = result.qISMarketCategory;
+            this.profileName = result.profileName;
+            console.log('profileName='+this.profileName);
+            console.log('qISSCReport='+this.qISSCReport);
+            console.log('nextaction='+this.nextaction);
+            console.log('qISMarketCategory='+this.qISMarketCategory);
+            if (this.profileName == '2F4_鎶�鏈帹杩涢儴' || this.profileName == '2F4_鎶�鏈帹杩涢儴_OSH 闈炲崟鐐�') {
+            	const evt = new ShowToastEvent({
+                            title : '鎮ㄦ病鏈夋柊寤篞IS甯傚満閮ㄦ潈闄愩��',
+                            message: '',
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        return;
+            }
+            if (this.qISSCReport!=null) {
+            	var url = 'https://ocsm.my.salesforce.com/'+this.qISSCId;
+            	window.open(url);
+            	this.dispatchEvent(new CloseActionScreenEvent());
+                return;
+            }else{
+            	if (this.nextaction == '閫佸洖' && (this.qISMarketCategory == 'ET' || this.qISMarketCategory == 'ENG' || this.qISMarketCategory == 'EndoRapid')) {
+            		var urlStr ='/a3w/e?CF00N100000095xFJ='+this.name+
+							'&CF00N100000095xFJ_lkid='+this.qisReportId+
+							'&retURL='+this.qisReportId+
+							'&Name='+this.name;
+						window.open(urlStr);	
+						
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        return;
+            	}else{
+            		const evt = new ShowToastEvent({
+                            title : '瀵瑰簲鏂规硶涓鸿繑鍥炰笖瀵瑰簲涓绘満/娑堣�楀搧涓篍T 鎴� ENG 鎴� EndoRapid 鏃讹紝鎵嶅彲浠ユ柊寤恒��',
+                            message: '',
+                            variant: 'error'
+                        });
+                        
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        return;
+            	}
+            }
+        }).catch(error => {
+            console.log('error='+error);
+        }).finally(() => {
+            
+        }); 
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQISSC/lexQISSC.js-meta.xml b/force-app/main/default/lwc/lexQISSC/lexQISSC.js-meta.xml
new file mode 100644
index 0000000..5701aa7
--- /dev/null
+++ b/force-app/main/default/lwc/lexQISSC/lexQISSC.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexQISSC">
+    <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQuotationProductNew/__tests__/lexQuotationProductNew.test.js b/force-app/main/default/lwc/lexQuotationProductNew/__tests__/lexQuotationProductNew.test.js
new file mode 100644
index 0000000..f8c78a9
--- /dev/null
+++ b/force-app/main/default/lwc/lexQuotationProductNew/__tests__/lexQuotationProductNew.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexQuotationProductNew from 'c/lexQuotationProductNew';
+
+describe('c-lex-quotation-product-new', () => {
+    afterEach(() => {
+        // The jsdom instance is shared across test cases in a single file so reset the DOM
+        while (document.body.firstChild) {
+            document.body.removeChild(document.body.firstChild);
+        }
+    });
+
+    it('TODO: test case generated by CLI command, please fill in test logic', () => {
+        // Arrange
+        const element = createElement('c-lex-quotation-product-new', {
+            is: LexQuotationProductNew
+        });
+
+        // Act
+        document.body.appendChild(element);
+
+        // Assert
+        // const div = element.shadowRoot.querySelector('div');
+        expect(1).toBe(1);
+    });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.html b/force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.html
new file mode 100644
index 0000000..1ac43b5
--- /dev/null
+++ b/force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.html
@@ -0,0 +1,6 @@
+<template>
+    <div class="lexQuotationRequestHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.js b/force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.js
new file mode 100644
index 0000000..6720168
--- /dev/null
+++ b/force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.js
@@ -0,0 +1,67 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-14 17:15:33
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-14 17:20:45
+ */
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init  from '@salesforce/apex/OpportunityLightingButtonController.initForQuotationProductNewButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+export default class LexQuotationProductNew extends LightningElement {
+    @api recordId;
+    currencyIsoCode;
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+            console.log(111);
+            console.log(currentPageReference);
+
+        if (currentPageReference) {
+          const urlValue = currentPageReference.state.recordId;
+          if (urlValue) {
+            let str = `${urlValue}`;
+            console.log("str");
+            console.log(str);
+            this.recordId = str;
+          }
+        }
+    }
+    connectedCallback(){
+        init({
+            recordId:this.recordId
+        }).then(result=>{
+            this.currencyIsoCode = result.currencyIsoCode;
+            this.quotationProductNew();
+        }).catch(error=>{
+            console.log(error);
+        });
+    }
+    quotationProductNew(){
+        var Currency = this.currencyIsoCode;
+        var OppID = this.recordId;
+        if (Currency == 'CNY'){
+        var url = '/00O10000002jviu?pv0=' + OppID;
+        }
+        else if (Currency == 'USD'){
+        var url = '/00O10000005Ju6L?pv0=' + OppID;
+        }
+        window.open(url);
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            title: '',
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+      }
+      updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+      }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.js-meta.xml b/force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>54.0</apiVersion>
+	<isExposed>true</isExposed>
+	<targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQuotationRequest/__tests__/lexQuotationRequest.test.js b/force-app/main/default/lwc/lexQuotationRequest/__tests__/lexQuotationRequest.test.js
new file mode 100644
index 0000000..2e33a91
--- /dev/null
+++ b/force-app/main/default/lwc/lexQuotationRequest/__tests__/lexQuotationRequest.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexQuotationRequest from 'c/lexQuotationRequest';
+
+describe('c-lex-quotation-request', () => {
+    afterEach(() => {
+        // The jsdom instance is shared across test cases in a single file so reset the DOM
+        while (document.body.firstChild) {
+            document.body.removeChild(document.body.firstChild);
+        }
+    });
+
+    it('TODO: test case generated by CLI command, please fill in test logic', () => {
+        // Arrange
+        const element = createElement('c-lex-quotation-request', {
+            is: LexQuotationRequest
+        });
+
+        // Act
+        document.body.appendChild(element);
+
+        // Assert
+        // const div = element.shadowRoot.querySelector('div');
+        expect(1).toBe(1);
+    });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.css b/force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.css
new file mode 100644
index 0000000..e2d6ce2
--- /dev/null
+++ b/force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.css
@@ -0,0 +1,10 @@
+.lexQuotationRequestHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.html b/force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.html
new file mode 100644
index 0000000..dff927d
--- /dev/null
+++ b/force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.html
@@ -0,0 +1,14 @@
+<!--
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-14 11:09:28
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-14 11:10:38
+-->
+<template>
+    <div class="lexQuotationRequestHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.js b/force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.js
new file mode 100644
index 0000000..d968b59
--- /dev/null
+++ b/force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.js
@@ -0,0 +1,73 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-14 11:09:28
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-14 11:21:24
+ */
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import queryForQuotationRequestButton  from '@salesforce/apex/OpportunityLightingButtonController.queryForQuotationRequestButton';
+import init  from '@salesforce/apex/OpportunityLightingButtonController.initForQuotationRequestButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+export default class LexQuotationRequest extends LightningElement {
+    @api recordId;
+    biddingProjectNameBidId;
+    estimationId;
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+            console.log(111);
+            console.log(currentPageReference);
+
+        if (currentPageReference) {
+          const urlValue = currentPageReference.state.recordId;
+          if (urlValue) {
+            let str = `${urlValue}`;
+            console.log("str");
+            console.log(str);
+            this.recordId = str;
+          }
+        }
+    }
+    connectedCallback(){
+        init({
+            recordId: this.recordId
+        }).then(result=>{
+            this.biddingProjectNameBidId = result.biddingProjectNameBidId;
+            this.estimationId = result.estimationId;
+            this.quotationRequest();
+        })
+    }
+    quotationRequest(){
+        queryForQuotationRequestButton({
+            recordId: this.recordId
+        }).then(result=>{
+            var records = result;
+            var size =records.length;
+            if(size > 1){
+                this.showToast("鏈�2涓垨鑰�2涓互涓婄殑鑽夋涓姤浠峰鎵橈紝璇风‘璁ゃ��","error");
+            }else if(size == 1){
+                var raes = records[0].Id;
+                location.href = "/apex/NewQuoteIrai?id="+ raes+"&tenderid=" + this.biddingProjectNameBidId;
+            }else{
+                location.href = "/apex/NewQuoteIrai?oppid=" + this.recordId + "&oppquoid=" + this.estimationId + "&tenderid=" + this.biddingProjectNameBidId;
+            }
+            this.dispatchEvent(new CloseActionScreenEvent()); 
+        })
+    }
+    showToast(msg,type) {
+      const event = new ShowToastEvent({
+          title: '',
+          message: msg,
+          variant: type
+      });
+      this.dispatchEvent(event);
+    }
+    updateRecordView(recordId) {
+      updateRecord({fields: { Id: recordId }});
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.js-meta.xml b/force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>54.0</apiVersion>
+	<isExposed>true</isExposed>
+	<targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.css b/force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.css
new file mode 100644
index 0000000..635bc6c
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.css
@@ -0,0 +1,22 @@
+.outerBorderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    border-top : 3px solid #565959;
+}
+.borderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    margin-bottom : 7px;
+    border-top : 3px solid #565959;
+}
+.headerDorderCss{
+    border-top: 1px solid #565959;
+    border-bottom: 1px solid #D4D4D4;
+    padding:3px;
+}
+.centerCss{
+    text-align: center;
+}
+.centerCss .left{
+    margin-left: 100px;
+}/* sample css file */
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.html b/force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.html
new file mode 100644
index 0000000..49a10f7
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="sisToOPDHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.js b/force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.js
new file mode 100644
index 0000000..73d0840
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.js
@@ -0,0 +1,98 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { NavigationMixin } from 'lightning/navigation';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { updateRecord } from 'lightning/uiRecordApi';
+import init  from '@salesforce/apex/QISReportController.initForlexRCinspectioncompletedateButton';
+import updateQis  from '@salesforce/apex/QISReportController.updateQisForRCinspectioncompletedate';
+
+export default class lexRCinspectioncompletedate extends LightningElement {
+	@api recordId;
+	err;
+	IsLoading = true;
+	qisReportId;
+	qisStatus;
+	rCinspectionDate;
+
+	 @wire(CurrentPageReference)
+     getStateParameters(currentPageReference) {
+             console.log(111);
+             console.log(currentPageReference);
+
+         if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             console.log("str");
+             console.log(str);
+             this.recordId = str;
+           }
+         }
+     }
+
+     connectedCallback () {
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            this.IsLoading = false;
+            this.qisReportId = result.Id;
+            this.qisStatus = result.qIStatus;
+            this.rCinspectionDate = result.rCinspectionDate;
+
+         	if (this.qisStatus =='RC妫�娴嬬敵璇�') {
+                const evt = new ShowToastEvent({
+                        title : '闇�瑕佸厛鐐瑰嚮锛籓CM鏈嶅姟鏈儴鏀跺埌瀹炵墿锛�',
+                        message: '',
+                        variant: 'error'
+                    });
+                this.dispatchEvent(evt);
+                this.dispatchEvent(new CloseActionScreenEvent());
+                return;
+         	}else if(this.rCinspectionDate != null){
+         			const evt = new ShowToastEvent({
+                        title : 'OCM鏈嶅姟鏈儴妫�娴嬪凡缁忓畬姣�',
+                        message: '',
+                        variant: 'error'
+                    });
+	                this.dispatchEvent(evt);
+	                this.dispatchEvent(new CloseActionScreenEvent());
+	                return;
+         	}else{
+         		this.updateQisSubmit();
+         	}
+        }).catch(error => {
+            console.log('error='+error);
+        }).finally(() => {
+            
+        }); 
+    }
+
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+
+    updateQisSubmit(){
+        	updateQis({
+        		 recordId: this.recordId
+        		}).then(result =>{
+                    
+        			console.log('result'+result);
+        			this.err = result;
+        			if (result!='鎴愬姛') {
+                        const evt = new ShowToastEvent({
+                            title : '鏇存柊澶辫触',
+                            message: this.err,
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                    }
+                this.dispatchEvent(new CloseActionScreenEvent());
+                this.updateRecordView(this.recordId);
+        		}).catch(error => {
+           				 console.log('error='+error);
+		        }).finally(() => {
+		            
+		        });
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.js-meta.xml b/force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.js-meta.xml
new file mode 100644
index 0000000..1546b5e
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexRCinspectioncompletedate">
+    <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.css b/force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.css
new file mode 100644
index 0000000..af18c76
--- /dev/null
+++ b/force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.css
@@ -0,0 +1,11 @@
+.Holder{
+	position: relative;
+	display: inline-block;
+	width: 80px;
+	height: 80px;
+	text-align: center;
+}
+
+.container .uiContainerManager{
+	display : none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.html b/force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.html
new file mode 100644
index 0000000..f60755f
--- /dev/null
+++ b/force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="Holder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+      </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.js b/force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.js
new file mode 100644
index 0000000..7cd6690
--- /dev/null
+++ b/force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.js
@@ -0,0 +1,91 @@
+import { LightningElement, track, wire, api } from 'lwc';
+import {CurrentPageReference,NavigationMixin} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+
+import eSetRefreshStatus from '@salesforce/apex/RentalApplyESetRefreshStatusController.eSetRefreshStatus';
+export default class lexRentalApplyESetRefreshStatus extends LightningElement {
+	@api raeSetId;
+	IsLoading=true;
+	refreshResult;
+	
+
+	@wire(CurrentPageReference)
+	getStateParameters(currentPageReference) {
+		console.log(currentPageReference);
+
+		if(currentPageReference) {
+			const urlValue = currentPageReference.state.recordId;
+			if(urlValue) {
+				let str = `${urlValue}`;
+		        console.log("str");
+		        console.log(str);
+		        this.recordId = str;
+
+			}
+		}
+	}
+
+	connectedCallback() {
+		console.log('this.raeSetId:' + this.recordId);
+		eSetRefreshStatus({
+			raeSetId : this.recordId
+		}).then(result => {
+			this.refreshResult = result;
+			
+			
+			this.cancelSubmit().then(res=>{
+				this.IsLoading=false;
+				this.dispatchEvent(new CloseActionScreenEvent());
+			});	
+					
+		}).catch( error =>{
+			console.log(error);
+		}).finally(()=>{
+
+			
+		});
+	}
+
+	async cancelSubmit(){
+		if(this.refreshResult == '1') {
+			this.showToast('','鐘舵�佹洿鏂板畬姣�','success');
+			// alert("鐘舵�佹洿鏂板畬姣�!");
+			location.href = "/"+this.recordId; 
+					
+		} else {
+			console.log("result:",this.refreshResult);
+			this.showToast('','鏇存柊澶辫触锛岃鑱旂郴绠$悊鍛橈紒','warning');
+			// alert("鏇存柊澶辫触锛岃鑱旂郴绠$悊鍛橈紒");
+			
+		}
+			
+    }
+    showToast(_title,_message,_variant) {
+        const event = new ShowToastEvent({
+            title: _title,
+            message:_message,
+            variant: _variant,
+        });
+        this.dispatchEvent(event);
+    }
+
+}
+
+// old js浠g爜锛�
+// {!RequireScript("/soap/ajax/51.0/connection.js")}
+// {!RequireScript("/soap/ajax/51.0/apex.js")}
+
+// var raeSet = '{!Rental_Apply_Equipment_Set__c.Id}';
+// try {
+//     var rtn = sforce.apex.execute("RentalApplyWebService", "eSetRefreshStatus", {raeSetId: raeSet});
+//     if (rtn = '1') {
+//         alert("鐘舵�佹洿鏂板畬姣�!");
+//         location.href = "/{!Rental_Apply_Equipment_Set__c.Id}"; 
+//     } else {
+//         alert(rtn);
+//     }
+// } catch(e) {
+//     alert(e);
+// }
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.js-meta.xml b/force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.js-meta.xml
new file mode 100644
index 0000000..d6ac86f
--- /dev/null
+++ b/force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexRentalApplyESetRefreshStatus">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__AppPage</target>
+        <target>lightning__RecordPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexStockApply/__tests__/lexStockApply.test.js b/force-app/main/default/lwc/lexStockApply/__tests__/lexStockApply.test.js
new file mode 100644
index 0000000..b8885a7
--- /dev/null
+++ b/force-app/main/default/lwc/lexStockApply/__tests__/lexStockApply.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexStockApply from 'c/lexStockApply';
+
+describe('c-lex-stock-apply', () => {
+    afterEach(() => {
+        // The jsdom instance is shared across test cases in a single file so reset the DOM
+        while (document.body.firstChild) {
+            document.body.removeChild(document.body.firstChild);
+        }
+    });
+
+    it('TODO: test case generated by CLI command, please fill in test logic', () => {
+        // Arrange
+        const element = createElement('c-lex-stock-apply', {
+            is: LexStockApply
+        });
+
+        // Act
+        document.body.appendChild(element);
+
+        // Assert
+        // const div = element.shadowRoot.querySelector('div');
+        expect(1).toBe(1);
+    });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexStockApply/lexStockApply.css b/force-app/main/default/lwc/lexStockApply/lexStockApply.css
new file mode 100644
index 0000000..39dab40
--- /dev/null
+++ b/force-app/main/default/lwc/lexStockApply/lexStockApply.css
@@ -0,0 +1,10 @@
+.lexStockApplyHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexStockApply/lexStockApply.html b/force-app/main/default/lwc/lexStockApply/lexStockApply.html
new file mode 100644
index 0000000..5674b24
--- /dev/null
+++ b/force-app/main/default/lwc/lexStockApply/lexStockApply.html
@@ -0,0 +1,6 @@
+<template>
+    <div class="lexStockApplyHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexStockApply/lexStockApply.js b/force-app/main/default/lwc/lexStockApply/lexStockApply.js
new file mode 100644
index 0000000..e82a54a
--- /dev/null
+++ b/force-app/main/default/lwc/lexStockApply/lexStockApply.js
@@ -0,0 +1,114 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-14 13:04:53
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-14 17:54:56
+ */
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import updateForStockApplyButton  from '@salesforce/apex/OpportunityLightingButtonController.updateForStockApplyButton';
+import init  from '@salesforce/apex/OpportunityLightingButtonController.initForStockApplyButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { loadScript } from "lightning/platformResourceLoader";
+import connection from '@salesforce/resourceUrl/connection20';
+export default class LexStockApply extends LightningElement {
+    @api recordId;
+    stockApplyStatus;
+    lastOpportunityFileId;
+    IsLoading = true;  
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+            console.log(111);
+            console.log(currentPageReference);
+
+        if (currentPageReference) {
+          const urlValue = currentPageReference.state.recordId;
+          if (urlValue) {
+            let str = `${urlValue}`;
+            console.log("str");
+            console.log(str);
+            this.recordId = str;
+          }
+        }
+    }
+    connectedCallback(){
+        init({
+            recordId: this.recordId
+        }).then(result=>{
+            console.log(result);
+            this.stockApplyStatus = result.stockApplyStatus;
+            this.lastOpportunityFileId = result.lastOpportunityFileId;
+            this.stockApply();
+        })
+    }
+    stockApply(){
+        var status = this.stockApplyStatus;
+        if (status != '鑽夋涓�' && status != '濉啓瀹屾瘯' && status != '涓嶆壒鍑�' && status != '' && status != undefined) {
+            this.showToast("澶囪揣鐢宠鐘舵�佷笉姝g‘锛屼笉鑳芥彁浜ゅ璐х敵璇枫��","error");
+            return;
+        }
+        var oppfile = this.lastOpportunityFileId;
+        if (oppfile == undefined || oppfile == '') {
+            this.showToast("璇蜂笂浼犺浠锋枃浠躲��","error");
+            return;
+        }
+
+        if (!confirm("涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵")) {
+            this.dispatchEvent(new CloseActionScreenEvent);
+            return;
+        }
+        
+        updateForStockApplyButton({
+            recordId: this.recordId,
+            flag: true
+        }).then(result=>{
+            if(result){
+                this.showToast(result,"error");
+                return;
+            }
+            Promise.all([
+               loadScript(this,connection)
+            ]).then(() =>{
+                var request = new window.sforce.ProcessSubmitRequest();
+                request.objectId = this.recordId;
+                console.log("s");
+                console.log(request);
+                console.log("e");
+                var processResults = window.sforce.Connection.prototype.process([request]);
+                console.log(processResults);
+                if (processResults[0].errors != null) {
+                    updateForStockApplyButton({
+                        recordId: this.recordId,
+                        flag: false
+                    }).then(result=>{
+                        if(result){
+                            this.showToast(result,"error");
+                            return;
+                        }
+                        this.IsLoading = false;
+                        this.updateRecordView(this.recordId);
+                        this.dispatchEvent(new CloseActionScreenEvent);
+                    })
+                }
+            }); 
+        }).catch(error=>{
+            console.log(error);
+        })
+    }
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            title: '',
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+        this.dispatchEvent(new CloseActionScreenEvent);
+      }
+      updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+      }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexStockApply/lexStockApply.js-meta.xml b/force-app/main/default/lwc/lexStockApply/lexStockApply.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexStockApply/lexStockApply.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>54.0</apiVersion>
+	<isExposed>true</isExposed>
+	<targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.css b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.css
new file mode 100644
index 0000000..af18c76
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.css
@@ -0,0 +1,11 @@
+.Holder{
+	position: relative;
+	display: inline-block;
+	width: 80px;
+	height: 80px;
+	text-align: center;
+}
+
+.container .uiContainerManager{
+	display : none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.html b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.html
new file mode 100644
index 0000000..404c915
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.html
@@ -0,0 +1,5 @@
+<template>
+	<!-- <div class="Holder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+	</div> -->
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js
new file mode 100644
index 0000000..2a9ab34
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js
@@ -0,0 +1,101 @@
+import { LightningElement, track, wire,api } from 'lwc';
+import {CurrentPageReference,NavigationMixin} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import LightningConfirm from 'lightning/confirm';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+
+
+import applyPermission from '@salesforce/apex/TransferApplyController.applyPermission';
+import submitApply from '@salesforce/apex/TransferApplyWebService.submitApply';
+
+export default class lexSubmitApprovalProcess extends LightningElement {
+	@api recordId;
+	transferApplyPermission;
+	IsLoading=true;
+
+	@wire(CurrentPageReference)
+	getStateParameters(currentPageReference) {
+		console.log(currentPageReference);
+
+		if(currentPageReference) {
+			const urlValue = currentPageReference.state.recordId;
+			if(urlValue) {
+				let str = `${urlValue}`;
+		        console.log("str");
+		        console.log(str);
+		        this.recordId = str;
+
+			}
+		}
+	}
+
+	connectedCallback() {
+		console.log('this.transferApplyId:' + this.recordId);
+		applyPermission().then(result => {
+			console.log(result);
+			this.transferApplyPermission = result;			
+			this.cancelSubmit();	
+					
+		}).catch( error =>{
+			console.log(error);
+		});
+	}
+	
+	cancelSubmit(){
+		if (this.transferApplyPermission == false) {
+			this.showToast('','娌℃湁鎻愪氦鐢宠鐨勬潈闄�','warning');
+		} else{
+			LightningConfirm.open({
+	            message: '涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵',
+	            variant: 'headerless',
+	          
+	        }).then(cancel=>{
+	        	if(cancel) {
+	    			submitApply({taId:this.recordId}).then(submitRes=>{
+						if(submitRes == '1'){
+							this.showToast('','鎻愪氦鎴愬姛','success');
+							window.location.href = window.location;
+						}else{
+							this.showToast("",submitRes,"warning");
+						}
+						this.IsLoading=false;
+						this.dispatchEvent(new CloseActionScreenEvent());
+					});	
+	        	}
+	        });
+			
+		}		
+    }
+    
+    showToast(_title,_message,_variant) {
+        const event = new ShowToastEvent({
+            title: _title,
+            message:_message,
+            variant: _variant,
+        });
+        this.dispatchEvent(event);
+    }
+}
+
+//old js
+/*
+{!REQUIRESCRIPT('/soap/ajax/51.0/connection.js')}
+{!REQUIRESCRIPT('/soap/ajax/51.0/apex.js')}
+var result = sforce.connection.describeSObject('TransferApply__c');
+if (result.createable == 'false') {
+	alert('娌℃湁鎻愪氦鐢宠鐨勬潈闄�');
+}
+else{
+	if (confirm("涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵")) {
+		var rs = sforce.apex.execute("TransferApplyWebService","submitApply",{taId:'{!TransferApply__c.Id}'});
+		if(rs == '1'){
+			alert('鎻愪氦鎴愬姛');
+			window.location.href = window.location;
+		}
+		else{
+			alert(rs);
+		}
+	}
+}
+*/
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js-meta.xml b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js-meta.xml
new file mode 100644
index 0000000..4fe44a7
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexSubmitApprovalProcess">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.css b/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.css
new file mode 100644
index 0000000..af18c76
--- /dev/null
+++ b/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.css
@@ -0,0 +1,11 @@
+.Holder{
+	position: relative;
+	display: inline-block;
+	width: 80px;
+	height: 80px;
+	text-align: center;
+}
+
+.container .uiContainerManager{
+	display : none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.html b/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.html
new file mode 100644
index 0000000..2688153
--- /dev/null
+++ b/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.html
@@ -0,0 +1,5 @@
+<template>
+	<div class="Holder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+	</div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js b/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js
new file mode 100644
index 0000000..c41b11e
--- /dev/null
+++ b/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js
@@ -0,0 +1,92 @@
+import { LightningElement, track, wire,api } from 'lwc';
+import {CurrentPageReference,NavigationMixin} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+
+
+import transferApplyPDF from '@salesforce/apex/TransferApplyController.transferApplyPDF';
+export default class lexTransferApplyPDF extends LightningElement {
+	@api recordId;
+	transferApplyPDFRes;
+	IsLoading=true;
+
+	@wire(CurrentPageReference)
+	getStateParameters(currentPageReference) {
+		console.log(currentPageReference);
+
+		if(currentPageReference) {
+			const urlValue = currentPageReference.state.recordId;
+			if(urlValue) {
+				let str = `${urlValue}`;
+		        console.log("str");
+		        console.log(str);
+		        this.recordId = str;
+
+			}
+		}
+	}
+
+	connectedCallback() {
+		console.log('this.transferApplyId:' + this.recordId);
+		transferApplyPDF({
+			transferApplyId : this.recordId
+		}).then(result => {
+			console.log(result);
+			this.transferApplyPDFRes = result;			
+			this.cancelSubmit().then(res=>{
+				this.IsLoading=false;
+				this.dispatchEvent(new CloseActionScreenEvent());
+			});	
+					
+		}).catch( error =>{
+			console.log(error);
+		});
+	}
+	async cancelSubmit(){
+		let records = new Array();
+		records = this.transferApplyPDFRes;
+		var size =records.length;
+		if(size>0){
+			var length = size%10 ==0? size/10 : parseInt(size/10) +1;
+			for(var i =0;i<length;i++){
+				window.open('/apex/TransferApplyPDF?raid='+this.recordId+'&page=' + i);
+			}
+		}else{
+			this.showToast('','褰撳墠鐨勭敵璇峰崟涓病鏈夊凡鎵瑰噯澶囧搧銆�','warning');
+		}			
+    }
+
+    showToast(_title,_message,_variant) {
+        const event = new ShowToastEvent({
+            title: _title,
+            message:_message,
+            variant: _variant,
+        });
+        this.dispatchEvent(event);
+    }
+
+}
+
+//old js'
+/*
+{!RequireScript("/soap/ajax/51.0/connection.js")}
+{!RequireScript("/soap/ajax/51.0/apex.js")}
+var foo = function() {
+
+	var sql = "select Id from TransferApplySummary__c where TransferApply__c = '{!TransferApply__c.Id}' and ApprovalDetails__c > 0 and TAS_Status__c != '鍙栨秷'";
+	//Yi_StockDown__c->ApprovalDetails__c 20210805 ljh SFDC-C56D3K 宸蹭笅鏋�->宸叉壒鍑�
+	var sqlResult = sforce.connection.query(sql);
+	var records = sqlResult.getArray("records");
+	var size =records.length;
+	if(size>0){
+		var length = size%10 ==0? size/10 : parseInt(size/10) +1;
+		for(var i =0;i<length;i++){
+		window.open('/apex/TransferApplyPDF?raid={!TransferApply__c.Id}&page=' + i);
+		}
+	}else{
+		alert('褰撳墠鐨勭敵璇峰崟涓病鏈夊凡鎵瑰噯澶囧搧銆�');
+	}
+}
+foo();
+*/
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js-meta.xml b/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js-meta.xml
new file mode 100644
index 0000000..0a37c91
--- /dev/null
+++ b/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexTransferApplyPDF">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.css b/force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.css
new file mode 100644
index 0000000..9acb129
--- /dev/null
+++ b/force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.css
@@ -0,0 +1,22 @@
+.outerBorderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    border-top : 3px solid #565959;
+}
+.borderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    margin-bottom : 7px;
+    border-top : 3px solid #565959;
+}
+.headerDorderCss{
+    border-top: 1px solid #565959;
+    border-bottom: 1px solid #D4D4D4;
+    padding:3px;
+}
+.centerCss{
+    text-align: center;
+}
+.centerCss .left{
+    margin-left: 100px;
+}/* sample css file *//* sample css file */
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.html b/force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.html
new file mode 100644
index 0000000..c8bdbfc
--- /dev/null
+++ b/force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.html
@@ -0,0 +1,5 @@
+<template>
+   <div class="sisToOPDHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.js b/force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.js
new file mode 100644
index 0000000..ee1cc09
--- /dev/null
+++ b/force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.js
@@ -0,0 +1,61 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { NavigationMixin } from 'lightning/navigation';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { updateRecord } from 'lightning/uiRecordApi';
+import init  from '@salesforce/apex/QISReportController.initForlexcopyQISButton';
+
+
+export default class lexcopyQIS extends LightningElement {
+	@api recordId;
+	err;
+	IsLoading = true;
+	qisReportId;
+	qisStatus;
+	name;
+	
+	 @wire(CurrentPageReference)
+     getStateParameters(currentPageReference) {
+             console.log(111);
+             console.log(currentPageReference);
+
+         if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             console.log("str");
+             console.log(str);
+             this.recordId = str;
+           }
+         }
+     }
+
+     connectedCallback () {
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            this.IsLoading = false;
+            this.qisReportId = result.Id;
+            this.qisStatus = result.qIStatus;
+            this.name = result.name;
+            if (this.qisStatus != '鍙栨秷') {
+            	const evt = new ShowToastEvent({
+                        title : '鐘舵�佷负鍙栨秷鐨凲IS鎵嶅彲浠ヨ澶嶅埗骞舵柊寤�',
+                        message: '',
+                        variant: 'error'
+                    });
+	                this.dispatchEvent(evt);
+	                this.dispatchEvent(new CloseActionScreenEvent());
+	                return;
+            }
+           	var url = "/"+this.qisReportId+"/e?newclone=1&retURL=%2F"+this.qisReportId+" &CF00N100000073PA0="+this.name+"&CF00N100000073PA0_lkid="+this.qisReportId;
+           	window.open(url);
+           	this.dispatchEvent(new CloseActionScreenEvent());
+        }).catch(error => {
+            console.log('error='+error);
+        }).finally(() => {
+            
+        }); 
+    }
+}	
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.js-meta.xml b/force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.js-meta.xml
new file mode 100644
index 0000000..c629aee
--- /dev/null
+++ b/force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexcopyQIS">
+   <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/staticresources/connection20.js b/force-app/main/default/staticresources/connection20.js
new file mode 100644
index 0000000..c0616f1
--- /dev/null
+++ b/force-app/main/default/staticresources/connection20.js
@@ -0,0 +1,1935 @@
+锘�/*
+Salesforce.com AJAX Connector 51.0
+Copyright, 1999, salesforce.com, inc.
+All Rights Reserved
+*/
+/** check if sforce is already created by some other lib*/
+window.sforce = window.sforce || {};
+
+sforce.internal = {};
+/** StringBuffer */
+
+sforce.StringBuffer = function() {
+    this.buffer = [];
+
+    this.append = function (s) {
+        this.buffer.push(s);
+        return this;
+    };
+
+    this.toString = function() {
+        return this.buffer.join("");
+    };
+};
+
+/** Base64Binary */
+sforce.Base64Binary = function(text) {
+    this.input = text;
+};
+
+sforce.Base64Binary.prototype.keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
+
+sforce.Base64Binary.prototype.toString = function() {
+    var output = [];
+    var chr1, chr2, chr3 = "";
+    var enc1, enc2, enc3, enc4 = "";
+    var i = 0;
+    do {
+        chr1 = this.input.charCodeAt(i++);
+        chr2 = this.input.charCodeAt(i++);
+        chr3 = this.input.charCodeAt(i++);
+        enc1 = chr1 >> 2;
+        enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
+        enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
+        enc4 = chr3 & 63;
+        if (isNaN(chr2)) {
+            enc3 = enc4 = 64;
+        } else if (isNaN(chr3)) {
+            enc4 = 64;
+        }
+        output.push(this.keyStr.charAt(enc1) + this.keyStr.charAt(enc2) + this.keyStr.charAt(enc3) + this.keyStr.charAt(enc4));
+        chr1 = chr2 = chr3 = "";
+        enc1 = enc2 = enc3 = enc4 = "";
+    } while (i < this.input.length);
+    return output.join("");
+};
+
+sforce.Base64Binary.prototype.decode = function(input) {
+    var output = [];
+    var chr1, chr2, chr3 = "";
+    var enc1, enc2, enc3, enc4 = "";
+    var i = 0;
+    var base64test = /[^A-Za-z0-9\+\/\=]/g;
+    if (base64test.exec(input)) {
+        alert("There were invalid base64 characters in the input text.\n" +
+              "Valid base64 characters are A-Z, a-z, 0-9, '+', '/', and '='\n" + "Expect errors in decoding.");
+    }
+    input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
+    do {
+        enc1 = this.keyStr.indexOf(input.charAt(i++));
+        enc2 = this.keyStr.indexOf(input.charAt(i++));
+        enc3 = this.keyStr.indexOf(input.charAt(i++));
+        enc4 = this.keyStr.indexOf(input.charAt(i++));
+        chr1 = (enc1 << 2) | (enc2 >> 4);
+        chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
+        chr3 = ((enc3 & 3) << 6) | enc4;
+        output.push(String.fromCharCode(chr1));
+        if (enc3 != 64) {
+            output.push(String.fromCharCode(chr2));
+        }
+        if (enc4 != 64) {
+            output.push(String.fromCharCode(chr3));
+        }
+        chr1 = chr2 = chr3 = "";
+        enc1 = enc2 = enc3 = enc4 = "";
+    } while (i < input.length);
+    return output.join("");
+};
+
+/**DateCodec.js*/
+
+sforce.internal.dateToString = function(theDate) {
+    var today = theDate;
+    var year = today.getFullYear();
+    var month = today.getMonth() + 1;
+    var day = today.getDate();
+    return  year + "-" + month + "-" + day;
+};
+
+sforce.internal.dateTimeToString = function(theDate) {
+    var today = theDate;
+    var year = today.getFullYear();
+    var month = today.getMonth() + 1;
+    var day = today.getDate();
+    var hour = today.getHours();
+    var minute = today.getMinutes();
+    var second = today.getSeconds();
+
+    var offset = today.getTimezoneOffset();
+    var pm = (offset < 0) ? "+" : "-";
+    offset = Math.abs(offset);
+    var hourdifference = offset / 60;
+    var minutedifference = offset % 60;
+
+    if (second <= 9) {
+        second = "0" + second;
+    }
+
+    var milli = today.getMilliseconds();
+    if (milli !== 0) {
+        milli = "." + milli;
+        if (milli.length > 4) {
+            milli = milli.substring(0, 4);
+        }
+        second = second + milli;
+    }
+
+    var timezone;
+
+    if (offset === 0) {
+        timezone = "Z";
+    } else {
+        if (minutedifference < 10) {
+            minutedifference = "0" + minutedifference;
+        }
+        if (hourdifference < 10) {
+            hourdifference = "0" + hourdifference;
+        }
+        timezone = pm + hourdifference + ":" + minutedifference;
+    }
+
+    if (month <= 9) {
+        month = "0" + month;
+    }
+    if (day <= 9) {
+        day = "0" + day;
+    }
+    if (hour <= 9) {
+        hour = "0" + hour;
+    }
+    if (minute <= 9) {
+        minute = "0" + minute;
+    }
+
+    return  year + "-" + month + "-" + day + "T" + hour + ":" + minute + ":" + second + timezone;
+};
+
+
+sforce.internal.stringToDate = function(source) {
+    var bc = false;
+    if (source === null || source.length === 0) {
+        throw "Unable to parse dateTime";
+    }
+
+    if (source.charAt(0) == '+') {
+        source = source.substring(1);
+    }
+
+    if (source.charAt(0) == '-') {
+        source = source.substring(1);
+        bc = true;
+    }
+
+    if (source.length != 10) {
+        throw ("Unable to parse date, " + source + " length != 10");
+    }
+
+    if (source.charAt(4) != '-' || source.charAt(7) != '-') {
+        throw ("Unable to parse date");
+    }
+
+    var year = source.substring(0, 4);
+    var month = source.substring(5, 7);
+    var day = source.substring(8, 10);
+
+    var date = new Date(year, month-1, day, 0, 0, 0);
+    date.setMilliseconds(0);
+    return date;
+};
+
+
+sforce.internal.stringToDateTime = function(source) {
+    var bc = false;
+    if (source === null || source.length === 0) {
+        throw "Unable to parse dateTime";
+    }
+
+    if (source.charAt(0) == '+') {
+        source = source.substring(1);
+    }
+    if (source.charAt(0) == '-') {
+        source = source.substring(1);
+        bc = true;
+    }
+
+    if (source.length < 19) {
+        throw ("Unable to parse dateTime");
+    }
+
+    if (source.charAt(4) != '-' || source.charAt(7) != '-' ||
+        source.charAt(10) != 'T') {
+        throw ("Unable to parse dateTime");
+    }
+
+    if (source.charAt(13) != ':' || source.charAt(16) != ':') {
+        throw ("Unable to parse dateTime");
+    }
+
+    var year = source.substring(0, 4);
+    var month = source.substring(5, 7);
+    var day = source.substring(8, 10);
+    var hour = source.substring(11, 13);
+    var min = source.substring(14, 16);
+    var sec = source.substring(17, 19);
+
+    var date = new Date(year, month-1, day, hour, min, sec);
+
+    var pos = 19;
+
+    // parse optional milliseconds
+    if (pos < source.length && source.charAt(pos) == '.') {
+        var milliseconds = 0;
+        var start = ++pos;
+        while (pos < source.length && sforce.internal.isDigit(source.charAt(pos))) {
+            pos++;
+        }
+        var decimal = source.substring(start, pos);
+        if (decimal.length == 3) {
+            milliseconds = decimal;
+        } else if (decimal.length < 3) {
+            milliseconds = (decimal + "000").substring(0, 3);
+        } else {
+            milliseconds = decimal.substring(0, 3);
+            if (decimal.charAt(3) >= '5') {
+                ++milliseconds;
+            }
+        }
+
+        date.setMilliseconds(milliseconds);
+    }
+
+    var offset = date.getTimezoneOffset() * 60000;
+    //offset in milli;
+
+    // parse optional timezone
+    if (pos + 5 < source.length &&
+        (source.charAt(pos) == '+' || (source.charAt(pos) == '-'))) {
+        if (!sforce.internal.isDigit(source.charAt(pos + 1)) ||
+            !sforce.internal.isDigit(source.charAt(pos + 2)) ||
+            source.charAt(pos + 3) != ':' ||
+            !sforce.internal.isDigit(source.charAt(pos + 4)) ||
+            !sforce.internal.isDigit(source.charAt(pos + 5))) {
+            throw "Unable to parse dateTime";
+        }
+        var hours = (source.charAt(pos + 1) - '0') * 10 + source.charAt(pos + 2) - '0';
+        var mins = (source.charAt(pos + 4) - '0') * 10 + source.charAt(pos + 5) - '0';
+        var mseconds = (hours * 60 + mins) * 60 * 1000;
+
+        // subtract milliseconds from current date to obtain GMT
+        if (source.charAt(pos) == '+') {
+            mseconds = -mseconds;
+        }
+
+        date = new Date(date.getTime() - offset + mseconds);
+        pos += 6;
+    }
+
+    if (pos < source.length && source.charAt(pos) == 'Z') {
+        pos++;
+        date = new Date(date.getTime() - offset);
+    }
+
+    if (pos < source.length) {
+        throw ("Unable to parse dateTime");
+    }
+
+    return date;
+};
+
+
+sforce.internal.isDigit = function (ch) {
+    if (ch == '0' || ch == '1' || ch == '2' || ch == '3' || ch == '4' ||
+        ch == '5' || ch == '6' || ch == '7' || ch == '8' || ch == '9') {
+        return true;
+    } else {
+        return false;
+    }
+};
+/** Xml */
+
+sforce.Xml = function(name) {
+};
+
+sforce.Xml.prototype.toXml = function (sobjectNs, name, writer) {
+    writer.writeStartElement(name, sobjectNs);
+    if (this._xsiType) {
+        writer.writeXsiType(this._xsiType);
+    }
+    for (var f in this) {
+        if ("_name" == f || "_xsiType" == f) {
+            //skip
+        } else {
+            var val = this[f];
+            if (typeof val != "function") {
+                // if (typeof val == "array") {
+                if (Array.isArray(val)) {
+                    for (var i=0; i<val.length; i++) {
+                        this.writeValue(sobjectNs, writer, f, val[i]);
+                    }
+                } else {
+                    this.writeValue(sobjectNs, writer, f, val);
+                }
+            }
+        }
+    }
+    writer.writeEndElement(name, sobjectNs);
+};
+
+
+sforce.Xml.prototype.writeValue = function (sobjectNs, writer, name, val) {
+    if (val === null) {
+        writer.writeNameValueNode("fieldsToNull", name);
+        return;
+    }
+    if (typeof(val) === "undefined") {
+        //TODO:  throw "value for field " + name + " is undefined"; Bug: 100000000000Ufg
+        return; //skip for now
+    }
+    if (val.toXml) {
+        val.toXml(sobjectNs, name, writer);
+    } else {
+        writer.writeNameValueNode(name, val);
+    }
+};
+
+sforce.Xml.prototype.get = function(name) {
+    return this[name] ? this[name] : null;
+};
+
+sforce.Xml.prototype.set = function(name, value) {
+    this[name] = value;
+};
+
+sforce.Xml.prototype.getArray = function(name) {
+    var obj = this[name];
+    if (obj) {
+        if (obj.join) {
+            return obj;
+        } else {
+            return [obj];
+        }
+    } else {
+        return [];
+    }
+};
+
+sforce.Xml.prototype.getBoolean = function(name) {
+    return ("true" == this[name]) ? true : false;
+};
+
+sforce.Xml.prototype.getDate = function(name) {
+    if (this[name]) {
+        if (this[name].getFullYear) {
+            return this[name];
+        } else {
+            return sforce.internal.stringToDate(this[name]);
+        }
+    } else {
+        return null;
+    }
+};
+
+sforce.Xml.prototype.getDateTime = function(name) {
+    if (this[name]) {
+        if (this[name].getFullYear) {
+            return this[name];
+        } else {
+            return sforce.internal.stringToDateTime(this[name]);
+        }
+    } else {
+        return null;
+    }
+};
+
+sforce.Xml.prototype.getInt = function(name) {
+    if (this[name]) {
+        if (typeof this[name] === "number") {
+            return this[name];
+        } else {
+            return parseInt(this[name], 10);
+        }
+    } else {
+        throw "Unable to parse int field: " + name;
+    }
+};
+
+sforce.Xml.prototype.getFloat = function(name) {
+    if (this[name]) {
+        if (typeof this[name] === "number") {
+            return this[name];
+        } else {
+            return parseFloat(this[name]);
+        }
+    } else {
+        throw "Unable to parse float field: " + name;
+    }
+};
+
+sforce.Xml.prototype.getBase64Binary = function(name) {
+    if (this[name]) {
+        return sforce.Base64Binary.prototype.decode(this[name]);
+    } else {
+        throw "Unable to parse base64Binary field: " + name;
+    }
+};
+
+sforce.Xml.prototype.toString = function() {
+    var sb = new sforce.StringBuffer();
+    sb.append("{");
+
+    for (var f in this) {
+        var field = this[f];
+
+        if (!field) {
+            sb.append(f).append(":").append("" + field);
+        } else  if (typeof(field) == "object") {
+            sb.append(f).append(":").append(field.toString());
+        } else if (field.join) {
+            sb.append(f).append(":").append("[");
+            for (var i = 0; i < field.length; i++) {
+                sb.append(field[i]);
+                if (i < field.length - 1) {
+                    sb.append(", ");
+                }
+            }
+            sb.append("]");
+        } else if (typeof(field) == "function") {
+            continue;
+        } else {
+            sb.append(f).append(":").append("'" + field + "'");
+        }
+        sb.append(", ");
+    }
+
+    sb.append("}");
+    return sb.toString();
+};
+
+
+/** Debug */
+
+
+sforce.internal.Debug = function() {
+    this.output = null;
+    this.trace = false;
+    this.apexTrace = false;
+    this.win = null;
+    this.traceQueue = [];
+    this.quiet = false;
+
+    this.open = function() {
+        this.println("", "print");
+    };
+
+    this.println = function(s, type) {
+        if (this.quiet) {
+            return;
+        }
+
+        if (typeof(println) === "function") {
+            println(s, type);
+            return;
+        }
+
+        if (this.win === null || !this.win.document) {
+            this.output = null;
+            this.win = window.open((typeof window.UserContext != "undefined") ? UserContext.getUrl('/soap/ajax/51.0/debugshell.html') : '/soap/ajax/51.0/debugshell.html', '',
+                    'width=800,height=400,toolbar=no,location=no,directories=no,alwaysRaised=yes,' +
+                    'status=no,menubar=no,scrollbars=yes,copyhistory=yes,resizable=yes');
+        }
+
+        if (this.output === null) {
+            this.findOutput();
+        }
+
+        if (this.output !== null) {
+            if (sforce.debug.traceQueue.length > 0) {
+                this.traceCallback();
+            }
+            this.win.println(s, type);
+       } else {
+            sforce.debug.traceQueue.push({message: s, type: type});
+            setTimeout(sforce.debug.traceCallback, 1000);
+        }
+    };
+
+    this.traceCallback = function() {
+        sforce.debug.findOutput();
+
+        if (sforce.debug.output === null) {
+            setTimeout(sforce.debug.traceCallback, 1000);
+            return;
+        }
+
+        for (var i=0; i<sforce.debug.traceQueue.length; i++) {
+            var element = sforce.debug.traceQueue[i];
+            sforce.debug.win.println(element.message, element.type);
+        }
+        sforce.debug.traceQueue = [];
+    };
+
+    this.findOutput = function() {
+        if (this.output === null) {
+            this.output = this.win.document.getElementById("output");
+        }
+        return this.output;
+    };
+
+    this.logXml = function(str) {
+        str = str.replace(/</g, "&lt;");
+        str = str.replace(/>/g, "&gt;");
+        str = "<textarea cols=80 rows=5 wrap=hard>" + str + "</textarea>";
+        this.println(str, "printxml");
+    };
+
+    this.log = function(str) {
+        this.println(str, "print");
+    };
+
+    this.logApex = function(response) {
+        var start = response.indexOf("<debugLog>");
+        var end = response.indexOf("</debugLog>");
+        if (start === -1)
+            start = 0;
+        else
+            start = start + '<debugLog>'.length;
+        if (end === -1) end = response.length;
+        var msg = response.substring(start, end);
+
+        this.println(msg, "printxml");
+    };
+};
+
+sforce.debug = new sforce.internal.Debug();
+
+/** Transport */
+
+sforce.internal._connections = [];
+
+sforce.internal.ConnectionHolder = function(connection, callback) {
+    this.connection = connection;
+    this.callback = callback;
+    this.timedout = false;
+};
+
+sforce.Transport = function(url) {
+    this.url = url;
+    this.connection = null;
+
+    this.newConnection = function() {
+        try {
+            this.connection = new ActiveXObject('Msxml2.XMLHTTP');
+        } catch(e) {
+            try {
+                this.connection = new ActiveXObject('Microsoft.XMLHTTP');
+            } catch(e) {
+                this.connection = new XMLHttpRequest();
+            }
+        }
+
+        return this.connection;
+    };
+
+    this.send = function (envelope, callback, async, timeout) {
+        this.newConnection();
+        if (async) {
+            this.connection.onreadystatechange = this.httpConnectionCallback;
+        }
+        var holder = new sforce.internal.ConnectionHolder(this.connection, callback);
+        sforce.internal._connections.push(holder);
+        this.connection.open("POST", this.url, async);
+        this.connection.setRequestHeader("Content-Type", "text/xml; charset=UTF-8");
+        this.connection.setRequestHeader("SOAPAction", "\"\"");
+        this.connection.setRequestHeader("Accept", "text/xml");
+        this.connection.setRequestHeader("X-SFDC-User-Agent", "SFAJAX 1.0");
+        this.connection.send(envelope);
+        if (async && typeof(timeout) !== "undefined") {
+            this.setTimeoutOn(holder, timeout);
+        }
+        if (!async) {
+            this.httpConnectionCallback();
+        }
+    };
+
+    this.setTimeoutOn = function (holder, timeout) {
+        function abortConnection() {
+            if (holder.connection.readyState !== 4) {
+                holder.timedout = true;
+                holder.connection.abort();
+            }
+        }
+        setTimeout(abortConnection, timeout);
+    };
+
+    this.httpConnectionCallback = function () {
+
+        for (var i = 0; i < sforce.internal._connections.length; i++) {
+            var holder = sforce.internal._connections[i];
+            if (holder !== null) {
+                if (holder.timedout) {
+                    sforce.internal._connections[i] = null;
+                    sforce.internal._connections.slice(i,1);
+                    holder.callback.httpCallback("Remote invocation timed out", false);
+                } else  if (holder.connection.readyState == 4) {
+                    sforce.internal._connections[i] = null;
+                    sforce.internal._connections.slice(i,1);
+                    var success = holder.connection.status == 200;
+                    if (sforce.debug.trace) {
+                        sforce.debug.log("Response : status - " + holder.connection.status);
+                        sforce.debug.logXml(holder.connection.responseText);
+                    }
+                    if (sforce.debug.apexTrace) {
+                        sforce.debug.logApex(holder.connection.responseText);
+                    }
+                    if (holder.connection.responseXML && holder.connection.responseXML.documentElement) {
+                        holder.callback.httpCallback(holder.connection.responseXML.documentElement, success);
+                    } else {
+                        holder.callback.httpCallback("Remote invocation failed, due to: " + holder.connection.responseText +
+                                                     " status code: ", holder.connection.status);
+                    }
+                }
+            }
+        }
+    };
+};
+/** XmlWriter */
+
+
+sforce.XmlWriter = function() {
+    this.buffer = new sforce.StringBuffer();
+    this.namespaces = {};
+    this.prefixCount = 0;
+    this.writingStartElement = false;
+};
+
+sforce.XmlWriter.prototype.writeStartElement = function(name, namesp, prefix) {
+    if (this.writingStartElement) {
+        this.buffer.append(">");
+    }
+    this.buffer.append("<");
+    var newns = false;
+    if (namesp) {
+        if (!this.namespaces[namesp] && this.namespaces[namesp] !== "") {
+            newns = true;
+        }
+        if (!prefix) {
+            prefix = this.getPrefix(namesp);
+        }
+        if (prefix !== null && prefix !== "") {
+           this.buffer.append(prefix);
+           this.buffer.append(":");
+        }
+    }
+
+    this.buffer.append(name);
+    if (newns === true) {
+        this.writeNamespace(namesp, prefix);
+    }
+    this.writingStartElement = true;
+};
+
+sforce.XmlWriter.prototype.writeEndElement = function(name, namesp) {
+    if (this.writingStartElement) {
+        this.buffer.append("/>");
+    } else {
+        this.buffer.append("</");
+        if (namesp) {
+            var prefix = this.getPrefix(namesp);
+            if (prefix && prefix !== "") {
+              this.buffer.append(prefix);
+              this.buffer.append(":");
+            }
+        }
+        this.buffer.append(name);
+        this.buffer.append(">");
+    }
+    this.writingStartElement = false;
+};
+
+sforce.XmlWriter.prototype.writeNamespace = function(namesp, prefix) {
+    if (prefix && "" !== prefix) {
+        this.namespaces[namesp] = prefix;
+        this.buffer.append(" ");
+        this.buffer.append("xmlns:");
+        this.buffer.append(prefix);
+    } else {
+        this.namespaces[namesp] = "";
+        this.buffer.append(" ");
+        this.buffer.append("xmlns");
+    }
+    this.buffer.append("=\"");
+    this.buffer.append(namesp);
+    this.buffer.append("\"");
+};
+
+sforce.XmlWriter.prototype.writeText = function(text) {
+    if (this.writingStartElement) {
+        this.buffer.append(">");
+        this.writingStartElement = false;
+    } else {
+        throw "Can only write text after a start element";
+    }
+    if (typeof text == 'string') {
+        text = text.replace(/&/g, '\&amp;');
+        text = text.replace(/</g, '&lt;');
+        text = text.replace(/>/g, '&gt;');
+    }
+
+    this.buffer.append(text);
+};
+
+sforce.XmlWriter.prototype.writeXsiType = function(xsiType) {
+    this.writeNamespace("http://www.w3.org/2001/XMLSchema-instance", "xsi");
+    this.writeAttribute("xsi:type", xsiType);
+};
+
+sforce.XmlWriter.prototype.writeAttribute = function(name, value) {
+    this.buffer.append(" " + name + "=\"" + value + "\"");
+};
+
+sforce.XmlWriter.prototype.getPrefix = function(namesp) {
+    var prefix = this.namespaces[namesp];
+    //sforce.debug.log("--------");
+    //sforce.debug.log(namesp + ":" + (prefix === null ? "null":prefix) + ":");
+    if (!prefix && prefix !== "") {
+        prefix = "ns" + this.prefixCount;
+        this.prefixCount++;
+        this.namespaces[namesp] = prefix;
+        return prefix;
+    }
+    return prefix;
+};
+
+sforce.XmlWriter.prototype.toString = function() {
+    return this.buffer.toString();
+};
+
+/** soap writer*/
+sforce.XmlWriter.prototype.soapNS = "http://schemas.xmlsoap.org/soap/envelope/";
+
+sforce.XmlWriter.prototype.startEnvelope = function() {
+    this.writeStartElement("Envelope", this.soapNS, "se");
+};
+
+sforce.XmlWriter.prototype.endEnvelope = function() {
+    this.writeEndElement("Envelope", this.soapNS);
+};
+
+sforce.XmlWriter.prototype.startHeader = function() {
+    this.writeStartElement("Header", this.soapNS, "se");
+};
+
+sforce.XmlWriter.prototype.endHeader = function() {
+    this.writeEndElement("Header", this.soapNS);
+};
+
+sforce.XmlWriter.prototype.startBody = function() {
+    this.writeStartElement("Body", this.soapNS, "se");
+};
+
+sforce.XmlWriter.prototype.endBody = function() {
+    this.writeEndElement("Body", this.soapNS);
+};
+
+sforce.XmlWriter.prototype.writeNameValueNode = function(name, value) {
+    if (value === null) {
+        this.writeStartElement(name);
+        this.writeNamespace("http://www.w3.org/2001/XMLSchema-instance", "xsi");
+        this.writeAttribute("xsi:nill", "true");
+        this.writeEndElement(name);
+        return;
+    }
+
+    if (value.toUTCString) {
+        value = sforce.internal.dateTimeToString(value);
+    }
+    if (typeof value == "boolean") {
+        // boolean 'false' values get joined in string buffer,
+        // so convert to strings:
+        value = value ? "true" : "false";
+    }
+
+    if (value && value.join) {
+        for (var i=0; i<value.length; i++) {
+            this.writeStartElement(name);
+            this.writeText(value[i]);
+            this.writeEndElement(name);
+        }
+    } else {
+        this.writeStartElement(name);
+        this.writeText(value);
+        this.writeEndElement(name);
+    }
+};
+
+/** XmlReader */
+
+sforce.XmlReader = function(root) {
+    this.envelope = root;
+};
+
+sforce.XmlReader.prototype.getEnvelope = function() {
+    if (this.isTag("Envelope", this.envelope)) {
+        return this.envelope;
+    }
+    throw "Unable to find soap envelope, but found " + this.envelope.nodeName;
+};
+
+sforce.XmlReader.prototype.getBody = function() {
+    return this.getChild("Body", this.envelope);
+};
+
+sforce.XmlReader.prototype.getHeader = function() {
+    return this.getChild("Header", this.envelope);
+};
+
+sforce.XmlReader.prototype.getChild = function(name, node) {
+    var children = node.childNodes;
+    for (var i = 0; i < children.length; i++) {
+        if (children[i].nodeType == 1 && this.isTag(name, children[i])) {
+            return children[i];
+        }
+    }
+    return null;
+};
+
+sforce.XmlReader.prototype.getFirstElement = function(node) {
+    var children = node.childNodes;
+    for (var i = 0; i < children.length; i++) {
+        if (children[i].nodeType == 1) {
+            return children[i];
+        }
+    }
+    return null;
+};
+
+sforce.XmlReader.prototype.isTag = function(name, node) {
+    var ns = node.nodeName.split(":");
+    if (ns.length == 2 && ns[1] == name) {
+        return true;
+    }
+    if (ns.length == 1 && ns[0] == name) {
+        return true;
+    }
+    return false;
+};
+
+sforce.XmlReader.prototype.isNameValueNode = function(node) {
+    var children = node.childNodes;
+    for (var i = 0; i < children.length; i++) {
+        if (children[i].nodeType != 3) {
+            return false;
+        }
+    }
+
+    return true;
+};
+
+sforce.XmlReader.prototype.getTextValue = function(node) {
+    if (node.nodeType == 3) {
+        return node.nodeValue;
+    }
+    //todo: fix the hardcoded xsi prefix
+    var xsiNil = node.getAttribute("xsi:nil");
+    if (xsiNil == "true") {
+        return null;
+    }
+    var sb = "";
+    var children = node.childNodes;
+    for (var i = 0; i < children.length; i++) {
+        if (children[i].nodeType == 3) {
+            sb += children[i].nodeValue;
+        } else {
+            throw "Not a simple name value node";
+        }
+    }
+    return sb;
+};
+
+//todo: optimize
+/*
+sforce.XmlReader.prototype.toXmlObject2 = function(node) {
+    var children = node.childNodes;
+    var obj = new sforce.Xml();
+    for (var i = 0; i < children.length; i++) {
+        var child = children[i];
+        if (child.nodeType != 1) continue;
+        var name = child.nodeName;
+        var index = name.indexOf(":");
+        name = (index == -1) ? name : name.substring(index + 1);
+        var value;
+        if (this.isNameValueNode(child)) {
+            value = this.getTextValue(child);
+        } else {
+            value = this.toXmlObject(child);
+        }
+        this.addToObject(obj, name, value);
+    }
+    return obj;
+}
+*/
+
+
+sforce.XmlReader.prototype.toXmlObject = function(n) {
+    //todo: fix the hardcoded xsi prefix
+    var xsiNil = n.getAttribute("xsi:nil");
+    if (xsiNil == "true") {
+        return null;
+    }
+
+    var top = new sforce.Xml();
+    var stack = [];
+    stack.push({node: n, obj: top});
+
+    while (stack.length > 0) {
+        var st = stack.shift();
+
+        for (var child = st.node.firstChild; child !== null; child = child.nextSibling) {
+            if (child.nodeType != 1) {
+                continue;
+            }
+            var name = child.nodeName;
+            var index = name.indexOf(":");
+            name = (index == -1) ? name : name.substring(index + 1);
+            var value;
+
+            var isNameValue = true;
+            var sb = "";
+            for (var tc = child.firstChild; tc !== null; tc = tc.nextSibling) {
+                if (tc.nodeType != 3) {
+                    isNameValue = false;
+                    break;
+                } else {
+                    sb += tc.nodeValue;
+                }
+            }
+
+            if (isNameValue) {
+                if (child.getAttribute("xsi:nil") == "true") {
+                    value = null;
+                } else {
+                    value = sb;
+                }
+            } else {
+                value = new sforce.Xml();
+                stack.push({node: child, obj: value});
+            }
+            if (!st.obj[name]) {
+                st.obj[name] = value;
+            } else {
+                if (st.obj[name].push) {
+                    st.obj[name].push(value);
+                } else {
+                    var old = st.obj[name];
+                    if (name === "Id" && old === value) {
+                        //skip, special case for dup Id in sobject
+                    } else {
+                        st.obj[name] = [];
+                        st.obj[name].push(old);
+                        st.obj[name].push(value);
+                    }
+                }
+            }
+        }
+    }
+    return top;
+};
+
+
+/** SoapTransport */
+
+sforce.SoapTransport = function() {
+    this.connectionCallback = null;
+    this.result = null;
+    this.fault = null;
+    this.isAsync = true;
+    this.isArray = false;
+};
+
+sforce.SoapTransport.prototype.onFailure = function(res, writer) {
+    var error = "ERROR: ........... ";
+    alert(error + res);
+    this.result = null;
+};
+
+sforce.SoapTransport.prototype.send = function(url, writer, isArray, connectionCallback) {
+    this.isArray = isArray;
+    var transport = new sforce.Transport(url);
+    this.isAsync = connectionCallback ? true : false;
+    if (this.isAsync) {
+        this.connectionCallback = connectionCallback;
+        transport.send(writer.toString(), this, this.isAsync, connectionCallback.timeout);
+    } else {
+        transport.send(writer.toString(), this, this.isAsync);
+        if (this.fault !== null) {
+            throw this.fault;
+        }
+        return this.result;
+    }
+};
+
+sforce.SoapTransport.prototype.httpCallback = function(response, success) {
+    try {
+        if (success === true) {
+            var reader = new sforce.XmlReader(response);
+            var envelope = reader.getEnvelope();
+            var body = reader.getBody();
+            var operation = reader.getFirstElement(body);
+            if (operation === null) {
+                throw "Unable to find operation response element";
+            }
+            var resultArray = [];
+            var children = operation.childNodes;
+            for (var i = 0; i < children.length; i++) {
+                if (children[i].nodeType != 1) {
+                    continue;
+                }
+                if (reader.isNameValueNode(children[i])) {
+                    resultArray.push(reader.getTextValue(children[i]));
+                } else {
+                    resultArray.push(reader.toXmlObject(children[i]));
+                }
+            }
+
+            if (this.isArray) {
+                this.result = resultArray;
+            } else {
+                if (resultArray.length > 1) {
+                    throw "Found more than one response: " + resultArray;
+                }
+                this.result = resultArray[0];
+            }
+
+            if (this.isAsync) {
+                try {
+                    this.beforeCallback();
+                    if (typeof this.connectionCallback == "function") {
+                        this.connectionCallback(this.result);
+                    } else {
+                        if (this.connectionCallback.onSuccess) {
+                            this.connectionCallback.onSuccess(this.result, this.connectionCallback.source);
+                        } else {
+                            throw "Unable to find onSuccess method in the callback object";
+                        }
+                    }
+                } finally {
+                    this.afterCallback();
+                }
+            }
+        } else {
+            if (typeof(response.nodeName) !== "undefined") {
+                var reader2 = new sforce.XmlReader(response);
+                var envelope2 = reader2.getEnvelope();
+                var body2 = reader2.getBody();
+                var soapfaultEl = reader2.getFirstElement(body2);
+                var soapfault = reader2.toXmlObject(soapfaultEl);
+                this.sendFault(soapfault);
+            } else {
+                this.sendFault(response);
+            }
+        }
+    } catch(fault) {
+        this.sendFault(fault);
+    }
+};
+
+
+sforce.SoapTransport.prototype.sendFault = function(fault) {
+    if (this.isAsync) {
+        if (this.connectionCallback.onFailure) {
+            try {
+                this.beforeCallback();
+                this.connectionCallback.onFailure(fault, this.connectionCallback.source);
+            } finally {
+                this.afterCallback();
+            }
+        } else {
+            this.onFailure(fault);
+        }
+    } else {
+        this.fault = fault;
+    }
+};
+
+sforce.SoapTransport.prototype.beforeCallback = function () {};
+
+sforce.SoapTransport.prototype.afterCallback = function () {};
+
+/** SObject */
+
+
+sforce.SObject = function(type) {
+    this.type = type;
+};
+
+sforce.SObject.prototype = new sforce.Xml("sObjects");
+
+
+/** LeadConvert */
+
+
+sforce.LeadConvert = function() {
+};
+
+sforce.LeadConvert.prototype = new sforce.Xml("leadConverts");
+
+/** MergeRequest */
+
+
+sforce.MergeRequest = function() {
+};
+
+sforce.MergeRequest.prototype = new sforce.Xml("request");
+
+/** DescribeSoqlListViewsRequest - see describeSoqlListViews() */
+sforce.DescribeSoqlListViewsRequest  = function() {
+};
+sforce.DescribeSoqlListViewsRequest.prototype = new sforce.Xml("request");
+
+/** DescribeSoqlListViewParams - see describeSoqlListViews() */
+sforce.DescribeSoqlListViewParams = function() {
+};
+sforce.DescribeSoqlListViewParams.prototype = new sforce.Xml("listViewParams");
+
+/** DescribePicklistsParam - see describePicklists() */
+sforce.DescribePicklistsParam = function() {
+};
+sforce.DescribePicklistsParam.prototype = new sforce.Xml("picklistParams");
+
+
+/** QuickAction */
+
+
+sforce.QuickAction = function() {
+};
+
+sforce.QuickAction.prototype = new sforce.Xml("quickActions");
+
+/** Connection */
+
+sforce.Connection = function() {
+    this.sessionId = null;
+    this.updateMru = null;
+    this.allowFieldTruncation = null;
+    this.disableFeedTracking = null;
+    this.streamingEnabled = null;
+    this.allOrNone = null;
+    this.client = null;
+    this.defaultNamespace = null;
+    this.batchSize = null;
+    this.loginScopeHeader = null;
+    this.emailHeader = null;
+    this.assignmentRuleHeader = null;
+    this.duplicateRuleHeader = null;
+    this.transferToUserId = null;
+    this.debuggingHeader = null;
+    this.serverUrl = (typeof window.UserContext != "undefined") ? UserContext.getUrl("/services/Soap/u/51.0") : "/services/Soap/u/51.0";
+};
+
+
+/** internal methods */
+
+sforce.internal.Parameter = function (n, v, a) {
+    this.name = n;
+    this.value = v;
+    this.isArray = a;
+};
+
+sforce.Connection.prototype.sforceNs = "urn:partner.soap.sforce.com";
+sforce.Connection.prototype.sobjectNs = "sobject.partner.soap.sforce.com";
+
+sforce.Connection.prototype.writeOne = function (writer, name, value, sobjectNs) {
+    if (value === null) {
+        writer.writeNameValueNode(name, null);
+    } else if (value.toXml) {
+        value.toXml(sobjectNs, name, writer);
+    } else {
+        writer.writeNameValueNode(name, value);
+    }
+};
+
+sforce.Connection.prototype.init = function(sessionId, serverUrl) {
+    this.sessionId = sessionId;
+    this.serverUrl = serverUrl;
+};
+
+sforce.Connection.prototype.login = function (username, password) {
+    var arg1 = new sforce.internal.Parameter("username", username, false);
+    var arg2 = new sforce.internal.Parameter("password", password, false);
+    var result = this.invoke("login", [arg1, arg2], false, null);
+    this.sessionId = result.sessionId;
+    return result;
+};
+
+sforce.Connection.prototype.describeSObject = function(type, callback) {
+    var arg = new sforce.internal.Parameter("sObjectType", type, false);
+    return this.invoke("describeSObject", [arg], false, callback);
+};
+
+sforce.Connection.prototype.describeSObjects = function(types, callback) {
+    var arg = new sforce.internal.Parameter("sObjectType", types, true);
+    return this.invoke("describeSObjects", [arg], true, callback);
+};
+
+sforce.Connection.prototype.describeSearchLayouts = function(type, callback) {
+    var arg = new sforce.internal.Parameter("sObjectType", type, true);
+    return this.invoke("describeSearchLayouts", [arg], true, callback);
+};
+
+sforce.Connection.prototype.describeListViews = function(type, callback) {
+    var arg = new sforce.internal.Parameter("sObjectType", type, true);
+    return this.invoke("describeListViews", [arg], true, callback);
+};
+
+sforce.Connection.prototype.describeSoqlListViews = function(name, type, callback) {
+    // this interface is only for a single list 
+    // build up a request for the user - easier than making caller do it
+	var rp = new sforce.DescribeSoqlListViewParams();
+	rp.developerNameOrId = name;
+	rp.sobjectType = type;
+	var describeRequest = new sforce.DescribeSoqlListViewsRequest();
+	describeRequest.listViewParams = [ rp ];
+    
+    var arg1 = new sforce.internal.Parameter("request", describeRequest, false);
+    return this.invoke("describeSoqlListViews", [arg1], false, callback);
+};
+
+sforce.Connection.prototype.describeGlobal = function(callback) {
+    return this.invoke("describeGlobal", [], false, callback);
+};
+
+sforce.Connection.prototype.describeLayout = function(type, layoutName, recordTypes, callback) {
+    var arg1 = new sforce.internal.Parameter("sObjectType", type, false);
+    if (!layoutName) {
+        layoutName = null;
+    }
+    var arg2 = new sforce.internal.Parameter("layoutName", layoutName, false);
+    if (!recordTypes) {
+        recordTypes = [];
+    }
+    var arg3 = new sforce.internal.Parameter("recordTypeIds", recordTypes, true);
+    return this.invoke("describeLayout", [arg1, arg2, arg3], false, callback);
+};
+
+sforce.Connection.prototype.describeAvailableQuickActions = function(parentType, callback) {
+    var arg = new sforce.internal.Parameter("parentType", parentType, false);
+    return this.invoke("describeAvailableQuickActions", [arg], true, callback);
+};
+
+sforce.Connection.prototype.describeQuickActions = function(quickActionNames, callback) {
+    var arg = new sforce.internal.Parameter("quickActionNames", quickActionNames, true);
+    return this.invoke("describeQuickActions", [arg], true, callback);
+};
+
+sforce.Connection.prototype.describeQuickActionsForRecordType = function(quickActionNames, recordTypeId, callback) {
+    var arg = new sforce.internal.Parameter("quickActionNames", quickActionNames, true);
+    var arg2 = new sforce.internal.Parameter("recordTypeId", recordTypeId, false);
+    return this.invoke("describeQuickActionsForRecordType", [arg,arg2], true, callback);
+};
+
+sforce.Connection.prototype.performQuickActions = function(quickActions, callback) {
+    var arg = new sforce.internal.Parameter("quickActions", quickActions, true);
+    return this.invoke("performQuickActions", [arg], true, callback);
+};
+
+sforce.Connection.prototype.describeCompactLayouts = function(type, recordTypes, callback) {
+    var arg = new sforce.internal.Parameter("sObjectType", type, false);
+    if (!recordTypes) {
+        recordTypes = [];
+    }
+    var arg2 = new sforce.internal.Parameter("recordTypeIds", recordTypes, true);
+    return this.invoke("describeCompactLayouts", [arg, arg2], false, callback);
+};
+
+sforce.Connection.prototype.describePathAssistants = function(type, picklistValue, recordTypes, callback) {
+    var arg = new sforce.internal.Parameter("sObjectType", type, false);
+    if (!picklistValue) {
+        picklistValue = null;
+    }
+    var arg2 = new sforce.internal.Parameter("picklistValue", picklistValue, false);
+    if (!recordTypes) {
+        recordTypes = [];
+    }
+    var arg3 = new sforce.internal.Parameter("recordTypeIds", recordTypes, true);
+    return this.invoke("describePathAssistants", [arg, arg2, arg3], false, callback);
+};
+
+sforce.Connection.prototype.describePicklists = function(entityName, fieldNames, recordTypeId, callback) {
+    var picklistParams = new sforce.DescribePicklistsParam();
+    picklistParams.entityName = entityName;
+    picklistParams.fieldNames = fieldNames;
+    picklistParams.recordTypeId = recordTypeId;
+
+    var arg1 = new sforce.internal.Parameter("param", picklistParams, false);
+    return this.invoke("describePicklists", [arg1], false, callback);
+};
+
+sforce.Connection.prototype.describePrimaryCompactLayouts = function(sObjectTypes, callback) {
+    var arg = new sforce.internal.Parameter("sObjectTypes", sObjectTypes, true);
+    return this.invoke("describePrimaryCompactLayouts", [arg], true, callback);
+};
+
+sforce.Connection.prototype.describeApprovalLayout = function(type, approvalProcessNames, callback) {
+    var arg1 = new sforce.internal.Parameter("sObjectType", type, false);
+    if (!approvalProcessNames) {
+    	approvalProcessNames = [];
+    }
+    var arg2 = new sforce.internal.Parameter("approvalProcessNames", approvalProcessNames, true);
+    return this.invoke("describeApprovalLayout", [arg1, arg2], false, callback);
+};
+
+sforce.Connection.prototype.describeSObjectListViews = function(type, recentlyViewed, callback) {
+    var arg1 = new sforce.internal.Parameter("sObjectType", type, false);
+    var arg2 = new sforce.internal.Parameter("recentlyViewed", recentlyViewed, false);
+    var arg3 = new sforce.internal.Parameter("isSoqlCompatible", isSoqlCompatible, false);
+    var arg4 = new sforce.internal.Parameter("limit", limit, false);
+    var arg5 = new sforce.internal.Parameter("offset", offset, false);
+    return this.invoke("describeSObjectListViews", [arg1, arg2, arg3, arg4, arg5], true, callback);
+};
+
+sforce.Connection.prototype.describeTabs = function(callback) {
+	return this.invoke("describeTabs", [], true, callback);
+};
+
+sforce.Connection.prototype.describeAllTabs = function(callback) {
+	return this.invoke("describeAllTabs", [], true, callback);
+};
+
+sforce.Connection.prototype.describeAppMenu = function(appMenuType, networkId, callback) {
+	var arg1 = new sforce.internal.Parameter("appMenuType", appMenuType, false);
+	var arg2 = new sforce.internal.Parameter("networkId", networkId, false);
+    return this.invoke("describeAppMenu", [arg1, arg2], true, callback);
+};
+
+sforce.Connection.prototype.describeFlexiPages = function(flexipageDevName, callback) {
+	var arg1 = new sforce.internal.Parameter("FlexiPage", flexipageDevName, false);
+	return this.invoke("describeFlexiPages", [arg1], true, callback);
+};
+
+sforce.Connection.prototype.describeTheme = function(callback) {
+    return this.invoke("describeTheme", [], true, callback);
+};
+
+sforce.Connection.prototype.describeGlobalTheme = function(callback) {
+    return this.invoke("describeGlobalTheme", [], true, callback);
+};
+
+sforce.Connection.prototype.describeSoftphoneLayout = function(callback) {
+    return this.invoke("describeSoftphoneLayout", [], false, callback);
+};
+
+sforce.Connection.prototype.describeMiniLayout = function (type, recordTypeIds, callback) {
+    var arg1 = new sforce.internal.Parameter("sObjectType", type, false);
+    var arg2 = new sforce.internal.Parameter("recordTypeIds", recordTypeIds, true);
+    return this.invoke("describeMiniLayout", [arg1, arg2], false, callback);
+};
+
+sforce.Connection.prototype.describeSearchScopeOrder = function(callback) {
+     return this.invoke("describeSearchScopeOrder", [], true, callback);
+};
+
+sforce.Connection.prototype.create = function (sobjects, callback) {
+    var arg = new sforce.internal.Parameter("sObjects", sobjects, true);
+    return this.invoke("create", [arg], true, callback);
+};
+
+sforce.Connection.prototype.update = function (sobjects, callback) {
+    var arg = new sforce.internal.Parameter("sObjects", sobjects, true);
+    return this.invoke("update", [arg], true, callback);
+};
+
+sforce.Connection.prototype.upsert = function (externalIDFieldName, sobjects, callback) {
+    var arg1 = new sforce.internal.Parameter("externalIDFieldName", externalIDFieldName, false);
+    var arg2 = new sforce.internal.Parameter("sObjects", sobjects, true);
+    return this.invoke("upsert", [arg1, arg2], true, callback);
+};
+
+sforce.Connection.prototype.deleteIds = function (ids, callback) {
+    var arg = new sforce.internal.Parameter("ids", ids, true);
+    return this.invoke("delete", [arg], true, callback);
+};
+
+sforce.Connection.prototype.deleteByExample = function (sobjects, callback) {
+    var arg = new sforce.internal.Parameter("sObjects", sobjects, true);
+    return this.invoke("deleteByExample", [arg], true, callback);
+};
+
+sforce.Connection.prototype.impersonateUser = function (ids, callback) {
+    var arg = new sforce.internal.Parameter("ids", ids, true);
+    return this.invoke("impersonateUser", [arg], true, callback);
+};
+sforce.Connection.prototype.query = function(queryString, callback) {
+    var arg = new sforce.internal.Parameter("queryString", queryString, false);
+    return this.invoke("query", [arg], false, callback);
+};
+
+sforce.Connection.prototype.queryAll = function(queryString, callback) {
+    var arg = new sforce.internal.Parameter("queryString", queryString, false);
+    return this.invoke("queryAll", [arg], false, callback);
+};
+
+sforce.Connection.prototype.queryMore = function(queryLocator, callback) {
+    var arg = new sforce.internal.Parameter("queryLocator", queryLocator, false);
+    return this.invoke("queryMore", [arg], false, callback);
+};
+
+sforce.Connection.prototype.retrieve = function(fieldList, sObjectType, ids, callback) {
+    var arg1 = new sforce.internal.Parameter("fieldList", fieldList, false);
+    var arg2 = new sforce.internal.Parameter("sObjectType", sObjectType, false);
+    var arg3 = new sforce.internal.Parameter("ids", ids, true);
+    return this.invoke("retrieve", [arg1, arg2, arg3], true, callback);
+};
+
+sforce.Connection.prototype.getAccessInfo = function(callback) {
+    return this.invoke("getAccessInfo", [], false, callback);
+};
+
+sforce.Connection.prototype.getUserInfo = function(callback) {
+    return this.invoke("getUserInfo", [], false, callback);
+};
+
+sforce.Connection.prototype.resetPassword = function(userId, callback) {
+    var arg1 = new sforce.internal.Parameter("userId", userId, false);
+    return this.invoke("resetPassword", [arg1], false, callback);
+};
+
+sforce.Connection.prototype.setPassword = function(userId, password, callback) {
+    var arg1 = new sforce.internal.Parameter("userId", userId, false);
+    var arg2 = new sforce.internal.Parameter("password", password, false);
+    return this.invoke("setPassword", [arg1, arg2], false, callback);
+};
+
+sforce.Connection.prototype.search = function(searchString, callback) {
+    var arg1 = new sforce.internal.Parameter("searchString", searchString, false);
+    return this.invoke("search", [arg1], false, callback);
+};
+
+sforce.Connection.prototype.getDeleted = function(sObjectType, startDate, endDate, callback) {
+    var arg1 = new sforce.internal.Parameter("sObjectType", sObjectType, false);
+    var arg2 = new sforce.internal.Parameter("startDate", startDate, false);
+    var arg3 = new sforce.internal.Parameter("endDate", endDate, false);
+    return this.invoke("getDeleted", [arg1, arg2, arg3], false, callback);
+};
+
+sforce.Connection.prototype.getUpdated = function(sObjectType, startDate, endDate, callback) {
+    var arg1 = new sforce.internal.Parameter("sObjectType", sObjectType, false);
+    var arg2 = new sforce.internal.Parameter("startDate", startDate, false);
+    var arg3 = new sforce.internal.Parameter("endDate", endDate, false);
+    return this.invoke("getUpdated", [arg1, arg2, arg3], false, callback);
+};
+
+
+sforce.Connection.prototype.getServerTimestamp = function(callback) {
+    return this.invoke("getServerTimestamp", [], false, callback);
+};
+
+sforce.Connection.prototype.convertLead = function(leadConverts, callback) {
+    var arg1 = new sforce.internal.Parameter("leadConverts", leadConverts, true);
+    return this.invoke("convertLead", [arg1], true, callback);
+};
+
+sforce.Connection.prototype.merge = function(mergeRequest, callback) {
+    var arg1 = new sforce.internal.Parameter("request", mergeRequest, true);
+    return this.invoke("merge", [arg1], true, callback);
+};
+
+sforce.Connection.prototype.findDuplicates = function(sObjects, callback) {
+    var arg1 = new sforce.internal.Parameter("sObjects", sObjects, true);
+    return this.invoke("findDuplicates", [arg1], true, callback);
+};
+
+sforce.Connection.prototype.findDuplicatesByIds = function(ids, callback) {
+    var arg1 = new sforce.internal.Parameter("ids", ids, true);
+    return this.invoke("findDuplicatesByIds", [arg1], true, callback);
+};
+
+sforce.Connection.prototype.undelete = function(ids, callback) {
+    var arg1 = new sforce.internal.Parameter("ids", ids, true);
+    return this.invoke("undelete", [arg1], true, callback);
+};
+
+sforce.Connection.prototype.process = function(actions, callback) {
+    var arg1 = new sforce.internal.Parameter("actions", actions, true);
+    return this.invoke("process", [arg1], true, callback);
+};
+
+sforce.Connection.prototype.sendEmail = function(messages, callback) {
+    var arg1 = new sforce.internal.Parameter("messages", messages, true);
+    return this.invoke("sendEmail", [arg1], true, callback);
+};
+
+sforce.Connection.prototype.emptyRecycleBin = function(ids, callback) {
+    var arg1 = new sforce.internal.Parameter("ids", ids, true);
+    return this.invoke("emptyRecycleBin", [arg1], true, callback);
+};
+
+sforce.Connection.prototype.invalidateSessions = function(sessionIds, callback) {
+    var arg = new sforce.internal.Parameter("sessionIds", sessionIds, true);
+    return this.invoke("invalidateSessions", [arg], true, callback);
+};
+
+sforce.Connection.prototype.logout = function(callback) {
+    return this.invoke("logout", [], true, callback);
+};
+
+sforce.Connection.prototype.remoteFunction = function(args) {
+    if (!args.url) {
+        throw "url not defined";
+    }
+    if (!args.onSuccess) {
+        throw "onSuccess method not defined";
+    }
+
+    if (!args.method) {
+        args.method = "GET";
+    }
+    if (!args.mimeType) {
+        args.mimeType = "text/plain";
+    }
+
+    if (typeof(args.async) == 'undefined') {
+        args.async = true;
+    }
+
+    if (typeof(args.cache) == 'undefined') {
+        args.cache = false;
+    }
+
+    if (!(args.mimeType == "text/plain" ||
+          args.mimeType == "text/xml")) {
+        throw "Unknown mime type " + args.mimeType;
+    }
+
+    if (sforce.debug.trace) {
+        sforce.debug.log("Open connection to ... " + args.url);
+    }
+
+    var request = new sforce.Transport().newConnection();
+    var proxyUrl = (typeof window.UserContext != "undefined") ? UserContext.getUrl("/services/proxy") : "/services/proxy";
+    if (args.cache) {
+        proxyUrl = proxyUrl + "?end-point-url=" + args.url;
+    } else {
+        proxyUrl = proxyUrl + "?no-cache=" + new Date().getTime();
+    }
+    request.open(args.method, proxyUrl, args.async);
+
+    if (args.requestHeaders) {
+        for (var k in args.requestHeaders) {
+            if (typeof args.requestHeaders[k] != "function") {
+                request.setRequestHeader(k, args.requestHeaders[k]);
+            }
+        }
+    }
+
+    request.setRequestHeader("SalesforceProxy-Endpoint", args.url);
+    request.setRequestHeader("SalesforceProxy-SID", this.sessionId);
+
+    if (args.async) {
+        request.onreadystatechange = _remoteFunctionCallback;
+    }
+
+    if (sforce.debug.trace) {
+        sforce.debug.log("Sending ...");
+    }
+
+    if (args.requestData) {
+        request.send(args.requestData);
+    } else {
+        request.send(null);
+    }
+
+    if (sforce.debug.trace) {
+        sforce.debug.log("Done Sending ...");
+    }
+
+    if (!args.async) {
+        _remoteFunctionCallback();
+    }
+
+    function _remoteFunctionCallback() {
+        if (sforce.debug.trace) {
+            sforce.debug.log("callback called ...");
+        }
+        if (request.readyState == 4) {
+            if (request.status == 200) {
+                if (args.mimeType == "text/plain") {
+                    args.onSuccess(request.responseText, request);
+                } else if (args.mimeType == "text/xml") {
+                    if (!request.responseXML || !request.responseXML.documentElement) {
+                        throw "Response not text/xml mime type: " + request.responseText;
+                    }
+                    args.onSuccess(request.responseXML.documentElement, request);
+                } else {
+                    throw "unsupported mime type: " + args.mimeType;
+                }
+            } else {
+                if (args.onFailure) {
+                    args.onFailure(request.responseText, request);
+                } else {
+                    sforce.debug.log(request.responseText);
+                }
+            }
+        }
+    }
+};
+
+
+sforce.Connection.prototype.writeHeader = function(writer, headerNs) {
+    writer.startHeader();
+
+    writer.writeNamespace(headerNs, "sfns");
+
+    if (this.sessionId !== null) {
+        writer.writeStartElement("SessionHeader", headerNs);
+        writer.writeNameValueNode("sessionId", this.sessionId);
+        writer.writeEndElement("SessionHeader", headerNs);
+    }
+    if (typeof(this.organizationId) !== "undefined") {
+        throw "Use sforce.connection.loginScopeHeader.organizationId instead of sforce.connection.organizationId";
+    }
+    if (this.loginScopeHeader !== null) {
+        writer.writeStartElement("LoginScopeHeader", headerNs);
+        if (this.loginScopeHeader.organizationId !== null) {
+            writer.writeNameValueNode("organizationId", this.loginScopeHeader.organizationId);
+        }
+        if (this.loginScopeHeader.portalId !== null) {
+            writer.writeNameValueNode("portalId", this.loginScopeHeader.portalId);
+        }
+        writer.writeEndElement("LoginScopeHeader", headerNs);
+    }
+    if (this.client !== null || this.defaultNamespace !== null) {
+        writer.writeStartElement("CallOptions", headerNs);
+        if (this.client !== null) {
+            writer.writeNameValueNode("client", this.client);
+        }
+        if (this.defaultNamespace !== null) {
+            writer.writeNameValueNode("defaultNamespace", this.defaultNamespace);
+         }
+        writer.writeEndElement("CallOptions", headerNs);
+    }
+    if (this.batchSize !== null) {
+        writer.writeStartElement("QueryOptions", headerNs);
+        writer.writeNameValueNode("batchSize", this.batchSize);
+        writer.writeEndElement("QueryOptions", headerNs);
+    }
+    if (this.allowFieldTruncation !== null) {
+        writer.writeStartElement("AllowFieldTruncationHeader", headerNs);
+        writer.writeNameValueNode("allowFieldTruncation", this.allowFieldTruncation);
+        writer.writeEndElement("AllowFieldTruncationHeader", headerNs);
+    }
+    if (this.disableFeedTracking !== null) {
+        writer.writeStartElement("DisableFeedTrackingHeader", headerNs);
+        writer.writeNameValueNode("disableFeedTracking", this.disableFeedTracking);
+        writer.writeEndElement("DisableFeedTrackingHeader", headerNs);
+    }
+    if (this.streamingEnabled !== null) {
+        writer.writeStartElement("StreamingEnabledHeader", headerNs);
+        writer.writeNameValueNode("StreamingEnabled", this.streamingEnabled);
+        writer.writeEndElement("StreamingEnabledHeader", headerNs);
+    }
+    if (this.allOrNone !== null) {
+        writer.writeStartElement("AllOrNoneHeader", headerNs);
+        writer.writeNameValueNode("allOrNone", this.allOrNone);
+        writer.writeEndElement("AllOrNoneHeader", headerNs);
+    }
+    if (this.updateMru !== null) {
+        writer.writeStartElement("MruHeader", headerNs);
+        writer.writeNameValueNode("updateMru", this.updateMru);
+        writer.writeEndElement("MruHeader", headerNs);
+    }
+    if (this.emailHeader !== null) {
+        writer.writeStartElement("EmailHeader", headerNs);
+        if (this.emailHeader.triggerAutoResponseEmail) {
+            writer.writeNameValueNode("triggerAutoResponseEmail", this.emailHeader.triggerAutoResponseEmail);
+        }
+        if (this.emailHeader.triggerOtherEmail) {
+            writer.writeNameValueNode("triggerOtherEmail", this.emailHeader.triggerOtherEmail);
+        }
+        if (this.emailHeader.triggerUserEmail) {
+            writer.writeNameValueNode("triggerUserEmail", this.emailHeader.triggerUserEmail);
+        }
+        writer.writeEndElement("EmailHeader", headerNs);
+    }
+    if (this.assignmentRuleHeader !== null) {
+        writer.writeStartElement("AssignmentRuleHeader", headerNs);
+        if (this.assignmentRuleHeader.assignmentRuleId) {
+            writer.writeNameValueNode("assignmentRuleId", this.assignmentRuleHeader.assignmentRuleId);
+        }
+        if (this.assignmentRuleHeader.useDefaultRule) {
+            writer.writeNameValueNode("useDefaultRule", this.assignmentRuleHeader.useDefaultRule);
+        }
+        writer.writeEndElement("AssignmentRuleHeader", headerNs);
+    }
+    if (this.transferToUserId !== null) {
+        writer.writeStartElement("UserTerritoryDeleteHeader", headerNs);
+        writer.writeNameValueNode("transferToUserId", this.transferToUserId);
+        writer.writeEndElement("UserTerritoryDeleteHeader", headerNs);
+    }
+    if (this.duplicateRuleHeader !== null) {
+        writer.writeStartElement("DuplicateRuleHeader", headerNs);
+        if (this.duplicateRuleHeader.allowSave) {
+            writer.writeNameValueNode("allowSave", this.duplicateRuleHeader.allowSave);
+        }
+        if (this.duplicateRuleHeader.includeRecordDetails) {
+            writer.writeNameValueNode("includeRecordDetails", this.duplicateRuleHeader.includeRecordDetails);
+        }
+        if (this.duplicateRuleHeader.runAsCurrentUser) {
+            writer.writeNameValueNode("runAsCurrentUser", this.duplicateRuleHeader.runAsCurrentUser);
+        }
+        writer.writeEndElement("DuplicateRuleHeader", headerNs);
+    }
+    if (this.debuggingHeader !== null) {
+        writer.writeStartElement("DebuggingHeader", headerNs);
+        // Write out old style if specified
+        if (this.debuggingHeader.debugLevel) {
+            writer.writeNameValueNode("debugLevel", this.debuggingHeader.debugLevel);
+        }
+        // Write out the new style debugging categories and levels
+        if (this.debuggingHeader.debugCategories) {
+            var categories = this.debuggingHeader.debugCategories;
+            for (var i = 0; i < categories.length; i++) {
+                var catAndLevel = categories[i].split(",");
+
+                if (catAndLevel.length == 2) {
+                    writer.writeStartElement("categories");
+                    writer.writeNameValueNode("category", catAndLevel[0]);
+                    writer.writeNameValueNode("level", catAndLevel[1]);
+                    writer.writeEndElement("categories");
+                }
+            }
+        }
+        writer.writeEndElement("DebuggingHeader", headerNs);
+    }
+
+    writer.endHeader();
+};
+
+sforce.Connection.prototype.namespaceMap = [
+{ns:sforce.Connection.prototype.sforceNs, prefix:null},
+{ns:sforce.Connection.prototype.sobjectNs, prefix:"ns1"}
+        ];
+
+sforce.Connection.prototype.invoke = function(method, args, isArray, callback) {
+    return this._invoke(method, args, isArray, callback, this.namespaceMap, this.serverUrl, this.sforceNs, this.sobjectNs);
+};
+
+sforce.Connection.prototype._invoke = function(method, args, isArray, callback, namespaces, url, headerNs, sobjectNs) {
+    if (callback) {
+        if (typeof(callback) == "function") {
+        } else {
+            if (!callback.onSuccess) {
+                throw "onSuccess not defined in the callback";
+            }
+            if (!callback.onFailure) {
+                throw "onFailure not defined in the callback";
+            }
+        }
+    }
+
+    var writer = new sforce.XmlWriter();
+    writer.startEnvelope();
+    this.writeHeader(writer, headerNs);
+    writer.startBody();
+    writer.writeStartElement(method);
+
+    for (var i = 0; i<namespaces.length; i++) {
+        writer.writeNamespace(namespaces[i].ns, namespaces[i].prefix);
+    }
+
+    for (var i = 0; i < args.length; i++) {
+        var arg = args[i];
+        if (typeof(arg.value) === "undefined") {
+            throw "arg " + i + " '" + arg.name + "' not specified";
+        }
+        if (arg.value !== null) {
+            if (arg.isArray && !arg.value.push) {
+                throw "arg " + i + " '" + arg.name + "' is an array. But passed in value is not an array";
+            }
+            if (!arg.isArray && arg.value.push) {
+                throw "arg " + i + " '" + arg.name + "' is not an array. But passed in value is an array";
+            }
+        }
+        if (arg.value === null) {
+            this.writeOne(writer, arg.name, null, sobjectNs);
+        } else if (arg.value.push) { //this is an array
+            for (var j = 0; j < arg.value.length; j++) {
+                var obj = arg.value[j];
+                if (!obj) {
+                    throw "Array element at " + j + " is null.";
+                }
+                this.writeOne(writer, arg.name, obj, sobjectNs);
+            }
+        } else {
+            this.writeOne(writer, arg.name, arg.value, sobjectNs);
+        }
+    }
+    writer.writeEndElement(method);
+    writer.endBody();
+    writer.endEnvelope();
+    if (sforce.debug.trace) {
+        sforce.debug.log("Request: server- " + url);
+        sforce.debug.logXml(writer.toString());
+    }
+    var transport = new sforce.SoapTransport();
+    return transport.send(url, writer, isArray, callback);
+};
+
+
+/* QueryResultIterator */
+
+sforce.QueryResultIterator = function(queryResult) {
+    this.queryResult = queryResult;
+    this.index = 0;
+    this.records = this.queryResult.getArray("records");
+};
+
+sforce.QueryResultIterator.prototype.hasNext = function() {
+    if (this.records.length > this.index) {
+        return true;
+    }
+    if (this.queryResult.queryLocator !== null) {
+        this.queryResult = sforce.connection.queryMore(this.queryResult.queryLocator);
+        this.records = this.queryResult.getArray("records");
+        this.index = 0;
+    }
+    if (this.records.length > this.index) {
+        return true;
+    } else {
+        return false;
+    }
+};
+
+sforce.QueryResultIterator.prototype.next = function() {
+    if (this.records.length > this.index) {
+        var result = this.records[this.index];
+        this.index++;
+        return result;
+    } else {
+        throw "Index out of bound : " + this.index;
+    }
+};
+
+
+/* Email */
+
+
+sforce.Email = function() {
+};
+
+sforce.Email.prototype = new sforce.Xml("messages");
+
+sforce.MassEmailMessage = function() {
+};
+
+sforce.MassEmailMessage.prototype = new sforce.Xml("messages");
+sforce.MassEmailMessage.prototype._xsiType = "MassEmailMessage";
+
+
+
+sforce.SingleEmailMessage = function() {
+};
+
+sforce.SingleEmailMessage.prototype = new sforce.Xml("messages");
+sforce.SingleEmailMessage.prototype._xsiType = "SingleEmailMessage";
+
+
+
+/* ProcessRequest */
+
+
+sforce.ProcessRequest = function() {
+};
+
+sforce.ProcessRequest.prototype = new sforce.Xml("actions");
+
+sforce.ProcessSubmitRequest = function() {
+};
+
+sforce.ProcessSubmitRequest.prototype = new sforce.Xml("actions");
+sforce.ProcessSubmitRequest.prototype._xsiType = "ProcessSubmitRequest";
+
+
+sforce.ProcessWorkitemRequest = function() {
+};
+
+sforce.ProcessWorkitemRequest.prototype = new sforce.Xml("actions");
+sforce.ProcessWorkitemRequest.prototype._xsiType = "ProcessWorkitemRequest";
+/* set up connection */
+sforce.connection = new sforce.Connection();
+
+var UserContext = (typeof window.UserContext != "undefined") ? window.UserContext : {
+    siteUrlPrefix : "",
+    getUrl : function (url) {
+        // fix URL for sites with prefixes
+        if (typeof url == "undefined" || typeof UserContext.siteUrlPrefix == "undefined" || !UserContext.siteUrlPrefix)
+            return url;
+
+        if (url.indexOf('/') != 0)
+            return url;
+
+        if(url.indexOf(UserContext.siteUrlPrefix) == 0)
+            return url;
+
+        return UserContext.siteUrlPrefix + url;
+    }
+};
+
+if (typeof(__sfdcSiteUrlPrefix) != "undefined") {
+    UserContext.siteUrlPrefix = __sfdcSiteUrlPrefix;
+}
+
+sforce.connection.serverUrl = (typeof window.UserContext != "undefined") ? UserContext.getUrl("/services/Soap/u/51.0") : "/services/Soap/u/51.0";
+
+if (typeof(__sfdcSessionId) != "undefined") {
+    sforce.connection.sessionId = __sfdcSessionId;
+}
diff --git a/force-app/main/default/staticresources/connection20.resource-meta.xml b/force-app/main/default/staticresources/connection20.resource-meta.xml
new file mode 100644
index 0000000..aa06dd8
--- /dev/null
+++ b/force-app/main/default/staticresources/connection20.resource-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<StaticResource xmlns="http://soap.sforce.com/2006/04/metadata">
+    <cacheControl>Public</cacheControl>
+    <contentType>application/x-javascript</contentType>
+</StaticResource>

--
Gitblit v1.9.1