liuyn
2024-03-11 a87f1c3df03078814ee97ad0c8ac200a232419e9
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
@isTest
private class SortUpdateOpp2BatchTest {
 
    static testMethod void Method01() {
        StaticParameter.EscapeOppandStaTrigger = true;
 
        opp2AuxiliarySort__c oas1 = new opp2AuxiliarySort__c();
        oas1.Name = '1.华北';
        oas1.type__c = 2;
        insert oas1;
 
        Opportunity opp1 = new Opportunity();
        opp1.Name = 'aiueo';
        opp1.StageName = '引合';
        opp1.Trade__c = '内貿';
        opp1.SAP_Send_OK__c = false;
        opp1.Wholesale_Price__c = 101;
        opp1.Tax_Intra_F_Copy__c = 1;
        opp1.Opportunity_Category__c = 'GI';
        opp1.OCM_man_province_cus_txt__c = '北京';
        opp1.CloseDate = Date.today();
        insert opp1;
 
        Opportunity2__c o2pp1 = new Opportunity2__c();
        o2pp1.Opportunity__c = opp1.Id;
        insert o2pp1;
    
        List<String> str = new List<String>();
        str.add('1.华北');
        Database.executeBatch(new SortUpdateOpp2Batch(str),1);
    }
 
    static testMethod void Method02() {
        StaticParameter.EscapeOppandStaTrigger = true;
 
        opp2AuxiliarySort__c oas2 = new opp2AuxiliarySort__c();
        oas2.Name = '全国';
        oas2.type__c = 3;
        insert oas2;
 
        Opportunity opp2 = new Opportunity();
        opp2.Name = 'aiueo';
        opp2.StageName = '引合';
        opp2.Trade__c = '内貿';
        opp2.SAP_Send_OK__c = false;
        opp2.Wholesale_Price__c = 101;
        opp2.Tax_Intra_F_Copy__c = 1;
        opp2.Opportunity_Category__c = 'OTH';
        opp2.OCM_man_province_cus_txt__c = '北京';
        opp2.CloseDate = Date.today();
        insert opp2;
 
        Opportunity2__c o2pp2 = new Opportunity2__c();
        o2pp2.Opportunity__c = opp2.Id;
        insert o2pp2;
 
        Database.executeBatch(new SortUpdateOpp2Batch(),1);
    }
 
    static testMethod void Method03() {
        StaticParameter.EscapeOppandStaTrigger = true;
 
        opp2AuxiliarySort__c oas2 = new opp2AuxiliarySort__c();
        oas2.Name = '全国';
        oas2.type__c = 1;
        insert oas2;
 
        Opportunity opp2 = new Opportunity();
        opp2.Name = 'aiueo';
        opp2.StageName = '引合';
        opp2.Trade__c = '内貿';
        opp2.SAP_Send_OK__c = false;
        opp2.Wholesale_Price__c = 101;
        opp2.Tax_Intra_F_Copy__c = 1;
        opp2.Opportunity_Category__c = 'OTH';
        opp2.OCM_man_province_cus_txt__c = '北京';
        opp2.CloseDate = Date.today();
        insert opp2;
 
        Opportunity2__c o2pp2 = new Opportunity2__c();
        o2pp2.Opportunity__c = opp2.Id;
        insert o2pp2;
 
        Database.executeBatch(new SortUpdateOpp2Batch(),1);
    }
}