@isTest
|
private class ConsumableTargetManageBatch1Test {
|
static testMethod void testMethod1() {
|
Oly_TriggerHandler.bypass('AccountTrigger');
|
Oly_TriggerHandler.bypass('ConsumableAssetHander');
|
Oly_TriggerHandler.bypass('DailyReportSetHospitalCount');
|
Oly_TriggerHandler.bypass(ConsumableTargetManageHandler.Class.getName());
|
List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
|
if (rectCo.size() == 0) {
|
return;
|
}
|
Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin];
|
|
Account hospital = new Account();
|
hospital.RecordTypeId = rectCo[0].Id;
|
hospital.Name = 'NFM007Testhospital';
|
insert hospital;
|
|
ConsumableTargetManage__c ctm=new ConsumableTargetManage__c();
|
ctm.OCM_Year__c = 'FY2024';
|
ctm.productType__c='ET耗材';
|
ctm.Hospital__c = hospital.Id;
|
ctm.Category3__c = '呼吸科ET';
|
ctm.Category4__c = '活检套装';
|
ctm.ConsumableTargetManageKey__c= hospital.Id+'-呼吸科ET-'+'活检套装-'+'FY2024';
|
insert ctm;
|
String recordIdC = Schema.SObjectType.TrackConsumableSalesForecast__c.getRecordTypeInfosByDeveloperName().get('ConsumableCategory3').getRecordTypeId();
|
|
TrackConsumableSalesForecast__c tcsf=new TrackConsumableSalesForecast__c();
|
|
tcsf.RecordTypeId = recordIdC;
|
tcsf.Consumable_Category1__c=ctm.productType__c;
|
tcsf.HospitalName__c=hospital.Name;
|
tcsf.Hospital__c=ctm.Hospital__c;
|
tcsf.Type__c='ET';
|
tcsf.Consumable_Category2__c=ctm.Category3__c;
|
tcsf.Consumable_Category3__c=ctm.Category4__c;
|
tcsf.SnapshotMonth__c=Date.ValueOf('2023-05-01');
|
insert tcsf;
|
Database.executeBatch(new ConsumableTargetManageBatch1(Date.ValueOf('2023-05-01'),Date.ValueOf('2023-05-01'),false),1);
|
}
|
|
|
}
|