@isTest
|
private class CancelPostponePlanTriggerTest {
|
|
@isTest
|
static void test_method_one() {
|
//2021/02/07 liying SWAG-BXVDPJ start
|
SS_Batch_Column_Mapping__c opdMapping = new SS_Batch_Column_Mapping__c(Name = 'Rental_Apply_OPD_Cancle', SS_TableName__c='Rental_Apply_OPD_Cancle');
|
opdMapping.From_Column_001__c = '手术取消';
|
opdMapping.SS_Column_001__c = '取消OPD试用;主动取消';
|
opdMapping.From_Column_002__c = '信息填写错误';
|
opdMapping.SS_Column_002__c = '信息填写错误;主动取消';
|
insert new SS_Batch_Column_Mapping__c[] {opdMapping};
|
//2021/02/07 liying SWAG-BXVDPJ end
|
OPDPlan__c oPDPlan = new OPDPlan__c();
|
oPDPlan.Status__c = '计划中';
|
oPDPlan.OPDPlan_ImplementDate__c = Date.today().addDays(5);
|
oPDPlan.NoOpp_Reason__c = 'HCP对应';
|
oPDPlan.Rental_Apply2__c =null;
|
oPDPlan.Rental_Apply1__c =null;
|
oPDPlan.Rental_Apply3__c = null;
|
insert oPDPlan;
|
//备品借出申请
|
Rental_Apply__c raObj = new Rental_Apply__c();
|
raObj.OPDPlan__c = oPDPlan.Id;
|
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.Status__c = '草案中';
|
raObj.Request_shipping_day__c = Date.toDay(); // 希望到货日
|
raObj.Hope_Lonaer_date_Num__c = 1; // 希望借用天数
|
raObj.Phone_number__c = '1234567890';
|
insert raObj;
|
|
Test.startTest();
|
CancelPostponePlan__c cpp = new CancelPostponePlan__c();
|
//2021-01-20 mzy add OPD计划取消延期 审批 通过后更新【OPD计划实施日期temp】
|
cpp.RecordTypeId = '01210000000gQyL';
|
//2021-01-20 mzy add OPD计划取消延期 审批 通过后更新【OPD计划实施日期temp】
|
cpp.Status__c = '取消';
|
cpp.cancelReasonCombobox__c='手术取消';//2021/02/07 liying SWAG-BXVDPJ
|
cpp.cancelReason__c = 'Test';
|
cpp.CancelOPDPlan__c = oPDPlan.Id;
|
cpp.if_HaveRental_Apply__c = false;
|
insert cpp;
|
cpp.Status__c = '取消成功';
|
update cpp;
|
Test.stopTest();
|
|
}
|
|
@isTest
|
static void test_method_two() {
|
OPDPlan__c oPDPlan = new OPDPlan__c();
|
oPDPlan.Status__c = '计划中';
|
oPDPlan.OPDPlan_ImplementDate__c = Date.today().addDays(5);
|
oPDPlan.NoOpp_Reason__c = 'HCP对应';
|
insert oPDPlan;
|
|
CancelPostponePlan__c cpp = new CancelPostponePlan__c();
|
cpp.Status__c = '延期报告';
|
cpp.RecordTypeId = '01210000000gQyM';
|
cpp.cancelReason__c = 'Test';
|
cpp.CancelOPDPlan__c = oPDPlan.Id;
|
cpp.NextPlanDate__c = Date.today().addDays(10);
|
insert cpp;
|
|
cpp.Status__c = '延期成功';
|
update cpp;
|
|
}
|
|
//2021-08-01 mzy SWAG-C5RAZV 事件——计划 延期 调查 start
|
@isTest
|
static void test_method_three() {
|
Event insertTarget = new Event();
|
insertTarget.Subject = 'test00';
|
insertTarget.StartDateTime = Datetime.now().adddays(5);
|
//2021-08-09 mzy SWAG-C4YB9J 事件页面优化 update start
|
//insertTarget.DurationInMinutes = 60;
|
insertTarget.EndDateTime = Datetime.now().adddays(5).addMinutes(60);
|
//2021-08-09 mzy SWAG-C4YB9J 事件页面优化 update end
|
insertTarget.Location = 'testLocation';
|
insertTarget.Activity_Type2__c = '病院';
|
insertTarget.OPDPlan_Flag__c = true ;
|
insertTarget.PlanProdDetail__c = 'CV-290*4; GI-290镜子*1; GI-290镜子CF*1;';
|
insert insertTarget;
|
|
OPDPlan__c oPDPlan = new OPDPlan__c();
|
oPDPlan.Status__c = '计划中';
|
oPDPlan.OPDPlan_ImplementDate__c = Date.today().addDays(5);
|
oPDPlan.NoOpp_Reason__c = 'HCP对应';
|
insert oPDPlan;
|
|
task__c task0 = new Task__c();
|
task0.RecordTypeId = '01210000000cWfX';
|
task0.taskDifferent__c = '被动任务';
|
task0.taskStatus__c = '05 延期';
|
task0.Activity_Date__c = Date.today().addDays(5);
|
task0.Opd_Plan__c = oPDPlan.Id;
|
insert task0;
|
|
task__c task = new Task__c();
|
task.RecordTypeId = '01210000000cWfX';
|
task.taskDifferent__c = '被动任务';
|
task.taskStatus__c = '01 分配';
|
task.Activity_Date__c = Date.today().addDays(5);
|
task.Opd_Plan__c = oPDPlan.Id;
|
task.Initial_Task__c = task0.Id;
|
insert task;
|
|
oPDPlan.Task_ID__c = task.id;
|
update oPDPlan;
|
|
insertTarget.Task_ID__c = task.id;
|
insertTarget.Opd_Plan__c = oPDPlan.Id;
|
update insertTarget;
|
|
CancelPostponePlan__c cpp = new CancelPostponePlan__c();
|
//2021-01-20 mzy add OPD计划取消延期 审批 通过后更新【OPD计划实施日期temp】
|
cpp.RecordTypeId = '01210000000gQyL';
|
//2021-01-20 mzy add OPD计划取消延期 审批 通过后更新【OPD计划实施日期temp】
|
cpp.Status__c = '取消';
|
cpp.cancelReasonCombobox__c='担当离职';
|
cpp.CancelOPDPlan__c = oPDPlan.Id;
|
cpp.if_HaveRental_Apply__c = false;
|
insert cpp;
|
cpp.Status__c = '取消成功';
|
update cpp;
|
|
}
|
//2021-08-01 mzy SWAG-C5RAZV 事件——计划 延期 调查 end
|
}
|