高章伟
2022-02-24 2aa8da8af66aa8ae00f25831aed6bb0364176e7b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
@isTest
private class RentalApplyEquipmentSetCheckTest {
    
    @isTest
    static  void insertRentalApply_Test() {
 
 
 
 
        OPDPlan__c oPDPlan0 = new OPDPlan__c();
        oPDPlan0.Status__c = '计划中';
        oPDPlan0.OPDPlan_ImplementDate__c = Date.today();
        oPDPlan0.NoOpp_Reason__c = 'HCP对应';
        insert oPDPlan0;
        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('baoxiuyonghu');
        raObj.direct_send__c = '医疗机构';
        raObj.Loaner_received_staff__c = '王五';
        raObj.Loaner_received_staff_phone__c = '110';
        raObj.direct_shippment_address__c = '北京市';
        raObj.ApplyPerson_Phone__c = '12345';
 
        raObj.Request_shipping_day__c = Date.toDay();  // 希望到货日
        raObj.Phone_number__c = '1234567890';
        raObj.OPDPlan__c = oPDPlan0.Id;
        raObj.demo_purpose2__c = '试用(无询价)';
        insert raObj;
 
        Rental_Apply_Equipment_Set__c raesObjC1 = new Rental_Apply_Equipment_Set__c();
        raesObjC1.Rental_Apply__c = raObj.Id;
        //raesObjC1.Fixture_Set__c = fsObjC1.Id;
        raesObjC1.Cancel_Select__c = false;
        raesObjC1.Shipment_request_time__c = Date.toDay();
        raesObjC1.Rental_Start_Date__c = Date.toDay();
        raesObjC1.Rental_End_Date__c = Date.toDay();
        raesObjC1.IndexFromUniqueKey__c = 1;
        //raesObjC1.UniqueKey__c = '1:'+ fsObjC1.Id + ':1';
        insert raesObjC1;
 
        OPDPlan__c oPDPlan0Clone = new OPDPlan__c();
        oPDPlan0Clone = oPDPlan0.clone();
        oPDPlan0Clone.Id = null;
        oPDPlan0Clone.RentalReson__c = '追加配套';
        oPDPlan0Clone.OriginalOpdPlanApplication__c = oPDPlan0.Id;
        insert oPDPlan0Clone;
 
        Rental_Apply__c raObjClone = new Rental_Apply__c();
        raObjClone = raObj.clone();
        raObjClone.Id  = null;
        raObjClone.OPDPlan__c = oPDPlan0Clone.Id;
        insert raObjClone;
 
        Rental_Apply_Equipment_Set__c raesObjC2 = new Rental_Apply_Equipment_Set__c();
        raesObjC2.Rental_Apply__c = raObjClone.Id;
        //raesObjC1.Fixture_Set__c = fsObjC1.Id;
        raesObjC2.Cancel_Select__c = false;
        raesObjC2.Shipment_request_time__c = Date.toDay();
        raesObjC2.Rental_Start_Date__c = Date.toDay();
        raesObjC2.Rental_End_Date__c = Date.toDay();
        raesObjC2.IndexFromUniqueKey__c = 1;
        //raesObjC1.UniqueKey__c = '1:'+ fsObjC1.Id + ':1';
        insert raesObjC2;
 
        Rental_Apply_Equipment_Set__c raesObjC3 = new Rental_Apply_Equipment_Set__c();
        raesObjC3.Rental_Apply__c = raObjClone.Id;
        //raesObjC1.Fixture_Set__c = fsObjC1.Id;
        raesObjC3.Cancel_Select__c = false;
        raesObjC3.Shipment_request_time__c = Date.toDay();
        raesObjC3.Rental_Start_Date__c = Date.toDay();
        raesObjC3.Rental_End_Date__c = Date.toDay();
        raesObjC3.IndexFromUniqueKey__c = 2;
        //raesObjC1.UniqueKey__c = '1:'+ fsObjC1.Id + ':1';
        insert raesObjC3;
 
 
        ////新增时触发验证规则
        //OPDPlan__c oPDPlan0Clone2 = new OPDPlan__c();
        //oPDPlan0Clone2 = oPDPlan0.clone();
        //oPDPlan0Clone2.Id = null;
        //oPDPlan0Clone2.RentalReson__c = '追加配套';
        //oPDPlan0Clone2.OriginalOpdPlanApplication__c = oPDPlan0.Id;
        //insert oPDPlan0Clone2;
        //Rental_Apply__c raObjClone2 = new Rental_Apply__c();
        //raObjClone2 = raObj.clone();
        //raObjClone2.Id  = null;
        //raObjClone2.Phone_number__c ='0522';
        //raObjClone2.OPDPlan__c = oPDPlan0Clone2.Id;
        //insert raObjClone2;
 
        //raObjClone.Phone_number__c = '000000';
        //update raObjClone;
 
        Test.startTest();
        //OpdPlanWebService.insertRentalApply(raObj.Id, oPDPlan0Clone.Id);
        Test.stopTest();
    }
}