@isTest
public class SBG027TriggerHandleTest {
    static String  setdata(){
        //add by sushanhu 20220415 start
        TestDataUtility.CreatePIPolicyConfiguration('SBG027');
         //add by sushanhu 20220415 end
        Id pricebookId = Test.getStandardPricebookId();
        Pricebook2 pricebook = new Pricebook2(
            Name = 'IE',
            ProductSegment__c = 'IE',
            TradeType__c = 'Taxation',
            SalesChannel__c = 'direct',
            MachineParts__c = 'Machine',
            isActive = true
        );
        insert pricebook;
        Product2 product1 = new Product2();
        product1.Name = 'product1';
        Product2 product2 = new Product2();
        product2.Name = 'product2';
        Product2 product3 = new Product2();
        product3.Name = 'product3';
        insert new Product2[] {product1,product2,product3};
        PricebookEntry standardPrice1 = new PricebookEntry(
            Pricebook2Id = pricebookId,
            Product2Id = product1.Id,
            UnitPrice = 0,
            IsActive = true,
            CurrencyIsoCode = 'CNY'
        );
        PricebookEntry standardPrice2 = new PricebookEntry(
            Pricebook2Id = pricebookId,
            Product2Id = product2.Id,
            UnitPrice = 0,
            IsActive = true,
            CurrencyIsoCode = 'CNY'
        );
        PricebookEntry standardPrice3 = new PricebookEntry(
            Pricebook2Id = pricebookId,
            Product2Id = product3.Id,
            UnitPrice = 0,
            IsActive = true,
            CurrencyIsoCode = 'CNY'
        );
        insert new PricebookEntry[] {standardPrice1,standardPrice2,standardPrice3};
        PricebookEntry entry1 = new PricebookEntry( Pricebook2Id=pricebook.Id, Product2Id=product1.Id);
        entry1.UnitPrice = 0;
        entry1.IsActive = true;
        entry1.UseStandardPrice = false;
        entry1.CurrencyIsoCode = 'CNY';
        PricebookEntry entry2 = new PricebookEntry( Pricebook2Id=pricebook.Id, Product2Id=product2.Id);
        entry2.UnitPrice = 0;
        entry2.IsActive = true;
        entry2.UseStandardPrice = false;
        entry2.CurrencyIsoCode = 'CNY';
        PricebookEntry entry3 = new PricebookEntry( Pricebook2Id=pricebook.Id, Product2Id=product3.Id);
        entry3.UnitPrice = 0;
        entry3.IsActive = true;
        entry3.UseStandardPrice = false;
        entry3.CurrencyIsoCode = 'CNY';
        insert new PricebookEntry[] {entry1,entry2,entry3};
        List<RecordType> rectIE = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Customer BS'];
        Account accIE = new Account(
            Name = '*',
            RecordTypeId = rectIE[0].Id,
            OwnerId = UserInfo.getUserId(),
            DivisionName__c='Customer IE',
            FacilityName__c='abc',
            PostCode__c = '123456',
            DummyDealer__c = true
        );
        insert accIE; 
         List<RecordType> rectDealer = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Dealer'];
    //    List<RecordType> rectIE = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Customer BS'];

        Account buyer = new Account(
            Name = '*',
            FacilityName__c = 'buyer',
            PostCode__c = '123456',
            RecordTypeId = rectDealer[0].Id,
            ProductSegment__c = 'BS',
            DummyDealer__c = true
        );

        Contact con = new Contact();
        con.LastName = 'test';
        con.AccountId = accIE.Id;
        con.MobilePhone = 'MobilePhoneD__c';
        con.OtherPhone = 'OtherPhoneD__c';
        con.Fax = 'FaxD__c';
        con.Email = 'EmailD__c@test.com';
        con.Phone = 'PhoneD__c';
        con.Title = 'TitleD__c';
        con.Address1__c = 'Address1D__c';
        con.Address2__c = 'Address2D__c';
        con.Address3__c = 'Address3D__c';
        con.Postcode__c = '100111';
        con.ContactStatus__c = 'ContactStatusD__c';
        con.CancelReason__c = 'CancelReasonD__c';
        con.StatusD__c = 'Pass';

        insert con;
        Date day1 = Date.today();
        List<RecordType> rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity'];
        // 有预定下单日
        Opportunity opp = new Opportunity();
        opp.Name = 'test opp';
        opp.AccountId = accIE.Id;
        opp.Dealer__c = buyer.Id;
        opp.RecordTypeId = rectOpp[0].Id;
        opp.OwnerId = UserInfo.getUserId();
        opp.StageName = 'Phase3';//修改为Prospect Created 原来是Phase3
        opp.CurrencyIsoCode = 'CNY';
        opp.ProductSegment__c = 'IE';
        opp.CloseDate = Date.today();
        opp.NewInquiryDate__c = Date.today().addDays(-2);
        opp.ExpectedOrderDate__c = Date.today().addDays(2);
        opp.ApprovalStatus_D__c = 'Pass';
        opp.LeadSource = 'LeadSource_D__c';
        opp.BudgetAmount__c = 111;
        opp.CancelReasonText__c = 'Cancel_Reason_Text_D__c';
        opp.CancelReason__c = 'Cancel_reason_D__c';
        opp.CompetitorCompany__c = 'Competitor_Company_D__c';
        opp.Competitor_Product__c = 'Competitor_Product_D__c';
        opp.Competitor_Product2__c = 'Competitor_Product2_D__c';
        opp.Competitor_Product3__c = 'Competitor_Product3_D__c';
        opp.Competitor_Product4__c = 'Competitor_Product4_D__c';
        opp.Competitor_Product5__c = 'Competitor_Product5_D__c';
        opp.Competitor_Product6__c = 'Competitor_Product6_D__c';
        opp.Competitor_Product7__c = 'Competitor_Product7_D__c';
        opp.Competitor_Product8__c = 'Competitor_Product8_D__c';
        opp.CompetitorProductCode__c = 'Competitor_Product_Code_D__c';
        opp.CompetitorProductCode2__c = 'Competitor_Product_Code2_D__c';
        opp.CompetitorProductCode3__c = 'Competitor_Product_Code3_D__c';
        opp.CompetitorProductCode4__c = 'Competitor_Product_Code4_D__c';
        opp.CompetitorProductCode5__c = 'Competitor_Product_Code5_D__c';
        opp.CompetitorProductCode6__c = 'Competitor_Product_Code6_D__c';
        opp.CompetitorProductCode7__c = 'Competitor_Product_Code7_D__c';
        opp.CompetitorProductCode8__c = 'Competitor_Product_Code8_D__c';
        opp.DealerSalesStaffName__c = 'Dealer_Sales_Staff_Name_D__c';
        opp.DealerService__c = 'Dealer_Service_D__c';
        opp.ExpectedDeliveryDate__c = day1;
        opp.InquiryResult__c = 'InquiryResultD__c';
        //opp.InquiryResultCancel__c = day1;
        //opp.InquiryResultLost__c = day1;
        opp.InquiryResultOrder__c = day1;
        opp.LostAmount__c = 111;
        opp.LostCompetitorProduct__c = 'Lost_competitor_product_D__c';
        opp.LostReasonText__c = 'LostReasonText_D__c';
        opp.LostReason__c = 'Lostreason_D__c';
        opp.Phase1Date__c = day1;
        opp.Phase2Date__c = day1;
        opp.Phase3Date__c = day1;
        opp.SalesChannel__c = 'Sales_Channel_D__c';
        //opp.SalesChannel__c = 'direct';
        //opp.Machine_Parts__c = 'Parts';

        opp.SubDealer__c = 'Sub_Dealer_D__c';
        opp.TradeType__c = 'Trade_Type_D__c';
        //opp.Pricebook2Id = pricebook.Id;

        insert opp;

        OpportunityContactRole role = new OpportunityContactRole(
            Role  = 'End user',
            IsPrimary = true,
            OpportunityId = opp.Id,
            ContactId = con.Id
            );
        insert role;
         Quote quo = new Quote(
            Name = 'quo',
            OpportunityId = opp.Id,
            //Pricebook2Id = pricebook.Id,
            SetName1__c = 'setname1',
            SetQty1__c = 1,
            SetName2__c = 'setname2',
            SetQty2__c = 2,
            Custom_Price_Total_Text__c = 1000
            //IsSyncing = true
        );
        insert quo;

        opp.SyncedQuoteId = quo.Id;
        update opp;

        List<productSet__c>  insertproductSets = new  List<productSet__c>();
        productSet__c proSet1 = new productSet__c();
        proSet1.Code__c = 'IXP-7P2';
        proSet1.Name = 'IXP-7P2';
        proSet1.IsValid__c = true;
        proSet1.Name = 'IXP-7P2';
        insertproductSets.add(proSet1);
        productSet__c proSet2 = new productSet__c();
        proSet2.Code__c = 'IXP-7P1SC';
        proSet2.Name = 'IXP-7P1SC';
        proSet2.IsValid__c = true;
        proSet2.Name = 'IXP-7P1SC';
        insertproductSets.add(proSet2);
        productSet__c proSet3 = new productSet__c();
        proSet3.Code__c = 'IXSP-T7LED';
        proSet3.Name = 'IXSP-T7LED';
        proSet3.IsValid__c = true;
        proSet3.Name = 'IXSP-T7LED';
        insertproductSets.add(proSet3);


        insert insertproductSets;


        List<RecordType> rectOrder = [select id from RecordType where IsActive = true and SobjectType = 'Order'];
        Order odr = new Order(
            Name = '',
            Status = 'Draft',
            AccountId = accIE.Id,
            ApproveStatus__c = 'Draft',
            OpportunityId = opp.Id,
            EffectiveDate = Date.today(),
            RecordTypeId = '01228000000NJt6',
            confirm__c = false,
            SP_21__c = true,
            Discount_D__c = 10,
            EndUser__c = con.Id,
            EndUserD__c = con.Id
        );
        insert odr;

        DecideQuoteProductSet__c dqps = new DecideQuoteProductSet__c();

        dqps.DecideProductSet__c = proSet1.Id ;
        dqps.DecideProductSetCount__c = 4;
        dqps.DecideOpportunity__c = opp.Id;
        dqps.DecideQuote__c = quo.Id;
        dqps.DecideOrder__c = odr.Id;

        insert dqps;
        Delivery__c de1 = new Delivery__c();
        de1.SSBD_Contract__c = odr.Id;
        insert de1;
        Opportunity ordd = [Select InquiryNumber__c,Id,Name From Opportunity];
        return ordd.InquiryNumber__c;
    }


    @isTest static void test_method_1() {
        setdata();
        Order o = [Select Id,Name From Order];
        o.confirm__c = true;
        o.CrossCooperativeProject__c = true;
        o.SplitRatio__c = '5 : 5';
        update o;
    }

    @isTest static void test_execute2() {

        BatchIF_Log__c iflog = new BatchIF_Log__c();
        iflog.Log__c = '{"GeDatas":{"Monitoring":{"TransmissionDateTime":"202108250938","Text":"","Tag":"MSGH","Sender":"8405","Receiver":"1330","NumberOfRecord":"1","MessageType":"SBG027","MessageGroupNumber":"20210000465499"},"GeData":[{"ZNMPA":"N","TradeType":"Taxation","SpecialWarranty":null,"SpecialDeliveryAddress":"3000002093,C-2018-72066","ServiceFee":null,"SalesChannel":"41","SalesAccountCode":"76002795","PurposeOfAdvice":null,"ProductSegment":"BS","PaymentCondition":"ZZTT","Other3":"null,null","Other2":"跨省份合作项目","Other1":"test,dealer","OrderCode":"00050193","OpportunityCode":"O-2021-115172","OlympusPriceBeforeDiscount":null,"OlympusContractPrices":729412.00,"MachineParts":"Machine","GeDataDetails":[{"ItemQuantity":20,"ItemCode":"000000000006498300","DetailLine":10},{"ItemQuantity":20,"ItemCode":"N2664900","DetailLine":20}],"ForeignTradeCompany":null,"EndUser":"C-2016-25119","Discount":49.00,"DeliveryDate":"20210825","DealerSalesStaffName":"a","DealerCode":"3000002093","CoopAgentPCT":"50","CoopAgent":"A-2021-120990"}]}}';
        insert iflog;
        SBG027Controller.execute2(iflog.Id);
    }

//     @isTest static void test_init1() {
//         Id pricebookId = Test.getStandardPricebookId();

//         Pricebook2 pricebook = new Pricebook2(
//             Name = 'IE',
//             ProductSegment__c = 'IE',
//             TradeType__c = 'Taxation',
//             SalesChannel__c = 'direct',
//             MachineParts__c = 'Machine',
//             isActive = true
//         );
//         insert pricebook;

//         Product2 product1 = new Product2();
//         product1.Name = 'product1';
//         product1.ProductCode = 'product1';
//         product1.Product_ECCode__c = 'product1';
//         product1.IsActive = true;

//         Product2 product2 = new Product2();
//         product2.Name = 'product2';
//         product2.ProductCode = 'product2';
//         product2.Product_ECCode__c = 'product2';
//         product2.IsActive = true;

//         Product2 product3 = new Product2();
//         product3.Name = 'product3';
//         product3.ProductCode = 'product3';
//         product3.Product_ECCode__c = 'product3';
//         product3.IsActive = true;

//         insert new Product2[] {product1, product2, product3};

//         PricebookEntry standardPrice1 = new PricebookEntry(
//             Pricebook2Id = pricebookId,
//             Product2Id = product1.Id,
//             UnitPrice = 0,
//             IsActive = true,
//             CurrencyIsoCode = 'CNY'
//         );

//         PricebookEntry standardPrice2 = new PricebookEntry(
//             Pricebook2Id = pricebookId,
//             Product2Id = product2.Id,
//             UnitPrice = 0,
//             IsActive = true,
//             CurrencyIsoCode = 'CNY'
//         );

//         PricebookEntry standardPrice3 = new PricebookEntry(
//             Pricebook2Id = pricebookId,
//             Product2Id = product3.Id,
//             UnitPrice = 0,
//             IsActive = true,
//             CurrencyIsoCode = 'CNY'
//         );

//         insert new PricebookEntry[] {standardPrice1, standardPrice2, standardPrice3};

//         PricebookEntry entry1 = new PricebookEntry(
//             Pricebook2Id = pricebook.Id,
//             Product2Id = product1.Id,
//             UnitPrice = 30,
//             IsActive = true,
//             UseStandardPrice = false,
//             CurrencyIsoCode = 'CNY'
//         );

//         PricebookEntry entry2 = new PricebookEntry(
//             Pricebook2Id = pricebook.Id,
//             Product2Id = product2.Id,
//             UnitPrice = 30,
//             IsActive = true,
//             UseStandardPrice = false,
//             CurrencyIsoCode = 'CNY'
//         );

//         PricebookEntry entry3 = new PricebookEntry(
//             Pricebook2Id = pricebook.Id,
//             Product2Id = product3.Id,
//             UnitPrice = 30,
//             IsActive = true,
//             UseStandardPrice = false,
//             CurrencyIsoCode = 'CNY'
//         );

//         insert new PricebookEntry[] {entry1, entry2, entry3};

//         List<RecordType> rectIE = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Customer BS'];
//         Account user = new Account(
//             Name = '*',
//             FacilityName__c = 'user',
//             PostCode__c = '123456',
//             RecordTypeId = rectIE[0].Id
//         );
//         insert user;

//         Contact con = new Contact();
//         con.LastName = 'test';
//         con.AccountId = user.Id;
//         con.MobilePhone = 'MobilePhoneD__c';
//         con.OtherPhone = 'OtherPhoneD__c';
//         con.Fax = 'FaxD__c';
//         con.Email = 'EmailD__c@test.com';
//         con.Phone = 'PhoneD__c';
//         con.Title = 'TitleD__c';
//         con.Address1__c = 'Address1D__c';
//         con.Address2__c = 'Address2D__c';
//         con.Address3__c = 'Address3D__c';
//         con.Postcode__c = '100111';
//         con.ContactStatus__c = 'ContactStatusD__c';
//         con.CancelReason__c = 'CancelReasonD__c';
//         con.StatusD__c = 'Pass';

//         insert con;

//         Opportunity opp = new Opportunity(
//             Name = 'test opp',
//             AccountId = user.Id,
//             StageName = 'Phase3',
//             CurrencyIsoCode = 'CNY',
//             ProductSegment__c = 'IE',
//             CloseDate = Date.today(),
//             NewInquiryDate__c = Date.today().addDays(-2),
//             ExpectedOrderDate__c = Date.today().addDays(2),
//             TradeType__c = 'Taxation',
//             SalesChannel__c = 'direct',
//             Machine_Parts__c = 'Machine',
//             Pricebook2Id = pricebook.Id
//         );
//         insert opp;

//         OpportunityContactRole role = new OpportunityContactRole(
//             Role  = 'End user',
//             IsPrimary = true,
//             OpportunityId = opp.Id,
//             ContactId = con.Id
//             );
//         insert role;

//         OpportunityLineItem oli1 = new OpportunityLineItem(
//             OpportunityId = opp.Id,
//             PricebookEntryId = entry1.Id,
//             Quantity = 1,
//             UnitPrice = 30
//         );

//         OpportunityLineItem oli2 = new OpportunityLineItem(
//             OpportunityId = opp.Id,
//             PricebookEntryId = entry2.Id,
//             Quantity = 2,
//             UnitPrice = 30
//         );

//         OpportunityLineItem oli3 = new OpportunityLineItem(
//             OpportunityId = opp.Id,
//             PricebookEntryId = entry3.Id,
//             Quantity = 3,
//             UnitPrice = 30
//         );
//              System.Test.StartTest();
//         insert new OpportunityLineItem[] {oli1, oli2, oli3};

//         PageReference page = new PageReference('/apex/NewQuoteService?oppid=' + opp.Id + '&openType=service');
//         System.Test.setCurrentPage(page);
//         NewQuoteEntryController controller = new NewQuoteEntryController();

//         controller.init();

//         controller.quo.Name = '报价1';
//         controller.quo.PaymentTerms__c = 'Z0LC';
//         controller.quo.Shipment_Term__c = 'CIP';
//         controller.quo.Shipment_Term2__c = 'BEIJING';
//         controller.quo.DeliveryLeadTime__c = 90;
//         controller.quo.Warranty__c = 1;
//         controller.quo.ExpirationDate = Date.today();
//         controller.quo.Custom_Price_Total_Text__c = 1000;

// /*        controller.activities[0].pageObject.PricebookEntryId = entry1.Id;
//         controller.activities[0].pageObject.Set__c = 'set01';
//         controller.activities[0].pageObject.UnitPrice = 11;
//         controller.activities[0].pageObject.Quantity = 1
//         controller.activities[0].pageObject.Discount = 0;
//         controller.activities[0].pageObject.Custom_Price__c = 20;
//         controller.activities[0].pageObject.Description = 'test1';*/
        
//         controller.Save();

//         //system.assertEquals('',controller.errormessage);

//         // controller.excelImport();

//         // controller.OppReflection();

//         // controller.BackBtn();
       
//         controller.Decide();
//         List<Quote> QuoteList = [select Id from Quote]; 
//         // Quote quo = QuoteList[0];
//         // quo.PaymentTerms__c = 'Z9TT';
//         // update quo;
//         Order order = new Order(
//             Name = 'order',
//             CurrencyIsoCode = 'CNY',
//             AccountId = user.Id,
//             OpportunityId = opp.Id,
//             QuoteId = QuoteList[0].Id, //quo.Id,
//             EffectiveDate = Date.today(),
//             Status = 'Draft',
//             Pricebook2Id = pricebook.Id,
//             EndUser__c = con.Id
//         );
//         insert order;

//         order.confirm__c = true;
//         update order;

//         //controller.UnDecide();
//         System.Test.StopTest();
//     }

    //    //产品配套相关
    //@isTest static void test_init5() {
    //    Id pricebookId = Test.getStandardPricebookId();

    //    Pricebook2 pricebook = new Pricebook2(
    //        Name = 'IE',
    //        ProductSegment__c = 'IE',
    //        TradeType__c = 'Taxation',
    //        SalesChannel__c = 'direct',
    //        MachineParts__c = 'Machine',
    //        isActive = true
    //    );
    //    insert pricebook;

    //    Product2 product1 = new Product2();
    //    product1.Name = 'product1';
    //    product1.ProductCode = 'product1';
    //    product1.Product_ECCode__c = 'product1';
    //    product1.ProductModels__c = true;
    //    product1.ProductStatus__c = '1';
    //    insert product1;

    //    PricebookEntry standardPrice1 = new PricebookEntry(
    //        Pricebook2Id = pricebookId,
    //        Product2Id = product1.Id,
    //        UnitPrice = 0,
    //        IsActive = true,
    //        CurrencyIsoCode = 'CNY'
    //    );
    //    insert standardPrice1;

    //    PricebookEntry entry1 = new PricebookEntry(Pricebook2Id = pricebook.Id, Product2Id = product1.Id);
    //    entry1.UnitPrice = 0;
    //    entry1.IsActive = true;
    //    entry1.UseStandardPrice = false;
    //    entry1.CurrencyIsoCode = 'CNY';
    //    insert entry1;

    //    Product_Search__c ps = new Product_Search__c(Product__c = product1.Id);

    //    List<RecordType> rectIE = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Customer BS'];
    //    Account user = new Account(
    //        Name = '*',
    //        FacilityName__c = 'user',
    //        PostCode__c = '123456',
    //        RecordTypeId = rectIE[0].Id
    //    );
    //    insert user;

    //    Opportunity opp = new Opportunity(
    //        Name = 'test opp',
    //        AccountId = user.Id,
    //        StageName = 'Prospect Created',
    //        CurrencyIsoCode = 'CNY',
    //        ProductSegment__c = 'BS',
    //        CloseDate = Date.today(),
    //        NewInquiryDate__c = Date.today().addDays(-2),
    //        ExpectedOrderDate__c = Date.today().addDays(2),
    //        TradeType__c = 'Taxation',
    //        SalesChannel__c = 'direct',
    //        Machine_Parts__c = 'Machine',
    //        Pricebook2Id = pricebook.Id
    //    );
    //    insert opp;
    //     Quote quo = new Quote(
    //        Name = 'quo',
    //        OpportunityId = opp.Id,
    //        SetName1__c = 'IXP-7P2',
    //        SetQty1__c = 1,
    //        Is_Decided__c = true
    //    );
    //    insert quo;
    //    List<productSet__c>  insertproductSets = new  List<productSet__c>();
    //    productSet__c proSet1 = new productSet__c();
    //    proSet1.Code__c = 'IXP-7P2';
    //    proSet1.Name = 'IXP-7P2';
    //    proSet1.IsValid__c = true;
    //    proSet1.Name = 'IXP-7P2';
    //    insertproductSets.add(proSet1);
    //    productSet__c proSet2 = new productSet__c();
    //    proSet2.Code__c = 'IXP-7P1SC';
    //    proSet2.Name = 'IXP-7P1SC';
    //    proSet2.IsValid__c = true;
    //    proSet2.Name = 'IXP-7P1SC';
    //    insertproductSets.add(proSet2);
    //    productSet__c proSet3 = new productSet__c();
    //    proSet3.Code__c = 'IXSP-T7LED';
    //    proSet3.Name = 'IXSP-T7LED';
    //    proSet3.IsValid__c = true;
    //    proSet3.Name = 'IXSP-T7LED';
    //    insertproductSets.add(proSet3);


    //    insert insertproductSets;

    //    productSetItem__c  productSetItem = new productSetItem__c();
    //    productSetItem.productSet__c = proSet1.Id;
    //    productSetItem.Count__c = 5;
    //    productSetItem.product__c = product1.Id;
    //    insert productSetItem ;
    //    PageReference page = new PageReference('/apex/NewQuoteEntry?id=' + quo.Id );
    //    System.Test.setCurrentPage(page);
    //    NewQuoteEntryController controller = new NewQuoteEntryController();
    //    Map<String,String> productSetCodeMap = new Map<String,String>();
    //    productSetCodeMap.put('IXP-7P1SC', '3;49');
    //    //productSetCodeMap.put('111111111', '3;49');
    //    controller.init();
    //    controller.setProduct_text = proSet1.Id+',1,49;'+proSet2.Id +',2,49;';
    //    controller.setProductEntry();
    //    controller.acquireProductSetId(productSetCodeMap);
    //    controller.Save();
    //    //controller.decideORundecideQuote(quo.Id,true);
    //    controller.Decide();

    //    List<QuoteLineItem> quoteLineItemList = [select id from QuoteLineItem];
                                         
    //    system.assertEquals(11111,quoteLineItemList.size());
    //    Order order = new Order(
    //        Name = 'order',
    //        CurrencyIsoCode = 'CNY',
    //        AccountId = user.Id,
    //        OpportunityId = opp.Id,
    //        QuoteId = quo.Id,
    //        EffectiveDate = Date.today(),
    //        Status = 'Draft',
    //        Pricebook2Id = pricebook.Id
    //    );

    //    insert order;
    //    List<Order> orderList = [select Id,ProductSegment__c from Order];
    //    //system.assertEquals('Bss',orderList[0].ProductSegment__c);
    //    List<OrderItem> ordLiList = 
    //                                    [select Id, Quantity, PricebookEntry.ProductCode,QuoteLineItem.SingleProduct__c,
    //                                        ODISingleProduct__c,Order.ProductSegment__c from  OrderItem ];
    //    system.assertEquals(11111,ordLiList.size());   
    //    order.confirm__c = true;
    //    update order;

    //}
}