高章伟
2022-02-18 8b5f4c6c281cfa548f92de52c8021e37aa81901e
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
@isTest
private class NotReceivingNoteListFirstControllerTest {
    static testMethod void testMethod1() {
        //创建收货清单
        Date td = Date.today();
        ReceivingNote__c rn = new ReceivingNote__c();
        rn.Internal_asset_location__c = '上海 张江';
        rn.Asset_loaner_category__c = '固定资产';
        rn.Name = 'ZZ-153PA-0000813';
        rn.Status__c = '待数据确认';
        rn.DateOfDelivery__c = td+7;
        rn.OrderCode__c = 'SHRC-SP-20044-02';
        rn.Sales_order_number__c = '1000109900';
        rn.ApprovalNumber__c = 'ME153P07-0301';
        rn.ContactPerson__c = 'username';
        insert rn;
        //收货清单一览
        ReceivingNoteSummary__c rns = new ReceivingNoteSummary__c();
        rns.ReceivingNote__c = rn.Id;
        insert rns;
 
        // 收货一览明细
        ReceivingNoteDetail__c rnd1 = new ReceivingNoteDetail__c();
        rnd1.ReceivingNoteSummary__c = rns.Id;
        rnd1.Is_Body__c = true;
        rnd1.SerialNumber__c = '12';
 
        insert new ReceivingNoteDetail__c[] {rnd1};
 
        PageReference ref = new PageReference('/apex/NotReceivingNoteListFirst');
        Test.setCurrentPage(ref);
 
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
        if (rectCo.size() == 0) {
              return;
        }
 
        Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999960');
        insert myAccount1;
 
        NotReceivingNoteListFirstController controller = new NotReceivingNoteListFirstController();
        CreateRelationListPagingCmpCtrl cmp = new CreateRelationListPagingCmpCtrl();
        cmp.pageController = controller;
        controller.myComponentController.init();
 
        controller.init();
        controller.getAsset_loaner_categoryOps();
        controller.getRNStatusOpss();
        controller.beiPinCunfangDi = '上海';
        controller.contactPerson = 'user';
        // controller.dateOfDelivery = td.format();
        controller.salesOrderNumber = '10001099';
        controller.orderCode = 'SHRC';
        controller.approvalNumber = 'ME153P07';
        controller.searchOpp();
 
        System.assertEquals(1, controller.viewList.size());
 
        controller.viewList[0].check = true;
        controller.save();
 
    }
}