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
@isTest
private class LexRepairCloneButtonControllerTest {
 
    @testSetup
    static void setupTestData(){
    }
    
    @isTest
    static void tesMethod1(){
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
        Account myAccount1 = new Account(name='Testaccount001-1',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '8888888',GI_Main__c = '00510000001rcZh');
        insert myAccount1;
        Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
        insert prod07;
        Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false);
        insert prod01;
       
    
        String ReRecordTypeId = Schema.SObjectType.Repair__c.getRecordTypeInfosByDeveloperName().get('Repair').getRecordTypeId();
        System.debug(ReRecordTypeId);
        String AsRecordTypeId = Schema.SObjectType.Asset.getRecordTypeInfosByDeveloperName().get('HPAsset').getRecordTypeId();
        System.debug(AsRecordTypeId);
    
        Asset ass = new Asset();
        ass.Hospital__c = myAccount1.Id;
        // ass.Hospital__c = '0011000000VAVA5';
        ass.RecordTypeId = AsRecordTypeId;
        ass.Product2Id = prod07.Id;
        // ass.AccountId = '0011000000VAVA5';
        ass.AccountId = myAccount1.Id;
        ass.Asset_Owner__c = '医院资产';
        ass.Name = 'Test';
        ass.SerialNumber = '1234567';
        insert ass;
    
        Repair__c rep = new Repair__c();
        rep.Delivered_Product__c = ass.Id;
        rep.Hospital__c = myAccount1.Id;
        rep.SalesOfficeCode_selection__c = '北京';
        rep.SalesOfficeCode_selection__c = 'RC修理';
        rep.work_location_select__c = '北京办事处';
        rep.Repair_Detail__c = 'Test';
        rep.RecordTypeId = ReRecordTypeId;
        rep.Agreed_Date__c = System.today();
        rep.Status__c = '0.删除';
        insert rep;
 
        // List<Repair__c> rep2 = [SELECT Id FROM Repair__c WHERE Status__c = '0.删除' LIMIT 1];
        LexRepairCloneButtonController.checkStatus(rep.Id);
        // List<Repair__c> rep1 = [SELECT Id FROM Repair__c WHERE Status__c != '0.删除' LIMIT 1];
        LexRepairCloneButtonController.checkStatus(rep.Id);
        // LexRepairCloneButtonController.LexRepairCloneButtonController();
        LexRepairCloneButtonController repController= new LexRepairCloneButtonController();
    }
 
 
}