高章伟
2022-03-10 1312ba82d4c880bdb5357d28e0d4af5b285f610f
最近一月修改内容
106个文件已修改
70个文件已添加
11805 ■■■■ 已修改文件
force-app/main/default/aura/DealerPersonnelInformationImport/DealerPersonnelInformationImport.cmp 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/DealerPersonnelInformationImport/DealerPersonnelInformationImportHelper.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReport.cmp 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReportHelper.js 51 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/WeeklyReport/WeeklyReport.cmp 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/AccAssumeChangeBatch.cls 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ApplicationForCAHandler.cls 88 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/BatchSelectRepairPageController.cls 79 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/BatchSelectRepairPageControllerTest.cls 87 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/CampaignCreateController.cls 206 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/CampaignTriggerBefInsHandler.cls 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ChoiceAssetController.cls 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ConsumAutoSelectBatch.cls 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ConsumDefaultSelectController.cls 51 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ConsumEquipmentSetReturnController.cls 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ConsumEquipmentSetShipmentController.cls 1341 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ConsumEquipmentSetShipmentControllerTest.cls 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ContactTriggerHandler.cls 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/CreateNewMaintenanceTaskBatch.cls 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/CreateOpportunityTaskBatch.cls 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/DealerPersonnelController.cls 141 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/DealerPersonnelControllerTest.cls 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/DealerPersonnelControllerTest.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/EquipmentRealCoverageBatch.cls 193 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/EquipmentRealCoverageBatch.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/EquipmentRealCoverageBatchTest.cls 235 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/EquipmentRealCoverageBatchTest.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/EquipmentRenewBatch.cls 133 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/EquipmentRenewBatch.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/EquipmentRenewBatchTest.cls 213 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/EquipmentRenewBatchTest.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/EquipmentSetShippmentReceived1Controller.cls 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/EquipmentSetShippmentReceived2Controller.cls 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/EquipmentSetShippmentReceived3Controller.cls 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/EquipmentSetShippmentReceived3CtrlTest.cls 602 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/EquipmentTargetCoverageBatch.cls 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/EquipmentTargetCoverageBatch.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/EventToProjectSummaryBatch.cls 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/EventToProjectSummaryBatch.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/FixtureUtil.cls 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/FollowTriggerHandler.cls 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/FollowTriggerHandler.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/InquiryVerifyBatch.cls 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/InquiryVerifyBatchTest.cls 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/InventoryHeaderCopyHandler.cls 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/InventoryResultRecordCopyController.cls 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/InventoryResultRecordCopyControllerTest.cls 418 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/InventoryResultRecordCopyControllerTest.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/InventorySendMailBatch.cls 62 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/InventoryStartAssetSnapshotCopyBatch.cls 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/InventoryStartAssetSnapshotCopyBatchTest.cls 1444 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/InventoryStartAssetSnapshotCopyBatchTest.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/KPIPreviewScheduel.cls 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/KPIPreviewScheduel.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LastbuyProductHandler.cls 188 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LastbuyProductHandlerTest.cls 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LightningUtil.cls 65 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LightningUtilTest.cls 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/MaintenanceCommissionPDFController.cls 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/MeetingDelayApplyTriggerHandler.cls 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM105Rest.cls 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM114RestTest.cls 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM115ControllerTest.cls 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM202Controller.cls 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM203Rest.cls 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM401Controller.cls 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM603Controller.cls 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM606Controller.cls 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM608Rest.cls 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM620Rest.cls 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM701ControllerHandler.cls 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM701ControllerHandlerTest.cls 136 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM701ControllerHandlerTest.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM702WebService.cls 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM702WebService.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM702WebServiceTest.cls 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM702WebServiceTest.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM703Controller.cls 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM704Rest.cls 169 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM705Rest.cls 407 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM705RestTest.cls 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM707Rest.cls 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFMUtil.cls 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NewQuoteEntryController.cls 118 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NewQuoteIraiController.cls 109 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/OFSCalendarController.cls 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/OrderListHandlerTest.cls 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/OrdergoodsControllerTest.cls 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/PersonalCalendarController.cls 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/QuotePDFExtensionController.cls 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/RentalApplyEquipmentSetDetailHandler.cls 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/RentalApplySplitController.cls 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/RentalApplyWebService.cls 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/RentalFixtureSetAssignAgencyControTest.cls 295 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/RentalFixtureSetAssignAgencyController.cls 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/RentalFixtureSetAssignController.cls 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/RetrospectiveWeeklyReportController.cls 155 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/RetrospectiveWeeklyReportTest.cls 499 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/RetrospectiveWeeklyReportTest.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/SI_NewQuoteEntryController.cls 116 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/SampleInventoryControllerTest.cls 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/SampleInventorySectionControllerTest.cls 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/SelectAssetEstimateVMController.cls 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/SimpleEventRegisterController.cls 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/StaticParameter.cls 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/StatusPageController.cls 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/StatusPageControllerTest.cls 352 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/StatusPageControllerTest.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/TaskObjectTriggerHandle.cls 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/TenderDeleteLwcController.cls 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/TenderWebService.cls 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/UploadOBPMController.cls 88 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/UploadOBPMControllerTest.cls 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/UploadOBPMControllerTest.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/WeeklyReportCmp.cls 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/WeeklyReportCmpTest.cls 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/updateESignBatch.cls 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/Account_Service_Of_Target__c/fields/Renew_Coverage_Correlation__c.field-meta.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/Account_Service_Of_Target__c/fields/Renew_Finish_Rigid_Mirror_1__c.field-meta.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/Account_Service_Of_Target__c/fields/Renew_Finish_Rigid_Mirror_2__c.field-meta.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/Account_Service_Of_Target__c/fields/Renew_Target_Correlation_Lightsource__c.field-meta.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/Account_Service_Of_Target__c/fields/Renew_Target_Rigid_Mirror_2__c.field-meta.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/Account_Service_Of_Target__c/fields/Renew_Target_Soft_Mirror_2__c.field-meta.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/Agency_Report__c/fields/SupportNeeds__c.field-meta.xml 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/Agency_Report__c/fields/WarlockClassification__c.field-meta.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/Application_for_Conference_Adjudication__c/fields/Adjudication_Owner_Num__c.field-meta.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/Application_for_Conference_Adjudication__c/fields/Adjudication_Owner__c.field-meta.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/Application_for_Conference_Adjudication__c/fields/Applicant_Dep__c.field-meta.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/Application_for_Conference_Adjudication__c/sharingReasons/Shared_Editor__c.sharingReason-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/BatchIF_Log__c/listViews/NFM_702.listView-meta.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/Consum_Apply_Equipment_Set_Detail__c/fields/demo_purpose2__c.field-meta.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/FieldClassification__c/FieldClassification__c.object-meta.xml 164 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/FieldClassification__c/fields/ET_ENG_classification__c.field-meta.xml 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/FieldClassification__c/fields/EffectProgress__c.field-meta.xml 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/FieldClassification__c/fields/ProductCcategory__c.field-meta.xml 105 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/FieldClassification__c/fields/ProductClassification__c.field-meta.xml 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/FieldClassification__c/fields/WarlockClassification__c.field-meta.xml 100 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/FieldClassification__c/fields/WorkRecord__c.field-meta.xml 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/FieldClassification__c/fields/classification__c.field-meta.xml 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/FieldClassification__c/fields/productCategories__c.field-meta.xml 105 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/Inquiry_form__c/fields/Follow_Date__c.field-meta.xml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/Inquiry_form__c/fields/No_Need_Date__c.field-meta.xml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/Inquiry_form__c/fields/lead_Num__c.field-meta.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/Inventory_Header_Copy__c/webLinks/ClearStatus.webLink-meta.xml 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/Inventory_Header__c/listViews/Viewguangdong.listView-meta.xml 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/LastbuyProduct__c/fields/RemainingNumber__c.field-meta.xml 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/LastbuyProduct__c/validationRules/yuliudayu.validationRule-meta.xml 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/Maintenance_Contract__c/fields/Equipment_Last_Money__c.field-meta.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/Rental_Apply_Equipment_Set_Detail__c/fields/ApplyToShipmentWorkTime__c.field-meta.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/meeting_delay_apply__c/fields/IF_Approved_Old__c.field-meta.xml 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/objects/meeting_delay_apply__c/fields/MeetingApproved__c.field-meta.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/BatchSelectRepairPage.page 235 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/CampaignCreate.page 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/CampaignMember.page 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/ConsumEquipmentSetReceived.page 130 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/ConsumEquipmentSetShipment.page 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/ContractDetailPDF.page 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/DirectAssign.page 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/EquipmentSetShippmentReceived2.page 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/FollowPage.page 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/InventoryReport.page 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/InventoryResultRecordCopy.page 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/LostReportEdit.page 54 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/LostReportEditAsset.page 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/MaintenanceCommissionPDF.page 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/Ordergoods.page 576 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/StatusPage.page 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/UploadOBPM.page 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/triggers/AccountTrigger.trigger 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/triggers/ConsumableOrderDetail2Trigger.trigger 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/triggers/FollowTrigger.trigger 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/triggers/FollowTrigger.trigger-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/triggers/NFM007.trigger 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/triggers/OpportunityBefUpd.trigger 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/triggers/Repair.trigger 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/aura/DealerPersonnelInformationImport/DealerPersonnelInformationImport.cmp
@@ -64,7 +64,7 @@
<div >
    <div class="slds-modal__header ">
        <h4 id="headerTarget" class="slds-float--left"></h4>
        <h2 id="headerTarget" class="slds-text-heading--medium">周报批量导入</h2>
        <h2 id="headerTarget" class="slds-text-heading--medium">客户人员批量导入</h2>
    </div>
    <div class="slds-modal__content slds-scrollable slds-grow slds-p-around--medium ">
        <aura:if isTrue="{!v.showMain}">
force-app/main/default/aura/DealerPersonnelInformationImport/DealerPersonnelInformationImportHelper.js
@@ -145,7 +145,7 @@
        window.setTimeout($A.getCallback(function () {
            $A.util.addClass(component.find('errorDiv'), 'slds-hide');
        }),
            3000
            4000
        );
    },
    success : function(message) {
force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReport.cmp
@@ -509,10 +509,10 @@
                            <ui:inputText aura:id="select_ConsumptionOfConsumables" class="slds-select"
                                change="{!c.select_ConsumptionOfConsumables}" />
                        </div>
                        <!-- 术士分类   OtherBrandConsumables__c   -->
                        <!-- 术士分类   WarlockClassification__c   -->
                        <div
                            class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6">
                            {!v.fieldsmap.OtherBrandConsumables__c}
                            {!v.fieldsmap.WarlockClassification__c}
                            <ui:inputSelect aura:id="select_OtherBrandConsumables" class="slds-select" />
                        </div>
                        <!-- 已采用其他品牌   ProductCcategory__c -->
force-app/main/default/aura/RetrospectiveWeeklyReport/RetrospectiveWeeklyReportHelper.js
@@ -237,14 +237,14 @@
                var report_id = component.get('v.edit_copy_select_report_id');
                if (report_id != "") {
                    var select_EffectProgress1 = '';
                    var OtherBrandConsumables = '';
                    var WarlockClassification = '';
                    var ProductCcategory = '';
                    var productCategories = '';
                    var i = 0;
                    for (i = 0; i < reports.length; i++) {
                        if (report_id == reports[i]["Id"]) {
                            select_EffectProgress1 = reports[i]["EffectProgress__c"];
                            OtherBrandConsumables = reports[i]["OtherBrandConsumables__c"];
                            WarlockClassification = reports[i]["WarlockClassification__c"];
                            ProductCcategory = reports[i]["ProductCcategory__c"];
                            productCategories = reports[i]["productCategories__c"];
                                break;
@@ -255,8 +255,8 @@
                        component.find('select_EffectProgress').set('v.value', select_EffectProgress1);
                    }
                    //术士分类
                    if (OtherBrandConsumables != null && OtherBrandConsumables != '') {
                        component.find('select_OtherBrandConsumables').set('v.value', OtherBrandConsumables);
                    if (WarlockClassification != null && WarlockClassification != '') {
                        component.find('select_OtherBrandConsumables').set('v.value', WarlockClassification);
                    }
                    //已采用其他品牌
                    if (ProductCcategory != null && ProductCcategory != '') {
@@ -283,7 +283,7 @@
            var doctor2__c = component.find('select_doctor').get('v.value');
            var WorkRecord__c = component.find('select_purpose_type').get('v.value');
            var EffectProgress__c = component.find('select_EffectProgress').get('v.value');
            var OtherBrandConsumables__c = component.find('select_OtherBrandConsumables').get('v.value');
            var WarlockClassification__c = component.find('select_OtherBrandConsumables').get('v.value');
            var ProductCcategory__c = component.find('select_ProductCcategory').get('v.value');
            var productCategories__c = component.find('select_productCategories').get('v.value');
            var warlocksNumber__c = component.find('select_warlocksNumber').get('v.value');
@@ -301,7 +301,7 @@
                    !DealerPersonnel__c &&
                    !doctor2__c &&
                    !EffectProgress__c &&
                    !OtherBrandConsumables__c &&
                    !WarlockClassification__c &&
                    !ProductCcategory__c &&
                    !productCategories__c &&
                    !warlocksNumber__c &&
@@ -327,7 +327,7 @@
                    select_report_data['DealerPersonnel__c'] == DealerPersonnel__c &&
                    select_report_data['doctor2__c'] == doctor2__c &&
                    select_report_data['EffectProgress__c'] == EffectProgress__c &&
                    select_report_data['OtherBrandConsumables__c'] == OtherBrandConsumables__c &&
                    select_report_data['WarlockClassification__c'] == WarlockClassification__c &&
                    select_report_data['ProductCcategory__c'] == ProductCcategory__c &&
                    select_report_data['productCategories__c'] == productCategories__c &&
                    select_report_data['warlocksNumber__c'] == warlocksNumber__c &&
@@ -352,7 +352,7 @@
                    select_report_data['DealerPersonnel__c'] == DealerPersonnel__c &&
                    select_report_data['doctor2__c'] == doctor2__c &&
                    select_report_data['EffectProgress__c'] == EffectProgress__c &&
                    select_report_data['OtherBrandConsumables__c'] == OtherBrandConsumables__c &&
                    select_report_data['WarlockClassification__c'] == WarlockClassification__c &&
                    select_report_data['ProductCcategory__c'] == ProductCcategory__c &&
                    select_report_data['productCategories__c'] == productCategories__c &&
                    select_report_data['warlocksNumber__c'] == warlocksNumber__c &&
@@ -512,8 +512,8 @@
        var EffectProgress__c = component.find('select_EffectProgress').get('v.value');
         // 科室同来耗材月使用量   ConsumptionOfConsumables__c      
        var ConsumptionOfConsumables__c = component.find('select_ConsumptionOfConsumables').get('v.value');
         // 术士分类   OtherBrandConsumables__c
        var OtherBrandConsumables__c = component.find('select_OtherBrandConsumables').get('v.value');
         // 术士分类   WarlockClassification__c
        var WarlockClassification__c = component.find('select_OtherBrandConsumables').get('v.value');
          // 已采用其他品牌   ProductCcategory__c  
        var ProductCcategory__c = component.find('select_ProductCcategory').get('v.value');
           // 其他品牌产品类别   productCategories__c  
@@ -563,7 +563,7 @@
        if (!EffectProgress__c) { error.push("效果/进度 不存在"); } 
        // if (!OtherBrandConsumables__c) { error.push("术士分类 不存在"); }
        if (!ProductCcategory__c) { error.push("已采用其他品牌  不存在"); }
        if (!productCategories__c) { error.push("产品类别 不存在"); }
        // if (!productCategories__c) { error.push("其他品牌产品类别 不存在"); }
        if (!ConsumptionOfConsumables__c) { error.push("科室同类耗材月使用量 不能为空"); }
        if (!warlocksNumber__c) { error.push("产品用量 不能为空"); }
        for (var i = 0; i < error.length; i++) {
@@ -585,7 +585,7 @@
                "ConsumptionOfConsumables": ConsumptionOfConsumables__c,
                "WorkRecord": WorkRecord__c,
                "EffectProgress": EffectProgress__c,
                "OtherBrandConsumables" : OtherBrandConsumables__c,
                "WarlockClassification" : WarlockClassification__c,
                "ProductCcategory" : ProductCcategory__c,
                "productCategories" : productCategories__c,
                "warlocksNumber" : warlocksNumber__c,
@@ -646,7 +646,7 @@
                "DealerPersonnel": DealerPersonnel__c,
                "ProductCcategory" : ProductCcategory__c,
                "productCategories" : productCategories__c,
                "OtherBrandConsumables" : OtherBrandConsumables__c,
                "WarlockClassification" : WarlockClassification__c,
                "ProductClassification": ProductClassification__c,
                "WorkRecord": WorkRecord__c,
                "EffectProgress": EffectProgress__c,
@@ -1441,7 +1441,7 @@
        }
        columnDivider = ',';
        lineDivider = '\n';
        keys = ['Submit_date__c', 'Person_In_Charge2__c', 'Report_Date__c', 'Agency_Hospital__c','Department_Cateogy__c','DealerPersonnel__c','WorkRecord__c','doctor2__c','ProductClassification__c','UseProduct1__c', 'UseProduct2__c','UseProduct3__c', 'EffectProgress__c','ConsumptionOfConsumables__c',  'OtherBrandConsumables__c', 'ProductCcategory__c', 'productCategories__c','warlocksNumber__c','WorkMark__c'];
        keys = ['Submit_date__c', 'Person_In_Charge2__c', 'Report_Date__c', 'Agency_Hospital__c','Department_Cateogy__c','DealerPersonnel__c','WorkRecord__c','doctor2__c','ProductClassification__c','UseProduct1__c', 'UseProduct2__c','UseProduct3__c', 'EffectProgress__c','ConsumptionOfConsumables__c',  'WarlockClassification__c', 'ProductCcategory__c', 'productCategories__c','warlocksNumber__c','WorkMark__c'];
        thkeys = ['周', '担当', '活动日', '医院', '科室', '经销商人员', '工作记录',  '医院人员','产品分类(第三分类)', '使用产品1(产品型号)', '使用产品2','使用产品3','效果/进度','科室同类耗材月使用量','术士分类','已采用其他品牌','其他品牌产品类别','产品用量','工作标记']
        csvStringResult = '';
        csvStringResult += thkeys.join(columnDivider);
@@ -1473,13 +1473,13 @@
                } else if (skey == 'UseProduct3__c') {
                    csvStringResult +=  objectRecords[i].UseProduct3__r.Name;
                } else if (skey == 'EffectProgress__c'){
                    csvStringResult +=  objectRecords[i].EffectProgress__r.Name;
                }else if (skey == 'OtherBrandConsumables__c'){
                    csvStringResult +=  objectRecords[i].OtherBrandConsumables__r.Name;
                    csvStringResult +=  objectRecords[i].EffectProgress__r.EffectProgress__c;
                }else if (skey == 'WarlockClassification__c'){
                    csvStringResult +=  objectRecords[i].WarlockClassification__r.WarlockClassification__c;
                }else if(skey == 'ProductCcategory__c'){
                    csvStringResult +=  objectRecords[i].ProductCcategory__r.Name;
                    csvStringResult +=  objectRecords[i].ProductCcategory__r.ProductCcategory__c;
                }else if(skey == 'productCategories__c'){
                    csvStringResult +=  objectRecords[i].productCategories__r.Name;
                    csvStringResult +=  objectRecords[i].productCategories__r.productCategories__c;
                }else{
                    csvStringResult +=  objectRecords[i][skey] ;
                }
@@ -1493,7 +1493,7 @@
    //  导出页面显示的模板
    showExportDate: function (component, objectRecords) {
        console.log('进入showexceportdate' + objectRecords);
        var keys = ['Submit_date__c', 'Person_In_Charge2__c', 'Report_Date__c', 'Agency_Hospital__c','Department_Cateogy__c','DealerPersonnel__c','WorkRecord__c','doctor2__c','ProductClassification__c','UseProduct1__c', 'UseProduct2__c','UseProduct3__c', 'EffectProgress__c','ConsumptionOfConsumables__c',  'OtherBrandConsumables__c', 'ProductCcategory__c','productCategories__c', 'warlocksNumber__c','WorkMark__c'];
        var keys = ['Submit_date__c', 'Person_In_Charge2__c', 'Report_Date__c', 'Agency_Hospital__c','Department_Cateogy__c','DealerPersonnel__c','WorkRecord__c','doctor2__c','ProductClassification__c','UseProduct1__c', 'UseProduct2__c','UseProduct3__c', 'EffectProgress__c','ConsumptionOfConsumables__c',  'WarlockClassification__c', 'ProductCcategory__c','productCategories__c', 'warlocksNumber__c','WorkMark__c'];
        var headers = ['周', '担当', '活动日', '医院', '科室', '经销商人员', '工作记录',  '医院人员','产品分类(第三分类)', '使用产品1(产品型号)', '使用产品2','使用产品3','效果/进度','科室同类耗材月使用量','术士分类','已采用其他品牌','其他品牌产品类别','产品用量','工作标记']
        var content = "<table class=\"table slds-table slds-table--bordered slds-table--cell-buffer\">";
        content += "<thead><tr class=\"slds-text-title--caps\">";
@@ -1527,13 +1527,13 @@
                } else if (skey == 'UseProduct3__c') {
                    content += '<td>' + objectRecords[i].UseProduct3__r.Name + '</td>';
                } else if (skey == 'EffectProgress__c'){
                    content += '<td>' + objectRecords[i].EffectProgress__r.Name + '</td>';
                }else if (skey == 'OtherBrandConsumables__c'){
                    content += '<td>' + objectRecords[i].OtherBrandConsumables__r.Name + '</td>';
                    content += '<td>' + objectRecords[i].EffectProgress__r.EffectProgress__c + '</td>';
                }else if (skey == 'WarlockClassification__c'){
                    content += '<td>' + objectRecords[i].WarlockClassification__r.WarlockClassification__c + '</td>';
                }else if (skey == 'ProductCcategory__c'){
                    content += '<td>' + objectRecords[i].ProductCcategory__r.Name + '</td>';
                    content += '<td>' + objectRecords[i].ProductCcategory__r.ProductCcategory__c + '</td>';
                }else if (skey == 'productCategories__c'){
                    content += '<td>' + objectRecords[i].productCategories__r.Name + '</td>';
                    content += '<td>' + objectRecords[i].productCategories__r.productCategories__c + '</td>';
                }else{
                    content += '<td>' + objectRecords[i][skey] + '</td>';
                }
@@ -1703,6 +1703,7 @@
    //工作会记录
    selectPurposeType: function (component,event,helper) {
        var doctor_value = component.find('select_purpose_type').get('v.value');
        alert(doctor_value);
        if(doctor_value != ''){
        var action = component.get('c.selectPurposeTypes');
        action.setParams({
force-app/main/default/aura/WeeklyReport/WeeklyReport.cmp
@@ -343,7 +343,6 @@
                            {!v.fieldsmap.visitor_title__c}
                            <div>{!v.doctor_title}</div>
                        </div>
                        <!-- 活动区分 -->
                        <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6">
                            {!v.fieldsmap.Purpose_Type__c}
@@ -410,7 +409,13 @@
                            <!-- <force:inputField value="{!v.data.Product_Category3__c}" aura:id="input-product-category3"/> -->
                            <ui:inputSelect aura:id="select_Product3" class="slds-select" change="{!c.productcategoryChange3}"/>
                        </div>
                        <!--SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start-->
                        <!-- 支援需求 -->
                        <div class="slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--1-of-5 slds-large-size--1-of-6">
                            {!v.fieldsmap.SupportNeeds__c}
                            <ui:inputSelect aura:id="SupportNeeds__c" class="slds-select" change="{!c.SupportNeeds__c}"/>
                        </div>
                        <!--SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 end-->
                        <div aura:id="result" class="disp_none slds-p-horizontal--small slds-size--1-of-1 slds-medium-size--3-of-12 slds-large-size--3-of-12">
                            {!v.fieldsmap.Result__c}
                            <ui:inputSelect aura:id="select_result" class="slds-select"/>
force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js
@@ -17,6 +17,9 @@
                component.find('select_purpose_type').set('v.options', this.conv_selected(res.allselectlist.Purpose_Type__c));
                component.find('select_result').set('v.options', this.conv_selected(res.allselectlist.Result__c));
                component.find('select_stageName').set('v.options', this.conv_selected(res.allselectlist.StageName__c));
                //SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start
                component.find('SupportNeeds__c').set('v.options', this.conv_selected(res.allselectlist.SupportNeeds__c));
                //SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 end
                component.set('v.selected_agency_person', res.allselectlist.AgencyPerson__c[0].label);
                component.set('v.dialog_type', '新建');
                
@@ -524,6 +527,10 @@
        
        // 活动区分 Purpose_Type__c
        var Purpose_Type__c = component.find('select_purpose_type').get('v.value');
        //SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start
        // 支援需求 SupportNeeds__c
        var SupportNeeds__c = component.find('SupportNeeds__c').get('v.value');
        //SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 end
        // 询价 Opportunity__c
        var Opportunity__c = component.get('v.data.Opportunity__c');
@@ -572,6 +579,7 @@
        if (!Department_Cateogy__c) { error.push("科室 不存在"); }
        if (!doctor2__c) { error.push("拜访人 不存在"); }
        if (!Purpose_Type__c) { error.push("活动区分 不存在"); }
        if (!SupportNeeds__c) { error.push("支援需求 不存在"); }
        if (!Opportunity__c) { Opportunity__c = ""; }
        if (!Product_Category1__c) { error.push("产品区分1 不存在"); }
        if (Purpose_Type__c && (Purpose_Type__c.substr(-3) == 'SIS' || Purpose_Type__c.substr(-3) == 'OPD')) {
@@ -591,10 +599,14 @@
        if (component.get('v.mode') == 'edit') {
            var Agency_Report__c = component.get('v.select_report_data').Id;
            var action = component.get('c.editAgencyReport');
            alert("Purpose_Type:"+Purpose_Type__c+","+"SupportNeedsc:"+SupportNeeds__c);
            action.setParams({
                "Agency_Report_Id" : Agency_Report__c,
                "Department_Cateogy" : Department_Cateogy__c,
                "Purpose_Type" : Purpose_Type__c,
                //SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start
                "SupportNeedsc" : SupportNeeds__c,
                //SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 end
                "Agency_Report_Header" : Agency_Report_Header__c,
                "Agency_Hospital" : Agency_Hospital__c,
                "Person_In_Charge2" : Person_In_Charge2__c,
@@ -658,6 +670,9 @@
            action.setParams({
                "Department_Cateogy" : Department_Cateogy__c,
                "Purpose_Type" : Purpose_Type__c,
                //SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start
                "SupportNeedsc" : SupportNeeds__c,
                //SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 end
                "Agency_Report_Header" : Agency_Report_Header__c,
                "Agency_Hospital" : Agency_Hospital__c,
                "Person_In_Charge2" : Person_In_Charge2__c,
force-app/main/default/classes/AccAssumeChangeBatch.cls
@@ -12,8 +12,7 @@
    global AccAssumeChangeBatch() {
    }
    global Database.QueryLocator start(Database.BatchableContext bc) {
        // 检索医院(用来对应其关联的招投标)
        String query = 'Select Id, Assume_Change__c FROM Account ';
force-app/main/default/classes/ApplicationForCAHandler.cls
@@ -21,6 +21,8 @@
    }
    protected override void beforeUpdate() {
        // 更新时判断是否更新了绑定的学会,如果绑定多个学会且不是赞助会时,清空绑定关系
        clean_binding();
        clean_campaign();
        update_campaign();
    }
@@ -28,6 +30,27 @@
    protected override void afterUpdate() {
        // opd计划的引用字段达到上线,决裁状态需要在触发器里更新
        update_status_on_opd();
    }
    // 更新时判断是否更新了绑定的学会,如果绑定多个学会且不是赞助会时,清空绑定关系
    private void clean_binding() {
        Map<String, String> app_cam_binds = new Map<String, String>();
        for (Application_for_Conference_Adjudication__c app : this.newList) {
            Application_for_Conference_Adjudication__c old_app = this.oldMap.get(app.Id);
            if (String.isNotBlank(old_app.Num__c) && !old_app.Num__c.equals(app.Num__c)) {
                app_cam_binds.put(old_app.Id, old_app.Num__c);
            }
        }
        if (app_cam_binds.size() > 0) {
            List<Campaign> cams = [select Id, MeetingApprovedNo__c, Meeting_Approved_No__c from Campaign where Meeting_Approved_No__c in :app_cam_binds.keySet() and Num__c in :app_cam_binds.values()];
            if (cams != null && cams.size() > 0) {
                for (Campaign cam : cams) {
                    cam.MeetingApprovedNo__c = null;
                    cam.Meeting_Approved_No__c = null;
                }
                update cams;
            }
        }
    }
    // 审批不通过的时候 清空会议和OPD计划上的决裁信息
@@ -76,7 +99,7 @@
        }
        Map<String, Campaign> wait_upd_campaigns = new Map<String, Campaign>();
        if (app_ids.size() > 0) {
            List<Campaign> campaigns = [select Id, Num__c, MeetingApprovedNo__c, Meeting_Approved_No__c from Campaign where Meeting_Approved_No__c in :app_ids];
            List<Campaign> campaigns = [select Id, Num__c, MeetingApprovedNo__c, Meeting_Approved_No__c from Campaign where Meeting_Approved_No__c in :app_ids and Meeting_Type__c != '赞助会'];
            if (campaigns.size() > 0) {
                for (Campaign cam : campaigns) {
                    Application_for_Conference_Adjudication__c app = this.newMap.get(cam.Meeting_Approved_No__c);
@@ -128,13 +151,11 @@
    // 更新决裁的信息到学会上
    private Campaign update_info_from_app(Campaign cam, Application_for_Conference_Adjudication__c app) {
        init_state_city();
        cam.StartDate                        = app.StartDate__c;
        cam.EndDate                          = app.EndDate__c;
        cam.Budget_Type__c                   = app.BudgetType__c;
        cam.OfficeCategory__c                = app.OfficeCategory__c;
        cam.Meeting_Type__c                  = app.MeetingType__c;
        cam.Activity_Type_Name__c            = app.ActivityTypeName__c;
        cam.WorkshopPlace__c                 = app.WorkshopPlace__c;
        cam.HostName__c                      = app.HostName__c;
@@ -146,65 +167,12 @@
        cam.Expected_Hcp_Attendance__c       = app.ExpectedHcpAttendance__c;
        cam.SponsorshipCategory__c           = app.SponsorshipCategory__c;
        cam.IsPaidToSponsor__c               = app.IsPaidToSponsor__c;
        cam.Activity_Type_Name__c            = app.ActivityTypeName__c;
        // cam.Activity_Type_Name__c            = app.ActivityTypeName__c;
        cam.Activity_Type_Name__c            = app.Type_of_adjudication_meeting__c;
        // 这里需要额外加操作
        cam.State_Master__c                  = get_state(app.StateMaster__c);
        cam.City_Master__c                   = get_city(app.CityMaster__c);
        cam.State_Master__c                  = StateCityUtil.get_state(app.StateMaster__c);
        cam.City_Master__c                   = StateCityUtil.get_city(app.CityMaster__c);
        return cam;
    }
    // 初始化省市信息
    public static void init_state_city() {
        if (states == null || states.size() <= 0) {
            states = new Map<String, String>();
            List<Address_Level__c> lst_state = [select Id, Name from Address_Level__c];
            for (Address_Level__c level1 : lst_state) {
                states.put(level1.Name, level1.Id);
            }
        }
        if (cities == null || cities.size() <= 0) {
            cities = new Map<String, String>();
            List<Address_Level2__c> lst_city = [select Id, Name from Address_Level2__c];
            for (Address_Level2__c level2 : lst_city) {
                cities.put(level2.Name, level2.Id);
            }
        }
    }
    // 设置会议上的省
    public static String get_state(String state_name) {
        if (String.isBlank(state_name)) {
            return null;
        }
        if (states == null || states.size() <= 0) {
            return null;
        }
        // 处理空格 或许后续还有别的处理
        state_name = state_name.trim().replace(' ', '');
        for(String state : states.keySet()) {
            if (state_name.contains(state) || state.contains(state_name)) {
                return states.get(state);
            }
        }
        return null;
    }
    // 设置会议上的市
    public static String get_city(String city_name) {
        if (String.isBlank(city_name)) {
            return null;
        }
        if (cities == null || cities.size() <= 0) {
            return null;
        }
        // 处理空格 或许后续还有别的处理
        city_name = city_name.trim().replace(' ', '');
        for(String city : cities.keySet()) {
            if (city_name.contains(city) || city.contains(city_name)) {
                return cities.get(city);
            }
        }
        return null;
    }
}
force-app/main/default/classes/BatchSelectRepairPageController.cls
@@ -14,56 +14,52 @@
    public void init(){
        RetrievalData reval = new RetrievalData();
        RevalInfoList = new List<RetrievalData>();
        reval.RepairName = null;
        reval.SAPRepairNo = null;
        reval.HospitalName = null;
        RevalInfoList.add(reval);
    }
    public PageReference RetrievalBtn() {
        RepairList = new List<Repair__c>();
        RAInfoList = new List<RepairData>();
        String RepairName;
        String SAPRepairNo;
        String HospitalName;
        String sql;
        System.debug('RevalInfoList1:' + RevalInfoList);
        for(RetrievalData reval : RevalInfoList){
            if(String.isBlank(reval.Status2) && String.isBlank(reval.RepairName) && String.isBlank(reval.SAPRepairNo)
                && String.isBlank(reval.SerialNumber) && String.isBlank(reval.repair.Incharge_Staff__c)
                && String.isBlank(String.valueOf(reval.repair.Final_complete_day__c))){
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '请至少添加一个检索条件!'));
                return null;
            }
            sql += 'select Id, Name, SAP_Service_Repair_No__c, Status1__c, Status2__c, Delivered_Product__c, SerialNumber__c, ';
            sql += 'HP_Name__c, State_Hospital__c, Incharge_Staff__c, FSE_ApplyForRepair_Day__c, work_location_select__c, On_site_repair__c,';
            sql += 'Number_of_EffectiveContract__c, NewProductGuaranteeObject__c from Repair__c where Id != null ';
            if(String.isNotBlank(reval.Status2)){
                sql += ' and Status2__c like \'%' + reval.Status2 + '%\' ';
            }
            if(String.isNotBlank(reval.RepairName)){
                RepairName = reval.RepairName;
                sql += ' and Name like \'%' + reval.RepairName + '%\' ';
            }
            if(String.isNotBlank(reval.SAPRepairNo)){
                SAPRepairNo = reval.SAPRepairNo;
                sql += ' and SAP_Service_Repair_No__c like \'%' + reval.SAPRepairNo + '%\' ';
            }
            if(String.isNotBlank(reval.HospitalName)){
                HospitalName = reval.HospitalName;
            if(String.isNotBlank(reval.SerialNumber)){
                sql += ' and SerialNumber__c like \'%' + reval.SerialNumber + '%\' ';
            }
            if(String.isNotBlank(reval.repair.Incharge_Staff__c)){
                sql += ' and Incharge_Staff__c = \'' + reval.repair.Incharge_Staff__c + '\' ';
            }
            if(String.isNotBlank(String.valueof(reval.repair.Final_complete_day__c))){
                String day = String.valueof(reval.repair.Final_complete_day__c);
                day = day.substring(0,10);
                sql += ' and FSE_ApplyForRepair_Day__c = ' + day;
            }
            sql += ' limit 200';
            sql = sql.substring(4);
        }
        System.debug('RepairName1:' + RepairName);
        if(String.isBlank(RepairName) && String.isBlank(SAPRepairNo) && String.isBlank(HospitalName)){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '请至少添加一个检索条件!'));
            return null;
        System.debug('sql1:' + sql);
        if(String.isNotBlank(sql)){
            RepairList = Database.query(sql);
        }
        String sql = 'select Id, Name, SAP_Service_Repair_No__c, HP_Name__c, Department_Name__c from Repair__c ';
        if(String.isNotBlank(RepairName)){
            sql += ' where Name like \'%' + RepairName.trim() + '%\'';
            if(String.isNotBlank(SAPRepairNo)){
                sql += ' and SAP_Service_Repair_No__c like \'%' + SAPRepairNo.trim() + '%\'';
                if(String.isNotBlank(HospitalName)){
                    sql += ' and (HP_Name__c like \'%' + HospitalName.trim() + '%\' or Department_Name__c like \'%' + HospitalName.trim() + '%\')';
                }
            } else if(String.isNotBlank(HospitalName)) {
                sql += ' and (HP_Name__c like \'%' + HospitalName.trim() + '%\' or Department_Name__c like \'%' + HospitalName.trim() + '%\')';
            }
        } else if(String.isNotBlank(SAPRepairNo)){
            sql += ' where SAP_Service_Repair_No__c like \'%' + SAPRepairNo.trim() + '%\'';
            if(String.isNotBlank(HospitalName)){
                sql += ' and (HP_Name__c like \'%' + HospitalName.trim() + '%\' or Department_Name__c like \'%' + HospitalName.trim() + '%\')';
            }
        } else if(String.isNotBlank(HospitalName)){
            sql += ' where HP_Name__c like \'%' + HospitalName.trim() + '%\' or Department_Name__c like \'%' + HospitalName.trim() + '%\'';
        }
        sql += ' limit 5000';
        RepairList = Database.query(sql);
        if(RepairList.size() >= 5000 ){
        if(RepairList.size() >= 200 ){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '检索数据太多,请缩小检索范围'));
            return null;
        }
@@ -100,9 +96,7 @@
                for(String Id : repairIdList){
                    url += Id + '=';
                }
                System.debug('url1:'+url);
                url = url.substring(0, url.lastIndexOf('='));
                System.debug('url2:'+url);
                PageReference pageRef = new PageReference('/apex/MaintenanceCommissionPDF?id' + url);
                pageRef.setRedirect(true);
                return pageRef;
@@ -139,9 +133,16 @@
    }
    public class RetrievalData {
        public String Status2{ get; set; }
        public String RepairName{ get; set; }
        public String SAPRepairNo{ get; set; }
        public String HospitalName{ get; set; }
        public String SerialNumber{ get; set; }
        // public String FSE_ApplyForRepair_Day{ get; set; }
        // public String InchargeStaffName{ get; set; }
        public Repair__c repair{ get; set; }
        public RetrievalData(){
            repair = new Repair__c();
        }
    }
    public class RepairData {
force-app/main/default/classes/BatchSelectRepairPageControllerTest.cls
@@ -1,6 +1,93 @@
@isTest
private class BatchSelectRepairPageControllerTest {
    static Repair__c repair01;
    public static void init(){
        Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin];
        User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
        insert hpOwner;
        List<RecordType> rectHp = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'];
        List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_GI'];
        if (rectDpt.size() == 0) {
            return;
        }
        Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'SoakupTestHp', OwnerId = hpOwner.Id);
        insert hp;
        Account dc = [select Id, Name, RecordType_DeveloperName__c, Account2__c from Account where ParentId = :hp.Id and RecordType_DeveloperName__c = 'Department_Class_GI'];
        Account dpt = new Account(RecordTypeId = rectDpt[0].Id);
        dpt.Name         = '*';
        dpt.Department_Name__c  = 'TestDepart';
        dpt.ParentId            = dc.Id;
        dpt.Department_Class__c = dc.Id;
        dpt.Hospital__c         = hp.Id;
        insert dpt;
        Asset asset = new Asset();
        asset.Name = 'テスト機器';
        asset.AccountId = dpt.Id;
        asset.Department_Class__c = dc.Id;
        asset.Hospital__c = hp.Id;
        asset.SerialNumber = 'testserial';
        insert asset;
        repair01 = new Repair__c();
        repair01.Account__c = dpt.Id;
        repair01.Department_Class__c = dc.Id;
        repair01.Hospital__c = hp.Id;
        repair01.Delivered_Product__c = asset.Id;
        repair01.SERVICE_CONTRACT_JUDEGE_DAY__C = Date.today().addDays(0);
        repair01.FSE_Work_Location__c = '上海';
        repair01.Incharge_Staff__c = hpOwner.Id;
        // repair01.Final_complete_day__c = Date.today().addDays(-1);
        insert repair01;
    }
    static testMethod void testSample_01() {
        init();
        PageReference page = new PageReference('/apex/BatchSelectRepairPage');
        System.Test.setCurrentPage(page);
        System.Test.StartTest();
        BatchSelectRepairPageController br = new BatchSelectRepairPageController();
        br.init();
        br.RevalInfoList[0].repair = repair01;
        br.RevalInfoList[0].Status2 = '01.分公司受理完毕';
        br.RevalInfoList[0].RepairName = 'RS-202203-651844';
        br.RevalInfoList[0].SerialNumber = 'testserial';
        // br.RevalInfoList[0].SAPRepairNo = '000010201157';
        br.RetrievalBtn();
        br.RAInfoList[0].IFCheck = true;
        br.showPDF();
        System.Test.StopTest();
    }
    static testMethod void testSample_02() {
        init();
        PageReference page = new PageReference('/apex/BatchSelectRepairPage');
        System.Test.setCurrentPage(page);
        System.Test.StartTest();
        BatchSelectRepairPageController br = new BatchSelectRepairPageController();
        br.init();
        br.RetrievalBtn();
        System.Test.StopTest();
    }
    static testMethod void testSample_03() {
        init();
        PageReference page = new PageReference('/apex/BatchSelectRepairPage');
        System.Test.setCurrentPage(page);
        System.Test.StartTest();
        BatchSelectRepairPageController br = new BatchSelectRepairPageController();
        br.init();
        br.RevalInfoList[0].Status2 = '012312';
        br.RetrievalBtn();
        System.Test.StopTest();
    }
    static testMethod void testSample_04() {
        init();
        PageReference page = new PageReference('/apex/BatchSelectRepairPage');
        System.Test.setCurrentPage(page);
        System.Test.StartTest();
        BatchSelectRepairPageController br = new BatchSelectRepairPageController();
        br.init();
        br.showPDF();
        System.Test.StopTest();
    }
}
force-app/main/default/classes/CampaignCreateController.cls
@@ -1,21 +1,211 @@
public with sharing class CampaignCreateController {
    public List<AdjudicationData> AdjudicationDataList{ get; set; }
    public AdjudicationData AdjudicationDataobj{ get; set; }
    public boolean hasError { get; set; }
    public String MeetingApprovedName{ get; set; }
    public String flag{ get; set; }
    public String CampaignTheme{ get; set; }
    private String RecordTypeId{ get; set; }
    private String CMRT{ get; set; }
    private String retURL{ get; set; }
    private String p8{ get; set; }
    private String CF00N10000002DIsr{ get; set; }
    private String ent{ get; set; }
    private String CF00N10000002DIsr_lkid{ get; set; }
    public CampaignCreateController(ApexPages.StandardController controller) {
        RecordTypeId = ApexPages.currentPage().getParameters().get('RecordType');
        CMRT = ApexPages.currentPage().getParameters().get('CMRT');
        retURL = ApexPages.currentPage().getParameters().get('retURL');
        p8 = ApexPages.currentPage().getParameters().get('p8');
        CF00N10000002DIsr = ApexPages.currentPage().getParameters().get('CF00N10000002DIsr');
        ent = ApexPages.currentPage().getParameters().get('ent');
        CF00N10000002DIsr_lkid = ApexPages.currentPage().getParameters().get('CF00N10000002DIsr_lkid');
    }
    public void init(){
        AdjudicationDataList = new List<AdjudicationData>();
        AdjudicationData ad = new AdjudicationData();
        AdjudicationDataList.add(ad);
    public Pagereference init(){
        hasError = false;
        RecordType recordType = [select Id, Name, DeveloperName from RecordType where IsActive = true and id = :RecordTypeId];
        String RecordTypeName = recordType.DeveloperName;
        //记录类型为1.学会/会议或者6.营业部专用会议的时候才跳转小页面
        if(RecordTypeName == 'Society' || RecordTypeName == 'BusinessTraining'){
            // AdjudicationDataList = new List<AdjudicationData>();
            AdjudicationData ad = new AdjudicationData();
            ad.cam = new Campaign();
            // 默认选中
            ad.cam.IF_Approved__c = true;
            // AdjudicationDataList.add(ad);
            AdjudicationDataobj=ad;
            return null;
        } else{
            String buildUrl = skipBuildPage();
            PageReference pg = new PageReference(buildUrl);
            pg.setRedirect(true);
            return pg;
        }
    }
    //标准页面跳转新建学会页面
    public String skipBuildPage(){
        String str = '/701/e?cpn1=*';
        if(RecordTypeId != null){
            str += '&RecordType=' + RecordTypeId;
        }
        if(CMRT != null){
            str += '&CMRT=' + CMRT;
        }
        if(retURL != null){
            str += '&retURL=' + retURL;
        }
        if(p8 != null){
            str += '&p8=' + p8;
        }
        if(CF00N10000002DIsr != null){
            str += '&CF00N10000002DIsr=' + CF00N10000002DIsr;
        }
        if(ent != null){
            str += '&ent=' + ent;
        }
        if(CF00N10000002DIsr_lkid != null){
            str += '&CF00N10000002DIsr_lkid=' + CF00N10000002DIsr_lkid;
        }
        str += '&nooverride=1';
        return str;
    }
    public void changeCheckboxs(){
        System.debug('flag++++'+flag);
        if(flag=='0'){
            AdjudicationDataobj.cam.IF_Approved__c=false;
        }else if(flag=='1'){
            AdjudicationDataobj.cam.IF_Approved__c=true;
        }
    }
    //小页面跳转学会新建页面
    public Pagereference skipPage(){
        List<String> MeetingApprovedIdList = new List<String>();
        Map<String, Application_for_Conference_Adjudication__c> MeetingApprovedMap = new Map<String, Application_for_Conference_Adjudication__c>();
        // for(AdjudicationData ad : AdjudicationDataList){
            // if(String.isNotBlank(ad.cam.Meeting_Approved_No__c)){
            //     MeetingApprovedIdList.add(ad.cam.Meeting_Approved_No__c);
            // }
        // }
        if(String.isNotBlank(AdjudicationDataobj.cam.Meeting_Approved_No__c)){
            MeetingApprovedIdList.add(AdjudicationDataobj.cam.Meeting_Approved_No__c);
        }
        List<Application_for_Conference_Adjudication__c> MeetingApprovedList =
            [select Id, Name, StartDate__c, EndDate__c, BudgetType__c, OfficeCategory__c, MeetingType__c, WorkshopPlace__c,
                HostName__c, CooperatorCompany__c, ConveningParticipantsNum__c, ExpectedOlympusAttendance__c,ExpectedHcpAttendance__c,
                SponsorshipCategory__c, IsPaidToSponsor__c, ActivityTypeName__c, Type_of_adjudication_meeting__c
                from Application_for_Conference_Adjudication__c where Id = :MeetingApprovedIdList];
        for(Application_for_Conference_Adjudication__c afca : MeetingApprovedList){
            MeetingApprovedMap.put(afca.Id, afca);
        }
        String url = skipBuildPage();
        // for(AdjudicationData ad : AdjudicationDataList){
            system.debug('123321+++++++===='+AdjudicationDataobj.cam.IF_Approved__c);
            if(AdjudicationDataobj.cam != null){
                if(AdjudicationDataobj.cam.IF_Approved__c || String.isNotBlank(AdjudicationDataobj.cam.Meeting_Approved_No__c)){
                    url += '&00N1m000005tHDi=1';
                }else{
                    url += '&00N1m000005tHDi=0';
                }
            }
            if(AdjudicationDataobj.cam != null && String.isNotBlank(AdjudicationDataobj.cam.Meeting_Approved_No__c)){
                Application_for_Conference_Adjudication__c mam = MeetingApprovedMap.get(AdjudicationDataobj.cam.Meeting_Approved_No__c);
                //会议决裁编码的Name,查找字段赋值Name和ID都要赋值
                if(String.isNotBlank(mam.Name)){
                    url += '&CF00N1m000006G5NG=' + mam.Name;
                }
                //会议决裁编码的ID,如果根据名字找到多个,就根据ID确定唯一的一个值
                url += '&CF00N1m000006G5NG_lkid=' + AdjudicationDataobj.cam.Meeting_Approved_No__c;
                //开始日期、结束日期、活动性质、科室分类、会议类型、会场地点、会议主办方、会议承办方、参加人数(召开)、预计参会Olympus人数
                if(String.isNotBlank(String.valueOf(mam.StartDate__c))){
                    url += '&cpn5=' + String.valueOf(mam.StartDate__c).replace('-','/');
                }
                if(String.isNotBlank(String.valueOf(mam.EndDate__c))){
                    url += '&cpn6=' + String.valueOf(mam.EndDate__c).replace('-','/');
                }
                if(String.isNotBlank(mam.BudgetType__c)){
                    url += '&00N100000098OEy=' + mam.BudgetType__c;
                }
                if(String.isNotBlank(mam.OfficeCategory__c)){
                    url += '&00N10000006pwAg=' + mam.OfficeCategory__c;
                }
                if(String.isNotBlank(mam.MeetingType__c)){
                    url += '&00N100000072rGE=' + mam.MeetingType__c;
                }
                if(String.isNotBlank(mam.WorkshopPlace__c)){
                    url += '&00N10000002DGF0=' + mam.WorkshopPlace__c;
                }
                if(String.isNotBlank(mam.HostName__c)){
                    url += '&00N10000008qcCO=' + mam.HostName__c;
                }
                if(String.isNotBlank(mam.CooperatorCompany__c)){
                    url += '&00N10000008qcCT=' + mam.CooperatorCompany__c;
                }
                if(String.isNotBlank(String.valueOf(mam.ConveningParticipantsNum__c))){
                    url += '&00N10000008ptmP=' + mam.ConveningParticipantsNum__c;
                }
                if(String.isNotBlank(String.valueOf(mam.ExpectedOlympusAttendance__c))){
                    url += '&00N1m00000652oO=' + mam.ExpectedOlympusAttendance__c;
                }
                //预计参会HCP人数、赞助类别、赞助款项是否支付给主办方、活动形式
                if(String.isNotBlank(String.valueOf(mam.ExpectedHcpAttendance__c))){
                    url += '&00N1m00000652oT=' + mam.ExpectedHcpAttendance__c;
                }
                if(String.isNotBlank(mam.SponsorshipCategory__c)){
                    url += '&00N1m000006fdGn=' + mam.SponsorshipCategory__c;
                }
                if(String.isNotBlank(mam.IsPaidToSponsor__c)){
                    url += '&00N1m000006fcjJ=' + mam.IsPaidToSponsor__c;
                }
                if(String.isNotBlank(mam.Type_of_adjudication_meeting__c)){
                    url += '&00N1m00000652jY=' + mam.Type_of_adjudication_meeting__c;
                }
            }
        // }
        PageReference pg = new PageReference(url);
        pg.setRedirect(true);
        return pg;
    }
    //跳转回学会主页面
    public Pagereference returnPage(){
        PageReference pg = new PageReference('/701/o');
        pg.setRedirect(true);
        return pg;
    }
    //返回会议裁决主题
    public void displayDecisionTheme(){
        Savepoint sp = Database.setSavepoint();
        try {
            String aid = '';
            // for(AdjudicationData ad : AdjudicationDataList){
            //     if(String.isNotBlank(ad.cam.Meeting_Approved_No__c)){
            //         aid = ad.cam.Meeting_Approved_No__c;
            //         break;
            //     }
            // }
            if(String.isNotBlank(AdjudicationDataobj.cam.Meeting_Approved_No__c)){
                aid = AdjudicationDataobj.cam.Meeting_Approved_No__c;
                AdjudicationDataobj.cam.IF_Approved__c = true;
            }
            Application_for_Conference_Adjudication__c afca = [select Id, CampaignTheme__c from Application_for_Conference_Adjudication__c
                                                                where id = :aid];
            //查出来对应的会议主题传给全局变量,前台显示
            CampaignTheme = afca.CampaignTheme__c;
        } catch (System.Exception e) {
            Database.rollback(sp);
            // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, e.getMessage()));
            hasError = true;
        }
    }
    public class AdjudicationData{
        public Boolean isAdjudication{ get; set; }
        public String MeetingReport{ get; set; }
        public Campaign cam{ get; set; }
        public String MeetingApprovedNo{ get; set; }
        public String MeetingApprovedNoText{ get; set; }
    }
}
force-app/main/default/classes/CampaignTriggerBefInsHandler.cls
@@ -204,11 +204,13 @@
            // 会议决裁不为空时
            if (String.isNotBlank(cam.Meeting_Approved_No__c) && cam.Meeting_Approved_No__c != old_cam.Meeting_Approved_No__c) {
                app_ids.add(cam.Meeting_Approved_No__c);
                cam_ids.add(cam.Id);
                if (String.isNotBlank(cam.Id)) {
                    cam_ids.add(cam.Id);
                }
            }
        }
        if (app_ids.size() > 0) {
            List<OPDPlan__c> plans = [select Id, Campaign__c, IF_Approved__c, Approved_Status__c, Approved_No__c from OPDPlan__c where Campaign__c in :cam_ids];
            List<OPDPlan__c> plans = cam_ids.size() > 0 ? [select Id, Campaign__c, IF_Approved__c, Approved_Status__c, Approved_No__c from OPDPlan__c where Campaign__c in :cam_ids] : null;
            List<Application_for_Conference_Adjudication__c> apps = [select Id, 
                                                                        MeetingApprovedNo__c, 
                                                                        Num__c,
@@ -228,7 +230,8 @@
                                                                        CityMaster__c, 
                                                                        IsPaidToSponsor__c, 
                                                                        SponsorshipCategory__c, 
                                                                        ConveningParticipantsNum__c
                                                                        ConveningParticipantsNum__c,
                                                                        Type_of_adjudication_meeting__c
                                                                    from 
                                                                        Application_for_Conference_Adjudication__c 
                                                                    where 
@@ -257,14 +260,16 @@
                                cam.Expected_Hcp_Attendance__c       = app.ExpectedHcpAttendance__c;
                                cam.SponsorshipCategory__c           = app.SponsorshipCategory__c;
                                cam.IsPaidToSponsor__c               = app.IsPaidToSponsor__c;
                                cam.Activity_Type_Name__c            = app.ActivityTypeName__c;
                                // cam.Activity_Type_Name__c            = app.ActivityTypeName__c;
                                cam.Activity_Type_Name__c            = app.Type_of_adjudication_meeting__c;
                                // 这里需要额外加操作
                                cam.State_Master__c                  = StateCityUtil.get_state(app.StateMaster__c);                 
                                cam.City_Master__c                   = StateCityUtil.get_city(app.CityMaster__c);
                            }
                            if (String.isBlank(app.Num__c)) {
                                app.Num__c = cam.Num__c;
                                set_cam_num_apps.add(app);
                                if (cam.Num__c != app.Num__c) {
                                    app.Num__c = cam.Num__c;
                                    set_cam_num_apps.add(app);
                                }
                            }
                            // opd计划上的内容更新
                            if (plans != null && plans.size() > 0) {
@@ -284,7 +289,7 @@
                if (set_cam_num_apps.size() > 0) {
                    update set_cam_num_apps;
                }
                if (plans.size() > 0) {
                if (plans != null && plans.size() > 0) {
                    update plans;
                }
            }
force-app/main/default/classes/ChoiceAssetController.cls
@@ -126,6 +126,10 @@
            if (info.check) {
                ast = info.ast;
                quantity += 1;
                if (info.ast.Ji_Zhong_Guan_Li_Ku_Cun__c <= 0){
                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '设备集中管理库存不足'));
                    return null;
                }
            }
        }
        if (quantity == 0) {
force-app/main/default/classes/ConsumAutoSelectBatch.cls
@@ -24,6 +24,7 @@
                + ', demo_purpose2__c'
            + ' from Consum_Apply__c'
            + ' where (Status__c = \'已批准\' OR Status__c = \'已出库指示\')'
            // + ' and demo_purpose2__c !=\'动物实验\' and demo_purpose2__c !=\'ET展箱\''
            + ' and Wei_Shipment_request__c > 0'
            + ' and Yi_loaner_arranged__c = 0'
            + ' order by Id';
@@ -47,7 +48,7 @@
                      AND Cancel_Select__c = false
                      AND Shipment_request_time2__c = null];
            List<Consum_Apply_Equipment_Set_Detail__c> caesdList = new List<Consum_Apply_Equipment_Set_Detail__c>();
            Boolean haveChangeAss = ConsumDefaultSelectController.reSetAsset(selectedData, caesdList, csmApyList[0], false, true);
            if (caesdList.size() > 0) {
                update caesdList;
force-app/main/default/classes/ConsumDefaultSelectController.cls
@@ -27,6 +27,7 @@
        myComponentController.columnLeftRW.put('You_Xiao_Ku_Cun_Jia__c', 'r');
        myComponentController.columnLeftRW.put('You_Xiao_Qi_Ku_Cun_Jia__c', 'r');
        myComponentController.columnLeftRW.put('Yi_Guo_Qi_Ku_Cun_Jia__c', 'r');
        myComponentController.columnLeftRW.put('demo_purpose2__c', 'r'); // 20220309 ljh  SFDC-CC73U5 132 动物实验&ET展箱 锁定已过期库存 add start
        return selectedDataSql;
    }
@@ -69,6 +70,7 @@
                , 'Select_Time__c'
                , 'GroupKey_F__c'
                , 'Asset__c'
                , 'demo_purpose2__c' // 20220309 ljh  SFDC-CC73U5 132 动物实验&ET展箱 锁定已过期库存 add start
                , 'Shipment_request_time2__c'
                , 'Consum_Start_Date_After_15_Day__c'
                , 'Consum_Apply_Equipment_Set__r.Model_No__c'
@@ -272,7 +274,10 @@
                    Consum_Apply_Equipment_Set_Detail__c caesd = (Consum_Apply_Equipment_Set_Detail__c)info.sobj;
                    if (caesd.Qu_Xiao_Fen_Pei_Shu_Liang_Jia__c != null
                            && caesd.Qu_Xiao_Fen_Pei_Shu_Liang_Jia__c > 0) {
                        String key = caesd.GroupKey_F__c;
                        // 20220309 ljh  SFDC-CC73U5 132 动物实验&ET展箱 锁定已过期库存 add start
                        // String key = caesd.GroupKey_F__c;
                        String key = caesd.GroupKey_F__c+caesd.Fixture_Model_No__c;
                        // 20220309 ljh  SFDC-CC73U5 132 动物实验&ET展箱 锁定已过期库存 add end
                        System.debug(caesd.Consumable_Guaranteen_end_F__c);
                        System.debug(key);
                        if(caesd.Qu_Xiao_Fen_Pei_Shu_Liang_Jia__c>caesd.Jie_Chu_Fen_Pei_Jia__c){
@@ -317,6 +322,7 @@
            carsdList = [SELECT Id
                        , Select_Time__c
                        , GroupKey_F__c
                        , Fixture_Model_No__c // 20220309 ljh  SFDC-CC73U5 132 动物实验&ET展箱 锁定已过期库存 add
                     FROM Consum_Apply_Equipment_Set_Detail__c
                    WHERE Consum_Apply__c = :parentId
                      AND Cancel_Select__c = False
@@ -324,11 +330,22 @@
                    ORDER BY Degree_Of_Importance__c DESC];
            Map<String, List<Consum_Apply_Equipment_Set_Detail__c>> caesdListMap = new Map<String, List<Consum_Apply_Equipment_Set_Detail__c>>();
            for (Consum_Apply_Equipment_Set_Detail__c caesd : carsdList) {
                if (caesdListMap.containsKey(caesd.GroupKey_F__c) == false) {
                    caesdListMap.put(caesd.GroupKey_F__c, new List<Consum_Apply_Equipment_Set_Detail__c>());
                // 20220309 ljh  SFDC-CC73U5 132 动物实验&ET展箱 锁定已过期库存 add start
                String key = caesd.GroupKey_F__c+caesd.Fixture_Model_No__c;
                // if (caesdListMap.containsKey(caesd.GroupKey_F__c) == false) {
                //     caesdListMap.put(caesd.GroupKey_F__c, new List<Consum_Apply_Equipment_Set_Detail__c>());
                // }
                // System.debug(caesd.GroupKey_F__c);
                // caesdListMap.get(caesd.GroupKey_F__c).add(caesd);
                List<Consum_Apply_Equipment_Set_Detail__c> tempCaesdL;
                if(caesdListMap.containsKey(key)){
                    tempCaesdL = caesdListMap.get(key);
                }else{
                    tempCaesdL = new List<Consum_Apply_Equipment_Set_Detail__c>();
                }
                System.debug(caesd.GroupKey_F__c);
                caesdListMap.get(caesd.GroupKey_F__c).add(caesd);
                tempCaesdL.add(caesd);
                caesdListMap.put(key,tempCaesdL);
                // 20220309 ljh  SFDC-CC73U5 132 动物实验&ET展箱 锁定已过期库存 add end
            }
            System.debug(caesdListMap);
            List<Consum_Apply_Equipment_Set_Detail__c> caesdList = new List<Consum_Apply_Equipment_Set_Detail__c>();
@@ -572,7 +589,7 @@
                final String soqlStr = 'Select {0} {1} ';
                String soql1 = String.format(soqlStr, new String[] {myComponentController.strColumus , selectedDataSql1});
                selectedData = Consum_ApplyUtil.withoutQueryList(soql1);
                System.debug('zheli:'+selectedData.size());
                if (String.isNotBlank(wherStr1) && String.isBlank(wherStr)) {
                    wherStr = wherStr1;
                }
@@ -595,18 +612,23 @@
                Map<String, Consum_Apply_Equipment_Set_Detail__c> keyMap = new Map<String, Consum_Apply_Equipment_Set_Detail__c>();
                Boolean haveChange = false;
                Set<String> modelKeySet = new Set<String>();
                System.debug('zheli598:'+selectedData.size());
                for (SObject sobj : selectedData) {
                    Consum_Apply_Equipment_Set_Detail__c caesdobj = (Consum_Apply_Equipment_Set_Detail__c) sobj;
                    if (caesdobj.Asset__c == null) {
                        continue;
                    }
                    String key = caesdobj.GroupKey_F__c;
                    // 20220309 ljh  SFDC-CC73U5 132 动物实验&ET展箱 锁定已过期库存 add start
                    // String key = caesdobj.GroupKey_F__c;
                    String key = caesdobj.GroupKey_F__c+caesdobj.Fixture_Model_No__c;
                    // 20220309 ljh  SFDC-CC73U5 132 动物实验&ET展箱 锁定已过期库存 add end
                    if (keyMap.containsKey(key)) {
                        Consum_Apply_Equipment_Set_Detail__c caesd = keyMap.get(key);
                        keyMap.get(key).Request_Num_Jia__c ++;
                        if (caesdobj.Select_Time__c != null) {
                            keyMap.get(key).Jie_Chu_Fen_Pei_Jia__c += 1;
                        }
                        System.debug('zheli598:'+selectedData.size());
                        continue;
                    }
                    keyMap.put(key, caesdobj);
@@ -631,6 +653,7 @@
                    //viewList[viewList.size() - 1].additionalInfoMap.put('Substitute_Select_Again__c', String.valueOf(caesdobj.Substitute_Select_Again__c));
                }
            }
            System.debug('zheli634:'+viewList.size());
            if (savetype == '1') {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '保存成功'));
            }
@@ -667,10 +690,14 @@
                wherStr2 += ' (';
                wherStr += '(Fixture_Model_No_F__c  = \'' + String.escapeSingleQuotes(caesdobj.Consum_Apply_Equipment_Set__r.Model_No__c) + '\'';
                wherStr2 += 'Fixture_Model_No_F__c  = \'' + String.escapeSingleQuotes(caesdobj.Consum_Apply_Equipment_Set__r.Model_No__c) + '\'';
                // 20220309 ljh  SFDC-CC73U5 132 动物实验&ET展箱 锁定已过期库存 add start
                if (parentObj.demo_purpose2__c != '动物实验' 
                    //2021-04-30  mzy 备品课题-1577 start
                    &&parentObj.demo_purpose2__c != 'ET展箱') {
                    //2021-04-30  mzy 备品课题-1577 end
                // if (caesdobj.demo_purpose2__c != '动物实验'
                //     && caesdobj.demo_purpose2__c != 'ET展箱') {
                // 20220309 ljh  SFDC-CC73U5 132 动物实验&ET展箱 锁定已过期库存 add end
                    // Date d1 = caesdobj.Consum_Start_Date_After_15_Day__c == null ? td : caesdobj.Consum_Start_Date_After_15_Day__c;
                    // wherStr += ' AND Consumable_Guaranteen_end__c >= ' + d1.year() + '-' + String.valueOf(d1.month()).leftPad(2,'0') + '-' + String.valueOf(d1.day()).leftPad(2,'0') + ' )';
                    wherStr2 += ' AND (Consumable_Guaranteen_end__c >= ' + td.year() + '-' + String.valueOf(td.month()).leftPad(2,'0') + '-' + String.valueOf(td.day()).leftPad(2,'0');
@@ -693,7 +720,7 @@
        // if (String.isNotBlank(parentObj.Internal_asset_location_F__c)) {
            wherStr += ' AND Internal_asset_location__c = \'上海 备品中心\'';
            wherStr2 += ' AND Internal_asset_location__c = \'上海 备品中心\'';
        // }
        // }
        if (String.isNotBlank(parentObj.Salesdepartment__c)) {
            wherStr += ' AND (Salesdepartment__c = \'' + parentObj.Salesdepartment__c + '\' OR Salesdepartment__c = \'0.备品中心\')';
            wherStr2 += ' AND (Salesdepartment__c = \'' + parentObj.Salesdepartment__c + '\' OR Salesdepartment__c = \'0.备品中心\')';
@@ -753,10 +780,14 @@
                                && (caesdobj.Consumable_Guaranteen_end_F__c == null
                                    // || caesdobj.Consumable_Guaranteen_end_F__c >= fDateMap.get(key)) {
                                    || caesdobj.Consumable_Guaranteen_end_F__c >= d
                                    // 20220309 ljh  SFDC-CC73U5 132 动物实验&ET展箱 锁定已过期库存 add start
                                    || parentObj.demo_purpose2__c == '动物实验'
                                    //2021-04-30  mzy 备品课题-1577 start
                                    || parentObj.demo_purpose2__c == 'ET展箱'
                                    //2021-04-30  mzy 备品课题-1577 end
                                    // || caesdobj.demo_purpose2__c == '动物实验'
                                    // || caesdobj.demo_purpose2__c == 'ET展箱'
                                    // 20220309 ljh  SFDC-CC73U5 132 动物实验&ET展箱 锁定已过期库存 add end
                                   )
                        ) {
                            if (caesdobj.Select_Time__c == null) {
@@ -773,10 +804,14 @@
                                        && (caesdobj.Consumable_Guaranteen_end_F__c == null
                                            // || caesdobj.Consumable_Guaranteen_end_F__c >= fDateMap.get(key)) {
                                            || caesdobj.Consumable_Guaranteen_end_F__c > d
                                            // 20220309 ljh  SFDC-CC73U5 132 动物实验&ET展箱 锁定已过期库存 add start
                                            || parentObj.demo_purpose2__c == '动物实验'
                                            //2021-04-30  mzy 备品课题-1577 start
                                            || parentObj.demo_purpose2__c == 'ET展箱'
                                            //2021-04-30  mzy 备品课题-1577 end
                                            // || caesdobj.demo_purpose2__c == '动物实验'
                                            // || caesdobj.demo_purpose2__c == 'ET展箱'
                                            // 20220309 ljh  SFDC-CC73U5 132 动物实验&ET展箱 锁定已过期库存 add end
                                            )
                                    ) {
                                        caesdobj.Asset__c = assBean.assId;
force-app/main/default/classes/ConsumEquipmentSetReturnController.cls
@@ -25,7 +25,7 @@
    public override Integer getSearchNumMax() {
        //各ページに制御あれば、最大件数を指定する
        // searchNumMax = Integer.valueOf(Label.Product_Select_Limit);
        searchNumMax = 350;
        searchNumMax = 370;
        pagesize = '20';
        return searchNumMax;
    }
@@ -97,6 +97,7 @@
                              , 'Return_DeliverySlip__c'
                              , 'Fixture_Model_No__c'
                              , 'SerialNumber_F__c'
                              , 'ManagementCode__c'
                              , 'EquipmentManagementCode__c' //add by yc 20220217 
                              , 'EquipmentManagementCode_OldData__c' //add by yc 20220217 
                              , 'Shipment_request_time2__c', 'Consum_Apply_Equipment_Set__r.Yi_Shipment_request__c'};
@@ -211,10 +212,10 @@
                return null;
            }
            Integer cnt = caesd.Hui_Ji_Jia__c == null ? 0 : Integer.valueOf(caesd.Hui_Ji_Jia__c);
            String asscodeX = caesd.Asset__c + caesd.EquipmentManagementCode__c;
            String asscodeX = caesd.Asset__c + caesd.EquipmentManagementCode__c + caesd.ManagementCode__c;
            //add by yc 20220217 处理老数据开的口 start
            if (String.isEmpty(caesd.EquipmentManagementCode__c)) {
                   asscodeX = caesd.Asset__c + caesd.EquipmentManagementCode_OldData__c;
                   asscodeX = caesd.Asset__c + caesd.EquipmentManagementCode_OldData__c + caesd.ManagementCode__c;
            }  
            //add by yc 20220217 处理老数据开的口 end
            //要发货件数
@@ -235,10 +236,10 @@
                continue;
            }
             //20211115 耗材追溯 yc 定义key
            String asscodeX1 = caesd.Asset__c + caesd.EquipmentManagementCode__c;
            String asscodeX1 = caesd.Asset__c + caesd.EquipmentManagementCode__c + caesd.ManagementCode__c;
            //add by yc 20220217 处理老数据开的口 start
            if (String.isEmpty(caesd.EquipmentManagementCode__c)) {
                asscodeX1 = caesd.Asset__c + caesd.EquipmentManagementCode_OldData__c;
                asscodeX1 = caesd.Asset__c + caesd.EquipmentManagementCode_OldData__c + caesd.ManagementCode__c;
            }  
            //add by yc 20220217 处理老数据开的口 end
            System.debug('zheli1'+sendAssetKey);
force-app/main/default/classes/ConsumEquipmentSetShipmentController.cls
@@ -678,4 +678,1345 @@
        
    }
      @TestVisible private static void test() {
        if (false == Test.isRunningTest()) return;
        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++;
    }
}
force-app/main/default/classes/ConsumEquipmentSetShipmentControllerTest.cls
@@ -1,5 +1,11 @@
@isTest
private class ConsumEquipmentSetShipmentControllerTest {
    // static testMethod void testCoverUp() {
    //    ConsumEquipmentSetShipmentController.test();
    //}//System.LimitException: Too many SOQL queries: 101
    // 造出出库指示完成数据
    @testSetup static void setupTestData(){
        ConsumTestDataFactory factory = new ConsumTestDataFactory();
force-app/main/default/classes/ContactTriggerHandler.cls
@@ -20,16 +20,12 @@
        syncToAgencyContact();
        updateDealerNum();
        sendToComPlat();
        //NFM702
        // NFM702_Handler(this.newList , this.newMap , this.oldList , this.oldMap);
    }
    protected override void afterUpdate() {
        syncToAgencyContact();
        updateDealerNum();
        sendToComPlat();
        //NFM702
        // NFM702_Handler(this.newList , this.newMap , this.oldList , this.oldMap);
    }
    protected override void beforeUpdate() {
@@ -232,9 +228,40 @@
        Pattern pattern = Pattern.compile('^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\\d{8}$');
        Map<String, Map<String,Contact>> accountContactMap = new Map<String, Map<String,Contact>>();
        Set<Id> accountIdSet = new Set<Id>();
        //用户对象上找对应的联系人
        List<User> userList=[select ID,ContactID from User where ContactID != null];
        Map<String,User> userMap= new Map<String,User>();
        if (userList.size()>0){
            for(User us1: userList){
                userMap.put(us1.ContactId, us1);
            }
        }
        //查找联系人对象上对应的有效客户;医院直接使用有效/无效字段、经销商使用有效/无效公式字段
        List<String> accIdList = new List<String>();
        Map<String,String> accMap= new Map<String,String>();
        for (Contact contact1: newList) {
            accIdList.add(contact1.AccountId);
        }
        if (accIdList.size()>0){
            List<Account> accList=[select ID,Is_Active__c,Is_Active_Formula__c from Account where ID in:accIdList];
            if(accList.size()>0){
                for(Account acc:accList){
                    if (String.isNotBlank(acc.Is_Active__c)){
                        accMap.put(acc.Id, acc.Is_Active__c);
                        continue;
                    }
                    if (String.isNotBlank(acc.Is_Active_Formula__c)){
                        accMap.put(acc.Id, acc.Is_Active_Formula__c);
                    }
                }
            }
        }
        for (Contact contactnew: newList) {
            // 手机号 有值 并且 联系人有效 进行手机号码验证
            if (String.isNotBlank(contactnew.MobilePhone) && '有效'.equals(contactnew.Isactive__c)) {
            // 手机号 有值 并且 联系人有效 联系人的客户有效 无外部关联用户 进行手机号码验证
            if (String.isNotBlank(contactnew.MobilePhone) && ('有效'.equals(contactnew.Isactive__c) ||'有効'.equals(contactnew.Isactive__c))
                && '有効'.equals(accMap.get(contactnew.AccountId))
                && !userMap.containsKey(contactnew.Id)
                ) {
                Matcher isMobilePhone = pattern.matcher(contactnew.MobilePhone);
                if (isMobilePhone.matches()) {
                    // 将手机号 赋值给 手机号唯一字段
@@ -378,42 +405,6 @@
            }
        } 
        
    }
    public void NFM702_Handler(List<Contact> newList, Map<Id, Contact> newMap, List<Contact> oldList, Map<Id, Contact> oldMap){
        List<Contact> conIdList = new List<Contact>();
        List<String> idList = new List<String>();
        String LOG_TYPE = 'NFM702';
        // iflog.Log__c = '---------';
        String ConTypeId = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Doctor').getRecordTypeId();
        if (Trigger.isUpdate && Trigger.isAfter) {
            if (newList.size() > 0) {
                for (Contact con : newList) {
                    Contact oldCon = oldMap.get(con.Id);
                    if ((con.RecordTypeId.equals(ConTypeId)) && (con.FullName__c != oldCon.FullName__c || con.Phone != oldCon.Phone || con.Department__c != oldCon.Department__c || con.Isactive__c != oldCon.Isactive__c)) {
                        idList.add(con.Id);
                    }
                }
            }
        }
        if(Trigger.isInsert && Trigger.isAfter){
            if (newList.size() > 0) {
                for (Contact con : newList) {
                    if(con.RecordTypeId.equals(ConTypeId)){
                        idList.add(con.Id);
                    }
                }
            }
        }
        if (idList.size() > 0) {
            BatchIF_Log__c iflog = new BatchIF_Log__c();
            iflog.Log__c = '触发成功';
            iflog.Type__c = LOG_TYPE;
            insert iflog;
            NFM702Controller.callout(iflog.Id, idList);
        }
    }
}
force-app/main/default/classes/CreateNewMaintenanceTaskBatch.cls
@@ -122,27 +122,40 @@
        if(NeedCreateNMC.size()>0){
            //遍历需要创建报告书的合同
            for(Maintenance_Contract__c tempNMC : NeedCreateNMC){
                //定义变量,判断是否需要顺延
                // //定义变量,判断是否需要顺延
                Boolean isDelay = false;
                //第一版:当合同生效日晚于【合同开始日+3个月】,第一次发放计划顺延为4/1~6/30 (下一季度)。
                //第二版:合同盖章完毕日晚于【合同开始日+3个月】,不生成第一个区间(即 顺延为下一季度)。
                //第三版:盖章完毕日晚于合同开始日1个月以上,自动从第二季度开始
                if(tempNMC.Contract_print_completed__c > tempNMC.Contract_Start_Date__c.addMonths(1)){
                    isDelay = true;
                }
                // //第一版:当合同生效日晚于【合同开始日+3个月】,第一次发放计划顺延为4/1~6/30 (下一季度)。
                // //第二版:合同盖章完毕日晚于【合同开始日+3个月】,不生成第一个区间(即 顺延为下一季度)。
                // //第三版:盖章完毕日晚于合同开始日1个月以上,自动从第二季度开始
                 if(tempNMC.Contract_print_completed__c > tempNMC.Contract_Start_Date__c.addMonths(1)){
                     isDelay = true;
                 }
                //获取当前遍历的合同的季度数 并遍历 生成报告书
                for(Integer qnum = 1;qnum <= QuarterNumMap.get(tempNMC.Id);qnum++){
                    //如果 当合同生效日晚于【合同开始日+3个月】, 顺延为第二季度
                    // //如果 当合同生效日晚于【合同开始日+3个月】, 顺延为第二季度
                    if(isDelay){
                        isDelay = false;
                        continue;
                         isDelay = false;
                         continue;
                    }
                    //2022-03-01  mzy SLA报告书上线后问题  start
                    //合同日
                    Date ContractConclusionDate = tempNMC.Contract_Conclusion_Date__c;
                    //2022-03-01  mzy SLA报告书上线后问题  end
                    //计算开始日期
                    Date DistributionStartDate= tempNMC.Contract_Start_Date__c.addMonths((qnum-1) * 3);
                    //计算结束日期
                    Date DistributionEndDate = tempNMC.Contract_Start_Date__c.addMonths((qnum) * 3).addDays(-1);
                    //2022-03-01  mzy  SLA报告书上线后问题  start
                    //合同日到满一个季度的期间大于2个月则需要生成发放计划,小于2个月则不需要生成计划
                    //为了防止出现 55485 的那种情况(合同日所在区间之前的季度不再生成)
                    if ((ContractConclusionDate.addMonths(2)>DistributionEndDate) || (ContractConclusionDate > DistributionEndDate)) {
                        continue;
                    }
                    //2022-03-01  mzy  SLA报告书上线后问题  end
                    //开始生成服务合同报告书
                    NewMaintenanceReport_Task__c tempNMCT = new NewMaintenanceReport_Task__c();
force-app/main/default/classes/CreateOpportunityTaskBatch.cls
@@ -42,6 +42,7 @@
        //2021-08-10  mzy  update   SWAG-C5R6GW   询价任务新增字段  start
        oppSql += ',Competitor__c,Close_Forecasted_Date__c,Created_Day__c,StageName__c,Bid_Date__c,Closing_Bid_Date__c ';
        //2021-08-10  mzy  update  SWAG-C5R6GW   询价任务新增字段  end
        oppSql += ', OCSM_RMB_Without_Tax_1000__c '; //2022-2-28 yjk 【委托】【询价任务】询价任务派送时点字段记录增加
        oppSql += ' from Opportunity ';
        // 询价科室分类(Opportunity_Category__c) 是GI
@@ -162,6 +163,7 @@
                //2021-11-26 yjk 询价任务增加派发原因字段
                newTask.OCSM_RMB_Without_Tax_1000__c = opp.OCSM_RMB_Without_Tax_1000__c; //2022-2-28 yjk 【委托】【询价任务】询价任务派送时点字段记录增加
                if(opp.Close_Forecasted_Date__c >= nextMonthFirstDay && opp.Close_Forecasted_Date__c<= nnexMonthLastDay){
                    if(
force-app/main/default/classes/DealerPersonnelController.cls
@@ -6,16 +6,13 @@
    public static String processData(String fileData,String sobjectName,List<String> fields) {
        system.debug('fileData===============>'+fileData);
        String errorMage = '';
        String str = '';
        try {
            if(fileData != null){
                String[] fileLines = new String[]{};
                fileLines = fileData.split('\n');
                system.debug('fileLines===================>'+fileLines);
                // 记录类型
                List<String> recordTypeList = new List<String>();
                // 客户名
                List<String> accountNameList = new List<String>();
                // 经销商管理编码
                List<String> managementCodeList = new List<String>();
                // 导入的数据
                List<List<String>> inputList = new List<List<String>>();
                for (Integer i = 1,j = fileLines.size(); i < j; i++) {
@@ -23,133 +20,89 @@
                    inputValues = fileLines[i].split(',');
                    System.debug('inputValues=============>'+inputValues);
                    if(inputValues != null){
                        if(inputValues[0] == '' || inputValues[0] == null){
                            errorMage += 'errorMage: 第' + i + '行,记录类型不能为空!';
                        if(inputValues[0] == '' || inputValues[0]== null){
                            errorMage += 'errorMage: 第' + i + '行,姓名不能为空!';
                            errorMage += '=';
                        } 
                        if(inputValues[1] == '' || inputValues[1]== null){
                            errorMage += 'errorMage: 第' + i + '行,姓氏不能为空!';
                            errorMage += '=';
                        }
                        if(inputValues[2] == '' || inputValues[2] == null){
                            errorMage += 'errorMage: 第' + i + '行,名字不能为空!';
                            errorMage += '=';
                        }
                        if(inputValues[3] == '' || inputValues[3] ==null){
                        if(inputValues[1] == '' || inputValues[1] ==null){
                            errorMage += 'errorMage: 第' + i + '行,手机不能为空!';
                            errorMage += '=';
                        }
                        boolean mobileNumberFlag = mobileNumberVerification(inputValues[3]);
                    System.debug('mobileNumberFlag=============>'+mobileNumberFlag);
                        boolean mobileNumberFlag = mobileNumberVerification(inputValues[1]);
                        if(mobileNumberFlag == false){
                            errorMage += 'errorMage: 你的手机号码不太正确,请检查您的手机是否正确!';
                            errorMage += '=';
                        }
                        if(inputValues[4] == '' || inputValues[4] == null){
                        if(inputValues[2] == '' || inputValues[2] == null){
                            errorMage += 'errorMage: 第' + i + '行,邮箱不能为空!';
                            errorMage += '=';
                        }
                        boolean mailboxFlag = mailboxVerification(inputValues[4]);
                    System.debug('mailboxFlag=============>'+mailboxFlag);
                        boolean mailboxFlag = mailboxVerification(inputValues[2]);
                        if(mailboxFlag == false){
                            errorMage += 'errorMage: 你的邮箱不太正确,请检查您的邮箱格式!';
                            errorMage += '=';
                        }
                        if(inputValues[5] == '' || inputValues[5] == null){
                            errorMage += 'errorMage: 第' + i + '行,客户名不能为空!';
                        if(inputValues[3] == '' || inputValues[3] == null){
                            errorMage += 'errorMage: 第' + i + '行,经销商管理编码不能为空!';
                            errorMage += '=';
                        }
                        str = inputValues[5];
                        recordTypeList.add(inputValues[0]);
                        accountNameList.add(str);
                        //导入的数据
                        inputList.add(inputvalues);
                        
                        managementCodeList.add(inputValues[3]);
                        inputList.add(inputValues);
                        //导入的数据
                        System.debug('inputValues[0]===============>'+ inputValues[0]);
                        System.debug('inputValues[1]===============>'+ inputValues[1]);
                        System.debug('inputValues[2]===============>'+ inputValues[2]);
                        System.debug('inputValues[3]===============>'+ inputValues[3]);
                        System.debug('inputValues[4]===============>'+ inputValues[4]);
                        System.debug('inputValues[5]===============>'+ inputValues[5]);
                        System.debug('inputValues[6]===============>'+ inputValues[6]);
                    }
                }
                Map<String,Account> accountMap = new Map<String,Account>();
                List<String> accountIdList = new List<String>();
                Map<String,RecordType> recordTypeMap = new Map<String,RecordType>();
                List<String> recordTypeIdList = new List<String>();
                List<Account> accountList = [select id, Name from Account where Name in: accountNameList];
                List<RecordType> rectCo = [select Id,Name from RecordType where IsActive = true and SobjectType = 'Contact' and Name in: recordTypeList];
                Map<String,Account> accountIdMap = new Map<String,Account>();
                List<Account> accountList = [select id, Name,Management_Code__c from Account where Management_Code__c in: managementCodeList];
                for(Account ac : accountList){ 
                    accountMap.put(ac.Name, ac);
                    accountIdList.add(ac.Id);
                }
                system.debug('accountList===============>'+accountList);
                system.debug('accountNameList===============>'+accountNameList);
                system.debug('accountMap===============>'+accountMap);
                for(RecordType re : rectCo){
                    recordTypeMap.put(re.Name, re);
                    recordTypeIdList.add(re.Id);
                    accountIdMap.put(ac.Management_Code__c,ac);
                }
                List<Contact> cnList = new List<Contact>();
                Integer lineNumber = 1;
                for(List<String> lineList :inputList){
                    Contact con = new Contact();
                    if(recordTypeMap.containsKey(lineList[0])){
                        con.RecordTypeId = recordTypeMap.get(lineList[0]).id;
                    //暂时导入的是经销商用户,所以记录类型只有经销商,暂时写死;后期如果有变动再更改
                    con.RecordTypeId = '01210000000QfWiAAK';
                    if(lineList[0] != null && lineList[0] != ''){
                        con.LastName  = lineList[0];
                    }else{
                        errorMage += 'error: 第'+ lineNumber +'行数据,记录类型'+lineList[0]+'不存在';
                        errorMage += '=';
                    }
                    if(lineList[1] != null && lineList[1] != ''){
                        con.LastName  = lineList[1];
                    }else{
                        errorMage += 'error: 第'+ lineNumber +'行数据,姓氏'+lineList[1]+'不存在';
                        errorMage += 'error: 第'+ lineNumber +'行数据,姓氏'+lineList[0]+'不存在';
                        errorMage += '=';
                    }   
                    if(lineList[1] != null && lineList[1] != ''){
                        if(mobileNumberVerification(lineList[1])){
                            con.MobilePhone = lineList[1];
                        }else{
                            errorMage += 'error: 第'+ lineNumber +'行数据,手机'+lineList[1]+'不正确!';
                            errorMage += '=';
                        }
                    }else{
                        errorMage += 'error: 第'+ lineNumber +'行数据,手机'+lineList[1]+'不存在';
                        errorMage += '=';
                    }
                    if(lineList[2] != null && lineList[2] != ''){
                        con.FirstName  = lineList[2];
                    }else{
                        errorMage += 'error: 第'+ lineNumber +'行数据,名字'+lineList[2]+'不存在';
                        errorMage += '=';
                    }
                    if(lineList[3] != null && lineList[3] != ''){
                        if(mobileNumberVerification(lineList[3])){
                            con.MobilePhone = lineList[3];
                        if(mailboxVerification(lineList[2])){
                            con.Email = lineList[2];
                        }else{
                            errorMage += 'error: 第'+ lineNumber +'行数据,手机'+lineList[3]+'不正确!';
                            errorMage += 'error: 第'+ lineNumber +'行数据,电子邮件'+lineList[2]+'不正确!';
                            errorMage += '=';
                        }
                    }else{
                        errorMage += 'error: 第'+ lineNumber +'行数据,手机'+lineList[3]+'不存在';
                        errorMage += 'error: 第'+ lineNumber +'行数据,电子邮件'+lineList[2]+'不存在';
                        errorMage += '=';
                    }
                    if(lineList[4] != null && lineList[4] != ''){
                        if(mailboxVerification(lineList[4])){
                            con.Email = lineList[4];
                        }else{
                            errorMage += 'error: 第'+ lineNumber +'行数据,电子邮件'+lineList[4]+'不正确!';
                            errorMage += '=';
                        }
                    if(accountIdMap.containsKey(lineList[3])){
                        con.AccountId = accountIdMap.get(lineList[3]).id;
                    }else{
                        errorMage += 'error: 第'+ lineNumber +'行数据,电子邮件'+lineList[4]+'不存在';
                        errorMage += 'error: 第'+ lineNumber +'行数据,经销商编码'+lineList[3]+'不存在';
                        errorMage += '=';
                    }
                    if(accountMap.containsKey(lineList[5])){
                        con.AccountId = accountMap.get(lineList[5]).id;
                    }else{
                        errorMage += 'error: 第'+ lineNumber +'行数据,客户名'+lineList[5]+'不存在';
                        errorMage += '=';
                    }
                    if(lineList[6] == 'TRUE'){
                        con.Agency_User__c =  true;
                    }else{
                        con.Agency_User__c =  false;
                    }
                    //暂定创建直接为 true
                    con.Agency_User__c =  true;
                    lineNumber++;
                    cnList.add(con);
                }
@@ -190,18 +143,6 @@
    }
    //新增客户人员;
    public static void insertContact(List<Contact> data) {
        // System.debug('data==============>'+data);
        // List<String> lastNameList = new List<String>();
        // List<String> firstNameList = new List<String>();
        // for(Contact con:data){
        //     lastNameList.add(con.LastName);
        //     firstNameList.add(con.FirstName);
        // }
        // List<Contact> contactList = [select id, Name,Agency_User__c from contact where LastName in: lastNameList AND FirstName in: firstNameList];
        // if(contactList.size() >= 0){
        //     return '';
        // }
        // System.debug('strNameList==============>'+strNameList);
        insert data;
    }
force-app/main/default/classes/DealerPersonnelControllerTest.cls
New file
@@ -0,0 +1,22 @@
@isTest
public with sharing class DealerPersonnelControllerTest {
        public static Account account1 = new Account();
        private static void testInit() {
            account1.Name = 'test1医院';
            account1.RecordTypeId = '01210000000QemG';
            account1.AgentCode_Ext__c = '737011';
            insert account1;
        }
        @isTest public static void selectProductCcategoryTest() {
            testInit();
            Test.startTest();
            String reports = DealerPersonnelController.processData('"姓名,手机,电子邮件,经销商编码,客户名\r\n小王,18801332211,123@qq.com,737011,启稳起步\r\n','',null);
            Test.stopTest();
        }
        @isTest public static void selectProductCcategoryTest01() {
            testInit();
            Test.startTest();
            String reports = DealerPersonnelController.processData('"姓名,手机,电子邮件,经销商编码,客户名\r\n,,,,\r\n','',null);
            Test.stopTest();
        }
}
force-app/main/default/classes/DealerPersonnelControllerTest.cls-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>52.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/EquipmentRealCoverageBatch.cls
New file
@@ -0,0 +1,193 @@
global class EquipmentRealCoverageBatch implements Database.Batchable<sObject>,Database.Stateful {
    public String query;
    public Date start_dateH1 ;
    public Date end_dateH1 ;
    public List<Id> conIds = new List<Id>();
    public List<Id> hospIds = new List<Id>();
    public Date toDayTime = Date.today();
    // public String type ;
    private BatchIF_Log__c iflog;
    global EquipmentRealCoverageBatch() {
        // if (i == 1) {
        //     this.query = 'select Id,(select Id,IF_Coverage_Real_Asset__c from Asset_Hospital__r where CurrentContract__c In :conIds) from Account';
        //     type = '分子';
        // }
        // if (i == 2) {
        this.query = 'select Id,(select id,IF_Coverage_Target_Asset__c,IF_Coverage_Real_Asset__c,CurrentContract__r.Contract_End_Date__c,Product2.Category4__c,Product2.ServiceCategory__c,Product2.Category3__c from Asset_Hospital__r where Status != \'廃棄\' and Status != \'待报废\''
                     +' and SerMarGuranteeType__c != \'服务多年保修\' and SerMarGuranteeType__c != \'市场多年保修\''
                     +' and Product2.ServiceCategory__c != null) from Account where id in :hospIds';
            // type = '分母';
        // }
        iflog = new BatchIF_Log__c();
        iflog.Type__c = 'PushNotification';
        iflog.Log__c  = 'EquipmentRealCoverageBatch start\n';
        iflog.ErrorLog__c = '';
        insert iflog;
    }
    global Database.QueryLocator start(Database.BatchableContext bc) {
        // if (type == '分子') {
        //      List<Maintenance_Contract__c> conList = new List<Maintenance_Contract__c>();
        //      // 判断为1H还是为2H
        //     if (toDayTime.month() >= 4 && toDayTime.month() <= 9) {
        //         start_dateH1 = Date.newInstance(toDayTime.year(),4,1);
        //         end_dateH1 = Date.newInstance(toDayTime.year(),9,30);
        //     }else{
        //         start_dateH1 = Date.newInstance(toDayTime.year(),10,1);
        //         end_dateH1 = Date.newInstance(toDayTime.year()+1,3,31);
        //     }
        //     List<Maintenance_Contract__c> conList1 = [select Id,Name,Contract_Start_Date__c,Contract_End_Date__c from Maintenance_Contract__c where Contract_Start_Date__c >= :start_dateH1 and Contract_End_Date__c <= :end_dateH1];
        //     conList.addAll(conList1);
        //       if(conList!=null){
        //             for (Maintenance_Contract__c con : conList) {
        //                     conIds.add(con.id);
        //              }
        //         }
        // }
        // if (type == '分母') {
            // 5条以上软性镜医院&&医院有效
            List<AggregateResult> Asset1 = [select count(Id),Hospital__c from asset where Product2.ServiceCategory__c ='软性镜'  Group by Hospital__c having count(Id)>=5];
           if(Asset1!=null){
               for (AggregateResult a1 : Asset1) {
                   hospIds.add(String.valueOf(a1.get('Hospital__c')));
               }
           }
        // }
        return Database.getQueryLocator(query);
    }
    global void execute(Database.BatchableContext BC, list<Account> accList) {
        List<Account_Service_Of_Target__c> asotList = new List<Account_Service_Of_Target__c>();
        // if (type == '分子') {
        //     for (Account a : accList) {
        //         for (Asset as1 : a.Asset_Hospital__r) {
        //             // 标记是否覆盖率实际设备
        //             as1.IF_Coverage_Real_Asset__c = '1';
        //             AssetsNew.add(as1);
        //         }
        //     }
        // }
        // if (type == '分母') {
            // 实际设备合同时间区间1H(4,9);2H(10,3)
            if (toDayTime.month() >= 4 && toDayTime.month() <= 9) {
                start_dateH1 = Date.newInstance(toDayTime.year(),9,1);
                end_dateH1 = Date.newInstance(toDayTime.year(),9,30);
            }else{
                start_dateH1 = Date.newInstance(toDayTime.year(),3,1);
                end_dateH1 = Date.newInstance(toDayTime.year()+1,3,31);
            }
            for (Account acc1 : accList) {
                 Account_Service_Of_Target__c asot = new Account_Service_Of_Target__c();
                // 覆盖目标(硬):泌尿科用硬性镜
                Integer mirror_1 = 0;
                // 覆盖目标(软):鼻咽喉镜
                Integer mirror_2 = 0;
                //覆盖目标(周边):光源
                Integer mirror_3 = 0;
                // 实际覆盖数(硬):泌尿科用硬性镜
                Integer mirror_4 = 0;
                // 实际覆盖数(硬):妇科用硬性镜
                Integer mirror_5 = 0;
                // 实际覆盖数(周边):光源
                Integer mirror_6 = 0;
                // 实际覆盖数(软):电子镜
                Integer mirror_7 = 0;
                List<Asset> AssetsTarget = new List<Asset>();
                List<Asset> AssetsReal = new List<Asset>();
                for (Asset ass1 : acc1.Asset_Hospital__r) {
                    // 标记是否覆盖率目标设备
                    ass1.IF_Coverage_Target_Asset__c = '1';
                     AssetsTarget.add(ass1);
                    // 标记是否覆盖率实际设备
                    if (ass1.CurrentContract__r.Contract_End_Date__c >= start_dateH1 && ass1.CurrentContract__r.Contract_End_Date__c <= end_dateH1) {
                        ass1.IF_Coverage_Real_Asset__c = '1';
                        AssetsReal.add(ass1);
                    }
                    if (ass1.Product2.Category4__c == '泌尿科用硬性镜') {
                        mirror_1++;
                    }
                    if(ass1.Product2.ServiceCategory__c =='软性镜'){
                        mirror_2++;
                    }
                    if (ass1.Product2.Category3__c == '光源') {
                        mirror_3++;
                    }
                    if (AssetsTarget!=null) {
                        try {
                            update AssetsTarget;
                        }
                        catch (Exception e) {
                            iflog.ErrorLog__c += 'ERROR'+'['+'update AssetsTarget:'+']'+e.getMessage()+'\n';
                         }
                    }
                     if (AssetsReal!=null) {
                        try {
                            update AssetsReal;
                        }
                        catch (Exception e) {
                            iflog.ErrorLog__c += 'ERROR'+'['+'update AssetsReal:'+']'+e.getMessage()+'\n';
                         }
                    }
                 }
                // List<Asset> assList = [select id,Product2.Category4__c,Product2.ServiceCategory__c,Product2.Category3__c from Asset
                //                     where IF_Coverage_Real_Asset__c = '1' and Hospital__c = :acc1.id];
                for (Asset AtoHp: AssetsReal) {
                    if (AtoHp.Product2.Category4__c == '泌尿科用硬性镜') {
                        mirror_4++;
                    }
                    if (AtoHp.Product2.Category4__c == '妇科用硬性镜') {
                        mirror_5++;
                    }
                    if (AtoHp.Product2.Category3__c == '光源') {
                        mirror_6++;
                    }
                    if (AtoHp.Product2.ServiceCategory__c =='软性镜') {
                        mirror_7++;
                    }
                }
                asot.Account_HP__c = acc1.id;
                asot.Coverage_Target_Account__c = true;
                asot.Target_Rigid_Mirror_2__c = mirror_1;
                asot.Target_Soft_Mirror_2__c = mirror_2;
                asot.Target_Correlation_Lightsource__c = mirror_3;
                asot.Finish_Rigid_Mirror_2__c = mirror_4;
                asot.Finish_Rigid_Mirror_3__c = mirror_5;
                asot.Finish_Correlation_Lightsource__c = mirror_6;
                asot.Finish_Rigid_Mirror_1__c = mirror_7;
                if (toDayTime.year()<=2029 && toDayTime.year()>=2023) {
                    asot.OCSM_Period__c =  'FY'+toDayTime.year();
                    if (toDayTime.month() >= 4 && toDayTime.month() <= 9) {
                        asot.OCSM_Period_half__c =  '1H';
                    }else{
                        asot.OCSM_Period_half__c =  '2H';
                    }
                }
                asotList.add(asot);
            }
        if (asotList!=null) {
            try {
                insert asotList;
            }
            catch (Exception e) {
                iflog.ErrorLog__c += 'ERROR'+'['+'insert asotList:'+']'+e.getMessage()+'\n';
            }
        }
    }
    global void finish(Database.BatchableContext BC) {
        iflog.Log__c += '\nEquipmentRealCoverageBatch end';
        String tmp = iflog.ErrorLog__c;
        if (tmp.length() > 65000) {
            tmp = tmp.substring(0, 65000);
            tmp += ' ...have more lines...';
            iflog.ErrorLog__c = tmp;
        }
        update iflog;
    }
}
force-app/main/default/classes/EquipmentRealCoverageBatch.cls-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>51.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/EquipmentRealCoverageBatchTest.cls
New file
@@ -0,0 +1,235 @@
@isTest
private class EquipmentRealCoverageBatchTest {
    @testSetup
    private static void setUpDate(){
        // 病院を作る
        Account hospital = new Account();
        hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id;
        hospital.Name = 'test hospital';
        hospital.Is_Active__c = '有効';
        hospital.Attribute_Type__c = '卫生部';
        hospital.Speciality_Type__c = '综合医院';
        hospital.Grade__c = '一级';
        hospital.OCM_Category__c = 'SLTV';
        hospital.Is_Medical__c = '医疗机构';
        hospital.Town__c = '东京';
        insert hospital;
        // 戦略科室を得る
        Account[] strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_OTH'];
        // 診療科を作る
        Account dep = new Account();
        dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_OTH'].id;
        dep.Name = 'test dep';
        dep.AgentCode_Ext__c = System.Label.Account_Asset_FJZ;
        dep.ParentId = strategicDep[0].Id;
        dep.Department_Class__c = strategicDep[0].Id;
        dep.Hospital__c = hospital.Id;
        insert dep;
        Contact contact2 = new Contact();
        contact2.AccountId = dep.Id;
        contact2.FirstName = '責任者';
        contact2.LastName = 'test1经销商';
        insert contact2;
        // 产品
        Product2 pro1 = new Product2(Name='name01',IsActive=true,Family='GI',
                Fixture_Model_No__c='n01',Serial_Lot_No__c='S/N tracing',
                Fixture_Model_No_T__c = 'n01',
                ProductCode_Ext__c='pc01',Manual_Entry__c=false,
                Category3__c='电子镜');
        Product2 pro2 = new Product2(Name='name02',IsActive=true,Family='GI',
                Fixture_Model_No__c='n02',Serial_Lot_No__c='Lot tracing',
                ProductCode_Ext__c='pc02',Manual_Entry__c=false,
                Category3__c='纤维镜');
        Product2 pro3 = new Product2(Name='name03',IsActive=true,Family='GI',
                Fixture_Model_No__c='n03',Serial_Lot_No__c='Lot tracing',
                ProductCode_Ext__c='pc03',Manual_Entry__c=false,
                Category3__c='EUS');
        Product2 pro4 = new Product2(Name='name04',IsActive=true,Family='GI',
                Fixture_Model_No__c='n04',Serial_Lot_No__c='Lot tracing',
                ProductCode_Ext__c='pc04',Manual_Entry__c=false,
                 Category3__c='EUS',
                Category4__c ='泌尿科用硬性镜');
        Product2 pro5 = new Product2(Name='name05',IsActive=true,Family='GI',
                Fixture_Model_No__c='n05',Serial_Lot_No__c='Lot tracing',
                ProductCode_Ext__c='pc05',Manual_Entry__c=false,
                 Category3__c='EUS',
                Category4__c = '妇科用硬性镜');
        insert new Product2[] {pro1, pro2, pro3,pro4,pro5};
        Date toDayTime = Date.today();
        Maintenance_Contract__c contract = new Maintenance_Contract__c();
        contract.Name = 'tect contract';
        contract.status__c ='契約';
        contract.Maintenance_Contract_No__c = 'Kami_Contract_No';
        contract.Contract_Conclusion_Date__c = Date.today();
        contract.Hospital__c = hospital.Id;
        contract.Department_Class__c = strategicDep[0].Id;
        contract.Department__c = dep.Id;
        contract.Contract_Start_Date__c=Date.newInstance(toDayTime.year(),3,2);  // 10日前
        contract.Contract_End_Date__c = Date.newInstance(toDayTime.year()+1,3,20);       // 5日後
        contract.SalesOfficeCode_selection__c = '北京RC';
        contract.RecordTypeId = Schema.SObjectType.Maintenance_Contract__c.getRecordTypeInfosByDeveloperName().get('VM_Contract').getRecordTypeId();
        insert contract;
        List<Maintenance_Contract__c> MaintenanceContract=[select id from Maintenance_Contract__c];
        //---------------------------主体 两个附属品(个体管理 数量管理)
        // 保有设备A (主体)
        Asset assetA1 = new Asset(Asset_Owner__c = 'Olympus');
        assetA1.RecordTypeId = System.Label.Asset_RecordType;
        assetA1.SerialNumber = 'ass01';
        assetA1.Name = 'ass01';
        assetA1.AccountId = dep.Id;
        assetA1.Department_Class__c = strategicDep[0].Id;
        assetA1.Hospital__c = hospital.Id;
        assetA1.Product2Id = pro1.Id;
        assetA1.Quantity = 1;
        assetA1.Status = '有库存';
        assetA1.Manage_type__c = '个体管理';
        assetA1.Loaner_accsessary__c = false;
        assetA1.Product_category__c = 'GI';
        assetA1.Delete_Flag__c = false;
        assetA1.Freeze_sign__c = false;
        assetA1.Out_of_wh__c = 0;
        assetA1.Salesdepartment__c = '1.华北营业本部';
        assetA1.Internal_asset_location__c = '北京 备品中心';
        assetA1.Product_category__c = 'GI';
        assetA1.Equipment_Type__c = '产品试用';
        assetA1.SalesProvince__c = '北京';
        assetA1.WH_location__c = '货架号1';
        assetA1.Asset_loaner_category__c = '固定资产';
        assetA1.CompanyOfEquipment__c = '123';
        assetA1.Internal_Asset_number__c = '123';
        assetA1.CurrentContract__c=MaintenanceContract[0].Id;
        // assetA1.AssetManageConfirm__c = true;
        // 保有设备A (附属品 数量管理)
        Asset assetA2 = new Asset(Asset_Owner__c = 'Olympus');
        assetA2.RecordTypeId = System.Label.Asset_RecordType;
        assetA2.SerialNumber = 'ass02';
        assetA2.Name = 'ass02';
        assetA2.AccountId = dep.Id;
        assetA2.Department_Class__c = strategicDep[0].Id;
        assetA2.Hospital__c = hospital.Id;
        assetA2.Product2Id = pro2.Id;
        assetA2.Quantity = 10;
        assetA2.Status = '有库存';
        assetA2.Manage_type__c = '数量管理';
        assetA2.Loaner_accsessary__c = true;
        assetA2.Product_category__c = 'GI';
        assetA2.Delete_Flag__c = false;
        assetA2.Freeze_sign__c = false;
        assetA2.Out_of_wh__c = 3;
        assetA2.Frozen_Quantity__c = 2;
        assetA2.Salesdepartment__c = '1.华北营业本部';
        assetA2.Internal_asset_location__c = '北京 备品中心';
        assetA2.Product_category__c = 'GI';
        assetA2.Equipment_Type__c = '产品试用';
        assetA2.SalesProvince__c = '北京';
        assetA2.WH_location__c = '货架号2';
        assetA2.Asset_loaner_category__c = '固定资产';
        assetA2.CompanyOfEquipment__c = '123';
        assetA2.Internal_Asset_number__c = '123';
        assetA2.CurrentContract__c=MaintenanceContract[0].Id;
        // assetA2.AssetManageConfirm__c = true;
        // 保有设备A (附属品 个体管理)
        Asset assetA3 = new Asset(Asset_Owner__c = 'Olympus');
        assetA3.RecordTypeId = System.Label.Asset_RecordType;
        assetA3.SerialNumber = 'ass03';
        assetA3.Name = 'ass03';
        assetA3.AccountId = dep.Id;
        assetA3.Department_Class__c = strategicDep[0].Id;
        assetA3.Hospital__c = hospital.Id;
        assetA3.Product2Id = pro3.Id;
        assetA3.Quantity = 10;
        assetA3.Status = '有库存';
        assetA3.Manage_type__c = '数量管理';
        assetA3.Loaner_accsessary__c = true;
        assetA3.Product_category__c = 'GI';
        assetA3.Delete_Flag__c = false;
        assetA3.Freeze_sign__c = false;
        assetA3.Out_of_wh__c = 3;
        assetA3.Salesdepartment__c = '1.华北营业本部';
        assetA3.Internal_asset_location__c = '北京 备品中心';
        assetA3.Product_category__c = 'GI';
        assetA3.Equipment_Type__c = '产品试用';
        assetA3.SalesProvince__c = '北京';
        assetA3.WH_location__c = '货架号3';
        assetA3.Abandoned_Inventory__c = 1;
        assetA3.Asset_loaner_category__c = '固定资产';
        assetA3.CompanyOfEquipment__c = '123';
        assetA3.Internal_Asset_number__c = '123';
        assetA3.CurrentContract__c=MaintenanceContract[0].Id;
    // 保有设备A (附属品 数量管理)
        Asset assetA4 = new Asset(Asset_Owner__c = 'Olympus');
        assetA4.RecordTypeId = System.Label.Asset_RecordType;
        assetA4.SerialNumber = 'ass04';
        assetA4.Name = 'ass04';
        assetA4.AccountId = dep.Id;
        assetA4.Department_Class__c = strategicDep[0].Id;
        assetA4.Hospital__c = hospital.Id;
        assetA4.Product2Id = pro4.Id;
        assetA4.Quantity = 10;
        assetA4.Status = '有库存';
        assetA4.Manage_type__c = '数量管理';
        assetA4.Loaner_accsessary__c = true;
        assetA4.Product_category__c = 'GI';
        assetA4.Delete_Flag__c = false;
        assetA4.Freeze_sign__c = false;
        assetA4.Out_of_wh__c = 3;
        assetA4.Frozen_Quantity__c = 2;
        assetA4.Salesdepartment__c = '1.华北营业本部';
        assetA4.Internal_asset_location__c = '北京 备品中心';
        assetA4.Product_category__c = 'GI';
        assetA4.Equipment_Type__c = '产品试用';
        assetA4.SalesProvince__c = '北京';
        assetA4.WH_location__c = '货架号2';
        assetA4.Asset_loaner_category__c = '固定资产';
        assetA4.CompanyOfEquipment__c = '123';
        assetA4.Internal_Asset_number__c = '123';
        assetA4.CurrentContract__c=MaintenanceContract[0].Id;
        // assetA2.AssetManageConfirm__c = true;
        // 保有设备A (附属品 数量管理)
        Asset assetA5 = new Asset(Asset_Owner__c = 'Olympus');
        assetA5.RecordTypeId = System.Label.Asset_RecordType;
        assetA5.SerialNumber = 'ass05';
        assetA5.Name = 'ass05';
        assetA5.AccountId = dep.Id;
        assetA5.Department_Class__c = strategicDep[0].Id;
        assetA5.Hospital__c = hospital.Id;
        assetA5.Product2Id = pro5.Id;
        assetA5.Quantity = 10;
        assetA5.Status = '有库存';
        assetA5.Manage_type__c = '数量管理';
        assetA5.Loaner_accsessary__c = true;
        assetA5.Product_category__c = 'GI';
        assetA5.Delete_Flag__c = false;
        assetA5.Freeze_sign__c = false;
        assetA5.Out_of_wh__c = 3;
        assetA5.Frozen_Quantity__c = 2;
        assetA5.Salesdepartment__c = '1.华北营业本部';
        assetA5.Internal_asset_location__c = '北京 备品中心';
        assetA5.Product_category__c = 'GI';
        assetA5.Equipment_Type__c = '产品试用';
        assetA5.SalesProvince__c = '北京';
        assetA5.WH_location__c = '货架号2';
        assetA5.Asset_loaner_category__c = '固定资产';
        assetA5.CompanyOfEquipment__c = '123';
        assetA5.Internal_Asset_number__c = '123';
        assetA5.CurrentContract__c=MaintenanceContract[0].Id;
        // assetA2.AssetManageConfirm__c = true;
        insert new Asset[] {assetA1, assetA2, assetA3,assetA4,assetA5};
    }
    static testMethod void testMethod1() {
        database.executeBatch(new EquipmentRealCoverageBatch(),200);
    }
}
force-app/main/default/classes/EquipmentRealCoverageBatchTest.cls-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>51.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/EquipmentRenewBatch.cls
New file
@@ -0,0 +1,133 @@
global class EquipmentRenewBatch implements Database.Batchable<sObject>,Database.Stateful {
    public String query;
    public Date toDayTime = Date.today();
    public Date start_date1 ;
    public Date end_date1 ;
    public Date start_date2 ;
    public Date end_date2 ;
    public Date deadlineTime;
    private BatchIF_Log__c iflog;
    global EquipmentRenewBatch() {
        this.query = '';
        iflog = new BatchIF_Log__c();
        iflog.Type__c = 'PushNotification';
        iflog.Log__c  = 'EquipmentRenewBatch start\n';
        iflog.ErrorLog__c = '';
        insert iflog;
    }
    global Database.QueryLocator start(Database.BatchableContext bc) {
        if (toDayTime.month() >= 4 && toDayTime.month() <= 9) {
            this.start_date1 = Date.newInstance(toDayTime.year()-1,4,1);
            this.end_date1 = Date.newInstance(toDayTime.year()-1,12,31);
            this.start_date2 = Date.newInstance(toDayTime.year(),1,1);
            this.end_date2 = Date.newInstance(toDayTime.year(),6,30);
            this.deadlineTime = Date.newInstance(toDayTime.year(),3,31);
        }else{
            this.start_date1 = Date.newInstance(toDayTime.year()-1,10,1);
            this.end_date1 = Date.newInstance(toDayTime.year(),6,30);
            this.start_date2 = Date.newInstance(toDayTime.year(),7,1);
            this.end_date2 = Date.newInstance(toDayTime.year(),12,31);
            this.deadlineTime = Date.newInstance(toDayTime.year(),9,30);
        }
        query+='select Id,(select Id,CurrentContract__c,CurrentContract__r.Contract_End_Date__c,CurrentContract__r.Contract_Start_Date__c,CurrentContract__r.New_Contract_TypeF_Text__c,Product2.ServiceCategory__c,CurrentContract__r.Status__c'
                + ' from Asset_Hospital__r where CurrentContract__r.Contract_End_Date__c >= :start_date1 and CurrentContract__r.Contract_End_Date__c <= :end_date2)'
                + ' from Account';
        return Database.getQueryLocator(query);
    }
    global void execute(Database.BatchableContext BC, list<Account> Accounts) {
        List<Account_Service_Of_Target__c> asotList = new List<Account_Service_Of_Target__c>();
        for (Account acc : Accounts) {
            Account_Service_Of_Target__c asot = new Account_Service_Of_Target__c();
            List<Asset> AssetsTarget = new List<Asset>();
            List<Asset> AssetsReal = new List<Asset>();
            // 实际续签数:设备数
            Integer mirror_1 = 0;
            // 续签目标:设备数
            Integer mirror_2 = 0;
            for (Asset ass : acc.Asset_Hospital__r) {
                // 分子
                    //1. 设备关联的合同类型是“续签合同” 2. 在2023年3月31日前系统生效完毕
                    if (ass.CurrentContract__r.Contract_End_Date__c <= Date.newInstance(toDayTime.year()+1,3,31) && ass.CurrentContract__r.New_Contract_TypeF_Text__c == '续签合同') {
                            // 标记为是否续签实际设备
                            ass.IF_Renewalrate_Real_Asset__c = '1';
                            AssetsReal.add(ass);
                            mirror_1++;
                    }
                    // 分母
                    /*1H考核对象: 1)、2021.4.1-2021.12.31合同结束且截止2022.3.31未续签的设备;
                    2)、2022.1.1-2022.6.30合同结束,不论该设备是否续签
                    2H考核对象: 1)、2021.10.1-2022.6.30合同结束且截止2022.9.30未续签的设备;
                    2)、2022.7.1-2022.12.31 合同结束,不论该设备是否续签
                    */
                    Boolean result = true;
                    if (ass.Product2.ServiceCategory__c != null) {
                        if (ass.CurrentContract__r.Contract_End_Date__c>=start_date1&&ass.CurrentContract__r.Contract_End_Date__c<=end_date1){
                            if (ass.CurrentContract__c == null || ass.CurrentContract__r.Status__c == '合同结束') {
                                ass.IF_Renewalrate_Target_Asset__c = '1';
                                AssetsTarget.add(ass);
                                result = false;
                                mirror_2++;
                            }
                            if (result) {
                                if (ass.CurrentContract__r.Contract_Start_Date__c <= deadlineTime) {
                                ass.IF_Renewalrate_Target_Asset__c = '1';
                                AssetsTarget.add(ass);
                                mirror_2++;
                                }
                            }
                        }
                        if (ass.CurrentContract__r.Contract_End_Date__c>=start_date2&&ass.CurrentContract__r.Contract_End_Date__c<=end_date2) {
                            ass.IF_Renewalrate_Target_Asset__c = '1';
                            AssetsTarget.add(ass);
                            mirror_2++;
                        }
                    }
                if (AssetsReal!=null) {
                    try {
                        update AssetsReal;
                    }
                    catch (Exception e) {
                        iflog.ErrorLog__c += 'ERROR'+'['+'update AssetsReal:'+']'+e.getMessage()+'\n';
                     }
                }
                 if (AssetsTarget!=null) {
                    try {
                        update AssetsTarget;
                    }
                    catch (Exception e) {
                        iflog.ErrorLog__c += 'ERROR'+'['+'update AssetsTarget:'+']'+e.getMessage()+'\n';
                     }
                }
            }
            asot.Account_HP__c = acc.id;
            // asot.Finish_Asset__c = mirror_1;
            // asot.AssetContinueTaget__c = mirror_2;
            // asotList.add(asot);
        }
        // if (asotList!=null) {
        //     try {
        //         insert asotList;
        //     }
        //     catch (Exception e) {
        //         iflog.ErrorLog__c += 'ERROR'+'['+'insert asotList:'+']'+e.getMessage()+'\n';
        //     }
        // }
    }
    global void finish(Database.BatchableContext BC) {
        iflog.Log__c += '\nEquipmentRenewBatch end';
        String tmp = iflog.ErrorLog__c;
        if (tmp.length() > 65000) {
            tmp = tmp.substring(0, 65000);
            tmp += ' ...have more lines...';
            iflog.ErrorLog__c = tmp;
        }
        update iflog;
    }
}
force-app/main/default/classes/EquipmentRenewBatch.cls-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>51.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/EquipmentRenewBatchTest.cls
New file
@@ -0,0 +1,213 @@
@isTest(SeeAllData=false)
private class EquipmentRenewBatchTest {
    private static void initData(){
         List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
        if (rectCo.size() == 0) {
            return;
        }
        List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 呼吸科'];
        if (rectSct.size() == 0) {
            return;
        }
        List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '診療科 消化科'];
        if (rectDpt.size() == 0) {
            return;
        }
        Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin];
        User MacOwner = new User(Test_staff__c = true, LastName = 'hp1', FirstName = 'owner1', Alias = 'hp', CommunityNickname = 'hpOwner1', Email = 'olympus_hpowner@sunbridge.com',Job_Category__c = '销售服务', Username = 'olympus_hpowner@sunbridge.com1', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
        insert MacOwner;
        Account hospital = new Account();
        hospital.RecordTypeId = rectCo[0].Id;
        hospital.Name         = 'NFM007Testhospital';
        insert hospital;
        // 戦略科室を得る
        List<Account> strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_GI'];
        Account section = new Account();
        section.RecordTypeId = rectSct[0].Id;
        section.Name         = '*';
        section.Department_Class_Label__c = '消化科';
        section.ParentId                  = hospital.Id;
        section.Hospital_Department_Class__c = hospital.Id;
        section.AgentCode_Ext__c = '9999900';
        insert section;
        Account depart = new Account();
        depart.RecordTypeId = rectDpt[0].Id;
        depart.Name         = '*';
        depart.Department_Name__c  = 'NFM007TestDepart';
        depart.ParentId = strategicDep[0].Id;
        depart.Department_Class__c = strategicDep[0].Id;
        depart.Hospital__c = hospital.Id;
        insert depart;
        Product2 prd1 = new Product2();
        prd1.ProductCode_Ext__c     = 'Prd1';
        prd1.ProductCode            = 'Prd1';
        prd1.Repair_Product_Code__c = 'Prd1_RP';
        prd1.Name                   = 'Prd1';
        prd1.Manual_Entry__c        = false;
        // prd1.Category2__c = '本体';
        // prd1.Category3__c = '纤维镜';
        prd1.Category4__c = 'SD EndoEYE';
        // prd1.Category5__c = '260SL系列';
        prd1.Asset_Model_No__c = '1001';
        prd1.Important_product__c = true;
        prd1.Important_Rroduct_1GI__c = true;
        insert prd1;
        Product2 prd2 = new Product2();
        prd2.ProductCode_Ext__c     = 'Prd2';
        prd2.ProductCode            = 'Prd2';
        prd2.Repair_Product_Code__c = 'Prd2_RP';
        prd2.Name                   = 'Prd2';
        prd2.Manual_Entry__c        = false;
        // prd1.Category2__c = '本体';
        prd2.Category3__c = '光源';
        // prd2.Category4__c = 'SD EndoEYE';
        // prd1.Category5__c = '260SL系列';
        prd2.Asset_Model_No__c = '1001';
        prd2.Important_product__c = true;
        prd2.Important_Rroduct_1GI__c = true;
        insert prd2;
        Consumable_order_details2__c saledet1 = new Consumable_order_details2__c();
        saledet1.Name = 'OCM_01_001001';
        // saledet1.Consumable_order_minor__c = Order1.Id;
        saledet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
        saledet1.Bar_Code__c = '0114953170032070111804001082K250BBBBB';
        // saledet1.Consumable_Product__c = prd1.Id;
        saledet1.Used_account__c = section.Id;
        saledet1.Delivery_List_RMB__c = 11;
        saledet1.Box_Piece__c = '盒';
        saledet1.TracingCode__c = 'BBBBB';
        saledet1.SerialLotNo__c = '82K';
        saledet1.Guarantee_period_for_products__c = Date.today().addDays(5);
        saledet1.Sterilization_limit__c = Date.today().addDays(5);
        saledet1.Send_Date__c = null;
        //saledet1.Dealer_Shipment__c = false;
        saledet1.Arrive_date__c = null;
        //saledet1.Dealer_Arrive__c = false;
        saledet1.Used_date__c = null;
        //saledet1.Dealer_Saled__c = false;
        saledet1.Deliver_date__c = Date.today().addDays(-10);
        insert saledet1;
        // 维修合同を作成する
        Maintenance_Contract__c contract = new Maintenance_Contract__c();
        contract.Name = 'tect contract';
        contract.Hospital__c = hospital.Id;
        contract.Department_Class__c = strategicDep[0].Id;
        contract.Department__c = depart.Id;
        contract.Service_Contract_Staff__c = MacOwner.Id;
        contract.Payment_Plan_Sum_First__c = 1;
        contract.Status__c = '契約満了';
        contract.Maintenance_Contract_No__c = '11123';
         contract.recordtypeId =
             Schema.SObjectType.Maintenance_Contract__c.getRecordTypeInfosByDeveloperName().get('NewMaintenance_Contract').getRecordTypeId();
        contract.Not_Upper_limit_reason__c = ' 1';
        contract.Contract_Start_Date__c = Date.newInstance(2021,10,5);
        contract.Contract_End_Date__c = Date.newInstance(2021,11,1);
        contract.SalesOfficeCode_selection__c = '北京RC';
        contract.New_Contract_TypeF_Text__c = '续签合同';
        system.assertEquals(contract.Contract_End_Date__c >= Date.newInstance(2021,10,1) && contract.Contract_End_Date__c <= Date.newInstance(2022,9,30),true);
        insert contract;
        Maintenance_Contract__c contract2 = new Maintenance_Contract__c();
        contract2.Name = 'tect contract2';
        contract2.Hospital__c = hospital.Id;
        contract2.Department_Class__c = strategicDep[0].Id;
        contract2.Department__c = depart.Id;
        contract2.Service_Contract_Staff__c = MacOwner.Id;
        contract2.Payment_Plan_Sum_First__c = 1;
        contract2.Status__c = '契約';
        contract2.Maintenance_Contract_No__c = '11123111';
        contract2.Not_Upper_limit_reason__c = ' 2';
        contract2.Contract_Start_Date__c = Date.newInstance(2021,10,5);
        contract2.Contract_End_Date__c = Date.newInstance(2021,11,1);
        contract2.SalesOfficeCode_selection__c = '北京RC';
        system.assertEquals(contract2.Contract_End_Date__c >= Date.newInstance(2021,10,1) && contract2.Contract_End_Date__c <= Date.newInstance(2022,9,30),true);
        insert contract2;
        asset ast = new asset();
        ast.Name                             = prd1.Name;
        ast.Product2Id                       = prd1.Id;
        ast.SerialNumber                     = saledet1.SerialLotNo__c + '(' + saledet1.TracingCode__c + ')';
        ast.SLMark__c                        = 'Serial Number';         // 固定 dnInfo.SorLMark;
        ast.Guarantee_period_for_products__c = saledet1.Guarantee_period_for_products__c;
        ast.TracingCode__c                   = saledet1.TracingCode__c;
        ast.Guaranteen_end__c                = saledet1.Sterilization_limit__c;
        ast.Barcode__c                       = saledet1.Bar_Code__c;
        ast.Product_Serial_No__c             = saledet1.SerialLotNo__c  + '(' + saledet1.TracingCode__c + ')';
        ast.Asset_Owner__c                   = '经销商资产';
        ast.AccountId                        = depart.Id;
        ast.Department_Class__c              = section.Id;
        // ast.Asset_owner_delaer_name__c       = hospital.Id;
        ast.Hospital__c                      = hospital.Id;
        ast.CurrentContract__c = contract.Id;
        ast.CurrentContract_Asset_Price__c = 0;
        insert ast;
        asset ast1 = new asset();
        ast1.Name                             = prd2.Name;
        ast1.Product2Id                       = prd2.Id;
        ast1.SerialNumber                     = saledet1.SerialLotNo__c + '(' + saledet1.TracingCode__c + ')';
        ast1.SLMark__c                        = 'Serial Number';         // 固定 dnInfo.SorLMark;
        ast1.Guarantee_period_for_products__c = saledet1.Guarantee_period_for_products__c;
        ast1.TracingCode__c                   = saledet1.TracingCode__c;
        ast1.Guaranteen_end__c                = saledet1.Sterilization_limit__c;
        ast1.Barcode__c                       = saledet1.Bar_Code__c;
        ast1.Product_Serial_No__c             = saledet1.SerialLotNo__c  + '(' + saledet1.TracingCode__c + ')';
        ast1.Asset_Owner__c                   = '经销商资产';
        ast1.AccountId                        = depart.Id;
        ast1.Department_Class__c              = section.Id;
        // ast.Asset_owner_delaer_name__c       = hospital.Id;
        ast1.Hospital__c                      = hospital.Id;
        ast1.CurrentContract__c = contract2.Id;
        ast1.CurrentContract_Asset_Price__c = 0;
        insert ast1;
    }
    static testMethod void testMethod1() {
        Date toDayTime = Date.today();
         Date start_date1 ;
         Date end_date1 ;
         Date start_date2 ;
         Date end_date2 ;
         Date deadlineTime;
           if (toDayTime.month() >= 4 && toDayTime.month() <= 9) {
            start_date1 = Date.newInstance(toDayTime.year()-1,4,1);
            end_date1 = Date.newInstance(toDayTime.year()-1,12,31);
            start_date2 = Date.newInstance(toDayTime.year(),1,1);
            end_date2 = Date.newInstance(toDayTime.year(),6,30);
            deadlineTime = Date.newInstance(toDayTime.year(),3,31);
        }else{
            start_date1 = Date.newInstance(toDayTime.year()-1,10,1);
            end_date1 = Date.newInstance(toDayTime.year(),6,30);
            start_date2 = Date.newInstance(toDayTime.year(),7,1);
            end_date2 = Date.newInstance(toDayTime.year(),12,31);
            deadlineTime = Date.newInstance(toDayTime.year(),9,30);
        }
        system.Test.startTest();
        initData();
        String query='select Id,(select Id,CurrentContract__c,CurrentContract__r.Contract_End_Date__c,CurrentContract__r.Contract_Start_Date__c,CurrentContract__r.New_Contract_TypeF_Text__c,Product2.ServiceCategory__c,CurrentContract__r.Status__c'
                + ' from Asset_Hospital__r where CurrentContract__r.Contract_End_Date__c >= :start_date1 and CurrentContract__r.Contract_End_Date__c <= :end_date2)'
                + ' from Account';
               List<Account> accs =  database.query(query);
               for (Account  acc: accs) {
                   for (Asset ass : acc.Asset_Hospital__r) {
                        system.debug('acc$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'+ass);
                   }
               }
               system.assertEquals(true,accs == null);
        database.executeBatch(new EquipmentRenewBatch(),200);
        system.Test.stopTest();
    }
}
force-app/main/default/classes/EquipmentRenewBatchTest.cls-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>51.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/EquipmentSetShippmentReceived1Controller.cls
@@ -174,8 +174,9 @@
    public PageReference save() {
        //检查是否可以继续
        Rental_Apply__c RaTar = [select Campaign__c,Repair__c,next_action__c,QIS_number__r.ReplaceDeliveryDate__c,demo_purpose2__c,Follow_UP_Opp__r.Shipping_Finished_Day_Func__c,
                                                Campaign__r.Status,repair__r.Return_Without_Repair_Date__c,Repair__r.Repair_Final_Inspection_Date__c,Repair__r.Repair_Shipped_Date__c
        Rental_Apply__c RaTar = [select Name,Campaign__c,Repair__c,next_action__c,QIS_number__r.ReplaceDeliveryDate__c,demo_purpose2__c,Follow_UP_Opp__r.Shipping_Finished_Day_Func__c,
                                                Campaign__r.Status,repair__r.Return_Without_Repair_Date__c,Repair__r.Repair_Final_Inspection_Date__c,Repair__r.Repair_Shipped_Date__c,
                                                Campaign__r.IF_Approved__c,Campaign__r.Meeting_Approved_No__c
                                            from Rental_Apply__c 
                                            where id=:Raid];
@@ -203,9 +204,15 @@
        }else if(RaTar.demo_purpose2__c=='索赔QIS' && RaTar.next_action__c=='无偿更换' && RaTar.QIS_number__r.ReplaceDeliveryDate__c!= null){
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '索赔QIS目的,QIS已有新品发货日,不能继续了'));
                return null;
           }
        }
        //1822 yc 20211025 end
        
        //20220225 sx start obpm 下架增加 是否申请决裁勾着没有决裁编号不能进行操作
        else if ( RaTar.Campaign__c!= null && RaTar.Campaign__r.IF_Approved__c && RaTar.Campaign__r.Meeting_Approved_No__c == null){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '单号No.'+ RaTar.Name + '已申请决裁但决裁编码为空'));
        }
        //20220225 sx end 下架增加判断
        String userid = Userinfo.getUserId();
        List<Rental_Apply_Equipment_Set_Detail__c> eList = new List<Rental_Apply_Equipment_Set_Detail__c>();
        Map<Id, Boolean> stockDownMap = new Map<Id, Boolean>();
force-app/main/default/classes/EquipmentSetShippmentReceived2Controller.cls
@@ -201,7 +201,8 @@
        //检查是否可以继续
        Rental_Apply__c RaTar = [select Campaign__c,Repair__c,next_action__c,QIS_number__r.ReplaceDeliveryDate__c,demo_purpose2__c,Follow_UP_Opp__r.Shipping_Finished_Day_Func__c,
                                                Campaign__r.Status,repair__r.Return_Without_Repair_Date__c,Repair__r.Repair_Final_Inspection_Date__c,Repair__r.Repair_Shipped_Date__c
                                                Campaign__r.Status,repair__r.Return_Without_Repair_Date__c,Repair__r.Repair_Final_Inspection_Date__c,Repair__r.Repair_Shipped_Date__c,
                                                Campaign__r.IF_Approved__c, Campaign__r.Meeting_Approved_No__c
                                            from Rental_Apply__c 
                                            where id=:Raid];
@@ -232,6 +233,13 @@
                return null;
           }
        //1822 yc 20211108 end
        //20220225 sx start obpm 下架增加 是否申请决裁勾着没有决裁编号不能进行操作
        else if ( RaTar.Campaign__c!= null &&  RaTar.Campaign__r.IF_Approved__c && RaTar.Campaign__r.Meeting_Approved_No__c == null){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '已申请决裁但决裁编码为空'));
            return null;
        }
        //20220225 sx end 下架增加判断
        
        String userid = Userinfo.getUserId();
        List<Rental_Apply_Equipment_Set_Detail__c> eList = new List<Rental_Apply_Equipment_Set_Detail__c>();
force-app/main/default/classes/EquipmentSetShippmentReceived3Controller.cls
@@ -7,8 +7,8 @@
    public Boolean saveBtnDisabled { get; private set; }
    public boolean ReturnRefuse {get;private set;}
    public String ErrorMessage {get; set;}
    public String CDSFinished {get;set;}
    public boolean LostFlg {get;set;}
    // public String CDSFinished {get;set;}
    // public boolean LostFlg {get;set;}
    public String Step_status { get; private set; }
    public Boolean needCDS { get; private set; }
    public Boolean done_flg { get; set; }
force-app/main/default/classes/EquipmentSetShippmentReceived3CtrlTest.cls
@@ -544,6 +544,557 @@
        raesdObj6.Shipment_Status_Text__c = FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Chu_Ku_Qian_Yi_Jian_Ce.ordinal());
        update new Rental_Apply_Equipment_Set_Detail__c[] {raesdObj1,raesdObj2,raesdObj3,raesdObj4,raesdObj5,raesdObj6};
    }}
        static void setupTestData2() {
    // MIXED_DML_OPERATION, DML operation on setup object is not permitted Error
    System.runAs(new User(Id = Userinfo.getUserId())) {
        StaticParameter.EscapeNFM001AgencyContractTrigger = true;
        StaticParameter.EscapeNFM001Trigger = true;
        Oly_TriggerHandler.bypass(ContactTriggerHandler.class.getName());
        Oly_TriggerHandler.bypass(AgencyHospitalHandler.class.getName());
        // システム管理者
        User user = new User(Test_staff__c = true);
        user.LastName = '_サンブリッジ1';
        user.FirstName = 'う';
        user.Alias = 'う';
        user.Email = 'olympusTest03@sunbridge.com';
        user.Username = 'olympusTest03@sunbridge.com';
        user.CommunityNickname = 'う';
        user.IsActive = true;
        user.EmailEncodingKey = 'ISO-2022-JP';
        user.TimeZoneSidKey = 'Asia/Tokyo';
        user.LocaleSidKey = 'ja_JP';
        user.LanguageLocaleKey = 'ja';
        user.ProfileId = System.Label.ProfileId_SystemAdmin;
        user.Province__c = '北京';
        user.Dept__c = '医疗华北营业本部';
        user.Use_Start_Date__c = Date.today().addMonths(-6);
        insert user;
        // 省
        Address_Level__c al = new Address_Level__c();
        al.Name = '東京';
        al.Level1_Code__c = 'CN-99';
        al.Level1_Sys_No__c = '999999';
        insert al;
        // 市
        Address_Level2__c al2 = new Address_Level2__c();
        al2.Level1_Code__c = 'CN-99';
        al2.Level1_Sys_No__c = '999999';
        al2.Level1_Name__c = '東京';
        al2.Name = '渋谷区';
        al2.Level2_Code__c = 'CN-9999';
        al2.Level2_Sys_No__c = '9999999';
        al2.Address_Level__c = al.id;
        insert al2;
        // 病院を作る
        Account hospital = new Account();
        hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id;
        hospital.Name = 'test hospital';
        hospital.Is_Active__c = '有効';
        hospital.Attribute_Type__c = '卫生部';
        hospital.Speciality_Type__c = '综合医院';
        hospital.Grade__c = '一级';
        hospital.OCM_Category__c = 'SLTV';
        hospital.Is_Medical__c = '医疗机构';
        hospital.State_Master__c = al.id;
        hospital.City_Master__c = al2.id;
        hospital.Town__c = '东京';
        insert hospital;
        StaticParameter.EscapeAccountTrigger = true;
        // 戦略科室を得る
        Account[] strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_OTH'];
        // 診療科を作る
        Account dep = new Account();
        dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_OTH'].id;
        dep.Name = 'test dep1';
        dep.AgentCode_Ext__c = '9999999';
        dep.ParentId = strategicDep[0].Id;
        dep.Department_Class__c = strategicDep[0].Id;
        dep.Hospital__c = hospital.Id;
        insert dep;
        Contact contact2 = new Contact();
        contact2.AccountId = dep.Id;
        contact2.FirstName = '責任者';
        contact2.LastName = 'test1经销商';
        insert contact2;
        // 产品
        Product2 pro1 = new Product2(Name='name01',IsActive=true,Family='GI',
                Fixture_Model_No__c='n01',Serial_Lot_No__c='S/N tracing',
                Fixture_Model_No_T__c = 'n01', Asset_Model_No__c = 'Pro1',
                ProductCode_Ext__c='pc01',Manual_Entry__c=false);
        Product2 pro2 = new Product2(Name='name02',IsActive=true,Family='GI',
                Fixture_Model_No__c='n02',Serial_Lot_No__c='Lot tracing',
                Fixture_Model_No_T__c = 'n02', Asset_Model_No__c = 'Pro2',
                ProductCode_Ext__c='pc02',Manual_Entry__c=false);
        Product2 pro3 = new Product2(Name='name03',IsActive=true,Family='GI',
                Fixture_Model_No__c='n03',Serial_Lot_No__c='Lot tracing',
                Fixture_Model_No_T__c = 'n03', Asset_Model_No__c = 'Pro3',
                ProductCode_Ext__c='pc03',Manual_Entry__c=false);
        Product2 pro4 = new Product2(Name='name04',IsActive=true,Family='GI',
                Fixture_Model_No__c='n04',Serial_Lot_No__c='Lot tracing',
                Fixture_Model_No_T__c = 'n04', Asset_Model_No__c = 'Pro4',
                ProductCode_Ext__c='pc04',Manual_Entry__c=false);
        insert new Product2[] {pro1, pro2, pro3, pro4};
        Campaign cam = new Campaign();
            cam.Name = 'test campaign';
            cam.StartDate = Date.today().addDays(15);
            cam.EndDate = Date.today().addDays(18);
            cam.Name2__c = '1234';
            cam.Status = '取消';
            cam.Mailflg_after45__c = true;
            cam.Mailflg_cancel__c = true;
            cam.Mailflg_before15__c = true;
            cam.Mailflg_before7__c = true;
            cam.Mailflg_after3__c = true;
            cam.HostName__c = '1';
            cam.cooperatorCompany__c = '1';
            cam.RecordTypeId = System.label.RecordType_CampaignService;
            cam.OwnerId = user.Id;
        cam.IF_Approved__c = true;
        insert cam;
        //备品借出申请
        Rental_Apply__c raObj = new Rental_Apply__c();
        raObj.Name = 'testra';
        raObj.OwnerId = user.Id;
        raObj.Product_category__c = 'GI';
        raObj.Demo_purpose1__c = '产品试用';
        raObj.demo_purpose2__c = FixtureUtil.raDemo_purpose2MAP.get('shiyongwuxunjia');
        raObj.direct_send__c = '医疗机构';
        raObj.Loaner_received_staff__c = '王五';
        raObj.Loaner_received_staff_phone__c = '110';
        raObj.direct_shippment_address__c = '北京市';
        raObj.Hospital__c = hospital.Id;
        raObj.Strategic_dept__c = strategicDep[0].Id;
        raObj.Account__c = dep.Id;
        raObj.Request_shipping_day__c = Date.toDay();
        raObj.Hope_Lonaer_date_Num__c = 1;
        //raObj.Request_return_day__c = Date.toDay();
        raObj.Answer_for_request__c = 'Test';
        raObj.Asset_loaner_start_day__c = Date.today();
        raObj.Asset_loaner_closed_day__c = Date.today();
        raObj.Phone_number__c = '1234567890';
        raObj.Loaner_medical_Staff__c = contact2.Id;
        raObj.Campaign__c = cam.id;
        insert raObj;
        List<Rental_Apply__c> RaTarList = [select Name,Campaign__c,Repair__c,next_action__c,QIS_number__r.ReplaceDeliveryDate__c,demo_purpose2__c,Follow_UP_Opp__r.Shipping_Finished_Day_Func__c,
                                                Campaign__r.Status,Campaign__r.IF_Approved__c,repair__r.Return_Without_Repair_Date__c,Repair__r.Repair_Final_Inspection_Date__c,Repair__r.Repair_Shipped_Date__c
                                            from Rental_Apply__c
                                            where id = :raObj.id];
                                            system.assertEquals(RaTarList[0].Campaign__r.Status,'取消');
                                            system.assertEquals(RaTarList[0].Campaign__r.IF_Approved__c,true);
        // 保有设备
        Asset asset1 = new Asset(Asset_Owner__c = 'Olympus');
        asset1.RecordTypeId = System.Label.Asset_RecordType;
        asset1.SerialNumber = 'asset1';
        asset1.Name = 'asset1';
        asset1.AccountId = dep.Id;
        asset1.Department_Class__c = strategicDep[0].Id;
        asset1.Hospital__c = hospital.Id;
        asset1.Product2Id = pro1.Id;
        asset1.Quantity = 11;
        asset1.Status = '不明';
        asset1.Manage_type__c = '个体管理';
        asset1.Loaner_accsessary__c = false;
        asset1.Out_of_wh__c = 0;
        asset1.Salesdepartment__c = '1.华北营业本部';
        asset1.Internal_asset_location__c = '北京 备品中心';
        asset1.Product_category__c = 'GI';
        asset1.Equipment_Type__c = '产品试用';
        asset1.SalesProvince__c = '北京';
        asset1.CompanyOfEquipment__c = '北京';
        asset1.Internal_Asset_number__c = '0001';
        Asset asset2 = new Asset(Asset_Owner__c = 'Olympus');
        asset2.RecordTypeId = System.Label.Asset_RecordType;
        asset2.SerialNumber = 'asset2';
        asset2.Name = 'asset2';
        asset2.AccountId = dep.Id;
        asset2.Department_Class__c = strategicDep[0].Id;
        asset2.Hospital__c = hospital.Id;
        asset2.Product2Id = pro2.Id;
        asset2.Quantity = 11;
        asset2.Status = '不明';
        asset2.Manage_type__c = '个体管理';
        asset2.Loaner_accsessary__c = true;
        asset2.Out_of_wh__c = 0;
        asset2.Salesdepartment__c = '1.华北营业本部';
        asset2.Internal_asset_location__c = '北京 备品中心';
        asset2.Product_category__c = 'GI';
        asset2.Equipment_Type__c = '产品试用';
        asset2.SalesProvince__c = '北京';
        asset2.CompanyOfEquipment__c = '北京';
        asset2.Internal_Asset_number__c = '0002';
        Asset asset3 = new Asset(Asset_Owner__c = 'Olympus');
        asset3.RecordTypeId = System.Label.Asset_RecordType;
        asset3.SerialNumber = 'asset3';
        asset3.Name = 'asset3';
        asset3.AccountId = dep.Id;
        asset3.Department_Class__c = strategicDep[0].Id;
        asset3.Hospital__c = hospital.Id;
        asset3.Product2Id = pro3.Id;
        asset3.Quantity = 15;
        asset3.Status = '不明';
        asset3.Manage_type__c = '数量管理';
        asset3.Loaner_accsessary__c = true;
        asset3.Out_of_wh__c = 0;
        asset3.Salesdepartment__c = '1.华北营业本部';
        asset3.Internal_asset_location__c = '北京 备品中心';
        asset3.Product_category__c = 'GI';
        asset3.Equipment_Type__c = '产品试用';
        asset3.SalesProvince__c = '北京';
        asset3.CompanyOfEquipment__c = '北京';
        asset3.Internal_Asset_number__c = '0003';
        Asset asset4 = new Asset(Asset_Owner__c = 'Olympus');
        asset4.RecordTypeId = System.Label.Asset_RecordType;
        asset4.SerialNumber = 'asset4';
        asset4.Name = 'asset4';
        asset4.AccountId = dep.Id;
        asset4.Department_Class__c = strategicDep[0].Id;
        asset4.Hospital__c = hospital.Id;
        asset4.Product2Id = pro4.Id;
        asset4.Quantity = 20;
        asset4.Status = '不明';
        asset4.Manage_type__c = '数量管理';
        asset4.Loaner_accsessary__c = true;
        asset4.Out_of_wh__c = 0;
        asset4.Salesdepartment__c = '1.华北营业本部';
        asset4.Internal_asset_location__c = '北京 备品中心';
        asset4.Product_category__c = 'GI';
        asset4.Equipment_Type__c = '产品试用';
        asset4.SalesProvince__c = '北京';
        asset4.CompanyOfEquipment__c = '北京';
        asset4.Internal_Asset_number__c = '0004';
        insert new Asset[] {asset1, asset2, asset3, asset4};
        // 备品一对一Link表
        Fixture_OneToOne_Link__c foLink1 = new Fixture_OneToOne_Link__c();
        foLink1.Main_Asset__c = asset1.Id;
        foLink1.Accessory_Asset__c = asset2.Id;
        foLink1.Quantity__c = 1;
        Fixture_OneToOne_Link__c foLink2 = new Fixture_OneToOne_Link__c();
        foLink2.Main_Asset__c = asset1.Id;
        foLink2.Accessory_Asset__c = asset3.Id;
        foLink2.Quantity__c = 1;
        insert new Fixture_OneToOne_Link__c[] {foLink1, foLink2};
        // 备品配套
        Fixture_Set__c fsObj1 = new Fixture_Set__c();
        fsObj1.Name = 'set1';
        fsObj1.Fixture_Set_Body_Model_No__c = 'modelNo1';
        fsObj1.Loaner_name__c = 'name1';
        insert fsObj1;
        // 备品配套明细
        Fixture_Set_Detail__c fsdObjA1 = new Fixture_Set_Detail__c();
        fsdObjA1.Name = '备品配套明细名1';
        fsdObjA1.Name_CHN_Created__c = '中文名称1';
        fsdObjA1.Product2__c = pro1.Id;
        fsdObjA1.Fixture_Set__c = fsObj1.Id;
        fsdObjA1.Is_Body__c = true;
        fsdObjA1.Is_Optional__c = false;
        fsdObjA1.UniqueKey__c = fsObj1.Id + ':' + pro1.Id;
        fsdObjA1.SortInt__c = 1;
        fsdObjA1.Quantity__c = 1;
        Fixture_Set_Detail__c fsdObjA2 = new Fixture_Set_Detail__c();
        fsdObjA2.Name = '备品配套明细名2';
        fsdObjA2.Name_CHN_Created__c = '中文名称2';
        fsdObjA2.Product2__c = pro2.Id;
        fsdObjA2.Fixture_Set__c = fsObj1.Id;
        fsdObjA2.Is_Body__c = false;
        fsdObjA2.Is_Optional__c = true;
        fsdObjA2.UniqueKey__c = fsObj1.Id + ':' + pro2.Id;
        fsdObjA2.SortInt__c = 2;
        fsdObjA2.Quantity__c = 1;
        fsdObjA2.Is_OneToOne__c = true;
        Fixture_Set_Detail__c fsdObjA3 = new Fixture_Set_Detail__c();
        fsdObjA3.Name = '备品配套明细名3';
        fsdObjA3.Name_CHN_Created__c = '中文名称3';
        fsdObjA3.Product2__c = pro3.Id;
        fsdObjA3.Fixture_Set__c = fsObj1.Id;
        fsdObjA3.Is_Body__c = false;
        fsdObjA3.Is_Optional__c = true;
        fsdObjA3.UniqueKey__c = fsObj1.Id + ':' + pro3.Id;
        fsdObjA3.SortInt__c = 3;
        fsdObjA3.Quantity__c = 2;
        fsdObjA3.Is_OneToOne__c = true;
        Fixture_Set_Detail__c fsdObjA4 = new Fixture_Set_Detail__c();
        fsdObjA4.Name = '备品配套明细名4';
        fsdObjA4.Name_CHN_Created__c = '中文名称4';
        fsdObjA4.Product2__c = pro4.Id;
        fsdObjA4.Fixture_Set__c = fsObj1.Id;
        fsdObjA4.Is_Body__c = false;
        fsdObjA4.Is_Optional__c = true;
        fsdObjA4.UniqueKey__c = fsObj1.Id + ':' + pro4.Id;
        fsdObjA4.SortInt__c = 4;
        fsdObjA4.Quantity__c = 2;
        fsdObjA4.Is_OneToOne__c = false;
        fsdObjA4.Is_Optional__c = true;
        insert new Fixture_Set_Detail__c[] {fsdObjA1, fsdObjA2, fsdObjA3, fsdObjA4};
        // 借出备品配套一览
        Rental_Apply_Equipment_Set__c raesObj = new Rental_Apply_Equipment_Set__c();
        raesObj.Rental_Apply__c = raObj.Id;
        raesObj.Fixture_Set__c = fsObj1.Id;
        raesObj.Cancel_Select__c = false;
        raesObj.Rental_Start_Date__c = Date.toDay();
        raesObj.Rental_End_Date__c = Date.toDay();
        raesObj.IndexFromUniqueKey__c = 1;
        raesObj.UniqueKey__c = '1:'+ fsObj1.Id + ':1';
        insert raesObj;
        // 借出备品配套一览明细
        Rental_Apply_Equipment_Set_Detail__c raesdObj1 = new Rental_Apply_Equipment_Set_Detail__c();
        raesdObj1.Rental_Apply__c = raObj.Id;
        raesdObj1.Fixture_Set_Detail__c = fsdObjA1.Id;
        raesdObj1.Rental_Num__c = 1;
        raesdObj1.Queue_Number__c = null;
        raesdObj1.Is_Body__c = true;
        raesdObj1.Rental_Apply_Equipment_Set__c = raesObj.Id;
        raesdObj1.IndexFromUniqueKey__c = 1;
        raesdObj1.UniqueKey__c = '1:'+ raesObj.Id + ':' + fsdObjA1.Id + ':1';
        raesdObj1.FSD_OneToOneAccessory_Cnt__c = 2;
        raesdObj1.FSD_Is_Optional__c = false;
        raesdObj1.FSD_Is_OneToOne__c = false;
        raesdObj1.ApplyPersonAppended__c = false;
        raesdObj1.FSD_Fixture_Model_No__c = 'n01';
        raesdObj1.Fixture_Model_No_text__c = 'n01';
        raesdObj1.Salesdepartment_before__c = '1.华北营业本部';
        raesdObj1.Internal_asset_location_before__c = '北京 备品中心';
        raesdObj1.Product_category_text__c = 'GI';
        raesdObj1.Equipment_Type_text__c = '产品试用';
        Rental_Apply_Equipment_Set_Detail__c raesdObj2 = new Rental_Apply_Equipment_Set_Detail__c();
        raesdObj2.Rental_Apply__c = raObj.Id;
        raesdObj2.Fixture_Set_Detail__c = fsdObjA2.Id;
        raesdObj2.Rental_Num__c = 1;
        raesdObj2.Queue_Number__c = null;
        raesdObj2.Is_Body__c = false;
        raesdObj2.Rental_Apply_Equipment_Set__c = raesObj.Id;
        raesdObj2.IndexFromUniqueKey__c = 2;
        raesdObj2.UniqueKey__c = '1:'+ raesObj.Id + ':' + fsdObjA2.Id + ':2';
        raesdObj2.FSD_OneToOneAccessory_Cnt__c = 2;
        raesdObj2.FSD_Is_Optional__c = false;
        raesdObj2.FSD_Is_OneToOne__c = true;
        raesdObj2.ApplyPersonAppended__c = false;
        raesdObj2.FSD_Fixture_Model_No__c = 'n02';
        raesdObj2.Fixture_Model_No_text__c = 'n02';
        raesdObj2.Salesdepartment_before__c = '1.华北营业本部';
        raesdObj2.Internal_asset_location_before__c = '北京 备品中心';
        raesdObj2.Product_category_text__c = 'GI';
        raesdObj2.Equipment_Type_text__c = '产品试用';
        Rental_Apply_Equipment_Set_Detail__c raesdObj3 = new Rental_Apply_Equipment_Set_Detail__c();
        raesdObj3.Rental_Apply__c = raObj.Id;
        raesdObj3.Fixture_Set_Detail__c = fsdObjA3.Id;
        raesdObj3.Rental_Num__c = 2;
        raesdObj3.Queue_Number__c = null;
        raesdObj3.Is_Body__c = false;
        raesdObj3.Rental_Apply_Equipment_Set__c = raesObj.Id;
        raesdObj3.IndexFromUniqueKey__c = 3;
        raesdObj3.UniqueKey__c = '1:'+ raesObj.Id + ':' + fsdObjA3.Id + ':3';
        raesdObj3.FSD_OneToOneAccessory_Cnt__c = 2;
        raesdObj3.FSD_Is_Optional__c = false;
        raesdObj3.FSD_Is_OneToOne__c = true;
        raesdObj3.ApplyPersonAppended__c = false;
        raesdObj3.FSD_Fixture_Model_No__c = 'n03';
        raesdObj3.Fixture_Model_No_text__c = 'n03';
        raesdObj3.Salesdepartment_before__c = '1.华北营业本部';
        raesdObj3.Internal_asset_location_before__c = '北京 备品中心';
        raesdObj3.Product_category_text__c = 'GI';
        raesdObj3.Equipment_Type_text__c = '产品试用';
        Rental_Apply_Equipment_Set_Detail__c raesdObj4 = new Rental_Apply_Equipment_Set_Detail__c();
        raesdObj4.Rental_Apply__c = raObj.Id;
        raesdObj4.Fixture_Set_Detail__c = fsdObjA3.Id;
        raesdObj4.Rental_Num__c = 2;
        raesdObj4.Queue_Number__c = null;
        raesdObj4.Is_Body__c = false;
        raesdObj4.Rental_Apply_Equipment_Set__c = raesObj.Id;
        raesdObj4.IndexFromUniqueKey__c = 4;
        raesdObj4.UniqueKey__c = '1:'+ raesObj.Id + ':' + fsdObjA3.Id + ':4';
        raesdObj4.FSD_OneToOneAccessory_Cnt__c = 2;
        raesdObj4.FSD_Is_Optional__c = false;
        raesdObj4.FSD_Is_OneToOne__c = true;
        raesdObj4.ApplyPersonAppended__c = false;
        raesdObj4.FSD_Fixture_Model_No__c = 'n03';
        raesdObj4.Fixture_Model_No_text__c = 'n03';
        raesdObj4.Salesdepartment_before__c = '1.华北营业本部';
        raesdObj4.Internal_asset_location_before__c = '北京 备品中心';
        raesdObj4.Product_category_text__c = 'GI';
        raesdObj4.Equipment_Type_text__c = '产品试用';
        Rental_Apply_Equipment_Set_Detail__c raesdObj5 = new Rental_Apply_Equipment_Set_Detail__c();
        raesdObj5.Rental_Apply__c = raObj.Id;
        raesdObj5.Fixture_Set_Detail__c = fsdObjA4.Id;
        raesdObj5.Rental_Num__c = 2;
        raesdObj5.Queue_Number__c = null;
        raesdObj5.Is_Body__c = false;
        raesdObj5.Rental_Apply_Equipment_Set__c = raesObj.Id;
        raesdObj5.IndexFromUniqueKey__c = 5;
        raesdObj5.UniqueKey__c = '1:'+ raesObj.Id + ':' + fsdObjA4.Id + ':5';
        raesdObj5.FSD_OneToOneAccessory_Cnt__c = 2;
        raesdObj5.FSD_Is_Optional__c = true;
        raesdObj5.FSD_Is_OneToOne__c = false;
        raesdObj5.ApplyPersonAppended__c = false;
        raesdObj5.FSD_Fixture_Model_No__c = 'n04';
        raesdObj5.Fixture_Model_No_text__c = 'n04';
        raesdObj5.Salesdepartment_before__c = '1.华北营业本部';
        raesdObj5.Internal_asset_location_before__c = '北京 备品中心';
        raesdObj5.Product_category_text__c = 'GI';
        raesdObj5.Equipment_Type_text__c = '产品试用';
        Rental_Apply_Equipment_Set_Detail__c raesdObj6 = new Rental_Apply_Equipment_Set_Detail__c();
        raesdObj6.Rental_Apply__c = raObj.Id;
        raesdObj6.Fixture_Set_Detail__c = fsdObjA4.Id;
        raesdObj6.Rental_Num__c = 2;
        raesdObj6.Queue_Number__c = null;
        raesdObj6.Is_Body__c = false;
        raesdObj6.Rental_Apply_Equipment_Set__c = raesObj.Id;
        raesdObj6.IndexFromUniqueKey__c = 6;
        raesdObj6.UniqueKey__c = '1:'+ raesObj.Id + ':' + fsdObjA4.Id + ':6';
        raesdObj6.FSD_OneToOneAccessory_Cnt__c = 2;
        raesdObj6.FSD_Is_Optional__c = true;
        raesdObj6.FSD_Is_OneToOne__c = false;
        raesdObj6.ApplyPersonAppended__c = false;
        raesdObj6.FSD_Fixture_Model_No__c = 'n04';
        raesdObj6.Fixture_Model_No_text__c = 'n04';
        raesdObj6.Salesdepartment_before__c = '1.华北营业本部';
        raesdObj6.Internal_asset_location_before__c = '北京 备品中心';
        raesdObj6.Product_category_text__c = 'GI';
        raesdObj6.Equipment_Type_text__c = '产品试用';
        insert new Rental_Apply_Equipment_Set_Detail__c[] {raesdObj1,raesdObj2,raesdObj3,raesdObj4,raesdObj5,raesdObj6};
        Test.setCreatedDate(raObj.Id, Datetime.now().addDays(-2));
        // 申请单
        raObj.Status__c = FixtureUtil.raStatusMap.get(FixtureUtil.RaStatus.Yi_Pi_Zhun.ordinal());
        raObj.Status_Text__c = FixtureUtil.raStatusMap.get(FixtureUtil.RaStatus.Yi_Pi_Zhun.ordinal());
        raObj.NotWatch_RA_Status__c = true;
        raObj.Request_approval_time__c = Datetime.now().addDays(-1);
        update raObj;
        // 借出备品配套一览明细
        raesdObj1.Select_Time__c = Date.toDay();
        raesdObj1.Asset__c = asset1.Id;
        raesdObj1.Loaner_accsessary__c = false;
        raesdObj1.FSD_Name_CHN__c = 'name01';
        raesdObj1.Shipment_Status_Text__c = FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Yi_Fen_Pei.ordinal());
        raesdObj2.Select_Time__c = Date.toDay();
        raesdObj2.Asset__c = asset2.Id;
        raesdObj2.Loaner_accsessary__c = true;
        raesdObj2.Fixture_OneToOne_Link_Id__c = foLink1.Id;
        raesdObj2.FSD_Name_CHN__c = 'name02';
        raesdObj2.Shipment_Status_Text__c = FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Yi_Fen_Pei.ordinal());
        raesdObj3.Select_Time__c = Date.toDay();
        raesdObj3.Asset__c = asset3.Id;
        raesdObj3.Loaner_accsessary__c = true;
        raesdObj3.Fixture_OneToOne_Link_Id__c = foLink2.Id;
        raesdObj3.FSD_Name_CHN__c = 'name03';
        raesdObj3.Shipment_Status_Text__c = FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Yi_Fen_Pei.ordinal());
        raesdObj4.Select_Time__c = Date.toDay();
        raesdObj4.Asset__c = asset3.Id;
        raesdObj4.Loaner_accsessary__c = true;
        raesdObj4.FSD_Name_CHN__c = 'name03';
        raesdObj4.Shipment_Status_Text__c = FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Yi_Fen_Pei.ordinal());
        raesdObj5.Select_Time__c = Date.toDay();
        raesdObj5.Asset__c = asset4.Id;
        raesdObj5.Loaner_accsessary__c = true;
        raesdObj5.FSD_Name_CHN__c = 'name04';
        raesdObj5.Shipment_Status_Text__c = FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Yi_Fen_Pei.ordinal());
        raesdObj6.Select_Time__c = Date.toDay();
        raesdObj6.Asset__c = asset4.Id;
        raesdObj6.Loaner_accsessary__c = true;
        raesdObj6.FSD_Name_CHN__c = 'name04';
        raesdObj6.Shipment_Status_Text__c = FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Yi_Fen_Pei.ordinal());
        // update new Rental_Apply_Equipment_Set_Detail__c[] {raesdObj1,raesdObj2,raesdObj3,raesdObj4,raesdObj5,raesdObj6};
        // 分配后修改asset里面的数据
        asset1.Last_Reserve_RAES_Detail__c = raesdObj1.Id;
        asset1.Out_of_wh__c = 1;
        asset1.Lei_Ji_Jie_Chu_Shu_Jia__c = 1;
        asset2.Last_Reserve_RAES_Detail__c = raesdObj2.Id;
        asset2.Out_of_wh__c = 1;
        asset2.Lei_Ji_Jie_Chu_Shu_Jia__c = 1;
        asset3.Last_Reserve_RAES_Detail__c = null;
        asset3.Out_of_wh__c = 2;
        asset3.Lei_Ji_Jie_Chu_Shu_Jia__c = 2;
        asset4.Last_Reserve_RAES_Detail__c = null;
        asset4.Out_of_wh__c = 2;
        asset4.Lei_Ji_Jie_Chu_Shu_Jia__c = 2;
        // update new Asset[] {asset1,asset2,asset3,asset4};
        // 出库指示操作 下架操作
        raesdObj1.Shipment_request_time2__c = Date.toDay();
        raesdObj1.Shipment_request__c = true;
        raesdObj1.StockDown__c = true;
        raesdObj1.StockDown_time__c = Date.toDay();
        raesdObj1.StockDown_staff__c = Userinfo.getUserId();
        raesdObj1.Inspection_result__c = 'OK';
        raesdObj1.Pre_inspection_time__c = System.now();
        raesdObj1.Inspection_staff__c = Userinfo.getUserId();
        raesdObj1.Shipment_Status_Text__c = FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Chu_Ku_Qian_Yi_Jian_Ce.ordinal());
        raesdObj2.Shipment_request_time2__c = Date.toDay();
        raesdObj2.Shipment_request__c = true;
        raesdObj2.StockDown__c = true;
        raesdObj2.StockDown_time__c = Date.toDay();
        raesdObj2.StockDown_staff__c = Userinfo.getUserId();
        raesdObj2.Inspection_result__c = 'OK';
        raesdObj2.Pre_inspection_time__c = System.now();
        raesdObj2.Inspection_staff__c = Userinfo.getUserId();
        raesdObj2.Shipment_Status_Text__c = FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Chu_Ku_Qian_Yi_Jian_Ce.ordinal());
        raesdObj3.Shipment_request_time2__c = Date.toDay();
        raesdObj3.Shipment_request__c = true;
        raesdObj3.StockDown__c = true;
        raesdObj3.StockDown_time__c = Date.toDay();
        raesdObj3.StockDown_staff__c = Userinfo.getUserId();
        raesdObj3.Inspection_result__c = 'OK';
        raesdObj3.Pre_inspection_time__c = System.now();
        raesdObj3.Inspection_staff__c = Userinfo.getUserId();
        raesdObj3.Shipment_Status_Text__c = FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Chu_Ku_Qian_Yi_Jian_Ce.ordinal());
        raesdObj4.Shipment_request_time2__c = Date.toDay();
        raesdObj4.Shipment_request__c = true;
        raesdObj4.StockDown__c = true;
        raesdObj4.StockDown_time__c = Date.toDay();
        raesdObj4.StockDown_staff__c = Userinfo.getUserId();
        raesdObj4.Inspection_result__c = 'OK';
        raesdObj4.Pre_inspection_time__c = System.now();
        raesdObj4.Inspection_staff__c = Userinfo.getUserId();
        raesdObj4.Shipment_Status_Text__c = FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Chu_Ku_Qian_Yi_Jian_Ce.ordinal());
        raesdObj5.Shipment_request_time2__c = Date.toDay();
        raesdObj5.Shipment_request__c = true;
        raesdObj5.StockDown__c = true;
        raesdObj5.StockDown_time__c = Date.toDay();
        raesdObj5.StockDown_staff__c = Userinfo.getUserId();
        raesdObj5.Inspection_result__c = 'OK';
        raesdObj5.Pre_inspection_time__c = System.now();
        raesdObj5.Inspection_staff__c = Userinfo.getUserId();
        raesdObj5.Shipment_Status_Text__c = FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Chu_Ku_Qian_Yi_Jian_Ce.ordinal());
        raesdObj6.Shipment_request_time2__c = Date.toDay();
        raesdObj6.Shipment_request__c = true;
        raesdObj6.StockDown__c = true;
        raesdObj6.StockDown_time__c = Date.toDay();
        raesdObj6.StockDown_staff__c = Userinfo.getUserId();
        raesdObj6.Inspection_result__c = 'OK';
        raesdObj6.Pre_inspection_time__c = System.now();
        raesdObj6.Inspection_staff__c = Userinfo.getUserId();
        raesdObj6.Shipment_Status_Text__c = FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Chu_Ku_Qian_Yi_Jian_Ce.ordinal());
        update new Rental_Apply_Equipment_Set_Detail__c[] {raesdObj1,raesdObj2,raesdObj3,raesdObj4,raesdObj5,raesdObj6};
    }}
    static testMethod void testSave() {
        Oly_TriggerHandler.bypass('RentalApplyTriggerHandler');
         setupTestData(); 
@@ -596,4 +1147,55 @@
        essr3Controller.save();
         // system.Test.stopTest();
    }
    static testMethod void test2(){
        Oly_TriggerHandler.bypass('RentalApplyTriggerHandler');
         setupTestData2();
        CreateRelationListPagingCmpCtrl cmp;
        PageReference ref;
        List<Rental_Apply__c> raObjs;
        Rental_Apply__c raObj;
        List<Rental_Apply_Equipment_Set__c> raesObjs;
        Rental_Apply_Equipment_Set__c raesObj;
        List<Rental_Apply_Equipment_Set_Detail__c> raesdObjs;
        raesObjs = [select Id, RAES_Status__c FROM Rental_Apply_Equipment_Set__c];
        raesdObjs = [select Id, Rental_Apply_Equipment_Set__c,RAESD_Status__c from Rental_Apply_Equipment_Set_Detail__c];
        // 发货单
        FixtureDeliverySlip__c fdsObj = new FixtureDeliverySlip__c();
        fdsObj.Name = '00001';
        fdsObj.DeliveryCompany__c = '利讯';
        fdsObj.Distributor_method__c = '陆运';
        fdsObj.DeliveryType__c = '发货';
        insert fdsObj;
        // 发货操作
        ref = new PageReference('/apex/EquipmentSetShippmentReceived3?id=' + raesObjs[0].Id + '&step=明细');
        Test.setCurrentPage(ref);
        EquipmentSetShippmentReceived3Controller essr3Controller = new EquipmentSetShippmentReceived3Controller();
        essr3Controller.init();
        essr3Controller.getEsdListSize();
        essr3Controller.CheckedId = raesObjs[0].Id;
        essr3Controller.filljsQRAction(); //扫描其他申请会增加明细
        for (EquipmentSetShippmentReceived3Controller.EsdInfo esdInfo : essr3Controller.esdList) {
            esdInfo.isChecked = true;
        }
        // system.test.startTest();
        essr3Controller.UnCheckedId = raesObjs[0].Id;
        essr3Controller.deleteDetail(); //删除明细
        essr3Controller.ShippmentAdd(); //追加 到明细页面
        essr3Controller.CheckedId = raesObjs[0].Id;
        // essr3Controller.filljsQRAction();
        // for (EquipmentSetShippmentReceived3Controller.EsdInfo esdInfo : essr3Controller.esdList) {
        //     esdInfo.isChecked = true;
        // }
        essr3Controller.ShippmentDetail(); //发货前-检测
        essr3Controller.slip.Name = '00001';
        essr3Controller.searchSlip();
        essr3Controller.slip.Name = '00002';
        essr3Controller.slip.DeliveryType__c = '发货';
        essr3Controller.slip.Distributor_method__c = '陆运';
        essr3Controller.slip.DeliveryCompany__c = '利讯';
        essr3Controller.save();
    }
}
force-app/main/default/classes/EquipmentTargetCoverageBatch.cls
New file
@@ -0,0 +1,50 @@
global class EquipmentTargetCoverageBatch implements Database.Batchable<sObject> {
    public String query;
    // public List<Id> prdIds = new List<Id>();
    public List<Id> hospIds = new List<Id>();
    global EquipmentTargetCoverageBatch() {
        this.query = query;
    }
    global Database.QueryLocator start(Database.BatchableContext bc) {
        // List<String> classify = new List<String>();
        // classify.add('软性镜');
        // classify.add('硬性镜');
        // classify.add('周边');
        // List<Product2> prdList = [select Id,ServiceCategory__c from Product2 where ServiceCategory__c in :classify and Can_Repair__c != '不'];
        // system.debug('产品'+prdList);
        // if (prdList!=null) {
        //     for (Product2 p : prdList) {
        //     prdIds.add(p.Id);
        //     }
        // }
       List<AggregateResult> Asset1 = [select count(Id),Hospital__c from asset where Product2.ServiceCategory__c ='软性镜'  Group by Hospital__c having count(Id)>=5];
        system.debug('第一重'+Asset1);
       if(Asset1!=null){
           for (AggregateResult a1 : Asset1) {
               hospIds.add(String.valueOf(a1.get('Hospital__c')));
           }
       }
       query = 'select Id,IF_Coverage_Target_Asset__c from asset where hospital__c in :hospIds'
                            +' and Status != \'廃棄\' and Status != \'待报废\''
                            +' and SerMarGuranteeType__c != \'服务多年保修\' and SerMarGuranteeType__c != \'市场多年保修\''
                            +' and Product2.ServiceCategory__c != null';
        return Database.getQueryLocator(query);
    }
    global void execute(Database.BatchableContext BC, list<Asset> Assets) {
        List<Asset> AssetsNew = new List<Asset>();
        system.debug('第二重'+Assets);
        for (Asset a : Assets) {
            // a.IF_Coverage_Target_Asset__c = true;
            AssetsNew.add(a);
        }
        update AssetsNew;
        system.debug('执行完成');
    }
    global void finish(Database.BatchableContext BC) {
    }
}
force-app/main/default/classes/EquipmentTargetCoverageBatch.cls-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>51.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/EventToProjectSummaryBatch.cls
New file
@@ -0,0 +1,19 @@
global class EventToProjectSummaryBatch implements Database.Batchable<sObject> {
    public String query;
    global EventToProjectSummaryBatch() {
        this.query = query;
    }
    global Database.QueryLocator start(Database.BatchableContext bc) {
        return Database.getQueryLocator(query);
    }
    global void execute(Database.BatchableContext BC, list<Sobject> scope) {
    }
    global void finish(Database.BatchableContext BC) {
    }
}
force-app/main/default/classes/EventToProjectSummaryBatch.cls-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>48.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/FixtureUtil.cls
@@ -1521,11 +1521,11 @@
    public static void withoutUpsertIh(List<Inventory_Header__c> sobj) {
        if (!sobj.isEmpty()) upsert sobj UniqueKey__c;
    }
    // 20220224 ljh 113盘点 Copy  start
    public static void withoutUpsertIhCopy(List<Inventory_Header_Copy__c> sobj) {
        if (!sobj.isEmpty()) upsert sobj UniqueKey__c;
    }
    // 20220224 ljh 113盘点 Copy  end
    public static void withoutUpsertRaesd(List<Rental_Apply_Equipment_Set_Detail__c> sobj) {
        if (!sobj.isEmpty()) upsert sobj UniqueKey__c;
    }
force-app/main/default/classes/FollowTriggerHandler.cls
New file
@@ -0,0 +1,33 @@
public without sharing class FollowTriggerHandler extends Oly_TriggerHandler{
    private Map<Id, Inquiry_form__c> newMap;
    private Map<Id, Inquiry_form__c> oldMap;
    private List<Inquiry_form__c> newList;
    private List<Inquiry_form__c> oldList;
    public FollowTriggerHandler() {
        this.newMap = (Map<Id, Inquiry_form__c>) Trigger.newMap;
        this.oldMap = (Map<Id, Inquiry_form__c>) Trigger.oldMap;
        this.newList = (List<Inquiry_form__c>) Trigger.new;
        this.oldList = (List<Inquiry_form__c>) Trigger.old;
        Integer i = 0;
    }
    protected override void afterUpdate() {
        followUpdate();
    }
    public void followUpdate(){
        Map<SObject,List<String>> data = new Map<SObject,List<String>>();
        List<ReportMemo__c> rmList = new List<ReportMemo__c>();
        for (Inquiry_form__c inquiry : newList) {
            List<String> strList = new List<String>();
            Inquiry_form__c oldInquiry = null;
            if (Trigger.isUpdate) {
                oldInquiry = oldMap.get(inquiry.Id);
            }
            if (oldInquiry == null || inquiry.Product1__c != oldInquiry.Product1__c) {
                strList.add('Product1__c');
            }
            data.put(inquiry, strList);
        }
        SplitOptionListUtil util = new SplitOptionListUtil();
        util.makeObject(data);
    }
}
force-app/main/default/classes/FollowTriggerHandler.cls-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>41.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/InquiryVerifyBatch.cls
@@ -1,9 +1,7 @@
global class InquiryVerifyBatch implements  Database.Batchable<sObject>, Database.Stateful {
global class InquiryVerifyBatch  implements Schedulable,Database.Batchable<SObject>,Database.Stateful {
    public String query;
    public Date start_date;
    public Date end_date;
    global InquiryVerifyBatch() {
        // if(Test.isRunningTest()){
@@ -22,11 +20,13 @@
            month = 4;
        }
        start_date = Date.newInstance(year, month, 1);
        end_date = start_date.addMonths(1);
        this.query = 'select id,quoteSavedDate__c,Opportunity.Id,Opportunity.Department_Class__c from quote where Quote_No_last2__c = \'01\' and CreatedDate >= :start_date and CreatedDate < :end_date';
        this.query = 'select id,quoteSavedDate__c,Opportunity.Id,Opportunity.Department_Class__c from quote where Quote_No_last2__c = \'01\' and CreatedDate >= :start_date';
    }
    public void execute(SchedulableContext sc) {
        Database.executeBatch(this);
    }
    // global void execute(SchedulableContext sc){Database.executebatch(this);}
    global Database.QueryLocator start(Database.BatchableContext bc) {
        // 获取报价单数据
@@ -48,7 +48,7 @@
                createdDateStr = Date.today();
            }
            // 获取报价产品数据,获取第四分类
             List<QuoteLineItem> qlts = [Select Id,Product2.Category4__c from QuoteLineItem where QuoteId  = :quo.Id limit 200];
             List<QuoteLineItem> qlts = [Select Id,Product2.Category4__c from QuoteLineItem where QuoteId  = :quo.Id and Product2.Important_product__c = true];
             List<String> c4  = new List<String>();
             List<String> qdept  = new List<String>();
             // 第四分类放入list
force-app/main/default/classes/InquiryVerifyBatchTest.cls
@@ -21,15 +21,14 @@
    private static Date createdDateStr = Date.today();
    static testMethod void testMethod1() {
        System.Test.StartTest();
        InitData();
        // System.Test.StartTest();
        // try {
            ID exid = Database.executeBatch(new InquiryVerifyBatch(),1);
            // System.abortJob(exid);
        // } catch(Exception e){
        // }
            // System.Test.StopTest();
        ID exid = Database.executeBatch(new InquiryVerifyBatch(),1);
        InquiryVerifyBatch bct1 = new InquiryVerifyBatch(null,null);
        System.schedule('Scheduled Job 5', '0 45 * * * ?', bct1);
        System.Test.StopTest();
    }
    private static void InitData() {
@@ -163,9 +162,11 @@
            prd1.Category4__c = 'CV';
            prd1.Category5__c = '260SL系列';
            prd1.Asset_Model_No__c = '1001';
            prd1.Important_product__c = true;
            prd1.Important_Rroduct_1GI__c = true;
            insert prd1;
            System.assertEquals(prd1.Important_product__c,true);
            PricebookEntry entry = new PricebookEntry(Pricebook2Id = pricebookId, Product2Id = prd1.Id);
            entry.UnitPrice = 0;
@@ -173,7 +174,7 @@
            entry.UseStandardPrice = false;
            entry.CurrencyIsoCode = 'CNY';
            insert entry;
            System.assertEquals(prd1.Important_product__c,true);
            List<Quote> qList = [Select Id, CurrencyIsoCode from Quote where Id = : quote.Id];
            System.assertEquals(1, qList.size());
            System.assertEquals('CNY', qList[0].CurrencyIsoCode);
@@ -189,7 +190,14 @@
            target.Product2Id = prd1.id;
            target.PricebookEntryId = entry.Id;
            insert target;
            prd1.Important_product__c = true;
            update prd1;
            System.assertEquals(prd1.Important_product__c,true);
            // System.assertEquals(target.Product2.Important_product__c,true);
            system.assertEquals(target.Product2Id,prd1.id);
            List<QuoteLineItem> qlts = [Select Id,Product2.Important_product__c,QuoteId from QuoteLineItem where id = :target.id];
            System.assertEquals(qlts[0].Product2.Important_product__c,true);
            System.assertEquals(qlts[0].QuoteId,quote.id);
            Consumable_order_details2__c saledet1 = new Consumable_order_details2__c();
            saledet1.Name = 'OCM_01_001001';
            // saledet1.Consumable_order_minor__c = Order1.Id;
force-app/main/default/classes/InventoryHeaderCopyHandler.cls
@@ -101,7 +101,7 @@
        }
        //20210427 you 1650 end
        String reportNo = '', location = '', month = '';
        String reportNo = '', location = '', month = '',day = '';
        for (Inventory_Header_Copy__c nObj : this.newList) {
            // 20210223 you WLIG-BV8CHF start
            // reportNo = 'OCMA-' + nObj.Report_No_Year__c + '-';
@@ -150,7 +150,11 @@
            if(String.isNotBlank(month) && month.length() == 1){
                month = '0' + month;
            }
            reportNo += month;
            day  = String.valueOf(nObj.Inventory_Start_Date__c.day());
            if(String.isNotBlank(day) && day.length() == 1){
                day = '0' + day;
            }
            reportNo += month+'-'+day;
            nObj.Name = reportNo;
        }
    }
force-app/main/default/classes/InventoryResultRecordCopyController.cls
@@ -174,7 +174,7 @@
        deptCheck_PIC = currUser.Dept__c; //20210618 1650 you
        String cunFangDi = ApexPages.currentPage().getParameters().get('cunFangDi');
        hasConsumAsset = false;
        system.debug(cunFangDi+'==177='+bieCunFangDi);
        system.debug(cunFangDi+'==177=='+bieCunFangDi);
        if (cunFangDi != null) bieCunFangDi = cunFangDi;
        //20210628 you 1650 办事处看不到 货架号
        if (bieCunFangDi=='广州 备品中心' || bieCunFangDi=='北京 备品中心' || bieCunFangDi=='上海 备品中心') {
@@ -204,11 +204,15 @@
        
        statusMap = new Map<String, List<String>>();
        //备品搬家 20210706  SFDC-C5CC5S 暂停
        Date today = Date.today();
        List<Inventory_Header_Copy__c> ihList = [
            select Id, Inventory_Status__c, Name, Internal_asset_location__c, Inventory_Start_Date__c, Fixture_Header__c
              from Inventory_Header_Copy__c
             where Inventory_Status__c <> '已批准' and Internal_asset_location__c =:bieCunFangDi
                and Inventory_Start_Date__c = LAST_N_DAYS:30
                // 20220225 ljh 113盘点
                // and Inventory_Start_Date__c = LAST_N_DAYS:30
                and Inventory_Start_Date__c = :today
                // 20220225 ljh 113盘点
                ORDER BY Fixture_Header__c NULLS FIRST];
        // List<Inventory_Header_Copy__c> ihList = [
        //     select Id, Inventory_Status__c, Name, Internal_asset_location__c, Inventory_Start_Date__c, Fixture_Header__c
@@ -536,8 +540,10 @@
            return;
        }
        // 备品搬家 SFDC-C5CC5S 暂停
        List<Inventory_Header_Copy__c> ihList = [select Id, Inventory_Status__c, Name, Internal_asset_location__c, Inventory_Start_Date__c from Inventory_Header_Copy__c where Internal_asset_location__c =:bieCunFangDi and Inventory_Start_Date__c = LAST_N_DAYS:30];
        // List<Inventory_Header_Copy__c> ihList = [select Id, Inventory_Status__c, Name, Internal_asset_location__c, Inventory_Start_Date__c from Inventory_Header_Copy__c where Internal_asset_location__c =:bieCunFangDi and Inventory_Start_Date__c = LAST_N_DAYS:1];
        // 20220225 ljh 113盘点
        // List<Inventory_Header_Copy__c> ihList = [select Id, Inventory_Status__c, Name, Internal_asset_location__c, Inventory_Start_Date__c from Inventory_Header_Copy__c where Internal_asset_location__c =:bieCunFangDi and Inventory_Start_Date__c = LAST_N_DAYS:30];
        Date today = Date.today();
        List<Inventory_Header_Copy__c> ihList = [select Id, Inventory_Status__c, Name, Internal_asset_location__c, Inventory_Start_Date__c from Inventory_Header_Copy__c where Internal_asset_location__c =:bieCunFangDi and Inventory_Start_Date__c =:today];
        if (ihList.size() > 0) {
            if (ihList[0].Inventory_Status__c == null) {
                //do nothing
@@ -564,15 +570,11 @@
        ih_new.Inventory_Start_Date__c = Date.today();
        ih_new.InventorySubmit_PIC__c = String.isBlank(submitPIC) ? null : submitPIC;
        ih_new.InventoryCheck_PIC__c = String.isBlank(checkPIC) ? null : checkPIC;
        ih_new.UniqueKey__c = bieCunFangDi+':'+Date.today().toStartOfMonth();
        // ih_new.UniqueKey__c = bieCunFangDi+':'+Date.today().toStartOfMonth();
        ih_new.UniqueKey__c = bieCunFangDi+':'+Date.today();
        //.toStartOfMonth(); 备品搬家  uniqueKey保证唯一  SFDC-C5CC5S
        
        // FixtureUtil.withoutUpsertIh(new List<Inventory_Header_Copy__c> {ih_new});
        /*public static void withoutUpsertIh(List<Inventory_Header__c> sobj) {
            if (!sobj.isEmpty()) upsert sobj UniqueKey__c;
        }*/
        // List<Inventory_Header_Copy__c> sobj = new List<Inventory_Header_Copy__c> {ih_new};
        // if (!sobj.isEmpty()) upsert sobj UniqueKey__c;
        FixtureUtil.withoutUpsertIhCopy(new List<Inventory_Header_Copy__c> {ih_new});
        // InventoryStartAssetSnapshotBatch istarter = new InventoryStartAssetSnapshotBatch(bieCunFangDi, ih_new);
        InventoryStartAssetSnapshotCopyBatch istarter = new InventoryStartAssetSnapshotCopyBatch(bieCunFangDi, ih_new);
@@ -581,7 +583,7 @@
        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '开始盘点处理,请等待Batch处理结束'));
    }
    public void save() {
    /*public void save() {
        doneFlg = false;
        // 类别为备品或为空 <=> 类别!=耗材
        if (assetCategory != '耗材' && inventoryHeader!=null && String.isNotBlank(inventoryHeader.Id) && System.Approval.isLocked(inventoryHeader.Id)) {
@@ -690,7 +692,10 @@
                        , Fixture_Header__c
                        from Inventory_Header_Copy__c
                        where Inventory_Status__c <> null and Inventory_Status__c <> '已批准' and Internal_asset_location__c =:bieCunFangDi
                          and Inventory_Start_Date__c = LAST_N_DAYS:30
                          // 20220225 ljh 113盘点
                        // and Inventory_Start_Date__c = LAST_N_DAYS:30
                          and Inventory_Start_Date__c = LAST_N_DAYS:1
                          // 20220225 ljh 113盘点
                          ORDER BY Fixture_Header__c nulls first
                        ];
        // ihList = [select Id,Inventory_Status__c, Name, Internal_asset_location__c, Inventory_Start_Date__c
@@ -833,13 +838,13 @@
                    //add by rentx 20210901 end
                }
                // 113 盘点Copy
                /*List<AggregateResult> consumAssetList = [
                        Select Internal_Asset_Flg__c fix, Asset_Status__c status, sum(toAbandon_amount__c) abAmount, sum(Amount__c) amount, sum(Inventory_Count__c) acAmount
                        From Consum_Inventory_Detail__c
                        Where Inventory_Header_Copy__c = : ih.Id
                        and Asset_Status__c != '已消耗明细'
                        group by Internal_Asset_Flg__c, Asset_Status__c];
                consumAssetMap = getInitData(consumAssetList, 'consum');*/
                // List<AggregateResult> consumAssetList = [
                //         Select Internal_Asset_Flg__c fix, Asset_Status__c status, sum(toAbandon_amount__c) abAmount, sum(Amount__c) amount, sum(Inventory_Count__c) acAmount
                //         From Consum_Inventory_Detail__c
                //         Where Inventory_Header_Copy__c = : ih.Id
                //         and Asset_Status__c != '已消耗明细'
                //         group by Internal_Asset_Flg__c, Asset_Status__c];
                // consumAssetMap = getInitData(consumAssetList, 'consum');
            }
            else{
                inventoryDetailList = Database.query(soqlAsset);
@@ -874,7 +879,7 @@
        Id[] usrArray = usrList[0].InventoryUser__c.split(',');
        inventoryUserList = [select id, name from user where id in :usrArray];
    }
    }*/
    /**
     * 获取初始化时页面显示的数据
force-app/main/default/classes/InventoryResultRecordCopyControllerTest.cls
New file
@@ -0,0 +1,418 @@
@isTest
private class InventoryResultRecordCopyControllerTest {
    // 创建Asset数据
    public static User user = new User();
    static void setupTestData() {
        ControllerUtil.EscapeNFM001Trigger = true;
        //// 省
        //Address_Level__c al = new Address_Level__c();
        //al.Name = '東京';
        //al.Level1_Code__c = 'CN-99';
        //al.Level1_Sys_No__c = '999999';
        //insert al;
        //// 市
        //Address_Level2__c al2 = new Address_Level2__c();
        //al2.Level1_Code__c = 'CN-99';
        //al2.Level1_Sys_No__c = '999999';
        //al2.Level1_Name__c = '東京';
        //al2.Name = '渋谷区';
        //al2.Level2_Code__c = 'CN-9999';
        //al2.Level2_Sys_No__c = '9999999';
        //al2.Address_Level__c = al.id;
        //insert al2;
        SS_Batch_Column_Mapping__c InventoryHeaderName = new SS_Batch_Column_Mapping__c(Name = 'Inventory_Header_Name', SS_TableName__c='Inventory_Header_Name');
        InventoryHeaderName.From_Column_001__c = '北京 备品中心';
        InventoryHeaderName.SS_Column_001__c = 'BJ';
        InventoryHeaderName.From_Column_002__c = '上海 备品中心';
        InventoryHeaderName.SS_Column_002__c = 'SH';
        InventoryHeaderName.From_Column_003__c = '广州 备品中心';
        InventoryHeaderName.SS_Column_003__c = 'GZ';
        insert new SS_Batch_Column_Mapping__c[] {InventoryHeaderName};
        SS_Batch_Column_Mapping__c Agency_Inventory_Role1 = new SS_Batch_Column_Mapping__c(Name = 'Agency_Inventory_Role', SS_TableName__c='Agency_Inventory_Role__c');
        Agency_Inventory_Role1.From_Column_001__c = '呼和浩特';
        Agency_Inventory_Role1.SS_Column_001__c = '1.华北营业本部';
        Agency_Inventory_Role1.From_Column_002__c = '郑州';
        Agency_Inventory_Role1.SS_Column_002__c = '3.西北营业本部';
        Agency_Inventory_Role1.From_Column_003__c = '沈阳';
        Agency_Inventory_Role1.SS_Column_003__c = '2.东北营业本部';
        insert new SS_Batch_Column_Mapping__c[] {Agency_Inventory_Role1};
        // 病院を作る
        Account hospital = new Account();
        hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id;
        hospital.Name = 'test hospital';
        hospital.Is_Active__c = '有効';
        hospital.Attribute_Type__c = '卫生部';
        hospital.Speciality_Type__c = '综合医院';
        hospital.Grade__c = '一级';
        hospital.OCM_Category__c = 'SLTV';
        hospital.Is_Medical__c = '医疗机构';
        //hospital.State_Master__c = al.id;
        //hospital.City_Master__c = al2.id;
        hospital.Town__c = '东京';
        insert hospital;
        // 戦略科室を得る
        Account[] strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_OTH'];
        // 診療科を作る
        Account dep = new Account();
        dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_OTH'].id;
        dep.Name = 'test dep';
        dep.AgentCode_Ext__c = '9999998';
        dep.ParentId = strategicDep[0].Id;
        dep.Department_Class__c = strategicDep[0].Id;
        dep.Hospital__c = hospital.Id;
        insert dep;
        Contact contact2 = new Contact();
        contact2.AccountId = dep.Id;
        contact2.FirstName = '責任者';
        contact2.LastName = 'test1经销商';
        insert contact2;
        // 产品
        Product2 pro1 = new Product2(Name='name01',IsActive=true,Family='GI',
                Fixture_Model_No__c='n01',Serial_Lot_No__c='S/N tracing',
                Fixture_Model_No_T__c = 'n01',
                ProductCode_Ext__c='pc01',Manual_Entry__c=false);
        Product2 pro2 = new Product2(Name='name02',IsActive=true,Family='GI',
                Fixture_Model_No__c='n02',Serial_Lot_No__c='Lot tracing',
                ProductCode_Ext__c='pc02',Manual_Entry__c=false);
        Product2 pro3 = new Product2(Name='name03',IsActive=true,Family='GI',
                Fixture_Model_No__c='n03',Serial_Lot_No__c='Lot tracing',
                ProductCode_Ext__c='pc03',Manual_Entry__c=false);
        insert new Product2[] {pro1, pro2, pro3};
        //---------------------------主体 两个附属品(个体管理 数量管理)
        // 保有设备A (主体)
        Asset assetA1 = new Asset(Asset_Owner__c = 'Olympus');
        assetA1.RecordTypeId = System.Label.Asset_RecordType;
        assetA1.SerialNumber = 'ass01';
        assetA1.Name = 'ass01';
        assetA1.AccountId = dep.Id;
        assetA1.Department_Class__c = strategicDep[0].Id;
        assetA1.Hospital__c = hospital.Id;
        assetA1.Product2Id = pro1.Id;
        assetA1.Quantity = 1;
        assetA1.Status = '有库存';
        assetA1.Manage_type__c = '个体管理';
        assetA1.Loaner_accsessary__c = false;
        assetA1.Product_category__c = 'GI';
        assetA1.Delete_Flag__c = false;
        assetA1.Freeze_sign__c = false;
        assetA1.Out_of_wh__c = 0;
        assetA1.Salesdepartment__c = '1.华北营业本部';
        assetA1.Internal_asset_location__c = '北京 备品中心';
        assetA1.Product_category__c = 'GI';
        assetA1.Equipment_Type__c = '产品试用';
        assetA1.SalesProvince__c = '北京';
        assetA1.WH_location__c = '货架号1';
        assetA1.AssetManageConfirm__c = true;
        // 保有设备A (附属品 数量管理)
        Asset assetA2 = new Asset(Asset_Owner__c = 'Olympus');
        assetA2.RecordTypeId = System.Label.Asset_RecordType;
        assetA2.SerialNumber = 'ass02';
        assetA2.Name = 'ass02';
        assetA2.AccountId = dep.Id;
        assetA2.Department_Class__c = strategicDep[0].Id;
        assetA2.Hospital__c = hospital.Id;
        assetA2.Product2Id = pro2.Id;
        assetA2.Quantity = 10;
        assetA2.Status = '有库存';
        assetA2.Manage_type__c = '数量管理';
        assetA2.Loaner_accsessary__c = true;
        assetA2.Product_category__c = 'GI';
        assetA2.Delete_Flag__c = false;
        assetA2.Freeze_sign__c = false;
        assetA2.Out_of_wh__c = 3;
        assetA2.Frozen_Quantity__c = 2;
        assetA2.Salesdepartment__c = '1.华北营业本部';
        assetA2.Internal_asset_location__c = '北京 备品中心';
        assetA2.Product_category__c = 'GI';
        assetA2.Equipment_Type__c = '产品试用';
        assetA2.SalesProvince__c = '北京';
        assetA2.WH_location__c = '货架号2';
        assetA2.AssetManageConfirm__c = true;
        // 保有设备A (附属品 个体管理)
        Asset assetA3 = new Asset(Asset_Owner__c = 'Olympus');
        assetA3.RecordTypeId = System.Label.Asset_RecordType;
        assetA3.SerialNumber = 'ass03';
        assetA3.Name = 'ass03';
        assetA3.AccountId = dep.Id;
        assetA3.Department_Class__c = strategicDep[0].Id;
        assetA3.Hospital__c = hospital.Id;
        assetA3.Product2Id = pro3.Id;
        assetA3.Quantity = 10;
        assetA3.Status = '有库存';
        assetA3.Manage_type__c = '数量管理';
        assetA3.Loaner_accsessary__c = true;
        assetA3.Product_category__c = 'GI';
        assetA3.Delete_Flag__c = false;
        assetA3.Freeze_sign__c = false;
        assetA3.Out_of_wh__c = 3;
        assetA3.Salesdepartment__c = '1.华北营业本部';
        assetA3.Internal_asset_location__c = '北京 备品中心';
        assetA3.Product_category__c = 'GI';
        assetA3.Equipment_Type__c = '产品试用';
        assetA3.SalesProvince__c = '北京';
        assetA3.WH_location__c = '货架号3';
        assetA3.Abandoned_Inventory__c = 1;
        assetA3.AssetManageConfirm__c = true;
        // 耗材
        Asset assetC1 = new Asset(Asset_Owner__c = 'Olympus');
        assetC1.RecordTypeId = System.Label.Asset_RecordType;
        assetC1.SerialNumber = 'ass04';
        assetC1.Name = 'ass04';
        assetC1.AccountId = dep.Id;
        assetC1.Department_Class__c = strategicDep[0].Id;
        assetC1.Hospital__c = hospital.Id;
        assetC1.Product2Id = pro3.Id;
        assetC1.Quantity = 10;
        assetC1.Status = '有库存';
        assetC1.Manage_type__c = '数量管理';
        assetC1.Loaner_accsessary__c = true;
        assetC1.Product_category__c = 'GI';
        assetC1.Delete_Flag__c = false;
        assetC1.Freeze_sign__c = false;
        assetC1.Out_of_wh__c = 3;
        assetC1.Asset_loaner_category__c = '耗材';
        assetC1.AssetMark__c = '耗材';
        assetC1.Salesdepartment__c = '0.备品中心';
        assetC1.Internal_asset_location__c = '上海 备品中心';
        assetC1.Product_category__c = 'GI';
        assetC1.Equipment_Type__c = '产品试用';
        assetC1.SalesProvince__c = '上海';
        assetC1.WH_location__c = '货架号4';
        assetC1.Abandoned_Inventory__c = 1;
        assetC1.AssetManageConfirm__c = true;
        insert new Asset[] {assetA1, assetA2, assetA3, assetC1};
        User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
       // Insert account as current user
        System.runAs (thisUser) {
            Profile p = [SELECT Id FROM Profile WHERE Name LIKE '%2B1%' Limit 1];
            UserRole r = [SELECT Id FROM UserRole WHERE DeveloperName = 'beipin_huadong_staff' Limit 1];
            user = new User(alias = 'test', email='test@acme.com',
                emailencodingkey='UTF-8', lastname='test',
                languagelocalekey='en_US',
                localesidkey='en_US', profileid = p.Id, userroleid = r.Id,
                timezonesidkey='America/Los_Angeles',
                username='test@acme.com' + Datetime.now().getTime());
            insert user;
        }
        //Repair__c repair = new Repair__c();
        //repair.Service_Repair_No__c = 'repair';
        //repair.Status__c = '草案中';
        //repair.Hospital__c = hospital.Id;
        //repair.Account__c = dep.Id;
        //repair.Department_Class__c = strategicDep[0].id;
        //repair.Delivered_Product__c = assetA2.Id;
        //insert repair;
    }
    /**  点击开始盘点
    *    @author : sohobb
    *    @description : 点击开始盘点Check
    *    @created Date : 2019-2-18
    **/
    static testMethod void testMethod1() {
        bp3_Setting__c conf = bp3_Setting__c.getOrgDefaults();
        conf.BJ_Start_Inventory_User__c = UserInfo.getUserId();
        conf.InventoryDetailArchiveFolder__c = UserInfo.getUserId();
        insert conf;
        setupTestData();
        InventoryResultRecordCopyController con = new InventoryResultRecordCopyController();
        con.init();
        //con.bieCunFangDi = '北京 备品中心';
        //未开始盘点
        List<Apexpages.Message> msgs = ApexPages.getMessages();
        boolean b = false;
        for(Apexpages.Message msg:msgs){
            if (msg.getDetail().contains('没有开始中的盘点,请点击开始盘点')) b = true;
        }
        //system.assert(b);
        Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin];
        // ユーザー作成
        User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
        insert hpOwner;
        System.runAs(hpOwner) {
            //没有开始权限
            con.startInventory();
            msgs = ApexPages.getMessages();
            b = false;
            for(Apexpages.Message msg:msgs){
                if (msg.getDetail().contains('没有开始盘点的权限')) b = true;
            }
            //system.assert(b, msgs);
        }
        //第一次开始盘点
        con.startInventory();
        msgs = ApexPages.getMessages();
        b = false;
        for(Apexpages.Message msg:msgs){
            if (msg.getDetail().contains('开始盘点处理,请等待Batch处理结束')) b = true;
        }
        //system.assert(b, msgs);
        List<Inventory_Header_Copy__c> ihList = [select Id,InventoryCheck_PIC__c,InventorySubmit_PIC__c from Inventory_Header_Copy__c];
        //system.assertEquals(1, ihList.size());
        //再次开始盘点
        con.startInventory();
        msgs = ApexPages.getMessages();
        b = false;
        for(Apexpages.Message msg:msgs){
            if (msg.getDetail().contains('有未结束的盘点')) b = true;
        }
        //system.assert(b);
         //ihList[0].Inventory_Status__c = '已批准';
         //ihList[0].InventoryCheck_PIC__c = [SELECT Id
          //       FROM User WHERE Dept__c = '医疗东北营业本部' and IsActive = true limit 1].id;
         //ihList[0].InventorySubmit_PIC__c = [SELECT id
         //        FROM User WHERE Dept__c = '医疗东北营业本部' and IsActive = true limit 1].id;
        // update ihList;
        //本月已有结束的盘点
        // con.startInventory();
        // msgs = ApexPages.getMessages();
        // b = false;
        // for(Apexpages.Message msg:msgs){
        //     if (msg.getDetail().contains('本仓库本月已进行过盘点')) b = true;
         //}
        //system.assert(b);
    }
    static testMethod void testMethod2() {
        setupTestData();
        //盘点表头
        String cunFangDi = '北京 备品中心';
        Inventory_Header_Copy__c header = new Inventory_Header_Copy__c();
        header.Inventory_Start_Date__c = Date.toDay();
        header.UniqueKey__c = 'IH-0000';
        header.Inventory_Status__c = '处理中';
        header.Internal_asset_location__c = cunFangDi;
        header.InventoryCheck_PIC__c = [SELECT Id
                FROM User WHERE Dept__c = '医疗东北营业本部' and IsActive = true limit 1].id;
        header.InventorySubmit_PIC__c = [SELECT id
                FROM User WHERE Dept__c = '医疗东北营业本部' and IsActive = true limit 1].id;
        insert header;
        List<Inventory_Header_Copy__c> headerList = [select UniqueKey__c from Inventory_Header_Copy__c];
        System.assertEquals(1, headerList.size());
        System.Test.StartTest();
        Database.executeBatch(new InventoryStartAssetSnapshotCopyBatch(cunFangDi,header));
        System.Test.StopTest();
        InventoryResultRecordCopyController con = new InventoryResultRecordCopyController();
        con.init();
        con.searchBtn();
    }
    static testMethod void testMethod3() {
        setupTestData();
        System.Test.StartTest();
        //盘点表头
        String cunFangDi = '北京 备品中心';
        Inventory_Header_Copy__c header = new Inventory_Header_Copy__c();
        header.Inventory_Start_Date__c = Date.toDay();
        header.UniqueKey__c = 'IH-0000';
        header.Inventory_Status__c = '处理中';
        header.Internal_asset_location__c = cunFangDi;
        header.InventoryCheck_PIC__c = [SELECT Id
                FROM User WHERE Dept__c = '医疗东北营业本部' and IsActive = true limit 1].id;
        header.InventorySubmit_PIC__c = [SELECT id
                FROM User WHERE Dept__c = '医疗东北营业本部' and IsActive = true limit 1].id;
        insert header;
        Database.executeBatch(new InventoryStartAssetSnapshotCopyBatch(cunFangDi,header));
        System.Test.StopTest();
        InventoryResultRecordCopyController con = new InventoryResultRecordCopyController();
        con.init();
        con.searchBtn();
        System.assertEquals(3, con.assetStatusOptionList.size());
        con.getbieCunFangDiOps();
        con.getInventoryUserOps();
        con.getInventory_DeviationOps();
        con.getInternal_Asset_FlgOps();
    }
    static testMethod void testMethod4() {
        setupTestData();
        System.Test.StartTest();
        //盘点表头
        String cunFangDi = '北京 备品中心';
        Inventory_Header_Copy__c header = new Inventory_Header_Copy__c();
        header.Inventory_Start_Date__c = Date.toDay();
        header.UniqueKey__c = 'IH-0000';
        header.Inventory_Status__c = '处理中';
        header.Internal_asset_location__c = cunFangDi;
        header.InventoryCheck_PIC__c = [SELECT Id
                FROM User WHERE Dept__c = '医疗东北营业本部' and IsActive = true limit 1].id;
        header.InventorySubmit_PIC__c = [SELECT id
                FROM User WHERE Dept__c = '医疗东北营业本部' and IsActive = true limit 1].id;
        insert header;
        Database.executeBatch(new InventoryStartAssetSnapshotCopyBatch(cunFangDi,header));
        System.Test.StopTest();
        List<Inventory_Detail_Copy__c> ids = [select id from Inventory_Detail_Copy__c  where Inventory_Header_Copy__c = :header.Id];
        System.assertEquals(5, ids.size());
        InventoryResultRecordCopyController con = new InventoryResultRecordCopyController();
        con.init();
        con.searchBtn();
        System.assertEquals(19, con.salesdepartmentOpts.size());
        System.assertEquals(57, con.salesProvinceOpts.size());
        //con.inventoryDetailList[0].Inventory_Count__c = 1;
        //con.save();
    }
    // 20220228 ljh 113盘点
    /*static testMethod void testMethod5() {
        setupTestData();
        System.runAs(user){
            System.Test.StartTest();
            //盘点表头
            String cunFangDi = '上海 备品中心';
            Inventory_Header_Copy__c header = new Inventory_Header_Copy__c();
            header.Inventory_Start_Date__c = Date.toDay();
            header.UniqueKey__c = 'IH-0000';
            header.Inventory_Status__c = '处理中';
            header.Internal_asset_location__c = cunFangDi;
            header.InventoryCheck_PIC__c = [SELECT Id
                FROM User WHERE Dept__c = '医疗东北营业本部' and IsActive = true limit 1].id;
            header.InventorySubmit_PIC__c = [SELECT id
                FROM User WHERE Dept__c = '医疗东北营业本部' and IsActive = true limit 1].id;
            insert header;
            Database.executeBatch(new InventoryStartAssetSnapshotCopyBatch(cunFangDi,header));
            System.Test.StopTest();
            InventoryResultRecordCopyController con = new InventoryResultRecordCopyController();
            con.init();
            con.searchBtn();
            //update by rentx
            System.assertEquals(2, con.assetCategoryOptionList.size());
            System.assertEquals(19, con.salesdepartmentOpts.size());
            System.assertEquals(57, con.salesProvinceOpts.size());
            con.consumInventoryDetailList[0].Inventory_Count__c = 1;
            con.save();
        }
    }*/
    static testMethod void updaue() {
        InventoryResultRecordCopyController.test();//先调用这个,然后继续补充测试类
    }
}
force-app/main/default/classes/InventoryResultRecordCopyControllerTest.cls-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>48.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/InventorySendMailBatch.cls
@@ -10,26 +10,24 @@
    }
    global Database.QueryLocator start(Database.BatchableContext BC) {
        if (Test.isRunningTest()) {
            return Database.getQueryLocator(
                [select Id, Name, Email, Manager.Email from User where isActive = true and (ProfileId = :System.label.ProfileId_2S6
                    or ProfileId = :System.label.ProfileId_2S7 or ProfileId = :System.label.ProfileId_2S8) limit 1]
            );
        } else {
            return Database.getQueryLocator(
                [select Id, Name, Email, Manager.Email from User where isActive = true and (ProfileId = :System.label.ProfileId_2S6
                    or ProfileId = :System.label.ProfileId_2S7 or ProfileId = :System.label.ProfileId_2S8)]
            );
        }
        return Database.getQueryLocator(
            [SELECT (select userOrGroupId from groupMembers) FROM group WHERE name = '样本盘点小组']
        );
    }
    global void execute(Database.BatchableContext BC, List<sObject> User) {
        List<User> UserList = User;
    global void execute(Database.BatchableContext BC, List<group> gList) {
        List<String> IdList = new List<String>();
        if (gList != null && gList.size() > 0) {
            for (Group g : gList) {
                for (GroupMember gm : g.groupMembers) {
                    IdList.add(gm.userOrGroupId);
                }
            }
        }
        Date toDate = Date.today();
        Integer day = Integer.valueOf(toDate.day());
        if(System.Test.isRunningTest()|| (UserList.size() > 0 && (day == 6 || day == 14))){
            sendMail(UserList);
        if(System.Test.isRunningTest() || (IdList.size() > 0 && (day == 10 || day == 14))){
            sendMail(IdList);
        }    
    }
@@ -62,12 +60,13 @@
            iflog.Log__c += logstr;
            iflog.ErrorLog__c = Errorstr;
        }
        insert iflog;
    }
    public boolean sendMail(List<User> userList) {
    public boolean sendMail(List<String> IdList) {
        boolean rs = true;
        List<User> userList = [select Id, Name, Email, Manager.Email from User where id IN :IdList];
        List<Messaging.SingleEmailMessage> sendMails = new List<Messaging.SingleEmailMessage>();
        for(User user : userList){
            String title = '';
            String body = '';
@@ -85,24 +84,27 @@
            toMailList.add(user.Email);
            //抄送的邮箱
            List<String> ccMailList = new List<String>();
            ccMailList.add(user.Manager.Email);
            List<Messaging.SingleEmailMessage> sendMails = new List<Messaging.SingleEmailMessage>();
            if(user.Manager.Email != null){
                ccMailList.add(user.Manager.Email);
            }
            Messaging.SingleEmailMessage messageNEW = new Messaging.SingleEmailMessage();
            messageNEW.subject = title;
            messageNEW.htmlBody = body;
            messageNEW.setCharset('UTF-8');
            messageNEW.toAddresses = toMailList;
            messageNEW.ccAddresses = ccMailList;
            if(ccMailList.size() > 0){
                messageNEW.ccAddresses = ccMailList;
            }
            sendMails.add(messageNEW);
            Messaging.SendEmailResult[] results = messaging.sendEmail(sendMails);
            for (Integer i = 0; i < results.size(); i++) {
                if (results[i].success == false) {
                    system.debug('=====send mail error:' + results[i].errors[0].message);
                    result = false;
                    Errorstr += 'sendMail error:' + results[i].errors[0].message + '\n';
                    rs = false;
                }
        }
        //在单个事务中,只能调用send方法 10 次。
        Messaging.SendEmailResult[] results = messaging.sendEmail(sendMails);
        for (Integer i = 0; i < results.size(); i++) {
            if (results[i].success == false) {
                system.debug('=====send mail error:' + results[i].errors[0].message);
                result = false;
                Errorstr += 'sendMail error:' + results[i].errors[0].message + '\n';
                rs = false;
            }
        }
        return rs;
force-app/main/default/classes/InventoryStartAssetSnapshotCopyBatch.cls
@@ -879,7 +879,7 @@
         }
         InventoryStartAssetSnapshotCopyBatch.messagesForTest = this.emailMessages;
        // 发 mail
        String InventoryCheck_PIC_email = iheader.InventoryCheck_PIC__r.Email;
        // String InventoryCheck_PIC_email = iheader.InventoryCheck_PIC__r.Email;
        BatchEmailUtil be = new BatchEmailUtil();
        // String[] toList = new String[]{UserInfo.getUserEmail()};
        String[] toList = new String[]{'sfdc_lijinhuan@olympus.com.cn'};
@@ -888,10 +888,10 @@
        for(String email : System.Label.Inventory_Result_Email.split(',')){
            ccList.add(email);
        } 
        system.debug('盘点报告确认人'+InventoryCheck_PIC_email);
         /*system.debug('盘点报告确认人'+InventoryCheck_PIC_email);
        if(InventoryCheck_PIC_email != null){
           ccList.add(InventoryCheck_PIC_email); 
        }
        }*/
         
        if(this.emailMessages.size() == 0 && totalCount == executedCount) {
            be.successMail(toList,ccList, title, totalCount, text);
force-app/main/default/classes/InventoryStartAssetSnapshotCopyBatchTest.cls
New file
@@ -0,0 +1,1444 @@
@isTest
private class InventoryStartAssetSnapshotCopyBatchTest {
    //static testMethod void testabnormalCase() {
    //    //盘点表头
    //    Inventory_Header_Copy__c header = new Inventory_Header_Copy__c();
    //    header.Inventory_Start_Date__c = Date.toDay();
    //    header.UniqueKey__c = 'IH-0000';
    //    header.Inventory_Status__c = '完了';
    //    insert header;
    //    String cunFangDi = '北京 备品中心';
    //    Database.executeBatch(new InventoryStartAssetSnapshotCopyBatch(cunFangDi,header));
    //    List<Inventory_Detail_Copy__c> resultList = [select UniqueKey__c from Inventory_Detail_Copy__c];
    //    System.assertEquals(0, resultList.size());
    //}
    @isTest
    static void testAssert() {
        ControllerUtil.EscapeNFM001Trigger = true;
        SS_Batch_Column_Mapping__c InventoryHeaderName = new SS_Batch_Column_Mapping__c(Name = 'Inventory_Header_Name', SS_TableName__c='Inventory_Header_Name');
        InventoryHeaderName.From_Column_001__c = '北京 备品中心';
        InventoryHeaderName.SS_Column_001__c = 'BJ';
        InventoryHeaderName.From_Column_002__c = '上海 备品中心';
        InventoryHeaderName.SS_Column_002__c = 'SH';
        InventoryHeaderName.From_Column_003__c = '广州 备品中心';
        InventoryHeaderName.SS_Column_003__c = 'GZ';
        insert new SS_Batch_Column_Mapping__c[] {InventoryHeaderName};
        // 省
        Address_Level__c al = new Address_Level__c();
        al.Name = '東京';
        al.Level1_Code__c = 'CN-99';
        al.Level1_Sys_No__c = '999999';
        insert al;
        // 市
        Address_Level2__c al2 = new Address_Level2__c();
        al2.Level1_Code__c = 'CN-99';
        al2.Level1_Sys_No__c = '999999';
        al2.Level1_Name__c = '東京';
        al2.Name = '渋谷区';
        al2.Level2_Code__c = 'CN-9999';
        al2.Level2_Sys_No__c = '9999999';
        al2.Address_Level__c = al.id;
        insert al2;
        // 病院を作る
        Account hospital = new Account();
        hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id;
        hospital.Name = 'test hospital';
        hospital.Is_Active__c = '有効';
        hospital.Attribute_Type__c = '卫生部';
        hospital.Speciality_Type__c = '综合医院';
        hospital.Grade__c = '一级';
        hospital.OCM_Category__c = 'SLTV';
        hospital.Is_Medical__c = '医疗机构';
        hospital.State_Master__c = al.id;
        hospital.City_Master__c = al2.id;
        hospital.Town__c = '东京';
        insert hospital;
        // 戦略科室を得る
        Account[] strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_OTH'];
        // 診療科を作る
        Account dep = new Account();
        dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_OTH'].id;
        dep.Name = 'test dep';
        dep.AgentCode_Ext__c = '9999998';
        dep.ParentId = strategicDep[0].Id;
        dep.Department_Class__c = strategicDep[0].Id;
        dep.Hospital__c = hospital.Id;
        insert dep;
        Contact contact2 = new Contact();
        contact2.AccountId = dep.Id;
        contact2.FirstName = '責任者';
        contact2.LastName = 'test1经销商';
        insert contact2;
        // 产品
        Product2 pro1 = new Product2(Name='name01',IsActive=true,Family='GI',
                Fixture_Model_No__c='n01',Serial_Lot_No__c='S/N tracing',
                Fixture_Model_No_T__c = 'n01',
                ProductCode_Ext__c='pc01',Manual_Entry__c=false);
        Product2 pro2 = new Product2(Name='name02',IsActive=true,Family='GI',
                Fixture_Model_No__c='n02',Serial_Lot_No__c='Lot tracing',
                ProductCode_Ext__c='pc02',Manual_Entry__c=false);
        Product2 pro3 = new Product2(Name='name03',IsActive=true,Family='GI',
                Fixture_Model_No__c='n03',Serial_Lot_No__c='Lot tracing',
                ProductCode_Ext__c='pc03',Manual_Entry__c=false);
        insert new Product2[] {pro1, pro2, pro3};
        SS_Batch_Column_Mapping__c AgencyInventory = new SS_Batch_Column_Mapping__c(Name = 'Agency_Inventory_Role', SS_TableName__c='Agency_Inventory_Role');
        AgencyInventory.From_Column_001__c = '北京 备品中心';
        AgencyInventory.SS_Column_001__c = '1.华北营业本部';
        AgencyInventory.From_Column_002__c = '济南';
        AgencyInventory.SS_Column_002__c = '1.华北营业本部';
        AgencyInventory.From_Column_003__c = '郑州';
        AgencyInventory.SS_Column_003__c = '3.西北营业本部';
        insert new SS_Batch_Column_Mapping__c[] {AgencyInventory};
        //---------------------------主体 两个附属品(个体管理 数量管理)
        // 保有设备A (主体)
        Asset assetA1 = new Asset(Asset_Owner__c = 'Olympus');
        assetA1.RecordTypeId = System.Label.Asset_RecordType;
        assetA1.SerialNumber = 'ass01';
        assetA1.Name = 'ass01';
        assetA1.AccountId = dep.Id;
        assetA1.Department_Class__c = strategicDep[0].Id;
        assetA1.Hospital__c = hospital.Id;
        assetA1.Product2Id = pro1.Id;
        assetA1.Quantity = 1;
        assetA1.Status = '有库存';
        assetA1.Manage_type__c = '个体管理';
        assetA1.Loaner_accsessary__c = false;
        assetA1.Product_category__c = 'GI';
        assetA1.Delete_Flag__c = false;
        assetA1.Freeze_sign__c = false;
        assetA1.Out_of_wh__c = 0;
        assetA1.Salesdepartment__c = '1.华北营业本部';
        assetA1.Internal_asset_location__c = '北京 备品中心';
        assetA1.Product_category__c = 'GI';
        assetA1.Equipment_Type__c = '产品试用';
        assetA1.SalesProvince__c = '北京';
        assetA1.WH_location__c = '货架号1';
        assetA1.AssetManageConfirm__c = true;
        // 保有设备A (附属品 数量管理)
        Asset assetA2 = new Asset(Asset_Owner__c = 'Olympus');
        assetA2.RecordTypeId = System.Label.Asset_RecordType;
        assetA2.SerialNumber = 'ass02';
        assetA2.Name = 'ass02';
        assetA2.AccountId = dep.Id;
        assetA2.Department_Class__c = strategicDep[0].Id;
        assetA2.Hospital__c = hospital.Id;
        assetA2.Product2Id = pro2.Id;
        assetA2.Quantity = 10;
        assetA2.Status = '有库存';
        assetA2.Manage_type__c = '数量管理';
        assetA2.Loaner_accsessary__c = true;
        assetA2.Product_category__c = 'GI';
        assetA2.Delete_Flag__c = false;
        assetA2.Freeze_sign__c = false;
        assetA2.Out_of_wh__c = 3;
        assetA2.Frozen_Quantity__c = 2;
        assetA2.Salesdepartment__c = '1.华北营业本部';
        assetA2.Internal_asset_location__c = '北京 备品中心';
        assetA2.Product_category__c = 'GI';
        assetA2.Equipment_Type__c = '产品试用';
        assetA2.SalesProvince__c = '北京';
        assetA2.WH_location__c = '货架号2';
        assetA2.AssetManageConfirm__c = true;
        // 保有设备A (附属品 个体管理)
        Asset assetA3 = new Asset(Asset_Owner__c = 'Olympus');
        assetA3.RecordTypeId = System.Label.Asset_RecordType;
        assetA3.SerialNumber = 'ass03';
        assetA3.Name = 'ass03';
        assetA3.AccountId = dep.Id;
        assetA3.Department_Class__c = strategicDep[0].Id;
        assetA3.Hospital__c = hospital.Id;
        assetA3.Product2Id = pro3.Id;
        assetA3.Quantity = 10;
        assetA3.Status = '有库存';
        assetA3.Manage_type__c = '数量管理';
        assetA3.Loaner_accsessary__c = true;
        assetA3.Product_category__c = 'GI';
        assetA3.Delete_Flag__c = false;
        assetA3.Freeze_sign__c = false;
        assetA3.Out_of_wh__c = 3;
        assetA3.Salesdepartment__c = '1.华北营业本部';
        assetA3.Internal_asset_location__c = '北京 备品中心';
        assetA3.Product_category__c = 'GI';
        assetA3.Equipment_Type__c = '产品试用';
        assetA3.SalesProvince__c = '北京';
        assetA3.WH_location__c = '货架号3';
        assetA3.Abandoned_Inventory__c = 1;
        assetA3.AssetManageConfirm__c = true;
        insert new Asset[] {assetA1, assetA2, assetA3};
        List<Asset> assetList = [select Name from Asset];
        System.assertEquals(3, assetList.size());
        Repair__c repair = new Repair__c();
        repair.Service_Repair_No__c = 'repair';
        repair.Status__c = '4.修理品返送阶段';
        repair.Hospital__c = hospital.Id;
        repair.Account__c = dep.Id;
        repair.Department_Class__c = strategicDep[0].id;
        repair.Delivered_Product__c = assetA2.Id;
        insert repair;
        List<Repair__c> repairList = [select Service_Repair_No__c from Repair__c];
        System.assertEquals(1, repairList.size());
        //盘点表头
        Inventory_Header_Copy__c header = new Inventory_Header_Copy__c();
        header.Inventory_Start_Date__c = Date.toDay();
        header.UniqueKey__c = 'IH-0000';
        header.Inventory_Status__c = '处理中';
        header.InventoryCheck_PIC__c = [SELECT Id
                FROM User WHERE Dept__c = '医疗东北营业本部' and IsActive = true limit 1].id;
        header.InventorySubmit_PIC__c = [SELECT id
                FROM User WHERE Dept__c = '医疗东北营业本部' and IsActive = true limit 1].id;
        insert header;
        List<Inventory_Header_Copy__c> headerList = [select UniqueKey__c from Inventory_Header_Copy__c];
        System.assertEquals(1, headerList.size());
        String cunFangDi = '北京 备品中心';
        System.Test.StartTest();
        Database.executeBatch(new InventoryStartAssetSnapshotCopyBatch(cunFangDi,header));
        System.Test.StopTest();
        List<Inventory_Detail_Copy__c> onStockList = [select UniqueKey__c from Inventory_Detail_Copy__c
                                                                    WHERE Asset_Status__c = '在库'];
       // System.assertEquals(3, onStockList.size());
        List<Inventory_Detail_Copy__c> lostList = [select UniqueKey__c from Inventory_Detail_Copy__c
                                                                 WHERE Asset_Status__c = '丢失'];
        System.assertEquals(1, lostList.size());
        List<Inventory_Detail_Copy__c> fixList = [select UniqueKey__c from Inventory_Detail_Copy__c
                                                                WHERE Asset_Status__c = '维修中'];
        System.assertEquals(1, fixList.size());
        List<Inventory_Detail_Copy__c> frozenList = [select UniqueKey__c from Inventory_Detail_Copy__c
                                                                WHERE Asset_Status__c = '冻结'];
        System.assertEquals(1, frozenList.size());
    }
     @isTest
    static void testOnetoOne() {
        ControllerUtil.EscapeNFM001Trigger = true;
        SS_Batch_Column_Mapping__c InventoryHeaderName = new SS_Batch_Column_Mapping__c(Name = 'Inventory_Header_Name', SS_TableName__c='Inventory_Header_Name');
        InventoryHeaderName.From_Column_001__c = '北京 备品中心';
        InventoryHeaderName.SS_Column_001__c = 'BJ';
        InventoryHeaderName.From_Column_002__c = '上海 备品中心';
        InventoryHeaderName.SS_Column_002__c = 'SH';
        InventoryHeaderName.From_Column_003__c = '广州 备品中心';
        InventoryHeaderName.SS_Column_003__c = 'GZ';
        insert new SS_Batch_Column_Mapping__c[] {InventoryHeaderName};
        SS_Batch_Column_Mapping__c AgencyInventory = new SS_Batch_Column_Mapping__c(Name = 'Agency_Inventory_Role', SS_TableName__c='Agency_Inventory_Role');
        AgencyInventory.From_Column_001__c = '北京 备品中心';
        AgencyInventory.SS_Column_001__c = '1.华北营业本部';
        AgencyInventory.From_Column_002__c = '济南';
        AgencyInventory.SS_Column_002__c = '1.华北营业本部';
        AgencyInventory.From_Column_003__c = '郑州';
        AgencyInventory.SS_Column_003__c = '3.西北营业本部';
        insert new SS_Batch_Column_Mapping__c[] {AgencyInventory};
        // 省
        Address_Level__c al = new Address_Level__c();
        al.Name = '東京';
        al.Level1_Code__c = 'CN-99';
        al.Level1_Sys_No__c = '999999';
        insert al;
        // 市
        Address_Level2__c al2 = new Address_Level2__c();
        al2.Level1_Code__c = 'CN-99';
        al2.Level1_Sys_No__c = '999999';
        al2.Level1_Name__c = '東京';
        al2.Name = '渋谷区';
        al2.Level2_Code__c = 'CN-9999';
        al2.Level2_Sys_No__c = '9999999';
        al2.Address_Level__c = al.id;
        insert al2;
        // 病院を作る
        Account hospital = new Account();
        hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id;
        hospital.Name = 'test hospital';
        hospital.Is_Active__c = '有効';
        hospital.Attribute_Type__c = '卫生部';
        hospital.Speciality_Type__c = '综合医院';
        hospital.Grade__c = '一级';
        hospital.OCM_Category__c = 'SLTV';
        hospital.Is_Medical__c = '医疗机构';
        hospital.State_Master__c = al.id;
        hospital.City_Master__c = al2.id;
        hospital.Town__c = '东京';
        insert hospital;
        StaticParameter.EscapeAccountTrigger = true;
        // 戦略科室を得る
        Account[] strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_OTH'];
        // 診療科を作る
        Account dep = new Account();
        dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_OTH'].id;
        dep.Name = 'test dep';
        dep.AgentCode_Ext__c = '9999998';
        dep.ParentId = strategicDep[0].Id;
        dep.Department_Class__c = strategicDep[0].Id;
        dep.Hospital__c = hospital.Id;
        insert dep;
        Contact contact2 = new Contact();
        contact2.AccountId = dep.Id;
        contact2.FirstName = '責任者';
        contact2.LastName = 'test1经销商';
        insert contact2;
        // 产品
        Product2 pro1 = new Product2(Name='name01',IsActive=true,Family='GI',
                Fixture_Model_No__c='n01',Serial_Lot_No__c='S/N tracing',
                Fixture_Model_No_T__c = 'n01', Asset_Model_No__c = 'Pro1',
                ProductCode_Ext__c='pc01',Manual_Entry__c=false);
        Product2 pro2 = new Product2(Name='name02',IsActive=true,Family='GI',
                Fixture_Model_No__c='n02',Serial_Lot_No__c='Lot tracing',
                Fixture_Model_No_T__c = 'n02', Asset_Model_No__c = 'Pro2',
                ProductCode_Ext__c='pc02',Manual_Entry__c=false);
        Product2 pro3 = new Product2(Name='name03',IsActive=true,Family='GI',
                Fixture_Model_No__c='n03',Serial_Lot_No__c='Lot tracing',
                Fixture_Model_No_T__c = 'n03', Asset_Model_No__c = 'Pro3',
                ProductCode_Ext__c='pc03',Manual_Entry__c=false);
        Product2 pro4 = new Product2(Name='name04',IsActive=true,Family='GI',
                Fixture_Model_No__c='n04',Serial_Lot_No__c='Lot tracing',
                Fixture_Model_No_T__c = 'n04', Asset_Model_No__c = 'Pro4',
                ProductCode_Ext__c='pc04',Manual_Entry__c=false);
        insert new Product2[] {pro1, pro2, pro3, pro4};
        // 保有设备
        Asset asset1 = new Asset(Asset_Owner__c = 'Olympus');
        asset1.RecordTypeId = System.Label.Asset_RecordType;
        asset1.SerialNumber = 'asset1';
        asset1.Name = 'asset1';
        asset1.AccountId = dep.Id;
        asset1.Department_Class__c = strategicDep[0].Id;
        asset1.Hospital__c = hospital.Id;
        asset1.Product2Id = pro1.Id;
        asset1.Quantity = 1;
        asset1.Status = '不明';
        asset1.Manage_type__c = '个体管理';
        asset1.Loaner_accsessary__c = false;
        asset1.Out_of_wh__c = 0;
        asset1.Salesdepartment__c = '1.华北营业本部';
        asset1.Internal_asset_location__c = '北京 备品中心';
        asset1.Product_category__c = 'GI';
        asset1.Equipment_Type__c = '产品试用';
        asset1.SalesProvince__c = '北京';
        asset1.CompanyOfEquipment__c = '北京';
        asset1.Internal_Asset_number__c = '0001';
        asset1.AssetManageConfirm__c = true;
        Asset asset2 = new Asset(Asset_Owner__c = 'Olympus');
        asset2.RecordTypeId = System.Label.Asset_RecordType;
        asset2.SerialNumber = 'asset2';
        asset2.Name = 'asset2';
        asset2.AccountId = dep.Id;
        asset2.Department_Class__c = strategicDep[0].Id;
        asset2.Hospital__c = hospital.Id;
        asset2.Product2Id = pro2.Id;
        asset2.Quantity = 1;
        asset2.Status = '不明';
        asset2.Manage_type__c = '个体管理';
        asset2.Loaner_accsessary__c = true;
        asset2.Out_of_wh__c = 0;
        asset2.Salesdepartment__c = '1.华北营业本部';
        asset2.Internal_asset_location__c = '北京 备品中心';
        asset2.Product_category__c = 'GI';
        asset2.Equipment_Type__c = '产品试用';
        asset2.SalesProvince__c = '北京';
        asset2.CompanyOfEquipment__c = '北京';
        asset2.Internal_Asset_number__c = '0002';
        asset2.AssetManageConfirm__c = true;
        Asset asset3 = new Asset(Asset_Owner__c = 'Olympus');
        asset3.RecordTypeId = System.Label.Asset_RecordType;
        asset3.SerialNumber = 'asset3';
        asset3.Name = 'asset3';
        asset3.AccountId = dep.Id;
        asset3.Department_Class__c = strategicDep[0].Id;
        asset3.Hospital__c = hospital.Id;
        asset3.Product2Id = pro3.Id;
        asset3.Quantity = 5;
        asset3.Status = '不明';
        asset3.Manage_type__c = '数量管理';
        asset3.Loaner_accsessary__c = true;
        asset3.Out_of_wh__c = 0;
        asset3.Salesdepartment__c = '1.华北营业本部';
        asset3.Internal_asset_location__c = '北京 备品中心';
        asset3.Product_category__c = 'GI';
        asset3.Equipment_Type__c = '产品试用';
        asset3.SalesProvince__c = '北京';
        asset3.CompanyOfEquipment__c = '北京';
        asset3.Internal_Asset_number__c = '0003';
        asset3.AssetManageConfirm__c = true;
        insert new Asset[] {asset1, asset2, asset3};
        // 备品一对一Link表
        Fixture_OneToOne_Link__c foLink1 = new Fixture_OneToOne_Link__c();
        foLink1.Main_Asset__c = asset1.Id;
        foLink1.Accessory_Asset__c = asset2.Id;
        foLink1.Quantity__c = 1;
        Fixture_OneToOne_Link__c foLink2 = new Fixture_OneToOne_Link__c();
        foLink2.Main_Asset__c = asset1.Id;
        foLink2.Accessory_Asset__c = asset3.Id;
        foLink2.Quantity__c = 1;
        insert new Fixture_OneToOne_Link__c[] {foLink1, foLink2};
        List<Fixture_OneToOne_Link__c> linkList = [select Main_Asset__c from Fixture_OneToOne_Link__c];
        System.assertEquals(2, linkList.size());
        List<Asset> assetList = [select Fixture_OneToOne_Link__c from Asset where Fixture_OneToOne_Link__c <> null];
        System.assertEquals(1, assetList.size());
        // 备品配套
        Fixture_Set__c fsObj1 = new Fixture_Set__c();
        fsObj1.Name = 'set1';
        fsObj1.Fixture_Set_Body_Model_No__c = 'modelNo1';
        fsObj1.Loaner_name__c = 'name1';
        insert fsObj1;
        //盘点表头
        Inventory_Header_Copy__c header = new Inventory_Header_Copy__c();
        header.Inventory_Start_Date__c = Date.toDay();
        header.UniqueKey__c = 'IH-0000';
        header.Inventory_Status__c = '处理中';
        header.InventoryCheck_PIC__c = [SELECT Id
                FROM User WHERE Dept__c = '医疗东北营业本部' and IsActive = true limit 1].id;
        header.InventorySubmit_PIC__c = [SELECT id
                FROM User WHERE Dept__c = '医疗东北营业本部' and IsActive = true limit 1].id;
        insert header;
        String cunFangDi = '北京 备品中心';
        System.Test.StartTest();
        Database.executeBatch(new InventoryStartAssetSnapshotCopyBatch(cunFangDi,header));
        System.Test.StopTest();
        //System.assertEquals(0, InventoryStartAssetSnapshotCopyBatch.messagesForTest.size(), InventoryStartAssetSnapshotCopyBatch.messagesForTest);
        List<Inventory_Detail_Copy__c> resultList = [select UniqueKey__c from Inventory_Detail_Copy__c
                                                                   WHERE Asset_Status__c = '在库' ];
        System.assertEquals(4, resultList.size());
        //todo assert具体属性
        resultList = [select Amount__c from Inventory_Detail_Copy__c WHERE Asset__c = :asset3.Id ];
        System.assertEquals(4, resultList[0].Amount__c);
    }
    //todo明细表
    // @isTest
    // static void testDetail() {
    //     ControllerUtil.EscapeNFM001Trigger = true;
    //     SS_Batch_Column_Mapping__c InventoryHeaderName = new SS_Batch_Column_Mapping__c(Name = 'Inventory_Header_Name', SS_TableName__c='Inventory_Header_Name');
    //     InventoryHeaderName.From_Column_001__c = '北京 备品中心';
    //     InventoryHeaderName.SS_Column_001__c = 'BJ';
    //     InventoryHeaderName.From_Column_002__c = '上海 备品中心';
    //     InventoryHeaderName.SS_Column_002__c = 'SH';
    //     InventoryHeaderName.From_Column_003__c = '广州 备品中心';
    //     InventoryHeaderName.SS_Column_003__c = 'GZ';
    //     insert new SS_Batch_Column_Mapping__c[] {InventoryHeaderName};
    //     // システム管理者
    //     /**
    //     User user = new User(Test_staff__c = true);
    //     user.LastName = '_サンブリッジ';
    //     user.FirstName = 'う';
    //     user.Alias = 'う';
    //     user.Email = 'olympusTest03@sunbridge.com';
    //     user.Username = 'olympusTest03@sunbridge.com';
    //     user.CommunityNickname = 'う';
    //     user.IsActive = true;
    //     user.EmailEncodingKey = 'ISO-2022-JP';
    //     user.TimeZoneSidKey = 'Asia/Tokyo';
    //     user.LocaleSidKey = 'ja_JP';
    //     user.LanguageLocaleKey = 'ja';
    //     user.ProfileId = System.Label.ProfileId_SystemAdmin;
    //     user.Province__c = '北京';
    //     user.Dept__c = '医疗华北营业本部';
    //     user.Use_Start_Date__c = Date.today().addMonths(-6);
    //     user.JingliApprovalManager__c = UserInfo.getUserId();
    //     user.JingliEquipmentManager__c = UserInfo.getUserId();
    //     user.SalesManager__c = UserInfo.getUserId();
    //     user.BuchangApprovalManager__c = UserInfo.getUserId();
    //     user.Buzhang_Equipment_Manager__c = UserInfo.getUserId();
    //     user.BuchangApprovalManagerSales__c = UserInfo.getUserId();
    //     insert user;
    //     **/
    //     User thisUser = [Select Id from User where Id =: UserInfo.getUserId()];
    //     System.runAs(thisUser) {
    //         // 省
    //         Address_Level__c al = new Address_Level__c();
    //         al.Name = '東京';
    //         al.Level1_Code__c = 'CN-99';
    //         al.Level1_Sys_No__c = '999999';
    //         insert al;
    //         // 市
    //         Address_Level2__c al2 = new Address_Level2__c();
    //         al2.Level1_Code__c = 'CN-99';
    //         al2.Level1_Sys_No__c = '999999';
    //         al2.Level1_Name__c = '東京';
    //         al2.Name = '渋谷区';
    //         al2.Level2_Code__c = 'CN-9999';
    //         al2.Level2_Sys_No__c = '9999999';
    //         al2.Address_Level__c = al.id;
    //         insert al2;
    //         // 病院を作る
    //         Account hospital = new Account();
    //         hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id;
    //         hospital.Name = 'test hospital';
    //         hospital.Is_Active__c = '有効';
    //         hospital.Attribute_Type__c = '卫生部';
    //         hospital.Speciality_Type__c = '综合医院';
    //         hospital.Grade__c = '一级';
    //         hospital.OCM_Category__c = 'SLTV';
    //         hospital.Is_Medical__c = '医疗机构';
    //         hospital.State_Master__c = al.id;
    //         hospital.City_Master__c = al2.id;
    //         hospital.Town__c = '东京';
    //         insert hospital;
    //         // 戦略科室を得る
    //         Account[] strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_OTH'];
    //         // 診療科を作る
    //         Account dep = new Account();
    //         dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_OTH'].id;
    //         dep.Name = 'test dep';
    //         dep.AgentCode_Ext__c = '9999998';
    //         dep.ParentId = strategicDep[0].Id;
    //         dep.Department_Class__c = strategicDep[0].Id;
    //         dep.Hospital__c = hospital.Id;
    //         insert dep;
    //         Contact contact2 = new Contact();
    //         contact2.AccountId = dep.Id;
    //         contact2.FirstName = '責任者';
    //         contact2.LastName = 'test1经销商';
    //         insert contact2;
    //         // 产品
    //         Product2 pro1 = new Product2(Name='name01',IsActive=true,Family='GI',
    //                 Fixture_Model_No__c='n01',Serial_Lot_No__c='S/N tracing',
    //                 Fixture_Model_No_T__c = 'n01',
    //                 ProductCode_Ext__c='pc01',Manual_Entry__c=false);
    //         Product2 pro2 = new Product2(Name='name02',IsActive=true,Family='GI',
    //                 Fixture_Model_No__c='n02',Serial_Lot_No__c='Lot tracing',
    //                 ProductCode_Ext__c='pc02',Manual_Entry__c=false);
    //         Product2 pro3 = new Product2(Name='name03',IsActive=true,Family='GI',
    //                 Fixture_Model_No__c='n03',Serial_Lot_No__c='Lot tracing',
    //                 ProductCode_Ext__c='pc03',Manual_Entry__c=false);
    //         insert new Product2[] {pro1, pro2, pro3};
    //         // 保有设备
    //         Asset asset1 = new Asset(Asset_Owner__c = 'Olympus');
    //         asset1.RecordTypeId = System.Label.Asset_RecordType;
    //         asset1.SerialNumber = 'asset1';
    //         asset1.Name = 'asset1';
    //         asset1.AccountId = dep.Id;
    //         asset1.Department_Class__c = strategicDep[0].Id;
    //         asset1.Hospital__c = hospital.Id;
    //         asset1.Product2Id = pro1.Id;
    //         asset1.Quantity = 10;
    //         asset1.Status = '不明';
    //         asset1.Manage_type__c = '个体管理';
    //         asset1.Loaner_accsessary__c = false;
    //         asset1.Out_of_wh__c = 0;
    //         asset1.Salesdepartment__c = '1.华北营业本部';
    //         asset1.Internal_asset_location__c = '北京 备品中心';
    //         asset1.Product_category__c = 'GI';
    //         asset1.Equipment_Type__c = '产品试用';
    //         asset1.SalesProvince__c = '北京';
    //         asset1.CompanyOfEquipment__c = '北京';
    //         asset1.Internal_Asset_number__c = '0001';
    //         asset1.Rental_Count__c = 0;
    //         asset1.AssetManageConfirm__c = true;
    //         Asset asset2 = new Asset(Asset_Owner__c = 'Olympus');
    //         asset2.RecordTypeId = System.Label.Asset_RecordType;
    //         asset2.SerialNumber = 'asset2';
    //         asset2.Name = 'asset2';
    //         asset2.AccountId = dep.Id;
    //         asset2.Department_Class__c = strategicDep[0].Id;
    //         asset2.Hospital__c = hospital.Id;
    //         asset2.Product2Id = pro2.Id;
    //         asset2.Quantity = 10;
    //         asset2.Status = '不明';
    //         asset2.Manage_type__c = '数量管理';
    //         asset2.Loaner_accsessary__c = true;
    //         asset2.Out_of_wh__c = 0;
    //         asset2.Salesdepartment__c = '1.华北营业本部';
    //         asset2.Internal_asset_location__c = '北京 备品中心';
    //         asset2.Product_category__c = 'GI';
    //         asset2.Equipment_Type__c = '产品试用';
    //         asset2.SalesProvince__c = '北京';
    //         asset2.CompanyOfEquipment__c = '北京';
    //         asset2.Internal_Asset_number__c = '0002';
    //         asset2.Rental_Count__c = 0;
    //         asset2.AssetManageConfirm__c = true;
    //         insert new Asset[] {asset1, asset2};
    //         // 备品配套
    //         Fixture_Set__c fsObjA1 = new Fixture_Set__c();
    //         fsObjA1.Name = 'set1';
    //         fsObjA1.Fixture_Set_Body_Model_No__c = 'modelNo1';
    //         fsObjA1.Loaner_name__c = 'name1';
    //         insert fsObjA1;
    //         // 备品配套明细
    //         Fixture_Set_Detail__c fsdObjA1 = new Fixture_Set_Detail__c();
    //         fsdObjA1.Name = '备品配套明细名1';
    //         fsdObjA1.Name_CHN_Created__c = '中文名称1';
    //         fsdObjA1.Product2__c = pro1.Id;
    //         fsdObjA1.Fixture_Set__c = fsObjA1.Id;
    //         fsdObjA1.Is_Body__c = true;
    //         fsdObjA1.Is_Optional__c = false;
    //         fsdObjA1.UniqueKey__c = fsObjA1.Id + ':' + pro1.Id;
    //         // 备品配套明细
    //         Fixture_Set_Detail__c fsdObjA2 = new Fixture_Set_Detail__c();
    //         fsdObjA2.Name = '备品配套明细名2';
    //         fsdObjA2.Name_CHN_Created__c = '中文名称2';
    //         fsdObjA2.Product2__c = pro2.Id;
    //         fsdObjA2.Fixture_Set__c = fsObjA1.Id;
    //         fsdObjA2.Is_Body__c = false;
    //         fsdObjA2.Is_Optional__c = true;
    //         fsdObjA2.UniqueKey__c = fsObjA1.Id + ':' + pro2.Id;
    //         insert new Fixture_Set_Detail__c[] {fsdObjA1, fsdObjA2};
    //         List<Fixture_Set_Detail__c> fictureList = [select Name from Fixture_Set_Detail__c];
    //         System.assertEquals(2, fictureList.size());
    //         ////备品借出申请
    //         Rental_Apply__c raObj = new Rental_Apply__c();
    //         raObj.Name = 'testra';
    //         raObj.Product_category__c = 'GI';
    //         raObj.Demo_purpose1__c = '产品试用';
    //         raObj.demo_purpose2__c = FixtureUtil.raDemo_purpose2MAP.get('shiyongwuxunjia');
    //         raObj.direct_send__c = '医疗机构';
    //         raObj.Loaner_received_staff__c = '王五';
    //         raObj.Loaner_received_staff_phone__c = '110';
    //         raObj.direct_shippment_address__c = '北京市';
    //         raObj.Hospital__c = hospital.Id;
    //         raObj.Strategic_dept__c = strategicDep[0].Id;
    //         raObj.Account__c = dep.Id;
    //         raObj.Request_shipping_day__c = Date.toDay();
    //         raObj.Request_return_day__c = Date.toDay();
    //         raObj.Phone_number__c = '1234567890';
    //         raObj.Loaner_medical_Staff__c = contact2.Id;
    //         insert raObj;
    //         FixtureDeliverySlip__c ds = new FixtureDeliverySlip__c();
    //         ds.Name = 'Test1';
    //         ds.Wh_Staff__c = UserInfo.getUserId();
    //         ds.DeliveryCompany__c = '利讯';
    //         ds.Shippment_loaner_time__c = Datetime.now();
    //         ds.Distributor_method__c = '陆运';
    //         ds.DeliveryType__c = '发货';
    //         ds.DeliveryCompany_SlipNo__c = 'TestNo1';
    //         insert ds;
    //         Rental_Apply_Equipment_Set__c raesObj = new Rental_Apply_Equipment_Set__c();
    //         raesObj.Rental_Apply__c = raObj.Id;
    //         raesObj.Fixture_Set__c = fsObjA1.Id;
    //         raesObj.Cancel_Select__c = false;
    //         raesObj.Shipment_request_time__c = Date.toDay();
    //         raesObj.Rental_Start_Date__c = Date.toDay();
    //         raesObj.Rental_End_Date__c = Date.toDay();
    //         raesObj.UniqueKey__c = raObj.RequestNoJoinStr2__c + ':'+ fsObjA1.Id + ':'+ 1;
    //         raesObj.IndexFromUniqueKey__c = 1;
    //         insert raesObj;
    //         // 借出备品配套一览明细
    //         Rental_Apply_Equipment_Set_Detail__c raesdObj1 = new Rental_Apply_Equipment_Set_Detail__c();
    //         raesdObj1.Rental_Apply__c = raObj.Id;
    //         raesdObj1.Fixture_Set_Detail__c = fsdObjA1.Id;
    //         raesdObj1.Rental_Num__c = 1;
    //         raesdObj1.Queue_Number__c = null;
    //         raesdObj1.Is_Body__c = true;
    //         raesdObj1.Rental_Apply_Equipment_Set__c = raesObj.Id;
    //         raesdObj1.IndexFromUniqueKey__c = 1;
    //         raesdObj1.Salesdepartment_before__c = '1.华北营业本部';
    //         raesdObj1.Internal_asset_location_before__c = '北京 备品中心';
    //         raesdObj1.Product_category_text__c = 'GI';
    //         raesdObj1.Equipment_Type_text__c = '产品试用';
    //         raesdObj1.UniqueKey__c = '1:'+ raesObj.Id + ':' + fsdObjA1.Id + ':1';
    //         raesdObj1.FSD_Fixture_Model_No__c = 'n01';
    //         raesdObj1.Fixture_Model_No_text__c = 'n01';
    //         raesdObj1.Asset__c = asset1.id;
    //         raesdObj1.StockDown__c = true;
    //         raesdObj1.OnStock_By_Cancel__c = true;
    //         raesdObj1.Inspection_result_NG__c = '废弃';
    //         raesdObj1.Inspection_result__c = 'NG';
    //         // 借出备品配套一览明细
    //         Rental_Apply_Equipment_Set_Detail__c raesdObj2 = new Rental_Apply_Equipment_Set_Detail__c();
    //         raesdObj2.Rental_Apply__c = raObj.Id;
    //         raesdObj2.Fixture_Set_Detail__c = fsdObjA2.Id;
    //         raesdObj2.Rental_Num__c = 1;
    //         raesdObj2.Queue_Number__c = null;
    //         raesdObj2.Is_Body__c = false;
    //         raesdObj2.Rental_Apply_Equipment_Set__c = raesObj.Id;
    //         raesdObj2.IndexFromUniqueKey__c = 1;
    //         raesdObj2.Salesdepartment_before__c = '1.华北营业本部';
    //         raesdObj2.Internal_asset_location_before__c = '北京 备品中心';
    //         raesdObj2.Product_category_text__c = 'GI';
    //         raesdObj2.Equipment_Type_text__c = '产品试用';
    //         raesdObj2.UniqueKey__c = '1:'+ raesObj.Id + ':' + fsdObjA2.Id + ':1';
    //         raesdObj2.FSD_Fixture_Model_No__c = 'n02';
    //         raesdObj2.Fixture_Model_No_text__c = 'n02';
    //         raesdObj2.Asset__c = asset2.id;
    //         raesdObj2.StockDown__c = true;
    //         raesdObj2.StockDown_staff__c = UserInfo.getUserId();
    //         raesdObj2.StockDown_time__c = Datetime.now();
    //         raesdObj2.Pre_inspection_time__c = Datetime.now();
    //         raesdObj2.Inspection_staff__c = UserInfo.getUserId();
    //         raesdObj2.Inspection_result__c = 'OK';
    //         raesdObj2.DeliverySlip__c = ds.Id;
    //         Rental_Apply_Equipment_Set_Detail__c raesdObj3 = new Rental_Apply_Equipment_Set_Detail__c();
    //         raesdObj3.Rental_Apply__c = raObj.Id;
    //         raesdObj3.Fixture_Set_Detail__c = fsdObjA2.Id;
    //         raesdObj3.Rental_Num__c = 1;
    //         raesdObj3.Queue_Number__c = null;
    //         raesdObj3.Is_Body__c = false;
    //         raesdObj3.Rental_Apply_Equipment_Set__c = raesObj.Id;
    //         raesdObj3.IndexFromUniqueKey__c = 2;
    //         raesdObj3.Salesdepartment_before__c = '1.华北营业本部';
    //         raesdObj3.Internal_asset_location_before__c = '北京 备品中心';
    //         raesdObj3.Product_category_text__c = 'GI';
    //         raesdObj3.Equipment_Type_text__c = '产品试用';
    //         raesdObj3.UniqueKey__c = '1:'+ raesObj.Id + ':' + fsdObjA2.Id + ':2';
    //         raesdObj3.FSD_Fixture_Model_No__c = 'n02';
    //         raesdObj3.Fixture_Model_No_text__c = 'n02';
    //         raesdObj3.Asset__c = asset2.id;
    //         raesdObj3.StockDown__c = true;
    //         raesdObj3.StockDown_staff__c = UserInfo.getUserId();
    //         raesdObj3.StockDown_time__c = Datetime.now();
    //         raesdObj3.Pre_inspection_time__c = Datetime.now();
    //         raesdObj3.Inspection_staff__c = UserInfo.getUserId();
    //         raesdObj3.Inspection_result__c = 'OK';
    //         raesdObj3.DeliverySlip__c = ds.Id;
    //         raesdObj3.Lost_item_giveup__c = true;
    //         raesdObj3.Loaner_Giveup_Time__c = System.now();
    //         insert new Rental_Apply_Equipment_Set_Detail__c[] {raesdObj1,raesdObj2,raesdObj3};
    //         List<Rental_Apply_Equipment_Set_Detail__c> detailList = [select Asset__c from Rental_Apply_Equipment_Set_Detail__c];
    //         System.assertEquals(3, detailList.size());
    //         raesObj.First_RAESD__c = raesdObj1.Id;
    //         update raesObj;
    //         raObj.Status__c = '已批准';
    //         update raObj;
    //         //盘点表头
    //         Inventory_Header_Copy__c header = new Inventory_Header_Copy__c();
    //         header.Inventory_Start_Date__c = Date.toDay();
    //         header.UniqueKey__c = 'IH-0000';
    //         header.Inventory_Status__c = '处理中';
    //         header.InventoryCheck_PIC__c = [SELECT Id
    //             FROM User WHERE Dept__c = '医疗东北营业本部' and IsActive = true limit 1].id;
    //         header.InventorySubmit_PIC__c = [SELECT id
    //             FROM User WHERE Dept__c = '医疗东北营业本部' and IsActive = true limit 1].id;
    //         insert header;
    //         String cunFangDi = '北京 备品中心';
    //         System.Test.StartTest();
    //        // Database.executeBatch(new InventoryStartAssetSnapshotCopyBatch(cunFangDi,header));
    //         System.Test.StopTest();
    //         List<Inventory_Detail_Copy__c> onStockList = [select UniqueKey__c from Inventory_Detail_Copy__c
    //                                                                     WHERE Asset_Status__c = '在库'];
    //         //System.assertEquals(2, onStockList.size());
    //         List<Inventory_Detail_Copy__c> lendList = [select UniqueKey__c from Inventory_Detail_Copy__c
    //                                                                  WHERE Asset_Status__c = '出借中'];
    //         //System.assertEquals(1, lendList.size());
    //         //Delete test TODO assert
    //         header.Inventory_Status__c = null;
    //         update header;
    //         Database.executeBatch(new InventoryStartAssetSnapshotCopyBatch(cunFangDi,header));
    //     }
    // }
     @isTest
    static void testDetail1() {
        ControllerUtil.EscapeNFM001Trigger = true;
        SS_Batch_Column_Mapping__c InventoryHeaderName = new SS_Batch_Column_Mapping__c(Name = 'Inventory_Header_Name', SS_TableName__c='Inventory_Header_Name');
        InventoryHeaderName.From_Column_001__c = '北京 备品中心';
        InventoryHeaderName.SS_Column_001__c = 'BJ';
        InventoryHeaderName.From_Column_002__c = '上海 备品中心';
        InventoryHeaderName.SS_Column_002__c = 'SH';
        InventoryHeaderName.From_Column_003__c = '广州 备品中心';
        InventoryHeaderName.SS_Column_003__c = 'GZ';
        insert new SS_Batch_Column_Mapping__c[] {InventoryHeaderName};
        SS_Batch_Column_Mapping__c AgencyInventory = new SS_Batch_Column_Mapping__c(Name = 'Agency_Inventory_Role', SS_TableName__c='Agency_Inventory_Role');
        AgencyInventory.From_Column_001__c = '北京 备品中心';
        AgencyInventory.SS_Column_001__c = '1.华北营业本部';
        AgencyInventory.From_Column_002__c = '济南';
        AgencyInventory.SS_Column_002__c = '1.华北营业本部';
        AgencyInventory.From_Column_003__c = '郑州';
        AgencyInventory.SS_Column_003__c = '3.西北营业本部';
        insert new SS_Batch_Column_Mapping__c[] {AgencyInventory};
        User thisUser = [Select Id from User where Id =: UserInfo.getUserId()];
        System.runAs(thisUser) {
            // 省
            Address_Level__c al = new Address_Level__c();
            al.Name = '東京';
            al.Level1_Code__c = 'CN-99';
            al.Level1_Sys_No__c = '999999';
            insert al;
            // 市
            Address_Level2__c al2 = new Address_Level2__c();
            al2.Level1_Code__c = 'CN-99';
            al2.Level1_Sys_No__c = '999999';
            al2.Level1_Name__c = '東京';
            al2.Name = '渋谷区';
            al2.Level2_Code__c = 'CN-9999';
            al2.Level2_Sys_No__c = '9999999';
            al2.Address_Level__c = al.id;
            insert al2;
            // 病院を作る
            Account hospital = new Account();
            hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id;
            hospital.Name = 'test hospital';
            hospital.Is_Active__c = '有効';
            hospital.Attribute_Type__c = '卫生部';
            hospital.Speciality_Type__c = '综合医院';
            hospital.Grade__c = '一级';
            hospital.OCM_Category__c = 'SLTV';
            hospital.Is_Medical__c = '医疗机构';
            hospital.State_Master__c = al.id;
            hospital.City_Master__c = al2.id;
            hospital.Town__c = '东京';
            insert hospital;
            StaticParameter.EscapeAccountTrigger = true;
            // 戦略科室を得る
            Account[] strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_OTH'];
            // 診療科を作る
            Account dep = new Account();
            dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_OTH'].id;
            dep.Name = 'test dep1';
            dep.AgentCode_Ext__c = System.Label.Account_Asset_FJZ;
            dep.ParentId = strategicDep[0].Id;
            dep.Department_Class__c = strategicDep[0].Id;
            dep.Hospital__c = hospital.Id;
            Account dep1 = new Account();
            dep1.recordtypeId = dep.recordtypeId;
            dep1.Name = 'test dep1';
            dep1.AgentCode_Ext__c = System.Label.Account_Asset;
            dep1.ParentId = strategicDep[0].Id;
            dep1.Department_Class__c = strategicDep[0].Id;
            dep1.Hospital__c = hospital.Id;
            insert new Account[]{dep, dep1};
            // 产品
            Product2 pro1 = new Product2(Name='CLH-250:内窥镜冷光源',IsActive=true,Family='GI',
                    Fixture_Model_No__c='CLH-250',Serial_Lot_No__c='S/N tracing',
                    Fixture_Model_No_T__c = 'CLH-250', Asset_Model_No__c = 'Pro1',
                    ProductCode_Ext__c='4604362',Manual_Entry__c=false);
            Product2 pro2 = new Product2(Name='电源线',IsActive=true,Family='GI',
                    Fixture_Model_No__c='电源线',Serial_Lot_No__c='Lot tracing',
                    Fixture_Model_No_T__c = '电源线', Asset_Model_No__c = 'Pro2',
                    ProductCode_Ext__c='BP900003',Manual_Entry__c=false);
            Product2 pro3 = new Product2(Name='MAJ-1933:数字调光电缆',IsActive=true,Family='GI',
                    Fixture_Model_No__c='MAJ-1933',Serial_Lot_No__c='Lot tracing',
                    Fixture_Model_No_T__c = 'MAJ-1933', Asset_Model_No__c = 'Pro3',
                    ProductCode_Ext__c='N3647100',Manual_Entry__c=false);
            insert new Product2[] {pro1, pro2, pro3};
             // 保有设备  主机
            Asset asset1 = new Asset(Asset_Owner__c = 'Olympus');
            asset1.RecordTypeId = System.Label.Asset_RecordType;
            asset1.SerialNumber = 'asset1';
            asset1.Name = 'asset1';
            asset1.AccountId = dep.Id;
            asset1.Department_Class__c = strategicDep[0].Id;
            asset1.Hospital__c = hospital.Id;
            asset1.Product2Id = pro1.Id;
            asset1.Quantity = 10;
            asset1.Status = '不明';
            asset1.Manage_type__c = '个体管理';
            asset1.Loaner_accsessary__c = false;
            asset1.Out_of_wh__c = 0;
            asset1.Salesdepartment__c = '1.华北营业本部';
            asset1.Internal_asset_location__c = '北京 备品中心';
            asset1.Product_category__c = 'GI';
            asset1.Equipment_Type__c = '产品试用';
            asset1.SalesProvince__c = '北京';
            asset1.CompanyOfEquipment__c = '北京';
            asset1.Internal_Asset_number__c = '0001';
            asset1.Rental_Count__c = 0;
            asset1.AssetManageConfirm__c = true;
            Asset asset2 = new Asset(Asset_Owner__c = 'Olympus');
            asset2.RecordTypeId = System.Label.Asset_RecordType;
            asset2.SerialNumber = 'asset2';
            asset2.Name = 'asset2';
            asset2.AccountId = dep.Id;
            asset2.Department_Class__c = strategicDep[0].Id;
            asset2.Hospital__c = hospital.Id;
            asset2.Product2Id = pro2.Id;
            asset2.Quantity = 10;
            asset2.Status = '不明';
            asset2.Manage_type__c = '数量管理';
            asset2.Loaner_accsessary__c = true;   //附属品
            asset2.Out_of_wh__c = 0;
            asset2.Salesdepartment__c = '1.华北营业本部';
            asset2.Internal_asset_location__c = '北京 备品中心';
            asset2.Product_category__c = 'GI';
            asset2.Equipment_Type__c = '产品试用';
            asset2.SalesProvince__c = '北京';
            asset2.CompanyOfEquipment__c = '北京';
            asset2.Internal_Asset_number__c = '0002';
            asset2.Rental_Count__c = 0;
            asset2.AssetManageConfirm__c = true;
            insert new Asset[] {asset1, asset2};
            List<Asset> assetList = [select Name from Asset];
            System.assertEquals(2, assetList.size());
            // 备品一对一Link表
            Fixture_OneToOne_Link__c foLink1 = new Fixture_OneToOne_Link__c();
            foLink1.Main_Asset__c = asset1.Id;
            foLink1.Accessory_Asset__c = asset2.Id;
            foLink1.Quantity__c = 1;
            insert new Fixture_OneToOne_Link__c[] {foLink1};
            // 备品配套
            Fixture_Set__c fsObj1 = new Fixture_Set__c();
            fsObj1.Name = 'set1';
            fsObj1.Fixture_Set_Body_Model_No__c = 'modelNo1';
            fsObj1.Loaner_name__c = 'name1';
            insert fsObj1;
            // 备品配套明细
            Fixture_Set_Detail__c fsdObjA1 = new Fixture_Set_Detail__c();
            fsdObjA1.Name = '备品配套明细名1';
            fsdObjA1.Name_CHN_Created__c = '中文名称1';
            fsdObjA1.Product2__c = pro1.Id;
            fsdObjA1.Fixture_Set__c = fsObj1.Id;
            fsdObjA1.Is_Body__c = true;
            fsdObjA1.Is_Optional__c = false;
            fsdObjA1.UniqueKey__c = fsObj1.Id + ':' + pro1.Id;
            fsdObjA1.SortInt__c = 1;
            fsdObjA1.Quantity__c = 1;
            Fixture_Set_Detail__c fsdObjA2 = new Fixture_Set_Detail__c();
            fsdObjA2.Name = '备品配套明细名2';
            fsdObjA2.Name_CHN_Created__c = '中文名称2';
            fsdObjA2.Product2__c = pro2.Id;
            fsdObjA2.Fixture_Set__c = fsObj1.Id;
            fsdObjA2.Is_Body__c = false;
            fsdObjA2.Is_Optional__c = true;
            fsdObjA2.UniqueKey__c = fsObj1.Id + ':' + pro2.Id;
            fsdObjA2.SortInt__c = 2;
            fsdObjA2.Quantity__c = 1;
            fsdObjA2.Is_OneToOne__c = true;
            Fixture_Set_Detail__c fsdObjA3 = new Fixture_Set_Detail__c();
            fsdObjA3.Name = '备品配套明细名3';
            fsdObjA3.Name_CHN_Created__c = '中文名称3';
            fsdObjA3.Product2__c = pro3.Id;
            fsdObjA3.Fixture_Set__c = fsObj1.Id;
            fsdObjA3.Is_Body__c = false;
            fsdObjA3.Is_Optional__c = true;
            fsdObjA3.UniqueKey__c = fsObj1.Id + ':' + pro3.Id;
            fsdObjA3.SortInt__c = 3;
            fsdObjA3.Quantity__c = 1;
            fsdObjA3.Is_OneToOne__c = true;
            insert new Fixture_Set_Detail__c[] {fsdObjA1, fsdObjA2, fsdObjA3};
            FixtureDeliverySlip__c ds = new FixtureDeliverySlip__c();
            ds.Name = 'Test1';
            ds.Wh_Staff__c = UserInfo.getUserId();
            ds.DeliveryCompany__c = '利讯';
            ds.Shippment_loaner_time__c = Datetime.now();
            ds.Distributor_method__c = '陆运';
            ds.DeliveryType__c = '发货';
            ds.DeliveryCompany_SlipNo__c = 'TestNo1';
            insert ds;
            //调拨申请
            TransferApply__c raObj = new TransferApply__c();
            raObj.Name = 'testra';
            raObj.From_Location__c = '北京';
            raObj.Destination_Location__c = '北京 备品中心';
            Map<String,Schema.RecordTypeInfo>  DEVELOPERNAMEMAP  = Schema.SObjectType.TransferApply__c.getRecordTypeInfosByDeveloperName();
            raObj.RecordTypeId = DEVELOPERNAMEMAP.get('AgencyToCenter').getRecordTypeId();
            insert raObj;
            // 调拨一览
            TransferApplySummary__c raesObj = new TransferApplySummary__c();
            raesObj.TransferApply__c = raObj.Id;
            raesObj.Fixture_Set__c = fsObj1.Id;
            raesObj.Cancel_Select__c = false;
            raesObj.IndexFromUniqueKey__c = 1;
            insert raesObj;
            //调拨申请一览明细
            //状态 待移至报废区   主机
            TransferApplyDetail__c raesdObj1 = new TransferApplyDetail__c();
            raesdObj1.TransferApply__c = raObj.Id;
            raesdObj1.Fixture_Set_Detail__c = fsdObjA1.Id;
            raesdObj1.TransferApplySummary__c = raesObj.Id;
            raesdObj1.IndexFromUniqueKey__c = 1;
            raesdObj1.FSD_OneToOneAccessory_Cnt__c = 1;
            raesdObj1.ApplyPersonAppended__c = false;
            raesdObj1.TransferCount__c = 1;
            raesdObj1.FSD_SortInt__c = 01;
            raesdObj1.Asset__c = asset1.Id;
            raesdObj1.Main_OneToOne__c = true;  //主机
            raesdObj1.Salesdepartment_After__c = '1.华北营业本部';
            raesdObj1.OneToOneAccessory__c = false;
            raesdObj1.StockDown__c = true;
            raesdObj1.StockDown_staff__c = UserInfo.getUserId();
            raesdObj1.StockDown_time__c = Datetime.now();
            raesdObj1.Pre_inspection_time__c = Datetime.now();
            raesdObj1.Inspection_staff__c = UserInfo.getUserId();
            raesdObj1.Inspection_result__c = 'OK';
            raesdObj1.DeliverySlip__c = ds.Id;
            raesdObj1.Check_lost_Item__c ='OK';
            raesdObj1.Inspection_result_after__c = 'NG';
            raesdObj1.Inspection_NG_abord_reason__c = '其他';
            raesdObj1.Inspection_Comment__c = 'test';
            raesdObj1.Inspection_result_after_ng__c = '废弃';
            //附属品  欠品
            TransferApplyDetail__c raesdObj2 = new TransferApplyDetail__c();
            raesdObj2.TransferApply__c = raObj.Id;
            raesdObj2.Fixture_Set_Detail__c = fsdObjA2.Id;
            raesdObj2.TransferApplySummary__c = raesObj.Id;
            raesdObj2.IndexFromUniqueKey__c = 2;
            raesdObj2.FSD_OneToOneAccessory_Cnt__c = 1;
            raesdObj2.ApplyPersonAppended__c = false;
            raesdObj2.TransferCount__c = 1;
            raesdObj2.FSD_SortInt__c = 02;
            raesdObj2.Asset__c = asset2.Id;
            raesdObj2.OneToOneAccessory__c = true;
            raesdObj2.StockDown__c = true;
            raesdObj2.StockDown_staff__c = UserInfo.getUserId();
            raesdObj2.StockDown_time__c = Datetime.now();
            raesdObj2.Pre_inspection_time__c = Datetime.now();
            raesdObj2.Inspection_staff__c = UserInfo.getUserId();
            raesdObj2.Inspection_result__c = 'OK';
            raesdObj2.DeliverySlip__c = ds.Id;
            raesdObj2.Lost_item_giveup__c = true;
            raesdObj2.Loaner_Giveup_Time__c = System.now();
            raesdObj2.OnStock_By_Cancel__c = false;
            raesdObj2.Check_lost_Item_Final__c ='欠品';
            raesdObj2.Loaner_accsessary__c = true;
            insert new TransferApplyDetail__c[] {raesdObj1,raesdObj2};
            //盘点表头
            Inventory_Header_Copy__c header = new Inventory_Header_Copy__c();
            header.Inventory_Start_Date__c = Date.toDay();
            header.UniqueKey__c = 'IH-0000';
            header.Inventory_Status__c = '处理中';
            header.InventoryCheck_PIC__c = [SELECT Id
                FROM User WHERE Dept__c = '医疗东北营业本部' and IsActive = true limit 1].id;
            header.InventorySubmit_PIC__c = [SELECT id
                FROM User WHERE Dept__c = '医疗东北营业本部' and IsActive = true limit 1].id;
            insert header;
            String cunFangDi = '北京 备品中心';
            System.Test.StartTest();
            Database.executeBatch(new InventoryStartAssetSnapshotCopyBatch(cunFangDi,header));
            System.Test.StopTest();
            List<Inventory_Detail_Copy__c> onStockList = [select UniqueKey__c from Inventory_Detail_Copy__c
                                                                        WHERE Asset_Status__c = '在库'];
            System.assertEquals(3, onStockList.size());
            //Delete test TODO assert
            header.Inventory_Status__c = null;
            update header;
            Database.executeBatch(new InventoryStartAssetSnapshotCopyBatch(cunFangDi,header));
        }
    }
    //  @isTest
    // static void testDetail4() {
    //     ControllerUtil.EscapeNFM001Trigger = true;
    //     SS_Batch_Column_Mapping__c InventoryHeaderName = new SS_Batch_Column_Mapping__c(Name = 'Inventory_Header_Name', SS_TableName__c='Inventory_Header_Name');
    //     InventoryHeaderName.From_Column_001__c = '北京 备品中心';
    //     InventoryHeaderName.SS_Column_001__c = 'BJ';
    //     InventoryHeaderName.From_Column_002__c = '上海 备品中心';
    //     InventoryHeaderName.SS_Column_002__c = 'SH';
    //     InventoryHeaderName.From_Column_003__c = '广州 备品中心';
    //     InventoryHeaderName.SS_Column_003__c = 'GZ';
    //     insert new SS_Batch_Column_Mapping__c[] {InventoryHeaderName};
    //     User thisUser = [Select Id from User where Id =: UserInfo.getUserId()];
    //     System.runAs(thisUser) {
    //         // 省
    //         Address_Level__c al = new Address_Level__c();
    //         al.Name = '東京';
    //         al.Level1_Code__c = 'CN-99';
    //         al.Level1_Sys_No__c = '999999';
    //         insert al;
    //         // 市
    //         Address_Level2__c al2 = new Address_Level2__c();
    //         al2.Level1_Code__c = 'CN-99';
    //         al2.Level1_Sys_No__c = '999999';
    //         al2.Level1_Name__c = '東京';
    //         al2.Name = '渋谷区';
    //         al2.Level2_Code__c = 'CN-9999';
    //         al2.Level2_Sys_No__c = '9999999';
    //         al2.Address_Level__c = al.id;
    //         insert al2;
    //         // 病院を作る
    //         Account hospital = new Account();
    //         hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id;
    //         hospital.Name = 'test hospital';
    //         hospital.Is_Active__c = '有効';
    //         hospital.Attribute_Type__c = '卫生部';
    //         hospital.Speciality_Type__c = '综合医院';
    //         hospital.Grade__c = '一级';
    //         hospital.OCM_Category__c = 'SLTV';
    //         hospital.Is_Medical__c = '医疗机构';
    //         hospital.State_Master__c = al.id;
    //         hospital.City_Master__c = al2.id;
    //         hospital.Town__c = '东京';
    //         insert hospital;
    //         StaticParameter.EscapeAccountTrigger = true;
    //         // 戦略科室を得る
    //         Account[] strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_OTH'];
    //         // 診療科を作る
    //         Account dep = new Account();
    //         dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_OTH'].id;
    //         dep.Name = 'test dep1';
    //         dep.AgentCode_Ext__c = System.Label.Account_Asset_FJZ;
    //         dep.ParentId = strategicDep[0].Id;
    //         dep.Department_Class__c = strategicDep[0].Id;
    //         dep.Hospital__c = hospital.Id;
    //         Account dep1 = new Account();
    //         dep1.recordtypeId = dep.recordtypeId;
    //         dep1.Name = 'test dep1';
    //         dep1.AgentCode_Ext__c = System.Label.Account_Asset;
    //         dep1.ParentId = strategicDep[0].Id;
    //         dep1.Department_Class__c = strategicDep[0].Id;
    //         dep1.Hospital__c = hospital.Id;
    //         insert new Account[]{dep, dep1};
    //         // 产品
    //         Product2 pro1 = new Product2(Name='CLH-250:内窥镜冷光源',IsActive=true,Family='GI',
    //                 Fixture_Model_No__c='CLH-250',Serial_Lot_No__c='S/N tracing',
    //                 Fixture_Model_No_T__c = 'CLH-250', Asset_Model_No__c = 'Pro1',
    //                 ProductCode_Ext__c='4604362',Manual_Entry__c=false);
    //         Product2 pro2 = new Product2(Name='电源线',IsActive=true,Family='GI',
    //                 Fixture_Model_No__c='电源线',Serial_Lot_No__c='Lot tracing',
    //                 Fixture_Model_No_T__c = '电源线', Asset_Model_No__c = 'Pro2',
    //                 ProductCode_Ext__c='BP900003',Manual_Entry__c=false);
    //         Product2 pro3 = new Product2(Name='MAJ-1933:数字调光电缆',IsActive=true,Family='GI',
    //                 Fixture_Model_No__c='MAJ-1933',Serial_Lot_No__c='Lot tracing',
    //                 Fixture_Model_No_T__c = 'MAJ-1933', Asset_Model_No__c = 'Pro3',
    //                 ProductCode_Ext__c='N3647100',Manual_Entry__c=false);
    //         insert new Product2[] {pro1, pro2, pro3};
    //          // 保有设备  单独主机
    //         Asset asset1 = new Asset(Asset_Owner__c = 'Olympus');
    //         asset1.RecordTypeId = System.Label.Asset_RecordType;
    //         asset1.SerialNumber = 'asset1';
    //         asset1.Name = 'asset1';
    //         asset1.AccountId = dep.Id;
    //         asset1.Department_Class__c = strategicDep[0].Id;
    //         asset1.Hospital__c = hospital.Id;
    //         asset1.Product2Id = pro1.Id;
    //         asset1.Quantity = 10;
    //         asset1.Status = '不明';
    //         asset1.Manage_type__c = '个体管理';
    //         asset1.Loaner_accsessary__c = false;
    //         asset1.Out_of_wh__c = 0;
    //         asset1.Salesdepartment__c = '1.华北营业本部';
    //         asset1.Internal_asset_location__c = '北京 备品中心';
    //         asset1.Product_category__c = 'GI';
    //         asset1.Equipment_Type__c = '产品试用';
    //         asset1.SalesProvince__c = '北京';
    //         asset1.CompanyOfEquipment__c = '北京';
    //         asset1.Internal_Asset_number__c = '0001';
    //         asset1.Rental_Count__c = 0;
    //         asset1.AssetManageConfirm__c = true;
    //         insert asset1;
    //          // 保有设备  一对一主机
    //         Asset asset11 = new Asset(Asset_Owner__c = 'Olympus');
    //         asset11.RecordTypeId = System.Label.Asset_RecordType;
    //         asset11.SerialNumber = 'asset11';
    //         asset11.Name = 'asset11';
    //         asset11.AccountId = dep.Id;
    //         asset11.Department_Class__c = strategicDep[0].Id;
    //         asset11.Hospital__c = hospital.Id;
    //         asset11.Product2Id = pro1.Id;
    //         asset11.Quantity = 10;
    //         asset11.Status = '不明';
    //         asset11.Manage_type__c = '个体管理';
    //         asset11.Loaner_accsessary__c = false;
    //         asset11.Out_of_wh__c = 0;
    //         asset11.Salesdepartment__c = '1.华北营业本部';
    //         asset11.Internal_asset_location__c = '北京 备品中心';
    //         asset11.Product_category__c = 'GI';
    //         asset11.Equipment_Type__c = '产品试用';
    //         asset11.SalesProvince__c = '北京';
    //         asset11.CompanyOfEquipment__c = '北京';
    //         asset11.Internal_Asset_number__c = '0001';
    //         asset11.Rental_Count__c = 0;
    //         asset11.AssetManageConfirm__c = true;
    //         //一对一得附属品
    //         Asset asset12 = new Asset(Asset_Owner__c = 'Olympus');
    //         asset12.RecordTypeId = System.Label.Asset_RecordType;
    //         asset12.SerialNumber = 'asset12';
    //         asset12.Name = 'asset12';
    //         asset12.AccountId = dep.Id;
    //         asset12.Department_Class__c = strategicDep[0].Id;
    //         asset12.Hospital__c = hospital.Id;
    //         asset12.Product2Id = pro2.Id;
    //         asset12.Quantity = 10;
    //         asset12.Status = '不明';
    //         asset12.Manage_type__c = '数量管理';
    //         asset12.Loaner_accsessary__c = true;   //附属品
    //         asset12.Out_of_wh__c = 0;
    //         asset12.Salesdepartment__c = '1.华北营业本部';
    //         asset12.Internal_asset_location__c = '北京 备品中心';
    //         asset12.Product_category__c = 'GI';
    //         asset12.Equipment_Type__c = '产品试用';
    //         asset12.SalesProvince__c = '北京';
    //         asset12.CompanyOfEquipment__c = '北京';
    //         asset12.Internal_Asset_number__c = '0002';
    //         asset12.Rental_Count__c = 0;
    //         asset12.AssetManageConfirm__c = true;
    //         insert new Asset[] {asset11, asset12};
    //         List<Asset> assetList = [select Name from Asset];
    //         System.assertEquals(3, assetList.size());
    //         // 备品一对一Link表
    //         Fixture_OneToOne_Link__c foLink1 = new Fixture_OneToOne_Link__c();
    //         foLink1.Main_Asset__c = asset11.Id;
    //         foLink1.Accessory_Asset__c = asset12.Id;
    //         foLink1.Quantity__c = 1;
    //         insert new Fixture_OneToOne_Link__c[] {foLink1};
    //         FixtureDeliverySlip__c ds = new FixtureDeliverySlip__c();
    //         ds.Name = 'Test1';
    //         ds.Wh_Staff__c = UserInfo.getUserId();
    //         ds.DeliveryCompany__c = '利讯';
    //         ds.Shippment_loaner_time__c = Datetime.now();
    //         ds.Distributor_method__c = '陆运';
    //         ds.DeliveryType__c = '发货';
    //         ds.DeliveryCompany_SlipNo__c = 'TestNo1';
    //         insert ds;
    //         //调拨申请
    //         TransferApply__c raObj = new TransferApply__c();
    //         raObj.Name = 'testra';
    //         raObj.From_Location__c = '北京';
    //         raObj.Destination_Location__c = '北京 备品中心';
    //         Map<String,Schema.RecordTypeInfo>  DEVELOPERNAMEMAP  = Schema.SObjectType.TransferApply__c.getRecordTypeInfosByDeveloperName();
    //         raObj.RecordTypeId = DEVELOPERNAMEMAP.get('AgencyToCenter').getRecordTypeId();
    //         insert raObj;
    //         // 调拨一览
    //         TransferApplySummary__c raesObj = new TransferApplySummary__c();
    //         raesObj.TransferApply__c = raObj.Id;
    //         raesObj.Cancel_Select__c = false;
    //         raesObj.IndexFromUniqueKey__c = 1;
    //         insert raesObj;
    //         //调拨中得数据
    //         TransferApplyDetail__c raesdObj3 = new TransferApplyDetail__c();
    //         raesdObj3.TransferApply__c = raObj.Id;
    //         raesdObj3.TransferApplySummary__c = raesObj.Id;
    //         raesdObj3.IndexFromUniqueKey__c = 1;
    //         raesdObj3.ApplyPersonAppended__c = false;
    //         raesdObj3.FSD_SortInt__c = 01;
    //         raesdObj3.Asset__c = asset1.Id;
    //         raesdObj3.StockDown__c = true;
    //         raesdObj3.StockDown_staff__c = UserInfo.getUserId();
    //         raesdObj3.StockDown_time__c = Datetime.now();
    //         raesdObj3.Pre_inspection_time__c = Datetime.now();
    //         raesdObj3.Inspection_staff__c = UserInfo.getUserId();
    //         raesdObj3.Inspection_result__c = 'OK';
    //         raesdObj3.DeliverySlip__c = ds.Id;
    //         raesdObj3.OneToOneAccessory__c =false;
    //         raesdObj3.CDS_complete__c =true;
    //         raesdObj3.CDS_complete_time__c = Datetime.now();
    //         raesdObj3.Shipment_Status_Text__c = '已出库';
    //         insert raesdObj3;
    //         // 调拨一览
    //         TransferApplySummary__c raesObj1 = new TransferApplySummary__c();
    //         raesObj1.TransferApply__c = raObj.Id;
    //         raesObj1.Cancel_Select__c = false;
    //         raesObj1.IndexFromUniqueKey__c = 1;
    //         insert raesObj1;
    //         //调拨申请一览明细    一对一走的数据
    //         //状态 下架   主机
    //         TransferApplyDetail__c raesdObj1 = new TransferApplyDetail__c();
    //         raesdObj1.TransferApply__c = raObj.Id;
    //         raesdObj1.TransferApplySummary__c = raesObj1.Id;
    //         raesdObj1.IndexFromUniqueKey__c = 1;
    //         raesdObj1.FSD_OneToOneAccessory_Cnt__c = 1;
    //         raesdObj1.ApplyPersonAppended__c = false;
    //         raesdObj1.TransferCount__c = 1;
    //         raesdObj1.FSD_SortInt__c = 01;
    //         raesdObj1.Asset__c = asset11.Id;
    //         raesdObj1.Main_OneToOne__c = true;  //主机
    //         raesdObj1.Salesdepartment_After__c = '1.华北营业本部';
    //         raesdObj1.OneToOneAccessory__c = true;
    //         raesdObj1.StockDown__c = true;
    //         raesdObj1.StockDown_staff__c = UserInfo.getUserId();
    //         raesdObj1.StockDown_time__c = Datetime.now();
    //         //附属品  下架
    //         TransferApplyDetail__c raesdObj2 = new TransferApplyDetail__c();
    //         raesdObj2.TransferApply__c = raObj.Id;
    //         raesdObj2.TransferApplySummary__c = raesObj1.Id;
    //         raesdObj2.IndexFromUniqueKey__c = 2;
    //         raesdObj2.FSD_OneToOneAccessory_Cnt__c = 1;
    //         raesdObj2.ApplyPersonAppended__c = false;
    //         raesdObj2.TransferCount__c = 1;
    //         raesdObj2.FSD_SortInt__c = 02;
    //         raesdObj2.Asset__c = asset12.Id;
    //         raesdObj2.OneToOneAccessory__c = true;
    //         raesdObj2.StockDown__c = true;
    //         raesdObj2.StockDown_staff__c = UserInfo.getUserId();
    //         raesdObj2.StockDown_time__c = Datetime.now();
    //         insert new TransferApplyDetail__c[] {raesdObj1,raesdObj2};
    //         ////备品借出申请
    //         Rental_Apply__c rasObj = new Rental_Apply__c();
    //         rasObj.Name = 'testra';
    //         rasObj.Product_category__c = 'GI';
    //         rasObj.Demo_purpose1__c = '产品试用';
    //         rasObj.demo_purpose2__c = FixtureUtil.raDemo_purpose2MAP.get('shiyongwuxunjia');
    //         rasObj.direct_send__c = '医疗机构';
    //         rasObj.Loaner_received_staff__c = '王五';
    //         rasObj.Loaner_received_staff_phone__c = '110';
    //         rasObj.direct_shippment_address__c = '北京市';
    //         rasObj.Hospital__c = hospital.Id;
    //         rasObj.Strategic_dept__c = strategicDep[0].Id;
    //         rasObj.Account__c = dep.Id;
    //         rasObj.Request_shipping_day__c = Date.toDay();
    //         rasObj.Request_return_day__c = Date.toDay();
    //         rasObj.Phone_number__c = '1234567890';
    //         insert rasObj;
    //         Rental_Apply_Equipment_Set__c raessObj = new Rental_Apply_Equipment_Set__c();
    //         raessObj.Rental_Apply__c = rasObj.Id;
    //         raessObj.Cancel_Select__c = false;
    //         raessObj.Shipment_request_time__c = Date.toDay();
    //         raessObj.Rental_Start_Date__c = Date.toDay();
    //         raessObj.Rental_End_Date__c = Date.toDay();
    //         raessObj.UniqueKey__c = rasObj.RequestNoJoinStr2__c + ':'+ null + ':'+ 1;
    //         raessObj.IndexFromUniqueKey__c = 1;
    //         insert raessObj;
    //         // 借出备品配套一览明细
    //         Rental_Apply_Equipment_Set_Detail__c raesdsObj1 = new Rental_Apply_Equipment_Set_Detail__c();
    //         raesdsObj1.Rental_Apply__c = rasObj.Id;
    //         raesdsObj1.Rental_Num__c = 1;
    //         raesdsObj1.Queue_Number__c = null;
    //         raesdsObj1.Is_Body__c = true;
    //         raesdsObj1.Rental_Apply_Equipment_Set__c = raessObj.Id;
    //         raesdsObj1.IndexFromUniqueKey__c = 1;
    //         raesdsObj1.Salesdepartment_before__c = '1.华北营业本部';
    //         raesdsObj1.Internal_asset_location_before__c = '北京 备品中心';
    //         raesdsObj1.Product_category_text__c = 'GI';
    //         raesdsObj1.Equipment_Type_text__c = '产品试用';
    //         raesdsObj1.UniqueKey__c = '1:'+ raessObj.Id + ':' + null + ':1';
    //         raesdsObj1.FSD_Fixture_Model_No__c = 'n01';
    //         raesdsObj1.Fixture_Model_No_text__c = 'n01';
    //         raesdsObj1.Asset__c = asset1.id;
    //         raesdsObj1.StockDown__c = true;
    //         raesdsObj1.OnStock_By_Cancel__c = true;
    //         raesdsObj1.Inspection_result_NG__c = '废弃';
    //         raesdsObj1.Inspection_result__c = 'NG';
    //         raesdsObj1.FSD_Is_OneToOne__c =true;
    //         raesdsObj1.Fixture_OneToOne_Link_Id__c ='12435';
    //         insert raesdsObj1;
    //         //盘点表头
    //         Inventory_Header_Copy__c header = new Inventory_Header_Copy__c();
    //         header.Inventory_Start_Date__c = Date.toDay();
    //         header.UniqueKey__c = 'IH-0000';
    //         header.Inventory_Status__c = '处理中';
    //         header.InventoryCheck_PIC__c = [SELECT Id
    //             FROM User WHERE Dept__c = '医疗东北营业本部' and IsActive = true limit 1].id;
    //         header.InventorySubmit_PIC__c = [SELECT id
    //             FROM User WHERE Dept__c = '医疗东北营业本部' and IsActive = true limit 1].id;
    //         insert header;
    //         // Inventory_Header__Share xmshare = new Inventory_Header__Share(
    //         //             RowCause = 'Manual',
    //         //             ParentId = header.Id,
    //         //             UserOrGroupId = header.InventoryCheck_PIC__c,
    //         //             AccessLevel = 'Edit');
    //         String cunFangDi = '北京 备品中心';
    //         System.Test.StartTest();
    //        // Database.executeBatch(new InventoryStartAssetSnapshotCopyBatch(cunFangDi,header));
    //         System.Test.StopTest();
    //          List<TransferApplyDetail__c> tadList = [select TAESD_Status__c from TransferApplyDetail__c
    //                                                                     WHERE Inspection_result__c = 'OK' and CDS_complete__c= true];
    //          //System.assertEquals('收货后已CDS', tadList[0].TAESD_Status__c);
    //         List<Inventory_Detail_Copy__c> trList = [select UniqueKey__c from Inventory_Detail_Copy__c
    //                                                                  WHERE Asset_Status__c = '调拨中'];
    //        // System.assertEquals(1, trList.size());
    //         //Delete test TODO assert
    //         //header.Inventory_Status__c = null;
    //        // update header;
    //        // Database.executeBatch(new InventoryStartAssetSnapshotCopyBatch(cunFangDi,header));
    //     }
    // }
    static testMethod void updaue() {
        InventoryStartAssetSnapshotCopyBatch.test();//先调用这个,然后继续补充测试类
    }
}
force-app/main/default/classes/InventoryStartAssetSnapshotCopyBatchTest.cls-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>48.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/KPIPreviewScheduel.cls
New file
@@ -0,0 +1,6 @@
global class KPIPreviewScheduel implements Schedulable {
   global void execute(SchedulableContext SC) {
      EquipmentRealCoverageBatch batch1 = new EquipmentRealCoverageBatch();
      Database.executeBatch(batch1);
   }
}
force-app/main/default/classes/KPIPreviewScheduel.cls-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>54.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/LastbuyProductHandler.cls
@@ -1,7 +1,12 @@
/**
 * 20220210 lt UpdateIdentification()--更新产品上的“预留产品”标识
 * 预留产品对象会关联一个产品主数据
 * 创建预留产品时,将产品主数据上的“预留产品”标识 更新为 true
 * 20220210 lt 更新产品上的“预留产品”标识
 * 产品 有 有效预留产品  “预留产品”标识 true
 * 产品 没有 有效预留产品(无预留产品 或 预留产品 无效)  “预留产品”标识 false
 * (1) 新建 有效预留产品                                            --true
 * (2) 更新  “是否有效” false 变为 true                             --true
 * (3) 更新 “产品” 后                                               --true
 * (4) 更新  “是否有效” true 变为 false 的产品下无有效预留产品        --false
 * (5) 更新 “产品” 前的产品 无预留产品 或 无有效预留产品               --false
 */
public without sharing class LastbuyProductHandler extends Oly_TriggerHandler {
    private Map<Id, LastbuyProduct__c> newMap;
@@ -21,114 +26,113 @@
    }
    protected override void afterInsert(){
        UpdateIdentification();
        ReservedPro();
    }
    protected override void afterUpdate(){
        Invalid();
        ReservedPro();
    }
    //更新标识
    private void UpdateIdentification(){
        //存产品的ID
        List<Id> pList = new List<Id>();
        for(LastbuyProduct__c lbp : newList){
            if(lbp.ProductName__c != null){
                pList.add(lbp.ProductName__c);
    private void ReservedPro(){
        //1.新建或者更新产品后,若预留产品有效,“预留产品”标识为true
        if(trigger.isInsert || trigger.isUpdate){
            //存产品的ID
            List<Id> pList = new List<Id>();
            for(LastbuyProduct__c lbp : newList){
                if(lbp.ProductName__c != null && lbp.effectiveFLG__c == true){
                    pList.add(lbp.ProductName__c);
                }
            }
        }
        List<Product2> proList = [select id, LastbuyProductFLG__c from Product2 where Id in :pList];
        List<Product2> pflgList = new List<Product2>();
            List<Product2> proList = [select id, LastbuyProductFLG__c from Product2 where Id in :pList];
            List<Product2> pflgList = new List<Product2>();
        for(Product2 pro : proList){
            if(pro.LastbuyProductFLG__c == false){
                pro.LastbuyProductFLG__c = true;
                pflgList.add(pro);
            for(Product2 pro : proList){
                if(pro.LastbuyProductFLG__c == false){
                    pro.LastbuyProductFLG__c = true;
                    pflgList.add(pro);
                }
            }
        }
        if(pflgList.size() > 0){
            update pflgList;
            if(pflgList.size() > 0){
                update pflgList;
            }
        }
        
    }
        //2.(1)"是否有效" 变为 false  检索产品主数据下的所有预留产品,全无效则把产品主数据的"预留产品"标识 变为 false
        //  (2)"产品"    预留产品 更改 产品主数据之前的产品 -- 检索产品主数据下的所有预留产品(没有/全无效)
        //                                                  "预留产品"标识 变为 false
        if(trigger.isUpdate){
            //"是否有效" 变为 "否" 时 所对应的产品主数据Id &&预留产品 更改 产品主数据之前的产品
            List<Id> pfList = new List<Id>();
    //当"是否有效"发生变化且变成"否"时,检索同一产品的所有预留产品,
    //如果这个产品所有的预留产品都无效了,把产品主数据上的预留产品标签设置成false。
    //当"是否有效"发生变化且变成"是"时,产品主数据上的预留产品标签设置成true。
    private void Invalid(){
        List<Id> pfList = new List<Id>();  //"是否有效" 变为 "否" 时 所对应的产品主数据Id
        List<Id> ptList = new List<Id>();  //"是否有效" 变为 "是" 时 所对应的产品主数据Id
        for(LastbuyProduct__c lbp1 : newList){
            LastbuyProduct__c oldLbp1 = oldMap.get(lbp1.Id);
            if(oldLbp1.effectiveFLG__c != lbp1.effectiveFLG__c){
                if(lbp1.effectiveFLG__c == false){
                    pfList.add(lbp1.ProductName__c);
                }else{  //lbp1.effectiveFLG__c == true
                    ptList.add(lbp1.ProductName__c);
                }
            }
        }
        //"预留产品"标识 变"false"
        if(pfList.size() > 0){
            //Map<产品Id,预留产品>
            Map<String,LastbuyProduct__c> lbpMap = new Map<String,LastbuyProduct__c>();
            //发生变化的产品Id下的所有预留产品
            List<LastbuyProduct__c> lbpList = [select id, effectiveFLG__c,ProductName__c from LastbuyProduct__c where ProductName__c in :pfList];
            System.debug('lt123变化的预留产品lbpList'+lbpList);
            //p1List effectiveFLG__c为true 的产品Id
            List<Id> p1List = new List<Id>();
            //p2List 这个产品所有的预留产品都无效 的产品Id
            List<Id> p2List = new List<Id>();
            for(LastbuyProduct__c lbm : lbpList){
                lbpMap.put(lbm.ProductName__c,lbm);
                if(lbm.effectiveFLG__c == true){
                    p1List.add(lbm.ProductName__c);
                }
            }
            if(p1List.size() > 0){
                for(Id p1 : p1List){
                    if(!lbpMap.containsKey(p1)){
                        p2List.add(p1);
            for(LastbuyProduct__c lbp1 : newList){
                LastbuyProduct__c oldLbp1 = oldMap.get(lbp1.Id);
                if(oldLbp1.effectiveFLG__c != lbp1.effectiveFLG__c){
                    System.debug('lt123无效?'+lbp1.effectiveFLG__c);
                    if(lbp1.effectiveFLG__c == false){
                        System.debug('lt123无效'+lbp1.effectiveFLG__c);
                        pfList.add(lbp1.ProductName__c);
                    }
                }
            }else{
                for(LastbuyProduct__c lbm : lbpList){
                    p2List.add(lbm.ProductName__c);
                //产品发生变化时,检索两个产品的标识
                if(oldLbp1.ProductName__c != lbp1.ProductName__c){
                    pfList.add(oldLbp1.ProductName__c);
                }
            }
            
            List<Product2> pro1List = [select Id, LastbuyProductFLG__c from Product2 where Id in :p2List];
            List<Product2> prflgList = new List<Product2>();
            for(Product2 pro1 : pro1List){
                pro1.LastbuyProductFLG__c = false;
                System.debug('lt123预留产品标识'+pro1.LastbuyProductFLG__c);
                prflgList.add(pro1);
            }
            if(prflgList.size() > 0){
                update prflgList;
            }
        }
        //"预留产品"标识 变"true"
        if(ptList.size() > 0){
            List<Product2> protList = [select Id, LastbuyProductFLG__c from Product2 where Id in :ptList];
            List<Product2> ptflgList = new List<Product2>();
            for(Product2 prot : protList){
                prot.LastbuyProductFLG__c = true;
                ptflgList.add(prot);
            }
            if(ptflgList.size() > 0){
                update ptflgList;
            }
        }
            System.debug('lt123需检索所有预留产品的产品ID-pfList'+pfList);
            //检索产品下的所有预留产品,全无效将产品主数据下的标识置为false
            if(pfList.size() > 0){
                //Map<产品Id,预留产品>
                Map<String,LastbuyProduct__c> lbpMap = new Map<String,LastbuyProduct__c>();
                //发生变化的产品Id下的所有预留产品
                List<LastbuyProduct__c> lbpList = [select id, effectiveFLG__c,ProductName__c from LastbuyProduct__c where ProductName__c in :pfList];
                System.debug('lt123变化的预留产品lbpList'+lbpList);
                //p1List effectiveFLG__c为true 的产品Id
                List<Id> p1List = new List<Id>();
                //p2List 这个产品所有的预留产品都无效 的产品Id
                List<Id> p2List = new List<Id>();
                if(lbpList.size() > 0){   //产品有预留产品 检查预留产品的"是否有效"
                    for(LastbuyProduct__c lbm : lbpList){
                        lbpMap.put(lbm.ProductName__c,lbm);
                        if(lbm.effectiveFLG__c == true){
                            p1List.add(lbm.ProductName__c);
                        }
                    }
                    if(p1List.size() > 0){
                        for(Id p1 : p1List){
                            if(!lbpMap.containsKey(p1)){
                                p2List.add(p1);
                            }
                        }
                    }else{
                        for(LastbuyProduct__c lbm : lbpList){
                            p2List.add(lbm.ProductName__c);
                        }
                    }
                }
                else{   //产品 没有预留产品  标识false
                    p2List = pfList;
                }
                List<Product2> pro1List = [select Id, LastbuyProductFLG__c from Product2 where Id in :p2List];
                List<Product2> prflgList = new List<Product2>();
                for(Product2 pro1 : pro1List){
                    pro1.LastbuyProductFLG__c = false;
                    System.debug('lt123预留产品标识'+pro1.LastbuyProductFLG__c);
                    prflgList.add(pro1);
                }
                if(prflgList.size() > 0){
                    update prflgList;
                }
            }
        }
    }
}
force-app/main/default/classes/LastbuyProductHandlerTest.cls
@@ -39,6 +39,9 @@
        lbp1.effectiveFLG__c = false;
        update lbp1;
        lbp2.ProductName__c = pro.Id;
        update lbp2;
    }
}
force-app/main/default/classes/LightningUtil.cls
@@ -43,6 +43,13 @@
        return [select id, Name, Agency_User__c from contact where Isactive__c = '有效' and AccountId in 
        (select AccountId from User where id=:login_user_id)];
    }
    public static List<contact> selectAgencyPerson03() {
        String login_user_id = UserInfo.getUserId();
        system.debug('login_user_id=============>'+login_user_id);
        return [select id, Name,Agency_User__c from contact where   Isactive__c = '有效'  and id in
        (select ContactId from User where id =: login_user_id)];
    }
    
    public static void updateAccMaxActivityDate(String accId, Date week) {
        Agency_Hospital_Link__c account = [select Id,MaxActivityDate__c from Agency_Hospital_Link__c where id=:accId];
@@ -104,60 +111,80 @@
    public static void upsertAgencyOpportunity(List<Agency_Opportunity__c> upsertList) {
        upsert upsertList Agency_Opportunity__c.TargetInputKey__c;
    }
    //经销商系统
    public static List<Agency_Report__c> selectAgencyReport(Date week, String person_str) {
        if (String.isBlank(person_str)) {
            List<Contact> person_list = selectAgencyPerson();
            return [Select Id, Name, Report_Date__c, Product_Category1__r.Name, Product_Category2__r.Name, Product_Category3__r.Name, Product_Category1__c, Product_Category2__c, Product_Category3__c,ConsumptionOfConsumables__c, WorkMark__c,warlocksNumber__c,Department_Cateogy__c,ProductClassification__c,OtherBrandConsumables__r.Name,OtherBrandConsumables__c,ProductCcategory__c, ProductCcategory__r.Name,productCategories__c, productCategories__r.Name,DealerPersonnel__c,WorkRecord__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
            return [Select Id, Name, Report_Date__c, Product_Category1__r.Name, Product_Category2__r.Name, Product_Category3__r.Name, Product_Category1__c, Product_Category2__c, Product_Category3__c,ConsumptionOfConsumables__c, WorkMark__c,warlocksNumber__c,Department_Cateogy__c,ProductClassification__c,WarlockClassification__r.WarlockClassification__c,WarlockClassification__c,ProductCcategory__c, ProductCcategory__r.ProductCcategory__c,productCategories__c, productCategories__r.productCategories__c,DealerPersonnel__c,WorkRecord__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
                            Person_In_Charge2__c,DealerPersonnel__r.Name, Person_In_Charge2__r.Name, doctor2__c, doctor2__r.Name, Submit_date__c,
                            Product_Category__c, Product_Category__r.Name, Result__c, visitor_title__c, Opportunity__c, Opportunity__r.Name,EffectProgress__r.Name,EffectProgress__c,
                            Product_Category__c, Product_Category__r.Name, Result__c, visitor_title__c, Opportunity__c, Opportunity__r.Name,EffectProgress__r.EffectProgress__c,EffectProgress__c,
                            UseProduct1__c,UseProduct2__c,UseProduct3__c,UseProduct1__r.Name,UseProduct2__r.Name,UseProduct3__r.Name    
                            From Agency_Report__c
                            where Submit_date__c=:week and Person_In_Charge2__c in :person_list order by LastModifiedDate desc];
                            where Submit_date__c=:week and Person_In_Charge2__c in :person_list and WeeklyReportClassification__c = ''  order by LastModifiedDate desc];
        } else {
            return [Select Id, Name, Report_Date__c, Product_Category1__r.Name, Product_Category2__r.Name, Product_Category3__r.Name, Product_Category1__c, Product_Category2__c, Product_Category3__c,ConsumptionOfConsumables__c, WorkMark__c,warlocksNumber__c,Department_Cateogy__c,DealerPersonnel__c,ProductClassification__c,OtherBrandConsumables__r.Name,OtherBrandConsumables__c,ProductCcategory__c,ProductCcategory__r.Name, productCategories__c, productCategories__r.Name,WorkRecord__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
            return [Select Id, Name, Report_Date__c, Product_Category1__r.Name, Product_Category2__r.Name, Product_Category3__r.Name, Product_Category1__c, Product_Category2__c, Product_Category3__c,ConsumptionOfConsumables__c, WorkMark__c,warlocksNumber__c,Department_Cateogy__c,DealerPersonnel__c,ProductClassification__c,WarlockClassification__r.WarlockClassification__c,WarlockClassification__c,ProductCcategory__c,ProductCcategory__r.ProductCcategory__c, productCategories__c, productCategories__r.productCategories__c,WorkRecord__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
                            Person_In_Charge2__c,DealerPersonnel__r.Name, Person_In_Charge2__r.Name, doctor2__c, doctor2__r.Name, Submit_date__c,
                            Product_Category__c, Product_Category__r.Name, Result__c, visitor_title__c, Opportunity__c, Opportunity__r.Name,EffectProgress__r.Name,EffectProgress__c,
                            Product_Category__c, Product_Category__r.Name, Result__c, visitor_title__c, Opportunity__c, Opportunity__r.Name,EffectProgress__r.EffectProgress__c,EffectProgress__c,
                            UseProduct1__c,UseProduct2__c,UseProduct3__c,UseProduct1__r.Name,UseProduct2__r.Name,UseProduct3__r.Name   
                            From Agency_Report__c
                            where Submit_date__c=:week and Person_In_Charge2__c=:person_str order by LastModifiedDate desc];
                            where Submit_date__c=:week and Person_In_Charge2__c=:person_str and WeeklyReportClassification__c = ''  order by LastModifiedDate desc];
        }
    }
    //追溯系统
    public static List<Agency_Report__c> selectAgencyReport01(Date week, String person_str) {
        system.debug('person_strperson_str=================>'+person_str);
        if (String.isBlank(person_str)) {
            List<Contact> person_list = selectAgencyPerson01();
            return [Select Id, Name, Report_Date__c, Product_Category1__r.Name, Product_Category2__r.Name, Product_Category3__r.Name, Product_Category1__c, Product_Category2__c, Product_Category3__c,ConsumptionOfConsumables__c, WorkMark__c,warlocksNumber__c,Department_Cateogy__c,ProductClassification__c,OtherBrandConsumables__r.Name,OtherBrandConsumables__c,ProductCcategory__c,ProductCcategory__r.Name,productCategories__c, productCategories__r.Name, DealerPersonnel__c,WorkRecord__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
            return [Select Id, Name, Report_Date__c, Product_Category1__r.Name, Product_Category2__r.Name, Product_Category3__r.Name, Product_Category1__c, Product_Category2__c, Product_Category3__c,ConsumptionOfConsumables__c, WorkMark__c,warlocksNumber__c,Department_Cateogy__c,ProductClassification__c,WarlockClassification__r.WarlockClassification__c,WarlockClassification__c,ProductCcategory__c,ProductCcategory__r.ProductCcategory__c,productCategories__c, productCategories__r.productCategories__c, DealerPersonnel__c,WorkRecord__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
                            Person_In_Charge2__c,DealerPersonnel__r.Name, Person_In_Charge2__r.Name, doctor2__c, doctor2__r.Name, Submit_date__c,
                            Product_Category__c, Product_Category__r.Name, Result__c, visitor_title__c, Opportunity__c, Opportunity__r.Name,EffectProgress__r.Name,EffectProgress__c,
                            Product_Category__c, Product_Category__r.Name, Result__c, visitor_title__c, Opportunity__c, Opportunity__r.Name,EffectProgress__r.EffectProgress__c,EffectProgress__c,
                            UseProduct1__c,UseProduct2__c,UseProduct3__c,UseProduct1__r.Name,UseProduct2__r.Name,UseProduct3__r.Name    
                            From Agency_Report__c
                            where Submit_date__c=:week and Person_In_Charge2__c in :person_list order by LastModifiedDate desc];
                            where Submit_date__c=:week and Person_In_Charge2__c in :person_list and WeeklyReportClassification__c != '' order by LastModifiedDate desc];
        } else {
            return [Select Id, Name, Report_Date__c, Product_Category1__r.Name, Product_Category2__r.Name, Product_Category3__r.Name, Product_Category1__c, Product_Category2__c, Product_Category3__c,ConsumptionOfConsumables__c, WorkMark__c,warlocksNumber__c,Department_Cateogy__c,DealerPersonnel__c,ProductClassification__c,OtherBrandConsumables__r.Name,OtherBrandConsumables__c,ProductCcategory__c,ProductCcategory__r.Name,productCategories__c, productCategories__r.Name, WorkRecord__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
            return [Select Id, Name, Report_Date__c, Product_Category1__r.Name, Product_Category2__r.Name, Product_Category3__r.Name, Product_Category1__c, Product_Category2__c, Product_Category3__c,ConsumptionOfConsumables__c, WorkMark__c,warlocksNumber__c,Department_Cateogy__c,DealerPersonnel__c,ProductClassification__c,WarlockClassification__r.WarlockClassification__c,WarlockClassification__c,ProductCcategory__c,ProductCcategory__r.ProductCcategory__c,productCategories__c, productCategories__r.productCategories__c, WorkRecord__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
                            Person_In_Charge2__c,DealerPersonnel__r.Name, Person_In_Charge2__r.Name, doctor2__c, doctor2__r.Name, Submit_date__c,
                            Product_Category__c, Product_Category__r.Name, Result__c, visitor_title__c, Opportunity__c, Opportunity__r.Name,EffectProgress__r.Name,EffectProgress__c,
                            Product_Category__c, Product_Category__r.Name, Result__c, visitor_title__c, Opportunity__c, Opportunity__r.Name,EffectProgress__r.EffectProgress__c,EffectProgress__c,
                            UseProduct1__c,UseProduct2__c,UseProduct3__c,UseProduct1__r.Name,UseProduct2__r.Name,UseProduct3__r.Name   
                            From Agency_Report__c
                            where Submit_date__c=:week and Person_In_Charge2__c=:person_str order by LastModifiedDate desc];
                            where Submit_date__c=:week and Person_In_Charge2__c=:person_str and WeeklyReportClassification__c != '' order by LastModifiedDate desc];
        }
    }
    //经销商系统
    public static List<Agency_Report__c> selectMAgencyReport(Date date1, Date date2 ,List<Contact> conMList) {
        List<Agency_Report__c> reportlist = [Select Id, Name, Report_Date__c, Product_Category1__r.Name, Product_Category2__r.Name, Product_Category3__r.Name, Product_Category1__c, Product_Category2__c, Product_Category3__c,ConsumptionOfConsumables__c,warlocksNumber__c,WorkMark__c,Department_Cateogy__c, DealerPersonnel__c,WorkRecord__c, ProductClassification__c,OtherBrandConsumables__r.Name,OtherBrandConsumables__c,ProductCcategory__c,ProductCcategory__r.Name,productCategories__c, productCategories__r.Name,Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
        List<Agency_Report__c> reportlist = [Select Id, Name, Report_Date__c, Product_Category1__r.Name, Product_Category2__r.Name, Product_Category3__r.Name, Product_Category1__c, Product_Category2__c, Product_Category3__c,ConsumptionOfConsumables__c,warlocksNumber__c,WorkMark__c,Department_Cateogy__c, DealerPersonnel__c,WorkRecord__c, ProductClassification__c,WarlockClassification__r.WarlockClassification__c,WarlockClassification__c,ProductCcategory__c,ProductCcategory__r.ProductCcategory__c,productCategories__c, productCategories__r.productCategories__c,Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
                            Person_In_Charge2__c,DealerPersonnel__r.Name,Person_In_Charge2__r.Name, doctor2__c, doctor2__r.Name, Submit_date__c,
                            Product_Category__c, Product_Category__r.Name, Result__c, visitor_title__c, Opportunity__c, Opportunity__r.Name,EffectProgress__r.Name,EffectProgress__c,
                            Product_Category__c, Product_Category__r.Name, Result__c, visitor_title__c, Opportunity__c, Opportunity__r.Name,EffectProgress__r.EffectProgress__c,EffectProgress__c,
                            UseProduct1__c,UseProduct2__c,UseProduct3__c,UseProduct1__r.Name,UseProduct2__r.Name,UseProduct3__r.Name  
                            From Agency_Report__c
                            where Person_In_Charge2__c in :conMList and Report_Date__c >= :date1 and Report_Date__c <= :date2 ];
                            where Person_In_Charge2__c in :conMList and Report_Date__c >= :date1 and Report_Date__c <= :date2 and WeeklyReportClassification__c = '' ];
        return reportlist;
    }
    //追溯系统
    public static List<Agency_Report__c> selectMAgencyReport01(Date date1, Date date2 ,List<Contact> conMList) {
        List<Agency_Report__c> reportlist = [Select Id, Name, Report_Date__c, Product_Category1__r.Name, Product_Category2__r.Name, Product_Category3__r.Name, Product_Category1__c, Product_Category2__c, Product_Category3__c,ConsumptionOfConsumables__c,warlocksNumber__c,WorkMark__c,Department_Cateogy__c, DealerPersonnel__c,WorkRecord__c, ProductClassification__c,WarlockClassification__r.WarlockClassification__c,WarlockClassification__c,ProductCcategory__c,ProductCcategory__r.ProductCcategory__c,productCategories__c, productCategories__r.productCategories__c,Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
                            Person_In_Charge2__c,DealerPersonnel__r.Name,Person_In_Charge2__r.Name, doctor2__c, doctor2__r.Name, Submit_date__c,
                            Product_Category__c, Product_Category__r.Name, Result__c, visitor_title__c, Opportunity__c, Opportunity__r.Name,EffectProgress__r.EffectProgress__c,EffectProgress__c,
                            UseProduct1__c,UseProduct2__c,UseProduct3__c,UseProduct1__r.Name,UseProduct2__r.Name,UseProduct3__r.Name
                            From Agency_Report__c
                            where Person_In_Charge2__c in :conMList and Report_Date__c >= :date1 and Report_Date__c <= :date2 and WeeklyReportClassification__c != '' ];
        return reportlist;
    }
    //经销商系统的
    public static List<Agency_Report__c> selectAgencyReportById(String report_id) {
        return [Select Id, Name, Department_Cateogy__c, ConsumptionOfConsumables__c,warlocksNumber__c,WorkMark__c,WorkRecord__c,EffectProgress__c,ProductClassification__c,ProductCcategory__c,productCategories__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
                            Person_In_Charge2__c,DealerPersonnel__c,DealerPersonnel__r.Name, Person_In_Charge2__r.Name, doctor2__c, doctor2__r.Name, Submit_date__c,
                            Product_Category__c, Product_Category__r.Name, Result__c, visitor_title__c 
                            From Agency_Report__c
                            where id=:report_id];
                            where id=:report_id ];
    }
    //追溯系统的
    public static List<Agency_Report__c> selectAgencyReportById01(String report_id) {
        return [Select Id, Name, Department_Cateogy__c, ConsumptionOfConsumables__c,warlocksNumber__c,WorkMark__c,WorkRecord__c,EffectProgress__c,ProductClassification__c,ProductCcategory__c,productCategories__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
                            Person_In_Charge2__c,DealerPersonnel__c,DealerPersonnel__r.Name, Person_In_Charge2__r.Name, doctor2__c, doctor2__r.Name, Submit_date__c,
                            Product_Category__c, Product_Category__r.Name, Result__c, visitor_title__c
                            From Agency_Report__c
                            where id=:report_id ];
    }
    
    public static List<Agency_Opportunity__c> selectOpportunityByIdAndHospitalLinkId(String opportunity_id, String agency_hospital_link_id) {
force-app/main/default/classes/LightningUtilTest.cls
@@ -30,10 +30,27 @@
    public static OlympusCalendar__c olympus_calendar = new OlympusCalendar__c();
    public static String report_id;
    public static String report_header_id;
    /**
     * @description AgencyOpportunityHandlerテスト
     */
    static testMethod void unitTestAgencyOpportunityHandler() {
        Oly_TriggerHandler.bypass('AgencyReportHeaderHandler');
        Oly_TriggerHandler.bypass('AgencyHospitalHandler');
        StaticParameter.EscapeAccountTrigger = true;
        StaticParameter.EscapeNFM007Trigger = true;
        StaticParameter.EscapeOpportunityBefUpdTrigger = true;
        StaticParameter.EscapeOpportunityHpDeptUpdTrigger = true;
        StaticParameter.EscapeSyncOpportunityTrigger = true;
        StaticParameter.EventOpportunityPileUpExeFlg = true;
        StaticParameter.EscapeNFM001AgencyContractTrigger = true;
        StaticParameter.EscapeNFM001AgencyContractTrigger2 = true;
        StaticParameter.EscapeLeadTrigger = true;
        StaticParameter.EscapeOpportunityownerUpdate = true;
        ControllerUtil.EscapeNFM001Trigger = true;
        ControllerUtil.EscapeMaintenanceContractAfterUpdateTrigger = true;
        StaticParameter.EscapeNFM001Trigger = true;
        StaticParameter.EscapeMaintenanceContractAfterUpdateTrigger = true;
        // 取引先
        account1.Name = 'test1医院';
        account1.RecordTypeId = '01210000000QemG';
@@ -47,7 +64,7 @@
        List < Account > acc2list = [select RecordTypeId, Name
            from Account
        ];
        System.assertEquals(10, acc2list.size());
        System.assertEquals(2, acc2list.size());
        // 取引先責任者
        contact1.AccountId = account1.Id;
        contact1.FirstName = '責任者';
force-app/main/default/classes/MaintenanceCommissionPDFController.cls
@@ -1,9 +1,6 @@
public with sharing class MaintenanceCommissionPDFController {
    public Repair__c ra { get; private set; }
    public List<Repair__c> repList { get; private set; }
    public Integer repSize {
        get { return repList == null ? 0 : repList.size(); }
    }
    public MaintenanceCommissionPDFController() {
        ra = new Repair__c();
force-app/main/default/classes/MeetingDelayApplyTriggerHandler.cls
@@ -48,6 +48,12 @@
                // cam.Status = mda.campaign_status__c;
                //OBPM LY 20211221 start
                cam.IF_Approved__c = mda.IF_Approved__c;//是否申请决裁
                cam.Meeting_Approved_No__c = mda.MeetingApproved__c;//会议决裁申请
                if (String.isBlank(mda.MeetingApproved__c)) {
                    cam.MeetingApprovedNo__c = null;
                } else {
                    cam.MeetingApprovedNo__c = mda.MeetingApproved__r.MeetingApprovedNo__c;
                }
                cam.Test_Status__c = mda.campaign_status__c;
                //OBPM LY 20211221 end
                clist.add(cam);
@@ -93,7 +99,8 @@
                List<Campaign> statusList = [SELECT Id,
                                                Status,StartDate,EndDate,PlanBackData__c,
                                                Meeting_Cooperate__c,Meeting_Type__c,HostName__c,
                                                cooperatorCompany__c,Meeting_Cooperate2__c,Meeting_Cooperate3__c,Meeting_Cooperate4__c
                                                cooperatorCompany__c,Meeting_Cooperate2__c,Meeting_Cooperate3__c,Meeting_Cooperate4__c,
                                                IF_Approved__c,Meeting_Approved_No__c
                                                 FROM Campaign WHERE id in :camIds];
                for (Campaign c :statusList ) {
                    camMap.put(c.Id, c);
@@ -120,6 +127,8 @@
                    mda.Meeting_Cooperate2_Old__c = camMap.get(mda.campaign__c).Meeting_Cooperate2__c;
                    mda.Meeting_Cooperate3_Old__c = camMap.get(mda.campaign__c).Meeting_Cooperate3__c;
                    mda.Meeting_Cooperate4_Old__c = camMap.get(mda.campaign__c).Meeting_Cooperate4__c;
                    mda.IF_Approved_Old__c = camMap.get(mda.campaign__c).IF_Approved__c;
                    mda.MeetingApproved_Old__c = camMap.get(mda.campaign__c).Meeting_Approved_No__c;
                    if (String.isNotBlank(mda.CreatedById)) {
                        mda.manager__c = userMap.get(mda.CreatedById).SalesManager__c == null ? mda.CreatedById : userMap.get(mda.CreatedById).SalesManager__c;
force-app/main/default/classes/NFM105Rest.cls
@@ -25,6 +25,9 @@
        public String IncorrectDataComment;
        public String ReturnType;
        public String InspectType;
        //WLIG-CC78MX 【委托】NFM105接口增加OTS运单号字段 thh 20220307 start
        public String OTSRepairOrder;
        //WLIG-CC78MX 【委托】NFM105接口增加OTS运单号字段 thh 20220307 end
        public InspectionResultInformation[] InspectionResultInformation;
        public FailureInformation[] FailureInformation;
    }
@@ -265,6 +268,7 @@
                    //                        continue;
                    //                    }
                    logstr += ' ';
                    System.debug('rpr1:' + rpr);
                    rprUpdateMap.put(rpr.SAPRepairNo__c, rpr);
                } else {
                    logstr += quoteInfo.SAPRepairNo + ':' + quoteInfo.RepairOrderStatusCode + '(' + quoteInfo.SAPQuotationNo + ') ';
@@ -470,6 +474,11 @@
                    // L60-SORC修理品出库
                    // L65-OGZ修理品出库
                    // L80-RC修理品出库
                    //WLIG-CC78MX 【委托】NFM105接口增加OTS运单号字段 thh 20220307 start
                    if(String.isNotBlank(quoteInfo.OTSRepairOrder)){
                        rpr.OTSRepairOrder__c = quoteInfo.OTSRepairOrder;
                    }
                    //WLIG-CC78MX 【委托】NFM105接口增加OTS运单号字段 thh 20220307 end
                    Asset ast = getAstUpdate(astUpdateMap, rpr);
                    if (rpr.Return_Without_Repair_IF__c == true) {
                        rpr.Return_Without_Repair_Date__c = statusUpdateDateTime.date();
@@ -545,6 +554,7 @@
            for (Repair_Quotation__c rqfalse : rqList) {
                rqfalse.Quotation_agreement__c = false;
            }
            System.debug('rqUpdateMap1:' + rqUpdateMap);
            rqList.addAll(rqUpdateMap.values());
            if (rqList.size() > 0) {
                // TODO update false;
force-app/main/default/classes/NFM114RestTest.cls
@@ -4,8 +4,12 @@
    static Product2 product;
    static void initData() {
        Account account2 = new Account();
        account2.Name = 'test1经销商';
        account2.RecordTypeId = '01210000000Qem1';
        insert account2;
        ID AgencyID = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Office').getRecordTypeId();
        Agency = new Account(RecordTypeId = AgencyID, Name = 'NFM114TestAgency', FSE_SP_Main_Leader__c = UserInfo.getUserId(), FSE_GI_Main_Leader__c = UserInfo.getUserId());
        Agency = new Account(ParentId = account2.Id, RecordTypeId = AgencyID, Name = 'NFM114TestAgency', FSE_SP_Main_Leader__c = UserInfo.getUserId(), FSE_GI_Main_Leader__c = UserInfo.getUserId());
        insert Agency;
        Agency = [select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where Id = :Agency.Id];
force-app/main/default/classes/NFM115ControllerTest.cls
@@ -22,8 +22,12 @@
    }
    static testMethod void testMethod1(){
        Account account2 = new Account();
        account2.Name = 'test1经销商';
        account2.RecordTypeId = '01210000000Qem1';
        insert account2;
        ID AgencyID = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Office').getRecordTypeId();
        Agency = new Account(RecordTypeId = AgencyID, Name = 'NFM115TestAgency', FSE_SP_Main_Leader__c = UserInfo.getUserId(), FSE_GI_Main_Leader__c = UserInfo.getUserId());
        Agency = new Account(ParentId = account2.Id, RecordTypeId = AgencyID, Name = 'NFM115TestAgency', FSE_SP_Main_Leader__c = UserInfo.getUserId(), FSE_GI_Main_Leader__c = UserInfo.getUserId());
        insert Agency;
        Agency = [select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where Id = :Agency.Id];
@@ -47,8 +51,12 @@
    }
    static testMethod void testMethod2(){
        Account account2 = new Account();
        account2.Name = 'test1经销商';
        account2.RecordTypeId = '01210000000Qem1';
        insert account2;
        ID AgencyID = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Office').getRecordTypeId();
        Agency = new Account(RecordTypeId = AgencyID, Name = 'NFM115TestAgency', FSE_SP_Main_Leader__c = UserInfo.getUserId(), FSE_GI_Main_Leader__c = UserInfo.getUserId());
        Agency = new Account(ParentId = account2.Id, RecordTypeId = AgencyID, Name = 'NFM115TestAgency', FSE_SP_Main_Leader__c = UserInfo.getUserId(), FSE_GI_Main_Leader__c = UserInfo.getUserId());
        insert Agency;
        Agency = [select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where Id = :Agency.Id];
force-app/main/default/classes/NFM202Controller.cls
@@ -257,7 +257,7 @@
                                                         PricebookEntry.Product2.GuranteeType__c
                                                         //lt 20220223 CHAN-CBW9FX 特殊交货期影响的对应  start
                                                         ,PricebookEntry.Product2.DeliveryDate__c
                                                         ,DeliveryDate__c
                                                         //lt 20220223 CHAN-CBW9FX 特殊交货期影响的对应  end
                                                    from OpportunityLineItem 
@@ -589,7 +589,7 @@
                        detail.Quantity = oppLine.Quantity;
                        //lt 20220223 CHAN-CBW9FX 特殊交货期影响的对应   交货期 start 
                        detail.DeliveryDate = oppLine.PricebookEntry.Product2.DeliveryDate__c;
                        detail.DeliveryDate = oppLine.DeliveryDate__c;
                        //lt 20220223 CHAN-CBW9FX 特殊交货期影响的对应  end
                        // LHJ SWAG-C9F9P8  20211206 增加规格 Start
force-app/main/default/classes/NFM203Rest.cls
@@ -1162,6 +1162,9 @@
                        contact.LastName = contactAllName.split('_')[0];
                        contact.FirstName = contactAllName.split('_')[1];
                        contact.IsFromSPO__c = true;
                        // SFDC电话重复人员创建信息确认  pk 2022-2-28 start
                        contact.RecordTypeId = '01210000000QfWi';
                        // SFDC电话重复人员创建信息确认  pk 2022-2-28 end
                        contact.Ignore_Same_Name__c = true;//不是重复的客户名 跳过 客户人员名字已存在 验证
                        insertContactList.add(contact);
                        
force-app/main/default/classes/NFM401Controller.cls
@@ -448,7 +448,15 @@
                RepairRequest.PRODUCT_RECEIPT_DATE = NFMUtil.formatDate2Str(rr.Repair_Ordered_Date__c);
                RepairRequest.EVALUATION_RESULT = null;
                RepairRequest.INITIATION_DATE = NFMUtil.formatDate2Str(rr.FSE_ApplyForRepair_Day__c) ;
                RepairRequest.INSTALLATION_DATE = NFMUtil.formatDate2Str(rr.PurchaseOrInstallationDate__c) ;
                // 精琢科技  2022-03-03 LJPH-CC5ANQ 【委托】之前会传一个1900-1-1的日期,导致报错,现在改为传null zxk  start
                if(rr.PurchaseOrInstallationDate__c != null){
                    RepairRequest.INSTALLATION_DATE = NFMUtil.formatDate2Str(rr.PurchaseOrInstallationDate__c) ;
                }else{
                    RepairRequest.INSTALLATION_DATE =  null;
                }
                // 精琢科技  2022-03-03 LJPH-CC5ANQ 【委托】之前会传一个1900-1-1的日期,导致报错,现在改为传null zxk  end
                RepairRequest.EVENTDATE_UNKNOWN = null ;
                RepairRequest.SEND_REPORT_COMPETENT_AUTH = NFMUtil.getMapValue(transferMap,'ReportAdverseEvents__c', rr.ReportAdverseEvents__c, iflog) ;
                RepairRequest.PROC_THERAPEUTIC_DIAGNOSTIC = NFMUtil.getMapValue(transferMap,'WhatProject__c', rr.WhatProject__c, iflog) ;
@@ -594,7 +602,13 @@
                RepairRequest.ACTIONS_TAKEN_AT_CUST_SITE = NFMUtil.getMapValue(transferMap,'qis_next_action__c', qr.next_action__c, iflog) ;
                RepairRequest.INITIATION_DATE = NFMUtil.formatDate2Str(qr.QIS_Submit_day__c) ;
                RepairRequest.INSTALLATION_DATE = NFMUtil.formatDate2Str(qr.QISInstallDate__c) ;
                // 精琢科技  2022-03-03 LJPH-CC5ANQ 【委托】之前会传一个1900-1-1的日期,导致报错,现在改为传null zxk  start
                if(qr.QISInstallDate__c != null){
                    RepairRequest.INSTALLATION_DATE = NFMUtil.formatDate2Str(qr.QISInstallDate__c) ;
                }else{
                    RepairRequest.INSTALLATION_DATE =  null;
                }
                // 精琢科技  2022-03-03 LJPH-CC5ANQ 【委托】之前会传一个1900-1-1的日期,导致报错,现在改为传null zxk  end
                RepairRequest.EVENTDATE_UNKNOWN = null ;
force-app/main/default/classes/NFM603Controller.cls
@@ -41,6 +41,10 @@
        public String QuotationGread; //报价等级(new)
        public String detectionResult; //检测结果
        public String cus_dn; //DN号
        //修理增加OTS运单号字段 thh 20220308 start
        public String OTSRepairOrder;
        //修理增加OTS运单号字段 thh 20220308 end
        //送修物流
        public String deliveryLogisticsMode; //送修物流方式
        public String engineerSendDate; //工程师修理品寄送日
@@ -216,6 +220,7 @@
                RcSorcDate__c,
                SorcAcceptDate__c,
                SorcOgzDate__c,
                RcOgzDate__c,
                Returns_Product_waySAP__c,
                DnNO__c,
                OgzAcceptDate__c,
@@ -233,7 +238,10 @@
                Repair_Final_Inspection_DateTime__c,
                Repair_Shipped_DateTime__c,
                Repair_Discount_approval_DateTime_form__c,
                Agreed_DateTime__c
                Agreed_DateTime__c,
                //修理增加OTS运单号字段 thh 20220308 start
                OTSRepairOrder__c
                //修理增加OTS运单号字段 thh 20220308 end
                from Repair__c where id in: repairOrderIdList
            ];
        }
@@ -366,10 +374,17 @@
                info.OgzAcceptDate = NFMUtil.formatDateTime2Str(repair.OgzAcceptDateTime__c);//OGZ受理日(小程序)
                //update        wangweipeng         2022/02/16           end
                info.SorcOgzDate = NFMUtil.formatDate2StrDateTime(repair.SorcOgzDate__c);
                // info.SorcOgzDate = NFMUtil.formatDate2StrDateTime(repair.SorcOgzDate__c);RcOgzDate__c
                //update   zhangyuheng    2022/03/07
                info.SorcOgzDate = NFMUtil.formatDate2StrDateTime(repair.RcOgzDate__c);
                info.cus_dn = repair.DnNO__c;
                //修理增加OTS运单号字段 thh 20220308 start
                info.OTSRepairOrder = repair.OTSRepairOrder__c;
                //修理增加OTS运单号字段 thh 20220308 end
                repairs.add(info);
                System.debug('repairs1:' + repairs);
            }
            logstr += '\nend';
            if (repairs.size() > 0) {
force-app/main/default/classes/NFM606Controller.cls
@@ -116,7 +116,7 @@
                ged.Mobile = String.isNotBlank(con.UniqueNumber__c) ? con.UniqueNumber__c:con.MobilePhone;//手机
                ged.PersonManagementCode = con.CManageCode__c; //人员管理编码
                ged.Status = '有效'.equals(con.Isactive__c) ? true:false ;//状态
                ged.Name = '';//姓名
                ged.Name = con.Name;//姓名
                ged.Email = '';
                ged.Hospital =''; //医院编码
                ged.Department = ''; //科室编码
@@ -136,7 +136,7 @@
                }
                // 经销商
                if ('01210000000QfWiAAK'.equals(con.RecordTypeId)) {
                    ged.Name = con.Name;//姓名
                    //ged.Name = con.Name;//姓名
                    ged.Account = con.Account.Name;//经销商名
                    ged.AgentCode = con.Account.Management_Code__c;//经销商编码
                    ged.AgentUserType = String.isBlank(con.ContactType__c) ? '': con.ContactType__c.replaceAll(';',',');//人员类型
force-app/main/default/classes/NFM608Rest.cls
@@ -224,7 +224,7 @@
        Map < String, String > VisitTypeMap = new Map < String, String > ();
        VisitTypeMap.put('公司工作', '社内活動');
        VisitTypeMap.put('用户拜访', '病院');
        VisitTypeMap.put('经销商拜访', '販売店');
        VisitTypeMap.put('经销商支持', '販売店');
        VisitTypeMap.put('学术会议', '社外イベント');
        VisitTypeMap.put('移动', '移動');
        VisitTypeMap.put('休假', '休暇');
force-app/main/default/classes/NFM620Rest.cls
@@ -25,7 +25,7 @@
        public String Product;                   // 产品信息
        public String Request;                   // 委托事项
        public String RequestDetail;             // 委托事项详细
        // public String ApproverID;                // 审核人员员工编码
        public String ApproverID;                // 审核人员员工编码
    }
    @HttpPost
@@ -104,7 +104,7 @@
            List<String> inquiryNoList = new List<String>();
            List<String> conIDList = new List<String>();
            List<String> camNoList = new List<String>();
            // List<String> approverIDList = new List<String>();
            List<String> approverIDList = new List<String>();
            List<GeData> geDataListNew = new List<GeData>();
            for (GeData geData : geDataList) {
                if (String.isBlank(geData.InquiryNo)) {
@@ -122,9 +122,9 @@
                } else {
                    conIDList.add(geData.ContactId);
                }
                // if (String.isNotBlank(geData.ApproverID)) {
                //     approverIDList.add(geData.ApproverID);
                // }
                if (String.isNotBlank(geData.ApproverID)) {
                    approverIDList.add(geData.ApproverID);
                }
                if (String.isNotBlank(geData.Campaign)) {
                    camNoList.add(geData.Campaign);
                }
@@ -168,11 +168,17 @@
                }
            }
            //使用审核人员员工编码查询用户ID
            // Map<string,String> ownerMap = new Map<string,String>();
            // List<User> ownerList = [select Id,Employee_No__c from User where Employee_No__c  IN:approverIDList];
            // for(User temp : ownerList){
            //     ownerMap.put(temp.Employee_No__c,temp.Id);
            // }
            Map<string,String> ownerMap = new Map<string,String>();
            if(approverIDList.size()>0){
                List<User> ownerList = [select Id,Employee_No__c from User where Employee_No__c  IN:approverIDList];
                if (ownerList.size()>0){
                    for(User temp : ownerList){
                        ownerMap.put(temp.Employee_No__c,temp.Id);
                    }
                }
            }
            // 将XML各数据项更新到商品询问单对象中
            for (GeData geData : geDataListNew) {
@@ -186,8 +192,10 @@
                inquiry.Request_Detail__c = geData.RequestDetail;                 //委托事项详细
                inquiry.Product1__c = geData.Product;                             //产品信息
                inquiry.ContactId__c = geData.ContactId;                          //统一用户ID
                // inquiry.OwnerId = ownerMap.get(geData.ApproverID);                //所有人
                if (String.isNotBlank(ownerMap.get(geData.ApproverID))){
                    inquiry.OwnerId = ownerMap.get(geData.ApproverID);            //所有人
                }
                //委托事项取值后拆分
                List<String> requestList = geData.Request.split(';');
                String request1 = '';
force-app/main/default/classes/NFM701ControllerHandler.cls
@@ -11,7 +11,9 @@
        this.oldList = (List<Account>) Trigger.old;
    }
    protected override void afterUpdate(){
        updateAccount(this.newList , this.newMap , this.oldList , this.oldMap);
        // if (!StaticParameter.EscapeNFM701Trigger) {
            updateAccount(this.newList , this.newMap , this.oldList , this.oldMap);
        // }
    }
    public static void updateAccount(List<Account> newList, Map<Id, Account> newMap, List<Account> oldList, Map<Id, Account> oldMap){
        List<String> accIdList = new List<String>();
@@ -24,7 +26,7 @@
        if (newList.size()>0) {
            // iflog.Log__c += '进if';
            for (Account acc : newList) {
                    if(!acc.RecordType_DeveloperName__c.equals('Agency') && !acc.RecordType_DeveloperName__c.equals('AgencyContract') && !acc.RecordType_DeveloperName__c.contains('Department_Class')){
                    if(!acc.RecordType_DeveloperName__c.equals('Agency') && !acc.RecordType_DeveloperName__c.equals('AgencyContract') && !acc.RecordType_DeveloperName__c.contains('Department_')){
                        // iflog.Log__c += acc.RecordType.DeveloperName;
                        // iflog.Log__c += acc;
                        if(((acc.Is_Active__c != oldMap.get(acc.Id).Is_Active__c) && (acc.Is_Active__c.equals('有効') || acc.Is_Active__c.equals('無効'))) || ((acc.Name != oldMap.get(acc.Id).Name) && (acc.Is_Active__c.equals('有効')))){
force-app/main/default/classes/NFM701ControllerHandlerTest.cls
New file
@@ -0,0 +1,136 @@
@isTest
private class NFM701ControllerHandlerTest {
    @testSetup
    static void makeTestRepair() {
        List < RecordType > rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account'
            and Name = '病院'
        ];
        if (rectCo.size() == 0) {
            throw new ControllerUtil.myException('not found 病院 recodetype');
        }
        List < RecordType > rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account'
            and Name = '戦略科室分類 消化科'
        ];
        if (rectSct.size() == 0) {
            throw new ControllerUtil.myException('not found 戦略科室分類 呼吸科 recodetype');
        }
        List < RecordType > rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account'
            and Name = '診療科 消化科'
        ];
        if (rectDpt.size() == 0) {
            throw new ControllerUtil.myException('not found 診療科 消化科 recodetype');
        }
        // テストデータ
        Account company = new Account();
        company.RecordTypeId = rectCo[0].Id;
        company.Is_Active__c = '有効';
        company.Name = 'NFM105TestCompany';
        company.AwaitToSendAWS__c = true;
        upsert company;
        Account section = [Select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where ParentId =: company.Id and RecordTypeId =: rectSct[0].Id];
        Account depart = new Account();
        depart.RecordTypeId = rectDpt[0].Id;
        depart.Name = '*';
        depart.Department_Name__c = 'NFM105TestDepart';
        depart.ParentId = section.Id;
        depart.Department_Class__c = section.Id;
        depart.Hospital__c = company.Id;
        upsert depart;
        company.Site = '测试变更别名1';
        upsert company;
        List < RecordType > rectDpt2 = [select Id from RecordType where IsActive = true and SobjectType = 'Account'
            and DeveloperName = 'Agency'
        ];
        if (rectDpt.size() == 0) {
            throw new ControllerUtil.myException('not found 診療科 消化科 recodetype');
        }
        ControllerUtil.EscapeNFM001Trigger = true;
        StaticParameter.EscapeNFM001AgencyContractTrigger2 = true;
        Account company2 = new Account();
        company2.RecordTypeId = rectDpt2[0].Id;
        company2.Name = 'NFM105TestCompany';
        upsert company2;
        License_Information__c lic = new License_Information__c();
        lic.name = 'Test20181204';
        lic.LicenseType__c = '医疗器械经营许可证';
        lic.BusinessLicense__c = '20180522';
        lic.ValidFrom__c = date.newinstance(2018, 05, 22);
        lic.ValidTo__c = date.newinstance(2018, 05, 22);
        lic.Scope3__c = '6815;6822;6823;6825';
        lic.IsInquire__c = false;
        lic.LicenseAndAccount__c = company2.Id;
        insert lic;
        License_Information__c lic1 = new License_Information__c();
        lic1.name = 'Test20190111';
        lic1.LicenseType__c = '第二类医疗器械经营备案凭证';
        lic1.BusinessLicense__c = '20190522';
        lic1.ValidFrom__c = date.newinstance(2018, 05, 21);
        lic1.ValidTo__c = date.newinstance(2018, 05, 21);
        lic.IsInquire__c = false;
        lic1.Scope__c = '6815;6822;6823;6825';
        lic1.LicenseAndAccount__c = company2.Id;
        insert lic1;
        List < RecordType > rectDptAgencyContract = [select Id from RecordType where IsActive = true and SobjectType = 'Account'
            and DeveloperName = 'AgencyContract'
        ];
        if (rectDptAgencyContract.size() == 0) {
            return;
        }
        Account AagencyContractAccount = new Account();
        AagencyContractAccount.RecordTypeId = rectDptAgencyContract[0].Id;
        AagencyContractAccount.Contract_Decide_Start_Date__c = System.today();
        AagencyContractAccount.Contract_Decide_End_Date__c = System.today();
        AagencyContractAccount.Contract_End_Date__c = Date.today();
        AagencyContractAccount.Name = '*';
        AagencyContractAccount.Department_Name__c = 'NFM701TestDepart';
        AagencyContractAccount.ParentId = company2.Id;
        AagencyContractAccount.Agent_Ref__c = company2.Id;
        AagencyContractAccount.ET_SP_Dealer__c = true;
        // AagencyContractAccount.RecordType.DeveloperName = 'HP';
        upsert AagencyContractAccount;
        // List < BatchIF_Transfer__c > transfers = new List < BatchIF_Transfer__c > ();
        // BatchIF_Transfer__c transfer = new BatchIF_Transfer__c();
        // transfer.Table__c = 'Account';
        // transfer.Column__c = 'RecordTypeId';
        // transfer.External_Value__c = rectDpt[0].Id;
        // transfer.Internal_Value__c = '消化科';
        // insert transfer;
        // BatchIF_Log__c iflog = new BatchIF_Log__c();
        // iflog.Log__c = '{"GeDatas":{"Monitoring":{"TransmissionDateTime":"20211231104929","Text":"","Tag":"MSGH","Sender":"SFDC","Receiver":"OBPM","NumberOfRecord":"1","MessageType":"NFM701","MessageGroupNumber":"20211231104929"},"GeData":[{"StateMaster":"山西省","LinkedHospitalMCode":null,"IsMerge":false,"IsActive":true,"HospitalName":"夏县第二人民医院","HospitalMCode":"360437","Grade":"二级乙","DataType":"Hospital","CityMaster":"运城市","Address":"山西省运城市夏县运城地区夏县北街"}]}}';
        // iflog.Type__c = '701test';
        // insert iflog;
    }
    static testMethod void testMethod1() {
        List < Account > userList = [select id from Account];
        Test.startTest();
        Integer i = 0;
        List < Id > idList = new List < Id > ();
        for (Account user: userList) {
            idList.add(user.Id);
            user.Is_Active__c = '有效';
            user.Name = user.Name + i;
            i++;
        }
        BatchIF_Log__c iflog = new BatchIF_Log__c();
        iflog.Log__c = 'test start \n';
        insert iflog;
        upsert userList;
        // NFM701Controller.callout(iflog.Id, idList);
        Test.stopTest();
    }
}
force-app/main/default/classes/NFM701ControllerHandlerTest.cls-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>41.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/NFM702WebService.cls
New file
@@ -0,0 +1,6 @@
global without sharing class NFM702WebService {
    webservice static String sendToOBPM(String iflog_Id, List<String> contactids){
        NFM702Controller.callout(iflog_Id, contactids);
        return '上传OBPM成功!';
    }
}
force-app/main/default/classes/NFM702WebService.cls-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>52.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/NFM702WebServiceTest.cls
New file
@@ -0,0 +1,57 @@
@isTest
private class NFM702WebServiceTest {
    public Class GeDatas {
        public NFMUtil.Monitoring Monitoring;
        public GeData[] GeData;
    }
    public Class GeData {
        public String DoctorNo;   //人员管理编码
        public String HospitalName;     //医院名称
        public String OfficeName;   //科室名称
        public String DoctorName;    //姓名
        public String TelNo;   //电话
        public String HcpNo;    //HPC编码
        public Boolean IsActive;    //是否有效
        public String UpdateStatus;     //操作类型
    }
    static testMethod void testMethod1() {
        GeDatas GeDatas = new GeDatas();
        GeDatas.Monitoring = new NFMUtil.Monitoring();
        Datetime nowDT = Datetime.now();
        String nowStr = nowDT.format('yyyyMMddHHmm');
        GeDatas.Monitoring.TransmissionDateTime = nowStr;
        GeDatas.Monitoring.Text                 = '';
        GeDatas.Monitoring.Tag                  = '';
        GeDatas.Monitoring.Sender               = 'SFDC';
        GeDatas.Monitoring.Receiver             = 'OBPM';
        GeDatas.Monitoring.MessageType          = 'NFM702';
        GeDatas.GeData = new List<GeData>();
        GeData GeData = new GeData();
        GeDatas.GeData.add(GeData);
        GeData.DoctorNo = 'C000033002';
        GeData.HospitalName = '安徽中医药大学第一附属医院';
        GeData.OfficeName = ' 耳鼻喉科';
        GeData.DoctorName = '刘刚';
        GeData.TelNo = '13810000000';
        GeData.HcpNo = '123456';
        GeData.IsActive = true;
        GeData.UpdateStatus = '1';
        NFMUtil.Monitoring Monitoring   = new NFMUtil.Monitoring();
        Monitoring.Tag                  = GeDatas.Monitoring.Tag;
        Monitoring.Sender               = GeDatas.Monitoring.Sender;
        Monitoring.Receiver             = GeDatas.Monitoring.Receiver;
        Monitoring.MessageType          = GeDatas.Monitoring.MessageType;
        Monitoring.MessageGroupNumber   = GeDatas.Monitoring.MessageGroupNumber;
        Monitoring.NumberOfRecord       = GeDatas.Monitoring.NumberOfRecord;
        Monitoring.TransmissionDateTime = GeDatas.Monitoring.TransmissionDateTime;
        Monitoring.Text = '';
        BatchIF_Log__c rowData = NFMUtil.saveRowData(Monitoring, 'NFM702', GeDatas.GeData);
        List<String> geList = new List<String>();
        geList.add('C000033002');
        NFM702WebService.sendToOBPM(rowData.id, geList);
    }
}
force-app/main/default/classes/NFM702WebServiceTest.cls-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>52.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/NFM703Controller.cls
@@ -83,6 +83,8 @@
                                        HostName__c,
                                        cooperatorCompany__c, 
                                        Owner.Employee_No__c, 
                                        Shared_Editing__c,
                                        Carbon_Copy__c,
                                        IF_Approved__c from Campaign where id in: camIdList];
        String logstr = ' ' + 'NumberOfRecord=' + camList.size() + '\n';
@@ -97,6 +99,19 @@
        mon.TransmissionDateTime = nowStr;
        mon.Text = '';
        Map<String, String> transferMap = new Map<String, String>();
        List<BatchIF_Transfer__c> transferList = [select Table__c,
                                  Column__c,
                                  External_value__c,
                                  Internal_value__c
                                  from BatchIF_Transfer__c
                                  where Dropped_Flag__c = false
                                          and (Table__c = 'Application_for_Conference_Adjudication__c')
                                          ];
        for (BatchIF_Transfer__c t : transferList) {
            transferMap.put(t.Column__c + t.Internal_value__c, t.External_value__c);
        }
        try {
                
            for (Campaign cam : camList) {
@@ -107,7 +122,7 @@
                ged.StartDate           = NFMUtil.formatDate2StrSpo(cam.StartDate);
                ged.EndDate           = NFMUtil.formatDate2StrSpo(cam.EndDate);
                ged.BudgetType        = cam.Budget_Type__c;
                ged.OfficeCategory       = cam.OfficeCategory__c;
                ged.OfficeCategory       = NFMUtil.getMapValue(transferMap, 'OfficeCategory__c', cam.OfficeCategory__c, iflog);
                ged.MeetingType       = cam.Meeting_Type__c;
                ged.ActivityTypeName  = cam.Activity_Type_Name__c;
                ged.StateMaster       = cam.State_Master__r.Name;                 
@@ -118,7 +133,7 @@
                ged.ExpectedOlympusAttendance = String.valueOf(cam.Expected_Olympus_Attendance__c);
                ged.ExpectedHcpAttendance = String.valueOf(cam.Expected_Hcp_Attendance__c);
                // 暂时定义为主担当,后续添加其他共享人
                ged.SharedEditing     = cam.Owner.Employee_No__c;
                ged.SharedEditing     = Modify_Sharing(cam.Owner.Employee_No__c, cam.Shared_Editing__c, cam.Carbon_Copy__c);
                gds.GeData.add(ged);
            }
@@ -231,4 +246,27 @@
        upsert rowDataSFDC;
    }
    public static String Modify_Sharing(String owner, String shared_editors, String carbon_copies) {
        if (String.isBlank(owner) && String.isBlank(shared_editors) && String.isBlank(carbon_copies)) {
            return '';
        }
        String ret = '';
        if (String.isNotBlank(owner)) {
            ret = owner;
        }
        if (String.isNotBlank(shared_editors)) {
            if (ret.length() > 0) {
                ret = ret + ',';
            }
            ret = ret + shared_editors;
        }
        if (String.isNotBlank(carbon_copies)) {
            if (ret.length() > 0) {
                ret = ret + ',';
            }
            ret = ret + carbon_copies;
        }
        return ret;
    }
}
force-app/main/default/classes/NFM704Rest.cls
@@ -14,13 +14,21 @@
    public static final String LOG_TYPE = 'NFM704';
    global class GeData {
        public String StaffMCode;   //SFDC人员管理编码
        public String StaffMCode;   //人员管理编码OBPM
        public String HospitalMCode;     //医院管理编码
        public String OfficeMCode;   //科室管理编码
        public String OfficeMCode;   //OBPM科室
        public String HcpNo;    //HPC编码
        public String HCPLevel; //HCP等级
        public String Name;    //姓名
        public String Mobile;   //电话
        public String State;    //省
        public String City;     //市
        public String WorkingSeniority; //临床工作年限
        public String TechnicalTitle; //技术职称
        public String Speciality;   //擅长的手术
        public String ProfessionalField;    //专业领域
        public String Society1;  //学会名称
        public String EventStatus; //学会职称
    }
    @HttpPost
@@ -89,10 +97,11 @@
            List<String> DoctorNoList = new List<String>();
            //待更新的客户人员List
            List<Contact> updateList = new List<Contact>();
            List<Contact> upsertList = new List<Contact>();
            //科室编码List
            List<String> officeMCodeList = new List<String>();
            //医院编码List
            List<String> HospitalMCodeList = new List<String>();
            for(GeData ged : itemMasterList){
                String dataComplete = verify(ged);
@@ -101,69 +110,86 @@
                    continue;
                }
                DoctorNoList.add(ged.StaffMCode);
                officeMCodeList.add(ged.OfficeMCode);
                //officeMCodeList.add(ged.OfficeMCode);
                HospitalMCodeList.add(ged.HospitalMCode);
            }
            system.debug('HospitalMCodeList=============>'+HospitalMCodeList);
            system.debug('DoctorNoList=============>'+DoctorNoList);
            //Map<String, Map<String,Contact>> hospitalMap = new Map<String, Map<String,Contact>>();
            Map<String, Contact> conListMap = new Map<String, Contact>();
            List<Contact> conList = [select Id,
                                            CManageCode__c,     //人员管理编码
                                            Account.Hospital_Name__c,       //医院名称
                                            Account.Department_Name__c,       //科室名称
                                            Name,       //姓名
                                            Phone,      //电话
                                            HcpNo__c,       //HCP编码
                                            Isactive__c,    //是否有效
                                            UpdateStatus__c            //操作类型
                                            from Contact WHERE CManageCode__c IN:DoctorNoList order by AccountId];
                                            Management_Code__c, //医院管理编码
                                            CManageCode__c     //人员管理编码
                                            from Contact WHERE CManageCode__c IN:DoctorNoList];
            system.debug('conList============>'+conList);
            
            for(Contact con : conList ){
                conListMap.put(con.CManageCode__c, con);
                //hospitalMap.put(con.Management_Code__c,conListMap);
            }
            //Management_Code__c
            List<Account> accList = [select Id, Name, Management_Code__c from Account where Management_Code__c in :officeMCodeList];
            List<Account> accList = [select Id, Name,GI_Main__c,Management_Code__c from Account where Management_Code__c in :HospitalMCodeList];
            system.debug('accList=============>'+accList);
            Map<String, Account> accMap = new Map<String, Account>();
            for(Account acc : accList){
                accMap.put(acc.Management_Code__c, acc);
               accMap.put(acc.Management_Code__c, acc);
            }
            for( GeData ged : itemMasterList ){
                Contact con = new Contact();
                logstr += conListMap.get(ged.StaffMCode).Id;
                if(conListMap.containsKey(ged.StaffMCode)){
                    logstr += '已存在客户人员\n';
                    con.Id = conListMap.get(ged.StaffMCode).Id;
                }else {
                    logstr += '不存在的客户人员\n';
                //Map<String, Contact> tempMap = new Map<String, Contact>();
                if(accMap.containsKey(ged.HospitalMCode)){//医院编码是否存在 是
                    Contact con = new Contact();
                    if(conListMap.containsKey(ged.StaffMCode)){
                        //存在则更新
                        system.debug('更新联系人');
                        logstr += conListMap.get(ged.StaffMCode).Id + '\n';
                        logstr += '已存在客户人员\n';
                        con.Id = conListMap.get(ged.StaffMCode).Id;
                        system.debug('request'+conListMap.get(ged.StaffMCode).Management_Code__c.equals(ged.HospitalMCode));
                        if(conListMap.get(ged.StaffMCode).Management_Code__c.equals(ged.HospitalMCode)){//判断联系人上的管理编码和接口传输过来的管理编码是否一致
                            system.debug('request'+conListMap.get(ged.StaffMCode).Management_Code__c.equals(ged.HospitalMCode));
                        }else{
                            con.OBPMHospital__c = accMap.get(ged.HospitalMCode).Id;//接收的管理编码对应的医院写到OBPM医院上
                        }
                        con = assignment(ged,con);
                    }else{
                        //不存在则新建
                        system.debug('新建联系人');
                        //logstr += '不存在的客户人员\n';
                        con.OwnerId = accMap.get(ged.HospitalMCode).GI_Main__c;//所有人取医院上的消化科担当
                        con.AccountId = accMap.get(ged.HospitalMCode).Id;//新建联系人放到医院下
                        con.LastName = ged.Name;
                        con.FirstName = '';
                        con = assignment(ged,con);
                    }
                    upsertList.add(con);
                }else{//否
                    continue;
                    logstr += '不存在的医院管理编码:['+accMap.get(ged.HospitalMCode)+']/n';
                }
                //AccountId
                if( accMap.get(ged.OfficeMCode) != null ){
                    con.AccountId = accMap.get(ged.OfficeMCode).Id;
                }else {
                    logstr += '当前科室id有误或不存在';
                }
                // //AccountId
                // if( accMap.get(ged.OfficeMCode) != null ){
                //     con.AccountId = accMap.get(ged.OfficeMCode).Id;
                // }else {
                //     logstr += '当前科室id有误或不存在';
                // }
                con.HcpNo__c = ged.HcpNo;
                con.HCPLevel__c = ged.HCPLevel;
                con.LastName = ged.Name;
                con.MobilePhone = ged.Mobile;
                // con.HcpNo__c = ged.HcpNo;
                // con.HCPLevel__c = ged.HCPLevel;
                // con.LastName = ged.Name;
                // con.MobilePhone = ged.Mobile;
                conListMap.put(ged.StaffMCode, con);
                // conListMap.put(ged.StaffMCode, con);
            }
            if(conListMap.size() > 0 ){
            system.debug('upsertList==================>'+upsertList);
            if(upsertList.size() > 0 ){
                // Update updateList;
                UpSert conListMap.values();
                Oly_TriggerHandler.bypass('ConsumableOrderTrigger');
                UpSert upsertList;
            }
            rowData.retry_cnt__c = 0;
@@ -191,9 +217,9 @@
        if (ged.HospitalMCode == null) {
            result += 'DataError: 医院管理编码 [ HospitalMCode ] is null!\n';
        }
        if (ged.OfficeMCode == null) {
            result += 'DataError: 科室管理编码 [ OfficeMCode ] is null!\n';
        }
        // if (ged.OfficeMCode == null) {
        //     result += 'DataError: 科室管理编码 [ OfficeMCode ] is null!\n';
        // }
        if (ged.HcpNo == null) {
            result += 'DataError: HCP编码 [ HcpNo ] is null!\n';
        }
@@ -210,4 +236,45 @@
        return result;
    }
    public static Contact assignment(GeData ged,Contact con){//联系人数据赋值方法
        List<String> societyList = Breakup(ged.Society1);
        List<String> eventStatusList = Breakup(ged.EventStatus);
        con.NameOBPM__c             = ged.Name;//姓名
        con.MobileOBPM__c           = ged.Mobile;//电话
        con.stateOBPM__c            = ged.State;//省OBPM
        con.CityOBPM__c             = ged.City;//市OBPM
        con.HcpNo__c                = ged.HcpNo;//HPC编码
        con.HCPLevel__c             = ged.HCPLevel;//HCP等级
        con.OBPMDepartment__c       = ged.OfficeMCode;//OBPM科室
        con.WorkingSeniorityOBPM__c = ged.WorkingSeniority;  //临床工作年限
        con.TechnicalTitleOBPM__c   = ged.TechnicalTitle;//技术职称
        con.SpecialityOBPM__c       = ged.Speciality;//擅长的手术
        con.ProfessionalField__c    = ged.ProfessionalField;//专业领域
        if(societyList.size()>0){
            con.Learn_name1__c          = societyList[0];//学会名称1
        }
        if(societyList.size()>1){
            con.Learn_name2__c          = societyList[1];//学会名称2
        }
        if(societyList.size()>2){
            con.Learn_name3__c          = societyList[2];//学会名称3
        }
        if(eventStatusList.size()>0){
            con.Learn_serve1__c         = eventStatusList[0];//学会职称1
        }
        if(eventStatusList.size()>1){
            con.Learn_serve2__c         = eventStatusList[1];//学会职称2
        }
        if(eventStatusList.size()>2){
            con.Learn_serve3__c         = eventStatusList[2];//学会职称3
        }
        return con;
    }
    public static List<String> Breakup (String str){
        // List<string> over = new List<string>();
        // over = str.split('↑');
        List<string> over = str.split('↑');
        return over;
    }
}
force-app/main/default/classes/NFM705Rest.cls
@@ -122,6 +122,7 @@
            //Map<string,GeData> meetingApprovedNoMap = new Map<string,GeData>();
            List<String> meetingApprovedNoList = new List<String>();
            List<String> NumList = new List<String>();
            List<User> users = new List<User>();
            for(GeData ged : itemMasterList){
                //验证数据完整性
                // String dataComplete = verify(ged);
@@ -140,7 +141,8 @@
                                            Num__c, 
                                            MeetingApprovedNo__c 
                                        from Campaign 
                                        where Num__c IN: NumList] : new List<Campaign>();
                                        where Num__c IN: NumList
                                        ] : new List<Campaign>();
            // for(Campaign temp : campaignList){
            //     campaignMap.put(temp.Num__c,temp.Id);
            // }
@@ -155,6 +157,9 @@
                oldacfcMap.put(oldafca.MeetingApprovedNo__c,oldafca);
            }
            // 所有人信息
            List<String> user_nos = new List<String>();
            for (GeData ged : itemMasterList) {
                //新建会议裁决申请
                Application_for_Conference_Adjudication__c aca = new Application_for_Conference_Adjudication__c();
@@ -165,7 +170,7 @@
                aca.StartDate__c                    = NFMUtil.parseDateTimeStr2Date(ged.StartDate);
                aca.EndDate__c                      = NFMUtil.parseDateTimeStr2Date(ged.EndDate);
                aca.BudgetType__c                   = ged.BudgetType;
                aca.OfficeCategory__c               = ged.OfficeCategory;
                aca.OfficeCategory__c               = GetOfficeCategory(ged.OfficeCategory, transferMap, iflog);
                //aca.MeetingType__c                  = ged.MeetingType;
                aca.MeetingType__c                  = DividingTypes(ged.IsCoOrganizingActivities,ged.ActivityTypeName);
                aca.StateMaster__c                  = ged.StateMaster;
@@ -188,34 +193,68 @@
                    aca.ProcessState__c == oldacfcMap.get(ged.MeetingApprovedNo).ProcessState__c)){
                    aca.Id = oldacfcMap.get(ged.MeetingApprovedNo).Id;
                    aca.Num__c = String.isBlank(aca.Num__c) ? oldacfcMap.get(ged.MeetingApprovedNo).Num__c : aca.Num__c; 
                }
                // 确认申请人
                System.debug('aca.Id: ' + aca.Id);
                if (String.isBlank(aca.Id)) {
                    user_nos.add(ged.Applicant);
                }
                aca.IsSupplemental__c = aca.ProcessState__c != '补充决裁' ? false : true;
                aca.Applicant__c = ged.Applicant;
                aca.Shared_Editing__c = ged.SharedEditing;
                if (String.isNotBlank(ged.SharedEditing)) {
                    user_nos.addAll(ged.SharedEditing.split(','));
                }
                System.debug(user_nos);
                acaList.add(aca);
            }
            // 查找所有人
            if (user_nos != null && user_nos.size() > 0) {
                users = [select Id, Employee_No__c from User where Employee_No__c in :user_nos];
                if (users != null && users.size() > 0) {
                    String owner = '';
                    for (Application_for_Conference_Adjudication__c app : acaList) {
                        System.debug('owner from 705: ' + app.Applicant__c);
                        for (User u : users) {
                            System.debug('user no: ' + u.Employee_No__c);
                            if (String.isNotBlank(u.Employee_No__c) && u.Employee_No__c.equals(app.Applicant__c)) {
                                app.OwnerId = u.Id;
                                owner = u.Id;
                                break;
                            }
                        }
                    }
                }
            }
            
            if (acaList.size() > 0) {
                // 写入决裁信息
                upsert acaList;
                // 共享权限
                SetSharing(users, acaList);
                // 自动创建学会
                List<Application_for_Conference_Adjudication__c> wait_to_create_cams = new List<Application_for_Conference_Adjudication__c>();
                List<Campaign> new_campaigns = new List<Campaign>();
                for (Application_for_Conference_Adjudication__c app : acaList) {
                    if (String.isBlank(app.Id) && String.isBlank(app.Num__c) && app.MeetingType__c != '赞助会' && app.ProcessState__c != '补充决裁') {
                        wait_to_create_cams.add(app);
                    }
                }
                if (wait_to_create_cams != null && wait_to_create_cams.size() > 0) {
                    for (Application_for_Conference_Adjudication__c app : wait_to_create_cams) {
                        Campaign cam = createNewCampaignFromApplication(app);
                        new_campaigns.add(cam);
                    }
                    if (new_campaigns.size() > 0) {
                        insert new_campaigns;
                    }
                }
                // 2022-02-22 会议确认 无法确认记录类型,不做自动创建
                // List<Application_for_Conference_Adjudication__c> wait_to_create_cams = new List<Application_for_Conference_Adjudication__c>();
                // List<Campaign> new_campaigns = new List<Campaign>();
                // for (Application_for_Conference_Adjudication__c app : acaList) {
                //     if (String.isBlank(app.Id) && String.isBlank(app.Num__c) && app.MeetingType__c != '赞助会' && app.ProcessState__c != '补充决裁') {
                //         wait_to_create_cams.add(app);
                //     }
                // }
                // if (wait_to_create_cams != null && wait_to_create_cams.size() > 0) {
                //     for (Application_for_Conference_Adjudication__c app : wait_to_create_cams) {
                //         Campaign cam = createNewCampaignFromApplication(app);
                //         new_campaigns.add(cam);
                //     }
                //     if (new_campaigns.size() > 0) {
                //         insert new_campaigns;
                //     }
                // }
                // 更新已存在的决裁信息
                System.debug('查找到的会议: ' + campaignList.size());
                if (campaignList != null && campaignList.size() > 0) {
@@ -225,6 +264,31 @@
                            if (cam.Num__c == app.Num__c && !app.IsSupplemental__c) {
                                cam.MeetingApprovedNo__c             = app.MeetingApprovedNo__c;
                                cam.Meeting_Approved_No__c           = app.Id;
                                if (app.MeetingType__c != '赞助会') {
                                    cam.StartDate                        = app.StartDate__c;
                                    cam.EndDate                          = app.EndDate__c;
                                    cam.Budget_Type__c                   = app.BudgetType__c;
                                    cam.OfficeCategory__c                = app.OfficeCategory__c;
                                    cam.Meeting_Type__c                  = app.MeetingType__c;
                                    cam.WorkshopPlace__c                 = app.WorkshopPlace__c;
                                    cam.HostName__c                      = app.HostName__c;
                                    cam.cooperatorCompany__c             = app.CooperatorCompany__c;
                                    cam.Convening_Participants_Num__c    = app.ConveningParticipantsNum__c;
                                    // OBPM对接 新增字段
                                    cam.Expected_Olympus_Attendance__c   = app.ExpectedOlympusAttendance__c;
                                    cam.Expected_Hcp_Attendance__c       = app.ExpectedHcpAttendance__c;
                                    cam.SponsorshipCategory__c           = app.SponsorshipCategory__c;
                                    cam.IsPaidToSponsor__c               = app.IsPaidToSponsor__c;
                                    // cam.Activity_Type_Name__c            = app.ActivityTypeName__c;
                                    cam.Activity_Type_Name__c            = app.Type_of_adjudication_meeting__c;
                                    // 这里需要额外加操作
                                    cam.State_Master__c                  = StateCityUtil.get_state(app.StateMaster__c);
                                    cam.City_Master__c                   = StateCityUtil.get_city(app.CityMaster__c);
                                }
                                updatelist.add(cam);
                                break;
                            }
@@ -259,145 +323,145 @@
        
    }
    // 必填字段验证
    private static String verify(GeData ged) {
        String result = '';
    // private static String verify(GeData ged) {
    //     String result = '';
        // Map<String , String> BudgetTypeMap = new Map<String,String>();
        // BudgetTypeMap.put(ged.BudgetType, '新产品上市');
        // BudgetTypeMap.put(ged.BudgetType, '产品推广');
        // BudgetTypeMap.put(ged.BudgetType, '主题活动(NBI早癌,EUS大赛等)');
        // BudgetTypeMap.put(ged.BudgetType, '产品售后使用培训');
        // BudgetTypeMap.put(ged.BudgetType, 'NTC等故障预防活动');
        // BudgetTypeMap.put(ged.BudgetType, '经销商相关会议');
        // BudgetTypeMap.put(ged.BudgetType, '其他');
    //     // Map<String , String> BudgetTypeMap = new Map<String,String>();
    //     // BudgetTypeMap.put(ged.BudgetType, '新产品上市');
    //     // BudgetTypeMap.put(ged.BudgetType, '产品推广');
    //     // BudgetTypeMap.put(ged.BudgetType, '主题活动(NBI早癌,EUS大赛等)');
    //     // BudgetTypeMap.put(ged.BudgetType, '产品售后使用培训');
    //     // BudgetTypeMap.put(ged.BudgetType, 'NTC等故障预防活动');
    //     // BudgetTypeMap.put(ged.BudgetType, '经销商相关会议');
    //     // BudgetTypeMap.put(ged.BudgetType, '其他');
        // Map<String , String> OfficeCategoryMap = new Map<String,String>();
        // OfficeCategoryMap.put(ged.OfficeCategory, '1.消化科');
        // OfficeCategoryMap.put(ged.OfficeCategory, '2.呼吸科');
        // OfficeCategoryMap.put(ged.OfficeCategory, '3.普外科');
        // OfficeCategoryMap.put(ged.OfficeCategory, '4.泌尿科');
        // OfficeCategoryMap.put(ged.OfficeCategory, '5.妇科');
        // OfficeCategoryMap.put(ged.OfficeCategory, '6.耳鼻喉科');
        // OfficeCategoryMap.put(ged.OfficeCategory, '其他');
        // OfficeCategoryMap.put(ged.OfficeCategory, '肝胆外科');
        // OfficeCategoryMap.put(ged.OfficeCategory, '胃肠外科');
    //     // Map<String , String> OfficeCategoryMap = new Map<String,String>();
    //     // OfficeCategoryMap.put(ged.OfficeCategory, '1.消化科');
    //     // OfficeCategoryMap.put(ged.OfficeCategory, '2.呼吸科');
    //     // OfficeCategoryMap.put(ged.OfficeCategory, '3.普外科');
    //     // OfficeCategoryMap.put(ged.OfficeCategory, '4.泌尿科');
    //     // OfficeCategoryMap.put(ged.OfficeCategory, '5.妇科');
    //     // OfficeCategoryMap.put(ged.OfficeCategory, '6.耳鼻喉科');
    //     // OfficeCategoryMap.put(ged.OfficeCategory, '其他');
    //     // OfficeCategoryMap.put(ged.OfficeCategory, '肝胆外科');
    //     // OfficeCategoryMap.put(ged.OfficeCategory, '胃肠外科');
        // Map<String , String> MeetingTypeMap = new Map<String,String>();
        // MeetingTypeMap.put(ged.MeetingType, '自办会');
        // MeetingTypeMap.put(ged.MeetingType, '赞助会');
        // MeetingTypeMap.put(ged.MeetingType, '共同主办会');
    //     // Map<String , String> MeetingTypeMap = new Map<String,String>();
    //     // MeetingTypeMap.put(ged.MeetingType, '自办会');
    //     // MeetingTypeMap.put(ged.MeetingType, '赞助会');
    //     // MeetingTypeMap.put(ged.MeetingType, '共同主办会');
        // if (ged.MeetingApprovedNo == null) {
        //     result += 'DataError: 会议决裁编码 [ MeetingApprovedNo ] is null!\n';
        // }
        if (String.isBlank(ged.Name)) {
            result += 'DataError: 会议名称 [ Name ] 不能为空!\n';
        }
        if(String.isBlank(ged.MeetingApprovedNo)){
            result += 'DataError:会议决裁编码[MeetingApprovedNo] 不能为空!\n';
        }
        if(ged.ProcessState == null){
            result += 'DataError:OBPM审批状态[ProcessState] 不能为空!\n';
        }
        if(String.isBlank(ged.HostName)){
            result += 'DataError:会议主办方[HostName] 不能为空!\n';
        }
        if(String.isBlank(ged.CooperatorCompany)){
            result += 'DataError:会议承办方[CooperatorCompany] 不能为空!\n';
        }
        /*if (!BudgetTypeMap.containsKey(ged.BudgetType)) {
            result += 'DataError: 预算类型 [ BudgetType ] 传值有误!\n';
        } else if (!ged.BudgetType.equals('产品推广')) {
            result += 'DataError: 预算类型 [ BudgetType ] 传值有误!\n';
        } else if (!ged.BudgetType.equals('主题活动(NBI早癌,EUS大赛等)')) {
            result += 'DataError: 预算类型 [ BudgetType ] 传值有误!\n';
        } else if (!ged.BudgetType.equals('产品售后使用培训')) {
            result += 'DataError: 预算类型 [ BudgetType ] 传值有误!\n';
        } else if (!ged.BudgetType.equals('NTC等故障预防活动')) {
            result += 'DataError: 预算类型 [ BudgetType ] 传值有误!\n';
        } else if (!ged.BudgetType.equals('经销商相关会议')) {
            result += 'DataError: 预算类型 [ BudgetType ] 传值有误!\n';
        } else if (!ged.BudgetType.equals('其他')) {
            result += 'DataError: 预算类型 [ BudgetType ] 传值有误!\n';
        }
        if (!OfficeCategoryMap.containsKey(ged.OfficeCategory)) {
            result += 'DataError: 科室分类 [ OfficeCategory ] 传值有误!\n';
        } else if (!ged.OfficeCategory.equals('2.呼吸科')) {
            result += 'DataError: 科室分类 [ OfficeCategory ] 传值有误!\n';
        } else if (!ged.OfficeCategory.equals('3.普外科')) {
            result += 'DataError: 科室分类 [ OfficeCategory ] 传值有误!\n';
        } else if (!ged.OfficeCategory.equals('4.泌尿科')) {
            result += 'DataError: 科室分类 [ OfficeCategory ] 传值有误!\n';
        } else if (!ged.OfficeCategory.equals('5.妇科')) {
            result += 'DataError: 科室分类 [ OfficeCategory ] 传值有误!\n';
        } else if (!ged.OfficeCategory.equals('6.耳鼻喉科')) {
            result += 'DataError: 科室分类 [ OfficeCategory ] 传值有误!\n';
        } else if (!ged.OfficeCategory.equals('其他')) {
            result += 'DataError: 科室分类 [ OfficeCategory ] 传值有误!\n';
        } else if (!ged.OfficeCategory.equals('肝胆外科')) {
            result += 'DataError: 科室分类 [ OfficeCategory ] 传值有误!\n';
        } else if (!ged.OfficeCategory.equals('胃肠外科')) {
            result += 'DataError: 科室分类 [ OfficeCategory ] 传值有误!\n';
        }
        if (!MeetingTypeMap.containsKey(ged.MeetingType)) {
            result += 'DataError: 会议类型 [ MeetingType ] 传值有误!\n';
        } else if (!ged.MeetingType.equals('赞助会')) {
            result += 'DataError: 会议类型 [ MeetingType ] 传值有误!\n';
        } else if (!ged.MeetingType.equals('共同主办会')) {
            result += 'DataError: 会议类型 [ MeetingType ] 传值有误!\n';
        } */
        return result;
    }
    //     // if (ged.MeetingApprovedNo == null) {
    //     //     result += 'DataError: 会议决裁编码 [ MeetingApprovedNo ] is null!\n';
    //     // }
    //     if (String.isBlank(ged.Name)) {
    //         result += 'DataError: 会议名称 [ Name ] 不能为空!\n';
    //     }
    //     if(String.isBlank(ged.MeetingApprovedNo)){
    //         result += 'DataError:会议决裁编码[MeetingApprovedNo] 不能为空!\n';
    //     }
    //     if(ged.ProcessState == null){
    //         result += 'DataError:OBPM审批状态[ProcessState] 不能为空!\n';
    //     }
    //     if(String.isBlank(ged.HostName)){
    //         result += 'DataError:会议主办方[HostName] 不能为空!\n';
    //     }
    //     if(String.isBlank(ged.CooperatorCompany)){
    //         result += 'DataError:会议承办方[CooperatorCompany] 不能为空!\n';
    //     }
    //     /*if (!BudgetTypeMap.containsKey(ged.BudgetType)) {
    //         result += 'DataError: 预算类型 [ BudgetType ] 传值有误!\n';
    //     } else if (!ged.BudgetType.equals('产品推广')) {
    //         result += 'DataError: 预算类型 [ BudgetType ] 传值有误!\n';
    //     } else if (!ged.BudgetType.equals('主题活动(NBI早癌,EUS大赛等)')) {
    //         result += 'DataError: 预算类型 [ BudgetType ] 传值有误!\n';
    //     } else if (!ged.BudgetType.equals('产品售后使用培训')) {
    //         result += 'DataError: 预算类型 [ BudgetType ] 传值有误!\n';
    //     } else if (!ged.BudgetType.equals('NTC等故障预防活动')) {
    //         result += 'DataError: 预算类型 [ BudgetType ] 传值有误!\n';
    //     } else if (!ged.BudgetType.equals('经销商相关会议')) {
    //         result += 'DataError: 预算类型 [ BudgetType ] 传值有误!\n';
    //     } else if (!ged.BudgetType.equals('其他')) {
    //         result += 'DataError: 预算类型 [ BudgetType ] 传值有误!\n';
    //     }
    //     if (!OfficeCategoryMap.containsKey(ged.OfficeCategory)) {
    //         result += 'DataError: 科室分类 [ OfficeCategory ] 传值有误!\n';
    //     } else if (!ged.OfficeCategory.equals('2.呼吸科')) {
    //         result += 'DataError: 科室分类 [ OfficeCategory ] 传值有误!\n';
    //     } else if (!ged.OfficeCategory.equals('3.普外科')) {
    //         result += 'DataError: 科室分类 [ OfficeCategory ] 传值有误!\n';
    //     } else if (!ged.OfficeCategory.equals('4.泌尿科')) {
    //         result += 'DataError: 科室分类 [ OfficeCategory ] 传值有误!\n';
    //     } else if (!ged.OfficeCategory.equals('5.妇科')) {
    //         result += 'DataError: 科室分类 [ OfficeCategory ] 传值有误!\n';
    //     } else if (!ged.OfficeCategory.equals('6.耳鼻喉科')) {
    //         result += 'DataError: 科室分类 [ OfficeCategory ] 传值有误!\n';
    //     } else if (!ged.OfficeCategory.equals('其他')) {
    //         result += 'DataError: 科室分类 [ OfficeCategory ] 传值有误!\n';
    //     } else if (!ged.OfficeCategory.equals('肝胆外科')) {
    //         result += 'DataError: 科室分类 [ OfficeCategory ] 传值有误!\n';
    //     } else if (!ged.OfficeCategory.equals('胃肠外科')) {
    //         result += 'DataError: 科室分类 [ OfficeCategory ] 传值有误!\n';
    //     }
    //     if (!MeetingTypeMap.containsKey(ged.MeetingType)) {
    //         result += 'DataError: 会议类型 [ MeetingType ] 传值有误!\n';
    //     } else if (!ged.MeetingType.equals('赞助会')) {
    //         result += 'DataError: 会议类型 [ MeetingType ] 传值有误!\n';
    //     } else if (!ged.MeetingType.equals('共同主办会')) {
    //         result += 'DataError: 会议类型 [ MeetingType ] 传值有误!\n';
    //     } */
    //     return result;
    // }
    // 创建会议 绑定决裁相关信息
    public static Campaign createNewCampaignFromApplication(Application_for_Conference_Adjudication__c app) {
        Campaign cam = new Campaign();
        //定义变量保存记录类型
        Id RtId = Schema.SObjectType.Campaign.getRecordTypeInfosByDeveloperName().get('Society').getRecordTypeId();
        //List<Id> = [select Id from RecordType where IsActive = true and SobjectType = 'CampaignMember' and Name = '社外参加人'];
        Id RtId2 = Schema.SObjectType.CampaignMember.getRecordTypeInfosByDeveloperName().get('WorkShop').getRecordTypeId();
        cam.RecordTypeId                     = RtId;
        cam.CampaignMemberRecordTypeId       = RtId2;//ID不写死 社外人员
    // public static Campaign createNewCampaignFromApplication(Application_for_Conference_Adjudication__c app) {
    //     Campaign cam = new Campaign();
    //     //定义变量保存记录类型
    //     Id RtId = Schema.SObjectType.Campaign.getRecordTypeInfosByDeveloperName().get('Society').getRecordTypeId();
    //     //List<Id> = [select Id from RecordType where IsActive = true and SobjectType = 'CampaignMember' and Name = '社外参加人'];
    //     Id RtId2 = Schema.SObjectType.CampaignMember.getRecordTypeInfosByDeveloperName().get('WorkShop').getRecordTypeId();
    //     cam.RecordTypeId                     = RtId;
    //     cam.CampaignMemberRecordTypeId       = RtId2;//ID不写死 社外人员
        cam.Name                             = app.MeetingApprovedNo__c;
        cam.Name2__c                         = app.MeetingApprovedNo__c;
        cam.MeetingApprovedNo__c             = app.MeetingApprovedNo__c;
        cam.Meeting_Approved_No__c           = app.Id;
        cam.StartDate                        = app.StartDate__c;
        cam.EndDate                          = app.EndDate__c;
        cam.Budget_Type__c                   = app.BudgetType__c;
        cam.OfficeCategory__c                = app.OfficeCategory__c;
        cam.Meeting_Type__c                  = app.MeetingType__c;
        cam.Activity_Type_Name__c            = app.ActivityTypeName__c;
    //     cam.Name                             = app.MeetingApprovedNo__c;
    //     cam.Name2__c                         = app.MeetingApprovedNo__c;
    //     cam.MeetingApprovedNo__c             = app.MeetingApprovedNo__c;
    //     cam.Meeting_Approved_No__c           = app.Id;
    //     cam.StartDate                        = app.StartDate__c;
    //     cam.EndDate                          = app.EndDate__c;
    //     cam.Budget_Type__c                   = app.BudgetType__c;
    //     cam.OfficeCategory__c                = app.OfficeCategory__c;
    //     cam.Meeting_Type__c                  = app.MeetingType__c;
    //     cam.Activity_Type_Name__c            = app.ActivityTypeName__c;
        
        cam.WorkshopPlace__c                 = app.WorkshopPlace__c;
        cam.HostName__c                      = app.HostName__c;
        cam.cooperatorCompany__c             = app.CooperatorCompany__c;
        cam.Convening_Participants_Num__c    = app.ConveningParticipantsNum__c;
        cam.IF_Approved__c                   = true;
    //     cam.WorkshopPlace__c                 = app.WorkshopPlace__c;
    //     cam.HostName__c                      = app.HostName__c;
    //     cam.cooperatorCompany__c             = app.CooperatorCompany__c;
    //     cam.Convening_Participants_Num__c    = app.ConveningParticipantsNum__c;
    //     cam.IF_Approved__c                   = true;
        // OBPM对接 新增字段
        cam.Expected_Olympus_Attendance__c   = app.ExpectedOlympusAttendance__c;
        cam.Expected_Hcp_Attendance__c       = app.ExpectedHcpAttendance__c;
        cam.SponsorshipCategory__c           = app.SponsorshipCategory__c;
        cam.IsPaidToSponsor__c               = app.IsPaidToSponsor__c;
        cam.Activity_Type_Name__c            = app.ActivityTypeName__c;
    //     // OBPM对接 新增字段
    //     cam.Expected_Olympus_Attendance__c   = app.ExpectedOlympusAttendance__c;
    //     cam.Expected_Hcp_Attendance__c       = app.ExpectedHcpAttendance__c;
    //     cam.SponsorshipCategory__c           = app.SponsorshipCategory__c;
    //     cam.IsPaidToSponsor__c               = app.IsPaidToSponsor__c;
    //     cam.Activity_Type_Name__c            = app.ActivityTypeName__c;
        // 新增所有人信息
        List<String> user_nos = new List<String>();
        user_nos.add(app.Applicant__c);
        user_nos.addAll(app.Shared_Editing__c.split(','));
        List<User> users = [select Id, Employee_No__c from User where Employee_No__c in :user_nos];
        if (users != null && users.size() > 0) {
            for (User u : users) {
                if (u.Employee_No__c == app.Applicant__c) {
                    cam.OwnerId = u.Id;
                }
            }
        }
    //     // 新增所有人信息
    //     List<String> user_nos = new List<String>();
    //     user_nos.add(app.Applicant__c);
    //     user_nos.addAll(app.Shared_Editing__c.split(','));
    //     List<User> users = [select Id, Employee_No__c from User where Employee_No__c in :user_nos];
    //     if (users != null && users.size() > 0) {
    //         for (User u : users) {
    //             if (u.Employee_No__c == app.Applicant__c) {
    //                 cam.OwnerId = u.Id;
    //             }
    //         }
    //     }
        return cam;
    }
    //     return cam;
    // }
    public static string DividingTypes(String IsCoOrganizingActivities,String ActivityTypeName){
        if('N'.equals(IsCoOrganizingActivities)){
@@ -408,4 +472,55 @@
        }
        return '共同主办会';
    }
    public static void SetSharing(List<User> users, List<Application_for_Conference_Adjudication__c> apps) {
        if (users == null || users.size() <= 0 || apps == null || apps.size() <= 0) {
            return;
        }
        // 初始化参数
        List<Application_for_Conference_Adjudication__Share> delete_list = new List<Application_for_Conference_Adjudication__Share>();
        List<Application_for_Conference_Adjudication__Share> insert_list = new List<Application_for_Conference_Adjudication__Share>();
        List<String> app_ids = new List<String>();
        // 共享理由
        String rowCauseShare = Schema.Application_for_Conference_Adjudication__Share.RowCause.Shared_Editor__c;
        // 循环设置
        for (Application_for_Conference_Adjudication__c app : apps) {
            app_ids.add(app.Id);
            System.debug('app.Shared_Editing__c: ' + app.Shared_Editing__c);
            for (User u : users) {
                if (String.isBlank(u.Employee_No__c)) {
                    continue;
                }
                System.debug('u.Employee_No__c: ' + u.Employee_No__c);
                if (app.Shared_Editing__c.contains(u.Employee_No__c)) {
                    Application_for_Conference_Adjudication__Share aos = new Application_for_Conference_Adjudication__Share(
                        RowCause = rowCauseShare,
                        ParentId = app.Id,
                        UserOrGroupId = u.Id,
                        AccessLevel = 'Edit');
                    insert_list.add(aos);
                }
            }
        }
        // 先删除
        delete_list = [select Id from Application_for_Conference_Adjudication__Share where ParentId in :app_ids and RowCause =: rowCauseShare];
        if (delete_list != null && delete_list.size() > 0) {
            delete delete_list;
        }
        // 再新增
        if (insert_list != null && insert_list.size() > 0) {
            insert insert_list;
        }
    }
    public static String GetOfficeCategory(String OfficeCategory, Map<String, String> transferMap, BatchIF_Log__c iflog) {
        if (String.isNotBlank(OfficeCategory)) {
            List<String> categories = OfficeCategory.split(',');
            if (categories != null && categories.size() > 0) {
                return NFMUtil.getMapValue(transferMap, 'OfficeCategory__c', categories.get(0), iflog);
            }
        }
        return null;
    }
}
force-app/main/default/classes/NFM705RestTest.cls
@@ -9,35 +9,20 @@
        testLog.ErrorLog__c = '';
        testLog.MessageGroupNumber__c = '20211207';
        testLog.RowDataFlg__c = true;
        testLog.Log__c = '[{"WorkshopPlace":"未来城","StateMaster":"贵州","StartDate":"20221215","SponsorshipCategory":"白给","ProcessState": null ,"OfficeCategory":"1.消化科","Num":"MT-HB-202112-5773","Name":null,"MeetingType":"主办会","MeetingApprovedNo":null,"IsPaidToSponsor":"Y","HostName":"黔西南州中医院","EndDate":"20221216","CooperatorCompany":"未来城","ConveningParticipantsNum":50,"CityMaster":"贵阳","BudgetType":"新产品上市"}]';
        testLog.Log__c = '[{"WorkshopPlace":"朝阳","StateMaster":"北京市","StartDate":"2022-03-25T00:00:00","SponsorshipCategory":"","SharedEditing":"om002080,om003696,om001646","ProcessState":110,"OfficeCategory":"GI(MEBG),ET(MEBG),","Num":"","Name":"自主主办活动-SFDC测试0310","MeetingType":"线上+线下","MeetingApprovedNo":"ME154P03-0004","IsPaidToSponsor":"N","IsCoOrganizingActivities":"Y","HostName":"","ExpectedOlympusAttendance":10,"ExpectedHcpAttendance":2,"EndDate":"2022-03-30T00:00:00","CooperatorCompany":"","ConveningParticipantsNum":12,"CityMaster":"北京市","BudgetType":"其他","Applicant":"om002021","ActivityTypeName":"自主主办活动"}]';
        //[Select Id, Name, Log__c, ErrorLog__c, Log2__c, Log3__c, Log4__c, Log5__c, Log6__c, Log7__c, Log8__c, Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c, retry_cnt__c,NFM624_Secondary_processing__c  from BatchIF_Log__c where RowDataFlg__c = true and Id =: rowData_Id]
        insert testLog;
        NFM705Rest.main(testLog.Id);
    }
    static testMethod void testMethodTwo() {
        BatchIF_Transfer__c transfer1 = new BatchIF_Transfer__c();
        transfer1.Table__c = 'Application_for_Conference_Adjudication__c';
        transfer1.Column__c = 'ProcessState__c';
        transfer1.External_Value__c = '110';
        transfer1.Internal_Value__c = '草稿';
        transfer1.Dropped_Flag__c = false;
        insert transfer1;
        BatchIF_Transfer__c transfer2 = new BatchIF_Transfer__c();
        transfer2.Table__c = 'Application_for_Conference_Adjudication__c';
        transfer2.Column__c = 'IsPaidToSponsor__c';
        transfer2.External_Value__c = 'Y';
        transfer2.Internal_Value__c = '是';
        transfer2.Dropped_Flag__c = false;
        insert transfer2;
        Test.startTest();
        
        RestRequest req = new RestRequest();
        RestResponse res = new RestResponse();
        String JsonMsg = '{"Monitoring":{"TransmissionDateTime":"202107131529","Text":null,"Tag":null,"Sender":"OBPM","Receiver":"SFDC","NumberOfRecord":"2","MessageType":"NFM705","MessageGroupNumber":null},"GeData":[{"WorkshopPlace":"未来城","StateMaster":"贵州","StartDate":"20251215","SponsorshipCategory":"白给","ProcessState":110,"OfficeCategory":"1.消化科","Num":null,"Name":"Test会议","MeetingType":"主办会","MeetingApprovedNo":"TEST997931","IsPaidToSponsor":"Y","HostName":"黔西南州中医院","EndDate":"20251216","CooperatorCompany":"未来城","ConveningParticipantsNum":50,"CityMaster":"安顺","BudgetType":"新产品上市","ActivityTypeName":"嗯?乖乖站好?","ExpectedOlympusAttendance":50,"ExpectedHcpAttendance":100}]}';
        String JsonMsg = '{"Monitoring":{"TransmissionDateTime":"202107131529","Text":null,"Tag":null,"Sender":"OBPM","Receiver":"SFDC","NumberOfRecord":"2","MessageType":"NFM705","MessageGroupNumber":null},"GeData":[{"WorkshopPlace":"未来城","StateMaster":"贵州","StartDate":"20211215","SponsorshipCategory":"Y","ProcessState":110,"OfficeCategory":"1.消化科","Num":"MT-HB-202112-5773","Name":"Test会议","MeetingType":"主办会","MeetingApprovedNo":"TEST99793","IsPaidToSponsor":"白给","HostName":"黔西南州中医院","EndDate":"20211216","CooperatorCompany":"未来城","ConveningParticipantsNum":50,"CityMaster":"安顺","BudgetType":"新产品上市","ActivityTypeName":"嗯?乖乖站好?","ExpectedOlympusAttendance":50,"ExpectedHcpAttendance":100}]}';
        req.requestURI = 'services/apexrest/NFM705/execute';
        req.httpMethod = 'POST';
        req.requestBody = Blob.valueof(JsonMsg);
force-app/main/default/classes/NFM707Rest.cls
@@ -135,16 +135,19 @@
                // if (campaignMap.size() > 0) {
                //     update campaignMap.values();
                // }
                List<Campaign> camNoList = [select id,Num__c,MeetingApprovedNo__c,Meeting_Approved_No__c
                List<Campaign> camNoList = [select id,Num__c,MeetingApprovedNo__c,Meeting_Approved_No__c, CampaignStatus__c
                                    from Campaign 
                                    where MeetingApprovedNo__c in: camList];
                                    where MeetingApprovedNo__c in: camList and CampaignStatus__c = '会议结束'];
                if (camNoList != null && camNoList.size() > 0) {
                    List<String> cam_ids = new List<String>();
                    for(Campaign cam : camNoList) {
                        cam_ids.add(cam.id);
                        for (Result_for_Conference_Adjudication__c rca : rcaList) {
                            if (cam.Meeting_Approved_No__c == rca.Application_for_Conference_Adjudication__c) {
                                // 更新会议日程
                                cam.Meeting_Report__c = rca.Id;
                                cam.Society_Hold_Place__c = rca.SocietyHoldPlace__c;
                                cam.Competitor__c = rca.Competitor__c;
                                // 更新报告日期和状态
                                cam.Report_approved_day__c = Date.today();
                                cam.Approved_day__c = Date.today();
@@ -154,6 +157,16 @@
                        }
                    }
                    update camNoList;
                    // 更新OPD计划
                    List<OPDPlan__c> opdlist = [select id,status__c from OPDPlan__c WHERE OPDType__c = '学会' and status__c != '完毕' and Campaign__c in: cam_ids];
                    //将OPD计划的状态更新为 完毕
                    if (opdlist != null && opdlist.size() > 0) {
                        for (OPDPlan__c opdc : opdlist) {
                            opdc.Status__c= '完毕';
                        }
                        update opdlist;
                    }
                }
            }
            logstr += '\nend';
force-app/main/default/classes/NFMUtil.cls
@@ -175,6 +175,9 @@
            NFM621_ENDPOINT = 'https://wdp.olympus.com.cn:44302/RESTAdapter/NFM621';
            NFM622_ENDPOINT = 'https://api-platform.olympuschina.com/prod-api/api/sso/sfdc_activitydata';
            //样本管理
            NFM115_ENDPOINT = 'https://wdp.olympus.com.cn:44302/RESTAdapter/NFM115';
            // 新服务系统
            AWS_DOMAIN = 'https://svc-elb.olympuschina.com';
@@ -1150,8 +1153,6 @@
        system.debug('resb:' + resb);
        return resb;
    }
    //发送给共通平台 精琢技术 thh 2021-09-22 end
    
    public static Integer ControllerUtil() {
force-app/main/default/classes/NewQuoteEntryController.cls
@@ -11,6 +11,8 @@
  //public Id qlistId { get; set; }
  //lastbuy  2022/2/9 fy start
  public Boolean filg { get; set; }
  public Integer flglastbuy { get; set; }
  public String errorProductmodel { get; set; }
  //lastbuy  2022/2/9 fy end
  public String excel_text { get; set; }
@@ -406,6 +408,8 @@
         ,PricebookEntry.Product2.Intra_Trade_Foreign_RMB__c
         //NoDiscount 金额(USD)
         ,PricebookEntry.Product2.NoDiscount_Foreign__c 
         //fy 预留产品标识
         ,PricebookEntry.Product2.LastbuyProductFLG__c
         ,Quote.Opportunity.Trade__c 
         //外贸多年保 2021/01/04 精琢技术 wql end
@@ -902,6 +906,8 @@
                               //外贸多年保 2021/01/04 精琢技术 wql start
                               //维修合同报价(USD)
                               ,Repair_Contract_USD__c
                               //fy 预留产品标识
                               ,LastbuyProductFLG__c
                               //计提金额(不含税,USD)
                               ,Intra_Trade_Foreign_RMB__c
                               //NoDiscount 金额(USD)
@@ -1781,9 +1787,20 @@
      errormessage = null;
      //20220214 fy lastbuy start 
      if(!ReservedProductVerification()){
        errorflg = true;
        errormessage =  '产品数量不可超过产品预留数量' ;
        return null;
        system.debug('flglastbuy++++'+flglastbuy);
        if(flglastbuy==1){
          errorflg = true;
          errormessage =  '预留产品表中没有录入该报价的预留产品' ;
          return null;
        }else if(flglastbuy==2){
          errorflg = true;
          errormessage =  errorProductmodel+'产品数量不可超过产品预留数量' ;
          return null;
        }else if(flglastbuy==3){
          errorflg = true;
          errormessage =  '预留产品'+errorProductmodel+'未录入预留产品表';
          return null;
        }
      }
      //20220214 fy lastbuy end
      // 2022-01-12 ssm 报价计算check
@@ -2084,7 +2101,9 @@
      // ここを修正したら、NFM007.triggerも要確認
      prd2LatestValMap = new Map<Id, Product2>();
      integer cntPrd2 = 0;
      for (Product2 prd2 : [Select Id, Estimation_Entry_Possibility__c, SFDA_Status__c, Packing_list_manual__c
      for (Product2 prd2 : [Select Id, Estimation_Entry_Possibility__c, SFDA_Status__c, Packing_list_manual__c,
      //fy 预留产品标识
      LastbuyProductFLG__c
                            From Product2 Where Id IN :product2Ids]) {
        cntPrd2 = cntPrd2   +   1;
        if (prd2.Estimation_Entry_Possibility__c != '○') {
@@ -3122,31 +3141,82 @@
  }
  //lastbuy  2022/2/9 fy start
  public boolean ReservedProductVerification() {
    filg=true;
    Map<string,QuoteLineItem> quotlinitMap = new Map<string,QuoteLineItem>();
    List<Id> lastProductFLGList = new List<Id>();
    for(QELine qli : activities){
      lastProductFLGList.add(qli.pageObject.PricebookEntry.Product2Id);
      quotlinitMap.put(qli.pageObject.PricebookEntry.Product2Id,qli.pageObject);
    List<Id> lastProductFLGListId = new List<Id>();
    List<QuoteLineItem> lastProductFLGList = new List<QuoteLineItem>();
    List<QuoteLineItem> act = new List<QuoteLineItem>();
    List<QuoteLineItem> act2 = new List<QuoteLineItem>();
    for(QELine aaa :activities){
      if(aaa.pageObject.PricebookEntry.Product2Id!=null){
        act.add(aaa.pageObject);
      }
    }
    System.debug('activities!!!'+activities);
    act2=act.deepClone();
    Map<String,QuoteLineItem> map1 = new Map<String,QuoteLineItem>();
    System.debug('activities1111111111112为所当为多多!!!'+activities);
    integer i =0;
    for(QuoteLineItem pspsc :act2){
      if(pspsc.PricebookEntry.Product2Id!=null){
        if(map1.containsKey(pspsc.PricebookEntry.Product2Id)){
          QuoteLineItem quoteLine = map1.get(pspsc.PricebookEntry.Product2Id);
          quoteLine.Quantity__c =quoteLine.Quantity__c+pspsc.Quantity__c;
          map1.put(pspsc.PricebookEntry.Product2Id,quoteLine);
        }else{
          map1.put(pspsc.PricebookEntry.Product2Id,pspsc);
        }
        System.debug('34499879!!!'+activities);
      }
    }
    System.debug('3434343!!!'+activities);
    System.debug('5656565!!!'+map1);
    for (QuoteLineItem value : map1.values()) {
      if(value.PricebookEntry.Product2.LastbuyProductFLG__c){
        lastProductFLGListId.add(value.PricebookEntry.Product2Id);
        quotlinitMap.put(value.PricebookEntry.Product2Id,value);
        lastProductFLGList.add(value);
      }
    }
    System.debug('activities++++!!!'+activities);
    System.debug('activities!!!'+map1.values());
    System.debug('oppId!!!'+oppId);
    System.debug('lastProductFLGList!!!'+lastProductFLGList);
    if(lastProductFLGList!=null){
        List<LastbuyProduct__c> LastbuyObjList=[select id,LastbuyQuantity__c,InquiryCode__c,ProductName__c,effectiveFLG__c from LastbuyProduct__c where InquiryCode__c= : oppId and ProductName__c in :lastProductFLGList and effectiveFLG__c = true];
        if(LastbuyObjList!=null){
            for(LastbuyProduct__c lastbuypr :LastbuyObjList){
              Decimal quoteLItemNum=0;
              if(quotlinitMap.containsKey(lastbuypr.ProductName__c)){
                  quoteLItemNum=quotlinitMap.get(lastbuypr.ProductName__c).Quantity__c;
              }else{
                  continue;
              }
              if(lastbuypr.LastbuyQuantity__c<quoteLItemNum){
                filg=false;
                break;
              }
    System.debug('lastProductFLGList!!!'+lastProductFLGListId);
    if(lastProductFLGListId!=null&&lastProductFLGListId.size()!=0){
        List<LastbuyProduct__c> LastbuyObjList=[select id,LastbuyQuantity__c,InquiryCode__c,ProductName__c,effectiveFLG__c from LastbuyProduct__c where InquiryCode__c= : oppId and ProductName__c in :lastProductFLGListId and effectiveFLG__c = true];
        Map<string,LastbuyProduct__c> LastbuyObjMap = new Map<string,LastbuyProduct__c>();
        System.debug('LastbuyObjList+++++!!!'+LastbuyObjList);
        if(LastbuyObjList!=null&&LastbuyObjList.size()!=0){
          for(LastbuyProduct__c lastbuypr :LastbuyObjList){
            LastbuyObjMap.put(lastbuypr.ProductName__c,lastbuypr);
          }
        }else{
          flglastbuy=1;
          filg=false;
          return filg;
        }
        System.debug('LastbuyObjMap!!!'+LastbuyObjMap);
        System.debug('lastProductFLGList+++++++!!!'+lastProductFLGList);
        if(lastProductFLGList!=null&&lastProductFLGList.size()!=0){
          for(QuoteLineItem lastbuypr :lastProductFLGList){
            Decimal quoteLItemNum=0;
            if(LastbuyObjMap.containsKey(lastbuypr.PricebookEntry.Product2Id)){
                quoteLItemNum=LastbuyObjMap.get(lastbuypr.PricebookEntry.Product2Id).LastbuyQuantity__c;
                System.debug('quoteLItemNum!!!'+quoteLItemNum);
                System.debug('lastbuypr.pageObject.Quantity__c+++!!!'+lastbuypr.Quantity__c);
                if(lastbuypr.Quantity__c>quoteLItemNum){
                  errorProductmodel=lastbuypr.Asset_Model_No__c;
                  flglastbuy=2;
                  filg=false;
                  break;
                }
            }else{
              errorProductmodel=lastbuypr.Asset_Model_No__c;
              flglastbuy=3;
              filg=false;
              break;
            }
          }
        }
    }
    system.debug('filg====='+filg);
force-app/main/default/classes/NewQuoteIraiController.cls
@@ -8,6 +8,12 @@
    public Boolean productStatusUpdated {get;set;}               // 状態更新、{!$Label.Status_Update} を押下したかどうか
    public Boolean changedAfterPrint {get;set;}                  // true の場合、画面に confirm メッセージが表示します。quoIdを新しいinsert。判定はjsにて実施
    //lastbuy  2022/3/10 fy start
    public Boolean filg { get; set; }
    public Integer flglastbuy { get; set; }
    public String errorProductmodel { get; set; }
    //lastbuy  2022/3/10 fy end
    public String excel_text {get;set;}
    public Integer select_index {get;set;}                       // excelImport専用ですが、jsにて制御することになるので、TODO katsu 削除予定
    public String Product_text {get;set;}
@@ -1160,6 +1166,23 @@
    }
    public boolean dataCheck(){
         //20220310 fy lastbuy start
      if(!ReservedProductVerification()){
        if(flglastbuy==1){
          errorflg = true;
          errormessage =  '预留产品表中没有录入该报价的预留产品' ;
          return false;
        }else if(flglastbuy==2){
          errorflg = true;
          errormessage =  errorProductmodel+'产品数量不可超过产品预留数量' ;
          return false;
        }else if(flglastbuy==3){
          errorflg = true;
          errormessage =  '预留产品'+errorProductmodel+'未录入预留产品表';
          return false;
        }
      }
      //20220310 fy lastbuy end
        system.debug('○○○○○○○○○○○○Welcome to dataCheck class!!○○○○○○○○○○○○');
        errorflg = false;
        errormessage = null;
@@ -1399,6 +1422,92 @@
        return true;
    }
     //lastbuy  2022/3/10 fy start
  public boolean ReservedProductVerification() {
    filg=true;
    Map<string,QuoteIraiLineItem__c> quotlinitMap = new Map<string,QuoteIraiLineItem__c>();
    List<Id> lastProductFLGListId = new List<Id>();
    List<QuoteIraiLineItem__c> lastProductFLGList = new List<QuoteIraiLineItem__c>();
    List<QuoteIraiLineItem__c> act = new List<QuoteIraiLineItem__c>();
    List<QuoteIraiLineItem__c> act2 = new List<QuoteIraiLineItem__c>();
    for(QELine aaa :activities){
      if(aaa.pageObject.Product2__c!=null&&aaa.pageObject.Quantity__c!=null){
        act.add(aaa.pageObject);
      }
    }
    act2=act.deepClone();
    Map<String,QuoteIraiLineItem__c> map1 = new Map<String,QuoteIraiLineItem__c>();
    System.debug('activities1111111111112为所当为多多!!!'+activities);
    integer i =0;
    for(QuoteIraiLineItem__c pspsc :act2){
      if(pspsc.Product2__c!=null&&pspsc.Quantity__c!=null){
        if(map1.containsKey(pspsc.Product2__c)){
            QuoteIraiLineItem__c quoteLine = map1.get(pspsc.Product2__c);
          quoteLine.Quantity__c =quoteLine.Quantity__c+pspsc.Quantity__c;
          map1.put(pspsc.Product2__c,quoteLine);
          System.debug('2222222!!!'+quoteLine);
        }else{
          map1.put(pspsc.Product2__c,pspsc);
        }
        System.debug('5555555!!!'+pspsc);
        System.debug('34499879!!!'+activities);
      }
    }
    System.debug('3434343!!!'+activities);
    System.debug('5656565!!!'+map1);
    for (QuoteIraiLineItem__c value : map1.values()) {
      if(value.Product2__r.LastbuyProductFLG__c){
        lastProductFLGListId.add(value.Product2__c);
        quotlinitMap.put(value.Product2__c,value);
        lastProductFLGList.add(value);
      }
    }
    System.debug('activities++++!!!'+activities);
    System.debug('activities!!!'+map1.values());
    System.debug('oppId!!!'+oppId);
    System.debug('lastProductFLGList!!!'+lastProductFLGListId);
    if(lastProductFLGListId!=null&&lastProductFLGListId.size()!=0){
        List<LastbuyProduct__c> LastbuyObjList=[select id,LastbuyQuantity__c,InquiryCode__c,ProductName__c,effectiveFLG__c from LastbuyProduct__c where InquiryCode__c= : oppId and ProductName__c in :lastProductFLGListId and effectiveFLG__c = true];
        Map<string,LastbuyProduct__c> LastbuyObjMap = new Map<string,LastbuyProduct__c>();
        System.debug('LastbuyObjList+++++!!!'+LastbuyObjList);
        if(LastbuyObjList!=null&&LastbuyObjList.size()!=0){
          for(LastbuyProduct__c lastbuypr :LastbuyObjList){
            LastbuyObjMap.put(lastbuypr.ProductName__c,lastbuypr);
          }
        }else{
          flglastbuy=1;
          filg=false;
          return filg;
        }
        System.debug('LastbuyObjMap!!!'+LastbuyObjMap);
        System.debug('lastProductFLGList+++++++!!!'+lastProductFLGList);
        if(lastProductFLGList!=null&&lastProductFLGList.size()!=0){
          for(QuoteIraiLineItem__c lastbuypr :lastProductFLGList){
            Decimal quoteLItemNum=0;
            if(LastbuyObjMap.containsKey(lastbuypr.Product2__c)){
                quoteLItemNum=LastbuyObjMap.get(lastbuypr.Product2__c).LastbuyQuantity__c;
                System.debug('quoteLItemNum!!!'+quoteLItemNum);
                System.debug('lastbuypr.pageObject.Quantity__c+++!!!'+lastbuypr.Quantity__c);
                if(lastbuypr.Quantity__c>quoteLItemNum){
                  errorProductmodel=lastbuypr.Asset_Model_No__c;
                  flglastbuy=2;
                  filg=false;
                  break;
                }
            }else{
              errorProductmodel=lastbuypr.Asset_Model_No__c;
              flglastbuy=3;
              filg=false;
              break;
            }
          }
        }
    }
    system.debug('filg====='+filg);
    return filg;
  }
    // CHAN-BJQ4VZ 精琢技术 2019/12/11 Start
    public class QuoteBean {
    // 产品标准定价总额
force-app/main/default/classes/OFSCalendarController.cls
@@ -17,7 +17,7 @@
    static {
        at2CnMap = new Map<String, String>();
        at2CnMap.put('病院', '用户拜访');
        at2CnMap.put('販売店', '经销商拜访');
        at2CnMap.put('販売店', '经销商支持');
        at2CnMap.put('社内活動', '公司工作');
        at2CnMap.put('社外イベント', '社外会议');
        at2CnMap.put('移動', '移动');
@@ -388,7 +388,7 @@
        private String at2Css(String at2) {
            String at2Css = 'fc-event';     // default
            if (at2 == '用户拜访') { at2Css = 'fc-eventH'; }
            else if (at2 == '经销商拜访') { at2Css = 'fc-eventA'; }
            else if (at2 == '经销商支持') { at2Css = 'fc-eventA'; }
            else if (at2 == '公司工作') { at2Css = 'fc-eventI'; }
            else if (at2 == '社外会议') { at2Css = 'fc-eventC'; }
            else if (at2 == '移动') { at2Css = 'fc-eventM'; }
force-app/main/default/classes/OrderListHandlerTest.cls
@@ -2,7 +2,7 @@
private class OrderListHandlerTest {
    static testMethod void testMethod1(){
        Sample_order_list__c sorl = new Sample_order_list__c();
        sorl.Name = '123';
        // sorl.Name = '123';
        sorl.Status__c = '暂存';
        insert sorl;
        sorl.Status__c = '订单已发送';
@@ -11,7 +11,7 @@
    static testMethod void testMethod2(){
        Sample_order_list__c sorl = new Sample_order_list__c();
        sorl.Name = '123';
        // sorl.Name = '123';
        sorl.Status__c = '订单已发送';
        insert sorl;
    }
force-app/main/default/classes/OrdergoodsControllerTest.cls
@@ -7,6 +7,10 @@
        if (rectCo.size() == 0) {
            throw new ControllerUtil.myException('not found 办事处 recodetype');
        }
        Account account2 = new Account();
        account2.Name = 'test1经销商';
        account2.RecordTypeId = '01210000000Qem1';
        insert account2;
        // 客户
        Account account = new Account();
        account.RecordTypeId = rectCo[0].Id;
@@ -14,6 +18,7 @@
        account.Name = 'Katsu テスト';
        account.Quolified_Approve_Status__c = 'Draft';
        account.If_Need_Quolified__c = true;
        account.ParentId = account2.Id;
        insert account;
        Product2 product = new Product2();
@@ -147,12 +152,17 @@
            throw new ControllerUtil.myException('not found 办事处 recodetype');
        }
        // 客户
        Account account2 = new Account();
        account2.Name = 'test1经销商';
        account2.RecordTypeId = '01210000000Qem1';
        insert account2;
        Account account = new Account();
        account.RecordTypeId = rectCo[0].Id;
        account.Phone = '13888888888';
        account.Name = 'Katsu テスト';
        account.Quolified_Approve_Status__c = 'Draft';
        account.If_Need_Quolified__c = true;
        account.ParentId = account2.Id;
        insert account;
        //查不出任何样本品,SFDA_Status__c会被触发器修改为停止
        Product2 product = new Product2();
force-app/main/default/classes/PersonalCalendarController.cls
@@ -19,7 +19,7 @@
    static {
        at2CnMap = new Map<String, String>();
        at2CnMap.put('病院', '用户拜访');
        at2CnMap.put('販売店', '经销商拜访');
        at2CnMap.put('販売店', '经销商支持');
        at2CnMap.put('社内活動', '公司工作');
        at2CnMap.put('社外イベント', '社外会议');
        at2CnMap.put('移動', '移动');
@@ -708,7 +708,7 @@
        private String at2Css(String at2) {
            String at2Css = 'fc-event';     // default
            if (at2 == '用户拜访') { at2Css = 'fc-eventH'; }
            else if (at2 == '经销商拜访') { at2Css = 'fc-eventA'; }
            else if (at2 == '经销商支持') { at2Css = 'fc-eventA'; }
            else if (at2 == '公司工作') { at2Css = 'fc-eventI'; }
            else if (at2 == '社外会议') { at2Css = 'fc-eventC'; }
            else if (at2 == '移动') { at2Css = 'fc-eventM'; }
force-app/main/default/classes/QuotePDFExtensionController.cls
@@ -377,7 +377,7 @@
                                           , Quote.Opportunity.DecideQuoteDate__c, Quote.Opportunity.Estimation_Decision__c
                                           // Gzw 多年保修 End
                                           //lt 20220223 CHAN-CBW9FX 特殊交货期影响的对应  start
                                           ,PricebookEntry.Product2.DeliveryDate__c
                                           ,DeliveryDate__c
                                           //lt 20220223 CHAN-CBW9FX 特殊交货期影响的对应  end
                                      FROM QuoteLineItem
                                     WHERE QuoteId = :nowId
force-app/main/default/classes/RentalApplyEquipmentSetDetailHandler.cls
@@ -2879,6 +2879,13 @@
    protected override void beforeUpdate() {
        if(!disabled){
            beforeSetValue();
            // 不太确定此处理会对其他处理有什么影响,防止生产环境发生问题,用此标签控制
            // 等确认没问题后,在删除(Todo)
            if (System.Label.Set_Queue_UniqueKey == 'TRUE') {
                // 设值排队的UniqueKey
                setUniqueKeyQueue();
            }
        }
    }
    protected override void afterInsert() {
@@ -4602,6 +4609,30 @@
    }
    private void setUniqueKeyQueue(){
        Map<Id, Rental_Apply_Equipment_Set_Detail__c> olddetailMap = (Map<Id, Rental_Apply_Equipment_Set_Detail__c>) Trigger.oldMap;
        for(Rental_Apply_Equipment_Set_Detail__c newdetail : (List<Rental_Apply_Equipment_Set_Detail__c>)trigger.new){
            Rental_Apply_Equipment_Set_Detail__c olddetail = olddetailMap.get(newdetail.Id);
            if((olddetail.Queue_Number__c > 0  && newdetail.Queue_Number__c == 0)// 暂定分配
                || (!olddetail.Cancel_Select__c && newdetail.Cancel_Select__c && olddetail.Queue_Number__c > 0)  //取消(排队中,暂定分配)
                || (olddetail.Queue_Number__c > 0  && newdetail.Queue_Number__c == null )//分单
                ){
                // 清空排队的UniqueKey
                newdetail.UniqueKey_Queue__c = null;
            }
            // 重排或者排队No变化时更新
            if (!newdetail.Cancel_Select__c && newdetail.Queue_Number__c > 0 && newdetail.ExternalKey__c != null
                && (newdetail.Queue_Number__c != olddetail.Queue_Number__c
                    || newdetail.ExternalKey__c != olddetail.ExternalKey__c)) {
                // 排队的UniqueKey设值
                newdetail.UniqueKey_Queue__c = newdetail.ExternalKey__c + ':' + newdetail.Queue_Number__c;
            }
        }
    }
    /*
    private void reQueueNumber() {
        Map<String, List<Rental_Apply_Equipment_Set_Detail__c>> queueRaesdMap = new Map<String, List<Rental_Apply_Equipment_Set_Detail__c>>();
force-app/main/default/classes/RentalApplySplitController.cls
@@ -565,8 +565,8 @@
                cloneOPD.Status__c = '计划中';
                FixtureUtil.withoutInsert(new OPDPlan__c[]{cloneOPD});
                cloneRas.OPDPlan__c = cloneOPD.Id;
                cloneRas.ApprovedNo_Create__c = cloneOPD.Approved_No__c; // 20220218 ljh add 决裁
                cloneRas.Approved_State_Create__c = cloneOPD.Approved_Status__c; // 20220218 ljh add 决裁
                // cloneRas.ApprovedNo_Create__c = cloneOPD.Approved_No__c; // 20220218 ljh add 决裁
                // cloneRas.Approved_State_Create__c = cloneOPD.Approved_Status__c; // 20220218 ljh add 决裁
                // List<Plan_Rental_Equipment__c> inPreList = new List<Plan_Rental_Equipment__c>();
                // for(Plan_Rental_Equipment__c pre0 : [SELECT Id, Campaign__c,Event_ID__c,RecordTypeId,Name,Rental_Equipment__c,Rental_Quantity__c FROM Plan_Rental_Equipment__c WHERE OPD_Plan__c = :opdList[0].Id]){
                //     Plan_Rental_Equipment__c pre = new Plan_Rental_Equipment__c();
@@ -734,6 +734,8 @@
                    Post_Code__c,                    // 邮编
                    ApprovedNo_Delivery__c,          // 决裁编号(发货时) 20220224 ljh add
                    Approved_State_Delivery__c,      // 决裁状态(发货时)20220224 ljh add 
                    ApprovedNo_Create__c,            // 决裁编号(创建时) 20220301 ljh add
                    Approved_State_Create__c,        // 决裁状态(创建时) 20220301 ljh add
                    Response__c,                     // 应答沟通
                    Request_demo_time__c,            // 申请时间
                    Request_approval_time__c,        // 批准时间(申请提交时间)
force-app/main/default/classes/RentalApplyWebService.cls
@@ -411,6 +411,7 @@
            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';
@@ -1158,7 +1159,7 @@
//    }
    // 分配验证
    Webservice static String AssignBtn(String Rid){
        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   from Rental_Apply__c where id = :Rid];
        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   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];
@@ -1180,6 +1181,9 @@
           }else if(Ra.demo_purpose2__c=='索赔QIS' && Ra.next_action__c=='无偿更换' && Ra.QIS_number__r.ReplaceDeliveryDate__c!= null){
                return '索赔QIS目的,QIS已有新品发货日,不可分配';
           }//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{
                return 'Fin';
            } 
@@ -1613,6 +1617,9 @@
                //应该不会到这里
                return '没有可以出库指示的一览';
            }
        }
        String soql = 'SELECT Id'
                + ' FROM Rental_Apply_Equipment_Set__c '
force-app/main/default/classes/RentalFixtureSetAssignAgencyControTest.cls
@@ -74,7 +74,7 @@
        // 产品
        Product2 pro1 = new Product2(Name='name01',IsActive=true,Family='GI',
                Fixture_Model_No__c='n01',Serial_Lot_No__c='S/N tracing',
                Fixture_Model_No__c='modlen01',Serial_Lot_No__c='S/N tracing',
                Fixture_Model_No_T__c = 'n01', Asset_Model_No__c = 'Pro1',
                ProductCode_Ext__c='pc01',Manual_Entry__c=false);
        Product2 pro2 = new Product2(Name='name02',IsActive=true,Family='GI',
@@ -188,7 +188,7 @@
        Fixture_Set__c fsObj1 = new Fixture_Set__c();
        //fsObj1.Name = 'set1';
        fsObj1.Name = 'n01';
        fsObj1.Fixture_Set_Body_Model_No__c = 'n01';
        fsObj1.Fixture_Set_Body_Model_No__c = 'modlen01';
        fsObj1.Loaner_name__c = 'name1';
        insert fsObj1;
@@ -367,7 +367,29 @@
            raesdObj3.Product_category_text__c = 'GI';
            raesdObj3.Equipment_Type_text__c = '产品试用';
            raesdObj3.Cancel_Select__c=false;
            insert new Rental_Apply_Equipment_Set_Detail__c[] {raesdObj1,raesdObj2,raesdObj3};
            Rental_Apply_Equipment_Set_Detail__c raesdObj4 = new Rental_Apply_Equipment_Set_Detail__c();
            raesdObj4.Rental_Apply__c = raObj.Id;        //raesdObj3.Asset__c = asset3.Id;
            raesdObj4.Fixture_Set_Detail__c = fsdObjA3.Id;
            raesdObj4.Rental_Num__c = 1;
            raesdObj4.Queue_Number__c = null;
            raesdObj4.Is_Body__c = false;
            raesdObj4.Rental_Apply_Equipment_Set__c = raesObj.Id;
            raesdObj4.IndexFromUniqueKey__c = 4;
            raesdObj4.UniqueKey__c = '1:'+ raesObj.Id + ':' + fsdObjA3.Id + ':4';
            raesdObj4.FSD_OneToOneAccessory_Cnt__c = 2;
            raesdObj4.FSD_Is_Optional__c = false;
            raesdObj4.FSD_Is_OneToOne__c = false;
            raesdObj4.ApplyPersonAppended__c = false;
            raesdObj4.FSD_Fixture_Model_No__c = 'n04';
            raesdObj4.Fixture_Model_No_text__c = 'n04';
            raesdObj4.Salesdepartment_before__c = '1.华北营业本部';
            raesdObj4.Internal_asset_location_before__c = '北京 备品中心';
            raesdObj4.Product_category_text__c = 'GI';
            raesdObj4.Equipment_Type_text__c = '产品试用';
            raesdObj4.Cancel_Select__c=true;
            raesdObj4.Cancel_Reason__c= '主动取消';
            insert new Rental_Apply_Equipment_Set_Detail__c[] {raesdObj1,raesdObj2,raesdObj3,raesdObj4};
            // 申请单变为已批准
            raObj.Status__c = '已批准';
@@ -458,6 +480,33 @@
        System.assertEquals(false, controller.done_flg);
        System.debug('init Success');
    }
    @isTest
    public static void test_cancelSet3() {
        List<Rental_Apply__c> esList = [SELECT Id FROM Rental_Apply__c];
        PageReference ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id);
        Test.setCurrentPage(ref);
        RentalFixtureSetAssignAgencyController controller = new RentalFixtureSetAssignAgencyController();
        Test.startTest();
        controller.init();
        controller.esdList[0].checked = false;
        // 20210916 ljh update start
        // controller.cancelReason = '主动取消';
        // controller.cancelReasonRemark = 'aaaa';
        controller.parentObj.Cancel_Reason__c = '主动取消';
        controller.parentObj.Loaner_cancel_reason__c = '重复申请';
        // 20210916 ljh update end
        controller.cancelSet();
        Test.stopTest();
        //System.assertEquals(true, controller.done_flg);
        //System.debug('init Success');
    }
@@ -621,95 +670,11 @@
        System.debug('init Success');
    }
     //20210521 ljh add 1829 start
    @isTest
    public static void test_assignSub() {
     @isTest
    public static void test_assign() {
        changeData();
        List<Rental_Apply__c> esList = [SELECT Id FROM Rental_Apply__c];
        PageReference ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id);
        Test.setCurrentPage(ref);
        RentalFixtureSetAssignAgencyController controller = new RentalFixtureSetAssignAgencyController();
        Test.startTest();
        controller.init();
        // 第一次分配
        controller.esdList[0].checked = true;
        controller.parentObj.Asset_loaner_start_day__c = Date.today()+1;//20210513 ljh update
        controller.applyDate();
        controller.stepName = '分配';
        controller.qrcode = '511100000;2;'+controller.esdList[0].rec.Rental_Apply_Equipment_Set__c;
        controller.scanAndMatch();
        controller.assign();
        // controller.stepName = '下架';
        // controller.esdList[0].checked = true;
        // controller.stockDown();// 20210624 ljh update SFDC-C448GR
        ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id);
        controller = new RentalFixtureSetAssignAgencyController();
        // 下架后重新分配
        controller.init();
        controller.stepName = '分配';
        controller.esdList[0].checked = true;
        controller.qrcode = '51110001;2;'+controller.esdList[0].rec.Rental_Apply_Equipment_Set__c;
        controller.scanAndMatch();
        controller.assign();
        Test.stopTest();
        //System.assertEquals(true, controller.done_flg);
        System.debug('init Success');
    }
     @isTest
    public static void test_assignSub3() {
        List<Rental_Apply__c> esList = [SELECT Id FROM Rental_Apply__c];
        PageReference ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id);
        Test.setCurrentPage(ref);
        RentalFixtureSetAssignAgencyController controller = new RentalFixtureSetAssignAgencyController();
        Test.startTest();
        controller.init();
        // 第一次分配
        controller.esdList[0].checked = true;
        controller.parentObj.Asset_loaner_start_day__c = Date.today()+1;//20210513 ljh update
        controller.applyDate();
        controller.stepName = '分配';
        controller.qrcode = '511100000;2;'+controller.esdList[1].rec.Rental_Apply_Equipment_Set__c;
        controller.scanAndMatch();
        controller.assign();
        // controller.stepName = '下架';
        // controller.esdList[0].checked = true;
        // controller.stockDown();// 20210624 ljh update SFDC-C448GR
        ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id);
        controller = new RentalFixtureSetAssignAgencyController();
        // 下架后重新分配
        controller.init();
        controller.stepName = '分配';
        controller.esdList[0].checked = true;
        controller.qrcode = '51110001;2;'+controller.esdList[2].rec.Rental_Apply_Equipment_Set__c;
        controller.scanAndMatch();
        controller.assign();
        Test.stopTest();
        //System.assertEquals(true, controller.done_flg);
        System.debug('init Success');
    }
    @isTest
    public static void test_assign() {
        List<Rental_Apply__c> esList = [SELECT Id FROM Rental_Apply__c];
        PageReference ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id);
@@ -752,6 +717,156 @@
        System.debug('init Success');
    }
     //20210521 ljh add 1829 start
    @isTest
    public static void test_assignSub() {
        List<Rental_Apply__c> esList = [SELECT Id FROM Rental_Apply__c];
        PageReference ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id);
        Test.setCurrentPage(ref);
        List<Rental_Apply_Equipment_Set__c> raesone=[select Id from Rental_Apply_Equipment_Set__c];
        RentalFixtureSetAssignAgencyController controller = new RentalFixtureSetAssignAgencyController();
        Test.startTest();
        controller.init();
        // 第一次分配
        controller.esdList[0].checked = true;
        controller.parentObj.Asset_loaner_start_day__c = Date.today()+1;//20210513 ljh update
        controller.applyDate();
        controller.stepName = '分配';
        controller.qrcode = '511100000;2;'+controller.esdList[1].rec.Rental_Apply_Equipment_Set__c;
        //controller.qrcode = '511100000;2;'+raesone[0].Id;
        controller.scanAndMatch();
        controller.assign();
        // controller.stepName = '下架';
        // controller.esdList[0].checked = true;
        // controller.stockDown();// 20210624 ljh update SFDC-C448GR
        ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id);
        controller = new RentalFixtureSetAssignAgencyController();
        // 下架后重新分配
        controller.init();
        controller.stepName = '分配';
        controller.esdList[0].checked = false;
        //controller.qrcode = '511100000;2;'+controller.esdList[0].rec.Rental_Apply_Equipment_Set__c;
        controller.qrcode = '511100000;2;'+raesone[0].Id;
        controller.scanAndMatch();
        controller.assign();
        Test.stopTest();
        //System.assertEquals(true, controller.done_flg);
        System.debug('init Success');
    }
  @isTest
    public static void test_assignSub03() {
        List<Rental_Apply__c> esList = [SELECT Id FROM Rental_Apply__c];
        PageReference ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id);
        Test.setCurrentPage(ref);
        RentalFixtureSetAssignAgencyController controller = new RentalFixtureSetAssignAgencyController();
        Test.startTest();
        controller.init();
        // 第一次分配
        controller.esdList[0].checked = true;
        controller.parentObj.Asset_loaner_start_day__c = Date.today()+1;//20210513 ljh update
        controller.applyDate();
        controller.stepName = '分配';
        controller.qrcode = '511100000;2;'+controller.esdList[0].rec.Rental_Apply_Equipment_Set__c;
        controller.scanAndMatch();
        controller.assign();
        // controller.stepName = '下架';
        // controller.esdList[0].checked = true;
        // controller.stockDown();// 20210624 ljh update SFDC-C448GR
        ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id);
        Test.setCurrentPage(ref);
        controller = new RentalFixtureSetAssignAgencyController();
        // 下架后重新分配
        controller.init();
        controller.stepName = '分配';
        controller.esdList[0].checked = true;
        controller.qrcode = '51110001;2;'+controller.esdList[0].rec.Rental_Apply_Equipment_Set__c;
        List<Asset> mainAssetList = [
                SELECT Id
                     , Fixture_Model_No_F__c
                     , Internal_asset_location__c
                     , SerialNumber
                     , Salesdepartment__c
                     , SalesProvince__c
                     , Product_category__c
                     , Equipment_Type__c
                     , Internal_Asset_number_key__c
                  FROM Asset
                 WHERE Fixture_QRCode__c ='51110001'
                   //AND Main_OneToOne__c = true //20210508 ljh add 1834
                   AND You_Xiao_Ku_Cun__c > 0
                 LIMIT 1
        ];
        List<Product2> pro2l=[select id from Product2 where  Fixture_Model_No_T__c != 'n01'];
        mainAssetList[0].Product2=pro2l[0];
        update mainAssetList;
        controller.scanAndMatch();
        controller.assign();
        Test.stopTest();
        //System.assertEquals(true, controller.done_flg);
        System.debug('init Success');
    }
     @isTest
    public static void test_assignSub04() {
        List<Rental_Apply__c> esList = [SELECT Id FROM Rental_Apply__c];
        PageReference ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id);
        Test.setCurrentPage(ref);
        List<Rental_Apply_Equipment_Set__c> raesone=[select Id from Rental_Apply_Equipment_Set__c];
        RentalFixtureSetAssignAgencyController controller = new RentalFixtureSetAssignAgencyController();
        Test.startTest();
        controller.init();
        // 第一次分配
        controller.esdList[0].checked = true;
        controller.parentObj.Asset_loaner_start_day__c = Date.today()+1;//20210513 ljh update
        controller.applyDate();
        controller.stepName = '分配';
        controller.qrcode = '511100000;2;'+controller.esdList[1].rec.Rental_Apply_Equipment_Set__c;
        //controller.qrcode = '511100000;2;'+raesone[0].Id;
        controller.scanAndMatch();
        controller.assign();
        ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id);
        controller = new RentalFixtureSetAssignAgencyController();
        // 下架后重新分配
        controller.init();
        controller.stepName = '分配';
        integer i=controller.esdList.size();
        for(integer j=0;i<i;j++){
            controller.esdList[j].checked = false;
        }
        //controller.qrcode = '511100000;2;'+controller.esdList[0].rec.Rental_Apply_Equipment_Set__c;
        controller.qrcode = '511100000;2;'+raesone[0].Id;
        controller.scanAndMatch();
        controller.assign();
        Test.stopTest();
        //System.assertEquals(true, controller.done_flg);
        System.debug('init Success');
    }
   
force-app/main/default/classes/RentalFixtureSetAssignAgencyController.cls
@@ -246,10 +246,11 @@
                     , Rental_Apply_Equipment_Set__r.Irreplaceable_flag__c //20210519 ljh add 1829 start
                     , Rental_Apply_Equipment_Set__r.canDelete__c //20210519 ljh add 1829 start
                     , Rental_Apply_Equipment_Set__r.Substitute_flag__c //20210526 ljh 1829 add
                     ,Rental_Apply_Equipment_Set__r.RAES_Status__c
                     ,Rental_Apply_Equipment_Set__r.Shippment_loaner_time2__c
                     ,Rental_Apply__r.Status__c
                     //20210519 ljh add 1829 end
                     , Rental_Apply_Equipment_Set__r.RAES_Status__c
                     , Rental_Apply_Equipment_Set__r.Shippment_loaner_time2__c
                     , Rental_Apply__r.Status__c //20210519 ljh add 1829 end
                     , Rental_Apply__r.Request_approval_time__c //20220309 SFDC-CC6CLJ phase5上线课题131 提交申请到备品出库时长
                     , Add_Request_approval_time__c //20220309 SFDC-CC6CLJ phase5上线课题131 提交申请到备品出库时长
                     , Rental_Num__c
                     , Rental_Start_Date__c
                     , Select_Time__c
@@ -432,6 +433,8 @@
            SELECT Campaign__c
                 , Repair__c
                 , Campaign__r.Status
                 ,Campaign__r.IF_Approved__c
                 ,Campaign__r.Meeting_Approved_No__c
                 // ,repair__r.Return_Without_Repair_Date__c
                 , Return_Without_Repair_Date_F__c
                 // , Repair__r.Repair_Final_Inspection_Date__c
@@ -477,6 +480,10 @@
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '索赔QIS目的,QIS已有新品发货日,不能继续了'));
                return false;
            }//1822 yc 20211108 end
            //20220225 sx add obpm 办事处增加判断:是否申请决裁勾着没有决裁编号不能进行操作
            else if(RaTar.Campaign__c != null && RaTar.Campaign__r.IF_Approved__c && RaTar.Campaign__r.Meeting_Approved_No__c == null){
                ApexPages.addMessage(new ApexPages.message(ApexPages.severity.Error, '已申请决裁但决裁编码为空'));
            }
        }
        return true;
    }
@@ -1214,7 +1221,6 @@
        }
        return true;
    }
    //20210519 ljh add 1829
    // 扫一扫按钮
    public void scanAndMatch() {
@@ -1708,6 +1714,8 @@
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '没有明细,不能发货!'));
                return;
            }
            Map<String,String> tes = new Map<String,String>();
            Map<String, List<Rental_Apply_Equipment_Set_Detail__c>> approvalMap = new Map<String, List<Rental_Apply_Equipment_Set_Detail__c>>();// 20220309 SFDC-CC6CLJ phase5上线课题131 提交申请到备品出库时长
            for(EsdInfo esd:esdList) {
                if(!raesdMap.containsKey(esd.rec.Id)) {
                    continue;
@@ -1764,7 +1772,17 @@
                    raesd.Inspection_result__c = 'OK';
                    // 发货前检测时间和检测人在trigger里设
                    raesd.Shippment_loaner_time__c = now;
                    // 20220309 SFDC-CC6CLJ phase5上线课题131 提交申请到备品出库时长 start
                    Datetime keyDt = raesd.Add_Request_approval_time__c != null?raesd.Add_Request_approval_time__c:raesd.Rental_Apply__r.Request_approval_time__c;
                    List<Rental_Apply_Equipment_Set_Detail__c> tempRaesdL;
                    if(approvalMap.containsKey(keyDt.format())){
                        tempRaesdL = approvalMap.get(keyDt.format());
                    }else{
                        tempRaesdL = new List<Rental_Apply_Equipment_Set_Detail__c>();
                    }
                    tempRaesdL.add(raesd);
                    approvalMap.put(keyDt.format(),tempRaesdL);
                    // 20220309 SFDC-CC6CLJ phase5上线课题131 提交申请到备品出库时长 end
                    updateRaesdList.add(raesd);
                }
                else {
force-app/main/default/classes/RentalFixtureSetAssignController.cls
@@ -296,6 +296,9 @@
            Rental_Apply__c raUpd = [
                    SELECT Id, Shipment_request_Cnt__c,
                           Asset_loaner_start_day__c,
                           // Campaign__c,
                           // Campaign__r.IF_Approved__c,
                           // Campaign__r.Meeting_Approved_No__c,
                           Asset_loaner_closed_day__c
                      FROM Rental_Apply__c
                     WHERE Id = :parentId
@@ -311,6 +314,11 @@
                }
            }
            //20220228 sx obpm修改 是否申请决裁勾着没有决裁编号不能进行操作
            // if( raUpd.Campaign__c!= null && raUpd.Campaign__r.IF_Approved__c && raUpd.Campaign__r.Meeting_Approved_No__c == null){
            //     throw new ControllerUtil.myException('已申请决裁但决裁编码为空');
            // }
            Integer indexNum = 1;
            // 20210708 ljh SFDC-C47CLV add start
            Set<Id> raeIdset = new Set<Id>();
@@ -322,6 +330,7 @@
                    raeIdset.add(robj.Id);    
                }
            }
            List<Rental_Apply_Equipment_Set__c> raeList = [SELECT Id, Name,Rental_Apply__c,Cancel_Select__c,LastModifiedDate FROM Rental_Apply_Equipment_Set__c where Id in :raeIdset];
            // 20210906  ljh SFDC-C6D9C2 add LastModifiedDate
            for(Rental_Apply_Equipment_Set__c rae:raeList){
@@ -344,6 +353,7 @@
                        hasError = true;
                        throw new ControllerUtil.myException('第' + indexNum +'行数据已被分割申请单,请刷新后重试!');
                    }
                    // 20210708 ljh update end
                    // 20210906  ljh SFDC-C6D9C2 add start
                    // 20210929 ljh SFDC-C6D9C2 注释 恢复改其他方案 start
@@ -1536,6 +1546,7 @@
        return result;
    }
    public static List<String> transferStringToList(String str){
        // System.debug(LoggingLevel.INFO, '*** str: ' + str);
        List<String> strList = new List<String>();
@@ -1544,6 +1555,11 @@
        }else{
            strList.add(str);
        }
        for(Integer i = strList.size()-1;i >= 0 ; i --){
            if(String.isEmpty(strList.get(i))){
                strList.remove(i);
            }
        }
        return strList;
    }
force-app/main/default/classes/RetrospectiveWeeklyReportController.cls
@@ -11,15 +11,9 @@
    public RetrospectiveWeeklyReportController() {
    }
    public void UserDoin(){
        system.debug('222222222222222================>');
        User UserProTypec = LightningUtil.loginUserId();
        system.debug('3333333333333================>'+UserProTypec);
        this.UserProType = '';
        this.UserProType = UserProTypec.UserPro_Type__c;
        system.debug('444444444444444================>'+this.UserProType);
    }
    
    public void setalldata()
@@ -41,7 +35,7 @@
        tmp.add(space);
        
        // 代理店担当者 AgencyPerson__c
        List<Contact> agency_person_data = LightningUtil.selectAgencyPerson01();
        List<Contact> agency_person_data = LightningUtil.selectAgencyPerson03();
        for(Contact var : agency_person_data) {
            Map<String,String> om = new Map<String,String>();
            om.put('label', var.Name);
@@ -90,7 +84,7 @@
        this.allselectlist.put('StageName__c', RetrospectiveWeeklyReportController.getPicklistValues('Agency_Opportunity__c','StageName__c'));
        //其他品牌耗材
        this.allselectlist.put('OtherBrandConsumables__c', RetrospectiveWeeklyReportController.getPicklistValues('Agency_Report__c','OtherBrandConsumables__c'));
        this.allselectlist.put('WarlockClassification__c', RetrospectiveWeeklyReportController.getPicklistValues('Agency_Report__c','WarlockClassification__c'));
        //产品类别
        this.allselectlist.put('ProductCcategory__c', RetrospectiveWeeklyReportController.getPicklistValues('Agency_Report__c','ProductCcategory__c'));
@@ -202,7 +196,6 @@
    @AuraEnabled
    public static RetrospectiveWeeklyReportController getalldata(){
        RetrospectiveWeeklyReportController li = new RetrospectiveWeeklyReportController();
        system.debug('1111111111111111111111================>');
        li.UserDoin();
        li.setalldata();
        return li;
@@ -240,12 +233,21 @@
    @AuraEnabled
    public static List<Agency_Hospital_Link__c> getHospitalList(String hospital_name) {
        User login_user_id = LightningUtil.loginUserId();
        String SignInId = UserInfo.getUserId();
        // List<Contact> conStrList = [select AccountId from contact where  id in (select ContactId from User where id =: SignInId)];
        Contact conStrList = [select AccountId from contact where  id in (select ContactId from User where id =: SignInId)];
        system.debug('conStrListconStrListr===============>'+conStrList);
        String strAgencyId =conStrList.AccountId;
        // for(Contact conStr : conStrList){
        //     strAgencyId = conStr.AccountId;
        // }
        system.debug('strAgencyIdstrAgencyId==============>'+strAgencyId);
        hospital_name = '%' + hospital_name.trim() + '%'; 
        if(login_user_id.UserPro_Type__c == 'ENG'){
            return [select Hospital_Name_readonly__c, Id, Hospital__c from Agency_Hospital_Link__c where Hospital_Name_readonly__c like :hospital_name and AgencyHos_ENG__c = true];
            return [select Hospital_Name_readonly__c, Id, Hospital__c from Agency_Hospital_Link__c where Agency__c =: strAgencyId and Hospital_Name_readonly__c like :hospital_name and AgencyHos_ENG__c = true];
        }else {
            return [select Hospital_Name_readonly__c, Id, Hospital__c from Agency_Hospital_Link__c where Hospital_Name_readonly__c like :hospital_name and AgencyHos_ET__c = true];
            return [select Hospital_Name_readonly__c, Id, Hospital__c from Agency_Hospital_Link__c where Agency__c =: strAgencyId and Hospital_Name_readonly__c like :hospital_name and AgencyHos_ET__c = true];
        }
        
    }
@@ -270,7 +272,6 @@
        space.put('selected', 'true');
        ret.add(space);
        
        // 戦略科室IDを取得して、それをもとに顧客をSELECT
        Agency_Hospital_Link__c ahl = [select Hospital__c from Agency_Hospital_Link__c where id = :hospital_id];
        List<Agency_Contact__c> doctor_list = [select id,Name,Doctor_Division1__c,Type__c,Agency_Hospital__c  
            FROM Agency_Contact__c WHERE Hospital_ID18__c=:ahl.Hospital__c order by Name];
@@ -289,24 +290,24 @@
    @RemoteAction
    @AuraEnabled
    public static String saveAgencyReport(String Department_Cateogy,Decimal ConsumptionOfConsumables, 
                                            Boolean WorkMark,Decimal warlocksNumber,String DealerPersonnel,String ProductCcategory,String productCategories ,String OtherBrandConsumables,
                                            Boolean WorkMark,Decimal warlocksNumber,String DealerPersonnel,String ProductCcategory,String productCategories ,String WarlockClassification,
                                            String ProductClassification,String WorkRecord,String EffectProgress, String Agency_Report_Header,
                                                String Agency_Hospital, String Person_In_Charge2, String doctor, String Submit_date,
                                                String UseProduct1, String UseProduct2, String UseProduct3,
                                                String StageName, String oppAmount, String oppOCMPrice, String Close_Forecasted_Date, String Report_Date)
    {
        Agency_Report__c agency_report = makeAgencyReport(Department_Cateogy,ConsumptionOfConsumables,
        WorkMark,warlocksNumber,DealerPersonnel,ProductCcategory,productCategories,OtherBrandConsumables,ProductClassification, WorkRecord,
        WorkMark,warlocksNumber,DealerPersonnel,ProductCcategory,productCategories,WarlockClassification,ProductClassification, WorkRecord,
        EffectProgress,Agency_Report_Header,
            Agency_Hospital, Person_In_Charge2, doctor, Submit_date,
            UseProduct1, UseProduct2, UseProduct3,
            StageName, oppAmount, oppOCMPrice, Close_Forecasted_Date, Report_Date);
        agency_report = LightningUtil.insertAgencyReport(agency_report);
        agency_report = insertAgencyReport(agency_report);
        return agency_report.Id;
    }
    public static Agency_Report__c makeAgencyReport(String Department_Cateogy,Decimal ConsumptionOfConsumables, 
    boolean WorkMark,Decimal warlocksNumber, String DealerPersonnel,String ProductCcategory,String productCategories,String OtherBrandConsumables,
    boolean WorkMark,Decimal warlocksNumber, String DealerPersonnel,String ProductCcategory,String productCategories,String WarlockClassification,
    String ProductClassification, String WorkRecord, String EffectProgress,String Agency_Report_Header,
            String Agency_Hospital, String Person_In_Charge2, String doctor, String Submit_date,
            String UseProduct1, String UseProduct2, String UseProduct3,
@@ -330,7 +331,6 @@
        }
        //经销商人员
        if (DealerPersonnel != '') {
            if(DealerPersonnel.contains(';')){
                DealerPersonnel = DealerPersonnel.split(';')[0];
            }
@@ -346,6 +346,7 @@
        if (Department_Cateogy != '') { agency_report.Department_Cateogy__c = Department_Cateogy; }
        if (ConsumptionOfConsumables != null) { agency_report.ConsumptionOfConsumables__c = ConsumptionOfConsumables; }
        if (WorkRecord != '') { agency_report.WorkRecord__c = WorkRecord; }
        // system.debug('EffectProgress==================>'+EffectProgress);
        if (EffectProgress != '') { agency_report.EffectProgress__c = EffectProgress; }
        // ET    
        if (ProductClassification != '') { agency_report.ProductClassification__c = ProductClassification; }
@@ -354,8 +355,10 @@
        if (UseProduct1 != '') { agency_report.UseProduct1__c = UseProduct1; }
        if (UseProduct2 != '') { agency_report.UseProduct2__c = UseProduct2; }
        if (UseProduct3 != '') { agency_report.UseProduct3__c = UseProduct3; }
        if (OtherBrandConsumables != '') { agency_report.OtherBrandConsumables__c = OtherBrandConsumables; }
        if (WarlockClassification != '') { agency_report.WarlockClassification__c = WarlockClassification; }
        system.debug('ProductCcategory==================>'+ProductCcategory);
        if (ProductCcategory != '') { agency_report.ProductCcategory__c = ProductCcategory; }
        system.debug('productCategories==================>'+productCategories);
        if (productCategories != '') { agency_report.productCategories__c = productCategories; }
        if (warlocksNumber != null) { agency_report.warlocksNumber__c = warlocksNumber; }
        if (WorkMark != false) {
@@ -363,12 +366,29 @@
        }
        return agency_report;  
    }
    //新建方法
    public static Agency_Report__c insertAgencyReport(Agency_Report__c data) {
        if (String.isBlank(data.Hospital__c)) {
            List<Agency_Hospital_Link__c> agency_hospital_link = [select Id, Hospital__c from Agency_Hospital_Link__c where Id=:data.Agency_Hospital__c];
            data.Hospital__c = agency_hospital_link[0].Hospital__c;
        }
        if (String.isBlank(data.Department_Class__c)) {
            String record_type_id = LightningUtil.getRecordTypeId(data.Department_Cateogy__c);
            List<Account> account = [select Id, RecordTypeId from account where Hospital_Department_Class__c=:data.Hospital__c and RecordTypeId=:record_type_id];
            data.Department_Class__c = account[0].Id;
        }
        User userPro = LightningUtil.loginUserId();
        data.WeeklyReportClassification__c = userPro.UserPro_Type__c;
        system.debug('data==================>'+data);
        insert data;
        return data;
    }
    @RemoteAction
    @AuraEnabled
    public static String editAgencyReport(String Agency_Report_Id, String Department_Cateogy,
                                        Decimal ConsumptionOfConsumables,boolean WorkMark,Decimal warlocksNumber,
                                        String DealerPersonnel,String OtherBrandConsumables,String ProductCcategory,String productCategories,String ProductClassification,
                                        String DealerPersonnel,String WarlockClassification,String ProductCcategory,String productCategories,String ProductClassification,
                                        String EffectProgress, String WorkRecord, String Agency_Report_Header,
                                        String Agency_Hospital, String Person_In_Charge2, String doctor, String Submit_date,
                                        String UseProduct1, String UseProduct2, String UseProduct3, 
@@ -377,7 +397,7 @@
        if (String.isBlank(Agency_Report_Id)) {
            return null;
        }
        Agency_Report__c agency_report = [select Id, Name, Department_Cateogy__c, ConsumptionOfConsumables__c, WorkRecord__c,OtherBrandConsumables__c,
        Agency_Report__c agency_report = [select Id, Name, Department_Cateogy__c, ConsumptionOfConsumables__c, WorkRecord__c,WarlockClassification__c,
                                            ProductCcategory__c, productCategories__c,warlocksNumber__c,WorkMark__c,ProductClassification__c,DealerPersonnel__c, Agency_Report_Header__c,Agency_Hospital__c,UseProduct1__c,
                                            UseProduct2__c, UseProduct3__c,  Person_In_Charge2__c,doctor2__c,Submit_date__c,Report_Date__c
                                            from Agency_Report__c where id=:Agency_Report_Id];
@@ -417,7 +437,7 @@
        if (UseProduct3 != '') { agency_report.UseProduct3__c = UseProduct3; } else { agency_report.UseProduct3__c = null; }  
        if (ProductCcategory != '') { agency_report.ProductCcategory__c = ProductCcategory; } else { agency_report.ProductCcategory__c = null; }
        if (productCategories != '') { agency_report.productCategories__c = productCategories; } else { agency_report.productCategories__c = null; }
        if (OtherBrandConsumables != '') { agency_report.OtherBrandConsumables__c = OtherBrandConsumables; } else { agency_report.OtherBrandConsumables__c = null; }
        if (WarlockClassification != '') { agency_report.WarlockClassification__c = WarlockClassification; } else { agency_report.WarlockClassification__c = null; }
        if (WorkMark != false) { agency_report.WorkMark__c = WorkMark; } else { agency_report.WorkMark__c = false; }
        if (warlocksNumber != null) { agency_report.warlocksNumber__c = warlocksNumber; } else { agency_report.warlocksNumber__c = null; }
        agency_report = LightningUtil.updateAgencyReport(agency_report);
@@ -444,7 +464,6 @@
    }
    
    public void get_reports(String date_str, String person_str) {     
        // 週報データを取得
        Date week = Date.valueOf(date_str);
        this.reports = LightningUtil.selectAgencyReport01(week, person_str);
    }
@@ -452,8 +471,10 @@
    @RemoteAction
    @AuraEnabled
    public static List<Agency_Report__c> getReportsById(String report_id) {
        system.debug('==report_id================>'+report_id);
        List<Agency_Report__c> ret = new List<Agency_Report__c>();
        ret = LightningUtil.selectAgencyReportById(report_id);
        ret = LightningUtil.selectAgencyReportById01(report_id);
        system.debug('==Agency_Report_Header__r.WeeklyReportClassification__c=================>'+ret);
        return ret;
    }
    
@@ -464,8 +485,8 @@
        Date date1_date = Date.valueOf(date1);
        Date date2_date = Date.valueOf(date2);
        RetrospectiveWeeklyReportController li = new RetrospectiveWeeklyReportController();
        List<Contact> conMList = LightningUtil.selectAgencyPerson01();
        return LightningUtil.selectMAgencyReport(date1_date, date2_date, conMList);
        List<Contact> conMList = LightningUtil.selectAgencyPerson03();
        return LightningUtil.selectMAgencyReport01(date1_date, date2_date, conMList);
    }
    public List<contact> selectMAgencyPerson() {
@@ -663,13 +684,13 @@
                // 使用产品1,2,3
                Map<String,Product2> UseProductMap = new Map<String,Product2>();
                // 效果进度
                Map<String,EffectProgress__c> EffectProgressMap = new Map<String,EffectProgress__c>();
                Map<String,FieldClassification__c> EffectProgressMap = new Map<String,FieldClassification__c>();
                // 术士分类
                Map<String,WarlockClassification__c> OtherBrandConsumablesMap = new Map<String,WarlockClassification__c>();
                Map<String,FieldClassification__c> OtherBrandConsumablesMap = new Map<String,FieldClassification__c>();
                // 已采用其他产品
                Map<String,ProductCcategory__c> ProductCcategorynMap = new Map<String,ProductCcategory__c>();
                Map<String,FieldClassification__c> ProductCcategorynMap = new Map<String,FieldClassification__c>();
                 // 其他品牌产品类别
                 Map<String,productCategories__c> productCategoriesMap = new Map<String,productCategories__c>();
                 Map<String,FieldClassification__c> productCategoriesMap = new Map<String,FieldClassification__c>();
                // 使用产品id的List
                List<String> UseProductIdList = new List<String>();
                 // 效果进度id的List
@@ -692,14 +713,14 @@
                Map<String,String> DealerPersonnelMap = new Map<String,String>();
                // 经销商询价的map
                Map<String,Agency_Opportunity__c> aoMap = new Map<String,Agency_Opportunity__c>();
                List<Contact> conList = LightningUtil.selectAgencyPerson01();
                List<Contact> conList = LightningUtil.selectAgencyPerson03();
                List<OlympusCalendar__c> olympusDateList = [select Id,Date__c,FirstDayOfWeek__c,DayOfTheWeek__c from OlympusCalendar__c where Date__c= :dateList ];
                List<Agency_Hospital_Link__c> ahlList = [select id,name,Hospital__c,MaxActivityDate__c from Agency_Hospital_Link__c where name = :ahlNameList and Agency_Campaign_Obj__c = true];
                List<Product2> pr2List = [select id,name from Product2 where name in:Product2NameList];
                List<EffectProgress__c> epList = [select id,name from EffectProgress__c where name in :EffectProgressList];
                List<WarlockClassification__c> ocList = [select id,name from WarlockClassification__c where name in :OtherBrandConsumablesList];
                List<ProductCcategory__c> PCList = [select id,name from ProductCcategory__c where name in :ProductCcategoryList];
                List<productCategories__c> PctList = [select id,name from productCategories__c where name in :productCategoriesList];
                List<FieldClassification__c> FieldClassification1List = [select id,EffectProgress__c from FieldClassification__c where EffectProgress__c  in :EffectProgressList];
                List<FieldClassification__c> FieldClassification2List = [select id,WarlockClassification__c from FieldClassification__c where WarlockClassification__c in :OtherBrandConsumablesList];
                List<FieldClassification__c> FieldClassification3List = [select id,ProductCcategory__c from FieldClassification__c where ProductCcategory__c in :ProductCcategoryList];
                List<FieldClassification__c> FieldClassification4List = [select id,productCategories__c from FieldClassification__c where productCategories__c in :productCategoriesList];
                
                for(OlympusCalendar__c olym : olympusDateList){
                    if(olym.DayOfTheWeek__c == 'Sun'){
@@ -727,20 +748,20 @@
                    UseProductMap.put(pr2.Name, pr2);
                    UseProductIdList.add(pr2.Id);
                }
                for(EffectProgress__c ep : epList){
                    EffectProgressMap.put(ep.Name, ep);
                for(FieldClassification__c ep : FieldClassification1List){
                    EffectProgressMap.put(ep.EffectProgress__c, ep);
                    EffectProgressIdList.add(ep.Id);
                }
                for(WarlockClassification__c oc : ocList){
                    OtherBrandConsumablesMap.put(oc.Name, oc);
                for(FieldClassification__c oc : FieldClassification2List){
                    OtherBrandConsumablesMap.put(oc.WarlockClassification__c, oc);
                    OtherBrandConsumablesIdList.add(oc.Id);
                }
                for(ProductCcategory__c pc : PCList){
                    ProductCcategorynMap.put(pc.Name, pc);
                for(FieldClassification__c pc : FieldClassification3List){
                    ProductCcategorynMap.put(pc.ProductCcategory__c, pc);
                    ProductCcategorynIdList.add(pc.Id);
                }
                for(productCategories__c pct : PctList){
                    productCategoriesMap.put(pct.Name, pct);
                for(FieldClassification__c pct : FieldClassification4List){
                    productCategoriesMap.put(pct.productCategories__c, pct);
                    productCategoriesIdList.add(pct.Id);
                }
                List<Agency_Contact__c> doctor2list = [select id,Name,Doctor_Division1__c,Type__c,Agency_Hospital__c FROM Agency_Contact__c WHERE Hospital_ID18__c= :ahlOcsmIdList order by Name];
@@ -791,6 +812,8 @@
                }
                List<Agency_Report__c> arList = new List<Agency_Report__c>();
                Integer hang = 1;
                User UserPro = LightningUtil.loginUserId();
                String UserProTypeStr = UserPro.UserPro_Type__c;
                for(List<String> lineList :inputList){
                    // 创建周报明细
                    Date week = null;
@@ -886,7 +909,7 @@
                        agencyReport.ConsumptionOfConsumables__c = Decimal.valueOf(lineList[13]);     
                    }
                    if(OtherBrandConsumablesMap.containsKey(lineList[14])){
                        agencyReport.OtherBrandConsumables__c = OtherBrandConsumablesMap.get(lineList[14]).Id;
                        agencyReport.WarlockClassification__c = OtherBrandConsumablesMap.get(lineList[14]).Id;
                    }
                    if(ProductCcategorynMap.containsKey(lineList[15])){   
                        agencyReport.ProductCcategory__c = ProductCcategorynMap.get(lineList[15]).Id;      
@@ -902,6 +925,7 @@
                    }else{
                        agencyReport.WorkMark__c =  false; 
                    }
                    agencyReport.WeeklyReportClassification__c = UserProTypeStr;
                    String headerStr = createHeader(week,s_agency);
                    if(agency_report_headerMap.containsKey(headerStr)){
                        agencyReport.Agency_Report_Header__c = agency_report_headerMap.get(headerStr).Id;
@@ -920,6 +944,7 @@
                }
                // 新增周报明细
                if(arList.size() > 0 ){
                    system.debug('arList==================>'+arList);
                    LightningUtil.insertMAgencyReport(arList);
                }
            }
@@ -1057,19 +1082,20 @@
    @AuraEnabled
    public static List<Map<String,String>> selectPurposeTypes(String doctor_value){
        system.debug('doctor_value===============>'+doctor_value);
        List<EffectProgress__c> eftpcList;
        List<FieldClassification__c> eftpcList;
        if(String.isNotBlank(doctor_value)){
            eftpcList = [select id, Name , WorkRecord__c from EffectProgress__c where WorkRecord__c =: doctor_value];
            // eftpcList = [select id, Name , WorkRecord__c from EffectProgress__c where WorkRecord__c =: doctor_value];
            eftpcList = [Select Id,WorkRecord__c,EffectProgress__c from FieldClassification__c where WorkRecord__c =: doctor_value];
        }
        List<Map<String,String>> options = new List<Map<String,String>>();
        Map<String,String> space = new Map<String,String>();
        space.put('label', '');
        space.put('value', '');
        options.add(space);
        for(EffectProgress__c efptc : eftpcList){
        for(FieldClassification__c efptc : eftpcList){
            Map<String,String> efptcMap = new Map<String,String>();
            efptcMap.put('label', efptc.Name);
            efptcMap.put('label', efptc.EffectProgress__c);
            efptcMap.put('value', efptc.Id);
            options.add(efptcMap);
        }
@@ -1079,18 +1105,20 @@
    @RemoteAction
    @AuraEnabled
    public static List<Map<String,String>> selectProductClassificationc(String select_ProductClassification){
        List<WarlockClassification__c> WarlockClassificationList;
        List<FieldClassification__c> WarlockClassificationList;
        if(String.isNotBlank(select_ProductClassification)){
            WarlockClassificationList = [select id, Name , ProductClassification__c from WarlockClassification__c where ProductClassification__c =: select_ProductClassification];
            // WarlockClassificationList = [select id, Name , ProductClassification__c from WarlockClassification__c where ProductClassification__c =: select_ProductClassification];
            WarlockClassificationList = [select id , ProductClassification__c,WarlockClassification__c from FieldClassification__c where ProductClassification__c =: select_ProductClassification];
        }
        List<Map<String,String>> options = new List<Map<String,String>>();
        Map<String,String> space = new Map<String,String>();
        space.put('label', '');
        space.put('value', '');
        options.add(space);
        for(WarlockClassification__c WarlockClassification : WarlockClassificationList){
        for(FieldClassification__c WarlockClassification : WarlockClassificationList){
            Map<String,String> WarlockClassificationMap = new Map<String,String>();
            WarlockClassificationMap.put('label', WarlockClassification.Name);
            WarlockClassificationMap.put('label', WarlockClassification.WarlockClassification__c);
            WarlockClassificationMap.put('value', WarlockClassification.Id);
            options.add(WarlockClassificationMap);
        }
@@ -1099,21 +1127,21 @@
    @RemoteAction
    @AuraEnabled
    public static List<Map<String,String>> selectProductCcategory(){
        List<ProductCcategory__c> ProductCcategoryList;
        List<FieldClassification__c> ProductCcategoryList;
        User UserProETENG = LightningUtil.loginUserId();
        if(UserProETENG.UserPro_Type__c == 'ET'){
            ProductCcategoryList = [select id, Name , ConsumablesClassification__c from ProductCcategory__c where ConsumablesClassification__c =: 'ET'];
            ProductCcategoryList = [select id,  ProductCcategory__c from FieldClassification__c where classification__c =: 'ET'];
        }else{
            ProductCcategoryList = [select id, Name , ConsumablesClassification__c from ProductCcategory__c where ConsumablesClassification__c =: 'ENG'];
            ProductCcategoryList = [select id,  ProductCcategory__c from FieldClassification__c where classification__c =: 'ENG'];
        }
        List<Map<String,String>> options = new List<Map<String,String>>();
        Map<String,String> space = new Map<String,String>();
        space.put('label', '');
        space.put('value', '');
        options.add(space);
        for(ProductCcategory__c ProductCcategory : ProductCcategoryList){
        for(FieldClassification__c ProductCcategory : ProductCcategoryList){
            Map<String,String> ProductCcategorynMap = new Map<String,String>();
            ProductCcategorynMap.put('label', ProductCcategory.Name);
            ProductCcategorynMap.put('label', ProductCcategory.ProductCcategory__c);
            ProductCcategorynMap.put('value', ProductCcategory.Id);
            options.add(ProductCcategorynMap);
        }
@@ -1122,22 +1150,23 @@
    @RemoteAction
    @AuraEnabled
    public static List<Map<String,String>> selectProductCcategory01(String select_ProductCcategory){
        List<productCategories__c> productCategoriesList;
        List<FieldClassification__c> productCategoriesList;
        User UserProETENG = LightningUtil.loginUserId();
        System.debug('UserProETENG.UserPro_Type__c=============>'+UserProETENG.UserPro_Type__c);
        FieldClassification__c fi = [Select ProductCcategory__c from FieldClassification__c where ID =: select_ProductCcategory];
        if(UserProETENG.UserPro_Type__c == 'ET'){
            productCategoriesList = [select id, Name,ET_ENG_classification__c,ProductCcategory__c from productCategories__c where ProductCcategory__c =:select_ProductCcategory AND ET_ENG_classification__c =: 'ET'];
            productCategoriesList = [select id, productCategories__c,ET_ENG_classification__c,ProductCcategory__c from FieldClassification__c where ProductCcategory__c =: fi.ProductCcategory__c AND ET_ENG_classification__c =: 'ET'];
        }else{
            productCategoriesList = [select id, Name,ET_ENG_classification__c,ProductCcategory__c from productCategories__c where ProductCcategory__c =:select_ProductCcategory AND ET_ENG_classification__c =: 'ENG'];
            productCategoriesList = [select id, productCategories__c,ET_ENG_classification__c,ProductCcategory__c from FieldClassification__c where ProductCcategory__c =:fi.ProductCcategory__c AND ET_ENG_classification__c =: 'ENG'];
        }
        List<Map<String,String>> options = new List<Map<String,String>>();
        Map<String,String> space = new Map<String,String>();
        space.put('label', '');
        space.put('value', '');
        options.add(space);
        for(productCategories__c productCategories : productCategoriesList){
        for(FieldClassification__c productCategories : productCategoriesList){
            Map<String,String> productCategoriesMap = new Map<String,String>();
            productCategoriesMap.put('label', productCategories.Name);
            productCategoriesMap.put('label', productCategories.productCategories__c);
            productCategoriesMap.put('value', productCategories.Id);
            options.add(productCategoriesMap);
        }
force-app/main/default/classes/RetrospectiveWeeklyReportTest.cls
New file
@@ -0,0 +1,499 @@
@isTest
public with sharing class RetrospectiveWeeklyReportTest {
        public static Account account1 = new Account();
        public static Account account2 = new Account();
        public static Contact contact1 = new Contact();
        public static Contact contact2 = new Contact();
        public static Product2 pro1 = new Product2();
        public static Product2 pro2 = new Product2();
        public static Product2 pro3 = new Product2();
        public static FieldClassification__c fc1 = new FieldClassification__c();
        public static FieldClassification__c fc2 = new FieldClassification__c();
        public static FieldClassification__c fc3  = new FieldClassification__c();
        public static FieldClassification__c fc4  = new FieldClassification__c();
        public static User user = new User();
        public static Agency_Hospital_Link__c agency_hospital_link = new Agency_Hospital_Link__c();
        public static Agency_Contact__c agency_contact = new Agency_Contact__c();
        // 经销商活动周报导入 update by vivek end
        public static OlympusCalendar__c olympus_calendar = new OlympusCalendar__c();
        // // public static productCategories__c pca = new productCategories__c();
        // public static WarlockClassification__c wcf = new WarlockClassification__c();
        // public static EffectProgress__c etp = new EffectProgress__c();
        public static String report_id;
        public static String report_header_id;
        /* 病院。コンタクト、ユーザー、カレンダーなどの初期データ作る
        */
        private static void testInit() {
            // 取引先
            account1.Name = 'test1医院';
            account1.RecordTypeId = '01210000000QemG';
            insert account1;
            account2.Name = 'test1经销商';
            account2.RecordTypeId = '01210000000Qem1';
            insert account2;
            // 取引先責任者
            contact1.AccountId = account1.Id;
            contact1.FirstName = '責任者';
            contact1.LastName = 'test1医院';
            insert contact1;
            contact2.AccountId = account2.Id;
            contact2.FirstName = '責任者';
            contact2.LastName = 'test1经销商';
            insert contact2;
            Profile p = [select Id from Profile where Name = '901_经销商活动系统'];
            user.ProfileId = p.Id;
            user.UserPro_Type__c = 'ET';
            user.ContactId = contact2.Id;
            user.FirstName = 'ユーザー';
            user.LastName = 'テスト';
            user.Email = 'test_user@example.com';
            user.emailencodingkey='UTF-8';
            user.languagelocalekey='zh_CN';
            user.localesidkey='ja_JP';
            user.timezonesidkey='Asia/Shanghai';
            user.Username = 'test_user@example.com';
            user.Alias = 'テユ';
            user.CommunityNickname = 'テストユーザー';
            insert user;
            // 代理店医院
            agency_hospital_link.Name = 'test1代理店医院';
            agency_hospital_link.Hospital__c = account1.Id;
            agency_hospital_link.Agency__c = account2.Id;
            agency_hospital_link.OwnerId = user.Id;
            agency_hospital_link.Agency_Campaign_Obj__c = true;
            insert agency_hospital_link;
            // 先生
            agency_contact.Name = 'test1医院先生';
            agency_contact.Doctor_Division1__c = '院长';
            agency_contact.Type__c = '医生';
            agency_contact.Agency_Hospital__c = agency_hospital_link.Id;
            agency_contact.OwnerId = user.Id;
            insert agency_contact;
            pro1.Name='name01';
            pro1.IsActive=true;
            pro1.Family='GI';
            pro1.Fixture_Model_No__c='n01';
            pro1.Serial_Lot_No__c='S/N tracing';
            pro1.Category3__c = 'ERCP';
            pro1.Fixture_Model_No_T__c = 'n01';
            pro1.ProductCode_Ext__c='pc01';
            pro1.Manual_Entry__c=false;
            insert pro1;
            pro2.Name='name02';
            pro2.IsActive=true;
            pro2.Family='GI';
            pro2.Fixture_Model_No__c='n01';
            pro2.Serial_Lot_No__c='S/N tracing';
            pro2.Category3__c = 'ERCP';
            pro2.Fixture_Model_No_T__c = 'n01';
            pro2.ProductCode_Ext__c='pc01';
            pro2.Manual_Entry__c=false;
            insert pro2;
            pro3.Name='name03';
            pro3.IsActive=true;
            pro3.Family='GI';
            pro3.Fixture_Model_No__c='n01';
            pro3.Serial_Lot_No__c='S/N tracing';
            pro3.Category3__c = 'ERCP';
            pro3.Fixture_Model_No_T__c = 'n01';
            pro3.ProductCode_Ext__c='pc01';
            pro3.Manual_Entry__c=false;
            insert pro3;
            // オリンパスカレンダー
            olympus_calendar.Date__c = Date.valueOf('2022-02-28');
            olympus_calendar.OwnerId = user.Id;
            insert olympus_calendar;
            fc1.Name = '1';
            fc1.ProductCcategory__c = '安瑞';
            fc1.classification__c = 'ET';
            insert fc1;
            fc2.Name = '2';
            fc2.WarlockClassification__c = '取石气囊';
            fc2.ProductClassification__c = 'ERCP';
            insert fc2;
            fc3.Name = '3';
            fc3.EffectProgress__c = '院级审核';
            fc3.WorkRecord__c = '院内入院申请';
            insert fc3;
            fc4.Name = '4';
            fc4.productCategories__c = '无线超声切割刀';
            fc4.ET_ENG_classification__c = 'ENG';
            fc4.ProductCcategory__c = '安瑞';
            insert fc4;
        }
        // @isTest public static void getProductListTest() {
        //     testInit();
        //     String select_ProductCcategory = pc.Id;
        //     System.runAs(user) {
        //         // 病院リスト取得
        //         List<Map<String,String>> test = RetrospectiveWeeklyReportController.selectProductCcategory01(select_ProductCcategory);
        //         Map<String,String> test_data = new Map<String,String>();
        //         test_data.put('label', agency_contact.Name);
        //         test_data.put('value', agency_contact.Id);
        //         System.assertEquals(test_data,null);
        //     }
        // }
        @isTest public static void selectProductCcategoryTest() {
            testInit();
            String select_ProductCcategory = fc1.ProductCcategory__c;
            System.runAs(user) {
                // 病院リスト取得
                List<Map<String,String>> test = RetrospectiveWeeklyReportController.selectProductCcategory();
                System.assertNotEquals(test, null);
            }
        }
        @isTest public static void getalldataTest() {
            testInit();
            System.runAs(user) {
                // 病院リスト取得
                RetrospectiveWeeklyReportController test = RetrospectiveWeeklyReportController.getalldata();
                System.assertNotEquals(test, null);
            }
        }
        @isTest
        public static void createReportHeaderTest() {
            testInit();
            System.runAs(user) {
                // 週報ヘッダー作成
                String name = 'テスト ユーザー';
                String s_date = '2022-02-28';
                String s_agency = contact2.Id;
                String head_key = contact2.Id + ':20220228';
                report_header_id = RetrospectiveWeeklyReportController.createReportHeader(name, s_date, s_agency, head_key);
                Agency_Report_Header__c data = [select Id, Name, Week__c, Agency_Person2__c, HeaderInputKey__c, OlympusDate__r.Date__c from Agency_Report_Header__c where HeaderInputKey__c = :head_key];
                System.assertEquals(name + ' (' + s_date + ')', data.Name);
                System.assertEquals(Date.valueOf(s_date), data.Week__c);
                System.assertEquals(s_agency, data.Agency_Person2__c);
                System.assertEquals(head_key, data.HeaderInputKey__c);
                System.assertEquals(Date.valueOf(s_date), data.OlympusDate__r.Date__c);
            }
        }
        @isTest public static void getDoctorListTest() {
            testInit();
            System.runAs(user) {
                List<Map<String,String>> doctor_data = RetrospectiveWeeklyReportController.getDoctorList(agency_hospital_link.Id);
                Map<String,String> test_data = new Map<String,String>();
                test_data.put('label', agency_contact.Name);
                test_data.put('value', agency_contact.Id);
                test_data.put('selected', 'false');
                test_data.put('Doctor_Division1__c', agency_contact.Doctor_Division1__c);
                System.assertEquals(test_data, doctor_data[1]);
            }
        }
        @isTest public static void selectProductClassificationc() {
            testInit();
            String str = 'ERCP';
            System.runAs(user) {
                List<Map<String,String>> doctor_data = RetrospectiveWeeklyReportController.selectProductClassificationc(str);
                Map<String,String> test_data = new Map<String,String>();
                test_data.put('label', fc2.WarlockClassification__c);
                test_data.put('value', fc2.Id);
                System.assertEquals(test_data, doctor_data[1]);
            }
        }
        @isTest public static void selectPurposeTypes() {
            testInit();
            String str ='院内入院申请';
            System.runAs(user) {
                List<Map<String,String>> doctor_data = RetrospectiveWeeklyReportController.selectPurposeTypes(str);
                Map<String,String> test_data = new Map<String,String>();
                test_data.put('label', fc3.EffectProgress__c);
                test_data.put('value', fc3.Id);
                System.assertEquals(test_data, doctor_data[1]);
            }
        }
        @isTest public static void processData() {
            testInit();
            OlympusCalendar__c oc1 = new OlympusCalendar__c();
            oc1.Date__c = Date.valueOf('2022-3-1');
            insert oc1;
            OlympusCalendar__c oc2 = new OlympusCalendar__c();
            oc2.Date__c = Date.valueOf('2022-3-2');
            insert oc2;
            OlympusCalendar__c oc3 = new OlympusCalendar__c();
            oc3.Date__c = Date.valueOf('2022-2-28');
            insert oc3;
            Test.startTest();
            System.runAs(user) {
            String reports = RetrospectiveWeeklyReportController.processData('"周,担当,活动日,医院,科室,经销商人员,工作记录,医院人员,产品分类(第三分类),使用产品1(产品型号),使用产品2,使用产品3,效果/进度,科室同类耗材月使用量,术士分类,已采用其他品牌,产品用量,工作标记\r\n2022-02-28,姜 彦,2022-03-03,鞍山九洲医院,ET,姜 彦,院内入院申请,小付,ERCP,KD-6G17Q-1-A:停止2005/10 G型导丝乳头切开刀,KD-200Q-0730:乳头切开刀,KD-211Q-0720:高频切开刀,院级审核,11,取石气囊,美迪云,,22,false\r\n2022-02-28,姜 彦,2022-03-03,鞍山九洲医院,ET,姜 彦,院内入院申请,小付,ERCP,KD-6G17Q-1-A:停止2005/10 G型导丝乳头切开刀,KD-200Q-0730:乳头切开刀,KD-211Q-0720:高频切开刀,院级审核,11,取石气囊,美迪云,,22,false\r\n','',null);
            }
            Test.stopTest();
        }
        @isTest static void saveAgencyReportTest() {
            testInit();
            System.runAs(user) {
                String name = 'テスト ユーザー';
                String s_date = '2022-02-28';
                String s_agency = contact2.Id;
                String head_key = contact2.Id + ':20220228';
                report_header_id = RetrospectiveWeeklyReportController.createReportHeader(name, s_date, s_agency, head_key);
                // 週報作成 String
                String Department_Cateogy = '';
                Decimal ConsumptionOfConsumables = 0;
                Boolean WorkMark  = false;
                Decimal warlocksNumber = 0;
                String DealerPersonnel = '';
                String ProductCcategory = '';
                String productCategories = '';
                String WarlockClassification = '';
                String ProductClassification = '';
                String WorkRecord = '';
                String EffectProgress = '';
                String Agency_Report_Header = '';
                String Agency_Hospital = '';
                String Person_In_Charge2 = '';
                String doctor = '';
                String Submit_date = '';
                String UseProduct1 = '';
                String UseProduct2 = '';
                String UseProduct3 = '';
                String StageName = '';
                String oppAmount = '';
                String oppOCMPrice = '';
                String Close_Forecasted_Date = '';
                String Report_Date = '';
                Department_Cateogy = 'ET';
                ConsumptionOfConsumables = 11;
                WorkMark  = true;
                warlocksNumber = 22;
                DealerPersonnel = contact1.id;
                ProductCcategory = fc1.ID;
                productCategories = '';
                WarlockClassification = fc2.ID;
                ProductClassification = 'ERCP';
                WorkRecord = '院内入院申请';
                EffectProgress = fc3.ID;
                Agency_Report_Header = report_header_id;
                Agency_Hospital = agency_hospital_link.Id;
                Person_In_Charge2 = contact2.Id;
                doctor = agency_contact.Id;
                Submit_date = '2022-02-28';
                UseProduct1 = pro1.id;
                UseProduct2 = pro2.Id;
                UseProduct3 = pro3.id;
                StageName = '';
                oppAmount = '';
                oppOCMPrice = '';
                Close_Forecasted_Date = '';
                Report_Date = '2022-3-3';
                report_id = RetrospectiveWeeklyReportController.saveAgencyReport(Department_Cateogy,ConsumptionOfConsumables,
                            WorkMark,warlocksNumber,DealerPersonnel,ProductCcategory,productCategories,WarlockClassification,ProductClassification, WorkRecord,
                            EffectProgress,Agency_Report_Header,
                            Agency_Hospital, Person_In_Charge2, doctor, Submit_date,
                            UseProduct1, UseProduct2, UseProduct3,
                            StageName, oppAmount, oppOCMPrice, Close_Forecasted_Date, Report_Date);
                Agency_Report__c data = [select Id, Name, Department_Cateogy__c, ConsumptionOfConsumables__c, WorkRecord__c,EffectProgress__c,WarlockClassification__c,
                ProductCcategory__c, productCategories__c,warlocksNumber__c,WorkMark__c,ProductClassification__c,DealerPersonnel__c, Agency_Report_Header__c,Agency_Hospital__c,UseProduct1__c,
                UseProduct2__c, UseProduct3__c,  Person_In_Charge2__c,doctor2__c,Submit_date__c,Report_Date__c
                from Agency_Report__c where id=:report_id];
                System.assertEquals(Department_Cateogy, data.Department_Cateogy__c);
                System.assertEquals(Agency_Report_Header, data.Agency_Report_Header__c);
                System.assertEquals(Agency_Hospital, data.Agency_Hospital__c);
                System.assertEquals(Person_In_Charge2, data.Person_In_Charge2__c);
                System.assertEquals(doctor, data.doctor2__c);
                System.assertEquals(Date.valueOf(Submit_date), data.Submit_date__c);
            }
        }
        @isTest public static void editAgencyReportTest() {
            saveAgencyReportTest();
            System.runAs(user) {
                String Department_Cateogy = '';
                Decimal ConsumptionOfConsumables = 0;
                Boolean WorkMark  = false;
                Decimal warlocksNumber = 0;
                String DealerPersonnel = '';
                String ProductCcategory = '';
                String productCategories = '';
                String WarlockClassification = '';
                String ProductClassification = '';
                String WorkRecord = '';
                String EffectProgress = '';
                String Agency_Report_Header = '';
                String Agency_Hospital = '';
                String Person_In_Charge2 = '';
                String doctor = '';
                String Submit_date = '';
                String UseProduct1 = '';
                String UseProduct2 = '';
                String UseProduct3 = '';
                String StageName = '';
                String oppAmount = '';
                String oppOCMPrice = '';
                String Close_Forecasted_Date = '';
                String Report_Date = '';
                Department_Cateogy = 'ET';
                ConsumptionOfConsumables = 11;
                WorkMark  = true;
                warlocksNumber = 22;
                DealerPersonnel = contact1.id;
                ProductCcategory = fc1.ID;
                productCategories = '';
                WarlockClassification = fc2.ID;
                ProductClassification = 'ERCP';
                WorkRecord = '院内入院申请';
                EffectProgress = fc3.Id;
                Agency_Report_Header = report_header_id;
                Agency_Hospital = agency_hospital_link.Id;
                Person_In_Charge2 = contact2.Id;
                doctor = agency_contact.Id;
                Submit_date = '2022-02-28';
                UseProduct1 = pro1.id;
                UseProduct2 = pro2.Id;
                UseProduct3 = pro3.id;
                Report_Date = '2022-3-3';
                Test.startTest();
                // 週報編集
                Department_Cateogy = 'BF';
                report_id = RetrospectiveWeeklyReportController.editAgencyReport(report_id,Department_Cateogy,ConsumptionOfConsumables,
                                                            WorkMark,warlocksNumber,DealerPersonnel,WarlockClassification,ProductCcategory,productCategories,ProductClassification,
                                                            EffectProgress,WorkRecord,Agency_Report_Header,
                                                            Agency_Hospital, Person_In_Charge2, doctor, Submit_date,
                                                            UseProduct1, UseProduct2, UseProduct3,
                                                            Report_Date);
                Agency_Report__c data = [select Id, Name, Department_Cateogy__c, ConsumptionOfConsumables__c, WorkRecord__c,EffectProgress__c,WarlockClassification__c,
                                            ProductCcategory__c, productCategories__c,warlocksNumber__c,WorkMark__c,ProductClassification__c,DealerPersonnel__c, Agency_Report_Header__c,Agency_Hospital__c,UseProduct1__c,
                                            UseProduct2__c, UseProduct3__c,  Person_In_Charge2__c,doctor2__c,Submit_date__c,Report_Date__c
                                            from Agency_Report__c where id=:report_id];
                System.assertEquals(Department_Cateogy, data.Department_Cateogy__c);
                Department_Cateogy = 'GYN';
                report_id = RetrospectiveWeeklyReportController.editAgencyReport(report_id,Department_Cateogy,ConsumptionOfConsumables,
                                                            WorkMark,warlocksNumber,DealerPersonnel,WarlockClassification,ProductCcategory,productCategories,ProductClassification,
                                                            EffectProgress,WorkRecord,Agency_Report_Header,
                                                            Agency_Hospital, Person_In_Charge2, doctor, Submit_date,
                                                            UseProduct1, UseProduct2, UseProduct3,
                                                            Report_Date);
                data = [select Id, Name, Department_Cateogy__c, ConsumptionOfConsumables__c, WorkRecord__c,EffectProgress__c,WarlockClassification__c,
                            ProductCcategory__c, productCategories__c,warlocksNumber__c,WorkMark__c,ProductClassification__c,DealerPersonnel__c, Agency_Report_Header__c,Agency_Hospital__c,UseProduct1__c,
                            UseProduct2__c, UseProduct3__c,  Person_In_Charge2__c,doctor2__c,Submit_date__c,Report_Date__c
                            from Agency_Report__c where id=:report_id];
                System.assertEquals(Department_Cateogy, data.Department_Cateogy__c);
                Department_Cateogy = 'GS';
                report_id = RetrospectiveWeeklyReportController.editAgencyReport(report_id,Department_Cateogy,ConsumptionOfConsumables,
                                                            WorkMark,warlocksNumber,DealerPersonnel,WarlockClassification,ProductCcategory,productCategories,ProductClassification,
                                                            EffectProgress,WorkRecord,Agency_Report_Header,
                                                            Agency_Hospital, Person_In_Charge2, doctor, Submit_date,
                                                            UseProduct1, UseProduct2, UseProduct3,
                                                            Report_Date);
                data = [select Id, Name, Department_Cateogy__c, ConsumptionOfConsumables__c, WorkRecord__c,EffectProgress__c,WarlockClassification__c,
                                            ProductCcategory__c, productCategories__c,warlocksNumber__c,WorkMark__c,ProductClassification__c,DealerPersonnel__c, Agency_Report_Header__c,Agency_Hospital__c,UseProduct1__c,
                                            UseProduct2__c, UseProduct3__c,  Person_In_Charge2__c,doctor2__c,Submit_date__c,Report_Date__c
                                            from Agency_Report__c where id=:report_id];
                System.assertEquals(Department_Cateogy, data.Department_Cateogy__c);
                Department_Cateogy = 'URO';
                report_id = RetrospectiveWeeklyReportController.editAgencyReport(report_id,Department_Cateogy,ConsumptionOfConsumables,
                                                            WorkMark,warlocksNumber,DealerPersonnel,WarlockClassification,ProductCcategory,productCategories,ProductClassification,
                                                            EffectProgress,WorkRecord,Agency_Report_Header,
                                                            Agency_Hospital, Person_In_Charge2, doctor, Submit_date,
                                                            UseProduct1, UseProduct2, UseProduct3,
                                                            Report_Date);
                data = [select Id, Name, Department_Cateogy__c, ConsumptionOfConsumables__c, WorkRecord__c,EffectProgress__c,WarlockClassification__c,
                            ProductCcategory__c, productCategories__c,warlocksNumber__c,WorkMark__c,ProductClassification__c,DealerPersonnel__c, Agency_Report_Header__c,Agency_Hospital__c,UseProduct1__c,
                            UseProduct2__c, UseProduct3__c,  Person_In_Charge2__c,doctor2__c,Submit_date__c,Report_Date__c
                            from Agency_Report__c where id=:report_id];
                System.assertEquals(Department_Cateogy, data.Department_Cateogy__c);
                Department_Cateogy = 'ENT';
                report_id = RetrospectiveWeeklyReportController.editAgencyReport(report_id,Department_Cateogy,ConsumptionOfConsumables,
                                                            WorkMark,warlocksNumber,DealerPersonnel,WarlockClassification,ProductCcategory,productCategories,ProductClassification,
                                                            EffectProgress,WorkRecord,Agency_Report_Header,
                                                            Agency_Hospital, Person_In_Charge2, doctor, Submit_date,
                                                            UseProduct1, UseProduct2, UseProduct3,
                                                            Report_Date);
                data = [select Id, Name, Department_Cateogy__c, ConsumptionOfConsumables__c, WorkRecord__c,EffectProgress__c,WarlockClassification__c,
                                    ProductCcategory__c, productCategories__c,warlocksNumber__c,WorkMark__c,ProductClassification__c,DealerPersonnel__c, Agency_Report_Header__c,Agency_Hospital__c,UseProduct1__c,
                                    UseProduct2__c, UseProduct3__c,  Person_In_Charge2__c,doctor2__c,Submit_date__c,Report_Date__c
                                    from Agency_Report__c where id=:report_id];
                System.assertEquals(Department_Cateogy, data.Department_Cateogy__c);
                Department_Cateogy = 'ET';
                report_id = RetrospectiveWeeklyReportController.editAgencyReport(report_id,Department_Cateogy,ConsumptionOfConsumables,
                                                            WorkMark,warlocksNumber,DealerPersonnel,WarlockClassification,ProductCcategory,productCategories,ProductClassification,
                                                            EffectProgress,WorkRecord,Agency_Report_Header,
                                                            Agency_Hospital, Person_In_Charge2, doctor, Submit_date,
                                                            UseProduct1, UseProduct2, UseProduct3,
                                                            Report_Date);
                data = [select Id, Name, Department_Cateogy__c, ConsumptionOfConsumables__c, WorkRecord__c,EffectProgress__c,WarlockClassification__c,
                            ProductCcategory__c, productCategories__c,warlocksNumber__c,WorkMark__c,ProductClassification__c,DealerPersonnel__c, Agency_Report_Header__c,Agency_Hospital__c,UseProduct1__c,
                            UseProduct2__c, UseProduct3__c,  Person_In_Charge2__c,doctor2__c,Submit_date__c,Report_Date__c
                            from Agency_Report__c where id=:report_id];
                System.assertEquals(Department_Cateogy, data.Department_Cateogy__c);
                Department_Cateogy = 'OTH';
                report_id = RetrospectiveWeeklyReportController.editAgencyReport(report_id,Department_Cateogy,ConsumptionOfConsumables,
                                                            WorkMark,warlocksNumber,DealerPersonnel,WarlockClassification,ProductCcategory,productCategories,ProductClassification,
                                                            EffectProgress,WorkRecord,Agency_Report_Header,
                                                            Agency_Hospital, Person_In_Charge2, doctor, Submit_date,
                                                            UseProduct1, UseProduct2, UseProduct3,
                                                            Report_Date);
                data = [select Id, Name, Department_Cateogy__c, ConsumptionOfConsumables__c, WorkRecord__c,EffectProgress__c,WarlockClassification__c,
                            ProductCcategory__c, productCategories__c,warlocksNumber__c,WorkMark__c,ProductClassification__c,DealerPersonnel__c, Agency_Report_Header__c,Agency_Hospital__c,UseProduct1__c,
                            UseProduct2__c, UseProduct3__c,  Person_In_Charge2__c,doctor2__c,Submit_date__c,Report_Date__c
                            from Agency_Report__c where id=:report_id];
                System.assertEquals(Department_Cateogy, data.Department_Cateogy__c);
                Test.stopTest();
            }
        }
        @isTest public static void getReports() {
            saveAgencyReportTest();
            System.runAs(user) {
                String date_str = '2022-02-28';
                String person_str = '';
                Test.startTest();
                RetrospectiveWeeklyReportController reports = RetrospectiveWeeklyReportController.getReports(date_str, person_str);
                List<Agency_Report__c> report = RetrospectiveWeeklyReportController.getReportsById(report_id);
                Test.stopTest();
                system.assertEquals(report_id, report[0].Id);
            }
        }
        @isTest public static void processData02() {
            testInit();
            OlympusCalendar__c oc1 = new OlympusCalendar__c();
            oc1.Date__c = Date.valueOf('2022-3-1');
            insert oc1;
            OlympusCalendar__c oc2 = new OlympusCalendar__c();
            oc2.Date__c = Date.valueOf('2022-3-2');
            insert oc2;
            OlympusCalendar__c oc3 = new OlympusCalendar__c();
            oc3.Date__c = Date.valueOf('2022-2-28');
            insert oc3;
            Test.startTest();
            System.runAs(user) {
            String reports = RetrospectiveWeeklyReportController.processData('"周,担当,活动日,医院,科室,经销商人员,工作记录,医院人员,产品分类(第三分类),使用产品1(产品型号),使用产品2,使用产品3,效果/进度,科室同类耗材月使用量,术士分类,已采用其他品牌,产品用量,工作标记\r\n,,,,,,,,,,,,,,,,,,\r\n','',null);
            }
            Test.stopTest();
        }
    }
force-app/main/default/classes/RetrospectiveWeeklyReportTest.cls-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>52.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/SI_NewQuoteEntryController.cls
@@ -12,6 +12,8 @@
    //lastbuy  2022/2/9 fy start
    public Boolean filg { get; set; }
    public Integer flglastbuy { get; set; }
    public String errorProductmodel { get; set; }
    //lastbuy  2022/2/9 fy end
    public String excel_text { get; set; }
@@ -418,7 +420,8 @@
                    ,PricebookEntry.Product2.NoDiscount_Foreign__c 
                    ,Quote.Opportunity.Trade__c 
                    //外贸多年保 2021/01/27 精琢技术 wql end
                    //fy 预留产品标识
                    ,PricebookEntry.Product2.LastbuyProductFLG__c
                    //SFDC停止预警 lt 20211009 start
                    ,PricebookEntry.Product2.Estimated_ConsumptionDueDate__c
                    //SFDC停止预警 lt 20211009 end
@@ -817,7 +820,8 @@
               //NoDiscount 金额(USD)
               ,NoDiscount_Foreign__c
               //外贸多年保 2021/01/27 精琢技术 wql end
                //fy 预留产品标识
                ,LastbuyProductFLG__c
               //SFDC停止预警 lt 20211009 start
               ,Estimated_ConsumptionDueDate__c
               //SFDC停止预警 lt 20211009 end
@@ -1230,7 +1234,8 @@
                        //NoDiscount 金额(USD)
                        ,NoDiscount_Foreign__c
                        //外贸多年保 2021/01/27 精琢技术 wql end
                        //fy 预留产品标识
                        ,LastbuyProductFLG__c
                        //SFDC停止预警 lt 20211009 start
                        ,Estimated_ConsumptionDueDate__c
                        //SFDC停止预警 lt 20211009 end
@@ -1682,9 +1687,19 @@
            }
            //20220215 fy lastbuy start
            if(!ReservedProductVerification()){
                errorflg = true;
                errormessage =  '产品数量不可超过产品预留数量' ;
                return null;
                if(flglastbuy==1){
                    errorflg = true;
                    errormessage =  '预留产品表中没有录入该报价的预留产品' ;
                    return null;
                  }else if(flglastbuy==2){
                    errorflg = true;
                    errormessage =  errorProductmodel+'产品数量不可超过产品预留数量' ;
                    return null;
                  }else if(flglastbuy==3){
                    errorflg = true;
                    errormessage =  '预留产品'+errorProductmodel+'未录入预留产品表';
                    return null;
                  }
            }
              //20220215 fy lastbuy end
            system.debug('PassFlg:'+PassFlg);
@@ -2774,26 +2789,79 @@
public boolean ReservedProductVerification() {
    filg=true;
    Map<string,QuoteLineItem> quotlinitMap = new Map<string,QuoteLineItem>();
    List<Id> lastProductFLGList = new List<Id>();
    for(QELine qli : activities){
      lastProductFLGList.add(qli.pageObject.PricebookEntry.Product2Id);
      quotlinitMap.put(qli.pageObject.PricebookEntry.Product2Id,qli.pageObject);
    List<Id> lastProductFLGListId = new List<Id>();
    List<QuoteLineItem> lastProductFLGList = new List<QuoteLineItem>();
    List<QuoteLineItem> act = new List<QuoteLineItem>();
    List<QuoteLineItem> act2 = new List<QuoteLineItem>();
    for(QELine aaa :activities){
      if(aaa.pageObject.PricebookEntry.Product2Id!=null){
        act.add(aaa.pageObject);
      }
    }
    if(lastProductFLGList!=null){
        List<LastbuyProduct__c> LastbuyObjList=[select id,LastbuyQuantity__c,InquiryCode__c,ProductName__c,effectiveFLG__c from LastbuyProduct__c where InquiryCode__c= : oppId and ProductName__c in :lastProductFLGList and  effectiveFLG__c= true];
        if(LastbuyObjList!=null){
            for(LastbuyProduct__c lastbuypr :LastbuyObjList){
              Decimal quoteLItemNum=0;
              if(quotlinitMap.containsKey(lastbuypr.ProductName__c)){
                  quoteLItemNum=quotlinitMap.get(lastbuypr.ProductName__c).Quantity__c;
              }else{
                  continue;
              }
              if(lastbuypr.LastbuyQuantity__c<quoteLItemNum){
                filg=false;
                break;
              }
    act2=act.deepClone();
    Map<String,QuoteLineItem> map1 = new Map<String,QuoteLineItem>();
    System.debug('activities1111111111112为所当为多多!!!'+activities);
    integer i =0;
    for(QuoteLineItem pspsc :act2){
      if(pspsc.PricebookEntry.Product2Id!=null){
        if(map1.containsKey(pspsc.PricebookEntry.Product2Id)){
          QuoteLineItem quoteLine = map1.get(pspsc.PricebookEntry.Product2Id);
          quoteLine.Quantity__c =quoteLine.Quantity__c+pspsc.Quantity__c;
          map1.put(pspsc.PricebookEntry.Product2Id,quoteLine);
        }else{
          map1.put(pspsc.PricebookEntry.Product2Id,pspsc);
        }
        // System.debug('34499879!!!'+activities);
      }
    }
    System.debug('3434343!!!'+activities);
    System.debug('5656565!!!'+map1);
    for (QuoteLineItem value : map1.values()) {
      if(value.PricebookEntry.Product2.LastbuyProductFLG__c){
        lastProductFLGListId.add(value.PricebookEntry.Product2Id);
        quotlinitMap.put(value.PricebookEntry.Product2Id,value);
        lastProductFLGList.add(value);
      }
    }
    System.debug('activities++++!!!'+activities);
    System.debug('activities!!!'+map1.values());
    System.debug('oppId!!!'+oppId);
    System.debug('lastProductFLGList!!!'+lastProductFLGListId);
    if(lastProductFLGListId!=null&&lastProductFLGListId.size()!=0){
        List<LastbuyProduct__c> LastbuyObjList=[select id,LastbuyQuantity__c,InquiryCode__c,ProductName__c,effectiveFLG__c from LastbuyProduct__c where InquiryCode__c= : oppId and ProductName__c in :lastProductFLGListId and effectiveFLG__c = true];
        Map<string,LastbuyProduct__c> LastbuyObjMap = new Map<string,LastbuyProduct__c>();
        System.debug('LastbuyObjList+++++!!!'+LastbuyObjList);
        if(LastbuyObjList!=null&&LastbuyObjList.size()!=0){
          for(LastbuyProduct__c lastbuypr :LastbuyObjList){
            LastbuyObjMap.put(lastbuypr.ProductName__c,lastbuypr);
          }
        }else{
          flglastbuy=1;
          filg=false;
          return filg;
        }
        System.debug('LastbuyObjMap!!!'+LastbuyObjMap);
        System.debug('lastProductFLGList+++++++!!!'+lastProductFLGList);
        if(lastProductFLGList!=null&&lastProductFLGList.size()!=0){
          for(QuoteLineItem lastbuypr :lastProductFLGList){
            Decimal quoteLItemNum=0;
            if(LastbuyObjMap.containsKey(lastbuypr.PricebookEntry.Product2Id)){
                quoteLItemNum=LastbuyObjMap.get(lastbuypr.PricebookEntry.Product2Id).LastbuyQuantity__c;
                System.debug('quoteLItemNum!!!'+quoteLItemNum);
                System.debug('lastbuypr.pageObject.Quantity__c+++!!!'+lastbuypr.Quantity__c);
                if(lastbuypr.Quantity__c>quoteLItemNum){
                  errorProductmodel=lastbuypr.Asset_Model_No__c;
                  flglastbuy=2;
                  filg=false;
                  break;
                }
            }else{
              errorProductmodel=lastbuypr.Asset_Model_No__c;
              flglastbuy=3;
              filg=false;
              break;
            }
          }
        }
    }
    system.debug('filg====='+filg);
force-app/main/default/classes/SampleInventoryControllerTest.cls
@@ -6,12 +6,21 @@
        if (rectCo.size() == 0) {
            throw new ControllerUtil.myException('not found 办事处 recodetype');
        }
        List<RecordType> rectCo1 = [select Id from RecordType where IsActive = true and SobjectType = 'Sample_order_list_detail__c' and Name = '盘点'];
        if (rectCo.size() == 0) {
            throw new ControllerUtil.myException('not found 盘点 recodetype');
        }
        // 客户
        Account account2 = new Account();
        account2.Name = 'test1经销商';
        account2.RecordTypeId = '01210000000Qem1';
        insert account2;
        Account Agency = new Account();
        Agency.RecordTypeId = rectCo[0].Id;
        Agency.Name = 'Katsu テスト';
        Agency.Quolified_Approve_Status__c = 'Draft';
        Agency.If_Need_Quolified__c = true;
        Agency.ParentId = account2.Id;
        insert Agency;
        // 产品
        Product2 product = new Product2();
@@ -55,7 +64,7 @@
        samOrderDetail.Standards__c        = 1;
        samOrderDetail.ItemQuantity__c     = 1;
        samOrderDetail.Inventory_Check__c  = 10;
        samOrderDetail.RecordTypeId        = '0121m000000xWyw';
        samOrderDetail.RecordTypeId        = rectCo1[0].Id;
        samOrderDetail.Inventory_Header__c = IHN.Id;
        insert samOrderDetail;
force-app/main/default/classes/SampleInventorySectionControllerTest.cls
@@ -7,11 +7,16 @@
            throw new ControllerUtil.myException('not found 办事处 recodetype');
        }
        // 客户
        Account account2 = new Account();
        account2.Name = 'test1经销商';
        account2.RecordTypeId = '01210000000Qem1';
        insert account2;
        Account Agency = new Account();
        Agency.RecordTypeId                = rectCo[0].Id;
        Agency.Name                        = 'Katsu テスト';
        Agency.Quolified_Approve_Status__c = 'Draft';
        Agency.If_Need_Quolified__c        = true;
        Agency.ParentId = account2.Id;
        insert Agency;
        // 产品
force-app/main/default/classes/SelectAssetEstimateVMController.cls
@@ -1,3 +1,4 @@
/*gzw 优化Maximum view state size limit 追加 Transient */
global class SelectAssetEstimateVMController {
    //test
    private String targetHospitalId = null;                                    // 今後系列病院用
@@ -25,7 +26,7 @@
    public Asset ass { get; set; }
    // 2021、8、26 合同报价页面的优化,无保有设备点检对象选择框变黑 fxk end
    // 病院配下の納入機器の情報を格納する。
    private List<Asset> assetRecords;                                               // TODO 系列病院の場合、この配列は固定できないです。
    private Transient List<Asset> assetRecords;                                               // TODO 系列病院の場合、この配列は固定できないです。
    public List<AssetInfo> checkedAssets { get; set; }
    private List<AssetInfo> unCheckedAssets = new List<AssetInfo>();
    
@@ -3174,21 +3175,21 @@
    public class AssetInfo {
    // 新合同备品确保提供 当前标记
    public Boolean etGFlg {get; set;}
    public Integer lineNo {get; private set;}
    public Transient Integer lineNo {get; private set;}
    public Boolean rec_checkBox_c {get; set;}
    public Asset rec { get; set; }
    public Maintenance_Contract_Asset_Estimate__c mcae { get; set; }
    public Boolean isManual { get; set; }
    public Decimal orgPrice {get; private set;}
    public Decimal orgPrice12 {get; private set;}
    public Transient Decimal orgPrice {get; private set;}
    public Transient Decimal orgPrice12 {get; private set;}
    // add by fxk 2021/9/9 控制点检对象是否可选 Star
    public Boolean CheckRows {get; private set;}
    // add by fxk 2021/9/9 控制点检对象是否可选 End
    
    //add by rentx 2020-11-12 LJPH-BV93RZ start
    public String proName;
    public String proSerialNumber;
    public String proSerialName;
    public Transient String proName;
    public Transient String proSerialNumber;
    public Transient String proSerialName;
    //add by rentx 2020-11-12 LJPH-BV93RZ end
    //add by mzy 2020-11-12 LJPH-BX9CVX start
    //public Date NoPartRiskDate;
force-app/main/default/classes/SimpleEventRegisterController.cls
@@ -1030,7 +1030,7 @@
                    }
                }
                if (this.targetEvent.Activity_Type2__c == '販売店') {
                    taskType = System.Label.AgencyVisit; // 经销商拜访任务
                    taskType = System.Label.AgencyVisit; // 经销商支持任务
                }
                if (this.targetEvent.Activity_Type2__c == '社外イベント') {
                    taskType = System.Label.campaignFollow; // 学术会议跟进任务
@@ -1149,7 +1149,7 @@
                taskAccType = '用户拜访';
            }
            if (this.targetEvent.Activity_Type2__c == '販売店') {
                taskAccType = '经销商拜访';
                taskAccType = '经销商支持';
            }
            if (this.targetEvent.Activity_Type2__c == '社外イベント') {
                taskAccType = '学术会议';
@@ -1182,7 +1182,7 @@
                    taskAccType = '用户拜访';
                }
                if (this.targetEvent.Activity_Type2__c == '販売店') {
                    taskAccType = '经销商拜访';
                    taskAccType = '经销商支持';
                }
                if (this.targetEvent.Activity_Type2__c == '社外イベント') {
                    taskAccType = '学术会议';
force-app/main/default/classes/StaticParameter.cls
@@ -57,6 +57,9 @@
    public static Boolean EscapeOtherUpdateTenOwner = true;
    public static Boolean EscapeContactToUser = false;
    // 跳过NFM701接口
    public static Boolean EscapeNFM701Trigger = true;
    public StaticParameter(){
    }
force-app/main/default/classes/StatusPageController.cls
@@ -2,9 +2,6 @@
    public StatusPageController() {
        Inquiryform = new Inquiry_form__c();
    }
    public String status{get;set;}
    public String search{get;set;}
    public String reason{get;set;}
    public Inquiry_form__c Inquiryform{get; set;}
    public void init(){
@@ -37,7 +34,14 @@
            if (String.isBlank(Inquiryform.Follow_Content__c) && String.isBlank(Inquiryform.Follow_Content_Other__c)) {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '跟进内容不能为空'));
            }
            if (String.isBlank(Inquiryform.Follow_Content__c)) {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '跟进内容不能为空'));
            }
            if ('其他'.equals(Inquiryform.Follow_Content__c) && String.isBlank(Inquiryform.Follow_Content_Other__c)) {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '跟进内容(其他)不能为空'));
            }
            // Date nowDT = Date.now();
            Inquiryform.Follow_Date__c = Date.toDay();
            Inquiryform.Status__c = '03.已跟进';
            update Inquiryform;
        }
force-app/main/default/classes/StatusPageControllerTest.cls
New file
@@ -0,0 +1,352 @@
@isTest
private class StatusPageControllerTest {
    static testMethod void testMethod1() {
        //医院
        List<RecordType> rectHp = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'];
        if (rectHp.size() == 0) {
            return;
        }
        //科室
        List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_GI'];
        if (rectDpt.size() == 0) {
            return;
        }
        Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin];
        User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '北京', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
        insert hpOwner;
        User hpOwner2 = new User(Test_staff__c = true, LastName = 'hp2', FirstName = 'owner', Alias = 'hp2', Work_Location__c = '重庆', CommunityNickname = 'hpOwner2', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner2@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
        insert hpOwner2;
        Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'hp', OwnerId = hpOwner.Id);
        hp.FSE_GI_Main_Leader__c = hpOwner.Id;
        hp.FSE_SP_Main_Leader__c = hpOwner2.Id;
        insert hp;
        //战略科室
        Account dc = [select Id, Name, RecordType_DeveloperName__c, Account2__c from Account where ParentId = :hp.Id and RecordType_DeveloperName__c = 'Department_Class_GI'];
        Account dpt = new Account(RecordTypeId = rectDpt[0].Id);
        dpt.Name         = '*';
        dpt.Department_Name__c  = 'TestDepart';
        dpt.ParentId            = dc.Id;
        dpt.Department_Class__c = dc.Id;
        dpt.Hospital__c         = hp.Id;
        insert dpt;
        Account dpt1 = new Account(RecordTypeId = rectDpt[0].Id);
        dpt1.Name         = '*';
        dpt1.Department_Name__c  = 'TestDepart1';
        dpt1.ParentId            = dc.Id;
        dpt1.Department_Class__c = dc.Id;
        dpt1.Hospital__c         = hp.Id;
        insert dpt1;
        Inquiry_form__c inquiryform = new Inquiry_form__c();
        // inquiryform.Name = '2019102101';
        inquiryform.Hospital_Name__c = dpt1.Id;
        List<Account> dpecList = [select Id,Department_Class__c from Account where Id =: dpt1.Id];
        inquiryform.Department_Class__c = dpecList[0].Department_Class__c;
        inquiryform.Status__c ='01.未跟进';
        inquiryform.Company__c ='北京某某某测试公司';
        inquiryform.Family_Name__c ='靳';
        inquiryform.Opportunity_Division__c = '询价';
        inquiryform.Phone__c = '13844756322';
        inquiryform.Product1__c = '超声';
        inquiryform.Request1__c = '需要报价';
        inquiryform.Reasons_options__c = '已经有询价';
        Test.startTest();
        insert inquiryform;
        PageReference page = new PageReference('/apex/StatusPage?id='+inquiryform.Id);
        System.Test.setCurrentPage(page);
        StatusPageController controller = new StatusPageController();
        controller.init();
        controller.save();
        controller.savefo();
    }
    static testMethod void testMethod2() {
        //医院
        List<RecordType> rectHp = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'];
        if (rectHp.size() == 0) {
            return;
        }
        //科室
        List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_GI'];
        if (rectDpt.size() == 0) {
            return;
        }
        Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin];
        User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '北京', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
        insert hpOwner;
        User hpOwner2 = new User(Test_staff__c = true, LastName = 'hp2', FirstName = 'owner', Alias = 'hp2', Work_Location__c = '重庆', CommunityNickname = 'hpOwner2', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner2@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
        insert hpOwner2;
        Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'hp', OwnerId = hpOwner.Id);
        hp.FSE_GI_Main_Leader__c = hpOwner.Id;
        hp.FSE_SP_Main_Leader__c = hpOwner2.Id;
        insert hp;
        //战略科室
        Account dc = [select Id, Name, RecordType_DeveloperName__c, Account2__c from Account where ParentId = :hp.Id and RecordType_DeveloperName__c = 'Department_Class_GI'];
        Account dpt = new Account(RecordTypeId = rectDpt[0].Id);
        dpt.Name         = '*';
        dpt.Department_Name__c  = 'TestDepart';
        dpt.ParentId            = dc.Id;
        dpt.Department_Class__c = dc.Id;
        dpt.Hospital__c         = hp.Id;
        insert dpt;
        Account dpt1 = new Account(RecordTypeId = rectDpt[0].Id);
        dpt1.Name         = '*';
        dpt1.Department_Name__c  = 'TestDepart1';
        dpt1.ParentId            = dc.Id;
        dpt1.Department_Class__c = dc.Id;
        dpt1.Hospital__c         = hp.Id;
        insert dpt1;
        Inquiry_form__c inquiryform = new Inquiry_form__c();
        // inquiryform.Name = '2019102101';
        inquiryform.Hospital_Name__c = dpt1.Id;
        List<Account> dpecList = [select Id,Department_Class__c from Account where Id =: dpt1.Id];
        inquiryform.Department_Class__c = dpecList[0].Department_Class__c;
        inquiryform.Status__c ='01.未跟进';
        inquiryform.Company__c ='北京某某某测试公司';
        inquiryform.Family_Name__c ='靳';
        inquiryform.Opportunity_Division__c = '询价';
        inquiryform.Phone__c = '13844756322';
        inquiryform.Product1__c = '超声';
        inquiryform.Request1__c = '需要报价';
        inquiryform.Reasons_options__c = '客户无意向';
        inquiryform.Follow_Content__c = '';
        Test.startTest();
        insert inquiryform;
        PageReference page = new PageReference('/apex/StatusPage?id='+inquiryform.Id);
        System.Test.setCurrentPage(page);
        StatusPageController controller = new StatusPageController();
        controller.init();
        controller.save();
        controller.savefo();
    }
    static testMethod void testMethod2_1() {
        //医院
        List<RecordType> rectHp = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'];
        if (rectHp.size() == 0) {
            return;
        }
        //科室
        List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_GI'];
        if (rectDpt.size() == 0) {
            return;
        }
        Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin];
        User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '北京', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
        insert hpOwner;
        User hpOwner2 = new User(Test_staff__c = true, LastName = 'hp2', FirstName = 'owner', Alias = 'hp2', Work_Location__c = '重庆', CommunityNickname = 'hpOwner2', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner2@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
        insert hpOwner2;
        Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'hp', OwnerId = hpOwner.Id);
        hp.FSE_GI_Main_Leader__c = hpOwner.Id;
        hp.FSE_SP_Main_Leader__c = hpOwner2.Id;
        insert hp;
        //战略科室
        Account dc = [select Id, Name, RecordType_DeveloperName__c, Account2__c from Account where ParentId = :hp.Id and RecordType_DeveloperName__c = 'Department_Class_GI'];
        Account dpt = new Account(RecordTypeId = rectDpt[0].Id);
        dpt.Name         = '*';
        dpt.Department_Name__c  = 'TestDepart';
        dpt.ParentId            = dc.Id;
        dpt.Department_Class__c = dc.Id;
        dpt.Hospital__c         = hp.Id;
        insert dpt;
        Account dpt1 = new Account(RecordTypeId = rectDpt[0].Id);
        dpt1.Name         = '*';
        dpt1.Department_Name__c  = 'TestDepart1';
        dpt1.ParentId            = dc.Id;
        dpt1.Department_Class__c = dc.Id;
        dpt1.Hospital__c         = hp.Id;
        insert dpt1;
        Inquiry_form__c inquiryform = new Inquiry_form__c();
        // inquiryform.Name = '2019102101';
        inquiryform.Hospital_Name__c = dpt1.Id;
        List<Account> dpecList = [select Id,Department_Class__c from Account where Id =: dpt1.Id];
        inquiryform.Department_Class__c = dpecList[0].Department_Class__c;
        inquiryform.Status__c ='01.未跟进';
        inquiryform.Company__c ='北京某某某测试公司';
        inquiryform.Family_Name__c ='靳';
        inquiryform.Opportunity_Division__c = '询价';
        inquiryform.Phone__c = '13844756322';
        inquiryform.Product1__c = '超声';
        inquiryform.Request1__c = '需要报价';
        inquiryform.Reasons_options__c = '';
        inquiryform.Follow_Content__c = '';
        Test.startTest();
        insert inquiryform;
        PageReference page = new PageReference('/apex/StatusPage?id='+inquiryform.Id);
        System.Test.setCurrentPage(page);
        StatusPageController controller = new StatusPageController();
        controller.init();
        controller.save();
    }
    static testMethod void testMethod3() {
        //医院
        List<RecordType> rectHp = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'];
        if (rectHp.size() == 0) {
            return;
        }
        //科室
        List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_GI'];
        if (rectDpt.size() == 0) {
            return;
        }
        Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin];
        User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '北京', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
        insert hpOwner;
        User hpOwner2 = new User(Test_staff__c = true, LastName = 'hp2', FirstName = 'owner', Alias = 'hp2', Work_Location__c = '重庆', CommunityNickname = 'hpOwner2', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner2@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
        insert hpOwner2;
        Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'hp', OwnerId = hpOwner.Id);
        hp.FSE_GI_Main_Leader__c = hpOwner.Id;
        hp.FSE_SP_Main_Leader__c = hpOwner2.Id;
        insert hp;
        //战略科室
        Account dc = [select Id, Name, RecordType_DeveloperName__c, Account2__c from Account where ParentId = :hp.Id and RecordType_DeveloperName__c = 'Department_Class_GI'];
        Account dpt = new Account(RecordTypeId = rectDpt[0].Id);
        dpt.Name         = '*';
        dpt.Department_Name__c  = 'TestDepart';
        dpt.ParentId            = dc.Id;
        dpt.Department_Class__c = dc.Id;
        dpt.Hospital__c         = hp.Id;
        insert dpt;
        Account dpt1 = new Account(RecordTypeId = rectDpt[0].Id);
        dpt1.Name         = '*';
        dpt1.Department_Name__c  = 'TestDepart1';
        dpt1.ParentId            = dc.Id;
        dpt1.Department_Class__c = dc.Id;
        dpt1.Hospital__c         = hp.Id;
        insert dpt1;
        Inquiry_form__c inquiryform = new Inquiry_form__c();
        // inquiryform.Name = '2019102101';
        inquiryform.Hospital_Name__c = dpt1.Id;
        List<Account> dpecList = [select Id,Department_Class__c from Account where Id =: dpt1.Id];
        inquiryform.Department_Class__c = dpecList[0].Department_Class__c;
        inquiryform.Status__c ='01.未跟进';
        inquiryform.Company__c ='北京某某某测试公司';
        inquiryform.Family_Name__c ='靳';
        inquiryform.Opportunity_Division__c = '询价';
        inquiryform.Phone__c = '13844756322';
        inquiryform.Product1__c = '超声';
        inquiryform.Request1__c = '需要报价';
        inquiryform.Reasons_options__c = '客户无意向';
        inquiryform.Follow_Content_Other__c = '';
        inquiryform.Follow_Content__c = '';
        Test.startTest();
        insert inquiryform;
        PageReference page = new PageReference('/apex/FollowPage?id='+inquiryform.Id);
        System.Test.setCurrentPage(page);
        StatusPageController controller = new StatusPageController();
        controller.init();
        controller.savefo();
    }
    static testMethod void testMethod4() {
        //医院
        List<RecordType> rectHp = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'];
        if (rectHp.size() == 0) {
            return;
        }
        //科室
        List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_GI'];
        if (rectDpt.size() == 0) {
            return;
        }
        Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin];
        User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '北京', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
        insert hpOwner;
        User hpOwner2 = new User(Test_staff__c = true, LastName = 'hp2', FirstName = 'owner', Alias = 'hp2', Work_Location__c = '重庆', CommunityNickname = 'hpOwner2', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner2@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
        insert hpOwner2;
        Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'hp', OwnerId = hpOwner.Id);
        hp.FSE_GI_Main_Leader__c = hpOwner.Id;
        hp.FSE_SP_Main_Leader__c = hpOwner2.Id;
        insert hp;
        //战略科室
        Account dc = [select Id, Name, RecordType_DeveloperName__c, Account2__c from Account where ParentId = :hp.Id and RecordType_DeveloperName__c = 'Department_Class_GI'];
        Account dpt = new Account(RecordTypeId = rectDpt[0].Id);
        dpt.Name         = '*';
        dpt.Department_Name__c  = 'TestDepart';
        dpt.ParentId            = dc.Id;
        dpt.Department_Class__c = dc.Id;
        dpt.Hospital__c         = hp.Id;
        insert dpt;
        Account dpt1 = new Account(RecordTypeId = rectDpt[0].Id);
        dpt1.Name         = '*';
        dpt1.Department_Name__c  = 'TestDepart1';
        dpt1.ParentId            = dc.Id;
        dpt1.Department_Class__c = dc.Id;
        dpt1.Hospital__c         = hp.Id;
        insert dpt1;
        Inquiry_form__c inquiryform = new Inquiry_form__c();
        // inquiryform.Name = '2019102101';
        inquiryform.Hospital_Name__c = dpt1.Id;
        List<Account> dpecList = [select Id,Department_Class__c from Account where Id =: dpt1.Id];
        inquiryform.Department_Class__c = dpecList[0].Department_Class__c;
        inquiryform.Status__c ='01.未跟进';
        inquiryform.Company__c ='北京某某某测试公司';
        inquiryform.Family_Name__c ='靳';
        inquiryform.Opportunity_Division__c = '询价';
        inquiryform.Phone__c = '13844756322';
        inquiryform.Product1__c = '超声';
        inquiryform.Request1__c = '需要报价';
        inquiryform.Reasons_options__c = '客户无意向';
        inquiryform.Follow_Content_Other__c = '';
        inquiryform.Follow_Content__c = '其他';
        Test.startTest();
        insert inquiryform;
        PageReference page = new PageReference('/apex/FollowPage?id='+inquiryform.Id);
        System.Test.setCurrentPage(page);
        StatusPageController controller = new StatusPageController();
        controller.init();
        controller.savefo();
    }
}
force-app/main/default/classes/StatusPageControllerTest.cls-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>41.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/TaskObjectTriggerHandle.cls
@@ -235,7 +235,7 @@
        taskPREMap.put('H层拜访','用户拜访:AccountName');
        taskPREMap.put('OPD','用户拜访:AccountName');
        taskPREMap.put('SLA报告书任务','服务合同发放报告书任务(AccountName)');
        taskPREMap.put('经销商拜访','经销商拜访:AccountName');
        taskPREMap.put('经销商支持','经销商支持:AccountName');
        taskPREMap.put('学术会议跟进','学术会议:CampaignName');
        taskPREMap.put('服务季报','用户拜访:AccountName');
        taskPREMap.put('目标客户拜访','用户拜访:AccountName');
force-app/main/default/classes/TenderDeleteLwcController.cls
@@ -2,7 +2,7 @@
    @AuraEnabled
    public static  String GetTenderinformationcData(String ParamIdStr) {
         List<Tender_information__c> arrays = Database.query('Select Id, InfoId__c, Logical_delete__c, ProjectId__c, Retain_Tender__c From Tender_information__c Where id = : ParamIdStr');
         List<Tender_information__c> arrays = Database.query('Select Id,Name,InfoId__c,Logical_delete__c,ProjectId__c,Retain_Tender__c From Tender_information__c Where id = : ParamIdStr');
         
         return JSON.serialize(arrays);
    }
@@ -58,9 +58,20 @@
                    insert addlinksList;
                }
            }
            // 【委托】招标项目-逻辑删除的项目需要自动取消与询价的关系 fy 2022.3.7 start
            List<Tender_Opportunity_Link__c> linksListdelect = [select id, Opportunity__c, Tender_information__c
                    from Tender_Opportunity_Link__c
                    where Tender_information__c = :TenInfo.Id];
            if(linksListdelect.size()>0){
                delete linksListdelect;
            }
            // 【委托】招标项目-逻辑删除的项目需要自动取消与询价的关系 fy 2022.3.7 end
            // }
            // 互换保留招投标与删除招投标的信息Id
            TenInfo.Retain_Tender__c = BTen.Id;
            // 【委托】招标项目-逻辑删除的项目需要自动取消与询价的关系 fy 2022.3.7 start
            TenInfo.Name = '逻辑删除:'+TenInfo.Name;
            // 【委托】招标项目-逻辑删除的项目需要自动取消与询价的关系 fy 2022.3.7 end
            String BTenInfo = BTen.InfoId__c;
            BTen.InfoId__c = TenInfo.InfoId__c;//保留招投标的信息Id赋给删除招投标的信息Id
            TenInfo.InfoId__c = BTenInfo;//删除招投标的信息Id赋给保留招投标的信息Id
force-app/main/default/classes/TenderWebService.cls
@@ -4,7 +4,7 @@
    }
    //招投标反逻辑删除
    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];
        Tender_information__c DTenInfo = [Select Id,Name, 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>();
        // 更新保留招投标
@@ -62,6 +62,15 @@
            // 互换保留招投标与删除招投标的信息Id
            DTenInfo.Retain_Tender__c = BTen.Id;
            if(String.isNotBlank(DTenInfo.Name)){
                String Namesliep=DTenInfo.Name.substring(0,5);
                system.debug('Namesliep++'+Namesliep);
                system.debug('234234++'+Namesliep.equals('逻辑删除:'));
                if(Namesliep.equals('逻辑删除:')){
                    DTenInfo.Name=DTenInfo.Name.substring(5);
                }
            }
            String BTenInfo = BTen.InfoId__c;
            BTen.InfoId__c = DTenInfo.InfoId__c;//保留招投标的信息Id赋给删除招投标的信息Id
            DTenInfo.InfoId__c = BTenInfo;//删除招投标的信息Id赋给保留招投标的信息Id
force-app/main/default/classes/UploadOBPMController.cls
@@ -1,9 +1,10 @@
public without sharing class UploadOBPMController {
    private String Id { get; set; }
    private String errorStr { get; set; }
    public boolean hasError { get; set; }
    public Boolean hasError { get; set; }
    public List<OBPMInfo> OBPMInfoList { get; set; }
    public Integer lineNo { get; set; }
    public Boolean IF_Approved { get; set; }
    public UploadOBPMController() {
        Id = ApexPages.currentPage().getParameters().get('id');
@@ -13,17 +14,54 @@
        hasError = false;
        OBPMInfoList = new  List<OBPMInfo>();
        
        List<Campaign> camList = [select id, Name, Shared_User__c from Campaign where id = :Id];
        if (camList.size() == 0) {
        Campaign cam = [select id, Name, Shared_User__c, IF_Approved__c, Shared_Editing__c, Carbon_Copy__c from Campaign where id = :Id];
        if (cam == null || String.isBlank(cam.Id)) {
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '学会不存在。'));
            hasError = true;
            return;
        }
        IF_Approved = cam.IF_Approved__c;
        List<String> user_nos = new List<String>();
        if (String.isNotBlank(cam.Shared_Editing__c)) {
            user_nos.addAll(cam.Shared_Editing__c.split(','));
        }
        if (String.isNotBlank(cam.Carbon_Copy__c)) {
            user_nos.addAll(cam.Carbon_Copy__c.split(','));
        }
        List<User> users = new List<User>();
        if (user_nos.size() > 0) {
            users = [select Id, Employee_No__c from User where Employee_No__c in :user_nos];
        }
        Integer line = 0;
        for (Integer i = 0; i < 5; i++) {
            line += 1;
            OBPMInfo temp = new OBPMInfo(line, new Campaign());
            OBPMInfoList.add(temp);
        if (users != null && users.size() > 0) {
            for(User u : users) {
                line += 1;
                Campaign t_cam = new Campaign();
                t_cam.Shared_User__c = u.Id;
                OBPMInfo temp = new OBPMInfo(line, t_cam);
                if (String.isNotBlank(cam.Shared_Editing__c) && cam.Shared_Editing__c.contains(u.Employee_No__c)) {
                    temp.Role = '共同编辑人';
                } else if (String.isNotBlank(cam.Carbon_Copy__c) && cam.Carbon_Copy__c.contains(u.Employee_No__c)) {
                    temp.Role = '抄送人';
                }
                OBPMInfoList.add(temp);
            }
            if (users.size() < 5) {
                Integer line_add = 5 - users.size();
                for (Integer i = 0; i < line_add; i++) {
                    OBPMInfo temp = new OBPMInfo(line, new Campaign());
                    OBPMInfoList.add(temp);
                }
            }
        } else {
            for (Integer i = 0; i < 5; i++) {
                line += 1;
                OBPMInfo temp = new OBPMInfo(line, new Campaign());
                OBPMInfoList.add(temp);
            }
        }
    }
@@ -61,7 +99,7 @@
        return null;
    }
    public PageReference uploadOBPM() {
    public void uploadOBPM() {
        List<String> userIdList = new List<String>();
        Map<String,String> userMap = new Map<String,String>();
        List<Campaign> camList = new List<Campaign>();
@@ -72,8 +110,8 @@
            }
        }
        if(userIdList.size() > 0){
            String SharedEditing;
            String CarbonCopy;
            String SharedEditing = '';
            String CarbonCopy = '';
            List<User> userList = [select id, Employee_No__c from User where id = :userIdList];
            for(User user : userList){
                userMap.put(user.id, user.Employee_No__c);
@@ -82,34 +120,38 @@
                if(String.isNotBlank(ob.cam.Shared_User__c)){
                    if(userMap.containsKey(ob.cam.Shared_User__c)){
                        if(ob.Role == '共同编辑人'){
                            SharedEditing += userMap.get(ob.cam.Shared_User__c) + ',';
                            SharedEditing += String.isNotBlank(userMap.get(ob.cam.Shared_User__c))? userMap.get(ob.cam.Shared_User__c) + ',' : '';
                        } else if(ob.Role == '抄送人'){
                            CarbonCopy += userMap.get(ob.cam.Shared_User__c) + ',';
                            CarbonCopy += String.isNotBlank(userMap.get(ob.cam.Shared_User__c))? userMap.get(ob.cam.Shared_User__c) + ',' : '';
                        }
                    }
                }
            }
            //截取掉null和最后的逗号
            SharedEditing = SharedEditing.substring(4, SharedEditing.lastIndexOf(','));
            CarbonCopy = CarbonCopy.substring(4, CarbonCopy.lastIndexOf(','));
            SharedEditing = SharedEditing.length() > 0 ? SharedEditing.substring(0, SharedEditing.lastIndexOf(',')) : '';
            CarbonCopy = CarbonCopy.length() > 0 ? CarbonCopy.substring(0, CarbonCopy.lastIndexOf(',')) : '';
            cam.Shared_Editing__c = SharedEditing;
            cam.Carbon_Copy__c = CarbonCopy;
            camList.add(cam);
        }
        errorStr = '';
        Savepoint sp = Database.setSavepoint();
        try {
        // try {
            if(camList.size() > 0){
                update camList;
                // 703接口触发
                List<String> cam_ids = new List<String>();
                cam_ids.add(cam.Id);
                NFM703Controller.callout(null,cam_ids);
            }
        } catch (System.Exception e) {
            Database.rollback(sp);
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, e.getMessage()));
            errorStr = e.getMessage();
            hasError = true;
            return null;
        }
        return null;
        // } catch (System.Exception e) {
        //     Database.rollback(sp);
        //     ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, e.getMessage()));
        //     errorStr = e.getMessage();
        //     hasError = true;
        //     return null;
        // }
    }
    public class OBPMInfo {
force-app/main/default/classes/UploadOBPMControllerTest.cls
New file
@@ -0,0 +1,75 @@
@isTest
private class UploadOBPMControllerTest {
    public static Campaign cam;
    static void init(){
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Campaign' and Name = '1.学会/会议'];
        if (rectCo.size() == 0) {
            throw new ControllerUtil.myException('not found 1.学会/会议 recordtype');
        }
        System.runAs(new User(Id = Userinfo.getUserId())) {
            User user = new User(Test_staff__c = true);
            user.LastName = '_サンブリッジ';
            user.FirstName = 'う';
            user.Alias = 'う';
            user.Email = 'olympusTest03@sunbridge.com';
            user.Username = 'olympusTest03@sunbridge.com';
            user.IsActive = true;
            user.EmailEncodingKey = 'ISO-2022-JP';
            user.TimeZoneSidKey = 'Asia/Tokyo';
            user.LocaleSidKey = 'ja_JP';
            user.LanguageLocaleKey = 'ja';
            user.ProfileId = System.Label.ProfileId_SystemAdmin;
            user.Province__c = '北京';
            user.Dept__c = '医疗华北营业本部';
            user.Use_Start_Date__c = Date.today().addMonths(-6);
            insert user;
            cam = new Campaign();
            cam.Name = 'test campaign';
            cam.StartDate = Date.today().addDays(15);
            cam.EndDate = Date.today().addDays(18);
            cam.Name2__c = '1234';
            cam.Status = '申请中';
            cam.Mailflg_after45__c = true;
            cam.Mailflg_cancel__c = true;
            cam.Mailflg_before15__c = true;
            cam.Mailflg_before7__c = true;
            cam.Mailflg_after3__c = true;
            cam.HostName__c = '1';
            cam.cooperatorCompany__c = '1';
            cam.RecordTypeId = rectCo[0].Id;
            cam.OwnerId = user.Id;
            insert cam;
        }
    }
    static testMethod void testSample_01() {
        init();
        User user = new User();
        User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
        System.runAs (thisUser) {
            Profile p = [SELECT Id FROM Profile WHERE Name LIKE '%2B1%' Limit 1];
            UserRole r = [SELECT Id FROM UserRole WHERE DeveloperName = 'beipin_huadong_staff' Limit 1];
            user = new User(alias = 'test', email='test@acme.com',
                emailencodingkey='UTF-8', lastname='test',
                languagelocalekey='en_US',
                localesidkey='en_US', profileid = p.Id, userroleid = r.Id,
                timezonesidkey='America/Los_Angeles',
                username='test@acme.com' + Datetime.now().getTime());
            insert user;
        }
        PageReference page = new PageReference('/apex/BatchSelectRepairPage?id='+cam.Id);
        System.Test.setCurrentPage(page);
        System.Test.StartTest();
        UploadOBPMController ub = new UploadOBPMController();
        ub.init();
        ub.OBPMInfoList[0].cam.Shared_User__c = user.Id;
        ub.OBPMInfoList[0].Role = '共同编辑人';
        ub.addLine();
        ub.deleteLine();
        ub.uploadOBPM();
        System.Test.StopTest();
    }
}
force-app/main/default/classes/UploadOBPMControllerTest.cls-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>52.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/WeeklyReportCmp.cls
@@ -86,7 +86,10 @@
        //阶段 StageName__c
        this.allselectlist.put('StageName__c', WeeklyReportCmp.getPicklistValues('Agency_Opportunity__c','StageName__c'));
        //SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start
        // 支援需求 SupportNeeds__c
        this.allselectlist.put('SupportNeeds__c', WeeklyReportCmp.getPicklistValues('Agency_Report__c','SupportNeeds__c'));
        //SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 end
        // 职位
//        this.allselectlist.put('visitor_title__c', WeeklyReportCmp.getPicklistValues('Agency_Report__c','visitor_title__c'));
@@ -287,24 +290,24 @@
    */
    @RemoteAction
    @AuraEnabled
    public static String saveAgencyReport(String Department_Cateogy, String Purpose_Type, String Agency_Report_Header,
    @AuraEnabled//SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start SupportNeedsc
    public static String saveAgencyReport(String Department_Cateogy, String Purpose_Type, String Agency_Report_Header,String SupportNeedsc,
            String Agency_Hospital, String Person_In_Charge2, String doctor, String Submit_date,
            String Product_Category1, String Product_Category2, String Product_Category3,
            String Result, String Opportunity, String StageName, String oppAmount, String oppOCMPrice, String Close_Forecasted_Date, String Report_Date)
    {
        Agency_Report__c agency_report = makeAgencyReport(Department_Cateogy, Purpose_Type, Agency_Report_Header,
            Agency_Hospital, Person_In_Charge2, doctor, Submit_date,
            Product_Category1, Product_Category2, Product_Category3,
            Result, Opportunity, StageName, oppAmount, oppOCMPrice, Close_Forecasted_Date, Report_Date);
            Product_Category1, Product_Category2, Product_Category3,//SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start SupportNeedsc
            Result, Opportunity, StageName, oppAmount, oppOCMPrice, Close_Forecasted_Date, Report_Date,SupportNeedsc);
        agency_report = LightningUtil.insertAgencyReport(agency_report);
        return agency_report.Id;
    }
    public static Agency_Report__c makeAgencyReport(String Department_Cateogy, String Purpose_Type, String Agency_Report_Header,
            String Agency_Hospital, String Person_In_Charge2, String doctor, String Submit_date,
            String Product_Category1, String Product_Category2, String Product_Category3,
            String Result, String Opportunity, String StageName, String oppAmount, String oppOCMPrice, String Close_Forecasted_Date, String Report_Date)
            String Product_Category1, String Product_Category2, String Product_Category3,//SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start SupportNeeds__c
            String Result, String Opportunity, String StageName, String oppAmount, String oppOCMPrice, String Close_Forecasted_Date, String Report_Date,String SupportNeedsc)
    {
        Agency_Report__c agency_report = new Agency_Report__c();
        Date week = Date.valueOf(Submit_date);
@@ -333,6 +336,9 @@
        if (doctor != '') { agency_report.doctor2__c = doctor; } else { agency_report.doctor2__c = null; }
        if (Department_Cateogy != '') { agency_report.Department_Cateogy__c = Department_Cateogy; }
        if (Purpose_Type != '') { agency_report.Purpose_Type__c = Purpose_Type; }
        //SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start
        if (SupportNeedsc != '') { agency_report.SupportNeeds__c = SupportNeedsc; }
        //SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 end
        if (Agency_Report_Header != '') { agency_report.Agency_Report_Header__c = Agency_Report_Header; }
        if (Agency_Hospital != '') { agency_report.Agency_Hospital__c = Agency_Hospital; }
        //if (olympus_calendar_id != '') { agency_report.Submit_date_Calendar__c = olympus_calendar_id; }
@@ -371,13 +377,13 @@
    @AuraEnabled
    public static String editAgencyReport(String Agency_Report_Id, String Department_Cateogy, String Purpose_Type, String Agency_Report_Header,
                                        String Agency_Hospital, String Person_In_Charge2, String doctor, String Submit_date,
                                        String Product_Category1, String Product_Category2, String Product_Category3,
                                        String Result, String Opportunity, String StageName, String oppAmount, String oppOCMPrice, String Close_Forecasted_Date, String Report_Date)
                                        String Product_Category1, String Product_Category2, String Product_Category3, //SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start SupportNeeds__c
                                        String Result, String Opportunity, String StageName, String oppAmount, String oppOCMPrice, String Close_Forecasted_Date, String Report_Date,String SupportNeedsc)
    {
        if (String.isBlank(Agency_Report_Id)) {
            return null;
        }
        Agency_Report__c agency_report = [select Id, Name, Department_Cateogy__c, Purpose_Type__c, Agency_Hospital__c,
        }//SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start SupportNeeds__c
        Agency_Report__c agency_report = [select Id, Name, Department_Cateogy__c, Purpose_Type__c, Agency_Hospital__c,SupportNeeds__c,
                                          Person_In_Charge2__c, doctor2__c, Submit_date__c, Product_Category__c, Result__c, visitor_title__c, Opportunity__c
                                          from Agency_Report__c where id=:Agency_Report_Id];
        Date week = Date.valueOf(Submit_date);
@@ -397,11 +403,13 @@
        if (Agency_Hospital != '')  {
            LightningUtil.updateAccMaxActivityDate(Agency_Hospital, week);
        }
        system.debug('Purpose_Type+++==++==='+Purpose_Type);
        // WRITE Agency Report__c
        if (doctor != '') { agency_report.doctor2__c = doctor; } else { agency_report.doctor2__c = null; }
        if (Department_Cateogy != '') { agency_report.Department_Cateogy__c = Department_Cateogy; } else { agency_report.Department_Cateogy__c = null; }
        if (Purpose_Type != '') { agency_report.Purpose_Type__c = Purpose_Type; } else { agency_report.Purpose_Type__c = null; }
        //SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start SupportNeeds__c
        if (SupportNeedsc != '') { agency_report.SupportNeeds__c = SupportNeedsc; } else { agency_report.SupportNeeds__c = null; }
        if (Agency_Hospital != '') { agency_report.Agency_Hospital__c = Agency_Hospital; } else { agency_report.Agency_Hospital__c = null; }
        if (Product_Category1 != '') { agency_report.Product_Category1__c = Product_Category1; } else { agency_report.Product_Category1__c = null; }
        if (Product_Category2 != '') { agency_report.Product_Category2__c = Product_Category2; } else { agency_report.Product_Category2__c = null; }
force-app/main/default/classes/WeeklyReportCmpTest.cls
@@ -43,8 +43,7 @@
        contact2.LastName = 'test1经销商';
        insert contact2;
        Profile p = [select Id, name from Profile where name = '901_经销商活动系统'];
        Profile p = [select Id from Profile where Name = '901_经销商活动系统'];
        user.ProfileId = p.Id;
        user.ContactId = contact2.Id;
        user.FirstName = 'ユーザー';
force-app/main/default/classes/updateESignBatch.cls
@@ -1041,7 +1041,9 @@
            //循环找到文件id
            if (fileDeleteIdList.size() > 0) {
                List<Attachment> attachMentList = [SELECT id, parentId, Body, Name, ContentType,Description  from Attachment where parentId = :fileDeleteIdList];
                // 2022-02-28 shashiming Apex heap size too large
                // 去掉Body字段
                List<Attachment> attachMentList = [SELECT id, parentId, Name, ContentType,Description  from Attachment where parentId = :fileDeleteIdList];
                if (attachMentList.size() > 0) {
                    for (Attachment att : attachMentList) {
force-app/main/default/objects/Account_Service_Of_Target__c/fields/Renew_Coverage_Correlation__c.field-meta.xml
New file
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>Renew_Coverage_Correlation__c</fullName>
    <externalId>false</externalId>
    <formula>Renew_Target_Correlation_Lightsource__c</formula>
    <formulaTreatBlanksAs>BlankAsZero</formulaTreatBlanksAs>
    <label>续签目标:周边</label>
    <precision>18</precision>
    <required>false</required>
    <scale>2</scale>
    <trackTrending>false</trackTrending>
    <type>Number</type>
    <unique>false</unique>
</CustomField>
force-app/main/default/objects/Account_Service_Of_Target__c/fields/Renew_Finish_Rigid_Mirror_1__c.field-meta.xml
New file
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>Renew_Finish_Rigid_Mirror_1__c</fullName>
    <externalId>false</externalId>
    <label>实际续签数(软):电子镜</label>
    <precision>18</precision>
    <required>false</required>
    <scale>0</scale>
    <trackTrending>false</trackTrending>
    <type>Number</type>
    <unique>false</unique>
</CustomField>
force-app/main/default/objects/Account_Service_Of_Target__c/fields/Renew_Finish_Rigid_Mirror_2__c.field-meta.xml
New file
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>Renew_Finish_Rigid_Mirror_2__c</fullName>
    <externalId>false</externalId>
    <label>实际续签数(硬):泌尿科用硬性镜</label>
    <precision>18</precision>
    <required>false</required>
    <scale>0</scale>
    <trackTrending>false</trackTrending>
    <type>Number</type>
    <unique>false</unique>
</CustomField>
force-app/main/default/objects/Account_Service_Of_Target__c/fields/Renew_Target_Correlation_Lightsource__c.field-meta.xml
New file
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>Renew_Target_Correlation_Lightsource__c</fullName>
    <externalId>false</externalId>
    <label>续签目标(周边):光源</label>
    <precision>18</precision>
    <required>false</required>
    <scale>0</scale>
    <trackTrending>false</trackTrending>
    <type>Number</type>
    <unique>false</unique>
</CustomField>
force-app/main/default/objects/Account_Service_Of_Target__c/fields/Renew_Target_Rigid_Mirror_2__c.field-meta.xml
New file
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>Renew_Target_Rigid_Mirror_2__c</fullName>
    <externalId>false</externalId>
    <label>续签目标(硬):泌尿科用硬性镜</label>
    <precision>18</precision>
    <required>false</required>
    <scale>0</scale>
    <trackTrending>false</trackTrending>
    <type>Number</type>
    <unique>false</unique>
</CustomField>
force-app/main/default/objects/Account_Service_Of_Target__c/fields/Renew_Target_Soft_Mirror_2__c.field-meta.xml
New file
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>Renew_Target_Soft_Mirror_2__c</fullName>
    <externalId>false</externalId>
    <label>续签目标(软):鼻咽喉镜</label>
    <precision>18</precision>
    <required>false</required>
    <scale>0</scale>
    <trackTrending>false</trackTrending>
    <type>Number</type>
    <unique>false</unique>
</CustomField>
force-app/main/default/objects/Agency_Report__c/fields/SupportNeeds__c.field-meta.xml
New file
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>SupportNeeds__c</fullName>
    <externalId>false</externalId>
    <label>支援需求</label>
    <required>false</required>
    <trackHistory>false</trackHistory>
    <trackTrending>false</trackTrending>
    <type>Picklist</type>
    <valueSet>
        <restricted>true</restricted>
        <valueSetDefinition>
            <sorted>false</sorted>
            <value>
                <fullName>维修备品</fullName>
                <default>false</default>
                <label>维修备品</label>
            </value>
            <value>
                <fullName>展示/试用备品</fullName>
                <default>false</default>
                <label>展示/试用备品</label>
            </value>
            <value>
                <fullName>招标/谈判协助</fullName>
                <default>false</default>
                <label>招标/谈判协助</label>
            </value>
            <value>
                <fullName>学术会议-科室会</fullName>
                <default>false</default>
                <label>学术会议-科室会</label>
            </value>
            <value>
                <fullName>学术会议-学术沙龙</fullName>
                <default>false</default>
                <label>学术会议-学术沙龙</label>
            </value>
            <value>
                <fullName>医护培训-产品使用方法及注意事项</fullName>
                <default>false</default>
                <label>医护培训-产品使用方法及注意事项</label>
            </value>
            <value>
                <fullName>整体内镜室解决方案</fullName>
                <default>false</default>
                <label>整体内镜室解决方案</label>
            </value>
            <value>
                <fullName>整体手术室解决方案</fullName>
                <default>false</default>
                <label>整体手术室解决方案</label>
            </value>
            <value>
                <fullName>售后点检服务</fullName>
                <default>false</default>
                <label>售后点检服务</label>
            </value>
        </valueSetDefinition>
    </valueSet>
</CustomField>
force-app/main/default/objects/Agency_Report__c/fields/WarlockClassification__c.field-meta.xml
New file
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>WarlockClassification__c</fullName>
    <deleteConstraint>SetNull</deleteConstraint>
    <externalId>false</externalId>
    <label>术士分类</label>
    <referenceTo>FieldClassification__c</referenceTo>
    <relationshipLabel>.周报明细 (术士分类)</relationshipLabel>
    <relationshipName>WarlockClassification</relationshipName>
    <required>false</required>
    <trackHistory>false</trackHistory>
    <trackTrending>false</trackTrending>
    <type>Lookup</type>
</CustomField>
force-app/main/default/objects/Application_for_Conference_Adjudication__c/fields/Adjudication_Owner_Num__c.field-meta.xml
New file
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>Adjudication_Owner_Num__c</fullName>
    <externalId>false</externalId>
    <formula>Owner:User.Employee_No__c</formula>
    <formulaTreatBlanksAs>BlankAsZero</formulaTreatBlanksAs>
    <label>申请人员工编码</label>
    <required>false</required>
    <trackHistory>false</trackHistory>
    <trackTrending>false</trackTrending>
    <type>Text</type>
    <unique>false</unique>
</CustomField>
force-app/main/default/objects/Application_for_Conference_Adjudication__c/fields/Adjudication_Owner__c.field-meta.xml
New file
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>Adjudication_Owner__c</fullName>
    <externalId>false</externalId>
    <formula>Owner:User.Name__c</formula>
    <formulaTreatBlanksAs>BlankAsZero</formulaTreatBlanksAs>
    <label>决裁申请人</label>
    <required>false</required>
    <trackHistory>false</trackHistory>
    <trackTrending>false</trackTrending>
    <type>Text</type>
    <unique>false</unique>
</CustomField>
force-app/main/default/objects/Application_for_Conference_Adjudication__c/fields/Applicant_Dep__c.field-meta.xml
New file
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>Applicant_Dep__c</fullName>
    <externalId>false</externalId>
    <formula>Owner:User.Category5__c</formula>
    <formulaTreatBlanksAs>BlankAsZero</formulaTreatBlanksAs>
    <label>申请人部门</label>
    <required>false</required>
    <trackHistory>false</trackHistory>
    <trackTrending>false</trackTrending>
    <type>Text</type>
    <unique>false</unique>
</CustomField>
force-app/main/default/objects/Application_for_Conference_Adjudication__c/sharingReasons/Shared_Editor__c.sharingReason-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<SharingReason xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>Shared_Editor__c</fullName>
    <label>共享编辑人</label>
</SharingReason>
force-app/main/default/objects/BatchIF_Log__c/listViews/NFM_702.listView-meta.xml
New file
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<ListView xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>NFM_702</fullName>
    <columns>NAME</columns>
    <filterScope>Everything</filterScope>
    <filters>
        <field>Type__c</field>
        <operation>equals</operation>
        <value>NFM702</value>
    </filters>
    <label>NFM-702客户人员信息</label>
    <language>zh_CN</language>
</ListView>
force-app/main/default/objects/Consum_Apply_Equipment_Set_Detail__c/fields/demo_purpose2__c.field-meta.xml
New file
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>demo_purpose2__c</fullName>
    <externalId>false</externalId>
    <formula>Text( Consum_Apply__r.demo_purpose2__c )</formula>
    <formulaTreatBlanksAs>BlankAsZero</formulaTreatBlanksAs>
    <label>出借目的</label>
    <required>false</required>
    <trackHistory>false</trackHistory>
    <trackTrending>false</trackTrending>
    <type>Text</type>
    <unique>false</unique>
</CustomField>
force-app/main/default/objects/FieldClassification__c/FieldClassification__c.object-meta.xml
New file
@@ -0,0 +1,164 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
    <actionOverrides>
        <actionName>Accept</actionName>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>Accept</actionName>
        <formFactor>Large</formFactor>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>Accept</actionName>
        <formFactor>Small</formFactor>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>CancelEdit</actionName>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>CancelEdit</actionName>
        <formFactor>Large</formFactor>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>CancelEdit</actionName>
        <formFactor>Small</formFactor>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>Clone</actionName>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>Clone</actionName>
        <formFactor>Large</formFactor>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>Clone</actionName>
        <formFactor>Small</formFactor>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>Delete</actionName>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>Delete</actionName>
        <formFactor>Large</formFactor>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>Delete</actionName>
        <formFactor>Small</formFactor>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>Edit</actionName>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>Edit</actionName>
        <formFactor>Large</formFactor>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>Edit</actionName>
        <formFactor>Small</formFactor>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>List</actionName>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>List</actionName>
        <formFactor>Large</formFactor>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>List</actionName>
        <formFactor>Small</formFactor>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>New</actionName>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>New</actionName>
        <formFactor>Large</formFactor>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>New</actionName>
        <formFactor>Small</formFactor>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>SaveEdit</actionName>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>SaveEdit</actionName>
        <formFactor>Large</formFactor>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>SaveEdit</actionName>
        <formFactor>Small</formFactor>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>Tab</actionName>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>Tab</actionName>
        <formFactor>Large</formFactor>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>Tab</actionName>
        <formFactor>Small</formFactor>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>View</actionName>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>View</actionName>
        <formFactor>Large</formFactor>
        <type>Default</type>
    </actionOverrides>
    <actionOverrides>
        <actionName>View</actionName>
        <formFactor>Small</formFactor>
        <type>Default</type>
    </actionOverrides>
    <allowInChatterGroups>false</allowInChatterGroups>
    <compactLayoutAssignment>SYSTEM</compactLayoutAssignment>
    <deploymentStatus>Deployed</deploymentStatus>
    <enableActivities>false</enableActivities>
    <enableBulkApi>true</enableBulkApi>
    <enableFeeds>false</enableFeeds>
    <enableHistory>false</enableHistory>
    <enableLicensing>false</enableLicensing>
    <enableReports>false</enableReports>
    <enableSearch>false</enableSearch>
    <enableSharing>true</enableSharing>
    <enableStreamingApi>true</enableStreamingApi>
    <externalSharingModel>Private</externalSharingModel>
    <label>追溯周报-字段分类</label>
    <nameField>
        <label>追溯周报-字段分类名称</label>
        <type>Text</type>
    </nameField>
    <searchLayouts></searchLayouts>
    <sharingModel>ReadWrite</sharingModel>
    <visibility>Public</visibility>
</CustomObject>
force-app/main/default/objects/FieldClassification__c/fields/ET_ENG_classification__c.field-meta.xml
New file
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>ET_ENG_classification__c</fullName>
    <externalId>false</externalId>
    <label>其他品牌产品类别分类</label>
    <required>false</required>
    <trackTrending>false</trackTrending>
    <type>Picklist</type>
    <valueSet>
        <restricted>true</restricted>
        <valueSetDefinition>
            <sorted>false</sorted>
            <value>
                <fullName>ET</fullName>
                <default>false</default>
                <label>ET</label>
            </value>
            <value>
                <fullName>ENG</fullName>
                <default>false</default>
                <label>ENG</label>
            </value>
        </valueSetDefinition>
    </valueSet>
</CustomField>
force-app/main/default/objects/FieldClassification__c/fields/EffectProgress__c.field-meta.xml
New file
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>EffectProgress__c</fullName>
    <externalId>false</externalId>
    <label>效果/进度</label>
    <required>false</required>
    <trackTrending>false</trackTrending>
    <type>Picklist</type>
    <valueSet>
        <restricted>true</restricted>
        <valueSetDefinition>
            <sorted>false</sorted>
            <value>
                <fullName>认可</fullName>
                <default>false</default>
                <label>认可</label>
            </value>
            <value>
                <fullName>中立</fullName>
                <default>false</default>
                <label>中立</label>
            </value>
            <value>
                <fullName>不认可</fullName>
                <default>false</default>
                <label>不认可</label>
            </value>
            <value>
                <fullName>科室申请</fullName>
                <default>false</default>
                <label>科室申请</label>
            </value>
            <value>
                <fullName>器械科审核</fullName>
                <default>false</default>
                <label>器械科审核</label>
            </value>
            <value>
                <fullName>院级审核</fullName>
                <default>false</default>
                <label>院级审核</label>
            </value>
            <value>
                <fullName>招标采购</fullName>
                <default>false</default>
                <label>招标采购</label>
            </value>
            <value>
                <fullName>申请驳回</fullName>
                <default>false</default>
                <label>申请驳回</label>
            </value>
            <value>
                <fullName>初步沟通</fullName>
                <default>false</default>
                <label>初步沟通</label>
            </value>
            <value>
                <fullName>同意协助</fullName>
                <default>false</default>
                <label>同意协助</label>
            </value>
            <value>
                <fullName>已提交申请</fullName>
                <default>false</default>
                <label>已提交申请</label>
            </value>
            <value>
                <fullName>未同意协助</fullName>
                <default>false</default>
                <label>未同意协助</label>
            </value>
            <value>
                <fullName>临床反馈</fullName>
                <default>false</default>
                <label>临床反馈</label>
            </value>
            <value>
                <fullName>OCSM跟进</fullName>
                <default>false</default>
                <label>OCSM跟进</label>
            </value>
            <value>
                <fullName>问题排除</fullName>
                <default>false</default>
                <label>问题排除</label>
            </value>
            <value>
                <fullName>召回产品对应</fullName>
                <default>false</default>
                <label>召回产品对应</label>
            </value>
        </valueSetDefinition>
    </valueSet>
</CustomField>
force-app/main/default/objects/FieldClassification__c/fields/ProductCcategory__c.field-meta.xml
New file
@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>ProductCcategory__c</fullName>
    <externalId>false</externalId>
    <label>已采用其他品牌</label>
    <required>false</required>
    <trackTrending>false</trackTrending>
    <type>Picklist</type>
    <valueSet>
        <restricted>true</restricted>
        <valueSetDefinition>
            <sorted>false</sorted>
            <value>
                <fullName>上海逸思</fullName>
                <default>false</default>
                <label>上海逸思</label>
            </value>
            <value>
                <fullName>美迪云</fullName>
                <default>false</default>
                <label>美迪云</label>
            </value>
            <value>
                <fullName>武汉半边天</fullName>
                <default>false</default>
                <label>武汉半边天</label>
            </value>
            <value>
                <fullName>安瑞</fullName>
                <default>false</default>
                <label>安瑞</label>
            </value>
            <value>
                <fullName>乐奥</fullName>
                <default>false</default>
                <label>乐奥</label>
            </value>
            <value>
                <fullName>美敦力(柯惠)</fullName>
                <default>false</default>
                <label>美敦力(柯惠)</label>
            </value>
            <value>
                <fullName>浙江赛诺微</fullName>
                <default>false</default>
                <label>浙江赛诺微</label>
            </value>
            <value>
                <fullName>唯德康</fullName>
                <default>false</default>
                <label>唯德康</label>
            </value>
            <value>
                <fullName>苏州以诺康</fullName>
                <default>false</default>
                <label>苏州以诺康</label>
            </value>
            <value>
                <fullName>天津瑞奇</fullName>
                <default>false</default>
                <label>天津瑞奇</label>
            </value>
            <value>
                <fullName>强生</fullName>
                <default>false</default>
                <label>强生</label>
            </value>
            <value>
                <fullName>北京安和</fullName>
                <default>false</default>
                <label>北京安和</label>
            </value>
            <value>
                <fullName>南京微创</fullName>
                <default>false</default>
                <label>南京微创</label>
            </value>
            <value>
                <fullName>安杰思</fullName>
                <default>false</default>
                <label>安杰思</label>
            </value>
            <value>
                <fullName>库克</fullName>
                <default>false</default>
                <label>库克</label>
            </value>
            <value>
                <fullName>湖南半陀</fullName>
                <default>false</default>
                <label>湖南半陀</label>
            </value>
            <value>
                <fullName>波科</fullName>
                <default>false</default>
                <label>波科</label>
            </value>
            <value>
                <fullName>天津厚凯</fullName>
                <default>false</default>
                <label>天津厚凯</label>
            </value>
        </valueSetDefinition>
    </valueSet>
</CustomField>
force-app/main/default/objects/FieldClassification__c/fields/ProductClassification__c.field-meta.xml
New file
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>ProductClassification__c</fullName>
    <externalId>false</externalId>
    <label>产品分类</label>
    <required>false</required>
    <trackTrending>false</trackTrending>
    <type>Picklist</type>
    <valueSet>
        <restricted>true</restricted>
        <valueSetDefinition>
            <sorted>false</sorted>
            <value>
                <fullName>ERCP</fullName>
                <default>false</default>
                <label>ERCP</label>
            </value>
            <value>
                <fullName>ESD</fullName>
                <default>false</default>
                <label>ESD</label>
            </value>
            <value>
                <fullName>EUS</fullName>
                <default>false</default>
                <label>EUS</label>
            </value>
            <value>
                <fullName>呼吸科</fullName>
                <default>false</default>
                <label>呼吸科</label>
            </value>
            <value>
                <fullName>基础</fullName>
                <default>false</default>
                <label>基础</label>
            </value>
            <value>
                <fullName>止血</fullName>
                <default>false</default>
                <label>止血</label>
            </value>
            <value>
                <fullName>其他</fullName>
                <default>false</default>
                <label>其他</label>
            </value>
        </valueSetDefinition>
    </valueSet>
</CustomField>
force-app/main/default/objects/FieldClassification__c/fields/WarlockClassification__c.field-meta.xml
New file
@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>WarlockClassification__c</fullName>
    <externalId>false</externalId>
    <label>术士分类</label>
    <required>false</required>
    <trackTrending>false</trackTrending>
    <type>Picklist</type>
    <valueSet>
        <restricted>true</restricted>
        <valueSetDefinition>
            <sorted>false</sorted>
            <value>
                <fullName>导丝</fullName>
                <default>false</default>
                <label>导丝</label>
            </value>
            <value>
                <fullName>取石气囊</fullName>
                <default>false</default>
                <label>取石气囊</label>
            </value>
            <value>
                <fullName>取石网篮</fullName>
                <default>false</default>
                <label>取石网篮</label>
            </value>
            <value>
                <fullName>乳头切开刀</fullName>
                <default>false</default>
                <label>乳头切开刀</label>
            </value>
            <value>
                <fullName>碎石器</fullName>
                <default>false</default>
                <label>碎石器</label>
            </value>
            <value>
                <fullName>IT系粘膜切开刀</fullName>
                <default>false</default>
                <label>IT系粘膜切开刀</label>
            </value>
            <value>
                <fullName>高频治疗钳</fullName>
                <default>false</default>
                <label>高频治疗钳</label>
            </value>
            <value>
                <fullName>先端系粘膜切开刀</fullName>
                <default>false</default>
                <label>先端系粘膜切开刀</label>
            </value>
            <value>
                <fullName>吸引活检针</fullName>
                <default>false</default>
                <label>吸引活检针</label>
            </value>
            <value>
                <fullName>活检钳</fullName>
                <default>false</default>
                <label>活检钳</label>
            </value>
            <value>
                <fullName>活检套装</fullName>
                <default>false</default>
                <label>活检套装</label>
            </value>
            <value>
                <fullName>细胞刷</fullName>
                <default>false</default>
                <label>细胞刷</label>
            </value>
            <value>
                <fullName>电圈套器</fullName>
                <default>false</default>
                <label>电圈套器</label>
            </value>
            <value>
                <fullName>注射针</fullName>
                <default>false</default>
                <label>注射针</label>
            </value>
            <value>
                <fullName>结扎装置</fullName>
                <default>false</default>
                <label>结扎装置</label>
            </value>
            <value>
                <fullName>止血夹</fullName>
                <default>false</default>
                <label>止血夹</label>
            </value>
            <value>
                <fullName>其他</fullName>
                <default>false</default>
                <label>其他</label>
            </value>
        </valueSetDefinition>
    </valueSet>
</CustomField>
force-app/main/default/objects/FieldClassification__c/fields/WorkRecord__c.field-meta.xml
New file
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>WorkRecord__c</fullName>
    <externalId>false</externalId>
    <label>工作记录</label>
    <required>false</required>
    <trackTrending>false</trackTrending>
    <type>Picklist</type>
    <valueSet>
        <restricted>true</restricted>
        <valueSetDefinition>
            <sorted>false</sorted>
            <value>
                <fullName>SIS</fullName>
                <default>false</default>
                <label>SIS</label>
            </value>
            <value>
                <fullName>科室会</fullName>
                <default>false</default>
                <label>科室会</label>
            </value>
            <value>
                <fullName>院内入院申请</fullName>
                <default>false</default>
                <label>院内入院申请</label>
            </value>
            <value>
                <fullName>收费项目申请</fullName>
                <default>false</default>
                <label>收费项目申请</label>
            </value>
            <value>
                <fullName>临床使用信息收集</fullName>
                <default>false</default>
                <label>临床使用信息收集</label>
            </value>
            <value>
                <fullName>市场推广类活动</fullName>
                <default>false</default>
                <label>市场推广类活动</label>
            </value>
            <value>
                <fullName>QIS处理</fullName>
                <default>false</default>
                <label>QIS处理</label>
            </value>
        </valueSetDefinition>
    </valueSet>
</CustomField>
force-app/main/default/objects/FieldClassification__c/fields/classification__c.field-meta.xml
New file
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>classification__c</fullName>
    <externalId>false</externalId>
    <label>周报分类</label>
    <required>false</required>
    <trackTrending>false</trackTrending>
    <type>Picklist</type>
    <valueSet>
        <restricted>true</restricted>
        <valueSetDefinition>
            <sorted>false</sorted>
            <value>
                <fullName>ET</fullName>
                <default>false</default>
                <label>ET</label>
            </value>
            <value>
                <fullName>ENG</fullName>
                <default>false</default>
                <label>ENG</label>
            </value>
        </valueSetDefinition>
    </valueSet>
</CustomField>
force-app/main/default/objects/FieldClassification__c/fields/productCategories__c.field-meta.xml
New file
@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>productCategories__c</fullName>
    <externalId>false</externalId>
    <label>其他品牌产品类别</label>
    <required>false</required>
    <trackTrending>false</trackTrending>
    <type>Picklist</type>
    <valueSet>
        <restricted>true</restricted>
        <valueSetDefinition>
            <sorted>false</sorted>
            <value>
                <fullName>HD1000i(换能器一体,使用一次后锁死)</fullName>
                <default>false</default>
                <label>HD1000i(换能器一体,使用一次后锁死)</label>
            </value>
            <value>
                <fullName>Focus(无软件锁)</fullName>
                <default>false</default>
                <label>Focus(无软件锁)</label>
            </value>
            <value>
                <fullName>Focus CN (使用一次后锁死)</fullName>
                <default>false</default>
                <label>Focus CN (使用一次后锁死)</label>
            </value>
            <value>
                <fullName>ACE+(无软件锁)</fullName>
                <default>false</default>
                <label>ACE+(无软件锁)</label>
            </value>
            <value>
                <fullName>ACE+ CN(使用一次后锁死)</fullName>
                <default>false</default>
                <label>ACE+ CN(使用一次后锁死)</label>
            </value>
            <value>
                <fullName>ACE+7(使用一次后锁死)</fullName>
                <default>false</default>
                <label>ACE+7(使用一次后锁死)</label>
            </value>
            <value>
                <fullName>无线超声切割刀</fullName>
                <default>false</default>
                <label>无线超声切割刀</label>
            </value>
            <value>
                <fullName>二类证(闭合5mm血管)</fullName>
                <default>false</default>
                <label>二类证(闭合5mm血管)</label>
            </value>
            <value>
                <fullName>三类证(闭合5mm血管)</fullName>
                <default>false</default>
                <label>三类证(闭合5mm血管)</label>
            </value>
            <value>
                <fullName>可重复使用刀头(闭合3mm血管)</fullName>
                <default>false</default>
                <label>可重复使用刀头(闭合3mm血管)</label>
            </value>
            <value>
                <fullName>一次性使用刀头(闭合3mm血管)</fullName>
                <default>false</default>
                <label>一次性使用刀头(闭合3mm血管)</label>
            </value>
            <value>
                <fullName>一次性使用刀头(闭合5mm血管)</fullName>
                <default>false</default>
                <label>一次性使用刀头(闭合5mm血管)</label>
            </value>
            <value>
                <fullName>一次性刀头(闭合5mm血管)</fullName>
                <default>false</default>
                <label>一次性刀头(闭合5mm血管)</label>
            </value>
            <value>
                <fullName>重复用刀头(闭合3mm血管)</fullName>
                <default>false</default>
                <label>重复用刀头(闭合3mm血管)</label>
            </value>
            <value>
                <fullName>一次性刀头(闭合3mm血管)</fullName>
                <default>false</default>
                <label>一次性刀头(闭合3mm血管)</label>
            </value>
            <value>
                <fullName>三类证(闭合3mm血管)</fullName>
                <default>false</default>
                <label>三类证(闭合3mm血管)</label>
            </value>
            <value>
                <fullName>二类证(闭合3mm血管)</fullName>
                <default>false</default>
                <label>二类证(闭合3mm血管)</label>
            </value>
            <value>
                <fullName>兼容STMS刀头的刀头(闭合3mm血管)</fullName>
                <default>false</default>
                <label>兼容STMS刀头的刀头(闭合3mm血管)</label>
            </value>
        </valueSetDefinition>
    </valueSet>
</CustomField>
force-app/main/default/objects/Inquiry_form__c/fields/Follow_Date__c.field-meta.xml
New file
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>Follow_Date__c</fullName>
    <externalId>false</externalId>
    <label>跟进日期</label>
    <required>false</required>
    <trackHistory>false</trackHistory>
    <trackTrending>false</trackTrending>
    <type>Date</type>
</CustomField>
force-app/main/default/objects/Inquiry_form__c/fields/No_Need_Date__c.field-meta.xml
New file
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>No_Need_Date__c</fullName>
    <externalId>false</externalId>
    <label>不需要日期</label>
    <required>false</required>
    <trackHistory>false</trackHistory>
    <trackTrending>false</trackTrending>
    <type>Date</type>
</CustomField>
force-app/main/default/objects/Inquiry_form__c/fields/lead_Num__c.field-meta.xml
New file
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>lead_Num__c</fullName>
    <externalId>false</externalId>
    <formula>Lead_link__r.Lead_No__c</formula>
    <formulaTreatBlanksAs>BlankAsZero</formulaTreatBlanksAs>
    <label>意向编码</label>
    <required>false</required>
    <trackHistory>false</trackHistory>
    <trackTrending>false</trackTrending>
    <type>Text</type>
    <unique>false</unique>
</CustomField>
force-app/main/default/objects/Inventory_Header_Copy__c/webLinks/ClearStatus.webLink-meta.xml
New file
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<WebLink xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>ClearStatus</fullName>
    <availability>online</availability>
    <displayType>button</displayType>
    <linkType>javascript</linkType>
    <masterLabel>清除盘点状态</masterLabel>
    <openType>onClickJavaScript</openType>
    <protected>false</protected>
    <url>{!RequireScript(&quot;/soap/ajax/51.0/connection.js&quot;)}
{!RequireScript(&quot;/soap/ajax/51.0/apex.js&quot;)}
{!RequireScript(&quot;/resource/CommonUtilJs&quot;)}
//2021-10-22 gwy 版本更改为51.0
var foo = function() {
var result = sforce.connection.query(&quot;SELECT Id, Name, Inventory_Status__c FROM Inventory_Header_Copy__c WHERE Id=&apos;{!Inventory_Header_Copy__c.Id}&apos; OR Fixture_Header__c = &apos;{!Inventory_Header_Copy__c.Id}&apos;&quot;);
var records = result.getArray(&quot;records&quot;);
for(var i=0;i&lt;records.length;i++){
    if (records[i].Inventory_Status__c != &apos;处理中&apos;&amp;&amp; records[i].Inventory_Status__c!=null) {
        alert(records[i].Name+&apos;的盘点状态为【&apos;+records[i].Inventory_Status__c+&apos;】,不能清除此盘点状态。&apos;);
        return;
    }
}
if (!confirm(&quot;请确认是否要清除盘点状态?&quot;)) {
    return;
}
for(var i=0;i&lt;records.length;i++){
    records[i].Inventory_Status__c = null;
}
var result = sforce.connection.update(records);
var messages = getConnectDMLErrorMessages(result);
if (messages.length &gt; 0) {
  alert(messages.join(&quot;\n&quot;));
  return;
}
window.location.reload();
}
foo();</url>
</WebLink>
force-app/main/default/objects/Inventory_Header__c/listViews/Viewguangdong.listView-meta.xml
New file
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<ListView xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>Viewguangdong</fullName>
    <columns>NAME</columns>
    <columns>UniqueKey__c</columns>
    <columns>InventoryPIC__c</columns>
    <columns>Inventory_Status__c</columns>
    <filterScope>Everything</filterScope>
    <filters>
        <field>Internal_asset_location__c</field>
        <operation>equals</operation>
        <value>广州 备品中心</value>
    </filters>
    <label>广州备品中心</label>
    <language>zh_CN</language>
</ListView>
force-app/main/default/objects/LastbuyProduct__c/fields/RemainingNumber__c.field-meta.xml
New file
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>RemainingNumber__c</fullName>
    <externalId>false</externalId>
    <formula>IF( ISBLANK( ActualQuantity__c ) ,  LastbuyQuantity__c ,  LastbuyQuantity__c  -  ActualQuantity__c )</formula>
    <formulaTreatBlanksAs>BlankAsZero</formulaTreatBlanksAs>
    <label>剩余数量</label>
    <precision>18</precision>
    <required>false</required>
    <scale>0</scale>
    <trackHistory>false</trackHistory>
    <trackTrending>false</trackTrending>
    <type>Number</type>
    <unique>false</unique>
</CustomField>
force-app/main/default/objects/LastbuyProduct__c/validationRules/yuliudayu.validationRule-meta.xml
New file
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ValidationRule xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>yuliudayu</fullName>
    <active>true</active>
    <errorConditionFormula>!ISNULL(ActualQuantity__c) &amp;&amp; ActualQuantity__c &gt; LastbuyQuantity__c</errorConditionFormula>
    <errorMessage>实际使用数量不能大于预留数量</errorMessage>
</ValidationRule>
force-app/main/default/objects/Maintenance_Contract__c/fields/Equipment_Last_Money__c.field-meta.xml
New file
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>Equipment_Last_Money__c</fullName>
    <externalId>false</externalId>
    <formula>Last_year_service_contract__r.Estimate_Cost_F__c</formula>
    <formulaTreatBlanksAs>BlankAsZero</formulaTreatBlanksAs>
    <label>设备上期签约金额</label>
    <precision>18</precision>
    <required>false</required>
    <scale>0</scale>
    <trackHistory>false</trackHistory>
    <trackTrending>false</trackTrending>
    <type>Currency</type>
</CustomField>
force-app/main/default/objects/Rental_Apply_Equipment_Set_Detail__c/fields/ApplyToShipmentWorkTime__c.field-meta.xml
New file
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>ApplyToShipmentWorkTime__c</fullName>
    <externalId>false</externalId>
    <label>提交申请到备品出库时长</label>
    <precision>18</precision>
    <required>false</required>
    <scale>1</scale>
    <trackFeedHistory>false</trackFeedHistory>
    <trackHistory>false</trackHistory>
    <trackTrending>false</trackTrending>
    <type>Number</type>
    <unique>false</unique>
</CustomField>
force-app/main/default/objects/meeting_delay_apply__c/fields/IF_Approved_Old__c.field-meta.xml
New file
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>IF_Approved_Old__c</fullName>
    <defaultValue>false</defaultValue>
    <externalId>false</externalId>
    <label>是否申请决裁.</label>
    <trackTrending>false</trackTrending>
    <type>Checkbox</type>
</CustomField>
force-app/main/default/objects/meeting_delay_apply__c/fields/MeetingApproved__c.field-meta.xml
New file
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>MeetingApproved__c</fullName>
    <deleteConstraint>SetNull</deleteConstraint>
    <externalId>false</externalId>
    <label>会议决裁申请</label>
    <referenceTo>Application_for_Conference_Adjudication__c</referenceTo>
    <relationshipLabel>会议变更申请 (会议决裁申请)</relationshipLabel>
    <relationshipName>MeetingApproved_change</relationshipName>
    <required>false</required>
    <trackTrending>false</trackTrending>
    <type>Lookup</type>
</CustomField>
force-app/main/default/pages/BatchSelectRepairPage.page
@@ -1,12 +1,10 @@
<apex:page id="Page" showHeader="false" sidebar="false" controller="BatchSelectRepairPageController" applyBodyTag="false" applyHtmlTag="false" action="{!init}">
<head>
    <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
    <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
    <!-- <apex:stylesheet value="{!URLFOR($Resource.jquerysuggestcss)}"/>
    <apex:includeScript value="{!URLFOR($Resource.jquerysuggestjs)}"/> -->
    <apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
    <apex:includeScript value="{!URLFOR($Resource.apex20)}"/>
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
<apex:includeScript value="{!URLFOR($Resource.CommonUtilJs)}"/>
<apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
<apex:includeScript value="{!URLFOR($Resource.apex20)}"/>
    <title>批量选择修理功能</title>
    <style type="text/css">
        .pure-table {
@@ -16,7 +14,7 @@
            border: 1px solid #cbcbcb;
            width: 100%;
        }
        .pure-table caption {
            color: #000;
            font: italic 85%/1 arial,sans-serif;
@@ -57,15 +55,15 @@
        //全选功能
        function checkAll() {
            var cnt = j$(escapeVfId('raCnt')).val();
            if (j$(escapeVfId('Page:Form:Block:j_id47:checkAll')).attr('checked') == 'checked') {
            if (j$(escapeVfId('Page:Form:Block:j_id53:checkAll')).attr('checked') == 'checked') {
                for (var i = 0; i < cnt; i++) {
                    j$(escapeVfId('Page:Form:Block:j_id47:records:' + i + ':checklist')).attr('checked',true);
                    j$(escapeVfId('Page:Form:Block:j_id53:records:' + i + ':checklist')).attr('checked',true);
                }
            } else {
            } else {
                for (var i = 0; i < cnt; i++) {
                    j$(escapeVfId('Page:Form:Block:j_id47:records:' + i + ':checklist')).attr('checked',false);
                    j$(escapeVfId('Page:Form:Block:j_id53:records:' + i + ':checklist')).attr('checked',false);
                }
            }
            }
        }
        //检索功能
        // function RetrievalBtnJS() {
@@ -88,83 +86,152 @@
        //     }
        // }
    </script>
</head>
<body>
    <apex:form id="Form" style="margin:10px 10px;">
    <apex:form id="allForm" style="margin: 10px 10px;">
        <apex:actionFunction name="RetrievalBtn" action="{!RetrievalBtn}" rerender="Form, message" onComplete="unblockUI();"/>
        <!-- <apex:actionFunction name="showPDF" action="{!showPDF}" rerender="Form, message" onComplete="unblockUI();" /> -->
        <!-- 后台报错信息显示的关键 -->
        <apex:outputPanel id="message">
            <apex:pageMessages ></apex:pageMessages>
        </apex:outputPanel>
        <apex:pageBlock mode="maindetail" Id="Block">
            <div style="position: relative;top:0;width:100%;">
                <table>
                    <tr>
                        <td><apex:outputLabel value="检索部" style="font-size:18px;font-weight:bold;padding-right: 5px;"/></td>
                    </tr>
                    <apex:repeat value="{!RevalInfoList}" var="reval" id="RevalInfoList">
                    <tr>
                        <td style="text-align: center;padding-right: 100px;">&nbsp;</td>
                        <td style="text-align: center;padding-right: 100px;">
                            <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="修理单号"/>
                            <apex:inputText id="RepairName" value="{!reval.RepairName}"/>
                        </td>
                        <td style="text-align: center;padding-right: 100px;">
                            <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="SAP单号"/>
                            <apex:inputText id="SAPRepairNo" value="{!reval.SAPRepairNo}"/>
                        </td>
                        <td style="text-align: center;padding-right: 100px;">
                            <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="医院/科室"/>
                            <apex:inputText id="HospitalName" value="{!reval.HospitalName}"/>
                        </td>
                        <td style="text-align: center;padding-right: 100px;">
                            <apex:commandButton style="width:80px;" value="检索" action="{!RetrievalBtn}" onclick="blockme();" reRender="Form,message" onComplete="unblockUI();"/>
                        </td>
                    </tr>
                    </apex:repeat>
                </table>
                <div style="font-size:12px; margin-top:10px">
                    <apex:pageBlockSection title="详细信息" columns="1">
        <apex:outputPanel id="allPanel">
            <apex:pageBlock mode="maindetail" Id="allBlock">
                <div style="position: relative; width:100%; ">
                    <apex:pageBlock title="检索列" id="Editable">
                        <table>
                            <tr><td style="text-align: left;padding-right: 100px;">&nbsp;</td></tr>
                            <apex:repeat value="{!RevalInfoList}" var="reval" id="RevalInfoList">
                            <tr>
                                <!-- <td style="text-align: left;padding-right: 100px;">&nbsp;</td> -->
                                <td style="text-align: right; width:200px;">
                                    <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="状态2"/>
                                </td>
                                <td style="text-align: left;">
                                    <apex:inputText id="Status2" value="{!reval.Status2}"/>
                                </td>
                                <td style="text-align: right; width:200px;">
                                    <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="RS修理单号"/>
                                </td>
                                <td style="text-align: left;">
                                    <apex:inputText id="RepairName" value="{!reval.RepairName}"/>
                                </td>
                                <td style="text-align: right; width:150px;">
                                    <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="SAP修理单号"/>
                                </td>
                                <td style="text-align: left;padding-right: 100px;">
                                    <apex:inputText id="SAPRepairNo" value="{!reval.SAPRepairNo}"/>
                                </td>
                            </tr>
                            <tr><td style="text-align: left;padding-right: 100px;">&nbsp;</td></tr>
                            <tr>
                                <!-- <td style="text-align: left;padding-right: 100px;">&nbsp;</td> -->
                                <td style="text-align: right; width:100px;">
                                    <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="机身编码"/>
                                </td>
                                <td style="text-align: left;">
                                    <apex:inputText id="SerialNumber" value="{!reval.SerialNumber}"/>
                                </td>
                                <td style="text-align: right; width:200px;">
                                    <apex:outputLabel style="font-weight: bold; " value="修理委托者"/>
                                </td>
                                <td style="text-align: left;">
                                    <apex:inputField id="InchargeStaffName" value="{!reval.repair.Incharge_Staff__c}"/>
                                </td>
                                <td style="text-align: right; width:150px;">
                                    <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="FSE申请日"/>
                                </td>
                                <td style="text-align: left;padding-right: 80px;">
                                    <apex:inputField id="FSE_ApplyForRepair_Day" value="{!reval.repair.Final_complete_day__c}"/>
                                </td>
                            </tr>
                            </apex:repeat>
                            <tr><td style="text-align: left;padding-right: 100px;">&nbsp;</td></tr>
                            <tr>
                                <td style="text-align: center;" colspan="6">
                                    <apex:commandButton style="width:80px;" value="检索" action="{!RetrievalBtn}" onclick="blockme();" reRender="allForm,message" onComplete="unblockUI();"/>
                                </td>
                            </tr>
                        </table>
                    </apex:pageBlock>
                    <!-- <div style="font-size:12px;"> -->
                    <apex:pageBlock title="详细信息" >
                        <input type="hidden" id="raCnt" value="{!RACount}" />
                        <!-- <input type="hidden" id="raIdList" value="{!repairIdList}" /> -->
                        <apex:outputPanel >
                            <div style="text-align: center;"><apex:commandButton style="width:80px;" value="打印PDF" action="{!showPDF}" onclick="blockme();" reRender="Form,message" onComplete="unblockUI();"/></div>
                            <div style="width:700px; height:700px; margin-left:100px; margin-top:10px;">
                                <table class="pure-table pure-table-horizontal" id="theTable_header">
                                    <tr style="background-color:#f2f3f3;">
                                        <th style="align:left; width:10%"><apex:inputCheckbox id="checkAll" onclick="checkAll();" style="text-align:left;"/></th>
                                        <th style="text-align:left; width:30%">修理单号</th>
                                        <th style="text-align:left; width:30%">科室</th>
                                        <th style="text-align:left; width:30%">医院</th>
                                    </tr>
                                </table>
                                <div style="height:500px; overflow:auto;">
                                <table class="pure-table pure-table-horizontal" id="theTable_header" style="width: 100%">
                                    <apex:repeat value="{!RAInfoList}" var="ra" id="records">
                                    <tr>
                                        <td align="left" width="10%">
                                            <apex:inputCheckbox style="text-align:left;" id="checklist" value="{!ra.IFCheck}" />
                                        </td>
                                        <td align="left" width="30%">
                                            <apex:outputField id="OTCode" value="{!ra.repair.Name}"/>
                                        </td>
                                        <td align="left" width="30%">
                                            <apex:outputField id="Samplename" value="{!ra.repair.HP_Name__c}"/>
                                        </td>
                                        <td align="left" width="30%">
                                            <apex:outputField id="Specs" value="{!ra.repair.Department_Name__c}"/>
                                        </td>
                                    </tr>
                                    </apex:repeat>
                                </table>
                                </div>
                            </div>
                        </apex:outputPanel>
                    </apex:pageBlockSection>
                        <apex:commandButton style="width:80px;" value="打印PDF" action="{!showPDF}" onclick="blockme();" reRender="allForm,message" onComplete="unblockUI();"/>
                        <div style="width:100%;height:385px;overflow:auto;">
                        <table class="pure-table pure-table-horizontal" id="theTable_header" style="width:99%; margin-top:10px;border-collapse: collapse;table-layout:fixed;">
                            <tr style="background-color:#f2f3f3;">
                                <th style="align:left; width:2%"><apex:inputCheckbox id="checkAll" onclick="checkAll();" style="text-align:left;"/></th>
                                <th style="text-align:left; width:6%">状态1</th>
                                <th style="text-align:left; width:6%">状态2</th>
                                <th style="text-align:left; width:7%">RS修理单号</th>
                                <th style="text-align:left; width:10%">SAP修理单号</th>
                                <th style="text-align:left; width:10%">型号</th>
                                <th style="text-align:left; width:5%">机身编号</th>
                                <th style="text-align:left; width:8%">医院名称</th>
                                <th style="text-align:left; width:5%">省份</th>
                                <th style="text-align:left; width:5%">修理委托者</th>
                                <th style="text-align:left; width:8%">FSE申请日期</th>
                                <th style="text-align:left; width:5%">维修中心</th>
                                <th style="text-align:left; width:5%">服务方式</th>
                                <th style="text-align:left; width:8%">有无维修合同对象</th>
                                <th style="text-align:left; width:8%">无偿区别标志</th>
                            </tr>
                        </table>
                        <table class="pure-table pure-table-horizontal" id="theTable_header" style="width:99%; border-collapse: collapse;table-layout:fixed;">
                            <apex:repeat value="{!RAInfoList}" var="ra" id="records">
                            <tr>
                                <td align="left" width="2%">
                                    <apex:inputCheckbox style="text-align:left;" id="checklist" value="{!ra.IFCheck}" />
                                </td>
                                <td align="left" width="6%">
                                    <apex:outputField id="Status1" value="{!ra.repair.Status1__c}"/>
                                </td>
                                <td align="left" width="6%">
                                    <apex:outputField id="Status2" value="{!ra.repair.Status2__c}"/>
                                </td>
                                <td align="left" width="7%">
                                    <apex:outputField id="OTCode" value="{!ra.repair.Name}"/>
                                </td>
                                <td align="left" width="10%">
                                    <apex:outputField id="SAP_Service_Repair_No" value="{!ra.repair.SAP_Service_Repair_No__c}"/>
                                </td>
                                <td align="left" width="10%">
                                    <apex:outputField id="Delivered_Product" value="{!ra.repair.Delivered_Product__c}"/>
                                </td>
                                <td align="left" width="5%">
                                    <apex:outputField id="SerialNumber" value="{!ra.repair.SerialNumber__c}"/>
                                </td>
                                <td align="left" width="8%">
                                    <apex:outputField id="HP_Name" value="{!ra.repair.HP_Name__c}"/>
                                </td>
                                <td align="left" width="5%">
                                    <apex:outputField id="State_Hospital" value="{!ra.repair.State_Hospital__c}"/>
                                </td>
                                <td align="left" width="5%">
                                    <apex:outputField id="Incharge_Staff" value="{!ra.repair.Incharge_Staff__c}"/>
                                </td>
                                <td align="left" width="8%">
                                    <apex:outputField id="FSE_ApplyForRepair_Day" value="{!ra.repair.FSE_ApplyForRepair_Day__c}"/>
                                </td>
                                <td align="left" width="5%">
                                    <apex:outputField id="work_location_select" value="{!ra.repair.work_location_select__c}"/>
                                </td>
                                <td align="left" width="5%">
                                    <apex:outputField id="On_site_repair" value="{!ra.repair.On_site_repair__c}"/>
                                </td>
                                <td align="center" width="8%">
                                    <apex:outputField id="Number_of_EffectiveContract" value="{!ra.repair.Number_of_EffectiveContract__c}"/>
                                </td>
                                <td align="left" width="8%">
                                    <apex:outputField id="NewProductGuaranteeObject" value="{!ra.repair.NewProductGuaranteeObject__c}"/>
                                </td>
                            </tr>
                            </apex:repeat>
                        </table>
                        </div>
                    </apex:pageBlock>
                    <!-- </div> -->
                </div>
            </div>
        </apex:pageBlock>
            </apex:pageBlock>
        </apex:outputPanel>
    </apex:form>
</body>
</apex:page>
force-app/main/default/pages/CampaignCreate.page
@@ -7,61 +7,55 @@
    <apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
    <apex:includeScript value="{!URLFOR($Resource.apex20)}"/>
    <script type="text/javascript">
        function skip() {
//            var test = window.location.search;
            var str = '/701/e?cpn1=*';
            if(getParam('RecordType') != null){
                str += '&RecordType='+getParam('RecordType');
        // function skipJS() {
        //     skipPage();
        // }
        // function ReturnWindowJs(){
        //     returnPage();
        // }
        function displayDecisionThemeJS(){
            if(document.getElementById('j_id0:allForm:allBlock:Meeting_Approved_No').value != ''){
                var MeetingApprovedName = document.getElementById('j_id0:allForm:allBlock:Meeting_Approved_No').value;
                displayDecisionTheme(MeetingApprovedName);
            }
            if(getParam('CMRT') != null){
                str += '&CMRT='+getParam('CMRT');
            }
            if(getParam('retURL') != null){
                str += '&retURL='+getParam('retURL');
            }
            if(getParam('p8') != null){
                str += '&p8='+getParam('p8');
            }
            if(getParam('CF00N10000002DIsr') != null){
                str += '&CF00N10000002DIsr='+getParam('CF00N10000002DIsr');
            }
            if(getParam('ent') != null){
                str += '&ent='+getParam('ent');
            }
            if(getParam('CF00N10000002DIsr_lkid') != null){
                str += '&CF00N10000002DIsr_lkid='+getParam('CF00N10000002DIsr_lkid');
            }
            str += '&nooverride=1';
            window.open(str,'_self');
        }
        function getParam(paramName) {
            paramValue = "", isFound = !1;
            if (this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) {
                arrSource = unescape(this.location.search).substring(1, this.location.search.length).split("&"), i = 0;
                while (i < arrSource.length && !isFound) arrSource[i].indexOf("=") > 0 && arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase() && (paramValue = arrSource[i].split("=")[1], isFound = !0), i++
            }
            return paramValue == "" && (paramValue = null), paramValue
        }
        function closeWindowJs(){
            window.location.href = 'https://ocsm--stagefull.my.salesforce.com/701/o';
        function changeCheckbox(){
            debugger
            var as = j$(escapeVfId("j_id0:allForm:allBlock:isAdjudication")).value();
            if(as==""){
                changeCheckboxs('0');
            }else{
                changeCheckboxs('1');
            }
        }
    </script>
    <apex:form id="allForm">
        <apex:actionFunction name="returnPage" action="{!returnPage}" rerender="allForm,allPanel,allBlock,records">
        </apex:actionFunction>
        <apex:actionFunction name="skipPage" action="{!skipPage}" rerender="allForm,allPanel,allBlock,records">
        </apex:actionFunction>
        <apex:actionFunction name="displayDecisionTheme" action="{!displayDecisionTheme}" rerender="allForm,allPanel,allBlock,records">
            <apex:param name="firstParam" assignTo="{!MeetingApprovedName}" value="" />
        </apex:actionFunction>
        <apex:actionFunction name="changeCheckboxs" action="{!changeCheckboxs}" rerender="allForm,allPanel,allBlock,records">
            <apex:param name="firstParam" assignTo="{!flag}" value="" />
        </apex:actionFunction>
        <apex:outputPanel id="allPanel">
            <apex:pageBlock id="allBlock">
                <input type="hidden" id="hasError" value="{!hasError}"/>
                <apex:outputPanel id="message">
                    <apex:pageMessages />
                </apex:outputPanel>
                <table id="linetable" class="linetable" border="0" style="border-collapse: collapse;width:590px;table-layout:fixed;">
                <table id="linetable" class="linetable" border="0" style="border-collapse: collapse;width:1000px;table-layout:fixed;">
                    <colgroup>
                        <col width="100px"/>
                        <col width="300px"/>
                        <col width="350px"/>
                        <col width="300px"/>
                    </colgroup>
                    <apex:repeat value="{!AdjudicationDataList}" var="AdInfo" id="records">
                    <!-- <apex:repeat value="{!AdjudicationDataList}" var="AdInfo" id="records"> -->
                    <tr>
                        <td align="left" colspan="3">
                        <td align="left" colspan="4">
                            <apex:outputLabel value="> 决裁信息" style="font-size:22px;font-weight:bold;"/>
                        </td>
                    </tr>
@@ -69,34 +63,26 @@
                    <tr>
                        <td style="text-align: center;">&nbsp;</td>
                        <td style="text-align: left;">
                            <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="是否申请决裁"/>
                            <apex:inputCheckbox id="isAdjudication" value="{!AdInfo.isAdjudication}"/>
                            <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="是否需要申请决裁"/>
                            <apex:inputField id="isAdjudication" value="{!AdjudicationDataobj.cam.IF_Approved__c}"  onchange="changeCheckbox();"/>
                        </td>
                        <td style="text-align: left;">
                            <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="会议决裁编码"/>
                            <apex:inputField id="Meeting_Approved_No" value="{!AdInfo.cam.Meeting_Approved_No__c}"/>
                        </td>
                    </tr>
                    <tr><td>&nbsp;</td></tr>
                    <tr>
                        <td style="text-align: center;">&nbsp;</td>
                        <td style="text-align: left;">
                            <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="会议报告"/>
                            <apex:inputField id="Meeting_Report" value="{!AdInfo.cam.Meeting_Report__c}"/>
                            <apex:inputField id="Meeting_Approved_No" value="{!AdjudicationDataobj.cam.Meeting_Approved_No__c}" onchange="displayDecisionThemeJS();"/>
                        </td>
                        <td style="text-align: left;">
                            <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="会议决裁编码(文本)"/>
                            <apex:inputField id="MeetingApprovedNo" value="{!AdInfo.cam.MeetingApprovedNo__c}"/>
                            <apex:outputLabel style="font-weight: bold; padding-right: 8px;" value="会议决裁主题:"/>
                            <apex:outputText id="DecisionTheme" value="{!CampaignTheme}"/>
                        </td>
                    </tr>
                    <tr><td>&nbsp;</td></tr>
                    <tr>
                        <td align="center" colspan="3">
                            <apex:commandButton immediate="true" onclick="skip();" value="确认" style="width:50px;margin-right: 10px;"/>
                            <apex:commandButton immediate="true" onclick="closeWindowJs();" value="取消" style="width:50px"/>
                            <apex:commandButton immediate="true" action="{!skipPage}" value="确认" style="width:50px;margin-right: 10px;"/>
                            <apex:commandButton immediate="true" action="{!returnPage}" value="取消" style="width:50px"/>
                        </td>
                    </tr>
                    </apex:repeat>
                    <!-- </apex:repeat> -->
                </table>
            </apex:pageBlock>
        </apex:outputPanel>
force-app/main/default/pages/CampaignMember.page
@@ -212,7 +212,8 @@
                    '&lea20_lkid=' + campaignId +
                    '&CF00N10000004oN28=' + encodeURI(campaign) + 
                    '&CF00N10000004oN28_lkid=' + campaignId +
                    '&lea5=' + encodeURI('学会/沙龙') +
                    // '&lea5=' + encodeURI('学会/沙龙') +
                    '&lea5=' + encodeURI('学会会议') +
                    '&CF00N10000006qNtt=' + encodeURI(contactSDCName);
        }else{      
            //新建询问单 URL  客户姓名 科室  询问单来源 主要学会 公司 意向学会
@@ -224,7 +225,8 @@
                    '&CF00N1000000962nJ_lkid=' + accid +
                    '&CF00N1000000962n3=' + encodeURI(campaign) + 
                    '&CF00N1000000962n3_lkid=' + campaignId +
                    '&00N1000000962nO=' + encodeURI('学会/沙龙') +
                    // '&00N1000000962nO=' + encodeURI('学会/沙龙') +
                    '&00N1000000962nO=' + encodeURI('学会会议') +
                    '&CF00N1000000962nC=' + encodeURI(records[0].Department_Class__r.Name)+
                    '&CF00N1000000962nC_lkid=' + encodeURI(records[0].Department_Class__c)+
                    '&Name='+encodeURI(username)+
force-app/main/default/pages/ConsumEquipmentSetReceived.page
@@ -40,7 +40,7 @@
  height: 100px;
  width: 30px;
}
/*add start by youc 2021-12-07 耗材追溯 -收货 管理编码 备品管理码设置成只读
/*add start by youc 2021-12-07 耗材追溯 -收货 管理编码 备品管理码设置成只读
.col_ManagementCode__c input{
    border:none;   
    pointer-events: none;
@@ -49,7 +49,7 @@
    border:none;
    pointer-events: none;
}
*/
 */
.col_barcodeforReceipt__c{
    display: none; 
}
@@ -108,7 +108,7 @@
            <tr>  <td align="right">管理编码</td>         <td><span id="bianma"/></td>  </tr> -->
            <tr class="headerRow" height="30px">
                <td class="headerRow  booleanColumn" onclick="document.getElementById('xiaomaCode').focus();return false" align="left">
                    码枪扫描袋子二维码: <input id="xiaomaCode" onkeypress="return checkXiaoMa(event)" autofocus="autofocus" />
                    码枪扫描袋子条形码: <input id="xiaomaCode" onkeypress="return checkXiaoMa(event)" autofocus="autofocus" />
                </td>
                <!-- <td class="headerRow  booleanColumn"> <input id="xiaomaCode" onkeypress="return checkXiaoMa(event)" autofocus="autofocus" /> </td> -->
                <!-- <td class="headerRow  booleanColumn" colspan="8"/> -->
@@ -452,6 +452,7 @@
            //update  by     wangweipeng           2022/02/24          end
        }
        j$("#boxCode").val("");
        setTimeout(function(){j$("#maqCode").focus();},300);
    }
    //4.扫小码之后对码的校验
@@ -522,12 +523,36 @@
                return;
            }
            //批量赋值的一个操作
            if (nowCode == 'AllmoveToBaoFei') {
            if (nowCode == 'allMoveToBaoFei') {
                if(tableId.rows.length > 0){
                    for(var i=1;i<tableId.rows.length;i++) {
                        tableId.children[0].children[i].children[7].children[0].checked = true;
                        tableId.children[0].children[i].children[8].children[0].checked = false;
                        tableId.children[0].children[i].children[9].children[0].checked = false;
                    }
                }
                j$( '#xiaomaCode' ).val("");
                return;
            }
            if (nowCode == 'allMoveToGuoqi') {
                if(tableId.rows.length > 0){
                    for(var i=1;i<tableId.rows.length;i++) {
                        tableId.children[0].children[i].children[7].children[0].checked = false;
                        tableId.children[0].children[i].children[8].children[0].checked = true;
                        tableId.children[0].children[i].children[9].children[0].checked = false;
                    }
                }
                j$( '#xiaomaCode' ).val("");
                return;
            }
            if (nowCode == 'allShangJia') {
                if(tableId.rows.length > 0){
                    for(var i=1;i<tableId.rows.length;i++) {
                        tableId.children[0].children[i].children[7].children[0].checked = false;
                        tableId.children[0].children[i].children[8].children[0].checked = false;
                        tableId.children[0].children[i].children[9].children[0].checked = true;
                    }
                }            
                
@@ -548,7 +573,7 @@
            var YZCode =SMCode+nowCode;
            //if (havCode.indexOf(nowCode) != -1) {
            if (havCode.indexOf(YZCode) != -1) {    
                alert('该明细已保存过,请重新尝试');
                alert('该明细已保存过,不能再进行修改');
                j$( '#xiaomaCode' ).val("");
                return;
            }
@@ -556,18 +581,22 @@
            var aa = rowObj[0].children[17].children[1].value;
            //alert(aa);
            if (aa != null && aa.length > 0) {
                //向弹出框里添加明细行
                //if (aa.indexOf(nowCode) == -1) {
                if (aa.indexOf(YZCode) == -1) {
                    //alert('this.flag==='+this.flag);
                    if (this.flag == 'delConsumables') {
                        alert('必须先扫描要取消的小码');
                        alert('已进入删除小码操作,请扫描正确的小码');
                        j$( '#xiaomaCode' ).val("");
                        this.flag = '';
                        return;
                    }
                    alert('扫描的小码在发货明细中不存在,请重新扫描!');
                    } else if(nowCode != null && nowCode.length == 3 && !isNaN(nowCode)){
                       }else{
                          alert('当前小码不正确');
                          j$( '#xiaomaCode' ).val("");
                          return;
                       }
                    alert('扫描的小码在发货明细中不存在或未寄回,请重新扫描!');
                    j$( '#xiaomaCode' ).val("");
                    return;
                }else{
@@ -575,7 +604,7 @@
                    // var tableId = document.getElementById("detailTb"); 
                    if(tableId.rows.length > 0){
                        for(var i=1;i<tableId.rows.length;i++) {
                            //alert(nowCode+'=498='+tableId.rows[i].cells[6].innerHTML);
                            console.log(nowCode+'=498='+tableId.rows[i].cells[6].innerHTML);
                            if(nowCode == tableId.rows[i].cells[6].innerHTML){
                                if (this.flag == 'delConsumables') {
                                    //删除这一行
@@ -585,15 +614,31 @@
                                    return;
                                }else{
                                    //小码已存在 滞后 先删后加 相当于让扫这个小码的那三个类型
                                    var bf1 = tableId.children[0].children[i].children[7].children[0].checked;
                                    var gq1 = tableId.children[0].children[i].children[8].children[0].checked;
                                    var sj1 = tableId.children[0].children[i].children[9].children[0].checked;
                                    console.log(bf1+'=1='+gq1+'=='+sj1);
                                    tableId.rows[i].remove();
                                    j$( '#xiaomaCode' ).val("");
                                    // return;
                                    alert('已为您滞后!');
                                    break;
                                    alert('小码已扫描,无需再次扫描!');
                                    // console.log(bf1+'=2='+gq1+'=='+sj1);
                                    if (bf1) {
                                         addRow(nowCode,'1');
                                    }else if (gq1) {
                                         addRow(nowCode,'2');
                                    }else if (sj1) {
                                         addRow(nowCode,'3');
                                    }else{
                                         addRow(nowCode,'');
                                    }
                                    //break;
                                    return;
                                }                                
                            }
                        }  
                    }
                    console.log('新码直接添加');
                    addRow(nowCode,'');
                }
            }
@@ -709,6 +754,33 @@
            tableId.children[0].children[tableId.rows.length-1].children[8].children[0].checked = false;
            tableId.children[0].children[tableId.rows.length-1].children[9].children[0].checked = true;
            return false
        } else if (ipadnowCode == 'allMoveToBaoFei') {//批量赋值的一个操作
            if(tableId.rows.length > 0){
                for(var i=1;i<tableId.rows.length;i++) {
                    tableId.children[0].children[i].children[7].children[0].checked = true;
                    tableId.children[0].children[i].children[8].children[0].checked = false;
                    tableId.children[0].children[i].children[9].children[0].checked = false;
                }
            }
            return false
        }else if (ipadnowCode == 'allMoveToGuoqi') {
            if(tableId.rows.length > 0){
                for(var i=1;i<tableId.rows.length;i++) {
                    tableId.children[0].children[i].children[7].children[0].checked = false;
                    tableId.children[0].children[i].children[8].children[0].checked = true;
                    tableId.children[0].children[i].children[9].children[0].checked = false;
                }
            }
            return false
        }else if (ipadnowCode == 'allShangJia') {
            if(tableId.rows.length > 0){
                for(var i=1;i<tableId.rows.length;i++) {
                    tableId.children[0].children[i].children[7].children[0].checked = false;
                    tableId.children[0].children[i].children[8].children[0].checked = false;
                    tableId.children[0].children[i].children[9].children[0].checked = true;
                }
            }
            return false
        }
       
        var havCode = document.getElementById("havCode").value;
@@ -717,24 +789,27 @@
        var YZCode =SMCode+ipadnowCode;
        //if (havCode.indexOf(ipadnowCode) != -1) {
        if (havCode.indexOf(YZCode) != -1) {  
            alert('该明细已保存过,请重新尝试')
            alert('该明细已保存过,不能再进行修改')
            return false;
        }
        //aa 拿到该保有设备对应的所有小码 判断是否存在
        var aa = rowObj[0].children[17].children[1].value;
        if (aa != null && aa.length > 0) {
            //向弹出框里添加明细行
            //if (aa.indexOf(ipadnowCode) == -1) {
            if (aa.indexOf(YZCode) == -1) {
                console.log('3=='+ipadnowCode+'==='+ipadflag);
                if (ipadflag == 'delConsumables') {
                    alert('必须先扫描要取消的小码')
                    alert('已进入删除小码操作,请扫描正确的小码')
                    ipadflag = '';
                    return false;
                }else if(ipadnowCode != null && ipadnowCode.length == 3 && !isNaN(ipadnowCode)){
                }else{
                  alert('当前小码不正确');
                  return;
                }
                alert('扫描的小码在发货明细中不存在,请重新扫描!')
                alert('扫描的小码在发货明细中不存在或未寄回,请重新扫描!')
                return;
            }else{
                //判断是否已经扫描过
@@ -754,6 +829,10 @@
                                 break;
                            }else{
                                //小码已存在 滞后 先删后加 相当于让扫这个小码的那三个类型
                                var bf1 = tableId.children[0].children[i].children[7].children[0].checked;
                                var gq1 = tableId.children[0].children[i].children[8].children[0].checked;
                                var sj1 = tableId.children[0].children[i].children[9].children[0].checked;
                                console.log(bf1+'=1='+gq1+'=='+sj1);
                                tableId.rows[i].remove();
                                // return;
                                //alert('qqq')
@@ -762,10 +841,21 @@
                                // });
                                // j$
                               //alert(1)
                               alert('已为您滞后!');
                               alert('小码已扫描,无需再次扫描!');
                                //已为您滞后!
                                //break;
                            }
                                //break;之前就是注释的
                                console.log(bf1+'=2='+gq1+'=='+sj1);
                                if (bf1) {
                                    addRow(ipadnowCode,'1');
                                }else if (gq1) {
                                    addRow(ipadnowCode,'2');
                                }else if (sj1) {
                                    addRow(ipadnowCode,'3');
                                }else{
                                     addRow(ipadnowCode,'');
                                }
                                return;
                        }
                        }
                    }
                    // 
@@ -876,7 +966,7 @@
                //add by youc 2021-12-07 end 删除输入框内容 并光标自动定位到输入框
                return false;
            } else if(allboxbarcode.indexOf(content250) == -1){
               alert('扫描的盒与发货时不一致,请重新扫描');
               alert('扫描的盒与发货时不一致或未寄回,请重新扫描');
               if(maqiang !='' && maqiang !=undefined){
                   j$("#maqCode").val("");
                   j$("#maqCode").focus();
force-app/main/default/pages/ConsumEquipmentSetShipment.page
@@ -36,12 +36,12 @@
  height: 100px;
  width: 30px;
}
/* add by rentx 2021-10-21 start 设置展示框
/* add by rentx 2021-10-21 start 设置展示框  */
.col_EquipmentManagementCode__c {display: none;}
.col_Scroll{display: none;}
.dataRow.col_Scroll{display: none;}
.col_ManagementCode__c{display: none;}
 */
.modal 
{
    display:none;
@@ -142,8 +142,9 @@
                <apex:commandButton onclick="qrsacn(0);return false;" value="扫一扫耗材" rerender="allForm"/>
                <apex:commandButton onclick="qrsacn(1);return false;" value="扫一扫物流单" rerender="allForm"/>
                <apex:commandButton onclick="blockme();" action="{!send}" value="发货" rerender="message" oncomplete="unblockUI();checkMessage();checEventFrame()"/>
                <!-- add     wangweipeng          2021/01/10             start -->
                <apex:commandButton onclick="window.open('/apex/ConsumTrialPDF?id={!parentId}');" value="试用表" rerender="allForm"/>
                <!-- add     wangweipeng          2021/01/10      /apex/ConsumTrialPDF?id={!parentId}     ConsumEquipmentSetShipmentPDF   start -->
                <apex:commandButton onclick="window.open('ConsumTrialPDF?id={!parentId}');" value="试用表" rerender="allForm"/>
                <!--<a href="openSafri/apex/ConsumTrialPDF?id={!parentId}">试用表</a> -->
                <!-- add     wangweipeng          2021/01/10             end -->
                <!-- add by rentx 2021-10-21 start 新增码枪扫描 -->
                <apex:commandButton onclick="document.getElementById('maqCode').focus();return false" id="maqCodeBtn"  value="码枪扫描:" style="padding: 6px;font-size: 110%;margin-right: 1px;"/>
@@ -181,7 +182,8 @@
                    <td >
                      <apex:outputLabel for="slipNo" value="发货-运输单号:" />
                      <apex:inputField id="slipNo" value="{!slip.Name}"/>
                      <apex:commandButton action="{!searchSlip}" value="检索" style="padding: 6px;font-size: 110%;" rerender="allForm" oncomplete="checEventFrame()"/>
                     <!-- <apex:commandButton action="{!searchSlip}" value="检索" style="padding: 6px;font-size: 110%;" rerender="allForm" oncomplete="checEventFrame()"/> -->
                     <apex:commandButton action="{!searchSlip}" value="检索" style="padding: 6px;font-size: 110%;" rerender="searchBlock" oncomplete="checEventFrame()"/>
                    </td>
                    <td width="10px"></td>
                    <td >
@@ -243,6 +245,7 @@
                j$("#tableData input[type=text]").on('change', function() {
                    let rownum = j$(this)[0].id.match(/oppTable\:(\d*)/)[1];
                    alert('====rownum=='+rownum);
                    j$('input[name$="oppTable_L:'+rownum+':rowCheck"]').prop('checked', true).trigger("change");
                })
@@ -254,8 +257,8 @@
                    }
                }
                //20220215 字段集中的输入框变成只读,不能直接变成span,否则后台取不到值
                j$("#tableData input[type=text]").attr("readonly",true);
               j$("#tableData input[type=text]").attr("disabled","disabled");
               //j$("#tableData input[type=text]").attr("readonly",true);  先隐藏掉
               //j$("#tableData input[type=text]").attr("disabled","disabled");
            </script>
        </apex:outputPanel>
    </apex:outputPanel>
@@ -320,6 +323,9 @@
                return false;
            }
            //判断这个小码code 是否符合要求 1:长度是否正确 2:是否重复输入 3:输入的是否为3位数字
           // var regNeg = /^[1-9]+[0-9]*]*$/; // 负整数
            //z<0||!(/^\d+$/.test(z))
            // && nowCode>=0 && (/^\d+$/.test(nowCode))
            if(nowCode != null && nowCode.length == 3 && !isNaN(nowCode)){
                //获取扫描过的小码
                var tableId = document.getElementById("detailTb"); 
@@ -480,7 +486,7 @@
        var code = paobj[0].children[9].children[0].value;  //.innerText; 
        var hecode = paobj[0].children[10].children[0].value;  //.innerText; 
        alert('xiaoma'+code);
        //alert('xiaoma'+code);
        if (code != null && code.length > 0) {
            //向弹出框里添加明细行
            var arr = code.split(',');
@@ -513,7 +519,7 @@
        //j$(".modal").hide();
        j$("#myModal1").hide();
        scanType = null;
        j$("#maqCode").focus();
        if(numflag == 0 ){
            //用户点击保存 1.设置数量到发货件数上   2.设置小码到明细的备品管理码上
            if(numObj != null){
@@ -669,11 +675,12 @@
            checkObj.prop('checked', false);
        }
        var maqCode = j$( '#maqCode' ).val();
        alert('==='+j$( '#maqCode' ).val());
        if (maqCode !='' && maqCode !=undefined){
        //alert('==='+j$( '#maqCode' ).val());
        //if (maqCode !='' && maqCode !=undefined){
            j$("#maqCode").val("");
            j$("#maqCode").focus();
        }
            setTimeout(function(){j$("#maqCode").focus();},300);
        //}
    }
    // <!-- add by qiuyj 2021-11-30 start  pc端扫码支持-->
    j$(document).ready(function(){
@@ -687,6 +694,8 @@
                return false;
            }
        });
        setTimeout(function(){j$("#maqCode").focus();},300);
    });
    // add by qiuyj 2021-11-30 end  pc端扫码支持
    // add by rentx 2021-10-19 end 耗材追溯 -码枪扫码之后展示弹出框 
@@ -777,8 +786,10 @@
        try{
        if (scanType == 1) {
            j$("input[name$='slipNo']").val(content);
            scanType = null;
        }else if(scanType == 2){//add by youc 2021-12-01 弹出框中ipad扫描小码
            checkipadXiaoMa(content);
            scanType = null;
        } else {
            
                 var tracingCode = content.substr(-8);//截取后8位
@@ -996,6 +1007,7 @@
            j$("#qrcode").focus();
            //add by qiuyj 2021-11-30 end  pc端扫码支持-->
             //alert('扫描条形码请使用App');
        }
    }
force-app/main/default/pages/ContractDetailPDF.page
@@ -165,8 +165,9 @@
                         <c:PDFWbr targetStr="{!item.qli.NameForPrint__c}"/>
                </apex:column>
                <apex:column styleClass="detailRowString" style="vertical-align:text-top;width: 80px">
                        <!-- lt 20220223 CHAN-CBW9FX 特殊交货期影响的对应 -->
                        <!-- <apex:facet name="header">{!$Label.Quote_SFDA_Approbation_No}</apex:facet>  </br>-->
                        <apex:facet name="header">注册证号/ 备案凭证编号</apex:facet>
                        <apex:facet name="header">注册证号/ 备案凭证 <br/>编号</apex:facet>
                        <apex:outputText value="{!item.ApprobationNo_c}"/>
                </apex:column>
                <apex:column styleClass="detailRowString" style="vertical-align:text-top;width: 160px">
@@ -200,14 +201,14 @@
                        <apex:outputText value="  "/>
                </apex:column>
                <apex:column styleClass="detailRowString" style="vertical-align:text-top; text-align: center;">
                        <apex:facet name="header">特殊保修年限</apex:facet>
                        <apex:facet name="header">特殊保修 年限</apex:facet>
                        <apex:outputText value="{!item.qli.GuaranteePeriod__c}"/>
                </apex:column>
                
                <!-- lt 20220223 CHAN-CBW9FX 特殊交货期影响的对应  start -->
                <apex:column styleClass="detailRowNumeric">
                        <apex:facet name="header">交货期</apex:facet>
                        <apex:outputText value="{!item.qli.PricebookEntry.Product2.DeliveryDate__c}"/>
                        <apex:outputText value="{!item.qli.DeliveryDate__c}"/>
                </apex:column>
                <!-- lt 20220223 CHAN-CBW9FX 特殊交货期影响的对应  end -->
                
@@ -368,10 +369,10 @@
                </apex:column>
                <!-- lt 20220223 CHAN-CBW9FX 特殊交货期影响的对应  start -->
                <apex:column styleClass="detailRowNumeric">
                <!-- <apex:column styleClass="detailRowNumeric">
                        <apex:facet name="header">交货期</apex:facet>
                        <apex:outputText value="{!item.qli.PricebookEntry.Product2.DeliveryDate__c}"/>
                </apex:column>
                        <apex:outputText value="{!item.qli.DeliveryDate__c}"/>
                </apex:column> -->
                <!-- lt 20220223 CHAN-CBW9FX 特殊交货期影响的对应  end -->
            </apex:dataTable>
force-app/main/default/pages/DirectAssign.page
@@ -17,7 +17,6 @@
  <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
  <apex:includeScript value="{!URLFOR($Resource.RelationListPagingCmpJS)}"/>
</head>
<!-- note -->
   <apex:form id="allForm">
    <apex:outputPanel id="pageallPanel">
      <apex:pageBlock id="searchBlock" tabStyle="Report">
force-app/main/default/pages/EquipmentSetShippmentReceived2.page
@@ -310,6 +310,29 @@
                            <span><apex:outputField id="inspectionResultNg1" value="{!esdInfo.rec.Inspection_result_NG__c}" style="margin:3px;width:75px;"/></span>
                            </apex:outputPanel>
                        </li>
                        <li style="{!IF(esdInfo.rec.Inspection_result_NG__c='维修','','display: none;')}">
                            <span>{!$ObjectType.Rental_Apply_Equipment_Set_Detail__c.fields.Pre_NG_abord_reason__c.label}:</span>
                            <apex:outputPanel layout="none" rendered="{!AND(esdInfo.editable,esdInfo.rec.Inspection_result_NG__c='维修')}">
                            <span>
                                <apex:inputField id="inspectionResultNG2" value="{!esdInfo.rec.Pre_NG_abord_reason__c}" style="margin:3px;width:90%;float:left;"/>
                            </span>
                            <script>
                                disabledShowNG() {
                                    var inspection_result_NG = '{!esdInfo.rec.Inspection_result_NG__c}';
                                    if(inspection_result_NG  != '废弃'){
                                        j$(escapeVfId('allPage:allForm:esdList:' + ('{!indexloop}' - 1) + ':inspectionResultNG2')).prop("disabled", true);
                                    }
                                }
                            </script>
                            </apex:outputPanel>
                            <apex:outputPanel layout="none" rendered="{!AND(NOT(esdInfo.editable),esdInfo.rec.Inspection_result_NG__c='维修')}">
                                <span>
                                    <apex:outputField value="{!esdInfo.rec.Inspection_NG_abord_reason__c}" style="margin:3px;width:90%;float:left;"></apex:outputField>
                                </span>
                            </apex:outputPanel>
                        </li>
                        <li style="{!IF(esdInfo.quickCheck, 'background:#BBFF66;', '')}">
                            <span>{!$ObjectType.Rental_Apply_Equipment_Set_Detail__c.fields.Pre_Inspection_Comment__c.label}: </span>
                            <apex:outputPanel layout="none" rendered="{!(esdInfo.editable)}">
force-app/main/default/pages/FollowPage.page
@@ -11,7 +11,13 @@
        function save(){
            var content = j$(escapeVfId('allPage:allForm:pageBlock:pageBlockSection:content')).value();
            var contentOther = j$(escapeVfId('allPage:allForm:pageBlock:pageBlockSection:contentOther')).value();
            if ((content.trim() == '' || content.trim() == null) && (contentOther.trim() == null || contentOther.trim() == '')) {
            if ((content == '' || content == null) && (contentOther.trim() == null || contentOther.trim() == '')) {
                alert('跟进内容不能为空!');
                return;
            }else if (content == '其他' && (contentOther.trim() == '' || contentOther.trim() == null)) {
                alert('跟进内容(其他)不能为空!');
                return;
            }else if (content == '' || content == null) {
                alert('跟进内容不能为空!');
                return;
            }else{
@@ -28,12 +34,14 @@
        <apex:actionfunction action="{!savefo}" name="allSave" onComplete="check();unblockUI();"></apex:actionfunction>
        <apex:pageBlock id="pageBlock">
            <apex:pageBlockSection id="pageBlockSection">
                    <apex:inputField id="content" value="{!Inquiryform.Follow_Content__c}" style="width: 155px"/>
                    <apex:inputField id="content" value="{!Inquiryform.Follow_Content__c}" />
                    <br />
                    <apex:inputField id="contentOther" value="{!Inquiryform.Follow_Content_Other__c}" style="width: 150px"/>
                    <br />
            </apex:pageBlockSection>
            <apex:pageblockbuttons >
                <apex:commandbutton onclick="save();return false;" value="保存"></apex:commandbutton>
            <apex:pageblockbuttons location="bottom">
                <apex:commandButton onclick="save();return false;" value="保存"></apex:commandButton>
            </apex:pageblockbuttons>
        </apex:pageBlock>
    </apex:form>
force-app/main/default/pages/InventoryReport.page
@@ -392,15 +392,15 @@
                </table>
                <table class="inventoryReportTable" width="100%">
                    <tr>
                        <td class="tdStyle-right">经理(审批):</td>
                        <td class="tdStyle-right">CL6 经理级(审批):</td>
                        <td class="tdStyle-left">
                            <apex:outputText id="ivconfirmJingli" value="{!ihObj.Jingli_Equipment__r.Name}" />
                        </td>
                        <td class="tdStyle-right">部长(审批):</td>
                        <td class="tdStyle-right">CL5 总监级(审批):</td>
                        <td class="tdStyle-left">
                            <apex:outputText id="ivconfirmBuzhang" value="{!ihObj.Buzhang_Equipment__r.Name}" />
                        </td>
                        <td class="tdStyle-right">总监(审批):</td>
                        <td class="tdStyle-right">CL4 高级总监(审批):</td>
                        <td class="tdStyle-left">
                            <apex:outputText id="ivconfirmZongjian" value="{!ihObj.Zongjian_Equipment__r.Name}" />
                        </td>
force-app/main/default/pages/InventoryResultRecordCopy.page
@@ -256,7 +256,9 @@
        // 检索按钮
        function searchBtnJs() {
            blockme();
            searchBtnFunc();
            alert('没用到的功能,不要点了,哈哈哈');
            unblockUI();
            // searchBtnFunc();
        }
        function hasChangeFunc() {
            hasChange = true;
@@ -336,7 +338,8 @@
            </apex:selectList>
            <br/>
            <br/>
            <apex:commandButton action="{!save}" value="确定" reRender="allForm" onclick="blockme()" oncomplete="unblockUI();j$('#myModal3').hide();changeFullScreen(true);if(j$(escapeVfId('allPage:allForm:doneFlg')).val()=='true') alert('保存完了')"/>
            <!-- action="{!save}" -->
            <apex:commandButton value="确定" reRender="allForm" onclick="blockme()" oncomplete="unblockUI();j$('#myModal3').hide();changeFullScreen(true);if(j$(escapeVfId('allPage:allForm:doneFlg')).val()=='true') alert('保存完了')"/>
            <apex:commandButton style="margin-left: 60px;" value="取消" onclick="j$('#myModal3').hide();return false;"/>
          </div>
@@ -344,7 +347,9 @@
        <apex:actionFunction name="startInventory" action="{!startInventory}" rerender="allForm" onComplete="unblockUI()" />
        <!-- update by rentx 20210827 start 耗材盘点方案 -->
        <!-- <apex:actionFunction name="searchBtnFunc" action="{!searchBtn}" rerender="allForm" onComplete="unblockUI();changeFullScreen(true);" /> -->
        <apex:actionFunction name="searchBtnFunc" action="{!searchBtn}" rerender="allForm" onComplete="unblockUI();changeFullScreen(true);addHistory();" />
        <!-- 20220228 ljh 113盘点start -->
        <!-- <apex:actionFunction name="searchBtnFunc" action="{!searchBtn}" rerender="allForm" onComplete="unblockUI();changeFullScreen(true);addHistory();" /> -->
        <!-- 20220228 ljh 113盘点end -->
        <!-- update by rentx 20210827 end 耗材盘点方案 -->
        <!-- <apex:actionFunction name="checkQRCode" action="{!checkQRCode}" rerender="qrType,qrError,qrId,repeat_panel" onComplete="checkQRDone()" >
            <apex:param name="qrcode" value="" />
force-app/main/default/pages/LostReportEdit.page
@@ -563,9 +563,9 @@
                <!-- add by rentx 20210605 1635 start 调拨的 备品中心提交 -->
                <apex:outputText rendered="{!pBean.tr != null && ! !pBean.lr.isBeipin__c}" >
                <!-- 经理 -->
                <!-- CL6 经理级 -->
                    <tr>
                            <td class="topb2 leftb2 rightb2">经理:</td>
                            <td class="topb2 leftb2 rightb2">CL6 经理级:</td>
                        </tr>
                        <tr>
                            <td class="leftb2 rightb2">
@@ -580,9 +580,9 @@
                                </apex:outputText>
                            </td>
                    </tr>
                <!-- 部长 -->
                <!-- CL5 总监级 -->
                    <tr>
                            <td class="topb2 leftb2 rightb2">部长:</td>
                            <td class="topb2 leftb2 rightb2">CL5 总监级:</td>
                        </tr>
                        <tr>
                            <td class="leftb2 rightb2">
@@ -597,9 +597,9 @@
                                </apex:outputText>
                            </td>
                    </tr>
                <!-- 备品中心总监 -->
                <!-- 备品中心CL4 高级总监 -->
                    <tr>
                            <td class="topb2 leftb2 rightb2">备品中心总监:</td>
                            <td class="topb2 leftb2 rightb2">备品中心CL4 高级总监:</td>
                        </tr>
                        <tr>
                            <td class="leftb2 rightb2">
@@ -636,9 +636,9 @@
                                </apex:outputText>
                            </td>
                    </tr>
                <!-- 经理 -->
                <!-- CL6 经理级 -->
                    <tr>
                            <td class="topb2 leftb2 rightb2">经理:</td>
                            <td class="topb2 leftb2 rightb2">CL6 经理级:</td>
                        </tr>
                        <tr>
                            <td class="leftb2 rightb2">
@@ -653,9 +653,9 @@
                                </apex:outputText>
                            </td>
                    </tr>
                <!-- 部长 -->
                <!-- CL5 总监级 -->
                    <tr>
                            <td class="topb2 leftb2 rightb2">部长:</td>
                            <td class="topb2 leftb2 rightb2">CL5 总监级:</td>
                        </tr>
                        <tr>
                            <td class="leftb2 rightb2">
@@ -670,9 +670,9 @@
                                </apex:outputText>
                            </td>
                    </tr>
                <!-- 副总监 -->
                <!-- 副CL4 高级总监-->
                    <tr>
                            <td class="topb2 leftb2 rightb2">副总监:</td>
                            <td class="topb2 leftb2 rightb2">副CL4 高级总监:</td>
                        </tr>
                        <tr>
                            <td class="leftb2 rightb2">
@@ -687,9 +687,9 @@
                                </apex:outputText>
                            </td>
                    </tr>
                <!-- 总监 -->
                <!-- CL4 高级总监 -->
                    <tr>
                            <td class="topb2 leftb2 rightb2">总监:</td>
                            <td class="topb2 leftb2 rightb2">CL4 高级总监:</td>
                        </tr>
                        <tr>
                            <td class="leftb2 rightb2">
@@ -704,9 +704,9 @@
                                </apex:outputText>
                            </td>
                    </tr>
                <!-- 统括总监 -->
                <!-- CL3 副总裁-->
                    <tr>
                            <td class="topb2 leftb2 rightb2">统括总监:</td>
                            <td class="topb2 leftb2 rightb2">CL3 副总裁:</td>
                        </tr>
                        <tr>
                            <td class="leftb2 rightb2">
@@ -761,15 +761,15 @@
                    </tr>
                </apex:outputText>
                
                <!-- 如果是调拨的话 这个节点是运营部长 如果是盘点的话这个节点是备品中心部长 但是盘点取得审批人是 运营部长 1650 1650暂不上线 先注释掉-->
                <!-- 如果是调拨的话 这个节点是运营CL5 总监级 如果是盘点的话这个节点是备品中心CL5 总监级 但是盘点取得审批人是 运营CL5 总监级 1650 1650暂不上线 先注释掉-->
                    <tr>
                        <apex:outputText rendered="{!pBean.lr.Inventory_Header__c!= null}" >
                            <td class="topb2 leftb2 rightb2">备品中心部长:</td>
                            <td class="topb2 leftb2 rightb2">备品中心CL5 总监级:</td>
                        </apex:outputText>
                        <apex:outputText rendered="{!pBean.tr != null && !pBean.lr.isBeipin__c}" >
                            <td class="topb2 leftb2 rightb2">运营部长:</td>
                            <td class="topb2 leftb2 rightb2">运营CL5 总监级:</td>
                        </apex:outputText>
                        <!-- <td class="topb2 leftb2 rightb2">运营部长:</td> -->
                        <!-- <td class="topb2 leftb2 rightb2">运营CL5 总监级:</td> -->
                    </tr>
                    <tr>
@@ -785,9 +785,9 @@
                            </apex:outputText>
                        </td>
                    </tr>
                <!-- 备品中心总监 -->
                <!-- 备品中心CL4 高级总监 -->
                    <tr>
                            <td class="topb2 leftb2 rightb2">备品中心总监:</td>
                            <td class="topb2 leftb2 rightb2">备品中心CL4 高级总监:</td>
                        </tr>
                        <tr>
                            <td class="leftb2 rightb2">
@@ -811,7 +811,7 @@
                <!-- add by rentx 20210605 end -->
                    <tr>
                        <td class="topb2 leftb2 rightb2">经理:</td>
                        <td class="topb2 leftb2 rightb2">CL6 经理级:</td>
                    </tr>
                    <tr>
                        <td class="leftb2 rightb2">
@@ -827,7 +827,7 @@
                        </td>
                    </tr>
                    <tr>
                        <td class="topb leftb2 rightb2">部长: </td>
                        <td class="topb leftb2 rightb2">CL5 总监级: </td>
                    </tr>
                    <tr>
                        <td class="leftb2 rightb2">
@@ -842,7 +842,7 @@
                        </td>
                    </tr>
                    <tr>
                        <td class="topb leftb2 rightb2">副总监: </td>
                        <td class="topb leftb2 rightb2">副CL4 高级总监: </td>
                    </tr>
                    <tr>
                        <td class="leftb2 rightb2">
@@ -857,7 +857,7 @@
                        </td>
                    </tr>
                    <tr>
                        <td class="topb leftb2 rightb2">统括总监(总监): </td>
                        <td class="topb leftb2 rightb2">CL3 副总裁(CL4 高级总监): </td>
                    </tr>
                    <tr>
                        <td class="leftb2 rightb2">
@@ -913,7 +913,7 @@
                        <td class="topb2 leftb2 rightb2 bottomb center" colspan="5">备品使用注意事项</td>
                    </tr>
                    <tr>
                        <td class="leftb2 rightb2 bottomb left"  colspan="5">1、当发生固定资产遗失・盘亏情况时,申请人须填写本《固定资产遗失・盘亏报告》,逐级向所属部门领导汇报,并取得统括总监批准。</td>
                        <td class="leftb2 rightb2 bottomb left"  colspan="5">1、当发生固定资产遗失・盘亏情况时,申请人须填写本《固定资产遗失・盘亏报告》,逐级向所属部门领导汇报,并取得CL3 副总裁批准。</td>
                    </tr>
                    <tr>
                        <td class="leftb2 rightb2 bottomb left"  colspan="5">2、对于遗失或盘亏的固定资产由公司做出最后处理决定。</td>
force-app/main/default/pages/LostReportEditAsset.page
@@ -518,7 +518,7 @@
                <table class="inventoryReportTable" style="width: 100%;margin-top: 0px; margin-bottom: 0px;">
                    <col style="width: 100%;" />
                    <tr>
                        <td class="topb2 leftb2 rightb2">经理:</td>
                        <td class="topb2 leftb2 rightb2">CL6 经理级:</td>
                    </tr>
                    <tr>
                        <td class="leftb2 rightb2">
@@ -533,7 +533,7 @@
                        </td>
                    </tr>
                    <tr>
                        <td class="topb leftb2 rightb2">部长: </td>
                        <td class="topb leftb2 rightb2">CL5 总监级: </td>
                    </tr>
                    <tr>
                        <td class="leftb2 rightb2">
@@ -548,7 +548,7 @@
                        </td>
                    </tr>
                    <tr>
                        <td class="topb leftb2 rightb2">统括总监(总监): </td>
                        <td class="topb leftb2 rightb2">CL3 副总裁(CL4 高级总监): </td>
                    </tr>
                    <tr>
                        <td class="leftb2 rightb2">
@@ -636,7 +636,7 @@
                        <td class="topb2 leftb2 rightb2 bottomb center" colspan="5">备品使用注意事项</td>
                    </tr>
                    <tr>
                        <td class="leftb2 rightb2 bottomb left"  colspan="5">1、当发生固定资产遗失・盘亏情况时,申请人须填写本《固定资产遗失・盘亏报告》,逐级向所属部门领导汇报,并取得统括总监批准。</td>
                        <td class="leftb2 rightb2 bottomb left"  colspan="5">1、当发生固定资产遗失・盘亏情况时,申请人须填写本《固定资产遗失・盘亏报告》,逐级向所属部门领导汇报,并取得CL3 副总裁批准。</td>
                    </tr>
                    <tr>
                        <td class="leftb2 rightb2 bottomb left"  colspan="5">2、对于遗失或盘亏的固定资产由公司做出最后处理决定。</td>
force-app/main/default/pages/MaintenanceCommissionPDF.page
@@ -75,13 +75,11 @@
                            </td>
                            <td width="45%" style="font-size:120%">&nbsp;如有破损,备注描述:</td>
                        </tr>
                    </table>
                    <table width="100%" border="1" cellspacing="0" style="border-top-color: white;">
                        <tr>
                            <td width="20%" class="label">清洗消毒时间</td>
                            <td width="30%" class="middle"></td>
                            <td width="20%" class="label">清洗消毒者</td>
                            <td width="30%" class="middle"></td>
                            <td width="15%" class="label">清洗消毒时间</td>
                            <td colspan="2" class="middle"></td>
                            <td width="10%" class="label">清洗消毒者</td>
                            <td class="middle"></td>
                        </tr>
                    </table>
                    <table width="100%" border="1" cellspacing="0">
force-app/main/default/pages/Ordergoods.page
@@ -7,11 +7,8 @@
        <script type="text/javascript">
            function checkAll() {
                var productCount = j$(escapeVfId('Page:mainForm:productInfoList:Size')).value();
                // alert(productCount);
                if (j$(escapeVfId('checkAll1')).attr('checked') == 'checked') {
                    // alert(productCount);
                    for (var i = 0; i < productCount; i++) {
                        // Page:mainForm:productInfoList:0:rowcheck
                        j$(escapeVfId('Page:mainForm:productInfoList:' + i + ':rowcheck')).attr('checked',true);
                    }
                } else {
@@ -20,13 +17,6 @@
                    }
                }
            }
            // 跳转到查询产品框
            // function searchProduct1(i, str) {
            //     //id="Page:mainForm:block2:productInfoList:1:proModel"
            //     j$(escapeVfId('Page:mainForm:productInfoList:' + (i-1) + ':proModel')).attr('readonly', true);
            //     // j$(escapeVfId('Page:mainForm:block:lists:' + i + ':Assert')).attr('readonly', true);
            //     openPopup('/apex/OrderSearchProduct?lineno=' + i + '&val=' + str, 'setsearch', 950, 450, 'width=950,height=450,scrollbars=yes,toolbar=no,status=no,directories=no,menubar=no,resizable=1', true);
            // }
            // 保存按钮
            function SaveJs() {
@@ -79,103 +69,32 @@
            //add 当收货方为办事处时,收货方地址为办事处地址 2021/11/17 fxk
            function resetDealer() {
                // 收货方
                var ReceivePart = j$(escapeVfId('Page:mainForm:sampleReceivePart')).val();
                var AccAdress = '{!AccName.Address__c}';
                var ReceivePart = j$(escapeVfId('Page:mainForm:sampleReceivePart')).val();
                var AccAdress = '{!AccName.Address__c}';
                var AccPhone = '{!AccName.Phone}';
                if (ReceivePart == '办事处') {
                    j$(escapeVfId('Page:mainForm:Address')).val(AccAdress);
                if (ReceivePart == '办事处') {
                    j$(escapeVfId('Page:mainForm:Address')).val(AccAdress);
                    j$(escapeVfId('Page:mainForm:Phone')).val(AccPhone);
                }else {
                    j$(escapeVfId('Page:mainForm:Address')).val('');
                }else {
                    j$(escapeVfId('Page:mainForm:Address')).val('');
                    j$(escapeVfId('Page:mainForm:Phone')).val('');
                    j$(escapeVfId('Page:mainForm:Contact')).val('');
                }
                }
            }
            // function getLastLineNoNext(doc) {
            //     var hasRecordFlg = false;
            //     var lastLineNo = 0;
            //     for(var i=99; i>=0; i--){
            //         if (j$(escapeVfId('Page:mainForm:productInfoList:' + i + ':proModel')).value() != ''){
            //             if (!hasRecordFlg) {
            //                 lastLineNo = i;
            //             }
            //             hasRecordFlg = true;
            //         }
            //         if (hasRecordFlg == true) {
            //             if (j$(escapeVfId('Page:mainForm:productInfoList:' + i + ':proModel')).value() == ''){
            //                 var moveCheckbox = true;
            //                 lastLineNo = i;
            //             }
            //         }
            //     }
            //     if (hasRecordFlg) {
            //         lastLineNo = lastLineNo + 1;
            //     }
            //     return lastLineNo;
            // }
        //     function radioChecker(str) {
        //     //error初期化
        //     var lastLineNoNext = getLastLineNoNext(document);
        //     try {
        //         var hasCheckedCnt = 0;
        //         for (var i = 0; i < lastLineNoNext; i++) {
        //             var iChecked = document.forms['Page:mainForm']['checklist'][i].checked;
        //             if (iChecked) {
        //                 hasCheckedCnt++;
        //                 if (hasCheckedCnt > 1) {
        //                     // 如果知道是否有多件检查 break
        //                     break;
        //                 }
        //             }
        //         }
        //         if (hasCheckedCnt == 0) {
        //             throw '请选中相应的行';
        //         }
        //         var hasCheckedCnt1 = 0; // 实际可以变更的件数
        //         if (str == 'del') {
        //             for (var i = lastLineNoNext - 1; i >= 0; i--) {
        //                 var iChecked = document.forms['Page:mainForm']['checklist'][i].checked;
        //                 if (iChecked) {
        //                     hasCheckedCnt1++;
        //                     deletelist(i, document);
        //                 }
        //             }
        //         } else {
        //             throw 'Unknow Operation';
        //         }
        //         if (str == 'del') {
        //             clearAllCheck();
        //         }
        //     } catch (e) {
        //         alert(e);
        //     }
        //     return true;
        // }
        // 清除所选框的勾
        // function clearAllCheck() {
        //     j$(escapeVfId("checkAll"))[0].checked = false;
        //     var checklist = j$("input[name='checklist']");
        //     for(var i = 0; i < checklist.length; i++){
        //         checklist[i].checked = false;
        //     }
        // }
        //文本框输入值,复选框自动打勾 thh 2021-12-15
        function ComputePrice(j) {
            var productCount = j$(escapeVfId('Page:mainForm:productInfoList:Size')).value();
            for(var i = 0; i < productCount; i++){
                var samNumber = document.getElementById("Page:mainForm:productInfoList:"+ i +":Number").value;
                var checklist = j$("input[name='Page:mainForm:productInfoList:"+ i +":rowcheck']");
                if(samNumber != null && samNumber != 0 && samNumber != ''){
                    checklist[0].checked = true;
                }else{
                    checklist[0].checked = false;
                }
            }
        }
            //文本框输入值,复选框自动打勾 thh 2021-12-15
            function ComputePrice(j) {
                var productCount = j$(escapeVfId('Page:mainForm:productInfoList:Size')).value();
                for(var i = 0; i < productCount; i++){
                    var samNumber = document.getElementById("Page:mainForm:productInfoList:"+ i +":Number").value;
                    var checklist = j$("input[name='Page:mainForm:productInfoList:"+ i +":rowcheck']");
                    if(samNumber != null && samNumber != 0 && samNumber != ''){
                        checklist[0].checked = true;
                    }else{
                        checklist[0].checked = false;
                    }
                }
            }
        </script>
        <!-- 样式 -->
        <style type="text/css">
@@ -231,7 +150,6 @@
                border-bottom-width: 0;
            }
            
            /* 添加行 html特性增加滑动条 精琢技术 wql 2021/02/09 start */
            /* 这里不考虑浏览器的兼容性 */
            input[type="range"] {
                width: 100%;
@@ -302,283 +220,209 @@
                opacity: 1;
                font-weight:bold;
            }
            /* 添加行 html特性增加滑动条 精琢技术 wql 2021/02/09 end */
        </style>
    </head>
    <!-- <body onload="init()"> -->
        <apex:form id="mainForm">
            <h1 style ="font-size: 30px; margin-left: 45%;">样本订货</h1>
            <!-- 初始化页面(默认十行空行) -->
            <!-- <apex:actionFunction name="searchHospital" action="{!searchHospital}" rerender="mainForm,listsTable" onComplete="unblockUI();mainForm">
            </apex:actionFunction> -->
            <!-- 默认十行空行 -->
            <!-- <apex:actionFunction name="addrow" action="{!addrow}" rerender="message,listsTable" onComplete="unblockUI();"> -->
            <!-- </apex:actionFunction> -->
            <!-- 保存按钮 -->
            <!-- <apex:actionFunction name="save" action="{!save}" rerender="message,theTable_Body,listsTable" onComplete="unblockUI();"> -->
            <apex:actionFunction name="save" action="{!save}" rerender="message,mainForm,listsTable" onComplete="SaveAllChecktime();unblockUI();">
            </apex:actionFunction>
            <!-- 删除按钮 -->
            <!-- <apex:actionFunction name="deleteBtn" action="{!deleteBtn}" rerender="message,mainForm,listsTable" onComplete="unblockUI();">
            </apex:actionFunction> -->
            <!-- 确认按钮 -->
            <apex:actionFunction name="confirmBtn" action="{!confirmBtn}" rerender="message,mainForm,listsTable" onComplete="SaveAllChecktime();unblockUI();">
            </apex:actionFunction>
            <!-- <apex:actionFunction name="resetDealer" action="{!Dummy}" rerender="listsTable" oncomplete="resetDealer();"></apex:actionFunction> -->
            <!-- 添加行  20211103 lt -->
            <!-- <apex:actionFunction action="{!addMultipleRow}" name="addMultipleRow" reRender="theTable_Body" oncomplete="unblockUI();">
                <apex:param assignTo="{!rowIdx}" name="rowIdx" value=""/>
            </apex:actionFunction> -->
            <apex:outputPanel id="listsTable">
                <!-- <apex:pageBlock id="block1"> -->
                    <div style="width: 100%;text-align:center;margin:0 auto;">
                        <table id="datatable_header" class="pure-table pure-table-horizontal" border="1" style="border-collapse:collapse; table-layout:fixed;">
                            <!-- 统一设置列宽度 -->
                            <colgroup>
                                <col width="15%"/>
                            </colgroup>
                            <tr style="background-color:#f2f3f1;width:900px;">
                                <th style="text-align: left;">客户:</th>
                                <td style="text-align:left;">
                                    <apex:outputLabel id="AccName" value="{!AccName.Name}" />
                                </td>
                                <th>
                                    <td></td>
                                </th>
                            </tr>
                            <!-- 20211115 lt start -->
                            <tr style="background-color:#f2f3f1;width:900px;">
                                <th style="text-align: left;">收货方:</th>
                                <td style="text-align:left;">
                                    <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                        <apex:outputField value="{!sampleOrder.ReceivePart__c}"/>
                                    </apex:outputPanel>
                                    <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                        <apex:inputField id="sampleReceivePart" value="{!sampleOrder.ReceivePart__c}" onchange="resetDealer();return false;" />
                                    </apex:outputPanel>
                                    <!-- <apex:inputField id="sampleReceivePart" value="{!sampleOrder.ReceivePart__c}" onchange="resetDealer();return false;" /> -->
                                    <!-- <apex:selectList id="recevicePart"  style="width:177px;height:20px;" value="{!selection_rec}" disabled="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                        <apex:selectOptions value="{!options_rec}" />
                                    </apex:selectList> -->
                                    <!-- <apex:inputField style="width:177px;height:20px;" value="{!sampleOrder.ReceivePart__c}" /> -->
                                </td>
                                <th style="text-align:right;">送达方地址:</th>
                                <td style="text-align:left;">
                                    <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                        <apex:outputField value="{!sampleOrder.DeliveryAddress__c}"/>
                                    </apex:outputPanel>
                                    <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                        <apex:inputField id="Address" value="{!sampleOrder.DeliveryAddress__c}" />
                                    </apex:outputPanel>
                                    <!-- <apex:inputHidden id="tempSize" value="{!tempSize}" /> -->
                                </td>
                            </tr>
                            <!-- 20211115 lt end -->
                            <tr style="background-color:#f2f3f3;width:900px;">
                                <th style="text-align: left;">送达方联系人:</th>
                                <td style="text-align:left;">
                                    <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                        <apex:outputField value="{!sampleOrder.DeliveryContact__c}"/>
                                    </apex:outputPanel>
                                    <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                        <apex:inputField id="Contact" value="{!sampleOrder.DeliveryContact__c}" />
                                    </apex:outputPanel>
                                </td>
                                <th style="text-align:right;">送达方电话:</th>
                                <td style="text-align:left;">
                                    <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                        <apex:outputField value="{!sampleOrder.DeliveryPhone__c}"/>
                                    </apex:outputPanel>
                                    <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                        <apex:inputField id="Phone" value="{!sampleOrder.DeliveryPhone__c}" />
                                    </apex:outputPanel>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <!-- 后台报错信息显示的关键 -->
                    <apex:outputPanel id="message">
                        <apex:pageMessages ></apex:pageMessages>
                    </apex:outputPanel>
                    <input type="hidden" id="Page:mainForm:productInfoList:Size" value="{!tempSize}" />
                    <div id="iframelike" style="width: 100%; height: 400px; text-align:center;margin:0 auto;" >
                    <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',false,true)}" >
                        <table id="theTable_Body" class="pure-table pure-table-horizontal" border="1" style="border-collapse: collapse; table-layout:fixed;">
                            <tr style="background-color:#f2f3f3; width:900px; color: black;">
                                <th style="text-align:left; width:50px">查询:</th>
                                <td style="text-align:left; width:180px">
                                    <apex:inputText style="text-align:left;" id="selectlike" value="{!QueryTemp}" />
                                </td>
                                <td style="text-align:left;">
                                    <apex:commandButton id="Query" value="查询" style="width:100px;height:30px;" action="{!FuzzyQuery}" />
                                </td>
                            </tr>
                        </table>
                    </apex:outputPanel>
                    <table id="theTable_Body" class="pure-table pure-table-horizontal" border="1" style="border-collapse: collapse; table-layout:fixed;">
    <apex:form id="mainForm">
        <h1 style ="font-size: 30px; margin-left: 45%;">样本订货</h1>
        <apex:actionFunction name="save" action="{!save}" rerender="message,mainForm,listsTable" onComplete="SaveAllChecktime();unblockUI();">
        </apex:actionFunction>
        <!-- 确认按钮 -->
        <apex:actionFunction name="confirmBtn" action="{!confirmBtn}" rerender="message,mainForm,listsTable" onComplete="SaveAllChecktime();unblockUI();">
        </apex:actionFunction>
        <apex:outputPanel id="listsTable">
            <!-- <apex:pageBlock id="block1"> -->
                <div style="width: 100%;text-align:center;margin:0 auto;">
                    <table id="datatable_header" class="pure-table pure-table-horizontal" border="1" style="border-collapse:collapse; table-layout:fixed;">
                        <!-- 统一设置列宽度 -->
                        <colgroup>
                            <col width="2%"/>
                            <col width="3%"/>
                            <col width="20%"/>
                            <col width="30%"/>
                            <col width="20%"/>
                            <col width="10%"/>
                            <col width="5%"/>
                            <col width="10%"/>
                            <col width="15%"/>
                        </colgroup>
                        <tr style="background-color:#f2f3f3;">
                            <th style="text-align:center"><input type="checkbox" id="checkAll1" onclick="checkAll();" style="width:10px;"/></th>
                            <th style="text-align:center;color: black;">NO</th>
                            <th style="text-align:center;color: black;">资料编码</th>
                            <th style="text-align:center;color: black;">资料名称</th>
                            <th style="text-align:center;color: black;">资料分类</th>
                            <th style="text-align:center;color: black;">数量</th>
                            <th style="text-align:center;color: black;">规格</th>
                            <th style="text-align:center;color: black;">总量</th>
                        <tr style="background-color:#f2f3f1;width:900px;">
                            <th style="text-align: left;">客户:</th>
                            <td style="text-align:left;">
                                <apex:outputLabel id="AccName" value="{!AccName.Name}" />
                            </td>
                            <th>
                                <td></td>
                            </th>
                        </tr>
                        <apex:repeat value="{!productInfoList}" var="pros" id="productInfoList">
                            <tr>
                                <!-- ⚀ -->
                                <td class="dataCell" style="text-align:center;">
                                    <apex:inputCheckbox value="{!pros.check}" id="rowcheck"/>
                                    <apex:inputHidden id="ProIdHidden" value="{!pros.proId}"/>
                                </td>
                        <tr style="background-color:#f2f3f1;width:900px;">
                            <th style="text-align: left;">收货方:</th>
                            <td style="text-align:left;">
                                <!-- NO -->
                                <td class="dataCell" style="text-align:center;">
                                    <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                        <apex:outputLabel style="width:20px" id="indexNo" value="{!IF(pros.SOLDel.Pro_model__c == null,'',pros.lineNo)}"/>
                                    </apex:outputPanel>
                                    <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                        <apex:outputLabel style="width:20px" value="{!IF(pros.pro.Asset_Model_No__c == null,'',pros.lineNo)}"/>
                                    </apex:outputPanel>
                                </td>
                                <!-- 资料编码 -->
                                <td class="dataCell" style="text-align:center;">
                                    <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                        <apex:outputField value="{!pros.SOLDel.Pro_model__c}"/>
                                    </apex:outputPanel>
                                    <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                        <apex:outputField style="width:90px" id="proModel" value="{!pros.pro.Asset_Model_No__c}"/>
                                    </apex:outputPanel>
                                </td>
                                <!-- 资料名称 -->
                                <td class="dataCell" style="text-align:center;">
                                    <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                        <apex:outputText style="width:400px" id="SOLDelName" value="{!pros.SOLDel.Pro_Name__c}"/>
                                    </apex:outputPanel>
                                    <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                        <apex:outputText style="width:400px" id="Name" value="{!pros.pro.Name}"/>
                                    </apex:outputPanel>
                                </td>
                                <!-- 资料分类 -->
                                <td class="dataCell" style="text-align:center;">
                                    <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                        <apex:outputText style="width:400px" id="SOLDelClassification" value="{!pros.SOLDel.Sample_Classification__c}"/>
                                    </apex:outputPanel>
                                    <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                        <apex:outputText style="width:400px" id="Classification" value="{!pros.pro.Sample_Classification__c}"/>
                                    </apex:outputPanel>
                                </td>
                                <!-- 效期 -->
                                <!-- <td class="dataCell" style="text-align:center;">
                                    <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}">
                                        <apex:outputField value="{!pros.SOLDel.TermDate__c}"/>
                                    </apex:outputPanel>
                                    <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                        <apex:outputField style="width:90px" id="SFDA_Expiration_Date" value="{!pros.pro.SFDA_Expiration_Date__c}"/>
                                    </apex:outputPanel>
                                </td> -->
                                <!-- 数量 -->
                                <td class="dataCell" style="text-align:center;">
                                    <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                        <apex:outputField value="{!pros.SOLDel.ItemQuantity__c}"/>
                                    </apex:outputPanel>
                                    <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                        <apex:inputField id="Number" style="width:80px" value="{!pros.SOLDel.ItemQuantity__c}" onblur="AllChecktime({!pros.lineNo});ComputePrice(this);return false;" />
                                    </apex:outputPanel>
                                </td>
                                <!-- 规格 -->
                                <td class="dataCell" style="text-align:center;">
                                    <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                        <apex:outputText value="{!pros.SOLDel.Standards__c}"/>
                                    </apex:outputPanel>
                                    <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                        <apex:outputText style="width:30px" id="Packing_list_manual" value="{!if(pros.pro.Asset_Model_No__c == null , '',pros.pro.Packing_list_manual__c)}" />
                                        <!-- <apex:inputHidden id="PackingHidden" value="{!pros.SOLDel.Standards__c}"/> -->
                                    </apex:outputPanel>
                                </td>
                                <!-- 总量 -->
                                <td class="dataCell" style="text-align:center;">
                                    <apex:outputField style="margin-left:3px;margin-right:3px;width:25px" id="Total" value="{!pros.SOLDel.Total__c}">
                                    </apex:outputField>
                                </td>
                            </tr>
                        </apex:repeat>
                                <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputField value="{!sampleOrder.ReceivePart__c}"/>
                                </apex:outputPanel>
                                <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:inputField id="sampleReceivePart" value="{!sampleOrder.ReceivePart__c}" onchange="resetDealer();return false;" />
                                </apex:outputPanel>
                            </td>
                            <th style="text-align:right;">送达方地址:</th>
                            <td style="text-align:left;">
                                <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputField value="{!sampleOrder.DeliveryAddress__c}"/>
                                </apex:outputPanel>
                                <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:inputField id="Address" value="{!sampleOrder.DeliveryAddress__c}" />
                                </apex:outputPanel>
                                <!-- <apex:inputHidden id="tempSize" value="{!tempSize}" /> -->
                            </td>
                        </tr>
                        <!-- 20211115 lt end -->
                        <tr style="background-color:#f2f3f3;width:900px;">
                            <th style="text-align: left;">送达方联系人:</th>
                            <td style="text-align:left;">
                                <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputField value="{!sampleOrder.DeliveryContact__c}"/>
                                </apex:outputPanel>
                                <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:inputField id="Contact" value="{!sampleOrder.DeliveryContact__c}" />
                                </apex:outputPanel>
                            </td>
                            <th style="text-align:right;">送达方电话:</th>
                            <td style="text-align:left;">
                                <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputField value="{!sampleOrder.DeliveryPhone__c}"/>
                                </apex:outputPanel>
                                <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:inputField id="Phone" value="{!sampleOrder.DeliveryPhone__c}" />
                                </apex:outputPanel>
                            </td>
                        </tr>
                    </table>
                </div>
                <div id="iframelike" style="width: 100%; height: 40px; text-align:center;margin:0 auto;" >
                    <table id="buttontable" border="0">
                        <tr>
                            <!-- <td style="width:100px;" align="left"><apex:commandButton value="增加行" style="width:100px;height:30px;" onclick="openAddMultipleRow(); return false;" rerender="{!displayFlg}"/></td> -->
                            <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',false,true)}">
                                <td style="width:100%;" align="right"><apex:commandButton id="preserve" value="保存" style="width:100px;height:30px;" onclick="SaveJs();return false;" /></td>
                                <td align="right"><apex:commandButton id="sendOrder" value="发送订货" style="width:100px;height:30px;" onclick="openAddMultipleRow(); return false;"/></td>
                            </apex:outputPanel>
                            <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}">
                                <td style="width:98%; position: absolute;" align="right"><apex:commandButton id="Return" value="返回" style="width:100px;height:30px;" action="{!ReturnBtn}" /></td>
                            </apex:outputPanel>
                <!-- 后台报错信息显示的关键 -->
                <apex:outputPanel id="message">
                    <apex:pageMessages ></apex:pageMessages>
                </apex:outputPanel>
                <input type="hidden" id="Page:mainForm:productInfoList:Size" value="{!tempSize}" />
                <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',false,true)}" >
                    <table id="theTable_Body" class="pure-table pure-table-horizontal" border="1" style="border-collapse: collapse; table-layout:fixed;">
                        <tr style="background-color:#f2f3f3; width:900px; color: black;">
                            <th style="text-align:left; width:50px">查询:</th>
                            <td style="text-align:left; width:180px">
                                <apex:inputText style="text-align:left;" id="selectlike" value="{!QueryTemp}" />
                            </td>
                            <td style="text-align:left;">
                                <apex:commandButton id="Query" value="查询" style="width:100px;height:30px;" action="{!FuzzyQuery}" />
                            </td>
                        </tr>
                    </table>
                </div>
            </apex:outputPanel>
        </apex:form>
                </apex:outputPanel>
                <div id="iframelike" style="width: 100%; height: 400px; text-align:center;margin:0 auto;" >
                <table id="theTable_Body" class="pure-table pure-table-horizontal" border="1" style="border-collapse: collapse; table-layout:fixed;">
                    <colgroup>
                        <col width="2%"/>
                        <col width="3%"/>
                        <col width="20%"/>
                        <col width="30%"/>
                        <col width="20%"/>
                        <col width="10%"/>
                        <col width="5%"/>
                        <col width="10%"/>
                    </colgroup>
                    <tr style="background-color:#f2f3f3;">
                        <th style="text-align:center"><input type="checkbox" id="checkAll1" onclick="checkAll();" style="width:10px;"/></th>
                        <th style="text-align:center;color: black;">NO</th>
                        <th style="text-align:center;color: black;">资料编码</th>
                        <th style="text-align:center;color: black;">资料名称</th>
                        <th style="text-align:center;color: black;">资料分类</th>
                        <th style="text-align:center;color: black;">数量</th>
                        <th style="text-align:center;color: black;">规格</th>
                        <th style="text-align:center;color: black;">总量</th>
                    </tr>
                    <apex:repeat value="{!productInfoList}" var="pros" id="productInfoList">
                        <tr>
                            <!-- ⚀ -->
                            <td class="dataCell" style="text-align:center;">
                                <apex:inputCheckbox value="{!pros.check}" id="rowcheck"/>
                                <apex:inputHidden id="ProIdHidden" value="{!pros.proId}"/>
                            </td>
    <!-- </body> -->
                            <!-- NO -->
                            <td class="dataCell" style="text-align:center;">
                                <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputLabel style="width:20px" id="indexNo" value="{!IF(pros.SOLDel.Pro_model__c == null,'',pros.lineNo)}"/>
                                </apex:outputPanel>
                                <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputLabel style="width:20px" value="{!IF(pros.pro.Asset_Model_No__c == null,'',pros.lineNo)}"/>
                                </apex:outputPanel>
                            </td>
    <!-- 20211103 lt -->
    <!-- 添加行 html特性增加滑动条 精琢技术 wql 2021/02/09 start -->
    <!-- <script type="text/javascript">
        //const duration = document.getElementById('dur');
        function changeV() {
            var speed = document.getElementById('speed');
            //durVal = parseFloat(duration.value);
            spdVal = parseFloat(speed.value);
            //const durationPercent = parseFloat(durVal, 2) * 100
            const speedPercent = parseFloat((spdVal / 100), 2)*100;
            //duration.style.backgroundSize = `${durationPercent}%, 100%`
            speed.style.background = `linear-gradient(to right, #ffa200, white ${speedPercent}%, white`
            document.getElementById("addMultipleRow").value= speed.value;
        };
        function changeI() {
            var speed = document.getElementById('speed');
            //durVal = parseFloat(duration.value);
            spdVal = parseFloat(document.getElementById("addMultipleRow").value);
            //const durationPercent = parseFloat(durVal, 2) * 100
            const speedPercent = parseFloat((spdVal / 100), 2)*100;
            //duration.style.backgroundSize = `${durationPercent}%, 100%`
            speed.style.background = `linear-gradient(to right, #ffa200, white ${speedPercent}%, white`
            speed.value = document.getElementById("addMultipleRow").value;
                            <!-- 资料编码 -->
                            <td class="dataCell" style="text-align:center;">
                                <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputField value="{!pros.SOLDel.Pro_model__c}"/>
                                </apex:outputPanel>
                                <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputField style="width:90px" id="proModel" value="{!pros.pro.Asset_Model_No__c}"/>
                                </apex:outputPanel>
                            </td>
        };
                            <!-- 资料名称 -->
                            <td class="dataCell" style="text-align:center;">
                                <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputText style="width:400px" id="SOLDelName" value="{!pros.SOLDel.Pro_Name__c}"/>
                                </apex:outputPanel>
                                <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputText style="width:400px" id="Name" value="{!pros.pro.Name}"/>
                                </apex:outputPanel>
                            </td>
                            <!-- 资料分类 -->
                            <td class="dataCell" style="text-align:center;">
                                <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputText style="width:400px" id="SOLDelClassification" value="{!pros.SOLDel.Sample_Classification__c}"/>
                                </apex:outputPanel>
                                <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputText style="width:400px" id="Classification" value="{!pros.pro.Sample_Classification__c}"/>
                                </apex:outputPanel>
                            </td>
    </script> -->
    <!-- //添加行 html特性增加滑动条 精琢技术 wql 2021/02/09 end -->
    <!-- 20211103 lt -->
                            <!-- 数量 -->
                            <td class="dataCell" style="text-align:center;">
                                <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputField value="{!pros.SOLDel.ItemQuantity__c}"/>
                                </apex:outputPanel>
                                <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:inputField id="Number" style="width:80px" value="{!pros.SOLDel.ItemQuantity__c}" onblur="AllChecktime({!pros.lineNo});ComputePrice(this);return false;" />
                                </apex:outputPanel>
                            </td>
                            <!-- 规格 -->
                            <td class="dataCell" style="text-align:center;">
                                <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputText value="{!pros.SOLDel.Standards__c}"/>
                                </apex:outputPanel>
                                <apex:outputPanel rendered="{!!IF(sampleOrder.Status__c='订单已发送',true,false)}" >
                                    <apex:outputText style="width:30px" id="Packing_list_manual" value="{!if(pros.pro.Asset_Model_No__c == null , '',pros.pro.Packing_list_manual__c)}" />
                                    <!-- <apex:inputHidden id="PackingHidden" value="{!pros.SOLDel.Standards__c}"/> -->
                                </apex:outputPanel>
                            </td>
                            <!-- 总量 -->
                            <td class="dataCell" style="text-align:center;">
                                <apex:outputField style="margin-left:3px;margin-right:3px;width:25px" id="Total" value="{!pros.SOLDel.Total__c}">
                                </apex:outputField>
                            </td>
                        </tr>
                    </apex:repeat>
                </table>
            </div>
            <div id="iframelike" style="width: 100%; height: 40px; text-align:center;margin:0 auto;" >
                <table id="buttontable" border="0">
                    <tr>
                        <!-- <td style="width:100px;" align="left"><apex:commandButton value="增加行" style="width:100px;height:30px;" onclick="openAddMultipleRow(); return false;" rerender="{!displayFlg}"/></td> -->
                        <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',false,true)}">
                            <td style="width:100%;" align="right"><apex:commandButton id="preserve" value="保存" style="width:100px;height:30px;" onclick="SaveJs();return false;" /></td>
                            <td align="right"><apex:commandButton id="sendOrder" value="发送订货" style="width:100px;height:30px;" onclick="openAddMultipleRow(); return false;"/></td>
                        </apex:outputPanel>
                        <apex:outputPanel rendered="{!IF(sampleOrder.Status__c='订单已发送',true,false)}">
                            <td style="width:98%; position: absolute;" align="right"><apex:commandButton id="Return" value="返回" style="width:100px;height:30px;" action="{!ReturnBtn}" /></td>
                        </apex:outputPanel>
                    </tr>
                </table>
            </div>
        </apex:outputPanel>
    </apex:form>
</apex:page>
force-app/main/default/pages/StatusPage.page
@@ -15,6 +15,10 @@
                alert('不需要理由不能为空');
                return;
            }
            if (chance.trim() == '' || chance.trim() == null) {
                alert('不需要理由不能为空');
                return;
            }
            if ((chance == '已经有询价') && (name1.trim() == null || name1.trim() == "")) {
                alert('已有询价名称不能为空');
                return;
@@ -39,7 +43,7 @@
                    <br />
                    <apex:inputField id="name1" value="{!Inquiryform.Opp_Name_Search__c}" style="width: 150px"/>
            </apex:pageBlockSection>
            <apex:pageblockbuttons >
            <apex:pageblockbuttons location="bottom">
                <apex:commandbutton onclick="save();return false;" value="保存"></apex:commandbutton>
            </apex:pageblockbuttons>
        </apex:pageBlock>
force-app/main/default/pages/UploadOBPM.page
@@ -8,16 +8,22 @@
    <apex:includeScript value="{!URLFOR($Resource.apex20)}"/>
    <script>
        sforce.connection.sessionId = '{!$Api.Session_ID}';
        function addJs(){
            blockme();
            addLine();
        }
        // function addJs(){
        //     blockme();
        //     addLine();
        // }
        function uploadJs(){
            blockme();
            uploadOBPM();
            var IF_Approved = j$(escapeVfId('IF_Approved')).value();
            if(IF_Approved == 'true'){
                blockme();
                uploadOBPM();
            } else{
                alert("此会议不需要申请决裁!");
            }
        }
        function uploadSuccess(){
            alert('上传OBPM成功!');
            window.close();
        }
        function closeJs(){
            window.close();
@@ -36,17 +42,19 @@
        <apex:actionFunction name="uploadOBPM" action="{!uploadOBPM}" rerender="allForm,allPanel,allBlock,records" oncomplete="unblockUI();uploadSuccess();">
        </apex:actionFunction>
        <apex:outputPanel id="allPanel">
            <input type="hidden" id="hasError" value="{!hasError}"/>
            <input type="hidden" id="IF_Approved" value="{!IF_Approved}"/>
            <apex:pageBlock id="allBlock">
                <apex:pageBlockButtons location="top">
                    <apex:commandButton immediate="true" onclick="uploadJs();" value="上传OBPM" rerender="dummy"/>
                    <apex:commandButton immediate="true" onclick="addJs();" value="添加行" rerender="dummy"/>
                    <apex:commandButton immediate="true" onclick="closeJs();" value="关闭" rerender="dummy"/>
                    <apex:commandButton immediate="true" onclick="uploadJs();return false;" value="上传OBPM"/>
                    <apex:commandButton immediate="true" action="{!addLine}" onclick="blockme();" value="添加行"/>
                    <apex:commandButton immediate="true" onclick="closeJs();" value="关闭"/>
                </apex:pageBlockButtons>
                <apex:outputPanel id="message">
                    <apex:pageMessages />
                </apex:outputPanel>
                <input type="hidden" id="hasError" value="{!hasError}"/>
                <label>申请决裁时如需要共同编辑人和抄送人,请填入下表:</label>
                <table class="linetable" border="1" style="border-collapse: collapse;width:590px;table-layout:fixed;">
                    <colgroup>
                        <col width="40px"/>
@@ -83,7 +91,7 @@
                                <option value ="共同编辑人">共同编辑人</option>
                                <option value ="抄送人">抄送人</option>
                            </select> -->
                            <apex:selectList value="{!OBPMInfo.Role}" size="1" style="position: absolute;transform: translate(-40px, -3px);">
                            <apex:selectList value="{!OBPMInfo.Role}" size="1" style="position: relative; top: 6px;">
                                <apex:selectOptions value="{!items}"/>
                            </apex:selectList><p/>
                        </td>
force-app/main/default/triggers/AccountTrigger.trigger
@@ -131,26 +131,27 @@
        }
        //HWAG-B4PCZ5 2018-09-19 end 
        //NFM112 2021/11/10 start
        String Idbox;
        List<String> IdList = new List<String>();
        for(Account account : Trigger.new){
           Account old = Trigger.oldMap.get(account.Id);
           if(old.FirstParagraph__c != account.FirstParagraph__c  || old.MonthlyPayment__c != account.MonthlyPayment__c){
                    Idbox = account.Id;
                IdList.add(account.Id);
            }
        }
        if(Idbox != null){
            BatchIF_Log__c iflog = new BatchIF_Log__c();
            iflog.Type__c = 'NFM112';
            iflog.Log__c  = 'callout start\n';
            insert iflog;
            iflog = [Select Id, Name from BatchIF_Log__c where Id = :iflog.Id];
            System.debug(Logginglevel.DEBUG, 'NFM112_' + iflog.Name + ' start');
            NFM112Controller.executeNotFuture(iflog.Id, Idbox);
        if(IdList.size()>0){
            for(String Id : IdList){
                BatchIF_Log__c iflog = new BatchIF_Log__c();
                iflog.Type__c = 'NFM112';
                iflog.Log__c  = 'callout start\n';
                insert iflog;
                //iflog = [Select Id, Name from BatchIF_Log__c where Id = :iflog.Id];
                //System.debug(Logginglevel.DEBUG, 'NFM112_' + iflog.Name + ' start');
                NFM112Controller.executeNotFuture(iflog.Id, Id);
            }
        }
        //NFM112 2021/11/10 end
    }
    //add            wangweipeng              2022/02/10                            start
 //add            wangweipeng              2022/02/10                            start
    //经销商的性质发生变化,那么需要发邮件,其中一个收件人为大区助理
    //大区助理:根据此经销商所在的那个大区,来判断到底发给谁,每个大区助理都有一个人,目前是存到自定义源数据里面了
    if(Trigger.isBefore){
force-app/main/default/triggers/ConsumableOrderDetail2Trigger.trigger
@@ -27,7 +27,6 @@
    }
        
    system.debug('orderSet---------------1--------------'+orderSet);
    if (orderSet.size()>0){
        // 2018年8月9日 HWAG-B3D9UV  替换 SQL start by 张玉山
        list<Consumable_order_details2__c> allresults = 
@@ -35,7 +34,6 @@
            Dealer_Returned__c, Dealer_Arrive__c, RemoveBox_No__c,Cancellation_Date__c
            FROM Consumable_order_details2__c
             WHERE Consumable_order_minor__c in :orderSet ];
        system.debug('allresults'+allresults);
        // 2018年8月9日 HWAG-B3D9UV  end by 张玉山
        
        // 2018年8月9日 HWAG-B3D9UV  替换下面原有SQL 使用 map 完成赋值 start by 张玉山
@@ -103,71 +101,102 @@
        //更新消耗品订单的发货日期
        // 2018年8月9日 HWAG-B3D9UV  替换下面原有SQL 使用 map 完成赋值  start by 张玉山
        map<string,Date> DeliverdateResults =  new map<string,Date>();
        Set<string> resultsKeySet =  new Set<String>();
        map<string,Date> DeliverdateResults =  new map<string,Date>();//最新发货时间
        map<string,Date> DeliverdateminResults =  new map<string,Date>();//最早发货时间
        for(Consumable_order_details2__c results1 : allresults){
            if(results1.Dealer_Arrive__c == true || results1.Dealer_Returned__c== true){
                continue;
            }
            string Consumable_order_minor_str = String.valueOf(results1.Consumable_order_minor__c);
            system.debug('---------------2---------------' + DeliverdateResults.containsKey(Consumable_order_minor_str));
            if(DeliverdateResults.containsKey(Consumable_order_minor_str)){
                if(DeliverdateResults.get(Consumable_order_minor_str)
                    < results1.Deliver_date__c
                    ){
                    DeliverdateResults.put(Consumable_order_minor_str,results1.Deliver_date__c);
                    resultsKeySet.add(Consumable_order_minor_str);
                }
            }else{
                DeliverdateResults.put(Consumable_order_minor_str,results1.Deliver_date__c);
                resultsKeySet.add(Consumable_order_minor_str);
            }
        }
        consumableOrderlist = new List<Consumable_Order__c>();
        for (string key : DeliverdateResults.keySet()) {
           if(DeliverdateResults.get(key)!=null){
                Consumable_Order__c consumableOrder1 = new Consumable_Order__c();
                consumableOrder1.Id = key;
                consumableOrder1.Shipment_Date__c = DeliverdateResults.get(key);
                consumableOrderlist.add(consumableOrder1);
            }
        }
        // 2018年8月9日 HWAG-B3D9UV  替换下面原有SQL 使用 map 完成赋值  end by 张玉山
        //获取早发货日期 start
        system.debug('DeliverdateResults==============' + DeliverdateResults);
        system.debug('走到最早发货日期');
        map<string,Date> DeliverdateminResults =  new map<string,Date>();
        for(Consumable_order_details2__c results1 : allresults){
            if(results1.Dealer_Arrive__c == true || results1.Dealer_Returned__c== true){
                continue;
            }
            string Consumable_order_minor_str = String.valueOf(results1.Consumable_order_minor__c);
            //获取最早发货时间 pk part1 start
            if(DeliverdateminResults.containsKey(Consumable_order_minor_str)){
                if(DeliverdateminResults.get(Consumable_order_minor_str)
                    > results1.Deliver_date__c
                    ){
                        DeliverdateminResults.put(Consumable_order_minor_str,results1.Deliver_date__c);
                    DeliverdateminResults.put(Consumable_order_minor_str,results1.Deliver_date__c);
                    resultsKeySet.add(Consumable_order_minor_str);
                }
            }else{
                DeliverdateminResults.put(Consumable_order_minor_str,results1.Deliver_date__c);
                resultsKeySet.add(Consumable_order_minor_str);
            }
            //获取最早发货时间 pk part1 end
        }
        List<Consumable_Order__c> consumableOrderminlist = new List<Consumable_Order__c>();
        for (string key : DeliverdateminResults.keySet()) {
           if(DeliverdateminResults.get(key)!=null){
                Consumable_Order__c consumableOrder1 = new Consumable_Order__c();
                consumableOrder1.Id = key;
                consumableOrder1.First_Delivery__c = DeliverdateResults.get(key);
                consumableOrderminlist.add(consumableOrder1);
        //两个DeliverdateResults.keySet(),DeliverdateminResults.keySet() 合并作为一个List ,遍历List
        //获取最早发货时间 pk part2 start
        consumableOrderlist = new List<Consumable_Order__c>();
        for(string temp : resultsKeySet){
            Consumable_Order__c consumableOrder1 = new Consumable_Order__c();
            consumableOrder1.Id = temp;
            if(DeliverdateResults.get(temp)!=null){
                consumableOrder1.Shipment_Date__c = DeliverdateResults.get(temp);
            }
            if(DeliverdateminResults.get(temp)!=null){
                consumableOrder1.First_Delivery__c = DeliverdateResults.get(temp);
            }
            consumableOrderlist.add(consumableOrder1);
        }
        //获取最早发货时间 pk part2 end
        // List<Consumable_Order__c> consumableOrderminlist = new List<Consumable_Order__c>();//最早发货时间
        // for (string key : DeliverdateminResults.keySet()) {
        //    if(DeliverdateminResults.get(key)!=null){
        //         Consumable_Order__c consumableOrder1 = new Consumable_Order__c();
        //         consumableOrder1.Id = key;
        //         consumableOrder1.First_Delivery__c = DeliverdateResults.get(key);
        //         consumableOrderminlist.add(consumableOrder1);
        //     }
        // }
        // 2018年8月9日 HWAG-B3D9UV  替换下面原有SQL 使用 map 完成赋值  end by 张玉山
        //获取早发货日期 start
        // system.debug('DeliverdateResults==============' + DeliverdateResults);
        // system.debug('走到最早发货日期');
        // map<string,Date> DeliverdateminResults =  new map<string,Date>();
        // for(Consumable_order_details2__c results1 : allresults){
        //     if(results1.Dealer_Arrive__c == true || results1.Dealer_Returned__c== true){
        //         continue;
        //     }
        //     string Consumable_order_minor_str = String.valueOf(results1.Consumable_order_minor__c);
        //     if(DeliverdateminResults.containsKey(Consumable_order_minor_str)){
        //         if(DeliverdateminResults.get(Consumable_order_minor_str)
        //             > results1.Deliver_date__c
        //             ){
        //                 DeliverdateminResults.put(Consumable_order_minor_str,results1.Deliver_date__c);
        //         }
        if(consumableOrderminlist.size() > 0){
            update consumableOrderminlist;
        }
        system.debug('DeliverdateResults==============' + DeliverdateResults);
        //     }else{
        //         DeliverdateminResults.put(Consumable_order_minor_str,results1.Deliver_date__c);
        //     }
        // }
        // List<Consumable_Order__c> consumableOrderminlist = new List<Consumable_Order__c>();
        // for (string key : DeliverdateminResults.keySet()) {
        //    if(DeliverdateminResults.get(key)!=null){
        //         Consumable_Order__c consumableOrder1 = new Consumable_Order__c();
        //         consumableOrder1.Id = key;
        //         consumableOrder1.First_Delivery__c = DeliverdateResults.get(key);
        //         consumableOrderminlist.add(consumableOrder1);
        //     }
        // }
        // if(consumableOrderminlist.size() > 0){
        //     update consumableOrderminlist;
        // }
        // system.debug('DeliverdateResults==============' + DeliverdateResults);
        // //获取最早发货日期 end
        /* 2018年8月9日 HWAG-B3D9UV  原有SQL 与赋值 start by 张玉山
@@ -191,7 +220,7 @@
        if (consumableOrderlist.size() > 0){
           update consumableOrderlist;
        }
        //更新待确认收货数量
        // 2018年8月9日 HWAG-B3D9UV  替换下面原有SQL 使用 map 完成赋值  start by 张玉山
        map<string,Integer> resultsMap2 =  new map<string,Integer>();
@@ -264,7 +293,6 @@
    if (trigger.isUpdate || trigger.isInsert || trigger.isDelete){
        if (trigger.isUpdate || trigger.isInsert){
            for (Consumable_order_details2__c detail2 : Trigger.New) {
                system.debug('detail2==========='+detail2);
                Consumable_order_details2__c oldDetail2 = null;
                if (Trigger.isUpdate) oldDetail2 = Trigger.oldMap.get(detail2.Id);
                if (detail2.Consumable_Arrived_order__c != null) {
@@ -297,7 +325,6 @@
            Map<Id, Consumable_order__c> arrivedMap = new Map<Id, Consumable_order__c>([select Id, RecordType.DeveloperName, Name from Consumable_order__c where Id in :arrivedSet]);
            List<Consumable_orderdetails__c> detail1List = [select Id, Name, Asset_Model_No__c, Consumable_count__c, Consumable_order__c from Consumable_orderdetails__c where Consumable_order__c in :arrivedSet];
            Map<String,Consumable_orderdetails__c> detail1Map = new Map<String,Consumable_orderdetails__c>();
            system.debug('detail1List'+detail1List);
            for (Consumable_orderdetails__c detail1 : detail1List) {
                String key = '' + detail1.Consumable_order__c + detail1.Asset_Model_No__c;
                detail1Map.put(key, detail1);
@@ -353,13 +380,10 @@
            Map<String, String> assetModelNoMap = new Map<String, String>();
            if (trigger.isUpdate || trigger.isInsert){
                for (Consumable_order_details2__c detail2 : Trigger.New) {  
                    system.debug('detail2'+detail2);
                    //Dataloaderで初期在庫登録をしたあと、データ修正が入ったときに明細1が更新されない。
                    //if (trigger.isUpdate && detail2.ManualRegisteredStock__c == true) continue;                  
                    if (detail2.Consumable_Arrived_order__c == null) continue;
                    String key = '' + detail2.Consumable_Arrived_order__c + detail2.Asset_Model_No__c;
                    system.debug('key'+key);
                    system.debug('detail1Map==============>'+detail1Map);
                    //if (upsertMap.get(key) != null) continue;
                    Integer count = keyCount.get(key);
                    Consumable_orderdetails__c detail1 = detail1Map.get(key);
@@ -368,7 +392,6 @@
                    detail1.Consumable_Arrivecount__c = count;
                    if (detail1.Id == null) {
                        Consumable_order__c co = arrivedMap.get(detail2.Consumable_Arrived_order__c);
                        system.debug('arrivedMap=============='+arrivedMap);
                        Integer index = noCount.get(co.Id);
                        if (index == null) index = 0;
                        if(assetModelNoMap.containsKey(detail2.Asset_Model_No__c)){
@@ -415,7 +438,6 @@
                        deletetMap.put(key,detail1);
                        continue;
                    }
                    system.debug('detail1========================'+detail1);
                    if (detail1 == null) continue;
                    detail1.Consumable_Arrivecount__c = count;
force-app/main/default/triggers/FollowTrigger.trigger
New file
@@ -0,0 +1,4 @@
trigger FollowTrigger on Inquiry_form__c(after update) {
    FollowTriggerHandler fth = new FollowTriggerHandler();
    fth.run();
}
force-app/main/default/triggers/FollowTrigger.trigger-meta.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexTrigger xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>41.0</apiVersion>
    <status>Active</status>
</ApexTrigger>
force-app/main/default/triggers/NFM007.trigger
@@ -57,6 +57,9 @@
                            Id,
                            SFDA_Status__c,
                            PricebookEntry.Product2Id
                            //lastbuy  2022/2/9 fy start
                            ,Asset_Model_No__c
                            //lastbuy  2022/2/9 fy end
                            // CHAN-BTF4XQ start
                            // 额外检索产品标准定价和产品成本
                            ,Product_Cost__c,Product_ListPrice__c,Quantity__c
@@ -77,7 +80,16 @@
                            }
                            // CHAN-BTF4XQ end
                            //lastbuy  2022/2/9 fy start
                            quotlinitMap.put(qli.PricebookEntry.Product2Id,qli);
                            if(qli.PricebookEntry.Product2Id!=null){
                                if(quotlinitMap.containsKey(qli.PricebookEntry.Product2Id)){
                                    QuoteLineItem quoteLine = quotlinitMap.get(qli.PricebookEntry.Product2Id);
                                    quoteLine.Quantity__c +=qli.Quantity__c;
                                    quotlinitMap.put(qli.PricebookEntry.Product2Id,quoteLine);
                                }else{
                                    quotlinitMap.put(qli.PricebookEntry.Product2Id,qli);
                                }
                            }
                            // quotlinitMap.put(qli.PricebookEntry.Product2Id,qli);
                            //lastbuy  2022/2/9 fy end
                        } 
                        if( CntCostOrListPrice > 0){
@@ -86,7 +98,9 @@
                        //CHAN-BWH2YW 20201221 you 加 字段 Correspond_Code__r start
                        //lastbuy  2022/2/9 fy
                        //新增预留产品字段LastbuyProductFLG__c
                        List<String> lastProductFLGList= new List<String>();
                        List<String> lastProductFLGIdList= new List<String>();
                        List<Product2> lastProductFLGList = new List<Product2>();
                        List<Product2> lastProductFLGListtest = new List<Product2>();
                        for (Product2 prd2: [Select Id,LastbuyProductFLG__c, Estimation_Entry_Possibility__c, SFDA_Status__c,Packing_list_manual__c,Correspond_Code__r.Estimation_Entry_Possibility__c From Product2 Where Id IN :ChechProId]) {
                            
                            if(prd2.Estimation_Entry_Possibility__c != '○'){ 
@@ -97,39 +111,56 @@
                                } 
                                 //CHAN-BWH2YW 20201221 you 加 字段 Correspond_Code__r end 
                            }
                            lastProductFLGListtest.add(prd2);
                            //lastbuy  2022/2/9 fy start
                            if(prd2.LastbuyProductFLG__c){
                                lastProductFLGList.add(prd2.Id);
                                lastProductFLGIdList.add(prd2.Id);
                                lastProductFLGList.add(prd2);
                            }
                            //lastbuy  2022/2/9 fy end
                        }
                        //lastbuy  2022/2/9 fy start
                        List<LastbuyProduct__c> upLastbuyObjList = new List<LastbuyProduct__c>();
                        if(lastProductFLGList!=null){
                            List<LastbuyProduct__c> LastbuyObjList=[select id,LastbuyQuantity__c,InquiryCode__c,ProductName__c,effectiveFLG__c from LastbuyProduct__c where InquiryCode__c= : opp.Id and ProductName__c in :lastProductFLGList and     effectiveFLG__c = true];
                            System.debug('bbbbbbbbbbbbbbb==='+lastProductFLGList);
                            if(LastbuyObjList!=null){
                        if(lastProductFLGIdList!=null && lastProductFLGIdList.size() !=0){
                            List<LastbuyProduct__c> LastbuyObjList=[select id,LastbuyQuantity__c,InquiryCode__c,ProductName__c,effectiveFLG__c from LastbuyProduct__c where InquiryCode__c= : opp.Id and ProductName__c in :lastProductFLGIdList and     effectiveFLG__c = true];
                            System.debug('bbbbbbbbbbbbbbb==='+lastProductFLGIdList);
                            Map<string,LastbuyProduct__c> LastbuyObjMap = new Map<string,LastbuyProduct__c>();
                            if(LastbuyObjList!=null&&LastbuyObjList.size()!=0){
                                for(LastbuyProduct__c lastbuypr :LastbuyObjList){
                                    Decimal quoteLItemNum=0;
                                    if(quotlinitMap.containsKey(lastbuypr.ProductName__c)){
                                        quoteLItemNum=quotlinitMap.get(lastbuypr.ProductName__c).Quantity__c;
                                    }else{
                                        continue;
                                    }
                                    if(lastbuypr.LastbuyQuantity__c<quoteLItemNum){
                                        opp.addError('产品数量不可超过产品预留数量');
                                    }else{
                                        lastbuypr.ActualQuantity__c=quoteLItemNum;
                                        lastbuypr.effectiveFLG__c=false;
                                        upLastbuyObjList.add(lastbuypr);
                                    }
                                    System.debug('cccccccccccccc==='+lastbuypr);
                                  LastbuyObjMap.put(lastbuypr.ProductName__c,lastbuypr);
                                }
                                System.debug('aaaaaaaaaaaaaa==='+LastbuyObjList);
                                System.debug('fffffffffffffff==='+LastbuyObjList);
                                if(lastProductFLGList!=null && lastProductFLGList.size() !=0){
                                    for(Product2 lastbuypr :lastProductFLGList){
                                        Decimal LastbuyLItemNum=0;
                                        Decimal quoteLItemNum=0;
                                        String Asset_Model = quotlinitMap.get(lastbuypr.Id).Asset_Model_No__c;
                                        if(LastbuyObjMap.containsKey(lastbuypr.Id)){
                                            LastbuyProduct__c lastbuyobj = LastbuyObjMap.get(lastbuypr.Id);
                                            if(quotlinitMap.containsKey(lastbuypr.Id)){
                                                LastbuyLItemNum=LastbuyObjMap.get(lastbuypr.Id).LastbuyQuantity__c;
                                                quoteLItemNum=quotlinitMap.get(lastbuypr.Id).Quantity__c;
                                                if(quoteLItemNum>LastbuyLItemNum){
                                                    opp.addError(Asset_Model+'产品数量不可超过产品预留数量');
                                                }else{
                                                    lastbuyobj.ActualQuantity__c=quoteLItemNum;
                                                    lastbuyobj.effectiveFLG__c=false;
                                                    upLastbuyObjList.add(lastbuyobj);
                                                }
                                            }
                                        }else{
                                            opp.addError('预留产品'+Asset_Model+'未录入预留产品表');
                                            System.debug('asdasdfasdfadsf错误提示');
                                        }
                                        System.debug('cccccccccccccc==='+lastbuypr);
                                    }
                                    System.debug('aaaaaaaaaaaaaa==='+LastbuyObjList);
                                }
                            }else{
                                opp.addError('预留表中还没有数据');
                                opp.addError('预留产品表中没有录入该询价的预留产品');
                            }
                        }
                        System.debug('upLastbuyObjList==='+upLastbuyObjList);
                        if(upLastbuyObjList!=null){
force-app/main/default/triggers/OpportunityBefUpd.trigger
@@ -129,7 +129,8 @@
                raList = [Select Id,Follow_UP_Opp__c From Rental_Apply__c Where RA_Status_Text__c != '取消' and Follow_UP_Opp__c IN :opIds];
            }else{
        //2.从询价Id中查询备品状态不为取消(状态不为取消且询价中有s备品的话,就报错)    
                raList = [Select Id,Follow_UP_Opp__c From Rental_Apply__c Where RA_Status_Text__c != '取消' and RA_Status_Text__c != '完了' and Follow_UP_Opp__c IN :opIds];
                //20220307 lt update and RA_Status_Text__c != '草案中'  SWAG-CBXCYR 【委托】医院合并数据转移问题
                raList = [Select Id,Follow_UP_Opp__c From Rental_Apply__c Where RA_Status_Text__c != '取消' and RA_Status_Text__c != '完了' and RA_Status_Text__c != '草案中' and Follow_UP_Opp__c IN :opIds];
            }
            //3.将其(每个询价对应的备品)放入map中
            Map<String,Rental_Apply__c> raMap = new Map<String,Rental_Apply__c>();
force-app/main/default/triggers/Repair.trigger
@@ -66,8 +66,17 @@
            boolean defaultFlag = true;
            //add     wangweipeng               2021/12/09          end
            // 草案中修理だけ更新
            // GZW 特殊处理 跳过维修中心自动赋值,以手选为准 start
            // 判断条件追加   && repair.Exc_work_location__c == false
            if(repair.Exc_work_location__c){
                defaultFlag = false;
            }
            // GZW 特殊处理 跳过维修中心自动赋值,以手选为准 start
            if ((repair.Status__c == '草案中' || String.isBlank(repair.Status__c)) == false) {
                if (Trigger.isUpdate && repair.SAP_Transfer_time__c == null) {
                // if (Trigger.isUpdate && repair.SAP_Transfer_time__c == null) {
                if (Trigger.isUpdate && repair.SAP_Transfer_time__c == null && repair.Exc_work_location__c == false) {
                    repair = RepairTrigger.updateWorkLocationSelect(repair, null);
                    defaultFlag = false;
                }
@@ -79,7 +88,8 @@
            Boolean needsetnull = true;
            System.debug( '-----:自动带出维修合同11111' + middleTableList);
            if (middleTableList == null) {
            // if (middleTableList == null) {
            if (middleTableList == null  && repair.Exc_work_location__c == false) {
                if ((repair.NewProductGuarante_Txt__c == '2: 多年保修'
                        || repair.NewProductGuarante_Txt__c == '2: 服务多年保修'
                        || repair.NewProductGuarante_Txt__c == '8: 市场多年保修')
@@ -114,7 +124,8 @@
                            repair.repairPlace__c = middleTable.Maintenance_Contract__r.SalesOfficeCode_selection__c;
                            //新增逻辑 HWAG-BKP5FB 精琢科技 2020/03/19 Start
                            //wangweipeng   发生数据到SAP以后,修理的维修中心不能做修改
                            if(repair.SAP_Transfer_time__c == null){
                            // if(repair.SAP_Transfer_time__c == null){
                            if(repair.SAP_Transfer_time__c == null  && repair.Exc_work_location__c == false){
                                repair = RepairTrigger.updateWorkLocationSelect(repair, middleTable);    
                                defaultFlag = false;
                            }
@@ -159,7 +170,8 @@
            // Boolean needsetnull = true;
            System.debug( '-----:自动带出虚拟维修合同');
            System.debug( '-----:自动带出虚拟维修合同' + middleTableVMList);
            if (middleTableVMList == null) {
            // if (middleTableVMList == null) {
            if (middleTableVMList == null  && repair.Exc_work_location__c == false) {
                if ((repair.NewProductGuarante_Txt__c == '2: 多年保修'
                        || repair.NewProductGuarante_Txt__c == '2: 服务多年保修'
                        || repair.NewProductGuarante_Txt__c == '8: 市场多年保修')
@@ -180,7 +192,8 @@
                        repair.VM_Maintenance_Contract__c = middleTable.Maintenance_Contract__c;
                        needsetnull = false;
                        //新增逻辑 SLIU-BMMDWK 精琢科技 2020/03/17 Start
                        if (repair.VM_Maintenance_Contract__c != null) {
                        // if (repair.VM_Maintenance_Contract__c != null) {
                        if (repair.VM_Maintenance_Contract__c != null  && repair.Exc_work_location__c == false) {
                            repair = RepairTrigger.updateWorkLocationSelect(repair, middleTable);
                            defaultFlag = false;
                        }