unknown
2023-04-18 4a05201d126ade3192225d25345ec78d2882affb
Merge branch 'LEX_dev' of http://47.92.229.245:8089/r/lightningupdate into LEX_dev
104个文件已添加
7个文件已修改
1个文件已删除
6658 ■■■■■ 已修改文件
.husky/pre-commit 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LightingButtonConstant.cls 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/OpportunityLightingButtonController.cls 204 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/QISReportController.cls 314 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/RentalApplyESetRefreshStatusController.cls 100 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/RentalApplyESetRefreshStatusController.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/SelectSubstituteControllerLWT.cls 633 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/SelectSubstituteControllerLWT.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/TransferApplyController.cls 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/TransferApplyController.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/TransferApplyWebService.cls 214 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/TransferApplyWebService.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.css 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.js 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.html 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.js 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.html 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.js 39 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCancelApply/lexCancelApply.html 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCancelApply/lexCancelApply.js 100 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCancelApply/lexCancelApply.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCancelReport/__tests__/lexCancelReport.test.js 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCancelReport/lexCancelReport.css 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCancelReport/lexCancelReport.html 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCancelReport/lexCancelReport.js 116 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCancelReport/lexCancelReport.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.css 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.js 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.css 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.js 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.css 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.js 231 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.css 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.js 158 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.css 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js 302 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js-meta.xml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexLoseReport/__tests__/lexLoseReport.test.js 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexLoseReport/lexLoseReport.css 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexLoseReport/lexLoseReport.html 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexLoseReport/lexLoseReport.js 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexLoseReport/lexLoseReport.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.css 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.js 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.css 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.js 101 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.css 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.js 100 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.css 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.js 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexQISSC/lexQISSC.css 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexQISSC/lexQISSC.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexQISSC/lexQISSC.js 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexQISSC/lexQISSC.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexQuotationProductNew/__tests__/lexQuotationProductNew.test.js 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.html 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.js 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexQuotationRequest/__tests__/lexQuotationRequest.test.js 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.css 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.html 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.js 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.css 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.js 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.css 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.js 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexStockApply/__tests__/lexStockApply.test.js 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexStockApply/lexStockApply.css 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexStockApply/lexStockApply.html 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexStockApply/lexStockApply.js 114 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexStockApply/lexStockApply.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.css 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js 101 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.css 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.css 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.js 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.js-meta.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/staticresources/connection20.js 1935 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/staticresources/connection20.resource-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.husky/pre-commit
File was deleted
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 = '中标结果确认';
    //询价的ConfirmationofAward__c字段值‘OLY中标’
    public static final String OPPORTUNITY_CONFIRMATION_OF_AWARD_OLY_WIN_BID = 'OLY中标';
     //询价的ConfirmationofAward__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';
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;
    }
}
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;
    }
    //发送QIS到SPO
    @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;
    }
}
force-app/main/default/classes/RentalApplyESetRefreshStatusController.cls
New file
@@ -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
                        //【FY23大及巨大课题】长假备品借用延期开发 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
                        //【FY23大及巨大课题】长假备品借用延期开发 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';
    }
}
force-app/main/default/classes/RentalApplyESetRefreshStatusController.cls-meta.xml
New file
@@ -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>
force-app/main/default/classes/SelectSubstituteControllerLWT.cls
New file
@@ -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目的,QIS已有新品发货日,不可出库指示';
            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 {
            //一览情况下检索一览对应的申请书Id,soql子查询不能和主查询是同一个表,单独检索一次
            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;
    }
}
force-app/main/default/classes/SelectSubstituteControllerLWT.cls-meta.xml
New file
@@ -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>
force-app/main/default/classes/TransferApplyController.cls
New file
@@ -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();
    }
}
force-app/main/default/classes/TransferApplyController.cls-meta.xml
New file
@@ -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>
force-app/main/default/classes/TransferApplyWebService.cls
New file
@@ -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 '请确认审批人,没有审批人(备品总窗口),不能提交';
        }
        //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);
    }
}
force-app/main/default/classes/TransferApplyWebService.cls-meta.xml
New file
@@ -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>
force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.css
New file
@@ -0,0 +1,11 @@
.Holder{
    position: relative;
    display: inline-block;
    width: 80px;
    height: 80px;
    text-align: center;
}
.container .uiContainerManager{
    display : none !important;
}
force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="Holder" if:true={IsLoading}>
          <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
      </div>
</template>
force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.js
New file
@@ -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 }');
force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.js-meta.xml
New file
@@ -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>
force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.html
New file
@@ -0,0 +1,3 @@
<template>
</template>
force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.js
New file
@@ -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');
    }
}
force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.js-meta.xml
New file
@@ -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>
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>
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,7 +44,26 @@
        })
    }
    beforeOPDPDFBtn(){
        if (window.confirm('是否新建OPD报告书?\n[确定] => 新建OPD\n[取消] => 只生成 [产品试用评价]')) {
        this.handleConfirmClick('是否新建OPD报告书?\n[确定] => 新建OPD\n[取消] => 只生成 [产品试用评价]');
    }
    showToast(msg,type) {
        const event = new ShowToastEvent({
            title: '',
            message: msg,
            variant: type
        });
        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',
@@ -77,13 +104,5 @@
            window.open('/apex/BeforeOPDPDF?oid=' + this.recordId, 'BeforeOPDPDF');
            this.dispatchEvent(new CloseActionScreenEvent());
        }
    }
    showToast(msg,type) {
        const event = new ShowToastEvent({
            title: '',
            message: msg,
            variant: type
        });
        this.dispatchEvent(event);
    }
}
force-app/main/default/lwc/lexCancelApply/lexCancelApply.html
New file
@@ -0,0 +1,4 @@
<template>
</template>
force-app/main/default/lwc/lexCancelApply/lexCancelApply.js
New file
@@ -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);
// }
// }
force-app/main/default/lwc/lexCancelApply/lexCancelApply.js-meta.xml
New file
@@ -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>
force-app/main/default/lwc/lexCancelReport/__tests__/lexCancelReport.test.js
New file
@@ -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);
    });
});
force-app/main/default/lwc/lexCancelReport/lexCancelReport.css
New file
@@ -0,0 +1,10 @@
.cancelReportHolder{
    position: relative;
    display: inline-block;
    width: 80px;
    height: 80px;
    text-align: center;
}
.container .uiContainerManager{
    display: none !important;
}
force-app/main/default/lwc/lexCancelReport/lexCancelReport.html
New file
@@ -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>
force-app/main/default/lwc/lexCancelReport/lexCancelReport.js
New file
@@ -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());
        });
    }
}
force-app/main/default/lwc/lexCancelReport/lexCancelReport.js-meta.xml
New file
@@ -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>
force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.css
New file
@@ -0,0 +1,11 @@
.Holder{
    position: relative;
    display: inline-block;
    width: 80px;
    height: 80px;
    text-align: center;
}
.container .uiContainerManager{
    display : none !important;
}
force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="Holder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.js
New file
@@ -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');
    }
}
force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.js-meta.xml
New file
@@ -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>
force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.css
New file
@@ -0,0 +1,11 @@
.Holder{
    position: relative;
    display: inline-block;
    width: 80px;
    height: 80px;
    text-align: center;
}
.container .uiContainerManager{
    display : none !important;
}
force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.html
New file
@@ -0,0 +1,5 @@
<template>
  <div class="Holder" if:true={IsLoading}>
              <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
  </div>
</template>
force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.js
New file
@@ -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);
            }
        }
    }
}
force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.js-meta.xml
New file
@@ -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>
force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.css
New file
@@ -0,0 +1,10 @@
.createEmailHolder{
    position: relative;
    display: inline-block;
    width: 80px;
    height: 80px;
    text-align: center;
}
.container .uiContainerManager{
    display: none !important;
}
force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="createEmailHolder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.js
New file
@@ -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-用替代品完成了'){
                     this.UseFailProductFinish = '否-用替代品完成';
                 }else if(this.isUsedForTheOpera == 'NO-用其他公司的同类产品完成了'){
                     this.UseFailProductFinish = '否-用其他公司的同类产品完成';
                 }else if(this.isUsedForTheOpera == 'NO-手术中止'){
                     this.UseFailProductFinish = '否-手术中止';
                 }
                 if ('使用前准备' == this.failuerSituation) {
                     this.failuerSituation = '使用前准备-患者未麻醉';
                 }
                 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 : '该QIS不能新建修理',
                        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(() => {
        });
    }
}
force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.js-meta.xml
New file
@@ -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>
force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.css
New file
@@ -0,0 +1,11 @@
.Holder{
    position: relative;
    display: inline-block;
    width: 80px;
    height: 80px;
    text-align: center;
}
.container .uiContainerManager{
    display : none !important;
}
force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.html
New file
@@ -0,0 +1,5 @@
<template>
      <div class="Holder" if:true={IsLoading}>
              <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
      </div>
</template>
force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.js
New file
@@ -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;
            // 处理异常情况
          });
    }
}
force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.js-meta.xml
New file
@@ -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>
force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.css
New file
@@ -0,0 +1,11 @@
.Holder{
    position: relative;
    display: inline-block;
    width: 80px;
    height: 80px;
    text-align: center;
}
.container .uiContainerManager{
    display : none !important;
}
force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="Holder" if:true={IsLoading}>
          <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
      </div>
</template>
force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js
New file
@@ -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)}");
}
force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js-meta.xml
New file
@@ -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>
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) {
        console.log("进入页面");
        console.log(currentPageReference);
        if(currentPageReference) {
            const urlValue = currentPageReference.state.recordId;
            if(urlValue) {
                let str = `${urlValue}`;
            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));
        init({recordId:this.recordId}).then(result=>{
            console.log(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("已申请决裁但决裁状态不符合条件。");
                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(()=>{
        });
    }
    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 {
                    approvalCheck({
                        rentalApplyId: this.recordId
                    }).then(res=>{
                        if (res != '1') {
                            alert(rs1);
            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 var rs2 = sforce.apex.execute("RentalApplyWebService", "reserve", {rentalApplyId: raid});
                //bp2 let 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=>{
                setShipment_requests({raid:null,raesid: this.id}).then(res=>{
                                if (res == "状态更新到已出库指示") { 
                                    alert("状态更新到已出库指示");
                                    print();
                                    setTimeout(function() {
                                        location.href = "/{!Rental_Apply__c.Id}";
                                    },100);
                        // alert("状态更新到已出库指示");
                        const event = new ShowToastEvent({
                            title: '提示信息',
                            message:"状态更新到已出库指示"
                        });
                        this.dispatchEvent(event);
                        print().then(res=>{
                            setTimeout(function() {location.href = "/"+this.RentalApplyC;}, 100);
                        });
                                }else {
                                    alert(res);
                                }
                            }).catch(e=>{
                                console.log('approvalCheck==='+e);
                            })
                        }
                    }).catch(e=>{
                        console.log('setShipment_request==='+e);
                    })
                }
                this.dispatchEvent(new CloseActionScreenEvent());
                        // 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);
                //         }
                // });
            }
    }
    print() {
        getRentalApplyEquipmentSet({
            recordId: this.recordId
        }).then(result => {
            window.open("https://ocsm--partial.sandbox.lightning.force.com/apex/FixtureRentalPDF?raid=" + this.recordId + "&page=" + result);
        })
        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);
            }
    }
    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;
        // 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;
        // }
    }
}
force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js-meta.xml
@@ -1,10 +1,10 @@
<?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>
force-app/main/default/lwc/lexLoseReport/__tests__/lexLoseReport.test.js
New file
@@ -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);
    });
});
force-app/main/default/lwc/lexLoseReport/lexLoseReport.css
New file
@@ -0,0 +1,10 @@
.lexLoseReportHolder{
    position: relative;
    display: inline-block;
    width: 80px;
    height: 80px;
    text-align: center;
}
.container .uiContainerManager{
    display: none !important;
}
force-app/main/default/lwc/lexLoseReport/lexLoseReport.html
New file
@@ -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>
force-app/main/default/lwc/lexLoseReport/lexLoseReport.js
New file
@@ -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 }});
    }
}
force-app/main/default/lwc/lexLoseReport/lexLoseReport.js-meta.xml
New file
@@ -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>
force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.css
New file
@@ -0,0 +1,11 @@
.Holder{
    position: relative;
    display: inline-block;
    width: 80px;
    height: 80px;
    text-align: center;
}
.container .uiContainerManager{
    display : none !important;
}
force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="Holder" if:true={IsLoading}>
          <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
      </div>
</template>
force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.js
New file
@@ -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}');
}
force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.js-meta.xml
New file
@@ -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>
force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.css
New file
@@ -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 */
force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="sisToOPDHolder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.js
New file
@@ -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(() => {
                });
    }
}
force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.js-meta.xml
New file
@@ -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>
force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.css
New file
@@ -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 */
force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="opdToSISHolder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.js
New file
@@ -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 : '需要先点击[OSH现品收到]',
                            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(() => {
        });
    }
}
force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.js-meta.xml
New file
@@ -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>
force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.css
New file
@@ -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 */
force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.html
New file
@@ -0,0 +1,5 @@
<template>
   <div class="sisToOPDHolder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.js
New file
@@ -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(() => {
        });
    }
}
force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.js-meta.xml
New file
@@ -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>
force-app/main/default/lwc/lexQISSC/lexQISSC.css
New file
@@ -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 */
force-app/main/default/lwc/lexQISSC/lexQISSC.html
New file
@@ -0,0 +1,5 @@
<template>
   <div class="sisToOPDHolder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexQISSC/lexQISSC.js
New file
@@ -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 : '您没有新建QIS市场部权限。',
                            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 : '对应方法为返回且对应主机/消耗品为ET 或 ENG 或 EndoRapid 时,才可以新建。',
                            message: '',
                            variant: 'error'
                        });
                        this.dispatchEvent(new CloseActionScreenEvent());
                        return;
                }
            }
        }).catch(error => {
            console.log('error='+error);
        }).finally(() => {
        });
    }
}
force-app/main/default/lwc/lexQISSC/lexQISSC.js-meta.xml
New file
@@ -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>
force-app/main/default/lwc/lexQuotationProductNew/__tests__/lexQuotationProductNew.test.js
New file
@@ -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);
    });
});
force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.html
New file
@@ -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>
force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.js
New file
@@ -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 }});
      }
}
force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.js-meta.xml
New file
@@ -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>
force-app/main/default/lwc/lexQuotationRequest/__tests__/lexQuotationRequest.test.js
New file
@@ -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);
    });
});
force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.css
New file
@@ -0,0 +1,10 @@
.lexQuotationRequestHolder{
    position: relative;
    display: inline-block;
    width: 80px;
    height: 80px;
    text-align: center;
}
.container .uiContainerManager{
    display: none !important;
}
force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.html
New file
@@ -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>
force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.js
New file
@@ -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 }});
    }
}
force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.js-meta.xml
New file
@@ -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>
force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.css
New file
@@ -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 */
force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="sisToOPDHolder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.js
New file
@@ -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 : '需要先点击[OCM服务本部收到实物]',
                        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(() => {
                });
    }
}
force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.js-meta.xml
New file
@@ -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>
force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.css
New file
@@ -0,0 +1,11 @@
.Holder{
    position: relative;
    display: inline-block;
    width: 80px;
    height: 80px;
    text-align: center;
}
.container .uiContainerManager{
    display : none !important;
}
force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="Holder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
      </div>
</template>
force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.js
New file
@@ -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代码:
// {!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);
// }
force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.js-meta.xml
New file
@@ -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>
force-app/main/default/lwc/lexStockApply/__tests__/lexStockApply.test.js
New file
@@ -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);
    });
});
force-app/main/default/lwc/lexStockApply/lexStockApply.css
New file
@@ -0,0 +1,10 @@
.lexStockApplyHolder{
    position: relative;
    display: inline-block;
    width: 80px;
    height: 80px;
    text-align: center;
}
.container .uiContainerManager{
    display: none !important;
}
force-app/main/default/lwc/lexStockApply/lexStockApply.html
New file
@@ -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>
force-app/main/default/lwc/lexStockApply/lexStockApply.js
New file
@@ -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("备货申请状态不正确,不能提交备货申请。","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 }});
      }
}
force-app/main/default/lwc/lexStockApply/lexStockApply.js-meta.xml
New file
@@ -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>
force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.css
New file
@@ -0,0 +1,11 @@
.Holder{
    position: relative;
    display: inline-block;
    width: 80px;
    height: 80px;
    text-align: center;
}
.container .uiContainerManager{
    display : none !important;
}
force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.html
New file
@@ -0,0 +1,5 @@
<template>
    <!-- <div class="Holder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div> -->
</template>
force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js
New file
@@ -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);
        }
    }
}
*/
force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js-meta.xml
New file
@@ -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>
force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.css
New file
@@ -0,0 +1,11 @@
.Holder{
    position: relative;
    display: inline-block;
    width: 80px;
    height: 80px;
    text-align: center;
}
.container .uiContainerManager{
    display : none !important;
}
force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.html
New file
@@ -0,0 +1,5 @@
<template>
    <div class="Holder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js
New file
@@ -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();
*/
force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js-meta.xml
New file
@@ -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>
force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.css
New file
@@ -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 */
force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.html
New file
@@ -0,0 +1,5 @@
<template>
   <div class="sisToOPDHolder" if:true={IsLoading}>
        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
    </div>
</template>
force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.js
New file
@@ -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 : '状态为取消的QIS才可以被复制并新建',
                        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(() => {
        });
    }
}
force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.js-meta.xml
New file
@@ -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>
force-app/main/default/staticresources/connection20.js
New file
@@ -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;
}
force-app/main/default/staticresources/connection20.resource-meta.xml
New file
@@ -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>