From 87861ae5f1ed5456685f97f8a8e7625e47b9576d Mon Sep 17 00:00:00 2001
From: KKbes <1620284052@qq.com>
Date: 星期四, 13 四月 2023 11:12:26 +0800
Subject: [PATCH] Merge branch 'LEX_dev' of http://47.92.229.245:8089/r/lightningupdate into LEX_dev
---
force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js-meta.xml | 11
force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.js | 97
force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.html | 5
force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.html | 6
force-app/main/default/lwc/lexOCSMToReportRepair/lexOCSMToReportRepair.js-meta.xml | 11
force-app/main/default/lwc/lexTenderingUsedAttachmentButton/lexTenderingUsedAttachmentButton.js-meta.xml | 11
force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.js-meta.xml | 11
force-app/main/default/lwc/lexOPDtoSIS/lexOPDtoSIS.js-meta.xml | 11
force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.js | 89
force-app/main/default/lwc/lexCancel/lexCancel.js-meta.xml | 11
force-app/main/default/lwc/lexOCSMToReportRepair/lexOCSMToReportRepair.js | 92
force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.html | 5
force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.js | 44
force-app/main/default/lwc/lexTenderingIntentionButton/lexTenderingIntentionButton.html | 5
force-app/main/default/lwc/lexTenderingLogicButton/lexTenderingLogicButton.html | 5
force-app/main/default/classes/TenderingButtonController.cls | 54
force-app/main/default/lwc/lexCancelSubmitReport/lexCancelSubmitReport.html | 6
force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.html | 5
force-app/main/default/lwc/lexComplete/lexComplete.js | 94
force-app/main/default/lwc/lexQuarterlyReport/lexQuarterlyReport.html | 5
force-app/main/default/lwc/lexInsPageBtn/__tests__/lexInsPageBtn.test.js | 25
force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.html | 5
force-app/main/default/lwc/lexOCSMNoToReportRepair/lexOCSMNoToReportRepair.js | 102
force-app/main/default/lwc/lexQuarterlyReport/lexQuarterlyReport.js | 69
force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.html | 5
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/oshRecieved/oshRecieved.js | 83
force-app/main/default/lwc/lexApplicationSubmitButton/lexApplicationSubmitButton.js | 83
force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js-meta.xml | 11
force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.css | 10
force-app/main/default/lwc/qisUniversalFailureCode/qisUniversalFailureCode.js | 63
force-app/main/default/lwc/lexCancel/lexCancel.css | 10
force-app/main/default/lwc/lexASRCEditorRepair/lexASRCEditorRepair.js | 75
force-app/main/default/lwc/lexCancel/lexCancel.html | 6
force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.js | 99
force-app/main/default/lwc/lexTenderingUsedAttachmentButton/lexTenderingUsedAttachmentButton.js | 46
force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.html | 5
force-app/main/default/lwc/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.js-meta.xml | 11
force-app/main/default/lwc/lexInsPageBtn/lexInsPageBtn.js-meta.xml | 11
force-app/main/default/lwc/lexQISIntakeuniversalcode/lexQISIntakeuniversalcode.html | 5
force-app/main/default/classes/SubmitExtensionApprovalProcessController.cls-meta.xml | 5
force-app/main/default/lwc/lexASACEditor/lexASACEditor.js | 73
force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.css | 22
force-app/main/default/lwc/lexQuarterlyReport/lexQuarterlyReport.js-meta.xml | 11
force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.js-meta.xml | 11
force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js | 71
force-app/main/default/classes/RentalApplyControllerLWT.cls | 290
force-app/main/default/lwc/qisUniversalFailureCode/qisUniversalFailureCode.html | 5
force-app/main/default/classes/ControllerUtil.cls-meta.xml | 5
force-app/main/default/lwc/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.html | 5
force-app/main/default/lwc/lexTenderingNotarizeButton/lexTenderingNotarizeButton.html | 5
force-app/main/default/lwc/lexComplete/lexComplete.css | 10
force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.js-meta.xml | 11
force-app/main/default/lwc/lexApplicationSubmitButton/lexApplicationSubmitButton.html | 5
force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.html | 5
force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.css | 10
force-app/main/default/classes/RentalApplyWebService.cls | 2069 ++++++
force-app/main/default/lwc/lexASRCEditorRepair/lexASRCEditorRepair.js-meta.xml | 11
force-app/main/default/lwc/lexTenderingNoStandardButton/lexTenderingNoStandardButton.js-meta.xml | 11
force-app/main/default/lwc/lexUploadToRecognitionModel/lexUploadToRecognitionModel.js-meta.xml | 11
force-app/main/default/classes/ControllerUtil.cls | 5828 ++++++++++++++++++
force-app/main/default/lwc/lexUploadToRecognitionModel/lexUploadToRecognitionModel.js | 133
force-app/main/default/classes/UpdateTenderInformationBatch.cls-meta.xml | 5
force-app/main/default/lwc/lexCustomNewCopy2/lexCustomNewCopy2.js | 77
force-app/main/default/classes/LightingButtonConstant.cls | 80
force-app/main/default/lwc/lexUploadToRecognitionModel/lexUploadToRecognitionModel.html | 6
force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.js | 95
force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.js-meta.xml | 11
force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.css | 10
force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.html | 5
force-app/main/default/lwc/lexASACEditor/lexASACEditor.html | 5
force-app/main/default/classes/loanerArrangedEmailController.cls | 95
force-app/main/default/lwc/lexTenderingRelevancyButton/lexTenderingRelevancyButton.js | 60
force-app/main/default/lwc/lexASRCEditor/lexASRCEditor.js | 74
force-app/main/default/lwc/lexTenderingAntiLogicButton/lexTenderingAntiLogicButton.js | 52
force-app/main/default/classes/QISReportController.cls-meta.xml | 5
force-app/main/default/classes/otherButtonPreparationReportController.cls-meta.xml | 5
force-app/main/default/lwc/lexTenderingIntentionButton/lexTenderingIntentionButton.js-meta.xml | 11
force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.js | 45
force-app/main/default/lwc/lexASRCEditorRepair/__tests__/lexASRCEditorRepair.test.js | 25
force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.js-meta.xml | 11
force-app/main/default/lwc/lexASRCEditor/lexASRCEditor.html | 5
force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.js-meta.xml | 11
force-app/main/default/lwc/lexOCSMNoToReportRepair/lexOCSMNoToReportRepair.html | 6
force-app/main/default/lwc/lexQISIntakeuniversalcode/lexQISIntakeuniversalcode.css | 22
force-app/main/default/classes/ReportController.cls | 536 +
force-app/main/default/lwc/lexInsPageBtn/lexInsPageBtn.js | 62
force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.html | 6
force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.js | 98
force-app/main/default/lwc/lexTenderingNoStandardButton/lexTenderingNoStandardButton.js | 49
force-app/main/default/classes/LightingButtonConstant.cls-meta.xml | 5
force-app/main/default/lwc/oshRecieved/oshRecieved.html | 5
force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.js-meta.xml | 11
force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.js-meta.xml | 11
force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.css | 22
force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.js-meta.xml | 11
force-app/main/default/lwc/lexTenderingEnquiryButton/lexTenderingEnquiryButton.js | 62
force-app/main/default/lwc/lexComplete/lexComplete.js-meta.xml | 11
force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.js | 70
force-app/main/default/classes/ApplicationButtonController.cls | 85
force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.html | 6
force-app/main/default/lwc/oshRecieved/oshRecieved.css | 10
force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.html | 6
force-app/main/default/lwc/lexTenderingRelevancyButton/lexTenderingRelevancyButton.js-meta.xml | 11
force-app/main/default/classes/MonthlyReportController.cls-meta.xml | 5
force-app/main/default/lwc/lexSendRepairsToEtQ/lexSendRepairsToEtQ.html | 6
force-app/main/default/lwc/lexInsPageBtn/lexInsPageBtn.html | 5
force-app/main/default/lwc/lexOPDtoSIS/lexOPDtoSIS.css | 10
force-app/main/default/lwc/lexProductRepairQuoteRepair/lexProductRepairQuoteRepair.js | 67
force-app/main/default/lwc/lexApplicationCancelSubmit/lexApplicationCancelSubmit.html | 5
force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.js-meta.xml | 11
force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.js-meta.xml | 11
force-app/main/default/lwc/rentalApplyLWT/rentalApplyLWT.html | 5
force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.js-meta.xml | 11
force-app/main/default/lwc/lexVOCConfirm/lexVOCConfirm.html | 6
force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.css | 10
force-app/main/default/lwc/lexQISAgree/lexQISAgree.js-meta.xml | 11
force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.html | 5
force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.js | 133
force-app/main/default/lwc/lexTenderingNotarizeButton/lexTenderingNotarizeButton.js-meta.xml | 11
sfdx-project.json | 2
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/lexPDFMaintenanceCommission/lexPDFMaintenanceCommission.js-meta.xml | 11
force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.html | 6
force-app/main/default/lwc/lexYanshoudanRequest/lexYanshoudanRequest.html | 6
force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.css | 10
force-app/main/default/lwc/lexProductRepairQuoteRepair/lexProductRepairQuoteRepair.html | 5
force-app/main/default/lwc/rentalApplyLWT/rentalApplyLWT.css | 11
force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.css | 10
force-app/main/default/classes/otherButtonMaintenanceContractCtl.cls | 87
force-app/main/default/lwc/lexOPDtoSIS/lexOPDtoSIS.js | 93
force-app/main/default/classes/UpdateTenderInformationBatch.cls | 1310 ++++
force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.js | 107
force-app/main/default/classes/TenderingButtonController.cls-meta.xml | 5
force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.js | 92
force-app/main/default/lwc/lexYanshoudanRequest/lexYanshoudanRequest.js | 79
force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.js | 94
force-app/main/default/classes/otherButtonSpotInspectionReportCtl.cls-meta.xml | 5
force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.js | 96
force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.html | 6
force-app/main/default/lwc/lexTenderingNoStandardButton/lexTenderingNoStandardButton.html | 5
force-app/main/default/lwc/lexComplete/lexComplete.html | 6
force-app/main/default/lwc/lexPDFMaintenanceCommission/lexPDFMaintenanceCommission.js | 54
force-app/main/default/lwc/lexVOCConfirm/lexVOCConfirm.js | 104
force-app/main/default/lwc/lexTenderingIntentionButton/lexTenderingIntentionButton.js | 52
force-app/main/default/lwc/lexTenderingLogicButton/lexTenderingLogicButton.js-meta.xml | 11
force-app/main/default/classes/otherButtonPreparationReportController.cls | 30
force-app/main/default/lwc/rentalApplyLWT/rentalApplyLWT.js-meta.xml | 11
force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.css | 22
force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.css | 10
force-app/main/default/lwc/lexCancelSubmitReport/lexCancelSubmitReport.js | 66
force-app/main/default/lwc/lexCreateReportMaintenanceContract/__tests__/lexCreateReportMaintenanceContract.test.js | 25
force-app/main/default/lwc/lexYanshoudanRequest/__tests__/lexYanshoudanRequest.test.js | 25
force-app/main/default/lwc/lexOCSMNoToReportRepair/__tests__/lexOCSMNoToReportRepair.test.js | 25
force-app/main/default/lwc/lexSendRepairsToEtQ/__tests__/lexSendRepairsToEtQ.test.js | 25
force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.js | 48
force-app/main/default/classes/QISReportController.cls | 471 +
force-app/main/default/lwc/lexOCSMNoToReportRepair/lexOCSMNoToReportRepair.js-meta.xml | 11
force-app/main/default/lwc/lexSendRepairsToEtQ/lexSendRepairsToEtQ.js | 192
force-app/main/default/classes/RentalApplyControllerLWT.cls-meta.xml | 5
force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.html | 5
force-app/main/default/lwc/lexMailMessege/lexMailMessege.js | 89
force-app/main/default/lwc/lexQISAgree/lexQISAgree.js | 85
force-app/main/default/lwc/lexTenderingRelevancyButton/lexTenderingRelevancyButton.html | 5
force-app/main/default/lwc/lexTenderingUsedAttachmentButton/lexTenderingUsedAttachmentButton.html | 5
force-app/main/default/lwc/lexApplicationCancelSubmit/lexApplicationCancelSubmit.js-meta.xml | 11
force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.css | 10
force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.js-meta.xml | 11
force-app/main/default/lwc/lexCustomNewCopy2/__tests__/lexCustomNewCopy2.test.js | 25
force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.js | 160
force-app/main/default/lwc/lexQISAgree/lexQISAgree.css | 22
force-app/main/default/lwc/lexTenderingNotarizeButton/lexTenderingNotarizeButton.js | 72
force-app/main/default/lwc/lexQuarterlyReport/__tests__/lexQuarterlyReport.test.js | 25
force-app/main/default/lwc/lexCopyPIInspectionReport/__tests__/lexCopyPIInspectionReport.test.js | 25
force-app/main/default/lwc/lexUploadToRecognitionModel/__tests__/lexUploadToRecognitionModel.test.js | 25
force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.html | 6
force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.js-meta.xml | 11
force-app/main/default/lwc/lexSendRepairsToEtQ/lexSendRepairsToEtQ.js-meta.xml | 11
force-app/main/default/classes/otherButtonSpotInspectionReportCtl.cls | 28
force-app/main/default/lwc/lexASRCEditor/lexASRCEditor.js-meta.xml | 11
force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.js-meta.xml | 11
force-app/main/default/lwc/lexMailMessege/lexMailMessege.html | 5
force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js | 110
force-app/main/default/lwc/lexMailMessege/__tests__/lexMailMessege.test.js | 25
force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.html | 5
force-app/main/default/classes/rentalApplyEquipmentRentalPDFController.cls | 25
force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.html | 6
force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.css | 10
force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.css | 10
force-app/main/default/lwc/lexASRCEditor/lexASRCEditor.css | 10
force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.js-meta.xml | 11
force-app/main/default/lwc/lexMailMessege/lexMailMessege.js-meta.xml | 11
force-app/main/default/lwc/lexCancelSubmitReport/lexCancelSubmitReport.css | 10
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/lexVOCConfirm/lexVOCConfirm.css | 10
force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.js-meta.xml | 11
force-app/main/default/lwc/lexVOCConfirm/lexVOCConfirm.js-meta.xml | 11
force-app/main/default/lwc/lexQISIntakeuniversalcode/lexQISIntakeuniversalcode.js | 64
force-app/main/default/lwc/lexApplicationCancelSubmit/lexApplicationCancelSubmit.js | 74
force-app/main/default/lwc/qisUniversalFailureCode/qisUniversalFailureCode.js-meta.xml | 11
force-app/main/default/lwc/lexOCSMToReportRepair/__tests__/lexOCSMToReportRepair.test.js | 25
force-app/main/default/lwc/lexSubmitForApproval/__tests__/lexSubmitForApproval.test.js | 25
force-app/main/default/lwc/lexApplicationSubmitButton/lexApplicationSubmitButton.xml | 11
force-app/main/default/classes/SubmitExtensionApprovalProcessController.cls | 42
force-app/main/default/lwc/lexASRCEditorRepair/lexASRCEditorRepair.html | 5
force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.js | 89
force-app/main/default/lwc/lexCustomNewCopy2/lexCustomNewCopy2.html | 6
force-app/main/default/lwc/lexTenderingAntiLogicButton/lexTenderingAntiLogicButton.html | 5
force-app/main/default/lwc/lexASACEditor/lexASACEditor.js-meta.xml | 11
force-app/main/default/lwc/lexCancelSubmitReport/lexCancelSubmitReport.js-meta.xml | 11
force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.html | 5
force-app/main/default/lwc/lexASACEditor/lexASACEditor.css | 10
force-app/main/default/lwc/rentalApplyLWT/rentalApplyLWT.js | 659 ++
force-app/main/default/lwc/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.js | 69
force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.js-meta.xml | 11
force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.css | 10
force-app/main/default/classes/otherButtonRepairController.cls | 392 +
force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.js | 155
force-app/main/default/classes/TenderWebService.cls | 83
force-app/main/default/lwc/lexProductRepairQuoteRepair/__tests__/lexProductRepairQuoteRepair.test.js | 25
force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.css | 10
force-app/main/default/lwc/lexPreContractSubmit/__tests__/lexPreContractSubmit.test.js | 25
force-app/main/default/lwc/qisUniversalFailureCode/qisUniversalFailureCode.css | 10
force-app/main/default/lwc/lexQISIntakeuniversalcode/lexQISIntakeuniversalcode.js-meta.xml | 11
force-app/main/default/lwc/lexQISAgree/lexQISAgree.html | 5
force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.html | 6
force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.html | 6
force-app/main/default/lwc/lexCancel/lexCancel.js | 103
force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js | 102
force-app/main/default/classes/ReportController.cls-meta.xml | 5
force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.js-meta.xml | 11
force-app/main/default/classes/TenderWebService.cls-meta.xml | 5
force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.js | 57
force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.css | 22
force-app/main/default/lwc/lexPDFMaintenanceCommission/lexPDFMaintenanceCommission.html | 5
force-app/main/default/classes/MonthlyReportController.cls | 95
force-app/main/default/classes/loanerArrangedEmailController.cls-meta.xml | 5
force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.js-meta.xml | 11
force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.js-meta.xml | 11
force-app/main/default/lwc/lexOCSMToReportRepair/lexOCSMToReportRepair.html | 6
force-app/main/default/lwc/lexTenderingLogicButton/lexTenderingLogicButton.js | 39
force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.html | 5
force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js-meta.xml | 11
force-app/main/default/lwc/oshRecieved/oshRecieved.js-meta.xml | 11
force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.js | 67
force-app/main/default/classes/otherButtonRepairController.cls-meta.xml | 5
force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.js | 89
force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.js | 105
force-app/main/default/lwc/lexProductRepairQuoteRepair/lexProductRepairQuoteRepair.js-meta.xml | 11
force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.html | 5
force-app/main/default/lwc/lexOPDtoSIS/lexOPDtoSIS.html | 6
force-app/main/default/lwc/lexPDFMaintenanceCommission/__tests__/lexPDFMaintenanceCommission.test.js | 25
force-app/main/default/lwc/lexYanshoudanRequest/lexYanshoudanRequest.js-meta.xml | 11
force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.js | 71
force-app/main/default/lwc/lexTenderingAntiLogicButton/lexTenderingAntiLogicButton.js-meta.xml | 11
force-app/main/default/lwc/lexUploadToSap/__tests__/lexUploadToSap.test.js | 25
force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.html | 5
force-app/main/default/classes/rentalApplyEquipmentRentalPDFController.cls-meta.xml | 5
force-app/main/default/lwc/lexCustomNewCopy2/lexCustomNewCopy2.js-meta.xml | 11
force-app/main/default/classes/RentalApplyWebService.cls-meta.xml | 5
force-app/main/default/classes/otherButtonMaintenanceContractCtl.cls-meta.xml | 5
force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.css | 10
force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.html | 6
force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.js | 116
force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.css | 10
force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.html | 7
force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.css | 10
270 files changed, 19,286 insertions(+), 1 deletions(-)
diff --git a/force-app/main/default/classes/ApplicationButtonController.cls b/force-app/main/default/classes/ApplicationButtonController.cls
new file mode 100644
index 0000000..9910696
--- /dev/null
+++ b/force-app/main/default/classes/ApplicationButtonController.cls
@@ -0,0 +1,85 @@
+public class OppSubmitController {
+ @AuraEnabled
+ public static InitData initSubmitButton (String recordId){
+ InitData res = new initData();
+ try{
+ Request_tedner_doc__c report = [SELECT OwnerId,Id FROM Request_tedner_doc__c WHERE Id = :recordId LIMIT 1];
+ res.OwnerId = report.OwnerId;
+ 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 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;
+ rac.RecordTypeId = rac.RecordTypeId = Schema.SObjectType.Request_tedner_doc__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_Application + LightingButtonConstant.STATUS_Application_Submitted).getRecordTypeId();
+ rac.Submit_check_flag__c = true;
+ rac.Submit_time__c = Datetime.now();
+ update rac;
+ messageText = '1';
+ return messageText;
+ } catch (Exception ex) {
+ System.debug(LoggingLevel.INFO, '*** xu: ' + ex);
+ 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;
+ report.RecordTypeId = Schema.SObjectType.Request_tedner_doc__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_Application).getRecordTypeId();
+ report.Submit_check_flag__c = false;
+ report.Submit_time__c = null;
+ update report;
+ messageText = '1';
+ return messageText;
+ } catch (Exception ex) {
+ System.debug(LoggingLevel.INFO, '*** cancelXu: ' + 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 from user where id = : myUserID ];
+ result.id = tempUser.id;
+ } catch (exception e) {
+ result.result = e.getMessage();
+ }
+ return result;
+ }
+
+ public class InitData{
+ @AuraEnabled
+ public String Id;
+ @AuraEnabled
+ public String OwnerId;
+ }
+ public class UserResult {
+ @AuraEnabled
+ public string result;
+ public UserResult( ) {
+ result = 'Success';
+ }
+ @AuraEnabled
+ public string id;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/ControllerUtil.cls b/force-app/main/default/classes/ControllerUtil.cls
new file mode 100644
index 0000000..a70f2f2
--- /dev/null
+++ b/force-app/main/default/classes/ControllerUtil.cls
@@ -0,0 +1,5828 @@
+global without sharing class ControllerUtil {
+ // 銉堛儶銈疅琛屽洖鏁般倰鍒跺尽銇欍倠銆佷竴鍥炵洰false銆佷簩鍥炵洰锛坵orkflow瀵惧繙鐢級true
+ //public static Boolean XinEventOppotunityPileUpExeFlg = false;
+ // 绌嶃伩涓娿亽銈扞sScheduled銉曘儵銈拌ō瀹氥伄寰屻伀瀹熻
+ public static Boolean EventOpportunityPileUpExeFlg = false;
+ // EventC鈬扙vent鍑︾悊寰屻�侀�嗘洿鏂般倰銈广儷銉肩敤
+ public static Boolean NotUpdEventCFlg = false;
+ // 绌嶃伩涓娿亽鍑︾悊寰屻�併儓銉偓銈掋偣銉兗鐢�
+ public static Boolean EscapeNFM001Trigger = false;
+ public static Boolean EscapeNFM001AgencyContractTrigger = false;
+ public static Boolean EscapeNFM007Trigger = false;
+ public static Boolean EscapeOpportunityBefUpdTrigger = false;
+ public static Boolean EscapeOpportunityHpDeptUpdTrigger = false;
+ public static Boolean EscapeSyncOpportunityTrigger = false;
+ public static Boolean EscapeMaintenanceContractAfterUpdateTrigger = false;
+ public static Boolean EscapeSyncProduct2Trigger = false;
+
+ // 鍟嗚珖銇洿鏂颁笉鍙爡鐩儶銈广儓
+ public static List<String> oppColumnList = System.Label.Opportunity_Columns.split(',');
+
+ // 鍓婇櫎瀵捐薄銇瓻vent
+ public static Set<Id> delEventIdSet = new Set<Id>();
+
+ // 100鏃ュ畾鏁�
+ public static Integer ReportDayRange = 100;
+
+ // 鍟嗚珖銉偝銉笺儔銈裤偆銉�
+ public static String[] oppRecordTypeDevNames = new String[] {'Opportunity'};
+
+ public static final String chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
+
+
+ public ControllerUtil() {
+ 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++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ }
+
+ WebService static String selectCommonSequence(String valueField, String formatField) {
+ Boolean insertNew = false;
+ //鍙栧緱鍏遍�氭帯鐣簭鍒�
+ String soql = 'select id,' + valueField + ',' + formatField + ' from Common_Sequence__c for update';
+ List<Common_Sequence__c> csList = Database.query(soql);
+ if (csList.size() == 0) {
+ //鍏遍�氭帯鐣簭鍒楁病鏁版嵁锛屾柊寤�
+ Common_Sequence__c newCS = new Common_Sequence__c();
+ newCS.Name = '鍏遍�氭帯鐣簭鍒�';
+ newCS.EvaluationPDF_NextValue__c = 1;
+ insert newCS;
+ insertNew = true;
+ //鍐嶅彇寰楀叡閫氭帯鐣簭鍒�
+ csList = Database.query(soql);
+ }
+ Common_Sequence__c cs = csList[0];
+ //鎺$暘缂栫爜
+ String format = String.valueOf(cs.get(formatField));
+ //涓嬩釜鎺$暘鍊�
+ Decimal nextValue = Decimal.valueOf(String.valueOf(cs.get(valueField)));
+ //鎺$暘
+ nextValue += 1;
+ cs.put(valueField, nextValue);
+ update csList;
+ //杩斿洖鎺$暘缂栫爜
+ return format;
+ }
+
+ public static String generateRandomStr(Integer len) {
+ String randStr = '';
+ while (randStr.length() < len) {
+ Integer idx = Math.mod(Math.abs(Crypto.getRandomInteger()), chars.length());
+ randStr += chars.substring(idx, idx+1);
+ }
+ return randStr;
+ }
+
+ public static List<Document> getPdfBlobForPreview(String docId) {
+ return [select Id, Name, Body, CreatedDate from Document where Id = :docId];
+ }
+
+ public static List<SMARM__c> getSmarmByUser(Map<String, Schema.SObjectField> fieldMap, String fromUserId, String toUserId) {
+ String sql = 'select ';
+ String fields = '';
+ for (String field : fieldMap.keySet()) {
+ if (fields.length() > 0) {
+ fields += ', ';
+ }
+ fields += field;
+ }
+ sql += fields;
+ sql += ' from SMARM__c where Review_Practitioner__c = :fromUserId and Review_Target__c = :toUserId and (Status__c = \'鑽夋涓璡' or Status__c = \'Delete\')';
+ List<SMARM__c> sList = Database.query(sql);
+ return sList;
+ }
+
+ public static void createDocForEmail(List<Document> docList) {
+ Folder f = [select Id from Folder where DeveloperName = 'EmailImgFolder'];
+ for (Document doc : docList) {
+ doc.FolderId = f.Id;
+ doc.IsPublic = true;
+ }
+ insert docList;
+ }
+
+ public static List<SMARM__c> getSmarmById(String sql) {
+ return Database.query(sql);
+ }
+
+ public static List<Attachment> getSmarmAtts(String smarmId) {
+ return [select Id, Name, Body from Attachment where ParentId = :smarmId order by Name];
+ }
+
+ public static void insertAttachments(List<Attachment> atts) {
+ if (atts.size() > 0) insert atts;
+ }
+
+ public static void updateAttachments(List<Attachment> atts) {
+ if (atts.size() > 0) update atts;
+ }
+
+ public static void deleteAttachments(List<Attachment> atts) {
+ if (atts.size() > 0) delete atts;
+ }
+
+ public static void upsertSMARM(SMARM__c smarm) {
+ upsert smarm;
+ }
+
+ public static void insertSMARMShare(List<SObject> smarmShare) {
+ insert smarmShare;
+ }
+
+ public static List<Account> selectAccountForTrigger(List<String> accIds) {
+ return [Select Id, Name, Management_Code__c, OwnerId, ParentId, Parent.ParentId,Parent.Parent.Name, RecordTypeId from Account where Id IN :accIds];
+ }
+ public static Map<Id, Contact> selectContactAccountForTrigger(List<Id> contactIds) {
+ return new Map<Id, Contact>([Select Id, AccountId, Account.ParentId, Account.Parent.ParentId, Account.RecordTypeId from Contact where Id IN :contactIds]);
+ }
+ public static list<Contact> selectContactForCampaignMember(Set<Id> contactIds) {
+ return [Select Id, campaign__c,campaign__r.Lesson_Type__c, campaign__r.TrainingType__c from Contact where Id IN :contactIds];
+ }
+ public static List<Contact> selectDummyContact() {
+ return [select id, Email from Contact where email <> null limit 1];
+ }
+
+ public static List<Account> selectBossMailAddr(List<String> accIds) {
+ return [select Id, Parent.Boss__r.Email, Parent.Sub_Boss__r.Email, Parent.Boss__r.Name, Parent.Sub_Boss__r.Name from Account where Id in : accIds];
+ }
+
+ public static List<Event> eventSelectById(String id){
+ List<Event> eParamList = [select id, ActivityDate, OwnerId, Subject, whatid__c, EventC_ID__c, NextEventC_ID__c, AppCdId__c, SyncCreatedDate__c,
+ StartDateTime, DurationInMinutes, Main_Visit_Location__c, Activity_Type2__c, IsScheduled__c, BeforeActivityDate__c,
+ Visitor1__c, Visitor2__c, Visitor3__c, Visitor4__c, Visitor5__c, Visitor1_ID__c, Visitor2_ID__c, Visitor3_ID__c, Visitor4_ID__c, Visitor5_ID__c,
+ Purpose_Type__c, Location, Related_Opportunity1__c, Related_Service1__c, Related_Opportunity1_ID__c, Related_Service1_ID__c,
+ Related_Opportunity2__c, Related_Opportunity3__c, Related_Opportunity4__c, Related_Opportunity5__c,OPDPlan_Flag__c,
+ Related_Opportunity2_ID__c, Related_Opportunity3_ID__c, Related_Opportunity4_ID__c, Related_Opportunity5_ID__c,
+ Activity_Purpose__c, Activity_PurposeFSE__c, Activity_PurposeEscFSE__c, Purpose_TypeFSE__c, Purpose_TypeEscFSE__c
+ from Event where id = :id];
+ return eParamList;
+ }
+ public static List<Event> eventSelectByDate(Date whereDate, User ur){
+ List<Event> calenderList = [select id, ActivityDate, OwnerId, Subject, whatid__c, EventC_ID__c, NextEventC_ID__c, AppCdId__c, SyncCreatedDate__c,
+ StartDateTime, DurationInMinutes, Main_Visit_Location__c, Activity_Type2__c, IsScheduled__c, BeforeActivityDate__c,
+ Visitor1__c, Visitor2__c, Visitor3__c, Visitor4__c, Visitor5__c, Visitor1_ID__c, Visitor2_ID__c, Visitor3_ID__c, Visitor4_ID__c, Visitor5_ID__c,
+ Purpose_Type__c, Location, Related_Opportunity1__c, Related_Service1__c, Related_Opportunity1_ID__c, Related_Service1_ID__c, WS_flg__c,
+ Related_Opportunity2__c, Related_Opportunity3__c, Related_Opportunity4__c, Related_Opportunity5__c,OPDPlan_Flag__c,
+ Related_Opportunity2_ID__c, Related_Opportunity3_ID__c, Related_Opportunity4_ID__c, Related_Opportunity5_ID__c,Opd_Plan__c,
+ Activity_Purpose__c, Activity_PurposeFSE__c, Activity_PurposeEscFSE__c, Purpose_TypeFSE__c, Purpose_TypeEscFSE__c,EventStatus__c,cancelReason__c,cancelReasonOther__c,cancelReasonSelect__c,cancelReasonSelectFSE__c,delayReason__c,delayReasonOther__c,delayReasonSelect__c,delayReasonSelectFSE__c,delayToDate__c
+ from Event where WS_flg__c = false and ActivityDate = :whereDate and OwnerId = :ur.Id and EventStatus__c not in ('04 鍙栨秷','05 寤舵湡','06 鍏抽棴','07 鏈墽琛�') order by StartDateTime];
+ return calenderList;
+ }
+
+ public static List<Daily_Report__c> reportSelectByDate(Date whereDate, String ownerId){
+ List<Daily_Report__c> reportList = [select id, name, Reporter__c, Reported_Date__c, Daily_Report_Data_Type__c,
+ Working_Time_From__c, Working_Time_To__c, Status__c, Mail_Send_Check__c,
+ Business_Trip__c, Submit_Date_New__c, Submit_DateTime_New__c, Approved_Date__c,
+ Approved_DateTime__c, CreatedById, Feed_Back_From_Manager__c, FeedbackManager__c,
+ Planning_Time__c, Submission_Elapsed_Hour__c, Approval_Elapsed_Time__c,
+ Activity_ID__c, Manager_Mail__c, Status_With_Check__c
+ from Daily_Report__c where Reported_Date__c =:whereDate and OwnerId =:ownerId];
+ return reportList;
+ }
+
+ public static List<RecordType> recordTypeSelectForTrainingtestResult(){
+ List<RecordType> rtList = [select Id, DeveloperName from RecordType where IsActive = true and SobjectType = 'Training_test_Result__c'];
+ return rtList;
+ }
+
+ public static List<Training_test_Result__c> trainingtestResultSelectByContactIds(Set<Id> ids){
+ List<Training_test_Result__c> ttrList = [select Id, RecordType.DeveloperName, employee__c from Training_test_Result__c where employee__c in :ids];
+ return ttrList;
+ }
+
+ public static void updateSObjectContact(List<SObject> contactList) {
+ if (contactList != null && contactList.size() > 0) update contactList;
+ }
+
+ public static Map<Id, Contact> selectActiveUserFromContact(List<Id> contactIds) {
+ return new Map<Id, Contact>([Select Id, User__c From Contact Where Id IN: contactIds and User__r.isActive = true]);
+ }
+
+
+ /**
+ * add 2021/12/23 wangweipeng satrt
+ * [updateFutureOds 鏇存柊ods鐨剈ser__c瀛楁]
+ * @param odsEmployeeNoList [鍛樺伐缂栫爜]
+ * @param odsEmployeeNoMap [鍛樺伐缂栫爜瀵瑰簲鐨剈ser Id]
+ *
+ */
+ @future
+ public static void updateFutureOds(List<String> odsEmployeeNoList,Map<String,Id> odsEmployeeNoMap) {
+ if(odsEmployeeNoList != null && odsEmployeeNoList.size() > 0){
+ List<ODS__c> odsData = [select id,name,User__c,Employee_No__c from ODS__c where Employee_No__c in :odsEmployeeNoList];
+ if(odsData != null && odsData.size() > 0){
+ for(ODS__c ods : odsData){
+ ods.User__c = odsEmployeeNoMap.get(ods.Employee_No__c);
+ }
+ update odsData;
+ }
+ }
+ }
+ //add 2021/12/23 wangweipeng end
+
+ /*
+ https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dml_non_mix_sobjects.htm
+ */
+ @future
+ public static void upsertFutureContact(List<String> userEmployeeNoList) {
+ upsertFutureContactInterface(userEmployeeNoList);
+ }
+ //@future
+ public static void upsertFutureContactInterface(List<String> userEmployeeNoList) {
+
+ // 绀惧唴鍛樺伐銇儸銈炽兗銉夈偪銈ゃ儣
+ Id rtId = '01210000000Qtky';
+ // 鐜版湁鑱旂郴浜�
+ Map<String, Contact> conMap = new Map<String, Contact>();
+ // UserToContact 銇� 澶夋洿銇椼仧銇� 銇仸鍒ゆ柇銇椼仧闋呯洰銇с仚
+ //20220425 LLIU-CCY9TA you 鏌ヨpost鐨勫湴鏂规崲鎴� HR_Post__c
+ List<User> usrList = [select Id,PositionSubsequence__c,Rank__c, Notes_File_Name__c,FirstName, LastName, Email, Mobile_Phone__c, Employee_No__c, Work_Location__c, HR_Post__c,Post__c, Job_Category__c, Hire_Date__c, Gender__c, Dept__c, Pregnant_Rest__c, Salesdepartment__c, Stay_or_not__c,IsMEBG__c, Work_Location_HR__c from User where Employee_No__c IN :userEmployeeNoList];
+ List<Contact> conList = [select Id,Notes_File_Name__c, User__c, Employee_No_manual__c,Isactive__c,IsMEBG__c, Work_Location_HR__c from Contact where Employee_No_manual__c IN :userEmployeeNoList and RecordTypeId = :rtId];
+ for (Contact con : conList) {
+ //conMap.put(con.Employee_No_manual__c, con);
+ conMap.put(con.Employee_No_manual__c.toLowerCase(), con);
+ }
+ system.debug('youchangtest1');
+ List<Contact> upsertList = new List<Contact>();
+ for (User local : usrList) {
+ //update wangweipeng 2021/11/19
+ //涓嶈兘濉啓璇稿鈥滃尰鐢熲�濓紝鈥滆�佸笀鈥濓紝鈥滄姢澹�濓紝鈥滈櫌闀库�濓紝鈥滄煇鏌愨�濈瓑澶磋浠gО
+ if(String.isNotBlank(local.FirstName)){
+ if(UserInfo.getProfileId() != '00e10000000Y3o5' && UserInfo.getProfileId() != '00e10000000Y3o5'){
+ if(local.FirstName == '鑰佸笀' || local.FirstName == '鍖荤敓' || local.FirstName == '涓讳换' || local.FirstName == '闄㈤暱'
+ || local.FirstName == '绉戦暱' || local.FirstName == '璇鹃暱' || local.FirstName == '鎶ゅ+' || local.FirstName == '鎶ゅ+闀�'
+ || local.FirstName == '鍏堢敓' || local.FirstName == '濂冲+' || local.FirstName == '绛夌瓑' || local.FirstName == '鏌�'
+ || local.FirstName == '鏌愭煇' || local.FirstName == '鏌愭煇鏌�' || local.FirstName == '澶уか')
+ {
+ System.debug('----浠g爜锛氳濉啓姝g‘鐨勫悕瀛楋紝涓嶈兘濉啓璇稿鈥滃尰鐢熲�濓紝鈥滆�佸笀鈥濓紝鈥滄姢澹�濓紝鈥滈櫌闀库�濓紝鈥滄煇鏌愨�濈瓑澶磋浠gО!');
+ continue;
+ }
+ }
+ }
+ //鐢变簬娴嬭瘯鏃讹紝鍙戠幇contact鐨勫憳宸ョ紪鐮佷负澶у啓锛寀ser琛ㄤ负灏忓啓锛屼絾鏄柊澧炴椂falseforce澶у皬鍐欎笉鏁忔劅锛屾墍浠ヤ細鎶ラ噸澶嶅�肩殑閿欒
+ // 鎵�浠ヤ负浜嗛伩鍏嶄互涓婇棶棰橈紝鎶婂憳宸ョ紪鐮侀兘杞负灏忓啓
+ if (conMap.containsKey(local.Employee_No__c.toLowerCase())) {
+ //if (conMap.containsKey(local.Employee_No__c)) {
+ // 鏇存柊鐜版湁鑱旂郴浜�
+ Contact tmp = conMap.get(local.Employee_No__c.toLowerCase());
+ tmp.User__c = local.Id;
+ tmp.FirstName = local.FirstName;
+ tmp.LastName = local.LastName;
+ tmp.Email = local.Email;
+ tmp.Notes_File_Name__c = local.Notes_File_Name__c;//20170220鏂板
+ tmp.MobilePhone = local.Mobile_Phone__c;
+ tmp.Employee_No_manual__c = local.Employee_No__c;
+ tmp.Work_Location_manual__c = local.Work_Location__c;
+ //鐢ㄦ埛鐨勫伐浣滃湴锛堜汉浜嬶級鏀瑰彉鏇存柊鍒拌仈绯讳汉涓� thh 2022-02-16 start
+ tmp.Work_Location_HR__c = local.Work_Location_HR__c;
+ //鐢ㄦ埛鐨勫伐浣滃湴锛堜汉浜嬶級鏀瑰彉鏇存柊鍒拌仈绯讳汉涓� thh 2022-02-16 end
+ tmp.Post_picklist__c = local.Post__c; //20220426 LLIU-CCY9TA you鐢ㄦ埛鐨� Post__c 锛岃繕鏄搴旇仈绯讳汉
+ tmp.HR_Post__c = local.HR_Post__c;//HR閫氱敤鑱岀骇 //20220425 LLIU-CCY9TA you
+ tmp.Job_Category_picklist__c = local.Job_Category__c;
+ tmp.Hire_date_text__c = local.Hire_Date__c;
+ tmp.Gender_text__c = local.Gender__c;
+ tmp.Dept__c = local.Dept__c;
+ tmp.Pregnant_Rest__c = local.Pregnant_Rest__c;
+ tmp.Salesdepartment_Text__c = local.Salesdepartment__c;
+ tmp.Stay_or_not__c = local.Stay_or_not__c;
+ tmp.IsMEBG__c = local.IsMEBG__c;//鏄惁MEBG
+ //20220428 LLIU-CDW5ZW you start
+ tmp.PositionSubsequence__c = local.PositionSubsequence__c;
+ //20220428 LLIU-CDW5ZW you end
+ //20220512 you LLIU-CDW5ZW start
+ tmp.Rank__c = local.Rank__c;
+ //20220428 you LLIU-CDW5ZW end
+
+ if(String.isNotBlank(local.Stay_or_not__c)){
+ tmp.Isactive__c = local.Stay_or_not__c == '鍦ㄨ亴' ? '鏈夋晥':'鏃犳晥(閫�浼�)';
+ }
+ upsertList.add(tmp);
+ system.debug('youchangtest2'+tmp.HR_Post__c);
+ } else {
+ // 鏂板仛鑱旂郴浜�
+ Contact tmp = new Contact();
+ tmp.RecordTypeId = rtId;
+ tmp.AccountId = System.Label.Olympus_AccountID_Internal_staff;
+ tmp.User__c = local.Id;
+ tmp.FirstName = local.FirstName;
+ tmp.LastName = local.LastName;
+ tmp.Notes_File_Name__c = local.Notes_File_Name__c;//20170220鏂板
+ tmp.Email = local.Email;
+ tmp.MobilePhone = local.Mobile_Phone__c;
+ tmp.Employee_No_manual__c = local.Employee_No__c;
+ tmp.Work_Location_manual__c = local.Work_Location__c;
+ //濡傛灉鏍规嵁HR淇℃伅鏂板缓鐢ㄦ埛,鍒欐妸HR淇℃伅鐨勫伐浣滃湴浼犵粰鐢ㄦ埛鐨勫伐浣滃湴鍜屽伐浣滃湴锛堜汉浜嬶級 thh 2022-02-16 start
+ tmp.Work_Location_HR__c = local.Work_Location__c;
+ tmp.Work_Location_picklist__c = local.Work_Location__c;
+ //濡傛灉鏍规嵁HR淇℃伅鏂板缓鐢ㄦ埛,鍒欐妸HR淇℃伅鐨勫伐浣滃湴浼犵粰鐢ㄦ埛鐨勫伐浣滃湴鍜屽伐浣滃湴锛堜汉浜嬶級 thh 2022-02-16 end
+ tmp.Post_picklist__c = local.Post__c;//20220426 LLIU-CCY9TA you鐢ㄦ埛鐨� Post__c 锛岃繕鏄搴旇仈绯讳汉
+ tmp.HR_Post__c = local.HR_Post__c;//HR閫氱敤鑱岀骇 //20220425 LLIU-CCY9TA you
+ tmp.Job_Category_picklist__c = local.Job_Category__c;
+ tmp.Hire_date_text__c = local.Hire_Date__c;
+ tmp.Gender_text__c = local.Gender__c;
+ tmp.Dept__c = local.Dept__c;
+ tmp.Pregnant_Rest__c = local.Pregnant_Rest__c;
+ tmp.Salesdepartment_Text__c = local.Salesdepartment__c;
+ tmp.Stay_or_not__c = local.Stay_or_not__c;
+ tmp.IsMEBG__c = local.IsMEBG__c;//鏄惁MEBG
+ //20220428 LLIU-CDW5ZW you start
+ tmp.PositionSubsequence__c = local.PositionSubsequence__c;
+ //20220428 LLIU-CDW5ZW you end
+ //20220512 you LLIU-CDW5ZW start
+ tmp.Rank__c = local.Rank__c;
+ //20220428 you LLIU-CDW5ZW end
+ if(String.isNotBlank(local.Stay_or_not__c)){
+ tmp.Isactive__c = '鍦ㄨ亴'.equals(local.Stay_or_not__c) ? '鏈夋晥':'鏃犳晥(閫�浼�)';
+ }
+ upsertList.add(tmp);
+ system.debug('youchangtest3'+tmp.HR_Post__c);
+ }
+ }
+ upsert upsertList;
+ }
+// 20220425 you 缁忔煡鐪� 姝ゅ璞″簲璇ユ槸娌℃湁浠讳綍鍦版柟鐢ㄥ埌浜嗭紝鍙互娉ㄩ噴鎺�
+ public static void updateFutureUserByContact(List<String> userEmployeeNoList) {
+ // 鐜版湁鐢ㄦ埛
+ Map<String, User> usrMap = new Map<String, User>();
+ // ContactToUser 銇� 澶夋洿銇椼仧銇� 銇仸鍒ゆ柇銇椼仧闋呯洰銇с仚
+ List<Contact> conList = [select Id, FirstName, LastName, Email, MobilePhone, Employee_No_manual__c, Work_Location_manual__c, Post_picklist__c, Job_Category_picklist__c, Hire_date_text__c, Gender_text__c, Dept__c, Pregnant_Rest__c, Stay_or_not__c from Contact where Employee_No_manual__c IN :userEmployeeNoList];
+ List<User> usrList = [select Id, Employee_No__c from User where Employee_No__c IN :userEmployeeNoList];
+ for (User usr : usrList) {
+ //update wangweipeng 2021/11/19
+ //鐢变簬娴嬭瘯鏃讹紝鍙戠幇contact鐨勫憳宸ョ紪鐮佷负澶у啓锛寀ser琛ㄤ负灏忓啓锛屼絾鏄柊澧炴椂falseforce澶у皬鍐欎笉鏁忔劅锛屾墍浠ヤ細鎶ラ噸澶嶅�肩殑閿欒
+ //鎵�浠ヤ负浜嗛伩鍏嶄互涓婇棶棰橈紝鎶婂憳宸ョ紪鐮侀兘杞负灏忓啓
+ usrMap.put(usr.Employee_No__c.toLowerCase(), usr);
+ }
+
+ List<User> updateList = new List<User>();
+ for (Contact local : conList) {
+ //update wangweipeng 2021/11/19
+ //鐢变簬娴嬭瘯鏃讹紝鍙戠幇contact鐨勫憳宸ョ紪鐮佷负澶у啓锛寀ser琛ㄤ负灏忓啓锛屼絾鏄柊澧炴椂falseforce澶у皬鍐欎笉鏁忔劅锛屾墍浠ヤ細鎶ラ噸澶嶅�肩殑閿欒
+ // 鎵�浠ヤ负浜嗛伩鍏嶄互涓婇棶棰橈紝鎶婂憳宸ョ紪鐮侀兘杞负灏忓啓
+ if (usrMap.containsKey(local.Employee_No_manual__c.toLowerCase())) {
+ // 鏇存柊鐜版湁鐢ㄦ埛
+ User tmp = usrMap.get(local.Employee_No_manual__c);
+ tmp.FirstName = local.FirstName;
+ tmp.LastName = local.LastName;
+ tmp.Email = local.Email;
+ tmp.Mobile_Phone__c = local.MobilePhone;
+ //tmp.Employee_No__c = local.Employee_No_manual__c;
+ tmp.Work_Location__c = local.Work_Location_manual__c;
+ tmp.Post__c = local.Post_picklist__c;
+ tmp.Job_Category__c = local.Job_Category_picklist__c;
+ tmp.Hire_Date__c = local.Hire_date_text__c;
+ tmp.Gender__c = local.Gender_text__c;
+ tmp.Dept__c = local.Dept__c;
+ tmp.Pregnant_Rest__c = local.Pregnant_Rest__c;
+ tmp.Stay_or_not__c = local.Stay_or_not__c;
+ updateList.add(tmp);
+ }
+ }
+ update updateList;
+ }
+
+ //add wangweipeng 2021/11/18 start
+ //鏍规嵁ods鐨勫憳宸ョ紪鐮侊紝鏇存柊鎴栨柊澧� user琛ㄧ殑鏁版嵁
+ public static void updateFutureOdsByUser(List<String> userEmployeeNoList) {
+ //20220426 LLIU-CCY9TA you start 閫氱敤鑱岃鍜寀ser涓婄殑鑱屼綅浜掔浉鏄犲皠锛�
+ SS_BatchColumnMapping__c mpdMapping = SS_BatchColumnMapping__c.getValues('HR_Post_To_UserAndContact__c');
+
+ Map<String,String> UserAndContactMap = new Map<String,String>();
+ for (Integer i = 1; i <= 30; i++) {
+ String lpadI = ('00' + i).right(3);
+ String fromColumn = 'From_Column_' + lpadI + '__c';
+ if(mpdMapping!=null){
+ String apiStr = String.valueOf(mpdMapping.get(fromColumn));
+ if (String.isBlank(apiStr) == false) {
+ String ssColumn = 'SS_Column_' + lpadI + '__c';
+ String ssApiStr = String.valueOf(mpdMapping.get(ssColumn));
+ UserAndContactMap.put(apiStr,ssApiStr);
+ }
+ }
+ }
+ //20220426 LLIU-CCY9TA you end
+
+ //20220721 you LLIU-CGH8EY start 鏈儴鍒嗙被-宀椾綅瀛愬簭鍒楋紝鏄犲皠 user涓婄殑鑱岀
+ SS_BatchColumnMapping__c JobmpdMapping = SS_BatchColumnMapping__c.getValues('HR_Post_To_Job_Category__c');
+
+ Map<String,String> Job_CategoryMap = new Map<String,String>();
+ for (Integer i = 1; i <= 30; i++) {
+ String lpadI = ('00' + i).right(3);
+ String fromColumn = 'From_Column_' + lpadI + '__c';
+ if(JobmpdMapping!=null){
+ String apiStr = String.valueOf(JobmpdMapping.get(fromColumn));
+ if (String.isBlank(apiStr) == false) {
+ String ssColumn = 'SS_Column_' + lpadI + '__c';
+ String ssApiStr = String.valueOf(JobmpdMapping.get(ssColumn));
+ Job_CategoryMap.put(apiStr,ssApiStr);
+ }
+ }
+ }
+ //20220721 you LLIU-CGH8EY end
+
+ //20220823 you LLIU-CHL8FB start 鏈儴鏄�--solution鏈儴鐨勯�氳繃鏄犲皠锛屾洿鏂扮敤鎴蜂笂鐨� 鏈儴(閫夐」)锛屽鏋滄槸鍏朵粬锛岄偅涔堟甯歌蛋閫昏緫
+ SS_BatchColumnMapping__c DeptMapping = SS_BatchColumnMapping__c.getValues('HR_Category4_To_Dept__c');
+
+ Map<String,String> DeptMap = new Map<String,String>();
+ for (Integer i = 1; i <= 30; i++) {
+ String lpadI = ('00' + i).right(3);
+ String fromColumn = 'From_Column_' + lpadI + '__c';
+ if(DeptMapping!=null){
+ String apiStr = String.valueOf(DeptMapping.get(fromColumn));
+ if (String.isBlank(apiStr) == false) {
+ String ssColumn = 'SS_Column_' + lpadI + '__c';
+ String ssApiStr = String.valueOf(DeptMapping.get(ssColumn));
+ DeptMap.put(apiStr,ssApiStr);
+ }
+ }
+ }
+ //20220823 you LLIU-CHL8FB end
+
+ system.debug(mpdMapping+'==UserAndContactMap=='+UserAndContactMap);
+ //鑾峰彇鑷畾涔夋爣绛撅紝鑷繁瀹氫箟锛岀敤鏉ョ┖鏇存柊鏁版嵁鎴栧鐞嗗巻鍙叉暟鎹�
+ //鍦ㄥ鐞嗗巻鍙茶褰曟椂锛氳亴浣嶅拰鑱岀 濡傛灉ods鐨勫�间负绌猴紝閭d箞user瀵硅薄鐨勮繖涓や釜瀛楁灏变笉闇�瑕佹洿鏂�
+ Integer buffer = Integer.valueOf(System.Label.ODS_Null_Update_Sign);
+ // 鐜版湁鐢ㄦ埛
+ Map<String, User> usrMap = new Map<String, User>();
+ // ContactToUser 銇� 澶夋洿銇椼仧銇� 銇仸鍒ゆ柇銇椼仧闋呯洰銇с仚
+ List<ODS__c> conList = [select id,Alias__c,Branch__c,PositionSubsequence__c,Rank__c,Category3__c,Category4__c,Category5__c,Category6__c,Employee_No__c,Hire_Date__c,FirstName__c,LastName__c,Name__c,Email__c,MobilePhone__c,Post__c,Job_Category__c,Job_Type__c,Product_specialist_incharge_product__c,Sales_Speciality__c,Work_Location__c,Stay_or_not__c,LeaveDate__c,UniqueId__c,Null_Update__c,Salesdepartment__c from ODS__c where Employee_No__c in :userEmployeeNoList];
+
+ List<User> usrList = [select Id, PBI_Enable__c ,PBIAuthorizedSetting__c,Employee_No__c from User where Employee_No__c IN :userEmployeeNoList];
+ for (User usr : usrList) {
+ //usrMap.put(usr.Employee_No__c, usr);
+ //鐢变簬娴嬭瘯鏃讹紝鍙戠幇ods鐨勫憳宸ョ紪鐮佸拰user鐨勫憳宸ョ紪鐮佸ぇ灏忓啓涓嶄竴鑷达紝鎵�鏈夋垜浠湪杩欓噷鎶婂憳宸ョ紪鐮佸叏閮ㄨ浆涓哄皬鍐�
+ //鎵�浠ヤ负浜嗛伩鍏嶄互涓婇棶棰橈紝鎶婂憳宸ョ紪鐮侀兘杞负灏忓啓
+ usrMap.put(usr.Employee_No__c.toLowerCase(), usr);
+ }
+
+ List<User> updateList = new List<User>();
+ List<User> insertList = new List<User>();
+ List<String> updateId = new List<String>();
+ for (ODS__c odsc : conList) {
+ //鐢变簬娴嬭瘯鏃讹紝鍙戠幇ods鐨勫憳宸ョ紪鐮佸拰user鐨勫憳宸ョ紪鐮佸ぇ灏忓啓涓嶄竴鑷达紝鎵�鏈夋垜浠湪杩欓噷鎶婂憳宸ョ紪鐮佸叏閮ㄨ浆涓哄皬鍐�
+ // 鎵�浠ヤ负浜嗛伩鍏嶄互涓婇棶棰橈紝鎶婂憳宸ョ紪鐮侀兘杞负灏忓啓
+ if (usrMap.containsKey(odsc.Employee_No__c.toLowerCase())) {
+ // 鏇存柊鐜版湁鐢ㄦ埛
+ User userData = usrMap.get(odsc.Employee_No__c.toLowerCase());
+
+ userData.Group_sales_dept__c = odsc.Category3__c;//缁熸嫭鏈儴
+ if(String.isNotBlank(odsc.Category4__c)){
+ //20220823 you LLIU-CHL8FB start
+ if(null!=DeptMap && DeptMap.containsKey(odsc.Category4__c)){
+ userData.Dept__c = DeptMap.get(odsc.Category4__c);//鏈儴
+ }else{
+ userData.Dept__c = odsc.Category4__c;//鏈儴
+ }
+ //20220823 you LLIU-CHL8FB end
+ }
+ userData.Category5__c = odsc.Category5__c;//閮�
+ //LLIU-CCS8ZB-褰撴柊鍒涘缓鐨勬椂鍊欐帴鏀朵汉浜嬩俊鎭腑鐨勮淇℃伅锛屼箣鍚庝笉杩涜鏇存柊 thh 20220324 start
+ // userData.Category6__c = odsc.Category6__c;//璇�
+ //LLIU-CCS8ZB-褰撴柊鍒涘缓鐨勬椂鍊欐帴鏀朵汉浜嬩俊鎭腑鐨勮淇℃伅锛屼箣鍚庝笉杩涜鏇存柊 thh 20220324 end
+ //userData.Employee_No__c = odsc.Employee_No__c;//鍛樺伐缂栫爜
+ userData.Hire_Date__c = odsc.Hire_Date__c;//鍏ヨ亴鏃ユ湡
+ //userData.Email = odsc.Email__c;//鐢靛瓙閭欢
+ userData.Mobile_Phone__c = odsc.MobilePhone__c;//鎵嬫満鍙风爜
+ //濡傛灉鑷畾涔夊彉杩佺殑鍊间负1锛岄偅涔堣瘉鏄庣幇鍦ㄦ槸鍦ㄥ鐞嗗巻鍙叉暟鎹紝鑰屽巻鍙叉暟鎹瀹氾紝濡傛灉ods鐨勮亴浣嶄负绌猴紝閭d箞灏变笉闇�瑕佹洿鏂皍ser鐨勮亴绉�
+ //20220425 LLIU-CCY9TA you ods 鐨� 閫氱敤鑱岃 瀵瑰簲鐢ㄦ埛涓婃柊鍒涘缓鐨� HR閫氱敤鑱岀骇 鏂紑璺熻亴浣嶇殑鍏崇郴
+
+ if(String.isNotBlank(odsc.Post__c) || buffer != 1){
+ //userData.Post__c = odsc.Post__c;//鑱屼綅
+ userData.HR_Post__c = odsc.Post__c;//HR閫氱敤鑱岀骇
+ system.debug(odsc.Post__c+'===='+UserAndContactMap.containsKey(odsc.Post__c));
+ if(null!=UserAndContactMap && UserAndContactMap.containsKey(odsc.Post__c)){
+ userData.Post__c = UserAndContactMap.get(odsc.Post__c);
+ }
+ }
+ //20220426 LLIU-CCY9TA you end
+
+ //20220428 LLIU-CDW5ZW you start
+ userData.PositionSubsequence__c = odsc.PositionSubsequence__c;
+ //20220428 LLIU-CDW5ZW you end
+ //20220512 you LLIU-CDW5ZW start
+ userData.Rank__c = odsc.Rank__c;
+ //20220428 you LLIU-CDW5ZW end
+
+ // 20220721 you LLIU-CGH8EY start 娉ㄩ噴锛屼緷鎹湰閮ㄥ拰宀椾綅瀛愬簭鍒� 缁欒亴绉嶈祴鍊�
+ /**
+ String zz = '';
+ if(odsc.Job_Category__c == '鏈嶅姟'){
+ zz = '閿�鍞湇鍔�';
+ }else if(odsc.Job_Category__c == '鎺ㄥ箍'){
+ zz = '閿�鍞帹骞�';
+ }else{
+ zz = odsc.Job_Category__c;
+ }
+ //濡傛灉鑷畾涔夊彉杩佺殑鍊间负1锛岄偅涔堣瘉鏄庣幇鍦ㄦ槸鍦ㄥ鐞嗗巻鍙叉暟鎹紝鑰屽巻鍙叉暟鎹瀹氾紝濡傛灉ods鐨勮亴绉嶄负绌猴紝閭d箞灏变笉闇�瑕佹洿鏂皍ser鐨勮亴绉�
+ if(String.isNotBlank(zz) || buffer != 1){
+ userData.Job_Category__c = zz;//鑱岀
+ }**/
+ String bbz=odsc.Category4__c+'-' +odsc.PositionSubsequence__c; //鏈儴-宀椾綅瀛愬簭鍒�
+ String ldbb=odsc.Salesdepartment__c+'-' +odsc.PositionSubsequence__c; //鍏ぇ鏈儴-宀椾綅瀛愬簭鍒�
+ String bbz1=odsc.Category5__c+'-' +odsc.PositionSubsequence__c; //閮�-宀椾綅瀛愬簭鍒�
+ system.debug(bbz+'==='+ldbb+'==Job_CategoryMap=='+Job_CategoryMap);
+ //鏈儴涓嶇瓑浜庣┖锛岀湅鏈儴
+ String zz = '';
+ if( (String.isNotBlank(odsc.PositionSubsequence__c) && odsc.PositionSubsequence__c=='渚涘簲閾剧鐞�') || ( String.isNotBlank(odsc.Category4__c) && odsc.Category4__c=='鎴樼暐鍒涙柊鏈儴')){
+ zz = '绠$悊';
+ }else if( String.isNotBlank(odsc.Category4__c) && odsc.Category4__c=='Solution鏈儴'){
+ zz = '甯傚満';
+ }else if(String.isNotBlank(odsc.Category4__c)){
+ if(null!=Job_CategoryMap && Job_CategoryMap.containsKey(bbz)){
+ if(Job_CategoryMap.get(bbz) == '鏈嶅姟'){
+ zz = '閿�鍞湇鍔�';
+ }else if(Job_CategoryMap.get(bbz) == '鎺ㄥ箍'){
+ zz = '閿�鍞帹骞�';
+ }else{
+ zz = Job_CategoryMap.get(bbz);
+ }
+ }
+ if(null!=Job_CategoryMap && Job_CategoryMap.containsKey(ldbb)){
+ if(Job_CategoryMap.get(ldbb) == '鏈嶅姟'){
+ zz = '閿�鍞湇鍔�';
+ }else if(Job_CategoryMap.get(ldbb) == '鎺ㄥ箍'){
+ zz = '閿�鍞帹骞�';
+ }else{
+ zz = Job_CategoryMap.get(ldbb);
+ }
+ }
+
+ system.debug('=='+Job_CategoryMap.get(bbz)+'==='+Job_CategoryMap.get(ldbb)+'==='+zz);
+ }else if(String.isBlank(odsc.Category4__c) && String.isNotBlank(odsc.Category5__c)){
+ //鏈儴绛変簬绌猴紝鐪嬮儴
+ if(odsc.Category5__c=='鍗庡寳涓滃寳杩愯惀绠$悊閮�' || odsc.Category5__c=='瑗垮寳瑗垮崡杩愯惀绠$悊閮�' || odsc.Category5__c=='瑗垮寳瑗垮崡杩愯惀鏀彺閮�' || bbz1=='鍗庡寳涓滃寳鏈嶅姟閮�-缁煎悎琛屾斂' || bbz1=='鍗庡寳涓滃寳甯傚満閮�-缁煎悎琛屾斂'){
+ zz = '鏀彺';
+ }else if(bbz1=='鍗庡寳涓滃寳鏈嶅姟閮�-FSE'){
+ zz = '閿�鍞湇鍔�';
+ }else if(odsc.Category5__c=='瑗块儴鎴樼暐鎺ㄨ繘閮�' || bbz1=='鍗庡寳涓滃寳甯傚満閮�-鎺ㄥ箍'){
+ zz = '閿�鍞帹骞�';
+ }
+ }
+ userData.Job_Category__c = zz;
+
+ // 20220721 you LLIU-CGH8EY end
+
+ //userData.Product_specialist_incharge_product__c = odsc.Product_specialist_incharge_product__c;//璐熻矗浜у搧锛堜富锛�
+ //userData.Sales_Speciality__c = odsc.Sales_Speciality__c;//閿�鍞伐浣滃唴瀹�
+ //HR淇℃伅涓婄殑宸ヤ綔鍦版洿鏂板埌鐢ㄦ埛鐨勫伐浣滃湴锛堜汉浜嬶級涓� thh 2022-02-16 start
+ userData.Work_Location_HR__c = odsc.Work_Location__c;
+ //HR淇℃伅涓婄殑宸ヤ綔鍦版洿鏂板埌鐢ㄦ埛鐨勫伐浣滃湴锛堜汉浜嬶級涓� thh 2022-02-16 end
+ userData.Stay_or_not__c = odsc.Stay_or_not__c;//鍦ㄨ亴/宸茬鑱�
+ //鐢变簬user鏈変竴涓獙璇佽鍒欙紝濡傛灉鍊间负宸茬鑱岋紝閭d箞PBI涓嶈兘涓簍rue锛屾墍浠ユ墜鍔ㄨ缃负false锛屽苟鎶奝BI瀵硅薄鐨勫�艰涓篺alse
+ if(userData.Stay_or_not__c == '宸茬鑱�' && userData.PBI_Enable__c){//PBI鏄惁鍚敤
+ userData.PBI_Enable__c = false;
+ updateId.add(userData.id);
+ }
+ userData.Null_Update__c = odsc.Null_Update__c;
+ userData.QuitDate__c = odsc.LeaveDate__c;//绂昏亴鏃ユ湡
+ userData.IsMEBG__c=true;//鏄惁MEBG
+ updateList.add(userData);
+ }else{
+ //濡傛灉娌℃湁鍦╱ser琛ㄤ腑鎵惧埌瀵瑰簲鐨勫憳宸ョ紪鐮侊紝閭d箞鏂板user
+ User userData = new User();
+ userData.Group_sales_dept__c = odsc.Category3__c;//缁熸嫭鏈儴
+ if(String.isNotBlank(odsc.Category4__c)){
+ //20220823 you LLIU-CHL8FB start
+ if(null!=DeptMap && DeptMap.containsKey(odsc.Category4__c)){
+ userData.Dept__c = DeptMap.get(odsc.Category4__c);//鏈儴
+ }else{
+ userData.Dept__c = odsc.Category4__c;//鏈儴
+ }
+ //20220823 you LLIU-CHL8FB end
+ }
+ userData.Category5__c = odsc.Category5__c;//閮�
+ userData.Category6__c = odsc.Category6__c;//璇�
+ userData.Employee_No__c = odsc.Employee_No__c;//鍛樺伐缂栫爜
+ userData.Hire_Date__c = odsc.Hire_Date__c;//鍏ヨ亴鏃ユ湡
+ userData.Email = odsc.Email__c;//鐢靛瓙閭欢,鏂板缓鏃讹紝濉啓鐢靛瓙閭欢
+ userData.Username = '_'+odsc.Email__c;//鐢ㄦ埛鍚�
+ userData.Mobile_Phone__c = odsc.MobilePhone__c;//鎵嬫満鍙风爜
+ //濡傛灉鑷畾涔夊彉杩佺殑鍊间负1锛岄偅涔堣瘉鏄庣幇鍦ㄦ槸鍦ㄥ鐞嗗巻鍙叉暟鎹紝鑰屽巻鍙叉暟鎹瀹氾紝濡傛灉ods鐨勮亴浣嶄负绌猴紝閭d箞灏变笉闇�瑕佹洿鏂皍ser鐨勮亴绉�
+ //20220426 LLIU-CCY9TA you start
+ if(String.isNotBlank(odsc.Post__c) || buffer != 1){
+ //userData.Post__c = odsc.Post__c;//鑱屼綅
+ userData.HR_Post__c = odsc.Post__c;//HR閫氱敤鑱岀骇
+ if(null!=UserAndContactMap && UserAndContactMap.containsKey(odsc.Post__c)){
+ userData.Post__c = UserAndContactMap.get(odsc.Post__c);
+ }
+ }
+ //20220426 LLIU-CCY9TA you end
+
+ //20220428 LLIU-CDW5ZW you start
+ userData.PositionSubsequence__c = odsc.PositionSubsequence__c;
+ //20220428 LLIU-CDW5ZW you end
+ //20220512 you LLIU-CDW5ZW start
+ userData.Rank__c = odsc.Rank__c;
+ //20220428 you LLIU-CDW5ZW end
+ // 20220721 you LLIU-CGH8EY start 娉ㄩ噴锛屼緷鎹湰閮ㄥ拰宀椾綅瀛愬簭鍒� 缁欒亴绉嶈祴鍊�
+ /**
+ String zz = '';
+ if(odsc.Job_Category__c == '鏈嶅姟'){
+ zz = '閿�鍞湇鍔�';
+ }else if(odsc.Job_Category__c == '鎺ㄥ箍'){
+ zz = '閿�鍞帹骞�';
+ }else{
+ zz = odsc.Job_Category__c;
+ }
+ //濡傛灉鑷畾涔夊彉杩佺殑鍊间负1锛岄偅涔堣瘉鏄庣幇鍦ㄦ槸鍦ㄥ鐞嗗巻鍙叉暟鎹紝鑰屽巻鍙叉暟鎹瀹氾紝濡傛灉ods鐨勮亴绉嶄负绌猴紝閭d箞灏变笉闇�瑕佹洿鏂皍ser鐨勮亴绉�
+ if(String.isNotBlank(zz) || buffer != 1){
+ userData.Job_Category__c = zz;//鑱岀
+ }**/
+ String bbz=odsc.Category4__c+'-' +odsc.PositionSubsequence__c; //鏈儴-宀椾綅瀛愬簭鍒�
+ String ldbb=odsc.Salesdepartment__c+'-' +odsc.PositionSubsequence__c; //鍏ぇ鏈儴-宀椾綅瀛愬簭鍒�
+ String bbz1=odsc.Category5__c+'-' +odsc.PositionSubsequence__c; //閮�-宀椾綅瀛愬簭鍒�
+ //鏈儴涓嶇瓑浜庣┖锛岀湅鏈儴
+ String zz = '';
+ if( (String.isNotBlank(odsc.PositionSubsequence__c) && odsc.PositionSubsequence__c=='渚涘簲閾剧鐞�') || ( String.isNotBlank(odsc.Category4__c) && odsc.Category4__c=='鎴樼暐鍒涙柊鏈儴')){
+ zz = '绠$悊';
+ }else if( String.isNotBlank(odsc.Category4__c) && odsc.Category4__c=='Solution鏈儴'){
+ zz = '甯傚満';
+ }else if(String.isNotBlank(odsc.Category4__c)){
+ if(null!=Job_CategoryMap && Job_CategoryMap.containsKey(bbz)){
+ if(Job_CategoryMap.get(bbz) == '鏈嶅姟'){
+ zz = '閿�鍞湇鍔�';
+ }else if(Job_CategoryMap.get(bbz) == '鎺ㄥ箍'){
+ zz = '閿�鍞帹骞�';
+ }else{
+ zz = Job_CategoryMap.get(bbz);
+ }
+ }
+ if(null!=Job_CategoryMap && Job_CategoryMap.containsKey(ldbb)){
+ if(Job_CategoryMap.get(ldbb) == '鏈嶅姟'){
+ zz = '閿�鍞湇鍔�';
+ }else if(Job_CategoryMap.get(ldbb) == '鎺ㄥ箍'){
+ zz = '閿�鍞帹骞�';
+ }else{
+ zz = Job_CategoryMap.get(ldbb);
+ }
+ }
+
+ }else if(String.isBlank(odsc.Category4__c) && String.isNotBlank(odsc.Category5__c)){
+ //鏈儴绛変簬绌猴紝鐪嬮儴 LLIU-CKE3UG 澧炲姞鏄犲皠鍏崇郴
+ if(odsc.Category5__c=='鍗庡寳涓滃寳杩愯惀绠$悊閮�' || odsc.Category5__c=='瑗垮寳瑗垮崡杩愯惀绠$悊閮�' || odsc.Category5__c=='瑗垮寳瑗垮崡杩愯惀鏀彺閮�' || bbz1=='鍗庡寳涓滃寳鏈嶅姟閮�-缁煎悎琛屾斂' || bbz1=='鍗庡寳涓滃寳甯傚満閮�-缁煎悎琛屾斂'){
+ zz = '鏀彺';
+ }else if(bbz1=='鍗庡寳涓滃寳鏈嶅姟閮�-FSE'){
+ zz = '閿�鍞湇鍔�';
+ }else if(odsc.Category5__c=='瑗块儴鎴樼暐鎺ㄨ繘閮�' || bbz1=='鍗庡寳涓滃寳甯傚満閮�-鎺ㄥ箍'){
+ zz = '閿�鍞帹骞�';
+ }
+ }
+ userData.Job_Category__c = zz;
+
+ // 20220721 you LLIU-CGH8EY end
+ userData.Null_Update__c = odsc.Null_Update__c;
+ userData.Product_specialist_incharge_product__c = odsc.Product_specialist_incharge_product__c;//璐熻矗浜у搧锛堜富锛�
+ userData.Sales_Speciality__c = odsc.Sales_Speciality__c;//閿�鍞伐浣滃唴瀹�
+ //濡傛灉鏍规嵁HR淇℃伅鏂板缓鐢ㄦ埛,鍒欐妸HR淇℃伅鐨勫伐浣滃湴浼犵粰鐢ㄦ埛鐨勫伐浣滃湴鍜屽伐浣滃湴锛堜汉浜嬶級 thh 2022-02-16 start
+ userData.Work_Location_HR__c = odsc.Work_Location__c;
+ userData.Work_Location__c = odsc.Work_Location__c;
+ //濡傛灉鏍规嵁HR淇℃伅鏂板缓鐢ㄦ埛,鍒欐妸HR淇℃伅鐨勫伐浣滃湴浼犵粰鐢ㄦ埛鐨勫伐浣滃湴鍜屽伐浣滃湴锛堜汉浜嬶級 thh 2022-02-16 end
+ userData.Stay_or_not__c = odsc.Stay_or_not__c;//鍦ㄨ亴/宸茬鑱�
+ userData.QuitDate__c = odsc.LeaveDate__c;//绂昏亴鏃ユ湡
+ userData.IsMEBG__c=true;//鏄惁MEBG
+ //鐢变簬ods鐨勫鍜屽悕閮芥槸鎷奸煶锛屾墍浠ヨ幏鍙杗ame__c鐨勫�硷紝骞朵笖棣栧瓧姣嶇涓�浣嶄负濮擄紝鍏朵綑涓哄悕
+ if(String.isNotBlank(odsc.Name__c)){
+ if(odsc.Name__c.length() > 1){
+ userData.LastName = odsc.Name__c.substring(0,1);
+ userData.FirstName = odsc.Name__c.substring(1,odsc.Name__c.length());
+ userData.Alias = odsc.Name__c;
+ }
+ }
+ //浠ヤ笅鏄郴缁熼粯璁�
+ userData.FederationIdentifier = odsc.Employee_No__c + '@olympus.com.cn';
+ userData.EmailEncodingKey = 'UTF-8';//鐢靛瓙閭欢缂栫爜
+ userData.IsActive = false;
+ userData.TimeZoneSidKey = 'Asia/Shanghai';//鏃跺尯
+ userData.LocaleSidKey = 'ja_JP';//鍖哄煙
+ userData.LanguageLocaleKey = 'zh_CN';//璇█
+ //userData.DefaultCurrencyIsoCode = 'CNY';//榛樿甯佺 ISO 浠g爜
+ //userData.CurrencyIsoCode = 'CNY';//淇℃伅甯佺
+ //榛樿ods鍒涘缓鐨剈ser鐢ㄦ埛鐨勭畝妗d负 999_鐪嬩笉瑙丳rofile
+ userData.Profileid = '00e10000000dFYJ';
+
+ insertList.add(userData);
+ }
+ }
+
+ //PBI鏁版嵁鏇存柊
+ //鐢变簬user鏈変竴涓獙璇佽鍒欙紝濡傛灉鍊煎彉涓哄凡绂昏亴锛岄偅涔圥BI涓嶈兘涓簍rue锛屾墍浠ユ墜鍔ㄨ缃负false锛屽苟鎶奝BI瀵硅薄鐨勫�艰涓篺alse
+ if(updateId.size() > 0){
+ List<PBIAuthorization__c> pbiUpd = [select id,name,PBI_Enable__c,User__c from PBIAuthorization__c where user__c in :updateId and PBI_Enable__c = true];
+ if(pbiUpd != null && pbiUpd.size() > 0){
+ for(PBIAuthorization__c pc : pbiUpd){
+ pc.PBI_Enable__c = false;
+ }
+ }
+ //棣栧厛鏇存柊 PBI鏉冮檺涓篺alse
+ if(pbiUpd.size() > 0){
+ update pbiUpd;
+ }
+ }
+ if(insertList.size() > 0 || updateList.size() > 0){
+ ID jobId = system.enqueueJob(new UserUpsertQueueable(insertList,updateList));
+ AsyncApexJob jobInfo = [select status,NumberOfErrors from AsyncApexJob where id =:jobId];
+ System.debug('--------------------闃熷垪鏃ュ織'+jobInfo);
+ }
+ }
+ //add wangweipeng 2021/11/18 start
+
+ @future (callout=true)
+ public static void upsertFutureContact(String sessionId, List<Id> userIdList) {
+ HttpRequest req = new HttpRequest();
+ req.setEndpoint(URL.getSalesforceBaseUrl().toExternalForm() + '/services/apexrest/UserToContact');
+System.debug('Endpoint ' + req.getEndpoint());
+ req.setMethod('POST');
+
+ // header
+ String authorizationHeader = 'OAuth ' + sessionId;
+System.debug(authorizationHeader);
+ req.setHeader('Authorization', authorizationHeader);
+
+ // body
+ String restBody = '{"userIdList":' + JSON.serialize(userIdList) + '}';
+System.debug('JSON ' + restBody);
+ req.setBody(restBody);
+
+ // Create a new http object to send the request object
+ Http http = new Http();
+ HTTPResponse res = http.send(req);
+System.debug(res.getBody());
+ }
+
+ public static List<Daily_Report__c> reportSelectById(String id){
+ List<Daily_Report__c> reportList = [select id, name, Reporter__c, Reported_Date__c, Daily_Report_Data_Type__c,
+ Working_Time_From__c, Working_Time_To__c, Status__c, Mail_Send_Check__c,
+ Business_Trip__c, Submit_Date_New__c, Submit_DateTime_New__c, Approved_Date__c,
+ Approved_DateTime__c, CreatedById, Feed_Back_From_Manager__c, FeedbackManager__c,
+ Planning_Time__c, Submission_Elapsed_Hour__c, Approval_Elapsed_Time__c,
+ Activity_ID__c, Manager_Mail__c, Status_With_Check__c
+ from Daily_Report__c where Id = :id];
+ return reportList;
+ }
+
+ public static List<Event> eventSelectByUsers(String soql, List<Date> mdates, List<Id> users) {
+ return Database.query(soql);
+ }
+ public static Map<Id, Daily_Report__c> reportMapSelectByIds(List<Id> ids){
+ Map<Id, Daily_Report__c> reportMap = new Map<Id, Daily_Report__c>([select id, Status__c, Submit_Date_New__c
+ from Daily_Report__c where Id IN :ids]);
+ return reportMap;
+ }
+
+ public static List<Opportunity> oppSelectForPersonTaget(Id rtId, User[] users, String currentPeriod) {
+ Opportunity[] opportunitys = [select
+ Id, OwnerId, Opportunity_Category__c, Proportion__c, CloseDate,
+ Amount, Objective__c, Target_category__c,
+ SAP_Province__c, RecordTypeId, OCM_Target_period__c
+ from Opportunity
+ where Target_category__c = '鎷呭綋鐩爣'
+ and RecordTypeId = :rtId
+ and OwnerId in :users
+ and OCM_Target_period__c = :currentPeriod
+ ];
+ return opportunitys;
+ }
+
+ public static List<Opportunity> oppSelectForLock(List<String> oppIds) {
+ List<Opportunity> opps = [select Id
+ ,Last_Visit_Scheduled_Date__c
+ ,Xin_Last_Follow_Up_Date_For_Report__c, Xin_Gross_Follow_Num__c,Visit_President_Count__c,Visit_Head_Doctor_Count__c,Num_Of_NTC__c
+ // CHAN-BE6CZZ 鏈�鍚庤窡杩涚粨鏋� LHJ 20190724 Start
+ ,Follow_up_comment__c
+ // CHAN-BE6CZZ 鏈�鍚庤窡杩涚粨鏋� LHJ 20190724 End
+ ,Num_Of_OPD__c
+ from Opportunity where Id in :oppIds for update];
+ return opps;
+ }
+
+ public static List<Opportunity> oppSelectForCity(List<String> oppIds) {
+ List<Opportunity> opps = [select Id, Account.Parent.RecordTypeId, Account.Parent.Parent.RecordTypeId, Account.Parent.Parent.City_Master__r.Name, Account.City_Master__r.Name from Opportunity where Id in :oppIds];
+ return opps;
+ }
+
+ public static void updOppList(List<Opportunity> oppUpdateList){
+ if (oppUpdateList != null && oppUpdateList.size() > 0) update oppUpdateList;
+ }
+
+ public static void updOpp(Opportunity opp) {
+ update opp;
+ }
+
+ public static List<Opportunity2__c> opp2SelectForSync(List<String> oppIds) {
+ List<Opportunity2__c> opp2s = [select Id, Opportunity__c from Opportunity2__c where Opportunity__c in :oppIds];
+ return opp2s;
+ }
+
+ public static List<Product2__c> pr2SelectForSync(List<Product2> pr2Ids) {
+ List<Product2__c> pr2s = [select Id, Product2__c from Product2__c where Product2__c in :pr2Ids];
+ return pr2s;
+ }
+
+ public static List<Maintenance_Contract__c> mcSelectForLock(List<String> serviceIds) {
+ List<Maintenance_Contract__c> mcs = [select Id, Xin_Last_Follow_Day__c from Maintenance_Contract__c where Id in :serviceIds for update];
+ return mcs;
+ }
+
+ public static void delEvent1ForTrigger(List<String> conIds) {
+ List<Activity_History_Daily_Report__c> ahdrList = [select Id from Activity_History_Daily_Report__c where Contact__c in :conIds];
+ if (ahdrList.size() > 0) delete ahdrList;
+ }
+
+ public static void delEvent2ForTrigger(List<String> oppIds) {
+ List<Event_Oppotunity__c> eoList = [select Id from Event_Oppotunity__c where Opportunity__c in :oppIds];
+ if (eoList.size() > 0) delete eoList;
+ }
+
+ public static void delEvent3ForTrigger(List<String> mcIds) {
+ List<Event_Service__c> esList = [select Id from Event_Service__c where Service__c in :mcIds];
+ if (esList.size() > 0) delete esList;
+ }
+
+ public static void upsEventC(List<Event__c> acts) {
+ System.debug('Event__c1111' + acts);
+ if(acts.size() > 0) upsert acts;
+ }
+
+ public static void upsEvent(List<Event> acts) {
+ if(acts.size() > 0) upsert acts;
+ }
+
+ public static void delEvent(Set<String> eventCIdSet, Map<Id, Event__c> eventC_eventMap) {
+ // 鍓婇櫎銇欍倠鍓嶃伀銆乨elete_flg銈抰rue銇仚銈�
+ List<Event> delList = [select Id from Event where EventC_ID__c in :eventCIdSet];
+ ControllerUtil.delEventIdSet.addAll((new Map<Id, SObject>(delList)).keySet());
+ if (delList.size() > 0) {
+ delete delList;
+ }
+ // Event__c銇獷vent銇搞伄鍙傜収ID銇屻亗銈�
+ delList = [select Id from Event where Id in :eventC_eventMap.keySet()];
+ ControllerUtil.delEventIdSet.addAll((new Map<Id, SObject>(delList)).keySet());
+ if (delList.size() > 0) {
+ delete delList;
+ }
+ }
+
+ public static void delEventOnly(String Id) {
+ List<Event> delList = [select Id from Event where id = :Id];
+ if (delList.size() > 0) {
+ delete delList;
+ }
+ }
+
+ public static void insSFDelete(List<SFDelete__c> dlist) {
+ if (dlist.size() > 0) insert dList;
+ }
+
+ public static void upsEventC2Event(Map<Id, Event__c> eventCMap, Map<Id, Event__c> eventC_eventMap) {
+ List<Event> unDelList = new List<Event>();
+ List<Event> upsList = new List<Event>();
+ List<Id> updateEIds = new List<Id>();
+ //2021-08-30 mzy SWAG-C5784H 銆愬鎵樸�戜簨浠舵棤娉曞欢鏈� start
+ Set<String> idSet = new Set<String>();
+ //2021-08-30 mzy SWAG-C5784H 銆愬鎵樸�戜簨浠舵棤娉曞欢鏈� end
+ Map<String, String> dupUpdIdMap = new Map<String, String>();
+
+ // 鏃ュ牨鐢婚潰銇嬨倝Event__c銈掓洿鏂般仚銈嬫檪
+ // 鈶燛vent銇獷vent__c銇搞伄鍙傜収ID銇屻亗銈�
+ // IsArchived = false 銈掓潯浠躲伀杩藉姞銇欍倠銇撱仺銇倛銈娿�侊紤骞翠互涓娿伄鍫村悎Event_C銇嬨倝Event銇稿悓鏈熴仐銇俱仜銈擄紒锛�
+ if (eventCMap.keySet().size() > 0) {
+ List<Event> eList = [select Id, EventC_ID__c, IsDeleted from Event where EventC_ID__c in :eventCMap.keySet() and IsArchived = false all rows];
+ if (eList.size() > 0) {
+ for (Event e : eList) {
+ updateEIds.add(e.Id);
+ Event__c ec = eventCMap.get(e.EventC_ID__c);
+System.debug('Event銇獷vent__c銇搞伄鍙傜収ID銇屻亗銈�:::::' + e.Id + ',' + e.EventC_ID__c);
+System.debug('ec.Subject__c:::::'+ec.Subject__c);
+System.debug('ec.StartDateTime__c:::::'+ec.StartDateTime__c);
+System.debug('ec.EndDateTime__c:::::'+ec.EndDateTime__c);
+System.debug('ec.DurationInMinutes:::::' + Integer.valueOf((ec.EndDateTime__c.getTime() - ec.StartDateTime__c.getTime()) / 1000 / 60));
+System.debug('ec.Daily_Report__c:::::'+ec.Daily_Report__c);
+System.debug('ec.Main_Visit_Location__c:::::'+ec.Main_Visit_Location__c);
+System.debug('ec.Activity_Type2__c:::::'+ec.Activity_Type2__c);
+System.debug('ec.Purpose_Type__c:::::'+ec.Purpose_Type__c);
+System.debug('ec.Location__c:::::'+ec.Location__c);
+System.debug('ec.Related_Opportunity1__c:::::'+ec.Related_Opportunity1__c);
+System.debug('ec.Related_Opportunity1_ID__c:::::'+ec.Related_Opportunity1_ID__c);
+System.debug('ec.Related_Service1__c:::::'+ec.Related_Service1__c);
+System.debug('ec.Related_Service1_ID__c:::::'+ec.Related_Service1_ID__c);
+System.debug('ec.whatid__c:::::'+ec.whatid__c);
+ e.Subject = (ec.Subject__c==null||ec.Subject__c=='')?ec.Activity_Purpose__c:ec.Subject__c;
+ e.IsAllDayEvent = false;
+ e.ActivityDateTime = ec.StartDateTime__c;
+ e.StartDateTime = ec.StartDateTime__c;
+ e.EndDateTime = ec.EndDateTime__c;
+ e.DurationInMinutes = Integer.valueOf((ec.EndDateTime__c.getTime() - ec.StartDateTime__c.getTime()) / 1000 / 60);
+ e.Main_Visit_Location__c = ec.Main_Visit_Location__c;
+ e.Activity_Type2__c = ec.Activity_Type2__c;
+ e.Purpose_Type__c = ec.Purpose_Type__c;
+ e.Purpose_TypeFSE__c = ec.Purpose_TypeFSE__c;
+ e.Purpose_TypeEscFSE__c = ec.Purpose_TypeEscFSE__c;
+ e.Location = String.isBlank(ec.Location__c) ? ec.Visitor_Place_Free__c : ec.Location__c;
+ e.Related_Opportunity1__c = ec.Related_Opportunity1__c;
+ e.Related_Opportunity1_ID__c = ec.Related_Opportunity1_ID__c;
+ e.Related_Opportunity2__c = ec.Related_Opportunity2__c;
+ e.Related_Opportunity2_ID__c = ec.Related_Opportunity2_ID__c;
+ e.Related_Opportunity3__c = ec.Related_Opportunity3__c;
+ e.Related_Opportunity3_ID__c = ec.Related_Opportunity3_ID__c;
+ e.Related_Opportunity4__c = ec.Related_Opportunity4__c;
+ e.Related_Opportunity4_ID__c = ec.Related_Opportunity4_ID__c;
+ e.Related_Opportunity5__c = ec.Related_Opportunity5__c;
+ e.Related_Opportunity5_ID__c = ec.Related_Opportunity5_ID__c;
+ e.Related_Service1__c = ec.Related_Service1__c;
+ e.Related_Service1_ID__c = ec.Related_Service1_ID__c;
+ e.Visitor1__c = ec.Visitor1__c;
+ e.Visitor2__c = ec.Visitor2__c;
+ e.Visitor3__c = ec.Visitor3__c;
+ e.Visitor4__c = ec.Visitor4__c;
+ e.Visitor5__c = ec.Visitor5__c;
+ e.Visitor1_ID__c = ec.Visitor1_ID__c;
+ e.Visitor2_ID__c = ec.Visitor2_ID__c;
+ e.Visitor3_ID__c = ec.Visitor3_ID__c;
+ e.Visitor4_ID__c = ec.Visitor4_ID__c;
+ e.Visitor5_ID__c = ec.Visitor5_ID__c;
+ e.Activity_Purpose__c = ec.Activity_Purpose__c;
+ e.Activity_PurposeFSE__c = ec.Activity_PurposeFSE__c;
+ e.Activity_PurposeEscFSE__c = ec.Activity_PurposeEscFSE__c;
+ e.whatid__c = ec.whatid__c;
+ e.EventC_ID__c = ec.Id;
+ e.WhatId = ec.Daily_Report__c;
+ e.IsScheduled__c = ec.IsScheduled__c;
+ e.BeforeActivityDate__c = ec.BeforeActivityDate__c;
+ e.AppCdId__c = ec.AppCdId__c;
+ e.SyncCreatedDate__c = ec.SyncCreatedDate__c;
+ e.WS_flg__c = false;
+ if (e.IsDeleted) {
+System.debug('e.IsDeleted:::::'+e.IsDeleted);
+ unDelList.add(e);
+ }
+ if (ec.Activity_Type2__c == 'Holiday') {
+ e.ShowAs = 'OutOfOffice';
+ }
+ upsList.add(e);
+ eventCMap.remove(e.EventC_ID__c); // 鏇存柊銇椼仧銈傘伄銈扢ap銇嬨倝鍓婇櫎
+ dupUpdIdMap.put(e.Id, e.Id);
+ }
+ }
+ }
+ List<Event__c> ecList = eventCMap.values();
+ // 鈶″弬鐓D銇傘倠銈傘伄銈掗櫎銇勩仸銆佹柊瑕�
+ if (ecList.size() > 0) {
+ List<Event> insE = new List<Event>();
+ for (Event__c ec : ecList) {
+ // Event__c銇獷vent_ID__c銇屻仾銇勩�併仱銇俱倞鏃ュ牨鐢婚潰銇嬨倝浣滄垚銇曘倢銇熸檪
+ if (ec.Event_ID__c == null) {
+System.debug('Event__c銇獷vent_ID__c銇屻仾銇勩�併仱銇俱倞鏃ュ牨鐢婚潰銇嬨倝浣滄垚銇曘倢銇熸檪:::::' + ec.Id);
+System.debug('ec.Subject__c:::::'+ec.Subject__c);
+System.debug('ec.StartDateTime__c:::::'+ec.StartDateTime__c);
+System.debug('ec.EndDateTime__c:::::'+ec.EndDateTime__c);
+System.debug('ec.DurationInMinutes:::::' + Integer.valueOf((ec.EndDateTime__c.getTime() - ec.StartDateTime__c.getTime()) / 1000 / 60));
+System.debug('ec.Daily_Report__c:::::'+ec.Daily_Report__c);
+System.debug('ec.Main_Visit_Location__c:::::'+ec.Main_Visit_Location__c);
+System.debug('ec.Activity_Type2__c:::::'+ec.Activity_Type2__c);
+System.debug('ec.Purpose_Type__c:::::'+ec.Purpose_Type__c);
+System.debug('ec.Location__c:::::'+ec.Location__c);
+System.debug('ec.Related_Opportunity1__c:::::'+ec.Related_Opportunity1__c);
+System.debug('ec.Related_Opportunity1_ID__c:::::'+ec.Related_Opportunity1_ID__c);
+System.debug('ec.Related_Service1__c:::::'+ec.Related_Service1__c);
+System.debug('ec.Related_Service1_ID__c:::::'+ec.Related_Service1_ID__c);
+System.debug('ec.whatid__c:::::'+ec.whatid__c);
+ Event e = new Event(
+ OwnerId = ec.Reporter__c,
+ Subject = (ec.Subject__c==null||ec.Subject__c=='')?ec.Activity_Purpose__c:ec.Subject__c,
+ IsAllDayEvent = false,
+ ActivityDateTime = ec.StartDateTime__c,
+ StartDateTime = ec.StartDateTime__c,
+ EndDateTime = ec.EndDateTime__c,
+ DurationInMinutes = Integer.valueOf((ec.EndDateTime__c.getTime() - ec.StartDateTime__c.getTime()) / 1000 / 60),
+ Main_Visit_Location__c = ec.Main_Visit_Location__c,
+ Activity_Type2__c = ec.Activity_Type2__c,
+ Purpose_Type__c = ec.Purpose_Type__c,
+ Purpose_TypeFSE__c = ec.Purpose_TypeFSE__c,
+ Purpose_TypeEscFSE__c = ec.Purpose_TypeEscFSE__c,
+ Location = String.isBlank(ec.Location__c) ? ec.Visitor_Place_Free__c : ec.Location__c,
+ Related_Opportunity1__c = ec.Related_Opportunity1__c,
+ Related_Opportunity1_ID__c = ec.Related_Opportunity1_ID__c,
+ Related_Opportunity2__c = ec.Related_Opportunity2__c,
+ Related_Opportunity2_ID__c = ec.Related_Opportunity2_ID__c,
+ Related_Opportunity3__c = ec.Related_Opportunity3__c,
+ Related_Opportunity3_ID__c = ec.Related_Opportunity3_ID__c,
+ Related_Opportunity4__c = ec.Related_Opportunity4__c,
+ Related_Opportunity4_ID__c = ec.Related_Opportunity4_ID__c,
+ Related_Opportunity5__c = ec.Related_Opportunity5__c,
+ Related_Opportunity5_ID__c = ec.Related_Opportunity5_ID__c,
+ Related_Service1__c = ec.Related_Service1__c,
+ Related_Service1_ID__c = ec.Related_Service1_ID__c,
+ Visitor1__c = ec.Visitor1__c,
+ Visitor2__c = ec.Visitor2__c,
+ Visitor3__c = ec.Visitor3__c,
+ Visitor4__c = ec.Visitor4__c,
+ Visitor5__c = ec.Visitor5__c,
+ Visitor1_ID__c = ec.Visitor1_ID__c,
+ Visitor2_ID__c = ec.Visitor2_ID__c,
+ Visitor3_ID__c = ec.Visitor3_ID__c,
+ Visitor4_ID__c = ec.Visitor4_ID__c,
+ Visitor5_ID__c = ec.Visitor5_ID__c,
+ Activity_Purpose__c = ec.Activity_Purpose__c,
+ Activity_PurposeFSE__c = ec.Activity_PurposeFSE__c,
+ Activity_PurposeEscFSE__c = ec.Activity_PurposeEscFSE__c,
+ whatid__c = ec.whatid__c,
+ EventC_ID__c = ec.Id,
+ IsScheduled__c = ec.IsScheduled__c,
+ WhatId = ec.Daily_Report__c,
+ BeforeActivityDate__c = ec.BeforeActivityDate__c,
+ AppCdId__c = ec.AppCdId__c,
+ SyncCreatedDate__c = ec.SyncCreatedDate__c,
+ WS_flg__c = false,
+ EventStatus__c = '02 鎺ュ彈'
+ );
+ if (ec.Activity_Type2__c == 'Holiday') {
+ e.ShowAs = 'OutOfOffice';
+ }
+ upsList.add(e);
+ //2021-08-30 mzy SWAG-C5784H 銆愬鎵樸�戜簨浠舵棤娉曞欢鏈� start
+ //鎶ュ憡涓�瑙堟柊寤轰簨浠舵椂,灏嗕簨浠剁殑Id璧嬪�煎埌鎶ュ憡涓�瑙堜笂
+ idSet.add(ec.Id);
+ //2021-08-30 mzy SWAG-C5784H 銆愬鎵樸�戜簨浠舵棤娉曞欢鏈� end
+ } else {
+ // 銈枫兂銉椼儷銇嬨倝閬风Щ銇欍倠鍫村悎銆丒vent_ID__c蹇呫仛銇傘倠銇嬨倝銆併儜銈�
+ }
+ }
+ }
+
+ // Event__c銇獷vent銇搞伄鍙傜収ID銇屻亗銈�
+ if (eventC_eventMap.keySet().size() > 0) {
+ List<Event> eList = [select Id, IsDeleted from Event where Id in :eventC_eventMap.keySet() and IsArchived = false all rows];
+ if (eList.size() > 0) {
+ for (Event e : eList) {
+ if (dupUpdIdMap.containsKey(e.Id)) {
+ continue;
+ }
+ updateEIds.add(e.Id);
+ Event__c ec = eventC_eventMap.get(e.Id);
+System.debug('Event__c銇獷vent銇搞伄鍙傜収ID銇屻亗銈�:::::' + e.Id + ',' + ec.Id);
+System.debug('ec.Subject__c:::::'+ec.Subject__c);
+System.debug('ec.StartDateTime__c:::::'+ec.StartDateTime__c);
+System.debug('ec.EndDateTime__c:::::'+ec.EndDateTime__c);
+System.debug('ec.DurationInMinutes:::::' + Integer.valueOf((ec.EndDateTime__c.getTime() - ec.StartDateTime__c.getTime()) / 1000 / 60));
+System.debug('ec.Daily_Report__c:::::'+ec.Daily_Report__c);
+System.debug('ec.Main_Visit_Location__c:::::'+ec.Main_Visit_Location__c);
+System.debug('ec.Activity_Type2__c:::::'+ec.Activity_Type2__c);
+System.debug('ec.Purpose_Type__c:::::'+ec.Purpose_Type__c);
+System.debug('ec.Location__c:::::'+ec.Location__c);
+System.debug('ec.Related_Opportunity1__c:::::'+ec.Related_Opportunity1__c);
+System.debug('ec.Related_Opportunity1_ID__c:::::'+ec.Related_Opportunity1_ID__c);
+System.debug('ec.Related_Service1__c:::::'+ec.Related_Service1__c);
+System.debug('ec.Related_Service1_ID__c:::::'+ec.Related_Service1_ID__c);
+System.debug('ec.whatid__c:::::'+ec.whatid__c);
+ e.Subject = (ec.Subject__c==null||ec.Subject__c=='')?ec.Activity_Purpose__c:ec.Subject__c;
+ e.IsAllDayEvent = false;
+ e.ActivityDateTime = ec.StartDateTime__c;
+ e.StartDateTime = ec.StartDateTime__c;
+ e.EndDateTime = ec.EndDateTime__c;
+ e.DurationInMinutes = Integer.valueOf((ec.EndDateTime__c.getTime() - ec.StartDateTime__c.getTime()) / 1000 / 60);
+ e.Main_Visit_Location__c = ec.Main_Visit_Location__c;
+ e.Activity_Type2__c = ec.Activity_Type2__c;
+ e.Purpose_Type__c = ec.Purpose_Type__c;
+ e.Purpose_TypeFSE__c = ec.Purpose_TypeFSE__c;
+ e.Purpose_TypeEscFSE__c = ec.Purpose_TypeEscFSE__c;
+ e.Location = String.isBlank(ec.Location__c) ? ec.Visitor_Place_Free__c : ec.Location__c;
+ e.Related_Opportunity1__c = ec.Related_Opportunity1__c;
+ e.Related_Opportunity1_ID__c = ec.Related_Opportunity1_ID__c;
+ e.Related_Opportunity2__c = ec.Related_Opportunity2__c;
+ e.Related_Opportunity2_ID__c = ec.Related_Opportunity2_ID__c;
+ e.Related_Opportunity3__c = ec.Related_Opportunity3__c;
+ e.Related_Opportunity3_ID__c = ec.Related_Opportunity3_ID__c;
+ e.Related_Opportunity4__c = ec.Related_Opportunity4__c;
+ e.Related_Opportunity4_ID__c = ec.Related_Opportunity4_ID__c;
+ e.Related_Opportunity5__c = ec.Related_Opportunity5__c;
+ e.Related_Opportunity5_ID__c = ec.Related_Opportunity5_ID__c;
+ e.Related_Service1__c = ec.Related_Service1__c;
+ e.Related_Service1_ID__c = ec.Related_Service1_ID__c;
+ e.Visitor1__c = ec.Visitor1__c;
+ e.Visitor2__c = ec.Visitor2__c;
+ e.Visitor3__c = ec.Visitor3__c;
+ e.Visitor4__c = ec.Visitor4__c;
+ e.Visitor5__c = ec.Visitor5__c;
+ e.Visitor1_ID__c = ec.Visitor1_ID__c;
+ e.Visitor2_ID__c = ec.Visitor2_ID__c;
+ e.Visitor3_ID__c = ec.Visitor3_ID__c;
+ e.Visitor4_ID__c = ec.Visitor4_ID__c;
+ e.Visitor5_ID__c = ec.Visitor5_ID__c;
+ e.Activity_Purpose__c = ec.Activity_Purpose__c;
+ e.Activity_PurposeFSE__c = ec.Activity_PurposeFSE__c;
+ e.Activity_PurposeEscFSE__c = ec.Activity_PurposeEscFSE__c;
+ e.whatid__c = ec.whatid__c;
+ e.EventC_ID__c = ec.Id;
+ e.IsScheduled__c = ec.IsScheduled__c;
+ e.WhatId = ec.Daily_Report__c;
+ e.BeforeActivityDate__c = ec.BeforeActivityDate__c;
+ e.AppCdId__c = ec.AppCdId__c;
+ e.SyncCreatedDate__c = ec.SyncCreatedDate__c;
+ e.WS_flg__c = false;
+ if (e.IsDeleted) {
+System.debug('e.IsDeleted:::::'+e.IsDeleted);
+ unDelList.add(e);
+ }
+ if (ec.Activity_Type2__c == 'Holiday') {
+ e.ShowAs = 'OutOfOffice';
+ }
+ upsList.add(e);
+ }
+ }
+ }
+ StaticParameter.NotUpdEventCFlg = true;
+ if (unDelList.size() > 0) undelete unDelList;
+ if (upsList.size() > 0) {
+ List<Event> eList = [select EventC_ID__c, IsDeleted, Related_Opportunity1_ID__c,WhatId, WhoID from Event where Id in :updateEIds and IsArchived = false for update];
+System.debug('upsert 鐩村墠 start');
+ for (Event e : eList) {
+System.debug('e.Id:::::'+e.Id);
+System.debug('e.EventC_ID__c:::::'+e.EventC_ID__c);
+System.debug('e.IsDeleted:::::'+e.IsDeleted);
+System.debug('e.Related_Opportunity1_ID__c:::::'+e.Related_Opportunity1_ID__c);
+System.debug('e.WhatId:::::'+e.WhatId);
+System.debug('e.WhoID:::::'+e.WhoID);
+ }
+System.debug('upsert 鐩村墠 end');
+ upsert upsList;
+ //2021-08-30 mzy SWAG-C5784H 銆愬鎵樸�戜簨浠舵棤娉曞欢鏈� start
+ //鏍规嵁IdSet 缁欐姤鍛婁竴瑙堢殑浜嬩欢Id璧嬪��
+ List<Event__c> needUpdateEvent = new List<Event__c>();
+ for(event e :upsList){
+ if( IdSet.contains(e.EventC_ID__c) ){
+ Event__c ec = new Event__c();
+ ec.Id = e.EventC_ID__c;
+ ec.Event_ID__c = e.Id;
+ needUpdateEvent.add(ec);
+ }
+ }
+
+ if(needUpdateEvent.size()>0){
+ update needUpdateEvent;
+ }
+ //2021-08-30 mzy SWAG-C5784H 銆愬鎵樸�戜簨浠舵棤娉曞欢鏈� start
+
+ }
+ }
+
+ public static void eventDelIns(Set<Id> actDelListForDelIns,
+ List<Activity_History_Daily_Report__c> ahdrUpSertList, List<Event_Oppotunity__c> eoUpSertList,List<Event_Service__c> esUpSertList){
+ // 鍙栧紩鍏堣铂浠昏�呫�佸紩鍚堛�併偟銉笺儞銈瑰绱勩伄娲诲嫊銇� delete insert 銇欍倠
+ List<Activity_History_Daily_Report__c> ahdrDelList = [select id from Activity_History_Daily_Report__c where EventC_ID__c =:actDelListForDelIns ];
+ List<Event_Oppotunity__c> eoDelList = [select id from Event_Oppotunity__c where EventC_ID__c =:actDelListForDelIns ];
+ List<Event_Service__c> esDelList = [select id from Event_Service__c where EventC_ID__c =:actDelListForDelIns ];
+
+ if(ahdrDelList.size() > 0){
+ delete ahdrDelList;
+ }
+ if(eoDelList.size() > 0){
+ delete eoDelList;
+ }
+ if(esDelList.size() > 0){
+ delete esDelList;
+ }
+ if(ahdrUpSertList.size() > 0){
+ insert ahdrUpSertList;
+ }
+ if(eoUpSertList.size() > 0){
+ insert eoUpSertList;
+ }
+ if(esUpSertList.size() > 0){
+ insert esUpSertList;
+ }
+ }
+
+ public static void eventDel(String delId){
+ List<Event__c> ecList = [select id from Event__c where Id =:delId];
+ if(ecList.size() > 0){
+ delete ecList;
+ }
+
+ List<Report__c> rList = [select id, Delete_Flg__c from Report__c where Event_Id__c =:delId];
+ if(rList.size() > 0){
+ delete rList;
+ }
+
+ List<Visit_Report__c> vrList = [select id, Delete_Flg__c from Visit_Report__c where Event_Id__c =:delId];
+ if(vrList.size() > 0){
+ delete vrList;
+ }
+
+ List<QIS_Report__c> qrList = [select id from QIS_Report__c where Event_Id__c =:delId];
+ if(qrList.size() > 0){
+ delete qrList;
+ }
+
+ List<Activity_History_Daily_Report__c> e1List = [select id from Activity_History_Daily_Report__c where EventC_Id__c =:delId];
+ if(e1List.size() > 0){
+ delete e1List;
+ }
+
+ List<Event_Oppotunity__c> e2List = [select id from Event_Oppotunity__c where EventC_Id__c =:delId];
+ if(e2List.size() > 0){
+ delete e2List;
+ }
+
+ List<Event_Service__c> e3List = [select id from Event_Service__c where EventC_Id__c =:delId];
+ if(e3List.size() > 0){
+ delete e3List;
+ }
+ }
+
+ public static void insOpp2List(List<Opportunity2__c> opp2List){
+ if (opp2List != null && opp2List.size() > 0) insert opp2List;
+ }
+ public static void updOpp2List(List<Opportunity2__c> opp2List){
+ if (opp2List != null && opp2List.size() > 0) update opp2List;
+ }
+ public static void delOpp2List(List<Opportunity2__c> opp2List){
+ if (opp2List != null && opp2List.size() > 0) delete opp2List;
+ }
+
+ public static void insPr2List(List<Product2__c> pr2List){
+ if (pr2List != null && pr2List.size() > 0) insert pr2List;
+ }
+ public static void updelPr2List(List<Product2__c> updPr2List, List<Product2__c> delPr2List){
+ if (updPr2List != null && updPr2List.size() > 0) update updPr2List;
+ if (delPr2List != null && delPr2List.size() > 0) delete delPr2List;
+ }
+ public static void delPr2List(List<Product2__c> pr2List){
+ if (pr2List != null && pr2List.size() > 0) delete pr2List;
+ }
+
+ public static void insMBAccountList(List<MB_Account__c> mbaccList){
+ if (mbaccList != null && mbaccList.size() > 0) insert mbaccList;
+ }
+ public static void delMBAccountList(List<Account> accountIds){
+ List<MB_Account__c> mbaccs = [select Id, Account__c from MB_Account__c where Account__c in :accountIds];
+ if (mbaccs != null && mbaccs.size() > 0) delete mbaccs;
+ }
+
+ public static void updMBAccountList(List<Account> accountIds){
+ List<MB_Account__c> mbaccs = [select Id, Account__r.HP_146POCM_Category_From_Dept__c, Account__r.Province_formula__c, Account__r.Department_Class_Name__c from MB_Account__c where Account__c in :accountIds];
+ if (mbaccs.size() > 0) {
+ for (MB_Account__c mbacc : mbaccs) {
+ mbacc.Opp_OCM_text__c = mbacc.Account__r.HP_146POCM_Category_From_Dept__c;
+ mbacc.State_Text__c = mbacc.Account__r.Province_formula__c;
+ mbacc.Opportunity_Category_text__c = mbacc.Account__r.Department_Class_Name__c;
+ }
+ update mbaccs;
+ }
+ }
+
+ // 瑷虹檪绉戦厤涓嬨伄MB銉嗐兗銉栥儷銈掓洿鏂�
+ public static void updMBChildFromDpt(Map<Id, Account> accDptMap) {
+ if (accDptMap.keySet().size() == 0) return;
+ List<MB_Repair__c> mbRepList = [Select Id, Repair__r.Account__c from MB_Repair__c where Repair__r.Account__c IN :accDptMap.keySet()];
+ if (mbRepList.size() > 0) {
+ for (MB_Repair__c mb : mbRepList) {
+ mb.Opp_OCM_text__c = accDptMap.get(mb.Repair__r.Account__c).OCM_Category__c;
+ mb.State_Text__c = accDptMap.get(mb.Repair__r.Account__c).State_Text__c;
+ mb.Opportunity_Category_text__c = accDptMap.get(mb.Repair__r.Account__c).Department_Class_Name__c;
+ }
+ update mbRepList;
+ }
+ List<MB_Event__c> mbEvtList = [Select Id, Event__r.Account_ID__c from MB_Event__c where Event__r.Account_ID__c IN :accDptMap.keySet()];
+ if (mbEvtList.size() > 0) {
+ for (MB_Event__c mb : mbEvtList) {
+ mb.Opp_OCM_text__c = accDptMap.get(mb.Event__r.Account_ID__c).OCM_Category__c;
+ mb.State_Text__c = accDptMap.get(mb.Event__r.Account_ID__c).State_Text__c;
+ mb.Opportunity_Category_text__c = accDptMap.get(mb.Event__r.Account_ID__c).Department_Class_Name__c;
+ }
+ update mbEvtList;
+ }
+ List<MB_Report__c> mbRptList = [Select Id, Report__r.Hospital_Department__c from MB_Report__c where Report__r.Hospital_Department__c IN :accDptMap.keySet()];
+ if (mbRptList.size() > 0) {
+ for (MB_Report__c mb : mbRptList) {
+ mb.Opp_OCM_text__c = accDptMap.get(mb.Report__r.Hospital_Department__c).OCM_Category__c;
+ mb.State_Text__c = accDptMap.get(mb.Report__r.Hospital_Department__c).State_Text__c;
+ mb.Opportunity_Category_text__c = accDptMap.get(mb.Report__r.Hospital_Department__c).Department_Class_Name__c;
+ }
+ update mbRptList;
+ }
+ List<MB_Maintenance_Contract__c> mbmcList = [Select Id, Maintenance_Contract__r.Department__c from MB_Maintenance_Contract__c where Maintenance_Contract__r.Department__c IN :accDptMap.keySet()];
+ if (mbmcList.size() > 0) {
+ for (MB_Maintenance_Contract__c mb : mbmcList) {
+ mb.Opp_OCM_text__c = accDptMap.get(mb.Maintenance_Contract__r.Department__c).OCM_Category__c;
+ mb.State_Text__c = accDptMap.get(mb.Maintenance_Contract__r.Department__c).State_Text__c;
+ mb.Opportunity_Category_text__c = accDptMap.get(mb.Maintenance_Contract__r.Department__c).Department_Class_Name__c;
+ }
+ update mbmcList;
+ }
+ List<MB_Asset__c> mbAstList = [Select Id, Asset__r.AccountId from MB_Asset__c where Asset__r.AccountId IN :accDptMap.keySet()];
+ if (mbAstList.size() > 0) {
+ for (MB_Asset__c mb : mbAstList) {
+ mb.Opp_OCM_text__c = accDptMap.get(mb.Asset__r.AccountId).OCM_Category__c;
+ mb.State_Text__c = accDptMap.get(mb.Asset__r.AccountId).State_Text__c;
+ mb.Opportunity_Category_text__c = accDptMap.get(mb.Asset__r.AccountId).Department_Class_Name__c;
+ }
+ update mbAstList;
+ }
+ // 鍟嗚珖銆佸晢璜囧晢鍝併�佹敞娈嬨伀銇ゃ亜銇︺�丱CM_Category__c 銇岄仌銇嗗牬鍚堛伄銇� 鏇存柊瀵捐薄
+ List<MB_Opportunity__c> mboppList = [Select Id, Opportunity__r.AccountId from MB_Opportunity__c where OCM_IsSame__c = false and Opportunity__r.AccountId IN :accDptMap.keySet()];
+ if (mboppList.size() > 0) {
+ for (MB_Opportunity__c mb : mboppList) {
+ mb.Opp_OCM_text__c = accDptMap.get(mb.Opportunity__r.AccountId).OCM_Category__c;
+ }
+ update mboppList;
+ }
+ List<MB_OpportunityLineItem__c> mbOliList = [Select Id, Opportunity__r.AccountId from MB_OpportunityLineItem__c where OCM_IsSame__c = false and Opportunity__r.AccountId IN :accDptMap.keySet()];
+ if (mbOliList.size() > 0) {
+ for (MB_OpportunityLineItem__c mb : mbOliList) {
+ mb.Opp_OCM_text__c = accDptMap.get(mb.Opportunity__r.AccountId).OCM_Category__c;
+ }
+ update mbOliList;
+ }
+ List<MB_Statu_Achievements__c> mbSAList = [Select Id, Statu_Achievements__r.Opportunity__r.AccountId from MB_Statu_Achievements__c where OCM_IsSame__c = false and Statu_Achievements__r.Opportunity__r.AccountId IN :accDptMap.keySet()];
+ if (mbSAList.size() > 0) {
+ for (MB_Statu_Achievements__c mb : mbSAList) {
+ mb.Opp_OCM_text__c = accDptMap.get(mb.Statu_Achievements__r.Opportunity__r.AccountId).OCM_Category__c;
+ }
+ update mbSAList;
+ }
+ }
+ public static void updMBChildFromOpp(Map<Id, Opportunity> oppMap) {
+ if (oppMap.keySet().size() == 0) return;
+ List<MB_Opportunity__c> mboppList = [Select Id, Opportunity__c from MB_Opportunity__c where Opportunity__c IN :oppMap.keySet()];
+ if (mboppList.size() > 0) {
+ for (MB_Opportunity__c mb : mboppList) {
+ mb.State_Text__c = oppMap.get(mb.Opportunity__c).SaleProvince_SAP__c;
+ mb.Opportunity_Category_text__c = oppMap.get(mb.Opportunity__c).Opportunity_Category__c;
+ mb.Distributor_InCharge_opp__c = oppMap.get(mb.Opportunity__c).Distributor_InCharge_opp__c;
+ mb.Group_purchase_PCL__c = oppMap.get(mb.Opportunity__c).Group_purchase_PCL__c;
+ }
+ update mboppList;
+ }
+ List<MB_OpportunityLineItem__c> mbOliList = [Select Id, Opportunity__c from MB_OpportunityLineItem__c where Opportunity__c IN :oppMap.keySet()];
+ if (mbOliList.size() > 0) {
+ for (MB_OpportunityLineItem__c mb : mbOliList) {
+ mb.State_Text__c = oppMap.get(mb.Opportunity__c).SaleProvince_SAP__c;
+ mb.Opportunity_Category_text__c = oppMap.get(mb.Opportunity__c).Opportunity_Category__c;
+ mb.Distributor_InCharge_opp__c = oppMap.get(mb.Opportunity__c).Distributor_InCharge_opp__c;
+ mb.Group_purchase_PCL__c = oppMap.get(mb.Opportunity__c).Group_purchase_PCL__c;
+ }
+ update mbOliList;
+ }
+ List<MB_Statu_Achievements__c> mbSAList = [Select Id, Statu_Achievements__r.Opportunity__c from MB_Statu_Achievements__c where Statu_Achievements__r.Opportunity__c IN :oppMap.keySet()];
+ if (mbSAList.size() > 0) {
+ for (MB_Statu_Achievements__c mb : mbSAList) {
+ mb.State_Text__c = oppMap.get(mb.Statu_Achievements__r.Opportunity__c).SaleProvince_SAP__c;
+ mb.Opportunity_Category_text__c = oppMap.get(mb.Statu_Achievements__r.Opportunity__c).Opportunity_Category__c;
+ mb.Distributor_InCharge_opp__c = oppMap.get(mb.Statu_Achievements__r.Opportunity__c).Distributor_InCharge_opp__c;
+// mb.Group_purchase_PCL__c = oppMap.get(mb.Statu_Achievements__r.Opportunity__c).Group_purchase_PCL__c;
+ }
+ update mbSAList;
+ }
+ }
+ public static void updMBChildFromUser(Map<Id, User> userMap) {
+ // 鐩銇仱銇勩仸銆侀亱鐢ㄥ伌銇с�佺洰妯欑敾闈€伀銇﹀啀淇濆瓨銇欍倠銇撱仺
+ if (userMap.keySet().size() == 0) return;
+ List<MB_Daily_Report__c> mbDRList = [Select Id, Daily_Report__r.Reporter__c from MB_Daily_Report__c where Daily_Report__r.Reporter__c IN :userMap.keySet()];
+ if (mbDRList.size() > 0) {
+ for (MB_Daily_Report__c mb : mbDRList) {
+ mb.State_Text__c = userMap.get(mb.Daily_Report__r.Reporter__c).Province__c;
+ }
+ update mbDRList;
+ }
+ List<MB_Event__c> mbEvtList = [Select Id, Event__r.Daily_Report__r.Reporter__c from MB_Event__c where Event__r.Hospital_ID__c = null and Event__r.Daily_Report__r.Reporter__c IN :userMap.keySet()];
+ if (mbEvtList.size() > 0) {
+ for (MB_Event__c mb : mbEvtList) {
+ mb.State_Text__c = userMap.get(mb.Event__r.Daily_Report__r.Reporter__c).Province__c;
+ }
+ update mbEvtList;
+ }
+ }
+ public static void upUserFederationIdentifier(List<User> userList) {
+ update userList;
+ }
+
+ public static void insMBStatuAchievementList(List<MB_Statu_Achievements__c> ins_mbs){
+ if (ins_mbs != null && ins_mbs.size() > 0) insert ins_mbs;
+ }
+ public static void delMBStatuAchievementList(List<Statu_Achievements__c> del_parents){
+ List<MB_Statu_Achievements__c> mbSAList = [select Id, Statu_Achievements__c from MB_Statu_Achievements__c where Statu_Achievements__c in :del_parents];
+ if (mbSAList != null && mbSAList.size() > 0) delete mbSAList;
+ }
+
+ public static void insMBRepairList(List<MB_Repair__c> mbrepairList){
+ if (mbrepairList != null && mbrepairList.size() > 0) insert mbrepairList;
+ }
+ public static void delMBRepairList(List<Repair__c> del_parents){
+ List<MB_Repair__c> mbrepairList = [select Id, Repair__c from MB_Repair__c where Repair__c in :del_parents];
+ if (mbrepairList != null && mbrepairList.size() > 0) delete mbrepairList;
+ }
+
+ public static void insMBEventList(List<MB_Event__c> mbeventList){
+ if (mbeventList != null && mbeventList.size() > 0) insert mbeventList;
+ }
+ public static void delMBEventList(List<Event__c> del_parents){
+ List<MB_Event__c> mbeventList = [select Id, Event__c from MB_Event__c where Event__c in :del_parents];
+ if (mbeventList != null && mbeventList.size() > 0) delete mbeventList;
+ }
+
+ public static void insMBReportList(List<MB_Report__c> mbreportList){
+ if (mbreportList != null && mbreportList.size() > 0) insert mbreportList;
+ }
+ public static void delMBReportList(List<Report__c> del_parents){
+ List<MB_Report__c> mbreportList = [select Id, Report__c from MB_Report__c where Report__c in :del_parents];
+ if (mbreportList != null && mbreportList.size() > 0) delete mbreportList;
+ }
+
+ public static void insMBDRList(List<MB_Daily_Report__c> mbdrList){
+ if (mbdrList != null && mbdrList.size() > 0) insert mbdrList;
+ }
+ public static void delMBDRList(List<Daily_Report__c> del_parents){
+ List<MB_Daily_Report__c> mbdrList = [select Id, Daily_Report__c from MB_Daily_Report__c where Daily_Report__c in :del_parents];
+ if (mbdrList != null && mbdrList.size() > 0) delete mbdrList;
+ }
+
+ public static void insMBMCList(List<MB_Maintenance_Contract__c> mbmcList){
+ if (mbmcList != null && mbmcList.size() > 0) insert mbmcList;
+ }
+ public static void delMBMCList(List<Maintenance_Contract__c> del_parents){
+ List<MB_Maintenance_Contract__c> mbmcList = [select Id, Maintenance_Contract__c from MB_Maintenance_Contract__c where Maintenance_Contract__c in :del_parents];
+ if (mbmcList != null && mbmcList.size() > 0) delete mbmcList;
+ }
+
+ public static void insMBTgtList(List<MB_Target__c> mbtgtList){
+ if (mbtgtList != null && mbtgtList.size() > 0) insert mbtgtList;
+ }
+ public static void delMBTgtList(List<Opportunity> del_parents){
+ List<MB_Target__c> mbtgtList = [select Id, Opportunity__c from MB_Target__c where Opportunity__c in :del_parents];
+ if (mbtgtList != null && mbtgtList.size() > 0) delete mbtgtList;
+ }
+ public static void insMBOppList(List<MB_Opportunity__c> mboppList){
+ if (mboppList != null && mboppList.size() > 0) insert mboppList;
+ }
+ public static void delMBOppList(List<Opportunity> del_parents){
+ List<MB_Opportunity__c> mboppList = [select Id, Opportunity__c from MB_Opportunity__c where Opportunity__c in :del_parents];
+ if (mboppList != null && mboppList.size() > 0) delete mboppList;
+ }
+
+ public static void insMBTgtLineItemList(List<MB_TargetLineItem__c> mbTliList){
+ if (mbTliList != null && mbTliList.size() > 0) insert mbTliList;
+ }
+ public static void delMBTgtLineItemList(List<String> del_parentIds){
+ List<MB_TargetLineItem__c> mbTliList = [select Id, Opportunity__c from MB_TargetLineItem__c where OpportunityLineItemId__c in :del_parentIds];
+ if (mbTliList != null && mbTliList.size() > 0) delete mbTliList;
+ }
+ public static void insMBOppLineItemList(List<MB_OpportunityLineItem__c> mbOliList){
+ if (mbOliList != null && mbOliList.size() > 0) insert mbOliList;
+ }
+ public static void delMBOppLineItemList(List<String> del_parentIds){
+ List<MB_OpportunityLineItem__c> mbOliList = [select Id, Opportunity__c from MB_OpportunityLineItem__c where OpportunityLineItemId__c in :del_parentIds];
+ if (mbOliList != null && mbOliList.size() > 0) delete mbOliList;
+ }
+
+ public static void insMBAssetList(List<MB_Asset__c> mbassList){
+ if (mbassList != null && mbassList.size() > 0) insert mbassList;
+ }
+ public static void delMBAssetList(List<Asset> del_parentIds) {
+ List<MB_Asset__c> mbassList = [select Id, Asset__c from MB_Asset__c where Asset__c in :del_parentIds];
+ if (mbassList != null && mbassList.size() > 0) delete mbassList;
+ }
+
+ public static void updDailyReport(Daily_Report__c report) {
+ System.debug('Daily_Report__c11111' + report);
+ update report;
+ }
+
+ public static void updMcList(List<Maintenance_Contract__c> mcs) {
+ update mcs;
+ }
+
+ public static void updQuote(Quote quo) {
+ update quo;
+ }
+
+ public static void delOppLine(List<OpportunityLineItem> ols) {
+ delete ols;
+ }
+
+ public static void insOppLine(List<OpportunityLineItem> ols) {
+ insert ols;
+ }
+
+ public static void updateMaintenance_Contract_Estimate(List<Maintenance_Contract_Estimate__c> mces) {
+ update mces;
+ }
+ public static void deleteMaintenance_Contract_Asset_Estimate(List<Maintenance_Contract_Asset_Estimate__c> mcaes) {
+ delete mcaes;
+ }
+ public static void insertMaintenance_Contract_Asset_Estimate(List<Maintenance_Contract_Asset_Estimate__c> mcaes) {
+ insert mcaes;
+ }
+
+ public static void insMaterialFor(List<Material_For__c> mfList) {
+ if (mfList != null && mfList.size() > 0) insert mfList;
+ }
+
+ public static void insProDocMidTbl(List<Product_and_document_middle_table__c> pdmtList) {
+ if (pdmtList != null && pdmtList.size() > 0) insert pdmtList;
+ }
+
+ public static void insCicProMidTbl(List<CIC_case_and_product_middle_table__c> cpmtList) {
+ if (cpmtList != null && cpmtList.size() > 0) insert cpmtList;
+ }
+
+ public static void delMaterialFor(String materialId, List<String> productIds) {
+ List<Material_For__c> dels = [select Id from Material_For__c where Material__c = :materialId and Product__c in :productIds];
+ if (dels.size() > 0) delete dels;
+ }
+
+ public static void delProDocMidTbl(String proDocId, List<String> productIds) {
+ List<Product_and_document_middle_table__c> dels = [select Id from Product_and_document_middle_table__c where Product_document__c = :proDocId and Product_name__c in :productIds];
+ if (dels.size() > 0) delete dels;
+ }
+
+ public static void delCicProMidTbl(String cicProId, List<String> productIds) {
+ List<CIC_case_and_product_middle_table__c> dels = [select Id from CIC_case_and_product_middle_table__c where CIC__c = :cicProId and Product__c in :productIds];
+ if (dels.size() > 0) delete dels;
+ }
+
+//bp2
+// // 澶囧搧鐢�
+// public static void updEquipmentSetList(List<Equipment_Set__c> esList) {
+// if (esList != null && esList.size() > 0) update esList;
+// }
+// public static void updEquipmentSet(Equipment_Set__c es) {
+// if (es != null) update es;
+//// }
+//bp2
+// public static void setEquipmentSetProvisionFlg(Set<Id> esIds) {
+// // 鍌欏搧Set銇ㄨ哺鍑哄倷鍝丼et涓�瑕с伄涓诲緭闁總銈掕В闄ゃ仐銇熴仧銈併�併亾銇嗐仐銇﹀倷鍝丼et銇哺鍑哄倷鍝丼et涓�瑕с伄浠舵暟銈掕▓绠椼仚銈嬨仐銇嬨仾銇�
+// // 浠舵暟锛�0锛氥�屽紩褰撴笀銆嶃儠銉┿偘锛漈rue銆併仹銇亼銈屻伆False
+// AggregateResult[] ars = [select Count(Id) cnt, Equipment_Set__c from Rental_Apply_Equipment_Set__c where Equipment_Set__c in :esIds and RAES_Status__c != '涓婃灦瀹屼簡'and RAES_Status__c != '鍙栨秷鍒嗛厤' group by Equipment_Set__c];
+// List<Equipment_Set__c> esList = new List<Equipment_Set__c>();
+// for (AggregateResult ar : ars) {
+// Equipment_Set__c es = new Equipment_Set__c();
+// // 銉偝銉笺儔銇傘倠
+// if (esIds.contains(String.valueOf(ar.get('Equipment_Set__c')))) {
+// esList.add(new Equipment_Set__c(
+// Id = String.valueOf(ar.get('Equipment_Set__c')),
+// Provision_finish__c = true
+// ));
+// esIds.remove((Id)String.valueOf(ar.get('Equipment_Set__c')));
+// }
+// }
+// if (esIds.size() > 0) {
+// for (Id id : esIds) {
+// esList.add(new Equipment_Set__c(
+// Id = id,
+// Provision_finish__c = false
+// ));
+// }
+// }
+// update esList;
+// }
+//bp2
+// public static Equipment_Set__c setEquipmentSetProvisionFlg(Equipment_Set__c es) {
+// // 鑷垎銇屻�屼笂鏋跺畬浜嗐�嶃伀銇倠銇伅銆併仢銇緦銉堛儶銈仹銈勩倞銇俱仚銇嬨倝銆併亾銇撱伅鑷垎銇甀d銈掓姕銇戙仸銆佽嚜鍒嗕互澶栥伄涓�瑕с伅銆屼笂鏋跺畬浜嗐�嶃仹銇傘倠銇嬨倰鍒ゆ柇
+// List<Rental_Apply_Equipment_Set__c> raeslist = [select Id from Rental_Apply_Equipment_Set__c where Equipment_Set__c = :es.Id and Id != :es.Last_Reserve_Rental_Apply_Equipment_Set__c and RAES_Status__c != '涓婃灦瀹屼簡'and RAES_Status__c != '鍙栨秷鍒嗛厤'];
+// if (raeslist.size() == 0) {
+// es.Provision_finish__c = false;
+// }
+// return es;
+// }
+
+//bp2 // 澶囧搧Set鍥炲簱寰屻�併伝銇嬨伄鍊熷嚭澶囧搧Set涓�瑙堛倰閫氱煡
+// public static void informOtherRAES(Id esId, Id lastRAESId) {
+// List<Rental_Apply_Equipment_Set__c> raesList = [select Id, Re_Inform_Mail__c from Rental_Apply_Equipment_Set__c where Equipment_Set__c = :esId and Id != :lastRAESId order by Rental_Start_Date__c];
+// if (raesList.size() > 0) {
+// raesList[0].Re_Inform_Mail__c = (raesList[0].Re_Inform_Mail__c == null || raesList[0].Re_Inform_Mail__c == '0') ? '1' : '0';
+// update raesList[0];
+// }
+// }
+
+//bp2
+// public static void insEquipmentSetDetail(List<Equipment_Set_Detail__c> esdList) {
+// if (esdList != null && esdList.size() > 0) insert esdList;
+// }
+// public static void updEquipmentSetDetail(List<Equipment_Set_Detail__c> esdList) {
+// if (esdList != null && esdList.size() > 0) update esdList;
+// }
+// public static void delEquipmentSetDetail(List<Equipment_Set_Detail__c> esdList) {
+// if (esdList != null && esdList.size() > 0) delete esdList;
+// }
+
+ public static void insRentalApply(Rental_Apply__c ra) {
+ if (ra != null) insert ra;
+ }
+ public static void updRentalApply(Rental_Apply__c ra) {
+ if (ra != null) update ra;
+ }
+ public static void updRentalApplyList(List<Rental_Apply__c> ra) {
+ if (ra.size() > 0) update ra;
+ }
+ public static void insRentalApplyEquipmentSet(List<Rental_Apply_Equipment_Set__c> raesList) {
+ if (raesList != null && raesList.size() > 0) insert raesList;
+ }
+ public static void delRentalApplyEquipmentSet(List<Rental_Apply_Equipment_Set__c> raesList) {
+ if (raesList != null && raesList.size() > 0) delete raesList;
+ }
+ public static void delConsumableAccessoriesInvoiceSet(List<Consumable_accessories_invoice__c> raesList) {
+ if (raesList != null && raesList.size() > 0) delete raesList;
+ }
+
+////bp2
+// public static void RAESDetailRollup(List<Id> raesIds) {
+// Map<Id, AggregateResult> allCntAr = new Map<Id, AggregateResult>([
+// select count(Id) Cnt_Id, Rental_Apply_Equipment_Set__c Id
+// from Rental_Apply_Equipment_Set_Detail__c
+// where Rental_Apply_Equipment_Set__c in : raesIds
+// group by Rental_Apply_Equipment_Set__c
+// ]);
+// Map<Id, AggregateResult> cliCntAr = new Map<Id, AggregateResult>([
+// select count(Id) Cnt_Id, Rental_Apply_Equipment_Set__c Id
+// from Rental_Apply_Equipment_Set_Detail__c
+// where Rental_Apply_Equipment_Set__c in : raesIds
+// and Check_lost_Item__c = '娆犲搧'
+// group by Rental_Apply_Equipment_Set__c
+// ]);
+// Map<Id, AggregateResult> cdsCntAr = new Map<Id, AggregateResult>([
+// select count(Id) Cnt_Id, Rental_Apply_Equipment_Set__c Id
+// from Rental_Apply_Equipment_Set_Detail__c
+// where Rental_Apply_Equipment_Set__c in : raesIds
+////bp2 and CDS_complete_time__c = null
+// and Asset__r.Loaner_CDS_Info__c = '闇�瑕佹竻娲�'
+// group by Rental_Apply_Equipment_Set__c
+// ]);
+// Map<Id, AggregateResult> iraCntAr = new Map<Id, AggregateResult>([
+// select count(Id) Cnt_Id, Rental_Apply_Equipment_Set__c Id
+// from Rental_Apply_Equipment_Set_Detail__c
+// where Rental_Apply_Equipment_Set__c in : raesIds
+// and Inspection_result_after__c = 'NG'
+// group by Rental_Apply_Equipment_Set__c
+// ]);
+// Map<Id, AggregateResult> aiwCntAr = new Map<Id, AggregateResult>([
+// select count(Id) Cnt_id, Rental_Apply_Equipment_Set__c Id
+// from Rental_Apply_Equipment_Set_Detail__c
+// where Rental_Apply_Equipment_Set__c in : raesIds
+// and Arrival_in_wh__c = false
+// group by Rental_Apply_Equipment_Set__c
+// ]);
+// Map<Id, Rental_Apply_Equipment_Set__c> raesUpdMap = new Map<Id, Rental_Apply_Equipment_Set__c>();
+// for (Id raesId : raesIds) {
+// Rental_Apply_Equipment_Set__c raes = raesUpdMap.get(raesId);
+// if (raes == null) {
+// // raesIds 銇噸瑜囥亴銇傘倠鍫村悎銇蹇溿�佽ΚId銇伄銇ч厤涓嬨伄銈傘伄銈掍竴绶掋伀鍑︾悊銇欍倠銇ㄣ亶鐧虹敓銇椼伨銇欍��
+// // 闆嗚▓銇椼仧鍊ゃ伅鍚屻仒銇伅銇氥�佷竴鍥炪仩銇戣ō瀹氥仚銈屻伆銇勩亜銇с仚銆�
+// raes = new Rental_Apply_Equipment_Set__c(
+// Id = raesId,
+// Count_Detail__c = 0,
+// Count_Lost__c = 0,
+// Count_NotComplete_CDS__c = 0,
+// Count_NG_Inspection_Result_After__c = 0,
+// Count_Not_Arrival_in_wh__c = 0
+// );
+// raesUpdMap.put(raesId, raes);
+// if (allCntAr.get(raesId) != null) {
+// raes.Count_Detail__c = Integer.valueOf(allCntAr.get(raesId).get('Cnt_Id'));
+// }
+// if (cliCntAr.get(raesId) != null) {
+// raes.Count_Lost__c = Integer.valueOf(cliCntAr.get(raesId).get('Cnt_Id'));
+// }
+// if (cdsCntAr.get(raesId) != null) {
+// raes.Count_NotComplete_CDS__c = Integer.valueOf(cdsCntAr.get(raesId).get('Cnt_Id'));
+// }
+// if (iraCntAr.get(raesId) != null) {
+// raes.Count_NG_Inspection_Result_After__c = Integer.valueOf(iraCntAr.get(raesId).get('Cnt_Id'));
+// }
+// if (aiwCntAr.get(raesId) != null) {
+// raes.Count_Not_Arrival_in_wh__c = Integer.valueOf(aiwCntAr.get(raesId).get('Cnt_Id'));
+// }
+// }
+// }
+// update raesUpdMap.values();
+// }
+
+ // Asset銇嬨倝鐥呴櫌銇銇夸笂銇掋倛銇�
+ public static AggregateResult[] selectAssetSetHospitalCount(Set<Id> hpIds) {
+ return [select Account.Parent.ParentId Parent_ParentId,
+ Sum(This_year_inspection_times__c) SUM_inspection_times,
+ Sum(This_year_inspection_count__c) SUM_inspection_count
+ from Asset where Account.Parent.ParentId in : hpIds
+ group by Account.Parent.ParentId];
+ }
+ // Asset銇嬨倝鎴︾暐绉戝銇銇夸笂銇掋倛銇�
+ public static AggregateResult[] selectAssetSetDCCount(Set<Id> dcIds) {
+ return [select Account.ParentId Parent_Id,
+ Sum(This_year_inspection_times__c) SUM_inspection_times,
+ Sum(This_year_inspection_count__c) SUM_inspection_count
+ from Asset where Account.ParentId in : dcIds
+ group by Account.ParentId];
+ }
+ //鏃ユ姤鐢ㄧ殑锛屾樉绀轰笉灞炰簬鑷韩鏉冮檺鐨勫尰闄�
+ public static List<Account> ShowAccount(list<String> AccountIdList){
+ List<Account> accountList = [select id,Name from Account where Id in :AccountIdList];
+ return accountList;
+ }
+ public static List<Campaign> ShowCampaign(list<String> CampaignIdList){
+ List<Campaign> campaignList = [select Id, Name from Campaign where Id in :CampaignIdList];
+ return campaignList;
+ }
+ // Smarm__c銇嬨倝User銇銇夸笂銇掋倛銇�
+ public static AggregateResult[] selectSmarmSetUserCount(Set<Id> userIds, List<Id> delIds) {
+ if (delIds.size() == 0) {
+ return [select Review_Target__c Review_Target,
+ COUNT(Id) Cnt_Id,
+ Max(Report_Date__c) Max_Report_Date
+ from SMARM__c where Review_Target__c in : userIds
+ group by Review_Target__c];
+ } else {
+ return [select Review_Target__c Review_Target,
+ COUNT(Id) Cnt_Id,
+ Max(Report_Date__c) Max_Report_Date
+ from SMARM__c where Review_Target__c in : userIds
+ and Id not in : delIds
+ group by Review_Target__c];
+ }
+ }
+ public static void updateUserList(List<User> userList) {
+ update userList;
+ }
+
+ public static void upsertAsset(List<Asset> astList) {
+ if (astList.size() > 0) {
+ upsert astList;
+ }
+ }
+ public static void deleteAsset(List<Id> astIds) {
+ if (astIds.size() > 0) {
+ delete [Select Id from Asset where Id In: astIds];
+ }
+ }
+
+ // SoNo_DeliveryDate_Text__c 銇仸 upsert
+ public static void upsertStatuAchievementsJournalByKey(List<Statu_Achievements_Journal__c> pList) {
+ if (pList.size() > 0) {
+ upsert pList SoNo_DeliveryDate_Text__c;
+ }
+ }
+ public static List<Statu_Achievements_Journal__c> selectStatuAchievementsJournalByKey(List<String> pList) {
+ return [Select SoNo_DeliveryDate_Text__c, ShippedAmount__c from Statu_Achievements_Journal__c where SoNo_DeliveryDate_Text__c in :pList];
+ }
+
+ // CHAN-BCPCA3 鎻掑叆骞舵洿鏂� 铏氭嫙 DN start
+ public static void upsertStatuAchievementsDNByKey(List<Statu_Achievements_DN__c> pList) {
+ if (pList.size() > 0) {
+ upsert pList DNKey__c;
+ }
+ }
+ // CHAN-BCPCA3 鎻掑叆骞舵洿鏂� 铏氭嫙 DN end
+
+ public static void deleteStatuAchievementsJournalByKey(List<String> pList) {
+ for(List<Statu_Achievements_Journal__c> delList : [Select SoNo_DeliveryDate_Text__c, ShippedAmount__c from Statu_Achievements_Journal__c where SoNo_DeliveryDate_Text__c in :pList]) {
+ delete delList;
+ }
+ }
+
+ // 鐪佸崢浣� or 鍏ㄥ浗銇ê鐧傜銈掓绱紝鏈�鍒濄伄50浠�
+ public static Map<Id, Account> selectDepartByHospitalState(String nameCondition, String reporterState, Integer limitCnt) {
+ User loginUser = [Select Id, State_Hospital__c, Job_Category__c from User where Id =: UserInfo.getUserId()];
+ String queryString = 'select Id, Name, Department_Class__c, Department_Class__r.Name, Hospital__c, Hospital__r.Name from Account where' + nameCondition + ' Hospital__r.RecordType.DeveloperName = \'HP\' and Is_Active__c <> \'鐒″姽\'';
+ if (loginUser.Job_Category__c == 'GI甯傚満'
+ || loginUser.Job_Category__c == 'SP甯傚満'
+ || loginUser.Job_Category__c == '鏈嶅姟鏈儴'
+ || loginUser.Job_Category__c == '鍩硅'
+ ) {
+ // 鍏ㄥ浗绡勫洸銆併仾銇倐銇椼仾銇�
+ } else {
+ // 鐪佸崢浣嶃伄鏉′欢杩藉姞
+ system.debug('selectDepartByHospitalState reporterState=' + reporterState);
+ queryString += ' and Parent.Parent.State_Master__r.Name = :reporterState';
+ }
+ queryString += ' order by Name limit :limitCnt';
+ system.debug('selectDepartByHospitalState queryString=' + queryString);
+ return new Map<Id, Account>((List<Account>) Database.query(queryString));
+ }
+
+ public static void updateAgencyName(Map<Id, Account> hpNameAfterAccMap) {
+ List<Agency_Hospital_Link__c> ahls = [Select Id, Name,Hospital__c From Agency_Hospital_Link__c where Hospital__c in :hpNameAfterAccMap.keySet()];
+ List<Agency_Hospital_Link__c> updAHList = new List<Agency_Hospital_Link__c>();
+ if (ahls.size() > 0) {
+ for (Agency_Hospital_Link__c ahl: ahls) {
+ Account hp = hpNameAfterAccMap.get(ahl.Hospital__c);
+ String hpName = hp.Name;
+ if (ahl.Name != hpName) {
+ ahl.Name = hpName;
+ updAHList.add(ahl);
+ }
+ }
+ update updAHList;
+ }
+ }
+
+ public static void updateDeptName(Map<Id, Account> hpAfterAccMap) {
+ if (hpAfterAccMap.size() > 0) {
+ // 澶夋洿蹇呰銇� 鎴︾暐瑾插銆両D銈掗泦銈併倠
+ List<String> dcNameIds = new List<String>();
+ List<Account> updAccList = new List<Account>();
+ List<Account> updChkList = new List<Account>();
+ // 鎴︾暐瑾插ID:NAME
+ Map<String, String> dcNameMap = new Map<String, String>();
+ // 鎴︾暐瑾插鍚嶇О銈掕ō瀹�
+ List<Account> accDcs = [Select Id, Name, ParentId, Parent.RecordTypeId, Department_Class_Label__c from Account where ParentId IN :hpAfterAccMap.keySet()];
+ if (accDcs.size() > 0) {
+ for (Account child: accDcs) {
+ dcNameIds.add(child.Id);
+ if (child.Name != hpAfterAccMap.get(child.ParentId).Name + ' ' + child.Department_Class_Label__c) {
+ child.Name = hpAfterAccMap.get(child.ParentId).Name + ' ' + child.Department_Class_Label__c;
+ // 鍏ュ姏瑕忓墖鍥為伩
+ child.Sys_Dept_Name_Change_Chk__c = true;
+ updChkList.add(child);
+ }
+ child.OCM_Category__c = hpAfterAccMap.get(child.ParentId).OCM_Category__c;
+ child.State_Text__c = hpAfterAccMap.get(child.ParentId).State_Text__c;
+ dcNameMap.put(child.Id, child.Name);
+ updAccList.add(child);
+ }
+ // 瑷虹檪绉戝悕绉般倰瑷畾
+ List<Account> accDpts = [Select Id, Name, ParentId, Parent.ParentId, Department_Name__c from Account where ParentId IN :dcNameIds];
+ if (accDpts.size() > 0) {
+ for (Account child: accDpts) {
+ child.Name = dcNameMap.get(child.ParentId) + ' ' + child.Department_Name__c;
+ child.OCM_Category__c = hpAfterAccMap.get(child.Parent.ParentId).OCM_Category__c;
+ child.State_Text__c = hpAfterAccMap.get(child.Parent.ParentId).State_Text__c;
+ updAccList.add(child);
+ }
+ }
+ update updAccList;
+ // 鍏ュ姏瑕忓墖鍥炲京
+ if (updChkList.size() > 0) {
+ for (Account child: updChkList) {
+ child.Sys_Dept_Name_Change_Chk__c = false;
+ }
+ update updChkList;
+ }
+ }
+ }
+ }
+
+ public static void collectDeptId(List<String> accIds, Map<String, String> purposeOfAdviceMap, List<String> hospitalIds) {
+ if (hospitalIds.size() > 0) {
+ List<Account> accList = [Select Id, Name, Is_Active__c, Hospital__c from Account where Hospital__c IN :hospitalIds];
+ for (Account acc : accList) {
+ accIds.add(acc.Id);
+ purposeOfAdviceMap.put(acc.Id, purposeOfAdviceMap.get(acc.Hospital__c));
+ }
+ }
+ }
+
+ public static void collectChildIdForAgent(List<String> accIds, Map<String, String> purposeOfAdviceMap, List<String> agentIds) {
+ if (agentIds.size() > 0) {
+ //-----------20180913---------XinHongLu-------------------Start--------------------
+ //Is_Active_Formula__c = '鏈夋晥',璇ユ潯浠朵负"濂戠害"涓烘湁鏁堟椂,鎴戜滑浼犵粰sap
+ //-----------20180913---------XinHongLu-------------------End--------------------
+ List<Account> accList = [Select Id, Name, Is_Active__c, Agent_Ref__c, AgencyContract_Management_Code__c from Account where Is_Active_Formula__c = '鏈夋晥' and Agent_Ref__c IN :agentIds order by Agent_Ref__c, AgencyContract_Management_Code__c, CreatedDate desc];
+ if (accList.size() > 0) update accList;
+ String tmpAgentRef = null;
+ String tmpAgencyContractManagementCode = null;
+ for (Account acc : accList) {
+ if ((tmpAgentRef == null || tmpAgentRef != acc.Agent_Ref__c)
+ || (tmpAgencyContractManagementCode == null || tmpAgencyContractManagementCode != acc.AgencyContract_Management_Code__c)) {
+ tmpAgentRef = acc.Agent_Ref__c;
+ tmpAgencyContractManagementCode = acc.AgencyContract_Management_Code__c;
+ accIds.add(acc.Id);
+ purposeOfAdviceMap.put(acc.Id, purposeOfAdviceMap.get(acc.Agent_Ref__c));
+ NFM001Controller.debug_msg += '_1';
+System.debug(Logginglevel.DEBUG, 'collectChildIdForAgent acc.AgencyContract_Management_Code__c:::::' + acc.AgencyContract_Management_Code__c);
+ }
+ }
+ }
+ }
+// public static List<Account> getDoubleChildForAgent(Map<String, Account> agentStateIds) {
+// List<Account> childList = new List<Account>();
+// if (agentStateIds.size() > 0) {
+// childList = [Select Id, Agency_State_Master__c, AgencyContract_Management_Code__c from Account where RecordType.Name IN ('濂戠磩') and Agency_State_Master__c IN :agentStateIds.keySet() and Id NOT IN :agentStateIds.values()];
+// }
+// return childList;
+// }
+
+ public static void updateDeptIsActive(List<String> accIds, Map<String, String> purposeOfAdviceMap,
+ List<String> hospitalIdsNeedUpdateAccountIsActive, Map<Id, String> hpIsActiveMap, Map<Id, String> hpDateToMap) {
+ if (hospitalIdsNeedUpdateAccountIsActive.size() > 0) {
+ List<Account> accList = [
+ Select Id, Name,Is_Active__c, DepartmentEffectiveDateTo__c, Hospital__c, Hospital__r.DepartmentEffectiveDateTo__c
+ from Account
+ where Hospital__c IN :hospitalIdsNeedUpdateAccountIsActive];
+ List<Account> accUpdList = new List<Account>();
+ for (Account acc : accList) {
+ if (acc.Is_Active__c == hpIsActiveMap.get(acc.Hospital__c)) {
+ // 鐥呴櫌锛堝鏇村緦锛夈仺瑷虹檪绉戙伄Is_Active__c銇屽悓銇樸伄鍫村悎
+ continue;
+ }
+ if (hpIsActiveMap.get(acc.Hospital__c) == '鐒″姽' && acc.DepartmentEffectiveDateTo__c == null) {
+ // 鐒″姽銇鏇淬仚銈嬨�佽ê鐧傜銇湁鍔圭祩浜嗘棩銇宯ull銇倐銇亴瀵捐薄銆佸嚘鐞嗗璞�
+System.debug(Logginglevel.DEBUG, '鐒″姽銇鏇淬仚銈嬨�佽ê鐧傜銇湁鍔圭祩浜嗘棩銇宯ull銇倐銇亴瀵捐薄銆佸嚘鐞嗗璞�');
+ }
+ else if (hpIsActiveMap.get(acc.Hospital__c) == '鏈夊姽' && acc.DepartmentEffectiveDateTo__c == acc.Hospital__r.DepartmentEffectiveDateTo__c) {
+ // 鐒″姽銇鏇淬仚銈嬨�佽ê鐧傜銇湁鍔圭祩浜嗘棩銇岀梾闄�(澶夋洿鍓�)銇ㄥ悓銇樸伄銈傘伄銇屽璞°�佸嚘鐞嗗璞�
+System.debug(Logginglevel.DEBUG, '鐒″姽銇鏇淬仚銈嬨�佽ê鐧傜銇湁鍔圭祩浜嗘棩銇岀梾闄€仺鍚屻仒銇倐銇亴瀵捐薄銆佸嚘鐞嗗璞�');
+ } else {
+System.debug(Logginglevel.DEBUG, '鍑︾悊瀵捐薄澶栥�佺梾闄s_Active__c=' + hpIsActiveMap.get(acc.Hospital__c) + ', 瑷虹檪绉慏ateto=' + acc.DepartmentEffectiveDateTo__c + ', 鐥呴櫌Dateto=' + hpDateToMap.get(acc.Hospital__c));
+ continue;
+ }
+ accIds.add(acc.Id);
+ purposeOfAdviceMap.put(acc.Id, purposeOfAdviceMap.get(acc.Hospital__c));
+System.debug(Logginglevel.DEBUG, 'purposeOfAdviceMap 鐥呴櫌=' + purposeOfAdviceMap.get(acc.Hospital__c));
+ accUpdList.add(acc);
+ acc.Is_Active__c = hpIsActiveMap.get(acc.Hospital__c);
+ acc.DepartmentEffectiveDateTo__c = hpDateToMap.get(acc.Hospital__c);
+ }
+ if (accUpdList.size() > 0) {
+ update accUpdList;
+ }
+ }
+ }
+ //CHAN-AZJ6JS 杩芥函绯荤粺鏉ョ殑璇环锛屽彇娑圵IN鏃讹紝缁忛攢鍟嗚鍗曡嚜鍔ㄦ敼鍒扳�滈┏鍥炩��
+ public static void selectAndupdateOrderSatus(List<String> idList) {
+ List<Consumable_order__c> orderList = [select id, Order_status__c from Consumable_order__c where Name = :idList and Order_status__c = '鎵瑰噯' and RecordType.DeveloperName = 'Order'];
+ for (Consumable_order__c order : orderList) {
+ order.Order_status__c = '椹冲洖';
+ }
+ update orderList;
+ }
+ //鏇存柊璁㈠崟
+ public static void updateOrderSatus(List<Consumable_order__c> docList) {
+ update docList;
+ }
+ //鏇存柊鏄庣粏2
+ public static void updateOrderDetailsSatus(List<Consumable_order_details2__c> docList) {
+ update docList;
+ }
+ //鏇存柊鏄庣粏1
+ public static void updateOrderDetails1Satus(List<Consumable_orderdetails__c> docList) {
+ update docList;
+ }
+
+ public static void updRentalApplyList(List<Consumable_order__c> ra) {
+ if (ra.size() > 0) update ra;
+ }
+
+ public static List<Event__c> getEventCList(Date whereDate, Daily_Report__c oya) {
+ return [
+ select Id, Event_ID__c, Daily_Report__c, Subject__c, StartDateTime__c, EndDateTime__c, Main_Visit_Location__c,
+ Location__c, whatId__c, Activity_Type2__c, Activity_Type2_Before__c,
+ Visitor1__c, Visitor2__c, Visitor3__c, Visitor4__c, Visitor5__c,
+ Visitor1_ID__c, Visitor2_ID__c, Visitor3_ID__c, Visitor4_ID__c, Visitor5_ID__c,
+ Companion__c, Purpose__c, Purpose_Type__c, Purpose_Type2__c, Purpose_Type3__c, Purpose_Type4__c, Purpose_Type5__c,
+ Purpose_TypeFSE__c, Purpose_TypeFSE2__c, Purpose_TypeFSE3__c, Purpose_TypeFSE4__c, Purpose_TypeFSE5__c,
+ Purpose_TypeEscFSE__c, Purpose_TypeEscFSE2__c, Purpose_TypeEscFSE3__c, Purpose_TypeEscFSE4__c, Purpose_TypeEscFSE5__c,
+ Related_Opportunity1__c, Related_Opportunity2__c, Related_Opportunity3__c, Related_Opportunity4__c, Related_Opportunity5__c,
+ Related_Opportunity1_ID__c, Related_Opportunity2_ID__c, Related_Opportunity3_ID__c, Related_Opportunity4_ID__c, Related_Opportunity5_ID__c,
+ Related_Service1__c, Related_Service2__c,
+ Related_Service1_ID__c, Related_Service2_ID__c,
+ Description__c, Hospital_Info__c, Doctor_Info__c, Technology_Treatment__c,
+ New_Query__c, Update_Query__c, Lost_Info__c, VOC__c, Meeting_Info__c, Product_Description_Id__c,
+ Maintenance_Contract_ID__c, Asset_Manual_ID__c, Rental_Apply_ID__c,
+ OPD_ID__c, NTC_ID__c, ReportAccompanied_ID__c, CityStatus_ID__c, Conflict_ID__c, Claim_ID__c, Improvement_ID__c, OnCall_ID__c,
+ nextPlanDate__c, nextPlanTimePurpose__c, Activity_ID__c,
+ Minister__c, Minister_Comment__c, Manager__c, Manager_Comment__c,
+ Free_Input__c, Visitor_Place_Free__c, Mail_Send_Btn__c,
+ Lead_ID__c, Lead_Count__c, InsReport_ID__c,
+ Activity_Purpose__c,Activity_PurposeFSE__c,Activity_PurposeEscFSE__c,ETAPPAct__c
+ ,IsAlertInputDep__c // 2018/11/21 SWAG-B6Q8BS 鍒ゆ柇鏄惁闇�瑕佸脊绐楁洿鏂板鎴蜂俊鎭�
+ ,SLARecorded__c,UseReport__c,SLAReportInfo__c//20210701 zh SLA
+ // 20200420 浠诲姟鏃ユ姤绠$悊 add gzw start
+ // ,eventStatus__c, delayToDate__c, delayReason__c,DurationInMinutes__c,BeforeActivityDate__c,OPDPlan_Flag__c,IsScheduled__c,AppCdId__c,SyncCreatedDate__c
+
+ ,eventStatus__c, CancelReason__c, delayToDate__c, delayReason__c,DurationInMinutes__c,cancelReasonSelect__c,cancelReasonSelectFSE__c,cancelReasonOther__c,delayReasonOther__c,delayReasonSelect__c,delayReasonSelectFSE__c,BeforeActivityDate__c,OPDPlan_Flag__c,IsScheduled__c,AppCdId__c,SyncCreatedDate__c
+ // 20200420 浠诲姟鏃ユ姤绠$悊 add gzw end
+ //,OPD_plan__c // 2022-4-14 yjk 澧炲姞OPD璁″垝
+ from Event__c where ActivityDate__c =:whereDate and Daily_Report__c = :oya.Id order by StartDateTime__c
+ ];
+ }
+
+ public static List<Event__c> getNextEventCList(List<String> nextEcIds) {
+ return [
+ select Id, Event_ID__c, Daily_Report__c, Subject__c, StartDateTime__c, EndDateTime__c, Main_Visit_Location__c,
+ Location__c, whatId__c, Activity_Type2__c, Activity_Type2_Before__c,
+ Visitor1__c, Visitor2__c, Visitor3__c, Visitor4__c, Visitor5__c,
+ Visitor1_ID__c, Visitor2_ID__c, Visitor3_ID__c, Visitor4_ID__c, Visitor5_ID__c,
+ Companion__c, Purpose__c, Purpose_Type__c, Purpose_Type2__c, Purpose_Type3__c, Purpose_Type4__c, Purpose_Type5__c,
+ Purpose_TypeFSE__c, Purpose_TypeFSE2__c, Purpose_TypeFSE3__c, Purpose_TypeFSE4__c, Purpose_TypeFSE5__c,
+ Purpose_TypeEscFSE__c, Purpose_TypeEscFSE2__c, Purpose_TypeEscFSE3__c, Purpose_TypeEscFSE4__c, Purpose_TypeEscFSE5__c,
+ Related_Opportunity1__c, Related_Opportunity2__c, Related_Opportunity3__c, Related_Opportunity4__c, Related_Opportunity5__c,
+ Related_Opportunity1_ID__c, Related_Opportunity2_ID__c, Related_Opportunity3_ID__c, Related_Opportunity4_ID__c, Related_Opportunity5_ID__c,
+ Related_Service1__c, Related_Service2__c,
+ Related_Service1_ID__c, Related_Service2_ID__c,
+ Description__c, Hospital_Info__c, Doctor_Info__c, Technology_Treatment__c,
+ New_Query__c, Update_Query__c, Lost_Info__c, VOC__c, Meeting_Info__c, Product_Description_Id__c,
+ Maintenance_Contract_ID__c, Asset_Manual_ID__c, Rental_Apply_ID__c,
+ OPD_ID__c, NTC_ID__c, ReportAccompanied_ID__c, CityStatus_ID__c, Conflict_ID__c, Claim_ID__c, Improvement_ID__c, OnCall_ID__c,
+ nextPlanDate__c, nextPlanTimePurpose__c, Activity_ID__c,
+ Minister__c, Minister_Comment__c, Manager__c, Manager_Comment__c,
+ Free_Input__c, Visitor_Place_Free__c, Mail_Send_Btn__c,
+ Lead_ID__c, Lead_Count__c, InsReport_ID__c,
+ Activity_Purpose__c,Activity_PurposeFSE__c,Activity_PurposeEscFSE__c
+ ,IsAlertInputDep__c // 2018/11/21 SWAG-B6Q8BS 鍒ゆ柇鏄惁闇�瑕佸脊绐楁洿鏂板鎴蜂俊鎭�
+ from Event__c where Id in :nextEcIds order by StartDateTime__c
+ ];
+ }
+
+ public static Map<String, Map<String, String>> getAccsByName(List<String> accList) {
+ Map<String, Map<String, String>> accMap = new Map<String, Map<String, String>>();
+ Map<String, String> accIds = new Map<String, String>();
+
+ List<Account> accs = [select Id, Name from Account where Name in : accList];
+ for (Account acc : accs) {
+ if (accMap.containsKey(acc.Name)) {
+ accIds = accMap.get(acc.Name);
+ } else {
+ accIds = new Map<String, String>();
+ }
+ accIds.put(acc.Id, acc.Id);
+ accMap.put(acc.Name, accIds);
+ }
+ return accMap;
+ }
+
+ public static Map<String, Map<String, String>> getCampsByName(List<String> campList) {
+ Map<String, Map<String, String>> campMap = new Map<String, Map<String, String>>();
+ Map<String, String> campIds = new Map<String, String>();
+
+ List<Campaign> camps = [select Id, Name from Campaign where Name in : campList];
+ for (Campaign camp : camps) {
+ if (campMap.containsKey(camp.Name)) {
+ campIds = campMap.get(camp.Name);
+ } else {
+ campIds = new Map<String, String>();
+ }
+ campIds.put(camp.Id, camp.Id);
+ campMap.put(camp.Name, campIds);
+ }
+ return campMap;
+ }
+
+ // CHAN-BE6CZZ 鏈�鍚庤窡杩涚粨鏋� LHJ 20190724 Start
+ //public static AggregateResult[] selectForOpp_Last_Follow_Up_Date(List<String> oppIds) {
+ //return [select Opportunity__c, Max(End_Time__c) maxET from Event_Oppotunity__c where Opportunity__c in : oppIds
+ // and Daily_Report__r.Status_With_Check__c <> '鑽夋涓�' and Daily_Report__r.Status_With_Check__c <> ''
+ // group by Opportunity__c];
+ //}
+ public static List<Event_Oppotunity__c> selectForOpp_Last_Follow_Up_Date(List<String> oppIds) {
+ return [select Opportunity__c, End_Time__c, EventC_ID__r.Description__c
+ from Event_Oppotunity__c
+ where Opportunity__c in : oppIds
+ and Daily_Report__r.Status_With_Check__c <> '鑽夋涓�'
+ and Daily_Report__r.Status_With_Check__c <> ''
+ order by Opportunity__c, End_Time__c desc
+ ];
+ }
+ // CHAN-BE6CZZ 鏈�鍚庤窡杩涚粨鏋� LHJ 20190724 Start
+
+
+ public static List<Event> selectForOpp_Last_Visit_Scheduled_Date(List<String> oppIds) {
+ // Max(ActivityDateTime)銇屻仱銇嬨亪銇亜銇熴倎銆乬roup by 銈掋倓銈併伨銇椼仧銆�
+ return [select Id, Related_Opportunity1_ID__c, ActivityDateTime from Event where Related_Opportunity1_ID__c != null and Related_Opportunity1_ID__c in :oppIds
+ order by Related_Opportunity1_ID__c, ActivityDateTime desc];
+ }
+
+ public static AggregateResult[] selectEventOppForAggregateFollowToOpp(List<String> oppIds) {
+ return [select Opportunity__c
+ , count(Name) cnt
+ , sum(Visit_President_Flag__c) vprCnt
+ , sum(Visit_Head_Doctor_Flag__c) vhdCnt
+ , sum(NTC_Flag__c) ntcCnt
+ from Event_Oppotunity__c where Opportunity__c in :oppIds
+ and Daily_Report__r.Status_With_Check__c <> '鑽夋涓�' and Daily_Report__r.Status_With_Check__c <> ''
+ group by Opportunity__c];
+ }
+
+ public static List<Report__c> selectReportForAggregateOpdToOpp(List<String> oppIds) {
+ return [select Opportunity1__c, Opportunity2__c, Opportunity3__c, Opportunity4__c, Opportunity5__c
+ from Report__c where Status__c <> '浣滄垚涓�' and Status__c <> '鍙栨秷銇�' and Status__c <> ''
+ and (Opportunity1__c in :oppIds or Opportunity2__c in :oppIds or Opportunity3__c in :oppIds or Opportunity4__c in :oppIds or Opportunity5__c in :oppIds)
+ and RecordType.DeveloperName = 'OPD'];
+ }
+
+ // 锛曘仱銇晢璜囥倰瑕嬨倠銇熴倎銆乬roup by 銇屻仹銇嶃仾銇勩伄銇с�佹绱㈠緦loop銇椼仸闆嗚▓銇欍倠
+ public static AggregateResult[] selectForService_Last_Follow_Up_Date(List<String> serviceIds) {
+ return [select Service__c, Max(Date__c) maxD from Event_Service__c where Service__c in : serviceIds
+ and Daily_Report__r.Status_With_Check__c <> '鑽夋涓�' and Daily_Report__r.Status_With_Check__c <> ''
+ group by Service__c];
+ }
+
+ public static void updateContactMonth(List<String> conIds, List<Date> conDates) {
+ Map<String, Integer> conCntMap = new Map<String, Integer>();
+ AggregateResult[] ar = [select count(Id) cnt, Contact__c, Date__c from Activity_History_Daily_Report__c
+ where Daily_Report__r.Status_With_Check__c <> '鑽夋涓�' and Daily_Report__r.Status_With_Check__c <> ''
+ and Contact__c in :conIds group by Contact__c, Date__c];
+ if (ar.size() > 0) {
+ for (Integer i = 0; i < ar.size(); i++) {
+ Date actDate = (Date) ar[i].get('Date__c');
+ String key = String.valueOf(ar[i].get('Contact__c')) + String.valueOf(actDate.year()) + (actDate.month() < 10 ? '0' + actDate.month() : '' + actDate.month());
+ if (conCntMap.containsKey(key)) {
+ conCntMap.put(key, conCntMap.get(key) + Integer.valueOf(ar[i].get('cnt')));
+ } else {
+ conCntMap.put(key, Integer.valueOf(ar[i].get('cnt')));
+ }
+ }
+ }
+
+ // 銇撱亾銇嬨倝12銉舵湀銇偒銈︺兂銉堛倰鏇存柊
+ Map<Id, Contact> conThisMap = new Map<Id, Contact>([select Id, Visit_Count1__c, Visit_Count2__c, Visit_Count3__c, Visit_Count4__c, Visit_Count5__c, Visit_Count6__c,
+ Visit_Count7__c, Visit_Count8__c, Visit_Count9__c, Visit_Count10__c, Visit_Count11__c, Visit_Count12__c
+ from Contact where Id in :conIds for update]);
+ if (conThisMap.size() > 0) {
+ Map<String, Contact> updMap = new Map<String, Contact>();
+ for (Integer i = 0; i < conIds.size(); i++) {
+ Contact con = conThisMap.get(conIds[i]);
+ if (updMap.containsKey(con.Id)) {
+ con = updMap.get(con.Id);
+ }
+
+ if (con != null) {
+ Date repDate = conDates[i];
+ Integer year = repDate.year();
+ Integer month = repDate.month();
+
+ Integer cnt = null;
+ if (conCntMap != null) {
+ cnt = conCntMap.get(con.Id + '' + year + ((month < 10) ? '0' : '') + month);
+ }
+ if(month == 1) {
+ if (!equalTwoNum(con.Visit_Count1__c, cnt)) {
+ con.Visit_Count1__c = cnt;
+ }
+ } else if(month == 2) {
+ if (!equalTwoNum(con.Visit_Count2__c, cnt)) {
+ con.Visit_Count2__c = cnt;
+ }
+ } else if(month == 3) {
+ if (!equalTwoNum(con.Visit_Count3__c, cnt)) {
+ con.Visit_Count3__c = cnt;
+ }
+ } else if(month == 4) {
+ if (!equalTwoNum(con.Visit_Count4__c, cnt)) {
+ con.Visit_Count4__c = cnt;
+ }
+ } else if(month == 5) {
+ if (!equalTwoNum(con.Visit_Count5__c, cnt)) {
+ con.Visit_Count5__c = cnt;
+ }
+ } else if(month == 6) {
+ if (!equalTwoNum(con.Visit_Count6__c, cnt)) {
+ con.Visit_Count6__c =cnt;
+ }
+ } else if(month == 7) {
+ if (!equalTwoNum(con.Visit_Count7__c, cnt)) {
+ con.Visit_Count7__c = cnt;
+ }
+ } else if(month == 8) {
+ if (!equalTwoNum(con.Visit_Count8__c, cnt)) {
+ con.Visit_Count8__c = cnt;
+ }
+ } else if(month == 9) {
+ if (!equalTwoNum(con.Visit_Count9__c, cnt)) {
+ con.Visit_Count9__c = cnt;
+ }
+ } else if(month == 10) {
+ if (!equalTwoNum(con.Visit_Count10__c, cnt)) {
+ con.Visit_Count10__c = cnt;
+ }
+ } else if(month == 11) {
+ if (!equalTwoNum(con.Visit_Count11__c, cnt)) {
+ con.Visit_Count11__c = cnt;
+ }
+ } else if(month == 12){
+ if (!equalTwoNum(con.Visit_Count12__c, cnt)) {
+ con.Visit_Count12__c = cnt;
+ }
+ } else {
+ // TODO Exception
+ }
+ updMap.put(con.Id, con);
+ }
+ }
+ List<Contact> updCon = updMap.values();
+ if (updCon.size() > 0) update updCon;
+ }
+ }
+
+ public static List<SObject> getPe99Info(String soql, String userId) {
+ return Database.query(soql);
+ }
+
+ public static Boolean checkInsHpChange(Id irHpId, Map<Id, Id> iiHpMap) {
+ Boolean isChange = false;
+ for (String key : iiHpMap.keySet()) {
+ Id iiHpId = iiHpMap.get(key);
+ if (irHpId != iiHpId) {
+ isChange = true;
+ break;
+ }
+ }
+ return isChange;
+ }
+
+
+ // equal:true
+ private static Boolean equalTwoNum(Decimal val1, Integer val2) {
+ if (val1 == null && val2 == null) {
+ return true;
+ } else if (val1 != null && val2 != null && val1 == Decimal.valueOf(val2)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ // JS鐢ㄦ绱�
+ @ReadOnly
+ @RemoteAction
+ global static String getQueryJson(String sql) {
+ system.debug('=====sql:' + sql);
+ List<SObject> rs = Database.query(sql);
+ String rsStr = JSON.serialize(rs);
+ system.debug('=====rsStr:' + rsStr);
+ return rsStr;
+ }
+
+ // JS鐢ㄦ洿鏂�
+ @ReadOnly
+ @RemoteAction
+ global static String getUpdateResult(String j) {
+ system.debug('=====json:' + j);
+ SObject obj = (SObject)JSON.deserializeStrict(j, SObject.class);
+ Database.SaveResult rs = Database.update(obj);
+ String rsStr = rs.isSuccess() ? '1' : '0';
+ system.debug('=====rsStr:' + rsStr);
+ return rsStr;
+ }
+
+ WebService static String getAccessToken() {
+ return UserInfo.getSessionId();
+ }
+
+ WebService static void addBatchIfLog(String typeStr, Integer isError, String logStr) {
+ BatchIF_Log__c log = new BatchIF_Log__c(
+ Type__c = typeStr,
+ Is_Error__c = isError
+ );
+ if (isError == 0) {
+ log.log__c = logStr;
+ } else {
+ log.ErrorLog__c = logStr;
+ }
+ insert log;
+ }
+
+ WebService static String deleteRepair(String rid) {
+ try {
+ Repair__c r = new Repair__c(Id = rid);
+ delete r;
+ return 'OK';
+ } catch (Exception e) {
+ return e.getMessage();
+ }
+ }
+ /*
+ =======================================================================================================================
+ ===================================================SI 璇环閮ㄥ垎util闆嗗悎=================================================
+ =======================================================================================================================
+ */
+ /**
+ OCM-SI闇�姹傝〃鐢紝澶嶅埗鍔熻兘锛屼粎闄愬綋鍓嶆墍鏈塖I闇�姹傝〃澶辨晥鐨勬椂鍊欙紝鎵嶈兘浣跨敤
+ */
+ 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;
+ List<IS_Opportunity_Demand__c> isoListForCheck = [select id, Func_SOD_Status__c,Abort_Date__c from IS_Opportunity_Demand__c where Opportunity_ID__c=:opporID];
+ for(IS_Opportunity_Demand__c iso: isoListForCheck){
+ if(iso.Abort_Date__c==null){
+ return '瀛樺湪鏈粓姝㈢殑SI闇�姹傝〃锛屼笉鑳藉鍒�';
+ }
+ }
+
+ return ISO_DemandOperAndDemonsController.CopyFunc(isoID);
+ }
+ /**
+ OCM-SI闇�姹傝〃鐢紝鑷畾涔夋彁浜ゅ緟瀹℃壒
+ */
+ WebService static String ISO_Submit_Func(id isoID){
+ List<IS_Opportunity_Demand__c> submintISOList = new List<IS_Opportunity_Demand__c>();
+ submintISOList = [SELECT id,Data_Check_TF__c from IS_Opportunity_Demand__c WHERE id =:isoID];
+ List<IS_Opportunity_Demand__c> isOppList = new List<IS_Opportunity_Demand__c>();
+ for(IS_Opportunity_Demand__c iso: submintISOList){
+ if(iso.Data_Check_TF__c){
+ Savepoint sp = Database.setSavepoint();
+ try {
+ Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest();
+ psr.setObjectId(isoID);
+ Approval.ProcessResult submitResult = Approval.process(psr);
+ return 'Fin';
+ }catch(exception e){
+ String ioError = e.getMessage();
+ Database.rollback(sp);
+ return ''+ioError;
+ }
+ }else{
+ return '璇风幇鍦ㄧ紪杈戦〉闈紝妫�鏌ユ暟鎹畬鏁存�э紝鐒跺悗鍐嶆墽琛屾彁浜�';
+ }
+ }
+ if(isOppList.size() > 0){
+ update isOppList;
+ }
+ return 'Fin';
+ }
+ /**
+ OCM-SI璇环鏂囦欢涓婁紶鐢紝鑷畾涔夋彁浜ゅ緟瀹℃壒
+ */
+ WebService static String SI_FileUpdateSubmit(id subID){
+ //List<Attachment> CheckFile = [select id from Attachment where ParentId=:subID];
+ //if(CheckFile.size()==0){
+ // return '璇蜂笂浼犻檮浠跺悗鍐嶆彁浜�';
+ //}else{
+ Savepoint sp = Database.setSavepoint();
+ try {
+ Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest();
+ psr.setObjectId(subID);
+ Approval.ProcessResult submitResult = Approval.process(psr);
+ return 'Fin';
+ }catch(exception e){
+ String ioError = e.getMessage();
+ Database.rollback(sp);
+ return ''+ioError;
+ }
+ //}
+ }
+ /**
+ OCM娉ㄦ畫鐢紝褰撴敞娈嬫洿鏂版椂锛屽垽鏂暟涓棩鏈熸槸鍚﹀彉闈╋紝濡傝嫢鍙橀潻锛屽垯鏇存柊瀵瑰簲璇环鐨勬槧灏勬椂闂达紙鍙栨渶澶у�硷級;
+ */
+ public static String updateOppoMuiltDate(id opporID){
+ List<AggregateResult> ArResult = [select
+ Max(ContractReceivedDate__c ) al,
+ Max(FirstApproveDate__c ) bl,
+ Max(LastApproveDate__c ) cl,
+ Max(X30_Deposit_Day__c) dl,
+ Max(Deposit_In_Full_Day__c) el,
+ Max(SoLatestDeliveryDate__c) fl,
+ Max(DeliveryDate__c ) gl,
+ Max(DeliveryDate_backup__c) hl,
+ Max(InstallDate__c) il,
+ Max(Collection_Day_Invoice__c) jl,
+ Max(Inspection_explanation_day__c) kl
+ from
+ Statu_Achievements__c
+ WHERE Opportunity__c =: opporID];
+ Opportunity ops = [SELECT Contract_Recieve_Date__c ,
+ First_Review_Date__c ,
+ LastApproveDate__c ,
+ X30_Deposit_Day__c,
+ Pay_All_Money__c,
+ Last_Delivery_Date__c,
+ DeliveryDate__c ,
+ InstallDate__c,
+ Inspection_explanation_day__c
+ From Opportunity
+ WHERE id =:opporID];
+ for(AggregateResult ar : ArResult ){
+ if(Date.valueOf(ar.get('al')) != ops.Contract_Recieve_Date__c){
+ ops.Contract_Recieve_Date__c = Date.valueOf(ar.get('al'));
+ }
+ if(Date.valueOf(ar.get('bl')) != ops.First_Review_Date__c){
+ ops.First_Review_Date__c = Date.valueOf(ar.get('bl'));
+ }
+ if(Date.valueOf(ar.get('cl')) != ops.LastApproveDate__c){
+ ops.LastApproveDate__c = Date.valueOf(ar.get('cl'));
+ }
+ if(Date.valueOf(ar.get('dl')) != ops.X30_Deposit_Day__c){
+ ops.X30_Deposit_Day__c = Date.valueOf(ar.get('dl'));
+ }
+ if(Date.valueOf(ar.get('el')) != ops.Pay_All_Money__c){
+ ops.Pay_All_Money__c = Date.valueOf(ar.get('el'));
+ }
+ if(Date.valueOf(ar.get('fl')) != ops.Last_Delivery_Date__c){
+ ops.Last_Delivery_Date__c = Date.valueOf(ar.get('fl'));
+ }
+ if(Date.valueOf(ar.get('gl')) != ops.DeliveryDate__c){
+ ops.DeliveryDate__c = Date.valueOf(ar.get('gl'));
+ }
+ if(Date.valueOf(ar.get('il')) != ops.InstallDate__c){
+ ops.InstallDate__c = Date.valueOf(ar.get('il'));
+ system.debug(ar.get('il')+'2333333333');
+ }
+ if(Date.valueOf(ar.get('kl')) != ops.Inspection_explanation_day__c){
+ ops.Inspection_explanation_day__c = Date.valueOf(ar.get('kl'));
+ }
+ }
+ update ops;
+
+ ControllerUtil.refreshSIOpporStatus(opporID);
+ return 'Fin';
+ }
+ /**
+ OCM璇环鐢紝鍒锋柊OCM鈥斺�擲I鐨勭姸鎬�
+ */
+ public static string refreshSIOpporStatus(id opporID){
+ Opportunity ops = [SELECT Last_Install_Confirm_Date__c,
+ InstallDate__c,
+ DeliveryDate__c,
+ Last_Delivery_Date__c,
+ Pay_All_Money__c ,
+ X30_Deposit_Day__c ,
+ LastApproveDate__c,
+ First_Review_Date__c,
+ Contract_Recieve_Date__c,
+ SFDCLast_Process_Date__c,
+ Input_Dealer_HP_date__c,
+ Agency_Contract_Date_last_update__c,
+ Assistant_Applied_Date__c,
+ Closing_Bid_Date__c,
+ Bid_Date__c,
+ Autholization_Activated_Date__c,
+ Authorized_Date__c,
+ Last_Follow_Up_Date__c,
+ Key_tipics_last_update_day__c,
+ Status_List_SI__c
+ FROM Opportunity
+ WHERE id=:opporID];
+ if(ops.Last_Install_Confirm_Date__c!=null){ops.Status_List_SI__c ='16 宸茬粨鏉�';}
+ else if(ops.InstallDate__c!=null){ops.Status_List_SI__c ='15 宸插畨瑁�';}
+ else if(ops.DeliveryDate__c!=null){ops.Status_List_SI__c ='14 宸插彂璐�';}
+ else if(ops.Last_Delivery_Date__c!=null){ops.Status_List_SI__c ='13 宸插垎閰嶏紝寰呭彂璐�';}
+ else if(ops.Pay_All_Money__c!=null){ops.Status_List_SI__c ='12 宸茶璐э紝浠樺叏娆�';}
+ else if(ops.X30_Deposit_Day__c!=null){ops.Status_List_SI__c ='11 宸茶璐э紝浠樿閲�';}
+ else if(ops.LastApproveDate__c!=null){ops.Status_List_SI__c ='10 搴撳瓨宸查鐣欙紝鏈粯娆�';}
+ else if(ops.First_Review_Date__c!=null){ops.Status_List_SI__c ='9 宸插綍鍏ヨ鍗曪紝鏈粯娆�';}
+ else if(ops.Contract_Recieve_Date__c!=null){ops.Status_List_SI__c ='9 宸插綍鍏ヨ鍗曪紝鏈粯娆�';}
+ else if(ops.SFDCLast_Process_Date__c!=null){ops.Status_List_SI__c ='8 宸茬绾�';}
+ else if(ops.Input_Dealer_HP_date__c!=null){ops.Status_List_SI__c ='7 鐢ㄦ埛宸茬绾�';}
+ else if(ops.Agency_Contract_Date_last_update__c!=null){ops.Status_List_SI__c ='6 鐢ㄦ埛鏈绾�';}
+ else if(ops.Assistant_Applied_Date__c!=null){ops.Status_List_SI__c ='5 浠锋牸鐢宠涓�';}
+ else if(ops.Closing_Bid_Date__c!=null){ops.Status_List_SI__c ='4 宸蹭腑鏍�';}
+ else if(ops.Bid_Date__c!=null ||ops.Autholization_Activated_Date__c!=null||ops.Authorized_Date__c!=null){ops.Status_List_SI__c ='3 宸叉巿鏉�';}
+ else if(ops.Last_Follow_Up_Date__c!=null){ops.Status_List_SI__c ='2 璺熻繘涓�';}
+ else if(ops.Key_tipics_last_update_day__c!=null){ops.Status_List_SI__c ='1 杩樻病鎷滆';}
+ else{ops.Status_List_SI__c = '0 杩樻病璺熻繘';}
+ update ops;
+ return 'Fin';
+ }/**
+ OCM璇环鏂囦欢涓婁紶鐢紝瀹為檯涓婁紶鏂囦欢鍚庯紝鍒锋柊涓婁紶鏃堕棿
+ */
+ public static String UpdateFileDateSet(List<String> SIopportunityIds){
+ List<SI_Attachment__c> attFileList = [select id,Opportunity_ID__c,File_Upload_Date__c,Type__c from SI_Attachment__c where id in:SIopportunityIds];
+ List<id> oppsId = new List<id>();
+ Map<id,id> SODOwnerMap = new Map<id,id>();
+ for(SI_Attachment__c siAc : attFileList){
+ oppsId.add(siAc.Opportunity_ID__c);
+ }
+ List<IS_Opportunity_Demand__c> sodList = [select OwnerId,id,Opportunity_ID__c from IS_Opportunity_Demand__c where Opportunity_ID__c in:oppsId];
+ for(IS_Opportunity_Demand__c sod: sodList){
+ SODOwnerMap.put(sod.Opportunity_ID__c, sod.OwnerId);
+ }
+ for(SI_Attachment__c siAc : attFileList){
+ siAc.File_Upload_Date__c = Date.today();
+ siAc.SI_SOD_Owner__c = SODOwnerMap.get(siAc.Opportunity_ID__c);
+ }
+ savepoint sp = Database.setsavepoint();
+ try{
+ update attFileList;
+ return 'Fin';
+ }catch(exception o){
+ Database.rollback(sp);
+ return 'Database Error';
+ }
+
+ }
+
+ /**
+ OCM璇环鏂囦欢涓婁紶鐢紝璇环涓婁紶鏂囦欢锛屾牴鎹枃浠剁绫伙紝鏇存柊瀵瑰簲SI闇�姹傝〃鐘舵��
+ */
+ public static String UpdateSIFunctionStatus(List<String> SIopportunityIds){
+ system.debug('Inside+++++++++++++++');
+ List<SI_Attachment__c> attFileList = [select id,Opportunity_ID__c,Type__c from SI_Attachment__c where id in:SIopportunityIds];
+ List<id> oppid = new List<id>();
+ for(SI_Attachment__c si : attFileList){
+ oppid.add(si.Opportunity_ID__c);
+ }
+ List<IS_Opportunity_Demand__c> isoFileList = new List<IS_Opportunity_Demand__c>();
+ List<Opportunity> opslist = [select id,Project_decide_date__c,bid_Confrim_Date__c from Opportunity where id in:oppid];
+ List<Opportunity> opslistUpdate = new List<Opportunity>();
+ Map<Id,String> AttTypeToISODate = new Map<Id,String>();
+ isoFileList = [ select Id,CAD_Upload_Date__c,Program_Plan_Upload_Date__c,
+ Param_Upload_Date__c,Bid_Document_Upload_Date__c,
+ ConfirmBook_Upload_Date__c,Opportunity_ID__c
+ from IS_Opportunity_Demand__c
+ where Opportunity_ID__c in:oppid
+ and Func_SOD_Status__c !='宸茬粓姝�'];
+ for(SI_Attachment__c att: attFileList){
+ AttTypeToISODate.put(att.Opportunity_ID__c,att.Type__c);
+ }
+ for(IS_Opportunity_Demand__c iso : isoFileList){
+ if(AttTypeToISODate.get(iso.Opportunity_ID__c) == 'CAD鍥剧焊'||
+ AttTypeToISODate.get(iso.Opportunity_ID__c) == '鎵嬫湳瀹ゅ噣鍖栧钩闈㈠浘锛堝惈璁惧瀹氫綅锛�'||
+ AttTypeToISODate.get(iso.Opportunity_ID__c) == '鐩爣鏈棿鍚婂瀹氫綅鍥�'||
+ AttTypeToISODate.get(iso.Opportunity_ID__c) == '鐩爣鏈棿鍑�鍖栫珛浣撳浘'||
+ AttTypeToISODate.get(iso.Opportunity_ID__c) == '绀烘暀鐐规ゼ灞傚钩闈㈠浘'||
+ AttTypeToISODate.get(iso.Opportunity_ID__c) == '妤煎眰寤虹瓚骞抽潰鍥�'||
+ AttTypeToISODate.get(iso.Opportunity_ID__c) == '鍏朵粬宸ョ▼鏂囦欢娓呭崟'){
+ if( iso.CAD_Upload_Date__c == null || AttTypeToISODate.get(iso.Opportunity_ID__c) == '鎵嬫湳瀹ゅ噣鍖栧钩闈㈠浘锛堝惈璁惧瀹氫綅锛�'){
+ iso.CAD_Upload_Date__c = Date.today();
+
+ }
+ }else if(AttTypeToISODate.get(iso.Opportunity_ID__c) == '椤圭洰鏂规涔�'){
+ iso.Program_Plan_Upload_Date__c = Date.today();
+ for(Opportunity op : opslist){
+ op.Project_decide_date__c = Date.today();
+ opslistUpdate.add(op);
+ System.debug('椤圭洰鏂规涔p'+opslistUpdate);
+ }
+ }else if(AttTypeToISODate.get(iso.Opportunity_ID__c) == '鎷涙爣鍙傛暟'){
+ iso.Param_Upload_Date__c = Date.today();
+ }else if(AttTypeToISODate.get(iso.Opportunity_ID__c) == '鏍囦功' ){
+ iso.Bid_Document_Upload_Date__c = Date.today();
+ for(Opportunity op : opslist){
+ op.bid_Confrim_Date__c = Date.today();
+ opslistUpdate.add(op);
+ }
+ }else if(AttTypeToISODate.get(iso.Opportunity_ID__c) == 'OCAP/TUV璁よ瘉'){
+ iso.ConfirmBook_Upload_Date__c = Date.today();
+ }
+ }
+ savepoint sp = Database.setsavepoint();
+ try{
+ update isoFileList;
+ if(opslistUpdate.size()>0){
+ update opslistUpdate;
+ }
+
+ }catch(exception o){
+ Database.rollback(sp);
+ return 'Failed: '+o;
+ system.debug('鏈嶅姟鍣ㄤ睛閿欙細'+o);
+ }
+ return 'Fin';
+ }
+ /**
+ OCM鎶ヤ环鐢紝褰撹浠风紪鐮佹洿鏂版椂锛屾姤浠风紪鐮佺浉搴旀敼鍙�
+ */
+ public static String ResetQuoteNo(List<id> oppidList){
+ List<Quote> UpdateQuoteList = new List<Quote>();
+ List<Opportunity> oppNoList = new List<Opportunity>();
+ Map<id,String> oppIdnoMap = new Map<id,String>();
+ oppNoList = [SELECT id,Opportunity_No__c from Opportunity where id in:oppNoList];
+ for(Opportunity ops : oppNoList){
+ oppIdnoMap.put(ops.id, ops.Opportunity_No__c);
+ }
+ UpdateQuoteList = [SELECT id,Quote_No__c,Opportunityid from Quote WHERE Opportunityid in:oppidList order by Opportunityid];
+ Integer index = 0;
+ id flgId = null;
+ for(Quote Qu : UpdateQuoteList){
+ if(flgId == null){
+ id ids = Qu.Opportunityid;
+ }
+ if(flgId == Qu.Opportunityid){
+ index ++;
+ }else{
+ flgId = Qu.Opportunityid;
+ index = 1;
+ }
+ Qu.Quote_No__c = oppIdnoMap.get(Qu.Opportunityid) + (index>9?(String.valueof(index)):('0'+String.valueof(index)));
+ }
+ return 'Fin';
+ }
+ /**
+ OCM_SI鏇存柊瀵瑰簲鎶ヤ环鐘舵�侊紝
+ */
+ WebService static String setQuote(string oppid){
+ system.debug('2323^^^^^^^^^^^^');
+ List<IS_Opportunity_Demand__c> updateList = [SELECT Quote_Locked_Date__c from IS_Opportunity_Demand__c WHERE Opportunity_ID__c =:oppid ];
+ for(IS_Opportunity_Demand__c iso : updateList){
+ iso.Quote_Locked_Date__c = Date.today();
+ }
+ update updateList;
+ return 'Fin';
+ }
+ /**
+ OCM璇环鎷嗗崟鐢紝鐢ㄦ潵澶嶅埗鍘熸湁璇环鐨勬姤浠�
+ */
+ public static String CopyQuoteFromOppor(id oldOppor,String opporName , id newOppor,Opportunity ModelOppor){
+ List<Quote> newQuoteList = new List<Quote>();
+ Map<id,id> newToold = new Map<id,id>();
+ Map<id,QuoteLineItem> QuidWithQLitem = new Map<id,QuoteLineItem>();
+ List<id> QuoteidOldList = new List<id>();
+ List<Opportunity> opGetname = [SELECT Opportunity_No__c from Opportunity where id = :newOppor];
+ if(opGetname.size()>0){
+ String nameCode = opGetname[0].Opportunity_No__c;
+ system.debug(nameCode+'nameCode');
+ }
+ String ele = '%'+ModelOppor.old_Oppo_No__c +'%';
+ List<Quote> countQu = [SELECT id from Quote WHERE Quote_No__c like :ele];
+ List<Quote> oldQuoteList = [SELECT Id,
+ Name,
+ CurrencyIsoCode,
+ CreatedDate,
+ OpportunityId,
+ Pricebook2Id,
+ ContactId,
+ QuoteNumber,
+ IsSyncing,
+ ShippingHandling,
+ Tax,
+ Status,
+ ExpirationDate,
+ Description,
+ Subtotal,
+ TotalPrice,
+ LineItemCount,
+ BillingName,
+ ShippingName,
+ QuoteToName,
+ AdditionalName,
+ Email,
+ Phone,
+ Fax,
+ AccountId,
+ Discount,
+ GrandTotal,
+ Agency1__c,
+ Agency1_Profit__c,
+ Agency1_Profit_Rate__c,
+ Agency2__c,
+ Agency2_Profit__c,
+ Agency2_Profit_Rate__c,
+ Agent1_Agent2_Price__c,
+ OCM_Agent1_Price__c,
+ OCM_Sales_Forecast__c,
+ Estimation_List_Price__c,
+ Stocking_Price__c,
+ Dealer_Final_Price__c,
+ Quote_No__c,
+ Stock_Pre_Arrangement__c,
+ Quote_Date__c,
+ Unit_Price__c,
+ Offer_Amount__c,
+ TOTAL__c,
+ Discount__c,
+ Pricing__c,
+ Preferential_Trading_Price__c,
+ Contract__c,
+ Quote_Expiration_Date__c,
+ Quote_Comment__c,
+ Discount_Amount_Calculate__c,
+ Discount_Amount__c,
+ Print_HP_Name__c,
+ Quote_Adjust_Amount__c,
+ Quote_Adjust_Calculate__c,
+ Quote_No_Auto__c,
+ Installation_location__c,
+ QuoteName__c,
+ PriceRefreshDate__c,
+ Quote_Print_Date__c,
+ OCM_Sales_Forecast_Without_Tax__c,
+ Quote_Decision__c,
+ Cancel_Decide__c,
+ TotalPrice__c,
+ Quote_Decision_Date__c,
+ Quote_CreatedDate__c,
+ IsSelected__c,
+ HasType3Machine__c,
+ OCM_Sales_Forecast_F__c,
+ Dealer_Final_Price_F__c,
+ Agent1_Agent2_Price_Page__c,
+ Dealer_Final_Price_Page__c,
+ OCM_Agent1_Price_Page__c,
+ QuoteTotal_Page__c,
+ Quote_Adjust_Amount_Page__c,
+
+ OCM_Agent1_Price_F__c,
+
+ Agent1_Agent2_Price_F__c,
+ Agency2_Profit_F__c,
+ Agency2_Profit_Rate_F__c,
+ Quote_Adjust_Amount_F__c,
+ Quote_Adjust_Calculate_F__c,
+ TotalPrice_F__c,
+ Discount_Amount_F__c,
+ Discount_Amount_Calculate_F__c,
+ BidAnnounce__c,
+ Quote_No_last2__c
+ FROM
+ Quote
+ WHERE
+ OpportunityId = :oldOppor
+ order by
+ CreatedDate];
+
+ Integer i = countQu.size();
+ i=1;
+ for(Quote Qu : oldQuoteList){
+ //瑕佹寜鐓у師鏈夐『搴忛噰鐣�
+ system.debug(Qu.Id+'===============4');
+ String title = ModelOppor.old_Oppo_No__c;
+ QuoteidOldList.add(Qu.Id);
+ Qu.Id = null;
+ Qu.OpportunityId = newOppor;
+ Qu.Quote_No__c = title.substring(0,title.length() - 7)+ModelOppor.Opp_Number__c+ '-'+(i>9?(String.valueof(i)):('0'+i));
+ newQuoteList.add(Qu);
+ i++;
+ }
+ Savepoint sp = Database.setSavepoint();
+ try{
+ insert newQuoteList;
+ } catch(Exception o){
+ Database.rollback(sp);
+ return 'Insert Failed'+o;
+ }
+ for(Integer k = 0; k < newQuoteList.size(); k++){
+ newToold.put(QuoteidOldList[k],newQuoteList[k].id);
+ }
+ List<QuoteLineItem> oldQuoteitemList = [Select Id,Asset_Model_No__c,SFDA_Status__c,Product_Sales_Possibility__c,
+ Name__c,BSS_Category__c,Quote.Quote_Print_Date__c,Quoteid,
+ Qty_Unit__c,Cost__c,UnitPrice__c,ListPrice__c,Quantity,TotalPrice__c,
+ PricebookEntry.Product2.SFDA_Status__c, ProductCode__c, Product_Cost__c,PricebookEntry.Product2.VenderName__c, Product2.VenderName__c,Product_ListPrice__c, PricebookEntry.Product2.Sales_Possibility__c, PricebookEntry.Product2.Name,
+ PricebookEntryId, PricebookEntry.Product2Id,UnitPrice_Page__c,PricebookEntry.Product2.Packing_list_manual__c,PricebookEntry.Product2.StorageStatus__c
+ // 2022-03-21 SWAG-CBX5NN start
+ ,If_Cancel_Guarantee__c
+ ,multiYearWarranty__c
+ ,CanNotCancelFlag__c
+ ,ProductEntend_gurantee_period_all__c
+ ,warrantyType__c
+ ,GuaranteePeriod__c
+ ,GuranteeType__c
+ // 2022-03-21 SWAG-CBX5NN end
+ From QuoteLineItem where Quoteid = :QuoteidOldList];
+ for(QuoteLineItem qli : oldQuoteitemList){
+ QuidWithQLitem.put(qli.Quoteid,qli);
+ }
+ system.debug(newToold+'newTooldnewTooldnewToold');
+ system.debug(QuoteidOldList+'QuoteListQuoteListQuoteList');
+ List<QuoteLineItem> copyQuoteItemList = new List<QuoteLineItem>();
+ for(String Qu : QuoteidOldList){
+ system.debug(Qu+'===============1');
+ for(QuoteLineItem qlir : oldQuoteitemList){
+ if(qlir.Quoteid == Qu){
+ system.debug(qlir+'===============2');
+ system.debug(QuidWithQLitem.get(Qu)+'===============3');
+ QuoteLineItem qli = qlir.clone();
+ qli.Quoteid = newToold.get(Qu);
+ qli.Id = null;
+ qli.UnitPrice = 0;
+ copyQuoteItemList.add(qli);
+ }
+
+ }
+ }
+ Savepoint spl = Database.setSavepoint();
+ try{
+ insert copyQuoteItemList;
+ } catch(Exception o){
+ Database.rollback(spl);
+ return 'Insert Failed copyQuoteItemList '+o;
+ }
+ return 'Fin';
+ }
+ /**
+ OCM鎶ヤ环鐢紝鍒ゆ柇SI闇�姹傝〃鐨勭姸鎬�
+ */
+ WebService static String getStatusForISO(id opporID){
+ //缈昏瘧宸叉壒鍑嗙殑鏁伴噺
+ Integer Abort = 0;
+ Integer Applying = 0;
+ Integer CommitCode = 0;
+ List<IS_Opportunity_Demand__c> isoList = [ SELECT
+ id,
+ name,
+ Abort_Date__c,
+ Approval_Date__c,
+ Func_SOD_Status__c
+ FROM
+ IS_Opportunity_Demand__c
+ where
+ Opportunity_ID__c = :opporID
+ AND
+ (
+ Approval_Date__c !=null
+ )];
+
+ if(isoList.size()==0){
+ return 'Abort';
+
+ }else if(isoList.size()>0){
+ return 'CommitCode';
+ }
+ return 'NoneIn';
+
+ }
+ /**
+ OCM鐢紝鍙栨秷SI闇�姹傝〃
+ */
+ WebService static String setAbortSI(id isoID,String AbortReason){
+ List<IS_Opportunity_Demand__c> updateList = new List<IS_Opportunity_Demand__c>();
+ List<id> oppidList = new List<id>();
+ List<Opportunity> Opplist = new List<Opportunity>();
+ if(AbortReason==null||String.isBlank(AbortReason)){
+ return '璇疯緭鍏ョ粓姝I闇�姹傚師鍥�';
+ }else{
+ updateList = [SELECT id,Abort_SI_Reason__c,Abort_Date__c,Opportunity_ID__c from IS_Opportunity_Demand__c where id = :isoID];
+ for(IS_Opportunity_Demand__c iso : updateList){
+ iso.Abort_SI_Reason__c = AbortReason;
+ iso.Abort_Date__c = Date.today();
+ oppidList.add(iso.Opportunity_ID__c);
+ }
+ Opplist = [SELECT Project_decide_date__c , Stock_Submit_Date__c , Stock_Confrim_Date__c from Opportunity WHERE id in:oppidList];
+ for(Opportunity ops : Opplist){
+ ops.Project_decide_date__c = null;
+ ops.Stock_Submit_Date__c = null;
+ ops.Stock_Confrim_Date__c = null;
+ }
+ Savepoint sp = Database.setSavepoint();
+ try{
+ update Opplist;
+ update updateList;
+ return 'Fin';
+ }catch (Exception o){
+ Database.rollback(sp);
+ return 'DataBase is Crashed,Connect with the Developer PLEASE';
+ }
+ }
+ }
+ /**
+ OCM璇环鐢紝鍙栨秷SI璇环锛屽皢鐩稿叧鑱旂殑SI闇�姹傝〃鏃犳晥鍖�
+ */
+ public static void updateSIodcList(List<String> OpporList){
+ //璇环澶卞崟锛屽皢璇环瀵瑰簲鐨凷I闇�姹傝〃鏃犳晥鍖�
+ List<IS_Opportunity_Demand__c> ODCLIST = new List<IS_Opportunity_Demand__c>();
+ ODCLIST = [SELECT id,Abort_Date__c from IS_Opportunity_Demand__c where Opportunity_ID__c in:OpporList and Abort_Date__c=null];
+ for(IS_Opportunity_Demand__c Od : ODCLIST){
+ Od.Abort_Date__c = Date.today();
+ }
+ update ODCLIST;
+ }
+ /*
+ =======================================================================================================================
+ ===================================================SI 璇环閮ㄥ垎util闆嗗悎=================================================
+ =======================================================================================================================
+ */
+ WebService static void addBatchIfLogForCnt(String typeStr, String operationType, String fileType, String hpId) {
+ BatchIF_Log__c log = new BatchIF_Log__c(
+ Type__c = typeStr,
+ Is_Error__c = 0
+ );
+ log.Account__c = hpId;
+ log.Log__c = operationType;
+ log.Log2__c = fileType;
+
+ insert log;
+ }
+
+ WebService 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();
+ }
+ }
+ // SWAG-BJ29Z4 钀ヤ笟鍔╃悊鍏变韩璇环瀛楁瀹℃壒鍔犲叆鍏变韩 start
+ WebService static String setOpportunityShare(String sobjectName, String parentId, List<String> userAccess, String ownerId) {
+ System.debug(sobjectName+'======'+parentId+'======'+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);
+ }
+ }
+ System.debug(sObjList+'======');
+ if (sObjList.size() > 0) insert sObjList;
+ return 'OK';
+ } catch (Exception e) {
+ return e.getMessage();
+ }
+ }
+ // SWAG-BJ29Z4 钀ヤ笟鍔╃悊鍏变韩璇环瀛楁瀹℃壒鍔犲叆鍏变韩 end
+
+ public static void insertBatchIfLog(BatchIF_Log__c bl) {
+ insert bl;
+ }
+
+ public static List<BatchIF_Log__c> getBatchIfLogForRequest(String typeStr, String hpId, Datetime dt) {
+ return [select Id from BatchIF_Log__c where Type__c = :typeStr and Account__c = :hpId
+ and RequestStatus__c != 'Finish' and RequestStatus__c != 'Error' and CreatedDate > :dt];
+ }
+ public static Integer getOlympusWorkDayCount(Date fromDate, Date toDate) {
+ AggregateResult[] calAggResult = [Select Count(Id) cnt From OlympusCalendar__c Where Date__c >= :fromDate And Date__c <= :toDate And IsWorkDay__c = 1];
+ Integer workDayCount = (Integer) calAggResult[0].get('cnt');
+ return workDayCount;
+ }
+
+ public static Pricebook2 getStandardPricebook() {
+ if (system.Test.isRunningTest()) {
+ return new Pricebook2(Id = System.Test.getStandardPricebookId(), Name = 'Standard Pricebook');
+ } else {
+ List<Pricebook2> pbs = [Select Id, Name From Pricebook2 where IsStandard = true AND isActive = true];
+ if (pbs.size() > 0) {
+ return pbs[0];
+ } else {
+ return null;
+ }
+ }
+ }
+ public static Set<Id> getAllSubRoleIds(Id userRoleId, String additionalRoleName) {
+ // currentRoleId 銇� additionalRoleName 銇俱仛 query銇欍倠
+ Map<Id, UserRole> parentRoleMap = new Map<Id, UserRole>();
+ Boolean isAdditional = false;
+ if (String.isBlank(additionalRoleName) == true) {
+ parentRoleMap = new MAP<Id, UserRole>([select Id from UserRole where Id = :userRoleId]);
+ } else {
+ isAdditional = true;
+ List<String> addtionalRoleNameList = additionalRoleName.split(',');
+ parentRoleMap = new MAP<Id, UserRole>([select Id from UserRole where Id = :userRoleId or DeveloperName in :addtionalRoleNameList]);
+ }
+ //MAP<Id, UserRole> parentRoleMap = new MAP<Id, UserRole>([select Id from UserRole where Id = :userRoleId or DeveloperName = :additionalRoleName]);
+ Map<Id, Set<Id>> allRoleMap = new Map<Id, Set<Id>>();
+ for (UserRole role : [select Id, ParentRoleId from UserRole]) {
+ Set<Id> roleIds = allRoleMap.get(role.ParentRoleId);
+ if (roleIds == null) {
+ roleIds = new Set<Id>();
+ }
+ roleIds.add(role.Id);
+ allRoleMap.put(role.ParentRoleId, roleIds);
+ }
+ return getSubRoleRecursive(parentRoleMap.keySet(), allRoleMap, isAdditional, userRoleId);
+ }
+
+ private static Set<Id> getSubRoleRecursive(Set<Id> roleIds, Map<Id, Set<Id>> allRoleMap, Boolean isAdditional, Id userRoleId) {
+ Set<Id> currentRoleIds = new Set<Id>();
+
+ // get all of the roles underneath the passed roles
+ for (Id parentRoleId : roleIds) {
+ if (allRoleMap.get(parentRoleId) != null) {
+ currentRoleIds.addAll(allRoleMap.get(parentRoleId));
+ }
+ }
+
+ // go fetch some more rolls!
+ if(currentRoleIds.size() > 0) {
+ currentRoleIds.addAll(getSubRoleRecursive(currentRoleIds, allRoleMap, isAdditional, userRoleId));
+ }
+
+ // 鍏艰伔銇牬鍚堛�佸吋鑱稲ole鑷韩銇甀d銈傚叆銈屻倠
+ if (isAdditional) {
+ roleIds.remove(userRoleId);
+ currentRoleIds.addAll(roleIds);
+ }
+ return currentRoleIds;
+ }
+
+ public static String getOppSearchSQOL(String visitorPlaceId, String nameCondition) {
+ Account a = null;
+ a = [select Id, Hospital__c, Agent_Ref__c, Parent.Parent.RecordType.DeveloperName, Parent.RecordType.DeveloperName, RecordType.DeveloperName from Account where Id=:visitorPlaceId];
+
+// String nameCondition = '%' + String.escapeSingleQuotes(query.replaceAll('%', '')) + '%';
+ system.debug('cond=' + nameCondition);
+
+ // 妞滅储
+ String queryString = '';
+ String temptoday = Date.today().format().replace('/', '-');
+ //String tempLastDate = Date.today().addDays(365).format().replace('/', '-');
+ String tempLastDate = Date.today().addDays(-365).format().replace('/', '-');
+ // 鐥呴櫌
+ if (a.Parent.Parent.RecordType.DeveloperName == 'HP') {
+ // queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and StageName IN (\'寮曞悎\',\'娉ㄦ畫\',\'鍑鸿嵎\') and RecordTypeId = \'01210000000QekK\' order by Name, Opportunity_No__c, Department_Name__c limit 31';
+ // 20200616 CHAN-BQM8LU vivek start
+ // 20191126 SWAG-BJA6JK LHJ Start
+ // queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and StageName IN (\'寮曞悎\',\'娉ㄦ畫\',\'鍑鸿嵎\') and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31';
+ // queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and StageName IN (\'寮曞悎\',\'娉ㄦ畫\') and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31';
+ //20210824 zh SWAG-C5S46P start
+ //queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c,Field1__c,CountNoInstall__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and ( StageName IN (\'寮曞悎\',\'娉ㄦ畫\') or ( StageName = \'鍑鸿嵎\' and CountNoInstall__c > 0 )) and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31';
+
+ //queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c,Field1__c,CountNoInstall__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and ( StageName IN (\'寮曞悎\',\'娉ㄦ畫\') or ( StageName = \'鍑鸿嵎\' and DeliveryDate__c > '+temptoday+' and DeliveryDate__c <= '+tempLastDate+')) and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31';
+ //20210824 zh SWAG-C5S46P end
+ // 20191126 SWAG-BJA6JK LHJ End
+ //20210826 mzy SWAG-C5S46P start
+ //鏀逛负鐢� 鍙戣揣瀹屾瘯鏃� 鍒ゆ柇 涓� 灏� 2012骞村垱寤虹殑涓旇浠风姸鎬佹槸鍙戣揣/瀹屾瘯鐨勬暟鎹帓闄�
+ //queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c,Field1__c,CountNoInstall__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and ( StageName IN (\'寮曞悎\',\'娉ㄦ畫\') or ( StageName = \'鍑鸿嵎\' and Shipping_Finished_Day__c > '+temptoday+' and Shipping_Finished_Day__c <= '+tempLastDate+' and CALENDAR_YEAR(Created_Day__c) != 2012 )) and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31';
+ queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c,Field1__c,CountNoInstall__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and ( StageName IN (\'寮曞悎\',\'娉ㄦ畫\') or ( StageName = \'鍑鸿嵎\' and Shipping_Finished_Day__c > '+tempLastDate+' and Shipping_Finished_Day__c <= '+temptoday+' and CALENDAR_YEAR(Created_Day__c) != 2012 )) and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31';
+ //20210826 mzy SWAG-C5S46P end
+ // 20200616 CHAN-BQM8LU vivek end
+ }
+ // 璨╁2搴�
+ else if (a.RecordType.DeveloperName == 'Agency') {
+ // queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' (Agency1__c=\'' + a.Id + '\' or Agency2__c=\'' + a.Id + '\') and StageName IN (\'寮曞悎\',\'娉ㄦ畫\',\'鍑鸿嵎\') and RecordTypeId = \'01210000000QekK\' order by Name, Opportunity_No__c, Department_Name__c limit 31';
+ // 20200616 CHAN-BQM8LU vivek start
+ // 20191126 SWAG-BJA6JK LHJ Start
+ // queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' (Agency1__c=\'' + a.Id + '\' or Agency2__c=\'' + a.Id + '\') and StageName IN (\'寮曞悎\',\'娉ㄦ畫\',\'鍑鸿嵎\') and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31';
+ //queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' (Agency1__c=\'' + a.Id + '\' or Agency2__c=\'' + a.Id + '\') and StageName IN (\'寮曞悎\',\'娉ㄦ畫\') and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31';
+ //20210824 zh SWAG-C5S46P start
+ //queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c,Field1__c,CountNoInstall__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and ( StageName IN (\'寮曞悎\',\'娉ㄦ畫\') or ( StageName = \'鍑鸿嵎\' and CountNoInstall__c > 0 )) and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31';
+
+ //queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c,Field1__c,CountNoInstall__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and ( StageName IN (\'寮曞悎\',\'娉ㄦ畫\') or ( StageName = \'鍑鸿嵎\' and DeliveryDate__c > '+temptoday+' and DeliveryDate__c <= '+tempLastDate+')) and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31';
+ //20210824 zh SWAG-C5S46P end
+ //20210826 mzy SWAG-C5S46P start
+ //鏀逛负鐢� 鍙戣揣瀹屾瘯鏃� 鍒ゆ柇 涓� 灏� 2012骞村垱寤虹殑涓旇浠风姸鎬佹槸鍙戣揣/瀹屾瘯鐨勬暟鎹帓闄�
+ //queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c,Field1__c,CountNoInstall__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and ( StageName IN (\'寮曞悎\',\'娉ㄦ畫\') or ( StageName = \'鍑鸿嵎\' and Shipping_Finished_Day__c > '+temptoday+' and Shipping_Finished_Day__c <= '+tempLastDate+' and CALENDAR_YEAR(Created_Day__c) != 2012 )) and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31';
+ queryString = 'Select Id, Opportunity_No__c, Name, toLabel(StageName), Department_Name__c,Field1__c,CountNoInstall__c, Close_Forecasted_Date__c, Competitor__c, Wholesale_Price__c from Opportunity where' + nameCondition + ' Account.Hospital__c=\'' + a.Hospital__c + '\' and ( StageName IN (\'寮曞悎\',\'娉ㄦ畫\') or ( StageName = \'鍑鸿嵎\' and Shipping_Finished_Day__c > '+tempLastDate+' and Shipping_Finished_Day__c <= '+temptoday+' and CALENDAR_YEAR(Created_Day__c) != 2012 )) and RecordTypeId in (\'01210000000QekK\',\'012100000006KMeAAM\') order by Name, Opportunity_No__c, Department_Name__c limit 31';
+ //20210826 mzy SWAG-C5S46P end
+ // 20191126 SWAG-BJA6JK LHJ End
+ // 20200616 CHAN-BQM8LU vivek end
+ }
+
+ return queryString;
+ }
+ // 鐢ㄦ潵瑙e喅缁忛攢鍟嗘椿鍔ㄧ殑鎷呭綋
+ public static List<Agency_Opportunity__c> DatabaseQuery(String soql){
+ return DataBase.query(soql);
+ }
+
+ public class myException extends Exception {}
+
+ WebService static String qureySoql(String soql) {
+ List<SObject> rtnList = Database.query(soql);
+ String rtnJSON = JSON.serialize(Database.query(soql), true);
+ System.debug('rtnJSON:' + rtnJSON);
+ return rtnJSON;
+ }
+
+ // GIR 椤圭洰闇�姹傜敤锛屾壘涓嶅埌Add_report鐨勬祴璇曠▼搴� 20191219 by vivek start
+ WebService static Account getAccountForJs(String id){
+ return [select Id, Name, Province_formula__c, Hospital__r.Salesdepartment_HP__c,Department_Class__r.Name,Department_Class__r.OwnerId, Department_Class__r.Owner.Name, Department_Class__r.Id, OwnerId, Owner.Name,
+ Hospital__r.Name, Hospital__r.Id, Hospital__r.OCM_Category__c,Hospital__r.OCM_Management_Province__r.GI_assistant__c,Hospital__r.OCM_Management_Province__r.GI_assistant__r.Name
+ from Account where Id = :id];
+ }
+ // GIR 椤圭洰闇�姹傜敤锛屾壘涓嶅埌Add_report鐨勬祴璇曠▼搴� 20191219 by vivek end
+
+ // 浠诲姟鍜屾棩鎶� 2020-05-23 update by vivek start
+ public static Event__c getNoIdEventC(Event__c dlyevt){
+ dlyevt.Id = null;
+ return dlyevt;
+ }
+ public static Event getNoIdEvent(Event dlyec){
+ dlyec.Id = null;
+ return dlyec;
+
+ }
+ public static Event getEventList(Id eventcid){
+ Event dlyec = [select id, ActivityDate, OwnerId, Subject, task_id__c,whatid__c, EventC_ID__c, NextEventC_ID__c, AppCdId__c, SyncCreatedDate__c,
+ StartDateTime, DurationInMinutes, Main_Visit_Location__c, Activity_Type2__c, IsScheduled__c, BeforeActivityDate__c,
+ Visitor1__c, Visitor2__c, Visitor3__c, Visitor4__c, Visitor5__c, Visitor1_ID__c, Visitor2_ID__c, Visitor3_ID__c, Visitor4_ID__c, Visitor5_ID__c,
+ Purpose_Type__c, Location, Related_Opportunity1__c, Related_Service1__c, Related_Opportunity1_ID__c, Related_Service1_ID__c, WS_flg__c,
+ Related_Opportunity2__c, Related_Opportunity3__c, Related_Opportunity4__c, Related_Opportunity5__c,OPDPlan_Flag__c,
+ Related_Opportunity2_ID__c, Related_Opportunity3_ID__c, Related_Opportunity4_ID__c, Related_Opportunity5_ID__c,
+ Activity_Purpose__c, Activity_PurposeFSE__c, Activity_PurposeEscFSE__c, Purpose_TypeFSE__c, Purpose_TypeEscFSE__c,Opd_Plan__c
+ from Event where EventC_ID__c = :eventcid];
+ return dlyec;
+ }
+
+ public static List<Event> getEventsList(Set<String> eventcid){
+ List<Event> dlyec = [select id, ActivityDate, OwnerId, Subject, whatid__c,task_id__c, EventC_ID__c, NextEventC_ID__c, AppCdId__c, SyncCreatedDate__c,
+ StartDateTime, DurationInMinutes, Main_Visit_Location__c, Activity_Type2__c, IsScheduled__c, BeforeActivityDate__c,
+ Visitor1__c, Visitor2__c, Visitor3__c, Visitor4__c, Visitor5__c, Visitor1_ID__c, Visitor2_ID__c, Visitor3_ID__c, Visitor4_ID__c, Visitor5_ID__c,
+ Purpose_Type__c, Location, Related_Opportunity1__c, Related_Service1__c, Related_Opportunity1_ID__c, Related_Service1_ID__c, WS_flg__c,
+ Related_Opportunity2__c, Related_Opportunity3__c, Related_Opportunity4__c, Related_Opportunity5__c,OPDPlan_Flag__c,
+ Related_Opportunity2_ID__c, Related_Opportunity3_ID__c, Related_Opportunity4_ID__c, Related_Opportunity5_ID__c,
+ Activity_Purpose__c, Activity_PurposeFSE__c, Activity_PurposeEscFSE__c, Purpose_TypeFSE__c, Purpose_TypeEscFSE__c
+ from Event where Id = :eventcid];
+ return dlyec;
+ }
+ // 浠诲姟鍜屾棩鎶� 2020-05-23 update by vivek end
+
+ //澶变絾鎶ュ憡鐢宠淇濆瓨 2021-09-13 upsert zxk start
+ public static void lostOrder(Lost_Report__c lostData) {
+ upsert lostData;
+ }
+
+ // FY23淇敼 WLIG-CFV4AV 閲嶇偣浜у搧缁存姢锛堟柊锛塻tart
+ public static String getKeyByProduct(String keyword) {
+ if (String.isBlank(keyword)) {
+ return null;
+ }
+ String KeyProductMapping = System.Label.Key_Product_Mapping;
+ Map<String, Object> mapping = (Map<String, Object>) JSON.deserializeUntyped(KeyProductMapping);
+ System.debug('==Mapping is: ' + mapping);
+
+ return mapping.get(keyword) != null ? String.valueOf(mapping.get(keyword)) : null;
+ }
+ // FY23淇敼 WLIG-CFV4AV 閲嶇偣浜у搧缁存姢锛堟柊锛塭nd
+
+ //20221021 lt SWAG-CHL5XA銆怓Y23璇环鏀瑰杽銆�-缁熻涓绘満鍙版暟 start
+ public static void UpdateBiddingFlag(List<String> oppId){
+ List<Tender_Opportunity_Link__c> links = [SELECT Id, Tender_information__c, Tender_information__r.IsReactionOpp__c, Opportunity__c
+ FROM Tender_Opportunity_Link__c
+ WHERE Opportunity__c in :oppId ];
+
+ Map<String,Tender_information__c> tenderMap = new Map<String,Tender_information__c>();
+
+ for (Tender_Opportunity_Link__c link : links){
+
+ Tender_information__c temptender = new Tender_information__c();
+ temptender.Id = link.Tender_information__c;
+ temptender.IsReactionOpp__c = true;
+ tenderMap.put(temptender.id ,temptender);
+
+ }
+
+ if(tenderMap.size()>0){
+ update tenderMap.values();
+ }
+
+ }
+ //20221021 lt SWAG-CHL5XA銆怓Y23璇环鏀瑰杽銆�-缁熻涓绘満鍙版暟 end
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/ControllerUtil.cls-meta.xml b/force-app/main/default/classes/ControllerUtil.cls-meta.xml
new file mode 100644
index 0000000..b12420e
--- /dev/null
+++ b/force-app/main/default/classes/ControllerUtil.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>31.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LightingButtonConstant.cls b/force-app/main/default/classes/LightingButtonConstant.cls
new file mode 100644
index 0000000..c68ab80
--- /dev/null
+++ b/force-app/main/default/classes/LightingButtonConstant.cls
@@ -0,0 +1,80 @@
+global without sharing class LightingButtonConstant {
+ //鎺堟潈鐢宠鐨勭姸鎬佲�樺凡鎻愪氦鈥�
+ public static final String STATUS_Application_Submitted = '宸叉彁浜�';
+ //鎺堟潈鐢宠鐨勭姸鎬佲�樿崏妗堜腑鈥�
+ public static final String STATUS_Application_CancelSubmit= '鑽夋涓�';
+ //鎺堟潈鐢宠鐨勮褰曠被鍨嬪悕鈥樻巿鏉冪敵璇封��
+ public static final String RECORD_TYPE_NAME_Application = '鎺堟潈鐢宠';
+ //鍛ㄦ姤鏈堟姤鐨勭姸鎬佲�樿崏妗堜腑鈥�
+ public static final String STATUS_DRAFT = '鑽夋涓�';
+ //鎶ュ憡涔︾殑鐘舵�佲�樺畬姣曗��
+ public static final String STATUS_COMPLETE = '瀹屾瘯';
+ //鎶ュ憡涔︾殑鐘舵�佲�樺彇娑堚��
+ public static final String STATUS_CANCEL = '鍙栨秷';
+ //OCSM鎶ュ憡鐨勭姸鎬佲�樺緟鎶ュ憡鈥�
+ public static final String STATUS_TO_BE_REPORTED = '寰呮姤鍛�';
+ //OCSM鎶ュ憡鐨勭姸鎬佲�樻棤闇�鎶ュ憡鈥�
+ public static final String STATUS_TO_NOT_REPORT = '鏃犻渶鎶ュ憡';
+ //VOC鎶ュ憡鐨勭姸鎬佲�樼粨鏋滅‘璁ゅ畬姣曗��
+ public static final String STATUS_VOC_CONFIRMED = '缁撴灉纭瀹屾瘯';
+ //VOC鎶ュ憡鐨勭姸鎬佲�樺洖绛斿畬姣曗��
+ public static final String STATUS_VOC_END_OF_ANSWER = '鍥炵瓟瀹屾瘯';
+ //VOC鎶ュ憡鐨勭姸鎬佲�樼敵璇蜂腑鈥�
+ public static final String STATUS_VOC_APPLYING = '鐢宠珛涓�';
+ //VOC鎶ュ憡鐨勭姸鎬佲�樺垽瀹氬畬姣曗��
+ public static final String STATUS_VOC_CHECK_OVER = '鍒ゅ畾瀹屾瘯';
+ //VOC鎶ュ憡鐨勭姸鎬佲�樺~鍐欏畬姣曗��
+ public static final String STATUS_VOC_WRITE_OVER = '濉啓瀹屾瘯';
+ //VOC鎶ュ憡鐨勭姸鎬佲�樺畬姣曗��
+ public static final String STATUS_VOC_FINISH = '瀹屾瘯';
+ //QIS鐨勭姸鎬佲�極SH妫�娴嬩腑鈥�
+ public static final String STATUS_QIS_OSH_TESTING = 'OSH妫�娴嬩腑';
+ //QIS鐨勭姸鎬佲�極SH濉啓瀹屾瘯鈥�
+ public static final String STATUS_QIS_OSH_COMPLATED = 'OSH濉啓瀹屾瘯';
+ //QIS鐨勭姸鎬佲�極SH妫�娴嬬敵璇封��
+ public static final String STATUS_QIS_OSH_TESTING_APP = 'OSH妫�娴嬬敵璇�';
+ //QIS鐨勭姸鎬佲�楻C濉啓瀹屾瘯鈥�
+ public static final String STATUS_QIS_RC_COMPLATED = 'RC濉啓瀹屾瘯';
+ //QIS鐨勭姸鎬佲�樺彇娑堢敵璇封��
+ public static final String STATUS_QIS_CANCEL = '鍙栨秷鐢宠';
+ //QIS鐨勭姸鎬佲�楻C妫�娴嬩腑鈥�
+ public static final String STATUS_QIS_RC_CHECKING = 'RC妫�娴嬩腑';
+ //QIS鐨勭姸鎬佲�楩SE濉啓瀹屾瘯鈥�
+ public static final String STATUS_QIS_FSE_COMPLATED = 'FSE濉啓瀹屾瘯';
+ //QIS鐨勭姸鎬佲�樺畬姣曗��
+ public static final String STATUS_QIS_COMPLATED = '瀹屾瘯';
+ //鍛ㄦ姤鏈堟姤鐨勮褰曠被鍨嬪悕鈥樺懆鎶モ��
+ public static final String RECORD_TYPE_NAME_BY_MONTHLY_REPORT = '鍛ㄦ姤';
+ //鎶ュ憡涔︾殑璁板綍绫诲瀷鈥樻彁浜も��
+ public static final String RECORD_TYPE_NAME_BY_SUBMIT = '鎻愪氦';
+ //鎶ュ憡涔︾殑璁板綍绫诲瀷鈥樿窡鍙扳��
+ public static final String RECORD_TYPE_NAME_BY_FOLLOW_THE_STAGE = '璺熷彴';
+ //鎶ュ憡涔︾殑璁板綍绫诲瀷鈥極PD鈥�
+ public static final String RECORD_TYPE_NAME_BY_OPD= 'OPD';
+ //QIS鐨勮褰曠被鍨嬧��3.OSH鈥�
+ public static final String RECORD_TYPE_NAME_BY_OSH= '3.OSH';
+ //QIS鐨勮褰曠被鍨嬧��4.OSH鍥炵瓟瀹屾瘯鈥�
+ public static final String RECORD_TYPE_NAME_BY_OSH_FINASH= '4.OSH鍥炵瓟瀹屾瘯';
+ //QIS鐨勮褰曠被鍨嬧��9.Final 瀹屾瘯鈥�
+ public static final String RECORD_TYPE_NAME_BY_FINAL= '9.Final 瀹屾瘯';
+ //QIS鐨勮褰曠被鍨嬧��5.鐜板満缁撴鈥�
+ public static final String RECORD_TYPE_NAME_BY_COMP= '5.鐜板満缁撴';
+ //璁板綍绫诲瀷鐨刣eveloperName鈥楢SRCDecision鈥�
+ public static final String DEVELOPER_NAME_ASRC_DECISION = 'ASRCDecision';
+ //璁板綍绫诲瀷鐨刣eveloperName鈥楢SACDecision鈥�
+ public static final String DEVELOPER_NAME_ASAC_DECISION = 'ASACDecision';
+ //宸ヤ綔鍒嗙被鐨勯攢鍞湇鍔�
+ public static final String TYPE_OF_SALES_SERVICES = '閿�鍞湇鍔�';
+ //userAccess鍙傛暟鍚庣紑_Edit
+ public static final String USER_ACCESS_EDIT = '_Edit';
+ //userAccess鍙傛暟鍚庣紑_Read
+ public static final String USER_ACCESS_READ = '_Read';
+ public static final String CN_YES = '鏄�';
+ public static final String CN_NO = '鍚�';
+ public static final String VOC_NAME = 'VOC';
+ public static final String OK = 'OK';
+ public static final String SOBJECT_NAME_OF_REPORT_SHARE ='Report__Share';
+ public static final String SOBJECT_NAME_OF_VOC_SHARE = 'VOCShare__c';
+
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LightingButtonConstant.cls-meta.xml b/force-app/main/default/classes/LightingButtonConstant.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/LightingButtonConstant.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/MonthlyReportController.cls b/force-app/main/default/classes/MonthlyReportController.cls
new file mode 100644
index 0000000..3822866
--- /dev/null
+++ b/force-app/main/default/classes/MonthlyReportController.cls
@@ -0,0 +1,95 @@
+public with sharing class MonthlyReportController {
+ //涓哄彇娑堟彁浜ょ浉搴旂殑js鎻愪緵鍒濆鍖栨暟鎹�
+ @AuraEnabled
+ public static InitData initForCancelSubmitButton (String recordId){
+ InitData res = new initData();
+ try{
+ Monthly_Report__c report = [SELECT OwnerId,Id,Next_week_plan__c FROM Monthly_Report__c WHERE Id = :recordId LIMIT 1];
+ res.OwnerId = report.OwnerId;
+ res.Id = report.Id;
+ res.nextWeekPlan = report.Next_week_plan__c;
+ System.debug(LoggingLevel.INFO, '*** res: ' + res);
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+
+ //涓哄垱寤簄otes閭鎿嶄綔鎻愪緵鍒濆鍖栨暟鎹�
+ @AuraEnabled
+ public static InitData initForCreateNoteEmailButton (String recordId) {
+ InitData res = new initData();
+ try{
+ Monthly_Report__c report = [SELECT
+ Owner_email__c,
+ Owner_alias__c,
+ Key_issue__c,
+ Feedback__c,
+ Task_follow__c,
+ Other_issue__c,
+ Next_week_plan__c,
+ Dr_Sum_URL__c
+ FROM Monthly_Report__c WHERE Id = :recordId LIMIT 1];
+ String userName = UserInfo.getUserName();
+ User activeUser = [Select Email From User where Username = : userName limit 1];
+ String userEmail = activeUser.Email;
+ res.ownerEmail = report.Owner_email__c;
+ res.ownerAlias = report.Owner_alias__c;
+ res.keyIssue = report.Key_issue__c;
+ res.feedBack = report.Feedback__c;
+ res.taskFollow = report.Task_follow__c;
+ res.otherIssue = report.Other_issue__c;
+ res.nextWeekPlan = report.Next_week_plan__c;
+ res.drSumUrl = report.Dr_Sum_URL__c;
+ res.userEmail = activeUser.Email;
+
+ System.debug(LoggingLevel.INFO, '*** res: ' + res);
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+ //鍙栨秷鎻愪氦鎿嶄綔鏇存柊鐩稿簲鏁版嵁
+ @AuraEnabled
+ public static void 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;
+ report.RecordTypeId = Schema.SObjectType.Monthly_Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_BY_MONTHLY_REPORT).getRecordTypeId();
+ report.Submit_check_flag__c = false;
+ report.Submit_time__c = null;
+ update report;
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ } finally {
+
+ }
+
+ }
+
+
+ public class InitData{
+ @AuraEnabled
+ public String Id;
+ @AuraEnabled
+ public String OwnerId;
+ @AuraEnabled
+ public String ownerEmail;
+ @AuraEnabled
+ public String ownerAlias;
+ @AuraEnabled
+ public String keyIssue;
+ @AuraEnabled
+ public String feedBack;
+ @AuraEnabled
+ public String taskFollow;
+ @AuraEnabled
+ public String otherIssue;
+ @AuraEnabled
+ public String nextWeekPlan;
+ @AuraEnabled
+ public String drSumUrl;
+ @AuraEnabled
+ public String userEmail;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/MonthlyReportController.cls-meta.xml b/force-app/main/default/classes/MonthlyReportController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/MonthlyReportController.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/QISReportController.cls b/force-app/main/default/classes/QISReportController.cls
new file mode 100644
index 0000000..3b375e1
--- /dev/null
+++ b/force-app/main/default/classes/QISReportController.cls
@@ -0,0 +1,471 @@
+public with sharing class QISReportController {
+ // Final universal code缂栬緫
+ @AuraEnabled
+ public static InitData initForQisUniversalFailureCodeButton (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;
+ }
+
+ @AuraEnabled
+ public static InitData sqlForPAE (String qisReportId){
+ InitData res = new initData();
+
+ String recordTypeId = LightingButtonConstant.DEVELOPER_NAME_ASAC_DECISION;
+ try{
+ PAE_DecisionRecord__c RCPAEDIdList = [SELECT LastModifiedDate, Id, Name, LastModifiedById,RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_QIS__c = :qisReportId And RecordType.DeveloperName = :recordTypeId limit 1];
+ res.pAEid = RCPAEDIdList.id;
+ System.debug(LoggingLevel.INFO, '*** res: ' + res);
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+
+ //Intake universal code缂栬緫
+ @AuraEnabled
+ public static InitData initForlexQISIntakeuniversalcodeButton (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;
+ }
+
+ @AuraEnabled
+ public static InitData sqlForPAE1 (String qisReportId){
+ InitData res = new initData();
+
+ String recordTypeId = LightingButtonConstant.DEVELOPER_NAME_ASRC_DECISION;
+ try{
+ PAE_DecisionRecord__c ASRCDIdList = [SELECT LastModifiedDate, Id, Name, LastModifiedById,RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_QIS__c = :qisReportId And RecordType.DeveloperName = :recordTypeId Limit 1];
+ res.pAEid = ASRCDIdList.id;
+ System.debug(LoggingLevel.INFO, '*** res: ' + res);
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+ //OSH鐜板搧鏀跺埌
+ @AuraEnabled
+ public static InitData initForOSHRecievedButton (String recordId){
+ InitData res = new initData();
+ try{
+ QIS_Report__c report = [SELECT id,QIS_Status__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+ res.Id = report.Id;
+ 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 updateQis (String recordId){
+ String re = '鎴愬姛';
+ try{
+ ID myUserID = UserInfo.getUserId();
+
+ User tempUser = [select id,Alias,Email from user where id = : myUserID ];
+ QIS_Report__c rac = new QIS_Report__c();
+ rac.id = recordId;
+ rac.QIS_Status__c = LightingButtonConstant.STATUS_QIS_OSH_TESTING;
+ rac.OSHRecievedDate__c = Date.today();
+ rac.OSH_Receive_staff__c = tempUser.Alias;
+ rac.OSH_staff__c = tempUser.Alias;
+ rac.OSH_staff_email__c = tempUser.email;
+ rac.Is_ProductGot__c = true;
+ rac.OSH_GotProductPeople__c = tempUser.id;
+ User resultSet = [SELECT Id, JingliApprovalManager__c, BuchangApprovalManager__c, ZongjianApprovalManager__c FROM User WHERE Id = :myUserID];
+ if (resultSet!=null && resultSet.JingliApprovalManager__c != null && resultSet.BuchangApprovalManager__c != null ) {
+ rac.OSH_Manager__c = resultSet.JingliApprovalManager__c;
+ rac.OSH_Buzhang__c = resultSet.BuchangApprovalManager__c;
+ }else{
+ rac.OSH_Manager__c= myUserID;
+ rac.OSH_Buzhang__c= myUserID;
+ }
+ Oly_TriggerHandler.bypass('QIS_ReportTrigger');
+ update rac;
+
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ re = e.getMessage();
+ }
+ return re;
+ }
+
+ //鎻愪氦寰呭鎵�1
+ @AuraEnabled
+ public static InitData initForOSHSubmitButton (String recordId){
+ InitData res = new initData();
+ try{
+ QIS_Report__c report = [SELECT id,QIS_Status__c,OSH_staff__c,OSH_staff_email__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+ res.Id = report.Id;
+ res.QIStatus = report.QIS_Status__c;
+ res.OSHstaff = report.OSH_staff__c;
+ res.OSHstaffEmail = report.OSH_staff_email__c;
+ System.debug(LoggingLevel.INFO, '*** res: ' + res);
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+ @AuraEnabled
+ public static String updateQis1 (String recordId){
+ String re = '鎴愬姛';
+ try{
+
+ QIS_Report__c rac = new QIS_Report__c();
+ rac.id = recordId;
+ rac.QIS_Status__c = LightingButtonConstant.STATUS_QIS_OSH_COMPLATED;
+ update rac;
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ re = e.getMessage();
+ }
+ return re;
+ }
+ //鎻愪氦寰呭鎵�
+ @AuraEnabled
+ public static InitData initForRCSubmitButton (String recordId){
+ InitData res = new initData();
+ try{
+ QIS_Report__c report = [SELECT id,RC_problem_not_found__c,QIS_Reply_day__c,RC_inspection_date__c,QIS_Status__c,Cancel_QIS_Reason__c,OSH_staff__c,OSH_staff_email__c,RC__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+ res.Id = report.Id;
+ res.QIStatus = report.QIS_Status__c;
+ res.OSHstaff = report.OSH_staff__c;
+ res.OSHstaffEmail = report.OSH_staff_email__c;
+ res.CancelQISReason = report.Cancel_QIS_Reason__c;
+ res.RCid = report.RC__c;
+ res.RCinspectionDate = report.RC_inspection_date__c;
+ res.QISReplyDay = report.QIS_Reply_day__c;
+ res.RCproblemnotfound = report.RC_problem_not_found__c;
+ System.debug(LoggingLevel.INFO, '*** res: ' + res);
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+
+ @AuraEnabled
+ public static String updateQisWithRC (String recordId,String type,String oldQIStatus){
+ String re = '鎴愬姛';
+
+ ID myUserID = UserInfo.getUserId();
+ User userinfo = [SELECT Id, JingliApprovalManager__c, BuchangApprovalManager__c, ZongjianApprovalManager__c, BuchangApprovalManagerSales__c, SalesManager__c FROM User WHERE Id = :myUserID LIMIT 1];
+ QIS_Report__c rac = new QIS_Report__c();
+ rac.id = recordId;
+ if (type == '1') {
+ QIS_Report__c report1 = [SELECT id,RC_problem_not_found__c,RC_FixedJudgement__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+ rac.QIS_Status__c = LightingButtonConstant.STATUS_QIS_RC_COMPLATED;
+ if (report1.RC_problem_not_found__c == true && report1.RC_FixedJudgement__c == false) {
+ QIS_Report__c qisreport = [SELECT Id, Reason_bloken__c, Special_follow__c, next_action__c, QIS_Reply_Comment__c, OCM_judgement__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+ if (qisreport != null) {
+ rac.Reason_bloken1__c = qisreport.Reason_bloken__c;
+ rac.Special_follow1__c = qisreport.Special_follow__c;
+ rac.next_action1__c = qisreport.next_action__c;
+ rac.QIS_Reply_Comment1__c = qisreport.QIS_Reply_Comment__c;
+ rac.OCM_judgement1__c = qisreport.OCM_judgement__c;
+ }
+ }
+ }
+ if (type == '2') {
+ rac.QIS_Status__c = LightingButtonConstant.STATUS_QIS_CANCEL;
+ rac.QIS_Cancel_Submit_day__c = Date.today();
+ }
+ try{
+ if (userinfo!=null && userinfo.BuchangApprovalManagerSales__c != null) {
+ rac.RC_Manager__c = userinfo.BuchangApprovalManagerSales__c;
+ }else{
+ rac.RC_Manager__c = myUserID;
+ }
+ if (userinfo!=null) {
+ if (oldQIStatus == LightingButtonConstant.STATUS_QIS_RC_CHECKING) {
+ rac.RC__c = myUserID;
+ }
+ if (userinfo.SalesManager__c != null ) {
+ rac.ApproveManager__c = userinfo.SalesManager__c;
+ }else{
+ rac.ApproveManager__c = myUserID;
+ }
+ if (userinfo.BuchangApprovalManagerSales__c != null ) {
+ rac.ApproveBuZhang__c = userinfo.BuchangApprovalManagerSales__c ;
+ }else{
+ rac.ApproveBuZhang__c = myUserID;
+ }
+ if (userinfo.ZongjianApprovalManager__c != null ) {
+ rac.AppeoveZongJian__c = userinfo.ZongjianApprovalManager__c ;
+ }else{
+ rac.AppeoveZongJian__c = myUserID;
+ }
+ }
+ update rac;
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ re = e.getMessage();
+ }
+ return re;
+ }
+ // 鎻愪氦
+ @AuraEnabled
+ public static InitData initForOCMSubmitButton (String recordId){
+ InitData res = new initData();
+ try{
+ QIS_Report__c report = [SELECT id,is_aohui_product__c,QIS_Status__c,OCM_Manager_Mail_F__c,QISInstallDate__c,contract_number__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+ res.Id = report.Id;
+ res.QIStatus = report.QIS_Status__c;
+ res.QISInstallDate = report.QISInstallDate__c;
+ res.contractnumber = report.contract_number__c;
+ res.isaohuiproduct = report.is_aohui_product__c;
+ System.debug(LoggingLevel.INFO, '*** res: ' + res);
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+
+ @AuraEnabled
+ public static String updateQisWithOCM (String recordId){
+ String re = '鎴愬姛';
+ QIS_Report__c report = [SELECT id,QIS_Status__c,QISInstallDate__c,contract_number__c,OCM_Manager_Mail_F__c
+ ,OCM_Member_Mail_F__c,OCM_Repair_Mail_F__c,OCM_Repair_Mail1_F__c,FSE_Special_Mail_F__c,FSE_Special_Manager_Mail_F__c
+ ,WorkLocation_CC_Mail_F__c,is_aohui_product__c,QuolityApproveResult__c
+ FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+ try{
+ QIS_Report__c rac = new QIS_Report__c();
+ rac.id = recordId;
+ rac.QIS_Status__c = LightingButtonConstant.STATUS_QIS_FSE_COMPLATED;
+ rac.OCM_Manager_Mail__c = report.OCM_Manager_Mail_F__c;
+ rac.OCM_Member_Mail__c = report.OCM_Member_Mail_F__c;
+ rac.OCM_Repair_Mail__c = report.OCM_Repair_Mail_F__c;
+ rac.OCM_Repair_Mail1__c = report.OCM_Repair_Mail1_F__c;
+ rac.FSE_Special_Mail__c = report.FSE_Special_Mail_F__c;
+ rac.FSE_Special_Manager_Mail__c = report.FSE_Special_Manager_Mail_F__c;
+ rac.WorkLocation_CC_Mail__c = report.WorkLocation_CC_Mail_F__c;
+ rac.Cancel_QIS_Reason__c = null;
+ if (report.is_aohui_product__c == true) {
+ rac.OCM_judgement__c = '璐ㄩ噺闂';
+ rac.next_action__c = '鏃犲伩缁翠慨';
+ rac.RecordTypeId = Schema.SObjectType.QIS_Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_BY_OSH).getRecordTypeId();
+ rac.QIS_Status__c = LightingButtonConstant.STATUS_QIS_OSH_TESTING_APP;
+ }
+ if (report.QuolityApproveResult__c == null || report.QuolityApproveResult__c == '') {
+ rac.QuolityApproveResult__c = '3.宸插鏍革紝涓�鑸川閲忛棶棰�';
+ }
+ update rac;
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ re = e.getMessage();
+ }
+ return re;
+ }
+
+ // QIS缁撴灉璺熻繘瀹屾瘯
+ @AuraEnabled
+ public static InitData initForQisAgreeButton (String recordId){
+ InitData res = new initData();
+ try{
+ QIS_Report__c report = [SELECT id ,OwnerId FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+ res.Id = report.Id;
+ res.ownerId = report.OwnerId;
+ System.debug(LoggingLevel.INFO, '*** res: ' + res);
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+
+ @AuraEnabled
+ public static String updateQisForQisAgree (String recordId){
+ String re = '鎴愬姛';
+ ID myUserID = UserInfo.getUserId();
+
+ String answerComp = Schema.SObjectType.QIS_Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_BY_OSH_FINASH).getRecordTypeId();
+ String fina = Schema.SObjectType.QIS_Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_BY_FINAL).getRecordTypeId();
+ String comp = Schema.SObjectType.QIS_Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_BY_COMP).getRecordTypeId();
+ // RecordType rectyp = [SELECT id ,name FROM RecordType where id = '01210000000gFTH'];
+ QIS_Report__c report = [SELECT id,OwnerId,RecordTypeId FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+ try{
+ if (report.ownerid == myUserID) {
+ QIS_Report__c rac = new QIS_Report__c();
+ rac.id = recordId;
+ rac.QIS_Status__c = LightingButtonConstant.STATUS_QIS_COMPLATED;
+ if (report.RecordTypeId == answerComp) {
+ rac.RecordTypeId = fina;
+ }else{
+ rac.RecordTypeId = comp;
+ }
+ rac.QIS_Complete_Day__c = Date.today();
+ update rac;
+ }
+
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ re = e.getMessage();
+ }
+ return re;
+ }
+ //OCSM鏈嶅姟鏈儴CDS瀹屾瘯
+ @AuraEnabled
+ public static InitData initForRCCDScompleteButton (String recordId){
+ InitData res = new initData();
+ try{
+ QIS_Report__c report = [SELECT id ,CDS_date__c,QIS_Status__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+ res.Id = report.Id;
+ res.cdsdate = report.CDS_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 updateQisForRCCDScomplete (String recordId){
+ String re = '鎴愬姛';
+ ID myUserID = UserInfo.getUserId();
+ User userinfo = [SELECT id,Alias__c FROM User WHERE Id = :myUserID LIMIT 1];
+ 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.CDS_date__c = Date.today();
+ rac.RC_CDS_staff__c = userinfo.Alias__c;
+ update rac;
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ re = e.getMessage();
+ }
+ 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;
+ }
+ public class InitData{
+ @AuraEnabled
+ public String Id;
+ @AuraEnabled
+ public String ownerId;
+ @AuraEnabled
+ public String qisRecordTypeId;
+ @AuraEnabled
+ public String qisRecordName;
+ @AuraEnabled
+ public String profileName;
+ @AuraEnabled
+ public String isAEProfile;
+ @AuraEnabled
+ public String isPAEProfile;
+ @AuraEnabled
+ public String isCNBuy;
+ @AuraEnabled
+ public String pAEid;
+ @AuraEnabled
+ public String oCSMAdministrativeReportNumber;
+ @AuraEnabled
+ public String oCSMAdministrativeReportStatus;
+ @AuraEnabled
+ public String qIStatus;
+ @AuraEnabled
+ public String oSHstaff;
+ @AuraEnabled
+ public String oSHstaffEmail;
+ @AuraEnabled
+ public String cancelQISReason;
+ @AuraEnabled
+ public String rCid;
+ @AuraEnabled
+ public String contractnumber;
+ @AuraEnabled
+ public Date rCinspectionDate;
+ @AuraEnabled
+ public Date qISReplyDay;
+ @AuraEnabled
+ public Date qISInstallDate;
+ @AuraEnabled
+ public Date cdsdate;
+ @AuraEnabled
+ public Date awaredate;
+ @AuraEnabled
+ public Date oCSMAdministrativeReportDate;
+ @AuraEnabled
+ public Boolean rCproblemnotfound;
+ @AuraEnabled
+ public Boolean isaohuiproduct;
+ @AuraEnabled
+ public Boolean isSendQIS;
+ }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/QISReportController.cls-meta.xml b/force-app/main/default/classes/QISReportController.cls-meta.xml
new file mode 100644
index 0000000..541584f
--- /dev/null
+++ b/force-app/main/default/classes/QISReportController.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>
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/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
new file mode 100644
index 0000000..aea48b6
--- /dev/null
+++ b/force-app/main/default/classes/ReportController.cls
@@ -0,0 +1,536 @@
+/*
+鐢ㄤ簬缁檒wc鐨刯s鍒濆鍖栨暟鎹拰瀵硅褰曡繘琛宒ml鎿嶄綔锛屾controller灞炰簬鎶ュ憡涔�
+*/
+public with sharing class ReportController {
+ //缁橵OC瀹屾瘯鐩稿簲鐨刯s鎻愪緵鍒濆鍖栨暟鎹�
+ @AuraEnabled
+ public static InitData initForVOCFinishButton (String recordId) {
+ InitData res = new initData();
+ try {
+ Report__c report = [select Status__c from Report__c where Id = :recordId];
+ res.status = report.Status__c;
+ res.profileId = UserInfo.getProfileId();
+ System.debug(LoggingLevel.INFO, '*** res: ' + res);
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+ //缁橵OC鍒ゅ畾鐩稿簲鐨刯s鎻愪緵鍒濆鍖栨暟鎹�
+ @AuraEnabled
+ public static InitData initForVOCCheckButton (String recordId) {
+ InitData res = new initData();
+ try {
+ Report__c report = [select Status__c,IsVOC__c,Responsible_Person__r.Id from Report__c where Id = :recordId];
+ res.status = report.Status__c;
+ res.isVOC = report.IsVOC__c;
+ res.personId = report.Responsible_Person__r.Id;
+ res.profileId = UserInfo.getProfileId();
+ System.debug(LoggingLevel.INFO, '*** res: ' + res);
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+ //缁橵OC鎻愬嚭鐩稿簲鐨刯s鎻愪緵鍒濆鍖栨暟鎹�
+ @AuraEnabled
+ public static Initdata initForVOCSubmitButton(String recordId){
+ InitData res = new InitData();
+ try {
+ Report__c report = [select Status__c,Owner.Id,CreatedBy.Id from Report__c where Id = :recordId];
+ res.status = report.Status__c;
+ res.ownerId = report.Owner.Id;
+ res.createdById = report.CreatedBy.Id;
+ System.debug(LoggingLevel.INFO, '*** res: ' + res);
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+
+
+ //缁橵OC鍥炵瓟鐩稿簲鐨刯s鎻愪緵鍒濆鍖栨暟鎹�
+ @AuraEnabled
+ public static Initdata initForVOCAnswerButton(String recordId){
+ InitData res = new InitData();
+ try {
+ Report__c report = [select Status__c from Report__c where Id = :recordId];
+ res.status = report.Status__c;
+ System.debug(LoggingLevel.INFO, '*** res: ' + res);
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+ //缁橵OC缁撴灉纭鐩稿簲鐨刯s鎻愪緵鍒濆鍖栨暟鎹�
+ @AuraEnabled
+ public static InitData initForVOCConfirmButton (String recordId) {
+ InitData res = new initData();
+ try {
+ Report__c report = [select Status__c,VOC_Satisfy__c,VOC_Satisfy1__c from Report__c where Id = :recordId];
+ res.status = report.Status__c;
+ res.Satisfy = report.VOC_Satisfy__c;
+ res.Satisfy1 = report.VOC_Satisfy1__c;
+ System.debug(LoggingLevel.INFO, '*** res: ' + res);
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+
+ //缁欏彇娑堢浉搴旂殑js鎻愪緵鍒濆鍖栨暟鎹�
+ @AuraEnabled
+ public static InitData initForCancelButton(String recordId){
+ InitData res = new InitData();
+ try {
+ Report__c report = [select Status__c from Report__c where Id = :recordId];
+ res.status = report.Status__c;
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+
+ //缁橭CSM涓嶈鎶ュ憡鐩稿簲鐨刯s鎻愪緵鍒濆鍖栨暟鎹�
+ @AuraEnabled
+ public static InitData initForOCSMNoToReportButton(String recordId){
+ InitData res = new InitData();
+ try {
+ Report__c report = [select OCSMAdministrativeReportNumber__c,OCSMAdministrativeReportDate__c,Aware_date__c from Report__c where Id = :recordId];
+ res.OCSMAdministrativeReportDate = report.OCSMAdministrativeReportDate__c;
+ res.OCSMAdministrativeReportNumber = report.OCSMAdministrativeReportNumber__c;
+ res.awareDate = report.Aware_date__c;
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+ //缁橲IStoOPD鐩稿簲鐨刯s鎻愪緵鍒濆鍖栨暟鎹�
+ @AuraEnabled
+ public static InitData initForSIStoOPDButton(String recordId){
+ InitData res = new InitData();
+ try {
+ Report__c report = [select Status__c,Owner.Id from Report__c where Id = :recordId];
+ res.status = report.Status__c;
+ res.ownerId = report.Owner.Id;
+ res.userId = UserInfo.getUserId();
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+
+ //缁橭CSM瑕佹姤鍛婄浉搴旂殑js鎻愪緵鍒濆鍖栨暟鎹�
+ @AuraEnabled
+ public static InitData initForOCSMToReportButton(String recordId){
+ InitData res = new InitData();
+ try {
+ Report__c report = [select OCSMAdministrativeReportStatus__c,AwareDate__C from Report__c where Id = :recordId];
+ res.OCSMAdministrativeReportStatus = report.OCSMAdministrativeReportStatus__c;
+ res.awareDate = report.AwareDate__C;
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+
+ //缁欏畬姣曠浉搴旂殑js鎻愪緵鍒濆鍖栨暟鎹�
+ @AuraEnabled
+ public static InitData initForCompleteButton(String recordId){
+ InitData res = new InitData();
+ try {
+ Report__c report = [select Status__c from Report__c where Id = :recordId];
+ res.status = report.Status__c;
+ res.profileId = UserInfo.getProfileId();
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+ //缁橧ntake universal code缂栬緫鐩稿簲鐨刯s鎻愪緵鍒濆鍖栨暟鎹�
+ @AuraEnabled
+ public static InitData initForASRCEditorButton(String recordId){
+ InitData res = new InitData();
+ String developerName = LightingButtonConstant.DEVELOPER_NAME_ASRC_DECISION;
+ try {
+ PAE_DecisionRecord__c[] report = [SELECT LastModifiedDate, Id, Name, LastModifiedById,RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_Report__c = :recordId And RecordType.DeveloperName = :developerName Order by LastModifiedDate desc];
+ if (report != null && !report.isEmpty()) {
+ res.LastModifiedDate = report[0].LastModifiedDate;
+ res.Id = report[0].Id;
+ res.Name = report[0].Name;
+ res.LastModifiedById = report[0].LastModifiedById;
+ res.DeveloperName = report[0].RecordType.DeveloperName;
+ }
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+
+
+ //缁橣inal universal code缂栬緫鐩稿簲鐨刯s鎻愪緵鍒濆鍖栨暟鎹�
+ @AuraEnabled
+ public static InitData initForASACEditorButton(String recordId){
+ InitData res = new InitData();
+ String recordTypeId = LightingButtonConstant.DEVELOPER_NAME_ASAC_DECISION;
+ try {
+ PAE_DecisionRecord__c[] report = [SELECT LastModifiedDate, Id, Name, LastModifiedById,RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_Report__c = :recordId And RecordType.DeveloperName = :recordTypeId Order by LastModifiedDate desc];
+ if (report != null && !report.isEmpty()) {
+ res.LastModifiedDate = report[0].LastModifiedDate;
+ res.Id = report[0].Id;
+ res.Name = report[0].Name;
+ res.LastModifiedById = report[0].LastModifiedById;
+ res.DeveloperName = report[0].RecordType.DeveloperName;
+ }
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+
+
+ //缁橭PDtoSIS鐩稿簲鐨刯s鎻愪緵鍒濆鍖栨暟鎹�
+ @AuraEnabled
+ public static InitData initForOPDtoSISButton(String recordId){
+ InitData res = new InitData();
+ try {
+ Report__c report = [select Status__c,Owner.Id from Report__C where Id = :recordId];
+ res.status = report.Status__c;
+ res.ownerId = report.Owner.Id;
+ res.userId = UserInfo.getUserId();
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+
+ //缁欐彁浜�(瀵规墜娲诲姩鎶ュ憡)鐩稿簲鐨刯s鎻愪緵鍒濆鍖栨暟鎹�
+ @AuraEnabled
+ public static InitData initForSubmitCompetitorReportButton(String recordId){
+ InitData res = null;
+ try {
+ res = new InitData();
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ return res;
+ }
+
+ //缁欐彁浜ょ浉搴旂殑js鎻愪緵鍒濆鍖栨暟鎹�
+ @AuraEnabled
+ public static void updateForSubmitButton(String reocrdId){
+ try {
+ Report__c rac = new Report__c();
+ rac.Id = reocrdId;
+ rac.Status__c = LightingButtonConstant.RECORD_TYPE_NAME_BY_SUBMIT;
+ rac.Submit_time__c = Datetime.now();
+ rac.Submit_report_day__c = Date.today();
+ update rac;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ }
+ //OPDtoSIS鎿嶄綔鏇存柊鐩稿簲鏁版嵁
+ @AuraEnabled
+ public static void 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;
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ }
+
+ //鍙栨秷鎻愪氦鎿嶄綔鏇存柊鐩稿簲鏁版嵁
+ @AuraEnabled
+ public static void updateForCancelSubmitReportButton(String recordId){
+ try {
+ Report__c rac = new Report__c();
+ rac.Id = recordId;
+ rac.Status__c = LightingButtonConstant.STATUS_DRAFT;
+ rac.Submit_report_day__c = null;
+ rac.Submit_time__c = null;
+ update rac;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ }
+ //瀹屾瘯鎿嶄綔鏇存柊鐩稿簲鏁版嵁
+ @AuraEnabled
+ public static void 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;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ }
+ //OCSM瑕佹姤鍛婃搷浣滄洿鏂扮浉搴旀暟鎹�
+ @AuraEnabled
+ public static void updateForOCSMToReportButton(String recordId){
+ try {
+ Report__c rac = new Report__c();
+ rac.Id = recordId;
+ rac.OCSMAdministrativeReportStatus__c = LightingButtonConstant.STATUS_TO_BE_REPORTED;
+ update rac;
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ }
+
+ //SIStoOPD鎿嶄綔鏇存柊鐩稿簲鏁版嵁
+ @AuraEnabled
+ public static String updateForSIStoOPDButton(String recordId){
+ Report__c rac = new Report__c();
+ try {
+ rac.Id = recordId;
+ rac.RecordTypeId = Schema.SObjectType.Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_BY_FOLLOW_THE_STAGE).getRecordTypeId();
+ update rac;
+ return null;
+ } catch (Exception e) {
+ return e.getMessage();
+ }
+ }
+ //DispatchOCSMQARA鎿嶄綔鏇存柊鐩稿簲鏁版嵁
+ @AuraEnabled
+ public static void updateForDispatchOCSMQARAButton(String recordId){
+ try {
+ Report__c rac = new Report__c();
+ rac.Id = recordId;
+ rac.Dispatch_OCSM_QARA__c = true;
+ update rac;
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ }
+ //OCSM涓嶈鎶ュ憡鎿嶄綔鏇存柊鐩稿簲鏁版嵁
+ @AuraEnabled
+ public static void updateForOCSMNoToReportButton(String recordId){
+ try {
+ Report__c rac = new Report__c();
+ rac.Id = recordId;
+ rac.OCSMAdministrativeReportStatus__c = LightingButtonConstant.STATUS_TO_NOT_REPORT;
+ update rac;
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ }
+
+ //鍙栨秷鎿嶄綔鏇存柊鐩稿簲鏁版嵁
+ @AuraEnabled
+ public static void updateForCancelButton(String recordId){
+ try {
+ Report__c rac = new Report__c();
+ rac.Id = recordId;
+ rac.Status__c = LightingButtonConstant.STATUS_CANCEL;
+ update rac;
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ }
+
+ //VOC缁撴灉纭鏇存柊鐩稿簲鏁版嵁
+ @AuraEnabled
+ public static void updateForVOCConfirmButton(String recordId,String Satisfy,String Satisfy1){
+ try {
+ Report__c rac = new Report__c();
+ rac.Id = recordId;
+ if (Satisfy == LightingButtonConstant.CN_YES) {
+ rac.Status__c = LightingButtonConstant.STATUS_VOC_CONFIRMED;
+ } else if (Satisfy == LightingButtonConstant.CN_NO) {
+ // 瀵惧繙绲愭灉锛堜竴鍥炵洰锛夈伀鍊ゃ仾銇戙倢銇般�佷竴鍥炵洰銇�屽惁銆嶃仺瑕嬨仾銇�
+ if (Satisfy1 != LightingButtonConstant.CN_NO) {
+ Report__c[] records = [SELECT Id, VOC_Satisfy__c, VOC_Unsatisfy_Reason__c, VOC_follow_up_result__c, VOC_solution_category__c FROM Report__c WHERE Id = :recordId];
+ rac.VOC_Satisfy__c = null;
+ rac.VOC_Unsatisfy_Reason__c = null;
+ rac.VOC_follow_up_result__c = null;
+ rac.VOC_solution_category__c = null;
+ rac.VOC_Satisfy1__c= records[0].VOC_Satisfy__c;
+ rac.VOC_Unsatisfy_Reason1__c = records[0].VOC_Unsatisfy_Reason__c;
+ rac.VOC_follow_up_result1__c = records[0].VOC_follow_up_result__c;
+ rac.VOC_solution_category1__c = records[0].VOC_solution_category__c;
+ rac.Status__c = LightingButtonConstant.STATUS_DRAFT;
+ }
+ // 瀵惧繙绲愭灉锛堜竴鍥炵洰锛夈伀鍊ゃ亗銈屻伆銆佷簩鍥炵洰銇�屽惁銆嶃仺瑕嬨仾銇�
+ else {
+ rac.Status__c = LightingButtonConstant.STATUS_VOC_CONFIRMED;
+ }
+ }
+ update rac;
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ }
+ //VOC鍥炵瓟鏇存柊鐩稿簲鏁版嵁
+ @AuraEnabled
+ public static String updateForVOCAnswerButton(String recordId){
+ try {
+ Report__c rac = [select Status__c from Report__c where Id = :recordId];
+ rac.Status__c = LightingButtonConstant.STATUS_VOC_END_OF_ANSWER;
+ update rac;
+ return null;
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ String exc = '' + e.getMessage();
+ Integer left = exc.indexOf(':') + 1;
+ Integer right = exc.lastIndexOf(':');
+ String str = exc.substring(left,right);
+ left = str.indexOf(',') + 1;
+ String newStr = str.substring(left);
+ return newStr;
+ }
+ }
+
+ //鎻愪氦绔炰簤瀵规墜鎶ュ憡鏇存柊鐩稿簲鏁版嵁
+ @AuraEnabled
+ public static void updateForSubmitCompetitorReportButton(String recordId){
+ try {
+ Report__c rac = new Report__c();
+ rac.Id = recordId;
+ rac.Status__c = LightingButtonConstant.STATUS_VOC_APPLYING;
+ rac.Submit_time__c = Datetime.now();
+ rac.Submit_report_day__c = Date.today();
+ rac.Date__c = Date.today();
+ update rac;
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ }
+ //VOC鍥炵瓟鏇存柊鐩稿簲鏁版嵁
+ @AuraEnabled
+ public static void 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
+ rac.Id = recordId;
+ User[] records = [SELECT Job_Category__c FROM User WHERE Id = :createdById];
+ List<String> userAccess = new List<String>();
+ if (records[0].Job_Category__c == LightingButtonConstant.TYPE_OF_SALES_SERVICES) {
+ userAccess.add(rac.JingliApprovalManager__c + LightingButtonConstant.USER_ACCESS_READ);
+ userAccess.add(rac.BuchangApprovalManager__c + LightingButtonConstant.USER_ACCESS_READ);
+ rac.VOC_CreatedBy_jingli__c = rac.JingliApprovalManager__c;
+ rac.VOC_CreatedBy_buzhang__c = rac.BuchangApprovalManager__c;
+ } else {
+ userAccess.add(rac.SalesManager__c + LightingButtonConstant.USER_ACCESS_READ);
+ userAccess.add(rac.BuchangApprovalManagerSales__c + LightingButtonConstant.USER_ACCESS_READ);
+ rac.VOC_CreatedBy_jingli__c = rac.SalesManager__c;
+ rac.VOC_CreatedBy_buzhang__c = rac.BuchangApprovalManagerSales__c;
+ }
+ 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;
+ }
+ rac.Status__c = LightingButtonConstant.STATUS_VOC_WRITE_OVER;
+ rac.Submit_time__c = Date.today();
+ rac.Submit_report_day__c = Date.today();
+ update rac;
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+
+ }
+ }
+ //VOC鍒ゅ畾鏇存柊鐩稿簲鏁版嵁
+ @AuraEnabled
+ public static String updateForVOCCheckButton (String recordId,String isVOC,String personId) {
+ try {
+ Report__c rac = [select Owner.Id,VOC_jingli__r.Id,VOC_buzhang__r.Id,VOC_zongjian__r.Id,VOC_Finish__c,VOC_share_date__c,Responsible_Person__r.Id from Report__c where Id = :recordId];
+ if (isVOC == LightingButtonConstant.VOC_NAME) {
+ // VOC瀵惧繙鑰呫伄绲岀悊閮ㄩ暦绶忕洠銈掕ō瀹�
+ User[] records = [SELECT Id, Job_Category__c, JingliApprovalManager__c, SalesManager__c, BuchangApprovalManager__c, BuchangApprovalManagerSales__c, ZongjianApprovalManager__c FROM User WHERE Id = :personId];
+ if (records[0].job_Category__c == LightingButtonConstant.TYPE_OF_SALES_SERVICES) {
+ rac.VOC_jingli__c = records[0].JingliApprovalManager__c == null ? '' : records[0].JingliApprovalManager__c;
+ rac.VOC_buzhang__c = records[0].BuchangApprovalManager__c == null ? '' : records[0].BuchangApprovalManager__c;
+ } else {
+ rac.VOC_jingli__c = records[0].SalesManager__c == null ? '' : records[0].SalesManager__c;
+ rac.VOC_buzhang__c = records[0].BuchangApprovalManagerSales__c == null ? '' : records[0].BuchangApprovalManagerSales__c;
+ }
+ rac.VOC_zongjian__c = records[0].ZongjianApprovalManager__c == null ? '' : records[0].ZongjianApprovalManager__c;
+ rac.Status__c = LightingButtonConstant.STATUS_VOC_CHECK_OVER;
+ rac.VOC_Finish__c = false;
+ Date serverTimestamp = Date.today();
+ rac.VOC_share_date__c = serverTimestamp;
+ // share
+ List<String> userAccess = new List<String>();
+ userAccess.add(rac.Responsible_Person__c + LightingButtonConstant.USER_ACCESS_EDIT);
+ userAccess.add(rac.VOC_jingli__c + LightingButtonConstant.USER_ACCESS_READ);
+ userAccess.add(rac.VOC_buzhang__c + LightingButtonConstant.USER_ACCESS_READ);
+ userAccess.add(rac.VOC_zongjian__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 null;
+ }
+ update rac;
+ } else {
+ rac.Status__c = LightingButtonConstant.STATUS_VOC_FINISH;
+ rac.VOC_Finish__c = true;
+ update rac;
+ }
+ return null;
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ String exc = e.getMessage();
+ return exc;
+ }
+ }
+ //VOC瀹屾瘯鎿嶄綔鏇存柊鐩稿簲鏁版嵁
+ @AuraEnabled
+ public static void 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;
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ }
+ public class InitData{
+ @AuraEnabled
+ public String status;
+ @AuraEnabled
+ public String isVOC;
+ @AuraEnabled
+ public String personId;
+ @AuraEnabled
+ public String createdById;
+ @AuraEnabled
+ public String ownerId;
+ @AuraEnabled
+ public String Satisfy;
+ @AuraEnabled
+ public String Satisfy1;
+ @AuraEnabled
+ public String profileId;
+ @AuraEnabled
+ public String OCSMAdministrativeReportNumber;
+ @AuraEnabled
+ public Date OCSMAdministrativeReportDate;
+ @AuraEnabled
+ public Date awareDate;
+ @AuraEnabled
+ public String OCSMAdministrativeReportStatus;
+ @AuraEnabled
+ public Datetime LastModifiedDate;
+ @AuraEnabled
+ public String Id;
+ @AuraEnabled
+ public String Name;
+ @AuraEnabled
+ public String LastModifiedById;
+ @AuraEnabled
+ public String DeveloperName;
+ @AuraEnabled
+ public String userId;
+
+
+
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/ReportController.cls-meta.xml b/force-app/main/default/classes/ReportController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/ReportController.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/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
new file mode 100644
index 0000000..5a2d0ea
--- /dev/null
+++ b/force-app/main/default/classes/TenderingButtonController.cls
@@ -0,0 +1,54 @@
+public class TenderingButtonController {
+ @AuraEnabled
+ public static InitData initTenderingController(String recordId) {
+ InitData res = new initData();
+ try{
+ Tender_information__c report = [SELECT OpportunityNum__c,OwnerId,Id,status__c,Name,IsRelateProject__c FROM Tender_information__c WHERE Id = :recordId LIMIT 1];
+ res.OwnerId = report.OwnerId;
+ res.Id = report.Id;
+ res.status = report.status__c;
+ res.name = report.Name;
+ 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);
+ }
+ return res;
+ }
+
+ // 鎷涙爣椤圭洰澶卞崟 TenderOpportunityLink
+ // 璋冪敤璇ユ帴鍙ar sql = "select id from Tender_Opportunity_Link__c where Tender_information__c='" + '{!Tender_information__c.Id}'+ "'";
+ @AuraEnabled
+ public static List<Tender_Opportunity_Link__c> sqlResult (String id) {
+ try {
+ List<Tender_Opportunity_Link__c> TenderOpportunityLink = [SELECT id FROM Tender_Opportunity_Link__c WHERE Tender_information__c = :id];
+ System.debug(LoggingLevel.INFO, '*** xu1: ' + TenderOpportunityLink);
+ return TenderOpportunityLink;
+ } catch (exception e) {
+ System.debug(LoggingLevel.INFO, '*** xu1111111: ' + e);
+ throw new AuraHandledException(e.getMessage());
+ }
+ }
+
+ public class InitData{
+ @AuraEnabled
+ public String Id;
+ @AuraEnabled
+ public String OwnerId;
+ @AuraEnabled
+ public String status;
+ @AuraEnabled
+ public String name;
+ @AuraEnabled
+ public String opportunityNum;
+ @AuraEnabled
+ 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/TenderingButtonController.cls-meta.xml b/force-app/main/default/classes/TenderingButtonController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/TenderingButtonController.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/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/otherButtonMaintenanceContractCtl.cls b/force-app/main/default/classes/otherButtonMaintenanceContractCtl.cls
new file mode 100644
index 0000000..32661b4
--- /dev/null
+++ b/force-app/main/default/classes/otherButtonMaintenanceContractCtl.cls
@@ -0,0 +1,87 @@
+public with sharing class otherButtonMaintenanceContractCtl {
+ public otherButtonMaintenanceContractCtl() {
+
+ }
+
+ @AuraEnabled
+ public static InitData init(String recordId){
+ InitData res = new initData();
+ try{
+ Maintenance_Contract__c report = [SELECT MC_approval_status__c,Payment_Plan_Sum_First__c,Contract_quotation_or_not__c,Name,notRenew__c,Contract_print_completed__c,Maintenance_Contract_No__c,upload_to_sap_time__c,old_Is_RecognitionModel__c,upload_to_RM_time__c,Is_Recognition_Model_True__c,Id,URF_Contract_F__c,RecordType_DeveloperName__c,Estimate_Target__c FROM Maintenance_Contract__c WHERE Id =: recordId LIMIT 1];
+ System.debug(LoggingLevel.INFO, '*** opp: ' + report);
+ res.MCApprovalStatusC = report.MC_approval_status__c;
+ res.MaintenanceContractNoC = report.Maintenance_Contract_No__c;
+ res.uploadToSapTimeC = report.upload_to_sap_time__c;
+ res.oldIsRecognitionModelC = report.old_Is_RecognitionModel__c;
+ res.uploadToRMTimeC = report.upload_to_RM_time__c;
+ res.IsRecognitionModelTrueC = report.Is_Recognition_Model_True__c;
+ res.Id = report.Id;
+ res.URFContractFC = report.URF_Contract_F__c;
+ res.RecordTypeDeveloperNameC = report.RecordType_DeveloperName__c;
+ res.EstimateTargetC = report.Estimate_Target__c;
+ res.ContractprintCompletedC = report.Contract_print_completed__c;
+ res.notRenewC = report.notRenew__c;
+ res.Name = report.Name;
+ res.ContractQuotationOrNotC = report.Contract_quotation_or_not__c;
+ res.PaymentPlanSumFirstC = report.Payment_Plan_Sum_First__c;
+
+ System.debug(LoggingLevel.INFO, '*** res: ' + res);
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+
+ // 缁翠慨鍚堝悓澶卞崟鎶ュ憡
+ @AuraEnabled
+ public static List<Lost_Report__c> selectRecords(String recordId){
+ List<Lost_Report__c> res = new List<Lost_Report__c>();
+ try{
+ res = [SELECT Id,Status__c,Other_Reasons__c,Other__c,Third_Party_Company__c,Third_Party_Contract_Price__c,To_Where__c,Specific_Reasons__c,Maintenance_Contract__c from Lost_Report__c where Maintenance_Contract__c =: recordId ];
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+
+ // 宸ヤ綔娴佺姸鎬�
+ @AuraEnabled
+ public static void processResults(String recordId){
+ Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest();
+ psr.setobjectid(recordId);
+ Approval.ProcessResult submitResult = Approval.process(psr);
+ }
+
+ public class InitData{
+ @AuraEnabled
+ public String MCApprovalStatusC;
+ @AuraEnabled
+ public String MaintenanceContractNoC;
+ @AuraEnabled
+ public Datetime uploadToSapTimeC;
+ @AuraEnabled
+ public Boolean oldIsRecognitionModelC;
+ @AuraEnabled
+ public Datetime uploadToRMTimeC;
+ @AuraEnabled
+ public Boolean IsRecognitionModelTrueC;
+ @AuraEnabled
+ public String Id;
+ @AuraEnabled
+ public String URFContractFC;
+ @AuraEnabled
+ public String RecordTypeDeveloperNameC;
+ @AuraEnabled
+ public String EstimateTargetC;
+ @AuraEnabled
+ public Datetime ContractprintCompletedC;
+ @AuraEnabled
+ public Boolean notRenewC;
+ @AuraEnabled
+ public String Name;
+ @AuraEnabled
+ public String ContractQuotationOrNotC;
+ @AuraEnabled
+ public Double PaymentPlanSumFirstC;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/otherButtonMaintenanceContractCtl.cls-meta.xml b/force-app/main/default/classes/otherButtonMaintenanceContractCtl.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/otherButtonMaintenanceContractCtl.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/otherButtonPreparationReportController.cls b/force-app/main/default/classes/otherButtonPreparationReportController.cls
new file mode 100644
index 0000000..2234e79
--- /dev/null
+++ b/force-app/main/default/classes/otherButtonPreparationReportController.cls
@@ -0,0 +1,30 @@
+public with sharing class otherButtonPreparationReportController {
+ public otherButtonPreparationReportController() {
+
+ }
+ @AuraEnabled
+ public static InitData init(String recordId){
+ InitData res = new initData();
+ try{
+ Maintenance_Contract__c report = [SELECT Id,RecordType_DeveloperName__c,Estimate_Target__c FROM Maintenance_Contract__c WHERE Id =: recordId LIMIT 1];
+ System.debug(LoggingLevel.INFO, '*** opp: ' + report);
+ res.Id = report.Id;
+ res.RecordTypeDeveloperNameC = report.RecordType_DeveloperName__c;
+ res.EstimateTargetC = report.Estimate_Target__c;
+
+ System.debug(LoggingLevel.INFO, '*** res: ' + res);
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+
+ public class InitData{
+ @AuraEnabled
+ public String Id;
+ @AuraEnabled
+ public String RecordTypeDeveloperNameC;
+ @AuraEnabled
+ public String EstimateTargetC;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/otherButtonPreparationReportController.cls-meta.xml b/force-app/main/default/classes/otherButtonPreparationReportController.cls-meta.xml
new file mode 100644
index 0000000..fbbad0a
--- /dev/null
+++ b/force-app/main/default/classes/otherButtonPreparationReportController.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/otherButtonRepairController.cls b/force-app/main/default/classes/otherButtonRepairController.cls
new file mode 100644
index 0000000..f244964
--- /dev/null
+++ b/force-app/main/default/classes/otherButtonRepairController.cls
@@ -0,0 +1,392 @@
+public with sharing class otherButtonRepairController {
+ public otherButtonRepairController() {
+
+ }
+
+ @AuraEnabled
+ public static InitData init(String recordId){
+ InitData res = new initData();
+ try{
+ Repair__c report = [SELECT Status1__c,Rental_Apply_Equipment_Set_Detail__c,Rental_Apply_Equipment_Set_Detail_Id__c,Latest_Collect_Date_Priority__c,if_Rental_Apply__c,Offer_Rental_New__c,ProduceCompany_hand__c,CFDA_No_Hand__c,MBC_AwareDate__c,InsReport__c,QIS_ID__c,On_Call_ID__c,RepairSubOrder__c,ProductFailureRelated__c,Delay15Min__c,ProblemOccurredSelect__c,Repair_Source__c ,Failure_Occurrence_Date__c ,MaintenanceContractType__c ,OperationOrExaminationName__c ,WhatProject__c ,FailureQInHospital__c ,ReportAdverseEvents__c ,InformationFrom__c ,AfterFailureInformation__c ,ProblemOccurred__c ,SupportingProducts__c ,ifDeadHurt__c ,UseFailProductFinish__c ,DelayReportReason__c ,BreakORFallOff__c ,DateReceiptQuestions__c ,DeliveryLogisticsAnnotation__c ,DeliveryLogisticsNo__c ,engineerSendDate__c ,DeliveryLogisticsMode__c ,RepairApplicantDepartment__c ,RepairApplicantHospital__c ,RepairApplicant__c ,Repair_Detail__c ,Returns_Product_way__c ,work_location_select__c ,On_site_repair__c ,SalesOfficeCode_selection__c ,Incharge_Staff_Contact__c ,Incharge_Staff__c ,Dealer__c ,RepairCostType__c ,Account__c,Department_Class__c ,Hospital__c ,PaperRepairRequestNo__c ,part_arrangement_complete__c,Repair_Shipped_Date__c,OCSMAdministrativeReportStatus__c,Incharge_Staff_Email__c,Name,HP_Name__c,Delivered_Product__c,
+ Repair_Product_Serial_No__c,Service_Repair_No__c,Repair_Firstestimated_Date__c,
+ Repair_Estimated_Date__c,RC_information__c,Id,OCSMAdministrativeReportNumber__c,
+ OCSMAdministrativeReportDate__c,Aware_date__c,PAE_Determine__c,ETQ_UPLOAD_STATUS__c,
+ AE_DetermineResult__c,PAE_DetermineAC__c,Repair_Inspection_Date__c,Contain_UseRSA__c FROM Repair__c WHERE Id =: recordId LIMIT 1];
+ System.debug(LoggingLevel.INFO, '*** opp: ' + report);
+
+ res.Status1C = report.Status1__c;
+ res.ProblemOccurredSelectC = report.ProblemOccurredSelect__c;
+ res.Delay15MinC = report.Delay15Min__c;
+ res.ProductFailureRelatedC = report.ProductFailureRelated__c;
+ res.RepairSubOrderC = report.RepairSubOrder__c;
+ res.OnCallIDC = report.On_Call_ID__c;
+ res.QISIDC = report.QIS_ID__c;
+ res.InsReportC = report.InsReport__c;
+ res.MBCAwareDateC = report.MBC_AwareDate__c;
+ res.CFDANoHandC = report.CFDA_No_Hand__c;
+ res.ProduceCompanyHandC = report.ProduceCompany_hand__c;
+ res.OfferRentalNewC = report.Offer_Rental_New__c;
+ res.ifRentalApplyC = report.if_Rental_Apply__c;
+ res.LatestCollectDatePriorityC = report.Latest_Collect_Date_Priority__c;
+ res.RentalApplyEquipmentSetDetailIdC = report.Rental_Apply_Equipment_Set_Detail_Id__c;
+ res.RentalApplyEquipmentSetDetailC = report.Rental_Apply_Equipment_Set_Detail__c;
+ res.PaperRepairRequestNoC = report.PaperRepairRequestNo__c;
+ res.HospitalC = report.Hospital__c;
+ res.DepartmentClassC = report.Department_Class__c;
+ res.AccountC = report.Account__c;
+ res.RepairCostTypeC = report.RepairCostType__c;
+ res.DealerC = report.Dealer__c ;
+ res.InchargeStaffC = report.Incharge_Staff__c ;
+ res.InchargeStaffContactC = report.Incharge_Staff_Contact__c ;
+ res.SalesOfficeCodeSelectionC = report.SalesOfficeCode_selection__c ;
+ res.OnSiteRepairC = report.On_site_repair__c ;
+ res.workLocationSelectC = report.work_location_select__c ;
+ res.ReturnsProductWayC = report.Returns_Product_way__c ;
+ res.RepairDetailC = report.Repair_Detail__c ;
+ res.RepairApplicantC = report.RepairApplicant__c ;
+ res.RepairApplicantHospitalC = report.RepairApplicantHospital__c ;
+ res.RepairApplicantDepartmentC = report.RepairApplicantDepartment__c ;
+ res.DeliveryLogisticsModeC = report.DeliveryLogisticsMode__c ;
+ res.engineerSendDateC = report.engineerSendDate__c ;
+ res.DeliveryLogisticsNoC = report.DeliveryLogisticsNo__c ;
+ res.DeliveryLogisticsAnnotationC = report.DeliveryLogisticsAnnotation__c ;
+ res.DateReceiptQuestionsC = report.DateReceiptQuestions__c ;
+ res.BreakORFallOffC = report.BreakORFallOff__c ;
+ res.DelayReportReasonC = report.DelayReportReason__c ;
+ res.UseFailProductFinishC = report.UseFailProductFinish__c ;
+ res.ifDeadHurtC = report.ifDeadHurt__c ;
+ res.SupportingProductsC = report.SupportingProducts__c ;
+ res.ProblemOccurredC = report.ProblemOccurred__c ;
+ res.AfterFailureInformationC = report.AfterFailureInformation__c ;
+ res.InformationFromC = report.InformationFrom__c ;
+ res.ReportAdverseEventsC = report.ReportAdverseEvents__c ;
+ res.FailureQInHospitalC = report.FailureQInHospital__c ;
+ res.WhatProjectC = report.WhatProject__c ;
+ res.OperationOrExaminationNameC = report.OperationOrExaminationName__c ;
+ res.MaintenanceContractTypeC = report.MaintenanceContractType__c ;
+ res.FailureOccurrenceDateC = report.Failure_Occurrence_Date__c ;
+ res.RepairSourceC = report.Repair_Source__c ;
+ res.Id = report.Id;
+ res.partArrangementCompleteC = report.part_arrangement_complete__c;
+ res.RepairShippedDateC = report.Repair_Shipped_Date__c;
+ res.OCSMAdministrativeReportNumberC = report.OCSMAdministrativeReportNumber__c;
+ res.OCSMAdministrativeReportDateC = report.OCSMAdministrativeReportDate__c;
+ res.AwareDateC = report.Aware_date__c;
+ res.PAEDetermineC = report.PAE_Determine__c;
+ res.ETQUPLOADSTATUSC = report.ETQ_UPLOAD_STATUS__c;
+ res.AEDetermineResultC = report.AE_DetermineResult__c;
+ res.PAEDetermineACC = report.PAE_DetermineAC__c;
+ res.RepairInspectionDateC = report.Repair_Inspection_Date__c;
+ res.ContainUseRSAC = report.Contain_UseRSA__c;
+ res.InchargeStaffEmailC = report.Incharge_Staff_Email__c;
+ res.Name = report.Name;
+ res.HPNameC = report.HP_Name__c;
+ res.DeliveredProductC = report.Delivered_Product__c;
+ res.RepairProductSerialNoC = report.Repair_Product_Serial_No__c;
+ res.ServiceRepairNoC = report.Service_Repair_No__c;
+ res.RepairFirstestimatedDateC = report.Repair_Firstestimated_Date__c;
+ res.RepairEstimatedDateC = report.Repair_Estimated_Date__c;
+ res.RCInformationC = report.RC_information__c;
+ res.OCSMAdministrativeReportStatusC = report.OCSMAdministrativeReportStatus__c;
+ res.userID = UserInfo.getUserId();
+ res.profileId = UserInfo.getProfileId();
+ res.userEmail = UserInfo.getUserEmail();
+
+
+ System.debug(LoggingLevel.INFO, '*** res: ' + res);
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+
+ // 鏍规嵁ID鏌ユ壘淇悊琛�
+ @AuraEnabled
+ public static List<Repair__c> selectRecords(String recordId){
+ List<Repair__c> res = new List<Repair__c>();
+ try{
+ res = [SELECT Id,AsyncData__c,Complaint_Number__c,ETQ_UPLOAD_STATUS__c FROM Repair__c WHERE id =: recordId ];
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+
+ // 鏍规嵁ID淇敼淇悊
+ @AuraEnabled
+ public static void updateRepair(String recordId){
+ try {
+ Repair__c repair = new Repair__c();
+ repair.Id = recordid;
+ repair.OCSMAdministrativeReportStatus__c = '鏃犻渶鎶ュ憡';
+ update repair;
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ }
+
+ // 淇敼楠屾敹鍗�
+ @AuraEnabled
+ public static String updateYanshoudan(String recordId){
+ String res;
+ try {
+ Repair__c repair = new Repair__c();
+ repair.Id = recordid;
+ repair.Request_yanshoudan_PDF__c = true;
+ repair.Facility_Return_Receipt_Collection_reque__c = Datetime.now().date();
+
+ update repair;
+ } catch (Exception e) {
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ res = e.getMessage();
+ }
+ return res;
+ }
+
+ // 鏌ユ壘PAE鍒ゅ畾璁板綍
+ @AuraEnabled
+ public static List<PAE_DecisionRecord__c> selectPAEDecisionRecord(String recordId,String recordTypeId){
+ List<PAE_DecisionRecord__c > res = new List<PAE_DecisionRecord__c >();
+ try{
+ res = [SELECT LastModifiedDate, Id, Name, LastModifiedById,RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_Repair__c =: recordId And RecordType.DeveloperName =: recordTypeId Order by LastModifiedDate desc];
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+
+ // 鍙戦�侀偖浠�
+ @AuraEnabled
+ public static String sendToETQ(String iflog_Id,BatchIF_Log__c rowDataSFDC, List<String> repairIds,String statu){
+ List<QIS_Report__c> temp = [select id from QIS_Report__c where id in :repairIds ];
+ if(temp != null && temp.size() > 0){
+ try {
+ Database.executeBatch(new QISToPDFBatch(iflog_Id, rowDataSFDC,repairIds,statu),50); //鐢熸垚PDF
+ }
+ catch (Exception e) {
+ return '鏇存柊QIS鎶ラ敊:'+ e.getMessage();
+ }
+ }else{
+ BatchIF_Log__c iflog = new BatchIF_Log__c();
+ iflog.Type__c = 'sendToETQ';
+ iflog.ErrorLog__c = '';
+ iflog.Log__c = 'NFM401WebService start--';
+
+ Repair__c updateRe = new Repair__c();
+ updateRe.Id = repairIds[0];
+ updateRe.INTERFACE_RECORD_ID__c = null;
+ updateRe.ETQ_UPLOAD_STATUS__c = null;
+ updateRe.ETQ_UPLOAD_MESSAGE__c = null;
+ updateRe.OSH_ConfirmationDate__c = Date.today();
+ updateRe.OSH_Affirmant__c = UserInfo.getUserId();
+ updateRe.AWS_Interface_Time__c = Datetime.now();
+ updateRe.AsyncData__c = true;
+ try{
+ update updateRe;
+ Database.executeBatch(new RepairToPDFBatch(iflog_Id, rowDataSFDC,repairIds,statu)); //鐢熸垚PDF
+ iflog.Log__c += '\n淇悊:'+updateRe+' 鏇存柊鎴愬姛';
+ iflog.Log__c = '\nNFM401WebService end--';
+ insert iflog;
+ }catch(Exception ex){
+ iflog.ErrorLog__c += '淇悊:'+updateRe+' 鏇存柊澶辫触,鍥犱负::'+ex.getMessage();
+ iflog.Log__c = '\nNFM401WebService end--';
+ insert iflog;
+ return '鏇存柊淇悊鎶ラ敊:'+ ex.getMessage();
+ }
+ }
+ return '鍙戦�佹垚鍔�!';
+ }
+
+ // 鏌ユ壘AssetID
+ @AuraEnabled
+ public static String selectAssetID(String recordId){
+ List<Repair__c> res = new List<Repair__c>();
+ try{
+ res = [SELECT Delivered_Product__c from Repair__c WHERE Id =: recordId];
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res[0].Delivered_Product__c;
+ }
+
+ // 鏌ユ壘鍒犻櫎ID
+ @AuraEnabled
+ public static List<Repair__c> selectCustomDeleteById(String recordId){
+ List<Repair__c > res = new List<Repair__c >();
+ try{
+ res = [SELECT Id, Status__c,SAP_Transfer_time__c, Repair_Ordered_Date__c, CreatedById, Acc_OwnerId__c,FSE_ownerid__c FROM Repair__c WHERE Id =: recordId];
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+
+ // 鏌ユ壘鍒犻櫎ID
+ @AuraEnabled
+ public static String deleteRepair(String rid) {
+ try {
+ Repair__c r = new Repair__c(Id = rid);
+ delete r;
+ return 'OK';
+ } catch (Exception e) {
+ return e.getMessage();
+ }
+ }
+
+ public class InitData{
+ @AuraEnabled
+ public String Status1C;
+ @AuraEnabled
+ public String RepairSubOrderC;
+ @AuraEnabled
+ public String OnCallIDC;
+ @AuraEnabled
+ public String QISIDC;
+ @AuraEnabled
+ public String InsReportC;
+ @AuraEnabled
+ public Datetime MBCAwareDateC;
+ @AuraEnabled
+ public String CFDANoHandC;
+ @AuraEnabled
+ public String ProduceCompanyHandC;
+ @AuraEnabled
+ public Boolean OfferRentalNewC;
+ @AuraEnabled
+ public Boolean ifRentalApplyC;
+ @AuraEnabled
+ public Datetime LatestCollectDatePriorityC;
+ @AuraEnabled
+ public String RentalApplyEquipmentSetDetailIdC;
+ @AuraEnabled
+ public String RentalApplyEquipmentSetDetailC;
+ @AuraEnabled
+ public String ProblemOccurredSelectC;
+ @AuraEnabled
+ public String Delay15MinC;
+ @AuraEnabled
+ public String ProductFailureRelatedC;
+ @AuraEnabled
+ public String Id;
+ @AuraEnabled
+ public String OCSMAdministrativeReportNumberC;
+ @AuraEnabled
+ public Datetime OCSMAdministrativeReportDateC;
+ @AuraEnabled
+ public Datetime AwareDateC;
+ @AuraEnabled
+ public String PAEDetermineC;
+ @AuraEnabled
+ public String ETQUPLOADSTATUSC;
+ @AuraEnabled
+ public String AEDetermineResultC;
+ @AuraEnabled
+ public String PAEDetermineACC;
+ @AuraEnabled
+ public Datetime RepairInspectionDateC;
+ @AuraEnabled
+ public boolean ContainUseRSAC;
+ @AuraEnabled
+ public String InchargeStaffEmailC;
+ @AuraEnabled
+ public String Name;
+ @AuraEnabled
+ public String HPNameC;
+ @AuraEnabled
+ public String DeliveredProductC;
+ @AuraEnabled
+ public String RepairProductSerialNoC;
+ @AuraEnabled
+ public String ServiceRepairNoC;
+ @AuraEnabled
+ public Datetime RepairFirstestimatedDateC;
+ @AuraEnabled
+ public Datetime RepairEstimatedDateC;
+ @AuraEnabled
+ public String RCInformationC;
+ @AuraEnabled
+ public String OCSMAdministrativeReportStatusC;
+ @AuraEnabled
+ public Datetime RepairShippedDateC;
+ @AuraEnabled
+ public Datetime partArrangementCompleteC;
+ @AuraEnabled
+ public String userID;
+ @AuraEnabled
+ public String profileId;
+ @AuraEnabled
+ public String userEmail;
+ @AuraEnabled
+ public String PaperRepairRequestNoC;
+ @AuraEnabled
+ public String HospitalC;
+ @AuraEnabled
+ public String AccountC;
+ @AuraEnabled
+ public String DepartmentClassC;
+ @AuraEnabled
+ public String RepairCostTypeC;
+ @AuraEnabled
+ public String DealerC;
+ @AuraEnabled
+ public String InchargeStaffC;
+ @AuraEnabled
+ public String InchargeStaffContactC;
+ @AuraEnabled
+ public String SalesOfficeCodeSelectionC;
+ @AuraEnabled
+ public String OnSiteRepairC;
+ @AuraEnabled
+ public String workLocationSelectC;
+ @AuraEnabled
+ public String ReturnsProductWayC;
+ @AuraEnabled
+ public String RepairDetailC;
+ @AuraEnabled
+ public String RepairApplicantC;
+ @AuraEnabled
+ public String RepairApplicantHospitalC;
+ @AuraEnabled
+ public String RepairApplicantDepartmentC;
+ @AuraEnabled
+ public String DeliveryLogisticsModeC;
+ @AuraEnabled
+ public Datetime engineerSendDateC;
+ @AuraEnabled
+ public String DeliveryLogisticsNoC;
+ @AuraEnabled
+ public String DeliveryLogisticsAnnotationC;
+ @AuraEnabled
+ public Datetime DateReceiptQuestionsC;
+ @AuraEnabled
+ public String BreakORFallOffC;
+ @AuraEnabled
+ public String DelayReportReasonC;
+ @AuraEnabled
+ public String UseFailProductFinishC;
+ @AuraEnabled
+ public String ifDeadHurtC;
+ @AuraEnabled
+ public String SupportingProductsC;
+ @AuraEnabled
+ public String ProblemOccurredC;
+ @AuraEnabled
+ public String AfterFailureInformationC;
+ @AuraEnabled
+ public String InformationFromC;
+ @AuraEnabled
+ public String ReportAdverseEventsC;
+ @AuraEnabled
+ public String FailureQInHospitalC;
+ @AuraEnabled
+ public String WhatProjectC;
+ @AuraEnabled
+ public String OperationOrExaminationNameC;
+ @AuraEnabled
+ public String MaintenanceContractTypeC;
+ @AuraEnabled
+ public Datetime FailureOccurrenceDateC;
+ @AuraEnabled
+ public String RepairSourceC;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/otherButtonRepairController.cls-meta.xml b/force-app/main/default/classes/otherButtonRepairController.cls-meta.xml
new file mode 100644
index 0000000..9bbf7b4
--- /dev/null
+++ b/force-app/main/default/classes/otherButtonRepairController.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>
\ No newline at end of file
diff --git a/force-app/main/default/classes/otherButtonSpotInspectionReportCtl.cls b/force-app/main/default/classes/otherButtonSpotInspectionReportCtl.cls
new file mode 100644
index 0000000..3cb0f27
--- /dev/null
+++ b/force-app/main/default/classes/otherButtonSpotInspectionReportCtl.cls
@@ -0,0 +1,28 @@
+public with sharing class otherButtonSpotInspectionReportCtl {
+ public otherButtonSpotInspectionReportCtl() {
+
+ }
+
+ @AuraEnabled
+ public static InitData init(String recordId){
+ InitData res = new initData();
+ try{
+ Inspection_Report__c report = [SELECT Id,RecordTypeId FROM Inspection_Report__c WHERE Id =: recordId LIMIT 1];
+ System.debug(LoggingLevel.INFO, '*** opp: ' + report);
+ res.Id = report.Id;
+ res.RecordTypeId = report.RecordTypeId;
+
+ System.debug(LoggingLevel.INFO, '*** res: ' + res);
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+
+ public class InitData{
+ @AuraEnabled
+ public String Id;
+ @AuraEnabled
+ public String RecordTypeId;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/otherButtonSpotInspectionReportCtl.cls-meta.xml b/force-app/main/default/classes/otherButtonSpotInspectionReportCtl.cls-meta.xml
new file mode 100644
index 0000000..9bbf7b4
--- /dev/null
+++ b/force-app/main/default/classes/otherButtonSpotInspectionReportCtl.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>
\ No newline at end of file
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/lexASACEditor/lexASACEditor.css b/force-app/main/default/lwc/lexASACEditor/lexASACEditor.css
new file mode 100644
index 0000000..689c97d
--- /dev/null
+++ b/force-app/main/default/lwc/lexASACEditor/lexASACEditor.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/lexASACEditor/lexASACEditor.html b/force-app/main/default/lwc/lexASACEditor/lexASACEditor.html
new file mode 100644
index 0000000..19263b7
--- /dev/null
+++ b/force-app/main/default/lwc/lexASACEditor/lexASACEditor.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="inASACEditorHolder" 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/lexASACEditor/lexASACEditor.js b/force-app/main/default/lwc/lexASACEditor/lexASACEditor.js
new file mode 100644
index 0000000..a40f487
--- /dev/null
+++ b/force-app/main/default/lwc/lexASACEditor/lexASACEditor.js
@@ -0,0 +1,73 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init from '@salesforce/apex/ReportController.initForASACEditorButton';
+export default class LexASACEditor extends LightningElement {
+ @api recordId;
+ LastModifiedDate
+ Id
+ Name
+ LastModifiedById
+ DeveloperName
+ IsLoading = true;
+ url;
+ @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 () {
+ console.log(this.recordId);
+ init({
+ recordId: this.recordId
+ }).then(result => {
+ console.log(result);
+ if (result != undefined) {
+ console.log("if");
+ this.LastModifiedById = result.LastModifiedById;
+ this.LastModifiedDate = result.LastModifiedDate;
+ this.Id = result.Id;
+ this.Name = result.Name;
+ this.DeveloperName = result.DeveloperName;
+ console.log(this.Id);
+ this.editor();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view");
+ }else{
+ console.log("else");
+ this.IsLoading = false;
+ this.editor();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }).catch(error => {
+ console.log("error");
+ console.log(error);
+ }).finally(() => {
+
+ });
+ //this.updateRecordView(this.recordId);
+
+ }
+
+ editor(){
+ if (this.Id != undefined){
+ this.url = "/apex/RepPAEDecisionRecord?Id="+this.Id+"&ReportId="+this.recordId+"&RecordTypeIds="+"ASACDecision";
+ console.log(this.url);
+ } else {
+ this.url = "/apex/RepPAEDecisionRecord?ReportId="+this.recordId+"&RecordTypeIds="+"ASACDecision";
+ console.log(this.url);
+ }
+ window.open(this.url,"_self");
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexASACEditor/lexASACEditor.js-meta.xml b/force-app/main/default/lwc/lexASACEditor/lexASACEditor.js-meta.xml
new file mode 100644
index 0000000..952a036
--- /dev/null
+++ b/force-app/main/default/lwc/lexASACEditor/lexASACEditor.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/lexASRCEditor/lexASRCEditor.css b/force-app/main/default/lwc/lexASRCEditor/lexASRCEditor.css
new file mode 100644
index 0000000..5cd9c5d
--- /dev/null
+++ b/force-app/main/default/lwc/lexASRCEditor/lexASRCEditor.css
@@ -0,0 +1,10 @@
+.inASRCEditorHolder{
+ 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/lexASRCEditor/lexASRCEditor.html b/force-app/main/default/lwc/lexASRCEditor/lexASRCEditor.html
new file mode 100644
index 0000000..79f5b93
--- /dev/null
+++ b/force-app/main/default/lwc/lexASRCEditor/lexASRCEditor.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="inASRCEditorHolder" 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/lexASRCEditor/lexASRCEditor.js b/force-app/main/default/lwc/lexASRCEditor/lexASRCEditor.js
new file mode 100644
index 0000000..982af66
--- /dev/null
+++ b/force-app/main/default/lwc/lexASRCEditor/lexASRCEditor.js
@@ -0,0 +1,74 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init from '@salesforce/apex/ReportController.initForASRCEditorButton';
+
+export default class LexASRCEditor extends LightningElement {
+ @api recordId;
+ LastModifiedDate
+ Id
+ Name
+ LastModifiedById
+ DeveloperName
+ IsLoading = true;
+ url;
+ @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 () {
+ console.log(this.recordId);
+ init({
+ recordId: this.recordId
+ }).then(result => {
+ console.log(result);
+ if (result != undefined) {
+ console.log("if");
+ this.LastModifiedById = result.LastModifiedById;
+ this.LastModifiedDate = result.LastModifiedDate;
+ this.Id = result.Id;
+ this.Name = result.Name;
+ this.DeveloperName = result.DeveloperName;
+ console.log(this.Id);
+ this.editor();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view");
+ }else{
+ console.log("else");
+ this.IsLoading = false;
+ this.editor();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }).catch(error => {
+ console.log("error");
+ console.log(error);
+ }).finally(() => {
+
+ });
+ //this.updateRecordView(this.recordId);
+
+ }
+
+ editor(){
+ if (this.Id != undefined){
+ this.url = "/apex/RepPAEDecisionRecord?Id="+this.Id+"&ReportId="+this.recordId+"&RecordTypeIds="+"ASRCDecision";
+ console.log(this.url);
+ } else {
+ this.url = "/apex/RepPAEDecisionRecord?ReportId="+this.recordId+"&RecordTypeIds="+"ASRCDecision";
+ console.log(this.url);
+ }
+ window.open(this.url,"_self");
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexASRCEditor/lexASRCEditor.js-meta.xml b/force-app/main/default/lwc/lexASRCEditor/lexASRCEditor.js-meta.xml
new file mode 100644
index 0000000..952a036
--- /dev/null
+++ b/force-app/main/default/lwc/lexASRCEditor/lexASRCEditor.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/lexASRCEditorRepair/__tests__/lexASRCEditorRepair.test.js b/force-app/main/default/lwc/lexASRCEditorRepair/__tests__/lexASRCEditorRepair.test.js
new file mode 100644
index 0000000..d5c600d
--- /dev/null
+++ b/force-app/main/default/lwc/lexASRCEditorRepair/__tests__/lexASRCEditorRepair.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexASRCEditorRepair from 'c/lexASRCEditorRepair';
+
+describe('c-lex-asrc-editor-repair', () => {
+ 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-asrc-editor-repair', {
+ is: LexASRCEditorRepair
+ });
+
+ // 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/lexASRCEditorRepair/lexASRCEditorRepair.html b/force-app/main/default/lwc/lexASRCEditorRepair/lexASRCEditorRepair.html
new file mode 100644
index 0000000..d044dbb
--- /dev/null
+++ b/force-app/main/default/lwc/lexASRCEditorRepair/lexASRCEditorRepair.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="exampleHolder" 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/lexASRCEditorRepair/lexASRCEditorRepair.js b/force-app/main/default/lwc/lexASRCEditorRepair/lexASRCEditorRepair.js
new file mode 100644
index 0000000..8387edc
--- /dev/null
+++ b/force-app/main/default/lwc/lexASRCEditorRepair/lexASRCEditorRepair.js
@@ -0,0 +1,75 @@
+import {
+ LightningElement,
+ wire,
+ api
+} from 'lwc';
+import {
+ CurrentPageReference
+} from "lightning/navigation";
+import {
+ CloseActionScreenEvent
+} from 'lightning/actions';
+
+import init from '@salesforce/apex/otherButtonRepairController.init';
+import selectPAEDecisionRecord from '@salesforce/apex/otherButtonRepairController.selectPAEDecisionRecord';
+
+export default class LexASRCEditorRepair extends LightningElement {
+ @api recordId;
+ str;
+ IsLoading = true;
+ Id;
+ RecordTypeId;
+
+ @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 => {
+ console.log(result);
+ if (result != null) {
+ this.IsLoading = false;
+ this.Id = result.Id;
+ this.RecordTypeId = result.RecordTypeId;
+
+ this.ASRCEditor();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }).catch(error => {
+ console.log(error);
+ }).finally(() => {
+
+ });
+ }
+
+ // Intake universal code缂栬緫
+ ASRCEditor() {
+ var RecordTypeId = "ASRCDecision";
+ var RepairId = this.Id;
+ var url = '';
+ selectPAEDecisionRecord({
+ recordId: RepairId,
+ recordTypeId: RecordTypeId
+ }).then(result => {
+ if (result != null) {
+ if (result.length > 0) {
+ url = "/apex/PAEDecisionRecord?Id=" + result[0].Id + "&RepairId=" + RepairId + "&RecordTypeIds=" + RecordTypeId;
+ } else {
+ url = "/apex/PAEDecisionRecord?RepairId=" + RepairId + "&RecordTypeIds=" + RecordTypeId;
+ }
+ window.open(url, '_self');
+ }
+ }).catch(error => {
+ console.log(error);
+ })
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexASRCEditorRepair/lexASRCEditorRepair.js-meta.xml b/force-app/main/default/lwc/lexASRCEditorRepair/lexASRCEditorRepair.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexASRCEditorRepair/lexASRCEditorRepair.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.html b/force-app/main/default/lwc/lexApplicationCancelSubmit/lexApplicationCancelSubmit.html
new file mode 100644
index 0000000..6a7e8a2
--- /dev/null
+++ b/force-app/main/default/lwc/lexApplicationCancelSubmit/lexApplicationCancelSubmit.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="CancelSubmitHolder" 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/lexApplicationCancelSubmit/lexApplicationCancelSubmit.js b/force-app/main/default/lwc/lexApplicationCancelSubmit/lexApplicationCancelSubmit.js
new file mode 100644
index 0000000..ee9ec67
--- /dev/null
+++ b/force-app/main/default/lwc/lexApplicationCancelSubmit/lexApplicationCancelSubmit.js
@@ -0,0 +1,74 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init from '@salesforce/apex/ApplicationButtonController.initSubmitButton';
+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';
+export default class lexApplicationCancelSubmit extends LightningElement {
+ @api recordId;//OwnerId
+ ownerId;
+ monthlyReportId;
+ 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.ownerId = result.OwnerId;
+ this.monthlyReportId = result.Id;
+ this.cancelSubmit();
+ })
+ }
+ //鎺堟潈鐢宠 鍙栨秷鎻愪氦
+ cancelSubmit(){
+ //'鑾峰彇褰撳墠鐧婚檰浜篿d'
+ userInfo_Owner({}).then(result=>{
+ if(this.ownerId == result.id){
+ submitCancel({
+ recordId: this.recordId
+ }).then(requst=>{
+ if(requst == '1'){
+ this.showToast("鍙栨秷鎻愪氦鎺堟潈淇℃伅鎴愬姛","success");
+ }
+ if(requst != "1"){
+ var messageage = "";
+ messageage = requst.split(',')[1];
+ this.showToast(messageage,"error");
+ }
+ })
+ }else{
+ this.showToast("鍙巿鏉冪敵璇蜂功鎵�鏈変汉鍙互鍙栨秷鎻愪氦","error");
+ }
+ })
+ }
+
+ updateRecordView() {
+ updateRecord({fields: { Id: this.recordId }});
+ }
+
+ showToast(msg,type) {
+ const event = new ShowToastEvent({
+ message: msg,
+ variant: type
+ });
+ if(type == 'success'){
+ this.updateRecordView();
+ }
+ this.dispatchEvent(event);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexApplicationCancelSubmit/lexApplicationCancelSubmit.js-meta.xml b/force-app/main/default/lwc/lexApplicationCancelSubmit/lexApplicationCancelSubmit.js-meta.xml
new file mode 100644
index 0000000..2b7649d
--- /dev/null
+++ b/force-app/main/default/lwc/lexApplicationCancelSubmit/lexApplicationCancelSubmit.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/lexApplicationSubmitButton/lexApplicationSubmitButton.html b/force-app/main/default/lwc/lexApplicationSubmitButton/lexApplicationSubmitButton.html
new file mode 100644
index 0000000..6a7e8a2
--- /dev/null
+++ b/force-app/main/default/lwc/lexApplicationSubmitButton/lexApplicationSubmitButton.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="CancelSubmitHolder" 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/lexApplicationSubmitButton/lexApplicationSubmitButton.js b/force-app/main/default/lwc/lexApplicationSubmitButton/lexApplicationSubmitButton.js
new file mode 100644
index 0000000..90688a9
--- /dev/null
+++ b/force-app/main/default/lwc/lexApplicationSubmitButton/lexApplicationSubmitButton.js
@@ -0,0 +1,83 @@
+import { LightningElement,wire,track,api} from 'lwc';
+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 submit from '@salesforce/apex/ApplicationButtonController.submit';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class lexApplicationSubmitButton extends LightningElement {
+ @api recordId;//OwnerId
+ ownerId;//鎵�鏈変汉id
+ id;//杩斿洖鍊肩殑id
+ IsLoading = true;
+ arrMessage = [];
+
+ @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.ownerId = result.OwnerId;
+ this.id = result.Id;
+ this.Submit();
+ }
+ })
+ }
+
+ Submit(){
+ this.arrMessage = [];
+ //鑾峰彇鑾峰彇褰撳墠鐧婚檰浜�
+ userInfo_Owner({}).then(result=>{
+ if(this.ownerId == result.id){
+ submit({
+ recordId: this.recordId
+ }).then(requst=>{
+ if(requst == '1'){
+ this.showToast("鎻愪氦鎺堟潈淇℃伅鎴愬姛","success");
+ }
+ if(requst != "1"){
+ var messageage = "";
+ for(let i=0;i<this.arrMessage.length;i++){
+ if(this.arrMessage.length-1 == i){
+ break;
+ }
+ messageage += this.arrMessage[i+1];
+ }
+ this.showToast(messageage,"error");
+ }
+ })
+ }else{
+ this.showToast("鍙巿鏉冪敵璇蜂功鎵�鏈変汉鍙互鎻愪氦","error");
+ }
+ })
+ }
+
+ updateRecordView() {
+ updateRecord({fields: { Id: this.recordId }});
+ }
+
+ showToast(msg,type) {
+ const event = new ShowToastEvent({
+ message: msg,
+ variant: type
+ });
+ this.dispatchEvent(event);
+ if(type == 'success'){
+ this.updateRecordView();
+ }
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexApplicationSubmitButton/lexApplicationSubmitButton.xml b/force-app/main/default/lwc/lexApplicationSubmitButton/lexApplicationSubmitButton.xml
new file mode 100644
index 0000000..2b7649d
--- /dev/null
+++ b/force-app/main/default/lwc/lexApplicationSubmitButton/lexApplicationSubmitButton.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.css b/force-app/main/default/lwc/lexCancel/lexCancel.css
new file mode 100644
index 0000000..6e1b0a2
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancel/lexCancel.css
@@ -0,0 +1,10 @@
+.cancelHolder{
+ 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/lexCancel/lexCancel.html b/force-app/main/default/lwc/lexCancel/lexCancel.html
new file mode 100644
index 0000000..61b5906
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancel/lexCancel.html
@@ -0,0 +1,6 @@
+<template>
+ <div class="cancelHolder" 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/lexCancel/lexCancel.js b/force-app/main/default/lwc/lexCancel/lexCancel.js
new file mode 100644
index 0000000..29ffc5c
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancel/lexCancel.js
@@ -0,0 +1,103 @@
+/*
+ * @Description:
+ * @version:
+ * @Author: chen jing wu
+ * @Date: 2023-04-07 09:02:03
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-11 09:00:54
+ */
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init from '@salesforce/apex/ReportController.initForCancelButton';
+import updateForCancelButton from '@salesforce/apex/ReportController.updateForCancelButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class LexCancel extends LightningElement {
+ @api recordId;
+ status;
+ 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(){
+ console.log(this.recordId);
+ init({
+ recordId: this.recordId
+ }).then(result => {
+ console.log(result);
+ if (result != null) {
+ this.status = result.status;
+ console.log(this.status);
+ this.cancel();
+
+ }
+ }).catch(error => {
+ console.log("error");
+ console.log(error);
+ }).finally(() => {
+
+ });
+
+ }
+
+ showToast(msg,type) {
+ const event = new ShowToastEvent({
+ title: '',
+ message: msg,
+ variant: type
+ });
+ this.dispatchEvent(event);
+ }
+
+
+ updateRecordView(recordId) {
+ updateRecord({fields: { Id: recordId }});
+ }
+
+ cancel () {
+ if (this.status == "鍙栨秷") {
+ ShowToastEvent("宸茬粡鍙栨秷锛�","error");
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ if (this.status == "鎵瑰噯") {
+ ShowToastEvent("宸茬粡鎵瑰噯锛屼笉鑳藉垹闄わ紒","error");
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ if (this.status == "瀹屾瘯") {
+ ShowToastEvent("宸茬粡瀹屾瘯锛屼笉鑳藉垹闄わ紒","error");
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ if (this.status == "鎻愪氦") {
+ ShowToastEvent("宸茬粡鎻愪氦锛屼笉鑳藉垹闄わ紒","error");
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ updateForCancelButton({
+ recordId: this.recordId
+ }).then(result =>{
+ this.showToast("鍙栨秷鎴愬姛锛�","success");
+ this.updateRecordView(this.recordId);
+ this.IsLoading = false;
+ this.dispatchEvent(new CloseActionScreenEvent());
+ });
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCancel/lexCancel.js-meta.xml b/force-app/main/default/lwc/lexCancel/lexCancel.js-meta.xml
new file mode 100644
index 0000000..329e839
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancel/lexCancel.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/lexCancelSubmit/lexCancelSubmit.css b/force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.css
new file mode 100644
index 0000000..2cca6a5
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.css
@@ -0,0 +1,10 @@
+.cancelSubmitHolder{
+ 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/lexCancelSubmit/lexCancelSubmit.html b/force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.html
new file mode 100644
index 0000000..f8af820
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.html
@@ -0,0 +1,6 @@
+<template>
+ <div class="cancelSubmitHolder" 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/lexCancelSubmit/lexCancelSubmit.js b/force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.js
new file mode 100644
index 0000000..f5e217a
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.js
@@ -0,0 +1,89 @@
+/*
+ * @Description:
+ * @version:
+ * @Author: chen jing wu
+ * @Date: 2023-04-07 09:02:03
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-11 09:05:05
+ */
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { NavigationMixin } from 'lightning/navigation';
+import init from '@salesforce/apex/MonthlyReportController.initForCancelSubmitButton';
+import cancel from '@salesforce/apex/MonthlyReportController.cancel';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class LexCancelSubmit extends LightningElement {
+ @api recordId;//OwnerId
+ ownerId;
+ monthlyReportId;
+ 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 () {
+ console.log(this.recordId);
+ init({
+ recordId: this.recordId
+ }).then(result => {
+ console.log(result);
+ if (result != null) {
+ this.ownerId = result.ownerId;
+ this.monthlyReportId = result.Id;
+ this.cancelSubmit();
+ console.log("end");
+ //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(msg,type) {
+ const event = new ShowToastEvent({
+ title: '',
+ message: msg,
+ variant: type
+ });
+ this.dispatchEvent(event);
+ }
+ updateRecordView(recordId) {
+ updateRecord({fields: { Id: recordId }});
+ }
+ cancelSubmit () {
+ //闇�瑕佸畬鍠�
+ if(this.ownerId == UserInfo_Owner.Id) {
+ cancel({
+ recordId: this.recordId
+ }).then(result=>{
+ this.showToast("鎴愬姛","success");
+ this.updateRecordView(this.recordId);
+ 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/lexCancelSubmit/lexCancelSubmit.js-meta.xml b/force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.js-meta.xml
new file mode 100644
index 0000000..709c8f7
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.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/lexCancelSubmitReport/lexCancelSubmitReport.css b/force-app/main/default/lwc/lexCancelSubmitReport/lexCancelSubmitReport.css
new file mode 100644
index 0000000..3e04b55
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelSubmitReport/lexCancelSubmitReport.css
@@ -0,0 +1,10 @@
+.cancelSubmitReportHolder{
+ 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/lexCancelSubmitReport/lexCancelSubmitReport.html b/force-app/main/default/lwc/lexCancelSubmitReport/lexCancelSubmitReport.html
new file mode 100644
index 0000000..6b80280
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelSubmitReport/lexCancelSubmitReport.html
@@ -0,0 +1,6 @@
+<template>
+ <div class="cancelSubmitReportHolder" 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/lexCancelSubmitReport/lexCancelSubmitReport.js b/force-app/main/default/lwc/lexCancelSubmitReport/lexCancelSubmitReport.js
new file mode 100644
index 0000000..00557d0
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelSubmitReport/lexCancelSubmitReport.js
@@ -0,0 +1,66 @@
+/*
+ * @Description:
+ * @version:
+ * @Author: chen jing wu
+ * @Date: 2023-04-07 09:02:03
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-11 09:06:00
+ */
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import cancel from '@salesforce/apex/ReportController.updateForCancelSubmitReportButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class LexCancelSubmitReport 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(){
+ console.log(this.recordId);
+ this.cancelSubmit();
+ }
+
+
+ cancelSubmit(){
+ cancel({
+ recordId: this.recordId
+ }).then(result =>{
+ this.showToast("鍙栨秷鎻愪氦鎴愬姛锛�","success");
+ this.updateRecordView(this.recordId);
+ this.IsLoading = false;
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }).catch(error=>{
+ this.showToast(error,"error");
+ });
+ }
+
+ updateRecordView(recordId) {
+ updateRecord({fields: { Id: recordId }});
+ }
+
+
+ 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/lexCancelSubmitReport/lexCancelSubmitReport.js-meta.xml b/force-app/main/default/lwc/lexCancelSubmitReport/lexCancelSubmitReport.js-meta.xml
new file mode 100644
index 0000000..329e839
--- /dev/null
+++ b/force-app/main/default/lwc/lexCancelSubmitReport/lexCancelSubmitReport.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/lexComplete/lexComplete.css b/force-app/main/default/lwc/lexComplete/lexComplete.css
new file mode 100644
index 0000000..f9aba1f
--- /dev/null
+++ b/force-app/main/default/lwc/lexComplete/lexComplete.css
@@ -0,0 +1,10 @@
+.completeHolder{
+ 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/lexComplete/lexComplete.html b/force-app/main/default/lwc/lexComplete/lexComplete.html
new file mode 100644
index 0000000..7c1968c
--- /dev/null
+++ b/force-app/main/default/lwc/lexComplete/lexComplete.html
@@ -0,0 +1,6 @@
+<template>
+ <div class="completeHolder" 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/lexComplete/lexComplete.js b/force-app/main/default/lwc/lexComplete/lexComplete.js
new file mode 100644
index 0000000..27029f0
--- /dev/null
+++ b/force-app/main/default/lwc/lexComplete/lexComplete.js
@@ -0,0 +1,94 @@
+/*
+ * @Description:
+ * @version:
+ * @Author: chen jing wu
+ * @Date: 2023-04-07 09:02:03
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-11 09:06:48
+ */
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init from '@salesforce/apex/ReportController.initForCompleteButton';
+import updateForCompleteButton from '@salesforce/apex/ReportController.updateForCompleteButton';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class LexComplete extends LightningElement {
+ @api recordId;
+ profileId;
+ status;
+ 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 () {
+ console.log(this.recordId);
+ init({
+ recordId: this.recordId
+ }).then(result => {
+ console.log(result);
+ if (result != null) {
+ 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);
+ }
+
+ showToast(msg,type) {
+ const event = new ShowToastEvent({
+ title: '',
+ message: msg,
+ variant: type
+ });
+ this.dispatchEvent(event);
+ }
+
+ updateRecordView(recordId) {
+ updateRecord({fields: { Id: recordId }});
+ }
+
+
+
+ complete () {
+ // 闄嗚儨锛岃儭杩畨锛岀郴缁熺鐞嗗憳浠ュ娌℃湁鏉冮檺
+ if (UserInfo_Owner.Id != "00510000004reg2" && UserInfo_Owner.Id != "00510000000gWAE" && this.profileId != "00e10000000Y3o5") {
+ ShowToastEvent("浣犳病鏈夋潈闄�","error");
+ return;
+ }
+ if (this.status == "瀹屾瘯") {
+ ShowToastEvent("宸茬粡瀹屾瘯锛�","error");
+ return;
+ }
+ updateForCompleteButton({
+ recordId: this.recordId
+ }).then(result =>{
+ this.IsLoading = false;
+ this.updateRecordView(this.recordId);
+ this.showToast("瀹屾瘯鎴愬姛锛�","success");
+ });
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexComplete/lexComplete.js-meta.xml b/force-app/main/default/lwc/lexComplete/lexComplete.js-meta.xml
new file mode 100644
index 0000000..329e839
--- /dev/null
+++ b/force-app/main/default/lwc/lexComplete/lexComplete.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/lexCopyPIInspectionReport/__tests__/lexCopyPIInspectionReport.test.js b/force-app/main/default/lwc/lexCopyPIInspectionReport/__tests__/lexCopyPIInspectionReport.test.js
new file mode 100644
index 0000000..e21bfdf
--- /dev/null
+++ b/force-app/main/default/lwc/lexCopyPIInspectionReport/__tests__/lexCopyPIInspectionReport.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexCopyPIInspectionReport from 'c/lexCopyPIInspectionReport';
+
+describe('c-lex-copy-pi-inspection-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-copy-pi-inspection-report', {
+ is: LexCopyPIInspectionReport
+ });
+
+ // 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/lexCopyPIInspectionReport/lexCopyPIInspectionReport.html b/force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.html
new file mode 100644
index 0000000..d044dbb
--- /dev/null
+++ b/force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="exampleHolder" 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/lexCopyPIInspectionReport/lexCopyPIInspectionReport.js b/force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.js
new file mode 100644
index 0000000..44d87fb
--- /dev/null
+++ b/force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.js
@@ -0,0 +1,57 @@
+import {
+ LightningElement,
+ wire,
+ api
+} from 'lwc';
+import {
+ CurrentPageReference
+} from "lightning/navigation";
+import {
+ CloseActionScreenEvent
+} from 'lightning/actions';
+
+import init from '@salesforce/apex/otherButtonSpotInspectionReportCtl.init';
+
+export default class LexCopyPIInspectionReport extends LightningElement {
+ @api recordId;
+ str;
+ IsLoading = true;
+ Id;
+ RecordTypeId;
+
+ @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 => {
+ console.log(result);
+ if (result != null) {
+ this.IsLoading = false;
+ this.Id = result.Id;
+ this.RecordTypeId = result.RecordTypeId;
+
+ this.CopyPI();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }).catch(error => {
+ console.log(error);
+ }).finally(() => {
+
+ });
+ }
+
+ // 澶嶅埗
+ CopyPI() {
+ window.location.href = '/' + this.Id + '/e?newclone=1';
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.js-meta.xml b/force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.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.css b/force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.css
new file mode 100644
index 0000000..8d634cd
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.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/lexCreateNotesEmail/lexCreateNotesEmail.html b/force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.html
new file mode 100644
index 0000000..61d9b05
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.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/lexCreateNotesEmail/lexCreateNotesEmail.js b/force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.js
new file mode 100644
index 0000000..3130703
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.js
@@ -0,0 +1,97 @@
+/*
+ * @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';
+import { NavigationMixin } from 'lightning/navigation';
+import init from '@salesforce/apex/MonthlyReportController.initForCreateNoteEmailButton';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+
+export default class LexCreateNotesEmail extends LightningElement {
+ @api recordId;
+ ownerEmail;
+ ownerAlias;
+ keyIssue;
+ feedBack;
+ taskFollow;
+ otherIssue;
+ nextWeekPlan;
+ drSumUrl;
+ IsLoading = true;
+ url;
+
+ @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(){
+ console.log(this.recordId);
+ init({
+ recordId: this.recordId
+ }).then(result => {
+ console.log(result);
+ if (result != null) {
+ this.IsLoading = false;
+ this.ownerEmail = result.ownerEmail;
+ this.ownerAlias = result.ownerAlias;
+ this.keyIssue = result.keyIssue;
+ this.feedBack = result.feedBack;
+ this.taskFollow = result.taskFollow;
+ this.otherIssue = result.otherIssue;
+ this.nextWeekPlan = result.nextWeekPlan;
+ this.drSumUrl = result.drSumUrl;
+ this.userEmail = result.userEmail;
+ this.createEmail();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }).catch(error => {
+ console.log("error");
+ console.log(error);
+ }).finally(() => {
+
+ });
+ }
+ createEmail() {
+ console.log("start");
+
+ window.location.href = ("mailto:"
+ + this.ownerEmail
+ +"?bcc="
+ + this.userEmail
+ +"&subject=銆愬懆鎶�:"
+ + this.ownerAlias
+ + "銆�" + "&body=鍏堢敓/濂冲+" + "%0D%0A" + "%0D%0A" + "涓昏鎶ュ憡浜嬮」锛�"
+ + this.keyIssue
+ +"%0D%0A" + "涓嬪睘浜嬮」/鐘舵�佹姤鍛婏細"
+ + this.feedBack
+ +"%0D%0A" + "璇鹃鍙婂搴旂粨鏋�/鎻愭锛�"
+ + this.taskFollow
+ +"%0D%0A" + "鍏朵粬浜嬮」锛�"
+ + this.otherIssue
+ +"%0D%0A" + "涓嬪懆璁″垝锛�"
+ + this.nextWeekPlan
+ +"%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/lexCreateNotesEmail/lexCreateNotesEmail.js-meta.xml b/force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.js-meta.xml
new file mode 100644
index 0000000..329e839
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.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/lexCreateReportMaintenanceContract/__tests__/lexCreateReportMaintenanceContract.test.js b/force-app/main/default/lwc/lexCreateReportMaintenanceContract/__tests__/lexCreateReportMaintenanceContract.test.js
new file mode 100644
index 0000000..c75ef3d
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateReportMaintenanceContract/__tests__/lexCreateReportMaintenanceContract.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexCreateReportMaintenanceContract from 'c/lexCreateReportMaintenanceContract';
+
+describe('c-lex-create-report-maintenance-contract', () => {
+ 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-report-maintenance-contract', {
+ is: LexCreateReportMaintenanceContract
+ });
+
+ // 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/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.html b/force-app/main/default/lwc/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.html
new file mode 100644
index 0000000..d044dbb
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="exampleHolder" 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/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.js b/force-app/main/default/lwc/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.js
new file mode 100644
index 0000000..04d05e5
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.js
@@ -0,0 +1,69 @@
+import {
+ LightningElement,
+ wire,
+ api
+} from 'lwc';
+import {
+ CurrentPageReference
+} from "lightning/navigation";
+import {
+ CloseActionScreenEvent
+} from 'lightning/actions';
+import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init';
+
+export default class LexCreateReportMaintenanceContract extends LightningElement {
+ @api recordId;
+ str;
+ IsLoading = true;
+ Id;
+ RecordTypeDeveloperNameC;
+ EstimateTargetC;
+
+ @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);
+ if (result != null) {
+ this.IsLoading = false;
+ this.Id = result.Id;
+ this.RecordTypeDeveloperNameC = result.RecordTypeDeveloperNameC;
+ this.EstimateTargetC = result.EstimateTargetC;
+
+ this.CreateReport();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }).catch(error => {
+ console.log(error);
+ }).finally(() => {
+
+ });
+ }
+
+ // 鍒朵綔鎶ュ憡涔�
+ CreateReport() {
+ var MaintenanceContractId = this.Id;
+ var RecordTypeName = this.RecordTypeDeveloperNameC;
+ var EstimateTarget = this.EstimateTargetC;
+
+ var url = '';
+ if (EstimateTarget == "缁忛攢鍟�" && (RecordTypeName == "NewMaintenance_Contract" || RecordTypeName == "VM_Contract")) {
+ url = "/apex/MoreMaintenanceContractPop?Id=" + MaintenanceContractId + "&RecordTypeName=" + RecordTypeName;
+ } else {
+ url = "http://powerbi.olympus.com.cn/Home/Login";
+ }
+ window.open(url, '_bank');
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.js-meta.xml b/force-app/main/default/lwc/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.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/lexCustomNewCopy2/__tests__/lexCustomNewCopy2.test.js b/force-app/main/default/lwc/lexCustomNewCopy2/__tests__/lexCustomNewCopy2.test.js
new file mode 100644
index 0000000..b377bae
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomNewCopy2/__tests__/lexCustomNewCopy2.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexCustomNewCopy2 from 'c/lexCustomNewCopy2';
+
+describe('c-lex-custom-new-copy2', () => {
+ 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-custom-new-copy2', {
+ is: LexCustomNewCopy2
+ });
+
+ // 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/lexCustomNewCopy2/lexCustomNewCopy2.html b/force-app/main/default/lwc/lexCustomNewCopy2/lexCustomNewCopy2.html
new file mode 100644
index 0000000..87f391a
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomNewCopy2/lexCustomNewCopy2.html
@@ -0,0 +1,6 @@
+<template>
+ <div class="exampleHolder" 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/lexCustomNewCopy2/lexCustomNewCopy2.js b/force-app/main/default/lwc/lexCustomNewCopy2/lexCustomNewCopy2.js
new file mode 100644
index 0000000..2daf585
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomNewCopy2/lexCustomNewCopy2.js
@@ -0,0 +1,77 @@
+import {
+ LightningElement,
+ wire,
+ api
+} from 'lwc';
+import {
+ CurrentPageReference
+} from "lightning/navigation";
+import {
+ CloseActionScreenEvent
+} from 'lightning/actions';
+import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init';
+import {
+ ShowToastEvent
+} from 'lightning/platformShowToastEvent';
+
+export default class LexCustomNewCopy2 extends LightningElement {
+ @api recordId;
+ str;
+ IsLoading = true;
+ Id;
+ notRenewC;
+ Name;
+
+ @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);
+ if (result != null) {
+ this.IsLoading = false;
+ this.Id = result.Id;
+ this.notRenewC = result.notRenewC;
+ this.Name = result.Name;
+
+ this.CustomNewCopy2();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }).catch(error => {
+ console.log(error);
+ }).finally(() => {
+
+ });
+ }
+
+ // 缁х画鏂版湇鍔″悎鍚�
+ CustomNewCopy2() {
+ if (this.notRenewC) {
+ this.ShowToastEvent("璇疯仈绯绘湇鍔″晢鍝侀儴锛�", "error");
+ // alert("璇疯仈绯绘湇鍔″晢鍝侀儴锛�");
+ } else {
+ window.open("/" + this.Id + "/e?clone=1&Name=&00N10000002Dx5D=&00N10000002Dx5S=%e5%bc%95%e5%90%88%e4%b8%ad&00NO00000010sDc=&CF00NO00000010hyI=&CF00NO00000010hyI_lkid=&CF00NO00000010hyX=&CF00NO00000010hyX_lkid=&CF00NO00000010hyN=&CF00NO00000010hyN_lkid=&RecordType=01210000000gTYq&00N10000002pmOp=&00N10000006gZDd=&00N10000006gZDe=&00NO00000010hy4=&00N10000002Dx4j=&00N10000002Dx4m=&00N10000002Dx4w=&00N10000002Dx4k=&00N10000002Dx5J=&00N10000002Dx5M=&00N10000002Dx4i=&00N10000002Dx4h=&00N10000002Dx5K=&00N10000003OXdT=&00N100000048zfn=&00N10000002FMsq=&00N10000003OlGF=&00N10000002Dx4r=&00N100000047AY1=&00N100000047AYB=&00N100000047AY6=&00N10000003PCeB=&00N10000005HBNe=&00N10000006plAl=&00N10000002Dx5C=&retURL=%2F" + this.Id + "&saveURL=%2Fapex/SaveMaintenanceByCopy?mid=" + this.Id + "&CF00N100000048Paw=" + this.Name + "&CF00N100000048Paw_lkid=" + this.Id, "_blank");
+ }
+ }
+
+ // 寮圭獥
+ ShowToastEvent(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/lexCustomNewCopy2/lexCustomNewCopy2.js-meta.xml b/force-app/main/default/lwc/lexCustomNewCopy2/lexCustomNewCopy2.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomNewCopy2/lexCustomNewCopy2.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/lexDispatchOCSMQARA/lexDispatchOCSMQARA.css b/force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.css
new file mode 100644
index 0000000..3d14772
--- /dev/null
+++ b/force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.css
@@ -0,0 +1,10 @@
+.dispatchOCSMQARAHolder{
+ 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/lexDispatchOCSMQARA/lexDispatchOCSMQARA.html b/force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.html
new file mode 100644
index 0000000..894569c
--- /dev/null
+++ b/force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.html
@@ -0,0 +1,6 @@
+<template>
+ <div class="dispatchOCSMQARAHolder" 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/lexDispatchOCSMQARA/lexDispatchOCSMQARA.js b/force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.js
new file mode 100644
index 0000000..09c3a26
--- /dev/null
+++ b/force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.js
@@ -0,0 +1,67 @@
+/*
+ * @Description:
+ * @version:
+ * @Author: chen jing wu
+ * @Date: 2023-04-07 09:02:03
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-11 09:07:34
+ */
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import updateForDispatchOCSMQARAButton from '@salesforce/apex/ReportController.updateForDispatchOCSMQARAButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class LexDispatchOCSMQARA 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(){
+ console.log(this.recordId);
+ this.DispatchOCSMQARA();
+
+ }
+
+ showToast(msg,type) {
+ const event = new ShowToastEvent({
+ title: '',
+ message: msg,
+ variant: type
+ });
+ this.dispatchEvent(event);
+ }
+
+
+ updateRecordView(recordId) {
+ updateRecord({fields: { Id: recordId }});
+ }
+
+ DispatchOCSMQARA () {
+ updateForDispatchOCSMQARAButton({
+ recordId: this.recordId
+ }).then(result =>{
+ this.showToast("鎴愬姛","success");
+ this.updateRecordView(this.recordId);
+ this.IsLoading = false;
+ this.dispatchEvent(new CloseActionScreenEvent());
+ });
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.js-meta.xml b/force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.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/lexInsPageBtn/__tests__/lexInsPageBtn.test.js b/force-app/main/default/lwc/lexInsPageBtn/__tests__/lexInsPageBtn.test.js
new file mode 100644
index 0000000..bb52449
--- /dev/null
+++ b/force-app/main/default/lwc/lexInsPageBtn/__tests__/lexInsPageBtn.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexInsPageBtn from 'c/lexInsPageBtn';
+
+describe('c-lex-ins-page-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-ins-page-btn', {
+ is: LexInsPageBtn
+ });
+
+ // 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/lexInsPageBtn/lexInsPageBtn.html b/force-app/main/default/lwc/lexInsPageBtn/lexInsPageBtn.html
new file mode 100644
index 0000000..d044dbb
--- /dev/null
+++ b/force-app/main/default/lwc/lexInsPageBtn/lexInsPageBtn.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="exampleHolder" 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/lexInsPageBtn/lexInsPageBtn.js b/force-app/main/default/lwc/lexInsPageBtn/lexInsPageBtn.js
new file mode 100644
index 0000000..e0c1dbd
--- /dev/null
+++ b/force-app/main/default/lwc/lexInsPageBtn/lexInsPageBtn.js
@@ -0,0 +1,62 @@
+import {
+ LightningElement,
+ wire,
+ api
+} from 'lwc';
+import {
+ CurrentPageReference
+} from "lightning/navigation";
+import {
+ CloseActionScreenEvent
+} from 'lightning/actions';
+import init from '@salesforce/apex/otherButtonSpotInspectionReportCtl.init';
+
+export default class LexInsPageBtn extends LightningElement {
+ @api recordId;
+ str;
+ IsLoading = true;
+ Id;
+ RecordTypeId;
+
+ @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 => {
+ console.log(result);
+ if (result != null) {
+ this.IsLoading = false;
+ this.Id = result.Id;
+ this.RecordTypeId = result.RecordTypeId;
+
+ this.insPageBtn();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }).catch(error => {
+ console.log(error);
+ }).finally(() => {
+
+ });
+ }
+
+ // 鎶ュ憡涔︽槑缁嗙紪杈�
+ insPageBtn() {
+ var url;
+ if (this.RecordTypeId == '01210000000aLii') {
+ url = '/apex/OFSInsReportLayoutForVm';
+ } else {
+ url = '/apex/OFSInsReportLayout';
+ }
+ window.open(url += '?id=' + this.Id)
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexInsPageBtn/lexInsPageBtn.js-meta.xml b/force-app/main/default/lwc/lexInsPageBtn/lexInsPageBtn.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexInsPageBtn/lexInsPageBtn.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/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..3916190
--- /dev/null
+++ b/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js
@@ -0,0 +1,102 @@
+import { LightningElement, track, wire, api } from 'lwc';
+import { CurrentPageReference,NavigationMixin } from 'lightning/navigation';
+import { CloseActionScreenEvent } from 'lightning/actions';
+
+import init from '@salesforce/apex/loanerArrangedEmailController.init';
+import getRentalApplyEquipmentSet from '@salesforce/apex/loanerArrangedEmailController.getRentalApplyEquipmentSet';
+import approvalCheck from '@salesforce/apex/RentalApplyWebService.approvalCheck';
+import setShipment_request from '@salesforce/apex/RentalApplyWebService.approvalCheck';
+export default class lexLoanerArrangedEmail 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 => {
+ console.log(this.recordId);
+ console.log('result==='+JSON.stringify(result));
+ if(result != null) {
+ if( result.WeiAssignedCnt > 0 ) {
+ alert("鐢宠鍗曞唴瀛樺湪鏈垎閰嶇殑閰嶅锛岃鍒嗛厤澶囧搧鎴栧垎鍓茬敵璇峰崟");
+ }else if(result.CampaignStatus == "鍙栨秷") {
+ alert("瀛︿細鍙栨秷锛屼笉鍙嚭搴撴寚绀�");
+ }else if (result.RaStatus == "宸插嚭搴撴寚绀�" && result.AssignedNotShipment == 0){
+ alert("鎵�鏈夌殑鍊熷嚭澶囧搧Set涓�瑙堥兘杩涜杩囧嚭搴撴寚绀轰簡");
+ }else if (result.AssignedNotShipment == 0) {
+ alert("娌℃湁鍙互鍑哄簱鎸囩ず鐨勬槑缁�");
+ }else if (result.DemoPurpose1 == "闀挎湡鍊熷嚭" && result.ContractPdfUpdated == 0){
+ alert("闀挎湡鍊熷嚭鏃讹紝蹇呴』鍏堜笂浼犲绾︿功");
+ }else if (result.RepairId != '' && (result.RepairFinalInspectionDateF != null && result.RepairFinalInspectionDateF != '') || (result.RCReturnToOffice != null && result.RCReturnToOffice != '')){
+ alert("淇悊鏈夋渶缁堟娴嬫棩鎴栦慨鐞嗗搧杩旈�佹棩锛屼笉鍙嚭搴撴寚绀�");
+ }else if (result.IFApproved == "true" && (result.MeetingApprovedNo == null || result.MeetingApprovedNo == "")){
+ alert("娌℃湁鍐宠鍙风殑锛屾殏涓嶈兘鍑哄��,璇锋洿鏂拌鍐充俊鎭��");
+ }else if (result.IFApproved == "true" && result.MeetingApprovedNo != "" && result.StatusList.indexOf(records[0].Approved_Status__c) != -1){
+ alert("宸茬敵璇峰喅瑁佷絾鍐宠鐘舵�佷笉绗﹀悎鏉′欢銆�");
+ }else {
+ approvalCheck({
+ rentalApplyId: this.recordId
+ }).then(res=>{
+ if (res != '1') {
+ alert(rs1);
+ } else {
+ //bp2 var rs2 = sforce.apex.execute("RentalApplyWebService", "reserve", {rentalApplyId: raid});
+ //bp2 if (rs2 != '1') {
+ //bp2 alert(rs2);
+ //bp2 } else {
+ //var rs1 = sforce.apex.execute("RentalApplyWebService", "setShipment_request", {raid : "{!Rental_Apply__c.Id}"});
+
+ setShipment_request({
+ raid: this.recordId
+ }).then(res=>{
+ if (res == "鐘舵�佹洿鏂板埌宸插嚭搴撴寚绀�") {
+ alert("鐘舵�佹洿鏂板埌宸插嚭搴撴寚绀�");
+ print();
+ setTimeout(function() {
+ location.href = "/{!Rental_Apply__c.Id}";
+ },100);
+ }else {
+ alert(res);
+ }
+ }).catch(e=>{
+ console.log('approvalCheck==='+e);
+ })
+ }
+ }).catch(e=>{
+ console.log('setShipment_request==='+e);
+ })
+ }
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ })
+ }
+
+ print() {
+ getRentalApplyEquipmentSet({
+ recordId: this.recordId
+ }).then(result => {
+ window.open("https://ocsm--partial.sandbox.lightning.force.com/apex/FixtureRentalPDF?raid=" + this.recordId + "&page=" + result);
+ })
+ }
+
+ fixDate(date){
+ var Month = fixTime(date.getMonth() + 1);
+ var Day = fixTime(date.getDate());
+ var UTC = date.toUTCString();
+ var Time = UTC.substring(UTC.indexOf(':')-2, UTC.indexOf(':')+6);
+ var Minutes = fixTime(date.getMinutes());
+ var Seconds = fixTime(date.getSeconds());
+ return date.getFullYear() + "-" + Month + "-" + Day + "T" + Time;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js-meta.xml b/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js-meta.xml
new file mode 100644
index 0000000..e261be9
--- /dev/null
+++ b/force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.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/lexMailMessege/__tests__/lexMailMessege.test.js b/force-app/main/default/lwc/lexMailMessege/__tests__/lexMailMessege.test.js
new file mode 100644
index 0000000..a01145a
--- /dev/null
+++ b/force-app/main/default/lwc/lexMailMessege/__tests__/lexMailMessege.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexMailMessege from 'c/lexMailMessege';
+
+describe('c-lex-mail-messege', () => {
+ 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-mail-messege', {
+ is: LexMailMessege
+ });
+
+ // 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/lexMailMessege/lexMailMessege.html b/force-app/main/default/lwc/lexMailMessege/lexMailMessege.html
new file mode 100644
index 0000000..d044dbb
--- /dev/null
+++ b/force-app/main/default/lwc/lexMailMessege/lexMailMessege.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="exampleHolder" 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/lexMailMessege/lexMailMessege.js b/force-app/main/default/lwc/lexMailMessege/lexMailMessege.js
new file mode 100644
index 0000000..cf78f1a
--- /dev/null
+++ b/force-app/main/default/lwc/lexMailMessege/lexMailMessege.js
@@ -0,0 +1,89 @@
+import {
+ LightningElement,
+ wire,
+ api
+} from 'lwc';
+import {
+ CurrentPageReference
+} from "lightning/navigation";
+import {
+ CloseActionScreenEvent
+} from 'lightning/actions';
+import init from '@salesforce/apex/otherButtonRepairController.init';
+export default class LexMailMessege extends LightningElement {
+ @api recordId;
+ str;
+ IsLoading = true;
+ Id;;
+ InchargeStaffEmailC;
+ Name;
+ HPNameC;
+ DeliveredProductC;
+ RepairProductSerialNoC;
+ ServiceRepairNoC;
+ RepairFirstestimatedDateC;
+ RepairEstimatedDateC;
+ RCInformationC;
+ userEmail;
+
+ @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);
+ if (result != null) {
+ this.IsLoading = false;
+ this.Id = result.Id;
+ this.InchargeStaffEmailC = result.InchargeStaffEmailC;
+ this.Name = result.Name;
+ this.HPNameC = result.HPNameC;
+ this.DeliveredProductC = result.DeliveredProductC;
+ this.RepairProductSerialNoC = result.RepairProductSerialNoC;
+ this.ServiceRepairNoC = result.ServiceRepairNoC;
+ this.RepairFirstestimatedDateC = result.RepairFirstestimatedDateC;
+ this.RepairEstimatedDateC = result.RepairEstimatedDateC;
+ this.RCInformationC = result.RCInformationC;
+ this.userEmail = result.userEmail;
+
+ this.mailMessege();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }).catch(error => {
+ console.log(error);
+ }).finally(() => {
+
+ });
+ }
+
+ // 鎶ヤ环闄勪欢鏇存柊鐨勯偖浠堕�氱煡
+ mailMessege() {
+ var Link = "https://ocsm--partial.sandbox.my.salesforce.com/" + this.Id;
+ console.log(Link);
+
+ location.href = 'mailto:' + this.InchargeStaffEmailC +
+ '?bcc=' + this.userEmail +
+ '&subject=銆愭姤浠烽檮浠舵洿鏂伴�氱煡:' + this.Name + '銆�' + this.HPNameC + this.DeliveredProductC + this.RepairProductSerialNoC + this.ServiceRepairNoC +
+ '&body=鍏堢敓/濂冲+%0D%0A' +
+ '%0D%0A' +
+ '鍏充簬涓婚鐨勪慨鐞嗭紝淇悊鎶ヤ环鐨勯檮浠舵洿鏂板ソ浜�%0D%0A' +
+ '璇风‘璁ゅ苟璺熻繘涓�涓�%0D%0A' +
+ '%0D%0A' +
+ '鍒濇鎶ヤ环鏃ワ細' + this.RepairFirstestimatedDateC + '%0D%0A' +
+ '姝ゆ鎶ヤ环鏃ワ細' + this.RepairEstimatedDateC + '%0D%0A' +
+ '%0D%0A' +
+ 'RC鑱旂粶浜嬮」锛�' + this.RCInformationC + '%0D%0A' +
+ '%0D%0A' + Link + '';
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexMailMessege/lexMailMessege.js-meta.xml b/force-app/main/default/lwc/lexMailMessege/lexMailMessege.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexMailMessege/lexMailMessege.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/lexOCMSubmit/lexOCMSubmit.css b/force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.css
new file mode 100644
index 0000000..635bc6c
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.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/lexOCMSubmit/lexOCMSubmit.html b/force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.html
new file mode 100644
index 0000000..49a10f7
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.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/lexOCMSubmit/lexOCMSubmit.js b/force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.js
new file mode 100644
index 0000000..814dd7b
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.js
@@ -0,0 +1,133 @@
+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.initForOCMSubmitButton';
+import updateQis from '@salesforce/apex/QISReportController.updateQisWithOCM';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { updateRecord } from 'lightning/uiRecordApi';
+
+export default class lexOCMSubmit extends LightningElement {
+ @api recordId;
+ IsLoading = true;
+ qisReportId;
+ QISInstallDate;
+ qisStatus;
+ contractnumber;
+ isaohuiproduct;
+ 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.QISInstallDate = result.qISInstallDate;
+ this.contractnumber = result.contractnumber;
+ this.isaohuiproduct = result.isaohuiproduct;
+ if (this.qisStatus!='鑽夋涓�' && this.qisStatus!='鍙栨秷') {
+ const evt = new ShowToastEvent({
+ title : '宸茬粡鎻愪氦',
+ message: '',
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }else{
+ if (this.qisStatus == '鍙栨秷') {
+ const evt = new ShowToastEvent({
+ title : '鍙栨秷鍚庣殑QIS涓嶅厑璁稿啀鎻愪氦锛屽鏋滈渶瑕佹彁浜よ鐐瑰嚮\"澶嶅埗\"鎸夐挳閲嶆柊鐢熸垚涓�涓猀IS',
+ message: '',
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ }
+
+ if (this.QISInstallDate == null) {
+ const evt = new ShowToastEvent({
+ title : '銆愯喘涔版棩鏈�/瀹夎鏃ユ湡銆戜负绌烘椂涓嶈兘鎻愪氦鐢宠',
+ message: '',
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+
+ if (this.contractnumber == null) {
+ const evt = new ShowToastEvent({
+ title : '銆愰攢鍞悎鍚屼笂璁㈠崟鍙风爜銆戜负绌烘椂涓嶈兘鎻愪氦鐢宠',
+ message: '',
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+
+ if (!confirm("涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵")) {
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ this.updateQisSubmit();
+ if (this.isaohuiproduct == 'true') {
+ this.dispatchEvent(new CloseActionScreenEvent());
+ this.updateRecordView(this.recordId);
+ }
+ this.dispatchEvent(new CloseActionScreenEvent());
+ this.updateRecordView(this.recordId);
+ }).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());
+ }).catch(error => {
+ console.log('error='+error);
+ }).finally(() => {
+
+ });
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.js-meta.xml b/force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.js-meta.xml
new file mode 100644
index 0000000..74849f3
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.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.html b/force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.html
new file mode 100644
index 0000000..38c9114
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.html
@@ -0,0 +1,6 @@
+<template>
+ <div class="reportHolder" 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/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.js b/force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.js
new file mode 100644
index 0000000..6b44bc5
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.js
@@ -0,0 +1,96 @@
+/*
+ * @Description:
+ * @version:
+ * @Author: chen jing wu
+ * @Date: 2023-03-28 15:59:44
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-11 09:08:30
+ */
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init from '@salesforce/apex/ReportController.initForOCSMNoToReportButton';
+import updateForOCSMNoToReportButton from '@salesforce/apex/ReportController.updateForOCSMNoToReportButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class LexOCSMNoToReportForReport extends LightningElement {
+ @api recordId;
+ IsLoading = true;
+ OCSMAdministrativeReportNumber;
+ OCSMAdministrativeReportDate;
+ AwareDate;
+
+ @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(){
+ 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);
+ });
+ }
+
+
+ updateRecordView(recordId) {
+ updateRecord({fields: { Id: recordId }});
+ }
+
+ showToast(msg,type) {
+ const event = new ShowToastEvent({
+ title: '',
+ message: msg,
+ variant: type
+ });
+ this.dispatchEvent(event);
+ }
+
+ noToReport(){
+ if (!confirm("涓嶈鎶ュ憡鍚庢棤娉曟挙鍥烇紝鏄惁缁х画锛�")) {
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ if(this.OCSMAdministrativeReportNumber != undefined || this.OCSMAdministrativeReportDate != undefined ){
+ this.showToast("宸茬粡鎶ュ憡鐨凲IS锛屼笉鍙互鐐瑰嚮OCSM涓嶈鎶ュ憡銆�","error");
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ if(this.AwareDate != undefined ){
+ updateForOCSMNoToReportButton({
+ recordId: this.recordId
+ }).then(result=>{
+ this.showToast("OCSM涓嶈鎶ュ憡鎴愬姛","success");
+ this.updateRecordView(this.recordId);
+ this.IsLoading = false;
+ this.dispatchEvent(new CloseActionScreenEvent());
+ });
+ }else{
+ this.showToast("娌℃湁AwareDate鎴栧凡缁廜CSM琛屾斂鎶ュ憡锛岃纭銆�","error");
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.js-meta.xml b/force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.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/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/lexOCSMNoToReportRepair/__tests__/lexOCSMNoToReportRepair.test.js b/force-app/main/default/lwc/lexOCSMNoToReportRepair/__tests__/lexOCSMNoToReportRepair.test.js
new file mode 100644
index 0000000..511b2f0
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMNoToReportRepair/__tests__/lexOCSMNoToReportRepair.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexOCSMNoToReportRepair from 'c/lexOCSMNoToReportRepair';
+
+describe('c-lex-ocsm-no-to-report-repair', () => {
+ 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-ocsm-no-to-report-repair', {
+ is: LexOCSMNoToReportRepair
+ });
+
+ // 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/lexOCSMNoToReportRepair/lexOCSMNoToReportRepair.html b/force-app/main/default/lwc/lexOCSMNoToReportRepair/lexOCSMNoToReportRepair.html
new file mode 100644
index 0000000..87f391a
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMNoToReportRepair/lexOCSMNoToReportRepair.html
@@ -0,0 +1,6 @@
+<template>
+ <div class="exampleHolder" 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/lexOCSMNoToReportRepair/lexOCSMNoToReportRepair.js b/force-app/main/default/lwc/lexOCSMNoToReportRepair/lexOCSMNoToReportRepair.js
new file mode 100644
index 0000000..44ef2be
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMNoToReportRepair/lexOCSMNoToReportRepair.js
@@ -0,0 +1,102 @@
+import {
+ LightningElement,
+ wire,
+ api
+} from 'lwc';
+import {
+ CurrentPageReference
+} from "lightning/navigation";
+import {
+ CloseActionScreenEvent
+} from 'lightning/actions';
+import init from '@salesforce/apex/otherButtonRepairController.init';
+import updateRepair from '@salesforce/apex/otherButtonRepairController.updateRepair';
+import {
+ ShowToastEvent
+} from 'lightning/platformShowToastEvent';
+
+export default class LexOCSMNoToReportRepair extends LightningElement {
+ @api recordId;
+ str;
+ IsLoading = true;
+ Id;;
+ OCSMAdministrativeReportNumberC;
+ OCSMAdministrativeReportDateC;
+ AwareDateC;
+
+ @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);
+ if (result != null) {
+ this.IsLoading = false;
+ this.Id = result.Id;
+ this.OCSMAdministrativeReportNumberC = result.OCSMAdministrativeReportNumberC;
+ this.OCSMAdministrativeReportDateC = result.OCSMAdministrativeReportDateC;
+ this.AwareDateC = result.AwareDateC;
+
+ this.OCSMNoToReport();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }).catch(error => {
+ console.log(error);
+ }).finally(() => {
+
+ });
+ }
+
+ // OCSM涓嶈鎶ュ憡
+ OCSMNoToReport() {
+ if (!confirm("涓嶈鎶ュ憡鍚庢棤娉曟挙鍥烇紝鏄惁缁х画锛�")) {
+ return;
+ }
+
+ if (this.OCSMAdministrativeReportNumberC != undefined ||
+ this.OCSMAdministrativeReportDateC != undefined) {
+ this.ShowToastEvent("宸茬粡鎶ュ憡鐨凲IS锛屼笉鍙互鐐瑰嚮OCSM涓嶈鎶ュ憡銆�", "error")
+ // alert("宸茬粡鎶ュ憡鐨凲IS锛屼笉鍙互鐐瑰嚮OCSM涓嶈鎶ュ憡銆�");
+ return;
+ }
+
+ if (this.AwareDateC != undefined) {
+ updateRepair({
+ recordId: this.Id
+ }).catch(error => {
+ if (error.body.pageErrors.length > 0) {
+ var errmsg = error.body.pageErrors[0].message.toString();
+ this.ShowToastEvent(errmsg.join("\n"), "error")
+ // alert(errmsg.join("\n"));
+ return;
+ }
+ })
+ window.location.reload();
+ } else {
+ this.ShowToastEvent("娌℃湁AwareDate鎴栧凡缁廜CSM琛屾斂鎶ュ憡锛岃纭銆�", "error")
+ // alert("娌℃湁AwareDate鎴栧凡缁廜CSM琛屾斂鎶ュ憡锛岃纭銆�");
+ return;
+ }
+ }
+
+ // 寮圭獥
+ ShowToastEvent(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/lexOCSMNoToReportRepair/lexOCSMNoToReportRepair.js-meta.xml b/force-app/main/default/lwc/lexOCSMNoToReportRepair/lexOCSMNoToReportRepair.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMNoToReportRepair/lexOCSMNoToReportRepair.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/lexOCSMToReport/lexOCSMToReport.css b/force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.css
new file mode 100644
index 0000000..ecc934d
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.css
@@ -0,0 +1,10 @@
+.toReportHolder{
+ 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/lexOCSMToReport/lexOCSMToReport.html b/force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.html
new file mode 100644
index 0000000..aaa4cbd
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.html
@@ -0,0 +1,6 @@
+<template>
+ <div class="toReportHolder" 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/lexOCSMToReport/lexOCSMToReport.js b/force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.js
new file mode 100644
index 0000000..fab2fbb
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.js
@@ -0,0 +1,95 @@
+/*
+ * @Description:
+ * @version:
+ * @Author: chen jing wu
+ * @Date: 2023-04-07 09:02:03
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-11 09:09:14
+ */
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init from '@salesforce/apex/ReportController.initForOCSMToReportButton';
+import updateForOCSMToReportButton from '@salesforce/apex/ReportController.updateForOCSMToReportButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class LexOCSMToReport extends LightningElement {
+ @api recordId;
+ IsLoading = true;
+ OCSMAdministrativeReportStatus;
+ awareDate;
+
+
+ @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(){
+ console.log(this.recordId);
+ init({
+ recordId: this.recordId
+ }).then(result => {
+ console.log(result);
+ if (result != null) {
+ this.OCSMAdministrativeReportStatus = result.OCSMAdministrativeReportStatus;
+ this.awareDate = result.awareDate;
+ this.toReport();
+ }
+ }).catch(error => {
+ console.log("error");
+ console.log(error);
+ }).finally(() => {
+
+ });
+
+ }
+
+
+ showToast(msg,type) {
+ const event = new ShowToastEvent({
+ title: '',
+ message: msg,
+ variant: type
+ });
+ this.dispatchEvent(event);
+ }
+
+
+ updateRecordView(recordId) {
+ updateRecord({fields: { Id: recordId }});
+ }
+
+ toReport () {
+ if (!confirm("鎶ュ憡鍚庢棤娉曟挙鍥烇紝鏄惁缁х画锛�")) {
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+
+ if(this.OCSMAdministrativeReportStatus == undefined && this.awareDate != undefined ){
+ updateForOCSMToReportButton({
+ recordId: this.recordId
+ }).then(result =>{
+ this.showToast("鎴愬姛","success");
+ this.updateRecordView(this.recordId);
+ this.IsLoading = false;
+ this.dispatchEvent(new CloseActionScreenEvent());
+ });
+ }else{
+ this.showToast("娌℃湁AwareDate鎴栧凡缁廜CSM琛屾斂鎶ュ憡锛岃纭銆�","error");
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.js-meta.xml b/force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.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/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/lexOCSMToReportRepair/__tests__/lexOCSMToReportRepair.test.js b/force-app/main/default/lwc/lexOCSMToReportRepair/__tests__/lexOCSMToReportRepair.test.js
new file mode 100644
index 0000000..96ed586
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMToReportRepair/__tests__/lexOCSMToReportRepair.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexOCSMToReportRepair from 'c/lexOCSMToReportRepair';
+
+describe('c-lex-ocsm-to-report-repair', () => {
+ 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-ocsm-to-report-repair', {
+ is: LexOCSMToReportRepair
+ });
+
+ // 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/lexOCSMToReportRepair/lexOCSMToReportRepair.html b/force-app/main/default/lwc/lexOCSMToReportRepair/lexOCSMToReportRepair.html
new file mode 100644
index 0000000..87f391a
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMToReportRepair/lexOCSMToReportRepair.html
@@ -0,0 +1,6 @@
+<template>
+ <div class="exampleHolder" 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/lexOCSMToReportRepair/lexOCSMToReportRepair.js b/force-app/main/default/lwc/lexOCSMToReportRepair/lexOCSMToReportRepair.js
new file mode 100644
index 0000000..40ebdc3
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMToReportRepair/lexOCSMToReportRepair.js
@@ -0,0 +1,92 @@
+import {
+ LightningElement,
+ wire,
+ api
+} from 'lwc';
+import {
+ CurrentPageReference
+} from "lightning/navigation";
+import {
+ CloseActionScreenEvent
+} from 'lightning/actions';
+import init from '@salesforce/apex/otherButtonRepairController.init';
+import updateRepair from '@salesforce/apex/otherButtonRepairController.updateRepair';
+import {
+ ShowToastEvent
+} from 'lightning/platformShowToastEvent';
+
+
+export default class LexOCSMToReportRepair extends LightningElement {
+ @api recordId;
+ str;
+ IsLoading = true;
+ Id;
+ AwareDateC;
+ OCSMAdministrativeReportStatusC;
+
+ @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);
+ if (result != null) {
+ this.IsLoading = false;
+ this.Id = result.Id;
+ this.AwareDateC = result.AwareDateC;
+ this.OCSMAdministrativeReportStatusC = result.OCSMAdministrativeReportStatusC;
+
+ this.OCSMToReport();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }).catch(error => {
+ console.log(error);
+ }).finally(() => {
+
+ });
+ }
+
+ // OCSM瑕佹姤鍛�
+ OCSMToReport() {
+ if (!confirm("鎶ュ憡鍚庢棤娉曟挙鍥烇紝鏄惁缁х画锛�")) {
+ return;
+ }
+ if (this.OCSMAdministrativeReportStatusC == undefined && this.AwareDateC != undefined) {
+ updateRepair({
+ recordId: this.Id
+ }).catch(error => {
+ if (error.body.pageErrors.length > 0) {
+ // alert(messages.join("\n"));
+ var errmsg = error.body.pageErrors[0].message.toString();
+ this.ShowToastEvent(errmsg.join("\n"), "error")
+ return;
+ }
+ })
+ window.location.reload();
+ } else {
+ this.ShowToastEvent("娌℃湁AwareDate鎴栧凡缁廜CSM琛屾斂鎶ュ憡锛岃纭銆�", "error")
+ return;
+ }
+ }
+
+ // 寮圭獥
+ ShowToastEvent(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/lexOCSMToReportRepair/lexOCSMToReportRepair.js-meta.xml b/force-app/main/default/lwc/lexOCSMToReportRepair/lexOCSMToReportRepair.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexOCSMToReportRepair/lexOCSMToReportRepair.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.css b/force-app/main/default/lwc/lexOPDtoSIS/lexOPDtoSIS.css
new file mode 100644
index 0000000..2a3dbc5
--- /dev/null
+++ b/force-app/main/default/lwc/lexOPDtoSIS/lexOPDtoSIS.css
@@ -0,0 +1,10 @@
+.opdToSISHolder{
+ 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/lexOPDtoSIS/lexOPDtoSIS.html b/force-app/main/default/lwc/lexOPDtoSIS/lexOPDtoSIS.html
new file mode 100644
index 0000000..de73f87
--- /dev/null
+++ b/force-app/main/default/lwc/lexOPDtoSIS/lexOPDtoSIS.html
@@ -0,0 +1,6 @@
+<template>
+ <div class="opdToSISHolder" 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/lexOPDtoSIS/lexOPDtoSIS.js b/force-app/main/default/lwc/lexOPDtoSIS/lexOPDtoSIS.js
new file mode 100644
index 0000000..ef83f36
--- /dev/null
+++ b/force-app/main/default/lwc/lexOPDtoSIS/lexOPDtoSIS.js
@@ -0,0 +1,93 @@
+/*
+ * @Description:
+ * @version:
+ * @Author: chen jing wu
+ * @Date: 2023-04-07 09:02:03
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-11 09:10:06
+ */
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import updateForOPDtoSISButton from '@salesforce/apex/ReportController.updateForOPDtoSISButton';
+import init from '@salesforce/apex/ReportController.initForOPDtoSISButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+export default class LexOPDtoSIS extends LightningElement {
+ @api recordId;
+ IsLoading = true;
+ ownerId;
+ status;
+ userId;
+
+ @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(){
+ console.log(this.recordId);
+ init({
+ recordId: this.recordId
+ }).then(result => {
+ console.log(result);
+ console.log("123");
+ if (result != null) {
+ this.ownerId = result.ownerId;
+ this.status = result.status;
+ this.userId = result.userId;
+ this.OPDtoSIS();
+ }
+ }).catch(error => {
+ console.log("error");
+ console.log(error);
+ }).finally(() => {
+
+ });
+
+ }
+
+ showToast(msg,type) {
+ const event = new ShowToastEvent({
+ title: '',
+ message: msg,
+ variant: type
+ });
+ this.dispatchEvent(event);
+ }
+
+ updateRecordView(recordId) {
+ updateRecord({fields: { Id: recordId }});
+ }
+
+ OPDtoSIS () {
+ if(this.ownerId == this.userId && this.status == "鑽夋涓�") {
+ updateForOPDtoSISButton({
+ recordId: this.recordId
+ }).then(result =>{
+ this.updateRecordView(this.recordId);
+ this.showToast("鎴愬姛锛�","success");
+ this.IsLoading = false;
+ this.dispatchEvent(new CloseActionScreenEvent());
+ });
+ } else {
+ this.showToast("鍙崏妗堜腑鐘舵�佸強OPD/SIS鎶ュ憡涔︾殑鎵�鏈変汉鍙互鎻愪氦","error");
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexOPDtoSIS/lexOPDtoSIS.js-meta.xml b/force-app/main/default/lwc/lexOPDtoSIS/lexOPDtoSIS.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexOPDtoSIS/lexOPDtoSIS.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/lexOSHSubmit/lexOSHSubmit.css b/force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.css
new file mode 100644
index 0000000..f708a55
--- /dev/null
+++ b/force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.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/lexOSHSubmit/lexOSHSubmit.html b/force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.html
new file mode 100644
index 0000000..cc6a015
--- /dev/null
+++ b/force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.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/lexOSHSubmit/lexOSHSubmit.js b/force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.js
new file mode 100644
index 0000000..0e82f06
--- /dev/null
+++ b/force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.js
@@ -0,0 +1,107 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { NavigationMixin } from 'lightning/navigation';
+import init from '@salesforce/apex/QISReportController.initForOSHSubmitButton';
+import updateQis from '@salesforce/apex/QISReportController.updateQis1';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { updateRecord } from 'lightning/uiRecordApi';
+export default class lexOSHSubmit extends LightningElement {
+ @api recordId;
+ IsLoading = true;
+ qisReportId;
+ qisStatus;
+ OSHstaff;
+ OSHstaffEmail;
+ 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.OSHstaff = result.oSHstaff;
+ this.OSHstaffEmail = result.oSHstaffEmail;
+ console.log('this.qisStatus='+this.qisStatus);
+ console.log('this.OSHstaff='+this.OSHstaff);
+ console.log('this.OSHstaffEmail='+this.OSHstaffEmail);
+ if (this.qisStatus=='OSH妫�娴嬬敵璇�' && this.qisStatus=='瀹屾瘯') {
+ alert('闇�瑕佸厛鐐瑰嚮锛籓SH妫�鏌ュ彈鐞嗭冀');
+ return;
+ }
+ if (this.qisStatus!='OSH妫�娴嬩腑') {
+ alert('宸茬粡鎻愪氦瀹℃壒');
+ return;
+ }
+ if (!confirm("涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵")) {
+ return;
+ }
+ if (this.OSHstaff==null||this.OSHstaffEmail==null) {
+ alert("OSH鎷呭綋蹇呴』濉啓");
+ return;
+ }
+ try{
+ this.updateQisSubmit();
+ }catch(err){
+ if(err.faultstring !=undefined && err.faultstring.indexOf('INVALID_SESSION_ID') != -1) {
+ alert('褰撳墠缃戦〉宸茬櫥鍑猴紝璇锋偍閲嶆柊鐧诲綍鍚庡埛鏂拌缃戦〉锛�');
+ } else {
+ alert(err.faultstring);
+ }
+ 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);
+ 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/lexOSHSubmit/lexOSHSubmit.js-meta.xml b/force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.js-meta.xml
new file mode 100644
index 0000000..a17e350
--- /dev/null
+++ b/force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexOSHSubmit">
+ <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/lexPDFMaintenanceCommission/__tests__/lexPDFMaintenanceCommission.test.js b/force-app/main/default/lwc/lexPDFMaintenanceCommission/__tests__/lexPDFMaintenanceCommission.test.js
new file mode 100644
index 0000000..7387e21
--- /dev/null
+++ b/force-app/main/default/lwc/lexPDFMaintenanceCommission/__tests__/lexPDFMaintenanceCommission.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexPDFMaintenanceCommission from 'c/lexPDFMaintenanceCommission';
+
+describe('c-lex-pdf-maintenance-commission', () => {
+ 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-pdf-maintenance-commission', {
+ is: LexPDFMaintenanceCommission
+ });
+
+ // 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/lexPDFMaintenanceCommission/lexPDFMaintenanceCommission.html b/force-app/main/default/lwc/lexPDFMaintenanceCommission/lexPDFMaintenanceCommission.html
new file mode 100644
index 0000000..d044dbb
--- /dev/null
+++ b/force-app/main/default/lwc/lexPDFMaintenanceCommission/lexPDFMaintenanceCommission.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="exampleHolder" 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/lexPDFMaintenanceCommission/lexPDFMaintenanceCommission.js b/force-app/main/default/lwc/lexPDFMaintenanceCommission/lexPDFMaintenanceCommission.js
new file mode 100644
index 0000000..3f5d7bb
--- /dev/null
+++ b/force-app/main/default/lwc/lexPDFMaintenanceCommission/lexPDFMaintenanceCommission.js
@@ -0,0 +1,54 @@
+import {
+ LightningElement,
+ wire,
+ api
+} from 'lwc';
+import {
+ CurrentPageReference
+} from "lightning/navigation";
+import {
+ CloseActionScreenEvent
+} from 'lightning/actions';
+import init from '@salesforce/apex/otherButtonRepairController.init';
+export default class LexPDFMaintenanceCommission extends LightningElement {
+ @api recordId;
+ str;
+ IsLoading = true;
+ Id;;
+
+ @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);
+ if (result != null) {
+ this.IsLoading = false;
+ this.Id = result.Id;
+
+ this.PDFMaintenanceCommission();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }).catch(error => {
+ console.log(error);
+ }).finally(() => {
+
+ });
+ }
+
+ // 鎵撳嵃缁翠慨濮旀墭涔�
+ PDFMaintenanceCommission() {
+ window.open('/apex/MaintenanceCommissionPDF?id=' + this.Id, 'MaintenanceCommissionPDF');
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexPDFMaintenanceCommission/lexPDFMaintenanceCommission.js-meta.xml b/force-app/main/default/lwc/lexPDFMaintenanceCommission/lexPDFMaintenanceCommission.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexPDFMaintenanceCommission/lexPDFMaintenanceCommission.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/lexPreContractSubmit/__tests__/lexPreContractSubmit.test.js b/force-app/main/default/lwc/lexPreContractSubmit/__tests__/lexPreContractSubmit.test.js
new file mode 100644
index 0000000..4fb8447
--- /dev/null
+++ b/force-app/main/default/lwc/lexPreContractSubmit/__tests__/lexPreContractSubmit.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexPreContractSubmit from 'c/lexPreContractSubmit';
+
+describe('c-lex-pre-contract-submit', () => {
+ 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-pre-contract-submit', {
+ is: LexPreContractSubmit
+ });
+
+ // 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/lexPreContractSubmit/lexPreContractSubmit.html b/force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.html
new file mode 100644
index 0000000..87f391a
--- /dev/null
+++ b/force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.html
@@ -0,0 +1,6 @@
+<template>
+ <div class="exampleHolder" 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/lexPreContractSubmit/lexPreContractSubmit.js b/force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.js
new file mode 100644
index 0000000..1340680
--- /dev/null
+++ b/force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.js
@@ -0,0 +1,116 @@
+import {
+ LightningElement,
+ wire,
+ api
+} from 'lwc';
+import {
+ CurrentPageReference
+} from "lightning/navigation";
+import {
+ CloseActionScreenEvent
+} from 'lightning/actions';
+import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init';
+import processResults from '@salesforce/apex/otherButtonMaintenanceContractCtl.processResults';
+import {
+ ShowToastEvent
+} from 'lightning/platformShowToastEvent';
+
+export default class LexPreContractSubmit extends LightningElement {
+ @api recordId;
+ str;
+ IsLoading = true;
+ oldIsRecognitionModelC;
+ uploadToRMTimeC;
+ IsRecognitionModelTrueC;
+ MCApprovalStatusC;
+ ContractprintCompletedC;
+ Id;
+
+ @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);
+ if (result != null) {
+ this.IsLoading = false;
+ this.oldIsRecognitionModelC = result.oldIsRecognitionModelC;
+ this.uploadToRMTimeC = result.uploadToRMTimeC;
+ this.IsRecognitionModelTrueC = result.IsRecognitionModelTrueC;
+ this.MCApprovalStatusC = result.MCApprovalStatusC;
+ this.ContractprintCompletedC = result.ContractprintCompletedC;
+ this.Id = result.Id;
+
+ this.preContractSubmit();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }).catch(error => {
+ console.log(error);
+ }).finally(() => {
+
+ });
+ }
+
+ // 鍚堝悓澶嶆牳
+ preContractSubmit() {
+ if (this.oldIsRecognitionModelC) {
+ if (this.uploadToRMTimeC == null) {
+ this.ShowToastEvent('褰撳墠缁翠慨鍚堝悓鐨勭粡閿�鍟嗘槸鍏堟瀵硅薄锛岄渶瑕佸厛銆愪笂浼犺娆惧悎鍚屻�戯紝鐒跺悗瀹屾垚璁ゆ浠ュ悗鎵嶈兘澶嶆牳銆�', "error")
+ // alert('褰撳墠缁翠慨鍚堝悓鐨勭粡閿�鍟嗘槸鍏堟瀵硅薄锛岄渶瑕佸厛銆愪笂浼犺娆惧悎鍚屻�戯紝鐒跺悗瀹屾垚璁ゆ浠ュ悗鎵嶈兘澶嶆牳銆�');
+ return;
+ } else {
+ if (!this.IsRecognitionModelTrueC) {
+ this.ShowToastEvent('褰撳墠缁翠慨鍚堝悓娌℃湁瀹屾垚璁ゆ锛屼笉鑳借繘琛屽鏍搞��', "error")
+ // alert('褰撳墠缁翠慨鍚堝悓娌℃湁瀹屾垚璁ゆ锛屼笉鑳借繘琛屽鏍搞��');
+ return;
+ }
+ }
+ }
+ var status = this.MCApprovalStatusC;
+ if (status != 'Draft' && status != 'Reject' && status != undefined) {
+ this.ShowToastEvent('澶嶆牳宸茬粡鎻愪氦锛岃纭鐘舵�併��', "success")
+ // alert('澶嶆牳宸茬粡鎻愪氦锛岃纭鐘舵�併��');
+ return;
+ }
+ var con_no = this.ContractprintCompletedC;
+ if (con_no == '') {
+ this.ShowToastEvent('鍚堝悓鐩栫珷瀹屾瘯涓虹┖锛屼笉鑳芥彁浜ゅ悎鍚屽鏍哥敵璇枫��', "error")
+ // alert('鍚堝悓鐩栫珷瀹屾瘯涓虹┖锛屼笉鑳芥彁浜ゅ悎鍚屽鏍哥敵璇枫��');
+ return;
+ }
+ if (!confirm("涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵")) {
+ return;
+ }
+ processResults({
+ recordId: this.recordId
+ }).catch(error => {
+ if (error.body.pageErrors[0] != null) {
+ var errmsg = error.body.pageErrors[0].message.toString();
+ // alert(errmsg + '_sys');
+ this.ShowToastEvent(errmsg + '_sys', "error")
+ return;
+ }
+ })
+ }
+
+ // 寮圭獥
+ ShowToastEvent(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/lexPreContractSubmit/lexPreContractSubmit.js-meta.xml b/force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.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/lexProductRepairQuoteRepair/__tests__/lexProductRepairQuoteRepair.test.js b/force-app/main/default/lwc/lexProductRepairQuoteRepair/__tests__/lexProductRepairQuoteRepair.test.js
new file mode 100644
index 0000000..013ddd6
--- /dev/null
+++ b/force-app/main/default/lwc/lexProductRepairQuoteRepair/__tests__/lexProductRepairQuoteRepair.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexProductRepairQuoteRepair from 'c/lexProductRepairQuoteRepair';
+
+describe('c-lex-product-repair-quote-repair', () => {
+ 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-product-repair-quote-repair', {
+ is: LexProductRepairQuoteRepair
+ });
+
+ // 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/lexProductRepairQuoteRepair/lexProductRepairQuoteRepair.html b/force-app/main/default/lwc/lexProductRepairQuoteRepair/lexProductRepairQuoteRepair.html
new file mode 100644
index 0000000..d044dbb
--- /dev/null
+++ b/force-app/main/default/lwc/lexProductRepairQuoteRepair/lexProductRepairQuoteRepair.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="exampleHolder" 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/lexProductRepairQuoteRepair/lexProductRepairQuoteRepair.js b/force-app/main/default/lwc/lexProductRepairQuoteRepair/lexProductRepairQuoteRepair.js
new file mode 100644
index 0000000..ef8176d
--- /dev/null
+++ b/force-app/main/default/lwc/lexProductRepairQuoteRepair/lexProductRepairQuoteRepair.js
@@ -0,0 +1,67 @@
+import {
+ LightningElement,
+ wire,
+ api
+} from 'lwc';
+import {
+ CurrentPageReference
+} from "lightning/navigation";
+import {
+ CloseActionScreenEvent
+} from 'lightning/actions';
+
+import init from '@salesforce/apex/otherButtonRepairController.init';
+import selectAssetID from '@salesforce/apex/otherButtonRepairController.selectAssetID';
+
+export default class LexProductRepairQuoteRepair extends LightningElement {
+ @api recordId;
+ str;
+ IsLoading = true;
+ Id;
+ RecordTypeId;
+ AssetOwnerC;
+ DeliveredProductC;
+
+ @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 => {
+ console.log(result);
+ if (result != null) {
+ this.IsLoading = false;
+ this.Id = result.Id;
+ this.RecordTypeId = result.RecordTypeId;
+
+ this.ProductRepairQuoteRepair();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }).catch(error => {
+ console.log(error);
+ }).finally(() => {
+
+ });
+ }
+
+ // 淇悊鎶ヤ环棰勪及
+ ProductRepairQuoteRepair() {
+ selectAssetID({
+ recordId: this.Id
+ }).then(result => {
+ this.DeliveredProductC = result;
+ window.open('/apex/ProductRepairQuote?productid=' + this.DeliveredProductC + '&flag=asset', '', 'height=250, width=500, top=300, left=350,location=no')
+ }).catch(error => {
+ console.log(error);
+ })
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexProductRepairQuoteRepair/lexProductRepairQuoteRepair.js-meta.xml b/force-app/main/default/lwc/lexProductRepairQuoteRepair/lexProductRepairQuoteRepair.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexProductRepairQuoteRepair/lexProductRepairQuoteRepair.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/lexQISAgree/lexQISAgree.css b/force-app/main/default/lwc/lexQISAgree/lexQISAgree.css
new file mode 100644
index 0000000..9acb129
--- /dev/null
+++ b/force-app/main/default/lwc/lexQISAgree/lexQISAgree.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/lexQISAgree/lexQISAgree.html b/force-app/main/default/lwc/lexQISAgree/lexQISAgree.html
new file mode 100644
index 0000000..c8bdbfc
--- /dev/null
+++ b/force-app/main/default/lwc/lexQISAgree/lexQISAgree.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/lexQISAgree/lexQISAgree.js b/force-app/main/default/lwc/lexQISAgree/lexQISAgree.js
new file mode 100644
index 0000000..5725e34
--- /dev/null
+++ b/force-app/main/default/lwc/lexQISAgree/lexQISAgree.js
@@ -0,0 +1,85 @@
+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.initForQisAgreeButton';
+import updateQis from '@salesforce/apex/QISReportController.updateQisForQisAgree';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { updateRecord } from 'lightning/uiRecordApi';
+
+export default class lexQISAgree extends LightningElement {
+ @api recordId;
+ IsLoading = true;
+ qisReportId;
+ OwnerId;
+ 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.OwnerId = result.ownerId;
+ if (this.OwnerId != UserInfo_Owner.Id) {
+ const evt = new ShowToastEvent({
+ title : '鍙湁鎵�鏈夎�呭彲浠ユ寜QIS缁撴灉璺熻繘瀹屾瘯鐨勬寜閽�',
+ message: '',
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }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/lexQISAgree/lexQISAgree.js-meta.xml b/force-app/main/default/lwc/lexQISAgree/lexQISAgree.js-meta.xml
new file mode 100644
index 0000000..7a4ca36
--- /dev/null
+++ b/force-app/main/default/lwc/lexQISAgree/lexQISAgree.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexQISAgree">
+ <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/lexQISIntakeuniversalcode/lexQISIntakeuniversalcode.css b/force-app/main/default/lwc/lexQISIntakeuniversalcode/lexQISIntakeuniversalcode.css
new file mode 100644
index 0000000..79456f2
--- /dev/null
+++ b/force-app/main/default/lwc/lexQISIntakeuniversalcode/lexQISIntakeuniversalcode.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/lexQISIntakeuniversalcode/lexQISIntakeuniversalcode.html b/force-app/main/default/lwc/lexQISIntakeuniversalcode/lexQISIntakeuniversalcode.html
new file mode 100644
index 0000000..c8bdbfc
--- /dev/null
+++ b/force-app/main/default/lwc/lexQISIntakeuniversalcode/lexQISIntakeuniversalcode.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/lexQISIntakeuniversalcode/lexQISIntakeuniversalcode.js b/force-app/main/default/lwc/lexQISIntakeuniversalcode/lexQISIntakeuniversalcode.js
new file mode 100644
index 0000000..94c87ab
--- /dev/null
+++ b/force-app/main/default/lwc/lexQISIntakeuniversalcode/lexQISIntakeuniversalcode.js
@@ -0,0 +1,64 @@
+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.initForlexQISIntakeuniversalcodeButton';
+import sqlForPAE from '@salesforce/apex/QISReportController.sqlForPAE1';
+
+export default class lexQISIntakeuniversalcode extends LightningElement {
+ @api recordId;
+ IsLoading = true;
+ qisReportId;
+ paeId;
+
+ @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);
+ if (result != null) {
+ this.IsLoading = false;
+ this.qisReportId = result.Id;
+ var RecordTypeId = "ASRCDecision";
+ sqlForPAE({
+ qisReportId: this.qisReportId
+ }).then(result => {
+ if (result!=null) {
+ this.paeId = result.PAEid;
+ console.log('result='+this.paeId);
+ }
+ var url = '';
+ if (result!=null&&result.length>0){
+ url = "/apex/PAEDecisionRecord?Id="+this.paeId+"&QISReportId="+this.qisReportId +"&RecordTypeIds="+RecordTypeId ;
+ } else {
+ url = "/apex/PAEDecisionRecord?QISReportId="+this.qisReportId +"&RecordTypeIds="+RecordTypeId;
+ }
+ console.log('url='+url);
+ window.location.replace(url);
+ });
+ }
+ }).catch(error => {
+ console.log('error='+error);
+ }).finally(() => {
+
+ });
+ }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQISIntakeuniversalcode/lexQISIntakeuniversalcode.js-meta.xml b/force-app/main/default/lwc/lexQISIntakeuniversalcode/lexQISIntakeuniversalcode.js-meta.xml
new file mode 100644
index 0000000..2ed1142
--- /dev/null
+++ b/force-app/main/default/lwc/lexQISIntakeuniversalcode/lexQISIntakeuniversalcode.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexQISIntakeuniversalcode">
+ <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/lexQuarterlyReport/__tests__/lexQuarterlyReport.test.js b/force-app/main/default/lwc/lexQuarterlyReport/__tests__/lexQuarterlyReport.test.js
new file mode 100644
index 0000000..95b6a0e
--- /dev/null
+++ b/force-app/main/default/lwc/lexQuarterlyReport/__tests__/lexQuarterlyReport.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexQuarterlyReport from 'c/lexQuarterlyReport';
+
+describe('c-lex-quarterly-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-quarterly-report', {
+ is: LexQuarterlyReport
+ });
+
+ // 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/lexQuarterlyReport/lexQuarterlyReport.html b/force-app/main/default/lwc/lexQuarterlyReport/lexQuarterlyReport.html
new file mode 100644
index 0000000..d044dbb
--- /dev/null
+++ b/force-app/main/default/lwc/lexQuarterlyReport/lexQuarterlyReport.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="exampleHolder" 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/lexQuarterlyReport/lexQuarterlyReport.js b/force-app/main/default/lwc/lexQuarterlyReport/lexQuarterlyReport.js
new file mode 100644
index 0000000..fc1f1e2
--- /dev/null
+++ b/force-app/main/default/lwc/lexQuarterlyReport/lexQuarterlyReport.js
@@ -0,0 +1,69 @@
+import {
+ LightningElement,
+ wire,
+ api
+} from 'lwc';
+import {
+ CurrentPageReference
+} from "lightning/navigation";
+import {
+ CloseActionScreenEvent
+} from 'lightning/actions';
+import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init';
+
+export default class LexQuarterlyReport extends LightningElement {
+ @api recordId;
+ str;
+ IsLoading = true;
+ Id;
+ RecordTypeDeveloperNameC;
+ EstimateTargetC;
+
+ @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);
+ if (result != null) {
+ this.IsLoading = false;
+ this.Id = result.Id;
+ this.RecordTypeDeveloperNameC = result.RecordTypeDeveloperNameC;
+ this.EstimateTargetC = result.EstimateTargetC;
+
+
+ this.QuarterlyReport();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }).catch(error => {
+ console.log(error);
+ }).finally(() => {
+
+ });
+ }
+
+ // 鍒朵綔瀛f姤
+ QuarterlyReport() {
+ var MaintenanceContractId = this.Id;
+ var RecordTypeName = this.RecordTypeDeveloperNameC;
+ var EstimateTarget = this.EstimateTargetC;
+ var url = '';
+ if (EstimateTarget == "缁忛攢鍟�" && (RecordTypeName == "NewMaintenance_Contract" || RecordTypeName == "VM_Contract")) {
+ url = "/apex/MoreMaintenanceContractPop?Id=" + MaintenanceContractId + "&RecordTypeName=" + RecordTypeName;
+ } else {
+ url = "http://powerbi.olympus.com.cn/Home/Login";
+ }
+ window.open(url, '_bank');
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexQuarterlyReport/lexQuarterlyReport.js-meta.xml b/force-app/main/default/lwc/lexQuarterlyReport/lexQuarterlyReport.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexQuarterlyReport/lexQuarterlyReport.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/lexRCCDScomplete/lexRCCDScomplete.css b/force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.css
new file mode 100644
index 0000000..79456f2
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.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/lexRCCDScomplete/lexRCCDScomplete.html b/force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.html
new file mode 100644
index 0000000..c8bdbfc
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.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/lexRCCDScomplete/lexRCCDScomplete.js b/force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.js
new file mode 100644
index 0000000..4f7e882
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.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 init from '@salesforce/apex/QISReportController.initForRCCDScompleteButton';
+import updateQis from '@salesforce/apex/QISReportController.updateQisForRCCDScomplete';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { updateRecord } from 'lightning/uiRecordApi';
+
+export default class lexRCCDScomplete extends LightningElement {
+ @api recordId;
+ IsLoading = true;
+ qisReportId;
+ cdsdate;
+ QIStatus;
+ 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.cdsdate = result.cdsdate;
+ this.QIStatus = result.qIStatus;
+ if (this.QIStatus == 'RC妫�娴嬬敵璇�') {
+ const evt = new ShowToastEvent({
+ title : '闇�瑕佸厛鐐瑰嚮锛籓CM鏈嶅姟鏈儴鏀跺埌瀹炵墿锛�',
+ message: '',
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ if (this.cdsdate != null) {
+ const evt = new ShowToastEvent({
+ title : 'OCM鏈嶅姟鏈儴CDS宸茬粡瀹屾瘯',
+ message: '',
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ 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/lexRCCDScomplete/lexRCCDScomplete.js-meta.xml b/force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.js-meta.xml
new file mode 100644
index 0000000..b85f028
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexRCCDScomplete">
+ <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/lexRCSubmit/lexRCSubmit.css b/force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.css
new file mode 100644
index 0000000..79456f2
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.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/lexRCSubmit/lexRCSubmit.html b/force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.html
new file mode 100644
index 0000000..49a10f7
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.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/lexRCSubmit/lexRCSubmit.js b/force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.js
new file mode 100644
index 0000000..a65405b
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.js
@@ -0,0 +1,160 @@
+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.initForRCSubmitButton';
+import updateQis from '@salesforce/apex/QISReportController.updateQisWithRC';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { updateRecord } from 'lightning/uiRecordApi';
+
+export default class lexRCSubmit extends LightningElement {
+ @api recordId;
+ IsLoading = true;
+ qisReportId;
+ qisStatus;
+ OSHstaff;
+ OSHstaffEmail;
+ CancelQISReason;
+ Rcid;
+ RCinspectionDate;
+ QISReplyDay;
+ RCproblemnotfound;
+ type;
+ 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.OSHstaff = result.oSHstaff;
+ this.OSHstaffEmail = result.oSHstaffEmail;
+ this.CancelQISReason = result.cancelQISReason;
+ this.Rcid = result.rCid;
+ this.RCinspectionDate = result.rCinspectionDate;
+ this.QISReplyDay = result.qISReplyDay;
+ this.RCproblemnotfound = result.rCproblemnotfound;
+ if (this.qisStatus!='RC妫�娴嬩腑') {
+ const evt = new ShowToastEvent({
+ title : '宸茬粡鎻愪氦瀹℃壒',
+ message: '',
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ if (this.CancelQISReason!=null) {
+ if (this.qisStatus == 'RC妫�娴嬬敵璇�') {
+ const evt = new ShowToastEvent({
+ title : '闇�瑕佸厛鐐瑰嚮锛籓CM鏈嶅姟鏈儴鏀跺埌瀹炵墿锛�',
+ message: '',
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ if (this.Rcid ==null) {
+ const evt = new ShowToastEvent({
+ title : '鍒ゅ畾鎷呭綋蹇呴』濉啓',
+ message: '',
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ if (this.RCinspectionDate == null) {
+ const evt = new ShowToastEvent({
+ title : 'OCM鏈嶅姟鏈儴杩樻病鏈夋娴嬪畬姣�',
+ message: '',
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ if (this.QISReplyDay!=null && this.RCproblemnotfound == 'true') {
+ const evt = new ShowToastEvent({
+ title : '鏈�缁堝垽瀹氭椂锛岃鍙栨秷[鏁呴殰鏈彂鐜扮暀涓嬬户缁瀵焆骞堕�夋嫨[瀵瑰簲鏂规硶]',
+ message: '',
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ if (confirm("涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵")) {
+ this.type = '1';
+ }else{
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ }else{
+ if (confirm("涓�鏃︽彁浜ゅ叧闂璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵")) {
+ this.type = '2';
+ }else{
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ }
+ console.log('this.type='+this.type);
+ // this.dispatchEvent(new CloseActionScreenEvent());
+ this.updateQisSubmit();
+ }).catch(error => {
+ console.log('error='+error);
+ }).finally(() => {
+
+ });
+ }
+
+ updateRecordView(recordId) {
+ updateRecord({fields: { Id: recordId }});
+ }
+
+ updateQisSubmit(){
+ updateQis({
+ recordId: this.recordId,
+ type: this.type,
+ oldQIStatus: this.qisStatus
+ }).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/lexRCSubmit/lexRCSubmit.js-meta.xml b/force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.js-meta.xml
new file mode 100644
index 0000000..87bc598
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexRCSubmit">
+ <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.css b/force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.css
new file mode 100644
index 0000000..eb667c5
--- /dev/null
+++ b/force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.css
@@ -0,0 +1,10 @@
+.sisToOPDHolder{
+ 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/lexSIStoOPD/lexSIStoOPD.html b/force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.html
new file mode 100644
index 0000000..48f29e0
--- /dev/null
+++ b/force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.html
@@ -0,0 +1,6 @@
+<template>
+ <div class="sisToOPDHolder" 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/lexSIStoOPD/lexSIStoOPD.js b/force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.js
new file mode 100644
index 0000000..1996195
--- /dev/null
+++ b/force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.js
@@ -0,0 +1,99 @@
+/*
+ * @Description:
+ * @version:
+ * @Author: chen jing wu
+ * @Date: 2023-04-07 09:02:03
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-11 09:10:42
+ */
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import updateForSIStoOPDButton from '@salesforce/apex/ReportController.updateForSIStoOPDButton';
+import init from '@salesforce/apex/ReportController.initForSIStoOPDButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class LexSIStoOPD extends LightningElement {
+ @api recordId;
+ IsLoading = true;
+ ownerId;
+ status;
+ userId;
+ @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(){
+ console.log(this.recordId);
+ init({
+ recordId: this.recordId
+ }).then(result => {
+ console.log(result);
+ if (result != null) {
+ this.ownerId = result.ownerId;
+ this.status = result.status;
+ this.userId = result.userId;
+ this.SIStoOPD();
+ }
+ }).catch(error => {
+ console.log("error");
+ console.log(error);
+ }).finally(() => {
+ });
+
+ }
+
+ showToast(msg,type) {
+ const event = new ShowToastEvent({
+ title: '',
+ message: msg,
+ variant: type
+ });
+ this.dispatchEvent(event);
+ }
+
+
+ updateRecordView(recordId) {
+ updateRecord({fields: { Id: recordId }});
+ }
+
+ SIStoOPD () {
+ if(this.ownerId == this.userId && this.status == "鑽夋涓�") {
+ updateForSIStoOPDButton({
+ recordId: this.recordId
+ }).then(result=>{
+ console.log(result);
+ if(result){
+ this.showToast(result,"error");
+ }else{
+ this.showToast("鎴愬姛","success");
+ this.updateRecordView(this.recordId);
+ }
+ this.IsLoading = false;
+ this.dispatchEvent(new CloseActionScreenEvent());
+ });
+ }
+
+}
+ // ifError(result){
+ // console.log(result);
+ // if(result){
+ // this.showToast(result,"error");
+ // }
+
+ // }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.js-meta.xml b/force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.js-meta.xml
new file mode 100644
index 0000000..c307012
--- /dev/null
+++ b/force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.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/lexSendRepairsToEtQ/__tests__/lexSendRepairsToEtQ.test.js b/force-app/main/default/lwc/lexSendRepairsToEtQ/__tests__/lexSendRepairsToEtQ.test.js
new file mode 100644
index 0000000..0f076e5
--- /dev/null
+++ b/force-app/main/default/lwc/lexSendRepairsToEtQ/__tests__/lexSendRepairsToEtQ.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexSendRepairsToEtQ from 'c/lexSendRepairsToEtQ';
+
+describe('c-lex-send-repairs-to-et-q', () => {
+ 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-send-repairs-to-et-q', {
+ is: LexSendRepairsToEtQ
+ });
+
+ // 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/lexSendRepairsToEtQ/lexSendRepairsToEtQ.html b/force-app/main/default/lwc/lexSendRepairsToEtQ/lexSendRepairsToEtQ.html
new file mode 100644
index 0000000..87f391a
--- /dev/null
+++ b/force-app/main/default/lwc/lexSendRepairsToEtQ/lexSendRepairsToEtQ.html
@@ -0,0 +1,6 @@
+<template>
+ <div class="exampleHolder" 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/lexSendRepairsToEtQ/lexSendRepairsToEtQ.js b/force-app/main/default/lwc/lexSendRepairsToEtQ/lexSendRepairsToEtQ.js
new file mode 100644
index 0000000..927e6d3
--- /dev/null
+++ b/force-app/main/default/lwc/lexSendRepairsToEtQ/lexSendRepairsToEtQ.js
@@ -0,0 +1,192 @@
+import {
+ LightningElement,
+ wire,
+ api
+} from 'lwc';
+import {
+ CurrentPageReference
+} from "lightning/navigation";
+import {
+ CloseActionScreenEvent
+} from 'lightning/actions';
+import init from '@salesforce/apex/otherButtonRepairController.init';
+import selectRecords from '@salesforce/apex/otherButtonRepairController.selectRecords';
+import sendToETQ from '@salesforce/apex/otherButtonRepairController.sendToETQ';
+import {
+ ShowToastEvent
+} from 'lightning/platformShowToastEvent';
+
+export default class LexSendRepairsToEtQ extends LightningElement {
+ @api recordId;
+ str;
+ IsLoading = true;
+ Id;;
+ PAEDetermineC;
+ ETQUPLOADSTATUSC;
+ AEDetermineResultC;
+ PAEDetermineACC;
+ RepairInspectionDateC;
+ ContainUseRSAC;
+ userID;
+ profileId;
+
+ @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);
+ if (result != null) {
+ this.IsLoading = false;
+ this.Id = result.Id;
+ this.PAEDetermineC = result.PAEDetermineC;
+ this.ETQUPLOADSTATUSC = result.ETQUPLOADSTATUSC;
+ this.AEDetermineResultC = result.AEDetermineResultC;
+ this.PAEDetermineACC = result.PAEDetermineACC;
+ this.RepairInspectionDateC = result.RepairInspectionDateC;
+ this.ContainUseRSAC = result.ContainUseRSAC;
+ this.userID = result.userID;
+ this.profileId = result.profileId;
+
+ this.myDate();
+ this.myReload();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }).catch(error => {
+ console.log(error);
+ }).finally(() => {
+
+ });
+ }
+
+ // 鏍规嵁鏃ユ湡鏋勫缓MessageGroupNumber
+ myDate() {
+ let messageNumber = '';
+ let today = new Date();
+ messageNumber = today.getFullYear() + '' + (today.getMonth() + 1) + '' + today.getDate() + '' + today.getHours() + '' +
+ today.getMinutes() + '' + today.getSeconds();
+ return messageNumber;
+ }
+
+ // 鎸夐挳鐐瑰嚮鍚庤Е鍙�,鍒ゆ柇鏄惁鍙戦�佽繃ETQ,濡傛灉鍙戦�佽繃缁欏嚭鎻愮ず骞剁伆鎺夋寜閽�
+ // 濡傛灉娌℃湁鍙戦�佽繃璋冪敤鍙戦�佹柟娉�
+ myReload() {
+ selectRecords({
+ recordId: this.Id
+ }).then(result => {
+ console.log(result);
+ if (result.AsyncData__c == 'true' && result.ETQ_UPLOAD_STATUS__c != '3' || result.Complaint_Number__c != null) {
+ var btns = document.getElementsByName("sendrepairstoetq");
+ for (var i = 0; i < btns.length; i++) {
+ btns[i].disabled = true;
+ btns[i].className = 'btnDisabled';
+ }
+ this.ShowToastEvent('璇ヤ慨鐞嗕箣鍓嶅凡缁忓彂閫佽繃浜�', "error");
+ // alert('璇ヤ慨鐞嗕箣鍓嶅凡缁忓彂閫佽繃浜�')
+ } else {
+ this.SendRepairsToEtQ();
+ }
+ }).catch(error => {
+ console.log(error);
+ }).finally(() => {
+
+ });
+ }
+
+ // 鍙戦�丒TQ
+ SendRepairsToEtQ() {
+ console.log(this.userID);
+ console.log(this.profileId);
+
+ var uid = this.userID;
+ if (this.profileId != "00e10000000xnoO" && this.profileId != "00e10000000hl7w" && this.profileId != '00e10000000Y3o5') {
+ this.ShowToastEvent("鎮ㄦ病鏈夊彂閫佷慨鐞嗗埌EtQ鐨勬潈闄愩��", "error");
+ // alert("鎮ㄦ病鏈夊彂閫佷慨鐞嗗埌EtQ鐨勬潈闄愩��");
+ return;
+ }
+ var statu = '';
+ if (this.PAEDetermineC == undefined) {
+ this.ShowToastEvent("OCSM QARA鐨凱AE鍒ゅ畾鏄┖鐨勬椂鍊欙紝涓嶅彲浠ュ彂閫佸埌EtQ銆�", "error");
+ // alert("OCSM QARA鐨凱AE鍒ゅ畾鏄┖鐨勬椂鍊欙紝涓嶅彲浠ュ彂閫佸埌EtQ銆�");
+ return;
+ }
+ if (this.ETQUPLOADSTATUSC == "3") {
+ if (!confirm("鏄惁娓呯┖EtQ鍚屾鐘舵�侊紝閲嶆柊鍚屾鏁版嵁锛�")) {
+ return;
+ }
+ }
+ if (this.PAEDetermineC == "nonPAE" && this.AEDetermineResultC == "nonAE" && this.PAEDetermineACC == "nonPAE" && uid != "005100000068zJ6") {
+ this.ShowToastEvent("Close Complait鐨勬椂鍊欙紝涓嶅彲浠ュ彂閫佸埌EtQ", "error");
+ // alert("Close Complait鐨勬椂鍊欙紝涓嶅彲浠ュ彂閫佸埌EtQ");
+ return;
+ }
+ if (this.PAEDetermineC != undefined && this.AEDetermineResultC != undefined && this.PAEDetermineACC == undefined) {
+ statu = "R1";
+ } else if ((this.AEDetermineResultC != undefined && this.PAEDetermineC != undefined && this.PAEDetermineACC != undefined) &&
+ !(this.PAEDetermineC == "nonPAE" && this.AEDetermineResultC == "nonAE" && this.PAEDetermineACC == "nonPAE")) {
+ statu = "R2";
+ if (this.RepairInspectionDateC == "") {
+ this.ShowToastEvent("5.淇悊妫�娴嬫棩鏄┖鐨勬椂鍊欙紝涓嶅彲浠ュ彂閫佸埌EtQ銆�", "error");
+ // alert("5.淇悊妫�娴嬫棩鏄┖鐨勬椂鍊欙紝涓嶅彲浠ュ彂閫佸埌EtQ銆�");
+ return;
+ }
+ if (this.ContainUseRSAC == 1) {
+ this.ShowToastEvent("Final universal code涓虹┖锛屾垨鑰呭寘鍚玌seRSA锛岃纭銆�", "error");
+ // alert("Final universal code涓虹┖锛屾垨鑰呭寘鍚玌seRSA锛岃纭銆�");
+ return;
+ }
+ }
+
+ var result;
+ try {
+ var repairids = new Array()
+ repairids[0] = this.Id;
+
+ var statuArr = new Array();
+ statuArr.push(statu);
+
+ sendToETQ({
+ iflog_Id: "",
+ rowDataSFDC: "",
+ repairIds: repairids,
+ statu: statuArr[0]
+ }).then(result => {
+ this.ShowToastEvent(result, "error");
+ // alert(result);
+ }).catch(error => {
+ console.log(error);
+ })
+
+ var btns = document.getElementsByName("sendrepairstoetq");
+ for (var i = 0; i < btns.length; i++) {
+ btns[i].disabled = true;
+ btns[i].className = 'btnDisabled';
+ }
+ location.reload();
+ } catch (error) {
+ this.ShowToastEvent("鍙戦�佷慨鐞嗗埌EtQ澶辫触" + error.faultstring + ' code:' + error.faultcode, "error");
+ // alert("鍙戦�佷慨鐞嗗埌EtQ澶辫触" + error.faultstring + ' code:' + error.faultcode);
+ }
+ }
+
+ // 寮圭獥
+ ShowToastEvent(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/lexSendRepairsToEtQ/lexSendRepairsToEtQ.js-meta.xml b/force-app/main/default/lwc/lexSendRepairsToEtQ/lexSendRepairsToEtQ.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexSendRepairsToEtQ/lexSendRepairsToEtQ.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/lexSubmitCompetitorReport/lexSubmitCompetitorReport.css b/force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.css
new file mode 100644
index 0000000..4379b62
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.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/lexSubmitCompetitorReport/lexSubmitCompetitorReport.html b/force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.html
new file mode 100644
index 0000000..9625dc2
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.html
@@ -0,0 +1,6 @@
+<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/lexSubmitCompetitorReport/lexSubmitCompetitorReport.js b/force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.js
new file mode 100644
index 0000000..213dc1c
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.js
@@ -0,0 +1,70 @@
+/*
+ * @Description:
+ * @version:
+ * @Author: chen jing wu
+ * @Date: 2023-04-07 09:02:03
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-11 09:11:11
+ */
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { NavigationMixin } from 'lightning/navigation';
+import otherButtonInSubmitCompetitorReport from '@salesforce/apex/ReportController.updateForSubmitCompetitorReportButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import init from '@salesforce/apex/ReportController.initForSubmitCompetitorReportButton';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class LexSubmitCompetitorReport 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;
+ }
+ }
+ }
+
+ updateRecordView(recordId) {
+ updateRecord({fields: { Id: recordId }});
+ }
+
+ connectedCallback(){
+ init({
+ recordId: this.recordId
+ }).then(result=>{
+ this.submit();
+ });
+
+ }
+
+ showToast(msg,type) {
+ const event = new ShowToastEvent({
+ title: '',
+ message: msg,
+ variant: type
+ });
+ this.dispatchEvent(event);
+ }
+
+
+ submit(){
+ otherButtonInSubmitCompetitorReport({
+ recordId: this.recordId
+ }).then(result=>{
+ this.showToast("鎻愪氦瀵规墜绔炰簤鎶ュ憡鎴愬姛","success")
+ this.updateRecordView(this.recordId);
+ this.IsLoading = false;
+ this.dispatchEvent(new CloseActionScreenEvent());
+ });
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.js-meta.xml b/force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.js-meta.xml
new file mode 100644
index 0000000..8b2c3d6
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.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/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/lexSubmitForApproval/__tests__/lexSubmitForApproval.test.js b/force-app/main/default/lwc/lexSubmitForApproval/__tests__/lexSubmitForApproval.test.js
new file mode 100644
index 0000000..fa04967
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitForApproval/__tests__/lexSubmitForApproval.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexSubmitForApproval from 'c/lexSubmitForApproval';
+
+describe('c-lex-submit-for-approval', () => {
+ 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-submit-for-approval', {
+ is: LexSubmitForApproval
+ });
+
+ // 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/lexSubmitForApproval/lexSubmitForApproval.html b/force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.html
new file mode 100644
index 0000000..d044dbb
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="exampleHolder" 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/lexSubmitForApproval/lexSubmitForApproval.js b/force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.js
new file mode 100644
index 0000000..9de188b
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.js
@@ -0,0 +1,71 @@
+import {
+ LightningElement,
+ wire,
+ api
+} from 'lwc';
+import {
+ CurrentPageReference
+} from "lightning/navigation";
+import {
+ CloseActionScreenEvent
+} from 'lightning/actions';
+import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init';
+import selectRecords from '@salesforce/apex/otherButtonMaintenanceContractCtl.selectRecords';
+
+export default class LexSubmitForApproval extends LightningElement {
+ @api recordId;
+ str;
+ IsLoading = true;
+ Id;
+
+ @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);
+ if (result != null) {
+ this.IsLoading = false;
+ this.Id = result.Id;
+
+ this.SubmitForApproval();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }).catch(error => {
+ console.log(error);
+ }).finally(() => {
+
+ });
+ }
+
+ // 鍏抽棴璇环/鍏抽棴缁
+ SubmitForApproval() {
+ var url = '';
+ selectRecords({
+ recordId: this.Id
+ }).then(result => {
+ console.log(result);
+ if (result.length > 0) {
+ url = "/apex/SubmitForApprovalPage?id=" + result[0].Id;
+ } else {
+ url = "/apex/SubmitForApprovalPage?mcId=" + this.Id;
+ }
+ window.open(url, '', 'height=350, width=600, top=200, left=350,location=no');
+ }).catch(error => {
+ console.log("error");
+ }).finally(() => {
+
+ });
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.js-meta.xml b/force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.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/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.html b/force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.html
new file mode 100644
index 0000000..edb0a0d
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="AttachmentButton" 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/lexTenderingAttachmentButton/lexTenderingAttachmentButton.js b/force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.js
new file mode 100644
index 0000000..c9f5295
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.js
@@ -0,0 +1,45 @@
+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 lexTenderingAttachmentButton 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/TenderInformationUploadPdf?id=${this.id}`);
+ }
+
+ showToast(msg,type) {
+ const event = new ShowToastEvent({
+ message: msg,
+ variant: type
+ });
+ this.dispatchEvent(event);
+ }
+}
diff --git a/force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.js-meta.xml b/force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.js-meta.xml
new file mode 100644
index 0000000..2b7649d
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.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/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.html b/force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.html
new file mode 100644
index 0000000..dc43ef6
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="HospitalButton" 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/lexTenderingHospitalButton/lexTenderingHospitalButton.js b/force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.js
new file mode 100644
index 0000000..e577335
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.js
@@ -0,0 +1,48 @@
+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 lexTenderingHospitalButton extends LightningElement {
+ @api recordId;//褰撳墠杩欐潯鏁版嵁鐨刬d
+ id;//杩斿洖鍊肩殑id Tender_information__c鎷涙爣椤圭洰鐨刬d
+ name;//鎷涙爣椤圭洰鍚�
+ Environment_Url;//鏂板缓鍖婚櫌鍦板潃
+ 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.name = result.name;
+ this.Environment_Url = result.Environment_Url;
+ this.HospitalButton();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }).catch(() => {
+ }).finally(() => {
+
+ });
+ }
+
+ //鎷涙爣椤圭洰鏂板缓鍖婚櫌
+ HospitalButton(){
+ var url = this.Environment_Url+'001/e?CF00N10000009I0o7='+encodeURIComponent(this.name)
+ +'&CF00N10000009I0o7_lkid='+encodeURIComponent(this.id)
+ +'&00N10000009HFQT='+encodeURIComponent('鎷涙爣椤圭洰')
+ +'&RecordType=01210000000QemG'
+ +'&retURL='+ encodeURIComponent(this.id);
+ window.location.href = url;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.js-meta.xml b/force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.js-meta.xml
new file mode 100644
index 0000000..2b7649d
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.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/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.html b/force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.html
new file mode 100644
index 0000000..e94a2ef
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="LostButton" 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/lexTenderingLostButton/lexTenderingLostButton.js b/force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js
new file mode 100644
index 0000000..ff5d294
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js
@@ -0,0 +1,71 @@
+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 sqlResult from '@salesforce/apex/TenderingButtonController.sqlResult';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class lexTenderingLostButton 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.LoseButton();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ })
+ }
+
+ //鎷涙爣椤圭洰澶卞崟
+ LoseButton(){
+ sqlResult({id: this.id}).then(result=>{
+ //绠�妗f潈闄� 2S1_閿�鍞尰闄㈡媴褰� 2S4_閿�鍞鐞嗚�� 绯荤粺绠$悊鍛�
+ if (this.profileId != '00e10000000xnp2' && this.profileId != '00e10000000xnpH' && this.profileId != '00e10000000Y3o5') {
+ this.showToast("鎮ㄦ病鏈夋潈闄愶紝鏃犳硶鍒涘缓璇环鎻愪氦澶卞崟銆�","error");
+ return;
+ }
+ // 鍒ゆ柇鍐呴儴纭鐘舵��
+ if(this.status == '01.寰呯‘璁�'|| this.status == '02.涓嶇浉鍏�'){
+ this.showToast("鐘舵�佷负寰呯‘璁ゆ垨涓嶇浉鍏筹紝涓嶅彲浠ュ仛澶卞崟銆�","error");
+ return;
+ }
+ // 鍒ゆ柇鏄惁闇�瑕佹柊寤鸿浠�
+ if(this.status == '05.璇环涓�'|| this.status == '06.鎴愪氦' || this.status == '07.閮ㄥ垎鎴愪氦' || this.status == '08.澶卞崟' || result.length > 0){
+ if(confirm('姝ら」鐩凡鍏宠仈璇环锛岃纭疄鏄惁鏂板缓璇环鎻愪氦澶卞崟銆�')) {
+
+ }else{
+ return;
+ }
+ }
+ window.open(`/apex/TenderLostPage?id=${this.id}`,'','height=500,width=800,top=200,left=250,location=no');
+ })
+ }
+ 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/lexTenderingLostButton/lexTenderingLostButton.js-meta.xml b/force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js-meta.xml
new file mode 100644
index 0000000..2b7649d
--- /dev/null
+++ b/force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.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/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/lexUploadToRecognitionModel/__tests__/lexUploadToRecognitionModel.test.js b/force-app/main/default/lwc/lexUploadToRecognitionModel/__tests__/lexUploadToRecognitionModel.test.js
new file mode 100644
index 0000000..3986cf6
--- /dev/null
+++ b/force-app/main/default/lwc/lexUploadToRecognitionModel/__tests__/lexUploadToRecognitionModel.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexUploadToRecognitionModel from 'c/lexUploadToRecognitionModel';
+
+describe('c-lex-upload-to-recognition-model', () => {
+ 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-upload-to-recognition-model', {
+ is: LexUploadToRecognitionModel
+ });
+
+ // 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/lexUploadToRecognitionModel/lexUploadToRecognitionModel.html b/force-app/main/default/lwc/lexUploadToRecognitionModel/lexUploadToRecognitionModel.html
new file mode 100644
index 0000000..87f391a
--- /dev/null
+++ b/force-app/main/default/lwc/lexUploadToRecognitionModel/lexUploadToRecognitionModel.html
@@ -0,0 +1,6 @@
+<template>
+ <div class="exampleHolder" 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/lexUploadToRecognitionModel/lexUploadToRecognitionModel.js b/force-app/main/default/lwc/lexUploadToRecognitionModel/lexUploadToRecognitionModel.js
new file mode 100644
index 0000000..6e22dc1
--- /dev/null
+++ b/force-app/main/default/lwc/lexUploadToRecognitionModel/lexUploadToRecognitionModel.js
@@ -0,0 +1,133 @@
+import {
+ LightningElement,
+ wire,
+ api
+} from 'lwc';
+import {
+ CurrentPageReference
+} from "lightning/navigation";
+import {
+ CloseActionScreenEvent
+} from 'lightning/actions';
+import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init';
+import updateColunm from '@salesforce/apex/MaintenanceContractSetColunmWebService.updateColunm';
+import up2sap from '@salesforce/apex/MaintenanceContractWebService.up2sap';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+export default class LexUploadToRecognitionModel extends LightningElement {
+ @api recordId;
+ str;
+ IsLoading = true;
+ Id;
+ ContractQuotationOrNotC;
+ oldIsRecognitionModelC;
+ MaintenanceContractNoC;
+ uploadToRMTimeC;
+ uploadToSapTimeC;
+ PaymentPlanSumFirstC;
+
+ @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);
+ if (result != null) {
+ this.IsLoading = false;
+ this.Id = result.Id;
+ this.ContractQuotationOrNotC = result.ContractQuotationOrNotC;
+ this.oldIsRecognitionModelC = result.oldIsRecognitionModelC;
+ this.MaintenanceContractNoC = result.MaintenanceContractNoC;
+ this.uploadToSapTimeC = result.uploadToSapTimeC;
+ this.uploadToRMTimeC = result.uploadToRMTimeC;
+ this.PaymentPlanSumFirstC = result.PaymentPlanSumFirstC;
+
+ this.uploadToRecognitionModel();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }).catch(error => {
+ console.log(error);
+ }).finally(() => {
+
+ });
+ }
+
+ // 涓婁紶璁ゆ鍚堝悓
+ uploadToRecognitionModel() {
+ if (this.ContractQuotationOrNotC == '杩樻病鍋氭姤浠�') {
+ this.ShowToastEvent("鎮ㄨ繕娌℃湁鍋氬悎鍚屾姤浠凤紝涓嶈兘涓婁紶璁ゆ鍚堝悓銆�", "error")
+ // alert("鎮ㄨ繕娌℃湁鍋氬悎鍚屾姤浠凤紝涓嶈兘涓婁紶璁ゆ鍚堝悓銆�");
+ } else if (this.MaintenanceContractNoC == undefined) {
+ this.ShowToastEvent('鍚堝悓鍙风爜涓虹┖锛屼笉鑳戒笂浼犺娆惧悎鍚屻��', "error")
+ // alert('鍚堝悓鍙风爜涓虹┖锛屼笉鑳戒笂浼犺娆惧悎鍚屻��');
+ } else if (this.uploadToSapTimeC != undefined) {
+ this.ShowToastEvent('宸茬粡涓婁紶SAP锛屼笉鑳藉啀娆′笂浼犺娆惧悎鍚屻��', "error")
+ // alert('宸茬粡涓婁紶SAP锛屼笉鑳藉啀娆′笂浼犺娆惧悎鍚屻��');
+ } else if (this.uploadToRMTimeC != undefined) {
+ this.ShowToastEvent('宸茬粡涓婁紶璁ゆ鍚堝悓锛屼笉鑳藉啀娆′笂浼犺娆惧悎鍚屻��', "error")
+ // alert('宸茬粡涓婁紶璁ゆ鍚堝悓锛屼笉鑳藉啀娆′笂浼犺娆惧悎鍚屻��');
+ } else {
+ if (!this.oldIsRecognitionModelC) {
+ this.ShowToastEvent('缁忛攢鍟嗕负绌烘垨缁忛攢鍟嗕笉鏄厛娆惧璞★紝涓嶉渶瑕佷笂浼犺娆惧悎鍚屻��', "error")
+ // alert('缁忛攢鍟嗕负绌烘垨缁忛攢鍟嗕笉鏄厛娆惧璞★紝涓嶉渶瑕佷笂浼犺娆惧悎鍚屻��');
+ } else if (this.PaymentPlanSumFirstC == undefined) {
+ this.ShowToastEvent('绗竴娆¤鍒掍粯娆鹃噾棰濅笉鑳戒负绌恒��', "error")
+ // alert('绗竴娆¤鍒掍粯娆鹃噾棰濅笉鑳戒负绌恒��');
+ } else {
+ if (!confirm('璇风‘璁ゆ槸鍚﹁涓婁紶璁ゆ鍚堝悓銆�')) {
+ return;
+ }
+
+ updateColunm({
+ mcid: this.Id
+ }).then(result => {
+ console.log(result);
+ if (result != '1') {
+ this.ShowToastEvent('涓婁紶璁ゆ鍚堝悓澶辫触,鍥犱负 鏉ュ勾鍚堝悓鐩稿叧淇℃伅淇敼澶辫触', "error")
+ // alert('涓婁紶璁ゆ鍚堝悓澶辫触,鍥犱负 鏉ュ勾鍚堝悓鐩稿叧淇℃伅淇敼澶辫触');
+ location.href = "/" + this.Id;
+ }
+ }).catch(error => {
+ console.log(error);
+ })
+
+ up2sap({
+ mcid: this.Id
+ }).then(rtn => {
+ console.log(rtn);
+ if (rtn == '1') {
+ this.ShowToastEvent("涓婁紶璁ゆ鍚堝悓鎴愬姛", "success")
+ // alert("涓婁紶璁ゆ鍚堝悓鎴愬姛");
+ location.href = "/" + this.Id;
+ } else {
+ this.ShowToastEvent(rtn, "error")
+ // alert(rtn);
+ }
+ }).catch(error => {
+ console.log(error);
+ })
+ }
+ }
+ }
+
+ // 寮圭獥
+ ShowToastEvent(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/lexUploadToRecognitionModel/lexUploadToRecognitionModel.js-meta.xml b/force-app/main/default/lwc/lexUploadToRecognitionModel/lexUploadToRecognitionModel.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexUploadToRecognitionModel/lexUploadToRecognitionModel.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/lexUploadToSap/__tests__/lexUploadToSap.test.js b/force-app/main/default/lwc/lexUploadToSap/__tests__/lexUploadToSap.test.js
new file mode 100644
index 0000000..d5f3d47
--- /dev/null
+++ b/force-app/main/default/lwc/lexUploadToSap/__tests__/lexUploadToSap.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexUploadToSap from 'c/lexUploadToSap';
+
+describe('c-lex-upload-to-sap', () => {
+ 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-upload-to-sap', {
+ is: LexUploadToSap
+ });
+
+ // 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/lexUploadToSap/lexUploadToSap.html b/force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.html
new file mode 100644
index 0000000..87f391a
--- /dev/null
+++ b/force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.html
@@ -0,0 +1,6 @@
+<template>
+ <div class="exampleHolder" 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/lexUploadToSap/lexUploadToSap.js b/force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.js
new file mode 100644
index 0000000..5bd9188
--- /dev/null
+++ b/force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.js
@@ -0,0 +1,155 @@
+import {
+ LightningElement,
+ wire,
+ api
+} from 'lwc';
+import {
+ CurrentPageReference
+} from "lightning/navigation";
+import {
+ CloseActionScreenEvent
+} from 'lightning/actions';
+import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init';
+import updateColunm from '@salesforce/apex/MaintenanceContractSetColunmWebService.updateColunm';
+import updateFirstContract from '@salesforce/apex/updateFirstServiceContractWebService.updateFirstContract';
+import Check_plan from '@salesforce/apex/MaintenanceContractWebService.Check_plan';
+import up2sap from '@salesforce/apex/MaintenanceContractWebService.up2sap';
+import {
+ ShowToastEvent
+} from 'lightning/platformShowToastEvent';
+
+export default class LexUploadToSap extends LightningElement {
+ @api recordId;
+ str;
+ IsLoading = true;
+ MCApprovalStatusC;
+ MaintenanceContractNoC;
+ uploadToSapTimeC;
+ oldIsRecognitionModelC;
+ uploadToRMTimeC;
+ IsRecognitionModelTrueC;
+ Id;
+ URFContractFC;
+ urfFlag;
+ rtn1;
+ rtn;
+ @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);
+ if (result != null) {
+ this.IsLoading = false;
+ this.MCApprovalStatusC = result.MCApprovalStatusC;
+ this.MaintenanceContractNoC = result.MaintenanceContractNoC;
+ this.uploadToSapTimeC = result.uploadToSapTimeC;
+ this.oldIsRecognitionModelC = result.oldIsRecognitionModelC;
+ this.uploadToRMTimeC = result.uploadToRMTimeC;
+ this.IsRecognitionModelTrueC = result.IsRecognitionModelTrueC;
+ this.Id = result.Id;
+ this.URFContractFC = result.URFContractFC;
+
+ this.uploadToSap();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }).catch(error => {
+ console.log(error);
+ }).finally(() => {
+
+ });
+ }
+
+ // 涓婁紶SAP
+ uploadToSap() {
+ if (this.MCApprovalStatusC != 'Pass') {
+ this.ShowToastEvent("鍚堝悓澶嶆牳鎵瑰噯鍚庢墠鍙互涓婁紶SAP銆�", "error")
+ // alert("鍚堝悓澶嶆牳鎵瑰噯鍚庢墠鍙互涓婁紶SAP銆�");
+ } else if (this.MaintenanceContractNoC == undefined) {
+ this.ShowToastEvent('缁翠慨鍚堝悓绠$悊缂栫爜涓虹┖锛屼笉鑳戒笂浼燬AP銆�', "error")
+ // alert('缁翠慨鍚堝悓绠$悊缂栫爜涓虹┖锛屼笉鑳戒笂浼燬AP銆�');
+ } else if (this.uploadToSapTimeC != undefined) {
+ this.ShowToastEvent('宸茬粡涓婁紶SAP锛屼笉鑳介噸澶嶄笂浼犮��', "error")
+ // alert('宸茬粡涓婁紶SAP锛屼笉鑳介噸澶嶄笂浼犮��');
+ } else {
+ if (this.oldIsRecognitionModelC) {
+ if (this.uploadToRMTimeC == undefined) {
+ this.ShowToastEvent('褰撳墠缁翠慨鍚堝悓鐨勭粡閿�鍟嗘槸鍏堟瀵硅薄锛岄渶瑕佸厛銆愪笂浼犺娆惧悎鍚屻�戯紝鐒跺悗瀹屾垚璁ゆ浠ュ悗鎵嶈兘涓婁紶SAP銆�', "error")
+ // alert('褰撳墠缁翠慨鍚堝悓鐨勭粡閿�鍟嗘槸鍏堟瀵硅薄锛岄渶瑕佸厛銆愪笂浼犺娆惧悎鍚屻�戯紝鐒跺悗瀹屾垚璁ゆ浠ュ悗鎵嶈兘涓婁紶SAP銆�');
+ return;
+ } else {
+ if (!this.IsRecognitionModelTrueC) {
+ this.ShowToastEvent('褰撳墠缁翠慨鍚堝悓娌℃湁瀹屾垚璁ゆ锛屼笉鑳戒笂浼燬AP銆�', "error")
+ // alert('褰撳墠缁翠慨鍚堝悓娌℃湁瀹屾垚璁ゆ锛屼笉鑳戒笂浼燬AP銆�');
+ return;
+ }
+ }
+ }
+ updateColunm({
+ mcid: this.Id
+ }).then(result => {
+ if (result != '1') {
+ this.ShowToastEvent('涓婁紶SAP澶辫触,鍥犱负 鏉ュ勾鍚堝悓鐩稿叧淇℃伅淇敼澶辫触', "error")
+ // alert('涓婁紶SAP澶辫触,鍥犱负 鏉ュ勾鍚堝悓鐩稿叧淇℃伅淇敼澶辫触');
+ }
+ });
+ updateFirstContract({
+ mcid: this.Id
+ }).then(result => {
+ if (result != '1') {
+ this.ShowToastEvent(result, "error")
+ // alert(result);
+ }
+ });
+ this.urfFlag = this.URFContractFC;
+ this.rtn1 = '1';
+ this.rtn = '1';
+ if (this.urfFlag == 'false') {
+ Check_plan({
+ mcidList: this.Id
+ }).then(result => {
+ this.rtn1 = result;
+ });
+ }
+ if (this.rtn1 == '1') {
+ up2sap({
+ mcid: this.Id
+ }).then(result => {
+ this.rtn = result;
+ });
+ if (this.rtn == '1') {
+ this.ShowToastEvent("涓婁紶SAP鎴愬姛", "success")
+ // alert("涓婁紶SAP鎴愬姛");
+ window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Maintenance_Contract__c/" + this.recordId + "/view");
+ } else {
+ this.ShowToastEvent(this.rtn, "error")
+ // alert(this.rtn);
+ }
+ } else {
+ this.ShowToastEvent(this.rtn1, "error")
+ // alert(this.rtn1);
+ }
+ }
+ }
+
+ // 寮圭獥
+ ShowToastEvent(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/lexUploadToSap/lexUploadToSap.js-meta.xml b/force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.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/lexVOCAnswer/lexVOCAnswer.css b/force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.css
new file mode 100644
index 0000000..f2237d1
--- /dev/null
+++ b/force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.css
@@ -0,0 +1,10 @@
+.answerHolder{
+ 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/lexVOCAnswer/lexVOCAnswer.html b/force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.html
new file mode 100644
index 0000000..c79d866
--- /dev/null
+++ b/force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.html
@@ -0,0 +1,7 @@
+<template>
+ <div class="answerHolder" 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/lexVOCAnswer/lexVOCAnswer.js b/force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.js
new file mode 100644
index 0000000..c4b9a85
--- /dev/null
+++ b/force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.js
@@ -0,0 +1,92 @@
+/*
+ * @Description:
+ * @version:
+ * @Author: chen jing wu
+ * @Date: 2023-03-27 14:05:59
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-10 17:56:04
+ */
+import { LightningElement, wire, track, api } from "lwc";
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from "lightning/actions";
+import { NavigationMixin } from "lightning/navigation";
+import init from "@salesforce/apex/ReportController.initForVOCAnswerButton";
+import updateForVOCAnswerButton from "@salesforce/apex/ReportController.updateForVOCAnswerButton";
+import { updateRecord } from "lightning/uiRecordApi";
+import { ShowToastEvent } from "lightning/platformShowToastEvent";
+export default class LexVOCAnswer extends LightningElement {
+ @api recordId;
+ status;
+ 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() {
+ console.log(this.recordId);
+ init({
+ recordId: this.recordId,
+ })
+ .then((result) => {
+ console.log(result);
+ if (result != null) {
+ this.status = result.status;
+ this.update();
+ }
+ })
+ .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");
+ }
+
+ showToast(msg, type) {
+ const event = new ShowToastEvent({
+ title: "",
+ message: msg,
+ variant: type
+ });
+ this.dispatchEvent(event);
+ }
+
+ updateRecordView(recordId) {
+ updateRecord({ fields: { Id: recordId } });
+ }
+
+ update() {
+ if (this.status != "宸插垎閰�") {
+ this.showToast("涓嶆槸宸插垎閰嶄笉鑳界偣鍑�", "error");
+ return;
+ }
+ updateForVOCAnswerButton({
+ recordId: this.recordId
+ }).then(result => {
+ if (result == null) {
+ this.showToast("鎴愬姛", "success");
+ } else {
+ console.log(result);
+ this.showToast(result,"error");
+ }
+ this.updateRecordView(this.recordId);
+ this.Isloading = false;
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }).catch(error=>{
+ console.log(error);
+ });
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.js-meta.xml b/force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.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/lexVOCCheck/lexVOCCheck.css b/force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.css
new file mode 100644
index 0000000..c068424
--- /dev/null
+++ b/force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.css
@@ -0,0 +1,10 @@
+.checkHolder{
+ 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/lexVOCCheck/lexVOCCheck.html b/force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.html
new file mode 100644
index 0000000..592cc85
--- /dev/null
+++ b/force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.html
@@ -0,0 +1,6 @@
+<template>
+ <div class="checkHolder" 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/lexVOCCheck/lexVOCCheck.js b/force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js
new file mode 100644
index 0000000..59e1cc3
--- /dev/null
+++ b/force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js
@@ -0,0 +1,110 @@
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init from '@salesforce/apex/ReportController.initForVOCCheckButton';
+import VOCCheck from '@salesforce/apex/ReportController.updateForVOCCheckButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+
+export default class LexVOCCheck extends LightningElement {
+
+ @api recordId;
+ status;
+ isVOC;
+ personId;
+ profileId;
+ 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(){
+ console.log(this.recordId);
+ init({
+ recordId: this.recordId
+ }).then(result => {
+ console.log(result);
+ if (result != null) {
+
+ this.status = result.status;
+ this.isVOC = result.isVOC;
+ this.personId = result.personId;
+ this.profileId = result.profileId;
+ console.log(this.status);
+ this.check();
+ //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(() => {
+
+ });
+ }
+
+
+ updateRecordView(recordId) {
+ updateRecord({fields: { Id: recordId }});
+ }
+
+ showToast(msg, type) {
+ const event = new ShowToastEvent({
+ title: "",
+ message: msg,
+ variant: type
+ });
+ this.dispatchEvent(event);
+ }
+
+ check (){
+ // 闄嗚儨锛岃儭杩畨锛岀郴缁熺鐞嗗憳鍙偣(闇�瑕佽皟鏁�)
+ if (UserInfo_Owner.Id != "00510000000gWAE" && UserInfo_Owner.Id != "00510000004reg2" && this.profileId != "00e10000000Y3o5AAC") {
+ this.showToast("浣犳病鏈夊垽瀹歏OC鐨勬潈闄�","error");
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ if (this.status != "璺熻繘涓�") {
+ this.showToast("涓嶆槸璺熻繘涓笉鑳界偣鍑�","error");
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ if (this.isVOC == undefined) {
+ this.showToast("蹇呴』閫夋嫨鏄惁VOC","error");
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ VOCCheck(
+ {
+ recordId:this.recordId,
+ isVOC:this.isVOC,
+ personId:this.personId
+ }
+ ).then(result =>{
+ if(result == null){
+ this.showToast("鎴愬姛","success");
+ this.updateRecordView(this.recordId);
+ }else {
+ this.showToast(result,"error");
+ }
+ this.Isloading = false;
+ this.dispatchEvent(new CloseActionScreenEvent());
+ });
+
+ //location.reload();
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js-meta.xml b/force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.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/lexVOCConfirm/lexVOCConfirm.css b/force-app/main/default/lwc/lexVOCConfirm/lexVOCConfirm.css
new file mode 100644
index 0000000..68704c6
--- /dev/null
+++ b/force-app/main/default/lwc/lexVOCConfirm/lexVOCConfirm.css
@@ -0,0 +1,10 @@
+.confirmHolder{
+ 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/lexVOCConfirm/lexVOCConfirm.html b/force-app/main/default/lwc/lexVOCConfirm/lexVOCConfirm.html
new file mode 100644
index 0000000..fd0bc74
--- /dev/null
+++ b/force-app/main/default/lwc/lexVOCConfirm/lexVOCConfirm.html
@@ -0,0 +1,6 @@
+<template>
+ <div class="confirmHolder" 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/lexVOCConfirm/lexVOCConfirm.js b/force-app/main/default/lwc/lexVOCConfirm/lexVOCConfirm.js
new file mode 100644
index 0000000..b364850
--- /dev/null
+++ b/force-app/main/default/lwc/lexVOCConfirm/lexVOCConfirm.js
@@ -0,0 +1,104 @@
+/*
+ * @Description:
+ * @version:
+ * @Author: chen jing wu
+ * @Date: 2023-03-27 14:08:56
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-10 17:49:00
+ */
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { NavigationMixin } from 'lightning/navigation';
+import init from '@salesforce/apex/ReportController.initForVOCConfirmButton';
+import updateForVOCConfirmButton from '@salesforce/apex/ReportController.updateForVOCConfirmButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class LexVOCConfirm extends LightningElement {
+ @api recordId;
+ status;
+ VOCSatisfy;
+ VOCSatisfy1;
+ 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(){
+ console.log(this.recordId);
+ init({
+ recordId: this.recordId
+ }).then(result => {
+ console.log(result);
+ if (result != null) {
+ this.status = result.status;
+ this.VOCSatisfy = result.Satisfy;
+ this.VOCSatisfy1 = result.Satisfy1;
+ console.log(this.VOCSatisfy);
+ console.log(this.VOCSatisfy1);
+ console.log(this.status);
+ this.update();
+ }
+ }).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) {
+ updateRecord({fields: { Id: recordId }});
+ }
+
+ showToast(msg,type) {
+ const event = new ShowToastEvent({
+ title: '',
+ message: msg,
+ variant: type
+ });
+ this.dispatchEvent(event);
+ }
+
+
+ update(){
+ if (this.status != "宸插洖绛�") {
+ this.showToast("涓嶆槸宸插洖绛斾笉鑳界偣鍑�","error");
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ if (this.VOCSatisfy == undefined) {
+ this.showToast("璇烽�夋嫨鏄惁婊℃剰","error");
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ updateForVOCConfirmButton({
+ recordId: this.recordId,
+ Satisfy: this.VOCSatisfy,
+ Satisfy1: this.VOCSatisfy1
+ }).then(result=>{
+ 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/lexVOCConfirm/lexVOCConfirm.js-meta.xml b/force-app/main/default/lwc/lexVOCConfirm/lexVOCConfirm.js-meta.xml
new file mode 100644
index 0000000..8b2c3d6
--- /dev/null
+++ b/force-app/main/default/lwc/lexVOCConfirm/lexVOCConfirm.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/lexVOCFinish/lexVOCFinish.css b/force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.css
new file mode 100644
index 0000000..83026d9
--- /dev/null
+++ b/force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.css
@@ -0,0 +1,10 @@
+.vocFinishHolder{
+ 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/lexVOCFinish/lexVOCFinish.html b/force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.html
new file mode 100644
index 0000000..308b1e2
--- /dev/null
+++ b/force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.html
@@ -0,0 +1,6 @@
+<template>
+ <div class="vocFinishHolder" 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/lexVOCFinish/lexVOCFinish.js b/force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.js
new file mode 100644
index 0000000..44d128d
--- /dev/null
+++ b/force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.js
@@ -0,0 +1,94 @@
+/*
+ * @Description:
+ * @version:
+ * @Author: chen jing wu
+ * @Date: 2023-03-27 14:11:17
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-10 17:52:00
+ */
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init from '@salesforce/apex/ReportController.initForVOCFinishButton';
+import update from '@salesforce/apex/ReportController.updateForVOCFinishButton';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class LexVOCFinish extends LightningElement {
+ @api recordId;
+ status;
+ IsLoading = true;
+ 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(){
+ console.log(this.recordId);
+ init({
+ recordId: this.recordId
+ }).then(result => {
+ console.log(result);
+ if (result != null) {
+ this.status = result.status;
+ this.profileId = result.profileId;
+ this.VOCFinish();
+ }
+ }).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);
+ }
+
+ showToast(msg,type) {
+ const event = new ShowToastEvent({
+ title: '',
+ message: msg,
+ variant: type
+ });
+ this.dispatchEvent(event);
+ }
+
+
+ updateRecordView(recordId) {
+ updateRecord({fields: { Id: recordId }});
+ }
+
+ VOCFinish () {
+ if (UserInfo_Owner.Id != "00510000000gWAE" && UserInfo_Owner.Id != "00510000004reg2" && this.profileId != "00e10000000Y3o5AAC") {
+ this.showToast("浣犳病鏈夊畬姣昖OC鐨勬潈闄�","error");
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ if (this.status != "缁撴灉纭瀹屾瘯") {
+ this.showToast("涓嶆槸缁撴灉纭瀹屾瘯涓嶈兘鐐瑰嚮","error");
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ update({
+ recordId: this.recordId
+ }).then(result =>{
+ this.showToast("鎴愬姛","success");
+ this.updateRecordView(this.recordId);
+ this.IsLoading = false;
+ this.dispatchEvent(new CloseActionScreenEvent());
+ });
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.js-meta.xml b/force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.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/lexVOCSubmit/lexVOCSubmit.css b/force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.css
new file mode 100644
index 0000000..4f256c3
--- /dev/null
+++ b/force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.css
@@ -0,0 +1,10 @@
+.vocSubmitHolder{
+ 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/lexVOCSubmit/lexVOCSubmit.html b/force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.html
new file mode 100644
index 0000000..cb84330
--- /dev/null
+++ b/force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.html
@@ -0,0 +1,6 @@
+<template>
+ <div class="vocSubmitHolder" 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/lexVOCSubmit/lexVOCSubmit.js b/force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.js
new file mode 100644
index 0000000..93f5e5f
--- /dev/null
+++ b/force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.js
@@ -0,0 +1,89 @@
+/*
+ * @Description:
+ * @version:
+ * @Author: chen jing wu
+ * @Date: 2023-03-27 13:39:23
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-10 17:57:16
+ */
+import { LightningElement,wire,track,api} from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init from '@salesforce/apex/ReportController.initForVOCSubmitButton';
+import VOCSubmit from '@salesforce/apex/ReportController.updateForVOCSubmitButton';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class LexVOCSubmit extends LightningElement {
+ @api recordId;
+ createdById;
+ status;
+ 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 () {
+ console.log(this.recordId);
+ init({
+ recordId: this.recordId
+ }).then(result => {
+ console.log(result);
+ if (result != null) {
+ this.status = result.status;
+ this.createdById = result.createdById;
+ this.Submit();
+ //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);
+ }
+
+ updateRecordView(recordId) {
+ updateRecord({fields: { Id: recordId }});
+ }
+
+ showToast(msg,type) {
+ const event = new ShowToastEvent({
+ title: '',
+ message: msg,
+ variant: type
+ });
+ this.dispatchEvent(event);
+ }
+
+ Submit () {
+ if (this.status != "鑽夋涓�") {
+ this.showToast("涓嶆槸鑽夋涓笉鑳界偣鍑�","error");
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ VOCSubmit({
+ recordId: this.recordId,
+ createdById: this.createdById
+ }).then(result =>{
+ this.showToast("鎴愬姛","success");
+ this.updateRecordView(this.recordId);
+ this.IsLoading = false;
+ this.dispatchEvent(new CloseActionScreenEvent());
+ });
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.js-meta.xml b/force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.js-meta.xml
new file mode 100644
index 0000000..329e839
--- /dev/null
+++ b/force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.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/lexYanshoudanRequest/__tests__/lexYanshoudanRequest.test.js b/force-app/main/default/lwc/lexYanshoudanRequest/__tests__/lexYanshoudanRequest.test.js
new file mode 100644
index 0000000..02e891b
--- /dev/null
+++ b/force-app/main/default/lwc/lexYanshoudanRequest/__tests__/lexYanshoudanRequest.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexYanshoudanRequest from 'c/lexYanshoudanRequest';
+
+describe('c-lex-yanshoudan-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-yanshoudan-request', {
+ is: LexYanshoudanRequest
+ });
+
+ // 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/lexYanshoudanRequest/lexYanshoudanRequest.html b/force-app/main/default/lwc/lexYanshoudanRequest/lexYanshoudanRequest.html
new file mode 100644
index 0000000..87f391a
--- /dev/null
+++ b/force-app/main/default/lwc/lexYanshoudanRequest/lexYanshoudanRequest.html
@@ -0,0 +1,6 @@
+<template>
+ <div class="exampleHolder" 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/lexYanshoudanRequest/lexYanshoudanRequest.js b/force-app/main/default/lwc/lexYanshoudanRequest/lexYanshoudanRequest.js
new file mode 100644
index 0000000..84fe55d
--- /dev/null
+++ b/force-app/main/default/lwc/lexYanshoudanRequest/lexYanshoudanRequest.js
@@ -0,0 +1,79 @@
+import {
+ LightningElement,
+ wire,
+ api
+} from 'lwc';
+import {
+ CurrentPageReference
+} from "lightning/navigation";
+import {
+ CloseActionScreenEvent
+} from 'lightning/actions';
+import init from '@salesforce/apex/otherButtonRepairController.init';
+import updateYanshoudan from '@salesforce/apex/otherButtonRepairController.updateYanshoudan';
+import {
+ ShowToastEvent
+} from 'lightning/platformShowToastEvent';
+
+export default class LexYanshoudanRequest extends LightningElement {
+ @api recordId;
+ str;
+ IsLoading = true;
+ Id;
+
+ @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);
+ if (result != null) {
+ this.IsLoading = false;
+ this.Id = result.Id;
+
+ this.YanshoudanRequest();
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }
+ }).catch(error => {
+ console.log(error);
+ }).finally(() => {
+
+ });
+ }
+
+ // 楠屾敹鍗曞洖鏀剁敵璇�
+ YanshoudanRequest() {
+ updateYanshoudan({
+ recordId: this.Id
+ }).then(result => {
+ console.log(result);
+ if (result.length > 0) {
+ var indexs = result.indexOf(": ")
+ var resolves = result.substring(indexs + 1, result.length);
+ alert(resolves);
+ }
+ location.reload();
+ })
+ }
+
+ // 寮圭獥
+ ShowToastEvent(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/lexYanshoudanRequest/lexYanshoudanRequest.js-meta.xml b/force-app/main/default/lwc/lexYanshoudanRequest/lexYanshoudanRequest.js-meta.xml
new file mode 100644
index 0000000..3392981
--- /dev/null
+++ b/force-app/main/default/lwc/lexYanshoudanRequest/lexYanshoudanRequest.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/oshRecieved/oshRecieved.css b/force-app/main/default/lwc/oshRecieved/oshRecieved.css
new file mode 100644
index 0000000..a612ca7
--- /dev/null
+++ b/force-app/main/default/lwc/oshRecieved/oshRecieved.css
@@ -0,0 +1,10 @@
+.VOCSubmitHolder{
+ 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/oshRecieved/oshRecieved.html b/force-app/main/default/lwc/oshRecieved/oshRecieved.html
new file mode 100644
index 0000000..1d3b62c
--- /dev/null
+++ b/force-app/main/default/lwc/oshRecieved/oshRecieved.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="VOCSubmitHolder" 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/oshRecieved/oshRecieved.js b/force-app/main/default/lwc/oshRecieved/oshRecieved.js
new file mode 100644
index 0000000..12ad641
--- /dev/null
+++ b/force-app/main/default/lwc/oshRecieved/oshRecieved.js
@@ -0,0 +1,83 @@
+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.initForOSHRecievedButton';
+import updateQis from '@salesforce/apex/QISReportController.updateQis';
+export default class oshRecieved extends LightningElement {
+ @api recordId;
+ IsLoading = true;
+ qisReportId;
+ qisStatus;
+ @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;
+ console.log('this.qisStatus='+this.qisStatus);
+ if (this.qisStatus!='OSH妫�娴嬬敵璇�' && this.qisStatus!='瀹屾瘯') {
+ 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!='鎴愬姛') {
+ const evt = new ShowToastEvent({
+ title : '鏇存柊澶辫触',
+ message: result,
+ 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/oshRecieved/oshRecieved.js-meta.xml b/force-app/main/default/lwc/oshRecieved/oshRecieved.js-meta.xml
new file mode 100644
index 0000000..35ad9fc
--- /dev/null
+++ b/force-app/main/default/lwc/oshRecieved/oshRecieved.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="oshRecieved">
+ <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/qisUniversalFailureCode/qisUniversalFailureCode.css b/force-app/main/default/lwc/qisUniversalFailureCode/qisUniversalFailureCode.css
new file mode 100644
index 0000000..66b51b5
--- /dev/null
+++ b/force-app/main/default/lwc/qisUniversalFailureCode/qisUniversalFailureCode.css
@@ -0,0 +1,10 @@
+.exampleHolder{
+ 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/qisUniversalFailureCode/qisUniversalFailureCode.html b/force-app/main/default/lwc/qisUniversalFailureCode/qisUniversalFailureCode.html
new file mode 100644
index 0000000..33549d5
--- /dev/null
+++ b/force-app/main/default/lwc/qisUniversalFailureCode/qisUniversalFailureCode.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="exampleHolder" 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/qisUniversalFailureCode/qisUniversalFailureCode.js b/force-app/main/default/lwc/qisUniversalFailureCode/qisUniversalFailureCode.js
new file mode 100644
index 0000000..4e4a05c
--- /dev/null
+++ b/force-app/main/default/lwc/qisUniversalFailureCode/qisUniversalFailureCode.js
@@ -0,0 +1,63 @@
+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.initForQisUniversalFailureCodeButton';
+import sqlForPAE from '@salesforce/apex/QISReportController.sqlForPAE';
+
+export default class qisUniversalFailureCode extends LightningElement {
+ @api recordId;
+ IsLoading = true;
+ qisReportId;
+ paeId;
+ @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);
+ if (result != null) {
+ this.IsLoading = false;
+ this.qisReportId = result.Id;
+ var RecordTypeId = "ASACDecision";
+ sqlForPAE({
+ qisReportId: this.qisReportId
+ }).then(result => {
+ if (result!=null) {
+ this.paeId = result.PAEid;
+ console.log('result='+this.paeId);
+ }
+ var url = '';
+ if (result!=null&&result.length>0){
+ url = "/apex/PAEDecisionRecord?Id="+this.paeId+"&QISReportId="+this.qisReportId +"&RecordTypeIds="+RecordTypeId ;
+ } else {
+ url = "/apex/PAEDecisionRecord?QISReportId="+this.qisReportId +"&RecordTypeIds="+RecordTypeId;
+ }
+ console.log('url='+url);
+ // window.open(url,'_self');
+ window.location.replace(url);
+ });
+ }
+ }).catch(error => {
+ console.log('error='+error);
+ }).finally(() => {
+
+ });
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/qisUniversalFailureCode/qisUniversalFailureCode.js-meta.xml b/force-app/main/default/lwc/qisUniversalFailureCode/qisUniversalFailureCode.js-meta.xml
new file mode 100644
index 0000000..f9e530d
--- /dev/null
+++ b/force-app/main/default/lwc/qisUniversalFailureCode/qisUniversalFailureCode.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="qisUniversalFailureCode">
+ <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/sfdx-project.json b/sfdx-project.json
index ce080c1..0cf9ccc 100644
--- a/sfdx-project.json
+++ b/sfdx-project.json
@@ -7,6 +7,6 @@
],
"name": "Olympuslightning",
"namespace": "",
- "sfdcLoginUrl": "https://login.salesforce.com",
+ "sfdcLoginUrl": "https://test.salesforce.com",
"sourceApiVersion": "56.0"
}
--
Gitblit v1.9.1