From 74e6a383570060d05c58f731fa7cd9f241db50bd Mon Sep 17 00:00:00 2001
From: twysparks <twysparks@163.com>
Date: 星期四, 20 四月 2023 14:07:42 +0800
Subject: [PATCH] Merge branch 'LEX_dev' of http://47.92.229.245:8089/r/lightningupdate into LEX_dev

---
 force-app/main/default/classes/TransferApplyWebService.cls                                                 |  214 
 force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.html                                  |    3 
 force-app/main/default/classes/EquipmentRentalPicturePDFController.cls-meta.xml                            |    5 
 force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.js                                      |    9 
 force-app/main/default/lwc/lexOLYwinBid/lexOLYwinBid.css                                                   |   10 
 force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.html                            |    5 
 force-app/main/default/classes/FinLibraryButtonController3.cls                                             |   13 
 force-app/main/default/lwc/lexBidAnnouncementConsentButton/lexBidAnnouncementConsentButton.js-meta.xml     |   11 
 force-app/main/default/lwc/lexCancelReport/lexCancelReport.css                                             |   10 
 force-app/main/default/lwc/lexTenderingUsedAttachmentButton/lexTenderingUsedAttachmentButton.js-meta.xml   |   11 
 force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.js-meta.xml                                               |   11 
 force-app/main/default/lwc/lexQuotationProductNew/__tests__/lexQuotationProductNew.test.js                 |   25 
 force-app/main/default/lwc/lexSubmit/lexSubmit.css                                                         |   10 
 force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.js-meta.xml         |   11 
 force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.css                                                 |   22 
 force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.js                                                    |   20 
 force-app/main/default/lwc/lexOLYwinBid/lexOLYwinBid.js                                                    |   97 
 force-app/main/default/lwc/lexRequestDB/lexRequestDB.js-meta.xml                                           |   11 
 force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.html                                                      |    5 
 force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.html                      |    5 
 force-app/main/default/lwc/lexEquipmentRentalPicturePDF/lexEquipmentRentalPicturePDF.js-meta.xml           |   11 
 force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.html                |    5 
 force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.js                                            |   47 
 force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js                                      |   92 
 force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.js                  |   44 
 force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.html                                            |    5 
 force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.js                                                        |   61 
 force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.css                     |   22 
 force-app/main/default/lwc/lexTenderingIntentionButton/lexTenderingIntentionButton.html                    |    5 
 force-app/main/default/lwc/lexTenderingLogicButton/lexTenderingLogicButton.html                            |    5 
 force-app/main/default/classes/BidAnnouncementController.cls-meta.xml                                      |    5 
 force-app/main/default/classes/TenderingButtonController.cls                                               |    3 
 force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.html                                    |    5 
 force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.css                                               |   22 
 force-app/main/default/lwc/lexFinLibrary3/lexFinLibrary3.js-meta.xml                                       |   11 
 force-app/main/default/lwc/lexComplete/lexComplete.js                                                      |   26 
 force-app/main/default/lwc/lexBidAnnouncementApplyForButton/lexBidAnnouncementApplyForButton.js-meta.xml   |   11 
 force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js                            |  101 
 force-app/main/default/classes/OpportunityLightingButtonController.cls-meta.xml                            |    5 
 force-app/main/default/lwc/lexBidAnnouncementRejectButton/lexBidAnnouncementRejectButton.js                |   65 
 force-app/main/default/classes/AllReceivedFseController.cls                                                |   48 
 force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.js-meta.xml                     |   11 
 force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.js-meta.xml                 |   11 
 force-app/main/default/lwc/lexOLYwinBid/lexOLYwinBid.js-meta.xml                                           |   11 
 force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.js                                                  |  100 
 force-app/main/default/lwc/lexFinLibrary/lexFinLibrary.html                                                |    4 
 force-app/main/default/lwc/lexApplicationSubmitButton/lexApplicationSubmitButton.js                        |    8 
 force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js-meta.xml                       |   11 
 force-app/main/default/lwc/lexBidAnnouncementApplyForButton/lexBidAnnouncementApplyForButton.js            |   53 
 force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.css                               |   10 
 force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.html                                    |    5 
 force-app/main/default/lwc/lexBeforeOPDPDFBtnSIS/__tests__/lexBeforeOPDPDFBtnSIS.test.js                   |   25 
 force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.js                                              |  158 
 force-app/main/default/lwc/lexBeforeOPDPDFBtnSIS/lexBeforeOPDPDFBtnSIS.html                                |   14 
 force-app/main/default/classes/RentalApplyESetRefreshStatusController.cls                                  |  100 
 force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.js                                                      |   16 
 force-app/main/default/lwc/lexTenderingUsedAttachmentButton/lexTenderingUsedAttachmentButton.js            |   46 
 force-app/main/default/classes/SubmitExtensionApprovalProcessController.cls-meta.xml                       |    5 
 force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.css                                           |   22 
 force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.html                                      |   15 
 force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.css                         |   22 
 force-app/main/default/lwc/lexRequestDB/lexRequestDB.js                                                    |  107 
 force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js                                |    7 
 force-app/main/default/classes/RentalApplyControllerLWT.cls                                                |  290 
 force-app/main/default/lwc/lexFinLibrary/lexFinLibrary.js                                                  |   55 
 force-app/main/default/lwc/lexCancelApply/lexCancelApply.js                                                |  100 
 force-app/main/default/lwc/lexQISSC/lexQISSC.js-meta.xml                                                   |   11 
 force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js                                      |   39 
 force-app/main/default/lwc/lexSendQIS/lexSendQIS.html                                                      |    5 
 force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.css                         |   11 
 force-app/main/default/lwc/lexTenderingNotarizeButton/lexTenderingNotarizeButton.html                      |    5 
 force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.css                                     |   10 
 force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.html                    |    5 
 force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.css                                       |   10 
 force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.html                              |    5 
 force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.css                                                 |   10 
 force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.html                                                |    5 
 force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.css                                     |   11 
 force-app/main/default/classes/RentalApplyWebService.cls                                                   | 2069 +++++++
 force-app/main/default/lwc/lexSubmit/lexSubmit.js-meta.xml                                                 |   11 
 force-app/main/default/lwc/lexEquipmentRentalPicturePDF/lexEquipmentRentalPicturePDF.js                    |   41 
 force-app/main/default/lwc/lexTopInQueue/lexTopInQueue.js-meta.xml                                         |   11 
 force-app/main/default/lwc/lexTenderingNoStandardButton/lexTenderingNoStandardButton.js-meta.xml           |   11 
 force-app/main/default/classes/ControllerUtil.cls                                                          |    3 
 force-app/main/default/classes/UpdateTenderInformationBatch.cls-meta.xml                                   |    5 
 force-app/main/default/classes/LightingButtonConstant.cls                                                  |   13 
 force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.css                                                       |   22 
 force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.js                                              |  231 
 force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.js                                              |   20 
 force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.html                                              |    5 
 force-app/main/default/classes/ReturnDeliverySlipController.cls-meta.xml                                   |    5 
 force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js-meta.xml                             |   11 
 force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.js                                      |   73 
 force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.js-meta.xml                       |   11 
 force-app/main/default/lwc/lexRequestDB/lexRequestDB.html                                                  |    6 
 force-app/main/default/classes/loanerArrangedEmailController.cls                                           |   95 
 force-app/main/default/lwc/lexTenderingRelevancyButton/lexTenderingRelevancyButton.js                      |   60 
 force-app/main/default/lwc/lexLoseBid/lexLoseBid.css                                                       |   18 
 force-app/main/default/lwc/lexTenderingAntiLogicButton/lexTenderingAntiLogicButton.js                      |   52 
 force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.js-meta.xml                       |   11 
 force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.html                                    |   14 
 force-app/main/default/lwc/lexTenderingIntentionButton/lexTenderingIntentionButton.js-meta.xml             |   11 
 force-app/main/default/lwc/lexCancelApply/lexCancelApply.js-meta.xml                                       |   11 
 force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.js                    |    8 
 force-app/main/default/classes/OpportunityWebService.cls-meta.xml                                          |    5 
 force-app/main/default/classes/ReportController.cls                                                        |  104 
 force-app/main/default/classes/RentalApplyESetRefreshStatusController.cls-meta.xml                         |    5 
 force-app/main/default/lwc/lexRequestDB/lexRequestDB.css                                                   |   10 
 force-app/main/default/lwc/lexTenderingNoStandardButton/lexTenderingNoStandardButton.js                    |   49 
 force-app/main/default/classes/FinLibraryButtonController.cls-meta.xml                                     |    5 
 force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.html                              |    5 
 force-app/main/default/lwc/lexStockApply/lexStockApply.html                                                |    6 
 force-app/main/default/lwc/lexTenderingEnquiryButton/lexTenderingEnquiryButton.js                          |   62 
 force-app/main/default/classes/ApplyJsCtl.cls                                                              |   40 
 force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.js                          |   18 
 force-app/main/default/classes/ApplicationButtonController.cls                                             |   20 
 force-app/main/default/lwc/lexTenderingRelevancyButton/lexTenderingRelevancyButton.js-meta.xml             |   11 
 force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.js                                    |   35 
 force-app/main/default/lwc/lexFinLibrary/lexFinLibrary.js-meta.xml                                         |   11 
 force-app/main/default/lwc/lexPredictedDateChange/lexPredictedDateChange.js                                |   82 
 force-app/main/default/lwc/lexMainFixtureSelect/lexMainFixtureSelect.js-meta.xml                           |   11 
 force-app/main/default/classes/TransferApplyController.cls-meta.xml                                        |    5 
 force-app/main/default/lwc/lexCancelReport/lexCancelReport.html                                            |    6 
 force-app/main/default/lwc/rentalApplyLWT/rentalApplyLWT.html                                              |    5 
 force-app/main/default/lwc/lexCancelReport/lexCancelReport.js-meta.xml                                     |   11 
 force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.js                        |  107 
 force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.html            |    5 
 force-app/main/default/lwc/lexBidAnnouncementConsentButton/lexBidAnnouncementConsentButton.html            |    5 
 force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.js-meta.xml                                     |   11 
 force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.js-meta.xml                                       |   11 
 force-app/main/default/classes/BidAnnouncementController.cls                                               |  106 
 force-app/main/default/lwc/lexBeforeOPDPDFBtnSIS/lexBeforeOPDPDFBtnSIS.js-meta.xml                         |   11 
 force-app/main/default/lwc/lexCreateEvent/__tests__/lexCreateEvent.test.js                                 |   25 
 force-app/main/default/lwc/lexSendQIS/lexSendQIS.css                                                       |   22 
 force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.js                                        |  198 
 force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.css                           |   11 
 force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.css                 |   10 
 force-app/main/default/lwc/lexBeforeOPDPDFBtn/__tests__/lexBeforeOPDPDFBtn.test.js                         |   25 
 force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.js                                                |  101 
 force-app/main/default/lwc/lexTenderingNotarizeButton/lexTenderingNotarizeButton.js-meta.xml               |   11 
 force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.js-meta.xml                             |   11 
 force-app/main/default/lwc/lexBidAnnouncementApplyForButton/lexBidAnnouncementApplyForButton.html          |    5 
 force-app/main/default/lwc/lexStockApply/__tests__/lexStockApply.test.js                                   |   25 
 force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.js-meta.xml |   11 
 force-app/main/default/lwc/lexTenderingEnquiryButton/lexTenderingEnquiryButton.html                        |    5 
 force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.js                      |   98 
 force-app/main/default/lwc/lexTopInQueue/lexTopInQueue.js                                                  |   49 
 force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.html                                      |    6 
 force-app/main/default/lwc/lexLoseBid/__tests__/lexLoseBid.test.js                                         |   25 
 force-app/main/default/lwc/lexTopInQueue/lexTopInQueue.css                                                 |   22 
 force-app/main/default/classes/FinLibraryButtonController3.cls-meta.xml                                    |    5 
 force-app/main/default/lwc/rentalApplyLWT/rentalApplyLWT.css                                               |   11 
 force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.html                                            |    5 
 force-app/main/default/lwc/lexStockApply/lexStockApply.js                                                  |  114 
 force-app/main/default/lwc/lexFinLibrary2/lexFinLibrary2.js                                                |   62 
 force-app/main/default/lwc/lexLoseBid/lexLoseBid.html                                                      |    6 
 force-app/main/default/lwc/lexLoseBid/lexLoseBid.js                                                        |   89 
 force-app/main/default/lwc/lexOPDtoSIS/lexOPDtoSIS.js                                                      |   20 
 force-app/main/default/classes/UpdateTenderInformationBatch.cls                                            | 1310 ++++
 force-app/main/default/lwc/lexCreateEvent/lexCreateEvent.js-meta.xml                                       |   11 
 force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.js                                                    |   49 
 force-app/main/default/lwc/lexFinLibrary3/lexFinLibrary3.html                                              |    4 
 force-app/main/default/classes/OpportunityLightingButtonController.cls                                     |  524 +
 force-app/main/default/lwc/lexEquipmentRentalPicturePDF/lexEquipmentRentalPicturePDF.html                  |    5 
 force-app/main/default/lwc/lexLoseReport/lexLoseReport.html                                                |    6 
 force-app/main/default/lwc/lexFinLibrary3/lexFinLibrary3.css                                               |   11 
 force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.js                                                    |   22 
 force-app/main/default/lwc/lexPredictedDateChange/lexPredictedDateChange.html                              |    6 
 force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.js                                              |   53 
 force-app/main/default/lwc/lexMainFixtureSelect/lexMainFixtureSelect.js                                    |   33 
 force-app/main/default/lwc/lexSendQIS/lexSendQIS.js                                                        |  121 
 force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.js-meta.xml     |   11 
 force-app/main/default/staticresources/connection20.resource-meta.xml                                      |    5 
 force-app/main/default/staticresources/connection20.js                                                     | 1935 ++++++
 force-app/main/default/lwc/lexReturnDeliverySlip/lexReturnDeliverySlip.css                                 |   22 
 force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.js                                                    |   20 
 force-app/main/default/classes/OpportunityWebService.cls                                                   |  506 +
 force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.js                        |   17 
 force-app/main/default/lwc/lexBeforeOPDPDFBtnSIS/lexBeforeOPDPDFBtnSIS.js                                  |   97 
 force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.html                        |    5 
 force-app/main/default/lwc/lexFinLibrary3/lexFinLibrary3.js                                                |   58 
 force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.html                                            |    5 
 force-app/main/default/lwc/lexTenderingNoStandardButton/lexTenderingNoStandardButton.html                  |    5 
 force-app/main/default/lwc/lexOLYwinBid/lexOLYwinBid.html                                                  |    6 
 force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.html                          |    5 
 force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.js-meta.xml                               |   11 
 force-app/main/default/lwc/lexBidAnnouncementConsentButton/lexBidAnnouncementConsentButton.js              |   53 
 force-app/main/default/lwc/lexVOCConfirm/lexVOCConfirm.js                                                  |   21 
 force-app/main/default/lwc/lexTenderingIntentionButton/lexTenderingIntentionButton.js                      |   52 
 force-app/main/default/lwc/lexTenderingLogicButton/lexTenderingLogicButton.js-meta.xml                     |   11 
 force-app/main/default/lwc/lexBidAnnouncementRejectButton/lexBidAnnouncementRejectButton.html              |    5 
 force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.js-meta.xml                                         |   11 
 force-app/main/default/lwc/rentalApplyLWT/rentalApplyLWT.js-meta.xml                                       |   11 
 force-app/main/default/classes/TransferApplyWebService.cls-meta.xml                                        |    5 
 force-app/main/default/lwc/lexQISSC/lexQISSC.html                                                          |    5 
 force-app/main/default/lwc/lexFinLibrary2/lexFinLibrary2.html                                              |    4 
 force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.css                                             |   11 
 force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.js-meta.xml             |   11 
 force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.html                                                |    5 
 force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.css                                       |   10 
 force-app/main/default/lwc/lexRequestDB/__tests__/lexRequestDB.test.js                                     |   25 
 force-app/main/default/lwc/lexCancelSubmitReport/lexCancelSubmitReport.js                                  |   19 
 force-app/main/default/classes/Add_Report.cls                                                              |  565 +
 force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.js                        |    6 
 force-app/main/default/lwc/lexMainFixtureSelect/lexMainFixtureSelect.css                                   |   22 
 force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.js-meta.xml                                     |   11 
 force-app/main/default/classes/QISReportController.cls                                                     |  475 +
 force-app/main/default/classes/RentalApplyControllerLWT.cls-meta.xml                                       |    5 
 force-app/main/default/classes/TransferApplyController.cls                                                 |   31 
 force-app/main/default/lwc/lexFinLibrary2/lexFinLibrary2.js-meta.xml                                       |   11 
 force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.html                        |    5 
 force-app/main/default/lwc/lexLoseReport/lexLoseReport.js                                                  |  102 
 force-app/main/default/lwc/lexTenderingRelevancyButton/lexTenderingRelevancyButton.html                    |    5 
 force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.css                       |   11 
 force-app/main/default/lwc/lexTenderingUsedAttachmentButton/lexTenderingUsedAttachmentButton.html          |    5 
 force-app/main/default/classes/AllReceivedFseController.cls-meta.xml                                       |    5 
 force-app/main/default/lwc/lexTenderingNotarizeButton/lexTenderingNotarizeButton.js                        |   72 
 force-app/main/default/lwc/lexQuotationRequest/__tests__/lexQuotationRequest.test.js                       |   25 
 force-app/main/default/lwc/lexFinLibrary2/lexFinLibrary2.css                                               |   11 
 force-app/main/default/classes/ReturnDeliverySlipController.cls                                            |   37 
 force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.js                          |   39 
 force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js-meta.xml                   |   11 
 force-app/main/default/classes/FinLibraryButtonController.cls                                              |   24 
 force-app/main/default/lwc/lexCreateEvent/lexCreateEvent.js                                                |   59 
 force-app/main/default/lwc/lexPredictedDateChange/__tests__/lexPredictedDateChange.test.js                 |   25 
 force-app/main/default/lwc/lexQISSC/lexQISSC.js                                                            |   96 
 force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.css                               |   11 
 force-app/main/default/lwc/lexLoseBid/lexLoseBid.js-meta.xml                                               |   11 
 force-app/main/default/lwc/lexPredictedDateChange/lexPredictedDateChange.css                               |   10 
 force-app/main/default/lwc/lexMainFixtureSelect/lexMainFixtureSelect.html                                  |    5 
 force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.js-meta.xml                                     |   11 
 force-app/main/default/lwc/lexCancelApply/lexCancelApply.html                                              |    4 
 force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.html                              |    6 
 force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.js                                        |  108 
 force-app/main/default/lwc/lexCreateEvent/lexCreateEvent.html                                              |    6 
 force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js                                                      |   13 
 force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.html        |    5 
 force-app/main/default/classes/rentalApplyEquipmentRentalPDFController.cls                                 |   25 
 force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.js              |   91 
 force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js-meta.xml                             |   11 
 force-app/main/default/lwc/lexStockApply/lexStockApply.js-meta.xml                                         |   11 
 force-app/main/default/classes/FinLibraryButtonController2.cls-meta.xml                                    |    5 
 force-app/main/default/classes/OpportunityService.cls-meta.xml                                             |    5 
 force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.js          |   67 
 force-app/main/default/lwc/lexTenderingEnquiryButton/lexTenderingEnquiryButton.js-meta.xml                 |   11 
 force-app/main/default/lwc/lexCancelReport/lexCancelReport.js                                              |  116 
 force-app/main/default/lwc/lexReturnDeliverySlip/lexReturnDeliverySlip.js                                  |   53 
 force-app/main/default/lwc/lexSubmit/lexSubmit.js                                                          |   68 
 force-app/main/default/classes/SelectSubstituteControllerLWT.cls                                           |  633 ++
 force-app/main/default/lwc/lexEquipmentRentalPicturePDF/lexEquipmentRentalPicturePDF.css                   |   22 
 force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.js-meta.xml                           |   11 
 force-app/main/default/lwc/lexLoseReport/__tests__/lexLoseReport.test.js                                   |   25 
 force-app/main/default/classes/ApplyJsCtl.cls-meta.xml                                                     |    5 
 force-app/main/default/lwc/lexApplicationCancelSubmit/lexApplicationCancelSubmit.js                        |   10 
 force-app/main/default/lwc/lexSubmit/lexSubmit.html                                                        |    7 
 force-app/main/default/classes/FinLibraryButtonController2.cls                                             |   24 
 force-app/main/default/classes/SubmitExtensionApprovalProcessController.cls                                |   42 
 force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.js                                |   38 
 force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.js                              |   89 
 force-app/main/default/classes/OpportunityService.cls                                                      |  457 +
 force-app/main/default/lwc/lexLoseReport/lexLoseReport.css                                                 |   10 
 force-app/main/default/lwc/lexStockApply/lexStockApply.css                                                 |   10 
 force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.js                                                  |  103 
 force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.css                                     |   11 
 force-app/main/default/lwc/lexQISSC/lexQISSC.css                                                           |   22 
 force-app/main/default/lwc/lexTenderingAntiLogicButton/lexTenderingAntiLogicButton.html                    |    5 
 force-app/main/default/classes/EquipmentRentalPicturePDFController.cls                                     |   32 
 force-app/main/default/lwc/rentalApplyLWT/rentalApplyLWT.js                                                |  659 ++
 force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.css                                             |   10 
 force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.css                             |   10 
 force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.js-meta.xml                 |   11 
 force-app/main/default/classes/TenderWebService.cls                                                        |   83 
 force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.js-meta.xml                                         |   11 
 force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.css                                             |   11 
 force-app/main/default/lwc/lexPredictedDateChange/lexPredictedDateChange.js-meta.xml                       |   11 
 force-app/main/default/lwc/lexAgencyAuthorize/__tests__/lexAgencyAuthorize.test.js                         |   25 
 force-app/main/default/lwc/lexCancel/lexCancel.js                                                          |   29 
 force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js                                |  258 
 force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.js-meta.xml                                   |   11 
 force-app/main/default/lwc/lexReturnDeliverySlip/lexReturnDeliverySlip.js-meta.xml                         |   11 
 force-app/main/default/lwc/lexOLYwinBid/__tests__/lexOLYwinBid.test.js                                     |   25 
 force-app/main/default/lwc/lexBeforeOPDPDFBtnSIS/lexBeforeOPDPDFBtnSIS.css                                 |   10 
 force-app/main/default/classes/TenderWebService.cls-meta.xml                                               |    5 
 force-app/main/default/classes/MonthlyReportController.cls                                                 |   11 
 force-app/main/default/classes/loanerArrangedEmailController.cls-meta.xml                                  |    5 
 force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.js-meta.xml               |   11 
 force-app/main/default/classes/Add_Report.cls-meta.xml                                                     |    5 
 force-app/main/default/lwc/lexCancelReport/__tests__/lexCancelReport.test.js                               |   25 
 force-app/main/default/lwc/lexFinLibrary/lexFinLibrary.css                                                 |   11 
 force-app/main/default/lwc/lexBidAnnouncementRejectButton/lexBidAnnouncementRejectButton.js-meta.xml       |   11 
 force-app/main/default/lwc/lexTenderingLogicButton/lexTenderingLogicButton.js                              |   39 
 force-app/main/default/lwc/lexReturnDeliverySlip/lexReturnDeliverySlip.html                                |    5 
 force-app/main/default/lwc/lexSendQIS/lexSendQIS.js-meta.xml                                               |   11 
 force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.js                                      |   18 
 force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.js                                              |   31 
 force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.js                          |  105 
 force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.js                                |   67 
 force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.css             |   11 
 force-app/main/default/lwc/lexTenderingAntiLogicButton/lexTenderingAntiLogicButton.js-meta.xml             |   11 
 force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.js-meta.xml                               |   11 
 force-app/main/default/classes/rentalApplyEquipmentRentalPDFController.cls-meta.xml                        |    5 
 /dev/null                                                                                                  |    4 
 force-app/main/default/classes/SelectSubstituteControllerLWT.cls-meta.xml                                  |    5 
 force-app/main/default/lwc/lexLoseReport/lexLoseReport.js-meta.xml                                         |   11 
 force-app/main/default/classes/RentalApplyWebService.cls-meta.xml                                          |    5 
 force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.html                                          |    5 
 force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.css         |   10 
 force-app/main/default/lwc/lexTopInQueue/lexTopInQueue.html                                                |    5 
 308 files changed, 17,447 insertions(+), 162 deletions(-)

diff --git a/.husky/pre-commit b/.husky/pre-commit
deleted file mode 100644
index feac116..0000000
--- a/.husky/pre-commit
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-. "$(dirname "$0")/_/husky.sh"
-
-npm run precommit
\ No newline at end of file
diff --git a/force-app/main/default/classes/Add_Report.cls b/force-app/main/default/classes/Add_Report.cls
new file mode 100644
index 0000000..b1ea2b3
--- /dev/null
+++ b/force-app/main/default/classes/Add_Report.cls
@@ -0,0 +1,565 @@
+global class Add_Report {
+	// TODO report銇甶d銇ф绱€仒銈冦仾銇忋�乪vent_id__c銇ф绱�
+	WebService static String addReportPr(String repOwnerId, String reportId, String dailyReportId, String eventId, String recordType, String aId, String visitor1, String visitor2, String visitor3, String visitor4,String visitor5, String description, String reportDate){
+		String rt = selectRecordType(recordType);
+		List<Account> aList = selectAccount(aId);
+
+		if(reportId != null && reportId != ''){
+			List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Practitioner5__c, Comment__c from Report__c where id =:reportId];
+			if (rList.size() > 0) {
+				return rList.get(0).id;
+			}
+		}
+
+		Report__c r = new Report__c();
+
+		if(aList.size() != 0){
+			Account a = aList.get(0);
+			r.Hospital_Department__c = a.Id;
+			r.Department_Class_Ref__c = a.Department_Class__r.Id;
+			r.Hospital_Reference__c = a.Hospital__r.Id;
+		} else {
+			r.Manual_Name__c = aId;
+		}
+
+		r.Daily_Report__c = dailyReportId;
+		r.OwnerId = repOwnerId;
+		r.RecordTypeId = rt;
+		r.Event_Id__c = eventId;
+		if(reportDate != null && reportDate != ''){
+			r.Date__c = date.parse(reportDate);
+		}
+		if(visitor1 != null && visitor1 != ''){
+			r.Practitioner1__c = visitor1;
+		}
+		if(visitor2 != null && visitor2 != ''){
+			r.Practitioner2__c = visitor2;
+		}
+		if(visitor3 != null && visitor3 != ''){
+			r.Practitioner3__c = visitor3;
+		}
+		if(visitor4 != null && visitor4 != ''){
+			r.Practitioner4__c = visitor4;
+		}
+		if(visitor5 != null && visitor5 != ''){
+			r.Practitioner5__c = visitor5;
+		}
+		r.Comment__c = description;
+		upsert r;
+
+		updateEvent(r.id,eventId,recordType);
+
+		return r.id;
+	}
+
+	WebService static String addReportOP(String repOwnerId, String reportId, String dailyReportId, String eventId, String recordType, String aId, String visitor1, String visitor2, String visitor3, String visitor4, String visitor5, String opp1, String opp2, String opp3, String opp4, String opp5, String reportDate){
+		return addReportOPWithEvaluationPDF(repOwnerId, reportId, dailyReportId, eventId, recordType, aId, visitor1, visitor2, visitor3, visitor4, visitor5, opp1, opp2, opp3, opp4, opp5, reportDate, '', '', '', '');
+	}
+	WebService static String addReportOP2(String repOwnerId, String reportId, String dailyReportId, String eventId, String recordType, String aId, String visitor1, String visitor2, String visitor3, String visitor4, String visitor5, String opp1, String opp2, String opp3, String opp4, String opp5, String reportDate, String sTime, String eTime){
+		return addReportOPWithEvaluationPDF(repOwnerId, reportId, dailyReportId, eventId, recordType, aId, visitor1, visitor2, visitor3, visitor4, visitor5, opp1, opp2, opp3, opp4, opp5, reportDate, '', '', sTime, eTime);
+	}
+	@AuraEnabled
+	WebService static String addReportOPWithEvaluationPDF(String repOwnerId, String reportId, String dailyReportId, String eventId, String recordType, String aId, String visitor1, String visitor2, String visitor3, String visitor4, String visitor5, String opp1, String opp2, String opp3, String opp4, String opp5, String reportDate, String evaluationPDFNumber, String pro1, String sTime, String eTime) {
+		String rt = selectRecordType(recordType);
+		List<Account> aList = selectAccount(aId);
+
+		if(reportId != null && reportId != ''){
+			List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Practitioner5__c, Opportunity1__c, Opportunity2__c, Opportunity3__c, Opportunity4__c, Opportunity5__c from Report__c where id =:reportId];
+			if(rList.size() > 0){
+				return rList.get(0).id;
+			}
+		}
+
+		Report__c r = new Report__c();
+		
+		if(aList.size() != 0){
+			Account a = aList.get(0);
+			r.Hospital_Department__c = a.Id;
+			r.Department_Class_Ref__c = a.Department_Class__r.Id;
+			r.Hospital_Reference__c = a.Hospital__r.Id;
+		} else {
+			r.Manual_Name__c = aId;
+		}
+
+		if (String.isBlank(dailyReportId) == false) r.Daily_Report__c = dailyReportId;
+		r.OwnerId = repOwnerId;
+		r.RecordTypeId = rt;
+		if (String.isBlank(eventId) == false) r.Event_Id__c = eventId;
+		r.Evaluation_PDF_number__c = evaluationPDFNumber;
+		if(reportDate != null && reportDate != ''){
+			r.Date__c = date.parse(reportDate);
+		}
+		if(visitor1 != null && visitor1 != ''){
+			r.Practitioner1__c = visitor1;
+		}
+		if(visitor2 != null && visitor2 != ''){
+			r.Practitioner2__c = visitor2;
+		}
+		if(visitor3 != null && visitor3 != ''){
+			r.Practitioner3__c = visitor3;
+		}
+		if(visitor4 != null && visitor4 != ''){
+			r.Practitioner4__c = visitor4;
+		}
+		if(visitor5 != null && visitor5 != ''){
+			r.Practitioner5__c = visitor5;
+		}
+
+		List<String> oppIdList = new List<String>();
+		if(opp1 != null && opp1 != ''){
+			oppIdList.add(opp1);
+		}
+		if(opp2 != null && opp2 != ''){
+			oppIdList.add(opp2);
+		}
+		if(opp3 != null && opp3 != ''){
+			oppIdList.add(opp3);
+		}
+		if(opp4 != null && opp4 != ''){
+			oppIdList.add(opp4);
+		}
+		if(opp5 != null && opp5 != ''){
+			oppIdList.add(opp5);
+		}
+
+		if(oppIdList.size() > 0){
+			if(opp1 != null && opp1 != ''){
+				r.Opportunity1__c = opp1;
+			}
+			if(opp2 != null && opp2 != ''){
+				r.Opportunity2__c = opp2;
+			}
+			if(opp3 != null && opp3 != ''){
+				r.Opportunity3__c = opp3;
+			}
+			if(opp4 != null && opp4 != ''){
+				r.Opportunity4__c = opp4;
+			}
+			if(opp5 != null && opp5 != ''){
+				r.Opportunity5__c = opp5;
+			}
+			r.Opportunity_Situation__c = '寮曞悎鐧虹敓';
+		}
+		else{
+			r.Opportunity_Situation__c = '寮曞悎鐒�';
+		}
+		
+		if (String.isBlank(pro1) == false) {
+			r.Product1__c = pro1;
+		}
+
+		if (sTime != null && sTime != '') {
+			r.Operation_From__c = datetime.parse(sTime);
+		}
+		if (eTime != null && eTime != '') {
+			r.Operation_To__c = datetime.parse(eTime);
+		}
+		upsert r;
+
+		if (String.isBlank(eventId) == false) updateEvent(r.id,eventId,recordType);
+
+		return r.id;
+	}
+
+	WebService static String addReportNT(String repOwnerId, String reportId, String dailyReportId, String eventId, String recordType, String aId, String visitor1, String visitor2, String visitor3, String visitor4, String visitor5, String sTime, String eTime, String mainPlace){
+		String rt = selectRecordType(recordType);
+		List<Account> aList = selectAccount(aId);
+
+		if(reportId != null && reportId != ''){
+			List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Practitioner5__c, From__c, To__c, Location__c from Report__c where id =:reportId];
+			if(rList.size() > 0){
+				return rList.get(0).id;
+			}
+		}
+
+		Report__c r = new Report__c();
+
+		if(aList.size() != 0){
+			Account a = aList.get(0);
+			r.Hospital_Department__c = a.Id;
+			r.Department_Class_Ref__c = a.Department_Class__r.Id;
+			r.Hospital_Reference__c = a.Hospital__r.Id;
+		} else {
+			r.Manual_Name__c = aId;
+		}
+
+		r.Daily_Report__c = dailyReportId;
+		r.OwnerId = repOwnerId;
+		r.RecordTypeId = rt;
+		r.Event_Id__c = eventId;
+		if(visitor1 != null && visitor1 != ''){
+			r.Practitioner1__c = visitor1;
+		}
+		if(visitor2 != null && visitor2 != ''){
+			r.Practitioner2__c = visitor2;
+		}
+		if(visitor3 != null && visitor3 != ''){
+			r.Practitioner3__c = visitor3;
+		}
+		if(visitor4 != null && visitor4 != ''){
+			r.Practitioner4__c = visitor4;
+		}
+		if(visitor5 != null && visitor5 != ''){
+			r.Practitioner5__c = visitor5;
+		}
+		if(sTime != null && sTime != ''){
+			//sTime = sTime.substring(0,16);
+			r.From__c = datetime.parse(sTime);
+		}
+		if(eTime != null && eTime != ''){
+			//eTime = eTime.substring(0,16);
+			r.To__c = datetime.parse(eTime);
+		}
+		r.Location__c = mainPlace;
+		upsert r;
+
+		updateEvent(r.id,eventId,recordType);
+
+		return r.id;
+	}
+
+	WebService static String addReportOn(String repOwnerId, String reportId, String dailyReportId, String eventId, String recordType, String aId, String reportDate, String v1Str, String startHour, String startMin, String endHour, String endMin, String description){
+		List<Account> aList = selectAccount(aId);
+
+		if(reportId != null && reportId != ''){
+			List<On_Call__c> oList = [select id, Daily_Report__c, Event_Id__c, segment__c from On_Call__c where id =:reportId];
+			if(oList.size() > 0){
+				return oList.get(0).id;
+			}
+		}
+		
+		On_Call__c o = new On_Call__c();
+		
+		if(aList.size() != 0){
+			Account a = aList.get(0);
+			o.segment__c = a.Id;
+			// 鐥呴櫌ID(18妗�)宸炯銇�
+			o.Hospital__c = a.Hospital__r.Id;
+		}
+
+		o.Daily_Report__c = dailyReportId;
+		o.OwnerId = repOwnerId;
+		o.Event_Id__c = eventId;
+		o.Responsible_Person_HP__c = v1Str;
+		if(String.isBlank(description) == false){
+			if(description.length() > 255){
+				o.Customer_Problem_c__c = description.substring(0, 255);
+			} else {
+				o.Customer_Problem_c__c = description;
+			}
+
+		}
+		Date rDate = date.parse(reportDate);
+		o.From_c__c = Datetime.newInstance(rDate.year(), rDate.month(), rDate.day(), Integer.valueOf(startHour), Integer.valueOf(StartMin), 0);
+		o.To_c__c = Datetime.newInstance(rDate.year(), rDate.month(), rDate.day(), Integer.valueOf(endHour), Integer.valueOf(endMin), 0);
+
+		upsert o;
+		
+		updateEvent(o.id,eventId,recordType);
+		
+		return o.id;
+	}
+	
+	WebService static String addReportAc(String repOwnerId, String reportId, String dailyReportId, String eventId, String recordType, String aId, String reportDate, String description){
+		List<Account> aList = selectAccount(aId);
+
+		if(reportId != null && reportId != ''){
+			List<Visit_Report__c> rList = [select id, Daily_Report__c, Event_Id__c, Hospital_Reference__c, Department_Class__c, Department__c, Date__c from Visit_Report__c where id =:reportId];
+			if(rList.size() > 0){
+				return rList.get(0).id;
+			}
+		}
+
+		Visit_Report__c r = new Visit_Report__c();
+
+		if(aList.size() != 0){
+			Account a = aList.get(0);
+			r.Hospital_Reference__c = a.Hospital__r.Id;
+			r.Department_Class__c = a.Department_Class__r.Id;
+			r.Department__c = a.Id;
+//        } else {
+//            r.Manual_Name__c = aId;
+		}
+		
+		r.Daily_Report__c = dailyReportId;
+		r.OwnerId = repOwnerId;
+		r.Event_Id__c = eventId;
+		r.Evaluate_And_Problem__c = description;
+		if(reportDate != null && reportDate != ''){
+			r.Date__c = date.parse(reportDate);
+		}
+
+		upsert r;
+
+		updateEvent(r.id,eventId,recordType);
+
+		return r.id;
+	}
+	
+	WebService static String addClaim(String repOwnerId, String reportId, String dailyReportId, String eventId, String recordType, String aId, String reportDate, String description){
+		List<Account> aList = selectAccount(aId);
+
+		if(reportId != null && reportId != ''){
+			List<QIS_Report__c> rList = [select id, Daily_Report__c, Event_Id__c, Hospital_Department__c, Date__c from QIS_Report__c where id =:reportId];
+			if(rList.size() > 0){
+				return rList.get(0).id;
+			}
+		}
+
+		QIS_Report__c r = new QIS_Report__c();
+
+		if(aList.size() != 0){
+			Account a = aList.get(0);
+			r.Hospital_Department__c = a.Id;
+			r.Department_Class__c = a.Department_Class__r.Id;
+			r.Hospital__c = a.Hospital__r.Id;
+		}
+		r.Daily_Report__c = dailyReportId;
+		r.OwnerId = repOwnerId;
+		r.Event_Id__c = eventId;
+		//r.Department_Class_Ref__c = a.Department_Class__r.Id;
+		//r.Hospital_Reference__c = a.Hospital__r.Id;
+		r.problem_detail__c = description;
+		if(reportDate != null && reportDate != ''){
+			r.Date__c = date.parse(reportDate);
+		}
+		r.Generation_Source__c = '鏃ユ姤';
+		r.Name = '*';
+
+		upsert r;
+
+		updateEvent(r.id,eventId,recordType);
+
+		return r.id;
+	}
+
+	// MarketCondition or Competitor
+	WebService static String addReportEx(String repOwnerId, String reportId, String dailyReportId, String eventId, String recordType, String aId, String visitor1, String reportDate, String description){
+		String rt = selectRecordType(recordType);
+		List<Account> aList = selectAccount(aId);
+
+		if(reportId != null && reportId != ''){
+			List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Practitioner5__c, Comment__c from Report__c where id =:reportId];
+			if(rList.size() > 0){
+				return rList.get(0).id;
+			}
+		}
+		Report__c r = new Report__c();
+		if(aList.size() != 0){
+			Account a = aList.get(0);
+			r.Hospital_Department__c = a.Id;
+			r.Department_Class_Ref__c = a.Department_Class__r.Id;
+			r.Hospital_Reference__c = a.Hospital__r.Id;
+		}
+		r.Daily_Report__c = dailyReportId;
+		r.OwnerId = repOwnerId;
+		r.RecordTypeId = rt;
+		r.Event_Id__c = eventId;
+		if (String.isBlank(visitor1) == false) {
+			r.Person_In_Charge__c = visitor1;
+		}
+		if(reportDate != null && reportDate != ''){
+			r.Date__c = date.parse(reportDate);
+		}
+		r.Comment__c = description;
+
+		upsert r;
+
+		updateEvent(r.id,eventId,recordType);
+
+		return r.id;
+	}
+
+
+	WebService static String addReportIm(String repOwnerId, String reportId, String dailyReportId, String eventId, String recordType, String aId, String reportDate, String description){
+		String rt = selectRecordType(recordType);
+		List<Account> aList = selectAccount(aId);
+
+		if(reportId != null && reportId != ''){
+			List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Practitioner5__c, Comment__c from Report__c where id =:reportId];
+			if(rList.size() > 0){
+				return rList.get(0).id;
+			}
+		}
+
+		Report__c r = new Report__c();
+
+		if(aList.size() != 0){
+			Account a = aList.get(0);
+			r.Hospital_Reference__c = a.Hospital__r.Id;
+		}
+
+		r.Daily_Report__c = dailyReportId;
+		r.OwnerId = repOwnerId;
+		r.RecordTypeId = rt;
+		r.Event_Id__c = eventId;
+		if(reportDate != null && reportDate != ''){
+			r.Date__c = date.parse(reportDate);
+		}
+		r.Comment__c = description;
+
+		upsert r;
+
+		updateEvent(r.id,eventId,recordType);
+
+		return r.id;
+	}
+
+//    // Maintenance_Contract
+//    WebService static String addMC(String repOwnerId, String reportId, String dailyReportId, String eventId, String recordType, String aId, String reportDate, String description){
+//        List<Account> aList = selectAccount(aId);
+//
+//        if(reportId != null && reportId != ''){
+//            List<Maintenance_Contract__c> rList = [select id, Daily_Report__c, Event_Id__c from Maintenance_Contract__c where id =:reportId];
+//            if(rList.size() > 0){
+//                return rList.get(0).id;
+//            }
+//        }
+//
+//        Maintenance_Contract__c r = new Maintenance_Contract__c();
+//
+//        if(aList.size() != 0){
+//            Account a = aList.get(0);
+//            r.Hospital__c = a.Hospital__r.Id;
+//            r.Department_Class__c = a.Department_Class__r.Id;
+//            r.Department__c = a.Id;
+//        }
+//        
+//        r.Daily_Report__c = dailyReportId;
+//        r.Event_Id__c = eventId;
+//        r.Description__c = description;
+////        if(reportDate != null && reportDate != ''){
+////            r.Estimation_Create_Date__c = date.parse(reportDate);
+////        }
+//
+//        upsert r;
+//
+//        updateEvent(r.id,eventId,recordType);
+//
+//        return r.id;
+//    }
+
+	// Rental_Apply
+	WebService static String addRA(String repOwnerId, String reportId, String dailyReportId, String eventId, String recordType, String aId, String reportDate, String description,String followOpps){
+		List<Account> aList = selectAccount(aId);
+
+		if(reportId != null && reportId != ''){
+			List<Rental_Apply__c> rList = [select id, Daily_Report__c, Event_Id__c from Rental_Apply__c where id =:reportId];
+			if(rList.size() > 0){
+				return rList.get(0).id;
+			}
+		}
+
+		Rental_Apply__c r = new Rental_Apply__c();
+
+		if(aList.size() != 0){
+			Account a = aList.get(0);
+			r.Hospital__c = a.Hospital__r.Id;
+			r.Strategic_dept__c = a.Department_Class__r.Id;
+			r.Account__c = a.Id;
+		}
+		
+		r.Daily_Report__c = dailyReportId;
+		r.Event_Id__c = eventId;
+		r.Demo_purpose_text__c = description;
+		r.Request_return_day__c = Date.today();
+		r.Person_In_Charge__c = repOwnerId;
+		r.applyUser__c = repOwnerId;
+		if(followOpps!=null&&followOpps!=''){
+			r.Follow_UP_Opp__c = followOpps;
+		}
+		upsert r;
+
+		updateEvent(r.id,eventId,recordType);
+
+		return r.id;
+	}
+	
+	WebService static String selectRecordType(String recordTypeName){
+		List<RecordType> rtList = [select id from RecordType where IsActive = true and DeveloperName =:recordTypeName];
+		return rtList.get(0).id;
+	}
+
+	WebService static List<Account> selectAccount(String aId){
+		List<Account> aList = new List<Account>();
+		if (aId != null && aId.startsWith('001')) {
+			aList = [select Id, Department_Class__r.Id, Hospital__r.Id from Account where Id =:aId];
+		}
+		return aList;
+	}
+
+	WebService static void updateEvent(String rId, String eventId, String recordType){
+		Event__c e = [
+			select id,Maintenance_Contract_ID__c, Asset_Manual_ID__c, Rental_Apply_ID__c,
+				   Product_Description_Id__c, OPD_ID__c, NTC_ID__c, ReportAccompanied_ID__c, CityStatus_ID__c, Improvement_ID__c, Conflict_ID__c, Claim_ID__c
+			  from Event__c where id =:eventId
+		];
+//        if(recordType == 'Maintenance_Contract'){
+//            e.Maintenance_Contract_ID__c = rId;
+//        }
+		if(recordType == 'Rental_Apply'){
+			e.Rental_Apply_ID__c = rId;
+		}
+		if(recordType == 'Asset_Manual'){
+			e.Asset_Manual_ID__c = rId;
+		}
+		if(recordType == 'Product_Explanation'){
+			e.Product_Description_Id__c = rId;
+		}
+		else if(recordType == 'OPD' || recordType == 'SIS'){
+			e.OPD_ID__c = rId;
+		}
+		else if(recordType == 'NTC'){
+			e.NTC_ID__c = rId;
+		}
+		else if(recordType == 'On_Call'){
+			e.OnCall_ID__c = rId;
+		}
+		else if(recordType == 'Visit_With'){
+			e.ReportAccompanied_ID__c = rId;
+		}
+		else if(recordType == 'MarketCondition'){
+			e.CityStatus_ID__c = rId;
+		}
+		else if(recordType == 'Improvement'){
+			e.Improvement_ID__c = rId;
+		}
+		else if(recordType == 'Competitor'){
+			e.Conflict_ID__c = rId;
+		}
+		else if(recordType == 'Complaint'){
+			e.Claim_ID__c = rId;
+		}
+
+		update e;
+	}
+	
+	WebService static Product2 getProduct2(String a){
+		Product2 p2 = [select Id, Name, Intra_Trade_Cost_RMB__c, Intra_Trade_List_RMB__c FROM Product2 Where Id =:a];
+		return p2;
+	}
+
+	WebService static Product2 getProduct2US(String a){
+		Product2 p2 = [select Id, Name, Foreign_Trade_Cost_US__c, Foreign_Trade_List_US__c FROM Product2 Where Id =:a];
+		return p2;
+	}
+	
+	WebService static String getReportId(String oId, String rDate){
+		List<Daily_Report__c> rtList = [select Id from Daily_Report__c where OwnerId =:oId and Reported_Date__c =:date.parse(rDate)];
+		return rtList.get(0).id;
+	}
+	
+	WebService static String checkAccountMatch(String name, String id){
+		List<Account> accList = [select Id from Account where Name = :name and Id = :id];
+		if (accList.size() > 0) {
+			return 'OK';
+		}
+		return 'NG';
+	}
+	
+	WebService static Account getAccountForJs(String id){
+		return [select Id, Name, Department_Class__r.Name, Department_Class__r.Id,
+				Hospital__r.Name, Hospital__r.Id, Hospital__r.OCM_Category__c
+				from Account where Id = :id];
+	}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/Add_Report.cls-meta.xml b/force-app/main/default/classes/Add_Report.cls-meta.xml
new file mode 100644
index 0000000..b6a4861
--- /dev/null
+++ b/force-app/main/default/classes/Add_Report.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>20.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/AllReceivedFseController.cls b/force-app/main/default/classes/AllReceivedFseController.cls
new file mode 100644
index 0000000..9d19029
--- /dev/null
+++ b/force-app/main/default/classes/AllReceivedFseController.cls
@@ -0,0 +1,48 @@
+public with sharing class AllReceivedFseController {
+    public AllReceivedFseController() {
+        
+    }
+
+    @AuraEnabled
+    public static InitData init(String recordId){
+        InitData res = new InitData();
+        Rental_Apply__c ra = [SELECT Id, Loaner_received_ng_num__c from Rental_Apply__c where Id = :recordId];
+        res.Id = ra.Id;
+        res.LoanerReceivedNgNum = Integer.valueOf(ra.Loaner_received_ng_num__c);
+
+        return res;
+    }
+
+    @AuraEnabled
+    public static String getRaeSet(String recordId){
+        List<Rental_Apply_Equipment_Set__c> raeList = [SELECT Id, RAES_Status__c, Loaner_received_time__c from Rental_Apply_Equipment_Set__c WHERE Rental_Apply__c = :recordId];
+        List<Rental_Apply_Equipment_Set__c> updateList = new List<Rental_Apply_Equipment_Set__c>();
+        for(Integer i=0; i<raeList.size(); i++){
+            if(raeList[i].Loaner_received_time__c == null && raeList[i].RAES_Status__c == '宸插嚭搴�'){
+                Rental_Apply_Equipment_Set__c tempRAE = new Rental_Apply_Equipment_Set__c();
+                tempRAE.Id = raeList[i].Id;
+                tempRAE.Received_Confirm__c = 'OK';
+                updateList.add(tempRAE);
+            }
+        }
+
+        if(updateList.size()>0){
+            try {
+                update updateList;
+                return 'SUCCESS';
+            }
+            catch (Exception e) {
+                return e.getMessage();
+            }            
+        }
+
+        return '涓嶅瓨鍦ㄦ洿鏂版槑缁�';
+    }
+
+    public Class InitData{
+        @AuraEnabled
+        public String Id;
+        @AuraEnabled
+        public Integer LoanerReceivedNgNum;
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/AllReceivedFseController.cls-meta.xml b/force-app/main/default/classes/AllReceivedFseController.cls-meta.xml
new file mode 100644
index 0000000..9662499
--- /dev/null
+++ b/force-app/main/default/classes/AllReceivedFseController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>50.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
\ No newline at end of file
diff --git a/force-app/main/default/classes/ApplicationButtonController.cls b/force-app/main/default/classes/ApplicationButtonController.cls
index ad88920..9910696 100644
--- a/force-app/main/default/classes/ApplicationButtonController.cls
+++ b/force-app/main/default/classes/ApplicationButtonController.cls
@@ -16,6 +16,7 @@
     //鎺堟潈鐢宠鐨勬彁浜ゆ寜閽�
     @AuraEnabled
     public static String submit(String recordId) {
+       String messageText = '';
        try {
         Request_tedner_doc__c rac = [SELECT 	Id,Status__c,Submit_check_flag__c,RecordTypeId,Submit_time__c FROM Request_tedner_doc__c WHERE Id = :recordId LIMIT 1];
         rac.Status__c = LightingButtonConstant.STATUS_Application_Submitted;
@@ -23,18 +24,19 @@
         rac.Submit_check_flag__c = true;
         rac.Submit_time__c = Datetime.now();
         update rac;
-        return '1';
+        messageText = '1';
+        return messageText;
        } catch (Exception ex) {
         System.debug(LoggingLevel.INFO, '*** xu: ' + ex);
-        return ex.getMessage();
-       } finally {
-
+        messageText = ex.getMessage();
+        return messageText;
        }
     }
 
     //鎺堟潈鐢宠鐨勫彇娑堟彁浜ゆ寜閽�
     @AuraEnabled
     public static String submitCancel(String recordId) {
+       String messageText = '';
        try {
         Request_tedner_doc__c report = [SELECT 	Id,Status__c,Submit_check_flag__c,RecordTypeId,Submit_time__c FROM Request_tedner_doc__c WHERE Id = :recordId LIMIT 1];
         report.Status__c = LightingButtonConstant.STATUS_Application_CancelSubmit;
@@ -42,18 +44,18 @@
         report.Submit_check_flag__c = false;
         report.Submit_time__c = null;
         update report;
-        return '1';
+        messageText = '1';
+        return messageText;
        } catch (Exception ex) {
         System.debug(LoggingLevel.INFO, '*** cancelXu: ' + ex);
-        return ex.getMessage();
-       } finally {
-
+        messageText = ex.getMessage();
+        return messageText;
        }
     }
 
     //鑾峰彇褰撳墠鐧诲綍浜虹殑 id
     @AuraEnabled
-    public static UserResult UserInfo_Owner() {
+    public static UserResult userInfo_Owner() {
         UserResult result = new UserResult();
         ID myUserID = UserInfo.getUserId();
         try { 
diff --git a/force-app/main/default/classes/ApplyJsCtl.cls b/force-app/main/default/classes/ApplyJsCtl.cls
new file mode 100644
index 0000000..b09b2fe
--- /dev/null
+++ b/force-app/main/default/classes/ApplyJsCtl.cls
@@ -0,0 +1,40 @@
+/**************************************************************************************************
+ * Name: ApplyJsCtl
+ * Purpose: excute the java script of rental apply 
+ * Author: Prec-tech team
+ * Create Date: 2021-11-17
+ * Modify History:
+ * 2021-11-27       Create this class
+ **************************************************************************************************/
+global with sharing class ApplyJsCtl{
+    @AuraEnabled(cacheable=false)
+    webService static String queueTop(String applyId) {
+        try {
+            System.debug(LoggingLevel.INFO, '*** applyId: ' + applyId);
+            RentalFixtureSetAssignController.applysetMap = new Map<String,String>();
+            List<Rental_Apply_Equipment_Set_Detail__c> raesdObjs = [SELECT Id,Rental_Apply_Equipment_Set__r.Name,  Rental_Apply_Equipment_Set__c, Asset__c,Rental_Apply_Equipment_Set__r.Fixture_Set__r.Product_Type__c,
+                                                                   FSD_Fixture_Model_No__c, Fixture_Model_No_text__c,Rental_Apply__r.demo_purpose2__c,Queue_Day__c,ExternalKey__c,
+                                                                   Is_Body__c, FSD_Is_OneToOne__c, Select_Time__c,Rental_Apply__r.EquipmentGuaranteeFlg__c,Allow_Adjust_Queue_Flag__c,
+                                                                   Cancel_Select__c, Fixture_Model_No_F__c, Queue_Number__c, Internal_asset_location__c,Fixture_Model_No__c,
+                                                                   Internal_asset_location_before__c,Salesdepartment__c, Product_category_F__c, Product_category_text__c,Equipment_Type_text__c,
+                                                                   Salesdepartment_before__c,
+                                                                   Equipment_Type__c, Rental_Apply__r.Internal_asset_location_F__c,Cancel_Reason__c,Loaner_cancel_reason__c,Loaner_cancel_Remarks__c 
+                                                                    FROM Rental_Apply_Equipment_Set_Detail__c 
+                                                                    WHERE Rental_Apply__c =:applyId
+                                                                    AND Queue_Number__c > 0
+                                                                    AND Cancel_Select__c = false
+                                                                    AND Is_Body__c = true];
+            System.debug(LoggingLevel.INFO, '*** raesdObjs: ' + raesdObjs);
+            for(Rental_Apply_Equipment_Set_Detail__c detail:raesdObjs){
+                RentalFixtureSetAssignController.applysetMap.put(detail.Rental_Apply_Equipment_Set__c,detail.Rental_Apply_Equipment_Set__r.Name);
+            }
+            RentalFixtureSetAssignController.saveAgdustQueue(raesdObjs,'backEnd');
+        }
+        catch (Exception e) {
+            System.debug(LoggingLevel.INFO, '*** e.getMessage()+e.getLineNumber(): ' + e.getMessage()+e.getLineNumber());
+            return e.getMessage();
+        }
+        
+        return 'Success';
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/ApplyJsCtl.cls-meta.xml b/force-app/main/default/classes/ApplyJsCtl.cls-meta.xml
new file mode 100644
index 0000000..f928c8e
--- /dev/null
+++ b/force-app/main/default/classes/ApplyJsCtl.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>53.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/BidAnnouncementController.cls b/force-app/main/default/classes/BidAnnouncementController.cls
new file mode 100644
index 0000000..21e08db
--- /dev/null
+++ b/force-app/main/default/classes/BidAnnouncementController.cls
@@ -0,0 +1,106 @@
+public class BidAnnouncementController {
+    @AuraEnabled
+    public static InitData BidAnnouncementController (String recordId){
+        InitData res = new initData();
+        try{
+            Bid_Announcement__c report = [SELECT 	Id FROM Bid_Announcement__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;
+    }
+    //涓爣閫氱煡涔� 鐢宠
+    @AuraEnabled
+    public static String ApplyFor(String recordId) {
+        String messageText = '';
+        try {
+        Bid_Announcement__c Bid_Announcement = [SELECT 	Id,Status__c,Request_flag__c,Request_user__c,Request_date__c FROM Bid_Announcement__c WHERE Id = :recordId LIMIT 1];
+        Bid_Announcement.Id = Bid_Announcement.Id;
+        Bid_Announcement.Status__c = LightingButtonConstant.STATUS_Bid_Announcement_ApplyFor;
+        Bid_Announcement.Request_flag__c = true;
+        Bid_Announcement.Request_user__c = Userinfo.getUserId();
+        Bid_Announcement.Request_date__c = Datetime.now();
+        update Bid_Announcement;
+        messageText = '1';
+        return messageText;
+        } catch (Exception ex) {
+        System.debug(LoggingLevel.INFO, '*** ApplyForXu: ' + ex);
+        messageText = ex.getMessage();
+        return messageText;
+        }
+    }
+    //涓爣閫氱煡涔� 鍚屾剰
+    @AuraEnabled
+    public static String ConSent(String recordId) {
+        String messageText = '';
+        try {
+        Bid_Announcement__c Bid_Announcement = [SELECT 	Id,Status__c,Complete__c,Agree_user__c,Complete_date__c FROM Bid_Announcement__c WHERE Id = :recordId LIMIT 1];
+        Bid_Announcement.Id = Bid_Announcement.Id;
+        Bid_Announcement.Status__c = LightingButtonConstant.STATUS_Bid_Announcement_Consent;
+        Bid_Announcement.Complete__c = true;
+        Bid_Announcement.Agree_user__c = Userinfo.getUserId();
+        Bid_Announcement.Complete_date__c = Datetime.now();
+        update Bid_Announcement;
+        messageText = '1';
+        return messageText;
+        } catch (Exception ex) {
+        System.debug(LoggingLevel.INFO, '*** ConsentXu: ' + ex);
+        messageText = ex.getMessage();
+        return messageText;
+        }
+    }
+    //涓爣閫氱煡涔� 椹冲洖
+    @AuraEnabled
+    public static String Reject(String recordId) {
+        String messageText = '';
+        try {
+        Bid_Announcement__c Bid_Announcement = [SELECT 	Id,Status__c,Complete__c,Agree_user__c,Complete_date__c,Request_flag__c,Request_user__c,Request_date__c FROM Bid_Announcement__c WHERE Id = :recordId LIMIT 1];
+        Bid_Announcement.Id = Bid_Announcement.Id;
+        Bid_Announcement.Status__c = LightingButtonConstant.STATUS_Bid_Announcement_Reject;
+        Bid_Announcement.Complete__c = false;
+        Bid_Announcement.Agree_user__c = null;
+        Bid_Announcement.Complete_date__c = null;
+        Bid_Announcement.Request_flag__c = false;
+        Bid_Announcement.Request_user__c = null;
+        Bid_Announcement.Request_date__c = null;
+        update Bid_Announcement;
+        messageText = '1';
+        return messageText;
+        } catch (Exception ex) {
+        System.debug(LoggingLevel.INFO, '*** Reject: ' + ex);
+        messageText = ex.getMessage();
+        return messageText;
+        }
+    }
+    //鑾峰彇褰撳墠鐧诲綍浜虹殑 id
+    @AuraEnabled
+    public static UserResult UserInfo_Owner() {
+        UserResult result = new UserResult();
+        ID myUserID = UserInfo.getUserId();
+        try { 
+            User tempUser = [select id,BidCancel__c from user where id = : myUserID ];
+            result.id = tempUser.id;
+            result.BidCancel = tempUser.BidCancel__c;
+        } catch (exception e) {
+            result.result = e.getMessage();
+        }
+        return result;
+    }
+    public class InitData{
+        @AuraEnabled
+        public String Id;
+    }
+    public class UserResult {
+        @AuraEnabled
+        public string result;
+        public UserResult( ) {
+            result = 'Success';
+        }
+        @AuraEnabled
+        public string id;
+        @AuraEnabled
+        public Boolean BidCancel;
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/BidAnnouncementController.cls-meta.xml b/force-app/main/default/classes/BidAnnouncementController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/BidAnnouncementController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>56.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/ControllerUtil.cls b/force-app/main/default/classes/ControllerUtil.cls
index a70f2f2..e422a7a 100644
--- a/force-app/main/default/classes/ControllerUtil.cls
+++ b/force-app/main/default/classes/ControllerUtil.cls
@@ -2717,7 +2717,7 @@
         i++;
         i++;
     }
-    
+    @AuraEnabled
     WebService static String selectCommonSequence(String valueField, String formatField) {
         Boolean insertNew = false;
         //鍙栧緱鍏遍�氭帯鐣簭鍒�
@@ -4968,6 +4968,7 @@
     /**
     OCM-SI闇�姹傝〃鐢紝澶嶅埗鍔熻兘锛屼粎闄愬綋鍓嶆墍鏈塖I闇�姹傝〃澶辨晥鐨勬椂鍊欙紝鎵嶈兘浣跨敤
     */
+    @AuraEnabled
     WebService static String ISO_Copy_Func(id isoID){
         IS_Opportunity_Demand__c checkISO = [select Opportunity_ID__c from IS_Opportunity_Demand__c where id =:isoID];
         String opporID = checkISO.Opportunity_ID__c;
diff --git a/force-app/main/default/classes/EquipmentRentalPicturePDFController.cls b/force-app/main/default/classes/EquipmentRentalPicturePDFController.cls
new file mode 100644
index 0000000..d7ceca7
--- /dev/null
+++ b/force-app/main/default/classes/EquipmentRentalPicturePDFController.cls
@@ -0,0 +1,32 @@
+public with sharing class EquipmentRentalPicturePDFController {
+
+    @AuraEnabled
+    public static InitData init(String recordId){
+        InitData res = new InitData();
+        try {
+            Rental_Apply__c ra = [SELECT Id, Shipment_requested_cnt__c from Rental_Apply__c where Id = :recordId];
+            if(ra.Shipment_requested_cnt__c > 0){
+                List<Rental_Apply_Equipment_Set__c> raeSet = [select Id from Rental_Apply_Equipment_Set__c where Rental_Apply__c = :recordId and Yi_Shipment_request__c > 0 and RAES_Status__c != '鍙栨秷'];
+                Integer setLength = raeSet.size();
+                res.pageLength = Math.mod(setLength,10)== 0 ? setLength/10 : (setLength/10) +1 ;
+                res.raesList = raeSet;
+            } 
+            res.ShipmentRequestedCnt = Integer.valueOf(ra.Shipment_requested_cnt__c);   
+        }
+        catch (Exception e) {
+            System.debug(LoggingLevel.INFO, '****e:' + e);
+        }
+        return res;
+    }
+
+    public class InitData{
+        @AuraEnabled
+        public String Id;
+        @AuraEnabled
+        public Integer pagelength;
+        @AuraEnabled
+        public Integer ShipmentRequestedCnt;
+        @AuraEnabled
+        public List<Rental_Apply_Equipment_Set__c> raesList;
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/EquipmentRentalPicturePDFController.cls-meta.xml b/force-app/main/default/classes/EquipmentRentalPicturePDFController.cls-meta.xml
new file mode 100644
index 0000000..9662499
--- /dev/null
+++ b/force-app/main/default/classes/EquipmentRentalPicturePDFController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>50.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
\ No newline at end of file
diff --git a/force-app/main/default/classes/FinLibraryButtonController.cls b/force-app/main/default/classes/FinLibraryButtonController.cls
new file mode 100644
index 0000000..a20d79e
--- /dev/null
+++ b/force-app/main/default/classes/FinLibraryButtonController.cls
@@ -0,0 +1,24 @@
+/**********************************************************************
+ * 
+ *
+ * @url: /services/apexrest/rest
+ * @data:
+ *  {
+        
+    }
+*************************************************************************/
+
+global with sharing class FinLibraryButtonController {
+   
+   @AuraEnabled
+   public static Bulletin_Board__c  getBulletinBoard(String recordId){
+    Bulletin_Board__c res=new Bulletin_Board__c();
+    try {
+            res=[select iPad_Finlibrary__c from Bulletin_Board__c where Id=: recordId];
+    }
+    catch (Exception e) {
+        System.debug(Logginglevel.info,'*******e'+e);
+    }
+    return res;
+   }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/FinLibraryButtonController.cls-meta.xml b/force-app/main/default/classes/FinLibraryButtonController.cls-meta.xml
new file mode 100644
index 0000000..d75b058
--- /dev/null
+++ b/force-app/main/default/classes/FinLibraryButtonController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>51.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/FinLibraryButtonController2.cls b/force-app/main/default/classes/FinLibraryButtonController2.cls
new file mode 100644
index 0000000..8421838
--- /dev/null
+++ b/force-app/main/default/classes/FinLibraryButtonController2.cls
@@ -0,0 +1,24 @@
+/**********************************************************************
+ * 
+ *
+ * @url: /services/apexrest/rest
+ * @data:
+ *  {
+        
+    }
+*************************************************************************/
+
+global with sharing class FinLibraryButtonController2 {
+   
+   @AuraEnabled
+   public static Bulletin_Board__c getBulletinBoard(String recordId){
+    Bulletin_Board__c  res=new Bulletin_Board__c();
+    try{
+        res=[select iPad_Finlibrary_2__c from Bulletin_Board__c where Id=: recordId];
+    }
+    catch(Exception e){
+        System.debug(Logginglevel.info,'*******e'+e);
+    }
+    return res;
+   }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/FinLibraryButtonController2.cls-meta.xml b/force-app/main/default/classes/FinLibraryButtonController2.cls-meta.xml
new file mode 100644
index 0000000..d75b058
--- /dev/null
+++ b/force-app/main/default/classes/FinLibraryButtonController2.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>51.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/FinLibraryButtonController3.cls b/force-app/main/default/classes/FinLibraryButtonController3.cls
new file mode 100644
index 0000000..b6228d1
--- /dev/null
+++ b/force-app/main/default/classes/FinLibraryButtonController3.cls
@@ -0,0 +1,13 @@
+global with sharing class FinLibraryButtonController3 {
+   @AuraEnabled
+   public static Bulletin_Board__c getBulletinBoard(String recordId){
+    Bulletin_Board__c res=new Bulletin_Board__c();
+    try{
+        res=[select iPad_Finlibrary_3__c from Bulletin_Board__c where  Id= : recordId];
+    }
+    catch(Exception e){
+        System.debug(Logginglevel.info,'*******e'+e);
+    }
+    return res;
+   }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/FinLibraryButtonController3.cls-meta.xml b/force-app/main/default/classes/FinLibraryButtonController3.cls-meta.xml
new file mode 100644
index 0000000..d75b058
--- /dev/null
+++ b/force-app/main/default/classes/FinLibraryButtonController3.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>51.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LightingButtonConstant.cls b/force-app/main/default/classes/LightingButtonConstant.cls
index c68ab80..85921bf 100644
--- a/force-app/main/default/classes/LightingButtonConstant.cls
+++ b/force-app/main/default/classes/LightingButtonConstant.cls
@@ -1,4 +1,10 @@
 global without sharing class LightingButtonConstant {
+    //涓爣閫氱煡涔︾殑鐘舵�佲�樺鐞嗗畬姣曗��
+    public static final String STATUS_Bid_Announcement_Consent = '澶勭悊瀹屾瘯';
+    //涓爣閫氱煡涔︾殑鐘舵�佲�樿崏妗堜腑鈥�
+    public static final String STATUS_Bid_Announcement_Reject = '鑽夋涓�';
+    //涓爣閫氱煡涔︾殑鐘舵�佲�樼敵璇蜂腑鈥�
+    public static final String STATUS_Bid_Announcement_ApplyFor = '鐢宠涓�';
     //鎺堟潈鐢宠鐨勭姸鎬佲�樺凡鎻愪氦鈥�
     public static final String STATUS_Application_Submitted = '宸叉彁浜�';
     //鎺堟潈鐢宠鐨勭姸鎬佲�樿崏妗堜腑鈥�
@@ -69,6 +75,13 @@
     public static final String USER_ACCESS_EDIT = '_Edit';
     //userAccess鍙傛暟鍚庣紑_Read
     public static final String USER_ACCESS_READ = '_Read';
+    //浠诲姟鐨勫悕瀛椻�樹腑鏍囩粨鏋滅‘璁も��
+    public static final String TASK_NAME_BY_CONFIRMATION_OF_WINNING_BID = '涓爣缁撴灉纭';
+    //璇环鐨凜onfirmationofAward__c瀛楁鍊尖�極LY涓爣鈥�
+    public static final String OPPORTUNITY_CONFIRMATION_OF_AWARD_OLY_WIN_BID = 'OLY涓爣';
+     //璇环鐨凜onfirmationofAward__c瀛楁鍊尖�樼珵浜夊鎵嬩腑鏍団��
+     public static final String OPPORTUNITY_CONFIRMATION_OF_AWARD_LOSE_BID = '绔炰簤瀵规墜涓爣';
+    public static final String PREDICTED_DATE_STATUS = '瀹℃壒涓�';
     public static final String CN_YES = '鏄�';
     public static final String CN_NO = '鍚�';
     public static final String VOC_NAME = 'VOC';
diff --git a/force-app/main/default/classes/MonthlyReportController.cls b/force-app/main/default/classes/MonthlyReportController.cls
index 3822866..1448292 100644
--- a/force-app/main/default/classes/MonthlyReportController.cls
+++ b/force-app/main/default/classes/MonthlyReportController.cls
@@ -51,7 +51,7 @@
     }
     //鍙栨秷鎻愪氦鎿嶄綔鏇存柊鐩稿簲鏁版嵁
     @AuraEnabled
-    public static void cancel(String recordId) {
+    public static String cancel(String recordId) {
        try {
         Monthly_Report__c report = [SELECT 	Id,Status__c,Submit_check_flag__c,RecordTypeId,Submit_time__c FROM Monthly_Report__c WHERE Id = :recordId LIMIT 1];
         report.Status__c = LightingButtonConstant.STATUS_DRAFT;
@@ -59,12 +59,13 @@
         report.Submit_check_flag__c = false;
         report.Submit_time__c = null;
         update report;
+        return null;
        } catch (Exception e) {
-        System.debug(LoggingLevel.INFO, '*** e: ' + e);
-       } finally {
-
+        String eMessage = e.getMessage();
+        Integer left = eMessage.indexOf(',') + 1;
+        Integer right = eMessage.length();
+        return eMessage.substring(left,right);
        }
-
     }
 
 
diff --git a/force-app/main/default/classes/OpportunityLightingButtonController.cls b/force-app/main/default/classes/OpportunityLightingButtonController.cls
new file mode 100644
index 0000000..5c0b778
--- /dev/null
+++ b/force-app/main/default/classes/OpportunityLightingButtonController.cls
@@ -0,0 +1,524 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-12 11:16:07
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-14 17:24:54
+ */
+public with sharing class OpportunityLightingButtonController {
+    @AuraEnabled
+    public static InitData initForPredictedDateChangeButton(String recordId){
+        InitData res = new InitData();
+        try {
+            Opportunity opportunity = [
+            select 
+            DirectLossFLG__c,
+            Created_Day__c
+            from Opportunity where Id =: recordId];
+            res.createdDay = opportunity.Created_Day__c;
+            res.directLossFLG = opportunity.DirectLossFLG__c;
+        } catch (Exception e) {
+            System.debug('e:****' + e);
+        }
+        return res;
+    }
+    @AuraEnabled
+    public static InitData initForAgencyAuthorizeButton(String recordId){
+        InitData res = new InitData();
+        try {
+            Opportunity opportunity = [
+                select 
+                Agency1_ID_18__c,
+                StageName,
+                SAP_Send_OK__c,
+                Opp_order_Type__c,
+                If_Have_170__c,
+                If_Have_AH__c,
+                Cnt_Lost_cancel_Draft__c,
+                Cnt_Lost_cancel_report__c,
+                Estimation_Id__c,
+                DetailNum__c,
+                Estimation_Decision__c,
+                Sales_Root__c,
+                AcecideCntCheck__c,
+                IF_Submit__c ,
+                Trade__c,
+                Is_Corrosion__c,
+                If_Authorizing_Lock__c 
+                from Opportunity where Id =: recordId 
+            ];
+            res.agency1Id = opportunity.Agency1_ID_18__c;
+            res.stageName = opportunity.StageName;
+            res.sapSendOK = opportunity.SAP_Send_OK__c;
+            res.oppOrderType = opportunity.Opp_order_Type__c;
+            res.ifHave170 = opportunity.If_Have_170__c;
+            res.ifHaveAH = opportunity.If_Have_AH__c;
+            res.cntLostCancelDraft = opportunity.Cnt_Lost_cancel_Draft__c;
+            res.cntLostCancelReport = opportunity.Cnt_Lost_cancel_report__c;
+            res.estimationId = opportunity.Estimation_Id__c;
+            res.detailNum = opportunity.DetailNum__c;
+            res.estimationDecision = opportunity.Estimation_Decision__c;
+            res.salesRoot = opportunity.Sales_Root__c;
+            res.acecideCntCheck = opportunity.AcecideCntCheck__c;
+            res.ifSubmit = opportunity.IF_Submit__c;
+            res.trade = opportunity.Trade__c;
+            res.isCorrosion = opportunity.Is_Corrosion__c;
+            res.ifAuthorizingLock = opportunity.If_Authorizing_Lock__c;
+            String profile18 = UserInfo.getProfileId();
+            res.profileId = profile18.substring(0,profile18.length() - 3);
+        } catch (Exception e) {
+            System.debug('e:****' + e);
+        }
+        return res;
+    }
+    @AuraEnabled
+    public static InitData initForLoseBidButton(String recordId){
+        InitData res = new InitData();
+        try {
+            Opportunity opportunity = [
+                select
+                ifOpenBid__c
+                from Opportunity where Id =: recordId
+            ];
+            res.ifOpenBid = opportunity.ifOpenBid__c;
+        } catch (Exception e) {
+            System.debug('e:****' + e);
+        }
+        return res;
+    }
+    @AuraEnabled
+    public static InitData initForOLYwinBidButton(String recordId){
+        InitData res = new InitData();
+        try {
+            Opportunity opportunity = [
+                select
+                ifOpenBid__c
+                from Opportunity where Id =: recordId
+            ];
+            res.ifOpenBid = opportunity.ifOpenBid__c;
+        } catch (Exception e) {
+            System.debug('e:****' + e);
+        }
+        return res;
+    }
+    @AuraEnabled
+    public static InitData initForCreateEventButton(String recordId){
+        InitData res = new InitData();
+        try {
+            Opportunity opportunity = [
+                select 
+                AccountId 
+                from Opportunity where Id =: recordId];
+            res.accountId = opportunity.AccountId;
+        } catch (Exception e) {
+            System.debug('e:****' + e);
+        }
+        return res;
+    }
+    @AuraEnabled
+    public static InitData initFoBeforeOPDPDFBtnButton(String recordId){
+        InitData res = new InitData();
+        try {
+            Opportunity opportunity = [
+                select
+                AccountId
+                from Opportunity where Id =: recordId
+            ];
+            res.accountId = opportunity.AccountId;
+            res.userId = UserInfo.getUserId();
+        } catch (Exception e) {
+            System.debug('e:****' + e);
+        }
+        return res;
+    }
+    @AuraEnabled
+    public static InitData initFoBeforeOPDPDFBtnSISButton(String recordId){
+        InitData res = new InitData();
+        try {
+            Opportunity opportunity = [
+                select
+                AccountId
+                from Opportunity where Id =: recordId
+            ];
+            res.accountId = opportunity.AccountId;
+            res.userId = UserInfo.getUserId();
+        } catch (Exception e) {
+            System.debug('e:****' + e);
+        }
+        return res;
+    }
+    @AuraEnabled
+    public static InitData initForRequestDBButton(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,
+                Agency1__c,
+                Agency1_ID_18__c,
+                Name,
+                Bid_Planned_Date__c,
+                Sales_assistant_name__c,
+                Sales_assistant_ID__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.agency1 = opportunity.Agency1__c;
+            res.agency1Id = opportunity.Agency1_ID_18__c;
+            res.name = opportunity.Name;
+            res.bidPlannedDate = opportunity.Bid_Planned_Date__c;
+            res.salesAssistantName = opportunity.Sales_assistant_name__c;
+            res.salesAssistantID = opportunity.Sales_assistant_ID__c;
+            String profileId18 = UserInfo.getProfileId();
+            res.profileId = profileId18.substring(0, profileId18.length() - 3);
+        } catch (Exception e) {
+            System.debug('e:****' + e);
+        }
+        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();
+            opp.Id = recordId;
+            opp.If_Authorizing__c = true;
+            opp.if_Interface_Lock__c = true;
+            opp.IF_Submit__c = true;
+            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 updateForLoseBidButton(String recordId){
+        try {
+            Opportunity opp = new Opportunity();
+            opp.Id = recordId;
+            opp.ConfirmationofAward__c = LightingButtonConstant.OPPORTUNITY_CONFIRMATION_OF_AWARD_LOSE_BID;
+            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 updateForOLYwinBidButton(String recordId){
+        try {
+            Opportunity opp = [select ConfirmationofAward__c,Closing_Bid_Date__c from Opportunity where Id =: recordId];
+            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;
+        } catch (Exception e) {
+            String eMessage = e.getMessage();
+            Integer left = eMessage.indexOf(',') + 1;
+            Integer right = eMessage.length();
+            return eMessage.substring(left,right);
+        }
+    }
+    @AuraEnabled
+    public static List<InquiryPredictsDateChange__c> queryForPredictedDateChangeButton(String recordId){
+        List<InquiryPredictsDateChange__c> rac = null;
+        try {
+            rac = [
+                select 
+                id 
+                from InquiryPredictsDateChange__c where Predicted_Date_Status__c = :LightingButtonConstant.PREDICTED_DATE_STATUS and Opportunity__c =:recordId];
+        } catch (Exception e) {
+            System.debug('e:****' + e);
+        }
+        return rac;
+    }
+    @AuraEnabled
+    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 :obscureName];
+        } catch (Exception e) {
+            System.debug('e:****' + e);
+        }
+        return tasks;
+    }
+    @AuraEnabled
+    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 :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
+        public Boolean directLossFLG;
+        @AuraEnabled
+        public Date createdDay;
+        @AuraEnabled
+        public String agency1Id;
+        @AuraEnabled
+        public String agency1;
+        @AuraEnabled
+        public String stageName;
+        @AuraEnabled
+        public Boolean sapSendOK;
+        @AuraEnabled
+        public String oppOrderType;
+        @AuraEnabled
+        public Boolean ifHave170;
+        @AuraEnabled
+        public Boolean ifHaveAH;
+        @AuraEnabled
+        public Decimal cntLostCancelDraft;
+        @AuraEnabled
+        public Decimal cntLostCancelReport;
+        @AuraEnabled
+        public String estimationId;
+        @AuraEnabled
+        public Decimal detailNum;
+        @AuraEnabled
+        public Boolean estimationDecision;
+        @AuraEnabled
+        public String salesRoot;
+        @AuraEnabled
+        public Boolean acecideCntCheck;
+        @AuraEnabled
+        public Boolean ifSubmit;
+        @AuraEnabled
+        public String trade;
+        @AuraEnabled
+        public Boolean isCorrosion;
+        @AuraEnabled
+        public Boolean ifAuthorizingLock;
+        @AuraEnabled
+        public String profileId;
+        @AuraEnabled
+        public String ifOpenBid;
+        @AuraEnabled
+        public String accountId;
+        @AuraEnabled
+        public String userId;
+        @AuraEnabled
+        public String name;
+        @AuraEnabled
+        public Date bidPlannedDate;
+        @AuraEnabled
+        public String salesAssistantName;
+        @AuraEnabled
+        public String salesAssistantID;
+        @AuraEnabled
+        public String jobCategory;
+        @AuraEnabled
+        public String biddingProjectNameBid;
+        @AuraEnabled
+        public String managerName;
+        @AuraEnabled
+        public String salesManagerDepartmentID;
+        @AuraEnabled
+        public String salesOwnerBuchang;
+        @AuraEnabled
+        public String salesOwnerBuchangID;
+        @AuraEnabled
+        public String biddingProjectNameBidId;
+        @AuraEnabled
+        public String stockApplyStatus;
+        @AuraEnabled
+        public String lastOpportunityFileId;
+        @AuraEnabled
+        public String currencyIsoCode;
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/OpportunityLightingButtonController.cls-meta.xml b/force-app/main/default/classes/OpportunityLightingButtonController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/OpportunityLightingButtonController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>56.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/OpportunityService.cls b/force-app/main/default/classes/OpportunityService.cls
new file mode 100644
index 0000000..f8044db
--- /dev/null
+++ b/force-app/main/default/classes/OpportunityService.cls
@@ -0,0 +1,457 @@
+public with sharing   class OpportunityService{
+
+  private static String opp_search_field = ' Id, Name, Account_Name_F__c, OwnerId, Hospital__c, Opportunity_No__c, Opportunity_stage__c, StageName__c, Bidding_Project_Name_Bid__c, Department_Class__r.RecordTypeId ';
+  
+  // 鏌ヨ宸蹭繚瀛樼殑鏁版嵁  
+  //noStr 璇环鐨処D
+  //daccountID 瀹㈡埛鐨処D 鐜板湪娌$敤
+  // IdStr 鎷涙姇鏍囩殑ID
+  //hospital 鍖婚櫌鐨処D
+  @AuraEnabled
+  public  static string GetNormalProductDataSearch(String noStr,String accountId,String IdStr,String hospital,String[] hospitalArr, String departments) {
+
+    String sql = 'select ';
+    // sql += CommonUtils.GetSqlToPorps(Opportunity.SObjectType);
+    sql += opp_search_field;
+    sql += ' from Opportunity';
+    // 澶氬澶氬叧绯� 鍘绘帀鏈叧鑱旂殑鍒ゆ柇 start
+    // sql += ' where Bidding_Project_Name_Bid__c = null ';
+    sql += ' where id != null ';
+    // 澶氬澶氬叧绯� 鍘绘帀鏈叧鑱旂殑鍒ゆ柇 end
+    if(noStr != null && noStr != '' && noStr != ' ')
+    {
+      sql += ' and Opportunity_No__c = :noStr';
+    }
+
+    if(hospitalArr!= null && hospitalArr.size() > 0)
+    {
+      sql += ' and Hospital__c in :hospitalArr';
+    }
+    if(hospital != null && hospital != '' && hospital != ' ')
+    {
+      sql += ' and Hospital__c = :hospital';
+    }
+
+    // String paremt1 = '012100000006KMe';
+    // String paremt2 = '01210000000QekK';
+    // String paremt3 = '寮曞悎';
+    // sql += ' and (recordtypeid = :paremt1 or recordtypeid = :paremt2) and stagename = :paremt3 ';
+    sql += ' and recordtype.developername in (\'Opportunity\',\'SI_Oppor\') and Hospital__r.Is_Active__c = \'鏈夊姽\' '+
+        // 杩欓噷鏈変慨鏀癸紝鍒粰鐩栦簡
+    ' and ( (SAP_Send_OK__c = true and SAP_Send_OK_Date__c   = LAST_N_DAYS:183  ) '+
+        'or( stagename = \'鏁楁垿\' and Final_Contract_Proceeded_Date__c = LAST_N_DAYS:183  ) or stagename = \'寮曞悎\' ) ';
+      // 杩欓噷鏈変慨鏀癸紝鍒粰鐩栦簡
+    // 20210914 鎴樼暐绉戝淇敼
+    //if (departments != null && String.isNotBlank(departments)) {
+    //  String[] depart_types = departments.split(';');
+    //  if (depart_types != null && depart_types.size() > 0 && depart_types.size() < 6) {
+    //    sql += ' and Department_Class__r.RecordTypeId in :depart_types ';
+    //  }
+    //}
+    // 20210914 鎴樼暐绉戝淇敼
+    // 鍘绘帀宸茬粡鍏宠仈鐨勬嫑鏍�
+    if(IdStr != null && String.isNotBlank(IdStr)) {
+      sql += ' and id not in (select Opportunity__c from Tender_Opportunity_Link__c where Tender_information__c = :IdStr) ';
+    }
+    // 20221014 ljh SWAG-CK28WT add start
+    String proId = UserInfo.getProfileId();
+    String p_2M4 = System.Label.ProfileId_2M4;
+    if(proId.substring(0,15) == p_2M4.substring(0,15)){
+       sql += ' AND OwnerId =\''+UserInfo.getUserId()+'\'';
+    }
+    System.debug('sql:'+sql);
+    // 20221014 ljh SWAG-CK28WT add end
+    sql += '  limit 50';
+    List<Opportunity> arrays = Database.query(sql);
+    return JSON.serialize(arrays); 
+    
+  }
+ 
+ // 鏌ヨ鏈繚瀛樼殑鏁版嵁  
+  // IdStr 鎷涙姇鏍囩殑ID
+  //hospital 鍖婚櫌鐨処D
+  @AuraEnabled
+  public  static string GetNormalProductDataNotSave(String IdStr,String[] hospital, String departments) {
+
+    //TODU
+    // QueryWrapper query = new QueryWrapper(Tender_information__c.SObjectType);
+    // query.eq('Id',IdStr);
+
+    // 鎷涙爣-璇环鍏宠仈淇敼 20210813 start
+    String sql = 'select ';
+    // sql += CommonUtils.GetSqlToPorps(Opportunity.SObjectType);
+    sql += opp_search_field;
+    sql += ' from Opportunity';
+    // 澶氬澶氬叧绯� 鍘绘帀鏈叧鑱旂殑鍒ゆ柇 start
+    // sql += ' where Bidding_Project_Name_Bid__c = null ';
+    // 澶氬澶氬叧绯� 鍘绘帀鏈叧鑱旂殑鍒ゆ柇 end
+    // String paremt1 = '012100000006KMe';
+    // String paremt2 = '01210000000QekK';
+    // String paremt3 = '寮曞悎';
+    // sql += ' and (recordtypeid = :paremt1 or recordtypeid = :paremt2) and stagename = \'寮曞悎\' ';
+    // sql += ' and recordtype.developername in (\'Opportunity\',\'SI_Oppor\') and Hospital__r.Is_Active__c = \'鏈夊姽\' '+
+    sql += ' where recordtype.developername in (\'Opportunity\',\'SI_Oppor\') and Hospital__r.Is_Active__c = \'鏈夊姽\' '+
+        // 杩欓噷鏈変慨鏀癸紝鍒粰鐩栦簡
+    ' and ( (SAP_Send_OK__c = true and SAP_Send_OK_Date__c   = LAST_N_DAYS:183 ) '+
+        'or( stagename = \'鏁楁垿\' and Final_Contract_Proceeded_Date__c = LAST_N_DAYS:183  ) or stagename = \'寮曞悎\' ) ';
+      // 杩欓噷鏈変慨鏀癸紝鍒粰鐩栦簡
+    // 鍘绘帀宸茬粡鍏宠仈鐨勬嫑鏍�
+    if(IdStr != null && String.isNotBlank(IdStr)) {
+      sql += ' and id not in (select Opportunity__c from Tender_Opportunity_Link__c where Tender_information__c = :IdStr) ';
+    }
+    // 20210914 鎴樼暐绉戝淇敼
+    //if (departments != null && String.isNotBlank(departments)) {
+    //  String[] depart_types = departments.split(';');
+    //  if (depart_types != null && depart_types.size() > 0 && depart_types.size() < 6) {
+    //    sql += ' and Department_Class__r.RecordTypeId in :depart_types ';
+    //  }
+    //}
+    // 20210914 鎴樼暐绉戝淇敼
+    if(hospital!= null && hospital.size() > 0)
+    {
+      sql += ' and Hospital__c in :hospital';
+    }
+    // 20221014 ljh SWAG-CK28WT add start
+    String proId = UserInfo.getProfileId();
+    String p_2M4 = System.Label.ProfileId_2M4;
+    if(proId.substring(0,15) == p_2M4.substring(0,15)){
+       sql += ' AND OwnerId =\''+UserInfo.getUserId()+'\'';
+    }
+    System.debug('sql:'+sql);
+    // 20221014 ljh SWAG-CK28WT add end
+    sql += '  limit 50';
+    List<Opportunity> arrays = Database.query(sql);
+
+    // Tender_information__c
+    return JSON.serialize(arrays); 
+    
+    // 鎷涙爣-璇环鍏宠仈淇敼 20210813 end
+  }
+
+
+
+
+
+  //鏌ヨ宸蹭繚瀛�
+  // 鍙湁涓�涓� 褰撳墠鎷涙姇鏍�
+  //IdStr 鎷涙姇鏍囩殑ID
+  @AuraEnabled
+  public  static string GetNormalProductDataIsSave(String IdStr) {
+    // 鎷涙爣-璇环鍏宠仈淇敼 20210817 start
+    // 鏌ヨ鏂瑰紡鎴栬搴旇浼樺寲涓�涓�
+    // QueryWrapper query = new QueryWrapper(Opportunity.SObjectType);
+    // query.eq('Bidding_Project_Name_Bid__c', IdStr);
+    // List<Opportunity> arrays = DataBasePlus.listPlus(query);
+    List<Id> oppIds = new List<Id>();
+    List<Tender_Opportunity_Link__c> links = [select Opportunity__c from Tender_Opportunity_Link__c where Tender_information__c = :IdStr];
+    if (links != null && links.size() > 0) {
+      for (Tender_Opportunity_Link__c link : links) {
+        oppIds.add(link.Opportunity__c);
+      }
+    }
+    // String sql = 'select ' + CommonUtils.GetSqlToPorps(Opportunity.SObjectType) + ' from Opportunity ';
+    String sql = 'select ' + opp_search_field + ' from Opportunity ';
+    sql += 'where Id in :oppIds';
+    List<Opportunity> arrays = Database.query(sql);
+    // 鎷涙爣-璇环鍏宠仈淇敼 20210817 end
+    return JSON.serialize(arrays); 
+  }
+   
+
+
+  
+  //淇濆瓨
+   //JsonSelected JSON鏍煎紡鐨勬嫑鎶曟爣鐨勫凡閫夋嫨鏁版嵁闆嗗悎
+   //JsonNotSelected JSON鏍煎紡鐨勬嫑鎶曟爣鐨勬湭閫夋嫨鏁版嵁闆嗗悎
+   // BiddingId 瀵瑰簲鐨勬嫑鏍囬」鐩悕锛堟嫑鎶曟爣锛�
+   // flag  淇敼 鎷涙姇鏍囬」鐩� 鍏宠仈璇环鏃堕棿鐨勪竴涓爣璇�
+  @AuraEnabled
+  public  static string SaveData(String JsonSelected,String JsonNotSelected,String BiddingId,Boolean flag) {
+
+    try{
+      // 鏂板鎷涙爣-璇环鍏宠仈鍏崇郴琛紝鍘绘帀鏇存柊璇环涓婄殑鏈�鏂版嫑鏍囦俊鎭� 20210813 start
+      // if(JsonSelected != null &&  JsonSelected != '' && JsonSelected !='[]')
+      // {
+      //   List<Opportunity> SelectedList = (List<Opportunity>)JSON.deserialize(JsonSelected,List<Opportunity>.class);
+
+      //   for(Opportunity item :SelectedList){
+      //     item.Bidding_Project_Name_Bid__c = null;
+      //   }
+       
+
+              
+      // Database.update(SelectedList,false);
+      // }
+      // string OppOwnerId = '';
+      // if(JsonNotSelected != null &&  JsonNotSelected != '' && JsonNotSelected !='[]')
+      // {
+      //   List<Opportunity> NotSelectedList = (List<Opportunity>)JSON.deserialize(JsonNotSelected,List<Opportunity>.class);
+
+      //   for(Opportunity item :NotSelectedList){
+      //     item.Bidding_Project_Name_Bid__c = BiddingId;
+      //   }
+      //   OppOwnerId = NotSelectedList[0].ownerId;
+      //   Database.update(NotSelectedList);
+      // }
+      // if(flag != null && flag == true)
+      // {
+      //   string tenProp = CommonUtils.GetSqlToPorps(Tender_information__c.SObjectType);
+      //   String sql = 'select '+tenProp+' from Tender_information__c  where Id = :BiddingId';
+      //   List<Tender_information__c> arrays = Database.query(sql);
+      //   arrays[0].RelateOppTime__c = datetime.now();
+      //   //if( arrays[0].IsBid__c == null && OppOwnerId != '')
+      //   //{
+      //   //  arrays[0].ownerId = OppOwnerId;
+      //   //}
+      //   if (arrays != null && arrays.size() >0 &&
+      //   (arrays[0].ownerId == '00510000005sEEM' || arrays[0].ownerId == '00510000000gmxH')
+      //   && OppOwnerId != '')
+      //   {
+      //     arrays[0].ownerId = OppOwnerId;
+      //   }
+      //   Database.update(arrays);
+      // }
+      // 鏂板鎷涙爣-璇环鍏宠仈鍏崇郴琛紝鍘绘帀鏇存柊璇环涓婄殑鏈�鏂版嫑鏍囦俊鎭� 20210813 end
+
+      // 鎷涙爣-璇环鍏宠仈淇敼 20210813 start
+      // 鏌ヨ鎷涙爣
+      // string tenProp = CommonUtils.GetSqlToPorps(Tender_information__c.SObjectType);
+      // String sql = 'select '+tenProp+' from Tender_information__c  where Id = :BiddingId';
+      String sql = 'SELECT ';
+      sql += 'Id, ';
+      sql += 'NotBidApprovalStatus__c, ';
+      sql += 'IsBid__c, ';
+      sql += 'TenderBeginTime__c, ';
+      sql += 'InfoType__c, ';
+      sql += 'OwnerId, ';
+      sql += 'IsReactionOpp__c, ';
+      sql += 'IsRelateProject__c, ';
+      sql += 'RelateOppTime__c, ';
+      sql += 'irrelevantReasons__c, ';
+      sql += 'irrelevantReasonOther__c, ';
+      sql += 'Hospital__c, ';
+      sql += 'Hospital1__c, ';
+      sql += 'Hospital2__c, ';
+      sql += 'Hospital3__c, ';
+      sql += 'Hospital4__c, ';
+      sql += 'publicDate__c, ';// 20221114 ljh SWAG-CKL5UC
+      sql += 'Tender_Order__c, ';  //20220620 you SWAG-CFD4SU 
+      sql += 'subInfoType__c ';  //20220718 you 鎷涙爣浠诲姟 
+      sql += 'FROM Tender_information__c  WHERE Id = :BiddingId order by Tender_Order__c desc,relativeTime_F__c desc'; //20220620 you SWAG-CFD4SU 澧炲姞 order by
+      List<Tender_information__c> arrays = Database.query(sql);
+      Tender_information__c tender = arrays[0];
+      
+      // 涓嶅簲鏍囩敵璇蜂腑鐨勬椂鍊� 璋冨洖鐢宠淇敼 20210907 start
+      if (tender.NotBidApprovalStatus__c != null && tender.NotBidApprovalStatus__c == '鐢宠涓�') {
+        List<Approval.ProcessWorkitemRequest> requests = new List<Approval.ProcessWorkitemRequest> ();
+        ProcessInstance pi = [Select Id, SubmittedById from ProcessInstance where TargetObjectId = :tender.Id and Status = 'Pending' order by CreatedDate desc limit 1];
+        if (pi != null) {
+          for(ProcessInstanceWorkItem wi : [Select Id from ProcessInstanceWorkItem where ProcessInstanceId = :pi.Id]){
+            Approval.ProcessWorkitemRequest req2 = new Approval.ProcessWorkitemRequest();
+            if (pi.SubmittedById.equals(Userinfo.getUserId())) {
+              req2.setAction('Removed');
+              tender.NotBidApprovalStatus__c = '鑽夋涓�';
+            } else {
+              req2.setAction('Reject');
+              tender.NotBidApprovalStatus__c = '椹冲洖';
+              tender.IsBid__c = null;
+            }
+            req2.setWorkitemId(wi.Id);
+            requests.add(req2);
+          }
+          system.debug('==requests.size()=='+requests.size());
+          if (requests.size() > 0) {
+            Approval.ProcessResult[] processResults = null;
+            processResults = Approval.process(requests, true);
+            system.debug('==璋冨洖缁撴灉=='+processResults);
+          }
+        }
+      }
+      // 涓嶅簲鏍囩敵璇蜂腑鐨勬椂鍊� 璋冨洖鐢宠淇敼 20210907 end
+      
+      // 鍚堝苟宸插叧鑱斿拰鏈叧鑱斿垪琛�
+      List<Opportunity> all_selected_list = new List<Opportunity>();
+      if (JsonSelected != null &&  JsonSelected != '' && JsonSelected !='[]') {
+        all_selected_list.addAll((List<Opportunity>)JSON.deserialize(JsonSelected,List<Opportunity>.class));
+      }
+      if (JsonNotSelected != null &&  JsonNotSelected != '' && JsonNotSelected !='[]') {
+        all_selected_list.addAll((List<Opportunity>)JSON.deserialize(JsonNotSelected,List<Opportunity>.class));
+      }
+      // 鎷涙爣鎵�鏈変汉鏄惁瑕佷慨鏀筬lag
+      // boolean owner_change = false;
+      // 鍏堝垹闄ゆ棫鐨刲ink
+      // 璺宠繃trigger鏍囪
+      // 娌℃湁鍒犻櫎閫昏緫
+      StaticParameter.EscapeTOLinkTrigger = true;
+      // List<Tender_Opportunity_Link__c> del_links = [select Id from Tender_Opportunity_Link__c where Tender_information__c = :BiddingId];
+      // if (del_links != null && del_links.size() > 0) {
+      //   delete del_links;
+      // }
+      // 鏇存柊璇环
+      List<Opportunity> upd_opps = new List<Opportunity>();
+      List<Opportunity> upd_opps1 = new List<Opportunity>();
+      List<String> owners = new List<String>();
+      // 鎻掑叆link
+      if (all_selected_list.size() > 0) {
+        // 璁剧疆鎷涙爣鎵�鏈変汉
+        // OppOwnerId = all_selected_list[0].ownerId;
+        // 鍒濆鍖栧弬鏁�
+        List<Tender_Opportunity_Link__c> add_list = new List<Tender_Opportunity_Link__c>();
+        // 褰撹浠峰叧鑱旇繃缁撴灉闃舵鐨勬嫑鏍囬」鐩紝鍐嶈鍙︿竴涓粨鏋滈樁娈电殑鎷涙爣椤圭洰鍏宠仈鏃讹紝浼氬洜涓烘暟鎹閿佸畾鑰屾姤閿�
+        // 鍦ㄦ澶勯噸鏂版绱㈣浠�
+        List<String> oppIds = new List<String>();
+        for (Opportunity opp : all_selected_list) {
+          oppIds.add(opp.Id);
+          owners.add(opp.ownerId);
+          // 鏂板缓link
+          Tender_Opportunity_Link__c link = new Tender_Opportunity_Link__c();
+          link.Tender_information__c = tender.Id;
+          link.Opportunity__c = opp.Id;
+          link.Tender_Opportunity_Uniq__c = String.valueOf(tender.Id) + String.valueOf(opp.Id);
+
+          add_list.add(link);
+        }
+        // 鎻掑叆link
+        if (add_list.size() > 0) {
+          insert add_list;
+        }
+        // 鎭㈠trigger鏍囪
+        StaticParameter.EscapeTOLinkTrigger = false;
+        //20220620 you SWAG-CFD4SU 鏀归�� start  濮嬬粓鏄剧ず鏈�鏂扮殑 鈶� 3锛氱粨鏋�,鈶� 4锛氬彉鏇�,鈶� 2锛氬叕鍛�,鈶� 1锛氶鍛�,鈶� 5锛氬叾浠� 
+        List<String> tenIds = new List<String>();//20220718 you 鎷涙爣浠诲姟
+        system.debug('opportunityservicetest'+oppIds);
+        if (oppIds.size() > 0) {
+          // 20221114 SWAG-CKL5UC ljh 澧炲姞 Created_Day__c,LeadSource,LeakageNumber__c
+          List<Opportunity> wait_upd_opps = [select id,Opp_Order__c,Tender_Number__c, Bidding_Project_Name_Bid__c, Bidding_Project_Name_Bid__r.InfoType__c,Created_Day__c,LeadSource,LeakageNumber__c from Opportunity where id in :oppIds ];//and Bidding_Project_Name_Bid__r.InfoType__c != '3锛氱粨鏋�'];
+          if (wait_upd_opps != null && wait_upd_opps.size() > 0) {
+            for (Opportunity opp : wait_upd_opps) {
+              /**
+              if (opp.Bidding_Project_Name_Bid__c == null || String.isBlank(opp.Bidding_Project_Name_Bid__c)) {
+                opp.Bidding_Project_Name_Bid__c = tender.Id;
+                opp.TenderBeginDate_Text__c = tender.TenderBeginTime__c;
+                upd_opps.add(opp);
+              } else if (tender.InfoType__c == '3锛氱粨鏋�' && opp.Bidding_Project_Name_Bid__r.InfoType__c != '3锛氱粨鏋�') {
+                opp.Bidding_Project_Name_Bid__c = tender.Id;
+                upd_opps.add(opp);
+              }
+              **/
+              if(opp.Opp_Order__c <= tender.Tender_Order__c){
+                opp.Bidding_Project_Name_Bid__c =tender.Id;
+                //opp.TenderBeginDate_Text__c = tender.TenderDate__c;//鏇存敼璇环2鏃朵慨鏀硅繖涓瓧娈碉紝寮曠敤瓒�20锛宼ender.TenderBeginTime__c;
+                upd_opps.add(opp);
+                //20220715 you 鎷涙爣椤圭洰 start
+                if(String.isNotBlank(tender.InfoType__c) && tender.InfoType__c=='3锛氱粨鏋�' && String.isNotBlank(tender.subInfoType__c) && (tender.subInfoType__c=='3-5锛氫腑鏍囬�氱煡' || tender.subInfoType__c=='3-6锛氬悎鍚屽叕鍛�')){
+                  tenIds.add(opp.id); //绗﹀悎鏉′欢鐢熸垚浠诲姟
+                }
+                //20220715 you 鎷涙爣椤圭洰 end
+                break;
+              }
+
+            }
+            //20220829 you SWAG-CHL67J start
+            for (Opportunity opp : wait_upd_opps) {
+              Integer returncount =0;
+              if(String.isNotBlank(tender.InfoType__c) && tender.InfoType__c!='1锛氶鍛�' && String.isNotBlank(tender.subInfoType__c) && tender.subInfoType__c!='3-1锛氬簾鏍囧叕鍛�' && tender.subInfoType__c!='3-2锛氭祦鏍囧叕鍛�'){  
+                  returncount += 1;
+                }
+              opp.Tender_Number__c = returncount;
+              // 20221114 ljh SWAG-CKL5UC start 
+              if(opp.LeakageNumber__c != 1 && tender.publicDate__c != null && String.isNotBlank(opp.LeadSource) && opp.LeadSource == '鎷涙爣缃�' && opp.Created_Day__c > tender.publicDate__c){
+                opp.LeakageNumber__c = 1;
+              }
+              // 20221114 ljh SWAG-CKL5UC start 
+              upd_opps1.add(opp);  
+            }  
+                 
+            //20220829 you SWAG-CHL67J end 
+          }
+        }
+        if (upd_opps1.size() > 0) {
+          update upd_opps1;
+        }
+        //20220620 you SWAG-CFD4SU 鏀归�� end
+        // 鏇存柊璇环涓婄殑鎷涙爣椤圭洰
+        if (upd_opps.size() > 0) {
+          update upd_opps;
+        }
+         //20220718 you 鎷涙爣浠诲姟 start
+                             
+        if (tenIds !=null && tenIds.size() > 0) {
+            Database.executeBatch(new TenderResultConfirmTaskBatch(tenIds));
+          }
+          //20220718 you 鎷涙爣浠诲姟 end
+      }
+
+      // 鏌ヨ鎷涙爣鏁伴噺骞舵洿鏂�
+      List<Tender_Opportunity_Link__c> tenderLinks = [SELECT id, Tender_information__c, Opportunity__c, Opportunity__r.Hospital__c, Opportunity__r.OwnerId FROM Tender_Opportunity_Link__c WHERE Tender_information__c = :tender.Id];
+      List<String> oppOwnerInLinks = new List<String>();
+      for (Tender_Opportunity_Link__c link : tenderLinks) {
+        oppOwnerInLinks.add(link.Opportunity__r.OwnerId);
+      }
+      // 鏇存柊鎷涙爣涓婄殑鎵�鏈変汉
+      if (tender.OwnerId == null || '00510000000gmxH'.equals(tender.OwnerId) || (oppOwnerInLinks.size() > 0 && !oppOwnerInLinks.contains(tender.OwnerId))) {
+        tender.ownerId = owners.size() > 0 ? owners.get(0) : '00510000000gmxH';
+      }
+      // 鍙嶆槧璇环鐘舵��
+      tender.IsReactionOpp__c = true;
+      // 鏌ヨ鎷涙爣鏁伴噺骞舵洿鏂�
+      //List<Tender_Opportunity_Link__c> tenderLinks = [SELECT id, Tender_information__c, Opportunity__c, Opportunity__r.Hospital__c FROM Tender_Opportunity_Link__c WHERE Tender_information__c = :tender.Id];
+      tender.OpportunityNum__c = tenderLinks != null ? tenderLinks.size() : 0;
+      // 鍏宠仈璇环鏃堕棿鍜屾槸鍚︾浉鍏崇姸鎬�
+      if (tender.IsRelateProject__c != '鏄�') {
+        tender.IsRelateProject__c = '鏄�';
+        tender.RelateOppTime__c = datetime.now();
+        tender.irrelevantReasons__c = null;
+        tender.irrelevantReasonOther__c = null;
+      }
+      // 鏇存柊鍏宠仈鍖婚櫌
+      if (tenderLinks != null && tenderLinks.size() > 0) {
+        // 鎷涙爣椤圭洰鐨勫尰闄�
+        Map<String,String> fiveHospitalMap = new Map<String,String>();
+        fiveHospitalMap.put('Hospital__c', tender.Hospital__c);
+        fiveHospitalMap.put('Hospital1__c', tender.Hospital1__c);
+        fiveHospitalMap.put('Hospital2__c', tender.Hospital2__c);
+        fiveHospitalMap.put('Hospital3__c', tender.Hospital3__c);
+        fiveHospitalMap.put('Hospital4__c', tender.Hospital4__c);
+        for(Integer i = 0; i<tenderLinks.size();i++) {
+          //褰撴嫑鎶曟爣椤圭洰鐨勪簲涓尰闄㈣祴鍊煎畬鎴愬悗涓嶅啀璧嬪��
+          Boolean HospitalIsNeedBreak = false;
+          for(String ApiName :fiveHospitalMap.keySet()){
+              HospitalIsNeedBreak = fiveHospitalMap.get(ApiName)==null?false:true;
+          }
+          
+          if(HospitalIsNeedBreak){
+              break;
+          }
+
+          //缁欐嫑鎶曟爣椤圭洰鐨�5涓尰闄㈣鍊�
+          for(String ApiName : fiveHospitalMap.keySet()){
+            String tempTenderHospId = fiveHospitalMap.get(ApiName)==null?'':fiveHospitalMap.get(ApiName);
+            String oppHospId = tenderLinks.get(i).Opportunity__r.Hospital__c; 
+            //濡傛灉鎷涙爣椤圭洰宸茬粡鏈夎鍖婚櫌灏卞垽鏂笅涓�涓浠风殑鍖婚櫌
+            if(tempTenderHospId.contains(oppHospId)){
+                break;
+            }
+
+            //鍖婚櫌涓虹┖,璧嬪�煎尰闄�(璧嬪�间箣鍚庤繘琛岃祴鍊间笅涓�涓尰闄�)
+            if(String.isBlank( fiveHospitalMap.get(ApiName) )){
+                fiveHospitalMap.put(ApiName,oppHospId);
+                break;
+            }
+          }
+        }
+        tender.Hospital__c = fiveHospitalMap.get('Hospital__c');
+        tender.Hospital1__c = fiveHospitalMap.get('Hospital1__c');
+        tender.Hospital2__c = fiveHospitalMap.get('Hospital2__c');
+        tender.Hospital3__c = fiveHospitalMap.get('Hospital3__c');
+        tender.Hospital4__c = fiveHospitalMap.get('Hospital4__c');
+      }
+      update tender;
+      // 鎷涙爣-璇环鍏宠仈淇敼 20210813 end
+      return '鎴愬姛'; 
+    }catch (Exception ex) {
+      return  ex.getMessage();
+    }
+
+  }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/OpportunityService.cls-meta.xml b/force-app/main/default/classes/OpportunityService.cls-meta.xml
new file mode 100644
index 0000000..d75b058
--- /dev/null
+++ b/force-app/main/default/classes/OpportunityService.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>51.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/OpportunityWebService.cls b/force-app/main/default/classes/OpportunityWebService.cls
new file mode 100644
index 0000000..31ce276
--- /dev/null
+++ b/force-app/main/default/classes/OpportunityWebService.cls
@@ -0,0 +1,506 @@
+global class OpportunityWebService {
+    
+    @AuraEnabled
+    WebService static String changeTrade(String oppId){
+
+        List<Quote> quoList = [select id from Quote where OpportunityId = :oppId];
+        List<OpportunityLineItem> oppLI = [select id from OpportunityLineItem where Opportunity.id = :oppId];
+
+        Opportunity opp = new Opportunity();
+        opp.id = oppId;
+        opp.Estimation_Decision__c = false;
+        opp.Estimation_Id__c = null;
+        opp.Quote_Update_Sum__c = null;
+        opp.Estimation_No__c = null;
+        opp.Estimation_Proposal_Date__c = null;
+        opp.Estimation_Name__c = null;
+        // LHJ SWAG-C9QAAJ 鍘绘帀 Start
+        // opp.Authorized_Finish_Sales__c = null;
+        // opp.Authorized_DB_No__c = null;
+        // opp.Authorized_Date__c = null;
+        // opp.Autholization_Activated_Date__c = null;
+        // opp.Bidding_Content__c = null;
+        // opp.Bid_Date__c = null;
+        // opp.Bidding_No__c = null;
+        // opp.Bidding_Project_Name__c = null;
+        // LHJ End
+
+        Savepoint sp = Database.setSavepoint();
+        try {
+            delete quoList;
+            delete oppLI;
+            update opp;
+            return '1';     
+        } catch (Exception ex) {
+            Database.rollback(sp);
+            return  ex.getMessage() + ' | Line:' + ex.getLineNumber();
+        }
+    } 
+
+    // LHJ CBPR Start
+    webservice String parameter { get; set; }
+
+    public OpportunityWebService() {
+        this.parameter = 'value';
+    }
+    @AuraEnabled
+    WebService static String oppCheck(String oppid, String saveFlg) {
+
+        Map<Id, String> proMap= new Map<Id, String>();
+        List<OpportunityLineItem> OppItemList = [select PricebookEntry.Product2Id, PricebookEntry.Product2.Name
+                                                   From OpportunityLineItem 
+                                                  Where OpportunityId = :oppid];
+
+        if (OppItemList.size() > 0) {
+            for (OpportunityLineItem opl : OppItemList) {
+                proMap.put(opl.PricebookEntry.Product2Id, opl.PricebookEntry.Product2.Name);
+            }
+        }
+
+        List<Opportunity> oppList = [select Agency1__c from Opportunity where id = :oppid];
+        String angencyId = oppList[0].Agency1__c;
+        String strRet = '';
+
+        if (saveFlg == '1') {
+            strRet = checkProRegisterDecide(proMap, angencyId, oppid);
+        } else {
+            strRet = checkProRegisterDecide(proMap, angencyId, '');
+        }
+        return strRet;
+    }
+    @AuraEnabled
+    // LHJ 闃胯タ璧涘妫�鏌� Start
+    WebService  static String checkDangerItem(String agency1) {
+        //娌℃湁鍗卞寲鍝佽瘉鐓х殑鎻愮ず淇℃伅
+        String licenseStr = '绗竴缁忛攢鍟嗘病鏈夋湁鏁堢殑鍗遍櫓鍖栧鍝佺粡钀ヨ鍙瘉銆�';
+        //娌℃湁闃胯タ璧涘缁忛攢鍟嗗崗璁殑鎻愮ず淇℃伅
+        String accStr = '绗竴缁忛攢鍟嗘病鏈夐樋瑗胯禌澶氱粡閿�鍟嗗崗璁��';
+
+        //妫�鏌ユ槸鍚︽湁璇佺収
+        List<License_Information__c> licenseList = [SELECT Id
+                                                      FROM License_Information__c
+                                                     WHERE LicenseAndAccount__c = :agency1
+                                                       AND LicenseType__c = '鍗遍櫓鍖栧鍝佺粡钀ヨ鍙瘉'
+                                                       AND Is_Active_Formula__c = true
+                                                       
+                                                    ];
+        //妫�鏌ユ槸鍚︽湁闃胯タ璧涘鍗忚
+        List<Account> accountList = [SELECT Id
+                                                      FROM Account
+                                                     WHERE Parent.id = :agency1
+                                                       //闃胯タ璧涘 澧炲姞妫�绱㈤樋瑗胯禌澶氬崗璁� 浠ュ強 鍙互鍋氭姤浠�(澶嶉�夋) 绮剧悽鎶�鏈� wql 2021/01/04 start
+                                                       AND Contract_Quote_Decide_Flag_checkbox__c =true
+                                                       AND Assiesedo_Dealer__c  = true
+                                                       //闃胯タ璧涘 澧炲姞妫�绱㈤樋瑗胯禌澶氬崗璁� 浠ュ強 鍙互鍋氭姤浠�(澶嶉�夋) 绮剧悽鎶�鏈� wql 2021/01/04 end
+                                                    ];
+
+        system.debug('licenseList:'+licenseList.size());
+        system.debug('agency1:'+agency1);
+        //鈶犳棦娌℃湁鍗卞寲鍝佽瘉涔熸病鏈夐樋瑗胯禌澶氬崗璁�
+        if(licenseList.size() == 0 && accountList.size() ==0){
+            return licenseStr+accStr;
+        }
+        //鈶℃病鏈夊嵄鍖栧搧璇�
+        else if(licenseList.size() ==0){
+            return licenseStr;
+        }
+        //鈶℃病鏈夐樋瑗胯禌澶氱粡閿�鍟嗗崗璁�
+        else if(accountList.size() ==0){
+            return accStr;
+        }
+        //鈶㈠叏閮芥湁
+        else{
+            return 'OK';
+        }
+    }
+    // LHJ 闃胯タ璧涘妫�鏌� End
+
+    public static Map<String, String> MapCheckProRegisterDecide(Map<Id, String> proMap, String agency1, String OppId) {
+
+        Map<String, String> retMap = new Map<String, String>();
+        String errormessage = '';
+        Boolean error = false;
+        Map<String,List<String>> proAllBSstrMap;
+        List<String> proNotNeedList = new List<String>();
+
+        Map<String,List<String>> old_newMap = new Map<String,List<String>>();
+        Map<String,List<String>> new_oldMap = new Map<String,List<String>>();
+
+        // 鍙栧緱 缁忚惀鑼冨洿瀵瑰簲浜у搧鍏崇郴
+        List<String> midStr = new List<String>();
+        List<String> midStrO = new List<String>();
+
+        // List<Product_Register_contrast__c> rrList = Product_Register_contrast__c.getall().values();
+
+        // for (Product_Register_contrast__c rr : rrList) {
+
+        //     midStr = new List<String>();
+        //     midStrO = new List<String>();
+
+        //     // 缁忚惀鑼冨洿瀵瑰簲浜у搧鍏崇郴 Map浣滄垚 鏃�-鏂板鐓�
+        //     if (old_newMap.containsKey(rr.Register_old__c)) {
+        //         old_newMap.get(rr.Register_old__c).add(rr.Register_new__c);
+        //     } else {
+        //         midStrO.add(rr.Register_new__c);
+        //         old_newMap.put(rr.Register_old__c, midStrO.clone());
+        //     }
+
+        //     // 缁忚惀鑼冨洿瀵瑰簲浜у搧鍏崇郴 Map浣滄垚 鏂�-鏃у鐓�
+        //     if (new_oldMap.containsKey(rr.Register_new__c)) {
+        //         new_oldMap.get(rr.Register_new__c).add(rr.Register_old__c);
+        //     } else {
+        //         midStr.add(rr.Register_old__c);
+        //         new_oldMap.put(rr.Register_new__c, midStr.clone());
+        //     }
+            
+        // }
+        // 鍙栧緱缁忛攢鍟� 鍖荤枟鍣ㄦ缁忚惀璁稿彲璇�
+        List<License_Information__c> licenseList = [SELECT Id,
+                                                           ScopeKey__c, 
+                                                           LicenseType__c
+                                                      FROM License_Information__c
+                                                     WHERE LicenseAndAccount__c = :agency1
+                                                    AND (LicenseType__c = '鍖荤枟鍣ㄦ缁忚惀璁稿彲璇�'
+                                                        OR LicenseType__c = '绗簩绫诲尰鐤楀櫒姊扮粡钀ュ妗堝嚟璇�')
+                                                      AND Is_Active_Formula__c = true
+                                                    ];
+        // 鍒ゆ柇 鍖荤枟鍣ㄦ缁忚惀璁稿彲璇� 鏄惁瀛樺湪
+        if (licenseList.size() == 0) {
+            error = true;
+            errormessage = '绗竴缁忛攢鍟嗘病鏈夋湁鏁堢殑鍖荤枟鍣ㄦ缁忚惀璁稿彲璇併��';
+            retMap.put('agency', '0');
+
+        } else {
+            //缁忛攢鍟嗙粡钀ヨ寖鍥�
+            List<String> agListA = new List<String>();
+            List<String> agListTemp = new List<String>();
+            List<String> agList = new List<String>();
+
+            //鍙栫粡閿�鍟嗕笅 鎵�鏈夊尰鐤楀櫒姊扮粡钀ヨ鍙瘉銆佺浜岀被鍖荤枟鍣ㄦ缁忚惀澶囨鍑瘉
+            for (License_Information__c li : licenseList) {
+                if (li.ScopeKey__c != null) {
+                    agListA.addAll(li.ScopeKey__c.split(';'));
+                    agListTemp.addAll(li.ScopeKey__c.split(';'));
+                }
+            }
+            for (String a : agListTemp) {
+                if (a.length() >= 6) {
+                    agList.add(a.substring(0, a.length() - 1));
+                } else {
+                    agList.add(a.trim());
+                }                
+            }
+
+            //浜у搧娉ㄥ唽璇�
+            Map<String,Map<String,String>> proBSMap = new Map<String,Map<String,String>>();
+            
+            Map<String,String> proMidMap = null;
+            //浜у搧鎵�鏈夋湁鏁堟敞鍐岃瘉锛堝彲浠ュ拰缁忛攢鍟嗗尮閰嶏級
+            proAllBSstrMap = new Map<String,List<String>>();
+            set<Id> proIdList = new set<Id>();
+
+            for (String qli : proMap.keySet()) {     
+                    proIdList.add(qli);
+                    proBSMap.put(qli, proMidMap);
+                    List<String> empList = new List<String>();
+                    proAllBSstrMap.put(qli, empList);
+                
+            }
+
+            List<Product_Register_Link__c> prls = [
+                                                 Select Product2__c,
+                                                        Product2__r.Asset_Model_No__c,
+                                                        Product2__r.SFDA_Approbated_Status__c,
+                                                        Product2__r.SFDA_Status_New__c, // 浜у搧鐨凜FDA鏈�缁堢姸鎬� 20181225
+                                                        Product_Register__r.Name,
+                                                        Product_Register__r.BusinessScopeKey__c, 
+                                                        Product_Register__r.RegisterNoStatus__c,
+                                                        Product_Register__r.MedPrdClass__c 
+                                                   From Product_Register_Link__c
+                                                  where Product2__c in :proIdList
+                                                  ];
+
+            // LHJ 20190102 澧炲姞璺宠繃閫昏緫 Start
+            List<Product2> productList = [select ID,SFDA_Status__c from Product2 where id in :proIdList];
+            for (Product2 pro : productList) {
+                if (pro.SFDA_Status__c == '涓嶈') {
+                    proNotNeedList.add(pro.ID);
+                }
+            }
+            // LHJ 20190102 澧炲姞璺宠繃閫昏緫 End
+
+            for (Product_Register_Link__c prl : prls) {
+                
+                // 璁剧疆浜у搧绫诲埆MAP
+                if (String.isNotBlank(prl.Product_Register__r.BusinessScopeKey__c)) {
+                    system.debug('Product2 +++++++' + prl.Product2__c);
+                    if (proBSMap.get(prl.Product2__c) != null) {
+                        proBSMap.get(prl.Product2__c).put(prl.Product_Register__r.Name, prl.Product_Register__r.BusinessScopeKey__c);
+                    
+                    } else {
+                        Map<String,String> toooMap = new Map<String,String>();
+                        toooMap.put(prl.Product_Register__r.Name, prl.Product_Register__r.BusinessScopeKey__c);
+                        proBSMap.put(prl.Product2__c, toooMap.clone());
+                    }
+                }
+
+                // 浜у搧鐨勪骇鍝佹敞鍐岃瘉鏄�"涓嶈"鐘舵�� 涓嶉渶瑕佸尮閰嶆敞鍐岃瘉 20181225
+                if (prl.Product2__r.SFDA_Approbated_Status__c == '涓嶈' 
+                        
+                        || prl.Product_Register__r.MedPrdClass__c == '1') {
+                     proNotNeedList.add(prl.Product2__c);
+                }
+            }
+            system.debug('proBSMap +++++++' + proBSMap);
+            for (String qli : proMap.keySet()) {
+
+                String proId = qli;
+                String proName = proMap.get(proId);
+
+                if (proId != null) {
+                    Boolean haveBS = false;
+
+                    // 浜у搧灞炰簬闈炲尰鐤楋紝涓嶇敤鍒ゆ柇缁忚惀鑼冨洿
+                    if (proNotNeedList.contains(proId)) {
+                        haveBS = true;
+                        continue;
+                    }
+
+                    if (proBSMap.get(proId) == null) {
+                        error = true;
+                        errormessage += '浜у搧"' + proName + '"娌℃湁鏈夋晥鐨勪骇鍝佹敞鍐岃瘉銆俓n';
+                        retMap.put(proId, '1');
+                        continue;
+                    }
+
+
+                    if (proBSMap.get(proId) != null) {
+                        system.debug('111 +++++++' + proBSMap);
+                        Map<String,String> midMap = new Map<String,String>();
+                        midMap = proBSMap.get(proId);
+
+                        for (String str : midMap.keySet()) {
+                            // LHJ 20200711 Start
+                            String strMidMap = midMap.get(str);
+                            List<String> proRegList = new List<String>();
+                            proRegList.addAll(strMidMap.split(';'));
+                            // LHJ 20200711 End
+                            for(String strReg:proRegList){
+                                // 琚畾涔変负"6815A"鐨勪骇鍝佺被鍒�,缁忚惀鑼冨洿涓繀椤绘湁6815鎴栬��6815A澶栨墠鍙互鍖归厤銆�
+                                if (strReg.length() == 6) {
+                                
+                                    for(String strAg:agListA){
+                                        if(strAg.length() >= 5 && midMap.get(str.substring(0, str.length() - 1)) == strAg.substring(0,5)){
+                                            proAllBSstrMap.get(proId).add(str.substring(0, str.length() - 1));
+                                            haveBS = true;
+                                            break;
+                                        }
+                                    }
+
+                                    /*if (agListA.contains(midMap.get(str.substring(0, str.length() - 1)))) {
+                                        proAllBSstrMap.get(proId).add(str.substring(0, str.length() - 1));
+                                        haveBS = true;
+                                    }*/
+                                } else {
+                                    system.debug('agList +++++++' + agList);
+                                    system.debug('midMap +++++++' + strReg);
+
+                                    if (agList.contains(strReg)) {
+
+                                        //浜у搧绫诲埆,鍖归厤鍒扮粡閿�鍟嗙被鍒�
+                                        proAllBSstrMap.get(proId).add(str);
+                                        haveBS = true;
+                                        break;
+                                    }
+                                }  
+                            }
+                            
+                                                      
+                        }
+                    }
+
+                    if (!haveBS) {
+                        error = true;
+                        errormessage += '绗竴缁忛攢鍟嗙殑缁忚惀鑼冨洿涓笉鍖呭惈浜у搧" ' + proName + '"銆俓n';
+                        retMap.put(proId, '2');
+                    }
+                }
+            }
+        }
+
+        if (retMap.isEmpty() == false) {
+            //return errormessage;
+            
+        } else {
+            if (OppId != '') {
+                // 鏇存柊鎵�鏈夋敞鍐岃瘉淇℃伅
+                String strRegister_alleffective;
+                List<Product2> pro2List = new List<Product2>();
+                Map<String, Product2> pro2Map = new Map<String, Product2>();
+                List<OpportunityLineItem> updList = new List<OpportunityLineItem>();
+                List<OpportunityLineItem> OppItemList = [select id, Id__c, Register_alleffective__c,PricebookEntry.Product2Id
+                                                           From OpportunityLineItem 
+                                                          Where OpportunityId = :OppId];
+                // 闈炲尰鐤楁垨1绫讳骇鍝侊紝鍙栧緱
+                if (proNotNeedList != null && proNotNeedList.size() > 0) {
+                    pro2List = [select id, SFDA_Approbated_Status__c, RegisterNo_ALL__c from Product2 where Id in :proNotNeedList];
+                }
+                for (Product2 pro2 : pro2List) {
+                    pro2Map.put(pro2.Id, pro2);
+                }
+
+                for (OpportunityLineItem ol : OppItemList) {
+                    if (proAllBSstrMap.containsKey(ol.PricebookEntry.Product2Id)) {
+                        ol.Register_alleffective__c = '';
+                        for(String str: proAllBSstrMap.get(ol.PricebookEntry.Product2Id)) {
+
+                            if (String.isNotBlank(ol.Register_alleffective__c)) {
+                                ol.Register_alleffective__c += ';' + str;
+                            } else {
+                                ol.Register_alleffective__c = str;
+                            }
+                        }
+                        // 闈炲尰鐤楁垨1绫讳骇鍝�
+                        if (pro2Map.containskey(ol.PricebookEntry.Product2Id)) {
+                            if (pro2Map.get(ol.PricebookEntry.Product2Id).SFDA_Approbated_Status__c == '涓嶈') {
+                                ol.Register_alleffective__c = 'FYL';
+                            } else {
+                                ol.Register_alleffective__c = pro2Map.get(ol.PricebookEntry.Product2Id).RegisterNo_ALL__c;
+                            }
+                        }
+                    }
+                    updList.add(ol);
+                }
+                if (updList.size() > 0)  update updList;
+            }
+        }
+        //濡傛灉涓嶆弧瓒抽樋瑗胯禌澶氱殑鏉′欢锛岃繘鍏ヨ繖涓彉閲� 20200821 ljh 
+        return retMap;
+    }
+
+    public static String checkProRegisterDecide(Map<Id, String> proMap, String agency1, String OppId) {
+    
+        String errormessage = '';
+        Boolean error = false;
+
+        Map<String, String> CheckMap = new Map<String, String>();
+        CheckMap = MapCheckProRegisterDecide(proMap, agency1, OppId);
+        if (CheckMap.isEmpty()) {
+            return 'OK';
+        } else {
+            return '鏈変笉鍙攢鍞骇鍝佹垨瓒呭嚭缁忛攢鍟嗙粡钀ヨ寖鍥达紝璇锋洿鏂版姤浠峰崟' + CheckMap;
+        }
+
+    }
+    @AuraEnabled
+    WebService static String updReg(String  oppid) {
+
+        List<OpportunityLineItem> updList = new List<OpportunityLineItem>();
+        List<OpportunityLineItem> OppItemList = [select id, Id__c, Register_alleffective__c,
+                                                        PricebookEntry.Product2.RegisterNo_ALL__c 
+                                                           From OpportunityLineItem 
+                                                          Where OpportunityId = :oppid];
+        for (OpportunityLineItem ol : OppItemList) {
+            ol.Register_alleffective__c = ol.PricebookEntry.Product2.RegisterNo_ALL__c;
+            updList.add(ol);
+        }
+        if (updList.size() > 0)  update updList;
+        return 'OK';
+    }
+    //SWAG-CG88AG銆愬鎵樸�戞彁鍑轰环鏍肩敵璇锋槸鍦ㄥ崗璁湁鏁堟湡鍐咃紝鍏佽WIN fy start 
+    WebService static Boolean judgeIsAssistantAppliedOutTime(String  Quoteid) {
+        List<PromotionSales__c> PromotionSalesList = [select id,IsAssistantAppliedOutTime__c from PromotionSales__c where Quote__r.Quote_No__c =:Quoteid];
+        for(PromotionSales__c pro : PromotionSalesList){
+            if(pro.IsAssistantAppliedOutTime__c){
+                return false;
+            }
+        }
+        return true;
+    }
+    //SWAG-CG88AG銆愬鎵樸�戞彁鍑轰环鏍肩敵璇锋槸鍦ㄥ崗璁湁鏁堟湡鍐咃紝鍏佽WIN fy end 
+
+    //璐告槗鍚堣 20230307 you start
+    WebService static Boolean accSendEmail(String  AccDealerBlacklist,String accname,String angency1,String angency2,String ownerids,String ddid,String oppid) {
+      //鍙戦�侀偖浠�
+        List<Messaging.SingleEmailMessage> sendMails = new List<Messaging.SingleEmailMessage>();
+        List<String>  MailsList = new List<String>();
+        List<String> userIdList = new List<String>();
+        if(String.isNotBlank(ownerids)){
+            userIdList.add(ownerids);
+        }
+        if(String.isNotBlank(ddid)){
+            userIdList.add(ddid);
+        }
+         //璇环鎵�鏈変汉锛屼骇鍝佹媴褰擄紝鍙戦偖浠�
+        List<User> UsrList = [SELECT email FROM user WHERE id in :userIdList]; 
+        //鑾峰彇鍚勪釜鐢ㄦ埛鐨別mail
+        for (User u : UsrList){
+            MailsList.add(u.email);
+        }
+        MailsList.add('youchang@prec-tech.com');
+        system.debug('111===:'+MailsList);
+        if (MailsList!=null&&MailsList.size()>0){
+            String title = '';
+            String body = '';
+            title = ' 鏂板缓璇环鍖婚櫌/缁忛攢鍟嗘秹鍙婇粦鍚嶅崟';
+            if(AccDealerBlacklist=='123'){
+                body += '榛戝悕鍗曠殑瀹㈡埛涓猴細' + accname+ '<br/>';
+                body += '榛戝悕鍗曠殑缁忛攢鍟�1涓猴細' + angency1+ '<br/>';
+                body += '榛戝悕鍗曠殑缁忛攢鍟�2涓猴細' + angency2+ '<br/>';
+            }else if(AccDealerBlacklist=='12'){
+                body += '榛戝悕鍗曠殑瀹㈡埛涓猴細' + accname+ '<br/>';
+                body += '榛戝悕鍗曠殑缁忛攢鍟�1涓猴細' + angency1+ '<br/>';
+            }else if(AccDealerBlacklist=='23'){
+                body += '榛戝悕鍗曠殑缁忛攢鍟�1涓猴細' + angency1+ '<br/>';
+                body += '榛戝悕鍗曠殑缁忛攢鍟�2涓猴細' + angency2+ '<br/>';
+            }else if(AccDealerBlacklist=='13'){
+                body += '榛戝悕鍗曠殑瀹㈡埛涓猴細' + accname+ '<br/>';
+                body += '榛戝悕鍗曠殑缁忛攢鍟�2涓猴細' + angency2+ '<br/>';
+            }else if(AccDealerBlacklist=='1'){
+                body += '榛戝悕鍗曠殑瀹㈡埛涓猴細' + accname+ '<br/>';
+            }else if(AccDealerBlacklist=='2'){
+                body += '榛戝悕鍗曠殑缁忛攢鍟�1涓猴細' + angency2+ '<br/>';
+            }else if(AccDealerBlacklist=='3'){
+                body += '榛戝悕鍗曠殑缁忛攢鍟�2涓猴細' + angency2+ '<br/>';
+            }
+           
+            body += '<a href="' + System.Label.Environment_Url + oppid + '">'
+                    + System.Label.Environment_Url+ oppid +'</a><br/>'; 
+            body += '璋㈣阿锛�';
+  
+            Messaging.SingleEmailMessage messageNEW = new Messaging.SingleEmailMessage();
+            messageNEW.setSubject(title);
+            messageNEW.setHtmlBody(body);
+            messageNEW.setCharset('UTF-8');
+            messageNEW.setToAddresses(MailsList); 
+
+            //List<String> toCcMailsList = new List<String>();
+            //toCcMailsList.add('youchang@prec-tech.com');
+            //messageNEW.setCcAddresses(toCcMailsList); 
+            
+            sendMails.add(messageNEW);
+
+        }                      
+            
+        boolean rs = true;
+        if (sendMails.size() > 0) {
+            Messaging.Email[] allMails = new Messaging.Email[]{};
+            for(Integer j = 0; j < sendMails.size(); j++) {
+                allMails.add(sendMails.get(j));
+            }
+            system.debug('222===:'+allMails);
+        
+            Messaging.SendEmailResult[] results = Messaging.sendEmail(allMails);
+            System.debug('results 缁撴灉 :'+results);
+            for (Integer i = 0; i < results.size(); i++) {
+                if (results[i].success == false) {
+                    system.debug('=====send mail error:' + results[i].errors[0].message);
+                    rs = false;
+                }   
+            }
+        }
+        return rs;
+    }
+    //璐告槗鍚堣 20230307 you end
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/OpportunityWebService.cls-meta.xml b/force-app/main/default/classes/OpportunityWebService.cls-meta.xml
new file mode 100644
index 0000000..38aa015
--- /dev/null
+++ b/force-app/main/default/classes/OpportunityWebService.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>36.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/QISReportController.cls b/force-app/main/default/classes/QISReportController.cls
index c778eac..296a17c 100644
--- a/force-app/main/default/classes/QISReportController.cls
+++ b/force-app/main/default/classes/QISReportController.cls
@@ -350,16 +350,482 @@
         }
          return re;
     }
+    //OCSM涓嶈鎶ュ憡
+    @AuraEnabled
+    public static InitData initForlexOCSMNoToReportLightingButton (String recordId){
+        InitData res = new initData();
+        try{
+            QIS_Report__c report = [SELECT  id ,OCSMAdministrativeReportNumber__c,OCSMAdministrativeReportDate__c,Aware_date__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];  
+            res.Id = report.Id;
+            res.oCSMAdministrativeReportNumber = report.OCSMAdministrativeReportNumber__c;
+            res.oCSMAdministrativeReportDate = report.OCSMAdministrativeReportDate__c;
+            res.Awaredate = report.Aware_date__c;
+            System.debug(LoggingLevel.INFO, '*** res: ' + res);
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+        }
+        return res;
+    }
+    @AuraEnabled
+    public static String updateQisForlexOCSMNoToReportLighting (String recordId){
+        String re = '鎴愬姛'; 
+        QIS_Report__c report = [SELECT  id FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+        try{
+                QIS_Report__c rac  = new QIS_Report__c();   
+                rac.id = recordId;
+                rac.OCSMAdministrativeReportStatus__c = '鏃犻渶鎶ュ憡';
+                update rac;        
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+            re = e.getMessage();
+        }
+         return re;
+    }
+    //OCSM瑕佹姤鍛�
+    @AuraEnabled
+    public static InitData initForlexOCSMToReportLightingButton (String recordId){
+        InitData res = new initData();
+        try{
+            QIS_Report__c report = [SELECT  id ,OCSMAdministrativeReportStatus__c,Aware_date__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];  
+            res.Id = report.Id;
+            res.oCSMAdministrativeReportStatus = report.OCSMAdministrativeReportStatus__c;
+            res.Awaredate = report.Aware_date__c;
+            System.debug(LoggingLevel.INFO, '*** res: ' + res);
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+        }
+        return res;
+    }
 
+    @AuraEnabled
+    public static String updateQisForlexOCSMToReportLighting (String recordId){
+        String re = '鎴愬姛'; 
+        QIS_Report__c report = [SELECT  id FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+        try{
+                QIS_Report__c rac  = new QIS_Report__c();   
+                rac.id = recordId;
+                rac.OCSMAdministrativeReportStatus__c  = '寰呮姤鍛�';
+                update rac;        
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+            re = e.getMessage();
+        }
+         return re;
+    }
+
+    //鍙戦�丵IS鍒癝PO
+    @AuraEnabled
+    public static InitData initForlexSendQISButton (String recordId){
+        InitData res = new initData();
+        ID myUserID = UserInfo.getUserId();
+        User userinfo = [SELECT id,Profile.name FROM User WHERE Id = :myUserID LIMIT 1];
+        try{
+            QIS_Report__c report = [SELECT  id ,RecordTypeId,IsSendQIS__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+            RecordType rec = [SELECT id,name FROM RecordType where  Id = :report.RecordTypeId];
+            res.Id = report.Id;
+            res.qisRecordTypeId = report.RecordTypeId;
+            res.qisRecordName = rec.name;
+            res.profileName = userinfo.Profile.name;
+            res.IsSendQIS = report.IsSendQIS__c;
+            System.debug(LoggingLevel.INFO, '*** res: ' + res);
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+        }
+        return res;
+    }
+
+    @AuraEnabled
+    public static String updateQisForSendQIS (String recordId){
+        String re = '鎴愬姛'; 
+        QIS_Report__c report = [SELECT Id,Name,IsSendQIS__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+        if(report == null ){
+            return '娌℃湁QIS锛�' + recordId + '鐨勬暟鎹��';
+        }
+        Savepoint sp = Database.setSavepoint(); 
+        try{    
+                
+                QIS_Report__c rac  = new QIS_Report__c();   
+                rac.id = recordId;
+                rac.IsSendQIS__c = true;
+                update rac;
+        }catch(Exception e){
+            Database.rollback(sp);
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+            re = e.getMessage();
+        }
+         return re;
+    }
+    // OCSM鏈嶅姟鏈儴鏀跺埌瀹炵墿
+    @AuraEnabled
+    public static InitData initForlexRCRecievedButton (String recordId){
+        InitData res = new initData();
+        ID myUserID = UserInfo.getUserId();
+        User userinfo = [SELECT id,Profile.name FROM User WHERE Id = :myUserID LIMIT 1];
+        try{
+            QIS_Report__c report = [SELECT  id ,isAE_Profile__c,QIS_Status__c,isPAE_Profile__c,is_CNBuy__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+            res.Id = report.Id;
+            res.isAEProfile = report.isAE_Profile__c;
+            res.isPAEProfile = report.isPAE_Profile__c;
+            res.QIStatus = report.QIS_Status__c;
+            res.isCNBuy = report.is_CNBuy__c;
+            System.debug(LoggingLevel.INFO, '*** res: ' + res);
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+        }
+        return res;
+    }
+
+    @AuraEnabled
+    public static String updateQisForRCRecieved (String recordId){
+        String re = '鎴愬姛'; 
+        ID myUserID = UserInfo.getUserId();
+        User userinfo = [SELECT id,Alias,BuchangApprovalManagerSales__c,JingliApprovalManager__c, BuchangApprovalManager__c, ZongjianApprovalManager__c FROM User WHERE Id = :myUserID LIMIT 1];
+
+        try{    
+                QIS_Report__c rac  = new QIS_Report__c();   
+                rac.id = recordId;
+
+                rac.QIS_Status__c = 'RC妫�娴嬩腑';
+                rac.OCM_RC_RecievedDate__c = Date.today();
+                rac.RC__c = myUserID;
+                rac.RC_Receive_staff__c = userinfo.Alias;
+
+                if (userinfo != null  && userinfo.BuchangApprovalManagerSales__c!= null) {
+                    rac.RC_Manager__c = userinfo.BuchangApprovalManagerSales__c;
+                } else {
+                    rac.RC_Manager__c = myUserID;
+                }
+                update rac;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+            re = e.getMessage();
+        }
+         return re;
+    }
+    // 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;
         @AuraEnabled
+        public String qISSCReport;
+        @AuraEnabled
+        public String name;
+        @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
         public String qisRecordName;
+        @AuraEnabled
+        public String nextaction;
+        @AuraEnabled
+        public String qISMarketCategory;
         @AuraEnabled
         public String profileName;
         @AuraEnabled
@@ -393,6 +859,12 @@
         @AuraEnabled
         public Date qISInstallDate;
         @AuraEnabled
+        public Date oSHInspectionDate;
+        @AuraEnabled
+        public Date faliourdate;
+        @AuraEnabled
+        public Date trableoccurdaYcollect;
+        @AuraEnabled
         public Date cdsdate;
         @AuraEnabled
         public Date awaredate;
@@ -404,6 +876,9 @@
         public Boolean isaohuiproduct;
         @AuraEnabled
         public Boolean isSendQIS;
+        @AuraEnabled
+        public Boolean specialfollow;
+        
     }
 
 }
\ No newline at end of file
diff --git a/force-app/main/default/classes/RentalApplyControllerLWT.cls b/force-app/main/default/classes/RentalApplyControllerLWT.cls
new file mode 100644
index 0000000..ea1812a
--- /dev/null
+++ b/force-app/main/default/classes/RentalApplyControllerLWT.cls
@@ -0,0 +1,290 @@
+public with sharing class RentalApplyControllerLWT {
+    public RentalApplyControllerLWT() {
+        
+    }
+    @AuraEnabled
+    public static Rental_Apply__c initFromCancelSubmitButton(String recordId){
+        InitData res = new InitData();
+        try{
+            Rental_Apply__c report=[select 
+             Status__c,Yi_loaner_arranged__c,Id,RA_Status__c,
+            demo_purpose2__c,Follow_UP_Opp__c,Statu_Achievements__c,Statu_Achievements_ID__c,
+            Request_shipping_day__c,Demo_purpose1__c,Repair__c,RecordTypeId,SupplementCreated__c,
+            OPDPlan__c,Campaign__c,QIS_number__c,OwnerId,
+            // QIS_numberId__c,CampaignId__c,applyUserId__c锛�
+            Re_repair__c,
+            QIS_ID_Line__c,
+            applyUser__c
+             from Rental_Apply__c where Id= :recordId];
+            return report;
+            // res.StatusC=report.Status__c;
+            // res.Id=report.Id;
+            // res.YiLoanerArrangedC=report.Yi_loaner_arranged__c;
+            // res.RAStatusC=report.RA_Status__c;
+            // res.DemoPurpose2C=report.demo_purpose2__c;
+            // res.FollowUPOppC=report.Follow_UP_Opp__c;
+            // res.StatuAchievementsC=report.Statu_Achievements__c;
+            // res.StatuAchievementsIDC=report.Statu_Achievements_ID__c;
+            // res.RequestShippingDayC=report.Request_shipping_day__c;
+            // res.DemoPurpose1C=report.Demo_purpose1__c;
+            // res.RepairC=report.Repair__c;
+            // res.RecordTypeId=report.RecordTypeId;
+            // res.SupplementCreatedC=report.SupplementCreated__c;
+            // res.OPDPlanC=report.OPDPlan__c;
+            // res.CampaignC=report.Campaign__c;
+            // res.QISNumberC=report.QIS_number__c;
+            // res.QISNumberIdc=report.QIS_numberId__c;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+
+
+    @AuraEnabled
+    public static list<Rental_Apply_Equipment_Set_Detail__c> selectRentalApplyEquipmentSetDetailByRacId(String recordId){
+        InitData res = new InitData();
+        try{
+            list<Rental_Apply_Equipment_Set_Detail__c> report=[select 
+            Id, Fixture_Model_No_F__c, Product_Status_Flag_F__c 
+            from Rental_Apply_Equipment_Set_Detail__c where Rental_Apply__c = :recordId]; 
+            return report;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+
+    @AuraEnabled
+    public static list<QIS_Report__c> selectQISReportById(String recordId){
+        InitData res = new InitData();
+        try{
+            list<QIS_Report__c> report=[select 
+            Id, nonyushohin__r.Product2.Fixture_Model_No_T__c 
+            from QIS_Report__c 
+            where id = :recordId
+            ]; 
+            return report;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+    
+    @AuraEnabled
+    public static list<Repair__c> selectRepairById(String recordId){
+        InitData res = new InitData();
+        try{
+            list<Repair__c> report=[select Id, Repair_Rank__c, DW_Sign_Txt__c, FSE_ApplyForRepair_Day__c, Delivered_Product__r.Product2.Fixture_Model_No_T__c
+                 , ReRepairObject_F__c,Status1__c,Agreed_Date__c,Repair_Estimated_date_formula__c,Repair_Ordered_Date__c
+                 , IfCheckFixture__c
+                 , Repair_Final_Inspection_Date__c,Repair_Shipped_Date__c,Number_of_EffectiveContract__c, NewProductGuaranteeObject__c, Delivered_Product__r.Product2.Asset_Model_No__c
+                 from Repair__c where id = :recordId
+            ]; 
+            return report;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+
+    @AuraEnabled
+    public static list<Campaign> selectCampaignById(String recordId){
+        InitData res = new InitData();
+        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__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+    @AuraEnabled
+    public static list<Rental_Apply_Equipment_Set__c> selectRentalApplyEquipmentSetByRacId(String recordId){
+        InitData res = new InitData();
+        try{
+            list<Rental_Apply_Equipment_Set__c> report=[select Id 
+                from Rental_Apply_Equipment_Set__c 
+                where RetalFSetDetail_Cnt__c = 0 AND Rental_Apply__c = :recordId
+            ]; 
+            return report;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+
+    @AuraEnabled
+    public static list<Rental_Apply__c> selectRentalApplyById(String recordId){
+        InitData res = new InitData();
+        try{
+            list<Rental_Apply__c> report=[select 
+            id,OPDPlan__c,OPDPlan__r.SalesManager_Txt__c,OPDPlan__r.BuchangApprovalManagerSales_Txt__c 
+            from Rental_Apply__c where id = :recordId
+
+            ]; 
+            return report;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+
+    @AuraEnabled
+    public static list<User> selectUserById(String recordId){
+        InitData res = new InitData();
+        try{
+            list<User> report=[select 
+            id,JingliEquipmentManager__c,JingliEquipmentManager__r.Name,Buzhang_Equipment_Manager__c,
+            Buzhang_Equipment_Manager__r.Name 
+            from User where id = :recordId
+            ]; 
+            return report;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+
+    @AuraEnabled
+    public static list<QIS_report__c> selectQISreportById2(String recordId){
+        InitData res = new InitData();
+        try{
+            list<QIS_report__c> report=[select id,next_action__c 
+            from QIS_report__c where id =:recordId
+            ]; 
+            return report;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+
+         
+    @AuraEnabled
+    public static String getUserId(){
+        
+        return UserInfo.getUserId();
+    }
+
+    @AuraEnabled
+    public static String getProfileId(){
+        return UserInfo.getProfileId();
+    }   
+
+    @AuraEnabled
+    public static String setSObjectShare(String sobjectName, String rowCause, String parentId, List<String> userAccess, String ownerId) {
+
+        try {
+            List<SObject> sObjList = new List<SObject>();
+            for (String ua : userAccess) {
+                String userid = ua.split('_')[0];
+                String access = ua.split('_')[1];
+                SObject sObj = Schema.getGlobalDescribe().get(sobjectName).newSObject();
+                if (String.isBlank(userid) == false && userid.substring(0, 15) != ownerId.substring(0, 15)) {
+                    sObj.put('RowCause', rowCause);
+                    sObj.put('ParentId', parentId);
+                    sObj.put('UserOrGroupId', userid);
+                    sObj.put('AccessLevel', access);
+                    sObjList.add(sObj);
+                }
+            }
+            if (sObjList.size() > 0) insert sObjList;
+            return 'OK';
+        } catch (Exception e) {
+            return e.getMessage();
+        }   
+    }
+
+    @AuraEnabled
+    public static UpdateResult updateRentalApplyC(        
+        String recordId,
+        String SalesManagerSubmitC,
+        String StatusC,
+        String OPDManagerApproverC,
+        String BuchangApprovalManagerSalesSubmitC,
+        String OPDBuchangApproverC
+    ) {
+        UpdateResult result = new UpdateResult();
+        result.recordId = recordId;
+        try{
+            // 鏇存柊璁板綍骞惰幏鍙栫粨鏋�
+            if(recordId==null) return null;
+            Rental_Apply__c rac = new Rental_Apply__c( id=recordId);
+
+            if(SalesManagerSubmitC!=null&& SalesManagerSubmitC != ''){
+                rac.SalesManagerSubmit__c=SalesManagerSubmitC;
+            }
+            if(StatusC!=null&&StatusC!=''){
+                rac.Status__c=StatusC;
+            }
+            if(OPDManagerApproverC!=null&&OPDManagerApproverC!=''){
+                rac.OPDManagerApprover__c=OPDManagerApproverC;
+            }
+            if(BuchangApprovalManagerSalesSubmitC!=null&&BuchangApprovalManagerSalesSubmitC!=''){
+                rac.BuchangApprovalManagerSalesSubmit__c=BuchangApprovalManagerSalesSubmitC;
+            }
+            if(OPDBuchangApproverC!=null&&OPDBuchangApproverC!=''){
+                rac.OPDBuchangApprover__c=OPDBuchangApproverC;
+            }
+            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;
+    }
+
+    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 StatusC;
+        @AuraEnabled
+        public Decimal YiLoanerArrangedC;
+        @AuraEnabled
+        public String Id;
+        @AuraEnabled
+        public String RAStatusC;
+
+        @AuraEnabled
+        public String DemoPurpose2C;
+        @AuraEnabled
+        public String FollowUPOppC;
+        @AuraEnabled
+        public String StatuAchievementsC;
+        @AuraEnabled
+        public String StatuAchievementsIDC;
+        @AuraEnabled
+        public Date RequestShippingDayC;
+        @AuraEnabled
+        public String DemoPurpose1C;
+        @AuraEnabled
+        public String RepairC;
+        @AuraEnabled
+        public String RecordTypeId;
+        @AuraEnabled
+        public Boolean SupplementCreatedC;
+        @AuraEnabled
+        public String OPDPlanC;
+        @AuraEnabled
+        public String CampaignC;
+        @AuraEnabled
+        public String QISNumberC;
+        @AuraEnabled
+        public String QISNumberIdc;
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/RentalApplyControllerLWT.cls-meta.xml b/force-app/main/default/classes/RentalApplyControllerLWT.cls-meta.xml
new file mode 100644
index 0000000..d75b058
--- /dev/null
+++ b/force-app/main/default/classes/RentalApplyControllerLWT.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>51.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/RentalApplyESetRefreshStatusController.cls b/force-app/main/default/classes/RentalApplyESetRefreshStatusController.cls
new file mode 100644
index 0000000..d809cbf
--- /dev/null
+++ b/force-app/main/default/classes/RentalApplyESetRefreshStatusController.cls
@@ -0,0 +1,100 @@
+public with sharing class RentalApplyESetRefreshStatusController {
+    public RentalApplyESetRefreshStatusController() {
+        
+    }
+    @AuraEnabled
+    public static String eSetRefreshStatus(String raeSetId) {
+        return eSetRefreshStatusBatch(new List<String> {raeSetId});
+    }
+  
+    public static String eSetRefreshStatusBatch(List<String> raeSetIds) {
+        List<Rental_Apply_Equipment_Set__c> updateList1 = new List<Rental_Apply_Equipment_Set__c>();
+
+        if (!raeSetIds.isEmpty()) {
+            for (Rental_Apply_Equipment_Set__c raes: [
+                    select Id,Repair_Status1__c,Repair_Status_Text__c,Final_reply_day__c,Final_reply_day_text__c,
+                            Received_Confirm_NG_Not_Return__c,Received_Confirm_NG_Not_Return_Text__c,
+                            Received_Confirm_Status_Text__c, Received_Confirm_Status_F__c
+                              , NG_Final_reply_day_Text__c
+                              , NG_Final_reply_day_F__c
+                              , Yizhouweixiu_Final_reply_day_Text__c
+                              , Yizhouweixiu_Final_reply_day_F__c
+                              , Extend_Final_reply_day_Text__c
+                              , Extend_Final_reply_day_F__c
+                              , QIS_Final_reply_day_Text__c
+                              , QIS_Final_reply_day_F__c
+                              , Repair_cancel_Final_reply_day_Text__c
+                              , Repair_cancel_Final_reply_day_F__c
+                              , Return_to_office_Final_reply_day_Text__c
+                              , Return_to_office_Final_reply_day_F__c
+                              , Repair_delete_Final_reply_day_Text__c
+                              , Repair_delete_Final_reply_day_F__c
+                              , Yigoudaihuo_Final_reply_day_Text__c
+                              , Yigoudaihuo_Final_reply_day_F__c
+                              , Guzhangpaicha_Final_reply_day_Text__c
+                              , Guzhangpaicha_Final_reply_day_F__c
+                              , Repair_Agreed_Quotation_Text__c
+                              , Repair_Agreed_Quotation_F__c
+                              , Return_to_office_Final_reply_day_U_RC__c
+                              , Return_to_office_Final_reply_day_U_RC_F__c
+                              , Extend_Date__c
+                              , Extend_Date_F__c
+                              , Received_NG_ReAssign_Text__c
+                              , Received_NG_ReAssign__c
+                        //銆怓Y23澶у強宸ㄥぇ璇鹃銆戦暱鍋囧鍝佸�熺敤寤舵湡寮�鍙� 2022/12/27 start xxf
+                              , Final_reply_day_Holiday_backup__c
+                              , NG_Final_reply_day_F_Holiday_backup__c
+                              , NG_Final_reply_day_Text_Holiday_backup__c
+                              , Yizhouweixiu_Final_reply_day_F_Holiday__c
+                              , Yizhouweixiu_Final_reply_day_TextHoliday__c
+                              , Extend_Final_reply_day_F_Holiday_backup__c
+                              , Extend_Final_reply_day_Text_Holiday_back__c
+                              , QIS_Final_reply_day_F_Holiday_backup__c
+                              , QIS_Final_reply_day_Text_Holiday_backup__c
+                              , Repair_cancel_Final_reply_day_F_Holiday__c
+                              , Repair_cancel_Final_reply_day_Text_Holid__c
+                              , Return_to_office_Final_reply_day_F_Ho__c
+                              , Return_to_office_Final_reply_day_Text_Ho__c
+                              , Repair_delete_Final_reply_day_F_Holiday__c
+                              , Repair_delete_Final_reply_day_Text_Ho__c
+                              , Yigoudaihuo_Final_reply_day_F_Holiday__c
+                              , Yigoudaihuo_Final_reply_day_Text_Holiday__c
+                              , FGuzhangpaicha_Final_reply_day_F_Holiday__c
+                              , Guzhangpaicha_Final_reply_day_Text_Holid__c
+                              , Return_to_office_Final_reply_day_U_RC_Ho__c
+                              , Return_to_office_Final_reply_day_U_RC_FH__c
+                        //銆怓Y23澶у強宸ㄥぇ璇鹃銆戦暱鍋囧鍝佸�熺敤寤舵湡寮�鍙� 2022/12/27 end xxf
+                      from Rental_Apply_Equipment_Set__c
+                     where Id IN :raeSetIds
+            ]) {
+                Rental_Apply_Equipment_Set__c upd = UpdateRentalApplyEquipmentSetBatch.setRAES(raes);
+                if (upd != null) {
+                    updateList1.add(upd);
+                }
+            }
+        }
+//bp2
+//        List<Equipment_Set_Detail__c> esdList = [
+//                select Id,Asset_condition__c,Asset_condition_Text__c,
+//                       Serial_Lot__c,Serial_Lot_text__c,
+//                       Asset__r.Loaner_accsessary__c, Loaner_accsessary_text__c,
+//                       Active_judgement__c,Active_judgement_select__c,Active_judgement_text__c,
+//                       Last_Reserve_RAES_Detail_RAES_F__c,Last_Reserve_RAES_Detail_RAES_Id__c,
+//                       Equipment_Set_Last_Reserve_RAES_F__c,Equipment_Set_Last_Reserve_RAES_Id__c
+//                  from Equipment_Set_Detail__c 
+//                 where Equipment_Set__c IN :eSetIds];
+//        List<Equipment_Set_Detail__c> updateList2 = UpdateRentalApplyEquipmentSetBatch.setESD(esdList);
+
+        Savepoint sp = Database.setSavepoint();
+        try {
+            if (!updateList1.isEmpty()) update updateList1;
+//bp2            if (updateList2.size() > 0) update updateList2;
+            return '1';
+        } catch (System.Exception e) {
+            Database.rollback(sp);
+            return e.getMessage();
+        }
+        // return '1';
+    }
+    
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/RentalApplyESetRefreshStatusController.cls-meta.xml b/force-app/main/default/classes/RentalApplyESetRefreshStatusController.cls-meta.xml
new file mode 100644
index 0000000..d75b058
--- /dev/null
+++ b/force-app/main/default/classes/RentalApplyESetRefreshStatusController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>51.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/RentalApplyWebService.cls b/force-app/main/default/classes/RentalApplyWebService.cls
new file mode 100644
index 0000000..a78f66b
--- /dev/null
+++ b/force-app/main/default/classes/RentalApplyWebService.cls
@@ -0,0 +1,2069 @@
+global class RentalApplyWebService {
+    // TODO please use public okStatus
+    public final static Integer okStatus = 99;
+    public final static String okStatus2 = '寮曞綋娓�';
+
+//bp2
+//    /**
+//     * check meisai
+//     * @param rentalApplyId            澶囧搧鍊熷嚭鐢宠ID
+//     * @param rentalApplys             澶囧搧鍊熷嚭鐢宠
+//     * @param rentalApplyEquipmentSets 澶囧搧鐢宠鍊熷嚭鍘嗗彶(澶囧搧鍊熷嚭鐢宠 鍜� 澶囧搧Set 鐨凩ink琛�)
+//     * @param equipmentSetIdList       Equipment_Set__c.id
+//     * @param idmap                    Equipment_Set__c.Id => Rental_Apply_Equipment_Set__c.Id
+//     * @return 鎴愬姛: 1銆乷r 閿欒鍐呭
+//     */
+//    private static String privateCheck(String rentalApplyId,
+//            Map<String, List<List<Rental_Apply__c>>> mRentalApplys,
+//            Map<String, List<List<Rental_Apply_Equipment_Set__c>>> mRentalApplyEquipmentSets,
+//            Map<String, List<List<Id>>> mEquipmentSetIdList,
+//            Map<String, List<Map<Id, Id>>> mIdmap
+//    ) {
+//        List<Rental_Apply__c> rentalApplys = mRentalApplys.get('rentalApplys')[0];
+//        List<Rental_Apply_Equipment_Set__c> rentalApplyEquipmentSets = mRentalApplyEquipmentSets.get('rentalApplyEquipmentSets')[0];
+//        List<Id> equipmentSetIdList = mEquipmentSetIdList.get('equipmentSetIdList')[0];
+//        Map<Id, Id> idmap = mIdmap.get('idmap')[0];
+
+//        //杩斿洖缁撴灉,1:鎴愬姛銆�
+//        String checkRS = '1';
+        
+//        //澶囧搧鍊熷嚭鐢宠
+//        rentalApplys = [select Rental_Apply_Equipment_Set_Cnt__c from Rental_Apply__c where Id = :rentalApplyId];
+//        if (rentalApplys.size() == 0) {
+//            checkRS = '娌℃湁澶囧搧鍊熷嚭鐢宠锛岃纭銆�';
+//            return checkRS;
+//        }
+//        Rental_Apply__c rentalApply = rentalApplys[0];
+//        if (rentalApply.Rental_Apply_Equipment_Set_Cnt__c <= 0) {
+//            //杩斿洖缁撴灉,2:message-娌℃湁澶囧搧Set锛岃纭銆�
+//            checkRS = '娌℃湁鍊熷嚭澶囧搧set涓�瑙堬紝璇风‘璁ゃ��';
+//            return checkRS;
+//        }
+        
+//        //澶囧搧鐢宠鍊熷嚭鍘嗗彶
+//        equipmentSetIdList = new List<Id>();
+//        rentalApplyEquipmentSets = [
+//                select Equipment_Set__c,Equipment_Set__r.Active_judgement__c
+//                  from Rental_Apply_Equipment_Set__c
+//                 where Rental_Apply__c = :rentalApplyId and Cancel_Select__c = false];
+//        for (Rental_Apply_Equipment_Set__c rentalApplyEquipmentSet : rentalApplyEquipmentSets) {
+//            equipmentSetIdList.add(rentalApplyEquipmentSet.Equipment_Set__c);
+//        }
+
+//        // Equipment_Set_Detail__c锛岀┖鏇存柊 (TODO 浠婂緦batch銇仾銈嬶紒锛�)
+//        List<Equipment_Set_Detail__c> updDetailList = [
+//                select id
+//                  from Equipment_Set_Detail__c
+//                 where Equipment_Set__c in :equipmentSetIdList];
+//        update updDetailList;
+
+//        //澶囧搧鐢宠鍊熷嚭鍘嗗彶銆佸啀鍙栧緱
+//        List<Rental_Apply_Equipment_Set__c> raesList = new List<Rental_Apply_Equipment_Set__c>();
+//        equipmentSetIdList = new List<Id>();
+        
+//        rentalApplyEquipmentSets = [
+//                select Id,Name,Equipment_Set__c,ES_Stock_Status__c,Loaner_name_text__c,Loaner_code_text__c,SerialNumber_text__c,
+//                        Salesdepartment_text__c,Salesprovince_text__c,Equipment_Type_text__c,Equipment_Set_Borrowed__c,Product_Class_Bor__c,
+//                        Equipment_Set__r.Name,Equipment_Set__r.ES_Status__c,Equipment_Set__r.Active_judgement2__c,
+//                        Equipment_Set__r.Last_Reserve_Rental_Apply_Equipment_Set__c,Rental_Start_Date__c,
+//                        Equipment_Set__r.Already_Stock_Out__c, Equipment_Set__r.Loaner_name__c,
+//                        Equipment_Set__r.Loaner_code__c,Equipment_Set__r.Salesdepartment__c,
+//                        Equipment_Set__r.SalesProvince__c,Equipment_Set__r.Equipment_Type__c,Equipment_Set__r.SerialNumber__c,
+//                        Equipment_Set__r.Contents_number__c,Equipment_Set__r.Product_category__c
+//                  from Rental_Apply_Equipment_Set__c
+//                 where Rental_Apply__c = :rentalApplyId and Cancel_Select__c = false];
+//        idmap = new Map<Id,Id>();    // Equipment_Set__c.Id => Rental_Apply_Equipment_Set__c.Id
+        
+//        for (Rental_Apply_Equipment_Set__c rentalApplyEquipmentSet : rentalApplyEquipmentSets) {
+//            if (rentalApplyEquipmentSet.Equipment_Set__r.Last_Reserve_Rental_Apply_Equipment_Set__c != rentalApplyEquipmentSet.Id) {
+//                raesList.add(rentalApplyEquipmentSet);
+//                equipmentSetIdList.add(rentalApplyEquipmentSet.Equipment_Set__c);
+//            }
+//        }
+        
+//        for (Rental_Apply_Equipment_Set__c rentalApplyEquipmentSet : raesList) {
+//            /*
+//            if (rentalApplyEquipmentSet.Rental_Start_Date__c <= Date.today()) {
+//                checkRS = '鍊熷嚭寮�濮嬫棩蹇呴』澶т簬浠婃棩銆傚�熷嚭澶囧搧set涓�瑙堬細' + rentalApplyEquipmentSet.Name;
+//                return checkRS;
+//            }
+//            */
+//            /*
+//            if (rentalApplyEquipmentSet.Equipment_Set__r.Active_judgement2__c != okStatus) {
+//                //杩斿洖缁撴灉,1:message-璇风‘璁ゅ鍝丼et鐘舵�併��
+//                checkRS = '澶囧搧set ' + rentalApplyEquipmentSet.Equipment_Set__r.Name + ' 鐨�' + Schema.SObjectType.Equipment_Set__c.fields.Asset_Set_status2__c.label + '涓嶆槸 99.绛夊緟棰勭害 锛岀幇鍦ㄦ槸 ' + rentalApplyEquipmentSet.Equipment_Set__r.Asset_Set_status2__c + ' 璇风‘璁�';
+//                return checkRS;
+//            }
+//            */
+//            //
+////bp2            if (rentalApplyEquipmentSet.Equipment_Set__r.Contents_number__c == 0) {
+////bp2                checkRS = '澶囧搧set ' + rentalApplyEquipmentSet.Equipment_Set__r.Name + ' 娌℃湁閫夋嫨鍊熷嚭鐨勬槑缁嗭紝璇风‘璁�';
+////bp2                return checkRS;
+////bp2            }
+////bp2            if (rentalApplyEquipmentSet.Equipment_Set__r.ES_Status__c != okStatus2) {
+////bp2                checkRS = '澶囧搧set ' + rentalApplyEquipmentSet.Equipment_Set__r.Name + ' 鐨�' + Schema.SObjectType.Equipment_Set__c.fields.ES_Status__c.label + '涓嶆槸 ' + okStatus2 + '锛岀幇鍦ㄦ槸 ' + rentalApplyEquipmentSet.Equipment_Set__r.ES_Status__c + ' 璇风‘璁�';
+////bp2                return checkRS;
+////bp2            }
+////bp2            if (rentalApplyEquipmentSet.Equipment_Set__r.Already_Stock_Out__c == true) {
+////bp2                checkRS = '澶囧搧set ' + rentalApplyEquipmentSet.Equipment_Set__r.Name + ' 娌℃湁涓婃灦锛岃纭';
+////bp2                return checkRS;
+////bp2            }
+////bp2            if (rentalApplyEquipmentSet.ES_Stock_Status__c == '涓嶈兘鍑哄簱') {
+////bp2                checkRS = '澶囧搧set ' + rentalApplyEquipmentSet.Equipment_Set__r.Name + ' 鍦ㄩ绾︽湡闂村涓嶈兘鍑哄簱锛岃纭';
+////bp2                return checkRS;
+////bp2            }
+//            idmap.put(rentalApplyEquipmentSet.Equipment_Set__c, rentalApplyEquipmentSet.Id);
+//        }
+//        mRentalApplys.get('rentalApplys')[0] = rentalApplys;
+//        mRentalApplyEquipmentSets.get('rentalApplyEquipmentSets')[0] = raesList;
+//        mEquipmentSetIdList.get('equipmentSetIdList')[0] = equipmentSetIdList;
+//        mIdmap.get('idmap')[0] = idmap;
+//        return checkRS;
+//    }
+
+//bp2
+//    /**
+//     *@param  : String 澶囧搧鍊熷嚭鐢宠ID
+//     *@return : String (鎴愬姛: 1銆乷r 閿欒鍐呭)
+//     */
+//    WebService static String reserveCheck(String rentalApplyId) {
+//        //澶囧搧鍊熷嚭鐢宠
+//        List<Rental_Apply__c> rentalApplys = new List<Rental_Apply__c>();
+//        //澶囧搧鐢宠鍊熷嚭鍘嗗彶
+//        List<Rental_Apply_Equipment_Set__c> rentalApplyEquipmentSets = new List<Rental_Apply_Equipment_Set__c>();
+//        List<Id> equipmentSetIdList = new List<Id>();
+//        Map<Id, Id> idmap = new Map<Id,Id>();    // Equipment_Set__c.Id => Rental_Apply_Equipment_Set__c.Id
+
+//        Map<String, List<List<Rental_Apply__c>>> mRentalApplys =
+//                new Map<String, List<List<Rental_Apply__c>>>{'rentalApplys' => new List<List<Rental_Apply__c>>{rentalApplys}};
+//        Map<String, List<List<Rental_Apply_Equipment_Set__c>>> mRentalApplyEquipmentSets =
+//                new Map<String, List<List<Rental_Apply_Equipment_Set__c>>>{'rentalApplyEquipmentSets' => new List<List<Rental_Apply_Equipment_Set__c>>{rentalApplyEquipmentSets}};
+//        Map<String, List<List<Id>>> mEquipmentSetIdList =
+//                new Map<String, List<List<Id>>>{'equipmentSetIdList' => new List<List<Id>>{equipmentSetIdList}};
+//        Map<String, List<Map<Id, Id>>> mIdmap =
+//                new Map<String, List<Map<Id, Id>>>{'idmap' => new List<Map<Id, Id>>{idmap}};
+
+//        String rt1 = RentalApplyWebService.approvalCheck(rentalApplyId);
+//        if (rt1 != '1') {
+//            return rt1;
+//        }
+//        //杩斿洖缁撴灉,1:鎴愬姛銆�
+////        return RentalApplyWebService.privateCheck(rentalApplyId, mRentalApplys, mRentalApplyEquipmentSets, mEquipmentSetIdList, mIdmap);
+//        String rt2 = RentalApplyWebService.privateCheck(rentalApplyId, mRentalApplys, mRentalApplyEquipmentSets, mEquipmentSetIdList, mIdmap);
+//        if (rt2 != '1') {
+//            return rt2;
+//        }
+//        return '1';
+//    }
+
+//bp2
+//    /**
+//     *@param  : String 澶囧搧鍊熷嚭鐢宠ID
+//     *@return : String (鎴愬姛: 1銆乷r 閿欒鍐呭)
+//     */
+//    WebService static String reserve(String rentalApplyId) {
+//        //澶囧搧鍊熷嚭鐢宠
+//        List<Rental_Apply__c> rentalApplys = new List<Rental_Apply__c>();
+//        //澶囧搧鐢宠鍊熷嚭鍘嗗彶
+//        List<Rental_Apply_Equipment_Set__c> rentalApplyEquipmentSets = new List<Rental_Apply_Equipment_Set__c>();
+//        List<Id> equipmentSetIdList = new List<Id>();
+//        Map<Id, Id> idmap = new Map<Id,Id>();    // Equipment_Set__c.Id => Rental_Apply_Equipment_Set__c.Id
+
+//        Map<String, List<List<Rental_Apply__c>>> mRentalApplys =
+//                new Map<String, List<List<Rental_Apply__c>>>{'rentalApplys' => new List<List<Rental_Apply__c>>{rentalApplys}};
+//        Map<String, List<List<Rental_Apply_Equipment_Set__c>>> mRentalApplyEquipmentSets =
+//                new Map<String, List<List<Rental_Apply_Equipment_Set__c>>>{'rentalApplyEquipmentSets' => new List<List<Rental_Apply_Equipment_Set__c>>{rentalApplyEquipmentSets}};
+//        Map<String, List<List<Id>>> mEquipmentSetIdList =
+//                new Map<String, List<List<Id>>>{'equipmentSetIdList' => new List<List<Id>>{equipmentSetIdList}};
+//        Map<String, List<Map<Id, Id>>> mIdmap =
+//                new Map<String, List<Map<Id, Id>>>{'idmap' => new List<Map<Id, Id>>{idmap}};
+
+//        //杩斿洖缁撴灉,1:鎴愬姛銆�
+//        String checkRS = RentalApplyWebService.privateCheck(rentalApplyId, mRentalApplys, mRentalApplyEquipmentSets, mEquipmentSetIdList, mIdmap);
+//        if (checkRS != '1') return checkRS;
+//        rentalApplys = mRentalApplys.get('rentalApplys')[0];
+//        rentalApplyEquipmentSets = mRentalApplyEquipmentSets.get('rentalApplyEquipmentSets')[0];
+//        equipmentSetIdList = mEquipmentSetIdList.get('equipmentSetIdList')[0];
+//        idmap = mIdmap.get('idmap')[0];
+
+//        Rental_Apply__c rentalApply = rentalApplys[0];
+
+//        //澶囧搧Set
+//        List<Equipment_Set__c> equipmentSetUpdateList = new List<Equipment_Set__c>();
+//        //澶囧搧Set鏄庣粏
+//        List<Equipment_Set_Detail__c> equipmentSetDetailList = new List<Equipment_Set_Detail__c>();
+//        List<Equipment_Set_Detail__c> equipmentSetDetailList2 = new List<Equipment_Set_Detail__c>();
+//        //澶囧搧鐢宠鍊熷嚭鏄庣粏鍘嗗彶
+//        List<Rental_Apply_Equipment_Set_Detail__c> rentalApplyEquipmentSetDetailList = new List<Rental_Apply_Equipment_Set_Detail__c>();
+//        for (Rental_Apply_Equipment_Set__c rentalApplyEquipmentSet : rentalApplyEquipmentSets) {
+//            // 宸插仛鍑哄簱鎸囩ずflag鈬掑墠鍥炪伄鐢宠珛銇伨銇犵祩銈忋仯銇︺仾銇勨噿鍑哄簱銇椼仾銇�
+//            if (rentalApplyEquipmentSet.Equipment_Set__r.Already_Stock_Out__c == false) {
+//                //鏇存柊澶囧搧Set
+//                Equipment_Set__c equipmentSet = new Equipment_Set__c(
+//                    Id = rentalApplyEquipmentSet.Equipment_Set__c,
+//                    Last_Reserve_Rental_Apply_Equipment_Set__c = rentalApplyEquipmentSet.Id,
+//                    Pre_Reserve_Rental_Apply_Equipment_Set__c = rentalApplyEquipmentSet.Equipment_Set__r.Last_Reserve_Rental_Apply_Equipment_Set__c,
+//                    StockDown__c = false,
+//                    StockDown_time__c = null,
+//                    Shipment_request_time__c = System.now(),            //鍑哄簱鎸囩ず鏃堕棿
+//                    Shippment_loaner_time__c = null,            //澶囧搧涓績鍑哄簱鏃堕棿
+//                    Forecast_arrival_day__c = null,             //棰勮鍒拌揣鏃�
+//                    //Loaner_received_day__c = null,              //鐜板満绛炬敹鏃�
+//                    Return_wh_chenk_staff__c = null,
+//                    Request_asset_extend_time__c = null,        //寤舵湡鐢宠鏃堕棿
+//                    asset_extend_approval_time__c = null,       //寤舵湡鐢宠鎵瑰噯鏃堕棿
+//                    //Asset_return_day__c = null,                 //鐗╂祦鎻愯揣鏃�
+//                    Received_loaner_time__c = null,             //澶囧搧涓績鍥炴敹鏃堕棿
+//                    delivery_company__c = null,
+//                    Fedex_number__c = null,
+//                    Distributor_method__c = null,
+//                    Return_to_wh_staff__c = null,
+//                    Return_delivery_company__c = null,
+//                    Return_Fedex_number__c = null,
+//                    Return_Distributor_method__c = null,
+//                    Received_confirmation_staff__c = null,
+//                    Customer_install_explanation_sign__c = null, //鏄惁鍥炴敹CDS纭鍗�
+//                    Send_to_return_email__c = false, //鍙戦�佸洖鏀剁粨鏋滃弽棣堥偖浠�
+//                    Return_comment_anoucment__c = null, //鍙戦�佸洖鏀剁粨鏋滃弽棣堝唴瀹�(NG鐞嗙敱鍜屾瑺鍝佹儏鍐�)
+////bp2                    CDS_complete__c = false,
+//                    Arrival_in_wh__c = false,
+//                    Arrival_wh_time2__c = null,
+//                    Already_Stock_Out__c = true,
+
+//                    Repair_Sum_Update__c = 0
+//                );
+//                //鏇存柊澶囧搧Set
+//                equipmentSetUpdateList.add(equipmentSet);
+//            }
+//        }
+
+//        //鍊熷嚭璁惧鏈鸿韩鍙风爜
+//        Map<String, String> assetSerialNumberMap = new Map<String, String>();
+//        //澶囧搧Set鏄庣粏
+//        Equipment_Set_Detail__c[] equipmentSetDetails = [select Equipment_Set__c,Asset__c,Asset__r.SerialNumber,
+//                                            Check_lost_Item__c,Pre_disinfection__c,Water_leacage_check__c,
+//                                            Inspection_result_after__c,Arrival_in_wh__c,
+//                                            Lost_item_check_staff__c,CDS_staff__c,Inspection_staff_After__c,
+//                                            Return_wh_chenk_staff__c,Pre_inspection_time__c,Lost_item_check_time__c,
+//                                            After_Inspection_time__c,Arrival_wh_time__c,
+//                                            Inspection_result__c,Inspection_staff__c,Last_Reserve_RAES_Detail__c,
+//                                            Equipment_Set__r.Already_Stock_Out__c
+////bp2            , CDS_complete__c, CDS_complete_time__c
+//                                            from Equipment_Set_Detail__c
+//                                            where Equipment_Set__c in :equipmentSetIdList and Select_rental__c = true];
+        
+//        for (Equipment_Set_Detail__c equipmentSetDetail : equipmentSetDetails) {
+//            // 宸插仛鍑哄簱鎸囩ずflag鈬掑墠鍥炪伄鐢宠珛銇伨銇犵祩銈忋仯銇︺仾銇勨噿鍑哄簱銇椼仾銇�
+//            if (equipmentSetDetail.Equipment_Set__r.Already_Stock_Out__c == false) {
+//                //鎻掑叆澶囧搧鐢宠鍊熷嚭鏄庣粏鍘嗗彶
+//                Rental_Apply_Equipment_Set_Detail__c rentalApplyEquipmentSetDetail = new Rental_Apply_Equipment_Set_Detail__c();
+//                rentalApplyEquipmentSetDetail.Rental_Apply__c = rentalApply.Id;//澶囧搧鍊熷嚭鐢宠
+//                rentalApplyEquipmentSetDetail.Rental_Apply_Equipment_Set__c = idmap.get(equipmentSetDetail.Equipment_Set__c);//澶囧搧Set鍊熷嚭鍘嗗彶
+//                rentalApplyEquipmentSetDetail.Equipment_Set__c = equipmentSetDetail.Equipment_Set__c;//澶囧搧Set
+//                rentalApplyEquipmentSetDetail.Asset__c = equipmentSetDetail.Asset__c;//淇濇湁璁惧
+//                //鎻掑叆澶囧搧鐢宠鍊熷嚭鏄庣粏鍘嗗彶
+//                rentalApplyEquipmentSetDetailList.add(rentalApplyEquipmentSetDetail);
+                
+//                //鏇存柊澶囧搧Set鏄庣粏
+//                equipmentSetDetail.Check_lost_Item__c = null;//娆犲搧纭缁撴灉
+//                equipmentSetDetail.Lost_item_giveup__c = false;
+//                equipmentSetDetail.Pre_disinfection__c = null;//娓呮礂鍓�
+//                equipmentSetDetail.Water_leacage_check__c = null;//娴嬫紡妫�鏌ョ粨鏋�
+//                equipmentSetDetail.Inspection_result_after__c = null;//鍥炴敹鍚�-妫�娴嬬粨鏋�
+//                equipmentSetDetail.Arrival_in_wh__c = false;//鍥炲簱纭
+//                equipmentSetDetail.Lost_item_check_staff__c = null;//娆犲搧纭鑰�
+//                equipmentSetDetail.CDS_staff__c = null;//娑堟瘨浜哄憳
+//                equipmentSetDetail.Inspection_staff_After__c = null;//鍥炴敹鍚�-妫�娴嬩汉鍛�
+//                equipmentSetDetail.Return_wh_chenk_staff__c = null;//鍥炲簱纭鑰�
+//                equipmentSetDetail.Inspection_result__c = null;//鍙戣揣鍓�-妫�娴嬬粨鏋�
+//                equipmentSetDetail.Inspection_staff__c = null;//鍙戣揣鍓�-妫�娴嬩汉鍛�
+                
+//                equipmentSetDetail.Pre_inspection_time__c = null;//澶囧搧Set鐢�,鍙戣揣鍓�-妫�娴嬪悎鏍兼椂闂�
+//                equipmentSetDetail.Lost_item_check_time__c = null;//澶囧搧Set鐢�,娆犲搧纭鏃堕棿
+////bp2                equipmentSetDetail.CDS_complete_time__c = null;//澶囧搧Set鐢�,CDS瀹屾瘯鏃堕棿
+//                equipmentSetDetail.After_Inspection_time__c = null;//澶囧搧Set鐢�,鍥炴敹鍚�-妫�娴嬪畬姣曟椂闂�
+//                equipmentSetDetail.Arrival_wh_time__c = null;//澶囧搧Set鐢�,鍥炲簱纭瀹屾瘯鏃堕棿
+
+//                equipmentSetDetail.Inspection_result_after_ng__c = null;//鍥炴敹鍚�-妫�娴婲G鍖哄垎
+//                equipmentSetDetail.Inspection_result_ng__c = null;//鍙戣揣鍓�-妫�娴婲G鍖哄垎
+////bp2                equipmentSetDetail.CDS_complete__c = false;//CDS瀹屾瘯
+
+//                //鏇存柊澶囧搧Set鏄庣粏
+//                equipmentSetDetailList.add(equipmentSetDetail);
+//                //鍊熷嚭璁惧鏈鸿韩鍙风爜
+//                if (String.isNotBlank(equipmentSetDetail.Asset__r.SerialNumber)) {
+//                    if (assetSerialNumberMap.containsKey(equipmentSetDetail.Equipment_Set__c) == false) {
+//                        assetSerialNumberMap.put(equipmentSetDetail.Equipment_Set__c, ',' + equipmentSetDetail.Asset__r.SerialNumber + ',');
+//                    } else {
+//                        String tmp = assetSerialNumberMap.get(equipmentSetDetail.Equipment_Set__c);
+//                        tmp += equipmentSetDetail.Asset__r.SerialNumber + ',';
+//                        assetSerialNumberMap.put(equipmentSetDetail.Equipment_Set__c, tmp);
+//                    }
+//                }
+//            }
+//        }
+
+//        // TODO liang 锛戙仱sql銇伨銇ㄣ倎銇︺亸銇犮仌銇�
+//        Equipment_Set_Detail__c[] equipmentSetDetails2 = [select Id, Last_Reserve_RAES_Detail__c
+////bp2                ,CDS_complete__c
+//                                            from Equipment_Set_Detail__c
+//                                            where Equipment_Set__c in :equipmentSetIdList and Select_rental__c = false];
+//        for (Equipment_Set_Detail__c equipmentSetDetail : equipmentSetDetails2) {
+//            equipmentSetDetail.Pre_Reserve_RAES_Detail__c = equipmentSetDetail.Last_Reserve_RAES_Detail__c;
+//            equipmentSetDetail.Last_Reserve_RAES_Detail__c = null;
+////bp2            equipmentSetDetail.CDS_complete__c = false;//CDS瀹屾瘯
+//            equipmentSetDetailList2.add(equipmentSetDetail);
+//        }
+        
+//        //鏇存柊鍊熷嚭璁惧鏈鸿韩鍙风爜
+//        List<Rental_Apply_Equipment_Set__c> rentalApplyEquipmentSetUpdateList = new List<Rental_Apply_Equipment_Set__c>();
+//        for (Rental_Apply_Equipment_Set__c rentalApplyEquipmentSet : rentalApplyEquipmentSets) {
+//            if (assetSerialNumberMap.containsKey(rentalApplyEquipmentSet.Equipment_Set__c)) {
+//                rentalApplyEquipmentSet.Rental_Asset_SerialNumber__c = assetSerialNumberMap.get(rentalApplyEquipmentSet.Equipment_Set__c);
+//              // xiongyl-start
+//            }           
+//             rentalApplyEquipmentSet.Loaner_name_text__c =rentalApplyEquipmentSet.Equipment_Set__r.Loaner_name__c; //澶囧搧鍚嶇О
+//             rentalApplyEquipmentSet.Loaner_code_text__c = rentalApplyEquipmentSet.Equipment_Set__r.Loaner_code__c; //鍌欏搧鍨嬬暘
+//             rentalApplyEquipmentSet.Salesdepartment_text__c = rentalApplyEquipmentSet.Equipment_Set__r.Salesdepartment__c; // 鎵�鍦ㄥ湴鍖�(鏈儴)                
+//             rentalApplyEquipmentSet.Salesprovince_text__c = rentalApplyEquipmentSet.Equipment_Set__r.SalesProvince__c; //鎵�鍦ㄥ湴鍖�(鐪�)
+//             rentalApplyEquipmentSet.Equipment_Type_text__c = rentalApplyEquipmentSet.Equipment_Set__r.Equipment_Type__c; //鍒嗙被 
+//             rentalApplyEquipmentSet.Equipment_Set_Borrowed__c = rentalApplyEquipmentSet.Equipment_Set__r.Name;//澶囧搧set
+//             rentalApplyEquipmentSet.Product_Class_Bor__c = rentalApplyEquipmentSet.Equipment_Set__r.Product_category__c;
+//             rentalApplyEquipmentSet.SerialNumber_text__c = rentalApplyEquipmentSet.Equipment_Set__r.SerialNumber__c;
+//             rentalApplyEquipmentSetUpdateList.add(rentalApplyEquipmentSet);
+//             // xiongyl-end
+//        }
+
+//        Savepoint sp = Database.setSavepoint();
+//        try {
+//            if (equipmentSetUpdateList.size() > 0) {
+//                update equipmentSetUpdateList;
+//            }
+//            if (rentalApplyEquipmentSetDetailList.size() > 0) {
+//                insert rentalApplyEquipmentSetDetailList;
+//            }
+//            if (equipmentSetDetailList.size() > 0) {
+//                for (Integer i=0; i<equipmentSetDetailList.size(); i++) {
+//                    equipmentSetDetailList[i].Pre_Reserve_RAES_Detail__c = equipmentSetDetailList[i].Last_Reserve_RAES_Detail__c;
+//                    equipmentSetDetailList[i].Last_Reserve_RAES_Detail__c = rentalApplyEquipmentSetDetailList[i].Id;
+//                }
+//                update equipmentSetDetailList;
+//            }
+//            if (equipmentSetDetailList2.size() > 0) {
+//                update equipmentSetDetailList2;
+//            }
+//            if (rentalApplyEquipmentSetUpdateList.size() > 0) {
+//                update rentalApplyEquipmentSetUpdateList;
+//            }
+//            eSetRefreshStatus(equipmentSetIdList);
+//        } catch (System.Exception e) {
+//            Database.rollback(sp);
+//            return e.getMessage();
+//        }
+//        //杩斿洖缁撴灉
+//        return checkRS;
+//    }
+    
+    // 澶囧搧鍊熷嚭鏃堕棿check
+    @AuraEnabled
+    WebService static String approvalCheck(String rentalApplyId) {
+        // check缁撴灉
+        String returnStr = '';
+        
+        //1388 yc 20211021 璺ㄥ尯鍩熷垎閰嶄笉鑳藉嚭搴�  start
+        String rasdid = '';
+        system.debug(rentalApplyId+'==');
+        if(String.isNotBlank(rentalApplyId) && rentalApplyId.indexOf(';') >= 0){//璇存槑鏄粠涓�瑙堜笂瑙﹀彂鐨�
+           rasdid = rentalApplyId.subString(rentalApplyId.indexOf(';') + 1);
+           rentalApplyId = rentalApplyId.subString(0, rentalApplyId.indexOf(';'));
+        }
+        //1388 yc 20211021 璺ㄥ尯鍩熷垎閰嶄笉鑳藉嚭搴�  end
+        //澶囧搧鍊熷嚭鐢宠
+        Rental_Apply__c[] rentalApply = [select Id,repair__r.Repair_Final_Inspection_Date__c,Bollow_Date__c,repair__r.Return_Without_Repair_Date__c,
+                                        CreatedDate,Rental_Apply_Equipment_Set_Cnt__c,Prepare_Day__c,Cross_Region_Assign__c,
+                                        demo_purpose2__c,Follow_UP_Opp__r.Shipping_Finished_Day_Func__c,next_action__c,QIS_number__r.ReplaceDeliveryDate__c
+                                        from Rental_Apply__c 
+                                        where Id = :rentalApplyId];
+        if (rentalApply.size() == 0) {
+            returnStr = '娌℃湁澶囧搧鍊熷嚭鐢宠锛岃纭銆�';
+            return returnStr;
+        }
+        Rental_Apply__c ra = rentalApply[0];
+        if (ra.Rental_Apply_Equipment_Set_Cnt__c <= 0) {
+            returnStr = '娌℃湁鍊熷嚭澶囧搧set涓�瑙堬紝璇风‘璁ゃ��';
+            return returnStr;
+        }
+        //1822 yc 20211111 start
+        if(ra.demo_purpose2__c=='宸茶喘寰呰揣' && ra.Follow_UP_Opp__r.Shipping_Finished_Day_Func__c!= null){
+            returnStr = '宸茶喘寰呰揣鐩殑锛屾柊鍝佸凡鏈夊彂璐ф棩锛屼笉鍙嚭搴撴寚绀�';
+            return returnStr;
+        }
+        if(ra.demo_purpose2__c=='绱㈣禂QIS' && ra.next_action__c=='鏃犲伩鏇存崲' && ra.QIS_number__r.ReplaceDeliveryDate__c!= null){
+            returnStr = '绱㈣禂QIS鐩殑锛孮IS宸叉湁鏂板搧鍙戣揣鏃ワ紝涓嶅彲鍑哄簱鎸囩ず';
+            return returnStr;
+       }
+        //1822 yc 20211111 end
+
+//*************************Insert 20160826 SWAG-AD59Z6 瓒欏境鑺� Start*************************//
+        if(Ra.repair__r.Repair_Final_Inspection_Date__c != null) {
+            return '淇悊鏈�缁堟娴嬫棩涓嶄负绌猴紝涓嶈兘鍋氬嚭搴撴寚绀�';
+        }
+        if(Ra.repair__c!=null&&Ra.repair__r.Return_Without_Repair_Date__c != null) {
+            return '鏈慨鐞嗗綊杩樻棩涓嶄负绌猴紝涓嶈兘鍋氬嚭搴撴寚绀�';
+        }
+//*************************Insert 20160826 SWAG-AD59Z6 瓒欏境鑺� End***************************//
+
+        //1388 yc 20211021 璺ㄥ尯鍩熷垎閰嶄笉鑳藉嚭搴� start
+        if(String.isNotBlank(ra.Cross_Region_Assign__c)){
+            String soql = 'select Id, Name,Rental_Apply__c,Internal_asset_location_before__c';
+                   soql +=' from Rental_Apply_Equipment_Set_Detail__c';
+                   soql +=' where Rental_Apply__c = \'' + ra.Id +'\'';
+                   soql +=' and Internal_asset_location_before__c !=null and Internal_asset_location_before__c != \'' + ra.Cross_Region_Assign__c+ '\'';
+            
+            if(String.isNotBlank(rasdid)){
+                   soql +=' and Rental_Apply_Equipment_Set__c = :rasdid';            
+              }
+            List<Rental_Apply_Equipment_Set_Detail__c> raesd = Database.query(soql);
+            if(raesd.size()>0){
+                returnStr = '鍒嗛厤鐨勫鍝佷笉鏄偍鎵�灞炲鍝佷腑蹇冪殑澶囧搧锛屼笉鑳藉仛鍑哄簱鎸囩ず'; 
+                return returnStr;
+            }
+            
+        }
+        //1388 yc 20211021 璺ㄥ尯鍩熷垎閰嶄笉鑳藉嚭搴� end
+        // 20220211 ljh add 澶囧搧FY23璇鹃01 start
+        // AggregateResult[] resultsRas = [SELECT Rental_Start_Date__c,count(Id) cnt
+        //                              FROM Rental_Apply_Equipment_Set__c
+        //                              WHERE Rental_Apply__c = :rentalApplyId 
+        //                              AND Cancel_Select__c = false
+        //                              group by Rental_Start_Date__c];
+        // If(resultsRas.size() > 1){
+        //  returnStr = '鎵�鏈変竴瑙堝鍝侀璁″嚭璐ф棩搴斾竴鑷达紝涓嶄竴鑷翠笉鑳藉仛鍑哄簱鎸囩ず'; 
+        //     return returnStr;
+        // }
+        // 20220211 ljh add 澶囧搧FY23璇鹃01 end
+
+//bp2        // 澶囧搧鍊熷嚭鍘嗗彶鍙栧緱
+//        List<String> equipmentSetList = new List<String>();
+//        Rental_Apply_Equipment_Set__c[] raes = [
+//            select Id, Name, Equipment_Set__c, Equipment_Set__r.Name, Rental_Start_Date__c, Rental_End_Date__c, Rental_Apply__c 
+//              from Rental_Apply_Equipment_Set__c 
+//             where Rental_Apply__c = :rentalApplyId and Cancel_Select__c = false];
+//        // 鏃ュ巻鑼冨洿锛屾渶灏忕殑鍊熷嚭寮�濮嬫棩鍒版渶澶х殑鍊熷嚭缁堜簡鏃�
+//        Date startDate = Date.today();
+//        Date endDate = Date.today();
+//        for (Rental_Apply_Equipment_Set__c r : raes) {
+//            equipmentSetList.add(r.Equipment_Set__c);
+//            if (r.Rental_Start_Date__c != null && r.Rental_Start_Date__c < startDate) {
+//                startDate = r.Rental_Start_Date__c;
+//            }
+//            if (r.Rental_End_Date__c != null && r.Rental_End_Date__c > endDate) {
+//                endDate = r.Rental_End_Date__c;
+//            }
+//        }
+//        Integer prepareDay = ra.Prepare_Day__c == null ? Integer.valueOf(System.Label.EquipmentRentalPrepare) : ra.Prepare_Day__c.intValue();
+//        Date minDate = getWD_addday(startDate, -1 * prepareDay);
+//        Date maxDate = getWD_addday(endDate, prepareDay);
+//        // 鍏朵粬澶囧搧鍊熷嚭鐢宠鍘嗗彶
+//        Rental_Apply_Equipment_Set__c[] others = [
+//                    select Id, Name, Rental_Start_Date__c, Rental_End_Date__c, Equipment_Set__c, Rental_Apply__r.Status__c ,Rental_Apply__r.Prepare_Day__c 
+//                      from Rental_Apply_Equipment_Set__c
+//                     where Rental_Apply__c != :rentalApplyId
+//                       and Equipment_Set__c in :equipmentSetList
+//                       and Request_Status__c != '鍙栨秷'
+//                       and Request_Status__c != '鍒犻櫎'
+//                       and Cancel_Select__c = false
+//                       and ((Rental_Start_Date__c >= :minDate and Rental_Start_Date__c <= :maxDate)
+//                            or (Rental_End_Date__c >= :minDate and Rental_End_Date__c <= :maxDate)
+//                            or (Rental_Start_Date__c <= :startDate and Rental_End_Date__c >= :endDate))];
+        
+//        Map<String, List<Rental_Apply_Equipment_Set__c>> othersMap = new Map<String,List<Rental_Apply_Equipment_Set__c>>();
+//        for (Rental_Apply_Equipment_Set__c other : others) {
+//            if (othersMap.containsKey(other.Equipment_Set__c)) {
+//                othersMap.get(other.Equipment_Set__c).add(other);
+//            } else {
+//                List<Rental_Apply_Equipment_Set__c> l = new List<Rental_Apply_Equipment_Set__c>();
+//                l.add(other);
+//                othersMap.put(other.Equipment_Set__c, l);
+//            }
+//        }
+        
+//        for (Rental_Apply_Equipment_Set__c r : raes) {
+            
+//            List<Rental_Apply_Equipment_Set__c> other = othersMap.get(r.Equipment_Set__c);
+            
+//            Map<Date, Map<String, String>> dateMap= new Map<Date, Map<String, String>>();
+//            if (other != null) {
+//                Date sdate = startDate;
+//                Date edate = endDate;
+//                for (Rental_Apply_Equipment_Set__c o : other) {
+//                    if (o.Rental_Start_Date__c != null && (sdate == null || o.Rental_Start_Date__c < sdate)) {
+//                        sdate = o.Rental_Start_Date__c;
+//                    }
+//                    if (o.Rental_End_Date__c != null && (edate == null || o.Rental_End_Date__c > edate)) {
+//                        edate = o.Rental_End_Date__c;
+//                    }
+//                }
+//                if (sdate != null && edate != null) {
+//                    RentalApplyWebService raws = new RentalApplyWebService();
+//                    dateMap = raws.getDateMap(sdate, edate, prepareDay);
+//                }
+//            }
+            
+//            if (r.Rental_Start_Date__c == null && r.Rental_End_Date__c == null) {
+//                // 娓呯┖璇ュ�熷嚭鍘嗗彶鐨勫嚭搴撳拰鍥炴敹鏃堕棿
+//            } else if (other == null || other.size() == 0) {
+//                // 涓庡叾浠栧�熷嚭鍘嗗彶娌℃湁鍐茬獊
+//            } else {
+//                Date fromDate = r.Rental_Start_Date__c;
+//                Date toDate = r.Rental_End_Date__c;
+//                for (Rental_Apply_Equipment_Set__c o : other) {
+//                    if (o.Rental_Apply__r.Status__c != '鑽夋涓�' && o.Rental_Apply__r.Status__c != '鐢宠涓�' && o.Rental_Apply__r.Status__c != null) {
+//                        Date startD = o.Rental_Start_Date__c;
+//                        Date endD = o.Rental_End_Date__c;
+//                        Integer prepare = prepareDay; //>= o.Rental_Apply__r.Prepare_Day__c || o.Rental_Apply__r.Prepare_Day__c == null ? prepareDay : o.Rental_Apply__r.Prepare_Day__c.intValue();
+//                        if ((dateMap.containsKey(fromDate) && Date.valueOf(dateMap.get(fromDate).get('Next')) > startD && dateMap.containsKey(endD) && fromDate < Date.valueOf(dateMap.get(endD).get('Next'))) ||
+//                            (dateMap.containsKey(toDate) && Date.valueOf(dateMap.get(toDate).get('Next')) > startD && dateMap.containsKey(endD) && toDate < Date.valueOf(dateMap.get(endD).get('Next'))) ||
+//                            (dateMap.containsKey(fromDate) && Date.valueOf(dateMap.get(fromDate).get('Next')) <= startD && dateMap.containsKey(endD) && toDate >= Date.valueOf(dateMap.get(endD).get('Next')))) {
+//                            returnStr = '澶囧搧' + r.Equipment_Set__r.Name + '鐨勫�熷嚭鏃ヤ笌澶囧搧鍊熷嚭鍘嗗彶' + o.Name + '鏈夊啿绐侊紝璇风‘璁ゃ��';
+//                            return returnStr;
+//                        }
+//                    }
+//                }
+//            }
+//        }
+        return '1';
+    }
+
+    // 寤舵湡瀹℃壒Check
+    @AuraEnabled
+    WebService static String extension_approval_processCheck(String rentalApplyId) {
+        try {
+            List<Rental_Apply__c> raList = [SELECT Id,Name
+                       , Demo_purpose1__c
+                       , Demo_purpose2__c
+                       , Loaner_received_ng_num__c
+                       , ExtensionApprovalTime_Initial__c
+                       , ExtensionApplicationTime_Final__c
+                       , ExtensionApprovalTime_Final__c
+                       , NewRepair__c
+                       , NewRepair__r.Agreed_Date__c
+                       , NewRepair__r.Status__c
+                       , NewRepair__r.ReRepairObject_F__c
+                       , NewRepair__r.Repair_Shipped_Date__c
+                       , AgreementBorrowingExtensionDate__c
+                       , next_action__c
+                       , RC_Ordered_Date__c
+                       , Bollow_Date_Add_10_WD__c
+                       , Root_Rental_Apply__c
+                       , Assign_Person__c
+                       , Return_dadeline_final__c
+                       , RA_Status__c
+                       , ExtensionApplicationTime_Initial__c
+                       , RecordType.DeveloperName
+                       , RecordType.id
+                       , ExtensionStatus__c
+                    FROM Rental_Apply__c
+                    WHERE Id = :rentalApplyId];
+            if (raList.size() == 0) {
+                return '娌℃湁澶囧搧鍊熷嚭鐢宠锛岃纭銆�';
+            }
+            //add       wangweipeng            2021/11/26                   start
+            /*List<Rental_Apply_Equipment_Set__c> raesList = RentalApplyTriggerHandler.getCan_Extend_RequestList(raList[0],'1');
+            return '1';*/
+            String ErrorMessageStr = unifyGetRentalApply(raList[0]);
+            //add       wangweipeng            2021/11/26                   end
+            return ErrorMessageStr;
+        }
+        catch(Exception e) {
+            return e.getMessage();
+        }
+        
+    }
+
+    //add       wangweipeng            2021/11/26                   start
+    /**
+     * @param  rentalApplyId 澶囧搧id
+     * @return               澶囧搧閰嶅鏁版嵁
+     *
+     * 寤舵湡鏁翠綋閫昏緫锛�
+     *     1锛氳瘯鐢ㄧ洰鐨�2涓嶄负锛氭湁璇环鍜屾棤璇环锛屽仛鐗规畩澶勭悊
+     *     2锛氬叾浠栨儏鍐碉細閫昏緫涓嶅彉
+     *   涓婇潰绗竴涓潯浠舵弧瓒筹細
+     *       1锛氫粠鍘熷崟鐐瑰嚮寤舵湡鐢宠鎸夐挳锛屾病鏈夊垎鍓插崟
+     *       2锛氫粠鍘熷崟鐐瑰嚮寤舵湡鐢宠鎸夐挳锛屾湁鍒嗗壊鍗�
+     *       3锛氫粠鍗曠偣鍑诲欢鏈熺敵璇锋寜閽�
+     *
+     *      绗竴绉嶆儏鍐碉細鎸夌収鍘熸潵鐨勯�昏緫璧帮紝涓嶉渶瑕佸仛鐗规畩澶勭悊
+     *      绗簩绉嶆儏鍐碉細
+     *          锛�1锛夛細璁板綍绫诲瀷涓猴細澶囧搧涓績锛屽垽鏂垎閰嶄汉鏄惁涓虹┖锛屽姙浜嬪鍒嗛厤浜轰笉鍙兘涓虹┖
+     *          锛�2锛夛細鑾峰彇鍘熷崟鍜屽師鍗曚笅鎵�鏈夌殑鍒嗗崟锛屽洜涓烘壒閲忓欢鏈熶笉鍏夋煡鐪嬭嚜宸辩敵璇峰崟鎯呭喌锛屽鏋滄槸涓诲崟杩涙潵鐨勶紝杩橀渶瑕佹煡鐪嬪綋鍓嶅崟瀛愶紝鍜屼粬涓嬮潰鐨勬墍鏈変粠鍗�
+     *          锛�2锛夛細璧颁竴涓柟娉曪紝杩欐槸涓�涓欢鏈熼�氱敤鐨勬柟娉曪紝鐢ㄤ簬鍒ゆ柇姝ゆ寤舵湡鐨勭敵璇峰崟鏄惁鏈夊彲浠ュ欢鏈熺殑涓�瑙堬紝浼氬湪涓嬮潰鍏蜂綋浠嬬粛
+     *          锛�3锛夛細璧颁笂闈㈤�氱敤鐨勬柟娉曪紝娌℃湁鑾峰彇鍒板彲浠ュ欢鏈熺殑涓�瑙堬紝閭d箞鍋氭彁绀猴紝涓嶈兘寤舵湡
+     *          锛�4锛夛細璺宠浆椤甸潰涓猴細姝ゆ涓烘壒閲忓欢鏈熻嚜瀹氫箟寮�鍙戠殑椤甸潰
+     *      绗笁绉嶆儏鍐碉細
+     *          锛�1锛夛細濡傛灉鏄粠鍗曞欢鏈燂紝閭d箞闇�瑕佹煡鐪嬫鍗曪紝姝ゅ崟鐨勫師鍗曪紝姝ゅ崟鍘熷崟涓嬫墍鏈夌殑浠庡崟鏄惁婊¤冻寤舵湡鏉′欢
+     *          锛�2锛夛細浠ヤ笂鐨勫崟瀛愬繀椤绘弧瓒筹細宸插嚭搴撶殑--宸插洖鏀讹紙涓嶅惈锛変箣闂寸姸鎬侊紝涓旀渶鏂伴瀹氬綊杩樻棩鈮� 浠婂ぉ銆�
+     *          锛�3锛夛細璧颁竴涓柟娉曪紝杩欐槸涓�涓欢鏈熼�氱敤鐨勬柟娉曪紝鐢ㄤ簬鍒ゆ柇姝ゆ寤舵湡鐨勭敵璇峰崟鏄惁鏈夊彲浠ュ欢鏈熺殑涓�瑙堬紝浼氬湪涓嬮潰鍏蜂綋浠嬬粛
+     *          锛�4锛夛細鐢变簬閫氱敤鐨勬柟娉曚細杩斿洖鎵�鏈夌敵璇峰崟鍙欢鏈熺殑涓�瑙堬紝鎵�浠ラ渶瑕佸垽鏂鍗曟槸鍚︽湁鍙互寤舵湡鐨勪竴瑙�
+     *          锛�5锛夛細鐢变簬閫氱敤鐨勬柟娉曚細璺宠繃 ok骞朵笖鍥炲瘎鏃堕棿涓嶄负绌虹殑涓�瑙堬紝鎵�浠ユ鏃跺垽鏂繖涓潯浠讹紝婊¤冻灏变笉鑳藉欢鏈�
+     *          锛�6锛夛細璺宠浆椤甸潰涓哄師鏉ュ欢鏈熷紑鍙戠殑鑷畾涔夐〉闈�
+     *
+     *     閫氱敤鏄惁鍙互寤舵湡鐨勬柟娉曪細锛堣瘯鐢紙鏈夎浠凤級銆佽瘯鐢紙鏃犺浠凤級锛�
+     *         锛�1锛夛細姝ゆ柟娉曞弬鏁颁负list锛屽鏋滆秴杩�1鏉℃暟鎹紝榛樿涓鸿蛋鎵归噺寤舵湡鐨勬潯浠�
+     *         锛�2锛夛細鐢宠鍗曪細濡傛灉size澶т簬1锛岃烦杩囦竴浜涢獙璇侊細鏈畬鎴愬埌璐х‘璁や笉楠岃瘉鍜屽欢鏈熸壒鍑嗘椂闂�(鏈�鍒�)涓嶈兘寤舵湡
+     *         锛�3锛夛細涓�瑙堬細濡傛灉size澶т簬1锛宱k骞朵笖鍥炲瘎鏃堕棿涓嶄负绌虹殑涓�瑙堜笉楠岃瘉
+     *          
+     */
+    public static String unifyGetRentalApply(Rental_Apply__c rentalApply){
+        Rental_Apply__c rac = rentalApply;
+        //濡傛灉鐢宠鍗曠殑 浣跨敤鐩�2涓� 鏈夎浠锋垨鏃犺浠风殑,閭d箞闇�瑕佺壒娈婂鐞嗕竴涓�
+        if(rac.Demo_purpose1__c == '浜у搧璇曠敤' && (rac.demo_purpose2__c == '璇曠敤锛堟棤璇环锛�' || rac.demo_purpose2__c == '璇曠敤锛堟湁璇环锛�')){
+            if(rac.ExtensionStatus__c == '宸叉壒鍑�'){
+                return '浜у搧璇曠敤鐨勭敵璇蜂笉鑳芥彁浜ょ浜屾寤舵湡鐢宠銆�';
+            }else{
+                return muchRentalApply(rac);
+            }
+        }else{
+            //鍔炰簨澶勭洰鍓嶅彧鑳藉欢鏈熸湁璇环鎴栨棤璇环
+            if(rac.RecordType.DeveloperName == 'AgencyRequest'){
+                return '鍔炰簨澶勭敵璇峰崟锛岄潪璇曠敤锛堟棤璇环锛夈�� 璇曠敤锛堟湁璇环锛変笉鍙欢鏈熴��';
+            }else{
+                List<Rental_Apply_Equipment_Set__c> raesList = RentalApplyTriggerHandler.getCan_Extend_RequestList(new List<Rental_Apply__c>{rac});
+                return '1';
+            }
+        }
+    }
+
+    /**
+     * 
+     * @param  rac [寤舵湡鍏ュ彛]
+     * @return     [description]
+     *      
+     * 閫昏緫瑙i噴锛�
+     *     鍘熷崟锛堟病鏈変粠鍗曪級锛氳蛋鍘熸潵鐨勯�昏緫
+     *     浠庡崟锛氬垽鏂浠庡崟鐨勫師鍗曘�佸師鍗曚笅鎵�鏈夌殑浠庡崟鏄惁婊¤冻绗竴鏉★紝骞朵笖褰撳墠浠庡崟蹇呴』鏈変竴鏉℃弧瓒崇浜屾潯鎵嶈兘寤舵湡
+     *     鍘熷崟锛堟湁浠庡崟锛夛細鍒ゆ柇姝ょ敵璇峰崟鍜屽師鍗曚笅鎵�鏈夌殑浠庡崟鏄惁婊¤冻绗竴鏉★紝骞朵笖杩欎簺鐢宠鍗曟渶灏戞湁涓�涓敵璇峰崟婊¤冻绗簩涓潯浠讹紝鎵嶈兘寤舵湡
+     */
+    public static String muchRentalApply(Rental_Apply__c rac){
+        //鑾峰彇鎵�鏈夌殑鐢宠鍗�
+        List<Rental_Apply__c> rentalApplyData =  getAllRentalApply(rac);
+        if(rentalApplyData != null && rentalApplyData.size() > 0){
+            //濡傛灉鍙煡鍒颁竴鏉℃暟鎹紝閭d箞璇佹槑浠栨槸鍘熷崟锛屽苟涓旀病鏈夊垎鍓插崟锛岄偅涔堝氨璧板師鏉ュ欢鏈熺殑閫昏緫
+            if(rentalApplyData.size() == 1){
+                List<Rental_Apply_Equipment_Set__c> raesList = RentalApplyTriggerHandler.getCan_Extend_RequestList(rentalApplyData);
+                return '1';
+            }else{
+                //濡傛灉涓哄鏉★紝璇佹槑浠栨湁浠庡崟鎴栧綋鍓嶈寤舵湡鐨勫崟瀛愭槸浠庡崟锛岄偅涔堝氨闇�瑕佸仛鐗规畩澶勭悊
+                List<Rental_Apply__c> racList = new List<Rental_Apply__c>();
+                //鍒ゆ柇浠栨槸鍘熷崟杩樻槸浠庡崟
+                System.debug('--345----------'+rac.Root_Rental_Apply__c);
+                if(String.isNotBlank(rac.Root_Rental_Apply__c)){
+                    //鍙欢鏈熺殑鐢宠鍗曞簲婊¤冻锛氬凡鍑哄簱鐨�--宸插洖鏀讹紙涓嶅惈锛変箣闂寸姸鎬侊紝涓旀渶鏂伴瀹氬綊杩樻棩鈮� 浠婂ぉ銆�
+                    //褰撳墠鏃ユ湡
+                    Date today = Date.today();
+                    //棰勫畾褰掕繕鏃ヤ笉鑳戒负绌�
+                    if(rac.Return_dadeline_final__c != null){
+                        //鏈�鏂伴瀹氬綊杩樻棩鈮� 浠婂ぉ銆�
+                        if(rac.Return_dadeline_final__c >= today){
+                            //鍙欢鏈熺殑鐢宠鍗曞簲婊¤冻锛氬凡鍑哄簱鐨�--宸插洖鏀讹紙涓嶅惈锛変箣闂寸姸鎬�
+                            if(rac.RA_Status__c == '鐢宠鑰呭凡鏀惰揣' || rac.RA_Status__c == '鍖婚櫌宸茶鏈虹‘璁�' || rac.RA_Status__c == '宸插嚭搴�')
+                            {
+                                //鑳借蛋鍒拌繖閲岋紝璇佹槑寤舵湡鍏ュ彛鐨勭敵璇峰崟涓嶆槸宸茬粡寤惰繃鐨勶紝鎵�鏈夌幇鍦ㄥ垽鏂叾浠栫殑鐢宠鍗曟槸鍚﹀凡缁忓欢鏈燂紝濡傛灉寤惰繃锛岄偅涔堜笉闇�瑕侀獙璇�
+                                //if(rac.ExtensionApplicationTime_Initial__c == null){
+                                    racList = rentalApplyData;
+                                //}
+                            }else{
+                                if(rac.RA_Status__c != '鍙栨秷' && rac.RA_Status__c != '鍒犻櫎'){
+                                    return '鐢宠鍗曪細'+rac.Name+'鐨勭姸鎬佷负銆�'+rac.RA_Status__c+'銆� 涓嶅彲浠ヨ繘琛屽欢鏈熴��';
+                                }
+                            }
+                        }else{
+                            return '鐢宠鍗曪細'+rac.Name+'鐨勬渶鏂伴瀹氬綊杩樻棩灏忎簬褰撳墠鏃堕棿锛屼笉鍙互杩涜寤舵湡銆�';   
+                        }
+                    }else{
+                        return '鐢宠鍗曪細'+rac.Name+' 鐨勯瀹氬綊杩樻棩涓嶈兘涓虹┖銆�';
+                    }
+                }else{
+                    //澶囧搧涓績
+                    if(rac.RecordType.DeveloperName == 'StandardRequest'){
+                        //a. 鍘熷崟涓婂垎閰嶄汉=绌猴紝鐐瑰嚮鍘熷崟涓婄殑銆愬欢鏈熺敵璇枫�戞寜閽椂锛屾彁绀恒�愬師鍗曟湭鍒嗛厤鎴栧凡鍙栨秷锛岃鍦ㄥ垎鍗曚笂鎿嶄綔寤舵湡銆�
+                        //娉細鍘熷崟鏈垎閰嶅凡鍙栨秷鎴栨湭鍒嗛厤鏃讹紝鍘熷崟鍒嗛厤浜轰负绌�
+                        if(String.isBlank(rac.Assign_Person__c)){
+                            return '鍘熷崟鏈垎閰嶆垨宸插彇娑堬紝璇峰湪鍒嗗崟涓婃搷浣滃欢鏈熴��';
+                        }
+                    }
+                    //濡傛灉鏄師鍗曪紝鐩存帴鍒ゆ柇鏄惁婊¤冻绗竴鍜岀浜屾潯锛岀涓夋潯涓嶉渶瑕佺幇鍦ㄥ垽鏂�
+                    racList = rentalApplyData;
+                }
+                if(racList != null && racList.size() > 0){
+                    System.debug('-----------543---'+racList);
+                    //姝ゆ柟娉曚富瑕侀獙璇佺涓�鍜岀浜屼釜鏉′欢
+                    List<Rental_Apply_Equipment_Set__c> raesList = RentalApplyTriggerHandler.getCan_Extend_RequestList(racList);
+                    if(raesList.size() == 0){
+                       return '鏃犱换浣曠敵璇峰崟婊¤冻銆�';
+                    }else{
+                        //濡傛灉浠庡崟涓哄欢鏈熷叆鍙o紝浼氬垽鏂粬鐨勫師鍗曞拰姝ゅ師鍗曚笅鎵�鏈変粠鍗曟弧瓒冲欢鏈熸潯浠�
+                        //濡傛灉婊¤冻鏉′欢锛岄偅涔堝垽鏂綋鍓嶄粠鍗曟槸鍚︽弧瓒冲欢鏈熸潯浠讹紝濡傛灉鏄叾浠栫敵璇峰崟婊¤冻锛岄偅涔堜笉鑳藉欢鏈燂紝
+                        //濡傛灉姝ょ敵璇峰崟鏈変竴涓厤濂楁弧瓒筹紝閭d箞鍙互寤舵湡锛岃蛋鍗曠嫭寤舵湡閫昏緫锛堝師鏉ュ欢鏈熼�昏緫锛�
+                        if(String.isNotBlank(rac.Root_Rental_Apply__c)){
+                            Integer indexI = 0;
+                            String racIds = rac.Id;
+                            racIds = racIds.substring(0,15);
+                            //寰幆鍒ゆ柇姝ゅ崟鏄惁鏈夊彲浠ュ欢鏈熺殑閰嶅鍚楋紵
+                            for(Rental_Apply_Equipment_Set__c raesc : raesList){
+                                String raescId = raesc.Rental_Apply__c;
+                                raescId = raescId.substring(0,15);
+                                if(racIds.equals(raescId)){
+                                    indexI++;
+                                }
+                            }
+                            if(indexI > 0) {
+                                //濡傛灉浠庡崟涓哄欢鏈熷叆鍙o紝浠栦細璧伴�氱敤鐨勬壒閲忓欢鏈熼獙璇侊紝鎵�浠ラ渶瑕侀獙璇佷互涓嬬殑鏉′欢锛屽鏋滄弧瓒冲氨涓嶇劧寤舵湡
+                                //鍒ゆ柇鏄鐢宠鍗曟槸鍚﹀瓨鍦� ok骞朵笖鍥炲瘎鏃堕棿涓嶄负绌虹殑涓�瑙�
+                                List<Rental_Apply_Equipment_Set__c> raescc = getAllRentalApplyEs(rac);
+                                if(raescc != null && raescc.size() > 0){
+                                    for(Rental_Apply_Equipment_Set__c rr : raescc){
+                                        if ((rr.Received_Confirm__c == 'OK' || rr.Received_Confirm__c == '榛樿绛炬敹-OK') && rr.Asset_return_time__c != null) {
+                                            return '姝ゅ崟涓嶆弧瓒冲欢鏈熸潯浠躲��';
+                                        }
+                                    }
+                                    return '1';
+                                }
+                            }else{
+                                return '姝ゅ崟涓嶆弧瓒冲欢鏈熸潯浠躲��';
+                            }
+                        }else{
+                            return '2';
+                        }
+                    }
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * 鏍规嵁浼犺繃鏉ョ殑澶囧搧id鑾峰彇鎵�鏈夌殑浠庡崟鍜屽師鍗�
+     * @param  rea 寤舵湡鐨勫叆鍙g敵璇峰崟
+     * @return               杩斿洖鎵�鏈夌殑鍘熷崟鍜屼粠鍗�
+     * 鍙傛暟鏈夊彲鑳芥槸鍘熷崟id鎴栦粠鍗昳d
+     */
+    public static List<Rental_Apply__c> getAllRentalApply(Rental_Apply__c rea){
+        List<Rental_Apply__c> allRentalApply = [SELECT id,
+                                                        Name,
+                                                        RA_Status__c,
+                                                        Request_return_day__c,
+                                                        demo_purpose1__c,demo_purpose2__c,
+                                                        ExtensionApprovalTime_Final__c,
+                                                        RC_Ordered_Date__c,
+                                                        Bollow_Date_Add_10_WD__c,
+                                                        Loaner_received_ng_num__c,
+                                                        ExtensionApprovalTime_Initial__c,
+                                                        next_action__c,
+                                                        NewRepair__c,
+                                                        NewRepair__r.Agreed_Date__c,
+                                                        NewRepair__r.Status__c,
+                                                        NewRepair__r.ReRepairObject_F__c,
+                                                        NewRepair__r.Repair_Shipped_Date__c,
+                                                        AgreementBorrowingExtensionDate__c,
+                                                        Return_dadeline_final__c,
+                                                        ExtensionApplicationTime_Initial__c,
+                                                        Root_Rental_Apply__c,
+                                                        ExtensionStatus__c
+                                                    FROM Rental_Apply__c 
+                                                    WHERE id = :rea.Id 
+                                                        OR id = :rea.Root_Rental_Apply__c 
+                                                        OR (Root_Rental_Apply__c = :rea.Id AND Root_Rental_Apply__c != NULL)
+                                                        OR (Root_Rental_Apply__c = :rea.Root_Rental_Apply__c AND Root_Rental_Apply__c != NULL) 
+                                                        limit 1000];
+        return allRentalApply;
+    }
+
+    /**
+     * [getAllRentalApplyEs 鑾峰彇涓�瑙圿
+     * @param  rea [description]
+     * @return     [description]
+     *
+     * 鍙湁浠庡崟涓哄欢鏈熷叆鍙g殑鏃跺�欙紝鎵嶄細鍘绘煡璇竴瑙�
+     */
+    public static List<Rental_Apply_Equipment_Set__c> getAllRentalApplyEs(Rental_Apply__c rea){
+        List<Rental_Apply_Equipment_Set__c> raes = [SELECT Id,name
+                                                                , Rental_Apply__c
+                                                                , Rental_Apply__r.Repair__r.Agreed_Date__c
+                                                                , Rental_Apply__r.Repair__r.Repair_Estimated_date_formula__c
+                                                                , Rental_Apply__r.NewRepair__c
+                                                                , Rental_Apply__r.NewRepair__r.Agreed_Date__c
+                                                                , Rental_Apply__r.NewRepair__r.Status__c
+                                                                , Rental_Apply__r.NewRepair__r.ReRepairObject_F__c
+                                                                , Rental_Apply__r.NewRepair__r.Repair_Shipped_Date__c
+                                                                , Rental_Apply__r.QISRepair__r.Repair_Shipped_Date__c
+                                                                , Rental_Apply__r.RC_return_to_office__c
+                                                                , Rental_Apply__r.AgreementBorrowingExtensionDate__c
+                                                                , Rental_Apply__r.ExtensionApprovalTime_Initial__c
+                                                                , Rental_Apply__r.ExtensionApplicationTime_Final__c
+                                                                , Rental_Apply__r.RcUnexpectExpiryDelay__c
+                                                                , Final_reply_day__c
+                                                                , Asset_return_time__c
+                                                                , Bollow_Date__c
+                                                                , demo_purpose2__c
+                                                                , demo_purpose1__c
+                                                                , Request_demo_time__c
+                                                                , Loaner_received_time__c
+                                                                , Received_Confirm__c
+                                                                , Loaner_received_day2__c
+                                                                , RcUnexpectExpiryDelay__c
+                                                             FROM Rental_Apply_Equipment_Set__c
+                                                            WHERE Rental_Apply__c = :rea.Id 
+                                                              AND Cancel_Reason__c = null // 鍙栨秷閲嶆柊鍒嗛厤鐨勮瘽闇�瑕佸仛涓篘G閲嶆柊鍒嗛厤鐨勬儏鍐垫墍浠ヤ笉鑳界敤Cancel_Select__c
+                                                             ];
+        return raes;
+    }
+
+    //add       wangweipeng            2021/11/26                   start
+    
+//bp2
+//    // 澶囧搧鍊熷嚭鏃堕棿check
+//    WebService static String approvalCheck2(String raesId) {
+//        // check缁撴灉
+//        String returnStr = '';
+        
+//        // 澶囧搧鍊熷嚭鍘嗗彶鍙栧緱
+//        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, Rental_Apply__r.Prepare_Day__c 
+//              from Rental_Apply_Equipment_Set__c 
+//             where Id = :raesId and Cancel_Select__c = false];
+        
+//        Rental_Apply_Equipment_Set__c r = raes[0];
+//        // 鏃ュ巻鑼冨洿锛屾渶灏忕殑鍊熷嚭寮�濮嬫棩鍒版渶澶х殑鍊熷嚭缁堜簡鏃�
+//        Date startDate = r.Rental_Start_Date__c;
+//        Date endDate = r.Rental_End_Date__c;
+//        Integer prepareDay = r.Rental_Apply__r.Prepare_Day__c == null ? Integer.valueOf(System.Label.EquipmentRentalPrepare) : r.Rental_Apply__r.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 Id != :raesId
+//                       and Equipment_Set__c = :r.Equipment_Set__c
+//                       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);
+//            }
+//        }
+        
+//        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();
+//                    Date minD = startD.addDays(-1 * prepare);
+//                    Date maxD = endD.addDays(prepare);
+//                    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';
+//    }
+
+//bp2
+//    WebService static String reserve2(String raesId) {
+//        String checkRS = '1';
+//        Rental_Apply_Equipment_Set__c raes = [
+//                select Id,Name,Rental_Apply__c,Rental_Start_Date__c,ES_Stock_Status__c,
+//                       Equipment_Set__c,
+//                       Equipment_Set__r.Name,
+//                       Equipment_Set__r.Active_judgement2__c,
+//                       Equipment_Set__r.Last_Reserve_Rental_Apply_Equipment_Set__c,
+//                       Equipment_Set__r.Pre_Reserve_Rental_Apply_Equipment_Set__c
+//                  from Rental_Apply_Equipment_Set__c where Id = :raesId and Cancel_Select__c = false
+//        ];
+//        if (raes.Equipment_Set__r.Last_Reserve_Rental_Apply_Equipment_Set__c == raes.Id) {
+//            checkRS = '璇ュ�熷嚭澶囧搧set涓�瑙堝凡缁忓仛杩囧嚭搴撴寚绀�:' + raes.Name;
+//            return checkRS;
+//        }
+//        if (raes.ES_Stock_Status__c == '涓嶈兘鍑哄簱') {
+//             checkRS = '澶囧搧set ' + raes.Equipment_Set__r.Name + ' 鍦ㄩ绾︽湡闂村涓嶈兘鍑哄簱锛岃纭';
+//             return checkRS;
+//        }
+//        checkRS = RentalApplyWebService.approvalCheck2(raesId);
+//        if (checkRS != '1') {
+//            return checkRS;
+//        }
+//        /*
+//        if (raes.Rental_Start_Date__c <= Date.today()) {
+//            checkRS = '鍊熷嚭寮�濮嬫棩蹇呴』澶т簬浠婃棩銆傚�熷嚭澶囧搧set涓�瑙堬細' + raes.Name;
+//            return checkRS;
+//        }
+//        if (raes.Equipment_Set__r.Active_judgement2__c != okStatus) {
+//            checkRS = '澶囧搧set ' + raes.Equipment_Set__r.Name + ' 鐨�' + Schema.SObjectType.Equipment_Set__c.fields.Asset_Set_status2__c.label + '涓嶆槸 99.绛夊緟棰勭害 锛岀幇鍦ㄦ槸 ' + raes.Equipment_Set__r.Asset_Set_status2__c + ' 璇风‘璁�';
+//            return checkRS;
+//        }
+//        */
+//        //澶囧搧Set鏄庣粏
+//        List<Equipment_Set_Detail__c> equipmentSetDetailList = new List<Equipment_Set_Detail__c>();
+//        List<Equipment_Set_Detail__c> equipmentSetDetailList2 = new List<Equipment_Set_Detail__c>();
+//        //澶囧搧鐢宠鍊熷嚭鏄庣粏鍘嗗彶
+//        List<Rental_Apply_Equipment_Set_Detail__c> rentalApplyEquipmentSetDetailList = new List<Rental_Apply_Equipment_Set_Detail__c>();
+//        //鏇存柊澶囧搧Set
+//        Equipment_Set__c equipmentSet = new Equipment_Set__c(
+//            Id = raes.Equipment_Set__c,
+//            Last_Reserve_Rental_Apply_Equipment_Set__c = raes.Id,
+//            Pre_Reserve_Rental_Apply_Equipment_Set__c = raes.Equipment_Set__r.Last_Reserve_Rental_Apply_Equipment_Set__c == null ? raes.Equipment_Set__r.Pre_Reserve_Rental_Apply_Equipment_Set__c : raes.Equipment_Set__r.Last_Reserve_Rental_Apply_Equipment_Set__c,
+//            StockDown__c = false,
+//            StockDown_time__c = null,
+//            Shipment_request_time__c = System.now(),            //鍑哄簱鎸囩ず鏃堕棿
+//            Shippment_loaner_time__c = null,            //澶囧搧涓績鍑哄簱鏃堕棿
+//            Forecast_arrival_day__c = null,             //棰勮鍒拌揣鏃�
+//            //Loaner_received_day__c = null,              //鐜板満绛炬敹鏃�
+//            Request_asset_extend_time__c = null,        //寤舵湡鐢宠鏃堕棿
+//            asset_extend_approval_time__c = null,       //寤舵湡鐢宠鎵瑰噯鏃堕棿
+//            //Asset_return_day__c = null,                 //鐗╂祦鎻愯揣鏃�
+//            Received_loaner_time__c = null,             //澶囧搧涓績鍥炴敹鏃堕棿
+//            delivery_company__c = null,
+//            Fedex_number__c = null,
+//            Distributor_method__c = null,
+//            Return_to_wh_staff__c = null,
+//            Return_delivery_company__c = null,
+//            Return_Fedex_number__c = null,
+//            Return_Distributor_method__c = null,
+//            Received_confirmation_staff__c = null,
+//            Customer_install_explanation_sign__c = null, //鏄惁鍥炴敹CDS纭鍗�
+//            Send_to_return_email__c = false, //鍙戦�佸洖鏀剁粨鏋滃弽棣堥偖浠�
+//            Return_comment_anoucment__c = null, //鍙戦�佸洖鏀剁粨鏋滃弽棣堝唴瀹�(NG鐞嗙敱鍜屾瑺鍝佹儏鍐�)
+////bp2            CDS_complete__c = false,
+//            Arrival_in_wh__c = false,
+//            Arrival_wh_time2__c = null,
+
+//            Repair_Sum_Update__c = 0
+//        );
+        
+//        //鍊熷嚭璁惧鏈鸿韩鍙风爜
+//        String assetSerialNumber = '';
+//        Boolean assetFirst = false;
+//        //澶囧搧Set鏄庣粏
+//        Equipment_Set_Detail__c[] equipmentSetDetails = [select Equipment_Set__c,Asset__c,Asset__r.SerialNumber,
+//                                            Check_lost_Item__c,Pre_disinfection__c,Water_leacage_check__c,
+//                                            Inspection_result_after__c,Arrival_in_wh__c,
+//                                            Lost_item_check_staff__c,CDS_staff__c,Inspection_staff_After__c,
+//                                            Return_wh_chenk_staff__c,Pre_inspection_time__c,Lost_item_check_time__c,
+//                                            After_Inspection_time__c,Arrival_wh_time__c,
+//                                            Inspection_result__c,Inspection_staff__c,Last_Reserve_RAES_Detail__c
+////bp2        CDS_complete_time__c,
+//                                            from Equipment_Set_Detail__c
+//                                            where Equipment_Set__c = :equipmentSet.Id and Select_rental__c = true];
+        
+//        for (Equipment_Set_Detail__c equipmentSetDetail : equipmentSetDetails) {
+//            //鎻掑叆澶囧搧鐢宠鍊熷嚭鏄庣粏鍘嗗彶
+//            Rental_Apply_Equipment_Set_Detail__c rentalApplyEquipmentSetDetail = new Rental_Apply_Equipment_Set_Detail__c();
+//            rentalApplyEquipmentSetDetail.Rental_Apply__c = raes.Rental_Apply__c;//澶囧搧鍊熷嚭鐢宠
+//            rentalApplyEquipmentSetDetail.Rental_Apply_Equipment_Set__c = raes.Id;//澶囧搧Set鍊熷嚭鍘嗗彶
+//            rentalApplyEquipmentSetDetail.Equipment_Set__c = equipmentSetDetail.Equipment_Set__c;//澶囧搧Set
+//            rentalApplyEquipmentSetDetail.Asset__c = equipmentSetDetail.Asset__c;//淇濇湁璁惧
+//            //鎻掑叆澶囧搧鐢宠鍊熷嚭鏄庣粏鍘嗗彶
+//            rentalApplyEquipmentSetDetailList.add(rentalApplyEquipmentSetDetail);
+            
+//            //鏇存柊澶囧搧Set鏄庣粏
+//            equipmentSetDetail.Check_lost_Item__c = null;//娆犲搧纭缁撴灉
+//            equipmentSetDetail.Pre_disinfection__c = null;//娓呮礂鍓�
+//            equipmentSetDetail.Water_leacage_check__c = null;//娴嬫紡妫�鏌ョ粨鏋�
+//            equipmentSetDetail.Inspection_result_after__c = null;//鍥炴敹鍚�-妫�娴嬬粨鏋�
+//            equipmentSetDetail.Arrival_in_wh__c = false;//鍥炲簱纭
+//            equipmentSetDetail.Lost_item_check_staff__c = null;//娆犲搧纭鑰�
+//            equipmentSetDetail.CDS_staff__c = null;//娑堟瘨浜哄憳
+//            equipmentSetDetail.Inspection_staff_After__c = null;//鍥炴敹鍚�-妫�娴嬩汉鍛�
+//            equipmentSetDetail.Return_wh_chenk_staff__c = null;//鍥炲簱纭鑰�
+//            equipmentSetDetail.Inspection_result__c = null;//鍙戣揣鍓�-妫�娴嬬粨鏋�
+//            equipmentSetDetail.Inspection_staff__c = null;//鍙戣揣鍓�-妫�娴嬩汉鍛�
+            
+//            equipmentSetDetail.Pre_inspection_time__c = null;//澶囧搧Set鐢�,鍙戣揣鍓�-妫�娴嬪悎鏍兼椂闂�
+//            equipmentSetDetail.Lost_item_check_time__c = null;//澶囧搧Set鐢�,娆犲搧纭鏃堕棿
+////bp2            equipmentSetDetail.CDS_complete_time__c = null;//澶囧搧Set鐢�,CDS瀹屾瘯鏃堕棿
+//            equipmentSetDetail.After_Inspection_time__c = null;//澶囧搧Set鐢�,鍥炴敹鍚�-妫�娴嬪畬姣曟椂闂�
+//            equipmentSetDetail.Arrival_wh_time__c = null;//澶囧搧Set鐢�,鍥炲簱纭瀹屾瘯鏃堕棿
+//            //鏇存柊澶囧搧Set鏄庣粏
+//            equipmentSetDetailList.add(equipmentSetDetail);
+//            //鍊熷嚭璁惧鏈鸿韩鍙风爜
+//            if (String.isNotBlank(equipmentSetDetail.Asset__r.SerialNumber)) {
+//                if (assetFirst == false) {
+//                    assetSerialNumber += ',' + equipmentSetDetail.Asset__r.SerialNumber + ',';
+//                    assetFirst = true;
+//                } else {
+//                    assetSerialNumber += equipmentSetDetail.Asset__r.SerialNumber + ',';
+//                }
+//            }
+//        }
+        
+//        Equipment_Set_Detail__c[] equipmentSetDetails2 = [select Id, Last_Reserve_RAES_Detail__c
+//                                            from Equipment_Set_Detail__c
+//                                            where Equipment_Set__c = :equipmentSet.Id and Select_rental__c = false];
+//        for (Equipment_Set_Detail__c equipmentSetDetail : equipmentSetDetails2) {
+//            equipmentSetDetail.Pre_Reserve_RAES_Detail__c = equipmentSetDetail.Last_Reserve_RAES_Detail__c;
+//            equipmentSetDetail.Last_Reserve_RAES_Detail__c = null;
+//            equipmentSetDetailList2.add(equipmentSetDetail);
+//        }
+        
+//        //鏇存柊鍊熷嚭璁惧鏈鸿韩鍙风爜
+//        raes.Rental_Asset_SerialNumber__c = assetSerialNumber;
+        
+//        Savepoint sp = Database.setSavepoint();
+//        try {
+//            if (equipmentSet != null) {
+//                update equipmentSet;
+//            }
+//            if (rentalApplyEquipmentSetDetailList.size() > 0) {
+//                insert rentalApplyEquipmentSetDetailList;
+//            }
+//            if (equipmentSetDetailList.size() > 0) {
+//                for (Integer i=0; i<equipmentSetDetailList.size(); i++) {
+//                    equipmentSetDetailList[i].Pre_Reserve_RAES_Detail__c = equipmentSetDetailList[i].Last_Reserve_RAES_Detail__c;
+//                    equipmentSetDetailList[i].Last_Reserve_RAES_Detail__c = rentalApplyEquipmentSetDetailList[i].Id;
+//                }
+//                update equipmentSetDetailList;
+//            }
+//            if (equipmentSetDetailList2.size() > 0) {
+//                update equipmentSetDetailList2;
+//            }
+//            if (String.isNotBlank(assetSerialNumber)) {
+//                update raes;
+//            }
+//            eSetRefreshStatus(equipmentSet.Id);
+//        } catch (System.Exception e) {
+//            Database.rollback(sp);
+//            return e.getMessage();
+//        }
+//        //杩斿洖缁撴灉
+//        return checkRS;
+//    }
+
+    // 鍊熷嚭澶囧搧閰嶅涓�瑙堢姸鎬佸嵆鏃舵洿鏂�
+    WebService static String eSetRefreshStatus(String raeSetId) {
+        return eSetRefreshStatus(new List<String> {raeSetId});
+    }
+    public static String eSetRefreshStatus(List<String> raeSetIds) {
+        List<Rental_Apply_Equipment_Set__c> updateList1 = new List<Rental_Apply_Equipment_Set__c>();
+
+        if (!raeSetIds.isEmpty()) {
+            for (Rental_Apply_Equipment_Set__c raes: [
+                    select Id,Repair_Status1__c,Repair_Status_Text__c,Final_reply_day__c,Final_reply_day_text__c,
+                            Received_Confirm_NG_Not_Return__c,Received_Confirm_NG_Not_Return_Text__c,
+                            Received_Confirm_Status_Text__c, Received_Confirm_Status_F__c
+                              , NG_Final_reply_day_Text__c
+                              , NG_Final_reply_day_F__c
+                              , Yizhouweixiu_Final_reply_day_Text__c
+                              , Yizhouweixiu_Final_reply_day_F__c
+                              , Extend_Final_reply_day_Text__c
+                              , Extend_Final_reply_day_F__c
+                              , QIS_Final_reply_day_Text__c
+                              , QIS_Final_reply_day_F__c
+                              , Repair_cancel_Final_reply_day_Text__c
+                              , Repair_cancel_Final_reply_day_F__c
+                              , Return_to_office_Final_reply_day_Text__c
+                              , Return_to_office_Final_reply_day_F__c
+                              , Repair_delete_Final_reply_day_Text__c
+                              , Repair_delete_Final_reply_day_F__c
+                              , Yigoudaihuo_Final_reply_day_Text__c
+                              , Yigoudaihuo_Final_reply_day_F__c
+                              , Guzhangpaicha_Final_reply_day_Text__c
+                              , Guzhangpaicha_Final_reply_day_F__c
+                              , Repair_Agreed_Quotation_Text__c
+                              , Repair_Agreed_Quotation_F__c
+                              , Return_to_office_Final_reply_day_U_RC__c
+                              , Return_to_office_Final_reply_day_U_RC_F__c
+                              , Extend_Date__c
+                              , Extend_Date_F__c
+                              , Received_NG_ReAssign_Text__c
+                              , Received_NG_ReAssign__c
+                        //銆怓Y23澶у強宸ㄥぇ璇鹃銆戦暱鍋囧鍝佸�熺敤寤舵湡寮�鍙� 2022/12/27 start xxf
+                              , Final_reply_day_Holiday_backup__c
+                              , NG_Final_reply_day_F_Holiday_backup__c
+                              , NG_Final_reply_day_Text_Holiday_backup__c
+                              , Yizhouweixiu_Final_reply_day_F_Holiday__c
+                              , Yizhouweixiu_Final_reply_day_TextHoliday__c
+                              , Extend_Final_reply_day_F_Holiday_backup__c
+                              , Extend_Final_reply_day_Text_Holiday_back__c
+                              , QIS_Final_reply_day_F_Holiday_backup__c
+                              , QIS_Final_reply_day_Text_Holiday_backup__c
+                              , Repair_cancel_Final_reply_day_F_Holiday__c
+                              , Repair_cancel_Final_reply_day_Text_Holid__c
+                              , Return_to_office_Final_reply_day_F_Ho__c
+                              , Return_to_office_Final_reply_day_Text_Ho__c
+                              , Repair_delete_Final_reply_day_F_Holiday__c
+                              , Repair_delete_Final_reply_day_Text_Ho__c
+                              , Yigoudaihuo_Final_reply_day_F_Holiday__c
+                              , Yigoudaihuo_Final_reply_day_Text_Holiday__c
+                              , FGuzhangpaicha_Final_reply_day_F_Holiday__c
+                              , Guzhangpaicha_Final_reply_day_Text_Holid__c
+                              , Return_to_office_Final_reply_day_U_RC_Ho__c
+                              , Return_to_office_Final_reply_day_U_RC_FH__c
+                        //銆怓Y23澶у強宸ㄥぇ璇鹃銆戦暱鍋囧鍝佸�熺敤寤舵湡寮�鍙� 2022/12/27 end xxf
+                      from Rental_Apply_Equipment_Set__c
+                     where Id IN :raeSetIds
+            ]) {
+                Rental_Apply_Equipment_Set__c upd = UpdateRentalApplyEquipmentSetBatch.setRAES(raes);
+                if (upd != null) {
+                    updateList1.add(upd);
+                }
+            }
+        }
+//bp2
+//        List<Equipment_Set_Detail__c> esdList = [
+//                select Id,Asset_condition__c,Asset_condition_Text__c,
+//                       Serial_Lot__c,Serial_Lot_text__c,
+//                       Asset__r.Loaner_accsessary__c, Loaner_accsessary_text__c,
+//                       Active_judgement__c,Active_judgement_select__c,Active_judgement_text__c,
+//                       Last_Reserve_RAES_Detail_RAES_F__c,Last_Reserve_RAES_Detail_RAES_Id__c,
+//                       Equipment_Set_Last_Reserve_RAES_F__c,Equipment_Set_Last_Reserve_RAES_Id__c
+//                  from Equipment_Set_Detail__c 
+//                 where Equipment_Set__c IN :eSetIds];
+//        List<Equipment_Set_Detail__c> updateList2 = UpdateRentalApplyEquipmentSetBatch.setESD(esdList);
+
+        Savepoint sp = Database.setSavepoint();
+        try {
+            if (!updateList1.isEmpty()) update updateList1;
+//bp2            if (updateList2.size() > 0) update updateList2;
+            return '1';
+        } catch (System.Exception e) {
+            Database.rollback(sp);
+            return e.getMessage();
+        }
+        return '1';
+    }
+
+//bp2    //鏁板嚭涓�鍏辨湁澶氬皯涓鍝丼et锛屽嚭搴撴寚绀猴紝鍏ㄩ儴鍙戣揣浼氱敤鍒�
+//    Webservice static Integer CntEquipmentSet(String Raid){
+//        List<Rental_Apply_Equipment_Set__c> Raesc = [Select Equipment_Set__c from Rental_Apply_Equipment_Set__c where Rental_Apply__c=:Raid and Cancel_Select__c = false];
+//        return Raesc.size();
+//    }
+    // 鍒嗛厤楠岃瘉
+    Webservice static String AssignBtn(String Rid){
+
+        List<String> statusList = System.Label.StatusProcessState.split(',');
+
+        List<Rental_Apply__c> raList = [select demo_purpose2__c,next_action__c,QIS_number__r.ReplaceDeliveryDate__c,Follow_UP_Opp__r.Shipping_Finished_Day_Func__c,repair__r.Repair_Final_Inspection_Date__c,repair__r.Return_Without_Repair_Date__c,Campaign__c,Campaign__r.Status,Repair__r.Repair_Shipped_Date__c,Campaign__r.IF_Approved__c,Campaign__r.Meeting_Approved_No__c,Campaign__r.Approved_Status__c   from Rental_Apply__c where id = :Rid];
+        // 20210803 ljh  SFDC-C5HDC7 add 鏌ヨ娣诲姞 Campaign__c,Campaign__r.Status,Repair__r.Repair_Shipped_Date__c 
+        if(raList.size()>0){
+            Rental_Apply__c Ra = raList[0];
+            // 20210803 ljh  SFDC-C5HDC7 update  鍒ゆ柇澧炲姞 Ra.repair__c != null && start
+            // if(Ra.repair__r.Repair_Final_Inspection_Date__c!=null){
+            //     return '淇悊鏈�缁堟娴嬫棩涓嶄负绌猴紝涓嶈兘鍒嗛厤';
+            // }else if(Ra.repair__r.Return_Without_Repair_Date__c !=null){
+            //     return '鏈慨鐞嗗綊杩樻棩涓嶄负绌猴紝涓嶈兘鍒嗛厤';
+            if(Ra.Campaign__c != null && Ra.Campaign__r.Status == '鍙栨秷'){
+                return '瀛︿細鍙栨秷锛屼笉鍙垎閰�';
+            }else if(Ra.repair__c != null && (Ra.repair__r.Repair_Final_Inspection_Date__c!=null || Ra.Repair__r.Repair_Shipped_Date__c != null)){
+                return '淇悊鏈夋渶缁堟娴嬫棩鎴栦慨鐞嗗搧杩旈�佹棩锛屼笉鍙垎閰�';
+            }else if(Ra.repair__c != null && Ra.repair__r.Return_Without_Repair_Date__c !=null){
+                return '鏈慨鐞嗗綊杩樻棩涓嶄负绌猴紝涓嶈兘鍒嗛厤';
+            // 20210803 ljh  SFDC-C5HDC7 add end   
+            }//1822 yc 20211021 start
+            else if(Ra.demo_purpose2__c=='宸茶喘寰呰揣' && Ra.Follow_UP_Opp__r.Shipping_Finished_Day_Func__c!= null){
+                return '宸茶喘寰呰揣鐩殑锛屾柊鍝佸凡鏈夊彂璐ф棩锛屼笉鍙垎閰�';
+           }else if(Ra.demo_purpose2__c=='绱㈣禂QIS' && Ra.next_action__c=='鏃犲伩鏇存崲' && Ra.QIS_number__r.ReplaceDeliveryDate__c!= null){
+                return '绱㈣禂QIS鐩殑锛孮IS宸叉湁鏂板搧鍙戣揣鏃ワ紝涓嶅彲鍒嗛厤';
+           }//1822 yc 20211108 end
+           else if(Ra.Campaign__r.IF_Approved__c && Ra.Campaign__r.Meeting_Approved_No__c == null){
+                return '宸茬敵璇峰喅瑁佷絾鍐宠缂栫爜涓虹┖';
+           }//20220301 sx obpm淇敼
+           else if(Ra.Campaign__r.IF_Approved__c && Ra.Campaign__r.Meeting_Approved_No__c != null && statusList.contains(Ra.Campaign__r.Approved_Status__c)){
+                return '宸茬敵璇峰喅瑁佷絾鍐宠鐘舵�佷笉绗﹀悎鏉′欢';
+           }//20220315 sx obpm澶囧搧鍐宠鐘舵�佺浉鍏充慨鏀�
+           else{
+                return 'Fin';
+            } 
+        }else{
+            return '璇ュ�熷嚭鐢宠涓嶅瓨鍦�';
+        }
+    }
+
+//bp2
+//    // 琛ュ厖闄勫睘鍝�
+//    WebService static String fillOtherDetail(String eSetId) {
+//        // 涓嶆墦鍕剧殑涓嶈琛ュ厖锛屾墍浠ョ湅 Active_judgement_select__c
+//        List<Equipment_Set_Detail__c> sesd = [select Id from Equipment_Set_Detail__c where Equipment_Set__c = :eSetId and Asset__r.Loaner_accsessary__c = false and Active_judgement_select__c != :okStatus];
+//        if (sesd.size() > 0) {
+//            // 瑕佺瓑涓绘満鍥炴潵浜嗘墠鑳借ˉ
+//            return '璇风‘璁ゅ鍝佷腑涓绘満鐘舵��';
+//        }
+        
+//        List<Equipment_Set_Detail__c> oesd = [select Id, Last_Reserve_RAES_Detail__c from Equipment_Set_Detail__c where Equipment_Set__c = :eSetId and Asset__r.Loaner_accsessary__c = true and Equipment_Set__r.ES_Status__c not in ('寮曞綋鍙�','寮曞綋娓�') and Select_rental__c = true];
+//        // 鍥犱负鏈夊弬鐓у鍝乻et鐨勫瓧娈碉紝鎵�浠ヤ负浜嗚揪鍒扮姸鎬佸彉鎴�99鐨勭洰鐨勶紝鍦ㄨ繖閲屽仛浜嗗叆搴撶殑鎿嶄綔锛岃�屼笉鏄叏娓呯┖銆�
+//        for (Equipment_Set_Detail__c esd : oesd) {
+//            if (esd.Last_Reserve_RAES_Detail__c != null) {
+//                esd.Pre_Reserve_RAES_Detail__c = esd.Last_Reserve_RAES_Detail__c;
+//                esd.Last_Reserve_RAES_Detail__c = null;
+//            }
+
+//            esd.Inspection_result_ng__c = null;
+//            esd.Pre_inspection_time__c = null;
+//            esd.Inspection_staff__c = null;
+//            esd.Inspection_result__c = 'OK';
+
+//            esd.Check_lost_Item__c = 'OK';
+//            esd.Lost_item_check_time__c = null;
+//            esd.Lost_item_check_staff__c = null;
+//            esd.Lost_item_giveup__c = false;
+
+//            esd.Inspection_result_after_ng__c = null;
+//            esd.After_Inspection_time__c = null;
+//            esd.Inspection_staff_After__c = null;
+//            esd.Inspection_result_after__c = 'OK';
+
+//            esd.Arrival_in_wh__c = true;
+//            esd.Arrival_wh_time__c = null;
+//            esd.Return_wh_chenk_staff__c = null;
+
+//            esd.Pre_disinfection__c = null;
+//            esd.Water_leacage_check__c = null;
+////bp2            esd.CDS_staff__c = null;
+////bp2            esd.CDS_complete_time__c = null;
+//        }
+
+//        Savepoint sp = Database.setSavepoint();
+//        try {
+//            update oesd;
+//            return '1';
+//        } catch (System.Exception e) {
+//            Database.rollback(sp);
+//            return e.getMessage();
+//        }
+//        return '1';
+//    }
+
+    Webservice 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';
+    }
+    
+    // TODO please use public
+    public static Date getWD_now(Date d) {
+        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 1];
+        Date selectDate = workday[0].Date__c;
+        return selectDate;
+    }
+
+    // TODO please use public
+    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;
+        }
+    }
+    
+    // pd:0浠h〃褰撳ぉ,1浠h〃绗簩澶�
+    public Map<Date, Map<String, String>> getDateMap(Date sd, Date ed, Integer pd) {
+        Map<Date, Map<String, String>> returnMap = new Map<Date, Map<String, String>>();
+        List<OlympusCalendar__c> workdayList = [
+                select Id, Date__c, IsWorkDay__c 
+                  from OlympusCalendar__c 
+                 where Date__c >= :sd
+                   and Date__c <= :ed.addDays(15 + pd)                  // +15 鐨勭洰鐨勬槸銆佷负浜嗗彇寰梕d 銇� 涓嬩竴涓伐浣滄棩
+                 order by Date__c];
+        for (Integer i = 0; i < workdayList.size(); i++) {
+            OlympusCalendar__c wd = workdayList[i];
+            if (wd.Date__c > ed) break;
+            Integer nextWordDays = 0;
+            Map<String, String> valueMap = new Map<String, String>();
+            valueMap.put('WorkDay', String.valueOf(wd.IsWorkDay__c));
+            Integer maxJ = 15 + i + pd;
+            if (maxJ > workdayList.size()) maxJ = workdayList.size();
+            for (Integer j = i; j < maxJ; j++) {
+                OlympusCalendar__c oc = workdayList[j];
+                if (oc.IsWorkDay__c == 1) {
+                    nextWordDays++;
+                    if (nextWordDays == pd + 1) {
+                        valueMap.put('Next', String.valueOf(oc.Date__c));
+                        break;
+                    }
+                }
+            }
+            
+            returnMap.put(wd.Date__c, valueMap);
+        }
+        return returnMap;
+    }
+
+//bp2
+//// TODO katsu select in for, why?銆乬etBetweenWD 銈掋仾銇忋仚鏂瑰悜銆丆ount銇犮亼銇倝銆乬etOlympusWorkDayCount 銇儭銈姐儍銉夈亴銇傘倞銇俱仚銆�
+//    //宸ヤ綔鏃�
+//    WebService static String getBetweenWD(String sd, String ed) {
+//        String betweenWD = '0';
+//        if (sd != '' && ed != '') {
+//            Date sdate = Date.valueof(sd.replace('/','-'));
+//            Date edate = Date.valueof(ed.replace('/','-'));
+//            List<OlympusCalendar__c> workdayList = [
+//                    select Id, Date__c, IsWorkDay__c 
+//                      from OlympusCalendar__c 
+//                    where Date__c >= :sdate
+//                       and Date__c <= :edate
+//                       and IsWorkDay__c = 1
+//                     order by Date__c];
+//            betweenWD = String.valueOf(workdayList.size());
+//        }
+//        return betweenWD;
+//    }
+//bp2 OLY_OCM-113
+    ////鑷劧鏃�
+    //Webservice static String getBetweenNaturalDay(String sd, String ed){
+    //    String betweenND = '0';
+    //    if(sd != '' && ed != ''){
+    //        Date sdate = Date.valueof(sd.replace('/','-'));
+    //        Date edate = Date.valueof(ed.replace('/','-'));
+    //        Integer days = sdate.daysBetween(edate);
+
+    //        betweenND = String.valueOf(days);
+    //    }
+    //    return betweenND;
+    //}
+    //WebService static String sendAll(String raid) {
+    //    return '1';
+    //}
+
+////bp2 OLY_OCM-81
+//*************************Create 20160825 SWAG-AD59Z6 瓒欏境鑺� Start*************************//
+//    //鍏ㄩ儴鍙戣揣
+//    WebService static String DeliverAll(String raid){
+//        List<Rental_Apply__c> raList = [select id,repair__r.Repair_Final_Inspection_Date__c,Bollow_Date__c,repair__r.Return_Without_Repair_Date__c, delivery_company__c, Return_to_wh_staff__c, Distributor_method__c, Tracking_Number__c,
+//                                               Shippment_loaner_time__c,Status__c,All_Delivery_Flag_c__c
+//                                          from Rental_Apply__c
+//                                         where id = :raid];
+//        Rental_Apply__c Ra = new Rental_Apply__c();
+//        System.debug(raList);
+//        if(raList.size()>0){
+//            Ra = raList[0];
+//            if(Ra.delivery_company__c == null||
+//                Ra.Return_to_wh_staff__c == null ||
+//                 Ra.Distributor_method__c == null ||
+//                  Ra.Tracking_Number__c == null){
+//                return '璇疯ˉ鍏ㄥ彂璐х墿娴佷俊鎭�';
+//            }else if(Ra.Status__c !='鍑哄簱鎸囩ず瀹屼簡'){
+//                return '璇峰厛鍋氬嚭搴撴寚绀哄悗锛屽啀杩涜鍑哄簱';
+//            }
+//            //else if(Ra.repair__c.Repair_Final_Inspection_Date__c<Ra.Bollow_Date__c){
+//            //  return '淇悊鏈�缁堟娴嬫棩鏃╀簬鍙戣揣鏃ワ紝涓嶈兘鍙戣揣';
+//            //}
+//            else if(Ra.repair__c!=null&&Ra.repair__r.Repair_Final_Inspection_Date__c!=null){
+//                return '淇悊鏈�缁堟娴嬫棩涓嶄负绌猴紝涓嶈兘鍙戣揣';
+//            }else if(Ra.repair__c!=null&&Ra.repair__r.Return_Without_Repair_Date__c!=null){
+//                return '鏈慨鐞嗗綊杩樻棩涓嶄负绌猴紝涓嶈兘鍙戣揣';
+//            }else{
+//                List<Rental_Apply_Equipment_Set__c> DeliveryGoodDetail = new List<Rental_Apply_Equipment_Set__c>();
+//                DeliveryGoodDetail = [select id,name,Equipment_Set__c from Rental_Apply_Equipment_Set__c where Shippment_loaner_time__c =null and Rental_Apply__c =:raid and  Cancel_Select__c = false];
+//                if(DeliveryGoodDetail.size()>0){
+//                    List<Rental_Apply_Equipment_Set__c> ExistSet  = new List<Rental_Apply_Equipment_Set__c>();
+//                    ExistSet = [select id,name,Equipment_Set__c from Rental_Apply_Equipment_Set__c where Rental_Apply__c =:raid and Cancel_Select__c = false];
+//                    List<String> sqlLine = new List<String>();
+//                    for(Rental_Apply_Equipment_Set__c RAESC : DeliveryGoodDetail){
+//                        sqlLine.add(RAESC.Equipment_Set__c);
+//                    }
+//                    List<Equipment_Set__c> ResultSet = new List<Equipment_Set__c>();
+//                    ResultSet = [select id,Pre_inspection_time__c,Shippment_loaner_time__c from Equipment_Set__c where id in:sqlLine];
+//                    System.debug(ResultSet);
+//                    Integer Ncnt =0;
+//                    for(Equipment_Set__c ESC : ResultSet){
+//                        if(ESC.Shippment_loaner_time__c!=null){
+//                            Ncnt=Ncnt+1;
+//                        }
+//                    }
+//                    Savepoint sp = Database.setSavepoint();
+//                    List<Equipment_Set__c> UpsertEsc = new List<Equipment_Set__c>();
+//                    if(Ncnt==0){
+//                        for(Equipment_Set__c ESC : ResultSet){
+//                            Equipment_Set__c EscEle =  new Equipment_Set__c();
+//                            EscEle.id=ESC.id;
+//                            EscEle.delivery_company__c  = Ra.delivery_company__c;
+//                            EscEle.Return_to_wh_staff__c  = Ra.Return_to_wh_staff__c;
+//                            EscEle.Distributor_method__c  = Ra.Distributor_method__c;
+//                            EscEle.Fedex_number__c  = Ra.Tracking_Number__c;
+//                            EscEle.StockDown__c  = true;
+//                            UpsertEsc.add(EscEle);
+//                        }
+//                        if(UpsertEsc.size()>0){
+//                            Ra.All_Delivery_Flag_c__c = true;
+//                            try{
+//                                update Ra;    
+//                                update UpsertEsc;
+//                                return 'Fin';
+//                            }catch (System.Exception e){
+//                                Database.rollback(sp);
+//                                return e.getMessage();
+//                            }
+//                        }else{
+//                            return '鎵�閫夊鍝丼et锛屽凡鍏ㄩ儴鍑哄簱锛屾棤娉曞啀娆″嚭搴�';
+//                        }               
+//                    }else{
+//                        return '澶囧搧宸插嚭搴�';
+//                    }
+//                }else{
+//                    return '鏈�熷嚭鐢宠鏃犻渶瑕佸嚭搴撶殑澶囧搧';
+//                }
+//            }
+//        }else{
+//            return '鏃犳晥鐨勫鍝佸�熷嚭鐢宠';
+//        }
+//    }
+
+////bp2 OLY_OCM-81
+////*************************Create 20160825 SWAG-AD59Z6 瓒欏境鑺� End***************************//
+//    WebService static String receiveAll(String raid) {
+//        List<Rental_Apply__c> raList = [select id, Return_Track_Company__c, Return_Distrubutor_Method__c, Return_Trake_Staff__c, Return_Track_Number__c,
+//                                               Shippment_loaner_time__c
+//                                          from Rental_Apply__c
+//                                         where id = :raid];
+//        if (raList.size() == 0) {
+//            return '鏃犳晥鐨勫鍝佸�熷嚭鐢宠';
+//        }
+//        Rental_Apply__c ra = raList[0];
+//        if (ra.Return_Track_Company__c == null ||
+//            ra.Return_Distrubutor_Method__c == null ||
+//            ra.Return_Trake_Staff__c == null ||
+//            ra.Return_Track_Number__c == '' || ra.Return_Track_Number__c == null) {
+//            return '璇疯ˉ鍏ㄥ洖搴撶墿娴佷俊鎭�';
+//        }
+//        if (ra.Shippment_loaner_time__c == null) {
+//            return '澶囧搧杩樻病鍑哄簱';
+//        }
+//        List<Rental_Apply_Equipment_Set__c> raesList = [select id, Equipment_Set__c from Rental_Apply_Equipment_Set__c where Shippment_loaner_time__c != null and Rental_Apply__c = :raid and Cancel_Select__c = false];
+//        if (raesList.size() == 0) {
+//            return '澶囧搧杩樻病鍑哄簱';
+//        }
+//        Map<id,id> RaesEsIdMap = new Map<Id,id>();
+//        List<String> esidList = new List<String>();
+//        for (Rental_Apply_Equipment_Set__c raes : raesList) {
+//            esidList.add(raes.Equipment_Set__c);
+//            RaesEsIdMap.put(raes.Equipment_Set__c, raes.Id);
+//        }
+//        List<Equipment_Set__c> esList = [select id,Return_Fedex_number__c,Last_Reserve_Rental_Apply_Equipment_Set__c from Equipment_Set__c where id in :esidList];
+//        List<Equipment_Set__c> updList = new List<Equipment_Set__c>();
+//        for (Equipment_Set__c es : esList) {
+//            if ((es.Return_Fedex_number__c == null || es.Return_Fedex_number__c == '') && es.Last_Reserve_Rental_Apply_Equipment_Set__c == RaesEsIdMap.get(es.Id)) {
+//                Equipment_Set__c tmp = new Equipment_Set__c(
+//                    id = es.id,
+//                    Return_delivery_company__c = ra.Return_Track_Company__c,
+//                    Received_confirmation_staff__c = ra.Return_Trake_Staff__c,
+//                    Return_Distributor_method__c = ra.Return_Distrubutor_Method__c,
+//                    Return_Fedex_number__c = ra.Return_Track_Number__c
+//                );
+//                updList.add(tmp);
+//            }
+//        }
+//        if (updList.size() == 0) {
+//            return '澶囧搧宸茬粡鍏ㄩ儴鍥炲簱';
+//        } else {
+//            try {
+//                update updList;
+//            } catch (Exception ex) {
+//                return ex.getMessage();
+//            }
+//        }
+//        return '1';
+//    }
+
+    WebService static String RentalApplyCancel(String raid, Boolean autoCancel) {
+        List<Rental_Apply__c> raList = [select id, Shipment_request_Cnt__c, Status__c, RA_Status__c, Shippment_loaner_cnt__c, Loaner_cancel_request__c, Arrival_wh_cnt__c,
+                Cancel_Reason__c
+                from Rental_Apply__c
+                where id = :raid];
+        List<Rental_Apply_Equipment_Set__c> raesList = [select id, StockDown_time__c
+//bp2        , Equipment_Set__c
+                                                          from Rental_Apply_Equipment_Set__c
+                                                         where Rental_Apply__c = :raid
+                                                           and Cancel_Select__c = false];
+
+        List<Rental_Apply_Equipment_Set__c> updList = new List<Rental_Apply_Equipment_Set__c>();
+        // List<Rental_Apply_Equipment_Set_Detail__c> delList = new List<Rental_Apply_Equipment_Set_Detail__c>();
+        Set<Id> esIdSet = new Set<Id>();
+
+        if (raList.size() <= 0) {
+            return '澶囧搧鐢宠涔︿笉瀛樺湪銆�';
+        }
+        Rental_Apply__c ra = raList[0];
+        if (ra.Status__c == '鍙栨秷') {
+            return '澶囧搧鐢宠涔﹀凡缁忓彇娑堛��';
+        }
+        if (ra.Status__c == '鍒犻櫎') {
+            return '澶囧搧鐢宠涔﹀凡缁忓垹闄ゃ��';
+        }
+        if (ra.RA_Status__c == FixtureUtil.raStatusMap.get(FixtureUtil.RaStatus.Yi_Chu_Ku.ordinal()) || ra.Arrival_wh_cnt__c > 0) {
+            return '澶囧搧宸茬粡鍑哄簱锛屼笉鑳藉彇娑堛��';
+        }
+        
+        User loginUser = [Select Id, Name, ProfileId From User where Id = :Userinfo.getUserId()];
+        if(loginUser.ProfileId != System.Label.ProfileId_SystemAdmin && loginUser.ProfileId != System.Label.ProfileId_EquipmentCenter && !System.Label.ProfileId_EquCenCheckAndDepot.contains(loginUser.ProfileId)  && !System.Label.ProfileId_EquCenAdmin.contains(loginUser.ProfileId) && loginUser.ProfileId != System.Label.ProfileId_IThelp && ra.Shipment_request_Cnt__c > 0
+        ){
+            return '涓嶈兘鍙栨秷鐢宠锛岃鑱旂郴澶囧搧涓績绐楀彛鍙栨秷銆�';
+        }
+
+
+        if (autoCancel == false && String.isBlank(ra.Cancel_Reason__c)) {
+            return '蹇呴』杈撳叆鍙栨秷鐞嗙敱銆�';
+        }
+        ra.Status__c = '鍙栨秷';
+        if (autoCancel) {
+            ra.Cancel_Reason__c = '琚姩鍙栨秷';
+        }
+        // Map<Id, Asset> assetMap = new Map<Id, Asset>();
+        // for (Rental_Apply_Equipment_Set__c raes : raesList) {
+        //     // if (raes.StockDown_time__c != null) {
+        //         raes.Cancel_Select__c = true;
+        //         raes.Cancel_Reason__c = ra.Loaner_cancel_request__c;
+        //         if (autoCancel) {
+        //             raes.Cancel_Reason__c = '琚姩鍙栨秷';
+        //         }
+        //         updList.add(raes);
+//bp2                esIdSet.add(raes.Equipment_Set__c);
+            // } else {
+                // delList.add(raes);
+//bp2                esIdSet.add(raes.Equipment_Set__c);
+            // }
+            // Asset ass = new Asset(Id = raes.Asset__c, Last_Reserve_RAES_Detail__c = null);
+            // assetMap.put(raes.Asset__c, ass);
+        // }
+
+        Savepoint sp = Database.setSavepoint();
+        try {
+            Set<Id> assetIdSet = new Set<Id>();
+            for (Rental_Apply_Equipment_Set_Detail__c raesd : [SELECT Id, Asset__c
+                                                                 FROM Rental_Apply_Equipment_Set_Detail__c
+                                                                WHERE Rental_Apply__c = :raid
+                                                                  FOR UPDATE]
+            ) {
+                if (String.isNotBlank(raesd.Asset__c)) {
+                    assetIdSet.add(raesd.Asset__c);
+                }
+            }
+            if (assetIdSet.size() > 0) {
+                List<Asset> assetList = [SELECT Id FROM Asset WHERE Id = :assetIdSet FOR UPDATE];
+            }
+            update ra;
+            //if (updList.size() > 0) update updList;
+            // if (!assetMap.isEmpty()) update assetMap.values();
+//bp2            ControllerUtil.setEquipmentSetProvisionFlg(esIdSet);
+        } catch (Exception ex) {
+            return ex.getMessage();
+            Database.rollback(sp);
+        }
+
+        return '1';
+    }
+
+    // 涓�瑕у崢浣�
+    @AuraEnabled
+    WebService static String setRaesShipment_request(String raesid) {
+      return setShipment_requests(null, raesid);
+    }
+
+    // 鐢宠珛鏇稿崢浣�
+    @AuraEnabled
+    WebService static String setShipment_request(String raid) {
+      return setShipment_requests(raid, null);
+    }
+
+    //鍑哄簱鎸囩ず鎸夐挳js涓�娆℃渶澶氭洿鏂�200鏉★紝鎵�浠ユ敼鍦╓ebService鍋氬嚭搴撴寚绀�
+    @AuraEnabled
+    WebService static String setShipment_requests(String raid, String raesid) {
+      Savepoint sp = Database.setSavepoint();
+
+      try {
+        //涓�瑙堟儏鍐典笅妫�绱竴瑙堝搴旂殑鐢宠涔d锛宻oql瀛愭煡璇笉鑳藉拰涓绘煡璇㈡槸鍚屼竴涓〃锛屽崟鐙绱竴娆�
+        if (String.isBlank(raid)) {
+            List<Rental_Apply_Equipment_Set__c> raList = [select Id, Rental_Apply__c from Rental_Apply_Equipment_Set__c where id = :raesid];
+            if (raList.size() > 0) {
+                raid = raList[0].Rental_Apply__c;
+            } else {
+                //搴旇涓嶄細鍒拌繖閲�
+                return '娌℃湁鍙互鍑哄簱鎸囩ず鐨勪竴瑙�';
+            }
+        }
+        String soql = 'SELECT Id'
+                + ' FROM Rental_Apply_Equipment_Set__c '
+                + ' WHERE Shippment_loaner_time2__c <> null '
+                + ' AND Rental_Apply__c = :raid '
+                + ' ORDER BY Id' ;
+        List<Rental_Apply_Equipment_Set__c> shippedRaesList = Database.query(soql);
+        String raesStrShipped = '';
+        for (Rental_Apply_Equipment_Set__c raes : shippedRaesList) {
+            raesStrShipped += raes.Id;
+        }
+
+        //Srring soql = "SELECT Id FROM Rental_Apply_Equipment_Set_Detail__c WHERE Rental_Apply__c = '{!Rental_Apply__c.Id}' AND Cancel_Select__c = false AND Rental_Num__c > 0 AND Rental_Apply_Equipment_Set__r.Wei_Assigned_Cnt__c = 0 AND Rental_Apply_Equipment_Set__r.Yi_Assigned_Cnt__c > 0 AND Shipment_request__c  = false";
+        soql = 'SELECT Id, Rental_Apply__c, Rental_Apply_Equipment_Set__c'
+                + ' FROM Rental_Apply_Equipment_Set_Detail__c '
+                + ' WHERE ' + (String.isNotBlank(raesid) ? 'Rental_Apply_Equipment_Set__c = :raesid ' : 'Rental_Apply__c = :raid ')
+                + ' AND Cancel_Select__c = false '
+                + ' AND Rental_Num__c > 0 '
+                + ' AND Rental_Apply_Equipment_Set__r.Wei_Assigned_Cnt__c = 0 '
+                + ' AND Rental_Apply_Equipment_Set__r.Yi_Assigned_Cnt__c > 0 '
+                + ' AND Shipment_request__c  = false'
+                + ' ORDER BY Rental_Apply_Equipment_Set__c, Id';
+        List<Rental_Apply_Equipment_Set_Detail__c> raesds = Database.query(soql);
+
+        Map<Id, List<String>> rental_Asset_SerialNumberMap = new Map<Id, List<String>>();
+
+        if (raesds.size() < 1) {
+            return '娌℃湁鍙互鍑哄簱鎸囩ず鐨勪竴瑙�';
+        } else {
+            Set<Id> raesSet = new Set<Id>();
+            String raesStrRequest = '';
+            for (Rental_Apply_Equipment_Set_Detail__c raesd : raesds) {
+                if (false == raesSet.contains(raesd.Rental_Apply_Equipment_Set__c)) {
+                    raesSet.add(raesd.Rental_Apply_Equipment_Set__c);
+                    raesStrRequest += raesd.Rental_Apply_Equipment_Set__c;
+                }
+                raesd.Shipment_request_time2__c = Datetime.now();
+                raesd.Shipment_request__c = true;
+            }
+            // 鍑哄簱鍚�, 鍐嶆鍋氬嚭搴撴寚绀虹殑涓�瑙�, 涓�瀹氳涓嚭杩囧簱鐨勪竴瑙堜竴鏍�
+            if (false == String.isBlank(raesStrShipped) && raesStrRequest != raesStrShipped) {
+                return '涓嶈兘鍋氬嚭搴撴寚绀猴紝闇�瑕佸垎鍗曞悗鍐嶆搷浣�';
+            }
+        }
+
+        // add lc 20220927 SFDC-CJ48VE 澶囧搧棰勮鍑哄簱鏃ラ�昏緫璋冩暣 start
+        List<Rental_Apply_Equipment_Set__c> RAESRecords = [
+                SELECT Id,Rental_Start_Date__c 
+                FROM Rental_Apply_Equipment_Set__c 
+                WHERE Rental_Apply__c = :raid
+                AND Cancel_Select__c = False];
+
+        for (Integer i = 0; i < RAESRecords.size(); i++) {
+            // 澶囧搧棰勮鍑哄簱鏃ヤ笉涓�鑷达紝涓嶅彲鍑哄簱鎸囩ず
+            if (RAESRecords[i].Rental_Start_Date__c != RAESRecords[0].Rental_Start_Date__c) {
+                return '澶囧搧棰勮鍑鸿揣鏃ヤ笉涓�鑷达紝涓嶅彲鍑哄簱鎸囩ず';
+            }
+        }
+        // add lc 20220927 SFDC-CJ48VE 澶囧搧棰勮鍑哄簱鏃ラ�昏緫璋冩暣 end
+
+        Rental_Apply__c ra = new Rental_Apply__c(Id = raesds[0].Rental_Apply__c, Status__c = '宸插嚭搴撴寚绀�');
+        update ra;
+        Database.SaveResult[] results = Database.update(raesds);
+        Database.SaveResult dmlResult = results[0];
+        if (dmlResult.isSuccess()) {
+            //鏄庣粏鏇存柊鎴愬姛鍚庢墠鏇存柊涓�瑙堢殑Rental_Asset_SerialNumber__c
+            soql = 'SELECT Id, SerialNumber_text__c, Rental_Apply_Equipment_Set__c '
+                    +'FROM Rental_Apply_Equipment_Set_Detail__c '
+                    +'WHERE Rental_Apply__c = \'' + raesds[0].Rental_Apply__c + '\''
+                    +'AND Shipment_request_time2__c != null '
+                    +'AND Shipment_request__c = true '
+                    +'AND SerialNumber_text__c != null '
+                    +'ORDER BY Rental_Apply_Equipment_Set__c ';
+
+
+            List<Rental_Apply_Equipment_Set_Detail__c> raesdSerialNumbers = Database.query(soql);
+
+            for (Rental_Apply_Equipment_Set_Detail__c raesd : raesdSerialNumbers) {
+
+                if (!rental_Asset_SerialNumberMap.containsKey(raesd.Rental_Apply_Equipment_Set__c)) {
+                    // Asset__r.SerialNumber + ','
+                    rental_Asset_SerialNumberMap.put(raesd.Rental_Apply_Equipment_Set__c, new List<String>());
+                }
+                rental_Asset_SerialNumberMap.get(raesd.Rental_Apply_Equipment_Set__c).add(raesd.SerialNumber_text__c);
+            }
+
+            List<Rental_Apply_Equipment_Set__c> raess = new List<Rental_Apply_Equipment_Set__c>();
+            for (Id key : rental_Asset_SerialNumberMap.keySet()) {
+                raess.add(new Rental_Apply_Equipment_Set__c(Id = key,
+                        Rental_Asset_SerialNumber__c = ',' + String.join(rental_Asset_SerialNumberMap.get(key), ',') + ','));
+            }
+            if (!raess.isEmpty()) {
+                update raess;
+            }
+
+            return '鐘舵�佹洿鏂板埌宸插嚭搴撴寚绀�';
+        } else {
+            Database.rollback(sp);
+            Database.Error emsg = dmlResult.getErrors()[0];
+            return 'failed to update:' + emsg.getFields() +  ' ' + emsg.getMessage();
+        }
+      } catch (Exception ex) {
+        Database.rollback(sp);
+        return ex.getMessage();
+      }
+    }
+
+    /**
+     * 娉ㄦ畫鐢宠澶囧搧鐨勭鎺�
+     */
+     WebService static String RentalApplyCheckForSAoneEle(String SaID) {
+        Statu_Achievements__c Sac = [select id,
+            SalesChannel__c,
+            Opportunity__r.Sales_Root__c,
+            Status_1__c,
+            Status_2_Formula__c,
+            Opp_Number__c,
+            ContractNO__c,
+            FirstApproveDate__c,
+            CreatedDate,
+            X30_Deposit_Day__c,
+            Deposit_In_Full_Day__c,
+            DeliveryDate__c,
+            Backorder_complete_day__c,
+            DeliveryStatus__c
+        from Statu_Achievements__c where id = :SaID];
+        if(Sac.Opportunity__r.Sales_Root__c == '璨╁2搴�'){
+            if(Sac.Opp_Number__c.contains('GI')||Sac.Opp_Number__c.contains('BF')||Sac.Opp_Number__c.contains('ET') ){
+                //modify by lyh 20220606 start 宸茶喘寰呰揣閫昏緫璋冩暣 
+                //瀹㈡埛GIR璁㈠崟锛屾敞娈嬬姸鎬�2鏄��12浠樺叏娆�-14宸插彂璐р�滆繖涓尯闂翠笖鍙戣揣鐘舵�佷负鈥濇湭浜や粯銆佸拰閮ㄥ垎浜や粯鈥滄椂锛岃嚜浠樻鏃ヨ捣绗�31澶╂湭鐢熸垚鈥濆鎴疯鍗曟渶缁堝彂璐ф棩鈥滄椂锛屾柟鍙互鎻愪氦鈥濆凡璐緟璐р�滅洰鐨勭殑澶囧搧鐢宠
+                //if(Sac.Status_1__c == '娉ㄦ畫' && (Sac.Status_2_Formula__c == '12 宸茶璐с兓浠樺叏娆�'||Sac.Status_2_Formula__c == '13 寰呭彂璐�')){
+                //    if((Date.today().addDays(-30)>Sac.Deposit_In_Full_Day__c)&&Sac.DeliveryDate__c == null){
+                if((Sac.Status_2_Formula__c == '12 宸茶璐с兓浠樺叏娆�' || Sac.Status_2_Formula__c == '13 寰呭彂璐�' || Sac.Status_2_Formula__c == '14 宸插彂璐�')
+                    && (Sac.DeliveryStatus__c == '鏈氦浠�' || Sac.DeliveryStatus__c == '閮ㄥ垎浜や粯')) {
+                    if((Date.today().addDays(-30) > Sac.Deposit_In_Full_Day__c) && Sac.Backorder_complete_day__c == null) {
+                //modify by lyh 20220606 end 宸茶喘寰呰揣閫昏緫璋冩暣
+                        return 'Fin';
+                    } else {
+                        return '缁忛攢鍟嗗唴绉戣鍗曚笉鍦ㄧ敵璇锋湡鍐咃紝涓嶈兘鐢宠澶囧搧';
+                    }
+                }else{
+                    return '缁忛攢鍟嗗唴绉戣鍗曠姸鎬佷笉绗﹀悎澶囧搧鐢宠璧勬牸锛屼笉鑳界敵璇峰鍝�';
+                }
+            }else if(Sac.Opp_Number__c.contains('SP')){
+                //modify by lyh 20220606 start 宸茶喘寰呰揣閫昏緫璋冩暣 
+                //瀹㈡埛SP璁㈠崟锛屾敞娈嬬姸鎬�2鏄��11浠樺畾閲�-14宸插彂璐р�滆繖涓尯闂翠笖鍙戣揣鐘舵�佷负鈥濇湭浜や粯銆佸拰閮ㄥ垎浜や粯鈥滄椂锛岃嚜浠樻鏃ヨ捣绗�61澶╂湭鐢熸垚鈥濆鎴疯鍗曟渶缁堝彂璐ф棩鈥滄椂锛屾柟鍙互鎻愪氦鈥濆凡璐緟璐р�滅洰鐨勭殑澶囧搧鐢宠
+                //if(Sac.Status_1__c == '娉ㄦ畫' && (Sac.Status_2_Formula__c == '11 宸茶璐с兓浠樿閲�'||Sac.Status_2_Formula__c == '12 宸茶璐с兓浠樺叏娆�'||Sac.Status_2_Formula__c == '13 寰呭彂璐�')){
+                //    if((Date.today().addDays(-60)>Sac.X30_Deposit_Day__c )&&Sac.DeliveryDate__c == null){
+                if((Sac.Status_2_Formula__c == '11 宸茶璐с兓浠樿閲�'||Sac.Status_2_Formula__c == '12 宸茶璐с兓浠樺叏娆�'||Sac.Status_2_Formula__c == '13 寰呭彂璐�'||Sac.Status_2_Formula__c=='14 宸插彂璐�')
+                    && (Sac.DeliveryStatus__c == '鏈氦浠�' || Sac.DeliveryStatus__c == '閮ㄥ垎浜や粯')) {
+                    if((Date.today().addDays(-60) > Sac.X30_Deposit_Day__c ) && Sac.Backorder_complete_day__c == null){
+                //modify by lyh 20220606 end 宸茶喘寰呰揣閫昏緫璋冩暣
+                        return 'Fin';
+                    }else{
+                        return '缁忛攢鍟哠P璁㈠崟涓嶅湪鐢宠鏈熷唴锛屼笉鑳界敵璇峰鍝�';
+                    }
+                }else{
+                    return '缁忛攢鍟哠P璁㈠崟鐘舵�佷笉绗﹀悎澶囧搧鐢宠璧勬牸锛屼笉鑳界敵璇峰鍝�';
+                }
+            }else{
+                return '娉ㄦ畫閿�鍞笭閬撶被鍒笉鍦ㄥ彲鐢宠澶囧搧鑼冨洿鍐�';
+            }
+        }else if(Sac.Opportunity__r.Sales_Root__c == 'OCM鐩存帴璨╁2'){
+            if(Sac.Opp_Number__c.contains('GI')||Sac.Opp_Number__c.contains('BF')||Sac.Opp_Number__c.contains('ET')){
+                //modify by lyh 20220606 start 宸茶喘寰呰揣閫昏緫璋冩暣 
+                //娉ㄦ畫鐘舵��2鏄��9宸插綍璁㈠崟鏈粯娆�-14宸插彂璐р�滆繖涓尯闂翠笖鍙戣揣鐘舵�佷负鈥濇湭浜や粯銆佸拰閮ㄥ垎浜や粯鈥滀笖鈥滈攢鍞笭閬撲负鐩撮攢鏃垛�濓紝GIR璁㈠崟鑷鍗曞綍鍏ユ棩璧风31澶�/鏈敓鎴愨�濆鎴疯鍗曟渶缁堝彂璐ф棩鈥滄椂锛屾柟鍙互鎻愪氦鈥濆凡璐緟璐р�滅洰鐨勭殑澶囧搧鐢宠
+                //if(Sac.Status_1__c == '娉ㄦ畫' && (Sac.Status_2_Formula__c == '09 宸插綍鍏ヨ鍗曟湭浠樻'||Sac.Status_2_Formula__c == '10 搴撳瓨宸查鐣欍兓鏈粯娆�'||Sac.Status_2_Formula__c == '11 宸茶璐с兓浠樿閲�'||Sac.Status_2_Formula__c == '12 宸茶璐с兓浠樺叏娆�'||Sac.Status_2_Formula__c == '13 寰呭彂璐�')){
+                //    if((Date.today().addDays(-30)>Sac.FirstApproveDate__c )&&Sac.DeliveryDate__c == null){
+                if((Sac.Status_2_Formula__c == '09 宸插綍鍏ヨ鍗曟湭浠樻'||Sac.Status_2_Formula__c == '10 搴撳瓨宸查鐣欍兓鏈粯娆�'||Sac.Status_2_Formula__c == '11 宸茶璐с兓浠樿閲�'||Sac.Status_2_Formula__c == '12 宸茶璐с兓浠樺叏娆�'||Sac.Status_2_Formula__c == '13 寰呭彂璐�'||Sac.Status_2_Formula__c=='14 宸插彂璐�')
+                    && (Sac.DeliveryStatus__c == '鏈氦浠�' || Sac.DeliveryStatus__c == '閮ㄥ垎浜や粯')){
+                    if((Date.today().addDays(-30) > Sac.FirstApproveDate__c ) && Sac.Backorder_complete_day__c == null) {
+                //modify by lyh 20220606 end 宸茶喘寰呰揣閫昏緫璋冩暣
+                        return 'Fin';
+                    }else{
+                        return 'OCM鐩撮攢鍐呯璁㈠崟涓嶅湪鐢宠鏈熷唴锛屼笉鑳界敵璇峰鍝�';
+                    }
+                }else{
+                    return 'OCM鐩撮攢鍐呯璁㈠崟鐘舵�佷笉绗﹀悎澶囧搧鐢宠璧勬牸锛屼笉鑳界敵璇峰鍝�';
+                }
+            }else if(Sac.Opp_Number__c.contains('SP')){
+                    //modify by lyh 20220606 start 宸茶喘寰呰揣閫昏緫璋冩暣 
+                    //娉ㄦ畫鐘舵��2鏄��9宸插綍璁㈠崟鏈粯娆�-14宸插彂璐р�滆繖涓尯闂翠笖鍙戣揣鐘舵�佷负鈥濇湭浜や粯銆佸拰閮ㄥ垎浜や粯鈥滀笖鈥滈攢鍞笭閬撲负鐩撮攢鏃垛�濓紝SP璁㈠崟61澶╂湭鐢熸垚鈥濆鎴疯鍗曟渶缁堝彂璐ф棩鈥滄椂锛屾柟鍙互鎻愪氦鈥濆凡璐緟璐р�滅洰鐨勭殑澶囧搧鐢宠
+                    //if(Sac.Status_1__c == '娉ㄦ畫' && (Sac.Status_2_Formula__c == '09 宸插綍鍏ヨ鍗曟湭浠樻'||Sac.Status_2_Formula__c == '10 搴撳瓨宸查鐣欍兓鏈粯娆�'||Sac.Status_2_Formula__c == '11 宸茶璐с兓浠樿閲�'||Sac.Status_2_Formula__c == '12 宸茶璐с兓浠樺叏娆�'||Sac.Status_2_Formula__c == '13 寰呭彂璐�')){
+                    //    if((Date.today().addDays(-60)>Sac.FirstApproveDate__c )&&Sac.DeliveryDate__c == null){
+                    if((Sac.Status_2_Formula__c == '09 宸插綍鍏ヨ鍗曟湭浠樻'||Sac.Status_2_Formula__c == '10 搴撳瓨宸查鐣欍兓鏈粯娆�'||Sac.Status_2_Formula__c == '11 宸茶璐с兓浠樿閲�'||Sac.Status_2_Formula__c == '12 宸茶璐с兓浠樺叏娆�'||Sac.Status_2_Formula__c == '13 寰呭彂璐�'||Sac.Status_2_Formula__c=='14 宸插彂璐�')
+                        && (Sac.DeliveryStatus__c == '鏈氦浠�' || Sac.DeliveryStatus__c == '閮ㄥ垎浜や粯')) {
+                        if((Date.today().addDays(-60) > Sac.FirstApproveDate__c ) && Sac.Backorder_complete_day__c == null) {
+                    //modify by lyh 20220606 end 宸茶喘寰呰揣閫昏緫璋冩暣   
+                            return 'Fin';
+                        }else{
+                            return 'OCM鐩撮攢SP璁㈠崟涓嶅湪鐢宠鏈熷唴锛屼笉鑳界敵璇峰鍝�';
+                        }
+                    }else{
+                        return 'OCM鐩撮攢SP璁㈠崟鐘舵�佷笉绗﹀悎澶囧搧鐢宠璧勬牸锛屼笉鑳界敵璇峰鍝�';
+                    }
+                }else{
+                    return '娉ㄦ畫閿�鍞笭閬撶被鍒笉鍦ㄥ彲鐢宠澶囧搧鑼冨洿鍐呫��';
+                }
+        }else{
+            return '閿�鍞笭閬撴湭鐭ワ紝涓嶈兘鏂板缓';
+        }
+     }
+
+
+//bp2
+    //public static String RentalApplyCheckForSA(String raid,String SaID) {
+    //    List<String> ProList = new List<String>();
+    //    if(raid!=null){
+    //        Rental_Apply__c Ra = [select id,
+    //            Product_category__c,
+    //            ProductNameNum1__c,
+    //            ProductNameNum10__c,
+    //            ProductNameNum2__c,
+    //            ProductNameNum3__c,
+    //            ProductNameNum4__c,
+    //            ProductNameNum5__c,
+    //            ProductNameNum6__c,
+    //            ProductNameNum7__c,
+    //            ProductNameNum8__c,
+    //            ProductNameNum9__c
+    //        from
+    //            Rental_Apply__c
+    //        where 
+    //            id=: Raid];
+    //        ProList.add(Ra.ProductNameNum1__c);
+    //         ProList.add(Ra.ProductNameNum2__c);
+    //          ProList.add(Ra.ProductNameNum3__c);
+    //           ProList.add(Ra.ProductNameNum4__c);
+    //            ProList.add(Ra.ProductNameNum5__c);
+    //             ProList.add(Ra.ProductNameNum6__c);
+    //              ProList.add(Ra.ProductNameNum7__c);
+    //               ProList.add(Ra.ProductNameNum8__c);
+    //                ProList.add(Ra.ProductNameNum9__c);
+    //                 ProList.add(Ra.ProductNameNum10__c);
+    //    List<asset> ast = [select
+    //                            id,
+                                
+    //                            Backorder__c 
+    //                        from
+    //                            asset
+    //                        where
+    //                            Backorder__c =:SaID];
+    //    for(asset asl : ast){
+    //        for(String proStr : ProList){
+    //            if(asl.Id == proStr){
+    //                return '浜у搧宸插彂璐э紝涓嶈兘鐢宠澶囧搧';
+    //            }
+    //        }
+    //    }
+    //    }
+        
+    
+    //    Statu_Achievements__c Sac = [select id,
+    //        SalesChannel__c,
+    //        Status_1__c,
+    //        Status_2_Formula__c,
+    //        Opp_Number__c,
+    //        CreatedDate,
+    //        FirstApproveDate__c,
+    //        Opportunity__r.Sales_Root__c,
+    //        X30_Deposit_Day__c,
+    //        Deposit_In_Full_Day__c,
+    //        DeliveryDate__c
+    //    from Statu_Achievements__c where id = :SaID];
+        
+        
+        
+    //    if(Sac.Opportunity__r.Sales_Root__c == '璨╁2搴�'){
+    //        if(Sac.Opp_Number__c.contains('GI')||Sac.Opp_Number__c.contains('BF')||Sac.Opp_Number__c.contains('ET') ){
+    //            if(Sac.Status_1__c == '娉ㄦ畫' && (Sac.Status_2_Formula__c == '12 宸茶璐с兓浠樺叏娆�'||Sac.Status_2_Formula__c == '13 寰呭彂璐�')){
+    //                if((Date.today().addDays(-30)>Sac.Deposit_In_Full_Day__c)&&Sac.DeliveryDate__c == null){
+    //                    return 'Fin';
+    //                }else{
+    //                    return '缁忛攢鍟嗗唴绉戣鍗曚笉鍦ㄧ敵璇锋湡鍐咃紝涓嶈兘鐢宠澶囧搧';
+    //                }
+    //            }else{
+    //                return '缁忛攢鍟嗗唴绉戣鍗曠姸鎬佷笉绗﹀悎澶囧搧鐢宠璧勬牸锛屼笉鑳界敵璇峰鍝�';
+    //            }
+    //        }else if(Sac.Opp_Number__c.contains('SP')){
+    //            if(Sac.Status_1__c == '娉ㄦ畫' && (Sac.Status_2_Formula__c == '11 宸茶璐с兓浠樿閲�'||Sac.Status_2_Formula__c == '12 宸茶璐с兓浠樺叏娆�'||Sac.Status_2_Formula__c == '13 寰呭彂璐�')){
+    //                if((Date.today().addDays(-60)>Sac.X30_Deposit_Day__c )&&Sac.DeliveryDate__c == null){
+    //                    return 'Fin';
+    //                }else{
+    //                    return '缁忛攢鍟哠P璁㈠崟涓嶅湪鐢宠鏈熷唴锛屼笉鑳界敵璇峰鍝�';
+    //                }
+    //            }else{
+    //                return '缁忛攢鍟哠P璁㈠崟鐘舵�佷笉绗﹀悎澶囧搧鐢宠璧勬牸锛屼笉鑳界敵璇峰鍝�';
+    //            }
+    //        }else{
+    //            return 'Denied';
+    //        }
+    //    }else if(Sac.Opportunity__r.Sales_Root__c == 'OCM鐩存帴璨╁2'){
+    //        if(Sac.Opp_Number__c.contains('GI')||Sac.Opp_Number__c.contains('BF')||Sac.Opp_Number__c.contains('ET')){
+    //            if(Sac.Status_1__c == '娉ㄦ畫' && (Sac.Status_2_Formula__c == '09 宸插綍鍏ヨ鍗曟湭浠樻'||Sac.Status_2_Formula__c == '10 搴撳瓨宸查鐣欍兓鏈粯娆�'||Sac.Status_2_Formula__c == '11 宸茶璐с兓浠樿閲�'||Sac.Status_2_Formula__c == '12 宸茶璐с兓浠樺叏娆�'||Sac.Status_2_Formula__c == '13 寰呭彂璐�')){
+    //                if((Date.today().addDays(-30)>Sac.FirstApproveDate__c )&&Sac.DeliveryDate__c == null){
+    //                    return 'Fin';
+    //                }else{
+    //                    return 'OCM鐩撮攢鍐呯涓嶅湪鐢宠鏈熷唴锛屼笉鑳界敵璇峰鍝�';
+    //                }
+    //            }else{
+    //                 return 'OCM鐩撮攢鍐呯璁㈠崟鐘舵�佷笉绗﹀悎澶囧搧鐢宠璧勬牸锛屼笉鑳界敵璇峰鍝�';
+    //            }
+    //        }else if(Sac.Opp_Number__c.contains('SP')){
+    //            if(Sac.Status_1__c == '娉ㄦ畫' && (Sac.Status_2_Formula__c == '09 宸插綍鍏ヨ鍗曟湭浠樻'||Sac.Status_2_Formula__c == '10 搴撳瓨宸查鐣欍兓鏈粯娆�'||Sac.Status_2_Formula__c == '11 宸茶璐с兓浠樿閲�'||Sac.Status_2_Formula__c == '12 宸茶璐с兓浠樺叏娆�'||Sac.Status_2_Formula__c == '13 寰呭彂璐�')){
+    //                if((Date.today().addDays(-60)>Sac.FirstApproveDate__c )&&Sac.DeliveryDate__c == null){
+    //                    return 'Fin';
+    //                }else{
+    //                    return '鐩撮攢SP璁㈠崟涓嶅湪鐢宠鏈熷唴锛屼笉鑳界敵璇峰鍝�';
+    //                }
+    //            }else{
+    //                 return 'OCM鐩撮攢SP璁㈠崟鐘舵�佷笉绗﹀悎澶囧搧鐢宠璧勬牸锛屼笉鑳界敵璇峰鍝�';
+    //            }
+    //        }else{
+    //            return 'Fin';
+    //        }
+    //    }else{
+    //        return '閿�鍞笭閬撴湭鐭ワ紝涓嶈兘鏂板缓';
+    //    }
+    //}
+
+// bp2
+    ///**
+    //澶囧搧鏄惁鍙互缁х画鎿嶄綔鐨勭鎺�
+    //*/
+    //public static String rentalContiuneCheck(List<Rental_Apply__c> newList,Map<Id, Rental_Apply__c> oldMap){
+    //    List<String> RaidList = new List<String>();
+    //    for(Rental_Apply__c ra : newList){
+    //        RaidList.add(ra.id);
+    //    }
+    //    List<Rental_Apply__c> RaTarList = [select Campaign__c,Repair__c,
+    //                                            Campaign__r.Status,Repair__r.Repair_Final_Inspection_Date__c,Repair__r.Repair_Shipped_Date__c
+    //                                        from Rental_Apply__c 
+    //                                        where id=:RaidList];
+    //    for(Rental_Apply__c RaTar : RaTarList){
+    //    String RsStr = '';
+    //        if( RaTar.Campaign__r.Status == '鍙栨秷'||
+    //                RaTar.Campaign__r.Status == '鍙栨秷鐢宠涓�'||
+    //                    RaTar.Campaign__r.Status == '宸叉彁浜ゆ姤鍛�'||
+    //                        RaTar.Campaign__r.Status == '宸茬粨鏉�'){
+    //            RsStr = RentalApplyWebService.rentalContiuneinfoCheck(newList,oldMap);
+    //            if(RsStr == 'Denied'){
+    //                return '瀛︿細宸茬粨鏉燂紝鐢宠鍗曚笉鑳界户缁搷浣滀簡';
+    //            }else{
+    //                return 'Fin';
+    //            }
+                
+    //        }else if(   RaTar.Repair__r.Repair_Final_Inspection_Date__c!=null){
+    //            RsStr = RentalApplyWebService.rentalContiuneinfoCheck(newList,oldMap);
+    //            if(RsStr == 'Denied'){
+    //                return '瀛樺湪淇悊鏈�缁堟娴嬫棩锛岀敵璇峰崟涓嶈兘缁х画浜�';
+    //            }else{
+    //                return 'Fin';
+    //            }
+    //        }else if(   RaTar.Repair__r.Repair_Shipped_Date__c!=null){
+    //            RsStr = RentalApplyWebService.rentalContiuneinfoCheck(newList,oldMap);
+    //            if(RsStr == 'Denied'){
+    //                return '瀛樺湪RC淇悊杩旈�佹棩锛岀敵璇峰崟涓嶈兘缁х画浜�';
+    //            }else{
+    //                return 'Fin';
+    //            }
+    //        }else{
+    //            return 'Fin';
+    //        }
+    //    }
+    //    return 'Fin';
+    //}
+//bp2
+//    public static String rentalContiuneinfoCheck(List<Rental_Apply__c> newList,Map<Id, Rental_Apply__c> oldMap){
+//        for(Rental_Apply__c Rac : newList){
+//        if(
+//    //bp2  Trigger.oldMap.get(Rac.Id).get('HP_received_ng_num__c') != Rac.HP_received_ng_num__c ||
+//            Trigger.oldMap.get(Rac.Id).get('StockDown_ng_num__c') != Rac.StockDown_ng_num__c ||
+//             Trigger.oldMap.get(Rac.Id).get('Asset_return_time__c') != Rac.Asset_return_time__c ||
+//              Trigger.oldMap.get(Rac.Id).get('Count_Extend__c') != Rac.Count_Extend__c ||
+//                Trigger.oldMap.get(Rac.Id).get('Max_Extend_workday__c') != Rac.Max_Extend_workday__c ||
+//    //bp2        Trigger.oldMap.get(Rac.Id).get('Lost_item_ng_num__c') != Rac.Lost_item_ng_num__c ||
+//                  Trigger.oldMap.get(Rac.Id).get('Lost_item_finish__c') != Rac.Lost_item_finish__c ||
+//                   Trigger.oldMap.get(Rac.Id).get('Last_Assigned_Date__c') != Rac.Last_Assigned_Date__c ||
+//                    Trigger.oldMap.get(Rac.Id).get('Return_dadeline_final__c') != Rac.Return_dadeline_final__c ||
+//                     Trigger.oldMap.get(Rac.Id).get('Rental_Apply_Equipment_Set_Cnt__c') != Rac.Rental_Apply_Equipment_Set_Cnt__c ||
+//                      Trigger.oldMap.get(Rac.Id).get('Pre_inspection_ng_num__c') != Rac.Pre_inspection_ng_num__c ||
+//                       Trigger.oldMap.get(Rac.Id).get('Shippment_ng_num__c') != Rac.Shippment_ng_num__c ||
+//                        Trigger.oldMap.get(Rac.Id).get('ShelfUp_ng_num__c') != Rac.ShelfUp_ng_num__c ||
+//                         Trigger.oldMap.get(Rac.Id).get('Loaner_received_ng_num__c') != Rac.Loaner_received_ng_num__c ||
+//                          Trigger.oldMap.get(Rac.Id).get('Arrival_wh_cnt__c') != Rac.Arrival_wh_cnt__c ||
+//                           Trigger.oldMap.get(Rac.Id).get('Shippment_loaner_cnt__c') != Rac.Shippment_loaner_cnt__c ||
+//                            Trigger.oldMap.get(Rac.Id).get('Shipment_requested_cnt__c') != Rac.Shipment_requested_cnt__c ||
+//                             Trigger.oldMap.get(Rac.Id).get('Pre_inspection_ng_cnt2__c') != Rac.Pre_inspection_ng_cnt2__c ||
+//                              Trigger.oldMap.get(Rac.Id).get('Pre_inspection_ng_cnt__c') != Rac.Pre_inspection_ng_cnt__c ||
+//                               Trigger.oldMap.get(Rac.Id).get('Shippment_loaner_time__c') != Rac.Shippment_loaner_time__c ||
+//                                Trigger.oldMap.get(Rac.Id).get('Asset_loaner_closed_date__c') != Rac.Asset_loaner_closed_date__c ||
+//                                 Trigger.oldMap.get(Rac.Id).get('Asset_loaner_start_date__c') != Rac.Asset_loaner_start_date__c ||
+//                                  Trigger.oldMap.get(Rac.Id).get('Disposal_num__c') != Rac.Disposal_num__c ||
+//                                   Trigger.oldMap.get(Rac.Id).get('Asset_return_ng_num__c') != Rac.Asset_return_ng_num__c ||
+//                                    Trigger.oldMap.get(Rac.Id).get('Received_Confirm_NG_amount__c') != Rac.Received_Confirm_NG_amount__c ||
+//                                     Trigger.oldMap.get(Rac.Id).get('Received_Confirm_NG_Not_Return__c') != Rac.Received_Confirm_NG_Not_Return__c ||
+////bp2                                 Trigger.oldMap.get(Rac.Id).get('Loaner_received_time__c') != Rac.Loaner_received_time__c ||
+//                                       Trigger.oldMap.get(Rac.Id).get('Return_Track_Company__c') != Rac.Return_Track_Company__c ||
+//                                        Trigger.oldMap.get(Rac.Id).get('Return_Distrubutor_Method__c') != Rac.Return_Distrubutor_Method__c ||
+//                                         Trigger.oldMap.get(Rac.Id).get('Return_Trake_Staff__c') != Rac.Return_Trake_Staff__c ||
+//                                          Trigger.oldMap.get(Rac.Id).get('Return_Track_Number__c') != Rac.Return_Track_Number__c ||
+//                                          Trigger.oldMap.get(Rac.Id).get('HP_received_sign_day__c') != Rac.HP_received_sign_day__c ||
+//                                         Trigger.oldMap.get(Rac.Id).get('HP_received_sign_rich__c') != Rac.HP_received_sign_rich__c ||
+//                                        Trigger.oldMap.get(Rac.Id).get('HP_received_sign_text__c') != Rac.HP_received_sign_text__c ||
+//                                       Trigger.oldMap.get(Rac.Id).get('HP_received_sign_NG__c') != Rac.HP_received_sign_NG__c ||
+//                                      Trigger.oldMap.get(Rac.Id).get('HP_received_sign_NG_Reason__c') != Rac.HP_received_sign_NG_Reason__c ||
+//                                     Trigger.oldMap.get(Rac.Id).get('AssetManageConfirm__c') != Rac.AssetManageConfirm__c ||
+//                                    Trigger.oldMap.get(Rac.Id).get('Loaner_cancel_request__c') != Rac.Loaner_cancel_request__c ||
+//                                   Trigger.oldMap.get(Rac.Id).get('Status__c') != Rac.Status__c 
+//        ){
+//        return 'Fin';
+//    }
+//}   
+//    return 'Denied';
+//    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/RentalApplyWebService.cls-meta.xml b/force-app/main/default/classes/RentalApplyWebService.cls-meta.xml
new file mode 100644
index 0000000..94f6f06
--- /dev/null
+++ b/force-app/main/default/classes/RentalApplyWebService.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>40.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/ReportController.cls b/force-app/main/default/classes/ReportController.cls
index aea48b6..790ccbc 100644
--- a/force-app/main/default/classes/ReportController.cls
+++ b/force-app/main/default/classes/ReportController.cls
@@ -218,7 +218,7 @@
 
     //缁欐彁浜ょ浉搴旂殑js鎻愪緵鍒濆鍖栨暟鎹�
     @AuraEnabled
-    public static void updateForSubmitButton(String reocrdId){
+    public static String updateForSubmitButton(String reocrdId){
         try {
             Report__c rac = new Report__c();
             rac.Id = reocrdId;
@@ -226,26 +226,34 @@
             rac.Submit_time__c = Datetime.now();
             rac.Submit_report_day__c = Date.today();
             update rac;
+            return null;
         } catch (Exception e) {
-            throw new AuraHandledException(e.getMessage());
+            String eMessage = e.getMessage();
+            Integer left = eMessage.indexOf(',') + 1;
+            Integer right = eMessage.length();
+            return eMessage.substring(left,right);
         }
     }
     //OPDtoSIS鎿嶄綔鏇存柊鐩稿簲鏁版嵁
     @AuraEnabled
-    public static void updateForOPDtoSISButton(String recordId){
+    public static String updateForOPDtoSISButton(String recordId){
         try {
             Report__c rac = new Report__c();
             rac.Id = recordId;
             rac.RecordTypeId = Schema.SObjectType.Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_BY_OPD).getRecordTypeId();
             update rac;
+            return null;
         } catch (Exception e) {
-            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+            String eMessage = e.getMessage();
+            Integer left = eMessage.indexOf(',') + 1;
+            Integer right = eMessage.length();
+            return eMessage.substring(left,right);
         }
     }
 
     //鍙栨秷鎻愪氦鎿嶄綔鏇存柊鐩稿簲鏁版嵁
     @AuraEnabled
-    public static void updateForCancelSubmitReportButton(String recordId){
+    public static String updateForCancelSubmitReportButton(String recordId){
         try {
             Report__c rac = new Report__c();
             rac.Id = recordId;
@@ -253,33 +261,45 @@
             rac.Submit_report_day__c = null;
             rac.Submit_time__c = null;
             update rac;
+            return null;
         } catch (Exception e) {
-            throw new AuraHandledException(e.getMessage());
+            String eMessage = e.getMessage();
+            Integer left = eMessage.indexOf(',') + 1;
+            Integer right = eMessage.length();
+            return eMessage.substring(left,right);
         }
     }
     //瀹屾瘯鎿嶄綔鏇存柊鐩稿簲鏁版嵁
     @AuraEnabled
-    public static void updateForCompleteButton(String recordId){
+    public static String updateForCompleteButton(String recordId){
         Report__c rac = new Report__c();
         try {
             rac.Id = recordId;
             rac.Status__c = LightingButtonConstant.STATUS_COMPLETE;
             rac.RecordTypeId = Schema.SObjectType.Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.VOC_NAME).getRecordTypeId();
             update rac;
+            return null;
         } catch (Exception e) {
-            throw new AuraHandledException(e.getMessage());
+            String eMessage = e.getMessage();
+            Integer left = eMessage.indexOf(',') + 1;
+            Integer right = eMessage.length();
+            return eMessage.substring(left,right);
         }
     }
     //OCSM瑕佹姤鍛婃搷浣滄洿鏂扮浉搴旀暟鎹�
     @AuraEnabled
-    public static void updateForOCSMToReportButton(String recordId){
+    public static String updateForOCSMToReportButton(String recordId){
         try {
             Report__c rac = new Report__c();
             rac.Id = recordId;
             rac.OCSMAdministrativeReportStatus__c = LightingButtonConstant.STATUS_TO_BE_REPORTED;
             update rac;
+            return null;
         } catch (Exception e) {
-            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+            String eMessage = e.getMessage();
+            Integer left = eMessage.indexOf(',') + 1;
+            Integer right = eMessage.length();
+            return eMessage.substring(left,right);
         }
     }
 
@@ -293,50 +313,65 @@
             update rac;
             return null;
         } catch (Exception e) {
-            return e.getMessage();
+            String eMessage = e.getMessage();
+            Integer left = eMessage.indexOf(',') + 1;
+            Integer right = eMessage.length();
+            return eMessage.substring(left,right);
         }
     }
     //DispatchOCSMQARA鎿嶄綔鏇存柊鐩稿簲鏁版嵁
     @AuraEnabled
-    public static void updateForDispatchOCSMQARAButton(String recordId){
+    public static String updateForDispatchOCSMQARAButton(String recordId){
         try {
             Report__c rac = new Report__c();
             rac.Id = recordId;
             rac.Dispatch_OCSM_QARA__c = true;
             update rac;
+            return null;
         } catch (Exception e) {
-            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+            String eMessage = e.getMessage();
+            Integer left = eMessage.indexOf(',');
+            Integer right = eMessage.length();
+            return eMessage.substring(left,right);
         }
     }
     //OCSM涓嶈鎶ュ憡鎿嶄綔鏇存柊鐩稿簲鏁版嵁
     @AuraEnabled
-    public static void updateForOCSMNoToReportButton(String recordId){
+    public static String updateForOCSMNoToReportButton(String recordId){
         try {
             Report__c rac = new Report__c();
             rac.Id = recordId;
             rac.OCSMAdministrativeReportStatus__c  = LightingButtonConstant.STATUS_TO_NOT_REPORT;
             update rac;
+            return null;
         } catch (Exception e) {
-            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+            String eMessage = e.getMessage();
+            Integer left = eMessage.indexOf(',');
+            Integer right = eMessage.length();
+            return eMessage.substring(left,right); 
         }
     }
 
     //鍙栨秷鎿嶄綔鏇存柊鐩稿簲鏁版嵁
     @AuraEnabled
-    public static void updateForCancelButton(String recordId){
+    public static String updateForCancelButton(String recordId){
         try {
             Report__c rac = new Report__c();
             rac.Id = recordId;
             rac.Status__c = LightingButtonConstant.STATUS_CANCEL;
             update rac;
+            return null;
         } catch (Exception e) {
-            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+            String eMessage = e.getMessage();
+            Integer left = eMessage.indexOf(',');
+            Integer right = eMessage.length();
+            return eMessage.substring(left,right);
         }
     }
     
     //VOC缁撴灉纭鏇存柊鐩稿簲鏁版嵁
     @AuraEnabled
-    public static void updateForVOCConfirmButton(String recordId,String Satisfy,String Satisfy1){
+    public static String updateForVOCConfirmButton(String recordId,String Satisfy,String Satisfy1){
         try {
             Report__c rac = new Report__c();
             rac.Id = recordId;
@@ -362,8 +397,12 @@
                 }
                 }
             update rac;
+            return null;
         } catch (Exception e) {
-            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+            String eMessage = e.getMessage();
+            Integer left = eMessage.indexOf(',');
+            Integer right = eMessage.length();
+            return eMessage.substring(left,right);
         }
     }
     //VOC鍥炵瓟鏇存柊鐩稿簲鏁版嵁
@@ -388,7 +427,7 @@
 
     //鎻愪氦绔炰簤瀵规墜鎶ュ憡鏇存柊鐩稿簲鏁版嵁
     @AuraEnabled
-    public static void updateForSubmitCompetitorReportButton(String recordId){
+    public static String updateForSubmitCompetitorReportButton(String recordId){
         try {
             Report__c rac = new Report__c();
             rac.Id = recordId;
@@ -397,13 +436,17 @@
             rac.Submit_report_day__c = Date.today();
             rac.Date__c = Date.today();
             update rac;
+            return null;
         } catch (Exception e) {
-            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+            String eMessage = e.getMessage();
+            Integer left = eMessage.indexOf(',');
+            Integer right = eMessage.length();
+            return eMessage.substring(left,right);
         }
     }
     //VOC鍥炵瓟鏇存柊鐩稿簲鏁版嵁
     @AuraEnabled
-    public static void updateForVOCSubmitButton(String recordId ,String createdById){
+    public static String updateForVOCSubmitButton(String recordId ,String createdById){
         try {
             Report__c rac = [select Status__c,JingliApprovalManager__r.Id,BuchangApprovalManager__r.Id,SalesManager__r.Id,BuchangApprovalManagerSales__r.Id,ZongjianApprovalManager__c,Submit_time__c,Submit_report_day__c,Owner.Id from Report__c where Id = :recordId];
             // share
@@ -424,15 +467,18 @@
             userAccess.add(rac.ZongjianApprovalManager__c + LightingButtonConstant.USER_ACCESS_READ);
             String rtn = ControllerUtil.setSObjectShare(LightingButtonConstant.SOBJECT_NAME_OF_REPORT_SHARE,LightingButtonConstant.SOBJECT_NAME_OF_VOC_SHARE,recordId,userAccess,rac.Owner.Id);
             if (rtn != LightingButtonConstant.OK) {
-            return;
+            return null;
             }
             rac.Status__c = LightingButtonConstant.STATUS_VOC_WRITE_OVER;
             rac.Submit_time__c = Date.today();
             rac.Submit_report_day__c = Date.today();
             update rac;
+            return null;
         } catch (Exception e) {
-            System.debug(LoggingLevel.INFO, '*** e: ' + e);
-            
+            String eMessage = e.getMessage();
+            Integer left = eMessage.indexOf(',');
+            Integer right = eMessage.length();
+            return eMessage.substring(left, right);
         }
     }
     //VOC鍒ゅ畾鏇存柊鐩稿簲鏁版嵁
@@ -480,13 +526,17 @@
     }
     //VOC瀹屾瘯鎿嶄綔鏇存柊鐩稿簲鏁版嵁
     @AuraEnabled
-    public static void updateForVOCFinishButton (String recordId) {
+    public static String updateForVOCFinishButton (String recordId) {
         try {
             Report__c report = [select Id,Status__C from Report__c where Id = :recordId];
             report.Status__c = LightingButtonConstant.STATUS_VOC_FINISH;
             update report;
+            return null;
         } catch (Exception e) {
-            System.debug(LoggingLevel.INFO, '*** e: ' + e);
+            String eMessage = e.getMessage();
+            Integer left = eMessage.indexOf(',');
+            Integer right = eMessage.length();
+            return eMessage.substring(left,right);
         }
     }
     public class InitData{
diff --git a/force-app/main/default/classes/ReturnDeliverySlipController.cls b/force-app/main/default/classes/ReturnDeliverySlipController.cls
new file mode 100644
index 0000000..0a97ed6
--- /dev/null
+++ b/force-app/main/default/classes/ReturnDeliverySlipController.cls
@@ -0,0 +1,37 @@
+public with sharing class ReturnDeliverySlipController {
+    public ReturnDeliverySlipController() {
+        
+    }
+
+    @AuraEnabled
+    public static InitData init(String recordId){
+        InitData res = new InitData();
+        try {     
+            Rental_Apply__c ra = [SELECT Id, Name, Rental_Apply_Equipment_Set_Cnt__c, Loaner_received_ng_num__c from Rental_Apply__c where Id = :recordId];
+            res.raeSet = null;
+            if(ra.Rental_Apply_Equipment_Set_Cnt__c > 0){
+                List<Rental_Apply_Equipment_Set_Detail__c> raSet = [SELECT Id, Name from Rental_Apply_Equipment_Set_Detail__c WHERE Received_Confirm_F__c = 'NG' AND Cancel_Select__c = false AND Rental_Apply__c = :recordId];
+                res.raeSet = raSet;
+                system.debug('raeSet===='+res.raeSet);
+            }
+            res.Name = ra.Name;
+            res.RentalApplyEquipmentSetCnt = Integer.valueOf(ra.Rental_Apply_Equipment_Set_Cnt__c);
+            res.LoanerReceivedNgNum = Integer.valueOf(ra.Loaner_received_ng_num__c);   
+        }
+        catch (Exception e) {
+            system.debug('INFO****' + e);
+        }
+        return res;
+    }
+
+    public class InitData{
+        @AuraEnabled
+        public Integer RentalApplyEquipmentSetCnt;
+        @AuraEnabled
+        public Integer LoanerReceivedNgNum;
+        @AuraEnabled
+        public String Name;
+        @AuraEnabled
+        public List<Rental_Apply_Equipment_Set_Detail__c> raeSet;
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/ReturnDeliverySlipController.cls-meta.xml b/force-app/main/default/classes/ReturnDeliverySlipController.cls-meta.xml
new file mode 100644
index 0000000..9662499
--- /dev/null
+++ b/force-app/main/default/classes/ReturnDeliverySlipController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>50.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
\ No newline at end of file
diff --git a/force-app/main/default/classes/SelectSubstituteControllerLWT.cls b/force-app/main/default/classes/SelectSubstituteControllerLWT.cls
new file mode 100644
index 0000000..e184b48
--- /dev/null
+++ b/force-app/main/default/classes/SelectSubstituteControllerLWT.cls
@@ -0,0 +1,633 @@
+public with sharing class SelectSubstituteControllerLWT {
+    public SelectSubstituteControllerLWT() {
+
+    }
+    @AuraEnabled
+    public static InitData initFromSelectSubstituteButton(String recordId){
+        InitData res = new InitData();
+        try{
+            Rental_Apply_Equipment_Set__c report=[select
+                    Id,Rental_Apply__r.Status__c,Rental_Apply__r.Id
+            from Rental_Apply_Equipment_Set__c
+            where Id= :recordId];
+            res.id=report.Id;
+            res.RentalApplyId=report.Rental_Apply__r.Id;
+            res.Status=report.Rental_Apply__r.Status__c;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e);
+        }
+        return res;
+    }
+
+    @AuraEnabled
+    public static Rental_Apply_Equipment_Set__c initFromCustomSubmitButton(String recordId){
+
+        try{
+            Rental_Apply_Equipment_Set__c report=[select
+                    Id,Request_extend_day__c
+                    ,Extend_request_reason__c
+                    ,Rental_End_Date__c,
+                    Rental_Apply__c
+            from Rental_Apply_Equipment_Set__c
+            where Id= :recordId];
+
+            return report;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+
+    @AuraEnabled
+    public static InitData initFromLoanerArrangedEmailLButton(String recordId){
+        InitData res = new InitData();
+        try{
+            Rental_Apply_Equipment_Set__c report=[select
+                    Id,Rental_Apply__r.Status__c,Rental_Apply__c,Rental_Apply__r.Wei_Assigned_Cnt__c,
+                    Assigned_Not_Shipment__c,Rental_Apply__r.Bollow_Date__c
+            from Rental_Apply_Equipment_Set__c
+            where Id= :recordId];
+            res.id=report.Id;
+            res.RentalApplyC=report.Rental_Apply__c;
+            res.Status=report.Rental_Apply__r.Status__c;
+            res.WeiAssignedCntC=report.Rental_Apply__r.Wei_Assigned_Cnt__c;
+            res.BollowDateC=report.Rental_Apply__r.Bollow_Date__c;
+            res.AssignedNotShipmentC=report.Assigned_Not_Shipment__c;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e);
+        }
+        return res;
+    }
+
+    @AuraEnabled
+    public static InitData initClearReturnDeliverySlipButton(String recordId){
+        InitData res = new InitData();
+        try{
+            Rental_Apply_Equipment_Set__c report=[select
+                    Id,Rental_Apply__r.Status__c,Rental_Apply__c,Rental_Apply__r.Wei_Assigned_Cnt__c,
+                    Assigned_Not_Shipment__c,Rental_Apply__r.Bollow_Date__c
+            from Rental_Apply_Equipment_Set__c
+            where Id= :recordId];
+            res.id=report.Id;
+            res.RentalApplyC=report.Rental_Apply__c;
+            res.Status=report.Rental_Apply__r.Status__c;
+            res.WeiAssignedCntC=report.Rental_Apply__r.Wei_Assigned_Cnt__c;
+            res.BollowDateC=report.Rental_Apply__r.Bollow_Date__c;
+            res.AssignedNotShipmentC=report.Assigned_Not_Shipment__c;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e);
+        }
+        return res;
+    }
+
+    @AuraEnabled
+    public static Rental_Apply_Equipment_Set__c selectRentalApplyEquipmentSetByID(String recordId){
+        try{
+            Rental_Apply_Equipment_Set__c report=[select
+                    Cancel_Select__c,Irreplaceable_flag__c,RAES_Status__c,Shippment_loaner_time2__c
+            from Rental_Apply_Equipment_Set__c
+            where Id=:recordId];
+            return report;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+
+    @AuraEnabled
+    public static list<Rental_Apply_Equipment_Set_Detail__c> selectRentalApplyEquipmentSetByRACID(String recordId){
+        try{
+            list<Rental_Apply_Equipment_Set_Detail__c> report=[select Allow_Adjust_Queue_Flag__c
+            from Rental_Apply_Equipment_Set_Detail__c
+            where Rental_Apply__c = :recordId ];
+            return report;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+
+
+    @AuraEnabled
+    public static list<Rental_Apply__c> selectRentalApplyCByName(String recordId){
+        try{
+            list<Rental_Apply__c> report=[select
+                    Id,Campaign__c,Repair__c,Status__c, Demo_purpose1__c,Contract_pdf_updated__c,Repair_Final_Inspection_Date_F__c,RC_return_to_office__c
+            from Rental_Apply__c
+            where id=:recordId ];
+            return report;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+    @AuraEnabled
+    public static list<Campaign> selectCampaignById(String recordId){
+        try{
+            list<Campaign> report=[select
+                    Status, Rental_Apply_Flag__c,IF_Approved__c,Meeting_Approved_No__c,Approved_Status__c
+            from Campaign
+            where id =:recordId ];
+            return report;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+    @AuraEnabled
+    public static String getSessionId(){
+        return UserInfo.getSessionId();
+    }
+
+
+    @AuraEnabled
+    public static list<Rental_Apply_Equipment_Set__c> selectRaesById1(String recordId){
+        try{
+            list<Rental_Apply_Equipment_Set__c> report=[select Id
+            from Rental_Apply_Equipment_Set__c
+            where Rental_Apply__c = :recordId
+            and Shippment_loaner_time2__c != null
+            and RAES_Status__c != '宸插垎閰�'
+            and RAES_Status__c != '鍙栨秷鍒嗛厤'
+            ];
+            return report;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+    @AuraEnabled
+    public static list<Rental_Apply_Equipment_Set__c> selectRaesById2(String recordId){
+        try{
+            list<Rental_Apply_Equipment_Set__c> report=[select Id
+            from Rental_Apply_Equipment_Set__c
+            where Rental_Apply__c = :recordId
+            and RAES_Status__c != '宸插垎閰�'
+            and RAES_Status__c != '鍙栨秷鍒嗛厤'
+            ];
+            return report;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+
+    @AuraEnabled
+    public static list<Rental_Apply__c> selectRacById(String recordId){
+        try{
+            list<Rental_Apply__c> report=[SELECT
+                    Id, JingliApprovalManager__c, SalesManager__c
+                    , BuchangApprovalManager__c
+                    , BuchangApprovalManagerSales__c
+                    , ZongjianApprovalManager__c
+            FROM Rental_Apply__c
+            WHERE Id = :recordId
+            ];
+            return report;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+
+    @AuraEnabled
+    public static UpdateResult updateRaesc(
+            String recordId,
+            String JingliApprovalManagerc,
+            String SalesManagerc,
+            String BuchangApprovalManagerc,
+            String BuchangApprovalManagerSalesc,
+            String ZongjianApprovalManagerc,
+            String ExtendStatusc
+    ) {
+        UpdateResult result = new UpdateResult();
+        result.recordId = recordId;
+        try{
+            // 鏇存柊璁板綍骞惰幏鍙栫粨鏋�
+            if(recordId==null) return null;
+            Rental_Apply_Equipment_Set__c rac = new Rental_Apply_Equipment_Set__c( id=recordId);
+
+            if(JingliApprovalManagerc!=null&& JingliApprovalManagerc != ''){
+                rac.JingliApprovalManager__c=JingliApprovalManagerc;
+            }
+            if(SalesManagerc!=null&&SalesManagerc!=''){
+                rac.SalesManager__c=SalesManagerc;
+            }
+            if(BuchangApprovalManagerc!=null&&BuchangApprovalManagerc!=''){
+                rac.BuchangApprovalManager__c=BuchangApprovalManagerc;
+            }
+            if(BuchangApprovalManagerSalesc!=null&&BuchangApprovalManagerSalesc!=''){
+                rac.BuchangApprovalManagerSales__c=BuchangApprovalManagerSalesc;
+            }
+
+            if(ZongjianApprovalManagerc!=null&&ZongjianApprovalManagerc!=''){
+                rac.ZongjianApprovalManager__c=ZongjianApprovalManagerc;
+            }
+            if(ExtendStatusc!=null&&ExtendStatusc!=''){
+                rac.Extend_Status__c=ExtendStatusc;
+            }
+            if(rac.id==null)return null;
+            update rac;
+            result.success = true;
+            result.errors = new List<String>();
+            return result;
+        }catch(Exception e){
+            result.success = false;
+            result.errors = new List<String>();
+            result.errors.add(e.getMessage());
+            System.debug(LoggingLevel.INFO,'Rental_Apply__c update Error : ' + e);
+        }
+        return result;
+    }
+
+    @AuraEnabled
+    public static UpdateResult updateRaescList(
+            list<Rental_Apply_Equipment_Set_Detail__c> updateList
+    ) {
+        UpdateResult result = new UpdateResult();
+        try{
+            for(Rental_Apply_Equipment_Set_Detail__c item : updateList) {
+                item.Return_DeliverySlip__c = null;
+                item.Asset_return_time__c = null;
+            }
+            update updateList;
+            result.success = true;
+            result.errors = new List<String>();
+            return result;
+        }catch(Exception e){
+            result.success = false;
+            result.errors = new List<String>();
+            result.errors.add(e.getMessage());
+            System.debug(LoggingLevel.INFO,'Rental_Apply__c update Error : ' + e);
+        }
+        return result;
+    }
+
+    @AuraEnabled
+    public static list<Rental_Apply_Equipment_Set_Detail__c> selectRaesdcId(String recordId){
+        try{
+            list<Rental_Apply_Equipment_Set_Detail__c> report=[Select
+                    Id
+            From Rental_Apply_Equipment_Set_Detail__c
+            Where Return_DeliverySlip__c != null
+            AND Check_lost_Item_F__c = null
+            AND Rental_Apply_Equipment_Set__c = :recordId AND Cancel_Select__c = false
+            ];
+            return report;
+        }catch(Exception e){
+            System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e);
+        }
+        return null;
+    }
+
+    @AuraEnabled
+    public static String approvalCheck(String rentalApplyId) {
+        // check缁撴灉
+        String returnStr = '';
+
+        //1388 yc 20211021 璺ㄥ尯鍩熷垎閰嶄笉鑳藉嚭搴�  start
+        String rasdid = '';
+        system.debug(rentalApplyId+'==');
+        if(String.isNotBlank(rentalApplyId) && rentalApplyId.indexOf(';') >= 0){//璇存槑鏄粠涓�瑙堜笂瑙﹀彂鐨�
+            rasdid = rentalApplyId.subString(rentalApplyId.indexOf(';') + 1);
+            rentalApplyId = rentalApplyId.subString(0, rentalApplyId.indexOf(';'));
+        }
+        //1388 yc 20211021 璺ㄥ尯鍩熷垎閰嶄笉鑳藉嚭搴�  end
+        //澶囧搧鍊熷嚭鐢宠
+        Rental_Apply__c[] rentalApply = [select Id,repair__r.Repair_Final_Inspection_Date__c,Bollow_Date__c,repair__r.Return_Without_Repair_Date__c,
+                CreatedDate,Rental_Apply_Equipment_Set_Cnt__c,Prepare_Day__c,Cross_Region_Assign__c,
+                demo_purpose2__c,Follow_UP_Opp__r.Shipping_Finished_Day_Func__c,next_action__c,QIS_number__r.ReplaceDeliveryDate__c
+        from Rental_Apply__c
+        where Id = :rentalApplyId];
+        if (rentalApply.size() == 0) {
+            returnStr = '娌℃湁澶囧搧鍊熷嚭鐢宠锛岃纭銆�';
+            return returnStr;
+        }
+        Rental_Apply__c ra = rentalApply[0];
+        if (ra.Rental_Apply_Equipment_Set_Cnt__c <= 0) {
+            returnStr = '娌℃湁鍊熷嚭澶囧搧set涓�瑙堬紝璇风‘璁ゃ��';
+            return returnStr;
+        }
+        //1822 yc 20211111 start
+        if(ra.demo_purpose2__c=='宸茶喘寰呰揣' && ra.Follow_UP_Opp__r.Shipping_Finished_Day_Func__c!= null){
+            returnStr = '宸茶喘寰呰揣鐩殑锛屾柊鍝佸凡鏈夊彂璐ф棩锛屼笉鍙嚭搴撴寚绀�';
+            return returnStr;
+        }
+        if(ra.demo_purpose2__c=='绱㈣禂QIS' && ra.next_action__c=='鏃犲伩鏇存崲' && ra.QIS_number__r.ReplaceDeliveryDate__c!= null){
+            returnStr = '绱㈣禂QIS鐩殑锛孮IS宸叉湁鏂板搧鍙戣揣鏃ワ紝涓嶅彲鍑哄簱鎸囩ず';
+            return returnStr;
+        }
+        //1822 yc 20211111 end
+
+//*************************Insert 20160826 SWAG-AD59Z6 瓒欏境鑺� Start*************************//
+        if(Ra.repair__r.Repair_Final_Inspection_Date__c != null) {
+            return '淇悊鏈�缁堟娴嬫棩涓嶄负绌猴紝涓嶈兘鍋氬嚭搴撴寚绀�';
+        }
+        if(Ra.repair__c!=null&&Ra.repair__r.Return_Without_Repair_Date__c != null) {
+            return '鏈慨鐞嗗綊杩樻棩涓嶄负绌猴紝涓嶈兘鍋氬嚭搴撴寚绀�';
+        }
+//*************************Insert 20160826 SWAG-AD59Z6 瓒欏境鑺� End***************************//
+
+        //1388 yc 20211021 璺ㄥ尯鍩熷垎閰嶄笉鑳藉嚭搴� start
+        if(String.isNotBlank(ra.Cross_Region_Assign__c)){
+            String soql = 'select Id, Name,Rental_Apply__c,Internal_asset_location_before__c';
+            soql +=' from Rental_Apply_Equipment_Set_Detail__c';
+            soql +=' where Rental_Apply__c = \'' + ra.Id +'\'';
+            soql +=' and Internal_asset_location_before__c !=null and Internal_asset_location_before__c != \'' + ra.Cross_Region_Assign__c+ '\'';
+
+            if(String.isNotBlank(rasdid)){
+                soql +=' and Rental_Apply_Equipment_Set__c = :rasdid';
+            }
+            List<Rental_Apply_Equipment_Set_Detail__c> raesd = Database.query(soql);
+            if(raesd.size()>0){
+                returnStr = '鍒嗛厤鐨勫鍝佷笉鏄偍鎵�灞炲鍝佷腑蹇冪殑澶囧搧锛屼笉鑳藉仛鍑哄簱鎸囩ず';
+                return returnStr;
+            }
+
+        }
+        //1388 yc 20211021 璺ㄥ尯鍩熷垎閰嶄笉鑳藉嚭搴� end
+        // 20220211 ljh add 澶囧搧FY23璇鹃01 start
+        // AggregateResult[] resultsRas = [SELECT Rental_Start_Date__c,count(Id) cnt
+        //                              FROM Rental_Apply_Equipment_Set__c
+        //                              WHERE Rental_Apply__c = :rentalApplyId
+        //                              AND Cancel_Select__c = false
+        //                              group by Rental_Start_Date__c];
+        // If(resultsRas.size() > 1){
+        //  returnStr = '鎵�鏈変竴瑙堝鍝侀璁″嚭璐ф棩搴斾竴鑷达紝涓嶄竴鑷翠笉鑳藉仛鍑哄簱鎸囩ず';
+        //     return returnStr;
+        // }
+        // 20220211 ljh add 澶囧搧FY23璇鹃01 end
+
+//bp2        // 澶囧搧鍊熷嚭鍘嗗彶鍙栧緱
+//        List<String> equipmentSetList = new List<String>();
+//        Rental_Apply_Equipment_Set__c[] raes = [
+//            select Id, Name, Equipment_Set__c, Equipment_Set__r.Name, Rental_Start_Date__c, Rental_End_Date__c, Rental_Apply__c
+//              from Rental_Apply_Equipment_Set__c
+//             where Rental_Apply__c = :rentalApplyId and Cancel_Select__c = false];
+//        // 鏃ュ巻鑼冨洿锛屾渶灏忕殑鍊熷嚭寮�濮嬫棩鍒版渶澶х殑鍊熷嚭缁堜簡鏃�
+//        Date startDate = Date.today();
+//        Date endDate = Date.today();
+//        for (Rental_Apply_Equipment_Set__c r : raes) {
+//            equipmentSetList.add(r.Equipment_Set__c);
+//            if (r.Rental_Start_Date__c != null && r.Rental_Start_Date__c < startDate) {
+//                startDate = r.Rental_Start_Date__c;
+//            }
+//            if (r.Rental_End_Date__c != null && r.Rental_End_Date__c > endDate) {
+//                endDate = r.Rental_End_Date__c;
+//            }
+//        }
+//        Integer prepareDay = ra.Prepare_Day__c == null ? Integer.valueOf(System.Label.EquipmentRentalPrepare) : ra.Prepare_Day__c.intValue();
+//        Date minDate = getWD_addday(startDate, -1 * prepareDay);
+//        Date maxDate = getWD_addday(endDate, prepareDay);
+//        // 鍏朵粬澶囧搧鍊熷嚭鐢宠鍘嗗彶
+//        Rental_Apply_Equipment_Set__c[] others = [
+//                    select Id, Name, Rental_Start_Date__c, Rental_End_Date__c, Equipment_Set__c, Rental_Apply__r.Status__c ,Rental_Apply__r.Prepare_Day__c
+//                      from Rental_Apply_Equipment_Set__c
+//                     where Rental_Apply__c != :rentalApplyId
+//                       and Equipment_Set__c in :equipmentSetList
+//                       and Request_Status__c != '鍙栨秷'
+//                       and Request_Status__c != '鍒犻櫎'
+//                       and Cancel_Select__c = false
+//                       and ((Rental_Start_Date__c >= :minDate and Rental_Start_Date__c <= :maxDate)
+//                            or (Rental_End_Date__c >= :minDate and Rental_End_Date__c <= :maxDate)
+//                            or (Rental_Start_Date__c <= :startDate and Rental_End_Date__c >= :endDate))];
+
+//        Map<String, List<Rental_Apply_Equipment_Set__c>> othersMap = new Map<String,List<Rental_Apply_Equipment_Set__c>>();
+//        for (Rental_Apply_Equipment_Set__c other : others) {
+//            if (othersMap.containsKey(other.Equipment_Set__c)) {
+//                othersMap.get(other.Equipment_Set__c).add(other);
+//            } else {
+//                List<Rental_Apply_Equipment_Set__c> l = new List<Rental_Apply_Equipment_Set__c>();
+//                l.add(other);
+//                othersMap.put(other.Equipment_Set__c, l);
+//            }
+//        }
+
+//        for (Rental_Apply_Equipment_Set__c r : raes) {
+
+//            List<Rental_Apply_Equipment_Set__c> other = othersMap.get(r.Equipment_Set__c);
+
+//            Map<Date, Map<String, String>> dateMap= new Map<Date, Map<String, String>>();
+//            if (other != null) {
+//                Date sdate = startDate;
+//                Date edate = endDate;
+//                for (Rental_Apply_Equipment_Set__c o : other) {
+//                    if (o.Rental_Start_Date__c != null && (sdate == null || o.Rental_Start_Date__c < sdate)) {
+//                        sdate = o.Rental_Start_Date__c;
+//                    }
+//                    if (o.Rental_End_Date__c != null && (edate == null || o.Rental_End_Date__c > edate)) {
+//                        edate = o.Rental_End_Date__c;
+//                    }
+//                }
+//                if (sdate != null && edate != null) {
+//                    RentalApplyWebService raws = new RentalApplyWebService();
+//                    dateMap = raws.getDateMap(sdate, edate, prepareDay);
+//                }
+//            }
+
+//            if (r.Rental_Start_Date__c == null && r.Rental_End_Date__c == null) {
+//                // 娓呯┖璇ュ�熷嚭鍘嗗彶鐨勫嚭搴撳拰鍥炴敹鏃堕棿
+//            } else if (other == null || other.size() == 0) {
+//                // 涓庡叾浠栧�熷嚭鍘嗗彶娌℃湁鍐茬獊
+//            } else {
+//                Date fromDate = r.Rental_Start_Date__c;
+//                Date toDate = r.Rental_End_Date__c;
+//                for (Rental_Apply_Equipment_Set__c o : other) {
+//                    if (o.Rental_Apply__r.Status__c != '鑽夋涓�' && o.Rental_Apply__r.Status__c != '鐢宠涓�' && o.Rental_Apply__r.Status__c != null) {
+//                        Date startD = o.Rental_Start_Date__c;
+//                        Date endD = o.Rental_End_Date__c;
+//                        Integer prepare = prepareDay; //>= o.Rental_Apply__r.Prepare_Day__c || o.Rental_Apply__r.Prepare_Day__c == null ? prepareDay : o.Rental_Apply__r.Prepare_Day__c.intValue();
+//                        if ((dateMap.containsKey(fromDate) && Date.valueOf(dateMap.get(fromDate).get('Next')) > startD && dateMap.containsKey(endD) && fromDate < Date.valueOf(dateMap.get(endD).get('Next'))) ||
+//                            (dateMap.containsKey(toDate) && Date.valueOf(dateMap.get(toDate).get('Next')) > startD && dateMap.containsKey(endD) && toDate < Date.valueOf(dateMap.get(endD).get('Next'))) ||
+//                            (dateMap.containsKey(fromDate) && Date.valueOf(dateMap.get(fromDate).get('Next')) <= startD && dateMap.containsKey(endD) && toDate >= Date.valueOf(dateMap.get(endD).get('Next')))) {
+//                            returnStr = '澶囧搧' + r.Equipment_Set__r.Name + '鐨勫�熷嚭鏃ヤ笌澶囧搧鍊熷嚭鍘嗗彶' + o.Name + '鏈夊啿绐侊紝璇风‘璁ゃ��';
+//                            return returnStr;
+//                        }
+//                    }
+//                }
+//            }
+//        }
+        return '1';
+    }
+
+    @AuraEnabled
+    public static String setShipment_requests(String raid, String raesid) {
+        Savepoint sp = Database.setSavepoint();
+
+        try {
+            //涓�瑙堟儏鍐典笅妫�绱竴瑙堝搴旂殑鐢宠涔d锛宻oql瀛愭煡璇笉鑳藉拰涓绘煡璇㈡槸鍚屼竴涓〃锛屽崟鐙绱竴娆�
+            if (String.isBlank(raid)) {
+                List<Rental_Apply_Equipment_Set__c> raList = [select Id, Rental_Apply__c from Rental_Apply_Equipment_Set__c where id = :raesid];
+                if (raList.size() > 0) {
+                    raid = raList[0].Rental_Apply__c;
+                } else {
+                    //搴旇涓嶄細鍒拌繖閲�
+                    return '娌℃湁鍙互鍑哄簱鎸囩ず鐨勪竴瑙�';
+                }
+            }
+            String soql = 'SELECT Id'
+                    + ' FROM Rental_Apply_Equipment_Set__c '
+                    + ' WHERE Shippment_loaner_time2__c <> null '
+                    + ' AND Rental_Apply__c = :raid '
+                    + ' ORDER BY Id' ;
+            List<Rental_Apply_Equipment_Set__c> shippedRaesList = Database.query(soql);
+            String raesStrShipped = '';
+            for (Rental_Apply_Equipment_Set__c raes : shippedRaesList) {
+                raesStrShipped += raes.Id;
+            }
+
+            //Srring soql = "SELECT Id FROM Rental_Apply_Equipment_Set_Detail__c WHERE Rental_Apply__c = '{!Rental_Apply__c.Id}' AND Cancel_Select__c = false AND Rental_Num__c > 0 AND Rental_Apply_Equipment_Set__r.Wei_Assigned_Cnt__c = 0 AND Rental_Apply_Equipment_Set__r.Yi_Assigned_Cnt__c > 0 AND Shipment_request__c  = false";
+            soql = 'SELECT Id, Rental_Apply__c, Rental_Apply_Equipment_Set__c'
+                    + ' FROM Rental_Apply_Equipment_Set_Detail__c '
+                    + ' WHERE ' + (String.isNotBlank(raesid) ? 'Rental_Apply_Equipment_Set__c = :raesid ' : 'Rental_Apply__c = :raid ')
+                    + ' AND Cancel_Select__c = false '
+                    + ' AND Rental_Num__c > 0 '
+                    + ' AND Rental_Apply_Equipment_Set__r.Wei_Assigned_Cnt__c = 0 '
+                    + ' AND Rental_Apply_Equipment_Set__r.Yi_Assigned_Cnt__c > 0 '
+                    + ' AND Shipment_request__c  = false'
+                    + ' ORDER BY Rental_Apply_Equipment_Set__c, Id';
+            List<Rental_Apply_Equipment_Set_Detail__c> raesds = Database.query(soql);
+
+            Map<Id, List<String>> rental_Asset_SerialNumberMap = new Map<Id, List<String>>();
+
+            if (raesds.size() < 1) {
+                return '娌℃湁鍙互鍑哄簱鎸囩ず鐨勪竴瑙�';
+            } else {
+                Set<Id> raesSet = new Set<Id>();
+                String raesStrRequest = '';
+                for (Rental_Apply_Equipment_Set_Detail__c raesd : raesds) {
+                    if (false == raesSet.contains(raesd.Rental_Apply_Equipment_Set__c)) {
+                        raesSet.add(raesd.Rental_Apply_Equipment_Set__c);
+                        raesStrRequest += raesd.Rental_Apply_Equipment_Set__c;
+                    }
+                    raesd.Shipment_request_time2__c = Datetime.now();
+                    raesd.Shipment_request__c = true;
+                }
+                // 鍑哄簱鍚�, 鍐嶆鍋氬嚭搴撴寚绀虹殑涓�瑙�, 涓�瀹氳涓嚭杩囧簱鐨勪竴瑙堜竴鏍�
+                if (false == String.isBlank(raesStrShipped) && raesStrRequest != raesStrShipped) {
+                    return '涓嶈兘鍋氬嚭搴撴寚绀猴紝闇�瑕佸垎鍗曞悗鍐嶆搷浣�';
+                }
+            }
+
+            // add lc 20220927 SFDC-CJ48VE 澶囧搧棰勮鍑哄簱鏃ラ�昏緫璋冩暣 start
+            List<Rental_Apply_Equipment_Set__c> RAESRecords = [
+                    SELECT Id,Rental_Start_Date__c
+                    FROM Rental_Apply_Equipment_Set__c
+                    WHERE Rental_Apply__c = :raid
+                    AND Cancel_Select__c = False];
+
+            for (Integer i = 0; i < RAESRecords.size(); i++) {
+                // 澶囧搧棰勮鍑哄簱鏃ヤ笉涓�鑷达紝涓嶅彲鍑哄簱鎸囩ず
+                if (RAESRecords[i].Rental_Start_Date__c != RAESRecords[0].Rental_Start_Date__c) {
+                    return '澶囧搧棰勮鍑鸿揣鏃ヤ笉涓�鑷达紝涓嶅彲鍑哄簱鎸囩ず';
+                }
+            }
+            // add lc 20220927 SFDC-CJ48VE 澶囧搧棰勮鍑哄簱鏃ラ�昏緫璋冩暣 end
+
+            Rental_Apply__c ra = new Rental_Apply__c(Id = raesds[0].Rental_Apply__c, Status__c = '宸插嚭搴撴寚绀�');
+            update ra;
+            Database.SaveResult[] results = Database.update(raesds);
+            Database.SaveResult dmlResult = results[0];
+            if (dmlResult.isSuccess()) {
+                //鏄庣粏鏇存柊鎴愬姛鍚庢墠鏇存柊涓�瑙堢殑Rental_Asset_SerialNumber__c
+                soql = 'SELECT Id, SerialNumber_text__c, Rental_Apply_Equipment_Set__c '
+                        +'FROM Rental_Apply_Equipment_Set_Detail__c '
+                        +'WHERE Rental_Apply__c = \'' + raesds[0].Rental_Apply__c + '\''
+                        +'AND Shipment_request_time2__c != null '
+                        +'AND Shipment_request__c = true '
+                        +'AND SerialNumber_text__c != null '
+                        +'ORDER BY Rental_Apply_Equipment_Set__c ';
+
+
+                List<Rental_Apply_Equipment_Set_Detail__c> raesdSerialNumbers = Database.query(soql);
+
+                for (Rental_Apply_Equipment_Set_Detail__c raesd : raesdSerialNumbers) {
+
+                    if (!rental_Asset_SerialNumberMap.containsKey(raesd.Rental_Apply_Equipment_Set__c)) {
+                        // Asset__r.SerialNumber + ','
+                        rental_Asset_SerialNumberMap.put(raesd.Rental_Apply_Equipment_Set__c, new List<String>());
+                    }
+                    rental_Asset_SerialNumberMap.get(raesd.Rental_Apply_Equipment_Set__c).add(raesd.SerialNumber_text__c);
+                }
+
+                List<Rental_Apply_Equipment_Set__c> raess = new List<Rental_Apply_Equipment_Set__c>();
+                for (Id key : rental_Asset_SerialNumberMap.keySet()) {
+                    raess.add(new Rental_Apply_Equipment_Set__c(Id = key,
+                            Rental_Asset_SerialNumber__c = ',' + String.join(rental_Asset_SerialNumberMap.get(key), ',') + ','));
+                }
+                if (!raess.isEmpty()) {
+                    update raess;
+                }
+
+                return '鐘舵�佹洿鏂板埌宸插嚭搴撴寚绀�';
+            } else {
+                Database.rollback(sp);
+                Database.Error emsg = dmlResult.getErrors()[0];
+                return 'failed to update:' + emsg.getFields() +  ' ' + emsg.getMessage();
+            }
+        } catch (Exception ex) {
+            Database.rollback(sp);
+            return ex.getMessage();
+        }
+    }
+
+    @AuraEnabled
+    public static String postponeCheck(String endDate, Integer d) {
+        Date before5day = getWD_addday(date.parse(endDate), d);
+        if (Date.today() > before5day) {
+            return System.Label.EquipmentRentalPostponeOverDeadline;
+        }
+        return 'OK';
+    }
+
+    public static Date getWD_addday(Date d, Integer i) {
+        if (d == Date.valueOf('4000-12-31')) {
+            return d;
+        }
+        if (i >= 0) {
+            List<OlympusCalendar__c> workday = [
+                    select Id, Date__c, IsWorkDay__c
+                    from OlympusCalendar__c
+                    where Date__c >= :d
+                    and IsWorkDay__c = 1
+                    order by Date__c
+                    limit :(i+1)];
+            Date selectDate = workday[i].Date__c;
+            return selectDate;
+        } else {
+            i = Math.abs(i);
+            List<OlympusCalendar__c> workday = [
+                    select Id, Date__c, IsWorkDay__c
+                    from OlympusCalendar__c
+                    where Date__c <= :d
+                    and IsWorkDay__c = 1
+                    order by Date__c desc
+                    limit :(i+1)];
+            Date selectDate = workday[i].Date__c;
+            return selectDate;
+        }
+    }
+
+
+    public class UpdateResult {
+        @AuraEnabled public String recordId {get;set;}
+        @AuraEnabled public Boolean success {get;set;}
+        @AuraEnabled public List<String> errors {get;set;}
+    }
+    public class InitData{
+        @AuraEnabled
+        public String id;
+        @AuraEnabled
+        public String RentalApplyId;
+        @AuraEnabled
+        public String Status;
+        @AuraEnabled
+        public String RentalApplyC;
+        @AuraEnabled
+        public Decimal WeiAssignedCntC;
+        @AuraEnabled
+        public Date BollowDateC;
+        @AuraEnabled
+        public Decimal AssignedNotShipmentC;
+    }
+}
diff --git a/force-app/main/default/classes/SelectSubstituteControllerLWT.cls-meta.xml b/force-app/main/default/classes/SelectSubstituteControllerLWT.cls-meta.xml
new file mode 100644
index 0000000..d75b058
--- /dev/null
+++ b/force-app/main/default/classes/SelectSubstituteControllerLWT.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>51.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/SubmitExtensionApprovalProcessController.cls b/force-app/main/default/classes/SubmitExtensionApprovalProcessController.cls
new file mode 100644
index 0000000..af0b518
--- /dev/null
+++ b/force-app/main/default/classes/SubmitExtensionApprovalProcessController.cls
@@ -0,0 +1,42 @@
+public with sharing class SubmitExtensionApprovalProcessController {
+
+    public SubmitExtensionApprovalProcessController() {
+        
+    }
+
+
+    @AuraEnabled
+    public static InitData init(String recordId) {
+        InitData res = new InitData();
+
+        try {
+            Rental_Apply__c rac = [SELECT Id, ExtensionStatus__c, demo_purpose2__c, AgreementBorrowingExtensionDate__c, Return_dadeline_final__c from Rental_Apply__c where Id = :recordId];
+
+            res.Id = rac.Id;
+            res.ExtensionStatus = rac.ExtensionStatus__c;
+            res.RootRentalApply = rac.Root_Rental_Apply__c;
+            res.demoPurpose2 = rac.demo_purpose2__c;
+            res.AgreementBorrowingExtensionDate = rac.AgreementBorrowingExtensionDate__c;
+            res.ReturnDadelineFinal = rac.Return_dadeline_final__c;
+        }
+        catch (Exception e) {
+            System.debug(LoggingLevel.INFO, '****e:' + e);
+        }
+        return res;
+    }
+
+    public class InitData {
+        @AuraEnabled
+        public String Id;
+        @AuraEnabled
+        public String ExtensionStatus;
+        @AuraEnabled
+        public String RootRentalApply;
+        @AuraEnabled
+        public String demoPurpose2;
+        @AuraEnabled
+        public Date AgreementBorrowingExtensionDate;
+        @AuraEnabled
+        public Date ReturnDadelineFinal;
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/SubmitExtensionApprovalProcessController.cls-meta.xml b/force-app/main/default/classes/SubmitExtensionApprovalProcessController.cls-meta.xml
new file mode 100644
index 0000000..9662499
--- /dev/null
+++ b/force-app/main/default/classes/SubmitExtensionApprovalProcessController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>50.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
\ No newline at end of file
diff --git a/force-app/main/default/classes/TenderWebService.cls b/force-app/main/default/classes/TenderWebService.cls
new file mode 100644
index 0000000..65fb530
--- /dev/null
+++ b/force-app/main/default/classes/TenderWebService.cls
@@ -0,0 +1,83 @@
+global class TenderWebService {
+	public TenderWebService() {
+
+	}
+	@AuraEnabled
+	//鎷涙姇鏍囧弽閫昏緫鍒犻櫎
+	WebService static String ContraryLogicalDel(String DTenId) {
+		Tender_information__c DTenInfo = [Select Id, InfoId__c, Logical_delete__c, ProjectId__c, Retain_Tender__c From Tender_information__c Where id = : DTenId];
+		// 鏇存柊鍒犻櫎鎷涙姇鏍�
+		List<Tender_information__c> updateTenInfoList = new List<Tender_information__c>();
+		// 鏇存柊淇濈暀鎷涙姇鏍�
+		// List<Tender_information__c> updateBTenList = new List<Tender_information__c>();
+		if (String.isNotBlank(DTenInfo.Retain_Tender__c)) {
+			// System.debug('11111111' + TenInfo.Retain_Tender__c);
+			//瑕佷繚鐣欑殑鎷涙姇鏍�
+			Tender_information__c BTen =  [select Id, InfoId__c From Tender_information__c
+			                               Where Id = : DTenInfo.Retain_Tender__c];
+
+			// 鍒犻櫎鎷涙姇鏍囧叧鑱旂殑璇环
+			// List<Tender_Opportunity_Link__c> DTenLinkList = [select Opportunity__c
+			//         from Tender_Opportunity_Link__c
+			//         where Tender_information__c = :DTenId and IsRelated__c = true];
+			// System.debug('---------2---------' + DTenLinkList);
+			// Set<Id> DTenLinkOppIdSet = new Set<Id>();
+			// if (DTenLinkList.size() > 0) {
+			// 	for (Tender_Opportunity_Link__c DTenlink : DTenLinkList) {
+			// 		DTenLinkOppIdSet.add(DTenlink.Opportunity__c);
+			// 	}
+			// 	System.debug('---------3---------' + DTenLinkOppIdSet);
+			// 	// 鍒犻櫎椤圭洰鍏宠仈骞朵笖涓庝繚鐣欓」鐩叧鑱旂殑璇环鍏宠仈淇℃伅
+			// 	List<Tender_Opportunity_Link__c> DelD_BTenLinkList = [select id, Opportunity__c, Tender_information__c
+			// 	        from Tender_Opportunity_Link__c
+			// 	        where Tender_information__c = :BTen.Id and Opportunity__c in : DTenLinkOppIdSet];
+			// 	System.debug('---------1---------' + DelD_BTenLinkList);
+			// 	if (DelD_BTenLinkList.size() > 0) {
+			// 		Delete DelD_BTenLinkList;
+			// 	}
+			// }
+
+			// 淇濈暀椤圭洰閫氳繃杞垹闄ら�昏緫鍏宠仈鏉ョ殑璇环
+			List<Tender_Opportunity_Link__c> DelD_BTenLinkList = [select id, Opportunity__c, Tender_information__c
+				        from Tender_Opportunity_Link__c
+				        where Tender_information__c = :BTen.Id and IsRelated__c = true];
+			// 鍒ゆ柇link鏄惁涓虹┖
+			if (DelD_BTenLinkList != null && DelD_BTenLinkList.size() > 0) {
+				// 閫昏緫鏈夊ぇ鍧� 鏆傛椂鍙妸鎵撴爣璁扮殑鍒犳帀 涓嶅仛鍥炲啓鐨勬搷浣滀簡
+				// List<Tender_Opportunity_Link__c> add_list = new List<Tender_Opportunity_Link__c>();
+				// for (Tender_Opportunity_Link__c link : DelD_BTenLinkList) {
+				// 	Tender_Opportunity_Link__c add_link = new Tender_Opportunity_Link__c();
+				// 	add_link.Tender_information__c = DTenInfo.Id;
+				// 	add_link.Opportunity__c = link.Opportunity__c;
+				// 	add_link.Tender_Opportunity_Uniq__c = DTenInfo.Id + '' + link.Opportunity__c;
+				// 	add_link.IsRelated__c = false;
+				// 	add_list.add(add_link);
+				// }
+				// 鍒犳帀淇濈暀椤圭洰涓婄殑鍏宠仈璇环
+				delete DelD_BTenLinkList;
+				// 鍒犻櫎椤圭洰涓婄殑鍏宠仈鍔犲洖鏉�
+				// if (add_list.size() > 0) {
+				// 	insert add_list;
+				// }
+			}
+
+			// 浜掓崲淇濈暀鎷涙姇鏍囦笌鍒犻櫎鎷涙姇鏍囩殑淇℃伅Id
+			DTenInfo.Retain_Tender__c = BTen.Id;
+			String BTenInfo = BTen.InfoId__c;
+			BTen.InfoId__c = DTenInfo.InfoId__c;//淇濈暀鎷涙姇鏍囩殑淇℃伅Id璧嬬粰鍒犻櫎鎷涙姇鏍囩殑淇℃伅Id
+			DTenInfo.InfoId__c = BTenInfo;//鍒犻櫎鎷涙姇鏍囩殑淇℃伅Id璧嬬粰淇濈暀鎷涙姇鏍囩殑淇℃伅Id
+			// 鐐瑰嚮淇濆瓨鍚� 鍒犻櫎鎷涙姇鏍囦笂鐨勯�昏緫鍒犻櫎瀛楁鍙樹负true
+			DTenInfo.Logical_delete__c = false;
+			// update TenInfo;
+			// 涓�璧锋洿鏂板氨琛屼簡
+			updateTenInfoList.add(DTenInfo);
+			updateTenInfoList.add(BTen);
+			update updateTenInfoList;
+
+			// updateBTenList.add(BTen);
+			// update updateBTenList;
+
+		}
+		return 'OK';
+	}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/TenderWebService.cls-meta.xml b/force-app/main/default/classes/TenderWebService.cls-meta.xml
new file mode 100644
index 0000000..e3d1b51
--- /dev/null
+++ b/force-app/main/default/classes/TenderWebService.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>45.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/TenderingButtonController.cls b/force-app/main/default/classes/TenderingButtonController.cls
index 26eb6dd..5a2d0ea 100644
--- a/force-app/main/default/classes/TenderingButtonController.cls
+++ b/force-app/main/default/classes/TenderingButtonController.cls
@@ -11,6 +11,7 @@
             res.opportunityNum = String.valueOf(report.OpportunityNum__c);
             res.isRelateProject = report.IsRelateProject__c;
             res.profileId = UserInfo.getProfileId();
+            res.Environment_Url = System.Label.Environment_Url;
             System.debug(LoggingLevel.INFO, '*** xu: ' + res);
         }catch(Exception e){
             System.debug(LoggingLevel.INFO, '*** xu: ' + e);
@@ -47,5 +48,7 @@
         public String isRelateProject;
         @AuraEnabled
         public String profileId;
+        @AuraEnabled
+        public String Environment_Url;
     }
 }
\ No newline at end of file
diff --git a/force-app/main/default/classes/TransferApplyController.cls b/force-app/main/default/classes/TransferApplyController.cls
new file mode 100644
index 0000000..864e606
--- /dev/null
+++ b/force-app/main/default/classes/TransferApplyController.cls
@@ -0,0 +1,31 @@
+public with sharing class TransferApplyController {
+    public TransferApplyController() {
+        
+    }
+    @AuraEnabled
+    public static list<TransferApplySummary__c> transferApplyPDF(string transferApplyId) {
+        
+        try {
+            // var sql = "select Id from TransferApplySummary__c where TransferApply__c = 
+            //'{!TransferApply__c.Id}' and ApprovalDetails__c > 0 and TAS_Status__c != '鍙栨秷'";
+            list<TransferApplySummary__c> reports = [
+                select id from TransferApplySummary__c 
+                where TransferApply__c = :transferApplyId
+                and ApprovalDetails__c > 0
+                and TAS_Status__c != '鍙栨秷'];
+            return reports;
+        }catch ( Exception e) {
+            System.debug(LoggingLevel.ERROR,'TransferApplySummary__c TransferApplyPDF Error : ' + e);
+        }
+        return null;
+        
+    }
+
+    @AuraEnabled
+    public static Boolean applyPermission()
+    {
+        Schema.DescribeSobjectResult schemaMap = Schema.describeSObjects(new String[]{'TransferApply__c'})[0];
+        return schemaMap.isCreateable();
+    }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/TransferApplyController.cls-meta.xml b/force-app/main/default/classes/TransferApplyController.cls-meta.xml
new file mode 100644
index 0000000..d75b058
--- /dev/null
+++ b/force-app/main/default/classes/TransferApplyController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>51.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/TransferApplyWebService.cls b/force-app/main/default/classes/TransferApplyWebService.cls
new file mode 100644
index 0000000..371adb6
--- /dev/null
+++ b/force-app/main/default/classes/TransferApplyWebService.cls
@@ -0,0 +1,214 @@
+global without sharing class TransferApplyWebService {
+    public TransferApplyWebService() {
+
+    }
+
+    @AuraEnabled
+    WebService static String submitApply(String taId) {
+        List<TransferApply__c> taList = [
+            SELECT Id
+                 , Status__c
+                 , Add_Approval_Status__c
+                 , RecordType.DeveloperName //20201202 ljh add
+                 , BeiPinWindow__c //20201202 ljh add
+                 , Add_Reason__c // 20210429 1831 you
+             FROM TransferApply__c
+            WHERE Id = :taId
+              FOR UPDATE
+        ];
+        if (taList.isEmpty()) {
+            return '璋冩嫧鍗曚笉瀛樺湪銆�';
+        }
+        TransferApply__c ta = taList[0];
+        if(ta.Status__c != '鑽夋涓�' && ta.Add_Approval_Status__c != '鑽夋涓�'){
+            return '璇风‘璁よ皟鎷ㄥ崟鐘舵�侊紝娌℃湁寰呭鎵圭殑鏄庣粏锛屼笉鑳芥彁浜�';
+        }
+        List<String> errorList = checkTransferCount(ta.Id);
+        if(!errorList.isEmpty()) {
+            return String.join(errorList, '\n');
+        }
+        if(ta.Status__c == '鑽夋涓�') {
+
+            ta.Status__c = '濉啓瀹屾瘯';
+        }
+        else {
+            
+            // 20210429 1831 you start
+            if(ta.Add_Approval_Status__c == '鑽夋涓�' && String.isBlank(ta.Add_Reason__c) ){
+                return '娌℃湁濉啓杩藉姞鐞嗙敱锛屼笉鑳芥彁浜�';
+            }else {// 20210429 1831 you end
+        
+                ta.Add_Approval_Status__c = '濉啓瀹屾瘯';
+            }
+        }
+        //20201202 ljh OCSM_BP5-76 add start
+        if(ta.RecordType.DeveloperName == 'AgencyToCenter' && ta.BeiPinWindow__c == null){
+            return '璇风‘璁ゅ鎵逛汉锛屾病鏈夊鎵逛汉锛堝鍝佹�荤獥鍙o級锛屼笉鑳芥彁浜�';
+        }
+        //20201202 ljh OCSM_BP5-76 add end
+        Savepoint sp = Database.setSavepoint();
+        try {
+            update ta;
+        }
+        catch (Exception e) {
+            Database.rollback(sp);
+            return e.getMessage();
+        }
+        return '1';
+    }
+    public static List<String> checkTransferCount(Id taId) {
+        List<TransferApplyDetail__c> tadList =  [
+            SELECT Id
+                 , Asset__r.Ji_Zhong_Guan_Li_Ku_Cun__c
+                 , Asset__r.TransferableAbandon_F__c
+                 , Asset__r.TransferableRepair_F__c
+                 , Asset__r.TransferableLost_F__c
+                 , Asset__r.Name
+                 , Asset__c
+                 , Approved_F__c
+                 , TransferType__c
+                 , OneToOneAccessory__c
+            FROM TransferApplyDetail__c
+            WHERE TransferApply__c=:taId
+                AND Cancel_Select__c = false
+        ];
+
+        Map<Id, Integer> assCountMap = new Map<Id, Integer>(); // assetId->鏈夋晥搴撳瓨
+        Map<Id, Integer> assetAbanCntMap = new Map<Id, Integer>(); // 闈炰竴瀵逛竴闄勫睘鍝佸緟搴熷純鏁扮粺璁★紝淇濇湁璁惧Id->寰呭簾寮冭皟鎷ㄦ暟閲�
+        Map<Id, Integer> assetRepairCntMap = new Map<Id, Integer>(); // 闈炰竴瀵逛竴闄勫睘鍝佸緟搴熷純鏁扮粺璁★紝淇濇湁璁惧Id->寰呭簾寮冭皟鎷ㄦ暟閲�
+        Map<Id, Integer> assetLostCntMap = new Map<Id, Integer>(); // 闈炰竴瀵逛竴闄勫睘鍝佸緟搴熷純鏁扮粺璁★紝淇濇湁璁惧Id->寰呭簾寮冭皟鎷ㄦ暟閲�
+
+        Boolean needApprove = false;
+        for(TransferApplyDetail__c tad: tadList) {
+            if(!tad.Approved_F__c && !tad.OneToOneAccessory__c) {
+                Integer cnt = 0;
+                if(tad.TransferType__c == '寰呭簾寮�') {
+                    if(assetAbanCntMap.containsKey(tad.Asset__c)){
+                        cnt = assetAbanCntMap.get(tad.Asset__c);
+                    }
+                    cnt += 1;
+                    assetAbanCntMap.put(tad.Asset__c, cnt);
+                }
+                else if(tad.TransferType__c == '寰呬慨鐞�'){
+                    if(assetRepairCntMap.containsKey(tad.Asset__c)){
+                        cnt = assetRepairCntMap.get(tad.Asset__c);
+                    }
+                    cnt += 1;
+                    assetRepairCntMap.put(tad.Asset__c, cnt);
+                }
+                else if(tad.TransferType__c == '涓㈠け鎵惧洖'){
+                    if(assetLostCntMap.containsKey(tad.Asset__c)){
+                        cnt = assetLostCntMap.get(tad.Asset__c);
+                    }
+                    cnt += 1;
+                    assetLostCntMap.put(tad.Asset__c, cnt);
+                }
+                else {
+                    if(assCountMap.containsKey(tad.Asset__c)) {
+                        cnt = assCountMap.get(tad.Asset__c);
+                    }
+                    cnt += 1;
+                    assCountMap.put(tad.Asset__c, cnt);
+                }
+                if(!tad.Approved_F__c) {
+                    needApprove = true;
+                }
+            }
+        }
+        Set<String> errorList = new Set<String>();
+        if(!needApprove) {
+            errorList.add('娌℃湁闇�瑕佸鎵圭殑鏄庣粏锛�');
+        }
+        for(TransferApplyDetail__c tad: tadList) {
+            if(assCountMap.containsKey(tad.Asset__c)
+                && assCountMap.get(tad.Asset__c) > intValueOf(tad.Asset__r.Ji_Zhong_Guan_Li_Ku_Cun__c)) {
+                String msg = tad.Asset__r.Name;
+                msg += '锛氭湁鏁堝簱瀛�=' +  intValueOf(tad.Asset__r.Ji_Zhong_Guan_Li_Ku_Cun__c);
+                msg += '锛岃皟鎷ㄦ暟閲�=' + assCountMap.get(tad.Asset__c) ;
+                msg += '锛岃纭鏁伴噺鍚庢彁浜�';
+                errorList.add(msg);
+            }
+            if(assetRepairCntMap.containsKey(tad.Asset__c)
+                && assetRepairCntMap.get(tad.Asset__c) > intValueOf(tad.Asset__r.TransferableRepair_F__c)) {
+                String msg = tad.Asset__r.Name;
+                msg += '锛氬彲璋冩嫧鏁癬寰呬慨鐞�=' +  intValueOf(tad.Asset__r.TransferableRepair_F__c);
+                msg += '锛屽緟淇悊璋冩嫧鏁伴噺=' + assetRepairCntMap.get(tad.Asset__c) ;
+                msg += '锛岃纭鏁伴噺鍚庢彁浜�';
+                errorList.add(msg);
+            }
+            if(assetAbanCntMap.containsKey(tad.Asset__c)
+                && assetAbanCntMap.get(tad.Asset__c) > intValueOf(tad.Asset__r.TransferableAbandon_F__c)) {
+                String msg = tad.Asset__r.Name;
+                msg += '锛氬彲璋冩嫧鏁癬寰呭簾寮�=' + intValueOf(tad.Asset__r.TransferableAbandon_F__c);
+                msg += '锛屽緟搴熷純璋冩嫧鏁伴噺=' + assetAbanCntMap.get(tad.Asset__c);
+                msg += '锛岃纭鏁伴噺鍚庢彁浜�';
+                errorList.add(msg);
+            }
+            if(assetLostCntMap.containsKey(tad.Asset__c)
+                && assetLostCntMap.get(tad.Asset__c) > intValueOf(tad.Asset__r.TransferableLost_F__c)) {
+                String msg = tad.Asset__r.Name;
+                msg += '锛氬彲璋冩嫧鏁癬涓㈠け鎵惧洖=' + intValueOf(tad.Asset__r.TransferableLost_F__c);
+                msg += '锛屽緟搴熷純璋冩嫧鏁伴噺=' + assetLostCntMap.get(tad.Asset__c);
+                msg += '锛岃纭鏁伴噺鍚庢彁浜�';
+                errorList.add(msg);
+            }
+        }
+        return new List<String>(errorList);
+    }
+
+    @AuraEnabled
+    WebService static String cancelApply(Id taId) {
+        List<TransferApply__c> taList = [
+            SELECT Id
+                 , Add_Approval_Status__c
+                 , Cancel_Reason__c
+                 , OwnerId
+                 , Status__c
+                 , TA_Status__c
+                 , Yi_loaner_arranged__c
+                 , RecordType.DeveloperName
+                 , Request_approval_time__c
+             FROM TransferApply__c
+            WHERE Id = :taId
+              FOR UPDATE
+        ];
+        if (taList.isEmpty()) {
+            return '璋冩嫧鍗曚笉瀛樺湪銆�';
+        }
+        TransferApply__c ta = taList[0];
+        if(ta.Status__c == '鍙栨秷') {
+            return '宸茬粡鍙栨秷锛屼笉鑳藉啀娆″彇娑�';
+        }
+        if(ta.Status__c == '鐢宠涓�' || ta.Add_Approval_Status__c == '鐢宠涓�'){
+            return '鐢宠涓笉鑳藉彇娑�';
+        }
+        if(ta.RecordType.DeveloperName == 'InsideCenter' && ta.Request_approval_time__c != null) {
+            return '鍚屽鍝佷腑蹇冨唴璋冩嫧鍦ㄦ渶缁堟壒鍑嗕箣鍚庝笉鍙互鍙栨秷';
+        }
+        if(ta.TA_Status__c == '宸插嚭搴�' || ta.Yi_loaner_arranged__c > 0) {
+            return '宸茬粡鍑哄簱锛屼笉鑳藉彇娑�';
+        }
+        if(UserInfo.getUserId() != ta.OwnerId) {
+            return '浠呭垱寤鸿�呭彲浠ュ彇娑�';
+        }
+        if(String.isBlank(ta.Cancel_Reason__c)) {
+            return '蹇呴』杈撳叆鍙栨秷鐞嗙敱';
+        }
+        Savepoint sp = Database.setSavepoint();
+        try {
+            ta.Status__c = '鍙栨秷';
+            update ta;
+        }
+        catch (Exception e) {
+            Database.rollback(sp);
+            return e.getMessage();
+        }
+        return '1';
+    }
+    private static Integer intValueOf(Decimal d) {
+        if(d == null) {
+            return 0;
+        }
+        return Integer.valueOf(d);
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/TransferApplyWebService.cls-meta.xml b/force-app/main/default/classes/TransferApplyWebService.cls-meta.xml
new file mode 100644
index 0000000..91b23b8
--- /dev/null
+++ b/force-app/main/default/classes/TransferApplyWebService.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>46.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/UpdateTenderInformationBatch.cls b/force-app/main/default/classes/UpdateTenderInformationBatch.cls
new file mode 100644
index 0000000..5e34510
--- /dev/null
+++ b/force-app/main/default/classes/UpdateTenderInformationBatch.cls
@@ -0,0 +1,1310 @@
+/*2021-05-08  mzy
+* 鏇存柊鎷涙爣淇℃伅鐨勮浠风姸鎬佸拰璇环鐨勬暟閲�
+* 鏇存柊鎷涙爣淇℃伅鐨�5涓尰闄�
+* 褰撳尰闄㈠彂鐢熷彉鍖�/鎷涙姇鏍囬」鐩甇CSM鐪佸彂鐢熷彉鍖栨椂,绌烘洿鏂颁竴涓嬫嫑鎶曟爣
+*/
+global class UpdateTenderInformationBatch implements Database.Batchable<sObject>, Database.Stateful {
+
+    Boolean IsNeedExecute = false;
+    String tempTenderId ='';
+    Boolean IsOnlyTrue = true;
+    List<String> tempTenderList = new List<String>(); 
+
+    //閭欢淇℃伅
+    List<String> emailMessages = new List<String>();
+
+    //鎷涙姇鏍�: 鎶ラ敊鐨勬嫑鎶曟爣Id
+    String TenderlogStr = '鎷涙爣椤圭洰 : ';
+
+    //鎷涙姇鏍�: 鎶ラ敊淇℃伅
+    String TendererrorStr = '';
+
+    //鎷涙姇鏍�: 鎬讳欢鏁�
+    Integer TendertotalCount = 0;
+
+    //鎷涙姇鏍�: 澶辫触浠舵暟
+    Integer TenderfailedCount = 0; 
+
+    //鎵ц绗﹀悎鏉′欢鐨勬寚瀹氭嫑鎶曟爣椤圭洰
+    global UpdateTenderInformationBatch(String tempTenderId) {
+        this.tempTenderId = tempTenderId;
+    }
+    //鎵ц鎸囧畾鎷涙爣椤圭洰閲岀鍚堟潯浠剁殑鎷涙姇鏍囬」鐩�
+    global UpdateTenderInformationBatch(List<String> tempTenderList) {
+        this.tempTenderList = tempTenderList;
+    }
+    //澶勭悊鍘嗗彶鏁版嵁  IsOnlyTrue = false  鎵ц鎵�鏈夌殑鎷涙爣椤圭洰
+    global UpdateTenderInformationBatch(String tempOppId, Boolean IsOnlyTrue) {
+        this.IsOnlyTrue = IsOnlyTrue;
+    }
+    //  IsOnlyTrue = false 鍙互鎵嬪姩 鏃犳潯浠舵墽琛屽鏉℃嫑鎶曟爣椤圭洰
+    global UpdateTenderInformationBatch(String tempOppId, Boolean IsOnlyTrue,List<String> tempTenderList) {
+        this.IsOnlyTrue = IsOnlyTrue;
+        this.tempTenderList = tempTenderList;
+    }
+    
+    //Batch 閾� 鏃朵娇鐢�
+    global UpdateTenderInformationBatch(Boolean IsNeedExecute) {
+        this.IsNeedExecute = IsNeedExecute;
+    }
+
+    global UpdateTenderInformationBatch() {
+        
+    }
+
+    global Database.QueryLocator start(Database.BatchableContext bc) {
+        String query = 'SELECT Id,IsBid__c,NotBidApprovalStatus__c,IsReactionOpp__c,Hospital__c,Hospital1__c,Hospital2__c,Hospital3__c,Hospital4__c, ';
+               query += 'Hospital__r.Assume_Change__c,Hospital1__r.Assume_Change__c,Hospital2__r.Assume_Change__c,Hospital3__r.Assume_Change__c,Hospital4__r.Assume_Change__c ';
+               query += 'FROM Tender_information__c ';
+            if(IsOnlyTrue){               
+               query += 'WHERE  ((IsReactionOpp__c = true ) '; 
+               //2021-07-29 mzy  update 褰撳尰闄㈠彂鐢熷彉鍖�/鎷涙姇鏍囬」鐩甇CSM鐪佸彂鐢熷彉鍖栨椂,绌烘洿鏂颁竴涓嬫嫑鎶曟爣 start
+               // 2022-04-08 ssm SWAG-CC58ME 澧炲姞鎵�鏈変汉鏃犳晥鐨勫垽鏂� start 
+               query += 'OR (Owner.IsActive = false) ';
+               // 2022-04-08 ssm SWAG-CC58ME end
+               query += 'OR (BiddingOCSMAdministration__c = true) OR (Hospital__r.Assume_Change__c = true) '; 
+               query += 'OR (Hospital1__r.Assume_Change__c = true) OR (Hospital2__r.Assume_Change__c = true) '; 
+               query += 'OR (Hospital3__r.Assume_Change__c = true) OR (Hospital4__r.Assume_Change__c = true) )'; 
+               //2021-07-29  mzy update 褰撳尰闄㈠彂鐢熷彉鍖�/鎷涙姇鏍囬」鐩甇CSM鐪佸彂鐢熷彉鍖栨椂,绌烘洿鏂颁竴涓嬫嫑鎶曟爣 end
+               // DepartmentChanges__c 鍏ㄩ儴鎹㈡垚 Assume_Change__c 
+            }   
+            if(String.isNotBlank(this.tempTenderId)){
+                if(IsOnlyTrue){
+                    query += ' AND ';
+                }else {
+                    query += ' Where ';
+                }
+               query += 'Id = :tempTenderId ';
+            }
+            if(tempTenderList.size()>0){
+                if(IsOnlyTrue){
+                    query += ' AND ';
+                }else {
+                    query += ' Where ';
+                }
+
+               query += ' Id In :tempTenderList ';
+            }
+
+            System.debug('sql璇彞锛�'+query);
+        return Database.getQueryLocator(query);
+    }
+
+    global void execute(Database.BatchableContext BC, list<Tender_information__c> TenderList) {
+        //瀹氫箟List灏佽闇�瑕佺┖鏇存柊鐨勬嫑鎶曟爣椤圭洰
+        List<Tender_information__c> EmptyUpdateTenderList = new List<Tender_information__c>();
+        Map<String,Tender_information__c> EmptyUpdateTenderMap = new Map<String,Tender_information__c>();
+ 
+        //瀹氫箟List灏佽闇�瑕佹洿鏂扮殑鎷涙爣椤圭洰
+        List<Tender_information__c> updateTenderList = new List<Tender_information__c>();
+        //瀹氫箟Map淇濆瓨鎷涙姇鏍囦俊鎭� 
+        Map<String,Tender_information__c> tenderMap = new Map<String,Tender_information__c>();
+        //瀹氫箟List灏佽鎵�鏈夎浠风殑鎷涙爣椤圭洰Id
+        Set<String> BiddingProjectID = new Set<String>();
+        for(Tender_information__c tempTender : TenderList){
+            //2021-07-29   mzy  update  褰撳尰闄㈠彂鐢熷彉鍖�/鎷涙姇鏍囬」鐩甇CSM鐪佸彂鐢熷彉鍖栨椂,绌烘洿鏂颁竴涓嬫嫑鎶曟爣  start
+            if(tempTender.IsReactionOpp__c){
+                //濡傛灉鏄�  鏄惁鍙嶅簲璇环 涓� true 鍒欓渶瑕佽繘琛� 鍙嶅簲璇环 ,鍚﹀垯灏辩┖鏇存柊涓�涓�                
+                BiddingProjectID.add(tempTender.Id);
+                tenderMap.put( String.valueOf( tempTender.Id ).substring(0,15) ,tempTender);
+            }else {
+                //闇�瑕佺┖鏇存柊鐨勬嫑鎶曟爣
+                EmptyUpdateTenderList.add(tempTender);
+                EmptyUpdateTenderMap.put(String.valueOf( tempTender.Id ).substring(0,15) ,tempTender);
+            }
+            //2021-07-29  mzy  update  褰撳尰闄㈠彂鐢熷彉鍖�/鎷涙姇鏍囬」鐩甇CSM鐪佸彂鐢熷彉鍖栨椂,绌烘洿鏂颁竴涓嬫嫑鎶曟爣   end
+        }
+        //2021-07-29  mzy  update  绌烘洿鏂板け璐ョ殑璇濅笉娓呯┖鍖婚櫌鐨勬爣璇�  start
+        // System.debug('EmptyUpdateTenderList: ' + EmptyUpdateTenderList);
+        if(EmptyUpdateTenderList.size()>0){
+            //绌烘洿鏂版嫑鎶曟爣
+            // fxk 2021/9/28 Star
+            StaticParameter.EscapeOtherUpdateTenOwner = false;
+            Database.SaveResult[] EmptySaveTenderResult = Database.update(EmptyUpdateTenderList,false);
+            StaticParameter.EscapeOtherUpdateTenOwner = true;
+            // fxk 2021/9/28 End
+            //鏇存柊鎴愬姛鐨勬嫑鎶曟爣闇�瑕佸皢鍖婚櫌鐨勬爣璇嗘竻绌�
+            //淇濆瓨鏇存柊澶辫触鐨勫尰闄�
+            Set<String> faildHospIdSet = new Set<String>(); 
+            //鏌ョ湅澶辫触鐨勫尰闄�
+            for(Integer i = 0;i<EmptySaveTenderResult.size();i++){
+                if(!EmptySaveTenderResult.get(i).isSuccess()){
+                    String faildTenderId = String.valueOf(EmptyUpdateTenderList.get(i).id).substring(0,15);
+                    Tender_information__c  faildtender = EmptyUpdateTenderMap.get(faildTenderId);
+
+                    if(faildtender.Hospital__c != null && faildtender.Hospital__r.Assume_Change__c == true){                        
+                        faildHospIdSet.add(faildtender.Hospital__c);
+                    }
+                    if(faildtender.Hospital1__c != null && faildtender.Hospital1__r.Assume_Change__c == true){                        
+                        faildHospIdSet.add(faildtender.Hospital1__c);
+                    }
+                    if(faildtender.Hospital2__c != null&& faildtender.Hospital2__r.Assume_Change__c == true){                        
+                        faildHospIdSet.add(faildtender.Hospital2__c);
+                    }
+                    if(faildtender.Hospital3__c != null&& faildtender.Hospital3__r.Assume_Change__c == true){                        
+                        faildHospIdSet.add(faildtender.Hospital3__c);
+                    }
+                    if(faildtender.Hospital4__c != null&& faildtender.Hospital4__r.Assume_Change__c == true){                        
+                       faildHospIdSet.add(faildtender.Hospital4__c);
+                    }
+                }
+            }
+            //鏌ョ湅闇�瑕佹竻绌烘爣璇嗙殑鍖婚櫌id
+            Set<String> HospitalId = new Set<String>();
+            //闇�瑕佹竻绌烘爣璇嗙殑鍖婚櫌i
+            List<Account> needUpdateHPList = new  List<Account>();
+            for(Integer i = 0;i<EmptySaveTenderResult.size();i++){
+                String tenderId = String.valueOf(EmptyUpdateTenderList.get(i).id).substring(0,15);
+                Tender_information__c  tender = EmptyUpdateTenderMap.get(tenderId);
+
+                //濡傛灉澶辫触鐨凷et閲屾病鏈夎繖涓尰闄�,鍒欐竻绌鸿繖涓尰闄㈢殑鏍囪瘑
+                if(tender.Hospital__c != null && tender.Hospital__r.Assume_Change__c == true
+                    && (!faildHospIdSet.contains(tender.Hospital__c)) ){  
+                    HospitalId.add(tender.Hospital__c);
+                }
+                if(tender.Hospital1__c != null && tender.Hospital1__r.Assume_Change__c == true
+                    && (!faildHospIdSet.contains(tender.Hospital1__c)) ){  
+                    HospitalId.add(tender.Hospital1__c);
+                }
+                if(tender.Hospital2__c != null && tender.Hospital2__r.Assume_Change__c == true
+                    && (!faildHospIdSet.contains(tender.Hospital2__c)) ){
+                    HospitalId.add(tender.Hospital2__c); 
+                }
+                if(tender.Hospital3__c != null && tender.Hospital3__r.Assume_Change__c == true
+                    && (!faildHospIdSet.contains(tender.Hospital3__c)) ){
+                    HospitalId.add(tender.Hospital3__c);  
+                }
+                if(tender.Hospital4__c != null && tender.Hospital4__r.Assume_Change__c == true
+                    && (!faildHospIdSet.contains(tender.Hospital4__c)) ){
+                    HospitalId.add(tender.Hospital4__c);
+                }
+            }
+
+            Iterator<String> HospitalIds = HospitalId.iterator();
+
+            while(HospitalIds.hasNext()){
+                Account acc = new Account();
+                acc.id = HospitalIds.next();
+                acc.Assume_Change__c = false;
+                needUpdateHPList.add(acc);  
+            }
+
+            if(needUpdateHPList.size()>0){
+                 update needUpdateHPList;
+            }
+        }
+        //2021-07-29  mzy  update  绌烘洿鏂板け璐ョ殑璇濅笉娓呯┖鍖婚櫌鐨勬爣璇�  end
+  
+        //2021-07-29  mzy  update   濡傛灉鏈夐渶瑕佸弽搴旇浠风殑鍦ㄨ蛋涓嬮潰閫昏緫   start
+        if(BiddingProjectID.size()> 0){
+
+            //鏌ヨ鎷涙爣椤圭洰涓嬬殑鎵�鏈夎浠�
+            Map<String,List<Opportunity>> BiddingProjectOppMap = findTenderRelativeOpp(BiddingProjectID);
+
+            //璁$畻璇环鏁伴噺
+            List<Tender_information__c> updateTenderNumList = updateOpportunityNum(BiddingProjectOppMap);
+
+            //璁$畻璇环鐘舵��
+            List<Tender_information__c> updateTenderNumStatusList = updateOpportunityStatus(BiddingProjectOppMap,updateTenderNumList,tenderMap);
+
+
+            updateTenderList.addAll(updateTenderNumStatusList);
+
+        }
+
+        //鏇存柊鎷涙姇鏍� 璇环鏁伴噺鍜岀姸鎬�
+        if(updateTenderList.size()>0){
+            //涓�涓嫑鎶曟爣椤圭洰鏇存柊澶辫触
+            List<String> failedTenderList = new List<String>();
+            Database.SaveResult[] saveTenderResults = Database.update(updateTenderList,false);
+            //鎷涙姇鏍囬」鐩殑鎬绘暟
+            TendertotalCount += saveTenderResults.size();
+
+            for(Integer i = 0;i<saveTenderResults.size();i++) {
+                if(!saveTenderResults.get(i).isSuccess() ){ 
+                    /*if(TenderlogStr.equals('')){
+                        TenderlogStr = '' ;
+                    } */                    
+                    TenderlogStr += updateTenderList.get(i).id +' ,';
+                    //String statusCode = String.ValueOf(saveTenderResults.get(i).getErrors()[0]).split(';')[2].split('=')[1];
+                    //String errorMsg = String.ValueOf(saveTenderResults.get(i).getErrors()[0]).split(';')[1].split('=')[1];
+                    TendererrorStr += '澶辫触鎷涙爣椤圭洰 :'+updateTenderList.get(i).id+'  澶辫触鍘熷洜:'+ String.ValueOf(saveTenderResults.get(i).getErrors()[0]).split(';')[2].split('=')[1] 
+                    +' : '+String.ValueOf(saveTenderResults.get(i).getErrors()[0]).split(';')[1].split('=')[1] + '\r\n';
+                    TenderfailedCount++ ;
+                    //灏嗘洿鏂板け璐ョ殑鎷涙姇鏍囬」鐩坊鍔犳帀闆嗗悎涓�
+                    failedTenderList.add(String.valueOf( updateTenderList.get(i).id ).substring(0,15));
+                }
+            }
+            //鏇存柊鎴愬姛鍚�,娓呴櫎鎷涙姇鏍囩殑鍙嶅簲璇环鏍囪瘑
+            List<Tender_information__c> successTenderList = new List<Tender_information__c>();
+            for(Tender_information__c tempTender:TenderList){
+                if(failedTenderList.contains( String.valueOf( tempTender.id ).substring(0,15)  )){
+                    //鏇存柊澶辫触,鍒欎笉娓呴櫎鏍囪瘑
+                }else {
+                    //鏇存柊鎴愬姛,娓呴櫎鏍囪瘑
+                    tempTender.IsReactionOpp__c = false;
+                    successTenderList.add(tempTender);
+                }
+            }
+
+            //娓呴櫎鏍囪瘑
+            if(successTenderList.size()>0){
+                update successTenderList;
+            }
+        }
+        // 2021-07-29  mzy  update   濡傛灉鏈夐渶瑕佸弽搴旇浠风殑鍦ㄨ蛋涓嬮潰閫昏緫   end
+    }
+
+    global void finish(Database.BatchableContext BC) {
+
+        UpdateTenderInformationSchedule.assignOneHours();
+        BatchIF_Log__c TenderIfLog = new BatchIF_Log__c();
+        TenderIfLog.Type__c = 'UpdateTenderInformationBatchByTenderErrorLog';
+
+        if (TenderlogStr.length() > 60000) {
+            TenderlogStr = TenderlogStr.substring(0, 60000);
+        }
+        TenderIfLog.Log__c = TenderlogStr;
+        TenderIfLog.Log__c += '\n end';
+        if (TendererrorStr.length() > 60000) {
+            TenderIfLog.ErrorLog__c = TendererrorStr.substring(0, 60000);
+        } else {
+            TenderIfLog.ErrorLog__c = TendererrorStr.substring(0, TendererrorStr.length());
+        }
+
+        insert TenderIfLog;
+
+        emailMessages.add('澶辫触鏃ュ織ID涓猴細' + TenderIfLog.Id + '\r\n澶辫触淇℃伅:\r\n'+TendererrorStr);
+
+        //鍙戦�侀偖浠�
+        sendFieldEmail();
+
+    }
+    //鎵归噺鏇存柊鎷涙姇鏍囩殑璇环淇℃伅
+    @AuraEnabled
+    WebService static String updateOpportunityInformation(List<String> TenderIdList){
+        //瀛樺偍閿欒淇℃伅
+        String errorMessage = '';
+        //鐩殑 : 濡傛灉Batch鎵ц澶辫触,鍒欐暣浣搑ollback,鏍囪瘑涓嶈繘琛屾竻闄�
+        //瀹氫箟List灏佽闇�瑕佹洿鏂扮殑鎷涙爣椤圭洰
+        List<Tender_information__c> updateTenderList = new List<Tender_information__c>();
+        try{
+
+            Set<String> BiddingProjectID = new Set<String>();
+            for(String TenderId:TenderIdList){                  
+                BiddingProjectID.add(TenderId);
+            }
+            //鏌ヨ鎷涙姇鏍囦俊鎭�
+            List<Tender_information__c> tenderList = [SELECT Id,IsBid__c,NotBidApprovalStatus__c FROM Tender_information__c where id in :BiddingProjectID];
+            Map<String,Tender_information__c> tenderMap = new Map<String,Tender_information__c>();
+            for(Tender_information__c tempTender :tenderList){
+                tenderMap.put( String.valueOf( tempTender.Id ).substring(0,15) ,tempTender);
+            }
+
+            //鏌ヨ鎷涙爣椤圭洰涓嬬殑鎵�鏈夎浠�
+            Map<String,List<Opportunity>> BiddingProjectOppMap = findTenderRelativeOpp(BiddingProjectID);
+
+            //璁$畻璇环鏁伴噺
+            List<Tender_information__c> updateTenderNumList = updateOpportunityNum(BiddingProjectOppMap);
+
+            //璁$畻璇环鐘舵��
+            List<Tender_information__c> updateTenderNumStatusList = updateOpportunityStatus(BiddingProjectOppMap,updateTenderNumList,tenderMap);
+
+            updateTenderList.addAll(updateTenderNumStatusList);
+
+            //鏇存柊
+            if(updateTenderList.size()>0){
+                List<String> failedTenderList = new List<String>();
+                // add 鍙湁绌烘洿鏂版嫑鎶曟爣鐨勬椂鍊欒蛋鎷涙姇鏍囪Е鍙戝櫒 fxk 2021/9/28 Star
+                StaticParameter.EscapeOtherUpdateTenOwner = false;     
+                Database.SaveResult[] saveTenderResults = Database.update(updateTenderList,false);
+                StaticParameter.EscapeOtherUpdateTenOwner = true; 
+                // add 鍙湁绌烘洿鏂版嫑鎶曟爣鐨勬椂鍊欒蛋鎷涙姇鏍囪Е鍙戝櫒 fxk 2021/9/28 End
+
+                for(Integer i = 0;i<saveTenderResults.size();i++) {
+                    if(!saveTenderResults.get(i).isSuccess()){ 
+                        //String statusCode = String.ValueOf(saveTenderResults.get(i).getErrors()[0]).split(';')[2].split('=')[1];
+                        //String errorMsg = String.ValueOf(saveTenderResults.get(i).getErrors()[0]).split(';')[1].split('=')[1];
+                        errorMessage += '澶辫触鎷涙爣椤圭洰 :'+updateTenderList.get(i).id+'  澶辫触鍘熷洜:'
+                        + String.ValueOf(saveTenderResults.get(i).getErrors()[0]).split(';')[2].split('=')[1] 
+                        +' : '+String.ValueOf(saveTenderResults.get(i).getErrors()[0]).split(';')[1].split('=')[1] + '\r\n';
+                        //灏嗘洿鏂板け璐ョ殑鎷涙姇鏍囬」鐩坊鍔犳帀闆嗗悎涓�
+                        failedTenderList.add(String.valueOf( updateTenderList.get(i).id ).substring(0,15));
+                    }
+                }
+
+                //鏇存柊鎴愬姛鍚�,娓呴櫎鎷涙姇鏍囩殑鍙嶅簲璇环鏍囪瘑
+                List<Tender_information__c> successTenderList = new List<Tender_information__c>();
+                for(String tempTenderId:TenderIdList){
+                    if(failedTenderList.contains( String.valueOf( tempTenderId ).substring(0,15)  )){
+                        //鏇存柊澶辫触,鍒欎笉娓呴櫎鏍囪瘑
+                    }else {
+                        //鏇存柊鎴愬姛,娓呴櫎鏍囪瘑
+                        Tender_information__c tempTender = new Tender_information__c();
+                        tempTender.Id = String.valueOf( tempTenderId ).substring(0,15);
+                        tempTender.IsReactionOpp__c = false;
+                        successTenderList.add(tempTender);
+                    }
+                }
+
+                //娓呴櫎鏍囪瘑
+                if(successTenderList.size()>0){
+                    update successTenderList;
+                }
+
+            }
+            //璇环娴佺▼鏀瑰杽 fy start
+            System.debug('batch2寮�濮�');
+            Id execBTId = Database.executeBatch(new UpdateTenderInformationBatch2(TenderIdList),100);
+            System.debug('batch2缁撴潫');
+            //璇环娴佺▼鏀瑰杽 fy end
+
+        }catch(NullPointerException ex){         
+            system.debug('aa1:'+ex.getMessage());
+            return '绌烘寚閽� :'+ex.getLineNumber();
+        }catch(Exception ex2){          
+            system.debug('aa2:'+ex2.getMessage());
+            return '鍑洪敊浜�!'+ex2.getMessage();
+        }
+
+        if(String.isNotBlank(errorMessage)){
+            return errorMessage;
+        }
+
+        system.debug('aa');
+        return 'OK';
+
+    }
+
+
+
+    //0.璁$畻璇环鏁伴噺
+    public static List<Tender_information__c> updateOpportunityNum(Map<String,List<Opportunity>> tempMap){       
+        // 鎷涙爣-璇环鍏宠仈淇敼 鑾峰彇鎷涙爣淇℃伅淇敼 20210817 start
+        // List<Tender_information__c> updateTenderNumList = new List<Tender_information__c>();
+        // //閬嶅巻Map鐨刱ey
+        // for(String k : tempMap.keySet()){
+        //     Tender_information__c tempTender = new Tender_information__c();
+        //     tempTender.id = k;
+        //     String fifteenId = String.valueOf(tempTender.Id).subString(0,15);
+        //     tempTender.OpportunityNum__c = tempMap.get(fifteenId).size();
+        //     updateTenderNumList.add(tempTender);
+        // }
+        List<String> tenders = new List<String>();
+        //閬嶅巻Map鐨刱ey
+        for(String k : tempMap.keySet()){
+            tenders.add(k);
+        }
+        // 鑾峰緱鎷涙爣鏁版嵁 鎶婁粠璇环閲屾煡璇㈢殑鎷涙爣瀛楁鎸埌杩欓噷
+        List<Tender_information__c> updateTenderNumList = [SELECT Id, Hospital__c, Hospital1__c, 
+        Hospital2__c, Hospital3__c, Hospital4__c, OwnerId, IsRelateProject__c, IsBid__c, department__c, 
+        subDepartment1__c, subDepartment2__c, subDepartment3__c, subDepartment4__c, NotBidApprovalStatus__c, 
+        OpportunityNum__c, OpportunityStatus__c
+        //20221010  lt SWAG-CHL5XA銆怓Y23璇环鏀瑰杽銆�-缁熻涓绘満鍙版暟 start
+        ,OlyNumberHosts__c, RivalHostsNumber__c, TotalNumberHosts__c
+        //20221010  lt SWAG-CHL5XA銆怓Y23璇环鏀瑰杽銆�-缁熻涓绘満鍙版暟 end
+        FROM Tender_information__c WHERE Id IN :tenders];
+        // 鎷涙爣-璇环鍏宠仈淇敼 20210817 end
+
+        return updateTenderNumList;
+    }
+
+
+    //1.璁$畻璇环鐘舵��
+    //2.璧嬪�煎尰闄�
+    //3.璧嬪�兼垬鐣ョ瀹�
+    //  1)  濡傛灉鎷涙姇鏍囬」鐩殑鍏宠仈鍖婚櫌涓虹┖锛岄偅涔堝氨鏇存柊涓鸿浠风殑鍖婚櫌;
+    //  2)  濡傛灉鎷涙姇鏍囬」鐩殑鍏宠仈涓绘垬鐣ョ瀹や负绌猴紝閭d箞灏辨洿鏂颁负璇环鍒涘缓鏃堕棿鏈�鏃╃殑璇环鐨勬垬鐣ョ瀹わ紱
+    //  3)  濡傛灉鎷涙姇鏍囬」鐩殑鍏宠仈鍓垬鐣ョ瀹や负绌猴紝閭d箞灏辨洿鏂颁负鎺掑悕浼樺厛绾ч珮鐨勬垬鐣ョ瀹や箣澶栫殑鍏朵粬璇环鐨勬垬鐣ョ瀹わ紝涔熸槸浠ュ垱寤烘椂闂存洿鏃╀负鍏堝悗椤哄簭锛�
+    //  4锛� 濡傛灉鏇存柊婊′簡锛屽鐨勬垬鐣ョ瀹ゅ氨涓嶆洿鏂帮紱
+    public static List<Tender_information__c> updateOpportunityStatus(Map<String,List<Opportunity>> BiddingProjectOppMap,List<Tender_information__c> updateTenderNumList,Map<String,Tender_information__c> tenderMap){
+        //璇环鐘舵��
+        //瀹氫箟List灏佽闇�瑕佹洿鏂扮殑鎷涙爣椤圭洰
+        List<Tender_information__c> updateTenderList = new List<Tender_information__c>();
+
+        //閬嶅巻Map鐨刱ey
+        for(Tender_information__c tempTender : updateTenderNumList){
+
+            String fifteenId = String.valueOf(tempTender.Id).subString(0,15);
+            //鑾峰彇褰撳墠鎷涙姇鏍囦笅鐨勮浠�
+            List<Opportunity> BiddingDownOppList= BiddingProjectOppMap.get(fifteenId) == null ? new List<Opportunity>() : BiddingProjectOppMap.get(fifteenId);
+
+            //鑾峰彇褰撳墠鎷涙姇鏍囦笅鐨勮浠风殑鍖婚櫌
+            List<String> OppHospitalList = new List<String>();
+
+            //鍒ゆ柇鐘舵��
+            if(BiddingDownOppList.size() > 0){
+                //<!----  鎵�鏈変汉 ---->
+                //2021-08-09  mzy  濡傛灉鎷涙爣鐨刼wnerid鏄ゥ鏋楀反鏂郴缁熺敤鎴� 灏辨妸璇环鐨勬墍鏈変汉鍐欎笂鍘�
+                // 20210817 鏄笉鏄簲璇ョ洿鎺ュ垽鏂璽ender涓婄殑锛�
+                // if(BiddingDownOppList.get(0).Bidding_Project_Name_Bid__r.OwnerId == '00510000000gmxH'){
+                if(tempTender.OwnerId == '00510000000gmxH'){
+                    tempTender.OwnerId = BiddingDownOppList.get(0).ownerId;
+                }
+                //2021-08-09  mzy  濡傛灉鎷涙爣鐨刼wnerid鏄ゥ鏋楀反鏂郴缁熺敤鎴� 灏辨妸璇环鐨勬墍鏈変汉鍐欎笂鍘�
+                //<!----  鎵�鏈変汉 ---->
+                //<!---- 璇环鐘舵�� start --->
+                //<!--璇环鐘舵��-->
+                //WIN num
+                Integer WinNum = 0;
+                //澶卞崟 num
+                Integer SHDNum = 0;
+                //XLIU-CG98L5銆愬鎵樸�戙�愯瘎浼般�戞柊闇�姹�-鎷涙爣椤圭洰/璇环瀵瑰簲娴佹爣銆佸簾鏍囨敼鍠� fy start
+                //鍙栨秷 num
+                Integer QuxNum = 0;
+                //XLIU-CG98L5銆愬鎵樸�戙�愯瘎浼般�戞柊闇�姹�-鎷涙爣椤圭洰/璇环瀵瑰簲娴佹爣銆佸簾鏍囨敼鍠� fy end
+                //涓爣 2022-6-29 yjk
+                Integer bidNum = 0;
+                //瀵规墜涓爣 2022-6-29 yjk
+                Integer loseNum = 0;
+
+                //20221010  lt SWAG-CHL5XA銆怓Y23璇环鏀瑰杽銆�-缁熻涓绘満鍙版暟 start
+                tempTender.OlyNumberHosts__c = 0;
+                tempTender.RivalHostsNumber__c = 0;
+                tempTender.TotalNumberHosts__c = 0;
+
+                Decimal OlyNum = 0;
+                Decimal RivalNum = 0;
+                Decimal TotalNum = 0;
+                //20221010  lt SWAG-CHL5XA銆怓Y23璇环鏀瑰杽銆�-缁熻涓绘満鍙版暟 end
+
+                //鑾峰彇褰撳墠key鐨凩ist
+                for(Opportunity tempOp :BiddingDownOppList){
+
+                    //20221010  lt SWAG-CHL5XA銆怓Y23璇环鏀瑰杽銆�-缁熻涓绘満鍙版暟 start
+                    System.debug('lt123---------------------------------------');
+
+                    if(tempOp.OlyNumberHosts__c == null){
+                        tempOp.OlyNumberHosts__c = 0;
+                    }
+                    if(tempOp.RivalHostsNumber__c == null){
+                        tempOp.RivalHostsNumber__c = 0;
+                    }
+
+                    OlyNum += tempOp.OlyNumberHosts__c;
+                    RivalNum += tempOp.RivalHostsNumber__c;
+                    TotalNum += tempOp.InquireNumberHosts__c;
+                    //20221010  lt SWAG-CHL5XA銆怓Y23璇环鏀瑰杽銆�-缁熻涓绘満鍙版暟 end
+
+                // 鏉庢収濞熷娉� 锛� 杩欓噷璇锋浛鎹㈡垚<SAP涓婁紶(WIN)>鏍囪瘑鍒ゆ柇
+                    //<!--璇环鐘舵��-->
+                    if(tempOp.SAP_Send_OK__c || '瀹屾瘯'.equals(tempOp.StageName__c)){ // 2022-6-2 yjk SWAG-CEP9G8
+                      //win 
+                      WinNum += 1; 
+                    }
+                    //XLIU-CG98L5銆愬鎵樸�戙�愯瘎浼般�戞柊闇�姹�-鎷涙爣椤圭洰/璇环瀵瑰簲娴佹爣銆佸簾鏍囨敼鍠� fy start
+                    // else if(tempOp.StageName__c.equals('澶卞崟') || tempOp.StageName__c.equals('鍙栨秷')){ //2022-5-23 yjk SWAG-CEP9G8
+                    //   //澶卞崟  
+                    //   SHDNum += 1;
+                    // }
+                    else if(tempOp.StageName__c.equals('澶卞崟')){ //2022-5-23 yjk SWAG-CEP9G8
+                            //澶卞崟  
+                        SHDNum += 1;
+                    }
+                    else if(tempOp.StageName__c.equals('鍙栨秷')){ //2022-5-23 yjk SWAG-CEP9G8
+                            //澶卞崟  
+                            QuxNum += 1;
+                    }
+                    //XLIU-CG98L5銆愬鎵樸�戙�愯瘎浼般�戞柊闇�姹�-鎷涙爣椤圭洰/璇环瀵瑰簲娴佹爣銆佸簾鏍囨敼鍠� fy end
+                    //鑾峰彇璇环鐨勫尰闄�(鐩稿叧鎬ф椂鐢�)
+                    if(!OppHospitalList.contains(tempOp.Hospital__c)&&tempOp.Hospital__c!=null){
+                        OppHospitalList.add(tempOp.Hospital__c);
+                    }
+
+                    //2022-6-29 yjk 涓爣纭璧嬪�� start
+                    if('OLY涓爣'.equals(tempOp.ConfirmationofAward__c)){
+                        bidNum++;
+                    }else if('绔炰簤瀵规墜涓爣'.equals(tempOp.ConfirmationofAward__c)){
+                        loseNum++;
+                    }
+                    //2022-6-29 yjk 涓爣纭璧嬪�� end
+
+                }
+
+                //20221010  lt SWAG-CHL5XA銆怓Y23璇环鏀瑰杽銆�-缁熻涓绘満鍙版暟 start
+                tempTender.OlyNumberHosts__c = OlyNum;
+                tempTender.RivalHostsNumber__c = RivalNum;
+                tempTender.TotalNumberHosts__c = TotalNum;
+                //20221010  lt SWAG-CHL5XA銆怓Y23璇环鏀瑰杽銆�-缁熻涓绘満鍙版暟 end
+
+                //<!--璇环鐘舵��-->
+                if(WinNum == BiddingDownOppList.size()){
+                    //鍏ㄩ儴涓篧in,OLY纭鐘舵�� 涓� 鎴愪氦
+                    tempTender.OpportunityStatus__c = '鎴愪氦';
+                }else if(SHDNum == BiddingDownOppList.size()){
+                    //鍏ㄩ儴涓哄け鍗�.鐘舵�佷负 澶卞崟
+                    tempTender.OpportunityStatus__c = '澶卞崟';
+                }else if(WinNum>0&&SHDNum>0&&(WinNum + SHDNum) == BiddingDownOppList.size() ){
+                    //閮ㄥ垎Win,閮ㄥ垎澶卞崟鏃�, 鐘舵�佷负  閮ㄥ垎鎴愪氦
+                    tempTender.OpportunityStatus__c = '閮ㄥ垎鎴愪氦';
+                }
+                //XLIU-CG98L5銆愬鎵樸�戙�愯瘎浼般�戞柊闇�姹�-鎷涙爣椤圭洰/璇环瀵瑰簲娴佹爣銆佸簾鏍囨敼鍠� fy start
+                else if(QuxNum == BiddingDownOppList.size()){
+                        //鍏ㄩ儴涓哄彇娑�.鐘舵�佷负 鍙栨秷
+                    tempTender.OpportunityStatus__c = '鍙栨秷';
+                }
+                //XLIU-CG98L5銆愬鎵樸�戙�愯瘎浼般�戞柊闇�姹�-鎷涙爣椤圭洰/璇环瀵瑰簲娴佹爣銆佸簾鏍囨敼鍠� fy end
+                else if(tempTender.OpportunityNum__c > 0){
+                    //濡傛灉璇环鏁伴噺澶т簬0鐨勮瘽灏辨槸 璺熻繘涓�
+                    tempTender.OpportunityStatus__c = '璺熻繘涓�';
+                }else{
+                    //鍏朵粬閮芥槸 ''
+                    tempTender.OpportunityStatus__c = '';
+                }
+                //<!---- 璇环鐘舵��  end --->
+
+                //2022-6-29 yjk 涓爣纭璧嬪�� start
+                if(bidNum > 0 && loseNum == 0){
+                    tempTender.ConfirmationofAward__c = 'OLY涓爣';
+                }else if(loseNum > 0 && bidNum == 0){
+                    tempTender.ConfirmationofAward__c = '绔炰簤瀵规墜涓爣';
+                }else if(bidNum > 0 && loseNum > 0){
+                    tempTender.ConfirmationofAward__c = '閮ㄥ垎OLY涓爣';
+                }
+
+
+                //2022-6-29 yjk 涓爣纭璧嬪�� end
+
+                //<!------ 鐩稿叧鎬� 淇℃伅   start ----> 
+                //瀹氫箟Map瀛樻斁褰撳墠鎷涙姇鏍囬」鐩殑浜斾釜鍖婚櫌
+                Map<String,String> fiveHospitalMap = new Map<String,String>();
+                // 鎷涙爣-璇环鍏宠仈淇敼 杩欓噷鏄笉鏄彲浠ョ洿鎺ヤ粠褰撳墠鎷涙爣閲屽垵濮嬪寲锛熻浠蜂笂涓嶅啀鍏宠仈鍗曚竴鐨勬嫑鏍囬」鐩簡 20210818 start
+                // fiveHospitalMap.put('Hospital__c',BiddingDownOppList.get(0).Bidding_Project_Name_Bid__r.Hospital__c);
+                // fiveHospitalMap.put('Hospital1__c',BiddingDownOppList.get(0).Bidding_Project_Name_Bid__r.Hospital1__c);
+                // fiveHospitalMap.put('Hospital2__c',BiddingDownOppList.get(0).Bidding_Project_Name_Bid__r.Hospital2__c);
+                // fiveHospitalMap.put('Hospital3__c',BiddingDownOppList.get(0).Bidding_Project_Name_Bid__r.Hospital3__c);
+                // fiveHospitalMap.put('Hospital4__c',BiddingDownOppList.get(0).Bidding_Project_Name_Bid__r.Hospital4__c);
+                fiveHospitalMap.put('Hospital__c', tempTender.Hospital__c);
+                fiveHospitalMap.put('Hospital1__c', tempTender.Hospital1__c);
+                fiveHospitalMap.put('Hospital2__c', tempTender.Hospital2__c);
+                fiveHospitalMap.put('Hospital3__c', tempTender.Hospital3__c);
+                fiveHospitalMap.put('Hospital4__c', tempTender.Hospital4__c);
+                // 鎷涙爣-璇环鍏宠仈淇敼 20210818 end
+
+                //濡傛灉鎷涙姇鏍囬」鐩殑 鏄惁鐩稿叧 瀛楁涓嶄负鍚� , 骞朵笖 鐩稿叧鍖婚櫌 鐩稿叧鎴樼暐绉戝 鐩稿叧鏅�氱瀹� 涓虹┖鏃�,鍒欐洿鏂� 涓鸿浠风殑 鍖婚櫌 鎴樼暐绉戝 瀹㈡埛鍚�
+                // 鎷涙爣-璇环鍏宠仈淇敼 鍚屼笂淇敼 浠庡綋鍓嶆嫑鏍囩殑鏁版嵁閲岃幏寰楀垽鏂潯浠� 20210818 start
+                // if(!'鍚�'.equals(BiddingDownOppList.get(0).Bidding_Project_Name_Bid__r.IsRelateProject__c)){
+                if(!'鍚�'.equals(tempTender.IsRelateProject__c)){
+                // 鎷涙爣-璇环鍏宠仈淇敼 20210818 end
+                    //涓�.鍏宠仈鍖婚櫌
+                    //閬嶅巻鎷涙姇鏍囬」鐩笅鎵�鏈夎浠风殑鍖婚櫌,缁欐嫑鎶曟爣椤圭洰鐨�5涓尰闄㈣祴鍊� ---start
+                    //閬嶅巻鎷涙姇鏍囬」鐩笅鎵�鏈夎浠风殑鍖婚櫌
+                    if(OppHospitalList.size()>0){                        
+                        for(Integer i = 0; i<OppHospitalList.size();i++){
+                            //褰撴嫑鎶曟爣椤圭洰鐨勪簲涓尰闄㈣祴鍊煎畬鎴愬悗涓嶅啀璧嬪��
+                            Boolean HospitalIsNeedBreak = false;
+                            for(String ApiName :fiveHospitalMap.keySet()){
+                                HospitalIsNeedBreak = fiveHospitalMap.get(ApiName)==null?false:true;
+                            }
+                            
+                            if(HospitalIsNeedBreak){
+                                break;
+                            }
+
+                            //缁欐嫑鎶曟爣椤圭洰鐨�5涓尰闄㈣鍊�
+                            for(String ApiName : fiveHospitalMap.keySet()){
+                                String tempTenderHospId = fiveHospitalMap.get(ApiName)==null?'':fiveHospitalMap.get(ApiName);
+                                String oppHospId = OppHospitalList.get(i); 
+                                //濡傛灉鎷涙爣椤圭洰宸茬粡鏈夎鍖婚櫌灏卞垽鏂笅涓�涓浠风殑鍖婚櫌
+                                if(tempTenderHospId.contains(oppHospId)){
+                                    break;
+                                }
+
+                                //鍖婚櫌涓虹┖,璧嬪�煎尰闄�(璧嬪�间箣鍚庤繘琛岃祴鍊间笅涓�涓尰闄�)
+                                if(String.isBlank( fiveHospitalMap.get(ApiName) )){
+                                    fiveHospitalMap.put(ApiName,oppHospId);
+                                    break;
+                                }
+                            }
+
+                        }
+                    }
+
+                    //璧嬪�煎尰闄�
+                    tempTender.Hospital__c = fiveHospitalMap.get('Hospital__c');
+                    tempTender.Hospital1__c = fiveHospitalMap.get('Hospital1__c');
+                    tempTender.Hospital2__c = fiveHospitalMap.get('Hospital2__c');
+                    tempTender.Hospital3__c = fiveHospitalMap.get('Hospital3__c');
+                    tempTender.Hospital4__c = fiveHospitalMap.get('Hospital4__c');
+                    //閬嶅巻鎷涙姇鏍囬」鐩笅鎵�鏈夎浠风殑鍖婚櫌,缁欐嫑鎶曟爣椤圭洰鐨�5涓尰闄㈣祴鍊� ---end
+
+                }
+
+                //濡傛灉 鏄惁鐩稿叧 瀛楁宸茬粡閫夋嫨鍚�, 灏变笉搴旇鏇存柊鐩稿叧鍙婄浉鍏崇殑鐩稿叧淇℃伅
+                // 鎷涙爣-璇环鍏宠仈淇敼 鍚屼笂淇敼 浠庡綋鍓嶆嫑鏍囩殑鏁版嵁閲岃幏寰楀垽鏂潯浠� 20210818 start
+                // if(!'鍚�'.equals(BiddingDownOppList.get(0).Bidding_Project_Name_Bid__r.IsRelateProject__c)
+                //     &&!'鏄�'.equals(BiddingDownOppList.get(0).Bidding_Project_Name_Bid__r.IsRelateProject__c)){
+                //     tempTender.IsRelateProject__c = '鏄�';     
+                // }
+                if(!'鍚�'.equals(tempTender.IsRelateProject__c)
+                    &&!'鏄�'.equals(tempTender.IsRelateProject__c)){
+                    tempTender.IsRelateProject__c = '鏄�';     
+                }
+                // 鎷涙爣-璇环鍏宠仈淇敼 20210818 end
+                //<!------ 鐩稿叧鎬� 淇℃伅   end ---->
+
+                //<!------ 搴旀爣 淇℃伅    start---->
+                //2021-08-09   mzy   鍏宠仈璇环鎴愬姛鍚�,涓嶉渶瑕佽缃槸鍚﹀簲鏍� 涓� 鏄�
+                //濡傛灉 鏄惁搴旀爣 瀛楁宸茬粡閫夋嫨鍚�,灏变笉搴旇鏇存柊搴旀爣鍙婄浉鍏崇殑鐩稿叧淇℃伅
+                //if(!'鍚�'.equals(BiddingDownOppList.get(0).Bidding_Project_Name_Bid__r.IsBid__c)
+                //    &&!'鏄�'.equals(BiddingDownOppList.get(0).Bidding_Project_Name_Bid__r.IsBid__c)){
+                //    tempTender.IsBid__c = '鏄�';     
+                //}
+                //2021-08-09  mzy  鍏宠仈璇环鎴愬姛鍚�,涓嶉渶瑕佽缃槸鍚﹀簲鏍� 涓� 鏄�
+                //<!------ 搴旀爣 淇℃伅    end---->
+
+            }else {
+                //娓呯┖
+                tempTender.OpportunityStatus__c = '';
+            }
+            updateTenderList.add(tempTender);
+        }
+
+
+        return updateTenderList;
+
+    }
+
+
+    //鏌ヨ鎷涙爣椤圭洰涓嬬殑鎵�鏈夎浠�
+    //param : 闇�瑕佹煡璇㈢殑鎷涙爣椤圭洰Id
+    //return Map<鎷涙姇鏍囬」鐩甀d,List<璇环>>
+    public static Map<String,List<Opportunity>> findTenderRelativeOpp(Set<String>  BiddingProjectID){
+        //瀹氫箟Map灏佽鏁版嵁
+        Map<String,List<Opportunity>> BiddingProjectOppMap = new Map<String,List<Opportunity>>();
+        //鏌ヨ鎷涙爣椤圭洰涓嬬殑鎵�鏈夎浠�
+        // 鎷涙爣-璇环鍏宠仈淇敼 澶氬澶氬叧绯诲搴� 浠庡叧鑱旇〃涓幏鍙栬浠� 20210818 start
+        List<Tender_Opportunity_Link__c> links = [SELECT Id, Tender_information__c, Opportunity__c FROM Tender_Opportunity_Link__c WHERE Tender_information__c in :BiddingProjectID];
+        List<String> oppIds = new List<String>();
+        for (Tender_Opportunity_Link__c link : links) {
+            // 澶氬澶氬叧绯� 闇�瑕佸幓閲�
+            if (oppIds.contains(link.Opportunity__c)) {
+                continue;
+            }
+            oppIds.add(link.Opportunity__c);
+        }
+        List<Opportunity> allRelativeOppList = [SELECT Id ,AccountId,Hospital__c,Department_Class__c,SAP_Send_OK__c,CreatedDate, Whether_Bidding__c,
+        Old_BiddingProject_Bid__c, OwnerId, StageName__c, Bidding_Project_Name_Bid__c, ConfirmationofAward__c
+        //20221010  lt SWAG-CHL5XA銆怓Y23璇环鏀瑰杽銆�-缁熻涓绘満鍙版暟 start
+        ,OlyNumberHosts__c, RivalHostsNumber__c, InquireNumberHosts__c
+        //20221010  lt SWAG-CHL5XA銆怓Y23璇环鏀瑰杽銆�-缁熻涓绘満鍙版暟 end
+        FROM Opportunity WHERE Id in :oppIds ORDER By createdDate ASC];
+        // List<Opportunity> allRelativeOppList = [SELECT Id ,AccountId,Hospital__c,Department_Class__c,SAP_Send_OK__c,CreatedDate, Whether_Bidding__c,
+        // Old_BiddingProject_Bid__c,Bidding_Project_Name_Bid__c ,StageName__c ,Bidding_Project_Name_Bid__r.Hospital__c,Bidding_Project_Name_Bid__r.Hospital1__c,
+        // Bidding_Project_Name_Bid__r.Hospital2__c,Bidding_Project_Name_Bid__r.Hospital3__c,Bidding_Project_Name_Bid__r.Hospital4__c,
+        // Bidding_Project_Name_Bid__r.OwnerId,OwnerId,
+        // Bidding_Project_Name_Bid__r.IsRelateProject__c ,Bidding_Project_Name_Bid__r.IsBid__c ,Bidding_Project_Name_Bid__r.department__c,
+        // Bidding_Project_Name_Bid__r.subDepartment1__c,Bidding_Project_Name_Bid__r.subDepartment2__c,Bidding_Project_Name_Bid__r.subDepartment3__c,
+        // Bidding_Project_Name_Bid__r.subDepartment4__c FROM Opportunity WHERE Bidding_Project_Name_Bid__c in :BiddingProjectID ORDER By createdDate ASC];
+       
+        //閬嶅巻璇环闆嗗悎
+        //2.鎸夊垱寤烘椂闂存帓搴�(姝e簭),鍒涘缓map
+        for(Opportunity tempOp :allRelativeOppList){
+            // 寰幆link锛屾壘鍒拌浠峰搴旂殑鎷涙爣
+            for (Tender_Opportunity_Link__c link : links) {
+                if (link.Opportunity__c == tempOp.Id) {
+                    String fifteenTenderId = String.valueOf(link.Tender_information__c).subString(0,15);
+                    //Map閲岄潰娌℃湁淇濆瓨褰撳墠璇环鐨勬嫑鏍囬」鐩笅鐨勮浠�
+                    if(!BiddingProjectOppMap.containsKey(fifteenTenderId)){
+                        //绗竴娆″瓨鏀�
+                        List<Opportunity> tempOppList = new List<Opportunity>();
+                        tempOppList.add(tempOp);
+                        BiddingProjectOppMap.put(fifteenTenderId,tempOppList);
+                    }else {
+                        //浠ュ悗瀛樻斁
+                        List<Opportunity> tempOppListE = BiddingProjectOppMap.get(fifteenTenderId);
+                        tempOppListE.add(tempOp);
+                        BiddingProjectOppMap.put(fifteenTenderId,tempOppListE);
+                    }
+                }
+            }
+            //鍒ゆ柇褰撳墠璇环鏄惁鏈夋嫑鏍囬」鐩�
+            // if(tempOp.Bidding_Project_Name_Bid__c!=null){
+            //     String fifteenTenderId = String.valueOf(tempOp.Bidding_Project_Name_Bid__c).subString(0,15);
+            //     //Map閲岄潰娌℃湁淇濆瓨褰撳墠璇环鐨勬嫑鏍囬」鐩笅鐨勮浠�
+            //     if(!BiddingProjectOppMap.containsKey(fifteenTenderId)){
+            //         //绗竴娆″瓨鏀�
+            //         List<Opportunity> tempOppList = new List<Opportunity>();
+            //         tempOppList.add(tempOp);
+            //         BiddingProjectOppMap.put(fifteenTenderId,tempOppList);
+            //     }else {
+            //         //浠ュ悗瀛樻斁
+            //         List<Opportunity> tempOppListE =BiddingProjectOppMap.get(fifteenTenderId);
+            //         tempOppListE.add(tempOp);
+            //         BiddingProjectOppMap.put(fifteenTenderId,tempOppListE);
+            //     } 
+            // }
+        }
+        //瀹屽杽Map : 璇环涓�0鐨勬嫑鎶曟爣椤圭洰搴旇涔熸湁涓�鍒�
+        for(String TenderId : BiddingProjectID){
+            String fifteenTenderId = TenderId.subString(0,15);
+            if(!BiddingProjectOppMap.containsKey(fifteenTenderId)){
+                List<Opportunity> tempOppList = new List<Opportunity>();
+                BiddingProjectOppMap.put(fifteenTenderId,tempOppList);
+            }
+        }
+
+        return BiddingProjectOppMap;
+    }
+
+
+    // 鍙戦�佹彁閱掗偖浠�
+    private void sendFieldEmail() {
+        PretechBatchEmailUtil be = new PretechBatchEmailUtil();
+        String[] toList = new String[] {UserInfo.getUserEmail()};
+        String title = '鎷涙爣椤圭洰璇环鐘舵�佸拰璇环鏁伴噺鏇存柊澶辫触';
+        //String[] ccList = new String[] {'Xiaochen_You@olympus.com.cn'};
+        String[] ccList = new String[] {'miaoziyang@prec-tech.com'};
+        if (System.Test.isRunningTest()) {
+            be.successMail('', 1);
+        }
+        if (emailMessages.size() > 0 && TenderfailedCount > 0) {
+            be.failedMail(toList, ccList, title, this.emailMessages.get(0)+'\n',
+                            TendertotalCount, TendertotalCount - TenderfailedCount, TenderfailedCount,'',true);
+            if(!Test.isRunningTest()){
+                be.send();
+            }
+        }       
+    }
+    
+    public static void justForTest() {
+        Integer i = 0;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+             i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+             i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/UpdateTenderInformationBatch.cls-meta.xml b/force-app/main/default/classes/UpdateTenderInformationBatch.cls-meta.xml
new file mode 100644
index 0000000..e3d1b51
--- /dev/null
+++ b/force-app/main/default/classes/UpdateTenderInformationBatch.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>45.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/loanerArrangedEmailController.cls b/force-app/main/default/classes/loanerArrangedEmailController.cls
new file mode 100644
index 0000000..bb34d2f
--- /dev/null
+++ b/force-app/main/default/classes/loanerArrangedEmailController.cls
@@ -0,0 +1,95 @@
+public with sharing class loanerArrangedEmailController {
+
+	
+
+    public loanerArrangedEmailController() {
+    }
+
+    @AuraEnabled
+    public static InitData init(String recordId) {
+    	String statusSting = Label.StatusProcessState;
+		List<String> status = statusSting.split(',');
+    	InitData res = new InitData();
+    	try {
+    	    Rental_Apply__c rac = [SELECT Id, Status__c, Campaign__c, RC_return_to_office__c, Repair_Final_Inspection_Date_F__c, Repair__c, Assigned_Not_Shipment__c, Demo_purpose1__c, Contract_pdf_updated__c, Wei_Assigned_Cnt__c from Rental_Apply__c where Id = :recordId];
+
+    	    if( rac.Campaign__c != null ){
+    	    	//鑾峰彇瀛︿細瀵硅薄
+    	    	Campaign camp = [select Id, Status, Rental_Apply_Flag__c,IF_Approved__c,Approved_Status__c, Meeting_Approved_No__c from Campaign where id = :rac.Campaign__c];
+    	    	res.CampaignId = camp.Id;
+    	    	res.CampaignStatus = camp.Status;
+    	    	res.IFApproved = camp.IF_Approved__c;
+	    	    res.MeetingApprovedNo = camp.Meeting_Approved_No__c;
+	    	    res.ApprovedStatus = camp.Approved_Status__c;
+    	    }   
+    	    res.Id = recordId;   
+    	    res.RaStatus = rac.Status__c;
+    	    res.WeiAssignedCnt = Integer.valueOf(rac.Wei_Assigned_Cnt__c);
+    	    res.AssignedNotShipment = Integer.valueOf(rac.Assigned_Not_Shipment__c);
+    	    res.DemoPurpose1 = rac.Demo_purpose1__c;
+    	    res.ContractPdfUpdated = rac.Contract_pdf_updated__c;
+    	    res.RepairId = rac.Repair__c;
+    	    res.RepairFinalInspectionDateF = rac.Repair_Final_Inspection_Date_F__c;
+    	    res.RCReturnToOffice = rac.RC_return_to_office__c;
+    	    res.StatusList = status;
+    	}
+    	catch (Exception e) {
+    	    System.debug(LoggingLevel.INFO, '****e:' + e);
+    	}
+    	system.debug('res======'+res);
+    	return res;
+    }
+
+    
+    //鑾峰彇澶囧搧鍊熷嚭涓�鏍�
+    @AuraEnabled
+    public static Integer getRentalApplyEquipmentSet(String recordId) {
+    	Rental_Apply__c tempRa = [SELECT Id, Bollow_Date__c from Rental_Apply__c where Id = :recordId];
+    	List<Rental_Apply_Equipment_Set__c> tempRaEquipSetList = new List<Rental_Apply_Equipment_Set__c>();
+    	Integer pageLength ;
+    	if(tempRa.Bollow_Date__c != null) {
+    		tempRaEquipSetList = [SELECT Id from Rental_Apply_Equipment_Set__c where Rental_Apply__c = :recordId AND Shippment_loaner_time__c != null and RAES_Status__c != '宸插垎閰�' and RAES_Status__c != '鍙栨秷鍒嗛厤'];
+    	}else {
+    		tempRaEquipSetList = [SELECT Id from Rental_Apply_Equipment_Set__c where Rental_Apply__c = :recordId AND RAES_Status__c != '宸插垎閰�' and RAES_Status__c != '鍙栨秷鍒嗛厤'];
+    	}
+    	//
+    	if(tempRaEquipSetList.size()>0) {
+			Integer setLength = tempRaEquipSetList.size();
+			pageLength = Math.mod(setLength,10) == 0 ? setLength/10 : Math.round(setLength) + 1;
+    	}
+    	return pageLength;
+    }
+
+    public class InitData{
+		@AuraEnabled
+		public String Id;
+		@AuraEnabled
+		public String CampaignStatus;	//瀛︿細鐘舵��
+		@AuraEnabled
+		public String CampaignId;	//瀛︿細Id
+		@AuraEnabled
+		public String RaStatus;		//澶囧搧鍊熷嚭鐢宠鐘舵��
+		@AuraEnabled
+		public Integer WeiAssignedCnt;		//鏈垎閰嶄欢鏁�  Wei_Assigned_Cnt__c
+		@AuraEnabled
+		public Integer AssignedNotShipment;	//宸插垎閰嶆湭鍑哄簱鎸囩ず  Assigned_Not_Shipment__c
+		@AuraEnabled
+		public String DemoPurpose1;			//浣跨敤鐩殑1	 Demo_purpose1__c
+		@AuraEnabled
+		public Boolean ContractPdfUpdated;	//鍚堝悓涔﹀凡涓婁紶	Contract_pdf_updated__c
+		@AuraEnabled
+		public String RepairId;				//瀛︿細.淇悊Id
+		@AuraEnabled
+		public Date RepairFinalInspectionDateF;		//淇悊鏈�缁堟娴嬫棩F  	Repair_Final_Inspection_Date_F__c
+		@AuraEnabled
+		public Date RCReturnToOffice;		//RC淇悊鍝佽繑閫佹棩		RC_return_to_office__c
+		@AuraEnabled
+		public Boolean IFApproved;			//瀛︿細.鏄惁闇�瑕佺敵璇峰喅瑁�
+		@AuraEnabled
+		public String MeetingApprovedNo;	//瀛︿細.浼氳鍐宠缂栫爜
+		@AuraEnabled
+		public String ApprovedStatus;		//瀛︿細.鍐宠鐘舵��	Approved_Status__c
+		@AuraEnabled
+		public List<String> StatusList;
+	}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/loanerArrangedEmailController.cls-meta.xml b/force-app/main/default/classes/loanerArrangedEmailController.cls-meta.xml
new file mode 100644
index 0000000..d75b058
--- /dev/null
+++ b/force-app/main/default/classes/loanerArrangedEmailController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>51.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/rentalApplyEquipmentRentalPDFController.cls b/force-app/main/default/classes/rentalApplyEquipmentRentalPDFController.cls
new file mode 100644
index 0000000..9959c74
--- /dev/null
+++ b/force-app/main/default/classes/rentalApplyEquipmentRentalPDFController.cls
@@ -0,0 +1,25 @@
+public with sharing class rentalApplyEquipmentRentalPDFController {
+    public rentalApplyEquipmentRentalPDFController() {
+        
+    }
+    @AuraEnabled
+    public static InitData initJumptoPDFButton(String recordId) {
+    	InitData res = new InitData();
+    	try {
+    		List<Rental_Apply_Equipment_Set__c> raeSet = [SELECT Id from Rental_Apply_Equipment_Set__c where Rental_Apply__c = :recordId and Yi_Shipment_request__c > 0 and RAES_Status__c != '鍙栨秷'];
+    		Integer setLength = raeSet.size();
+    		res.pageLength = Math.mod(setLength,10)== 0 ? setLength/10 : Math.round(setLength) +1 ;
+    	}catch(Exception e){
+    		System.debug(LoggingLevel.INFO, '****e:' + e);
+    	}
+    	return res;
+    }
+
+    public class InitData{
+		@AuraEnabled
+		public String Id;
+		@AuraEnabled
+		public Integer pageLength;
+	}
+    
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/rentalApplyEquipmentRentalPDFController.cls-meta.xml b/force-app/main/default/classes/rentalApplyEquipmentRentalPDFController.cls-meta.xml
new file mode 100644
index 0000000..d75b058
--- /dev/null
+++ b/force-app/main/default/classes/rentalApplyEquipmentRentalPDFController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>51.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/lwc/lexAgencyAuthorize/__tests__/lexAgencyAuthorize.test.js b/force-app/main/default/lwc/lexAgencyAuthorize/__tests__/lexAgencyAuthorize.test.js
new file mode 100644
index 0000000..23a8f06
--- /dev/null
+++ b/force-app/main/default/lwc/lexAgencyAuthorize/__tests__/lexAgencyAuthorize.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexAgencyAuthorize from 'c/lexAgencyAuthorize';
+
+describe('c-lex-agency-authorize', () => {
+    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-agency-authorize', {
+            is: LexAgencyAuthorize
+        });
+
+        // Act
+        document.body.appendChild(element);
+
+        // Assert
+        // const div = element.shadowRoot.querySelector('div');
+        expect(1).toBe(1);
+    });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.css b/force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.css
new file mode 100644
index 0000000..689c97d
--- /dev/null
+++ b/force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.css
@@ -0,0 +1,10 @@
+.inASACEditorHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.html b/force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.html
new file mode 100644
index 0000000..e6785e4
--- /dev/null
+++ b/force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.html
@@ -0,0 +1,6 @@
+<template>
+    <div class="inASACEditorHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={showSuccess}></lightning-button>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.js b/force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.js
new file mode 100644
index 0000000..30da2db
--- /dev/null
+++ b/force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.js
@@ -0,0 +1,198 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-12 14:51:44
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-19 09:11:02
+ */
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init  from '@salesforce/apex/OpportunityLightingButtonController.initForAgencyAuthorizeButton';
+import updateForAgencyAuthorizeButton  from '@salesforce/apex/OpportunityLightingButtonController.updateForAgencyAuthorizeButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import checkDangerItem from '@salesforce/apex/OpportunityWebService.checkDangerItem';
+import oppCheck from '@salesforce/apex/OpportunityWebService.oppCheck';
+import updReg from '@salesforce/apex/OpportunityWebService.updReg';
+
+export default class LexAgencyAuthorize extends LightningElement {
+    @api recordId;
+    agency1Id;
+    stageName;
+    sapSendOK;
+    oppOrderType;
+    ifHave170;
+    ifHaveAH;
+    cntLostCancelDraft;
+    cntLostCancelReport;
+    estimationId;
+    detailNum;
+    estimationDecision;
+    salesRoot;
+    acecideCntCheck;
+    ifSubmit;
+    trade;
+    isCorrosion;
+    profileId;
+    ifAuthorizingLock;
+    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.agency1Id = result.agency1Id;
+            this.stageName = result.stageName;
+            this.sapSendOK = result.sapSendOK;
+            this.oppOrderType = result.oppOrderType;
+            this.ifHave170 = result.ifHave170;
+            this.ifHaveAH = result.ifHaveAH;
+            this.cntLostCancelDraft = result.cntLostCancelDraft;
+            this.cntLostCancelReport = result.cntLostCancelReport;
+            this.estimationId = result.estimationId;
+            this.detailNum = result.detailNum;
+            this.estimationDecision = result.estimationDecision;
+            this.salesRoot = result.salesRoot;
+            this.acecideCntCheck = result.acecideCntCheck;
+            this.ifSubmit = result.ifSubmit;
+            this.trade = result.trade;
+            this.isCorrosion = result.isCorrosion;
+            this.profileId = result.profileId;
+            this.ifAuthorizingLock = result.ifAuthorizingLock;
+            this.AgencyAuthorize();
+        })
+    }
+    AgencyAuthorize(){
+        var btns = document.getElementsByName("agency_authorize");
+        for (var i=0; i<btns.length; i++) {
+        btns[i].disabled = true;
+        btns[i].className = 'btnDisabled';
+        }
+        //2021-10-21 gwy 鐗堟湰鏇存敼涓�51.0
+        var oppid = this.recordId;
+        var angency = this.agency1Id;
+        var profileId = this.profileId;
+        
+        if (profileId != '00e10000000Y3o5' && profileId != '00e10000000Nab7' && profileId != '00e10000000xnpR' && profileId != '00e10000000xyK6' && profileId != '00e10000000NbCE'
+        && profileId != '00e10000000xyK6' && profileId != '00e10000000Nb7i') {
+            this.showToast("鎮ㄦ病鏈夋巿鏉冪敵璇风殑鏉冮檺銆傝鑱旂郴绯荤粺绠$悊鍛樸��","error");
+            return;
+        }
+        if (this.stageName != '寮曞悎' && this.stageName != '璇环' ) {
+            this.showToast("鐘舵��1:" + this.stageName + "銆佷笉鑳藉仛鎺堟潈鐢宠锛�","error");
+            return;
+        } else if (this.sapSendOK == '1') {
+            this.showToast("宸茬粡涓婁紶SAP銆佷笉鑳藉仛鎺堟潈鐢宠浜嗭紒","error");
+            return;
+        } else if (this.oppOrderType != undefined && this.ifHave170 == true) {
+            this.showToast("鑰楁潗涓嶅彲涓�170浜у搧鍚屾椂瀛樺湪锛�","error");
+            return;
+        } else if (this.oppOrderType != undefined && this.ifHaveAH == true) {
+            this.showToast("鑰楁潗涓嶅彲涓庡ゥ杈変骇鍝佸悓鏃跺瓨鍦紒","error");
+            return;
+        } else if (this.cntLostCancelDraft > 0) {
+        if(!confirm('璇环鏈夎崏妗堜腑鐨勫彇娑�/澶卞崟鎶ュ憡锛屾槸鍚︾户缁紵')){
+            return ;
+        }
+        } else if (this.cntLostCancelReport - this.cntLostCancelDraft > 0) {
+            this.showToast('璇环鏈夊凡鎻愪氦鐨勫彇娑�/澶卞崟鎶ュ憡銆�',"error");
+            return;
+        } else if (this.estimationId == undefined || this.detailNum == 0) {
+            this.showToast('鎶ヤ环鏈畬鎴愶紝璇峰厛鎶ヤ环銆�',"error");
+            return;
+        } else if (this.estimationDecision == '1') {
+            this.showToast('鎶ヤ环宸插喅瀹氾紝涓嶈兘杩涜鎺堟潈鐢宠銆�',"error");
+            return;
+        } else if (this.salesRoot != '璨╁2搴�') {
+            this.showToast('鍖婚櫌鐩撮攢涓嶉渶瑕佹巿鏉冪敵璇枫��',"error");
+            return;
+        }
+        // else if ('{!Opportunity.AcecideCntCheck__c}' != '1') {
+        // alert('闃胯タ璧涘璇环鍙兘鍖呭惈鍗卞寲鍝侊紝鎴栬�咃紝鏅�氳浠蜂笉鑳藉寘鍚嵄鍖栧搧銆�');
+        // return;
+        // }
+        else if (this.ifSubmit == '1') {
+            this.showToast('涓婁紶澶辫触锛岃鑱旂郴绯荤粺绠$悊鍛�!',"error");
+            return;
+        }
+        if (this.ifAuthorizingLock == 'true') {
+            this.showToast('璇环姝e湪鎺堟潈涓紝璇蜂笉瑕侀噸澶嶆彁浜ゃ��',"error");
+            return;
+        }
+        if (this.trade == '鍐呰部') {
+            if(this.isCorrosion == '1'){
+                checkDangerItem({
+                    agency1: angency
+                }).then(result=>{
+                    var rtn1 = result;
+                    if (rtn1 != 'OK') {
+                        this.showToast(rtn1,"error");
+                        return;
+                    }
+                    this.update();
+            });
+            }else{
+                oppCheck({
+                    oppid: oppid,
+                    saveFlg: '1'
+                }).then(result=>{
+                    var rtn = result;
+                    if (rtn != 'OK') {
+                        this.showToast(rtn,"error");
+                        return;
+                    }
+                    this.update();
+                })
+            }
+        } else {
+            updReg({
+                oppid: oppid
+            }).then(()=>{
+                this.update();
+            });
+        }  
+    }
+    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 }});
+    }
+    update(){
+        updateForAgencyAuthorizeButton({
+            recordId: this.recordId
+        }).then(result=>{
+            if(result){
+                this.showToast(result,"error");
+            }else{
+                this.updateRecordView(this.recordId);
+                window.open("https://olympus.sharepoint.cn/sites/GSPWF/SitePages/HomePage.aspx");
+                this.showToast('鎻愪氦鎴愬姛銆傝鍦⊿PO绯荤粺涓畬鎴愭巿鏉冪敵璇枫��',"success");
+            }
+            this.IsLoading = false;
+        })
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.js-meta.xml b/force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.js-meta.xml
new file mode 100644
index 0000000..329e839
--- /dev/null
+++ b/force-app/main/default/lwc/lexAgencyAuthorize/lexAgencyAuthorize.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexApplicationCancelSubmit/lexApplicationCancelSubmit.js b/force-app/main/default/lwc/lexApplicationCancelSubmit/lexApplicationCancelSubmit.js
index 9bb6831..ee9ec67 100644
--- a/force-app/main/default/lwc/lexApplicationCancelSubmit/lexApplicationCancelSubmit.js
+++ b/force-app/main/default/lwc/lexApplicationCancelSubmit/lexApplicationCancelSubmit.js
@@ -5,7 +5,7 @@
 import { updateRecord } from 'lightning/uiRecordApi';
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 import submitCancel from '@salesforce/apex/ApplicationButtonController.submitCancel';
-import UserInfo_Owner from '@salesforce/apex/ApplicationButtonController.UserInfo_Owner';
+import userInfo_Owner from '@salesforce/apex/ApplicationButtonController.userInfo_Owner';
 export default class lexApplicationCancelSubmit extends LightningElement {
     @api recordId;//OwnerId
     ownerId;
@@ -31,16 +31,12 @@
                 this.ownerId = result.OwnerId;
                 this.monthlyReportId = result.Id;
                 this.cancelSubmit();
-        }).catch(() => {
-
-        }).finally(() => {
-            
-        });        
+        })       
     }
     //鎺堟潈鐢宠 鍙栨秷鎻愪氦
     cancelSubmit(){
         //'鑾峰彇褰撳墠鐧婚檰浜篿d'
-        UserInfo_Owner({}).then(result=>{
+        userInfo_Owner({}).then(result=>{
             if(this.ownerId == result.id){
                 submitCancel({
                     recordId: this.recordId
diff --git a/force-app/main/default/lwc/lexApplicationSubmitButton/lexApplicationSubmitButton.js b/force-app/main/default/lwc/lexApplicationSubmitButton/lexApplicationSubmitButton.js
index 6a76d14..90688a9 100644
--- a/force-app/main/default/lwc/lexApplicationSubmitButton/lexApplicationSubmitButton.js
+++ b/force-app/main/default/lwc/lexApplicationSubmitButton/lexApplicationSubmitButton.js
@@ -2,7 +2,7 @@
 import { CurrentPageReference } from "lightning/navigation";
 import { CloseActionScreenEvent } from 'lightning/actions';
 import  init  from '@salesforce/apex/ApplicationButtonController.initSubmitButton';
-import UserInfo_Owner from '@salesforce/apex/ApplicationButtonController.UserInfo_Owner';
+import userInfo_Owner from '@salesforce/apex/ApplicationButtonController.userInfo_Owner';
 import submit  from '@salesforce/apex/ApplicationButtonController.submit';
 import { updateRecord } from 'lightning/uiRecordApi';
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
@@ -34,15 +34,13 @@
                 this.id = result.Id;
                 this.Submit();
             }
-        }).catch(() => {
-        }).finally(() => {
-        });        
+        })       
     }
 
     Submit(){
         this.arrMessage = [];
         //鑾峰彇鑾峰彇褰撳墠鐧婚檰浜�
-        UserInfo_Owner({}).then(result=>{
+        userInfo_Owner({}).then(result=>{
             if(this.ownerId == result.id){
                 submit({
                     recordId: this.recordId
diff --git a/force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.css b/force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.css
new file mode 100644
index 0000000..af18c76
--- /dev/null
+++ b/force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.css
@@ -0,0 +1,11 @@
+.Holder{
+	position: relative;
+	display: inline-block;
+	width: 80px;
+	height: 80px;
+	text-align: center;
+}
+
+.container .uiContainerManager{
+	display : none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.html b/force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.html
new file mode 100644
index 0000000..2ef2898
--- /dev/null
+++ b/force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.html
@@ -0,0 +1,5 @@
+<template>
+	<div class="Holder" if:true={IsLoading}>
+      	<lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+  	</div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.js b/force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.js
new file mode 100644
index 0000000..3b0f923
--- /dev/null
+++ b/force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.js
@@ -0,0 +1,38 @@
+import { LightningElement, track, wire, api } from 'lwc';
+import {CurrentPageReference} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+
+export default class lexAssetMaintainDetail extends LightningElement {
+	@api recordId;
+  
+
+    @wire(CurrentPageReference)
+	getStateParameters(currentPageReference){
+		console.log("杩涘叆椤甸潰");
+		console.log(currentPageReference);
+		if(currentPageReference){
+			const urvalue=currentPageReference.state.recordId;
+			if(urvalue){
+				let str=`${urvalue}`;
+				console.log('str');
+				console.log(str);
+				this.recordId=str;
+			}
+		}
+	}
+
+	connectedCallback(){
+
+		this.cancelSubmit().then(res=>{
+			this.IsLoading=false;
+			this.dispatchEvent(new CloseActionScreenEvent());
+		});
+	}
+
+	async cancelSubmit(){
+		window.open('/apex/AssetMaintainDetail?id='+this.recordId,'AssetMaintainDetail', 'width=600,height=200');
+	}
+}
+
+// old js
+// window.open('/apex/AssetMaintainDetail?id={! AssetMaintainHeader__c.Id }');
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.js-meta.xml b/force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.js-meta.xml
new file mode 100644
index 0000000..8d272e7
--- /dev/null
+++ b/force-app/main/default/lwc/lexAssetMaintainDetail/lexAssetMaintainDetail.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexAssetMaintainDetail">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__AppPage</target>
+        <target>lightning__RecordPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.html b/force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.html
new file mode 100644
index 0000000..af9fa97
--- /dev/null
+++ b/force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.html
@@ -0,0 +1,3 @@
+<template>
+
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.js b/force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.js
new file mode 100644
index 0000000..75d71ca
--- /dev/null
+++ b/force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.js
@@ -0,0 +1,35 @@
+import { LightningElement, track, wire, api } from 'lwc';
+import {CurrentPageReference} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+
+export default class lexAssetMaintainPage extends LightningElement {
+	@api recordId;
+  
+
+    @wire(CurrentPageReference)
+	getStateParameters(currentPageReference){
+		console.log("杩涘叆椤甸潰");
+		console.log(currentPageReference);
+		if(currentPageReference){
+			const urvalue=currentPageReference.state.recordId;
+			if(urvalue){
+				let str=`${urvalue}`;
+				console.log('str');
+				console.log(str);
+				this.recordId=str;
+			}
+		}
+	}
+
+	connectedCallback(){
+
+		this.cancelSubmit().then(res=>{
+			this.IsLoading=false;
+			this.dispatchEvent(new CloseActionScreenEvent());
+		});
+	}
+
+	async cancelSubmit(){
+		window.open('/apex/AssetMaintain?id='+this.recordId,'lexAssetMaintainPage', 'width=600,height=200');
+	}
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.js-meta.xml b/force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.js-meta.xml
new file mode 100644
index 0000000..2de4fcc
--- /dev/null
+++ b/force-app/main/default/lwc/lexAssetMaintainPage/lexAssetMaintainPage.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexAssetMaintainPage">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__AppPage</target>
+        <target>lightning__RecordPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexBeforeOPDPDFBtn/__tests__/lexBeforeOPDPDFBtn.test.js b/force-app/main/default/lwc/lexBeforeOPDPDFBtn/__tests__/lexBeforeOPDPDFBtn.test.js
new file mode 100644
index 0000000..e80318e
--- /dev/null
+++ b/force-app/main/default/lwc/lexBeforeOPDPDFBtn/__tests__/lexBeforeOPDPDFBtn.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexBeforeOPDPDFBtn from 'c/lexBeforeOPDPDFBtn';
+
+describe('c-lex-before-opdpdf-btn', () => {
+    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-before-opdpdf-btn', {
+            is: LexBeforeOPDPDFBtn
+        });
+
+        // Act
+        document.body.appendChild(element);
+
+        // Assert
+        // const div = element.shadowRoot.querySelector('div');
+        expect(1).toBe(1);
+    });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.css b/force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.css
new file mode 100644
index 0000000..049e19f
--- /dev/null
+++ b/force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.css
@@ -0,0 +1,10 @@
+.lexBeforeOPDPDFBtnHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.html b/force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.html
new file mode 100644
index 0000000..159518b
--- /dev/null
+++ b/force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.html
@@ -0,0 +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={showToast}></lightning-button>
+        <lightning-button onclick={handleConfirmClick} label="Open Confirm Modal"></lightning-button>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.js b/force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.js
new file mode 100644
index 0000000..babbb46
--- /dev/null
+++ b/force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.js
@@ -0,0 +1,108 @@
+/*
+ * @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';
+import init  from '@salesforce/apex/OpportunityLightingButtonController.initFoBeforeOPDPDFBtnButton';
+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;
+    userId;
+    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.accountId = result.accountId;
+            this.userId = result.userId;
+            this.beforeOPDPDFBtn();
+        })
+    }
+    beforeOPDPDFBtn(){
+        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',
+                    formatField: 'EvaluationPDF_Format__c'
+                }).then(result=>{
+                    var pdfno = result;
+                    addReportOPWithEvaluationPDF({
+                        "repOwnerId": this.userId,
+                        "reportId": "",
+                        "dailyReportId": "",
+                        "eventId": "",
+                        "recordType": "OPD",
+                        "aId": this.accountId,
+                        "visitor1": "",
+                        "visitor2": "",
+                        "visitor3": "",
+                        "visitor4": "",
+                        "visitor5": "",
+                        "opp1": this.recordId,
+                        "opp2": "",
+                        "opp3": "",
+                        "opp4": "",
+                        "opp5": "",
+                        "reportDate": "",
+                        "evaluationPDFNumber": pdfno
+                    }).then(()=>{
+                        // 20220913 ljh WLIG-CHMATN update end
+                        this.IsLoading = false;
+                        window.open('/apex/BeforeOPDPDF?oid=' + this.recordId + '&pdfNo=' + pdfno, 'BeforeOPDPDF');
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                    })
+                });
+                } catch(e) {
+                    this.showToast(e,"error");
+                    this.dispatchEvent(new CloseActionScreenEvent());
+                }
+        }else{
+            window.open('/apex/BeforeOPDPDF?oid=' + this.recordId, 'BeforeOPDPDF');
+            this.dispatchEvent(new CloseActionScreenEvent());
+        }
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.js-meta.xml b/force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.js-meta.xml
new file mode 100644
index 0000000..329e839
--- /dev/null
+++ b/force-app/main/default/lwc/lexBeforeOPDPDFBtn/lexBeforeOPDPDFBtn.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexBeforeOPDPDFBtnSIS/__tests__/lexBeforeOPDPDFBtnSIS.test.js b/force-app/main/default/lwc/lexBeforeOPDPDFBtnSIS/__tests__/lexBeforeOPDPDFBtnSIS.test.js
new file mode 100644
index 0000000..f21bd5a
--- /dev/null
+++ b/force-app/main/default/lwc/lexBeforeOPDPDFBtnSIS/__tests__/lexBeforeOPDPDFBtnSIS.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexBeforeOPDPDFBtnSIS from 'c/lexBeforeOPDPDFBtnSIS';
+
+describe('c-lex-before-opdpdf-btn-sis', () => {
+    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-before-opdpdf-btn-sis', {
+            is: LexBeforeOPDPDFBtnSIS
+        });
+
+        // Act
+        document.body.appendChild(element);
+
+        // Assert
+        // const div = element.shadowRoot.querySelector('div');
+        expect(1).toBe(1);
+    });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexBeforeOPDPDFBtnSIS/lexBeforeOPDPDFBtnSIS.css b/force-app/main/default/lwc/lexBeforeOPDPDFBtnSIS/lexBeforeOPDPDFBtnSIS.css
new file mode 100644
index 0000000..7980084
--- /dev/null
+++ b/force-app/main/default/lwc/lexBeforeOPDPDFBtnSIS/lexBeforeOPDPDFBtnSIS.css
@@ -0,0 +1,10 @@
+.lexBeforeOPDPDFBtnSISHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexBeforeOPDPDFBtnSIS/lexBeforeOPDPDFBtnSIS.html b/force-app/main/default/lwc/lexBeforeOPDPDFBtnSIS/lexBeforeOPDPDFBtnSIS.html
new file mode 100644
index 0000000..234e137
--- /dev/null
+++ b/force-app/main/default/lwc/lexBeforeOPDPDFBtnSIS/lexBeforeOPDPDFBtnSIS.html
@@ -0,0 +1,14 @@
+<!--
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-13 15:55:45
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-13 15:56:58
+-->
+<template>
+    <div class="lexBeforeOPDPDFBtnSISHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={showSuccess}></lightning-button>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexBeforeOPDPDFBtnSIS/lexBeforeOPDPDFBtnSIS.js b/force-app/main/default/lwc/lexBeforeOPDPDFBtnSIS/lexBeforeOPDPDFBtnSIS.js
new file mode 100644
index 0000000..db99c83
--- /dev/null
+++ b/force-app/main/default/lwc/lexBeforeOPDPDFBtnSIS/lexBeforeOPDPDFBtnSIS.js
@@ -0,0 +1,97 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-13 15:55:45
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-13 16:04:14
+ */
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init  from '@salesforce/apex/OpportunityLightingButtonController.initFoBeforeOPDPDFBtnSISButton';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import selectCommonSequence from '@salesforce/apex/ControllerUtil.selectCommonSequence';
+import addReportOPWithEvaluationPDF from '@salesforce/apex/Add_Report.addReportOPWithEvaluationPDF';
+
+export default class LexBeforeOPDPDFBtnSIS extends LightningElement {
+    @api recordId;
+    accountId;
+    userId;
+    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.accountId = result.accountId;
+            this.userId = result.userId;
+            this.beforeOPDPDFBtn();
+        })
+    }
+    beforeOPDPDFBtn(){
+        if (window.confirm('鏄惁鏂板缓SIS鎶ュ憡涔︼紵')) {
+            try {
+            selectCommonSequence({
+                valueField: 'EvaluationPDF_NextValue__c',
+                formatField: 'EvaluationPDF_Format__c'
+            }).then(result=>{
+                var pdfno = result;
+                addReportOPWithEvaluationPDF({
+                    "repOwnerId": this.userId,
+                    "reportId": "",
+                    "dailyReportId": "",
+                    "eventId": "",
+                    "recordType": "SIS",
+                    "aId": this.accountId,
+                    "visitor1": "",
+                    "visitor2": "",
+                    "visitor3": "",
+                    "visitor4": "",
+                    "visitor5": "",
+                    "opp1": this.recordId,
+                    "opp2": "",
+                    "opp3": "",
+                    "opp4": "",
+                    "opp5": "",
+                    "reportDate": "",
+                    "evaluationPDFNumber": pdfno
+                }).then(()=>{
+                    // 20220913 ljh WLIG-CHMATN update end
+                    this.IsLoading = false;
+                    window.open('/apex/BeforeOPDPDF?oid=' + this.recordId + '&pdfNo=' + pdfno, 'BeforeOPDPDF');
+                    this.dispatchEvent(new CloseActionScreenEvent());
+                })
+            });
+            } catch(e) {
+                this.showToast(e,"error");
+                this.dispatchEvent(new CloseActionScreenEvent());
+            }
+        } else {
+            window.open('/apex/BeforeOPDPDF?oid=' + this.recordId, 'BeforeOPDPDF');
+            this.dispatchEvent(new CloseActionScreenEvent());
+        }
+    }
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            title: '',
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexBeforeOPDPDFBtnSIS/lexBeforeOPDPDFBtnSIS.js-meta.xml b/force-app/main/default/lwc/lexBeforeOPDPDFBtnSIS/lexBeforeOPDPDFBtnSIS.js-meta.xml
new file mode 100644
index 0000000..329e839
--- /dev/null
+++ b/force-app/main/default/lwc/lexBeforeOPDPDFBtnSIS/lexBeforeOPDPDFBtnSIS.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexBidAnnouncementApplyForButton/lexBidAnnouncementApplyForButton.html b/force-app/main/default/lwc/lexBidAnnouncementApplyForButton/lexBidAnnouncementApplyForButton.html
new file mode 100644
index 0000000..e286a5b
--- /dev/null
+++ b/force-app/main/default/lwc/lexBidAnnouncementApplyForButton/lexBidAnnouncementApplyForButton.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="ApplyFor" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexBidAnnouncementApplyForButton/lexBidAnnouncementApplyForButton.js b/force-app/main/default/lwc/lexBidAnnouncementApplyForButton/lexBidAnnouncementApplyForButton.js
new file mode 100644
index 0000000..3bbe3fc
--- /dev/null
+++ b/force-app/main/default/lwc/lexBidAnnouncementApplyForButton/lexBidAnnouncementApplyForButton.js
@@ -0,0 +1,53 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import  ApplyFor  from '@salesforce/apex/BidAnnouncementController.ApplyFor';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class lexBidAnnouncementApplyForButton extends LightningElement {
+    @api recordId;//
+    IsLoading = true;
+
+    @wire(CurrentPageReference)
+     getStateParameters(currentPageReference) {
+         if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             this.recordId = str;
+           }
+         }
+     }
+    
+    connectedCallback(){
+        this.IsLoading = false;
+        this.ApplyFor();
+    }
+    //涓爣閫氱煡涔� 鐢宠
+    ApplyFor(){
+        ApplyFor({recordId:this.recordId}).then(res=>{
+            if(res == '1'){
+                this.showToast('璇锋眰鐢宠鎴愬姛,鐢宠涓�傘�傘��','success');
+                this.updateRecordView();
+            }else{
+                var messageage = "";
+                messageage = res.split(',')[1];
+                this.showToast(messageage,'error');
+            }
+        })
+    }
+    
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+
+    updateRecordView() {
+        updateRecord({fields: { Id: this.recordId }});
+    }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexBidAnnouncementApplyForButton/lexBidAnnouncementApplyForButton.js-meta.xml b/force-app/main/default/lwc/lexBidAnnouncementApplyForButton/lexBidAnnouncementApplyForButton.js-meta.xml
new file mode 100644
index 0000000..2b7649d
--- /dev/null
+++ b/force-app/main/default/lwc/lexBidAnnouncementApplyForButton/lexBidAnnouncementApplyForButton.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+	<apiVersion>54.0</apiVersion>
+	<isExposed>true</isExposed>
+	<targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexBidAnnouncementConsentButton/lexBidAnnouncementConsentButton.html b/force-app/main/default/lwc/lexBidAnnouncementConsentButton/lexBidAnnouncementConsentButton.html
new file mode 100644
index 0000000..55743be
--- /dev/null
+++ b/force-app/main/default/lwc/lexBidAnnouncementConsentButton/lexBidAnnouncementConsentButton.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="Consent" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexBidAnnouncementConsentButton/lexBidAnnouncementConsentButton.js b/force-app/main/default/lwc/lexBidAnnouncementConsentButton/lexBidAnnouncementConsentButton.js
new file mode 100644
index 0000000..b170c4e
--- /dev/null
+++ b/force-app/main/default/lwc/lexBidAnnouncementConsentButton/lexBidAnnouncementConsentButton.js
@@ -0,0 +1,53 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import  ConSent  from '@salesforce/apex/BidAnnouncementController.ConSent';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class lexBidAnnouncementRejectButton extends LightningElement {
+    @api recordId;
+    IsLoading = true;
+
+    @wire(CurrentPageReference)
+     getStateParameters(currentPageReference) {
+         if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             this.recordId = str;
+           }
+         }
+     }
+    connectedCallback(){
+        this.IsLoading = false;
+        this.Consent();
+    }
+    //涓爣閫氱煡涔� 鍚屾剰
+    Consent(){  
+        ConSent({recordId:this.recordId}).then(res=>{
+            if(res == '1'){
+                this.showToast("鍚屾剰璇锋眰鎴愬姛","success");
+            }
+            if(res != "1"){
+                var messageage = "";
+                messageage = res.split(',')[1];
+                this.showToast(messageage,"error");
+            }
+        })
+    }
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+        if(type == 'success'){
+            this.updateRecordView();
+        }
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+    updateRecordView() {
+        updateRecord({fields: { Id: this.recordId }});
+    }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexBidAnnouncementConsentButton/lexBidAnnouncementConsentButton.js-meta.xml b/force-app/main/default/lwc/lexBidAnnouncementConsentButton/lexBidAnnouncementConsentButton.js-meta.xml
new file mode 100644
index 0000000..2b7649d
--- /dev/null
+++ b/force-app/main/default/lwc/lexBidAnnouncementConsentButton/lexBidAnnouncementConsentButton.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+	<apiVersion>54.0</apiVersion>
+	<isExposed>true</isExposed>
+	<targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexBidAnnouncementRejectButton/lexBidAnnouncementRejectButton.html b/force-app/main/default/lwc/lexBidAnnouncementRejectButton/lexBidAnnouncementRejectButton.html
new file mode 100644
index 0000000..be06a03
--- /dev/null
+++ b/force-app/main/default/lwc/lexBidAnnouncementRejectButton/lexBidAnnouncementRejectButton.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="reject" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexBidAnnouncementRejectButton/lexBidAnnouncementRejectButton.js b/force-app/main/default/lwc/lexBidAnnouncementRejectButton/lexBidAnnouncementRejectButton.js
new file mode 100644
index 0000000..74a1baf
--- /dev/null
+++ b/force-app/main/default/lwc/lexBidAnnouncementRejectButton/lexBidAnnouncementRejectButton.js
@@ -0,0 +1,65 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import  UserInfo_Owner  from '@salesforce/apex/BidAnnouncementController.UserInfo_Owner';
+import  Reject  from '@salesforce/apex/BidAnnouncementController.Reject';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class lexBidAnnouncementRejectButton extends LightningElement {
+    @api recordId;
+    IsLoading = true;
+    BidCancel = null;
+
+    @wire(CurrentPageReference)
+     getStateParameters(currentPageReference) {
+         if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             this.recordId = str;
+           }
+         }
+     }
+    
+    connectedCallback(){
+        this.IsLoading = false;
+        this.Reject();
+    }
+    //涓爣閫氱煡涔� 椹冲洖
+    Reject(){
+        UserInfo_Owner().then(res=>{
+            this.BidCancel = res.BidCancel;
+            if(this.BidCancel == false){
+                this.showToast('娌℃湁椹冲洖鐨勬潈闄�',"error");
+            }else{
+                Reject({
+                    recordId: this.recordId
+                }).then(requst=>{
+                    if(requst == '1'){
+                        this.showToast("椹冲洖璇锋眰鎴愬姛","success");
+                    }
+                    if(requst != "1"){
+                        var messageage = "";
+                        messageage = requst.split(',')[1];
+                        this.showToast(messageage,"error");
+                    }
+                })
+            }
+        })
+    }
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+        if(type == 'success'){
+            this.updateRecordView();
+        }
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+    updateRecordView() {
+        updateRecord({fields: { Id: this.recordId }});
+    }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexBidAnnouncementRejectButton/lexBidAnnouncementRejectButton.js-meta.xml b/force-app/main/default/lwc/lexBidAnnouncementRejectButton/lexBidAnnouncementRejectButton.js-meta.xml
new file mode 100644
index 0000000..2b7649d
--- /dev/null
+++ b/force-app/main/default/lwc/lexBidAnnouncementRejectButton/lexBidAnnouncementRejectButton.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+	<apiVersion>54.0</apiVersion>
+	<isExposed>true</isExposed>
+	<targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancel/lexCancel.js b/force-app/main/default/lwc/lexCancel/lexCancel.js
index 302de36..77a0e59 100644
--- a/force-app/main/default/lwc/lexCancel/lexCancel.js
+++ b/force-app/main/default/lwc/lexCancel/lexCancel.js
@@ -1,3 +1,11 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-03-27 13:47:21
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-11 16:44:49
+ */
 import { api, wire,LightningElement } from 'lwc';
 import { CurrentPageReference } from "lightning/navigation";
 import { CloseActionScreenEvent } from 'lightning/actions';
@@ -37,14 +45,10 @@
                 this.status = result.status;
                 console.log(this.status);
                 this.cancel();
-                this.IsLoading = false;
-
             }
         }).catch(error => {
             console.log("error");
             console.log(error);
-        }).finally(() => {
-            
         });
 
     }
@@ -65,30 +69,35 @@
 
     cancel () {
         if (this.status == "鍙栨秷") {
-            ShowToastEvent("宸茬粡鍙栨秷锛�","error");
+            this.showToast("宸茬粡鍙栨秷锛�","error");
             this.dispatchEvent(new CloseActionScreenEvent());
             return;
             }
         if (this.status == "鎵瑰噯") {
-            ShowToastEvent("宸茬粡鎵瑰噯锛屼笉鑳藉垹闄わ紒","error");
+            this.showToast("宸茬粡鎵瑰噯锛屼笉鑳藉垹闄わ紒","error");
             this.dispatchEvent(new CloseActionScreenEvent());
             return;
         }
         if (this.status == "瀹屾瘯") {
-            ShowToastEvent("宸茬粡瀹屾瘯锛屼笉鑳藉垹闄わ紒","error");
+            this.showToast("宸茬粡瀹屾瘯锛屼笉鑳藉垹闄わ紒","error");
             this.dispatchEvent(new CloseActionScreenEvent());
             return;
         }
         if (this.status == "鎻愪氦") {
-            ShowToastEvent("宸茬粡鎻愪氦锛屼笉鑳藉垹闄わ紒","error");
+            this.showToast("宸茬粡鎻愪氦锛屼笉鑳藉垹闄わ紒","error");
             this.dispatchEvent(new CloseActionScreenEvent());
             return;
         }
         updateForCancelButton({
             recordId: this.recordId
         }).then(result =>{
-            this.showToast("鍙栨秷鎴愬姛锛�","success");
-            this.updateRecordView(this.recordId);
+            if(result){
+                this.showToast(result,"error");
+            }else{
+                this.showToast("鍙栨秷鎴愬姛锛�","success");
+                this.updateRecordView(this.recordId);
+            }
+            this.IsLoading = false;
             this.dispatchEvent(new CloseActionScreenEvent());
         });
     }
diff --git a/force-app/main/default/lwc/lexCancelApply/lexCancelApply.html b/force-app/main/default/lwc/lexCancelApply/lexCancelApply.html
new file mode 100644
index 0000000..66974ff
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelApply/lexCancelApply.html
@@ -0,0 +1,4 @@
+<template>
+
+    
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancelApply/lexCancelApply.js b/force-app/main/default/lwc/lexCancelApply/lexCancelApply.js
new file mode 100644
index 0000000..04cee1d
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelApply/lexCancelApply.js
@@ -0,0 +1,100 @@
+import { LightningElement, track, wire, api } from 'lwc';
+import LightningConfirm from 'lightning/confirm';
+import {CurrentPageReference,NavigationMixin} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+
+import cancelApply from '@salesforce/apex/TransferApplyWebService.cancelApply';
+
+export default class lexCancelApply extends LightningElement {
+	 @api recordId;
+	 IsLoading=true;
+	 cancelResult;
+  
+
+    @wire(CurrentPageReference)
+	getStateParameters(currentPageReference){
+		console.log("杩涘叆椤甸潰");
+		console.log(currentPageReference);
+		if(currentPageReference){
+			const urvalue=currentPageReference.state.recordId;
+			if(urvalue){
+				let str=`${urvalue}`;
+				console.log('str');
+				console.log(str);
+				this.recordId=str;
+				
+			}
+		}
+	}
+	connectedCallback() {
+		console.log('this.raeSetId:' + this.recordId);
+		
+		LightningConfirm.open({
+	        message: '纭畾鍙栨秷锛�',
+	        variant: 'headerless',
+	        label: 'this is the aria-label value',
+	        
+	    }).then(cancel=>{
+	  //   	this.IsLoading=false;
+			// this.dispatchEvent(new CloseActionScreenEvent());
+	    	if(cancel) {
+	    		cancelApply({
+					taId : this.recordId
+				}).then(result => {
+					this.cancelResult = result;
+					this.cancelSubmit().then(res=>{
+						this.IsLoading=false;
+						this.dispatchEvent(new CloseActionScreenEvent());
+					});	
+							
+				}).catch( error =>{
+					console.log(error);
+				}).finally(()=>{
+
+					
+				});
+	    	}
+	    	
+	    });
+		
+		
+	}
+
+	async cancelSubmit(){
+		if(this.cancelResult == '1') {
+			await this.showToast("",'鍙栨秷鎴愬姛',"success"); 
+			window.location.href = window.location;
+					
+		} else {
+			console.log("result:",this.cancelResult);
+			await this.showToast("",this.cancelResult,"warning"); 	
+		}
+			
+    }
+    showToast(_title,_message,_variant) {
+        const event = new ShowToastEvent({
+            title: _title,
+            message:_message,
+            variant: _variant,
+        });
+        this.dispatchEvent(event);
+    }
+	
+}
+
+//old js
+
+// {!REQUIRESCRIPT('/soap/ajax/51.0/connection.js')}
+// {!REQUIRESCRIPT('/soap/ajax/51.0/apex.js')}
+// if (confirm("纭畾鍙栨秷锛�")) {
+// var rs = sforce.apex.execute("TransferApplyWebService","cancelApply",{taId:'{!TransferApply__c.Id}'});
+// if(rs == '1'){
+// alert('鍙栨秷鎴愬姛');
+// window.location.href = window.location;
+// }
+// else{
+// alert(rs);
+// }
+// }
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancelApply/lexCancelApply.js-meta.xml b/force-app/main/default/lwc/lexCancelApply/lexCancelApply.js-meta.xml
new file mode 100644
index 0000000..f004c4d
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelApply/lexCancelApply.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexCancelApply">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__AppPage</target>
+        <target>lightning__RecordPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancelReport/__tests__/lexCancelReport.test.js b/force-app/main/default/lwc/lexCancelReport/__tests__/lexCancelReport.test.js
new file mode 100644
index 0000000..7171af0
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelReport/__tests__/lexCancelReport.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexCancelReport from 'c/lexCancelReport';
+
+describe('c-lex-cancel-report', () => {
+    afterEach(() => {
+        // The jsdom instance is shared across test cases in a single file so reset the DOM
+        while (document.body.firstChild) {
+            document.body.removeChild(document.body.firstChild);
+        }
+    });
+
+    it('TODO: test case generated by CLI command, please fill in test logic', () => {
+        // Arrange
+        const element = createElement('c-lex-cancel-report', {
+            is: LexCancelReport
+        });
+
+        // Act
+        document.body.appendChild(element);
+
+        // Assert
+        // const div = element.shadowRoot.querySelector('div');
+        expect(1).toBe(1);
+    });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancelReport/lexCancelReport.css b/force-app/main/default/lwc/lexCancelReport/lexCancelReport.css
new file mode 100644
index 0000000..a8fa542
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelReport/lexCancelReport.css
@@ -0,0 +1,10 @@
+.cancelReportHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancelReport/lexCancelReport.html b/force-app/main/default/lwc/lexCancelReport/lexCancelReport.html
new file mode 100644
index 0000000..c738dca
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelReport/lexCancelReport.html
@@ -0,0 +1,6 @@
+<template>
+    <div class="cancelReportHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancelReport/lexCancelReport.js b/force-app/main/default/lwc/lexCancelReport/lexCancelReport.js
new file mode 100644
index 0000000..0032022
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelReport/lexCancelReport.js
@@ -0,0 +1,116 @@
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init  from '@salesforce/apex/OpportunityLightingButtonController.initForCancelReportButton';
+import queryForCancelReportButton  from '@salesforce/apex/OpportunityLightingButtonController.queryForCancelReportButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class LexCancelReport extends LightningElement {
+    @api recordId;
+    stageName;
+    sapSendOK;
+    cntLostCancelReport;
+    cntLostCancelDraft;
+    jobCategory;
+    biddingProjectNameBid;
+    name;
+    salesAssistantName;
+    salesAssistantID;
+    managerName;
+    salesManagerDepartmentID;
+    salesOwnerBuchang;
+    salesOwnerBuchangID;
+    IsLoading = true;
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+            console.log(111);
+            console.log(currentPageReference);
+
+        if (currentPageReference) {
+          const urlValue = currentPageReference.state.recordId;
+          if (urlValue) {
+            let str = `${urlValue}`;
+            console.log("str");
+            console.log(str);
+            this.recordId = str;
+          }
+        }
+    }
+    connectedCallback(){
+        init({
+            recordId: this.recordId
+        }).then(result=>{
+            this.stageName = result.stageName;
+            this.sapSendOK = result.sapSendOK;
+            this.cntLostCancelDraft = result.cntLostCancelDraft;
+            this.cntLostCancelReport = result.cntLostCancelReport;
+            this.jobCategory = result.jobCategory;
+            this.biddingProjectNameBid = result.biddingProjectNameBid;
+            this.name = result.name;
+            this.salesAssistantID = result.salesAssistantID;
+            this.salesAssistantName = result.salesAssistantName;
+            this.managerName = result.managerName;
+            this.salesManagerDepartmentID = result.salesManagerDepartmentID;
+            this.salesOwnerBuchang = result.salesOwnerBuchang;
+            this.salesOwnerBuchangID = result.salesOwnerBuchangID;
+            this.cancelReport();
+        })
+    }
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            title: '',
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+    }
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+    cancelReport(){
+        //XLIU-CG98L5 銆愬鎵樸�戙�愯瘎浼般�戞柊闇�姹�-鎷涙爣椤圭洰/璇环瀵瑰簲娴佹爣銆佸簾鏍囨敼鍠� start
+        queryForCancelReportButton({
+            recordId: this.recordId
+        }).then(result=>{
+            var sqlResult = result;
+            // alert('娴嬭瘯+锛�'+sqlResult.size);
+            //XLIU-CG98L5 銆愬鎵樸�戙�愯瘎浼般�戞柊闇�姹�-鎷涙爣椤圭洰/璇环瀵瑰簲娴佹爣銆佸簾鏍囨敼鍠� end
+            // js銇牬鍚堛�佺炕瑷炽仌銈屻仧鍊ゃ亴銇с倠銇仹銆佽娉ㄦ剰
+            if (this.stageName != '寮曞悎'
+            && this.stageName != '璇环'
+            ) {
+                this.showToast("鐘舵��1:" + this.stageName + "銆佷笉鑳藉仛 鍙栨秷 浜嗭紒","error");
+                
+            }
+            else if (this.sapSendOK == '1') {
+                this.showToast("宸茬粡涓婁紶SAP銆佷笉鑳藉仛 鍙栨秷 浜嗭紒","");
+            }
+            else if (this.cntLostCancelReport - this.cntLostCancelDraft > 0) {
+                this.showToast("璇环宸茬粡鏈� 鍙栨秷锛忓け鍗曟姤鍛� 浜嗭紒","error");
+            }
+            else if (this.jobCategory == '鏀彺') {
+                this.showToast("璇环鎵�鏈変汉鏄姪鐞嗙殑锛屽厛璇蜂慨鏀瑰埌閿�鍞媴褰擄紒","");
+            }
+            //XLIU-CG98L5 銆愬鎵樸�戙�愯瘎浼般�戞柊闇�姹�-鎷涙爣椤圭洰/璇环瀵瑰簲娴佹爣銆佸簾鏍囨敼鍠� start
+            //else if({!NOT(ISBLANK(Opportunity.Bidding_Project_Name_Bid__c))}&& '{!Opportunity.subInfoType__c}' != '3-1锛氬簾鏍囧叕鍛�' &&'{!Opportunity.subInfoType__c}' != '3-2锛氭祦鏍囧叕鍛�'){
+            else if(this.biddingProjectNameBid != undefined && sqlResult.size == 0){
+                this.showToast("鏈夋嫑鎶曟爣椤圭洰鏃跺彧鑳藉仛澶卞崟鎴栭儴鍒嗗け鍗曟姤鍛婏紒","error");
+            }
+            //XLIU-CG98L5 銆愬鎵樸�戙�愯瘎浼般�戞柊闇�姹�-鎷涙爣椤圭洰/璇环瀵瑰簲娴佹爣銆佸簾鏍囨敼鍠� end
+            else {
+            location.href = '/a1U/e?retURL=%2F'+ this.recordId +
+            '&RecordType=01210000000R4hH' +
+            '&CF00N10000004lbGT=' + this.name +
+            '&CF00N10000004lbGT_lkid=' + this.recordId +
+            '&CF00N10000006QShg=' + this.salesAssistantName +
+            '&CF00N10000006QShg_lkid=' + this.salesAssistantID +
+            '&CF00N10000006QShq='+ this.managerName +
+            '&CF00N10000006QShq_lkid=' + this.salesManagerDepartmentID +
+            '&CF00N10000006QShb=' + this.salesOwnerBuchang +
+            '&CF00N10000006QShb_lkid=' + this.salesOwnerBuchangID +
+            '';
+        }
+        this.dispatchEvent(new CloseActionScreenEvent());
+        });  
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancelReport/lexCancelReport.js-meta.xml b/force-app/main/default/lwc/lexCancelReport/lexCancelReport.js-meta.xml
new file mode 100644
index 0000000..329e839
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelReport/lexCancelReport.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.css b/force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.css
new file mode 100644
index 0000000..e1fe560
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.css
@@ -0,0 +1,11 @@
+.Holder{
+	position: relative;
+	display: inline-block;
+	width: 80px;
+	height: 80px;
+	text-align: center;
+}
+
+.container .uiContainerManager{
+	display : none !important;
+}
diff --git a/force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.html b/force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.html
new file mode 100644
index 0000000..08c3ae1
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="Holder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
diff --git a/force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.js b/force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.js
new file mode 100644
index 0000000..193e3d7
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.js
@@ -0,0 +1,53 @@
+import { LightningElement,api, track, wire } from 'lwc';
+import {CurrentPageReference} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init from '@salesforce/apex/SelectSubstituteControllerLWT.initFromSelectSubstituteButton';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class lexCancelSelect extends LightningElement {
+	@api recordId;
+    IsLoading=true;
+    id;
+    RentalApplyId;
+    Status;
+    @wire(CurrentPageReference)
+	getStateParameters(currentPageReference){
+		console.log("杩涘叆椤甸潰");
+		console.log(currentPageReference);
+		if(currentPageReference){
+			const urvalue=currentPageReference.state.recordId;
+			if(urvalue){
+				let str=`${urvalue}`;
+				console.log('str');
+				console.log(str);
+				this.recordId=str;
+			}
+		}
+	}
+
+
+
+	connectedCallback(){
+		console.log(this.recordId);
+		init({recordId:this.recordId}).then(result=>{
+			console.log(result);
+			if(result!=null){
+				this.id=result.id;
+			    this.RentalApplyId=result.RentalApplyId;
+			    this.Status=result.Status;
+				this.cancelSubmit().then(res=>{
+					this.IsLoading=false;
+					this.dispatchEvent(new CloseActionScreenEvent());
+				});
+			}
+		}).catch(err=>{
+			console.log("error:");
+			console.log(err);
+		}).finally(()=>{
+
+		});
+	}
+
+    async cancelSubmit(){
+    	window.open("/apex/EquipmentRentalCancel?raid="+this.RentalApplyId,'cancelSelect','width=500,height=250');
+    }
+}
diff --git a/force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.js-meta.xml b/force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.js-meta.xml
new file mode 100644
index 0000000..4bb35f7
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexCancelSelect">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__AppPage</target>
+        <target>lightning__RecordPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
diff --git a/force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.js b/force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.js
index 85014ed..17d0216 100644
--- a/force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.js
+++ b/force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.js
@@ -1,3 +1,11 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-07 09:02:03
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-11 11:17:24
+ */
 import { LightningElement,wire,track,api} from 'lwc';
 import { CurrentPageReference } from "lightning/navigation";
 import { CloseActionScreenEvent } from 'lightning/actions';
@@ -37,30 +45,23 @@
         }).then(result => {
             console.log(result);
             if (result != null) {
-                this.IsLoading = false;
                 this.ownerId = result.ownerId;
                 this.monthlyReportId = result.Id;
                 this.cancelSubmit();
                 console.log("end");
-                this.dispatchEvent(new CloseActionScreenEvent());
-                this.showToast();
-                this.updateRecordView(this.recordId);
-
                 //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Monthly_Report__c/" + this.monthlyReportId + "/view");
             }
         }).catch(error => {
             console.log("error");
             console.log(error);
-        }).finally(() => {
-            
         });   
     }
 
-    showToast() {
+    showToast(msg,type) {
         const event = new ShowToastEvent({
             title: '',
-            message: '鍙栨秷鎻愪氦鎴愬姛锛�',
-            variant: 'success'
+            message: msg,
+            variant: type
         });
         this.dispatchEvent(event);
     }
@@ -72,10 +73,20 @@
         if(this.ownerId == UserInfo_Owner.Id) {
             cancel({
                 recordId: this.recordId
+            }).then(result=>{
+                if(result){
+                    this.showToast(result,"error");
+                }else{
+                    this.showToast("鎴愬姛","success");
+                    this.updateRecordView(this.recordId);
+                }
+                this.IsLoading = false;
+                this.dispatchEvent(new CloseActionScreenEvent());
             });
             console.log("321");
             } else {
             this.showToast("鍙湁鍛ㄦ姤鐨勬墍鏈変汉鍙互鍙栨秷","error");
+            this.dispatchEvent(new CloseActionScreenEvent());
             }
     }
 }
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancelSubmitReport/lexCancelSubmitReport.js b/force-app/main/default/lwc/lexCancelSubmitReport/lexCancelSubmitReport.js
index 5f4ce92..becb18d 100644
--- a/force-app/main/default/lwc/lexCancelSubmitReport/lexCancelSubmitReport.js
+++ b/force-app/main/default/lwc/lexCancelSubmitReport/lexCancelSubmitReport.js
@@ -1,3 +1,11 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-07 09:02:03
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-11 11:18:36
+ */
 import { LightningElement,wire,track,api} from 'lwc';
 import { CurrentPageReference } from "lightning/navigation";
 import { CloseActionScreenEvent } from 'lightning/actions';
@@ -33,11 +41,14 @@
         cancel({
             recordId: this.recordId
         }).then(result =>{
-            this.showToast("鍙栨秷鎻愪氦鎴愬姛锛�","success");
-            this.updateRecordView(this.recordId);
+            if(result){
+                this.showToast(result,"error");
+            }else{
+                this.showToast("鍙栨秷鎻愪氦鎴愬姛锛�","success");
+                this.updateRecordView(this.recordId);
+            }
+            this.IsLoading = false;
             this.dispatchEvent(new CloseActionScreenEvent());
-        }).catch(error=>{
-            this.showToast(error,"error");
         });
     }
 
diff --git a/force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.css b/force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.css
new file mode 100644
index 0000000..e1fe560
--- /dev/null
+++ b/force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.css
@@ -0,0 +1,11 @@
+.Holder{
+	position: relative;
+	display: inline-block;
+	width: 80px;
+	height: 80px;
+	text-align: center;
+}
+
+.container .uiContainerManager{
+	display : none !important;
+}
diff --git a/force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.html b/force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.html
new file mode 100644
index 0000000..be2ae8c
--- /dev/null
+++ b/force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.html
@@ -0,0 +1,5 @@
+<template>
+  <div class="Holder" if:true={IsLoading}>
+              <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+  </div>
+</template>
diff --git a/force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.js b/force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.js
new file mode 100644
index 0000000..28012eb
--- /dev/null
+++ b/force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.js
@@ -0,0 +1,107 @@
+import { LightningElement,api, track, wire } from 'lwc';
+import {CurrentPageReference} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import getUserId from '@salesforce/apex/RentalApplyControllerLWT.getUserId';
+import init from '@salesforce/apex/SelectSubstituteControllerLWT.initClearReturnDeliverySlipButton';
+import updateRaescList from '@salesforce/apex/SelectSubstituteControllerLWT.updateRaescList';
+import selectRacById from '@salesforce/apex/SelectSubstituteControllerLWT.selectRacById';
+import selectRaesdcId from '@salesforce/apex/SelectSubstituteControllerLWT.selectRaesdcId';
+
+import { loadScript } from 'lightning/platformResourceLoader';
+import { submitForApproval } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+
+export default class lexClearReturnDeliverySlip extends LightningElement {
+
+	@api recordId;
+    id;
+    RentalApplyId;
+    Status;
+    IsLoading=true;
+    @wire(CurrentPageReference)
+	getStateParameters(currentPageReference){
+		console.log("杩涘叆椤甸潰");
+		console.log(currentPageReference);
+		if(currentPageReference){
+			const urvalue=currentPageReference.state.recordId;
+			if(urvalue){
+				let str=`${urvalue}`;
+				console.log('str');
+				console.log(str);
+				this.recordId=str;
+			}
+		}
+	}
+
+
+
+	connectedCallback(){
+		console.log(this.recordId);
+		init({recordId:this.recordId}).then(result=>{
+			console.log(result);
+			if(result!=null){
+				this.Rental_Apply_Equipment_Set__c=result;
+				this.cancelSubmit().then(res=>{
+					this.IsLoading=false;
+					this.dispatchEvent(new CloseActionScreenEvent());
+				});
+			}
+		}).catch(err=>{
+			console.log("error:");
+			console.log(err);
+		}).finally(()=>{
+
+		});
+	}
+
+
+
+    async cancelSubmit(){
+    	console.log("hhh1");
+    	var raesId = this.recordId;
+    	console.log("hhh2");
+		var result = await selectRaesdcId({recordId:this.recordId});
+		console.log("hhh3");
+		var objs = result;
+		if (objs.length< 1) {
+			// alert('娌℃湁闇�瑕佹竻绌虹殑涓�瑙堟槑缁�');
+			const event = new ShowToastEvent({
+	            title: '鎻愮ず淇℃伅',
+	            message:'娌℃湁闇�瑕佹竻绌虹殑涓�瑙堟槑缁�'
+	        });
+	        this.dispatchEvent(event);
+		} else {
+			console.log("hhh4");
+			var result;
+			console.log("hhh5");
+			await updateRaescList({updateList:objs})
+			.then(res=>{
+				console.log(res);
+				result=res;
+			});
+			console.log("hhh6");
+			if (result.success==true) {
+				console.log("hhh7");
+				// success
+				// alert("鍥炲瘎杩愯緭鍗曚俊鎭凡娓呯┖");
+				const event = new ShowToastEvent({
+		            title: '鎻愮ず淇℃伅',
+		            message:"鍥炲瘎杩愯緭鍗曚俊鎭凡娓呯┖"
+		        });
+		        this.dispatchEvent(event);
+				setTimeout(function() {
+					location.href = "/"+this.recordId;
+				}, 100);
+			} else {
+				console.log("hhh8");
+				// alert("failed to update:" + result.errors.fields + " " + result[0].errors.message);
+				const event = new ShowToastEvent({
+		            title: '鎻愮ず淇℃伅',
+		            message:"failed to update:" + result.errors.fields + " " + result[0].errors.message
+		        });
+		        this.dispatchEvent(event);
+			}
+		}
+	}
+}
diff --git a/force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.js-meta.xml b/force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.js-meta.xml
new file mode 100644
index 0000000..57176cb
--- /dev/null
+++ b/force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexClearReturnDeliverySlip">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__AppPage</target>
+        <target>lightning__RecordPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
diff --git a/force-app/main/default/lwc/lexComplete/lexComplete.js b/force-app/main/default/lwc/lexComplete/lexComplete.js
index 11e315a..fb737d5 100644
--- a/force-app/main/default/lwc/lexComplete/lexComplete.js
+++ b/force-app/main/default/lwc/lexComplete/lexComplete.js
@@ -1,3 +1,11 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-07 09:02:03
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-11 11:21:30
+ */
 import { LightningElement,wire,track,api} from 'lwc';
 import { CurrentPageReference } from "lightning/navigation";
 import { CloseActionScreenEvent } from 'lightning/actions';
@@ -35,18 +43,14 @@
         }).then(result => {
             console.log(result);
             if (result != null) {
-                this.IsLoading = false;
                 this.status = result.status;
                 this.profileId = result.profileId;
                 this.complete();
-                this.dispatchEvent(new CloseActionScreenEvent());
                 //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view");
             }
         }).catch(error => {
             console.log("error");
             console.log(error);
-        }).finally(() => {
-            
         });   
         //this.updateRecordView(this.recordId);
     }
@@ -69,18 +73,24 @@
     complete () {
         // 闄嗚儨锛岃儭杩畨锛岀郴缁熺鐞嗗憳浠ュ娌℃湁鏉冮檺
         if (UserInfo_Owner.Id != "00510000004reg2" && UserInfo_Owner.Id != "00510000000gWAE" && this.profileId != "00e10000000Y3o5") {
-            ShowToastEvent("浣犳病鏈夋潈闄�","error");
+            this.showToast("浣犳病鏈夋潈闄�","error");
             return;
         }
         if (this.status == "瀹屾瘯") {
-            ShowToastEvent("宸茬粡瀹屾瘯锛�","error");
+            this.showToast("宸茬粡瀹屾瘯锛�","error");
             return;
         }
         updateForCompleteButton({
             recordId: this.recordId
         }).then(result =>{
-            this.updateRecordView(this.recordId);
-            this.showToast("瀹屾瘯鎴愬姛锛�","success");
+            if(result){
+                this.showToast(result,"error");
+            }else{
+                this.updateRecordView(this.recordId);
+                this.showToast("瀹屾瘯鎴愬姛锛�","success");
+            }
+            this.IsLoading = false;
+            this.dispatchEvent(new CloseActionScreenEvent());
         });
     }
 }
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCreateEvent/__tests__/lexCreateEvent.test.js b/force-app/main/default/lwc/lexCreateEvent/__tests__/lexCreateEvent.test.js
new file mode 100644
index 0000000..9d8a9ae
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateEvent/__tests__/lexCreateEvent.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexCreateEvent from 'c/lexCreateEvent';
+
+describe('c-lex-create-event', () => {
+    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-create-event', {
+            is: LexCreateEvent
+        });
+
+        // Act
+        document.body.appendChild(element);
+
+        // Assert
+        // const div = element.shadowRoot.querySelector('div');
+        expect(1).toBe(1);
+    });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCreateEvent/lexCreateEvent.html b/force-app/main/default/lwc/lexCreateEvent/lexCreateEvent.html
new file mode 100644
index 0000000..617f069
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateEvent/lexCreateEvent.html
@@ -0,0 +1,6 @@
+<template>
+    <div class="lexCreateEventReportHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCreateEvent/lexCreateEvent.js b/force-app/main/default/lwc/lexCreateEvent/lexCreateEvent.js
new file mode 100644
index 0000000..453f9df
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateEvent/lexCreateEvent.js
@@ -0,0 +1,59 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-13 13:50:23
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-13 14:39:54
+ */
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init  from '@salesforce/apex/OpportunityLightingButtonController.initForCreateEventButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class LexCreateEvent extends LightningElement {
+    @api recordId;
+    accountId;
+    @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.accountId = result.accountId;
+            this.createEvent();
+        }).catch(error=>{
+            console.log("error");
+            console.log(error);
+        })
+    }
+    createEvent(){
+        window.open("/00U/e?retURL=%2Fapex%2FVFClosePage&accid=" + this.accountId + "&oid=" + this.recordId, "鏂板缓璁″垝");
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            title: '',
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+    }
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCreateEvent/lexCreateEvent.js-meta.xml b/force-app/main/default/lwc/lexCreateEvent/lexCreateEvent.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateEvent/lexCreateEvent.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>54.0</apiVersion>
+	<isExposed>true</isExposed>
+	<targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.js b/force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.js
index 3eb1154..3130703 100644
--- a/force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.js
+++ b/force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.js
@@ -1,3 +1,11 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-03-27 13:53:40
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-10 14:22:27
+ */
 import { api, wire,LightningElement } from 'lwc';
 import { CurrentPageReference } from "lightning/navigation";
 import { CloseActionScreenEvent } from 'lightning/actions';
@@ -85,6 +93,5 @@
         +"%0D%0A" + "杩炴帴锛�" 
         + this.drSumUrl
         +"%0D%0A").substring(0,320).split("<br>").join("%0D%0A");
-
     }
 }
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.css b/force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.css
new file mode 100644
index 0000000..8d634cd
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.css
@@ -0,0 +1,10 @@
+.createEmailHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.html b/force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.html
new file mode 100644
index 0000000..61d9b05
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="createEmailHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.js b/force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.js
new file mode 100644
index 0000000..8a2f637
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.js
@@ -0,0 +1,231 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { NavigationMixin } from 'lightning/navigation';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import init  from '@salesforce/apex/QISReportController.initForlexCreateRepairButton';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { updateRecord } from 'lightning/uiRecordApi';
+
+export default class lexCreateRepair extends LightningElement {
+	@api recordId;
+	IsLoading = true;
+	typeflag = false;
+	newflag = false;
+	qisReportId='';
+	name='';
+	qisRecordTypeId='';
+    err='';
+    accParentId='';
+    accParentRecordTypeId='';
+    accParentParentFSEGIMainLeader='';
+    accParentParentFSEGIMainLeaderWorkLocation='';
+    accParentParentFSESPMainLeader='';
+    accParentParentFSESPMainLeaderWorkLocation='';
+    WorkLocation='';
+    accrecordId='';
+    oCMjudgement='';
+    nextaction='';
+    specialfollow='';
+    comment='';
+    isUsedForTheOpera='';
+    UseFailProductFinish='';
+    failuerSituation='';
+    sourceOnCall='';
+    hospitalId='';
+    departmentClassId='';
+    hospitalDepartment='';
+    nonyushohinId='';
+    ownerId='';
+    faliourdate='';
+    sourceforrepair='';
+    repairSalesPointProvinceChina='';
+    trableoccurdaYcollect='';
+    damageForDocOrPat='';
+    relationWithTheProblem='';
+    reportForGoz='';
+    whichProject='';
+    operaName='';
+    breakORFallOff='';
+    setusageproduct='';
+    afterFailureInformation='';
+    delay15Min='';
+    informationFrom='';
+    failureQInHospital='';
+    ownername='';
+    hospitalname = '';
+    departmentClassname = '';
+    hospitalDepartmentname = '';
+    nonyushohinIdname = '';
+    sourceOnCallname = '';
+
+	@wire(CurrentPageReference)
+     getStateParameters(currentPageReference) {
+             console.log(111);
+             console.log(currentPageReference);
+
+         if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             console.log("str");
+             console.log(str);
+             this.recordId = str;
+           }
+         }
+    }
+
+    connectedCallback () {
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            this.IsLoading = false;
+            this.qisReportId = result.Id;
+            this.oCMjudgement = result.oCMjudgement;
+            this.nextaction = result.nextaction;
+            this.ownername = result.ownername;
+            this.specialfollow = result.specialfollow;
+            this.qisRecordTypeId = result.qisRecordTypeId;
+            this.accParentId = result.accParentId;
+            this.comment = result.comment;
+            if (result.sourceOnCall!=null) {
+            	this.sourceOnCall = result.sourceOnCall;
+            	this.sourceOnCallname = result.sourceOnCallname;
+            }
+            this.name = result.name;
+            this.hospitalId = result.hospitalId;
+            this.hospitalname = result.hospitalname;
+            this.departmentClassname = result.departmentClassname;
+            this.departmentClassId = result.departmentClassId;
+            this.hospitalDepartment = result.hospitalDepartment;
+            this.nonyushohinId = result.nonyushohinId;
+            this.ownerId = result.ownerId;
+            this.faliourdate = result.faliourdate;
+            this.sourceforrepair = result.sourceforrepair;
+            this.repairSalesPointProvinceChina = result.repairSalesPointProvinceChina;
+            this.trableoccurdaYcollect = result.trableoccurdaYcollect;
+            this.damageForDocOrPat = result.damageForDocOrPat;
+            this.relationWithTheProblem = result.relationWithTheProblem;
+            this.reportForGoz = result.reportForGoz;
+            this.whichProject = result.whichProject;
+            this.operaName = result.operaName;
+            this.breakORFallOff = result.breakORFallOff;
+            this.setusageproduct = result.setusageproduct;
+            this.afterFailureInformation = result.afterFailureInformation;
+            this.delay15Min = result.delay15Min;
+            this.informationFrom = result.informationFrom;
+            this.failureQInHospital = result.failureQInHospital;
+            this.failuerSituation = result.failuerSituation;
+            this.isUsedForTheOpera = result.isUsedForTheOpera;
+            this.accParentRecordTypeId = result.accParentRecordTypeId;
+            this.accParentParentFSEGIMainLeader = result.accParentParentFSEGIMainLeader;
+            this.accParentParentFSEGIMainLeaderWorkLocation = result.accParentParentFSEGIMainLeaderWorkLocation;
+            this.accParentParentFSESPMainLeader = result.accParentParentFSESPMainLeader;
+            this.accParentParentFSESPMainLeaderWorkLocation = result.accParentParentFSESPMainLeaderWorkLocation;
+         	if (this.qisRecordTypeId != '01210000000RLWc' && this.qisRecordTypeId != '01210000000RLWh') {
+         		this.typeflag = true;
+         	}
+         	if (this.accParentId != null) {
+         		if (this.accParentRecordTypeId != null) {
+         			this.accrecordId = this.accParentRecordTypeId.substring(0,15);
+         			if (this.accrecordId == '01210000000QemL' || this.accrecordId == '01210000000QezZ' || this.accrecordId == '01210000000QemQ') {
+         				if (this.accParentParentFSEGIMainLeader != null) {
+         					this.WorkLocation = this.accParentParentFSEGIMainLeaderWorkLocation;
+         				}
+         			}else if(this.accrecordId == '01210000000Qeze' || this.accrecordId == '01210000000Qezj' || this.accrecordId == '01210000000Qezt'|| this.accrecordId == '01210000000Qezo'|| this.accrecordId == '01210000000Qezy'){
+         				if (this.accParentParentFSESPMainLeader != null) {
+         					this.WorkLocation = this.accParentParentFSESPMainLeaderWorkLocation;
+         				}
+         			}
+         		}
+         	}
+         	if ((this.oCMjudgement == '璐ㄩ噺闂' && this.nextaction == '鏃犲伩缁翠慨') ||
+         		(this.oCMjudgement == '璐ㄩ噺闂' && this.nextaction == '鏈夊伩缁翠慨' && this.specialfollow == '0') || 
+         		(this.oCMjudgement == '闈炶川閲忛棶棰�' && this.nextaction == '鏃犲伩缁翠慨' && this.specialfollow == '1') || 
+         		(this.oCMjudgement == '闈炶川閲忛棶棰�' && this.nextaction == '鏈夊伩缁翠慨' && this.specialfollow == '0') || 
+         		(this.oCMjudgement == '璐ㄩ噺闂+闈炶川閲忛棶棰�' && this.nextaction == '鏃犲伩缁翠慨' && this.specialfollow == '1') || 
+         		(this.oCMjudgement == '璐ㄩ噺闂+闈炶川閲忛棶棰�' && this.nextaction == '鏈夊伩缁翠慨+鏃犲伩缁翠慨' && this.specialfollow == '0') || 
+         		(this.oCMjudgement == '鐜拌薄鏈彂鐜�' && this.nextaction == '鏃犲伩缁翠慨' && this.specialfollow == '1') || 
+         		(this.oCMjudgement == '鐜拌薄鏈彂鐜�' && this.nextaction == '鏈夊伩缁翠慨' && this.specialfollow == '0')) {
+         		this.newflag = true;
+         	}
+         	console.log('this.newflag = '+this.newflag);
+         	console.log('this.typeflag = '+this.typeflag);
+         	if ( this.newflag && this.typeflag) {
+         		if (this.isUsedForTheOpera == 'YES') {
+         			this.UseFailProductFinish = '鏄�';
+         		}else if(this.isUsedForTheOpera == 'NO-鐢ㄦ浛浠e搧瀹屾垚浜�'){
+         			this.UseFailProductFinish = '鍚�-鐢ㄦ浛浠e搧瀹屾垚';
+         		}else if(this.isUsedForTheOpera == 'NO-鐢ㄥ叾浠栧叕鍙哥殑鍚岀被浜у搧瀹屾垚浜�'){
+         			this.UseFailProductFinish = '鍚�-鐢ㄥ叾浠栧叕鍙哥殑鍚岀被浜у搧瀹屾垚';
+         		}else if(this.isUsedForTheOpera == 'NO-鎵嬫湳涓'){
+         			this.UseFailProductFinish = '鍚�-鎵嬫湳涓';
+         		}
+         		if ('浣跨敤鍓嶅噯澶�' == this.failuerSituation) {
+         			this.failuerSituation = '浣跨敤鍓嶅噯澶�-鎮h�呮湭楹婚唹';
+         		}
+         		var url = '';
+         			url = "/a0J/e?" +
+						"CF00N10000002FIJU_lkid="+this.sourceOnCall+"&" +
+						"CF00N10000002FIJU="+this.sourceOnCallname+"&" +
+						"CF00N10000002FIJZ_lkid="+this.qisReportId+"&" +
+						"CF00N10000002FIJZ="+this.name+"&" +
+						"CF00N10000002Dx66_lkid="+this.hospitalId+"&" +
+						"CF00N10000002Dx66="+this.hospitalname+"&" +
+						"CF00N10000002Dx5t_lkid="+this.departmentClassId+"&" +
+						"CF00N10000002Dx5t="+this.departmentClassname+"&" +
+						"CF00N10000002Dx5n_lkid="+this.hospitalDepartment+"&" +
+						"CF00N10000002Dx5n="+this.hospitalDepartmentname+"&" +
+						"CF00N10000002Dx1X_lkid="+this.nonyushohinId+"&" +
+						"CF00N10000002Dx1X="+this.nonyushohinIdname+"&" +
+						"CF00N10000002EMHw_lkid="+this.ownerId+"&" +
+						"CF00N10000002EMHw="+this.ownername+"&" +
+						"00N10000002Dx5y="+this.faliourdate+"&" +
+						"00N10000002Dx6I="+this.comment+"&" +
+						"00N10000002FH86="+this.sourceforrepair+"&" +
+						"00N10000006P6Rn="+this.repairSalesPointProvinceChina+"&" +
+						"00N10000008rsVQ="+this.trableoccurdaYcollect+"&" +
+						"00N10000008rsW7="+this.damageForDocOrPat+"&"+
+						"00N10000008rsVw="+this.relationWithTheProblem+"&"+
+						"00N10000008rsW2="+this.reportForGoz+"&"+
+						"00N10000008rsW6="+this.whichProject+"&"+
+						"00N10000008rsVk="+this.operaName+"&" +
+						"00N10000008rsVN="+this.breakORFallOff+"&"+
+						"00N10000008rsW4="+this.setusageproduct+"&" +
+						"00N10000008rsVL="+this.afterFailureInformation+"&" +
+						"00N10000008rsVR="+this.delay15Min+"&"+
+						"00N10000008rsVZ="+this.informationFrom+"&"+
+						"00N10000008rsVT="+this.failureQInHospital+"&" +
+						"00N10000008rsVv="+this.failuerSituation+"&"+
+						"00N10000008rsW5="+this.UseFailProductFinish+ "&" +
+						"00N10000006P6SM="+this.WorkLocation+ "&" +
+						"retURL=%2F"+this.qisReportId;
+						window.open(url, "_blank");
+						this.dispatchEvent(new CloseActionScreenEvent());
+         	}else{
+         		const evt = new ShowToastEvent({
+                        title : '璇IS涓嶈兘鏂板缓淇悊',
+                        message: '',
+                        variant: 'error'
+                    });
+                    this.dispatchEvent(evt);
+                this.dispatchEvent(new CloseActionScreenEvent());
+         		return;
+         	}
+        }).catch(error => {
+            
+            const evt = new ShowToastEvent({
+                        title : '鍙戠敓閿欒',
+                        message: '',
+                        variant: 'error'
+                    });
+                    this.dispatchEvent(evt);
+
+            this.dispatchEvent(new CloseActionScreenEvent());
+            console.log('error='+error);
+         	return;
+        }).finally(() => {
+            
+        }); 
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.js-meta.xml b/force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.js-meta.xml
new file mode 100644
index 0000000..6cafb47
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateRepair/lexCreateRepair.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexCreateRepair">
+   <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.css b/force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.css
new file mode 100644
index 0000000..e1fe560
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.css
@@ -0,0 +1,11 @@
+.Holder{
+	position: relative;
+	display: inline-block;
+	width: 80px;
+	height: 80px;
+	text-align: center;
+}
+
+.container .uiContainerManager{
+	display : none !important;
+}
diff --git a/force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.html b/force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.html
new file mode 100644
index 0000000..e811909
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.html
@@ -0,0 +1,5 @@
+<template>
+      <div class="Holder" if:true={IsLoading}>
+              <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+      </div>
+</template>
diff --git a/force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.js b/force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.js
new file mode 100644
index 0000000..46be221
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.js
@@ -0,0 +1,158 @@
+import { LightningElement,api, track, wire } from 'lwc';
+import {CurrentPageReference} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import getUserId from '@salesforce/apex/RentalApplyControllerLWT.getUserId';
+import init from '@salesforce/apex/SelectSubstituteControllerLWT.initFromCustomSubmitButton';
+import updateRaesc from '@salesforce/apex/SelectSubstituteControllerLWT.updateRaesc';
+import selectRacById from '@salesforce/apex/SelectSubstituteControllerLWT.selectRacById';
+import postponeCheck from '@salesforce/apex/SelectSubstituteControllerLWT.postponeCheck';
+
+import { loadScript } from 'lightning/platformResourceLoader';
+import { submitForApproval } from 'lightning/uiRecordApi';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class lexCustomSubmit extends LightningElement {
+
+	@api recordId;
+    id;
+    RentalApplyId;
+    Status;
+    IsLoading=true;
+    @wire(CurrentPageReference)
+	getStateParameters(currentPageReference){
+		console.log("杩涘叆椤甸潰");
+		console.log(currentPageReference);
+		if(currentPageReference){
+			const urvalue=currentPageReference.state.recordId;
+			if(urvalue){
+				let str=`${urvalue}`;
+				console.log('str');
+				console.log(str);
+				this.recordId=str;
+			}
+		}
+	}
+
+
+
+	connectedCallback(){
+		console.log(this.recordId);
+		init({recordId:this.recordId}).then(result=>{
+			console.log(result);
+			if(result!=null){
+				this.Rental_Apply_Equipment_Set__c=result;
+				this.cancelSubmit().then(res=>{
+					this.IsLoading=false;
+					this.dispatchEvent(new CloseActionScreenEvent());
+				});	
+			}
+		}).catch(err=>{
+			console.log("error:");
+			console.log(err);
+		}).finally(()=>{
+
+		});
+	}
+
+
+ 
+    async cancelSubmit(){
+    	console.log("hhh1");
+		if (this.Rental_Apply_Equipment_Set__c.Request_extend_day__c == ""
+		|| this.Rental_Apply_Equipment_Set__c.Request_extend_day__c == null
+		|| this.Rental_Apply_Equipment_Set__c.Extend_request_reason__c == ""
+		|| this.Rental_Apply_Equipment_Set__c.Extend_request_reason__c == null) {
+			// alert("蹇呴』濉啓寤舵湡甯屾湜缁撴潫鏃ワ紝寤舵湡鐢宠鐞嗙敱");
+			const event = new ShowToastEvent({
+	            title: '鎻愮ず淇℃伅',
+	            message:"蹇呴』濉啓寤舵湡甯屾湜缁撴潫鏃ワ紝寤舵湡鐢宠鐞嗙敱"
+	        });
+	        this.dispatchEvent(event);
+			return;
+		}
+		console.log("hhh2");
+		let rtn;
+		await postponeCheck({
+			endDate:this.Rental_Apply_Equipment_Set__c.Rental_End_Date__c,
+			d:-5
+		}).then(res=>{
+			console.log(res);
+			rtn=res;
+		}).catch(err=>{
+			console.log("err:",err.message);
+		})
+
+		console.log(rtn);
+		if (rtn != "OK") {
+			// alert(rtn);
+			const event = new ShowToastEvent({
+	            title: '鎻愮ず淇℃伅',
+	            message:rtn
+	        });
+	        this.dispatchEvent(event);
+			return;
+		}
+		console.log("hhh3");
+		let resultSet = await selectRacById({recordId:this.Rental_Apply_Equipment_Set__c.Rental_Apply__c})
+		;
+		let records = resultSet;
+		console.log("hhh4");
+		let result = await updateRaesc({
+			recordId:this.Rental_Apply_Equipment_Set__c.Id,
+			JingliApprovalManagerc:records[0].JingliApprovalManager__c,
+			BuchangApprovalManagerc:records[0].SalesManager__c,
+			BuchangApprovalManagerSalesc:records[0].BuchangApprovalManager__c,
+			ZongjianApprovalManagerc:records[0].BuchangApprovalManagerSales__c,
+			ExtendStatusc:'濉啓瀹屾瘯',
+		});
+		console.log("hhh5");
+		console.log(result);
+		// let messages = getConnectDMLErrorMessages(result);
+		if(result!=null&&result.length>0&&result.errors.length>0){
+			// alert(result.errors[0].split(",")[1]);
+			const event = new ShowToastEvent({
+	            title: '鎻愮ず淇℃伅',
+	            message:result.errors[0].split(",")[1]
+	        });
+	        this.dispatchEvent(event);
+		}
+		console.log("hhh7");
+
+		// let request = new sforce.ProcessSubmitRequest();
+		// request.objectId = this.recordId;
+		// let processResults = sforce.connection.process([request]);
+		console.log("hhh8");
+		// submitForApproval(this.Rental_Apply_Equipment_Set__c.Id).then(result => {
+        // 	console.log(result);
+        // 	if (processResults[0].errors != null) {
+		// 		alert(processResults[0].errors.message);
+		// 		return;
+		// 	}
+		// 	console.log("hhh9");
+		// 	window.location.reload();
+        // })
+        // .catch(error => {
+        //   console.error('Error submitting record for approval:', error.message);
+        // });
+
+        // await submitForApproval(this.recordId);
+	    const fields = {}
+	    const recordInput = { fields };
+		updateRecord({ fields: recordInput, recordId: this.recordId })
+	      .then(() => {
+	        console.log("鏇存柊鎴愬姛");
+	      })
+	      .catch(error => {
+	      	console.log(error.message);
+	      	console.log(error);
+	      	// alert(error.body.message);
+			const event = new ShowToastEvent({
+	            title: '鎻愮ず淇℃伅',
+	            message:error.body.message
+	        });
+	        this.dispatchEvent(event);
+			return;
+	        // 澶勭悊寮傚父鎯呭喌
+	      });
+	}
+}
diff --git a/force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.js-meta.xml b/force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.js-meta.xml
new file mode 100644
index 0000000..d737898
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexCustomSubmit">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__AppPage</target>
+        <target>lightning__RecordPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
diff --git a/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.css b/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.css
new file mode 100644
index 0000000..af18c76
--- /dev/null
+++ b/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.css
@@ -0,0 +1,11 @@
+.Holder{
+	position: relative;
+	display: inline-block;
+	width: 80px;
+	height: 80px;
+	text-align: center;
+}
+
+.container .uiContainerManager{
+	display : none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.html b/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.html
new file mode 100644
index 0000000..2ef2898
--- /dev/null
+++ b/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.html
@@ -0,0 +1,5 @@
+<template>
+	<div class="Holder" if:true={IsLoading}>
+      	<lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+  	</div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js b/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js
new file mode 100644
index 0000000..fedf726
--- /dev/null
+++ b/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js
@@ -0,0 +1,39 @@
+import { LightningElement, track, wire, api } from 'lwc';
+import {CurrentPageReference} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+
+export default class lexDetailBulkUpdate extends LightningElement {
+	@api recordId;
+  
+
+    @wire(CurrentPageReference)
+	getStateParameters(currentPageReference){
+		console.log("杩涘叆椤甸潰");
+		console.log(currentPageReference);
+		if(currentPageReference){
+			const urvalue=currentPageReference.state.recordId;
+			if(urvalue){
+				let str=`${urvalue}`;
+				console.log('str');
+				console.log(str);
+				this.recordId=str;
+			}
+		}
+	}
+
+	connectedCallback(){
+
+		this.cancelSubmit().then(res=>{
+			this.IsLoading=false;
+			this.dispatchEvent(new CloseActionScreenEvent());
+		});
+	}
+
+	async cancelSubmit(){
+		window.open('/apex/TransferApplySelectDetailSub?id='+this.recordId,'DetailBulkUpdateLWC', 'width=600,height=200');
+	}
+
+	//old js
+	// window.open("/apex/TransferApplySelectDetailSub?Id={!URLENCODE(TransferApply__c.Id)}");
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js-meta.xml b/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js-meta.xml
new file mode 100644
index 0000000..b41eb1f
--- /dev/null
+++ b/force-app/main/default/lwc/lexDetailBulkUpdate/lexDetailBulkUpdate.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexDetailBulkUpdate">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__AppPage</target>
+        <target>lightning__RecordPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.js b/force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.js
index 04d513c..2076d74 100644
--- a/force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.js
+++ b/force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.js
@@ -1,3 +1,11 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-07 09:02:03
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-11 11:23:37
+ */
 import { api, wire,LightningElement } from 'lwc';
 import { CurrentPageReference } from "lightning/navigation";
 import { CloseActionScreenEvent } from 'lightning/actions';
@@ -28,7 +36,6 @@
 
     connectedCallback(){
         console.log(this.recordId);
-        this.IsLoading = false;
         this.DispatchOCSMQARA();
 
     }
@@ -51,8 +58,13 @@
             updateForDispatchOCSMQARAButton({
                 recordId: this.recordId
             }).then(result =>{
-                this.showToast("鎴愬姛","success");
-                this.updateRecordView(this.recordId);
+                if(result){
+                    this.showToast(result,"error");
+                }else{
+                    this.showToast("鎴愬姛","success");
+                    this.updateRecordView(this.recordId);
+                    this.IsLoading = false;
+                }
                 this.dispatchEvent(new CloseActionScreenEvent());
                 });
     }
diff --git a/force-app/main/default/lwc/lexEquipmentRentalPicturePDF/lexEquipmentRentalPicturePDF.css b/force-app/main/default/lwc/lexEquipmentRentalPicturePDF/lexEquipmentRentalPicturePDF.css
new file mode 100644
index 0000000..635bc6c
--- /dev/null
+++ b/force-app/main/default/lwc/lexEquipmentRentalPicturePDF/lexEquipmentRentalPicturePDF.css
@@ -0,0 +1,22 @@
+.outerBorderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    border-top : 3px solid #565959;
+}
+.borderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    margin-bottom : 7px;
+    border-top : 3px solid #565959;
+}
+.headerDorderCss{
+    border-top: 1px solid #565959;
+    border-bottom: 1px solid #D4D4D4;
+    padding:3px;
+}
+.centerCss{
+    text-align: center;
+}
+.centerCss .left{
+    margin-left: 100px;
+}/* sample css file */
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexEquipmentRentalPicturePDF/lexEquipmentRentalPicturePDF.html b/force-app/main/default/lwc/lexEquipmentRentalPicturePDF/lexEquipmentRentalPicturePDF.html
new file mode 100644
index 0000000..49a10f7
--- /dev/null
+++ b/force-app/main/default/lwc/lexEquipmentRentalPicturePDF/lexEquipmentRentalPicturePDF.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="sisToOPDHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexEquipmentRentalPicturePDF/lexEquipmentRentalPicturePDF.js b/force-app/main/default/lwc/lexEquipmentRentalPicturePDF/lexEquipmentRentalPicturePDF.js
new file mode 100644
index 0000000..bd82704
--- /dev/null
+++ b/force-app/main/default/lwc/lexEquipmentRentalPicturePDF/lexEquipmentRentalPicturePDF.js
@@ -0,0 +1,41 @@
+import { LightningElement, track, wire, api } from 'lwc';
+import { CurrentPageReference,NavigationMixin } from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init from '@salesforce/apex/EquipmentRentalPicturePDFController.init';
+export default class lexEquipmentRentalPicturePDF extends LightningElement {
+	@api recordId;
+		IsLoading = true;
+
+	@wire(CurrentPageReference)
+	getStateParameters(currentPageReference){
+		if(currentPageReference) {
+			const urlValue = currentPageReference.state.recordId;
+			if(urlValue) {
+				let str = `${urlValue}`;
+		        this.recordId = str;
+			}
+		}
+	}
+
+	connectedCallback(){
+		console.log(this.recordId);
+		init({
+			recordId: this.recordId
+		}).then(result=>{
+			//console.log('result.ShipmentRequestedCnt===' + result.ShipmentRequestedCnt)
+			if( result.ShipmentRequestedCnt > 0){
+				console.log(result.pagelength);
+				for(var i =0; i<result.pagelength; i++){
+					window.open('/apex/FixtureRentalPicturePDF?raid='+ this.recordId +'&page=' + i); 
+				}
+			}else{
+				alert('褰撳墠鐨勭敵璇峰崟涓病鏈夊凡鍑哄簱鎸囩ず鐨勯厤濂椼��');
+			}
+			this.dispatchEvent(new CloseActionScreenEvent());
+		}).catch(err=>{
+			this.dispatchEvent(new CloseActionScreenEvent());
+			console.log(err);
+		})
+	}
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexEquipmentRentalPicturePDF/lexEquipmentRentalPicturePDF.js-meta.xml b/force-app/main/default/lwc/lexEquipmentRentalPicturePDF/lexEquipmentRentalPicturePDF.js-meta.xml
new file mode 100644
index 0000000..74849f3
--- /dev/null
+++ b/force-app/main/default/lwc/lexEquipmentRentalPicturePDF/lexEquipmentRentalPicturePDF.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexOCMSubmit">
+    <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexFinLibrary/lexFinLibrary.css b/force-app/main/default/lwc/lexFinLibrary/lexFinLibrary.css
new file mode 100644
index 0000000..b606828
--- /dev/null
+++ b/force-app/main/default/lwc/lexFinLibrary/lexFinLibrary.css
@@ -0,0 +1,11 @@
+.lexFinlibraryHolder{
+ position: relative;
+ display: inline-block;
+ width: 80px;
+ height: 80px;
+ text-align: center;
+}
+
+.container .uiContainerManager{
+ display : none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexFinLibrary/lexFinLibrary.html b/force-app/main/default/lwc/lexFinLibrary/lexFinLibrary.html
new file mode 100644
index 0000000..aab9e0c
--- /dev/null
+++ b/force-app/main/default/lwc/lexFinLibrary/lexFinLibrary.html
@@ -0,0 +1,4 @@
+<template>
+<div class="lexFinlibraryHolder" if:true={IsLoding}>
+<lightning-spinner alternative-text="Loading" size="medium">  </lightning-spinner> </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexFinLibrary/lexFinLibrary.js b/force-app/main/default/lwc/lexFinLibrary/lexFinLibrary.js
new file mode 100644
index 0000000..febcdf5
--- /dev/null
+++ b/force-app/main/default/lwc/lexFinLibrary/lexFinLibrary.js
@@ -0,0 +1,55 @@
+import { LightningElement, track, wire,api } from 'lwc';
+import getBulletinBoard  from '@salesforce/apex/FinLibraryButtonController.getBulletinBoard';
+import {CurrentPageReference} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+export default class lexFinLibrary extends LightningElement {
+
+		@api recordId;
+		IsLoading;
+		Bulletin_Board__c;
+
+
+		@wire(CurrentPageReference)
+    getStateParameters(currentPageReference){
+    	if(currentPageReference){
+    		console.log(currentPageReference);
+    		console.log("杩涘叆鑾峰彇page鍙傛暟")
+    		const IdValue=currentPageReference.state.recordId;
+    		if(IdValue){
+    			let str=`${IdValue}`;
+    			this.recordId=str;
+    			console.log("recordId="+str);
+    		}
+    	}
+    }
+
+
+    connectedCallback(){
+    getBulletinBoard({recordId:this.recordId}).then(res=>{
+    	if(res!=null){
+    	this.IsLoading=false;
+    	console.log("res");
+    	console.log(res);
+    	console.log("杩涘叆鍒濆鍖栧璞″叾浠栧睘鎬�");
+    	this.Bulletin_Board__c=res;
+    	console.log(this.Bulletin_Board__c);
+        this.FinLibrary();
+    	}
+    	else{
+    		 var a="娌¤繘鏂规硶";
+ 			console.log(a);
+    	}
+    }).catch(error =>{
+    	console.log("error");
+    	console.log(error.message);
+    }).finally(()=>{
+
+    });
+    }
+
+    FinLibrary(){
+    	window.open(this.Bulletin_Board__c.iPad_Finlibrary__c, 'FinLibrary', '_top');
+    	this.dispatchEvent(new CloseActionScreenEvent());
+    }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexFinLibrary/lexFinLibrary.js-meta.xml b/force-app/main/default/lwc/lexFinLibrary/lexFinLibrary.js-meta.xml
new file mode 100644
index 0000000..79fced5
--- /dev/null
+++ b/force-app/main/default/lwc/lexFinLibrary/lexFinLibrary.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexFinLibrary">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+     <targets>
+        <target>lightning__AppPage</target>
+        <target>lightning__RecordPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexFinLibrary2/lexFinLibrary2.css b/force-app/main/default/lwc/lexFinLibrary2/lexFinLibrary2.css
new file mode 100644
index 0000000..bb273c4
--- /dev/null
+++ b/force-app/main/default/lwc/lexFinLibrary2/lexFinLibrary2.css
@@ -0,0 +1,11 @@
+.lexFinlibraryHolder2{
+ position: relative;
+ display: inline-block;
+ width: 80px;
+ height: 80px;
+ text-align: center;
+}
+
+.container .uiContainerManager{
+ display : none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexFinLibrary2/lexFinLibrary2.html b/force-app/main/default/lwc/lexFinLibrary2/lexFinLibrary2.html
new file mode 100644
index 0000000..81373b2
--- /dev/null
+++ b/force-app/main/default/lwc/lexFinLibrary2/lexFinLibrary2.html
@@ -0,0 +1,4 @@
+<template>
+<div class="lexFinlibraryHolder2" if:true={IsLoding}>
+<lightning-spinner alternative-text="Loading" size="medium">  </lightning-spinner> </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexFinLibrary2/lexFinLibrary2.js b/force-app/main/default/lwc/lexFinLibrary2/lexFinLibrary2.js
new file mode 100644
index 0000000..3db3717
--- /dev/null
+++ b/force-app/main/default/lwc/lexFinLibrary2/lexFinLibrary2.js
@@ -0,0 +1,62 @@
+import { LightningElement, track, wire,api } from 'lwc';
+import getBulletinBoard  from '@salesforce/apex/FinLibraryButtonController2.getBulletinBoard';
+import {CurrentPageReference} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+export default class lexFinLibrary2 extends LightningElement {
+
+
+	@api recordId;
+	IsLoading;
+	Bulletin_Board__c;
+
+
+	@wire(CurrentPageReference)
+    getStateParameters(currentPageReference){
+    	if(currentPageReference){
+    		console.log(currentPageReference);
+    		console.log("杩涘叆鑾峰彇page鍙傛暟")
+    		const IdValue=currentPageReference.state.recordId;
+    		if(IdValue){
+    			let str=`${IdValue}`;
+    			this.recordId=str;
+    			console.log("recordId="+str);
+    		}
+    	}
+    }
+
+
+
+
+    connectedCallback(){
+    getBulletinBoard({recordId:this.recordId}).then(res=>{
+    	if(res!=null){
+    	this.IsLoading=false;
+    	console.log("res");
+    	console.log(res);
+    	console.log("杩涘叆鍒濆鍖栧璞″叾浠栧睘鎬�");
+    	this.Bulletin_Board__c=res;
+    	console.log(this.Bulletin_Board__c);
+        this.FinLibrary2();
+    	}
+    	else{
+    		 var a="娌¤繘鏂规硶";
+ 			console.log(a);
+    	}
+    }).catch(error =>{
+    	console.log("error");
+    	console.log(error.message);
+    }).finally(()=>{
+
+    });
+    }
+
+
+    FinLibrary2(){
+
+
+    	window.open(this.Bulletin_Board__c.iPad_Finlibrary_2__c, 'FinLibrary', '_top');
+    	this.dispatchEvent(new CloseActionScreenEvent());
+
+    }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexFinLibrary2/lexFinLibrary2.js-meta.xml b/force-app/main/default/lwc/lexFinLibrary2/lexFinLibrary2.js-meta.xml
new file mode 100644
index 0000000..f128d90
--- /dev/null
+++ b/force-app/main/default/lwc/lexFinLibrary2/lexFinLibrary2.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexFinLibrary2">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+      <targets>
+        <target>lightning__AppPage</target>
+        <target>lightning__RecordPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexFinLibrary3/lexFinLibrary3.css b/force-app/main/default/lwc/lexFinLibrary3/lexFinLibrary3.css
new file mode 100644
index 0000000..69ceae8
--- /dev/null
+++ b/force-app/main/default/lwc/lexFinLibrary3/lexFinLibrary3.css
@@ -0,0 +1,11 @@
+.lexFinlibraryHolder3{
+ position: relative;
+ display: inline-block;
+ width: 80px;
+ height: 80px;
+ text-align: center;
+}
+
+.container .uiContainerManager{
+ display : none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexFinLibrary3/lexFinLibrary3.html b/force-app/main/default/lwc/lexFinLibrary3/lexFinLibrary3.html
new file mode 100644
index 0000000..2e542b1
--- /dev/null
+++ b/force-app/main/default/lwc/lexFinLibrary3/lexFinLibrary3.html
@@ -0,0 +1,4 @@
+<template>
+<div class="lexFinlibraryHolder3" if:true={IsLoding}>
+<lightning-spinner alternative-text="Loading" size="medium">  </lightning-spinner> </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexFinLibrary3/lexFinLibrary3.js b/force-app/main/default/lwc/lexFinLibrary3/lexFinLibrary3.js
new file mode 100644
index 0000000..21eca75
--- /dev/null
+++ b/force-app/main/default/lwc/lexFinLibrary3/lexFinLibrary3.js
@@ -0,0 +1,58 @@
+import { LightningElement, track, wire,api } from 'lwc';
+import getBulletinBoard  from '@salesforce/apex/FinLibraryButtonController3.getBulletinBoard';
+import {CurrentPageReference} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+export default class lexFinLibrary3 extends LightningElement {
+
+	@api recordId;
+	IsLoading;
+	Bulletin_Board__c;
+
+	@wire(CurrentPageReference)
+    getStateParameters(currentPageReference){
+    	if(currentPageReference){
+    		console.log(currentPageReference);
+    		console.log("杩涘叆鑾峰彇page鍙傛暟")
+    		const IdValue=currentPageReference.state.recordId;
+    		if(IdValue){
+    			let str=`${IdValue}`;
+    			this.recordId=str;
+    			console.log("recordId="+str);
+    		}
+    	}
+    }
+
+
+
+
+    connectedCallback(){
+    getBulletinBoard({recordId:this.recordId}).then(res=>{
+    	if(res!=null){
+    	this.IsLoading=false;
+    	console.log("res");
+    	console.log(res);
+    	console.log("杩涘叆鍒濆鍖栧璞″叾浠栧睘鎬�");
+    	this.Bulletin_Board__c=res;
+    	console.log(this.Bulletin_Board__c);
+        this.FinLibrary3();
+    	}
+    	else{
+    		 var a="娌¤繘鏂规硶";
+ 			console.log(a);
+    	}
+    }).catch(error =>{
+    	console.log("error");
+    	console.log(error.message);
+    }).finally(()=>{
+
+    });
+    }
+
+
+    FinLibrary3(){
+    	window.open(this.Bulletin_Board__c.iPad_Finlibrary_3__c, 'FinLibrary', '_top');
+    	this.dispatchEvent(new CloseActionScreenEvent());
+    }
+
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexFinLibrary3/lexFinLibrary3.js-meta.xml b/force-app/main/default/lwc/lexFinLibrary3/lexFinLibrary3.js-meta.xml
new file mode 100644
index 0000000..5323374
--- /dev/null
+++ b/force-app/main/default/lwc/lexFinLibrary3/lexFinLibrary3.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexFinLibrary3">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+     <targets>
+        <target>lightning__AppPage</target>
+        <target>lightning__RecordPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.css b/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.css
new file mode 100644
index 0000000..ebb43d9
--- /dev/null
+++ b/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.css
@@ -0,0 +1,10 @@
+.exampleHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.html b/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.html
new file mode 100644
index 0000000..3eff9e8
--- /dev/null
+++ b/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="EquipmentRentalPDF" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js b/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js
new file mode 100644
index 0000000..d2dbda3
--- /dev/null
+++ b/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js
@@ -0,0 +1,258 @@
+import { LightningElement,api, track, wire } from 'lwc';
+import {CurrentPageReference} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+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;
+	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 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.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 {
+			console.log("hhhh3");
+			let t=await getSessionId();
+			console.log(t);
+			window.sforce = window.sforce || {};
+			window.sforce.connection = window.sforce.connection || {};
+			window.sforce.connection.sessionId =t;
+			//154p 1388 yc 20211020
+			console.log("hhhh4");
+			let raid = RentalApply.Id+";"+this.id;
+			console.log(raid);
+			let rs1 = await approvalCheck({rentalApplyId:raid});
+			console.log(rs1);
+			if (rs1 != '1') {
+				// alert(rs1);
+				const event = new ShowToastEvent({
+					title: '鎻愮ず淇℃伅',
+					message:rs1
+				});
+				this.dispatchEvent(event);
+			} else {
+				//bp2 let rs2 = sforce.apex.execute("RentalApplyWebService", "reserve", {rentalApplyId: raid});
+				//bp2 if (rs2 != '1') {
+				//bp2 alert(rs2);
+				//bp2 } else {
+				setShipment_requests({raid:null,raesid: this.id}).then(res=>{
+					if (res == "鐘舵�佹洿鏂板埌宸插嚭搴撴寚绀�") {
+						// alert("鐘舵�佹洿鏂板埌宸插嚭搴撴寚绀�");
+						const event = new ShowToastEvent({
+							title: '鎻愮ず淇℃伅',
+							message:"鐘舵�佹洿鏂板埌宸插嚭搴撴寚绀�"
+						});
+						this.dispatchEvent(event);
+						print().then(res=>{
+							setTimeout(function() {location.href = "/"+this.RentalApplyC;}, 100);
+						});
+					} else {
+						// alert(res);
+						const event = new ShowToastEvent({
+							title: '鎻愮ず淇℃伅',
+							message:res
+						});
+						this.dispatchEvent(event);
+					}
+				})
+				// sforce.apex.execute("RentalApplyWebService", "setRaesShipment_request",
+				//  {raesid: this.id}
+				// 	,function(res) {
+				// 		if (res == "鐘舵�佹洿鏂板埌宸插嚭搴撴寚绀�") {
+				// 			alert("鐘舵�佹洿鏂板埌宸插嚭搴撴寚绀�");
+				// 			print().then(res=>{
+				// 				setTimeout(function() {location.href = "/"+this.RentalApplyC;}, 100);
+				// 			});
+				// 		} else {
+				// 			alert(res);
+				// 		}
+				// });
+			}
+		}
+
+		async function print(){
+			let sqlResult;
+			if(this.Bollow_Date__c != ''){
+				await selectRaesById1({recordId:RentalApply.Id}).then(res=>{
+					sqlResult=res;
+				});
+			}else{
+				await selectRaesById2({recordId:RentalApply.Id}).then(res=>{
+					sqlResult=res;
+				});
+			}
+			let records = sqlResult;
+			let size =records.length;
+			let length = size%10 ==0? size/10 : parseInt(size/10) +1;
+			for(let i =0;i<length;i++){
+				window.open('/apex/FixtureRentalPDF?raid=' + RentalApply.Id + '&page=' + i);
+			}
+		}
+
+
+		// function fixTime(time){
+		// 	if(time < 10) {time = "0" + time};
+		// 		return time;
+		// }
+
+		// function fixDate(date){
+		// 	let Month = fixTime(date.getMonth() + 1);
+		// 	let Day = fixTime(date.getDate());
+		// 	let UTC = date.toUTCString();
+		// 	let Time = UTC.substring(UTC.indexOf(':')-2, UTC.indexOf(':')+6);
+		// 	let Minutes = fixTime(date.getMinutes());
+		// 	let Seconds = fixTime(date.getSeconds());
+		// 	return date.getFullYear() + "-" + Month + "-" + Day + "T" + Time;
+		// }
+	}
+}
diff --git a/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js-meta.xml b/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js-meta.xml
new file mode 100644
index 0000000..0efa3b8
--- /dev/null
+++ b/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js-meta.xml
@@ -0,0 +1,11 @@
+<?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__AppPage</target>
+        <target>lightning__RecordPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
diff --git a/force-app/main/default/lwc/lexLoseBid/__tests__/lexLoseBid.test.js b/force-app/main/default/lwc/lexLoseBid/__tests__/lexLoseBid.test.js
new file mode 100644
index 0000000..559fd0b
--- /dev/null
+++ b/force-app/main/default/lwc/lexLoseBid/__tests__/lexLoseBid.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexLoseBid from 'c/lexLoseBid';
+
+describe('c-lex-lose-bid', () => {
+    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-bid', {
+            is: LexLoseBid
+        });
+
+        // Act
+        document.body.appendChild(element);
+
+        // Assert
+        // const div = element.shadowRoot.querySelector('div');
+        expect(1).toBe(1);
+    });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLoseBid/lexLoseBid.css b/force-app/main/default/lwc/lexLoseBid/lexLoseBid.css
new file mode 100644
index 0000000..fe3c9f1
--- /dev/null
+++ b/force-app/main/default/lwc/lexLoseBid/lexLoseBid.css
@@ -0,0 +1,18 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-13 10:31:18
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-13 10:46:09
+ */
+.lexLoseBidHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLoseBid/lexLoseBid.html b/force-app/main/default/lwc/lexLoseBid/lexLoseBid.html
new file mode 100644
index 0000000..6c30e33
--- /dev/null
+++ b/force-app/main/default/lwc/lexLoseBid/lexLoseBid.html
@@ -0,0 +1,6 @@
+<template>
+    <div class="lexLoseBidHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLoseBid/lexLoseBid.js b/force-app/main/default/lwc/lexLoseBid/lexLoseBid.js
new file mode 100644
index 0000000..db1b2da
--- /dev/null
+++ b/force-app/main/default/lwc/lexLoseBid/lexLoseBid.js
@@ -0,0 +1,89 @@
+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.initForLoseBidButton';
+import updateForLoseBidButton  from '@salesforce/apex/OpportunityLightingButtonController.updateForLoseBidButton';
+import queryForLexLoseBidButton  from '@salesforce/apex/OpportunityLightingButtonController.queryForLoseBidButton';
+export default class LexLoseBid extends LightningElement {
+    @api recordId;
+    ifOpenBid;
+    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.ifOpenBid = result.ifOpenBid;
+            this.lexLoseBid();
+        }).catch(error=>{
+            console.log("error");
+            console.log(error);
+        })
+    }
+    lexLoseBid(){
+        console.log("query start");
+        queryForLexLoseBidButton({
+            recordId: this.recordId
+        }).then(result=>{
+            console.log("query end");
+            console.log(result);
+            var flag = true;
+            var taskslist = result;
+            for(var task of taskslist ){
+                if(task.taskStatus__c != '04 鍙栨秷'){
+                flag = false;
+            }
+            }
+            if(this.ifOpenBid == '闈炲叕寮�鎷涙爣'){
+                flag = false;
+            }
+    
+            if(flag){
+                this.showToast("鏉′欢涓嶇鍚堬紝涓嶅彲鎿嶄綔","error");
+            }else{
+                if (window.confirm('鏄惁纭绔炰簤瀵规墜涓爣锛�')) {
+                    updateForLoseBidButton({
+                        recordId: this.recordId
+                    }).then(result=>{
+                        if (result) {
+                            this.showToast(result,"error");
+                        }else{
+                            this.IsLoading = false;
+                            this.updateRecordView(this.recordId);
+                            this.showToast("鎿嶄綔鎴愬姛锛�","success");
+                        }
+                    })  
+                }
+            }
+        });    
+    }
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            title: '',
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLoseBid/lexLoseBid.js-meta.xml b/force-app/main/default/lwc/lexLoseBid/lexLoseBid.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexLoseBid/lexLoseBid.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>54.0</apiVersion>
+	<isExposed>true</isExposed>
+	<targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLoseReport/__tests__/lexLoseReport.test.js b/force-app/main/default/lwc/lexLoseReport/__tests__/lexLoseReport.test.js
new file mode 100644
index 0000000..12c14ec
--- /dev/null
+++ b/force-app/main/default/lwc/lexLoseReport/__tests__/lexLoseReport.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexLoseReport from 'c/lexLoseReport';
+
+describe('c-lex-lose-report', () => {
+    afterEach(() => {
+        // The jsdom instance is shared across test cases in a single file so reset the DOM
+        while (document.body.firstChild) {
+            document.body.removeChild(document.body.firstChild);
+        }
+    });
+
+    it('TODO: test case generated by CLI command, please fill in test logic', () => {
+        // Arrange
+        const element = createElement('c-lex-lose-report', {
+            is: LexLoseReport
+        });
+
+        // Act
+        document.body.appendChild(element);
+
+        // Assert
+        // const div = element.shadowRoot.querySelector('div');
+        expect(1).toBe(1);
+    });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLoseReport/lexLoseReport.css b/force-app/main/default/lwc/lexLoseReport/lexLoseReport.css
new file mode 100644
index 0000000..93da52a
--- /dev/null
+++ b/force-app/main/default/lwc/lexLoseReport/lexLoseReport.css
@@ -0,0 +1,10 @@
+.lexLoseReportHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLoseReport/lexLoseReport.html b/force-app/main/default/lwc/lexLoseReport/lexLoseReport.html
new file mode 100644
index 0000000..d7e25f9
--- /dev/null
+++ b/force-app/main/default/lwc/lexLoseReport/lexLoseReport.html
@@ -0,0 +1,6 @@
+<template>
+    <div class="lexLoseReportHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLoseReport/lexLoseReport.js b/force-app/main/default/lwc/lexLoseReport/lexLoseReport.js
new file mode 100644
index 0000000..7b167ea
--- /dev/null
+++ b/force-app/main/default/lwc/lexLoseReport/lexLoseReport.js
@@ -0,0 +1,102 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-14 10:16:19
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-14 10:41:46
+ */
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import init  from '@salesforce/apex/OpportunityLightingButtonController.initForLostReportButton';
+export default class LexLoseReport extends LightningElement {
+    @api recordId;
+    stageName;
+    sapSendOK;
+    cntLostCancelReport;
+    name;
+    salesAssistantName;
+    salesAssistantID;
+    managerName;
+    salesManagerDepartmentID;
+    salesOwnerBuchang;
+    salesOwnerBuchangID;
+    IsLoading = true;
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+            console.log(111);
+            console.log(currentPageReference);
+
+        if (currentPageReference) {
+          const urlValue = currentPageReference.state.recordId;
+          if (urlValue) {
+            let str = `${urlValue}`;
+            console.log("str");
+            console.log(str);
+            this.recordId = str;
+          }
+        }
+    }
+    connectedCallback(){
+        init({
+            recordId: this.recordId
+        }).then(result=>{
+            this.stageName = result.stageName;
+            this.sapSendOK = result.sapSendOK;
+            this.cntLostCancelReport = result.cntLostCancelReport;
+            this.name = result.name;
+            this.salesAssistantID = result.salesAssistantID;
+            this.salesAssistantName = result.salesAssistantName;
+            this.managerName = result.managerName;
+            this.salesManagerDepartmentID = result.salesManagerDepartmentID;
+            this.salesOwnerBuchang = result.salesOwnerBuchang;
+            this.salesOwnerBuchangID = result.salesOwnerBuchangID;
+            this.loseReport();
+        })
+    }
+    loseReport(){
+        // js銇牬鍚堛�佺炕瑷炽仌銈屻仧鍊ゃ亴銇с倠銇仹銆佽娉ㄦ剰
+        if (this.stageName != '寮曞悎'
+        && this.stageName != '璇环'
+        ) {
+            this.showToast("鐘舵��1:" + this.stageName + "銆佷笉鑳藉仛 澶卞崟 浜嗭紒","error");
+        }
+        else if (this.sapSendOK == '1') {
+            this.showToast("宸茬粡涓婁紶SAP銆佷笉鑳藉仛 澶卞崟 浜嗭紒","error");
+        }
+        else if (this.cntLostCancelReport > 0) {
+            this.showToast("璇环宸茬粡鏈� 鍙栨秷锛忓け鍗曟姤鍛� 浜嗭紒","error");
+        }
+        //else if({!Not(ISBLANK(Opportunity.Bidding_Project_Name_Bid__c))} && //'{!Opportunity.InfoTypeBid__c}' != '3锛氱粨鏋�' ){
+        //alert("鍏宠仈鎷涙姇鏍囬」鐩殑璇环锛屽彧鑳藉湪鏈夌粨鏋滃悗鍋氬け鍗曟姤鍛婏紒");
+        //}
+        else {
+            location.href = '/a1U/e?retURL=%2F' + this.recordId +
+            '&RecordType=01210000000R4hM' +
+            '&CF00N10000004lbGT=' + this.name +
+            '&CF00N10000004lbGT_lkid=' + this.recordId +
+            '&CF00N10000006QShg=' + this.salesAssistantName +
+            '&CF00N10000006QShg_lkid=' + this.salesAssistantID +
+            '&CF00N10000006QShq=' + this.managerName +
+            '&CF00N10000006QShq_lkid=' + this.salesManagerDepartmentID +
+            '&CF00N10000006QShb=' + this.salesOwnerBuchang +
+            '&CF00N10000006QShb_lkid=' + this.salesOwnerBuchangID +
+            '';
+        }
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            title: '',
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+    }
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLoseReport/lexLoseReport.js-meta.xml b/force-app/main/default/lwc/lexLoseReport/lexLoseReport.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexLoseReport/lexLoseReport.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>54.0</apiVersion>
+	<isExposed>true</isExposed>
+	<targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.css b/force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.css
new file mode 100644
index 0000000..af18c76
--- /dev/null
+++ b/force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.css
@@ -0,0 +1,11 @@
+.Holder{
+	position: relative;
+	display: inline-block;
+	width: 80px;
+	height: 80px;
+	text-align: center;
+}
+
+.container .uiContainerManager{
+	display : none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.html b/force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.html
new file mode 100644
index 0000000..2ef2898
--- /dev/null
+++ b/force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.html
@@ -0,0 +1,5 @@
+<template>
+	<div class="Holder" if:true={IsLoading}>
+      	<lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+  	</div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.js b/force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.js
new file mode 100644
index 0000000..5d79272
--- /dev/null
+++ b/force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.js
@@ -0,0 +1,39 @@
+import { LightningElement, track, wire, api } from 'lwc';
+import {CurrentPageReference} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+
+export default class lexLostReturnDeliverySlip extends LightningElement {
+	@api recordId;
+  
+
+    @wire(CurrentPageReference)
+	getStateParameters(currentPageReference){
+		console.log("杩涘叆椤甸潰");
+		console.log(currentPageReference);
+		if(currentPageReference){
+			const urvalue=currentPageReference.state.recordId;
+			if(urvalue){
+				let str=`${urvalue}`;
+				console.log('str');
+				console.log(str);
+				this.recordId=str;
+			}
+		}
+	}
+
+	connectedCallback(){
+
+		this.cancelSubmit().then(res=>{
+			this.IsLoading=false;
+			this.dispatchEvent(new CloseActionScreenEvent());
+		});
+	}
+
+	async cancelSubmit(){
+		window.open('/apex/Lost_Return_DeliverySlip?id='+this.recordId,'LostReturnDeliverySlip', 'width=600,height=200');
+	}
+
+	//old js
+	// window.open('/apex/Lost_Return_DeliverySlip?id={!TransferApply__c.Id}');
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.js-meta.xml b/force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.js-meta.xml
new file mode 100644
index 0000000..d8dfadb
--- /dev/null
+++ b/force-app/main/default/lwc/lexLostReturnDeliverySlip/lexLostReturnDeliverySlip.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexLostReturnDeliverySlip">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__AppPage</target>
+        <target>lightning__RecordPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexMainFixtureSelect/lexMainFixtureSelect.css b/force-app/main/default/lwc/lexMainFixtureSelect/lexMainFixtureSelect.css
new file mode 100644
index 0000000..635bc6c
--- /dev/null
+++ b/force-app/main/default/lwc/lexMainFixtureSelect/lexMainFixtureSelect.css
@@ -0,0 +1,22 @@
+.outerBorderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    border-top : 3px solid #565959;
+}
+.borderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    margin-bottom : 7px;
+    border-top : 3px solid #565959;
+}
+.headerDorderCss{
+    border-top: 1px solid #565959;
+    border-bottom: 1px solid #D4D4D4;
+    padding:3px;
+}
+.centerCss{
+    text-align: center;
+}
+.centerCss .left{
+    margin-left: 100px;
+}/* sample css file */
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexMainFixtureSelect/lexMainFixtureSelect.html b/force-app/main/default/lwc/lexMainFixtureSelect/lexMainFixtureSelect.html
new file mode 100644
index 0000000..49a10f7
--- /dev/null
+++ b/force-app/main/default/lwc/lexMainFixtureSelect/lexMainFixtureSelect.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="sisToOPDHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexMainFixtureSelect/lexMainFixtureSelect.js b/force-app/main/default/lwc/lexMainFixtureSelect/lexMainFixtureSelect.js
new file mode 100644
index 0000000..4145e2e
--- /dev/null
+++ b/force-app/main/default/lwc/lexMainFixtureSelect/lexMainFixtureSelect.js
@@ -0,0 +1,33 @@
+import { LightningElement, track, wire, api } from 'lwc';
+import { CurrentPageReference,NavigationMixin } from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+
+import init from '@salesforce/apex/MainFixtureSelectButtonController.init';
+export default class lexMainFixtureSelect extends LightningElement {
+	@api recordId;
+	IsLoading = true;
+
+	@wire(CurrentPageReference)
+	getStateParameters(currentPageReference){
+		if(currentPageReference) {
+			const urlValue = currentPageReference.state.recordId;
+			if(urlValue) {
+				let str = `${urlValue}`;
+		        this.recordId = str;
+			}
+		}
+	}
+
+
+	connectedCallback(){
+		init({
+			recordId:this.recordId
+		}).then(res=>{
+			window.open("/apex/MainFixtureSelect?pt_recid=" + res, "_top");
+			this.dispatchEvent(new CloseActionScreenEvent());
+		}).catch(err=>{
+			console.log(err);
+			this.dispatchEvent(new CloseActionScreenEvent());
+		})
+	}
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexMainFixtureSelect/lexMainFixtureSelect.js-meta.xml b/force-app/main/default/lwc/lexMainFixtureSelect/lexMainFixtureSelect.js-meta.xml
new file mode 100644
index 0000000..74849f3
--- /dev/null
+++ b/force-app/main/default/lwc/lexMainFixtureSelect/lexMainFixtureSelect.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexOCMSubmit">
+    <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.js b/force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.js
index 06e8cda..b4a883a 100644
--- a/force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.js
+++ b/force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.js
@@ -1,3 +1,11 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-03-28 15:59:44
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-11 11:24:51
+ */
 import { api, wire,LightningElement } from 'lwc';
 import { CurrentPageReference } from "lightning/navigation";
 import { CloseActionScreenEvent } from 'lightning/actions';
@@ -32,13 +40,17 @@
 
 
     connectedCallback(){
+        console.log("123");
         init({
             recordId: this.recordId
         }).then(result=>{
+            console.log(result);
             this.OCSMAdministrativeReportDate = result.OCSMAdministrativeReportDate;
             this.OCSMAdministrativeReportNumber = result.OCSMAdministrativeReportNumber;
             this.AwareDate = result.awareDate;
             this.noToReport();
+        }).catch(error=>{
+            console.log(error);
         });
     }
 
@@ -70,8 +82,13 @@
            updateForOCSMNoToReportButton({
                 recordId: this.recordId
            }).then(result=>{
+            if(result){
+                this.showToast(result,"error");
+            }else{
                 this.showToast("OCSM涓嶈鎶ュ憡鎴愬姛","success");
                 this.updateRecordView(this.recordId);
+                this.IsLoading = false;
+            }
                 this.dispatchEvent(new CloseActionScreenEvent());
            });
         }else{
diff --git a/force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.css b/force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.css
new file mode 100644
index 0000000..79456f2
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.css
@@ -0,0 +1,22 @@
+.outerBorderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    border-top : 3px solid #565959;
+}
+.borderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    margin-bottom : 7px;
+    border-top : 3px solid #565959;
+}
+.headerDorderCss{
+    border-top: 1px solid #565959;
+    border-bottom: 1px solid #D4D4D4;
+    padding:3px;
+}
+.centerCss{
+    text-align: center;
+}
+.centerCss .left{
+    margin-left: 100px;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.html b/force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.html
new file mode 100644
index 0000000..c8bdbfc
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.html
@@ -0,0 +1,5 @@
+<template>
+   <div class="sisToOPDHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.js b/force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.js
new file mode 100644
index 0000000..2c3c93c
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.js
@@ -0,0 +1,105 @@
+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.initForlexOCSMNoToReportLightingButton';
+import updateQis  from '@salesforce/apex/QISReportController.updateQisForlexOCSMNoToReportLighting';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { updateRecord } from 'lightning/uiRecordApi';
+
+export default class lexOCSMNoToReportLighting extends LightningElement {
+	@api recordId;
+	IsLoading = true;
+	qisReportId;
+	OCSMAdministrativeReportNumber;
+    OCSMAdministrativeReportDate;
+    Awaredate;
+    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.OCSMAdministrativeReportNumber = result.oCSMAdministrativeReportNumber;
+            this.OCSMAdministrativeReportDate = result.oCSMAdministrativeReportDate;
+            this.qisReportId = result.Id;
+            this.Awaredate = result.awaredate;
+            if (!confirm("涓嶈鎶ュ憡鍚庢棤娉曟挙鍥烇紝鏄惁缁х画锛�")) {
+            		this.dispatchEvent(new CloseActionScreenEvent());
+                    return;
+        	}
+            if (this.OCSMAdministrativeReportDate != null || this.OCSMAdministrativeReportNumber != null) {
+            		const evt = new ShowToastEvent({
+                            title : '宸茬粡鎶ュ憡鐨凲IS锛屼笉鍙互鐐瑰嚮OCSM涓嶈鎶ュ憡',
+                            message: '',
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        return;
+            }
+         	if (this.Awaredate!=null) {
+         		this.updateQisSubmit();
+         	}else{
+         		const evt = new ShowToastEvent({
+                        title : '娌℃湁AwareDate鎴栧凡缁廜CSM琛屾斂鎶ュ憡锛岃纭',
+                        message: '',
+                        variant: 'error'
+                    });
+                    this.dispatchEvent(evt);
+                    this.dispatchEvent(new CloseActionScreenEvent());
+                    return;
+         	}
+        }).catch(error => {
+            console.log('error='+error);
+        }).finally(() => {
+            
+        }); 
+    }
+
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+
+    updateQisSubmit(){
+        	updateQis({
+        		 recordId: this.recordId
+        		}).then(result =>{
+        			console.log('result'+result);
+                     this.err = result;
+        			if (result!='鎴愬姛') {
+                        const evt = new ShowToastEvent({
+                            title : '鏇存柊澶辫触',
+                            message: this.err,
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                    }
+                this.dispatchEvent(new CloseActionScreenEvent());
+                this.updateRecordView(this.recordId);
+        		}).catch(error => {
+            console.log('error='+error);
+        }).finally(() => {
+            
+        });
+    }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.js-meta.xml b/force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.js-meta.xml
new file mode 100644
index 0000000..791ff80
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexOCSMNoToReportLighting">
+   <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.css b/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.css
new file mode 100644
index 0000000..635bc6c
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.css
@@ -0,0 +1,22 @@
+.outerBorderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    border-top : 3px solid #565959;
+}
+.borderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    margin-bottom : 7px;
+    border-top : 3px solid #565959;
+}
+.headerDorderCss{
+    border-top: 1px solid #565959;
+    border-bottom: 1px solid #D4D4D4;
+    padding:3px;
+}
+.centerCss{
+    text-align: center;
+}
+.centerCss .left{
+    margin-left: 100px;
+}/* sample css file */
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.html b/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.html
new file mode 100644
index 0000000..49a10f7
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="sisToOPDHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.js b/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.js
new file mode 100644
index 0000000..f7be272
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.js
@@ -0,0 +1,101 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { NavigationMixin } from 'lightning/navigation';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { updateRecord } from 'lightning/uiRecordApi';
+import init  from '@salesforce/apex/QISReportController.initForlexRCRecievedButton';
+import updateQis  from '@salesforce/apex/QISReportController.updateQisForRCRecieved';
+
+export default class lexOCSMNogoods extends LightningElement {
+	@api recordId;
+	err;
+	IsLoading = true;
+	qisReportId;
+	qisStatus;
+	isAEProfile;
+	isCNBuy;
+	 @wire(CurrentPageReference)
+     getStateParameters(currentPageReference) {
+             console.log(111);
+             console.log(currentPageReference);
+
+         if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             console.log("str");
+             console.log(str);
+             this.recordId = str;
+           }
+         }
+     }
+
+     connectedCallback () {
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            this.IsLoading = false;
+            this.qisReportId = result.Id;
+            this.qisStatus = result.qIStatus;
+            this.isAEProfile = result.isAEProfile;
+            this.isCNBuy = result.isCNBuy;
+            console.log('this.qisStatus='+this.qisStatus);   
+         	if (this.qisStatus!='RC妫�娴嬬敵璇�') {
+                const evt = new ShowToastEvent({
+                        title : 'OCM鏈嶅姟鏈儴宸茬粡鏀跺埌瀹炵墿',
+                        message: '',
+                        variant: 'error'
+                    });
+                this.dispatchEvent(evt);
+                this.dispatchEvent(new CloseActionScreenEvent());
+                return;
+         	}else{
+         		if (this.isAEProfile == null || this.isPAEProfile == null || this.isCNBuy != 'true') {
+         			const evt = new ShowToastEvent({
+                        title : '瀹夊叏淇℃伅鏈垽瀹氾紝璇疯仈绯昏川閲忔硶瑙勯儴',
+                        message: '',
+                        variant: 'error'
+                    });
+	                this.dispatchEvent(evt);
+	                this.dispatchEvent(new CloseActionScreenEvent());
+	                return;
+         		}else{
+         			this.updateQisSubmit();
+         		}
+         	}
+        }).catch(error => {
+            console.log('error='+error);
+        }).finally(() => {
+            
+        }); 
+    }
+
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+
+    updateQisSubmit(){
+        	updateQis({
+        		 recordId: this.recordId
+        		}).then(result =>{
+                    
+        			console.log('result'+result);
+        			this.err = result;
+        			if (result!='鎴愬姛') {
+                        const evt = new ShowToastEvent({
+                            title : '鏇存柊澶辫触',
+                            message: this.err,
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                    }
+                this.dispatchEvent(new CloseActionScreenEvent());
+                this.updateRecordView(this.recordId);
+        		}).catch(error => {
+           				 console.log('error='+error);
+		        }).finally(() => {
+		            
+		        });
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.js-meta.xml b/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.js-meta.xml
new file mode 100644
index 0000000..7881cfb
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMNogoods/lexOCSMNogoods.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexOCSMNogoods">
+     <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.js b/force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.js
index 4f69994..a7d8d5f 100644
--- a/force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.js
+++ b/force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.js
@@ -1,3 +1,11 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-07 09:02:03
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-11 11:26:11
+ */
 import { api, wire,LightningElement } from 'lwc';
 import { CurrentPageReference } from "lightning/navigation";
 import { CloseActionScreenEvent } from 'lightning/actions';
@@ -35,7 +43,6 @@
         }).then(result => {
             console.log(result);
             if (result != null) {
-                this.IsLoading = false;
                 this.OCSMAdministrativeReportStatus = result.OCSMAdministrativeReportStatus;
                 this.awareDate = result.awareDate;
                 this.toReport();
@@ -43,8 +50,6 @@
         }).catch(error => {
             console.log("error");
             console.log(error);
-        }).finally(() => {
-            
         });
 
     }
@@ -74,8 +79,13 @@
             updateForOCSMToReportButton({
                 recordId: this.recordId
             }).then(result =>{
-                this.showToast("鎴愬姛","success");
-                this.updateRecordView(this.recordId);
+                if(result){
+                    this.showToast(result,"error");
+                }else{
+                    this.showToast("鎴愬姛","success");
+                    this.updateRecordView(this.recordId);
+                    this.IsLoading = false;
+                }
                 this.dispatchEvent(new CloseActionScreenEvent());
                 });
         }else{
diff --git a/force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.css b/force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.css
new file mode 100644
index 0000000..0ca9d8e
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.css
@@ -0,0 +1,10 @@
+.toReportHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}/* sample css file *//* sample css file */
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.html b/force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.html
new file mode 100644
index 0000000..c8bdbfc
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.html
@@ -0,0 +1,5 @@
+<template>
+   <div class="sisToOPDHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.js b/force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.js
new file mode 100644
index 0000000..fe89267
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.js
@@ -0,0 +1,89 @@
+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.initForlexOCSMToReportLightingButton';
+import updateQis  from '@salesforce/apex/QISReportController.updateQisForlexOCSMToReportLighting';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { updateRecord } from 'lightning/uiRecordApi';
+
+export default class lexOCSMToReportLighting extends LightningElement {
+	@api recordId;
+    str;
+    err;
+    IsLoading = true;
+    qisReportId;
+    OCSMAdministrativeReportStatus;
+    Awaredate;
+
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+        if (currentPageReference) {
+            const urlValue = currentPageReference.state.recordId;
+            if (urlValue) {
+                let str = `${urlValue}`;
+                this.recordId = str;
+            }
+        }
+    }
+
+    connectedCallback() {
+        console.log(this.recordId);
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            console.log(result);
+                this.IsLoading = false;
+                this.OCSMAdministrativeReportStatus = result.oCSMAdministrativeReportStatus;
+                this.qisReportId = result.Id;
+                this.Awaredate = result.awaredate;
+                if (!confirm("涓嶈鎶ュ憡鍚庢棤娉曟挙鍥烇紝鏄惁缁х画锛�")) {
+            		this.dispatchEvent(new CloseActionScreenEvent());
+                    return;
+        		}
+        		if (this.OCSMAdministrativeReportStatus == null && this.Awaredate!=null) {
+	         		this.updateQisSubmit();
+	         	}else{
+	         		const evt = new ShowToastEvent({
+                            title : '娌℃湁AwareDate鎴栧凡缁廜CSM琛屾斂鎶ュ憡锛岃纭',
+                            message: '',
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        return;
+	         	}
+        }).catch(error => {
+            console.log(error);
+        }).finally(() => {
+
+        });
+    }
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+
+    updateQisSubmit(){
+        	updateQis({
+        		 recordId: this.recordId
+        		}).then(result =>{
+        			console.log('result'+result);
+                     this.err = result;
+        			if (result!='鎴愬姛') {
+                        const evt = new ShowToastEvent({
+                            title : '鏇存柊澶辫触',
+                            message: this.err,
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                    }
+                this.dispatchEvent(new CloseActionScreenEvent());
+                this.updateRecordView(this.recordId);
+        		}).catch(error => {
+            console.log('error='+error);
+        }).finally(() => {
+            
+        });
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.js-meta.xml b/force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.js-meta.xml
new file mode 100644
index 0000000..b0e1001
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexOCSMToReportLighting">
+   <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOLYwinBid/__tests__/lexOLYwinBid.test.js b/force-app/main/default/lwc/lexOLYwinBid/__tests__/lexOLYwinBid.test.js
new file mode 100644
index 0000000..a030bea
--- /dev/null
+++ b/force-app/main/default/lwc/lexOLYwinBid/__tests__/lexOLYwinBid.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexOLYwinBid from 'c/lexOLYwinBid';
+
+describe('c-lex-ol-ywin-bid', () => {
+    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-ol-ywin-bid', {
+            is: LexOLYwinBid
+        });
+
+        // Act
+        document.body.appendChild(element);
+
+        // Assert
+        // const div = element.shadowRoot.querySelector('div');
+        expect(1).toBe(1);
+    });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOLYwinBid/lexOLYwinBid.css b/force-app/main/default/lwc/lexOLYwinBid/lexOLYwinBid.css
new file mode 100644
index 0000000..a9b43eb
--- /dev/null
+++ b/force-app/main/default/lwc/lexOLYwinBid/lexOLYwinBid.css
@@ -0,0 +1,10 @@
+.lexOLYwinBidHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOLYwinBid/lexOLYwinBid.html b/force-app/main/default/lwc/lexOLYwinBid/lexOLYwinBid.html
new file mode 100644
index 0000000..cdbdc27
--- /dev/null
+++ b/force-app/main/default/lwc/lexOLYwinBid/lexOLYwinBid.html
@@ -0,0 +1,6 @@
+<template>
+    <div class="lexOLYwinBidHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOLYwinBid/lexOLYwinBid.js b/force-app/main/default/lwc/lexOLYwinBid/lexOLYwinBid.js
new file mode 100644
index 0000000..3aa9239
--- /dev/null
+++ b/force-app/main/default/lwc/lexOLYwinBid/lexOLYwinBid.js
@@ -0,0 +1,97 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-13 13:15:52
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-13 13:37:19
+ */
+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.initForOLYwinBidButton';
+import updateForOLYwinBidButton  from '@salesforce/apex/OpportunityLightingButtonController.updateForOLYwinBidButton';
+import queryForOLYwinBidButton  from '@salesforce/apex/OpportunityLightingButtonController.queryForOLYwinBidButton';
+export default class LexOLYwinBid extends LightningElement {
+    @api recordId;
+    ifOpenBid;
+    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.ifOpenBid = result.ifOpenBid;
+            this.lexLoseBid();
+        }).catch(error=>{
+            console.log("error");
+            console.log(error);
+        })
+    }
+    lexLoseBid(){
+        console.log("query start");
+        queryForOLYwinBidButton({
+            recordId: this.recordId
+        }).then(result=>{
+            console.log("query end");
+            console.log(result);
+            var flag = true;
+            var taskslist = result;
+            for(var task of taskslist ){
+                if(task.taskStatus__c != '04 鍙栨秷'){
+                flag = false;
+            }
+            }
+            if(this.ifOpenBid == '闈炲叕寮�鎷涙爣'){
+                flag = false;
+            }
+    
+            if(flag){
+                this.showToast("鏉′欢涓嶇鍚堬紝涓嶅彲鎿嶄綔","error");
+            }else{
+                if (window.confirm('鏄惁纭OLY涓爣锛�')) {
+                    updateForOLYwinBidButton({
+                        recordId: this.recordId
+                    }).then(result=>{
+                        if (result) {
+                            this.showToast(result,"error");
+                        }else{
+                            this.IsLoading = false;
+                            this.updateRecordView(this.recordId);
+                            this.showToast("鎿嶄綔鎴愬姛锛�","success");
+                        }
+                    })  
+                }
+            }
+        });    
+    }
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            title: '',
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOLYwinBid/lexOLYwinBid.js-meta.xml b/force-app/main/default/lwc/lexOLYwinBid/lexOLYwinBid.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexOLYwinBid/lexOLYwinBid.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>54.0</apiVersion>
+	<isExposed>true</isExposed>
+	<targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOPDtoSIS/lexOPDtoSIS.js b/force-app/main/default/lwc/lexOPDtoSIS/lexOPDtoSIS.js
index c283bb6..3d287d0 100644
--- a/force-app/main/default/lwc/lexOPDtoSIS/lexOPDtoSIS.js
+++ b/force-app/main/default/lwc/lexOPDtoSIS/lexOPDtoSIS.js
@@ -1,3 +1,11 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-07 09:02:03
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-11 11:27:14
+ */
 import { api, wire,LightningElement } from 'lwc';
 import { CurrentPageReference } from "lightning/navigation";
 import { CloseActionScreenEvent } from 'lightning/actions';
@@ -47,8 +55,6 @@
         }).catch(error => {
             console.log("error");
             console.log(error);
-        }).finally(() => {
-            
         });
 
     }
@@ -71,15 +77,19 @@
             updateForOPDtoSISButton({
                 recordId: this.recordId
             }).then(result =>{
-                this.updateRecordView(this.recordId);
-                this.showToast("鎴愬姛锛�","success");
+                if(result){
+                    this.showToast(result,"error");
+                }else{
+                    this.updateRecordView(this.recordId);
+                    this.showToast("鎴愬姛锛�","success");
+                    this.IsLoading = false;
+                }
                 this.dispatchEvent(new CloseActionScreenEvent());
                 });
             } else {
                 this.showToast("鍙崏妗堜腑鐘舵�佸強OPD/SIS鎶ュ憡涔︾殑鎵�鏈変汉鍙互鎻愪氦","error");
                 this.dispatchEvent(new CloseActionScreenEvent());
             }
-            this.IsLoading = false;
         
     }
 }
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.css b/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.css
new file mode 100644
index 0000000..f708a55
--- /dev/null
+++ b/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.css
@@ -0,0 +1,10 @@
+.opdToSISHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}/* sample css file */
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.html b/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.html
new file mode 100644
index 0000000..cc6a015
--- /dev/null
+++ b/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="opdToSISHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.js b/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.js
new file mode 100644
index 0000000..55e5142
--- /dev/null
+++ b/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.js
@@ -0,0 +1,100 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { NavigationMixin } from 'lightning/navigation';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import init  from '@salesforce/apex/QISReportController.initForlexOSHInspectButton';
+import updateQis  from '@salesforce/apex/QISReportController.updateQisForlexOSHInspect';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { updateRecord } from 'lightning/uiRecordApi';
+
+export default class lexOSHInspect extends LightningElement {
+	@api recordId;
+	IsLoading = true;
+	qisReportId;
+	qisStatus;
+	oSHInspectionDate;
+    err;
+    @wire(CurrentPageReference)
+     getStateParameters(currentPageReference) {
+             console.log(111);
+             console.log(currentPageReference);
+
+         if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             console.log("str");
+             console.log(str);
+             this.recordId = str;
+           }
+         }
+     }
+
+
+    connectedCallback () {
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            this.IsLoading = false;
+            this.qisReportId = result.Id;
+            this.qisStatus = result.qIStatus;
+            this.oSHInspectionDate = result.oSHInspectionDate;
+         	if (this.qisStatus!='OSH妫�娴嬩腑') {
+         		const evt = new ShowToastEvent({
+                            title : '闇�瑕佸厛鐐瑰嚮锛籓SH鐜板搧鏀跺埌锛�',
+                            message: '',
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        return;
+         	}else if(this.oSHInspectionDate != null){
+         		const evt = new ShowToastEvent({
+                            title : 'OSH妫�娴嬪凡缁忓彈鐞�',
+                            message: '',
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        return;
+         	}else{
+         		this.updateQisSubmit();
+         	}
+         	
+    
+			
+        }).catch(error => {
+            console.log('error='+error);
+        }).finally(() => {
+            
+        }); 
+    }
+
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+
+    updateQisSubmit(){
+        	updateQis({
+        		 recordId: this.recordId
+        		}).then(result =>{
+        			console.log('result'+result);
+        			if (result!='鎴愬姛') {
+                        this.err = result;
+                        const evt = new ShowToastEvent({
+                            title : '鏇存柊澶辫触',
+                            message: this.err,
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                    }
+                this.dispatchEvent(new CloseActionScreenEvent());
+                this.updateRecordView(this.recordId);
+        		}).catch(error => {
+            console.log('error='+error);
+        }).finally(() => {
+            
+        });
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.js-meta.xml b/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.js-meta.xml
new file mode 100644
index 0000000..220e747
--- /dev/null
+++ b/force-app/main/default/lwc/lexOSHInspect/lexOSHInspect.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexOSHInspect">
+      <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.js b/force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.js
index 0e82f06..515ea3e 100644
--- a/force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.js
+++ b/force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.js
@@ -2,6 +2,7 @@
 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.initForOSHSubmitButton';
 import updateQis  from '@salesforce/apex/QISReportController.updateQis1';
 import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
@@ -44,27 +45,59 @@
             console.log('this.OSHstaff='+this.OSHstaff);
             console.log('this.OSHstaffEmail='+this.OSHstaffEmail);
          	if (this.qisStatus=='OSH妫�娴嬬敵璇�' && this.qisStatus=='瀹屾瘯') {
-         		alert('闇�瑕佸厛鐐瑰嚮锛籓SH妫�鏌ュ彈鐞嗭冀'); 
-         		return;
+                const evt = new ShowToastEvent({
+                            title : '闇�瑕佸厛鐐瑰嚮锛籓SH妫�鏌ュ彈鐞嗭冀',
+                            message: '',
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        return;
          	}
          	if (this.qisStatus!='OSH妫�娴嬩腑') {
-         		alert('宸茬粡鎻愪氦瀹℃壒');
-         		return;
+                const evt = new ShowToastEvent({
+                            title : '宸茬粡鎻愪氦瀹℃壒',
+                            message: '',
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        return;
          	}
          	if (!confirm("涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵")) {
 				return;
 			}
 			if (this.OSHstaff==null||this.OSHstaffEmail==null) {
-				alert("OSH鎷呭綋蹇呴』濉啓");
-				return;
+                const evt = new ShowToastEvent({
+                            title : 'OSH鎷呭綋蹇呴』濉啓',
+                            message: '',
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        return;
 			}
             try{
                 this.updateQisSubmit();
             }catch(err){
                 if(err.faultstring !=undefined && err.faultstring.indexOf('INVALID_SESSION_ID') != -1) {
-                    alert('褰撳墠缃戦〉宸茬櫥鍑猴紝璇锋偍閲嶆柊鐧诲綍鍚庡埛鏂拌缃戦〉锛�');
+                    const evt = new ShowToastEvent({
+                            title : '褰撳墠缃戦〉宸茬櫥鍑猴紝璇锋偍閲嶆柊鐧诲綍鍚庡埛鏂拌缃戦〉锛�',
+                            message: '',
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        return;
                 } else {
-                    alert(err.faultstring);
+                    const evt = new ShowToastEvent({
+                            title : err.faultstring,
+                            message: '',
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        return;
                 }
                 return;
             }
diff --git a/force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.css b/force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.css
new file mode 100644
index 0000000..9acb129
--- /dev/null
+++ b/force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.css
@@ -0,0 +1,22 @@
+.outerBorderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    border-top : 3px solid #565959;
+}
+.borderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    margin-bottom : 7px;
+    border-top : 3px solid #565959;
+}
+.headerDorderCss{
+    border-top: 1px solid #565959;
+    border-bottom: 1px solid #D4D4D4;
+    padding:3px;
+}
+.centerCss{
+    text-align: center;
+}
+.centerCss .left{
+    margin-left: 100px;
+}/* sample css file *//* sample css file */
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.html b/force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.html
new file mode 100644
index 0000000..c8bdbfc
--- /dev/null
+++ b/force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.html
@@ -0,0 +1,5 @@
+<template>
+   <div class="sisToOPDHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.js b/force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.js
new file mode 100644
index 0000000..d442403
--- /dev/null
+++ b/force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.js
@@ -0,0 +1,47 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { NavigationMixin } from 'lightning/navigation';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import init  from '@salesforce/apex/QISReportController.initForlexPDFQISrequestButton';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { updateRecord } from 'lightning/uiRecordApi';
+
+export default class lexPDFQISrequest extends LightningElement {
+	@api recordId;
+	IsLoading = true;
+	qisReportId;
+    err;
+
+    @wire(CurrentPageReference)
+     getStateParameters(currentPageReference) {
+             console.log(111);
+             console.log(currentPageReference);
+
+         if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             console.log("str");
+             console.log(str);
+             this.recordId = str;
+           }
+         }
+    }
+
+    connectedCallback () {
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            this.IsLoading = false;
+            this.qisReportId = result.Id;
+            window.open('/apex/QISPDF?id='+this.qisReportId, 'QISPDF');
+            this.dispatchEvent(new CloseActionScreenEvent());
+        }).catch(error => {
+            console.log('error='+error);
+        }).finally(() => {
+            
+        }); 
+    }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.js-meta.xml b/force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.js-meta.xml
new file mode 100644
index 0000000..0030007
--- /dev/null
+++ b/force-app/main/default/lwc/lexPDFQISrequest/lexPDFQISrequest.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexPDFQISrequest">
+    <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexPredictedDateChange/__tests__/lexPredictedDateChange.test.js b/force-app/main/default/lwc/lexPredictedDateChange/__tests__/lexPredictedDateChange.test.js
new file mode 100644
index 0000000..db2a484
--- /dev/null
+++ b/force-app/main/default/lwc/lexPredictedDateChange/__tests__/lexPredictedDateChange.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexPredictedDateChange from 'c/lexPredictedDateChange';
+
+describe('c-lex-predicted-date-change', () => {
+    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-predicted-date-change', {
+            is: LexPredictedDateChange
+        });
+
+        // Act
+        document.body.appendChild(element);
+
+        // Assert
+        // const div = element.shadowRoot.querySelector('div');
+        expect(1).toBe(1);
+    });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexPredictedDateChange/lexPredictedDateChange.css b/force-app/main/default/lwc/lexPredictedDateChange/lexPredictedDateChange.css
new file mode 100644
index 0000000..548c121
--- /dev/null
+++ b/force-app/main/default/lwc/lexPredictedDateChange/lexPredictedDateChange.css
@@ -0,0 +1,10 @@
+.predictedDateChangeHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexPredictedDateChange/lexPredictedDateChange.html b/force-app/main/default/lwc/lexPredictedDateChange/lexPredictedDateChange.html
new file mode 100644
index 0000000..621521f
--- /dev/null
+++ b/force-app/main/default/lwc/lexPredictedDateChange/lexPredictedDateChange.html
@@ -0,0 +1,6 @@
+<template>
+    <div class="predictedDateChangeHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexPredictedDateChange/lexPredictedDateChange.js b/force-app/main/default/lwc/lexPredictedDateChange/lexPredictedDateChange.js
new file mode 100644
index 0000000..c121740
--- /dev/null
+++ b/force-app/main/default/lwc/lexPredictedDateChange/lexPredictedDateChange.js
@@ -0,0 +1,82 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-12 10:46:24
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-12 13:48:26
+ */
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import queryForPredictedDateChangeButton  from '@salesforce/apex/OpportunityLightingButtonController.queryForPredictedDateChangeButton';
+import init  from '@salesforce/apex/OpportunityLightingButtonController.initForPredictedDateChangeButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class LexPredictedDateChange extends LightningElement {
+    @api recordId;
+    IsLoading = true;
+    directLossFLG;
+    createdDay;
+    @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;
+          }
+        }
+    }
+    showToast(msg,type) {
+      const event = new ShowToastEvent({
+          title: '',
+          message: msg,
+          variant: type
+      });
+      this.dispatchEvent(event);
+    }
+    updateRecordView(recordId) {
+      updateRecord({fields: { Id: recordId }});
+    }
+    connectedCallback(){
+      init({
+        recordId: this.recordId
+      }).then(result=>{
+        this.directLossFLG = result.directLossFLG;
+        this.createdDay = result.createdDay;
+        this.predictedDateChange();
+      }).catch(error=>{
+        console.log("error");
+        console.log(error);
+      })
+    }
+    predictedDateChange(){
+      // 20221206 ljh DB202212030068 start
+      var DirectLossFLG = this.directLossFLG;
+      var CreatedDay = this.createdDay;
+      var Day =  Date('2022-12-03');
+      if((DirectLossFLG == 'true' || DirectLossFLG == 1 ) && CreatedDay > Day){
+        this.showToast("浠庢嫑鏍囬」鐩偣鍑诲け鍗曟柊寤虹殑璇环锛岄娴婳CSM绛剧害鏃�(KPI)鍜岄娴嬪彂璐ф棩涓嶅厑璁镐慨鏀�","error");
+        return;
+      }
+      // 20221206 ljh DB202212030068 end
+      queryForPredictedDateChangeButton({
+        recordId: this.recordId
+      }).then(result=>{
+        var sqlResult = result;
+        if (sqlResult.size > 0) {
+          this.showToast("宸插瓨鍦ㄥ緟瀹℃壒鐨勫彉鏇寸敵璇凤紒","error");
+          return;
+        } else {
+          window.open('/apex/ImprovedForecastTime?id=' + this.recordId,'','height=500,width=800,top=200,left=250,location=no');
+          this.dispatchEvent(new CloseActionScreenEvent());
+        }
+      })
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexPredictedDateChange/lexPredictedDateChange.js-meta.xml b/force-app/main/default/lwc/lexPredictedDateChange/lexPredictedDateChange.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexPredictedDateChange/lexPredictedDateChange.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>54.0</apiVersion>
+	<isExposed>true</isExposed>
+	<targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQISSC/lexQISSC.css b/force-app/main/default/lwc/lexQISSC/lexQISSC.css
new file mode 100644
index 0000000..9acb129
--- /dev/null
+++ b/force-app/main/default/lwc/lexQISSC/lexQISSC.css
@@ -0,0 +1,22 @@
+.outerBorderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    border-top : 3px solid #565959;
+}
+.borderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    margin-bottom : 7px;
+    border-top : 3px solid #565959;
+}
+.headerDorderCss{
+    border-top: 1px solid #565959;
+    border-bottom: 1px solid #D4D4D4;
+    padding:3px;
+}
+.centerCss{
+    text-align: center;
+}
+.centerCss .left{
+    margin-left: 100px;
+}/* sample css file *//* sample css file */
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQISSC/lexQISSC.html b/force-app/main/default/lwc/lexQISSC/lexQISSC.html
new file mode 100644
index 0000000..c8bdbfc
--- /dev/null
+++ b/force-app/main/default/lwc/lexQISSC/lexQISSC.html
@@ -0,0 +1,5 @@
+<template>
+   <div class="sisToOPDHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQISSC/lexQISSC.js b/force-app/main/default/lwc/lexQISSC/lexQISSC.js
new file mode 100644
index 0000000..2917728
--- /dev/null
+++ b/force-app/main/default/lwc/lexQISSC/lexQISSC.js
@@ -0,0 +1,96 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { NavigationMixin } from 'lightning/navigation';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import init  from '@salesforce/apex/QISReportController.initForlexQISSCButton';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { updateRecord } from 'lightning/uiRecordApi';
+
+export default class lexQISSC extends LightningElement {
+	@api recordId;
+	IsLoading = true;
+	qisReportId;
+	name;
+	profileName;
+	qISSCId;
+	qISSCReport;
+	nextaction;
+	qISMarketCategory;
+    err;
+
+    @wire(CurrentPageReference)
+     getStateParameters(currentPageReference) {
+             console.log(111);
+             console.log(currentPageReference);
+
+         if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             console.log("str");
+             console.log(str);
+             this.recordId = str;
+           }
+         }
+    }
+
+    connectedCallback () {
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            this.IsLoading = false;
+            this.qisReportId = result.Id;
+            this.name = result.name;
+            this.qISSCId = result.qISSCId;
+            this.qISSCReport = result.qISSCReport;
+            this.nextaction = result.nextaction;
+            this.qISMarketCategory = result.qISMarketCategory;
+            this.profileName = result.profileName;
+            console.log('profileName='+this.profileName);
+            console.log('qISSCReport='+this.qISSCReport);
+            console.log('nextaction='+this.nextaction);
+            console.log('qISMarketCategory='+this.qISMarketCategory);
+            if (this.profileName == '2F4_鎶�鏈帹杩涢儴' || this.profileName == '2F4_鎶�鏈帹杩涢儴_OSH 闈炲崟鐐�') {
+            	const evt = new ShowToastEvent({
+                            title : '鎮ㄦ病鏈夋柊寤篞IS甯傚満閮ㄦ潈闄愩��',
+                            message: '',
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        return;
+            }
+            if (this.qISSCReport!=null) {
+            	var url = 'https://ocsm.my.salesforce.com/'+this.qISSCId;
+            	window.open(url);
+            	this.dispatchEvent(new CloseActionScreenEvent());
+                return;
+            }else{
+            	if (this.nextaction == '閫佸洖' && (this.qISMarketCategory == 'ET' || this.qISMarketCategory == 'ENG' || this.qISMarketCategory == 'EndoRapid')) {
+            		var urlStr ='/a3w/e?CF00N100000095xFJ='+this.name+
+							'&CF00N100000095xFJ_lkid='+this.qisReportId+
+							'&retURL='+this.qisReportId+
+							'&Name='+this.name;
+						window.open(urlStr);	
+						
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        return;
+            	}else{
+            		const evt = new ShowToastEvent({
+                            title : '瀵瑰簲鏂规硶涓鸿繑鍥炰笖瀵瑰簲涓绘満/娑堣�楀搧涓篍T 鎴� ENG 鎴� EndoRapid 鏃讹紝鎵嶅彲浠ユ柊寤恒��',
+                            message: '',
+                            variant: 'error'
+                        });
+                        
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        return;
+            	}
+            }
+        }).catch(error => {
+            console.log('error='+error);
+        }).finally(() => {
+            
+        }); 
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQISSC/lexQISSC.js-meta.xml b/force-app/main/default/lwc/lexQISSC/lexQISSC.js-meta.xml
new file mode 100644
index 0000000..5701aa7
--- /dev/null
+++ b/force-app/main/default/lwc/lexQISSC/lexQISSC.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexQISSC">
+    <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQuotationProductNew/__tests__/lexQuotationProductNew.test.js b/force-app/main/default/lwc/lexQuotationProductNew/__tests__/lexQuotationProductNew.test.js
new file mode 100644
index 0000000..f8c78a9
--- /dev/null
+++ b/force-app/main/default/lwc/lexQuotationProductNew/__tests__/lexQuotationProductNew.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexQuotationProductNew from 'c/lexQuotationProductNew';
+
+describe('c-lex-quotation-product-new', () => {
+    afterEach(() => {
+        // The jsdom instance is shared across test cases in a single file so reset the DOM
+        while (document.body.firstChild) {
+            document.body.removeChild(document.body.firstChild);
+        }
+    });
+
+    it('TODO: test case generated by CLI command, please fill in test logic', () => {
+        // Arrange
+        const element = createElement('c-lex-quotation-product-new', {
+            is: LexQuotationProductNew
+        });
+
+        // Act
+        document.body.appendChild(element);
+
+        // Assert
+        // const div = element.shadowRoot.querySelector('div');
+        expect(1).toBe(1);
+    });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.html b/force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.html
new file mode 100644
index 0000000..1ac43b5
--- /dev/null
+++ b/force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.html
@@ -0,0 +1,6 @@
+<template>
+    <div class="lexQuotationRequestHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.js b/force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.js
new file mode 100644
index 0000000..6720168
--- /dev/null
+++ b/force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.js
@@ -0,0 +1,67 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-14 17:15:33
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-14 17:20:45
+ */
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init  from '@salesforce/apex/OpportunityLightingButtonController.initForQuotationProductNewButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+export default class LexQuotationProductNew extends LightningElement {
+    @api recordId;
+    currencyIsoCode;
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+            console.log(111);
+            console.log(currentPageReference);
+
+        if (currentPageReference) {
+          const urlValue = currentPageReference.state.recordId;
+          if (urlValue) {
+            let str = `${urlValue}`;
+            console.log("str");
+            console.log(str);
+            this.recordId = str;
+          }
+        }
+    }
+    connectedCallback(){
+        init({
+            recordId:this.recordId
+        }).then(result=>{
+            this.currencyIsoCode = result.currencyIsoCode;
+            this.quotationProductNew();
+        }).catch(error=>{
+            console.log(error);
+        });
+    }
+    quotationProductNew(){
+        var Currency = this.currencyIsoCode;
+        var OppID = this.recordId;
+        if (Currency == 'CNY'){
+        var url = '/00O10000002jviu?pv0=' + OppID;
+        }
+        else if (Currency == 'USD'){
+        var url = '/00O10000005Ju6L?pv0=' + OppID;
+        }
+        window.open(url);
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            title: '',
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+      }
+      updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+      }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.js-meta.xml b/force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexQuotationProductNew/lexQuotationProductNew.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>54.0</apiVersion>
+	<isExposed>true</isExposed>
+	<targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQuotationRequest/__tests__/lexQuotationRequest.test.js b/force-app/main/default/lwc/lexQuotationRequest/__tests__/lexQuotationRequest.test.js
new file mode 100644
index 0000000..2e33a91
--- /dev/null
+++ b/force-app/main/default/lwc/lexQuotationRequest/__tests__/lexQuotationRequest.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexQuotationRequest from 'c/lexQuotationRequest';
+
+describe('c-lex-quotation-request', () => {
+    afterEach(() => {
+        // The jsdom instance is shared across test cases in a single file so reset the DOM
+        while (document.body.firstChild) {
+            document.body.removeChild(document.body.firstChild);
+        }
+    });
+
+    it('TODO: test case generated by CLI command, please fill in test logic', () => {
+        // Arrange
+        const element = createElement('c-lex-quotation-request', {
+            is: LexQuotationRequest
+        });
+
+        // Act
+        document.body.appendChild(element);
+
+        // Assert
+        // const div = element.shadowRoot.querySelector('div');
+        expect(1).toBe(1);
+    });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.css b/force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.css
new file mode 100644
index 0000000..e2d6ce2
--- /dev/null
+++ b/force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.css
@@ -0,0 +1,10 @@
+.lexQuotationRequestHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.html b/force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.html
new file mode 100644
index 0000000..dff927d
--- /dev/null
+++ b/force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.html
@@ -0,0 +1,14 @@
+<!--
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-14 11:09:28
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-14 11:10:38
+-->
+<template>
+    <div class="lexQuotationRequestHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.js b/force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.js
new file mode 100644
index 0000000..d968b59
--- /dev/null
+++ b/force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.js
@@ -0,0 +1,73 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-14 11:09:28
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-14 11:21:24
+ */
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import queryForQuotationRequestButton  from '@salesforce/apex/OpportunityLightingButtonController.queryForQuotationRequestButton';
+import init  from '@salesforce/apex/OpportunityLightingButtonController.initForQuotationRequestButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+export default class LexQuotationRequest extends LightningElement {
+    @api recordId;
+    biddingProjectNameBidId;
+    estimationId;
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+            console.log(111);
+            console.log(currentPageReference);
+
+        if (currentPageReference) {
+          const urlValue = currentPageReference.state.recordId;
+          if (urlValue) {
+            let str = `${urlValue}`;
+            console.log("str");
+            console.log(str);
+            this.recordId = str;
+          }
+        }
+    }
+    connectedCallback(){
+        init({
+            recordId: this.recordId
+        }).then(result=>{
+            this.biddingProjectNameBidId = result.biddingProjectNameBidId;
+            this.estimationId = result.estimationId;
+            this.quotationRequest();
+        })
+    }
+    quotationRequest(){
+        queryForQuotationRequestButton({
+            recordId: this.recordId
+        }).then(result=>{
+            var records = result;
+            var size =records.length;
+            if(size > 1){
+                this.showToast("鏈�2涓垨鑰�2涓互涓婄殑鑽夋涓姤浠峰鎵橈紝璇风‘璁ゃ��","error");
+            }else if(size == 1){
+                var raes = records[0].Id;
+                location.href = "/apex/NewQuoteIrai?id="+ raes+"&tenderid=" + this.biddingProjectNameBidId;
+            }else{
+                location.href = "/apex/NewQuoteIrai?oppid=" + this.recordId + "&oppquoid=" + this.estimationId + "&tenderid=" + this.biddingProjectNameBidId;
+            }
+            this.dispatchEvent(new CloseActionScreenEvent()); 
+        })
+    }
+    showToast(msg,type) {
+      const event = new ShowToastEvent({
+          title: '',
+          message: msg,
+          variant: type
+      });
+      this.dispatchEvent(event);
+    }
+    updateRecordView(recordId) {
+      updateRecord({fields: { Id: recordId }});
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.js-meta.xml b/force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexQuotationRequest/lexQuotationRequest.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>54.0</apiVersion>
+	<isExposed>true</isExposed>
+	<targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.css b/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.css
new file mode 100644
index 0000000..635bc6c
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.css
@@ -0,0 +1,22 @@
+.outerBorderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    border-top : 3px solid #565959;
+}
+.borderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    margin-bottom : 7px;
+    border-top : 3px solid #565959;
+}
+.headerDorderCss{
+    border-top: 1px solid #565959;
+    border-bottom: 1px solid #D4D4D4;
+    padding:3px;
+}
+.centerCss{
+    text-align: center;
+}
+.centerCss .left{
+    margin-left: 100px;
+}/* sample css file */
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.html b/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.html
new file mode 100644
index 0000000..49a10f7
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="sisToOPDHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.js b/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.js
new file mode 100644
index 0000000..2afabee
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.js
@@ -0,0 +1,103 @@
+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 lexRCRecieved extends LightningElement {
+	@api recordId;
+	err;
+	IsLoading = true;
+	qisReportId;
+	qisStatus;
+	isAEProfile;
+	isPAEProfile;
+	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.isPAEProfile = result.isPAEProfile;
+            this.isCNBuy = result.isCNBuy;
+            console.log('this.qisStatus='+this.qisStatus);   
+         	if (this.qisStatus!='RC妫�娴嬬敵璇�') {
+                const evt = new ShowToastEvent({
+                        title : 'OCM鏈嶅姟鏈儴宸茬粡鏀跺埌瀹炵墿',
+                        message: '',
+                        variant: 'error'
+                    });
+                this.dispatchEvent(evt);
+                this.dispatchEvent(new CloseActionScreenEvent());
+                return;
+         	}else{
+         		if (this.isAEProfile == null || this.isPAEProfile == null || this.isCNBuy != 'true') {
+         			const evt = new ShowToastEvent({
+                        title : '瀹夊叏淇℃伅鏈垽瀹氾紝璇疯仈绯昏川閲忔硶瑙勯儴',
+                        message: '',
+                        variant: 'error'
+                    });
+	                this.dispatchEvent(evt);
+	                this.dispatchEvent(new CloseActionScreenEvent());
+	                return;
+         		}else{
+         			this.updateQisSubmit();
+         		}
+         	}
+        }).catch(error => {
+            console.log('error='+error);
+        }).finally(() => {
+            
+        }); 
+    }
+
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+
+    updateQisSubmit(){
+        	updateQis({
+        		 recordId: this.recordId
+        		}).then(result =>{
+                    
+        			console.log('result'+result);
+        			this.err = result;
+        			if (result!='鎴愬姛') {
+                        const evt = new ShowToastEvent({
+                            title : '鏇存柊澶辫触',
+                            message: this.err,
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                    }
+                this.dispatchEvent(new CloseActionScreenEvent());
+                this.updateRecordView(this.recordId);
+        		}).catch(error => {
+           				 console.log('error='+error);
+		        }).finally(() => {
+		            
+		        });
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.js-meta.xml b/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.js-meta.xml
new file mode 100644
index 0000000..120b162
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexRCRecieved">
+   <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.css b/force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.css
new file mode 100644
index 0000000..635bc6c
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.css
@@ -0,0 +1,22 @@
+.outerBorderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    border-top : 3px solid #565959;
+}
+.borderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    margin-bottom : 7px;
+    border-top : 3px solid #565959;
+}
+.headerDorderCss{
+    border-top: 1px solid #565959;
+    border-bottom: 1px solid #D4D4D4;
+    padding:3px;
+}
+.centerCss{
+    text-align: center;
+}
+.centerCss .left{
+    margin-left: 100px;
+}/* sample css file */
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.html b/force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.html
new file mode 100644
index 0000000..49a10f7
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="sisToOPDHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.js b/force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.js
new file mode 100644
index 0000000..73d0840
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.js
@@ -0,0 +1,98 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { NavigationMixin } from 'lightning/navigation';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { updateRecord } from 'lightning/uiRecordApi';
+import init  from '@salesforce/apex/QISReportController.initForlexRCinspectioncompletedateButton';
+import updateQis  from '@salesforce/apex/QISReportController.updateQisForRCinspectioncompletedate';
+
+export default class lexRCinspectioncompletedate extends LightningElement {
+	@api recordId;
+	err;
+	IsLoading = true;
+	qisReportId;
+	qisStatus;
+	rCinspectionDate;
+
+	 @wire(CurrentPageReference)
+     getStateParameters(currentPageReference) {
+             console.log(111);
+             console.log(currentPageReference);
+
+         if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             console.log("str");
+             console.log(str);
+             this.recordId = str;
+           }
+         }
+     }
+
+     connectedCallback () {
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            this.IsLoading = false;
+            this.qisReportId = result.Id;
+            this.qisStatus = result.qIStatus;
+            this.rCinspectionDate = result.rCinspectionDate;
+
+         	if (this.qisStatus =='RC妫�娴嬬敵璇�') {
+                const evt = new ShowToastEvent({
+                        title : '闇�瑕佸厛鐐瑰嚮锛籓CM鏈嶅姟鏈儴鏀跺埌瀹炵墿锛�',
+                        message: '',
+                        variant: 'error'
+                    });
+                this.dispatchEvent(evt);
+                this.dispatchEvent(new CloseActionScreenEvent());
+                return;
+         	}else if(this.rCinspectionDate != null){
+         			const evt = new ShowToastEvent({
+                        title : 'OCM鏈嶅姟鏈儴妫�娴嬪凡缁忓畬姣�',
+                        message: '',
+                        variant: 'error'
+                    });
+	                this.dispatchEvent(evt);
+	                this.dispatchEvent(new CloseActionScreenEvent());
+	                return;
+         	}else{
+         		this.updateQisSubmit();
+         	}
+        }).catch(error => {
+            console.log('error='+error);
+        }).finally(() => {
+            
+        }); 
+    }
+
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+
+    updateQisSubmit(){
+        	updateQis({
+        		 recordId: this.recordId
+        		}).then(result =>{
+                    
+        			console.log('result'+result);
+        			this.err = result;
+        			if (result!='鎴愬姛') {
+                        const evt = new ShowToastEvent({
+                            title : '鏇存柊澶辫触',
+                            message: this.err,
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                    }
+                this.dispatchEvent(new CloseActionScreenEvent());
+                this.updateRecordView(this.recordId);
+        		}).catch(error => {
+           				 console.log('error='+error);
+		        }).finally(() => {
+		            
+		        });
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.js-meta.xml b/force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.js-meta.xml
new file mode 100644
index 0000000..1546b5e
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCinspectioncompletedate/lexRCinspectioncompletedate.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexRCinspectioncompletedate">
+    <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.css b/force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.css
new file mode 100644
index 0000000..af18c76
--- /dev/null
+++ b/force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.css
@@ -0,0 +1,11 @@
+.Holder{
+	position: relative;
+	display: inline-block;
+	width: 80px;
+	height: 80px;
+	text-align: center;
+}
+
+.container .uiContainerManager{
+	display : none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.html b/force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.html
new file mode 100644
index 0000000..f60755f
--- /dev/null
+++ b/force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="Holder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+      </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.js b/force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.js
new file mode 100644
index 0000000..7cd6690
--- /dev/null
+++ b/force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.js
@@ -0,0 +1,91 @@
+import { LightningElement, track, wire, api } from 'lwc';
+import {CurrentPageReference,NavigationMixin} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+
+import eSetRefreshStatus from '@salesforce/apex/RentalApplyESetRefreshStatusController.eSetRefreshStatus';
+export default class lexRentalApplyESetRefreshStatus extends LightningElement {
+	@api raeSetId;
+	IsLoading=true;
+	refreshResult;
+	
+
+	@wire(CurrentPageReference)
+	getStateParameters(currentPageReference) {
+		console.log(currentPageReference);
+
+		if(currentPageReference) {
+			const urlValue = currentPageReference.state.recordId;
+			if(urlValue) {
+				let str = `${urlValue}`;
+		        console.log("str");
+		        console.log(str);
+		        this.recordId = str;
+
+			}
+		}
+	}
+
+	connectedCallback() {
+		console.log('this.raeSetId:' + this.recordId);
+		eSetRefreshStatus({
+			raeSetId : this.recordId
+		}).then(result => {
+			this.refreshResult = result;
+			
+			
+			this.cancelSubmit().then(res=>{
+				this.IsLoading=false;
+				this.dispatchEvent(new CloseActionScreenEvent());
+			});	
+					
+		}).catch( error =>{
+			console.log(error);
+		}).finally(()=>{
+
+			
+		});
+	}
+
+	async cancelSubmit(){
+		if(this.refreshResult == '1') {
+			this.showToast('','鐘舵�佹洿鏂板畬姣�','success');
+			// alert("鐘舵�佹洿鏂板畬姣�!");
+			location.href = "/"+this.recordId; 
+					
+		} else {
+			console.log("result:",this.refreshResult);
+			this.showToast('','鏇存柊澶辫触锛岃鑱旂郴绠$悊鍛橈紒','warning');
+			// alert("鏇存柊澶辫触锛岃鑱旂郴绠$悊鍛橈紒");
+			
+		}
+			
+    }
+    showToast(_title,_message,_variant) {
+        const event = new ShowToastEvent({
+            title: _title,
+            message:_message,
+            variant: _variant,
+        });
+        this.dispatchEvent(event);
+    }
+
+}
+
+// old js浠g爜锛�
+// {!RequireScript("/soap/ajax/51.0/connection.js")}
+// {!RequireScript("/soap/ajax/51.0/apex.js")}
+
+// var raeSet = '{!Rental_Apply_Equipment_Set__c.Id}';
+// try {
+//     var rtn = sforce.apex.execute("RentalApplyWebService", "eSetRefreshStatus", {raeSetId: raeSet});
+//     if (rtn = '1') {
+//         alert("鐘舵�佹洿鏂板畬姣�!");
+//         location.href = "/{!Rental_Apply_Equipment_Set__c.Id}"; 
+//     } else {
+//         alert(rtn);
+//     }
+// } catch(e) {
+//     alert(e);
+// }
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.js-meta.xml b/force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.js-meta.xml
new file mode 100644
index 0000000..d6ac86f
--- /dev/null
+++ b/force-app/main/default/lwc/lexRentalApplyESetRefreshStatus/lexRentalApplyESetRefreshStatus.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexRentalApplyESetRefreshStatus">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__AppPage</target>
+        <target>lightning__RecordPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRequestDB/__tests__/lexRequestDB.test.js b/force-app/main/default/lwc/lexRequestDB/__tests__/lexRequestDB.test.js
new file mode 100644
index 0000000..832098e
--- /dev/null
+++ b/force-app/main/default/lwc/lexRequestDB/__tests__/lexRequestDB.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexRequestDB from 'c/lexRequestDB';
+
+describe('c-lex-request-db', () => {
+    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-request-db', {
+            is: LexRequestDB
+        });
+
+        // Act
+        document.body.appendChild(element);
+
+        // Assert
+        // const div = element.shadowRoot.querySelector('div');
+        expect(1).toBe(1);
+    });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRequestDB/lexRequestDB.css b/force-app/main/default/lwc/lexRequestDB/lexRequestDB.css
new file mode 100644
index 0000000..a524923
--- /dev/null
+++ b/force-app/main/default/lwc/lexRequestDB/lexRequestDB.css
@@ -0,0 +1,10 @@
+.lexRequestDBHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRequestDB/lexRequestDB.html b/force-app/main/default/lwc/lexRequestDB/lexRequestDB.html
new file mode 100644
index 0000000..b4aff5b
--- /dev/null
+++ b/force-app/main/default/lwc/lexRequestDB/lexRequestDB.html
@@ -0,0 +1,6 @@
+<template>
+    <div class="lexRequestDBHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRequestDB/lexRequestDB.js b/force-app/main/default/lwc/lexRequestDB/lexRequestDB.js
new file mode 100644
index 0000000..b3ddb3a
--- /dev/null
+++ b/force-app/main/default/lwc/lexRequestDB/lexRequestDB.js
@@ -0,0 +1,107 @@
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init  from '@salesforce/apex/OpportunityLightingButtonController.initForRequestDBButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+export default class LexRequestDB extends LightningElement {
+    @api recordId;
+    stageName;
+    sapSendOK;
+    cntLostCancelReport;
+    cntLostCancelDraft;
+    agency1;
+    agency1Id;
+    name;
+    bidPlannedDate;
+    salesAssistantName;
+    salesAssistantID;
+    profileId;
+    @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.cntLostCancelDraft = result.cntLostCancelDraft;
+            this.agency1 = result.agency1;
+            this.agency1Id = result.agency1Id;
+            this.name = result.name;
+            this.bidPlannedDate = result.bidPlannedDate;
+            this.salesAssistantName = result.salesAssistantName;
+            this.salesAssistantID = result.salesAssistantID;
+            this.profileId = result.profileId;
+            this.requestDB();
+        })
+    }
+    requestDB(){
+        var profileId = this.profileId;
+        if (profileId != '00e10000000Y3o5' && profileId != '00e10000000xnp2' &&
+        profileId != '00e10000000xnpH') {
+            this.showToast("鎮ㄦ病鏈夋巿鏉冨鎵樼殑鏉冮檺銆傝鑱旂郴绯荤粺绠$悊鍛樸��","error");
+        }
+        // js銇牬鍚堛�佺炕瑷炽仌銈屻仧鍊ゃ亴銇с倠銇仹銆佽娉ㄦ剰
+        else if (this.stageName != '寮曞悎'
+        && this.stageName != '璇环'
+        ) {
+            this.showToast("鐘舵��1:" + this.stageName + "銆佷笉鑳藉仛鎺堟潈鐢宠锛�","");
+        }
+        else if (this.sapSendOK == '1') {
+            this.showToast("宸茬粡涓婁紶SAP銆佷笉鑳藉仛鎺堟潈鐢宠浜嗭紒","error");
+        }
+        else if (this.cntLostCancelReport - this.cntLostCancelDraft > 0) {
+            this.showToast("璇环宸茬粡鏈夊彇娑堬紡澶卞崟鎶ュ憡浜嗭紒","error");
+        }
+        else {
+        location.href = '/a2C/e?retURL=%2F' + 
+            encodeURI(this.recordId) +
+            '&RecordType=01210000000RNXi' +
+            '&CF00N10000006QdJz=' +
+            encodeURI(this.agency1) +
+            '&CF00N10000006QdJz_lkid=' +
+            encodeURI(this.agency1Id) +
+            '&CF00N10000006QdKn=' +
+            encodeURI(this.name) +
+            '&CF00N10000006QdKn_lkid=' +
+            encodeURI(this.recordId) +
+            '&00N10000006QdK4=' +
+            encodeURI(this.name) +
+            '&00N10000006QdYB=' +
+            encodeURI(this.bidPlannedDate) +
+            '&CF00N10000006QdZT=' +
+            encodeURI(this.salesAssistantName) +
+            '&CF00N10000006QdZT_lkid=' +
+            encodeURI(this.salesAssistantID) +
+            '';
+        };
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+    showToast(msg,type) {
+      const event = new ShowToastEvent({
+          title: '',
+          message: msg,
+          variant: type
+      });
+      this.dispatchEvent(event);
+    }
+    updateRecordView(recordId) {
+      updateRecord({fields: { Id: recordId }});
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRequestDB/lexRequestDB.js-meta.xml b/force-app/main/default/lwc/lexRequestDB/lexRequestDB.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexRequestDB/lexRequestDB.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>54.0</apiVersion>
+	<isExposed>true</isExposed>
+	<targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexReturnDeliverySlip/lexReturnDeliverySlip.css b/force-app/main/default/lwc/lexReturnDeliverySlip/lexReturnDeliverySlip.css
new file mode 100644
index 0000000..635bc6c
--- /dev/null
+++ b/force-app/main/default/lwc/lexReturnDeliverySlip/lexReturnDeliverySlip.css
@@ -0,0 +1,22 @@
+.outerBorderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    border-top : 3px solid #565959;
+}
+.borderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    margin-bottom : 7px;
+    border-top : 3px solid #565959;
+}
+.headerDorderCss{
+    border-top: 1px solid #565959;
+    border-bottom: 1px solid #D4D4D4;
+    padding:3px;
+}
+.centerCss{
+    text-align: center;
+}
+.centerCss .left{
+    margin-left: 100px;
+}/* sample css file */
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexReturnDeliverySlip/lexReturnDeliverySlip.html b/force-app/main/default/lwc/lexReturnDeliverySlip/lexReturnDeliverySlip.html
new file mode 100644
index 0000000..49a10f7
--- /dev/null
+++ b/force-app/main/default/lwc/lexReturnDeliverySlip/lexReturnDeliverySlip.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="sisToOPDHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexReturnDeliverySlip/lexReturnDeliverySlip.js b/force-app/main/default/lwc/lexReturnDeliverySlip/lexReturnDeliverySlip.js
new file mode 100644
index 0000000..b8c66e8
--- /dev/null
+++ b/force-app/main/default/lwc/lexReturnDeliverySlip/lexReturnDeliverySlip.js
@@ -0,0 +1,53 @@
+import { LightningElement, track, wire, api } from 'lwc';
+import { CurrentPageReference,NavigationMixin } from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
+import init from '@salesforce/apex/ReturnDeliverySlipController.init';
+
+
+export default class lexReturnDeliverySlip extends LightningElement {
+
+	@api recordId;
+		IsLoading = true;
+		raId;
+		raName;
+
+	@wire(CurrentPageReference)
+	getStateParameters(currentPageReference){
+		if(currentPageReference) {
+			const urlValue = currentPageReference.state.recordId;
+			if(urlValue) {
+				let str = `${urlValue}`;
+		        this.recordId = str;
+			}
+		}
+	}
+
+	connectedCallback(){
+		init({
+			recordId: this.recordId
+		}).then(result =>{
+			if(result.RentalApplyEquipmentSetCnt > 0){
+				console.log(JSON.stringify(result.raeSet));
+				if(JSON.stringify(result.raeSet) != '[]'){
+					var check = result.raeSet && result.raeSet.length>0;					
+					if((check || result.RentalApplyEquipmentSetCnt - result.LoanerReceivedNgNum > 0) && result.RentalApplyEquipmentSetCnt > 0){
+						window.open("/apex/EquipmentSetShippmentReceived4?id=" + result.Name); 
+					}else{
+						alert("娌℃湁鐢宠鑰呮敹鍒扮‘璁ょ殑鍊熷嚭澶囧搧");
+					}
+				}else{
+					alert("娌℃湁绗﹀悎鏉′欢鐨勫鍝佸�熷嚭鐢宠涓�瑙堟槑缁�");
+					console.log('else');
+				}
+			this.dispatchEvent(new CloseActionScreenEvent());
+		}else{
+			this.dispatchEvent(new CloseActionScreenEvent());
+			alert("娌℃湁澶囧搧鍊熷嚭鐢宠涓�瑙堝強涓�瑙堟槑缁�");
+		}
+		}).catch(err=>{
+			this.dispatchEvent(new CloseActionScreenEvent());
+			console.log('err=='+err);
+		})
+	}
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexReturnDeliverySlip/lexReturnDeliverySlip.js-meta.xml b/force-app/main/default/lwc/lexReturnDeliverySlip/lexReturnDeliverySlip.js-meta.xml
new file mode 100644
index 0000000..74849f3
--- /dev/null
+++ b/force-app/main/default/lwc/lexReturnDeliverySlip/lexReturnDeliverySlip.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexOCMSubmit">
+    <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.js b/force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.js
index 94f34b3..a44bcae 100644
--- a/force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.js
+++ b/force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.js
@@ -1,3 +1,11 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-07 09:02:03
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-12 10:15:28
+ */
 import { api, wire,LightningElement } from 'lwc';
 import { CurrentPageReference } from "lightning/navigation";
 import { CloseActionScreenEvent } from 'lightning/actions';
@@ -44,7 +52,6 @@
         }).catch(error => {
             console.log("error");
             console.log(error);
-        }).finally(() => {
         });
 
     }
@@ -74,10 +81,13 @@
                 }else{
                     this.showToast("鎴愬姛","success");
                     this.updateRecordView(this.recordId);
-                } 
-                this.dispatchEvent(new CloseActionScreenEvent());
+                }
                 this.IsLoading = false;
+                this.dispatchEvent(new CloseActionScreenEvent());
             });              
+    } else {
+        this.showToast("鍙崏妗堜腑鐘舵�佸強OPD/SIS鎶ュ憡涔︾殑鎵�鏈変汉鍙互鎻愪氦","error");
+        this.dispatchEvent(new CloseActionScreenEvent());
     }
     
 }
diff --git a/force-app/main/default/lwc/lexSendQIS/lexSendQIS.css b/force-app/main/default/lwc/lexSendQIS/lexSendQIS.css
new file mode 100644
index 0000000..635bc6c
--- /dev/null
+++ b/force-app/main/default/lwc/lexSendQIS/lexSendQIS.css
@@ -0,0 +1,22 @@
+.outerBorderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    border-top : 3px solid #565959;
+}
+.borderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    margin-bottom : 7px;
+    border-top : 3px solid #565959;
+}
+.headerDorderCss{
+    border-top: 1px solid #565959;
+    border-bottom: 1px solid #D4D4D4;
+    padding:3px;
+}
+.centerCss{
+    text-align: center;
+}
+.centerCss .left{
+    margin-left: 100px;
+}/* sample css file */
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSendQIS/lexSendQIS.html b/force-app/main/default/lwc/lexSendQIS/lexSendQIS.html
new file mode 100644
index 0000000..c8bdbfc
--- /dev/null
+++ b/force-app/main/default/lwc/lexSendQIS/lexSendQIS.html
@@ -0,0 +1,5 @@
+<template>
+   <div class="sisToOPDHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSendQIS/lexSendQIS.js b/force-app/main/default/lwc/lexSendQIS/lexSendQIS.js
new file mode 100644
index 0000000..f1ca368
--- /dev/null
+++ b/force-app/main/default/lwc/lexSendQIS/lexSendQIS.js
@@ -0,0 +1,121 @@
+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.initForlexSendQISButton';
+import sendSPO  from '@salesforce/apex/QISReportController.updateQisForSendQIS';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { updateRecord } from 'lightning/uiRecordApi';
+
+export default class lexSendQIS extends LightningElement {
+	@api recordId;
+    str;
+    err;
+    IsLoading = true;
+    qisReportId;
+    qisRecordTypeId;
+    qisRecordName;
+    ProfileName;
+    IsSendQIS;
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+        if (currentPageReference) {
+            const urlValue = currentPageReference.state.recordId;
+            if (urlValue) {
+                let str = `${urlValue}`;
+                this.recordId = str;
+            }
+        }
+    }
+
+    connectedCallback() {
+        console.log(this.recordId);
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            console.log(result);
+                this.IsLoading = false;
+                this.qisRecordTypeId = result.qisRecordTypeId;
+                this.qisReportId = result.Id;
+                this.qisRecordName = result.qisRecordName;
+                this.ProfileName = result.profileName;
+                this.IsSendQIS = result.isSendQIS;
+                if (this.qisRecordName == '2.OCSM') {
+                	const evt = new ShowToastEvent({
+                            title : '涓嶈兘鎻愪氦鍒癝PO',
+                            message: '璁板綍绫诲瀷涓�'+this.qisRecordName,
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        return;
+                }
+
+                if (!(this.ProfileName == '绯荤粺绠$悊鍛�' || this.ProfileName == '2F4_鎶�鏈帹杩涢儴' || this.ProfileName == '2F1_鏈嶅姟绐楀彛')) {
+                	const evt = new ShowToastEvent({
+                            title : '娌℃湁鏉冮檺鎻愪氦锛岃鑱旂郴绯荤粺绠$悊鍛�',
+                            message: '',
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        return;
+                }
+
+                if (this.IsSendQIS) {
+                	const evt = new ShowToastEvent({
+                            title : '宸叉彁浜ゅ埌SPO锛岃涓嶈閲嶅鎻愪氦',
+                            message: '',
+                            variant: 'error'
+                        });
+                        this.dispatchEvent(evt);
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                        return;
+                }
+                this.send2SPO();
+        }).catch(error => {
+            console.log(error.getMessage());
+        }).finally(() => {
+
+        });
+    }
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+
+    send2SPO(){
+        	sendSPO({
+        		 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());
+                        return;
+                    }else{
+                    	const evt = new ShowToastEvent({
+                            title : '鎻愪氦鎴愬姛锛佽鍦⊿PO绯荤粺涓畬鎴愰��鎹㈣揣鐢宠',
+                            message: '',
+                            variant: 'success'
+                        });
+		                this.dispatchEvent(evt);   
+		                this.dispatchEvent(new CloseActionScreenEvent());
+		                this.updateRecordView(this.recordId);
+                        window.location.replace("https://olympus.sharepoint.cn/sites/GSPWF/SitePages/HomePage.aspx");
+                    }
+                
+        		}).catch(error => {
+            console.log('error='+error);
+        }).finally(() => {
+            
+        });
+    }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSendQIS/lexSendQIS.js-meta.xml b/force-app/main/default/lwc/lexSendQIS/lexSendQIS.js-meta.xml
new file mode 100644
index 0000000..814503e
--- /dev/null
+++ b/force-app/main/default/lwc/lexSendQIS/lexSendQIS.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexSendQIS">
+   <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexStockApply/__tests__/lexStockApply.test.js b/force-app/main/default/lwc/lexStockApply/__tests__/lexStockApply.test.js
new file mode 100644
index 0000000..b8885a7
--- /dev/null
+++ b/force-app/main/default/lwc/lexStockApply/__tests__/lexStockApply.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexStockApply from 'c/lexStockApply';
+
+describe('c-lex-stock-apply', () => {
+    afterEach(() => {
+        // The jsdom instance is shared across test cases in a single file so reset the DOM
+        while (document.body.firstChild) {
+            document.body.removeChild(document.body.firstChild);
+        }
+    });
+
+    it('TODO: test case generated by CLI command, please fill in test logic', () => {
+        // Arrange
+        const element = createElement('c-lex-stock-apply', {
+            is: LexStockApply
+        });
+
+        // Act
+        document.body.appendChild(element);
+
+        // Assert
+        // const div = element.shadowRoot.querySelector('div');
+        expect(1).toBe(1);
+    });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexStockApply/lexStockApply.css b/force-app/main/default/lwc/lexStockApply/lexStockApply.css
new file mode 100644
index 0000000..39dab40
--- /dev/null
+++ b/force-app/main/default/lwc/lexStockApply/lexStockApply.css
@@ -0,0 +1,10 @@
+.lexStockApplyHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexStockApply/lexStockApply.html b/force-app/main/default/lwc/lexStockApply/lexStockApply.html
new file mode 100644
index 0000000..5674b24
--- /dev/null
+++ b/force-app/main/default/lwc/lexStockApply/lexStockApply.html
@@ -0,0 +1,6 @@
+<template>
+    <div class="lexStockApplyHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexStockApply/lexStockApply.js b/force-app/main/default/lwc/lexStockApply/lexStockApply.js
new file mode 100644
index 0000000..e82a54a
--- /dev/null
+++ b/force-app/main/default/lwc/lexStockApply/lexStockApply.js
@@ -0,0 +1,114 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-14 13:04:53
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-14 17:54:56
+ */
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import updateForStockApplyButton  from '@salesforce/apex/OpportunityLightingButtonController.updateForStockApplyButton';
+import init  from '@salesforce/apex/OpportunityLightingButtonController.initForStockApplyButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { loadScript } from "lightning/platformResourceLoader";
+import connection from '@salesforce/resourceUrl/connection20';
+export default class LexStockApply extends LightningElement {
+    @api recordId;
+    stockApplyStatus;
+    lastOpportunityFileId;
+    IsLoading = true;  
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+            console.log(111);
+            console.log(currentPageReference);
+
+        if (currentPageReference) {
+          const urlValue = currentPageReference.state.recordId;
+          if (urlValue) {
+            let str = `${urlValue}`;
+            console.log("str");
+            console.log(str);
+            this.recordId = str;
+          }
+        }
+    }
+    connectedCallback(){
+        init({
+            recordId: this.recordId
+        }).then(result=>{
+            console.log(result);
+            this.stockApplyStatus = result.stockApplyStatus;
+            this.lastOpportunityFileId = result.lastOpportunityFileId;
+            this.stockApply();
+        })
+    }
+    stockApply(){
+        var status = this.stockApplyStatus;
+        if (status != '鑽夋涓�' && status != '濉啓瀹屾瘯' && status != '涓嶆壒鍑�' && status != '' && status != undefined) {
+            this.showToast("澶囪揣鐢宠鐘舵�佷笉姝g‘锛屼笉鑳芥彁浜ゅ璐х敵璇枫��","error");
+            return;
+        }
+        var oppfile = this.lastOpportunityFileId;
+        if (oppfile == undefined || oppfile == '') {
+            this.showToast("璇蜂笂浼犺浠锋枃浠躲��","error");
+            return;
+        }
+
+        if (!confirm("涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵")) {
+            this.dispatchEvent(new CloseActionScreenEvent);
+            return;
+        }
+        
+        updateForStockApplyButton({
+            recordId: this.recordId,
+            flag: true
+        }).then(result=>{
+            if(result){
+                this.showToast(result,"error");
+                return;
+            }
+            Promise.all([
+               loadScript(this,connection)
+            ]).then(() =>{
+                var request = new window.sforce.ProcessSubmitRequest();
+                request.objectId = this.recordId;
+                console.log("s");
+                console.log(request);
+                console.log("e");
+                var processResults = window.sforce.Connection.prototype.process([request]);
+                console.log(processResults);
+                if (processResults[0].errors != null) {
+                    updateForStockApplyButton({
+                        recordId: this.recordId,
+                        flag: false
+                    }).then(result=>{
+                        if(result){
+                            this.showToast(result,"error");
+                            return;
+                        }
+                        this.IsLoading = false;
+                        this.updateRecordView(this.recordId);
+                        this.dispatchEvent(new CloseActionScreenEvent);
+                    })
+                }
+            }); 
+        }).catch(error=>{
+            console.log(error);
+        })
+    }
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            title: '',
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+        this.dispatchEvent(new CloseActionScreenEvent);
+      }
+      updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+      }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexStockApply/lexStockApply.js-meta.xml b/force-app/main/default/lwc/lexStockApply/lexStockApply.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexStockApply/lexStockApply.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>54.0</apiVersion>
+	<isExposed>true</isExposed>
+	<targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSubmit/lexSubmit.css b/force-app/main/default/lwc/lexSubmit/lexSubmit.css
new file mode 100644
index 0000000..4379b62
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmit/lexSubmit.css
@@ -0,0 +1,10 @@
+.submitHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSubmit/lexSubmit.html b/force-app/main/default/lwc/lexSubmit/lexSubmit.html
new file mode 100644
index 0000000..b494fe1
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmit/lexSubmit.html
@@ -0,0 +1,7 @@
+<template>
+    <div class="submitHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
+
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSubmit/lexSubmit.js b/force-app/main/default/lwc/lexSubmit/lexSubmit.js
new file mode 100644
index 0000000..f282667
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmit/lexSubmit.js
@@ -0,0 +1,68 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-11 16:46:48
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-11 16:48:05
+ */
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import updateForSubmitButton  from '@salesforce/apex/ReportController.updateForSubmitButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class LexSubmit extends LightningElement {
+    @api recordId;
+    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(){
+        this.submit();
+        
+     }
+
+
+     showToast(msg,type) {
+      const event = new ShowToastEvent({
+          title: '',
+          message: msg,
+          variant: type
+      });
+      this.dispatchEvent(event);
+    }
+
+
+     updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+
+     submit(){
+        updateForSubmitButton({
+          recordId: this.recordId
+        }).then(result=>{
+          if(result){
+            this.showToast(result,"error");
+          }else{
+            this.updateRecordView(this.recordId);
+            this.showToast("鎻愪氦鎴愬姛","success");
+          }
+          this.IsLoading = false;
+          this.dispatchEvent(new CloseActionScreenEvent());
+        });
+     }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSubmit/lexSubmit.js-meta.xml b/force-app/main/default/lwc/lexSubmit/lexSubmit.js-meta.xml
new file mode 100644
index 0000000..329e839
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmit/lexSubmit.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.css b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.css
new file mode 100644
index 0000000..af18c76
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.css
@@ -0,0 +1,11 @@
+.Holder{
+	position: relative;
+	display: inline-block;
+	width: 80px;
+	height: 80px;
+	text-align: center;
+}
+
+.container .uiContainerManager{
+	display : none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.html b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.html
new file mode 100644
index 0000000..404c915
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.html
@@ -0,0 +1,5 @@
+<template>
+	<!-- <div class="Holder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+	</div> -->
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js
new file mode 100644
index 0000000..2a9ab34
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js
@@ -0,0 +1,101 @@
+import { LightningElement, track, wire,api } from 'lwc';
+import {CurrentPageReference,NavigationMixin} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import LightningConfirm from 'lightning/confirm';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+
+
+import applyPermission from '@salesforce/apex/TransferApplyController.applyPermission';
+import submitApply from '@salesforce/apex/TransferApplyWebService.submitApply';
+
+export default class lexSubmitApprovalProcess extends LightningElement {
+	@api recordId;
+	transferApplyPermission;
+	IsLoading=true;
+
+	@wire(CurrentPageReference)
+	getStateParameters(currentPageReference) {
+		console.log(currentPageReference);
+
+		if(currentPageReference) {
+			const urlValue = currentPageReference.state.recordId;
+			if(urlValue) {
+				let str = `${urlValue}`;
+		        console.log("str");
+		        console.log(str);
+		        this.recordId = str;
+
+			}
+		}
+	}
+
+	connectedCallback() {
+		console.log('this.transferApplyId:' + this.recordId);
+		applyPermission().then(result => {
+			console.log(result);
+			this.transferApplyPermission = result;			
+			this.cancelSubmit();	
+					
+		}).catch( error =>{
+			console.log(error);
+		});
+	}
+	
+	cancelSubmit(){
+		if (this.transferApplyPermission == false) {
+			this.showToast('','娌℃湁鎻愪氦鐢宠鐨勬潈闄�','warning');
+		} else{
+			LightningConfirm.open({
+	            message: '涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵',
+	            variant: 'headerless',
+	          
+	        }).then(cancel=>{
+	        	if(cancel) {
+	    			submitApply({taId:this.recordId}).then(submitRes=>{
+						if(submitRes == '1'){
+							this.showToast('','鎻愪氦鎴愬姛','success');
+							window.location.href = window.location;
+						}else{
+							this.showToast("",submitRes,"warning");
+						}
+						this.IsLoading=false;
+						this.dispatchEvent(new CloseActionScreenEvent());
+					});	
+	        	}
+	        });
+			
+		}		
+    }
+    
+    showToast(_title,_message,_variant) {
+        const event = new ShowToastEvent({
+            title: _title,
+            message:_message,
+            variant: _variant,
+        });
+        this.dispatchEvent(event);
+    }
+}
+
+//old js
+/*
+{!REQUIRESCRIPT('/soap/ajax/51.0/connection.js')}
+{!REQUIRESCRIPT('/soap/ajax/51.0/apex.js')}
+var result = sforce.connection.describeSObject('TransferApply__c');
+if (result.createable == 'false') {
+	alert('娌℃湁鎻愪氦鐢宠鐨勬潈闄�');
+}
+else{
+	if (confirm("涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵")) {
+		var rs = sforce.apex.execute("TransferApplyWebService","submitApply",{taId:'{!TransferApply__c.Id}'});
+		if(rs == '1'){
+			alert('鎻愪氦鎴愬姛');
+			window.location.href = window.location;
+		}
+		else{
+			alert(rs);
+		}
+	}
+}
+*/
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js-meta.xml b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js-meta.xml
new file mode 100644
index 0000000..4fe44a7
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitApprovalProcess/lexSubmitApprovalProcess.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexSubmitApprovalProcess">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.js b/force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.js
index 4406dc9..cff5fa6 100644
--- a/force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.js
+++ b/force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.js
@@ -1,3 +1,11 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-04-07 09:02:03
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-11 11:28:51
+ */
 import { LightningElement,wire,track,api} from 'lwc';
 import { CurrentPageReference } from "lightning/navigation";
 import { CloseActionScreenEvent } from 'lightning/actions';
@@ -35,7 +43,6 @@
             recordId: this.recordId
           }).then(result=>{
             this.submit();
-            this.IsLoading = false;  
           });
           
     }
@@ -54,8 +61,13 @@
       otherButtonInSubmitCompetitorReport({
         recordId: this.recordId
     }).then(result=>{
-      this.showToast("鎻愪氦瀵规墜绔炰簤鎶ュ憡鎴愬姛","success")
-      this.updateRecordView(this.recordId);
+      if(result){
+        this.showToast(result,"error");
+      }else{
+        this.showToast("鎻愪氦瀵规墜绔炰簤鎶ュ憡鎴愬姛","success")
+        this.updateRecordView(this.recordId);  
+      }
+      this.IsLoading = false;
       this.dispatchEvent(new CloseActionScreenEvent());
     });
     }
diff --git a/force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.css b/force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.css
new file mode 100644
index 0000000..ebb43d9
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.css
@@ -0,0 +1,10 @@
+.exampleHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.html b/force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.html
new file mode 100644
index 0000000..3eff9e8
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="EquipmentRentalPDF" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.js b/force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.js
new file mode 100644
index 0000000..54846fe
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.js
@@ -0,0 +1,67 @@
+import { LightningElement, track, wire, api } from 'lwc';
+import { CurrentPageReference,NavigationMixin } from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+
+import init from '@salesforce/apex/SubmitExtensionApprovalProcessController.init';
+export default class lexSubmitExtensionApprovalProcess extends LightningElement {
+	@api
+	recordId;
+	IsLoading = true;
+
+	@wire(CurrentPageReference)
+	getStateParameters(currentPageReference){
+		if(currentPageReference) {
+			const urlValue = currentPageReference.state.recordId;
+			if(urlValue) {
+				let str = `${urlValue}`;
+		        this.recordId = str;
+			}
+		}
+	}
+
+	connectedCallback(){
+		init({
+			recordId:this.recordId
+		}).then(result=>{
+			var today = new Date();
+			//杩藉姞澶囧搧鐢宠鐘舵�佺‘璁わ紝宸茬粡鎻愪氦杩囩殑鐢宠锛屼笉鑳介噸澶嶆彁浜tatus__c 
+			if(result.ExtensionStatus == '濉啓瀹屾瘯' || result.ExtensionStatus == '鐢宠涓�') {
+				alert('璇风‘璁ゅ欢鏈熺敵璇风姸鎬侊紝宸茬粡鎻愪氦杩囩殑鐢宠锛屼笉鑳介噸澶嶆彁浜�');
+				return; 
+			}
+
+			var rs1 = sforce.apex.execute("RentalApplyWebService", "extension_approval_processCheck", {rentalApplyId: this.recordId});
+			if(rs1 != '1'){
+				if(rs1 == '2'){
+					//杩斿洖鍊间负2锛屽垽鏂叆鍙d负浠庡崟杩樻槸涓诲崟锛屽鏋滄槸浠庡崟锛岄偅涔堝氨闇�瑕佽烦鍘熸潵鐨勫崟涓欢鏈熼〉闈� 
+					if(result.RootRentalApply == '' || result.RootRentalApply == null){
+						window.open("/apex/RentalApplyMultiPostpone?parentId=" + this.recordId); 
+					}else {
+						window.open("/apex/RentalApplyExtensions?parentId=" + this.recordId); 
+					}
+				}else{
+					alert(rs1);
+					return
+				}
+			}else{
+				if(result.demoPurpose2 == '鍗忚鍊熺敤'){
+					alert('璇峰湪[闄勪欢]鍐呬笂浼犳柊鐨勫悎鍚岄檮浠讹紝骞朵緷鎹悎鍚屽唴鏈熼檺杩涜鏃ユ湡濉啓锛屼箣鍚庢彁浜ゅ鎵�'); 
+					return;
+				}
+				if(result.AgreementBorrowingExtensionDate =='' || result.AgreementBorrowingExtensionDate == null){
+					alert('鍗忚鍊熺敤鐨勫欢鏈熺敵璇风殑銆愬崗璁�熺敤寤舵湡鏃ユ湡銆戜笉鑳戒负绌�'); 
+					return;
+				}
+				if(result.AgreementBorrowingExtensionDate <= result.ReturnDadelineFinal){
+					alert('鍗忚鍊熺敤鐨勫欢鏈熺敵璇风殑銆愬崗璁�熺敤寤舵湡鏃ユ湡銆戝繀椤诲ぇ浜庢渶鏂伴瀹氬綊杩樻棩');
+					return; 
+				}
+				if(result.AgreementBorrowingExtensionDate <= today ){
+					alert('鍗忚鍊熺敤鐨勫欢鏈熺敵璇风殑銆愬崗璁�熺敤寤舵湡鏃ユ湡銆戝繀椤诲ぇ浜庝粖澶�');
+					return; 
+				}
+			}
+			window.open("/apex/RentalApplyExtensions?parentId=" + this.recordId); 
+		})
+	}
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.js-meta.xml b/force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.js-meta.xml
new file mode 100644
index 0000000..e261be9
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTenderingAntiLogicButton/lexTenderingAntiLogicButton.html b/force-app/main/default/lwc/lexTenderingAntiLogicButton/lexTenderingAntiLogicButton.html
new file mode 100644
index 0000000..81a3516
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingAntiLogicButton/lexTenderingAntiLogicButton.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="AntiLogicButton" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTenderingAntiLogicButton/lexTenderingAntiLogicButton.js b/force-app/main/default/lwc/lexTenderingAntiLogicButton/lexTenderingAntiLogicButton.js
new file mode 100644
index 0000000..1220eb0
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingAntiLogicButton/lexTenderingAntiLogicButton.js
@@ -0,0 +1,52 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import  init  from '@salesforce/apex/TenderingButtonController.initTenderingController';
+import  ContraryLogicalDel  from '@salesforce/apex/TenderWebService.ContraryLogicalDel';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class LexTenderingAntiLogicButton extends LightningElement {
+    @api recordId;//褰撳墠杩欐潯鏁版嵁鐨刬d
+    id;//杩斿洖鍊肩殑id  Tender_information__c鎷涙爣椤圭洰鐨刬d
+    IsLoading = true;
+
+    @wire(CurrentPageReference)
+     getStateParameters(currentPageReference) {
+         if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             this.recordId = str;
+           }
+         }
+     }
+    
+    connectedCallback(){
+        init({
+            recordId: this.recordId
+        }).then(result => {
+                this.IsLoading = false;
+                this.id = result.Id;
+                this.AntiLogicButton();
+                this.dispatchEvent(new CloseActionScreenEvent());
+        })   
+    }
+
+    //鎷涙爣椤圭洰鍙嶉�昏緫鍒犻櫎
+    AntiLogicButton(){
+        ContraryLogicalDel({DTenId : this.id}).then(result =>{
+            if(result == 'OK'){
+                this.showToast("鍙嶉�昏緫鍒犻櫎鎴愬姛","success");
+            }
+            this.dispatchEvent(new CloseActionScreenEvent());
+        })
+    }
+
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+}
diff --git a/force-app/main/default/lwc/lexTenderingAntiLogicButton/lexTenderingAntiLogicButton.js-meta.xml b/force-app/main/default/lwc/lexTenderingAntiLogicButton/lexTenderingAntiLogicButton.js-meta.xml
new file mode 100644
index 0000000..2b7649d
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingAntiLogicButton/lexTenderingAntiLogicButton.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+	<apiVersion>54.0</apiVersion>
+	<isExposed>true</isExposed>
+	<targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.js b/force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.js
index 81c44a0..c9f5295 100644
--- a/force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.js
+++ b/force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.js
@@ -27,14 +27,10 @@
             this.id = result.Id;
             this.AttachmentButton();
             this.dispatchEvent(new CloseActionScreenEvent());
-        }).catch(() => {
-
-        }).finally(() => {
-            
-        });        
+        })       
     }
     
-    //鏌ョ湅闄勪欢
+    //鎷涙爣椤圭洰鏌ョ湅闄勪欢
     AttachmentButton(){
         window.open(`/apex/TenderInformationUploadPdf?id=${this.id}`);
     }
diff --git a/force-app/main/default/lwc/lexTenderingEnquiryButton/lexTenderingEnquiryButton.html b/force-app/main/default/lwc/lexTenderingEnquiryButton/lexTenderingEnquiryButton.html
new file mode 100644
index 0000000..31d96b3
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingEnquiryButton/lexTenderingEnquiryButton.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="EnquiryButton" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTenderingEnquiryButton/lexTenderingEnquiryButton.js b/force-app/main/default/lwc/lexTenderingEnquiryButton/lexTenderingEnquiryButton.js
new file mode 100644
index 0000000..24650e9
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingEnquiryButton/lexTenderingEnquiryButton.js
@@ -0,0 +1,62 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import  init  from '@salesforce/apex/TenderingButtonController.initTenderingController';
+import  updateOpportunityInformation  from '@salesforce/apex/UpdateTenderInformationBatch.updateOpportunityInformation';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class lexTenderingEnquiryButton extends LightningElement {
+    @api recordId;//褰撳墠杩欐潯鏁版嵁鐨刬d
+    id;//杩斿洖鍊肩殑id  Tender_information__c鎷涙爣椤圭洰鐨刬d
+    IsLoading = true;
+    isRelateProject;//鍒ゆ柇鏄惁鍙嶅簲
+
+    @wire(CurrentPageReference)
+     getStateParameters(currentPageReference) {
+         if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             this.recordId = str;
+           }
+         }
+     }
+    
+    connectedCallback(){
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            if (result != null) {
+                this.IsLoading = false;
+                this.id = result.Id;
+                this.isRelateProject = result.isRelateProject;
+                this.EnquiryButton();
+                this.dispatchEvent(new CloseActionScreenEvent());
+            }
+        })     
+    }
+    //鎷涙爣椤圭洰 鍙嶅簲璇环鐘舵��
+    EnquiryButton(){
+        if(this.isRelateProject == "鍚�"){
+            this.showToast('鎷涙姇鏍囬」鐩笉鐩稿叧鍚庝笉鑳藉弽搴旇浠风姸鎬�!','error');
+            return;
+        }
+        var listss = [];
+        listss.push(this.id);
+        updateOpportunityInformation({TenderIdList : listss}).then(result=>{
+            if(result != 'OK'){
+                this.showToast(result,'error');
+            }else {
+                this.showToast('鍙嶆槧瀹屼簡','success');
+            }
+        })
+    }
+
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTenderingEnquiryButton/lexTenderingEnquiryButton.js-meta.xml b/force-app/main/default/lwc/lexTenderingEnquiryButton/lexTenderingEnquiryButton.js-meta.xml
new file mode 100644
index 0000000..2b7649d
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingEnquiryButton/lexTenderingEnquiryButton.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+	<apiVersion>54.0</apiVersion>
+	<isExposed>true</isExposed>
+	<targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.js b/force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.js
index 37f9f44..e577335 100644
--- a/force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.js
+++ b/force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.js
@@ -6,6 +6,7 @@
     @api recordId;//褰撳墠杩欐潯鏁版嵁鐨刬d
     id;//杩斿洖鍊肩殑id  Tender_information__c鎷涙爣椤圭洰鐨刬d
     name;//鎷涙爣椤圭洰鍚�
+    Environment_Url;//鏂板缓鍖婚櫌鍦板潃
     IsLoading = true;
 
     @wire(CurrentPageReference)
@@ -26,6 +27,7 @@
                 this.IsLoading = false;
                 this.id = result.Id;
                 this.name = result.name;
+                this.Environment_Url = result.Environment_Url;
                 this.HospitalButton();
                 this.dispatchEvent(new CloseActionScreenEvent());
         }).catch(() => {
@@ -34,9 +36,9 @@
         });        
     }
 
-    //鏂板缓鍖婚櫌
+    //鎷涙爣椤圭洰鏂板缓鍖婚櫌
     HospitalButton(){
-        var url = 'https://ocsm.my.salesforce.com/?ec=302&startURL=%2F'+'001/e?CF00N10000009I0o7='+encodeURIComponent(this.name)
+        var url = this.Environment_Url+'001/e?CF00N10000009I0o7='+encodeURIComponent(this.name)
         +'&CF00N10000009I0o7_lkid='+encodeURIComponent(this.id)
         +'&00N10000009HFQT='+encodeURIComponent('鎷涙爣椤圭洰')
         +'&RecordType=01210000000QemG'
diff --git a/force-app/main/default/lwc/lexTenderingIntentionButton/lexTenderingIntentionButton.html b/force-app/main/default/lwc/lexTenderingIntentionButton/lexTenderingIntentionButton.html
new file mode 100644
index 0000000..8e46b4b
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingIntentionButton/lexTenderingIntentionButton.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="IntentionButton" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTenderingIntentionButton/lexTenderingIntentionButton.js b/force-app/main/default/lwc/lexTenderingIntentionButton/lexTenderingIntentionButton.js
new file mode 100644
index 0000000..f5f5d53
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingIntentionButton/lexTenderingIntentionButton.js
@@ -0,0 +1,52 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import  init  from '@salesforce/apex/TenderingButtonController.initTenderingController';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class lexTenderingIntentionButton extends LightningElement {
+    @api recordId;//褰撳墠杩欐潯鏁版嵁鐨刬d
+    id;//杩斿洖鍊肩殑id  Tender_information__c鎷涙爣椤圭洰鐨刬d
+    IsLoading = true;
+
+    @wire(CurrentPageReference)
+     getStateParameters(currentPageReference) {
+         if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             this.recordId = str;
+           }
+         }
+     }
+    
+    connectedCallback(){
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            if (result != null) {
+                this.IsLoading = false;
+                this.id = result.Id;
+                this.IntentionButton();
+                this.dispatchEvent(new CloseActionScreenEvent());
+            }
+        })      
+    }
+
+    //鎷涙爣椤圭洰鏂板缓鎰忓悜
+    IntentionButton(){
+            // alert('濉啓澶卞崟鎶ュ憡璇风洿鎺ョ偣鍑绘嫑鏍囬〉闈€�愬け鍗曘�戞寜閽�');
+            this.showToast('濉啓澶卞崟鎶ュ憡璇风洿鎺ョ偣鍑绘嫑鏍囬〉闈€�愬け鍗曘�戞寜閽�','success');
+            var url = '/apex/NewAndEditLead?' + '00N10000009HKS5=' + this.id
+            + '&LeadSource=鎷涙爣缃�' + '&RecordTypeId=01210000000QiRf' + '&retURL=%2F' + this.id ;
+            window.open(url);
+    }
+
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTenderingIntentionButton/lexTenderingIntentionButton.js-meta.xml b/force-app/main/default/lwc/lexTenderingIntentionButton/lexTenderingIntentionButton.js-meta.xml
new file mode 100644
index 0000000..2b7649d
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingIntentionButton/lexTenderingIntentionButton.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+	<apiVersion>54.0</apiVersion>
+	<isExposed>true</isExposed>
+	<targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTenderingLogicButton/lexTenderingLogicButton.html b/force-app/main/default/lwc/lexTenderingLogicButton/lexTenderingLogicButton.html
new file mode 100644
index 0000000..e7eb872
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingLogicButton/lexTenderingLogicButton.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="LogicButton" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTenderingLogicButton/lexTenderingLogicButton.js b/force-app/main/default/lwc/lexTenderingLogicButton/lexTenderingLogicButton.js
new file mode 100644
index 0000000..54959c0
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingLogicButton/lexTenderingLogicButton.js
@@ -0,0 +1,39 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import  init  from '@salesforce/apex/TenderingButtonController.initTenderingController';
+export default class lexTenderingLogicButton extends LightningElement {
+    @api recordId;//褰撳墠杩欐潯鏁版嵁鐨刬d
+    id;//杩斿洖鍊肩殑id  Tender_information__c鎷涙爣椤圭洰鐨刬d
+    IsLoading = true;
+
+    @wire(CurrentPageReference)
+     getStateParameters(currentPageReference) {
+         if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             this.recordId = str;
+           }
+         }
+     }
+    
+
+    connectedCallback(){
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            if (result != null) {
+                this.IsLoading = false;
+                this.id = result.Id;
+                this.LogicButton();
+                this.dispatchEvent(new CloseActionScreenEvent());
+            }
+        })        
+    }
+    
+    //鎷涙爣椤圭洰閫昏緫鍒犻櫎
+    LogicButton(){
+        window.open (`/apex/TenderDeletePagelwc?id=${this.id}`, '', 'height=350, width=600, top=200, left=350');
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTenderingLogicButton/lexTenderingLogicButton.js-meta.xml b/force-app/main/default/lwc/lexTenderingLogicButton/lexTenderingLogicButton.js-meta.xml
new file mode 100644
index 0000000..2b7649d
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingLogicButton/lexTenderingLogicButton.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+	<apiVersion>54.0</apiVersion>
+	<isExposed>true</isExposed>
+	<targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js b/force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js
index cb7beef..ff5d294 100644
--- a/force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js
+++ b/force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js
@@ -33,12 +33,10 @@
                 this.profileId = result.profileId.slice(0,15);
                 this.LoseButton();
                 this.dispatchEvent(new CloseActionScreenEvent());
-        }).catch(() => {
-        }).finally(() => {
-        });        
+        })        
     }
 
-    //澶卞崟
+    //鎷涙爣椤圭洰澶卞崟
     LoseButton(){
         sqlResult({id: this.id}).then(result=>{
             //绠�妗f潈闄� 2S1_閿�鍞尰闄㈡媴褰� 2S4_閿�鍞鐞嗚�� 绯荤粺绠$悊鍛�
@@ -68,5 +66,6 @@
             variant: type
         });
         this.dispatchEvent(event);
+        this.dispatchEvent(new CloseActionScreenEvent());
     }
 }
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTenderingNoStandardButton/lexTenderingNoStandardButton.html b/force-app/main/default/lwc/lexTenderingNoStandardButton/lexTenderingNoStandardButton.html
new file mode 100644
index 0000000..0f47a3a
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingNoStandardButton/lexTenderingNoStandardButton.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="NoStandardButton" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTenderingNoStandardButton/lexTenderingNoStandardButton.js b/force-app/main/default/lwc/lexTenderingNoStandardButton/lexTenderingNoStandardButton.js
new file mode 100644
index 0000000..b071b10
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingNoStandardButton/lexTenderingNoStandardButton.js
@@ -0,0 +1,49 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import  init  from '@salesforce/apex/TenderingButtonController.initTenderingController';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class lexTenderingNoStandardButton extends LightningElement {
+    @api recordId;//褰撳墠杩欐潯鏁版嵁鐨刬d
+    id;//杩斿洖鍊肩殑id  Tender_information__c鎷涙爣椤圭洰鐨刬d
+    opportunityNum;
+    IsLoading = true;
+
+    @wire(CurrentPageReference)
+     getStateParameters(currentPageReference) {
+         if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             this.recordId = str;
+           }
+         }
+     }
+    connectedCallback(){
+        init({
+            recordId: this.recordId
+        }).then(result => {
+                this.IsLoading = false;
+                this.id = result.Id;
+                this.opportunityNum = result.opportunityNum;
+                this.NoStandardButton();
+                this.dispatchEvent(new CloseActionScreenEvent());
+        })        
+    }
+    //鎷涙爣椤圭洰涓嶅簲鏍囩敵璇�
+    NoStandardButton(){
+        if(Number(this.opportunityNum) > 0) {
+            this.showToast('椤圭洰宸插叧鑱旇繃璇环锛岃鍒拌浠烽噷鍋氫笉搴旀爣鐢宠','error');
+            return;
+        }
+        window.open ('/apex/Bidding?id='+this.id, '', 'height=350, width=600, top=200, left=350,location=no');
+    }
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+}
diff --git a/force-app/main/default/lwc/lexTenderingNoStandardButton/lexTenderingNoStandardButton.js-meta.xml b/force-app/main/default/lwc/lexTenderingNoStandardButton/lexTenderingNoStandardButton.js-meta.xml
new file mode 100644
index 0000000..2b7649d
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingNoStandardButton/lexTenderingNoStandardButton.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+	<apiVersion>54.0</apiVersion>
+	<isExposed>true</isExposed>
+	<targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTenderingNotarizeButton/lexTenderingNotarizeButton.html b/force-app/main/default/lwc/lexTenderingNotarizeButton/lexTenderingNotarizeButton.html
new file mode 100644
index 0000000..40c4113
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingNotarizeButton/lexTenderingNotarizeButton.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="NotarizeButton" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTenderingNotarizeButton/lexTenderingNotarizeButton.js b/force-app/main/default/lwc/lexTenderingNotarizeButton/lexTenderingNotarizeButton.js
new file mode 100644
index 0000000..e7f76d4
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingNotarizeButton/lexTenderingNotarizeButton.js
@@ -0,0 +1,72 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import  init  from '@salesforce/apex/TenderingButtonController.initTenderingController';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class lexTenderingNotarizeButton extends LightningElement {
+    @api recordId;//褰撳墠杩欐潯鏁版嵁鐨刬d
+    id;//杩斿洖鍊肩殑id  Tender_information__c鎷涙爣椤圭洰鐨刬d
+    status;//鐘舵��
+    profileId;//profileId id
+    IsLoading = true;
+
+    @wire(CurrentPageReference)
+     getStateParameters(currentPageReference) {
+         if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             this.recordId = str;
+           }
+         }
+     }
+    
+
+    connectedCallback(){
+        init({
+            recordId: this.recordId
+        }).then(result => {
+                this.IsLoading = false;
+                this.id = result.Id;
+                this.status = result.status;
+                this.profileId = result.profileId.slice(0,15);
+                this.NotarizeButton();
+                this.dispatchEvent(new CloseActionScreenEvent());
+        })       
+    }
+
+    //鎷涙爣椤圭洰 鐩稿叧鎬х‘璁�
+    NotarizeButton(){
+        if( this.ProfileId!= '00e1m000000MSci'
+        && this.ProfileId!= '00e10000000Y3o5'
+        && this.ProfileId!= '00e10000000xnpR' && this.ProfileId!= '00e10000000xyK6'
+        && this.ProfileId!= '00e10000000xnpW'
+        && this.ProfileId!= '00e10000000xnpb' && this.ProfileId!= '00e10000000xyKB'
+        && this.ProfileId!= '00e10000000a7NY'
+        && this.ProfileId!= '00e10000000s2fZ'
+        && this.ProfileId!= '00e10000000s3Jp'
+        ){
+            this.showToast("鍙湁鍔╃悊鎵嶈兘杩涜鐩稿叧鎬х‘璁わ紒","error");
+            return;
+        }
+        if(this.status== '01.寰呯‘璁�' ||
+           this.status== '02.涓嶇浉鍏�' ||
+           this.status == '03.涓嶅簲鏍�' ||
+           this.status== '04.寰呭叧鑱旇浠�' 
+        ){
+            window.open (`/apex/Relevance?id=${this.id}`, '', 'height=500, width=800, top=200, left=250,location=no');
+        }
+        else{
+            this.showToast("鍏宠仈璇环鍚庝笉鑳借繘琛岀浉鍏虫�х‘璁わ紒","error");
+        }
+
+    }
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTenderingNotarizeButton/lexTenderingNotarizeButton.js-meta.xml b/force-app/main/default/lwc/lexTenderingNotarizeButton/lexTenderingNotarizeButton.js-meta.xml
new file mode 100644
index 0000000..2b7649d
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingNotarizeButton/lexTenderingNotarizeButton.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+	<apiVersion>54.0</apiVersion>
+	<isExposed>true</isExposed>
+	<targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTenderingRelevancyButton/lexTenderingRelevancyButton.html b/force-app/main/default/lwc/lexTenderingRelevancyButton/lexTenderingRelevancyButton.html
new file mode 100644
index 0000000..71d8dbe
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingRelevancyButton/lexTenderingRelevancyButton.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="RelevancyButton" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTenderingRelevancyButton/lexTenderingRelevancyButton.js b/force-app/main/default/lwc/lexTenderingRelevancyButton/lexTenderingRelevancyButton.js
new file mode 100644
index 0000000..977a883
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingRelevancyButton/lexTenderingRelevancyButton.js
@@ -0,0 +1,60 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import  init  from '@salesforce/apex/TenderingButtonController.initTenderingController';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+export default class LexTenderingRelevancyButton extends LightningElement {
+    @api recordId;//褰撳墠杩欐潯鏁版嵁鐨刬d
+    id;//杩斿洖鍊肩殑id  Tender_information__c鎷涙爣椤圭洰鐨刬d
+    ProfileId;
+    IsLoading = true;
+
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+        if (currentPageReference) {
+          const urlValue = currentPageReference.state.recordId;
+          if (urlValue) {
+            let str = `${urlValue}`;
+            this.recordId = str;
+          }
+        }
+    }
+    connectedCallback(){
+        init({
+            recordId: this.recordId
+        }).then(result => {
+                this.IsLoading = false;
+                this.id = result.Id;
+                this.ProfileId = result.profileId.slice(0,15);
+                this.RelevancyButton();
+                this.dispatchEvent(new CloseActionScreenEvent());
+        })       
+    }
+    //鎷涙爣椤圭洰 鍏宠仈宸叉湁璇环
+    RelevancyButton(){
+        if( this.ProfileId != '00e1m000000MSci'
+        && this.ProfileId != '00e10000000Y3o5'
+        && this.ProfileId != '00e10000000xnp2' && this.ProfileId != '00e10000000xzQ0'
+        && this.ProfileId != '00e10000000xnp7'&& this.ProfileId != '00e10000001220i'
+        && this.ProfileId != '00e10000000xnpH' && this.ProfileId != '00e10000000xzQA'
+        && this.ProfileId != '00e10000000hkas'
+        && this.ProfileId != '00e10000000xnpR' && this.ProfileId != '00e10000000xyK6'
+        && this.ProfileId != '00e10000000xnpW'
+        && this.ProfileId != '00e10000000Nb7i'
+        ){
+        this.showToast('鍙湁鎷呭綋鍜屽姪鐞嗘墠鑳藉叧鑱旇浠�','error');
+        return;
+        }
+        window.open ('/apex/Enquiry?id='+this.recordId, '_blank');
+    }
+
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTenderingRelevancyButton/lexTenderingRelevancyButton.js-meta.xml b/force-app/main/default/lwc/lexTenderingRelevancyButton/lexTenderingRelevancyButton.js-meta.xml
new file mode 100644
index 0000000..2b7649d
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingRelevancyButton/lexTenderingRelevancyButton.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+	<apiVersion>54.0</apiVersion>
+	<isExposed>true</isExposed>
+	<targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTenderingUsedAttachmentButton/lexTenderingUsedAttachmentButton.html b/force-app/main/default/lwc/lexTenderingUsedAttachmentButton/lexTenderingUsedAttachmentButton.html
new file mode 100644
index 0000000..40c4113
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingUsedAttachmentButton/lexTenderingUsedAttachmentButton.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="NotarizeButton" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTenderingUsedAttachmentButton/lexTenderingUsedAttachmentButton.js b/force-app/main/default/lwc/lexTenderingUsedAttachmentButton/lexTenderingUsedAttachmentButton.js
new file mode 100644
index 0000000..7c0e891
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingUsedAttachmentButton/lexTenderingUsedAttachmentButton.js
@@ -0,0 +1,46 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import  init  from '@salesforce/apex/TenderingButtonController.initTenderingController';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class lexTenderingUsedAttachmentButton extends LightningElement {
+    @api recordId;//褰撳墠杩欐潯鏁版嵁鐨刬d
+    id;//杩斿洖鍊肩殑id  Tender_information__c鎷涙爣椤圭洰鐨刬d
+    IsLoading = true;
+
+    @wire(CurrentPageReference)
+     getStateParameters(currentPageReference) {
+         if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             this.recordId = str;
+           }
+         }
+     }
+    
+    connectedCallback(){
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            this.IsLoading = false;
+            this.id = result.Id;
+            this.AttachmentButton();
+            this.dispatchEvent(new CloseActionScreenEvent());
+        })        
+    }
+    
+    //鎷涙爣椤圭洰 鏌ョ湅闄勪欢(鏃�)
+    AttachmentButton(){
+        window.open(`/apex/QLMAttachmentPreview?parentId=${this.id}`);
+    }
+
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+}
diff --git a/force-app/main/default/lwc/lexTenderingUsedAttachmentButton/lexTenderingUsedAttachmentButton.js-meta.xml b/force-app/main/default/lwc/lexTenderingUsedAttachmentButton/lexTenderingUsedAttachmentButton.js-meta.xml
new file mode 100644
index 0000000..2b7649d
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingUsedAttachmentButton/lexTenderingUsedAttachmentButton.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+	<apiVersion>54.0</apiVersion>
+	<isExposed>true</isExposed>
+	<targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTopInQueue/lexTopInQueue.css b/force-app/main/default/lwc/lexTopInQueue/lexTopInQueue.css
new file mode 100644
index 0000000..635bc6c
--- /dev/null
+++ b/force-app/main/default/lwc/lexTopInQueue/lexTopInQueue.css
@@ -0,0 +1,22 @@
+.outerBorderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    border-top : 3px solid #565959;
+}
+.borderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    margin-bottom : 7px;
+    border-top : 3px solid #565959;
+}
+.headerDorderCss{
+    border-top: 1px solid #565959;
+    border-bottom: 1px solid #D4D4D4;
+    padding:3px;
+}
+.centerCss{
+    text-align: center;
+}
+.centerCss .left{
+    margin-left: 100px;
+}/* sample css file */
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTopInQueue/lexTopInQueue.html b/force-app/main/default/lwc/lexTopInQueue/lexTopInQueue.html
new file mode 100644
index 0000000..49a10f7
--- /dev/null
+++ b/force-app/main/default/lwc/lexTopInQueue/lexTopInQueue.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="sisToOPDHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTopInQueue/lexTopInQueue.js b/force-app/main/default/lwc/lexTopInQueue/lexTopInQueue.js
new file mode 100644
index 0000000..ca3dd20
--- /dev/null
+++ b/force-app/main/default/lwc/lexTopInQueue/lexTopInQueue.js
@@ -0,0 +1,49 @@
+import { LightningElement, track, wire, api } from 'lwc';
+import { CurrentPageReference,NavigationMixin } from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+import queueTop from '@salesforce/apex/ApplyJsCtl.queueTop';
+export default class lexTopInQueue extends LightningElement {
+
+	@api recordId;
+	IsLoading = true;
+
+	@wire(CurrentPageReference)
+	getStateParameters(currentPageReference){
+		if(currentPageReference) {
+			const urlValue = currentPageReference.state.recordId;
+			if(urlValue) {
+				let str = `${urlValue}`;
+		        this.recordId = str;
+			}
+		}
+	}
+
+	connectedCallback(){
+		queueTop({
+			applyId: this.recordId
+		}).then(res=>{
+			if(res == 'Success'){
+				const evt = new ShowToastEvent({
+                        title : '缃《鎴愬姛',
+                        message: '',
+                        variant: 'success'
+                    });
+                this.dispatchEvent(evt);
+                this.dispatchEvent(new CloseActionScreenEvent());
+			}else{
+				const evterr = new ShowToastEvent({
+                        title : res,
+                        message: '',
+                        variant: 'error'
+                    });
+                this.dispatchEvent(evterr);
+                this.dispatchEvent(new CloseActionScreenEvent());
+			}
+		}).catch(err=>{
+			this.dispatchEvent(new CloseActionScreenEvent());
+		})
+	}
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTopInQueue/lexTopInQueue.js-meta.xml b/force-app/main/default/lwc/lexTopInQueue/lexTopInQueue.js-meta.xml
new file mode 100644
index 0000000..74849f3
--- /dev/null
+++ b/force-app/main/default/lwc/lexTopInQueue/lexTopInQueue.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexOCMSubmit">
+    <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.css b/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.css
new file mode 100644
index 0000000..af18c76
--- /dev/null
+++ b/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.css
@@ -0,0 +1,11 @@
+.Holder{
+	position: relative;
+	display: inline-block;
+	width: 80px;
+	height: 80px;
+	text-align: center;
+}
+
+.container .uiContainerManager{
+	display : none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.html b/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.html
new file mode 100644
index 0000000..2688153
--- /dev/null
+++ b/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.html
@@ -0,0 +1,5 @@
+<template>
+	<div class="Holder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+	</div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js b/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js
new file mode 100644
index 0000000..c41b11e
--- /dev/null
+++ b/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js
@@ -0,0 +1,92 @@
+import { LightningElement, track, wire,api } from 'lwc';
+import {CurrentPageReference,NavigationMixin} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+
+
+import transferApplyPDF from '@salesforce/apex/TransferApplyController.transferApplyPDF';
+export default class lexTransferApplyPDF extends LightningElement {
+	@api recordId;
+	transferApplyPDFRes;
+	IsLoading=true;
+
+	@wire(CurrentPageReference)
+	getStateParameters(currentPageReference) {
+		console.log(currentPageReference);
+
+		if(currentPageReference) {
+			const urlValue = currentPageReference.state.recordId;
+			if(urlValue) {
+				let str = `${urlValue}`;
+		        console.log("str");
+		        console.log(str);
+		        this.recordId = str;
+
+			}
+		}
+	}
+
+	connectedCallback() {
+		console.log('this.transferApplyId:' + this.recordId);
+		transferApplyPDF({
+			transferApplyId : this.recordId
+		}).then(result => {
+			console.log(result);
+			this.transferApplyPDFRes = result;			
+			this.cancelSubmit().then(res=>{
+				this.IsLoading=false;
+				this.dispatchEvent(new CloseActionScreenEvent());
+			});	
+					
+		}).catch( error =>{
+			console.log(error);
+		});
+	}
+	async cancelSubmit(){
+		let records = new Array();
+		records = this.transferApplyPDFRes;
+		var size =records.length;
+		if(size>0){
+			var length = size%10 ==0? size/10 : parseInt(size/10) +1;
+			for(var i =0;i<length;i++){
+				window.open('/apex/TransferApplyPDF?raid='+this.recordId+'&page=' + i);
+			}
+		}else{
+			this.showToast('','褰撳墠鐨勭敵璇峰崟涓病鏈夊凡鎵瑰噯澶囧搧銆�','warning');
+		}			
+    }
+
+    showToast(_title,_message,_variant) {
+        const event = new ShowToastEvent({
+            title: _title,
+            message:_message,
+            variant: _variant,
+        });
+        this.dispatchEvent(event);
+    }
+
+}
+
+//old js'
+/*
+{!RequireScript("/soap/ajax/51.0/connection.js")}
+{!RequireScript("/soap/ajax/51.0/apex.js")}
+var foo = function() {
+
+	var sql = "select Id from TransferApplySummary__c where TransferApply__c = '{!TransferApply__c.Id}' and ApprovalDetails__c > 0 and TAS_Status__c != '鍙栨秷'";
+	//Yi_StockDown__c->ApprovalDetails__c 20210805 ljh SFDC-C56D3K 宸蹭笅鏋�->宸叉壒鍑�
+	var sqlResult = sforce.connection.query(sql);
+	var records = sqlResult.getArray("records");
+	var size =records.length;
+	if(size>0){
+		var length = size%10 ==0? size/10 : parseInt(size/10) +1;
+		for(var i =0;i<length;i++){
+		window.open('/apex/TransferApplyPDF?raid={!TransferApply__c.Id}&page=' + i);
+		}
+	}else{
+		alert('褰撳墠鐨勭敵璇峰崟涓病鏈夊凡鎵瑰噯澶囧搧銆�');
+	}
+}
+foo();
+*/
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js-meta.xml b/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js-meta.xml
new file mode 100644
index 0000000..0a37c91
--- /dev/null
+++ b/force-app/main/default/lwc/lexTransferApplyPDF/lexTransferApplyPDF.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexTransferApplyPDF">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.js b/force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.js
index 8e9882e..99cc31c 100644
--- a/force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.js
+++ b/force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.js
@@ -1,3 +1,11 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-03-27 14:05:59
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-11 11:30:45
+ */
 import { LightningElement, wire, track, api } from "lwc";
 import { CurrentPageReference } from "lightning/navigation";
 import { CloseActionScreenEvent } from "lightning/actions";
@@ -35,7 +43,6 @@
       .then((result) => {
         console.log(result);
         if (result != null) {
-          this.Isloading = false;
           this.status = result.status;
           this.update();
         }
@@ -43,8 +50,7 @@
       .catch((error) => {
         console.log("error");
         console.log(error);
-      })
-      .finally(() => {});
+      });
     //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view");
   }
 
@@ -69,13 +75,13 @@
     updateForVOCAnswerButton({
       recordId: this.recordId
     }).then(result => {
-      if (result == null) {
-        this.showToast("鎴愬姛", "success");
-      } else {
-        console.log(result);
+      if (result) {
         this.showToast(result,"error");
+      } else {
+        this.showToast("鎴愬姛", "success");
+        this.updateRecordView(this.recordId);
       }
-      this.updateRecordView(this.recordId);
+      this.Isloading = false;
       this.dispatchEvent(new CloseActionScreenEvent());
     }).catch(error=>{
       console.log(error);
diff --git a/force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js b/force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js
index 6d8e5b0..edccdf5 100644
--- a/force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js
+++ b/force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js
@@ -40,7 +40,7 @@
         }).then(result => {
             console.log(result);
             if (result != null) {  
-                this.Isloading = false;             
+          
                 this.status = result.status;
                 this.isVOC = result.isVOC;
                 this.personId = result.personId;
@@ -52,8 +52,6 @@
         }).catch(error => {
             console.log("error");
             console.log(error);
-        }).finally(() => {
-            
         });
     }
 
@@ -79,13 +77,11 @@
                 return;
             }
             if (this.status != "璺熻繘涓�") {
-                alert("涓嶆槸璺熻繘涓笉鑳界偣鍑�");
                 this.showToast("涓嶆槸璺熻繘涓笉鑳界偣鍑�","error");
                 this.dispatchEvent(new CloseActionScreenEvent());
                 return;
             }
             if (this.isVOC == undefined) {
-                alert("蹇呴』閫夋嫨鏄惁VOC");
                 this.showToast("蹇呴』閫夋嫨鏄惁VOC","error");
                 this.dispatchEvent(new CloseActionScreenEvent());
                 return;
@@ -97,12 +93,13 @@
                     personId:this.personId
                 }
             ).then(result =>{
-                if(result == null){
+                if(result){
+                    this.showToast(result,"error");
+                }else{
                     this.showToast("鎴愬姛","success");
                     this.updateRecordView(this.recordId);
-                }else {
-                    this.showToast(result,"error");
                 }
+                this.Isloading = false;   
                 this.dispatchEvent(new CloseActionScreenEvent());
             });
 
diff --git a/force-app/main/default/lwc/lexVOCConfirm/lexVOCConfirm.js b/force-app/main/default/lwc/lexVOCConfirm/lexVOCConfirm.js
index e5625e4..1f3ffdf 100644
--- a/force-app/main/default/lwc/lexVOCConfirm/lexVOCConfirm.js
+++ b/force-app/main/default/lwc/lexVOCConfirm/lexVOCConfirm.js
@@ -1,3 +1,11 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-03-27 14:08:56
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-11 11:33:01
+ */
 import { LightningElement,wire,track,api} from 'lwc';
 import { CurrentPageReference } from "lightning/navigation";
 import { CloseActionScreenEvent } from 'lightning/actions';
@@ -37,7 +45,6 @@
         }).then(result => {
             console.log(result);
             if (result != null) {
-                this.Isloading = false;
                 this.status = result.status;
                 this.VOCSatisfy = result.Satisfy;
                 this.VOCSatisfy1 = result.Satisfy1;
@@ -49,11 +56,8 @@
         }).catch(error => {
             console.log("error");
             console.log(error);
-        }).finally(() => {
-            
         });
         //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view");
-        this.updateRecordView(this.recordId);
     }
 
     updateRecordView(recordId) {
@@ -86,8 +90,13 @@
             Satisfy: this.VOCSatisfy,
             Satisfy1: this.VOCSatisfy1    
         }).then(result=>{
-            this.updateRecordView(this.recordId);
-            this.showToast("鎴愬姛","success");
+            if(result){
+                this.showToast(result,"error");
+            }else{
+                this.updateRecordView(this.recordId);
+                this.showToast("鎴愬姛","success");
+            }
+            this.Isloading = false;
             this.dispatchEvent(new CloseActionScreenEvent());
         });
 
diff --git a/force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.js b/force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.js
index 032beec..edcb0f1 100644
--- a/force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.js
+++ b/force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.js
@@ -1,3 +1,11 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-03-27 14:11:17
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-11 11:34:01
+ */
 import { api, wire,LightningElement } from 'lwc';
 import { CurrentPageReference } from "lightning/navigation";
 import { CloseActionScreenEvent } from 'lightning/actions';
@@ -35,7 +43,6 @@
         }).then(result => {
             console.log(result);
             if (result != null) {
-                this.IsLoading = false;
                 this.status = result.status;
                 this.profileId = result.profileId;
                 this.VOCFinish();
@@ -43,8 +50,6 @@
         }).catch(error => {
             console.log("error");
             console.log(error);
-        }).finally(() => {
-            
         });
         //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view");
         //this.updateRecordView(this.recordId);
@@ -78,8 +83,13 @@
             update({
                 recordId: this.recordId
             }).then(result =>{
-                this.showToast("鎴愬姛","success");
-                this.updateRecordView(this.recordId);
+                if(result){
+                    this.showToast(result,"error");
+                }else{
+                    this.showToast("鎴愬姛","success");
+                    this.updateRecordView(this.recordId);
+                }
+                this.IsLoading = false;
                 this.dispatchEvent(new CloseActionScreenEvent());
             });
     }
diff --git a/force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.js b/force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.js
index 491c418..62acb75 100644
--- a/force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.js
+++ b/force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.js
@@ -1,3 +1,11 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-03-27 13:39:23
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-11 11:35:31
+ */
 import { LightningElement,wire,track,api} from 'lwc';
 import { CurrentPageReference } from "lightning/navigation";
 import { CloseActionScreenEvent } from 'lightning/actions';
@@ -38,14 +46,11 @@
                 this.status = result.status;
                 this.createdById = result.createdById;
                 this.Submit();
-                this.IsLoading = false;
                 //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view");
             }
         }).catch(error => {
             console.log("error");
             console.log(error);
-        }).finally(() => {
-            
         });   
         //this.updateRecordView(this.recordId);
     }
@@ -73,8 +78,13 @@
                 recordId: this.recordId,
                 createdById: this.createdById
             }).then(result =>{
-                this.showToast("鎴愬姛","success");
-                this.updateRecordView(this.recordId);
+                if(result){
+                    this.showToast(result,"error");
+                }else{
+                    this.showToast("鎴愬姛","success");
+                    this.updateRecordView(this.recordId);
+                }
+                this.IsLoading = false;
                 this.dispatchEvent(new CloseActionScreenEvent());
             });
     }
diff --git a/force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.css b/force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.css
new file mode 100644
index 0000000..9acb129
--- /dev/null
+++ b/force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.css
@@ -0,0 +1,22 @@
+.outerBorderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    border-top : 3px solid #565959;
+}
+.borderCss{
+    border: 1px solid #D4D4D4;
+    border-radius : 5px;
+    margin-bottom : 7px;
+    border-top : 3px solid #565959;
+}
+.headerDorderCss{
+    border-top: 1px solid #565959;
+    border-bottom: 1px solid #D4D4D4;
+    padding:3px;
+}
+.centerCss{
+    text-align: center;
+}
+.centerCss .left{
+    margin-left: 100px;
+}/* sample css file *//* sample css file */
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.html b/force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.html
new file mode 100644
index 0000000..c8bdbfc
--- /dev/null
+++ b/force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.html
@@ -0,0 +1,5 @@
+<template>
+   <div class="sisToOPDHolder" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.js b/force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.js
new file mode 100644
index 0000000..ee1cc09
--- /dev/null
+++ b/force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.js
@@ -0,0 +1,61 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { NavigationMixin } from 'lightning/navigation';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { updateRecord } from 'lightning/uiRecordApi';
+import init  from '@salesforce/apex/QISReportController.initForlexcopyQISButton';
+
+
+export default class lexcopyQIS extends LightningElement {
+	@api recordId;
+	err;
+	IsLoading = true;
+	qisReportId;
+	qisStatus;
+	name;
+	
+	 @wire(CurrentPageReference)
+     getStateParameters(currentPageReference) {
+             console.log(111);
+             console.log(currentPageReference);
+
+         if (currentPageReference) {
+           const urlValue = currentPageReference.state.recordId;
+           if (urlValue) {
+             let str = `${urlValue}`;
+             console.log("str");
+             console.log(str);
+             this.recordId = str;
+           }
+         }
+     }
+
+     connectedCallback () {
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            this.IsLoading = false;
+            this.qisReportId = result.Id;
+            this.qisStatus = result.qIStatus;
+            this.name = result.name;
+            if (this.qisStatus != '鍙栨秷') {
+            	const evt = new ShowToastEvent({
+                        title : '鐘舵�佷负鍙栨秷鐨凲IS鎵嶅彲浠ヨ澶嶅埗骞舵柊寤�',
+                        message: '',
+                        variant: 'error'
+                    });
+	                this.dispatchEvent(evt);
+	                this.dispatchEvent(new CloseActionScreenEvent());
+	                return;
+            }
+           	var url = "/"+this.qisReportId+"/e?newclone=1&retURL=%2F"+this.qisReportId+" &CF00N100000073PA0="+this.name+"&CF00N100000073PA0_lkid="+this.qisReportId;
+           	window.open(url);
+           	this.dispatchEvent(new CloseActionScreenEvent());
+        }).catch(error => {
+            console.log('error='+error);
+        }).finally(() => {
+            
+        }); 
+    }
+}	
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.js-meta.xml b/force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.js-meta.xml
new file mode 100644
index 0000000..c629aee
--- /dev/null
+++ b/force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexcopyQIS">
+   <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__RecordPage</target>
+        <target>lightning__AppPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.css b/force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.css
new file mode 100644
index 0000000..ebb43d9
--- /dev/null
+++ b/force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.css
@@ -0,0 +1,10 @@
+.exampleHolder{
+    position: relative;
+    display: inline-block;
+    width: 80px;
+    height: 80px;
+    text-align: center;
+}
+.container .uiContainerManager{
+	display: none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.html b/force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.html
new file mode 100644
index 0000000..3eff9e8
--- /dev/null
+++ b/force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.html
@@ -0,0 +1,5 @@
+<template>
+    <div class="EquipmentRentalPDF" if:true={IsLoading}>
+        <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+    </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.js b/force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.js
new file mode 100644
index 0000000..12d6d76
--- /dev/null
+++ b/force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.js
@@ -0,0 +1,44 @@
+import { LightningElement, track, wire, api } from 'lwc';
+import {CurrentPageReference,NavigationMixin} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+
+import init from '@salesforce/apex/rentalApplyEquipmentRentalPDFController.initJumptoPDFButton';
+
+export default class rentalApplyEquipmentRentalPDF extends LightningElement {
+	@api recordId;
+	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.recordId' + this.recordId);
+		init({
+			recordId : this.recordId
+		}).then(result => {
+			if(result != null) {
+				this.IsLoading = false;
+				let num = result.pageLength;
+				console.log("======"+this.recordId + '   ' +num);
+				console.log("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/FixtureRentalPDF?raid=" + this.recordId + "&page=" + num)
+				window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/apex/FixtureRentalPDF?raid=" + this.recordId + "&page=" + num);
+			}
+		})
+		.catch( error =>{
+			console.log(error);
+		})
+	}
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.js-meta.xml b/force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.js-meta.xml
new file mode 100644
index 0000000..36ce96d
--- /dev/null
+++ b/force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>54.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+		<target>lightning__RecordPage</target>
+		<target>lightning__AppPage</target>
+		<target>lightning__HomePage</target>
+		<target>lightning__RecordAction</target>
+	</targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/rentalApplyLWT/rentalApplyLWT.css b/force-app/main/default/lwc/rentalApplyLWT/rentalApplyLWT.css
new file mode 100644
index 0000000..af18c76
--- /dev/null
+++ b/force-app/main/default/lwc/rentalApplyLWT/rentalApplyLWT.css
@@ -0,0 +1,11 @@
+.Holder{
+	position: relative;
+	display: inline-block;
+	width: 80px;
+	height: 80px;
+	text-align: center;
+}
+
+.container .uiContainerManager{
+	display : none !important;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/rentalApplyLWT/rentalApplyLWT.html b/force-app/main/default/lwc/rentalApplyLWT/rentalApplyLWT.html
new file mode 100644
index 0000000..960b41d
--- /dev/null
+++ b/force-app/main/default/lwc/rentalApplyLWT/rentalApplyLWT.html
@@ -0,0 +1,5 @@
+<template>
+      <div class="Holder" if:true={IsLoading}>
+              <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+      </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/rentalApplyLWT/rentalApplyLWT.js b/force-app/main/default/lwc/rentalApplyLWT/rentalApplyLWT.js
new file mode 100644
index 0000000..91a23a0
--- /dev/null
+++ b/force-app/main/default/lwc/rentalApplyLWT/rentalApplyLWT.js
@@ -0,0 +1,659 @@
+import { LightningElement,api, track, wire } from 'lwc';
+import getUserId from '@salesforce/apex/RentalApplyControllerLWT.getUserId';
+import getProfileId from '@salesforce/apex/RentalApplyControllerLWT.getProfileId';
+import init from '@salesforce/apex/RentalApplyControllerLWT.initFromCancelSubmitButton';
+import selectRentalApplyEquipmentSetDetailByRacId from '@salesforce/apex/RentalApplyControllerLWT.selectRentalApplyEquipmentSetDetailByRacId';
+import selectQISReportById from '@salesforce/apex/RentalApplyControllerLWT.selectQISReportById';
+import selectRepairById from '@salesforce/apex/RentalApplyControllerLWT.selectRepairById';
+import selectCampaignById from '@salesforce/apex/RentalApplyControllerLWT.selectCampaignById';
+import selectRentalApplyEquipmentSetByRacId from '@salesforce/apex/RentalApplyControllerLWT.selectRentalApplyEquipmentSetByRacId';
+import selectRentalApplyById from '@salesforce/apex/RentalApplyControllerLWT.selectRentalApplyById';
+import selectUserById from '@salesforce/apex/RentalApplyControllerLWT.selectUserById';
+import selectQISreportById2 from '@salesforce/apex/RentalApplyControllerLWT.selectQISreportById2';
+import setSObjectShare from '@salesforce/apex/RentalApplyControllerLWT.setSObjectShare';
+import updateRentalApplyC from '@salesforce/apex/RentalApplyControllerLWT.updateRentalApplyC';
+import {CurrentPageReference} from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import STATUS_PROCESS_STATE from '@salesforce/label/c.StatusProcessState';
+export default class rentalApplyLWT extends LightningElement {
+
+    contactFirstName = 'Yan';
+    contactLastName = 'Khang';
+    opportunityName = 'Possible deal';
+    clickedButtonLabel;
+
+    @api recordId;
+    @track StatusProcessState=STATUS_PROCESS_STATE;
+    Rental_Apply__c;
+    Status__c;
+    Id;
+    Yi_loaner_arranged__c;
+    RA_Status__c;
+    IsLoading=true;
+    demo_purpose2__c;
+    Follow_UP_Opp__c;
+    Statu_Achievements__c;
+    Statu_Achievements_ID__c;
+    Request_shipping_day__c;
+    Demo_purpose1__c;
+    Repair__c;
+    RecordTypeId;
+    SupplementCreated__c;
+    OPDPlan__c;
+    Campaign__c;
+    QIS_number__c;
+	RepairId__c;
+    @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;
+			}
+		}
+	}
+
+
+	async connectedCallback(){
+		console.log(this.recordId);
+		await init({recordId:this.recordId}).then(result=>{
+			console.log(result);
+			if(result!=null){
+				this.Rental_Apply__c=result;
+				this.Status__c=result.Status__c;
+				this.Yi_loaner_arranged__c=result.Yi_loaner_arranged__c;
+				this.Id=result.Id;
+				this.RA_Status__c=result.RA_Status__c;
+			    // this.Rental_Apply__c.demo_purpose2__c=result.DemoPurpose2C;
+			    // this..Follow_UP_Opp__c=result.FollowUPOppC;
+			    // this.Rental_Apply__c.Statu_Achievements__c=result.StatuAchievementsC;
+			    // this.Rental_Apply__c.Statu_Achievements_ID__c=result.StatuAchievementsIDC;
+			    // this.Rental_Apply__c.Request_shipping_day__c=result.RequestShippingDayC;
+			    // this.Rental_Apply__c.Demo_purpose1__c=result.DemoPurpose1C;
+			    // this.Rental_Apply__c.Repair__c=result.RepairC;
+			    // this.Rental_Apply__c.RecordTypeId=result.RecordTypeId;
+			    // this.Rental_Apply__c.SupplementCreated__c=result.SupplementCreatedC;
+			    // this.Rental_Apply__c.OPDPlan__c=result.OPDPlanC;
+			    // this.Rental_Apply__c.Campaign__c=result.CampaignC;
+			    // this.Rental_Apply__c.QIS_number__c=result.QISNumberC;
+				
+				this.sumit().then(res=>{
+					console.log("鍏抽棴绐楀彛");
+					this.IsLoading=false;
+					this.dispatchEvent(new CloseActionScreenEvent());
+				}).catch(err=>{
+					console.log("error:");
+					console.log(err.message);
+					alert("鎿嶄綔澶辫触,閿欒淇℃伅:"+err.message);
+				});
+				console.log("end");
+			}
+		}).catch(err=>{
+			console.log("error:");
+			console.log(err.message);
+			console.log("鎶ラ敊缁撴潫");
+		}).finally(()=>{
+			console.log("finally");
+			
+		});
+		
+	}
+
+
+    handleClick(event) {
+        this.clickedButtonLabel = event.target.label;
+    }
+    handleContactFirstNameInputChange(event) {
+        this.contactFirstName = event.target.value;
+    }
+    cancelSubmit(){
+    	console.log('djwaijd');
+    	if (this.Rental_Apply__c.Status__c == "鍙栨秷") {
+			alert("宸茬粡鍙栨秷锛�");
+			console.log('1');
+			return;
+		}
+		if (this.Rental_Apply__c.Status__c == "鍒犻櫎") {
+			alert("宸茬粡鍒犻櫎锛�");
+			console.log('2');
+			return;
+		}
+		if(this.RA_Status__c == "宸插嚭搴�" || this.Yi_loaner_arranged__c > 0) {
+			alert("澶囧搧宸茬粡鍑哄簱锛屼笉鑳藉彇娑堬紒");
+			console.log('2');
+			return;
+		}
+		let raid = this.Id;
+		window.open("/apex/RentalApplyCancel?objId="+raid, 'RentalApplyCancel', 'width=500,height=250');
+	}
+
+	
+
+	async sumit(){
+		let buttons = document.getElementsByName('submit_approval_process'.toLowerCase());
+		for (let i=0; i<buttons.length; i++) {
+			buttons[i].className = "btnDisabled";
+			buttons[i].disabled = true;
+		}
+		//kk
+		if (!confirm("涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵")) {
+			return;
+		}
+		//1540 you 璇曠敤锛堟棤璇环锛夌洰鐨勭殑澶囧搧鐢宠鍗曪紝涓嶈兘鍏宠仈璇环淇℃伅锛�
+		if(this.Rental_Apply__c.demo_purpose2__c == '璇曠敤锛堟棤璇环锛�' && this.Rental_Apply__c.Follow_UP_Opp__c !=null && this.Rental_Apply__c.Follow_UP_Opp__c != ''){
+			alert('璇曠敤锛堟棤璇环锛夌洰鐨勭殑澶囧搧鐢宠鍗曪紝涓嶈兘鍏宠仈璇环淇℃伅锛�');
+			return;
+		}
+		// 宸茶喘寰呰揣鐨勭敵璇峰崟瀹℃壒鏃讹紝闇�瑕乧heck娉ㄦ畫鐨勭姸鎬�
+		if (this.Rental_Apply__c.Statu_Achievements__c!=null&&this.Rental_Apply__c.Statu_Achievements__c!='') {
+
+			let SaID=this.Rental_Apply__c.Statu_Achievements_ID__c;
+			let rtn = sforce.apex.execute("RentalApplyWebService","RentalApplyCheckForSAoneEle",{SaID:SaID});
+			if(rtn!='Fin'){
+				alert(rtn);
+				return;
+			}
+		}
+		// 甯屾湜鍒拌揣鏃ヤ笉鑳芥棭浜庣敵璇锋彁浜ゆ棩-0418杩藉姞
+		let d=new Date();
+		if (this.Rental_Apply__c.Request_shipping_day__c < d ) {
+			alert('甯屾湜鍒拌揣鏃ヤ笉鑳芥棭浜庣敵璇锋彁浜ゆ棩');
+			return;
+		}
+		let raesdList = new Array();
+		await selectRentalApplyEquipmentSetDetailByRacId({recordId:this.recordId}).then(result=>{
+			console.log(result);
+			if(result!=null){
+				raesdList=result;
+				let modelSet = new Set();
+				let stoppedSet = new Set();
+				for(let i=0;i<raesdList.length;i++){
+					modelSet.add(raesdList[i].Fixture_Model_No_F__c);
+					if('false' == raesdList[i].Product_Status_Flag_F__c
+					&& (this.Rental_Apply__c.demo_purpose2__c == '璇曠敤锛堟湁璇环锛�' || this.Rental_Apply__c.demo_purpose2__c == '璇曠敤锛堟棤璇环锛�')){
+						stoppedSet.add(raesdList[i].Fixture_Model_No_F__c);
+					}
+				}
+				if(stoppedSet.size> 0) {
+					alert( Array.from(stoppedSet).join('锛�') + ' 浜у搧娉ㄥ唽璇佺姸鎬佷负鍋滄锛屼笉鍙敵璇�');
+					return;
+				}
+			}
+		}).catch(err=>{
+			console.log("selectRentalApplyEquipmentSetDetailByRacId error:");
+			console.log(err.message);
+			console.log("鎶ラ敊缁撴潫");
+		}).finally(()=>{
+		});
+
+
+
+		if(this.Rental_Apply__c.demo_purpose2__c == '绱㈣禂QIS'){
+			let DeliveryGood = new Array();
+			await selectQISReportById({recordId:this.Rental_Apply__c.QIS_number__c}).then(result=>{
+				console.log(result);
+				DeliveryGood=result;	
+			}).catch(err=>{
+				console.log("selectQISReportById error:");
+				console.log(err.message);
+			}).finally(()=>{
+			});
+			console.log(DeliveryGood);	
+			let records= DeliveryGood;
+			if(records.length == 0 || !modelSet.has(records[0].nonyushohin__r.Product2.Fixture_Model_No_T__c)){
+				alert('鐢宠鐨勫瀷鍙峰繀椤讳笌QIS鐢宠鍨嬪彿涓�鑷�');
+				return;
+			}
+		}
+		if(this.Rental_Apply__c.Repair__c==null){
+			console.log("Repair__c涓虹┖")
+		}else{
+			if( this.Rental_Apply__c.Repair__c != ''){
+				console.log("hhh7.1.1");
+				let DeliveryGood ;
+				let records;
+				await selectRepairById({recordId:this.Rental_Apply__c.Repair__c}).then(result=>{
+					console.log(result);
+					DeliveryGood=result;	
+					records=result;
+				}).catch(err=>{
+					console.log("selectRepairById error:");
+					console.log(err.message);
+				}).finally(()=>{
+				});
+				if(records==null||records.length==0){
+					console.log("records涓虹┖");
+				}else{
+					if(this.Rental_Apply__c.Demo_purpose1__c == '缁翠慨浠g敤' && this.Rental_Apply__c.demo_purpose2__c != '绱㈣禂QIS') {
+						if(!modelSet.has(records[0].Delivered_Product__r.Product2.Fixture_Model_No_T__c)){
+							alert('鐢宠鐨勫瀷鍙峰繀椤讳笌閫佷慨鐨勫瀷鍙蜂竴鑷�');
+							return;
+						}
+					}
+					if(this.Rental_Apply__c.Demo_purpose1__c==null){
+						console.log("Demo_purpose1__c涓虹┖");
+					}else if(this.Rental_Apply__c.Demo_purpose1__c == '缁翠慨浠g敤' && this.Rental_Apply__c.demo_purpose2__c == '涓�鑸敤鎴�' ){
+						if (records[0].Repair_Estimated_date_formula__c == null) {
+							alert('涓�鑸淮淇棤鎶ヤ环鏃ワ紝涓嶅彲鍊熺敤澶囧搧');
+							return;
+						}
+
+						else if (records[0].Repair_Estimated_date_formula__c < '2019-07-01' && records[0].Agreed_Date__c == null) {
+							alert('鎶ヤ环鏃ュ湪2019/7/1涔嬪墠涓旀埛鍚屾剰鏃ヤ负绌猴紝涓嶅彲鍊熺敤澶囧搧');
+							return;
+						}
+						//20210608 ljh SFDC-C3CCN4 start
+						if(records[0].Repair_Rank__c == '' || records[0].Repair_Rank__c == null){
+							alert('鎶ヤ环绛夌骇涓虹┖涓嶈兘鐢宠澶囧搧');
+							return;
+						}else{
+							if(records[0].DW_Sign_Txt__c == 'false' && records[0].Repair_Rank__c == 'DW'){
+								alert('DW鎶ヤ环绛夌骇涓嬫鍨嬪彿涓嶇鍚堝鍝佺敵璇峰�熺敤鏉′欢');
+								return;
+							}
+							if(records[0].Repair_Rank__c == 'D1'
+								||records[0].Repair_Rank__c == 'D2'
+								||records[0].Repair_Rank__c == 'D3'
+								||records[0].Repair_Rank__c == 'E2'){
+								alert('鎶ヤ环绛夌骇涓嶇鍚堝鍝佺敵璇峰�熺敤鏉′欢');
+								return;
+							}
+						}
+					//20210608 ljh SFDC-C3CCN4 end
+					}
+					if(this.Rental_Apply__c.Demo_purpose1__c ==null){
+						console.log("Demo_purpose1__c涓虹┖");
+					}else if(this.Rental_Apply__c.Demo_purpose1__c == '缁翠慨浠g敤' && this.Rental_Apply__c.demo_purpose2__c == '甯傚満澶氬勾淇濅慨' ){
+						if (records[0].FSE_ApplyForRepair_Day__c == null) {
+							alert('甯傚満澶氬勾淇濅慨锛屾病鏈塠FSE淇悊鐢宠鏃锛屼笉鍙�熺敤澶囧搧');
+							return;
+						}
+					}
+					if(this.Rental_Apply__c.Demo_purpose1__c == '缁翠慨浠g敤' && this.Rental_Apply__c.demo_purpose2__c == '鏁呴殰鎺掓煡' ){
+						if (records[0].FSE_ApplyForRepair_Day__c == null) {
+							alert('鏁呴殰鎺掓煡锛屾病鏈塠FSE淇悊鐢宠鏃锛屼笉鍙�熺敤澶囧搧');
+							return;
+						}
+						if(records[0].Repair_Ordered_Date__c != null) {
+							alert('鏁呴殰鎺掓煡锛孾4.淇悊鍝丷C鍙楃悊鏃蹇呴』涓虹┖');
+							return;
+						}
+						if(records[0].IfCheckFixture__c == 'false'){
+							alert('涓嶆弧瓒虫晠闅滄帓鏌ョ洰鐨�');
+							return;
+						}
+					}
+					let profileId="";
+					await getProfileId().then(result=>{
+						console.log(result);
+						profileId=result;	
+					}).catch(err=>{
+						console.log("getProfileId error:");
+						console.log(err.message);
+					}).finally(()=>{
+					});
+					if(this.Rental_Apply__c.RecordTypeId==null){
+						console.log("RecordTypeId涓虹┖");
+					}else if (this.Rental_Apply__c.RecordTypeId != "01210000000RHIn"
+						&& profileId != '00e10000000Y3o5'
+						&& records[0].NewProductGuaranteeObject__c == '8: 甯傚満澶氬勾淇濅慨'
+						&& this.Rental_Apply__c.demo_purpose2__c != '甯傚満澶氬勾淇濅慨') {
+						alert('鏃犲伩鍖哄埆鏍囧織涓�8: 甯傚満澶氬勾淇濅慨锛屽繀椤婚�夋嫨甯傚満澶氬勾淇濅慨銆�');
+					}
+					if(records[0].Repair_Final_Inspection_Date__c != null){
+						alert('瀛樺湪淇悊鏈�缁堟娴嬫棩锛屼笉鍙�熺敤澶囧搧');
+						return;
+					}
+					if(records[0].Repair_Shipped_Date__c != null){
+						alert('瀛樺湪RC淇悊杩旈�佹棩锛屼笉鍙�熺敤澶囧搧');
+						return;
+					}
+					if(records[0].Status1__c =='0.鍒犻櫎' ||records[0].Status1__c =='0.鍙栨秷' ||records[0].Status1__c =='5.瀹屾瘯' ){
+						alert('淇悊宸茬粡缁撴潫锛屼笉鑳界敵璇峰鍝�');
+						return;
+					}
+					if ( this.Rental_Apply__c.demo_purpose2__c == '鍐嶄慨鐞�' && records[0].ReRepairObject_F__c == 'false') {
+						alert('涓嶅睘浜庡啀鍙楃悊鍙傝�冨璞★紝涓嶅彲鍊熺敤澶囧搧');
+						return;
+					}
+					if (this.Rental_Apply__c.RecordTypeId != '01210000000RHIn'
+						&& this.Rental_Apply__c.demo_purpose2__c != '淇濅慨鐢ㄦ埛'
+						&& this.Rental_Apply__c.demo_purpose2__c != '甯傚満澶氬勾淇濅慨'
+						&& records[0].Number_of_EffectiveContract__c == '鏈�' ) {
+						alert('鏈夌淮淇悎鍚�,蹇呴』閫夋嫨淇濅慨鐢ㄦ埛.');
+						return;
+					}
+					let AssetModelNo = records[0].Delivered_Product__r.Product2.Asset_Model_No__c;
+					if (this.Rental_Apply__c.RecordTypeId != '01210000000RHIn' && records[0].Number_of_EffectiveContract__c == '鏃�'
+						&& (records[0].NewProductGuaranteeObject__c == '2: 鏈嶅姟澶氬勾淇濅慨'
+						&& (AssetModelNo == 'LTF-190-10-3D' || AssetModelNo == 'LTF-S190-5' || AssetModelNo == 'CYF-VHA' || AssetModelNo == 'CYF-VA2' || AssetModelNo == 'CYF-5A'|| AssetModelNo == 'LTF-S190-10'|| AssetModelNo == 'OER-AW'|| AssetModelNo == 'URF-V'|| AssetModelNo == 'URF-V2'|| AssetModelNo == 'URF-P6'))
+						&& this.Rental_Apply__c.demo_purpose2__c != '淇濅慨鐢ㄦ埛' ) {
+						alert('姝よ澶囧瀷鍙峰骞翠繚淇紝璇烽�夋嫨淇濅慨鐢ㄦ埛.');
+						return;
+					}
+
+					if (this.Rental_Apply__c.RecordTypeId != '01210000000RHIn'
+						&& records[0].NewProductGuaranteeObject__c == '2: 鏈嶅姟澶氬勾淇濅慨'
+						&& (AssetModelNo == 'CV-V1' || AssetModelNo == 'CV-V1(A)' || AssetModelNo == 'CV-V1(B)' || AssetModelNo == 'GIF-LV1' || AssetModelNo == 'CF-LV1L' || AssetModelNo == 'CF-LV1I' || AssetModelNo == 'MAJ-1910')
+						&& (this.Rental_Apply__c.demo_purpose2__c == '涓�鑸敤鎴�' || this.Rental_Apply__c.demo_purpose2__c == '鍐嶄慨鐞�')
+						) {
+							alert('濂ヨ緣璁惧锛屼繚淇湡鍐呬笉鎻愪緵澶囧搧.');
+							return;
+					}
+				}
+				
+			}
+		} 
+
+		if(this.Rental_Apply__c.SupplementCreated__c==null){
+			console.log("SupplementCreated__c涓虹┖");
+		}else if (this.Rental_Apply__c.SupplementCreated__c == '1' && this.Rental_Apply__c.OPDPlan__c != '') {
+			let raId = this.Id;
+			//kk
+			let raesCountCheck = sforce.apex.execute("OpdPlanWebService", "raesCountCheck", {rentalApplyId: raId});
+			if(raesCountCheck != 'OK'){
+				alert(raesCountCheck);
+				return;
+			}
+		}
+		console.log("hhh10");
+		if(this.Rental_Apply__c.Campaign__c==null){
+			console.log("Campaign__c涓虹┖");
+		}else if( this.Rental_Apply__c.Campaign__c != ''){
+			let DeliveryGood = new Array();
+			// 20220324 ljh obpm update start
+			//kk1
+			let statusSting = this.StatusProcessState;
+			let statusList = statusSting.split(',');
+			// DeliveryGood = sforce.connection.query("select Status, Rental_Apply_Flag__c from Campaign where id ='{!Rental_Apply__c.Campaign__c}'");
+			// DeliveryGood = await selectCampaignById(this.Rental_Apply__c.Campaign__c);
+			await selectCampaignById({recordId:this.Rental_Apply__c.Campaign__c}).then(result=>{
+				console.log(result);
+				DeliveryGood=result;	
+			}).catch(err=>{
+				console.log("selectCampaignById error:");
+				console.log(err.message);
+			}).finally(()=>{
+			});
+			// 20220324 ljh obpm update start
+			//kk
+			let records= DeliveryGood;
+
+			let interval = records[0].Status;
+			let records_Date = records[0].Rental_Apply_Flag__c;
+			if (interval==null ) {
+				alert("璇风‘璁ゅ浼氱姸鎬�");
+				return;
+			}
+			else if (interval == '鑽夋涓�') {
+				alert('瀛︿細鐘舵�佷负鑽夋涓紝涓嶈兘鎻愪氦');
+				return;
+			}
+			else if (interval == '鐢宠涓�') {
+				alert('瀛︿細鐘舵�佷负鐢宠涓紝涓嶈兘鎻愪氦');
+				return;
+			}
+			else if (interval == '宸茬粨鏉�') {
+				alert('瀛︿細鐘舵�佷负宸茬粨鏉燂紝涓嶈兘鎻愪氦');
+				return;
+			}
+			else if (interval == '宸叉彁浜ゆ姤鍛�') {
+				alert('瀛︿細鐘舵�佷负宸叉彁浜ゆ姤鍛婏紝涓嶈兘鎻愪氦');
+				return;
+			}
+			else if (interval == '鍙栨秷鐢宠涓�') {
+				alert('瀛︿細鐘舵�佷负鍙栨秷鐢宠涓紝涓嶈兘鎻愪氦');
+				return;
+			}
+			else if (interval == '鍙栨秷') {
+				alert('瀛︿細鐘舵�佷负鍙栨秷锛屼笉鑳芥彁浜�');
+				return;
+			}
+			//kk
+			if(this.Rental_Apply__c.Request_shipping_day__c==null){
+				alert("璇风‘璁ゅ笇鏈涘埌璐ф棩鏈�");
+				return;
+			}else{
+				if (d >= this.Rental_Apply__c.Request_shipping_day__c -7) {
+					alert("蹇呴』鎻愬墠浜庡笇鏈涘埌璐ф棩7澶╀互涓婃彁浜ょ敵璇�");
+					return;
+				}
+				// 20220324 ljh obpm add start
+				if (records != null && records[0].IF_Approved__c == "true" && (records[0].Meeting_Approved_No__c == null || records[0].Meeting_Approved_No__c == "") ) {
+					alert("娌℃湁鍐宠鍙风殑锛屾殏涓嶈兘鍑哄��,璇锋洿鏂拌鍐充俊鎭��");
+					return;
+				}
+				if (records != null && records[0].IF_Approved__c == "true" && records[0].Meeting_Approved_No__c != "" && statusList.indexOf(records[0].Approved_Status__c) != -1 && records[0].Approved_Status__c != '鑽夌' ) {
+					alert("宸茬敵璇峰喅瑁佷絾鍐宠鐘舵�佷笉绗﹀悎鏉′欢銆�");
+					return;
+				}
+			}
+			
+			// 20220324 ljh obpm add end
+		}
+
+		if (this.Rental_Apply__c.QIS_number__c == null) {
+			console.log("QIS_number__c 鏄┖鐨�");
+		}else{
+			if( this.Rental_Apply__c.QIS_number__c != ''){
+				let DeliveryGood = new Array();
+				// DeliveryGood =await selectQISreportById2(this.Rental_Apply__c.QIS_ID_Line__c);
+				await selectQISreportById2({recordId:this.Rental_Apply__c.QIS_ID_Line__c}).then(result=>{
+					console.log(result);
+					DeliveryGood=result;	
+				}).catch(err=>{
+					console.log("selectQISreportById2 error:");
+					console.log(err.message);
+				}).finally(()=>{
+				});
+				let records= DeliveryGood;
+				let interval = records[0].next_action__c;
+				if (interval == '閫佸洖') {
+					alert("QIS 宸查�佸洖锛屼笉鑳藉啀鐢宠澶囧搧浜�");
+					return;
+				}
+			}
+		}
+		// share
+		let userAccess = new Array();
+		//kk
+		let t=this.Rental_Apply__c.applyUser__c+'_Edit';
+		userAccess.push(t);
+		let rtn ;
+		await setSObjectShare({sobjectName:'Rental_Apply__Share',rowCause:'ApplyUserShare__c',parentId:this.Rental_Apply__c.Id,userAccess:userAccess,ownerId:this.Rental_Apply__c.OwnerId}).then(result=>{
+			console.log(result);
+			rtn=result;	
+		}).catch(err=>{
+			console.log("setSObjectShare error:");
+			console.log(err.message);
+		}).finally(()=>{
+		});
+
+		if(rtn==null){
+			alert("rtn涓虹┖");
+			return;
+		}else{
+			if (rtn != 'OK') {
+				alert(rtn);
+				return;
+			}	
+		}
+		if(this.Rental_Apply__c.Status__c == null){
+			alert('璇峰鍝佺敵璇风姸鎬佺‘璁わ紝涓嶈兘涓虹┖');
+			return;
+		}else{
+			if (this.Rental_Apply__c.Status__c == '濉啓瀹屾瘯' ||
+				this.Rental_Apply__c.Status__c == '鐢宠涓�' ||
+				this.Rental_Apply__c.Status__c == '宸叉壒鍑�' ||
+				//鐜板湪鐢宠涔︾殑Status__c宸茬粡娌℃湁寮曞綋瀹屼簡鐘舵�併�傛墍浠ヨ繖閲屼笉闇�瑕佸垽鏂�
+				//'{!Rental_Apply__c.Status__c}' == '寮曞綋瀹屼簡' ||
+				this.Rental_Apply__c.Status__c == '宸插嚭搴撴寚绀�' ||
+				this.Rental_Apply__c.Status__c == '鍒犻櫎' ||
+				this.Rental_Apply__c.Status__c == '鍙栨秷' ) {
+					alert('璇峰鍝佺敵璇风姸鎬佺‘璁わ紝宸茬粡鎻愪氦杩囩殑鐢宠锛屼笉鑳介噸澶嶆彁浜�');
+					return;
+			}
+		}
+			// 娌℃湁鏄庣粏鐨勪竴瑙坈heck
+		let raesList = new Array();
+		// raesList = selectRentalApplyEquipmentSetByRacId(this.recordId);
+		await selectRentalApplyEquipmentSetByRacId({recordId:this.recordId}).then(result=>{
+			console.log(result);
+			raesList=result;	
+		}).catch(err=>{
+			console.log("selectRentalApplyEquipmentSetByRacId error:");
+			console.log(err.message);
+		}).finally(()=>{
+		});
+		let records= raesList;
+
+		if(records.length > 0){
+			alert('鏈夋病鏈夋槑缁嗙殑鍊熷嚭澶囧搧閰嶅涓�瑙堬紝涓嶈兘鎻愪氦');
+			return;
+		}
+		
+		let racs ;
+		await selectRentalApplyById({recordId:this.recordId}).then(result=>{
+			console.log(result);
+			racs=result;	
+		}).catch(err=>{
+			console.log("selectRentalApplyById error:");
+			console.log(err.message);
+		}).finally(()=>{
+		});
+		let racNew = racs[0];
+		let id=this.Rental_Apply__c.Id;
+		let Status__c="濉啓瀹屾瘯";
+		let userId;
+		await getUserId().then(result=>{
+			console.log(result);
+			userId=result;	
+		}).catch(err=>{
+			console.log("getUserId error:");
+			console.log(err.message);
+		}).finally(()=>{
+		});
+		let manageUsers;
+		await selectUserById({recordId:userId}).then(result=>{
+			console.log(result);
+			manageUsers=result;	
+		}).catch(err=>{
+			console.log("selectUserById error:");
+			console.log(err.message);
+		}).finally(()=>{
+		});
+		let SalesManagerSubmit__c;
+		let OPDManagerApprover__c;
+		let BuchangApprovalManagerSalesSubmit__c;
+		let OPDBuchangApprover__c;
+		if(manageUsers[0].JingliEquipmentManager__c != null){
+			SalesManagerSubmit__c = manageUsers[0].JingliEquipmentManager__r.Name;
+		// 20220930 ljh SWAG-CJR8S7 start
+			if(racNew.OPDPlan__c != null){
+				OPDManagerApprover__c = SalesManagerSubmit__c == racNew.OPDPlan__r.SalesManager_Txt__c?SalesManagerSubmit__c:' ';
+			}
+		// 20220930 ljh SWAG-CJR8S7 end
+		}
+		if(manageUsers[0].Buzhang_Equipment_Manager__c != null){
+			BuchangApprovalManagerSalesSubmit__c = manageUsers[0].Buzhang_Equipment_Manager__r.Name; //2022-07-22 zyh
+		// 20220930 ljh SWAG-CJR8S7 start
+			if(racNew.OPDPlan__c != null){
+				OPDBuchangApprover__c = BuchangApprovalManagerSalesSubmit__c == racNew.OPDPlan__r.BuchangApprovalManagerSales_Txt__c?BuchangApprovalManagerSalesSubmit__c:' ';
+			}
+		// 20220930 ljh SWAG-CJR8S7 end
+		}
+		let resultt;
+		await updateRentalApplyC({
+			recordId:id,
+			SalesManagerSubmitC:SalesManagerSubmit__c,
+			StatusC:Status__c,
+			OPDManagerApproverC:OPDManagerApprover__c,
+			BuchangApprovalManagerSalesSubmitC:BuchangApprovalManagerSalesSubmit__c,
+			OPDBuchangApproverC:OPDBuchangApprover__c
+		}).then(res=>{
+			console.log(res);
+			if(res!=null&&res.success==false){
+				resultt=res;
+				let messages ="";
+				messages=resultt.errors[0].split(',')[1];
+				if (messages!=null&&messages!="") {
+					console.log("hhh26");
+					alert("鎿嶄綔澶辫触,閿欒淇℃伅:"+messages);
+					return;
+				}
+			}
+		}).catch(err=>{
+			console.log("updateRentalApplyC error:");
+			console.log(err.message);
+		}).finally(()=>{
+			console.log("finally");
+			console.log(resultt);
+		});
+
+		this.dispatchEvent(new CloseActionScreenEvent());
+	};
+
+	getConnectDMLErrorMessages (results) {
+		console.log("in 1");
+		console.log(results);
+		let messages = [];
+		let	i = 0;
+		let	len = results.length;
+		let	r;
+		console.log("in 1.1");
+		for (; i < len; i++) {
+			console.log("in 1.2");
+			r = results[i];
+			console.log("in 1.3");
+			if (r.success==false) {
+				console.log("in 1.4");
+				messages = messages.concat(this.getConnectDMLMessagesOfAResult(r));
+			}
+		}
+		console.log("in 1");
+		console.log("1缁撴灉");
+		console.log(messages);
+		return messages;
+	};
+	getConnectDMLMessagesOfAResult(res) {
+		console.log("in 2");
+		console.log(res);
+		let messages = [];
+		let	errors = res.errors;
+		let	i = 0;
+		let	len = errors.length;
+		let	e;
+		for (; i < len; i++) {
+			e = errors[i];
+			console.log("in 2.1");
+			messages.push(e + " " + this.getConnectDMLErrorFields(errors));
+			console.log("3缁撴灉");
+			console.log(this.getConnectDMLErrorFields(errors));
+			console.log("in 2.2");
+		}
+		console.log("in 2");
+		console.log("2缁撴灉");
+		console.log(messages);
+		return messages;
+	};
+	
+	getConnectDMLErrorFields (error) {
+		console.log("in 3");
+		console.log(error);
+		let fields = error;
+		if (fields.length > 0) {
+			console.log("in 3");
+			return "[" + fields + ",]"
+		} 
+		else {
+			console.log("in 3");
+			return "";
+		}
+
+	};
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/rentalApplyLWT/rentalApplyLWT.js-meta.xml b/force-app/main/default/lwc/rentalApplyLWT/rentalApplyLWT.js-meta.xml
new file mode 100644
index 0000000..9ac5a4a
--- /dev/null
+++ b/force-app/main/default/lwc/rentalApplyLWT/rentalApplyLWT.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="rentalApplyLWT">
+    <apiVersion>51.0</apiVersion>
+    <isExposed>true</isExposed>
+    <targets>
+        <target>lightning__AppPage</target>
+        <target>lightning__RecordPage</target>
+        <target>lightning__HomePage</target>
+        <target>lightning__RecordAction</target>
+    </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/staticresources/connection20.js b/force-app/main/default/staticresources/connection20.js
new file mode 100644
index 0000000..c0616f1
--- /dev/null
+++ b/force-app/main/default/staticresources/connection20.js
@@ -0,0 +1,1935 @@
+锘�/*
+Salesforce.com AJAX Connector 51.0
+Copyright, 1999, salesforce.com, inc.
+All Rights Reserved
+*/
+/** check if sforce is already created by some other lib*/
+window.sforce = window.sforce || {};
+
+sforce.internal = {};
+/** StringBuffer */
+
+sforce.StringBuffer = function() {
+    this.buffer = [];
+
+    this.append = function (s) {
+        this.buffer.push(s);
+        return this;
+    };
+
+    this.toString = function() {
+        return this.buffer.join("");
+    };
+};
+
+/** Base64Binary */
+sforce.Base64Binary = function(text) {
+    this.input = text;
+};
+
+sforce.Base64Binary.prototype.keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
+
+sforce.Base64Binary.prototype.toString = function() {
+    var output = [];
+    var chr1, chr2, chr3 = "";
+    var enc1, enc2, enc3, enc4 = "";
+    var i = 0;
+    do {
+        chr1 = this.input.charCodeAt(i++);
+        chr2 = this.input.charCodeAt(i++);
+        chr3 = this.input.charCodeAt(i++);
+        enc1 = chr1 >> 2;
+        enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
+        enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
+        enc4 = chr3 & 63;
+        if (isNaN(chr2)) {
+            enc3 = enc4 = 64;
+        } else if (isNaN(chr3)) {
+            enc4 = 64;
+        }
+        output.push(this.keyStr.charAt(enc1) + this.keyStr.charAt(enc2) + this.keyStr.charAt(enc3) + this.keyStr.charAt(enc4));
+        chr1 = chr2 = chr3 = "";
+        enc1 = enc2 = enc3 = enc4 = "";
+    } while (i < this.input.length);
+    return output.join("");
+};
+
+sforce.Base64Binary.prototype.decode = function(input) {
+    var output = [];
+    var chr1, chr2, chr3 = "";
+    var enc1, enc2, enc3, enc4 = "";
+    var i = 0;
+    var base64test = /[^A-Za-z0-9\+\/\=]/g;
+    if (base64test.exec(input)) {
+        alert("There were invalid base64 characters in the input text.\n" +
+              "Valid base64 characters are A-Z, a-z, 0-9, '+', '/', and '='\n" + "Expect errors in decoding.");
+    }
+    input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
+    do {
+        enc1 = this.keyStr.indexOf(input.charAt(i++));
+        enc2 = this.keyStr.indexOf(input.charAt(i++));
+        enc3 = this.keyStr.indexOf(input.charAt(i++));
+        enc4 = this.keyStr.indexOf(input.charAt(i++));
+        chr1 = (enc1 << 2) | (enc2 >> 4);
+        chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
+        chr3 = ((enc3 & 3) << 6) | enc4;
+        output.push(String.fromCharCode(chr1));
+        if (enc3 != 64) {
+            output.push(String.fromCharCode(chr2));
+        }
+        if (enc4 != 64) {
+            output.push(String.fromCharCode(chr3));
+        }
+        chr1 = chr2 = chr3 = "";
+        enc1 = enc2 = enc3 = enc4 = "";
+    } while (i < input.length);
+    return output.join("");
+};
+
+/**DateCodec.js*/
+
+sforce.internal.dateToString = function(theDate) {
+    var today = theDate;
+    var year = today.getFullYear();
+    var month = today.getMonth() + 1;
+    var day = today.getDate();
+    return  year + "-" + month + "-" + day;
+};
+
+sforce.internal.dateTimeToString = function(theDate) {
+    var today = theDate;
+    var year = today.getFullYear();
+    var month = today.getMonth() + 1;
+    var day = today.getDate();
+    var hour = today.getHours();
+    var minute = today.getMinutes();
+    var second = today.getSeconds();
+
+    var offset = today.getTimezoneOffset();
+    var pm = (offset < 0) ? "+" : "-";
+    offset = Math.abs(offset);
+    var hourdifference = offset / 60;
+    var minutedifference = offset % 60;
+
+    if (second <= 9) {
+        second = "0" + second;
+    }
+
+    var milli = today.getMilliseconds();
+    if (milli !== 0) {
+        milli = "." + milli;
+        if (milli.length > 4) {
+            milli = milli.substring(0, 4);
+        }
+        second = second + milli;
+    }
+
+    var timezone;
+
+    if (offset === 0) {
+        timezone = "Z";
+    } else {
+        if (minutedifference < 10) {
+            minutedifference = "0" + minutedifference;
+        }
+        if (hourdifference < 10) {
+            hourdifference = "0" + hourdifference;
+        }
+        timezone = pm + hourdifference + ":" + minutedifference;
+    }
+
+    if (month <= 9) {
+        month = "0" + month;
+    }
+    if (day <= 9) {
+        day = "0" + day;
+    }
+    if (hour <= 9) {
+        hour = "0" + hour;
+    }
+    if (minute <= 9) {
+        minute = "0" + minute;
+    }
+
+    return  year + "-" + month + "-" + day + "T" + hour + ":" + minute + ":" + second + timezone;
+};
+
+
+sforce.internal.stringToDate = function(source) {
+    var bc = false;
+    if (source === null || source.length === 0) {
+        throw "Unable to parse dateTime";
+    }
+
+    if (source.charAt(0) == '+') {
+        source = source.substring(1);
+    }
+
+    if (source.charAt(0) == '-') {
+        source = source.substring(1);
+        bc = true;
+    }
+
+    if (source.length != 10) {
+        throw ("Unable to parse date, " + source + " length != 10");
+    }
+
+    if (source.charAt(4) != '-' || source.charAt(7) != '-') {
+        throw ("Unable to parse date");
+    }
+
+    var year = source.substring(0, 4);
+    var month = source.substring(5, 7);
+    var day = source.substring(8, 10);
+
+    var date = new Date(year, month-1, day, 0, 0, 0);
+    date.setMilliseconds(0);
+    return date;
+};
+
+
+sforce.internal.stringToDateTime = function(source) {
+    var bc = false;
+    if (source === null || source.length === 0) {
+        throw "Unable to parse dateTime";
+    }
+
+    if (source.charAt(0) == '+') {
+        source = source.substring(1);
+    }
+    if (source.charAt(0) == '-') {
+        source = source.substring(1);
+        bc = true;
+    }
+
+    if (source.length < 19) {
+        throw ("Unable to parse dateTime");
+    }
+
+    if (source.charAt(4) != '-' || source.charAt(7) != '-' ||
+        source.charAt(10) != 'T') {
+        throw ("Unable to parse dateTime");
+    }
+
+    if (source.charAt(13) != ':' || source.charAt(16) != ':') {
+        throw ("Unable to parse dateTime");
+    }
+
+    var year = source.substring(0, 4);
+    var month = source.substring(5, 7);
+    var day = source.substring(8, 10);
+    var hour = source.substring(11, 13);
+    var min = source.substring(14, 16);
+    var sec = source.substring(17, 19);
+
+    var date = new Date(year, month-1, day, hour, min, sec);
+
+    var pos = 19;
+
+    // parse optional milliseconds
+    if (pos < source.length && source.charAt(pos) == '.') {
+        var milliseconds = 0;
+        var start = ++pos;
+        while (pos < source.length && sforce.internal.isDigit(source.charAt(pos))) {
+            pos++;
+        }
+        var decimal = source.substring(start, pos);
+        if (decimal.length == 3) {
+            milliseconds = decimal;
+        } else if (decimal.length < 3) {
+            milliseconds = (decimal + "000").substring(0, 3);
+        } else {
+            milliseconds = decimal.substring(0, 3);
+            if (decimal.charAt(3) >= '5') {
+                ++milliseconds;
+            }
+        }
+
+        date.setMilliseconds(milliseconds);
+    }
+
+    var offset = date.getTimezoneOffset() * 60000;
+    //offset in milli;
+
+    // parse optional timezone
+    if (pos + 5 < source.length &&
+        (source.charAt(pos) == '+' || (source.charAt(pos) == '-'))) {
+        if (!sforce.internal.isDigit(source.charAt(pos + 1)) ||
+            !sforce.internal.isDigit(source.charAt(pos + 2)) ||
+            source.charAt(pos + 3) != ':' ||
+            !sforce.internal.isDigit(source.charAt(pos + 4)) ||
+            !sforce.internal.isDigit(source.charAt(pos + 5))) {
+            throw "Unable to parse dateTime";
+        }
+        var hours = (source.charAt(pos + 1) - '0') * 10 + source.charAt(pos + 2) - '0';
+        var mins = (source.charAt(pos + 4) - '0') * 10 + source.charAt(pos + 5) - '0';
+        var mseconds = (hours * 60 + mins) * 60 * 1000;
+
+        // subtract milliseconds from current date to obtain GMT
+        if (source.charAt(pos) == '+') {
+            mseconds = -mseconds;
+        }
+
+        date = new Date(date.getTime() - offset + mseconds);
+        pos += 6;
+    }
+
+    if (pos < source.length && source.charAt(pos) == 'Z') {
+        pos++;
+        date = new Date(date.getTime() - offset);
+    }
+
+    if (pos < source.length) {
+        throw ("Unable to parse dateTime");
+    }
+
+    return date;
+};
+
+
+sforce.internal.isDigit = function (ch) {
+    if (ch == '0' || ch == '1' || ch == '2' || ch == '3' || ch == '4' ||
+        ch == '5' || ch == '6' || ch == '7' || ch == '8' || ch == '9') {
+        return true;
+    } else {
+        return false;
+    }
+};
+/** Xml */
+
+sforce.Xml = function(name) {
+};
+
+sforce.Xml.prototype.toXml = function (sobjectNs, name, writer) {
+    writer.writeStartElement(name, sobjectNs);
+    if (this._xsiType) {
+        writer.writeXsiType(this._xsiType);
+    }
+    for (var f in this) {
+        if ("_name" == f || "_xsiType" == f) {
+            //skip
+        } else {
+            var val = this[f];
+            if (typeof val != "function") {
+                // if (typeof val == "array") {
+                if (Array.isArray(val)) {
+                    for (var i=0; i<val.length; i++) {
+                        this.writeValue(sobjectNs, writer, f, val[i]);
+                    }
+                } else {
+                    this.writeValue(sobjectNs, writer, f, val);
+                }
+            }
+        }
+    }
+    writer.writeEndElement(name, sobjectNs);
+};
+
+
+sforce.Xml.prototype.writeValue = function (sobjectNs, writer, name, val) {
+    if (val === null) {
+        writer.writeNameValueNode("fieldsToNull", name);
+        return;
+    }
+    if (typeof(val) === "undefined") {
+        //TODO:  throw "value for field " + name + " is undefined"; Bug: 100000000000Ufg
+        return; //skip for now
+    }
+    if (val.toXml) {
+        val.toXml(sobjectNs, name, writer);
+    } else {
+        writer.writeNameValueNode(name, val);
+    }
+};
+
+sforce.Xml.prototype.get = function(name) {
+    return this[name] ? this[name] : null;
+};
+
+sforce.Xml.prototype.set = function(name, value) {
+    this[name] = value;
+};
+
+sforce.Xml.prototype.getArray = function(name) {
+    var obj = this[name];
+    if (obj) {
+        if (obj.join) {
+            return obj;
+        } else {
+            return [obj];
+        }
+    } else {
+        return [];
+    }
+};
+
+sforce.Xml.prototype.getBoolean = function(name) {
+    return ("true" == this[name]) ? true : false;
+};
+
+sforce.Xml.prototype.getDate = function(name) {
+    if (this[name]) {
+        if (this[name].getFullYear) {
+            return this[name];
+        } else {
+            return sforce.internal.stringToDate(this[name]);
+        }
+    } else {
+        return null;
+    }
+};
+
+sforce.Xml.prototype.getDateTime = function(name) {
+    if (this[name]) {
+        if (this[name].getFullYear) {
+            return this[name];
+        } else {
+            return sforce.internal.stringToDateTime(this[name]);
+        }
+    } else {
+        return null;
+    }
+};
+
+sforce.Xml.prototype.getInt = function(name) {
+    if (this[name]) {
+        if (typeof this[name] === "number") {
+            return this[name];
+        } else {
+            return parseInt(this[name], 10);
+        }
+    } else {
+        throw "Unable to parse int field: " + name;
+    }
+};
+
+sforce.Xml.prototype.getFloat = function(name) {
+    if (this[name]) {
+        if (typeof this[name] === "number") {
+            return this[name];
+        } else {
+            return parseFloat(this[name]);
+        }
+    } else {
+        throw "Unable to parse float field: " + name;
+    }
+};
+
+sforce.Xml.prototype.getBase64Binary = function(name) {
+    if (this[name]) {
+        return sforce.Base64Binary.prototype.decode(this[name]);
+    } else {
+        throw "Unable to parse base64Binary field: " + name;
+    }
+};
+
+sforce.Xml.prototype.toString = function() {
+    var sb = new sforce.StringBuffer();
+    sb.append("{");
+
+    for (var f in this) {
+        var field = this[f];
+
+        if (!field) {
+            sb.append(f).append(":").append("" + field);
+        } else  if (typeof(field) == "object") {
+            sb.append(f).append(":").append(field.toString());
+        } else if (field.join) {
+            sb.append(f).append(":").append("[");
+            for (var i = 0; i < field.length; i++) {
+                sb.append(field[i]);
+                if (i < field.length - 1) {
+                    sb.append(", ");
+                }
+            }
+            sb.append("]");
+        } else if (typeof(field) == "function") {
+            continue;
+        } else {
+            sb.append(f).append(":").append("'" + field + "'");
+        }
+        sb.append(", ");
+    }
+
+    sb.append("}");
+    return sb.toString();
+};
+
+
+/** Debug */
+
+
+sforce.internal.Debug = function() {
+    this.output = null;
+    this.trace = false;
+    this.apexTrace = false;
+    this.win = null;
+    this.traceQueue = [];
+    this.quiet = false;
+
+    this.open = function() {
+        this.println("", "print");
+    };
+
+    this.println = function(s, type) {
+        if (this.quiet) {
+            return;
+        }
+
+        if (typeof(println) === "function") {
+            println(s, type);
+            return;
+        }
+
+        if (this.win === null || !this.win.document) {
+            this.output = null;
+            this.win = window.open((typeof window.UserContext != "undefined") ? UserContext.getUrl('/soap/ajax/51.0/debugshell.html') : '/soap/ajax/51.0/debugshell.html', '',
+                    'width=800,height=400,toolbar=no,location=no,directories=no,alwaysRaised=yes,' +
+                    'status=no,menubar=no,scrollbars=yes,copyhistory=yes,resizable=yes');
+        }
+
+        if (this.output === null) {
+            this.findOutput();
+        }
+
+        if (this.output !== null) {
+            if (sforce.debug.traceQueue.length > 0) {
+                this.traceCallback();
+            }
+            this.win.println(s, type);
+       } else {
+            sforce.debug.traceQueue.push({message: s, type: type});
+            setTimeout(sforce.debug.traceCallback, 1000);
+        }
+    };
+
+    this.traceCallback = function() {
+        sforce.debug.findOutput();
+
+        if (sforce.debug.output === null) {
+            setTimeout(sforce.debug.traceCallback, 1000);
+            return;
+        }
+
+        for (var i=0; i<sforce.debug.traceQueue.length; i++) {
+            var element = sforce.debug.traceQueue[i];
+            sforce.debug.win.println(element.message, element.type);
+        }
+        sforce.debug.traceQueue = [];
+    };
+
+    this.findOutput = function() {
+        if (this.output === null) {
+            this.output = this.win.document.getElementById("output");
+        }
+        return this.output;
+    };
+
+    this.logXml = function(str) {
+        str = str.replace(/</g, "&lt;");
+        str = str.replace(/>/g, "&gt;");
+        str = "<textarea cols=80 rows=5 wrap=hard>" + str + "</textarea>";
+        this.println(str, "printxml");
+    };
+
+    this.log = function(str) {
+        this.println(str, "print");
+    };
+
+    this.logApex = function(response) {
+        var start = response.indexOf("<debugLog>");
+        var end = response.indexOf("</debugLog>");
+        if (start === -1)
+            start = 0;
+        else
+            start = start + '<debugLog>'.length;
+        if (end === -1) end = response.length;
+        var msg = response.substring(start, end);
+
+        this.println(msg, "printxml");
+    };
+};
+
+sforce.debug = new sforce.internal.Debug();
+
+/** Transport */
+
+sforce.internal._connections = [];
+
+sforce.internal.ConnectionHolder = function(connection, callback) {
+    this.connection = connection;
+    this.callback = callback;
+    this.timedout = false;
+};
+
+sforce.Transport = function(url) {
+    this.url = url;
+    this.connection = null;
+
+    this.newConnection = function() {
+        try {
+            this.connection = new ActiveXObject('Msxml2.XMLHTTP');
+        } catch(e) {
+            try {
+                this.connection = new ActiveXObject('Microsoft.XMLHTTP');
+            } catch(e) {
+                this.connection = new XMLHttpRequest();
+            }
+        }
+
+        return this.connection;
+    };
+
+    this.send = function (envelope, callback, async, timeout) {
+        this.newConnection();
+        if (async) {
+            this.connection.onreadystatechange = this.httpConnectionCallback;
+        }
+        var holder = new sforce.internal.ConnectionHolder(this.connection, callback);
+        sforce.internal._connections.push(holder);
+        this.connection.open("POST", this.url, async);
+        this.connection.setRequestHeader("Content-Type", "text/xml; charset=UTF-8");
+        this.connection.setRequestHeader("SOAPAction", "\"\"");
+        this.connection.setRequestHeader("Accept", "text/xml");
+        this.connection.setRequestHeader("X-SFDC-User-Agent", "SFAJAX 1.0");
+        this.connection.send(envelope);
+        if (async && typeof(timeout) !== "undefined") {
+            this.setTimeoutOn(holder, timeout);
+        }
+        if (!async) {
+            this.httpConnectionCallback();
+        }
+    };
+
+    this.setTimeoutOn = function (holder, timeout) {
+        function abortConnection() {
+            if (holder.connection.readyState !== 4) {
+                holder.timedout = true;
+                holder.connection.abort();
+            }
+        }
+        setTimeout(abortConnection, timeout);
+    };
+
+    this.httpConnectionCallback = function () {
+
+        for (var i = 0; i < sforce.internal._connections.length; i++) {
+            var holder = sforce.internal._connections[i];
+            if (holder !== null) {
+                if (holder.timedout) {
+                    sforce.internal._connections[i] = null;
+                    sforce.internal._connections.slice(i,1);
+                    holder.callback.httpCallback("Remote invocation timed out", false);
+                } else  if (holder.connection.readyState == 4) {
+                    sforce.internal._connections[i] = null;
+                    sforce.internal._connections.slice(i,1);
+                    var success = holder.connection.status == 200;
+                    if (sforce.debug.trace) {
+                        sforce.debug.log("Response : status - " + holder.connection.status);
+                        sforce.debug.logXml(holder.connection.responseText);
+                    }
+                    if (sforce.debug.apexTrace) {
+                        sforce.debug.logApex(holder.connection.responseText);
+                    }
+                    if (holder.connection.responseXML && holder.connection.responseXML.documentElement) {
+                        holder.callback.httpCallback(holder.connection.responseXML.documentElement, success);
+                    } else {
+                        holder.callback.httpCallback("Remote invocation failed, due to: " + holder.connection.responseText +
+                                                     " status code: ", holder.connection.status);
+                    }
+                }
+            }
+        }
+    };
+};
+/** XmlWriter */
+
+
+sforce.XmlWriter = function() {
+    this.buffer = new sforce.StringBuffer();
+    this.namespaces = {};
+    this.prefixCount = 0;
+    this.writingStartElement = false;
+};
+
+sforce.XmlWriter.prototype.writeStartElement = function(name, namesp, prefix) {
+    if (this.writingStartElement) {
+        this.buffer.append(">");
+    }
+    this.buffer.append("<");
+    var newns = false;
+    if (namesp) {
+        if (!this.namespaces[namesp] && this.namespaces[namesp] !== "") {
+            newns = true;
+        }
+        if (!prefix) {
+            prefix = this.getPrefix(namesp);
+        }
+        if (prefix !== null && prefix !== "") {
+           this.buffer.append(prefix);
+           this.buffer.append(":");
+        }
+    }
+
+    this.buffer.append(name);
+    if (newns === true) {
+        this.writeNamespace(namesp, prefix);
+    }
+    this.writingStartElement = true;
+};
+
+sforce.XmlWriter.prototype.writeEndElement = function(name, namesp) {
+    if (this.writingStartElement) {
+        this.buffer.append("/>");
+    } else {
+        this.buffer.append("</");
+        if (namesp) {
+            var prefix = this.getPrefix(namesp);
+            if (prefix && prefix !== "") {
+              this.buffer.append(prefix);
+              this.buffer.append(":");
+            }
+        }
+        this.buffer.append(name);
+        this.buffer.append(">");
+    }
+    this.writingStartElement = false;
+};
+
+sforce.XmlWriter.prototype.writeNamespace = function(namesp, prefix) {
+    if (prefix && "" !== prefix) {
+        this.namespaces[namesp] = prefix;
+        this.buffer.append(" ");
+        this.buffer.append("xmlns:");
+        this.buffer.append(prefix);
+    } else {
+        this.namespaces[namesp] = "";
+        this.buffer.append(" ");
+        this.buffer.append("xmlns");
+    }
+    this.buffer.append("=\"");
+    this.buffer.append(namesp);
+    this.buffer.append("\"");
+};
+
+sforce.XmlWriter.prototype.writeText = function(text) {
+    if (this.writingStartElement) {
+        this.buffer.append(">");
+        this.writingStartElement = false;
+    } else {
+        throw "Can only write text after a start element";
+    }
+    if (typeof text == 'string') {
+        text = text.replace(/&/g, '\&amp;');
+        text = text.replace(/</g, '&lt;');
+        text = text.replace(/>/g, '&gt;');
+    }
+
+    this.buffer.append(text);
+};
+
+sforce.XmlWriter.prototype.writeXsiType = function(xsiType) {
+    this.writeNamespace("http://www.w3.org/2001/XMLSchema-instance", "xsi");
+    this.writeAttribute("xsi:type", xsiType);
+};
+
+sforce.XmlWriter.prototype.writeAttribute = function(name, value) {
+    this.buffer.append(" " + name + "=\"" + value + "\"");
+};
+
+sforce.XmlWriter.prototype.getPrefix = function(namesp) {
+    var prefix = this.namespaces[namesp];
+    //sforce.debug.log("--------");
+    //sforce.debug.log(namesp + ":" + (prefix === null ? "null":prefix) + ":");
+    if (!prefix && prefix !== "") {
+        prefix = "ns" + this.prefixCount;
+        this.prefixCount++;
+        this.namespaces[namesp] = prefix;
+        return prefix;
+    }
+    return prefix;
+};
+
+sforce.XmlWriter.prototype.toString = function() {
+    return this.buffer.toString();
+};
+
+/** soap writer*/
+sforce.XmlWriter.prototype.soapNS = "http://schemas.xmlsoap.org/soap/envelope/";
+
+sforce.XmlWriter.prototype.startEnvelope = function() {
+    this.writeStartElement("Envelope", this.soapNS, "se");
+};
+
+sforce.XmlWriter.prototype.endEnvelope = function() {
+    this.writeEndElement("Envelope", this.soapNS);
+};
+
+sforce.XmlWriter.prototype.startHeader = function() {
+    this.writeStartElement("Header", this.soapNS, "se");
+};
+
+sforce.XmlWriter.prototype.endHeader = function() {
+    this.writeEndElement("Header", this.soapNS);
+};
+
+sforce.XmlWriter.prototype.startBody = function() {
+    this.writeStartElement("Body", this.soapNS, "se");
+};
+
+sforce.XmlWriter.prototype.endBody = function() {
+    this.writeEndElement("Body", this.soapNS);
+};
+
+sforce.XmlWriter.prototype.writeNameValueNode = function(name, value) {
+    if (value === null) {
+        this.writeStartElement(name);
+        this.writeNamespace("http://www.w3.org/2001/XMLSchema-instance", "xsi");
+        this.writeAttribute("xsi:nill", "true");
+        this.writeEndElement(name);
+        return;
+    }
+
+    if (value.toUTCString) {
+        value = sforce.internal.dateTimeToString(value);
+    }
+    if (typeof value == "boolean") {
+        // boolean 'false' values get joined in string buffer,
+        // so convert to strings:
+        value = value ? "true" : "false";
+    }
+
+    if (value && value.join) {
+        for (var i=0; i<value.length; i++) {
+            this.writeStartElement(name);
+            this.writeText(value[i]);
+            this.writeEndElement(name);
+        }
+    } else {
+        this.writeStartElement(name);
+        this.writeText(value);
+        this.writeEndElement(name);
+    }
+};
+
+/** XmlReader */
+
+sforce.XmlReader = function(root) {
+    this.envelope = root;
+};
+
+sforce.XmlReader.prototype.getEnvelope = function() {
+    if (this.isTag("Envelope", this.envelope)) {
+        return this.envelope;
+    }
+    throw "Unable to find soap envelope, but found " + this.envelope.nodeName;
+};
+
+sforce.XmlReader.prototype.getBody = function() {
+    return this.getChild("Body", this.envelope);
+};
+
+sforce.XmlReader.prototype.getHeader = function() {
+    return this.getChild("Header", this.envelope);
+};
+
+sforce.XmlReader.prototype.getChild = function(name, node) {
+    var children = node.childNodes;
+    for (var i = 0; i < children.length; i++) {
+        if (children[i].nodeType == 1 && this.isTag(name, children[i])) {
+            return children[i];
+        }
+    }
+    return null;
+};
+
+sforce.XmlReader.prototype.getFirstElement = function(node) {
+    var children = node.childNodes;
+    for (var i = 0; i < children.length; i++) {
+        if (children[i].nodeType == 1) {
+            return children[i];
+        }
+    }
+    return null;
+};
+
+sforce.XmlReader.prototype.isTag = function(name, node) {
+    var ns = node.nodeName.split(":");
+    if (ns.length == 2 && ns[1] == name) {
+        return true;
+    }
+    if (ns.length == 1 && ns[0] == name) {
+        return true;
+    }
+    return false;
+};
+
+sforce.XmlReader.prototype.isNameValueNode = function(node) {
+    var children = node.childNodes;
+    for (var i = 0; i < children.length; i++) {
+        if (children[i].nodeType != 3) {
+            return false;
+        }
+    }
+
+    return true;
+};
+
+sforce.XmlReader.prototype.getTextValue = function(node) {
+    if (node.nodeType == 3) {
+        return node.nodeValue;
+    }
+    //todo: fix the hardcoded xsi prefix
+    var xsiNil = node.getAttribute("xsi:nil");
+    if (xsiNil == "true") {
+        return null;
+    }
+    var sb = "";
+    var children = node.childNodes;
+    for (var i = 0; i < children.length; i++) {
+        if (children[i].nodeType == 3) {
+            sb += children[i].nodeValue;
+        } else {
+            throw "Not a simple name value node";
+        }
+    }
+    return sb;
+};
+
+//todo: optimize
+/*
+sforce.XmlReader.prototype.toXmlObject2 = function(node) {
+    var children = node.childNodes;
+    var obj = new sforce.Xml();
+    for (var i = 0; i < children.length; i++) {
+        var child = children[i];
+        if (child.nodeType != 1) continue;
+        var name = child.nodeName;
+        var index = name.indexOf(":");
+        name = (index == -1) ? name : name.substring(index + 1);
+        var value;
+        if (this.isNameValueNode(child)) {
+            value = this.getTextValue(child);
+        } else {
+            value = this.toXmlObject(child);
+        }
+        this.addToObject(obj, name, value);
+    }
+    return obj;
+}
+*/
+
+
+sforce.XmlReader.prototype.toXmlObject = function(n) {
+    //todo: fix the hardcoded xsi prefix
+    var xsiNil = n.getAttribute("xsi:nil");
+    if (xsiNil == "true") {
+        return null;
+    }
+
+    var top = new sforce.Xml();
+    var stack = [];
+    stack.push({node: n, obj: top});
+
+    while (stack.length > 0) {
+        var st = stack.shift();
+
+        for (var child = st.node.firstChild; child !== null; child = child.nextSibling) {
+            if (child.nodeType != 1) {
+                continue;
+            }
+            var name = child.nodeName;
+            var index = name.indexOf(":");
+            name = (index == -1) ? name : name.substring(index + 1);
+            var value;
+
+            var isNameValue = true;
+            var sb = "";
+            for (var tc = child.firstChild; tc !== null; tc = tc.nextSibling) {
+                if (tc.nodeType != 3) {
+                    isNameValue = false;
+                    break;
+                } else {
+                    sb += tc.nodeValue;
+                }
+            }
+
+            if (isNameValue) {
+                if (child.getAttribute("xsi:nil") == "true") {
+                    value = null;
+                } else {
+                    value = sb;
+                }
+            } else {
+                value = new sforce.Xml();
+                stack.push({node: child, obj: value});
+            }
+            if (!st.obj[name]) {
+                st.obj[name] = value;
+            } else {
+                if (st.obj[name].push) {
+                    st.obj[name].push(value);
+                } else {
+                    var old = st.obj[name];
+                    if (name === "Id" && old === value) {
+                        //skip, special case for dup Id in sobject
+                    } else {
+                        st.obj[name] = [];
+                        st.obj[name].push(old);
+                        st.obj[name].push(value);
+                    }
+                }
+            }
+        }
+    }
+    return top;
+};
+
+
+/** SoapTransport */
+
+sforce.SoapTransport = function() {
+    this.connectionCallback = null;
+    this.result = null;
+    this.fault = null;
+    this.isAsync = true;
+    this.isArray = false;
+};
+
+sforce.SoapTransport.prototype.onFailure = function(res, writer) {
+    var error = "ERROR: ........... ";
+    alert(error + res);
+    this.result = null;
+};
+
+sforce.SoapTransport.prototype.send = function(url, writer, isArray, connectionCallback) {
+    this.isArray = isArray;
+    var transport = new sforce.Transport(url);
+    this.isAsync = connectionCallback ? true : false;
+    if (this.isAsync) {
+        this.connectionCallback = connectionCallback;
+        transport.send(writer.toString(), this, this.isAsync, connectionCallback.timeout);
+    } else {
+        transport.send(writer.toString(), this, this.isAsync);
+        if (this.fault !== null) {
+            throw this.fault;
+        }
+        return this.result;
+    }
+};
+
+sforce.SoapTransport.prototype.httpCallback = function(response, success) {
+    try {
+        if (success === true) {
+            var reader = new sforce.XmlReader(response);
+            var envelope = reader.getEnvelope();
+            var body = reader.getBody();
+            var operation = reader.getFirstElement(body);
+            if (operation === null) {
+                throw "Unable to find operation response element";
+            }
+            var resultArray = [];
+            var children = operation.childNodes;
+            for (var i = 0; i < children.length; i++) {
+                if (children[i].nodeType != 1) {
+                    continue;
+                }
+                if (reader.isNameValueNode(children[i])) {
+                    resultArray.push(reader.getTextValue(children[i]));
+                } else {
+                    resultArray.push(reader.toXmlObject(children[i]));
+                }
+            }
+
+            if (this.isArray) {
+                this.result = resultArray;
+            } else {
+                if (resultArray.length > 1) {
+                    throw "Found more than one response: " + resultArray;
+                }
+                this.result = resultArray[0];
+            }
+
+            if (this.isAsync) {
+                try {
+                    this.beforeCallback();
+                    if (typeof this.connectionCallback == "function") {
+                        this.connectionCallback(this.result);
+                    } else {
+                        if (this.connectionCallback.onSuccess) {
+                            this.connectionCallback.onSuccess(this.result, this.connectionCallback.source);
+                        } else {
+                            throw "Unable to find onSuccess method in the callback object";
+                        }
+                    }
+                } finally {
+                    this.afterCallback();
+                }
+            }
+        } else {
+            if (typeof(response.nodeName) !== "undefined") {
+                var reader2 = new sforce.XmlReader(response);
+                var envelope2 = reader2.getEnvelope();
+                var body2 = reader2.getBody();
+                var soapfaultEl = reader2.getFirstElement(body2);
+                var soapfault = reader2.toXmlObject(soapfaultEl);
+                this.sendFault(soapfault);
+            } else {
+                this.sendFault(response);
+            }
+        }
+    } catch(fault) {
+        this.sendFault(fault);
+    }
+};
+
+
+sforce.SoapTransport.prototype.sendFault = function(fault) {
+    if (this.isAsync) {
+        if (this.connectionCallback.onFailure) {
+            try {
+                this.beforeCallback();
+                this.connectionCallback.onFailure(fault, this.connectionCallback.source);
+            } finally {
+                this.afterCallback();
+            }
+        } else {
+            this.onFailure(fault);
+        }
+    } else {
+        this.fault = fault;
+    }
+};
+
+sforce.SoapTransport.prototype.beforeCallback = function () {};
+
+sforce.SoapTransport.prototype.afterCallback = function () {};
+
+/** SObject */
+
+
+sforce.SObject = function(type) {
+    this.type = type;
+};
+
+sforce.SObject.prototype = new sforce.Xml("sObjects");
+
+
+/** LeadConvert */
+
+
+sforce.LeadConvert = function() {
+};
+
+sforce.LeadConvert.prototype = new sforce.Xml("leadConverts");
+
+/** MergeRequest */
+
+
+sforce.MergeRequest = function() {
+};
+
+sforce.MergeRequest.prototype = new sforce.Xml("request");
+
+/** DescribeSoqlListViewsRequest - see describeSoqlListViews() */
+sforce.DescribeSoqlListViewsRequest  = function() {
+};
+sforce.DescribeSoqlListViewsRequest.prototype = new sforce.Xml("request");
+
+/** DescribeSoqlListViewParams - see describeSoqlListViews() */
+sforce.DescribeSoqlListViewParams = function() {
+};
+sforce.DescribeSoqlListViewParams.prototype = new sforce.Xml("listViewParams");
+
+/** DescribePicklistsParam - see describePicklists() */
+sforce.DescribePicklistsParam = function() {
+};
+sforce.DescribePicklistsParam.prototype = new sforce.Xml("picklistParams");
+
+
+/** QuickAction */
+
+
+sforce.QuickAction = function() {
+};
+
+sforce.QuickAction.prototype = new sforce.Xml("quickActions");
+
+/** Connection */
+
+sforce.Connection = function() {
+    this.sessionId = null;
+    this.updateMru = null;
+    this.allowFieldTruncation = null;
+    this.disableFeedTracking = null;
+    this.streamingEnabled = null;
+    this.allOrNone = null;
+    this.client = null;
+    this.defaultNamespace = null;
+    this.batchSize = null;
+    this.loginScopeHeader = null;
+    this.emailHeader = null;
+    this.assignmentRuleHeader = null;
+    this.duplicateRuleHeader = null;
+    this.transferToUserId = null;
+    this.debuggingHeader = null;
+    this.serverUrl = (typeof window.UserContext != "undefined") ? UserContext.getUrl("/services/Soap/u/51.0") : "/services/Soap/u/51.0";
+};
+
+
+/** internal methods */
+
+sforce.internal.Parameter = function (n, v, a) {
+    this.name = n;
+    this.value = v;
+    this.isArray = a;
+};
+
+sforce.Connection.prototype.sforceNs = "urn:partner.soap.sforce.com";
+sforce.Connection.prototype.sobjectNs = "sobject.partner.soap.sforce.com";
+
+sforce.Connection.prototype.writeOne = function (writer, name, value, sobjectNs) {
+    if (value === null) {
+        writer.writeNameValueNode(name, null);
+    } else if (value.toXml) {
+        value.toXml(sobjectNs, name, writer);
+    } else {
+        writer.writeNameValueNode(name, value);
+    }
+};
+
+sforce.Connection.prototype.init = function(sessionId, serverUrl) {
+    this.sessionId = sessionId;
+    this.serverUrl = serverUrl;
+};
+
+sforce.Connection.prototype.login = function (username, password) {
+    var arg1 = new sforce.internal.Parameter("username", username, false);
+    var arg2 = new sforce.internal.Parameter("password", password, false);
+    var result = this.invoke("login", [arg1, arg2], false, null);
+    this.sessionId = result.sessionId;
+    return result;
+};
+
+sforce.Connection.prototype.describeSObject = function(type, callback) {
+    var arg = new sforce.internal.Parameter("sObjectType", type, false);
+    return this.invoke("describeSObject", [arg], false, callback);
+};
+
+sforce.Connection.prototype.describeSObjects = function(types, callback) {
+    var arg = new sforce.internal.Parameter("sObjectType", types, true);
+    return this.invoke("describeSObjects", [arg], true, callback);
+};
+
+sforce.Connection.prototype.describeSearchLayouts = function(type, callback) {
+    var arg = new sforce.internal.Parameter("sObjectType", type, true);
+    return this.invoke("describeSearchLayouts", [arg], true, callback);
+};
+
+sforce.Connection.prototype.describeListViews = function(type, callback) {
+    var arg = new sforce.internal.Parameter("sObjectType", type, true);
+    return this.invoke("describeListViews", [arg], true, callback);
+};
+
+sforce.Connection.prototype.describeSoqlListViews = function(name, type, callback) {
+    // this interface is only for a single list 
+    // build up a request for the user - easier than making caller do it
+	var rp = new sforce.DescribeSoqlListViewParams();
+	rp.developerNameOrId = name;
+	rp.sobjectType = type;
+	var describeRequest = new sforce.DescribeSoqlListViewsRequest();
+	describeRequest.listViewParams = [ rp ];
+    
+    var arg1 = new sforce.internal.Parameter("request", describeRequest, false);
+    return this.invoke("describeSoqlListViews", [arg1], false, callback);
+};
+
+sforce.Connection.prototype.describeGlobal = function(callback) {
+    return this.invoke("describeGlobal", [], false, callback);
+};
+
+sforce.Connection.prototype.describeLayout = function(type, layoutName, recordTypes, callback) {
+    var arg1 = new sforce.internal.Parameter("sObjectType", type, false);
+    if (!layoutName) {
+        layoutName = null;
+    }
+    var arg2 = new sforce.internal.Parameter("layoutName", layoutName, false);
+    if (!recordTypes) {
+        recordTypes = [];
+    }
+    var arg3 = new sforce.internal.Parameter("recordTypeIds", recordTypes, true);
+    return this.invoke("describeLayout", [arg1, arg2, arg3], false, callback);
+};
+
+sforce.Connection.prototype.describeAvailableQuickActions = function(parentType, callback) {
+    var arg = new sforce.internal.Parameter("parentType", parentType, false);
+    return this.invoke("describeAvailableQuickActions", [arg], true, callback);
+};
+
+sforce.Connection.prototype.describeQuickActions = function(quickActionNames, callback) {
+    var arg = new sforce.internal.Parameter("quickActionNames", quickActionNames, true);
+    return this.invoke("describeQuickActions", [arg], true, callback);
+};
+
+sforce.Connection.prototype.describeQuickActionsForRecordType = function(quickActionNames, recordTypeId, callback) {
+    var arg = new sforce.internal.Parameter("quickActionNames", quickActionNames, true);
+    var arg2 = new sforce.internal.Parameter("recordTypeId", recordTypeId, false);
+    return this.invoke("describeQuickActionsForRecordType", [arg,arg2], true, callback);
+};
+
+sforce.Connection.prototype.performQuickActions = function(quickActions, callback) {
+    var arg = new sforce.internal.Parameter("quickActions", quickActions, true);
+    return this.invoke("performQuickActions", [arg], true, callback);
+};
+
+sforce.Connection.prototype.describeCompactLayouts = function(type, recordTypes, callback) {
+    var arg = new sforce.internal.Parameter("sObjectType", type, false);
+    if (!recordTypes) {
+        recordTypes = [];
+    }
+    var arg2 = new sforce.internal.Parameter("recordTypeIds", recordTypes, true);
+    return this.invoke("describeCompactLayouts", [arg, arg2], false, callback);
+};
+
+sforce.Connection.prototype.describePathAssistants = function(type, picklistValue, recordTypes, callback) {
+    var arg = new sforce.internal.Parameter("sObjectType", type, false);
+    if (!picklistValue) {
+        picklistValue = null;
+    }
+    var arg2 = new sforce.internal.Parameter("picklistValue", picklistValue, false);
+    if (!recordTypes) {
+        recordTypes = [];
+    }
+    var arg3 = new sforce.internal.Parameter("recordTypeIds", recordTypes, true);
+    return this.invoke("describePathAssistants", [arg, arg2, arg3], false, callback);
+};
+
+sforce.Connection.prototype.describePicklists = function(entityName, fieldNames, recordTypeId, callback) {
+    var picklistParams = new sforce.DescribePicklistsParam();
+    picklistParams.entityName = entityName;
+    picklistParams.fieldNames = fieldNames;
+    picklistParams.recordTypeId = recordTypeId;
+
+    var arg1 = new sforce.internal.Parameter("param", picklistParams, false);
+    return this.invoke("describePicklists", [arg1], false, callback);
+};
+
+sforce.Connection.prototype.describePrimaryCompactLayouts = function(sObjectTypes, callback) {
+    var arg = new sforce.internal.Parameter("sObjectTypes", sObjectTypes, true);
+    return this.invoke("describePrimaryCompactLayouts", [arg], true, callback);
+};
+
+sforce.Connection.prototype.describeApprovalLayout = function(type, approvalProcessNames, callback) {
+    var arg1 = new sforce.internal.Parameter("sObjectType", type, false);
+    if (!approvalProcessNames) {
+    	approvalProcessNames = [];
+    }
+    var arg2 = new sforce.internal.Parameter("approvalProcessNames", approvalProcessNames, true);
+    return this.invoke("describeApprovalLayout", [arg1, arg2], false, callback);
+};
+
+sforce.Connection.prototype.describeSObjectListViews = function(type, recentlyViewed, callback) {
+    var arg1 = new sforce.internal.Parameter("sObjectType", type, false);
+    var arg2 = new sforce.internal.Parameter("recentlyViewed", recentlyViewed, false);
+    var arg3 = new sforce.internal.Parameter("isSoqlCompatible", isSoqlCompatible, false);
+    var arg4 = new sforce.internal.Parameter("limit", limit, false);
+    var arg5 = new sforce.internal.Parameter("offset", offset, false);
+    return this.invoke("describeSObjectListViews", [arg1, arg2, arg3, arg4, arg5], true, callback);
+};
+
+sforce.Connection.prototype.describeTabs = function(callback) {
+	return this.invoke("describeTabs", [], true, callback);
+};
+
+sforce.Connection.prototype.describeAllTabs = function(callback) {
+	return this.invoke("describeAllTabs", [], true, callback);
+};
+
+sforce.Connection.prototype.describeAppMenu = function(appMenuType, networkId, callback) {
+	var arg1 = new sforce.internal.Parameter("appMenuType", appMenuType, false);
+	var arg2 = new sforce.internal.Parameter("networkId", networkId, false);
+    return this.invoke("describeAppMenu", [arg1, arg2], true, callback);
+};
+
+sforce.Connection.prototype.describeFlexiPages = function(flexipageDevName, callback) {
+	var arg1 = new sforce.internal.Parameter("FlexiPage", flexipageDevName, false);
+	return this.invoke("describeFlexiPages", [arg1], true, callback);
+};
+
+sforce.Connection.prototype.describeTheme = function(callback) {
+    return this.invoke("describeTheme", [], true, callback);
+};
+
+sforce.Connection.prototype.describeGlobalTheme = function(callback) {
+    return this.invoke("describeGlobalTheme", [], true, callback);
+};
+
+sforce.Connection.prototype.describeSoftphoneLayout = function(callback) {
+    return this.invoke("describeSoftphoneLayout", [], false, callback);
+};
+
+sforce.Connection.prototype.describeMiniLayout = function (type, recordTypeIds, callback) {
+    var arg1 = new sforce.internal.Parameter("sObjectType", type, false);
+    var arg2 = new sforce.internal.Parameter("recordTypeIds", recordTypeIds, true);
+    return this.invoke("describeMiniLayout", [arg1, arg2], false, callback);
+};
+
+sforce.Connection.prototype.describeSearchScopeOrder = function(callback) {
+     return this.invoke("describeSearchScopeOrder", [], true, callback);
+};
+
+sforce.Connection.prototype.create = function (sobjects, callback) {
+    var arg = new sforce.internal.Parameter("sObjects", sobjects, true);
+    return this.invoke("create", [arg], true, callback);
+};
+
+sforce.Connection.prototype.update = function (sobjects, callback) {
+    var arg = new sforce.internal.Parameter("sObjects", sobjects, true);
+    return this.invoke("update", [arg], true, callback);
+};
+
+sforce.Connection.prototype.upsert = function (externalIDFieldName, sobjects, callback) {
+    var arg1 = new sforce.internal.Parameter("externalIDFieldName", externalIDFieldName, false);
+    var arg2 = new sforce.internal.Parameter("sObjects", sobjects, true);
+    return this.invoke("upsert", [arg1, arg2], true, callback);
+};
+
+sforce.Connection.prototype.deleteIds = function (ids, callback) {
+    var arg = new sforce.internal.Parameter("ids", ids, true);
+    return this.invoke("delete", [arg], true, callback);
+};
+
+sforce.Connection.prototype.deleteByExample = function (sobjects, callback) {
+    var arg = new sforce.internal.Parameter("sObjects", sobjects, true);
+    return this.invoke("deleteByExample", [arg], true, callback);
+};
+
+sforce.Connection.prototype.impersonateUser = function (ids, callback) {
+    var arg = new sforce.internal.Parameter("ids", ids, true);
+    return this.invoke("impersonateUser", [arg], true, callback);
+};
+sforce.Connection.prototype.query = function(queryString, callback) {
+    var arg = new sforce.internal.Parameter("queryString", queryString, false);
+    return this.invoke("query", [arg], false, callback);
+};
+
+sforce.Connection.prototype.queryAll = function(queryString, callback) {
+    var arg = new sforce.internal.Parameter("queryString", queryString, false);
+    return this.invoke("queryAll", [arg], false, callback);
+};
+
+sforce.Connection.prototype.queryMore = function(queryLocator, callback) {
+    var arg = new sforce.internal.Parameter("queryLocator", queryLocator, false);
+    return this.invoke("queryMore", [arg], false, callback);
+};
+
+sforce.Connection.prototype.retrieve = function(fieldList, sObjectType, ids, callback) {
+    var arg1 = new sforce.internal.Parameter("fieldList", fieldList, false);
+    var arg2 = new sforce.internal.Parameter("sObjectType", sObjectType, false);
+    var arg3 = new sforce.internal.Parameter("ids", ids, true);
+    return this.invoke("retrieve", [arg1, arg2, arg3], true, callback);
+};
+
+sforce.Connection.prototype.getAccessInfo = function(callback) {
+    return this.invoke("getAccessInfo", [], false, callback);
+};
+
+sforce.Connection.prototype.getUserInfo = function(callback) {
+    return this.invoke("getUserInfo", [], false, callback);
+};
+
+sforce.Connection.prototype.resetPassword = function(userId, callback) {
+    var arg1 = new sforce.internal.Parameter("userId", userId, false);
+    return this.invoke("resetPassword", [arg1], false, callback);
+};
+
+sforce.Connection.prototype.setPassword = function(userId, password, callback) {
+    var arg1 = new sforce.internal.Parameter("userId", userId, false);
+    var arg2 = new sforce.internal.Parameter("password", password, false);
+    return this.invoke("setPassword", [arg1, arg2], false, callback);
+};
+
+sforce.Connection.prototype.search = function(searchString, callback) {
+    var arg1 = new sforce.internal.Parameter("searchString", searchString, false);
+    return this.invoke("search", [arg1], false, callback);
+};
+
+sforce.Connection.prototype.getDeleted = function(sObjectType, startDate, endDate, callback) {
+    var arg1 = new sforce.internal.Parameter("sObjectType", sObjectType, false);
+    var arg2 = new sforce.internal.Parameter("startDate", startDate, false);
+    var arg3 = new sforce.internal.Parameter("endDate", endDate, false);
+    return this.invoke("getDeleted", [arg1, arg2, arg3], false, callback);
+};
+
+sforce.Connection.prototype.getUpdated = function(sObjectType, startDate, endDate, callback) {
+    var arg1 = new sforce.internal.Parameter("sObjectType", sObjectType, false);
+    var arg2 = new sforce.internal.Parameter("startDate", startDate, false);
+    var arg3 = new sforce.internal.Parameter("endDate", endDate, false);
+    return this.invoke("getUpdated", [arg1, arg2, arg3], false, callback);
+};
+
+
+sforce.Connection.prototype.getServerTimestamp = function(callback) {
+    return this.invoke("getServerTimestamp", [], false, callback);
+};
+
+sforce.Connection.prototype.convertLead = function(leadConverts, callback) {
+    var arg1 = new sforce.internal.Parameter("leadConverts", leadConverts, true);
+    return this.invoke("convertLead", [arg1], true, callback);
+};
+
+sforce.Connection.prototype.merge = function(mergeRequest, callback) {
+    var arg1 = new sforce.internal.Parameter("request", mergeRequest, true);
+    return this.invoke("merge", [arg1], true, callback);
+};
+
+sforce.Connection.prototype.findDuplicates = function(sObjects, callback) {
+    var arg1 = new sforce.internal.Parameter("sObjects", sObjects, true);
+    return this.invoke("findDuplicates", [arg1], true, callback);
+};
+
+sforce.Connection.prototype.findDuplicatesByIds = function(ids, callback) {
+    var arg1 = new sforce.internal.Parameter("ids", ids, true);
+    return this.invoke("findDuplicatesByIds", [arg1], true, callback);
+};
+
+sforce.Connection.prototype.undelete = function(ids, callback) {
+    var arg1 = new sforce.internal.Parameter("ids", ids, true);
+    return this.invoke("undelete", [arg1], true, callback);
+};
+
+sforce.Connection.prototype.process = function(actions, callback) {
+    var arg1 = new sforce.internal.Parameter("actions", actions, true);
+    return this.invoke("process", [arg1], true, callback);
+};
+
+sforce.Connection.prototype.sendEmail = function(messages, callback) {
+    var arg1 = new sforce.internal.Parameter("messages", messages, true);
+    return this.invoke("sendEmail", [arg1], true, callback);
+};
+
+sforce.Connection.prototype.emptyRecycleBin = function(ids, callback) {
+    var arg1 = new sforce.internal.Parameter("ids", ids, true);
+    return this.invoke("emptyRecycleBin", [arg1], true, callback);
+};
+
+sforce.Connection.prototype.invalidateSessions = function(sessionIds, callback) {
+    var arg = new sforce.internal.Parameter("sessionIds", sessionIds, true);
+    return this.invoke("invalidateSessions", [arg], true, callback);
+};
+
+sforce.Connection.prototype.logout = function(callback) {
+    return this.invoke("logout", [], true, callback);
+};
+
+sforce.Connection.prototype.remoteFunction = function(args) {
+    if (!args.url) {
+        throw "url not defined";
+    }
+    if (!args.onSuccess) {
+        throw "onSuccess method not defined";
+    }
+
+    if (!args.method) {
+        args.method = "GET";
+    }
+    if (!args.mimeType) {
+        args.mimeType = "text/plain";
+    }
+
+    if (typeof(args.async) == 'undefined') {
+        args.async = true;
+    }
+
+    if (typeof(args.cache) == 'undefined') {
+        args.cache = false;
+    }
+
+    if (!(args.mimeType == "text/plain" ||
+          args.mimeType == "text/xml")) {
+        throw "Unknown mime type " + args.mimeType;
+    }
+
+    if (sforce.debug.trace) {
+        sforce.debug.log("Open connection to ... " + args.url);
+    }
+
+    var request = new sforce.Transport().newConnection();
+    var proxyUrl = (typeof window.UserContext != "undefined") ? UserContext.getUrl("/services/proxy") : "/services/proxy";
+    if (args.cache) {
+        proxyUrl = proxyUrl + "?end-point-url=" + args.url;
+    } else {
+        proxyUrl = proxyUrl + "?no-cache=" + new Date().getTime();
+    }
+    request.open(args.method, proxyUrl, args.async);
+
+    if (args.requestHeaders) {
+        for (var k in args.requestHeaders) {
+            if (typeof args.requestHeaders[k] != "function") {
+                request.setRequestHeader(k, args.requestHeaders[k]);
+            }
+        }
+    }
+
+    request.setRequestHeader("SalesforceProxy-Endpoint", args.url);
+    request.setRequestHeader("SalesforceProxy-SID", this.sessionId);
+
+    if (args.async) {
+        request.onreadystatechange = _remoteFunctionCallback;
+    }
+
+    if (sforce.debug.trace) {
+        sforce.debug.log("Sending ...");
+    }
+
+    if (args.requestData) {
+        request.send(args.requestData);
+    } else {
+        request.send(null);
+    }
+
+    if (sforce.debug.trace) {
+        sforce.debug.log("Done Sending ...");
+    }
+
+    if (!args.async) {
+        _remoteFunctionCallback();
+    }
+
+    function _remoteFunctionCallback() {
+        if (sforce.debug.trace) {
+            sforce.debug.log("callback called ...");
+        }
+        if (request.readyState == 4) {
+            if (request.status == 200) {
+                if (args.mimeType == "text/plain") {
+                    args.onSuccess(request.responseText, request);
+                } else if (args.mimeType == "text/xml") {
+                    if (!request.responseXML || !request.responseXML.documentElement) {
+                        throw "Response not text/xml mime type: " + request.responseText;
+                    }
+                    args.onSuccess(request.responseXML.documentElement, request);
+                } else {
+                    throw "unsupported mime type: " + args.mimeType;
+                }
+            } else {
+                if (args.onFailure) {
+                    args.onFailure(request.responseText, request);
+                } else {
+                    sforce.debug.log(request.responseText);
+                }
+            }
+        }
+    }
+};
+
+
+sforce.Connection.prototype.writeHeader = function(writer, headerNs) {
+    writer.startHeader();
+
+    writer.writeNamespace(headerNs, "sfns");
+
+    if (this.sessionId !== null) {
+        writer.writeStartElement("SessionHeader", headerNs);
+        writer.writeNameValueNode("sessionId", this.sessionId);
+        writer.writeEndElement("SessionHeader", headerNs);
+    }
+    if (typeof(this.organizationId) !== "undefined") {
+        throw "Use sforce.connection.loginScopeHeader.organizationId instead of sforce.connection.organizationId";
+    }
+    if (this.loginScopeHeader !== null) {
+        writer.writeStartElement("LoginScopeHeader", headerNs);
+        if (this.loginScopeHeader.organizationId !== null) {
+            writer.writeNameValueNode("organizationId", this.loginScopeHeader.organizationId);
+        }
+        if (this.loginScopeHeader.portalId !== null) {
+            writer.writeNameValueNode("portalId", this.loginScopeHeader.portalId);
+        }
+        writer.writeEndElement("LoginScopeHeader", headerNs);
+    }
+    if (this.client !== null || this.defaultNamespace !== null) {
+        writer.writeStartElement("CallOptions", headerNs);
+        if (this.client !== null) {
+            writer.writeNameValueNode("client", this.client);
+        }
+        if (this.defaultNamespace !== null) {
+            writer.writeNameValueNode("defaultNamespace", this.defaultNamespace);
+         }
+        writer.writeEndElement("CallOptions", headerNs);
+    }
+    if (this.batchSize !== null) {
+        writer.writeStartElement("QueryOptions", headerNs);
+        writer.writeNameValueNode("batchSize", this.batchSize);
+        writer.writeEndElement("QueryOptions", headerNs);
+    }
+    if (this.allowFieldTruncation !== null) {
+        writer.writeStartElement("AllowFieldTruncationHeader", headerNs);
+        writer.writeNameValueNode("allowFieldTruncation", this.allowFieldTruncation);
+        writer.writeEndElement("AllowFieldTruncationHeader", headerNs);
+    }
+    if (this.disableFeedTracking !== null) {
+        writer.writeStartElement("DisableFeedTrackingHeader", headerNs);
+        writer.writeNameValueNode("disableFeedTracking", this.disableFeedTracking);
+        writer.writeEndElement("DisableFeedTrackingHeader", headerNs);
+    }
+    if (this.streamingEnabled !== null) {
+        writer.writeStartElement("StreamingEnabledHeader", headerNs);
+        writer.writeNameValueNode("StreamingEnabled", this.streamingEnabled);
+        writer.writeEndElement("StreamingEnabledHeader", headerNs);
+    }
+    if (this.allOrNone !== null) {
+        writer.writeStartElement("AllOrNoneHeader", headerNs);
+        writer.writeNameValueNode("allOrNone", this.allOrNone);
+        writer.writeEndElement("AllOrNoneHeader", headerNs);
+    }
+    if (this.updateMru !== null) {
+        writer.writeStartElement("MruHeader", headerNs);
+        writer.writeNameValueNode("updateMru", this.updateMru);
+        writer.writeEndElement("MruHeader", headerNs);
+    }
+    if (this.emailHeader !== null) {
+        writer.writeStartElement("EmailHeader", headerNs);
+        if (this.emailHeader.triggerAutoResponseEmail) {
+            writer.writeNameValueNode("triggerAutoResponseEmail", this.emailHeader.triggerAutoResponseEmail);
+        }
+        if (this.emailHeader.triggerOtherEmail) {
+            writer.writeNameValueNode("triggerOtherEmail", this.emailHeader.triggerOtherEmail);
+        }
+        if (this.emailHeader.triggerUserEmail) {
+            writer.writeNameValueNode("triggerUserEmail", this.emailHeader.triggerUserEmail);
+        }
+        writer.writeEndElement("EmailHeader", headerNs);
+    }
+    if (this.assignmentRuleHeader !== null) {
+        writer.writeStartElement("AssignmentRuleHeader", headerNs);
+        if (this.assignmentRuleHeader.assignmentRuleId) {
+            writer.writeNameValueNode("assignmentRuleId", this.assignmentRuleHeader.assignmentRuleId);
+        }
+        if (this.assignmentRuleHeader.useDefaultRule) {
+            writer.writeNameValueNode("useDefaultRule", this.assignmentRuleHeader.useDefaultRule);
+        }
+        writer.writeEndElement("AssignmentRuleHeader", headerNs);
+    }
+    if (this.transferToUserId !== null) {
+        writer.writeStartElement("UserTerritoryDeleteHeader", headerNs);
+        writer.writeNameValueNode("transferToUserId", this.transferToUserId);
+        writer.writeEndElement("UserTerritoryDeleteHeader", headerNs);
+    }
+    if (this.duplicateRuleHeader !== null) {
+        writer.writeStartElement("DuplicateRuleHeader", headerNs);
+        if (this.duplicateRuleHeader.allowSave) {
+            writer.writeNameValueNode("allowSave", this.duplicateRuleHeader.allowSave);
+        }
+        if (this.duplicateRuleHeader.includeRecordDetails) {
+            writer.writeNameValueNode("includeRecordDetails", this.duplicateRuleHeader.includeRecordDetails);
+        }
+        if (this.duplicateRuleHeader.runAsCurrentUser) {
+            writer.writeNameValueNode("runAsCurrentUser", this.duplicateRuleHeader.runAsCurrentUser);
+        }
+        writer.writeEndElement("DuplicateRuleHeader", headerNs);
+    }
+    if (this.debuggingHeader !== null) {
+        writer.writeStartElement("DebuggingHeader", headerNs);
+        // Write out old style if specified
+        if (this.debuggingHeader.debugLevel) {
+            writer.writeNameValueNode("debugLevel", this.debuggingHeader.debugLevel);
+        }
+        // Write out the new style debugging categories and levels
+        if (this.debuggingHeader.debugCategories) {
+            var categories = this.debuggingHeader.debugCategories;
+            for (var i = 0; i < categories.length; i++) {
+                var catAndLevel = categories[i].split(",");
+
+                if (catAndLevel.length == 2) {
+                    writer.writeStartElement("categories");
+                    writer.writeNameValueNode("category", catAndLevel[0]);
+                    writer.writeNameValueNode("level", catAndLevel[1]);
+                    writer.writeEndElement("categories");
+                }
+            }
+        }
+        writer.writeEndElement("DebuggingHeader", headerNs);
+    }
+
+    writer.endHeader();
+};
+
+sforce.Connection.prototype.namespaceMap = [
+{ns:sforce.Connection.prototype.sforceNs, prefix:null},
+{ns:sforce.Connection.prototype.sobjectNs, prefix:"ns1"}
+        ];
+
+sforce.Connection.prototype.invoke = function(method, args, isArray, callback) {
+    return this._invoke(method, args, isArray, callback, this.namespaceMap, this.serverUrl, this.sforceNs, this.sobjectNs);
+};
+
+sforce.Connection.prototype._invoke = function(method, args, isArray, callback, namespaces, url, headerNs, sobjectNs) {
+    if (callback) {
+        if (typeof(callback) == "function") {
+        } else {
+            if (!callback.onSuccess) {
+                throw "onSuccess not defined in the callback";
+            }
+            if (!callback.onFailure) {
+                throw "onFailure not defined in the callback";
+            }
+        }
+    }
+
+    var writer = new sforce.XmlWriter();
+    writer.startEnvelope();
+    this.writeHeader(writer, headerNs);
+    writer.startBody();
+    writer.writeStartElement(method);
+
+    for (var i = 0; i<namespaces.length; i++) {
+        writer.writeNamespace(namespaces[i].ns, namespaces[i].prefix);
+    }
+
+    for (var i = 0; i < args.length; i++) {
+        var arg = args[i];
+        if (typeof(arg.value) === "undefined") {
+            throw "arg " + i + " '" + arg.name + "' not specified";
+        }
+        if (arg.value !== null) {
+            if (arg.isArray && !arg.value.push) {
+                throw "arg " + i + " '" + arg.name + "' is an array. But passed in value is not an array";
+            }
+            if (!arg.isArray && arg.value.push) {
+                throw "arg " + i + " '" + arg.name + "' is not an array. But passed in value is an array";
+            }
+        }
+        if (arg.value === null) {
+            this.writeOne(writer, arg.name, null, sobjectNs);
+        } else if (arg.value.push) { //this is an array
+            for (var j = 0; j < arg.value.length; j++) {
+                var obj = arg.value[j];
+                if (!obj) {
+                    throw "Array element at " + j + " is null.";
+                }
+                this.writeOne(writer, arg.name, obj, sobjectNs);
+            }
+        } else {
+            this.writeOne(writer, arg.name, arg.value, sobjectNs);
+        }
+    }
+    writer.writeEndElement(method);
+    writer.endBody();
+    writer.endEnvelope();
+    if (sforce.debug.trace) {
+        sforce.debug.log("Request: server- " + url);
+        sforce.debug.logXml(writer.toString());
+    }
+    var transport = new sforce.SoapTransport();
+    return transport.send(url, writer, isArray, callback);
+};
+
+
+/* QueryResultIterator */
+
+sforce.QueryResultIterator = function(queryResult) {
+    this.queryResult = queryResult;
+    this.index = 0;
+    this.records = this.queryResult.getArray("records");
+};
+
+sforce.QueryResultIterator.prototype.hasNext = function() {
+    if (this.records.length > this.index) {
+        return true;
+    }
+    if (this.queryResult.queryLocator !== null) {
+        this.queryResult = sforce.connection.queryMore(this.queryResult.queryLocator);
+        this.records = this.queryResult.getArray("records");
+        this.index = 0;
+    }
+    if (this.records.length > this.index) {
+        return true;
+    } else {
+        return false;
+    }
+};
+
+sforce.QueryResultIterator.prototype.next = function() {
+    if (this.records.length > this.index) {
+        var result = this.records[this.index];
+        this.index++;
+        return result;
+    } else {
+        throw "Index out of bound : " + this.index;
+    }
+};
+
+
+/* Email */
+
+
+sforce.Email = function() {
+};
+
+sforce.Email.prototype = new sforce.Xml("messages");
+
+sforce.MassEmailMessage = function() {
+};
+
+sforce.MassEmailMessage.prototype = new sforce.Xml("messages");
+sforce.MassEmailMessage.prototype._xsiType = "MassEmailMessage";
+
+
+
+sforce.SingleEmailMessage = function() {
+};
+
+sforce.SingleEmailMessage.prototype = new sforce.Xml("messages");
+sforce.SingleEmailMessage.prototype._xsiType = "SingleEmailMessage";
+
+
+
+/* ProcessRequest */
+
+
+sforce.ProcessRequest = function() {
+};
+
+sforce.ProcessRequest.prototype = new sforce.Xml("actions");
+
+sforce.ProcessSubmitRequest = function() {
+};
+
+sforce.ProcessSubmitRequest.prototype = new sforce.Xml("actions");
+sforce.ProcessSubmitRequest.prototype._xsiType = "ProcessSubmitRequest";
+
+
+sforce.ProcessWorkitemRequest = function() {
+};
+
+sforce.ProcessWorkitemRequest.prototype = new sforce.Xml("actions");
+sforce.ProcessWorkitemRequest.prototype._xsiType = "ProcessWorkitemRequest";
+/* set up connection */
+sforce.connection = new sforce.Connection();
+
+var UserContext = (typeof window.UserContext != "undefined") ? window.UserContext : {
+    siteUrlPrefix : "",
+    getUrl : function (url) {
+        // fix URL for sites with prefixes
+        if (typeof url == "undefined" || typeof UserContext.siteUrlPrefix == "undefined" || !UserContext.siteUrlPrefix)
+            return url;
+
+        if (url.indexOf('/') != 0)
+            return url;
+
+        if(url.indexOf(UserContext.siteUrlPrefix) == 0)
+            return url;
+
+        return UserContext.siteUrlPrefix + url;
+    }
+};
+
+if (typeof(__sfdcSiteUrlPrefix) != "undefined") {
+    UserContext.siteUrlPrefix = __sfdcSiteUrlPrefix;
+}
+
+sforce.connection.serverUrl = (typeof window.UserContext != "undefined") ? UserContext.getUrl("/services/Soap/u/51.0") : "/services/Soap/u/51.0";
+
+if (typeof(__sfdcSessionId) != "undefined") {
+    sforce.connection.sessionId = __sfdcSessionId;
+}
diff --git a/force-app/main/default/staticresources/connection20.resource-meta.xml b/force-app/main/default/staticresources/connection20.resource-meta.xml
new file mode 100644
index 0000000..aa06dd8
--- /dev/null
+++ b/force-app/main/default/staticresources/connection20.resource-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<StaticResource xmlns="http://soap.sforce.com/2006/04/metadata">
+    <cacheControl>Public</cacheControl>
+    <contentType>application/x-javascript</contentType>
+</StaticResource>

--
Gitblit v1.9.1