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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
@isTest
private class TenderDeleteLwcControllerTest {
    static testMethod void testMethod1() {
        ControllerUtil.EscapeNFM001Trigger = true;
        StaticParameter.EscapeNFM001Trigger = true;
        StaticParameter.EscapeNFM001AgencyContractTrigger = true;
        StaticParameter.EscapeNFM001AgencyContractTrigger2 = true;
        StaticParameter.EscapeOppandStaTrigger = true;
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院' Limit 1];
        if (rectCo.size() == 0) {
            return;
        }
        List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 呼吸科' Limit 1];
        if (rectSct.size() == 0) {
            return;
        }
        List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '診療科 消化科' Limit 1];
        if (rectDpt.size() == 0) {
            return;
        }
 
        //List<Tender_information__c> TenInfo = [Select Id, InfoId__c, Logical_delete__c, ProjectId__c, Retain_Tender__c From Tender_information__c Where id = : 'a4J1m0000009Tv5'];
        List<RecordType> rectDpts = [select Id from RecordType where IsActive = true and SobjectType = 'Tender_information__c' and Name = '手工录入' Limit 1];
        if (rectDpts.size() == 0) {
            return;
        }
        Tender_information__c TenInfo = new Tender_information__c();
        Tender_information__c TenInfo1 = new Tender_information__c();
        TenInfo1.Name = 'QLMTEST08111057-02';
        TenInfo1.RecordTypeId=rectDpts[0].Id;
        TenInfo1.InfoTitle__c = '招标项目1';
        TenInfo1.subInfoType__c='1-1:意见征集'; // 20221018 ljh SWAG-CKB9NR add
        insert TenInfo1;
 
        TenInfo.Name = '2345';
        TenInfo.InfoId__c = '1234';
        TenInfo.Retain_Tender__c = TenInfo1.Id;
        TenInfo.RecordTypeId=rectDpts[0].Id;
        TenInfo.InfoTitle__c = '招标项目2';
        TenInfo.TenderManageCode__c ='123';
        TenInfo.subInfoType__c='1-1:意见征集'; // 20221018 ljh SWAG-CKB9NR add
        insert TenInfo;
 
        //List<Tender_Opportunity_Link__c> BlinksList = [select Opportunity__c from Tender_Opportunity_Link__c where Tender_information__c = :BTen.Id];
        Account company = new Account();
        company.RecordTypeId = rectCo[0].Id;
        company.Name         = 'NFM007TestCompany';
        upsert company;
        Account section = new Account();
        section.RecordTypeId = rectSct[0].Id;
        section.Name         = '*';
        section.Department_Class_Label__c = '消化科';
        section.ParentId                  = company.Id;
        section.Hospital_Department_Class__c = company.Id;
        upsert section;
        Account depart = new Account();
        depart.RecordTypeId = rectDpt[0].Id;
        depart.Name         = '*';
        depart.Department_Name__c  = 'NFM007TestDepart';
        depart.ParentId            = section.Id;
        depart.Department_Class__c = section.Id;
        depart.Hospital__c         = company.Id;
        upsert depart;
 
        Opportunity opp = new Opportunity();
        opp.AccountId           = depart.Id;
        opp.Department_Class__c = section.Id;
        opp.Hospital__c         = company.Id;
        opp.SAP_Send_OK__c      = false;
        opp.Name                = 'GZ-SP-NFM007_1';
        opp.Trade__c            = '内貿';
        opp.StageName           = '引合';
        opp.CloseDate           = date.newinstance(2025, 11, 30);
        opp.Stock_apply_status__c = '申请中';
        opp.Whether_Bidding__c = '否';
        insert opp;
 
        Tender_Opportunity_Link__c BlinksList = new Tender_Opportunity_Link__c();
        BlinksList.Opportunity__c = opp.Id;
        BlinksList.CurrencyIsoCode = 'CNY';
        BlinksList.Tender_information__c = TenInfo1.Id;
        // insert BlinksList;
 
        Tender_Opportunity_Link__c linksList = new Tender_Opportunity_Link__c();
        linksList.Opportunity__c = opp.Id;
        linksList.CurrencyIsoCode = 'CNY';
        linksList.Tender_information__c = TenInfo.Id;
        insert linksList;
 
        Tender_Opportunity_Link__c addlinksList = new Tender_Opportunity_Link__c();
        addlinksList.Opportunity__c = opp.Id;
        addlinksList.CurrencyIsoCode = 'CNY';
        addlinksList.Tender_information__c = TenInfo1.Id;
        // insert addlinksList;
        //Tender_information__c BTen = [select Id, InfoId__c From Tender_information__c Where Id = : TenInfo.Retain_Tender__c];
        Tender_information__c BTen = new Tender_information__c();
        BTen.InfoId__c = '1122';
 
        TenInfo.Retain_Tender__c = BTen.Id;
        String BTenInfo = BTen.InfoId__c;
        BTen.InfoId__c = TenInfo.InfoId__c;
        TenInfo.InfoId__c = BTenInfo;
        TenInfo.Logical_delete__c = true;
        List<Tender_information__c> updateTenInfoList = new List<Tender_information__c>();
        updateTenInfoList.add(TenInfo);
        updateTenInfoList.add(BTen);
 
        //Apexpages.currentPage().getParameters().put('id', TenInfo.Id);
        PageReference peg = new PageReference('/apex/TenderDeletePage?id=' + TenInfo.Id);
        System.Test.setCurrentPage(peg);
        // TenderDeleteLwcController tenderDeleteController = new TenderDeleteLwcController();
        System.Test.StartTest();
        String test =TenderDeleteLwcController.GetTenderinformationcData(TenInfo.Id);
        // Id,Name,InfoId__c,Logical_delete__c,ProjectId__c,Retain_Tender__c
        system.debug('test+++'+test);
        List<Tender_information__c> TenInfos=(List<Tender_information__c>)JSON.deserializeStrict(test,List<Tender_information__c>.class);
        test =JSON.serialize(TenInfos[0]);
        TenderDeleteLwcController.searchTender(TenInfo1.TenderManageCode__c);
        TenderDeleteLwcController.saveData(test);
        System.Test.StopTest();
    }
}