付煜
2022-03-25 8ea597d3c67631cd702415d43bc3d2961f6bc94d
force-app/main/default/classes/SI_NewQuoteEntryControllerTest.cls
@@ -1440,4 +1440,103 @@
            System.Test.stopTest();
        }
    }
    static testMethod void dataEntryTest2() {
        RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType = 'Account' and Name = :RC_BYOUIN limit 1];
        Account hospital = new Account(Name = 'テスト病院');
        hospital.RecordTypeId = recByoin.id;
        hospital.Site = 'テスト病院部門';
        hospital.Alias_Name2__c = 'テスト病院別名';
        insert hospital;
        RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType = 'Account' and Name = :RC_HANBAOITEN limit 1];
        Account sellerA = new Account(Name = '販売店');
        sellerA.RecordTypeId = recHanbaiten.id;
        sellerA.Hospital__c = hospital.id;
        insert sellerA;
        Product2 product2 = new Product2( Name = '11112');
        product2.SFDA_Status__c = '不要';
        product2.Intra_Trade_List_RMB_1__c = 100;
        product2.Intra_Trade_List_RMB_Date1__c = date.today();
        product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
        product2.Intra_Trade_Cost_RMB_1__c = 200;
        product2.Intra_Trade_Cost_RMB_Date1__c = date.today();
        product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
        product2.Manual_Entry__c = false;
        product2.Asset_Model_No__c = '11112';
        product2.MDM_Model_No__c = '11112';
        insert product2;
        PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);
        pE2.UnitPrice = 0;
        pE2.IsActive = true;
        pE2.UseStandardPrice = false;
        pE2.CurrencyIsoCode = CurrencyIso;
        insert pE2;
        Opportunity opp1 = buildOppInstance( trade, CurrencyIso);
        opp1.Trade__c = trade;
        opp1.owner_not_automatically_update__c = true;
        opp1.Sales_Root__c = 'AAA';
        opp1.Pricebook2Id = pricebook.id;
        opp1.Estimation_Decision__c=true;
        insert opp1;
        OpportunityLineItem oli = new OpportunityLineItem();
        oli.Quantity = 1;
        oli.UnitPrice = 10;
        oli.PricebookEntryId = pE2.Id;
        oli.OpportunityId = opp1.id;
        oli.Cost__c = 100;
        insert oli;
        SI_NewQuoteEntryController.QELine act = new SI_NewQuoteEntryController.QELine(oli, 0);
        act.Asset_Model = '';
        act.pageObject.Quantity__c = 10;
        act.pageObject.UnitPrice = 100;
        act.pageObject.Subtotal__c = 1000;
        act.pageObject.PricebookEntryId = pE2.id;
        List<SI_NewQuoteEntryController.QELine> actList = new List<SI_NewQuoteEntryController.QELine>();
        actList.add(act);
        SI_NewQuoteEntryController controller = new SI_NewQuoteEntryController();
        controller.oppId=opp1.Id;
        controller.enableSales=true;
        Quote quote=new Quote();
        quote.QuoteName__c = 'テスト見積';
        quote.Dealer_Final_Price_Page__c = 100;
        quote.Quote_Adjust_Amount_Page__c = 10;
        quote.Quote_Expiration_Date__c = date.today();
        quote.Agency1__c = sellerA.id;
        quote.OCM_Agent1_Price_Page__c = 1243;
        quote.OpportunityId = opp1.id;
        quote.Name ='テスト見積';
        quote.Pricebook2Id = pricebook.id;
        quote.Quote_No__c = quoteNo;
        insert quote;
        system.debug('act2++++++++++'+pE2);
        QuoteLineItem item02 = new QuoteLineItem();
        item02.Name__c = 'テスト商品';
        item02.QuoteId = quote.Id;
        item02.Quantity = 1;
        item02.Cost_Subtotal__c = 0;
        item02.Cost__c = 200;
        item02.UnitPrice = 10;
        item02.PricebookEntryId = pE2.Id;
        insert item02;
        // quote.QuoteName__c = 'テスト見積';
        // quote.QuoteName__c = 'テスト見積';
        controller.quo=quote;
        SI_NewQuoteEntryController.QuoteBean qbs=new SI_NewQuoteEntryController.QuoteBean();
        qbs.Quote_Adjust_Calculate = 100;
        controller.qb = qbs;
        controller.rowIdx=1;
        controller.activities=actList;
        controller.opp=opp1;
        controller.addMultipleRow();
        SI_NewQuoteEntryController.QELine actList12 = new SI_NewQuoteEntryController.QELine(10,true,'aaa',Date.today(),'bbb',pE2.Id,'ddd','eee','fff','ggg','hhh','iii','jjj','kkk',10,1.1,2.2,3.3,4.0,5.5,6.6,'lll',7.7,8.8);
        system.debug('xxxxxxxxxxxxxxxxxxxxxxxx++++++++++++++++++++++++');
    }
}