@isTest
public class lexNewQuoteEntryControllerTest {
    static final String RC_BYOUIN = '病院';
    static final String RC_HANBAOITEN = '販売店';
    static final String RC_KEIYAKU = '契約';
    private static String quoteNo = 'textQutote01';
    public static String CurrencyIso = 'CNY';
    private static Boolean isUnitPrice = true;
    private static Boolean isOfferAmount = true;
    private static Boolean isTotalPrice = true;
    private static Boolean isDiscountRate = true;
    private static Boolean isDiscountAmount = true;
    private static Boolean isTradingPrice = true;
    private static Boolean isContractDetail = true;

    private static Date offerExpireDate = Date.today();
    private static String clientName = 'test client';
    private static String offerComment = 'test comment';
    private static Date offerPrintDate = Date.today();
    private static String agentName = 'test agent name';
    @isTest
    static void Test1(){
        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;
        sellerA.Tax_Practice_No__c = '001';
        sellerA.Sales_Shop_Class__c = '特約販売店（区域）';
        sellerA.Business_Authorization_No__c = '001';
        sellerA.Tax_Practice_Expiration_Date__c =  Date.today().addDays(20);
        sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
        insert sellerA;
        
        RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
        Account contractA = new Account(Name = '*');
        contractA.RecordTypeId = recKeiyaku.id;
        contractA.Agent_Ref__c = sellerA.id;
        contractA.ParentId = sellerA.id;
        insert contractA;
        StaticParameter.EscapeOppandStaTrigger = true;
        Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
        opp.Trade__c = '内貿';
        //opp.CurrencyIsoCode = CurrencyIso;
        opp.Sales_Root__c = '販売店';
        opp.StageName = '引合';
        opp.Fixed_Check__c = false;
        opp.owner_not_automatically_update__c = true;
        //opp.Pricebook2Id = pricebook.id;
        opp.Purchase_Type__c = '一般引合';
        opp.Promise_Class__c = '外貿';
        opp.Fund_Basis__c = '政府資金';
        opp.AccountId = contractA.id;
        opp.Hospital__c = contractA.id;
        opp.Agency1__c = sellerA.id;
        opp.Wholesale_Price__c = 9000;
        opp.Opportunity_stage__c = '还没申请预算';
        opp.Close_Forecasted_Date__c = Date.today().addDays(50);
        opp.Special_Opp_lanhai__c = false;
        opp.CurrencyIsoCode = 'CNY';
        insert opp;
        Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss();
        lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
        User us =  lexNewQuoteEntryController.selecUser();
        Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
        String oppvalue = JSON.serialize(opp1);
        lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue);
        Product2 product1 = new Product2( Name = '11111');
            product1.SFDA_Status__c = '不要';
            product1.Intra_Trade_List_RMB_1__c = 100;
            product1.Intra_Trade_List_RMB_Date1__c = date.today();
            product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
            product1.Intra_Trade_Cost_RMB_1__c = 200;
            product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
            product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
            product1.Manual_Entry__c = false;
            product1.Asset_Model_No__c = '11111';
            product1.MDM_Model_No__c = '11111';
            product1.ProductCode = 'OTV-SP1H-NA-12E';
            insert product1;
            system.debug('##product.Id=[' + product1.Id + ']' );

            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;
            system.debug('##product1.Id=[' + product1.Id + ']' );
            system.debug('##product2.Id=[' + product2.Id + ']' );

            Pricebook2 pricebook = ControllerUtil.getStandardPricebook();

            PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);

            pE.UnitPrice = 0;
            pE.IsActive = true;
            pE.UseStandardPrice = false;
            pE.CurrencyIsoCode = CurrencyIso;
            //pE.
            insert pE;

            PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);

            pE2.UnitPrice = 0;
            pE2.IsActive = true;
            pE2.UseStandardPrice = false;
            pE2.CurrencyIsoCode = CurrencyIso;
            //pE.
            insert pE2;
        List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('','','');
        PageReference page = new PageReference('/apex/lexNewQuoteEntry');
        System.Test.setCurrentPage(page);
        Apexpages.currentPage().getParameters().put('oppid', opp.id);
        String CheckItemCan = null;
        Boolean SkipQuotefilgc = false;
        boolean WinOrDecideAlertc = false;
        String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H170L:电子大肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H170L:电子大肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170系列","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H170L:电子大肠内窥镜","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170系列","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"有效","Name__c":"CF-H170L:电子大肠内窥镜","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H190I:电子结肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"市场","warrantyType__c":"市场多年保修","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H190I:电子结肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"市场","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190系列","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H190I:电子结肠内窥镜","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"市场","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190系列","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"市场多年保修","NoDiscountTotal__c":31000,"SFDA_Status__c":"有效","Name__c":"CF-H190I:电子结肠内窥镜","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]';
        Boolean changedAfterPrintc = false;
        boolean enableSalesc = true;
        boolean newQuoteFlagc = false;
        String oppIdc = opp.Id;
        String oppInfoc = JSON.serialize(opp);
        boolean productStatusUpdatedc = false;
        String quoIdc = '';
        String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
        Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
        quos.Agency1__c = sellerA.id;
        quoc = JSON.serialize(quos);
        String quoteGurantee_Periodc = null;
        Boolean quoteflg = false;
        String quotemultiYearWarrantyc = null;
        String selection_hpc = '杭州市丁桥医院';
        lexNewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
        oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
        quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg,'');
        quoteflg = true;
        lexNewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
        oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
        quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg,'');
        lexNewQuoteEntryController.selectOppLItem(oppIdc);
        lexNewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
        oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
        quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,'');
        StaticParameter.EscapeOppandStaTrigger = false;
        lexNewQuoteEntryController.setOppFromOppInfo();
    }
    @isTest
    static void Test2(){
        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;
        sellerA.Tax_Practice_No__c = '001';
        sellerA.Sales_Shop_Class__c = '特約販売店（区域）';
        sellerA.Business_Authorization_No__c = '001';
        sellerA.Tax_Practice_Expiration_Date__c =  Date.today().addDays(20);
        sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
        insert sellerA;
        
        RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
        Account contractA = new Account(Name = '*');
        contractA.RecordTypeId = recKeiyaku.id;
        contractA.Agent_Ref__c = sellerA.id;
        contractA.Hospital__c=hospital.id;
        contractA.ParentId = sellerA.id;
        insert contractA;
        StaticParameter.EscapeOppandStaTrigger = true;
        Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
        opp.Trade__c = '内貿';
        //opp.CurrencyIsoCode = CurrencyIso;
        opp.Sales_Root__c = '販売店';
        opp.StageName = '引合';
        opp.Fixed_Check__c = false;
        opp.owner_not_automatically_update__c = true;
        //opp.Pricebook2Id = pricebook.id;
        opp.Purchase_Type__c = '一般引合';
        opp.Promise_Class__c = '外貿';
        opp.Fund_Basis__c = '政府資金';
        opp.AccountId = contractA.id;
        opp.Hospital__c = contractA.id;
        opp.Agency1__c = sellerA.id;
        opp.Wholesale_Price__c = 9000;
        opp.Opportunity_stage__c = '还没申请预算';
        opp.Close_Forecasted_Date__c = Date.today().addDays(50);
        opp.Special_Opp_lanhai__c = false;
        insert opp;
        Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss();
        lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
        User us =  lexNewQuoteEntryController.selecUser();
        Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
        String oppvalue = JSON.serialize(opp1);
        lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue);
        Product2 product1 = new Product2( Name = '11111');
            product1.SFDA_Status__c = '不要';
            product1.Intra_Trade_List_RMB_1__c = 100;
            product1.Intra_Trade_List_RMB_Date1__c = date.today();
            product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
            product1.Intra_Trade_Cost_RMB_1__c = 200;
            product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
            product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
            product1.Manual_Entry__c = false;
            product1.Asset_Model_No__c = '11111';
            product1.MDM_Model_No__c = '11111';
            product1.ProductCode = 'OTV-SP1H-NA-12E';
            insert product1;
            system.debug('##product.Id=[' + product1.Id + ']' );

            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;
            system.debug('##product1.Id=[' + product1.Id + ']' );
            system.debug('##product2.Id=[' + product2.Id + ']' );

            Pricebook2 pricebook = ControllerUtil.getStandardPricebook();

            PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);

            pE.UnitPrice = 0;
            pE.IsActive = true;
            pE.UseStandardPrice = false;
            pE.CurrencyIsoCode = CurrencyIso;
            //pE.
            insert pE;

            PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);

            pE2.UnitPrice = 0;
            pE2.IsActive = true;
            pE2.UseStandardPrice = false;
            pE2.CurrencyIsoCode = CurrencyIso;
            //pE.
            insert pE2;
            Product_Set__c ps1 = new Product_Set__c();
            ps1.Name = 'セット品１';
            ps1.Product_Set_CD__c = '111111';
            ps1.Description__c = '説明';
            ps1.Qty__c = 10;
            //ps1.Valid__c = true;
            ps1.Valid_Date__c = date.today().addDays(-5);
            insert ps1;

            Product_Set_Detail__c psd1 = new Product_Set_Detail__c();
            psd1.Product_Set__c = ps1.id;
            psd1.Price__c = 100;
            psd1.Quantity__c = 10;
            psd1.Product__c = product1.id;

            insert psd1;
        List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('12','121','122');
        // PageReference page = new PageReference('/apex/lexNewQuoteEntry');
        // System.Test.setCurrentPage(page);
        Apexpages.currentPage().getParameters().put('oppid', opp.id);
        List<Product_Set__c> pstc = lexNewQuoteEntryController.serSetContact('品','1','');
        String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H170L:电子大肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H170L:电子大肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170系列","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H170L:电子大肠内窥镜","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170系列","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"有效","Name__c":"CF-H170L:电子大肠内窥镜","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H190I:电子结肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"市场","warrantyType__c":"市场多年保修","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H190I:电子结肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"市场","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190系列","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H190I:电子结肠内窥镜","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"市场","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190系列","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"市场多年保修","NoDiscountTotal__c":31000,"SFDA_Status__c":"有效","Name__c":"CF-H190I:电子结肠内窥镜","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]';
        String oppInfoc = JSON.serialize(opp);
        String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
        Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
        quos.Agency1__c = sellerA.id;
        quoc = JSON.serialize(quos);
        String setProduct_text = ps1.Id;
        String setprd = lexNewQuoteEntryController.setProductEntry(setProduct_text,activitiesCan,oppInfoc,quoc);
        String excel_text = product1.ProductCode+'\t1\n'+product2.ProductCode+'\t1';
        String eximt = lexNewQuoteEntryController.excelImport(excel_text,activitiesCan,oppInfoc,quoc);
        StaticParameter.EscapeOppandStaTrigger = false;
    }
    private static Id pricebookId = ControllerUtil.getStandardPricebook().Id;

    static testMethod void Test3(){
        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;
        // 产品
        Product2 prd1 = new Product2();
            prd1.ProductCode_Ext__c     = 'Prd1';
            prd1.ProductCode            = 'Prd1';
            prd1.Repair_Product_Code__c = 'Prd1_RP';
            prd1.Name                   = 'Prd1';
            prd1.Manual_Entry__c        = false;
            prd1.Category2__c = '本体';
            prd1.Category3__c = '纤维镜';
            prd1.Category4__c = 'CV';
            prd1.Category5__c = '260SL系列';
            prd1.Asset_Model_No__c = '1001';
            prd1.Important_product__c = true;
            prd1.Important_Rroduct_1GI__c = true;
            insert prd1;

        PricebookEntry entry = new PricebookEntry(Pricebook2Id = pricebookId, Product2Id = prd1.Id);
            entry.UnitPrice = 0;
            entry.IsActive = true;
            entry.UseStandardPrice = false;
            entry.CurrencyIsoCode = 'CNY';
            insert entry;

            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;
            sellerA.Tax_Practice_No__c = '001';
            sellerA.Sales_Shop_Class__c = '特約販売店（区域）';
            sellerA.Business_Authorization_No__c = '001';
            sellerA.Tax_Practice_Expiration_Date__c =  Date.today().addDays(20);
            sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
            insert sellerA;

            RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
            Account contractA = new Account(Name = '*');
            contractA.RecordTypeId = recKeiyaku.id;
            contractA.Agent_Ref__c = sellerA.id;
            contractA.Hospital__c=hospital.id;
            contractA.ParentId = sellerA.id;
            insert contractA;
            lexNewQuoteEntryController.selectAccountById(contractA.Id);
            StaticParameter.EscapeOppandStaTrigger = true;
            Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
            opp.Trade__c = '外貿';
            //opp.CurrencyIsoCode = CurrencyIso;
            opp.Sales_Root__c = '販売店';
            opp.StageName = '引合';
            opp.Fixed_Check__c = false;
            opp.owner_not_automatically_update__c = true;
            //opp.Pricebook2Id = pricebook.id;
            opp.Purchase_Type__c = '一般引合';
            opp.Promise_Class__c = '外貿';
            opp.Fund_Basis__c = '政府資金';
            opp.AccountId = contractA.id;
            opp.Hospital__c = contractA.id;
            opp.Agency1__c = sellerA.id;
            opp.Wholesale_Price__c = 9000;
            opp.Opportunity_stage__c = '还没申请预算';
            opp.Close_Forecasted_Date__c = Date.today().addDays(50);
            opp.Special_Opp_lanhai__c = false;
            opp.CurrencyIsoCode = 'CNY';
            insert opp;

        
            String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":null,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":true,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":true,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":null,"OCM_Agent1_Price_Page__c":0,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
            
            Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
            quos.Agency1__c = sellerA.id;
            quos.OpportunityId = opp.Id;
            quos.Pricebook2Id = pricebookId;
            quos.Opportunity.RecordType.Id=recKeiyaku.Id;
            // 删除ID属性
            // 执行插入操作
            insert quos;

            Map<String,String> result = new Map<String,String>();
            lexNewQuoteEntryController.changedAfterPrint=true;
            lexNewQuoteEntryController.newQuoteFlag=true;
            // lexNewQuoteEntryController.dataEntry();
            lexNewQuoteEntryController.qname=true;
            lexNewQuoteEntryController.dfpp=true;
            lexNewQuoteEntryController.qacc=true;
            lexNewQuoteEntryController.qaapc=true;
            lexNewQuoteEntryController.Agency1=true;
            lexNewQuoteEntryController.nAgency1=true;
            lexNewQuoteEntryController.oapp=true;
            lexNewQuoteEntryController.noapp=true;
            lexNewQuoteEntryController.Agency2=true;
            lexNewQuoteEntryController.nAgency2=true;
            lexNewQuoteEntryController.aapp=true;
            lexNewQuoteEntryController.naapp=true;
            lexNewQuoteEntryController.resultFlag(result);
            lexNewQuoteEntryController.selectQuoteById(quos.Id);

            // 报价行项目   
            QuoteLineItem target = new QuoteLineItem();
            target.Name__c = 'テスト商品';
            target.QuoteId = quos.id;
            target.Quantity = 1;
            target.Cost_Subtotal__c = 0;
            target.Cost__c = 200;
            target.Item_Order__c  = 3;
            target.UnitPrice = 10;
            target.Product2Id = prd1.id;
            target.PricebookEntryId = entry.Id;
            insert target;

            
            
            

            lexNewQuoteEntryController.selectQuoteLineItem(quos.Id,opp.Id);
            lexNewQuoteEntryController.selectQuoteListLineItemCount(String.valueOf(quos.Id),String.valueOf(opp.Id),'');
            lexNewQuoteEntryController.selectQuoteListLineItemCount(String.valueOf(quos.Id),'','');
            lexNewQuoteEntryController.getPicklistValues('Quote','QuotationChange__c',true);
            String CheckItemCan = null;
            Boolean SkipQuotefilgc = false;
            boolean WinOrDecideAlertc = false;
            String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H170L:电子大肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H170L:电子大肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170系列","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H170L:电子大肠内窥镜","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170系列","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"有效","Name__c":"CF-H170L:电子大肠内窥镜","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H190I:电子结肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"市场","warrantyType__c":"市场多年保修","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H190I:电子结肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"市场","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190系列","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H190I:电子结肠内窥镜","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"市场","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190系列","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"市场多年保修","NoDiscountTotal__c":31000,"SFDA_Status__c":"有效","Name__c":"CF-H190I:电子结肠内窥镜","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]';
            Boolean changedAfterPrintc = false;
            boolean enableSalesc = true;
            boolean newQuoteFlagc = true;
            String oppIdc = opp.Id;
            String oppInfoc = JSON.serialize(opp);
            boolean productStatusUpdatedc = false;
            String quoIdc = '';
            String quoteGurantee_Periodc = null;
            String quotemultiYearWarrantyc = null;
            String selection_hpc = '杭州市丁桥医院';
            Boolean quoteflg = true;
            prd1.Category5__c = '虚拟';
            update prd1;
            lexNewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
        oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
        quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg,'');
        lexNewQuoteEntryController.print( activitiesCan,CheckItemCan ,WinOrDecideAlertc,productStatusUpdatedc,oppInfoc,enableSalesc,quoc,'',quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,false,'');
        quoIdc = quos.Id;
        oppIdc = null;
        oppInfoc = JSON.serialize(opp);
        lexNewQuoteEntryController.print( activitiesCan,CheckItemCan ,WinOrDecideAlertc,productStatusUpdatedc,oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,false,'');
        Product_Set__c ps1 = new Product_Set__c();
            ps1.Name = 'セット品１';
            ps1.Product_Set_CD__c = '111111';
            ps1.Description__c = '説明';
            ps1.Qty__c = 10;
            //ps1.Valid__c = true;
            ps1.Valid_Date__c = date.today().addDays(-5);
            insert ps1;
            String setProduct_text = ps1.Id;
            String setprd = lexNewQuoteEntryController.setProductEntry(setProduct_text,activitiesCan,oppInfoc,quoc);
    }
    @isTest
    static void Test4(){
        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;
        sellerA.Tax_Practice_No__c = '001';
        sellerA.Sales_Shop_Class__c = '特約販売店（区域）';
        sellerA.Business_Authorization_No__c = '001';
        sellerA.Tax_Practice_Expiration_Date__c =  Date.today().addDays(20);
        sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
        insert sellerA;
        
        RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
        Account contractA = new Account(Name = '*');
        contractA.RecordTypeId = recKeiyaku.id;
        contractA.Agent_Ref__c = sellerA.id;
        contractA.ParentId = sellerA.id;
        insert contractA;
        StaticParameter.EscapeOppandStaTrigger = true;
        Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
        opp.Trade__c = '外貿';
        //opp.CurrencyIsoCode = CurrencyIso;
        opp.Sales_Root__c = '販売店';
        opp.StageName = '引合';
        opp.Fixed_Check__c = false;
        opp.owner_not_automatically_update__c = true;
        //opp.Pricebook2Id = pricebook.id;
        opp.Purchase_Type__c = '一般引合';
        opp.Promise_Class__c = '外貿';
        opp.Fund_Basis__c = '政府資金';
        opp.AccountId = contractA.id;
        opp.Hospital__c = contractA.id;
        opp.Agency1__c = sellerA.id;
        opp.Wholesale_Price__c = 9000;
        opp.Opportunity_stage__c = '还没申请预算';
        opp.Close_Forecasted_Date__c = Date.today().addDays(50);
        opp.Special_Opp_lanhai__c = false;
        opp.CurrencyIsoCode = 'USD';
        opp.Is_Corrosion__c = false;
        opp.Purchase_Type__c = 'ET24時間販売';
        opp.SAP_Province__c='上海市';
        insert opp;
        Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss();
        lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
        User us =  lexNewQuoteEntryController.selecUser();
        Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
        String oppvalue = JSON.serialize(opp1);
        lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue);
        Product2 product1 = new Product2( Name = '11111');
            product1.SFDA_Status__c = '不要';
            product1.Intra_Trade_List_RMB_1__c = 100;
            product1.Intra_Trade_List_RMB_Date1__c = date.today();
            product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
            product1.Intra_Trade_Cost_RMB_1__c = 200;
            product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
            product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
            product1.Manual_Entry__c = false;
            product1.Asset_Model_No__c = '11111';
            product1.MDM_Model_No__c = '11111';
            product1.ProductCode = 'OTV-SP1H-NA-12E';
            insert product1;
            system.debug('##product.Id=[' + product1.Id + ']' );

            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;
            system.debug('##product1.Id=[' + product1.Id + ']' );
            system.debug('##product2.Id=[' + product2.Id + ']' );

            Pricebook2 pricebook = ControllerUtil.getStandardPricebook();

            PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);

            pE.UnitPrice = 0;
            pE.IsActive = true;
            pE.UseStandardPrice = false;
            pE.CurrencyIsoCode = CurrencyIso;
            //pE.
            insert pE;

            PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);

            pE2.UnitPrice = 0;
            pE2.IsActive = true;
            pE2.UseStandardPrice = false;
            pE2.CurrencyIsoCode = CurrencyIso;
            //pE.
            insert pE2;
        List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('','','');
        PageReference page = new PageReference('/apex/lexNewQuoteEntry');
        System.Test.setCurrentPage(page);
        Apexpages.currentPage().getParameters().put('oppid', opp.id);
        String CheckItemCan = null;
        Boolean SkipQuotefilgc = false;
        boolean WinOrDecideAlertc = false;
        String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H170L:电子大肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H170L:电子大肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170系列","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H170L:电子大肠内窥镜","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170系列","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"有效","Name__c":"CF-H170L:电子大肠内窥镜","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H190I:电子结肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"市场","warrantyType__c":"市场多年保修","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H190I:电子结肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"市场","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190系列","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H190I:电子结肠内窥镜","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"市场","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190系列","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"市场多年保修","NoDiscountTotal__c":31000,"SFDA_Status__c":"有效","Name__c":"CF-H190I:电子结肠内窥镜","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]';
        Boolean changedAfterPrintc = false;
        boolean enableSalesc = true;
        boolean newQuoteFlagc = false;
        String oppIdc = opp.Id;
        String oppInfoc = JSON.serialize(opp);
        boolean productStatusUpdatedc = false;
        String quoIdc = '';
        String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
        Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
        quos.Agency1__c = sellerA.id;
        quoc = JSON.serialize(quos);
        String quoteGurantee_Periodc = null;
        Boolean quoteflg = false;
        String quotemultiYearWarrantyc = null;
        String selection_hpc = '杭州市丁桥医院';
        lexNewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
        oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
        quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg,'');
        quoteflg = true;
        lexNewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
        oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
        quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg,'');
        lexNewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
        oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
        quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,'');
        newQuoteFlagc = false;
        lexNewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
        oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
        quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg,'');
        StaticParameter.EscapeOppandStaTrigger = false;
        lexNewQuoteEntryController.setOppFromOppInfo();
    }

    static testMethod void Test5(){
        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;
        // 产品
        Product2 prd1 = new Product2();
            prd1.ProductCode_Ext__c     = 'Prd1';
            prd1.ProductCode            = 'Prd1';
            prd1.Repair_Product_Code__c = 'Prd1_RP';
            prd1.Name                   = 'Prd1';
            prd1.Manual_Entry__c        = false;
            prd1.Category2__c = '本体';
            prd1.Category3__c = '纤维镜';
            prd1.Category4__c = 'CV';
            prd1.Category5__c = '260SL系列';
            prd1.Asset_Model_No__c = '1001';
            prd1.Important_product__c = true;
            prd1.Important_Rroduct_1GI__c = true;
            insert prd1;

            

            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;
            sellerA.Tax_Practice_No__c = '001';
            sellerA.Sales_Shop_Class__c = '特約販売店（区域）';
            sellerA.Business_Authorization_No__c = '001';
            sellerA.Tax_Practice_Expiration_Date__c =  Date.today().addDays(20);
            sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
            insert sellerA;

            RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
            Account contractA = new Account(Name = '*');
            contractA.RecordTypeId = recKeiyaku.id;
            contractA.Agent_Ref__c = sellerA.id;
            contractA.Hospital__c=hospital.id;
            contractA.ParentId = sellerA.id;
            insert contractA;
            lexNewQuoteEntryController.selectAccountById(contractA.Id);
            StaticParameter.EscapeOppandStaTrigger = true;
            Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
            opp.Trade__c = '内貿';
            //opp.CurrencyIsoCode = CurrencyIso;
            opp.Sales_Root__c = '販売店';
            opp.StageName = '引合';
            opp.Fixed_Check__c = false;
            opp.owner_not_automatically_update__c = true;
            //opp.Pricebook2Id = pricebook.id;
            opp.Purchase_Type__c = 'ET24時間販売';
            opp.Promise_Class__c = '内貿';
            opp.Fund_Basis__c = '政府資金';
            opp.AccountId = contractA.id;
            opp.Hospital__c = contractA.id;
            opp.Agency1__c = sellerA.id;
            opp.Wholesale_Price__c = 9000;
            opp.Opportunity_stage__c = '还没申请预算';
            opp.Close_Forecasted_Date__c = Date.today().addDays(50);
            opp.Special_Opp_lanhai__c = false;
            opp.CurrencyIsoCode = 'CNY'; 
            opp.Is_Corrosion__c=true;
            opp.SAP_Province__c='上海市';
            insert opp;
            List<Product_Set__c> pstc = lexNewQuoteEntryController.serSetContact('品','1','');
            PricebookEntry entry = new PricebookEntry(Pricebook2Id = pricebookId, Product2Id = prd1.Id);
            entry.UnitPrice = 0;
            entry.IsActive = true;
            entry.UseStandardPrice = false;
            entry.CurrencyIsoCode = 'CNY';
            insert entry;
            String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
            Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
            quos.Agency1__c = sellerA.id;
            // 删除ID属性
            quos.Id = null;
            quos.OpportunityId = opp.Id;
            quos.Opportunity.RecordType.Id=recKeiyaku.Id;
            quos.Pricebook2Id = pricebookId;
            // 执行插入操作
            insert quos;
            
            lexNewQuoteEntryController.selectQuoteById(quos.Id);
            // 报价行项目   
            QuoteLineItem target = new QuoteLineItem();
            target.Name__c = 'テスト商品';
            target.QuoteId = quos.id;
            target.Quantity = 1;
            target.Cost_Subtotal__c = 0;
            target.Cost__c = 200;
            //        target.TotalPrice = 100;
            target.UnitPrice = 10;
            target.Product2Id = prd1.id;
            target.PricebookEntryId = entry.Id;
            target.Item_Order__c = 3;
            insert target;

            

            lexNewQuoteEntryController.selectQuoteLineItem(target.Id,opp.Id);
            lexNewQuoteEntryController.selectQuoteListLineItemCount(String.valueOf(quos.Id),String.valueOf(opp.Id),'');
            lexNewQuoteEntryController.selectQuoteListLineItemCount(String.valueOf(quos.Id),'','');
            lexNewQuoteEntryController.getPicklistValues('Quote','QuotationChange__c',false);
            String CheckItemCan = null;
            Boolean SkipQuotefilgc = false;
            boolean WinOrDecideAlertc = false;
            String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H170L:电子大肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H170L:电子大肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170系列","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H170L:电子大肠内窥镜","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170系列","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"有效","Name__c":"CF-H170L:电子大肠内窥镜","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H190I:电子结肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"市场","warrantyType__c":"市场多年保修","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H190I:电子结肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"市场","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190系列","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H190I:电子结肠内窥镜","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"市场","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190系列","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"市场多年保修","NoDiscountTotal__c":31000,"SFDA_Status__c":"有效","Name__c":"CF-H190I:电子结肠内窥镜","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]';
            Boolean changedAfterPrintc = false;
            boolean enableSalesc = true;
            boolean newQuoteFlagc = false;
            String oppIdc = opp.Id;
            String oppInfoc = JSON.serialize(opp);
            boolean productStatusUpdatedc = false;
            String quoIdc = quos.Id;
            quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":null,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":true,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":null,"OCM_Agent1_Price_Page__c":0,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
            quos = (Quote)JSON.deserialize(quoc,Quote.class);
            quos.Agency1__c = sellerA.id;
            // 删除ID属性
            quos.Id = null;
            quos.OpportunityId = opp.Id;
            quos.Pricebook2Id = pricebookId;
            // 执行插入操作
            String quoteGurantee_Periodc = null;
            String quotemultiYearWarrantyc = null;
            String selection_hpc = '杭州市丁桥医院';
            lexNewQuoteEntryController.print( activitiesCan,CheckItemCan ,WinOrDecideAlertc,productStatusUpdatedc,oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,true,'');
            lexNewQuoteEntryController.WinOrDecideAlert=true;
            lexNewQuoteEntryController.productStatusUpdated=false;
            
    }
   
    @isTest
    static void Test6(){
        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;
        sellerA.Tax_Practice_No__c = '001';
        sellerA.Sales_Shop_Class__c = '特約販売店（区域）';
        sellerA.Business_Authorization_No__c = '001';
        sellerA.Tax_Practice_Expiration_Date__c =  Date.today().addDays(20);
        sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
        insert sellerA;
        
        RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
        Account contractA = new Account(Name = '*');
        contractA.RecordTypeId = recKeiyaku.id;
        contractA.Agent_Ref__c = sellerA.id;
        contractA.Hospital__c=hospital.id;
        contractA.ParentId = sellerA.id;
        insert contractA;
        StaticParameter.EscapeOppandStaTrigger = true;
        Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
        opp.Trade__c = '内貿';
        //opp.CurrencyIsoCode = CurrencyIso;
        opp.Sales_Root__c = '販売店';
        opp.StageName = '引合';
        opp.Fixed_Check__c = false;
        opp.owner_not_automatically_update__c = true;
        //opp.Pricebook2Id = pricebook.id;
        opp.Purchase_Type__c = '一般引合';
        opp.Promise_Class__c = '外貿';
        opp.Fund_Basis__c = '政府資金';
        opp.AccountId = contractA.id;
        opp.Hospital__c = contractA.id;
        opp.Agency1__c = sellerA.id;
        opp.Wholesale_Price__c = 9000;
        opp.Opportunity_stage__c = '还没申请预算';
        opp.Close_Forecasted_Date__c = Date.today().addDays(50);
        opp.Special_Opp_lanhai__c = false;
        insert opp;
        Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss();
        lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
        User us =  lexNewQuoteEntryController.selecUser();
        Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
        String oppvalue = JSON.serialize(opp1);
        lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue);
        Product2 product1 = new Product2( Name = '11111');
            product1.SFDA_Status__c = '不要';
            product1.Intra_Trade_List_RMB_1__c = 100;
            product1.Intra_Trade_List_RMB_Date1__c = date.today();
            product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
            product1.Intra_Trade_Cost_RMB_1__c = 200;
            product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
            product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
            product1.Manual_Entry__c = false;
            product1.Asset_Model_No__c = '11111';
            product1.MDM_Model_No__c = '11111';
            product1.ProductCode = 'OTV-SP1H-NA-12E';
            insert product1;
            system.debug('##product.Id=[' + product1.Id + ']' );

            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;
            system.debug('##product1.Id=[' + product1.Id + ']' );
            system.debug('##product2.Id=[' + product2.Id + ']' );

            Pricebook2 pricebook = ControllerUtil.getStandardPricebook();

            PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);

            pE.UnitPrice = 0;
            pE.IsActive = true;
            pE.UseStandardPrice = false;
            pE.CurrencyIsoCode = CurrencyIso;
            //pE.
            insert pE;

            PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);

            pE2.UnitPrice = 0;
            pE2.IsActive = true;
            pE2.UseStandardPrice = false;
            pE2.CurrencyIsoCode = CurrencyIso;
            //pE.
            insert pE2;
            Product_Set__c ps1 = new Product_Set__c();
            ps1.Name = 'セット品１';
            ps1.Product_Set_CD__c = '111111';
            ps1.Description__c = '説明';
            ps1.Qty__c = 10;
            //ps1.Valid__c = true;
            ps1.Valid_Date__c = date.today().addDays(-5);
            insert ps1;

            Product_Set_Detail__c psd1 = new Product_Set_Detail__c();
            psd1.Product_Set__c = ps1.id;
            psd1.Price__c = 100;
            psd1.Quantity__c = 10;
            psd1.Product__c = product1.id;

            insert psd1;
        List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('12','121','122');
        // PageReference page = new PageReference('/apex/lexNewQuoteEntry');
        // System.Test.setCurrentPage(page);
        Apexpages.currentPage().getParameters().put('oppid', opp.id);
        List<Product_Set__c> pstc = lexNewQuoteEntryController.serSetContact('品','1','');
        String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H170L:电子大肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H170L:电子大肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170系列","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H170L:电子大肠内窥镜","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170系列","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"有效","Name__c":"CF-H170L:电子大肠内窥镜","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H190I:电子结肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"市场","warrantyType__c":"市场多年保修","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H190I:电子结肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"市场","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190系列","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H190I:电子结肠内窥镜","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"市场","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190系列","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"市场多年保修","NoDiscountTotal__c":31000,"SFDA_Status__c":"有效","Name__c":"CF-H190I:电子结肠内窥镜","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]';
        String oppInfoc = JSON.serialize(opp);
        String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
        Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
        quos.Agency1__c = sellerA.id;
        quoc = JSON.serialize(quos);
        String setProduct_text = ps1.Id;
        String setprd = lexNewQuoteEntryController.setProductEntry(setProduct_text,activitiesCan,oppInfoc,quoc);
        String excel_text = product1.ProductCode+'\t1\n'+product2.ProductCode+'\t1';
        String eximt = lexNewQuoteEntryController.excelImport(excel_text,activitiesCan,oppInfoc,quoc);
        StaticParameter.EscapeOppandStaTrigger = false;
    }
    @isTest
    static void Test7(){
        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;
        sellerA.Tax_Practice_No__c = '001';
        sellerA.Sales_Shop_Class__c = '特約販売店（区域）';
        sellerA.Business_Authorization_No__c = '001';
        sellerA.Tax_Practice_Expiration_Date__c =  Date.today().addDays(20);
        sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
        sellerA.Medical_Equipment_Expiration_Date__c = Date.today().addDays(20);
        sellerA.Medical_Equipment_Num__c = '有证';
        sellerA.Business_Authorization_No__c = '0001';
        sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
        insert sellerA;
        
        RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
        Account contractA = new Account(Name = '*');
        contractA.RecordTypeId = recKeiyaku.id;
        contractA.Agent_Ref__c = sellerA.id;
        contractA.ParentId = sellerA.id;
        insert contractA;
        StaticParameter.EscapeOppandStaTrigger = true;
        Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
        opp.Trade__c = '内貿';
        //opp.CurrencyIsoCode = CurrencyIso;
        opp.Sales_Root__c = '販売店';
        opp.StageName = '引合';
        opp.Fixed_Check__c = false;
        opp.owner_not_automatically_update__c = true;
        //opp.Pricebook2Id = pricebook.id;
        opp.Purchase_Type__c = '一般引合';
        opp.Promise_Class__c = '外貿';
        opp.Fund_Basis__c = '政府資金';
        opp.AccountId = contractA.id;
        opp.Hospital__c = contractA.id;
        opp.Agency1__c = sellerA.id;
        opp.Wholesale_Price__c = 9000;
        opp.Opportunity_stage__c = '还没申请预算';
        opp.Close_Forecasted_Date__c = Date.today().addDays(50);
        opp.Special_Opp_lanhai__c = false;
        opp.CurrencyIsoCode = 'CNY';
        opp.Stock_Confrim_Date__c = Date.today().addDays(50);
        insert opp;
        IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c();
        ISOhead.name = '*';
        ISOhead.Opportunity_ID__c = opp.id;
        ISOhead.Approval_Date__c = Date.today();
        ISOhead.Public_Hospital_TF__c = true;
        ISOhead.Preparation_Stage_TF__c = true;
        ISOhead.Data_Check_TF__c = true;
        ISOhead.Operating_Room_Plane_Graph_TF__c = true;
        ISOhead.Demonstration_Area_Plane_Graph_TF__c = true;
        insert ISOhead;
        Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss();
        lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
        User us =  lexNewQuoteEntryController.selecUser();
        Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
        String oppvalue = JSON.serialize(opp1);
        lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue);
        lexNewQuoteEntryController.getquoDes();
        
        Product2 product1 = new Product2( Name = '11111');
            product1.SFDA_Status__c = '暂停出库（短期）';
            product1.Intra_Trade_List_RMB_1__c = 100;
            product1.Intra_Trade_List_RMB_Date1__c = date.today();
            product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
            product1.Intra_Trade_Cost_RMB_1__c = 200;
            product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
            product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
            product1.Manual_Entry__c = false;
            product1.Asset_Model_No__c = '11111';
            product1.MDM_Model_No__c = '11111';
            product1.ProductCode = 'OTV-SP1H-NA-12E';
            insert product1;
            system.debug('##product.Id=[' + product1.Id + ']' );

            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;
            system.debug('##product1.Id=[' + product1.Id + ']' );
            system.debug('##product2.Id=[' + product2.Id + ']' );

            Pricebook2 pricebook = ControllerUtil.getStandardPricebook();

            PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);

            pE.UnitPrice = 0;
            pE.IsActive = true;
            pE.UseStandardPrice = false;
            pE.CurrencyIsoCode = CurrencyIso;
            //pE.
            insert pE;

            PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);

            pE2.UnitPrice = 0;
            pE2.IsActive = true;
            pE2.UseStandardPrice = false;
            pE2.CurrencyIsoCode = CurrencyIso;
            //pE.
            insert pE2;
        List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('','','');
        // PageReference page = new PageReference('/apex/lexNewQuoteEntry');
        // System.Test.setCurrentPage(page);
        Apexpages.currentPage().getParameters().put('oppid', opp.id);
        List<String> proList = new List<String>();
        proList.add(product1.Id);
        proList.add(product2.Id);
        String prostr = JSON.serialize(proList);
        Boolean SkipQuotefilgc = false;
        boolean WinOrDecideAlertc = false;
        String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"暂停出库（短期）","Product_Sales_Possibility__c":"○","Name__c":"CF-H170L:电子大肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"暂停出库（短期）","Sales_Possibility__c":"○","Name":"CF-H170L:电子大肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170系列","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H170L:电子大肠内窥镜","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170系列","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"有效","Name__c":"CF-H170L:电子大肠内窥镜","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"Id__c":null,"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H190I:电子结肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"市场","warrantyType__c":"市场多年保修","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H190I:电子结肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"市场","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190系列","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H190I:电子结肠内窥镜","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"市场","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190系列","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"市场多年保修","NoDiscountTotal__c":31000,"SFDA_Status__c":"有效","Name__c":"CF-H190I:电子结肠内窥镜","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]';
        List<lexNewQuoteEntryController.QELine> activities = (List<lexNewQuoteEntryController.QELine>)JSON.deserialize(activitiesCan,List<lexNewQuoteEntryController.QELine>.class);
        List<QuoteLineItem> bbb = new List<QuoteLineItem>();
        Integer i = 0;
        activities[0].pageObject.Id__c = product1.Id;
        activities[1].pageObject.Id__c = product2.Id;
        for(lexNewQuoteEntryController.QELine aa:activities){
            bbb.add(aa.pageObject);
            i++;
        }
        String CheckItemCan =JSON.serialize(bbb);
        activitiesCan = JSON.serialize(activities);
        Boolean changedAfterPrintc = false;
        boolean enableSalesc = true;
        boolean newQuoteFlagc = false;
        String oppIdc = opp.Id;
        String oppInfoc = JSON.serialize(opp);
        boolean productStatusUpdatedc = false;
        String quoIdc = '';
        String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
        Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
        quos.Agency1__c = sellerA.id;
        quoc = JSON.serialize(quos);
        String quoteGurantee_Periodc = null;
        Boolean quoteflg = false;
        String quotemultiYearWarrantyc = null;
        String selection_hpc = '杭州市丁桥医院';
        lexNewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
        oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
        quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,'');
    }
    @isTest
    static void Test8(){
        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;
        sellerA.Tax_Practice_No__c = '001';
        sellerA.Sales_Shop_Class__c = '特約販売店（区域）';
        sellerA.Business_Authorization_No__c = '001';
        sellerA.Tax_Practice_Expiration_Date__c =  Date.today().addDays(20);
        sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
        sellerA.Medical_Equipment_Expiration_Date__c = Date.today().addDays(20);
        sellerA.Medical_Equipment_Num__c = '有证';
        sellerA.Business_Authorization_No__c = '0001';
        sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
        insert sellerA;
        
        RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
        Account contractA = new Account(Name = '*');
        contractA.RecordTypeId = recKeiyaku.id;
        contractA.Agent_Ref__c = sellerA.id;
        contractA.ParentId = sellerA.id;
        insert contractA;
        StaticParameter.EscapeOppandStaTrigger = true;
        Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
        opp.Trade__c = '外貿';
        //opp.CurrencyIsoCode = CurrencyIso;
        opp.Sales_Root__c = '販売店';
        opp.StageName = '引合';
        opp.Fixed_Check__c = false;
        opp.owner_not_automatically_update__c = true;
        //opp.Pricebook2Id = pricebook.id;
        opp.Purchase_Type__c = '一般引合';
        opp.Promise_Class__c = '外貿';
        opp.Fund_Basis__c = '政府資金';
        opp.AccountId = contractA.id;
        opp.Hospital__c = contractA.id;
        opp.Agency1__c = sellerA.id;
        opp.Wholesale_Price__c = 9000;
        opp.Opportunity_stage__c = '还没申请预算';
        opp.Close_Forecasted_Date__c = Date.today().addDays(50);
        opp.Special_Opp_lanhai__c = false;
        opp.CurrencyIsoCode = 'USD';
        opp.Stock_Confrim_Date__c = Date.today().addDays(50);
        insert opp;
        IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c();
        ISOhead.name = '*';
        ISOhead.Opportunity_ID__c = opp.id;
        ISOhead.Approval_Date__c = Date.today();
        ISOhead.Public_Hospital_TF__c = true;
        ISOhead.Preparation_Stage_TF__c = true;
        ISOhead.Data_Check_TF__c = true;
        ISOhead.Operating_Room_Plane_Graph_TF__c = true;
        ISOhead.Demonstration_Area_Plane_Graph_TF__c = true;
        insert ISOhead;
        Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss();
        lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
        User us =  lexNewQuoteEntryController.selecUser();
        Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
        String oppvalue = JSON.serialize(opp1);
        lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue);
        lexNewQuoteEntryController.getquoDes();
        
        Product2 product1 = new Product2( Name = '11111');
            product1.SFDA_Status__c = '暂停出库（短期）';
            product1.Intra_Trade_List_RMB_1__c = 100;
            product1.Intra_Trade_List_RMB_Date1__c = date.today();
            product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
            product1.Intra_Trade_Cost_RMB_1__c = 200;
            product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
            product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
            product1.Manual_Entry__c = false;
            product1.Asset_Model_No__c = '11111';
            product1.MDM_Model_No__c = '11111';
            product1.ProductCode = 'OTV-SP1H-NA-12E';
            product1.LastbuyProductFLG__c = true;
            insert product1;
            system.debug('##product.Id=[' + product1.Id + ']' );

            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;
            system.debug('##product1.Id=[' + product1.Id + ']' );
            system.debug('##product2.Id=[' + product2.Id + ']' );

            Pricebook2 pricebook = ControllerUtil.getStandardPricebook();

            PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);

            pE.UnitPrice = 0;
            pE.IsActive = true;
            pE.UseStandardPrice = false;
            pE.CurrencyIsoCode = 'USD';
            //pE.
            insert pE;

            PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);

            pE2.UnitPrice = 0;
            pE2.IsActive = true;
            pE2.UseStandardPrice = false;
            pE2.CurrencyIsoCode = 'USD';
            //pE.
            insert pE2;
            LastbuyProduct__c lbp = new LastbuyProduct__c();
            lbp.Name = 'Test0215';
            lbp.ProductName__c = product1.Id;
            lbp.InquiryCode__c = opp.Id;
            lbp.effectiveFLG__c = true;
            lbp.LastbuyQuantity__c = 1;
            insert lbp;
            Quote quote = new Quote( Name = 'テスト見積');
            quote.OpportunityId = opp.Id;
            quote.Pricebook2Id = pricebook.id;
            quote.Quote_No__c = 'textQutote01';
            quote.Unit_Price__c = isUnitPrice;
            quote.Offer_Amount__c = isOfferAmount;
            quote.TOTAL__c = isTotalPrice;
            quote.Discount__c = isDiscountRate;
            quote.Pricing__c = isDiscountAmount;
            quote.Preferential_Trading_Price__c = isTradingPrice;
            quote.Contract__c = isContractDetail;
            quote.Quote_Comment__c = offerComment;
            insert quote;
            QuoteLineItem target = new QuoteLineItem();
            target.Name__c = 'テスト商品';
            target.QuoteId = quote.id;
            target.Quantity = 1;
            target.Cost_Subtotal__c = 0;
            target.Cost__c = 200;
            target.Item_Order__c  = 3;
            target.UnitPrice = 10;
            target.Product2Id = product1.id;
            target.PricebookEntryId = pE.Id;
            insert target;
        List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('','','');
        // PageReference page = new PageReference('/apex/lexNewQuoteEntry');
        // System.Test.setCurrentPage(page);
        Apexpages.currentPage().getParameters().put('oppid', opp.id);
        List<String> proList = new List<String>();
        proList.add(product1.Id);
        proList.add(product2.Id);
        String prostr = JSON.serialize(proList);
        Boolean SkipQuotefilgc = false;
        boolean WinOrDecideAlertc = false;
        String activitiesCan = lexNewQuoteEntryController.selectQuoteLineItem(quote.Id,opp.Id);
        List<lexNewQuoteEntryController.QELine> activities = (List<lexNewQuoteEntryController.QELine>)JSON.deserialize(activitiesCan,List<lexNewQuoteEntryController.QELine>.class);
        List<QuoteLineItem> bbb = new List<QuoteLineItem>();
        Integer i = 0;
        activities[0].pageObject.Id__c = product1.Id;
        activities[0].pageObject.Quantity__c = 2;
        activities[0].pageObject.PricebookEntryId = pE.Id;
        for(lexNewQuoteEntryController.QELine aa:activities){
            bbb.add(aa.pageObject);
            i++;
        }
        String CheckItemCan =JSON.serialize(bbb);
        activitiesCan = JSON.serialize(activities);
        Boolean changedAfterPrintc = false;
        boolean enableSalesc = true;
        boolean newQuoteFlagc = false;
        String oppIdc = opp.Id;
        String oppInfoc = JSON.serialize(opp);
        boolean productStatusUpdatedc = false;
        String quoIdc = '';
        String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
        Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
        quos.Agency1__c = sellerA.id;
        quoc = JSON.serialize(quos);
        String quoteGurantee_Periodc = null;
        Boolean quoteflg = false;
        String quotemultiYearWarrantyc = null;
        String selection_hpc = '杭州市丁桥医院';
        lexNewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
        oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
        quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,'');
    }
    @isTest
    static void Test9(){
        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;
        sellerA.Tax_Practice_No__c = '001';
        sellerA.Sales_Shop_Class__c = '特約販売店（区域）';
        sellerA.Business_Authorization_No__c = '001';
        sellerA.Tax_Practice_Expiration_Date__c =  Date.today().addDays(20);
        sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
        sellerA.Medical_Equipment_Expiration_Date__c = Date.today().addDays(20);
        sellerA.Medical_Equipment_Num__c = '有证';
        sellerA.Business_Authorization_No__c = '0001';
        sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
        insert sellerA;
        
        RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
        Account contractA = new Account(Name = '*');
        contractA.RecordTypeId = recKeiyaku.id;
        contractA.Agent_Ref__c = sellerA.id;
        contractA.ParentId = sellerA.id;
        insert contractA;
        StaticParameter.EscapeOppandStaTrigger = true;
        Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
        opp.Trade__c = '外貿';
        //opp.CurrencyIsoCode = CurrencyIso;
        opp.Sales_Root__c = '販売店';
        opp.StageName = '引合';
        opp.Fixed_Check__c = false;
        opp.owner_not_automatically_update__c = true;
        //opp.Pricebook2Id = pricebook.id;
        opp.Purchase_Type__c = '一般引合';
        opp.Promise_Class__c = '外貿';
        opp.Fund_Basis__c = '政府資金';
        opp.AccountId = contractA.id;
        opp.Hospital__c = contractA.id;
        opp.Agency1__c = sellerA.id;
        opp.Wholesale_Price__c = 9000;
        opp.Opportunity_stage__c = '还没申请预算';
        opp.Close_Forecasted_Date__c = Date.today().addDays(50);
        opp.Special_Opp_lanhai__c = false;
        opp.CurrencyIsoCode = 'USD';
        opp.Stock_Confrim_Date__c = Date.today().addDays(50);
        insert opp;
        IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c();
        ISOhead.name = '*';
        ISOhead.Opportunity_ID__c = opp.id;
        ISOhead.Approval_Date__c = Date.today();
        ISOhead.Public_Hospital_TF__c = true;
        ISOhead.Preparation_Stage_TF__c = true;
        ISOhead.Data_Check_TF__c = true;
        ISOhead.Operating_Room_Plane_Graph_TF__c = true;
        ISOhead.Demonstration_Area_Plane_Graph_TF__c = true;
        insert ISOhead;
        Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss();
        lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
        User us =  lexNewQuoteEntryController.selecUser();
        Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
        String oppvalue = JSON.serialize(opp1);
        lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue);
        lexNewQuoteEntryController.getquoDes();
        
        Product2 product1 = new Product2( Name = '11111');
            product1.SFDA_Status__c = '暂停出库（短期）';
            product1.Intra_Trade_List_RMB_1__c = 100;
            product1.Intra_Trade_List_RMB_Date1__c = date.today();
            product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
            product1.Intra_Trade_Cost_RMB_1__c = 200;
            product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
            product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
            product1.Manual_Entry__c = false;
            product1.Asset_Model_No__c = '11111';
            product1.MDM_Model_No__c = '11111';
            product1.ProductCode = 'OTV-SP1H-NA-12E';
            product1.LastbuyProductFLG__c = false;
            insert product1;
            system.debug('##product.Id=[' + product1.Id + ']' );

            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;
            system.debug('##product1.Id=[' + product1.Id + ']' );
            system.debug('##product2.Id=[' + product2.Id + ']' );

            Pricebook2 pricebook = ControllerUtil.getStandardPricebook();

            PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);

            pE.UnitPrice = 0;
            pE.IsActive = true;
            pE.UseStandardPrice = false;
            pE.CurrencyIsoCode = 'USD';
            //pE.
            insert pE;

            PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);

            pE2.UnitPrice = 0;
            pE2.IsActive = true;
            pE2.UseStandardPrice = false;
            pE2.CurrencyIsoCode = 'USD';
            //pE.
            insert pE2;
            LastbuyProduct__c lbp = new LastbuyProduct__c();
            lbp.Name = 'Test0215';
            lbp.ProductName__c = product1.Id;
            lbp.InquiryCode__c = opp.Id;
            lbp.effectiveFLG__c = true;
            lbp.LastbuyQuantity__c = 1;
            // insert lbp;
            Quote quote = new Quote( Name = 'テスト見積');
            quote.OpportunityId = opp.Id;
            quote.Pricebook2Id = pricebook.id;
            quote.Quote_No__c = 'textQutote01';
            quote.Unit_Price__c = isUnitPrice;
            quote.Offer_Amount__c = isOfferAmount;
            quote.TOTAL__c = isTotalPrice;
            quote.Discount__c = isDiscountRate;
            quote.Pricing__c = isDiscountAmount;
            quote.Preferential_Trading_Price__c = isTradingPrice;
            quote.Contract__c = isContractDetail;
            quote.Quote_Comment__c = offerComment;
            insert quote;
            QuoteLineItem target = new QuoteLineItem();
            target.Name__c = 'テスト商品';
            target.QuoteId = quote.id;
            target.Quantity = 1;
            target.Cost_Subtotal__c = 0;
            target.Cost__c = 200;
            target.Item_Order__c  = 3;
            target.UnitPrice = 10;
            target.Product2Id = product1.id;
            target.PricebookEntryId = pE.Id;
            insert target;
            License_Information__c linc = new License_Information__c( name='Test20181204',
                                                LicenseType__c = '医疗器械经营许可证',
                                                BusinessLicense__c = '20180522',
                                                ValidFrom__c = date.newinstance(2018, 05, 22),
                                                ValidTo__c = date.newinstance(2088, 05, 22),
                                                Scope3__c = '6815;6822;6823;6825',
                                                LicenseAndAccount__c = sellerA.id
                                                );
        insert linc;
        List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('','','');
        // PageReference page = new PageReference('/apex/lexNewQuoteEntry');
        // System.Test.setCurrentPage(page);
        Apexpages.currentPage().getParameters().put('oppid', opp.id);
        List<String> proList = new List<String>();
        proList.add(product1.Id);
        proList.add(product2.Id);
        String prostr = JSON.serialize(proList);
        Boolean SkipQuotefilgc = false;
        boolean WinOrDecideAlertc = false;
        String activitiesCan = lexNewQuoteEntryController.selectQuoteLineItem(quote.Id,opp.Id);
        List<lexNewQuoteEntryController.QELine> activities = (List<lexNewQuoteEntryController.QELine>)JSON.deserialize(activitiesCan,List<lexNewQuoteEntryController.QELine>.class);
        List<QuoteLineItem> bbb = new List<QuoteLineItem>();
        Integer i = 0;
        activities[0].pageObject.Id__c = product1.Id;
        activities[0].pageObject.Quantity__c = 2;
        activities[0].pageObject.PricebookEntryId = pE.Id;
        activities[0].pageObject.SFDA_Status__c = '暂停出库（短期）';
        for(lexNewQuoteEntryController.QELine aa:activities){
            bbb.add(aa.pageObject);
            i++;
        }
        String CheckItemCan =JSON.serialize(bbb);
        activitiesCan = JSON.serialize(activities);
        Boolean changedAfterPrintc = false;
        boolean enableSalesc = true;
        boolean newQuoteFlagc = false;
        String oppIdc = opp.Id;
        String oppInfoc = JSON.serialize(opp);
        boolean productStatusUpdatedc = false;
        String quoIdc = '';
        String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
        Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
        quos.Agency1__c = sellerA.id;
        quos.IsQuoteTrial__c = true;
        quoc = JSON.serialize(quos);
        String quoteGurantee_Periodc = null;
        Boolean quoteflg = false;
        String quotemultiYearWarrantyc = null;
        String selection_hpc = '杭州市丁桥医院';
        lexNewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
        oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
        quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,'');
    }
    @isTest
    static void Test10(){
        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;
        sellerA.Tax_Practice_No__c = '001';
        sellerA.Sales_Shop_Class__c = '特約販売店（区域）';
        sellerA.Business_Authorization_No__c = '001';
        sellerA.Tax_Practice_Expiration_Date__c =  Date.today().addDays(20);
        sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
        sellerA.Medical_Equipment_Expiration_Date__c = Date.today().addDays(20);
        sellerA.Medical_Equipment_Num__c = '有证';
        sellerA.Business_Authorization_No__c = '0001';
        sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
        insert sellerA;
        
        RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
        Account contractA = new Account(Name = '*');
        contractA.RecordTypeId = recKeiyaku.id;
        contractA.Agent_Ref__c = sellerA.id;
        contractA.ParentId = sellerA.id;
        insert contractA;
        StaticParameter.EscapeOppandStaTrigger = true;
        Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
        opp.Trade__c = '外貿';
        //opp.CurrencyIsoCode = CurrencyIso;
        opp.Sales_Root__c = '販売店';
        opp.StageName = '引合';
        opp.Fixed_Check__c = false;
        opp.owner_not_automatically_update__c = true;
        //opp.Pricebook2Id = pricebook.id;
        opp.Purchase_Type__c = '一般引合';
        opp.Promise_Class__c = '外貿';
        opp.Fund_Basis__c = '政府資金';
        opp.AccountId = contractA.id;
        opp.Hospital__c = contractA.id;
        opp.Agency1__c = sellerA.id;
        opp.Wholesale_Price__c = 9000;
        opp.Opportunity_stage__c = '还没申请预算';
        opp.Close_Forecasted_Date__c = Date.today().addDays(50);
        opp.Special_Opp_lanhai__c = false;
        opp.CurrencyIsoCode = 'USD';
        opp.Stock_Confrim_Date__c = Date.today().addDays(50);
        insert opp;
        IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c();
        ISOhead.name = '*';
        ISOhead.Opportunity_ID__c = opp.id;
        ISOhead.Approval_Date__c = Date.today();
        ISOhead.Public_Hospital_TF__c = true;
        ISOhead.Preparation_Stage_TF__c = true;
        ISOhead.Data_Check_TF__c = true;
        ISOhead.Operating_Room_Plane_Graph_TF__c = true;
        ISOhead.Demonstration_Area_Plane_Graph_TF__c = true;
        insert ISOhead;
        Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss();
        lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
        User us =  lexNewQuoteEntryController.selecUser();
        Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
        String oppvalue = JSON.serialize(opp1);
        lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue);
        lexNewQuoteEntryController.getquoDes();
        
        Product2 product1 = new Product2( Name = '11111');
            product1.SFDA_Status__c = '暂停出库（短期）';
            product1.Intra_Trade_List_RMB_1__c = 100;
            product1.Intra_Trade_List_RMB_Date1__c = date.today();
            product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
            product1.Intra_Trade_Cost_RMB_1__c = 200;
            product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
            product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
            product1.Manual_Entry__c = false;
            product1.Asset_Model_No__c = '11111';
            product1.MDM_Model_No__c = '11111';
            product1.ProductCode = 'OTV-SP1H-NA-12E';
            product1.LastbuyProductFLG__c = false;
            insert product1;
            system.debug('##product.Id=[' + product1.Id + ']' );

            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;
            system.debug('##product1.Id=[' + product1.Id + ']' );
            system.debug('##product2.Id=[' + product2.Id + ']' );

            Pricebook2 pricebook = ControllerUtil.getStandardPricebook();

            PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);

            pE.UnitPrice = 0;
            pE.IsActive = true;
            pE.UseStandardPrice = false;
            pE.CurrencyIsoCode = 'USD';
            //pE.
            insert pE;

            PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);

            pE2.UnitPrice = 0;
            pE2.IsActive = true;
            pE2.UseStandardPrice = false;
            pE2.CurrencyIsoCode = 'USD';
            //pE.
            insert pE2;
            LastbuyProduct__c lbp = new LastbuyProduct__c();
            lbp.Name = 'Test0215';
            lbp.ProductName__c = product1.Id;
            lbp.InquiryCode__c = opp.Id;
            lbp.effectiveFLG__c = true;
            lbp.LastbuyQuantity__c = 1;
            // insert lbp;
            Quote quote = new Quote( Name = 'テスト見積');
            quote.OpportunityId = opp.Id;
            quote.Pricebook2Id = pricebook.id;
            quote.Quote_No__c = 'textQutote01';
            quote.Unit_Price__c = isUnitPrice;
            quote.Offer_Amount__c = isOfferAmount;
            quote.TOTAL__c = isTotalPrice;
            quote.Discount__c = isDiscountRate;
            quote.Pricing__c = isDiscountAmount;
            quote.Preferential_Trading_Price__c = isTradingPrice;
            quote.Contract__c = isContractDetail;
            quote.Quote_Comment__c = offerComment;
            insert quote;
            QuoteLineItem target = new QuoteLineItem();
            target.Name__c = 'テスト商品';
            target.QuoteId = quote.id;
            target.Quantity = 1;
            target.Cost_Subtotal__c = 0;
            target.Cost__c = 200;
            target.Item_Order__c  = 3;
            target.UnitPrice = 10;
            target.Product2Id = product1.id;
            target.PricebookEntryId = pE.Id;
            insert target;
            License_Information__c linc = new License_Information__c( name='Test20181204',
                                                LicenseType__c = '医疗器械经营许可证',
                                                BusinessLicense__c = '20180522',
                                                ValidFrom__c = date.newinstance(2018, 05, 22),
                                                ValidTo__c = date.newinstance(2088, 05, 22),
                                                Scope3__c = '6815;6822;6823;6825',
                                                LicenseAndAccount__c = sellerA.id
                                                );
        insert linc;
        List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('','','');
        // PageReference page = new PageReference('/apex/lexNewQuoteEntry');
        // System.Test.setCurrentPage(page);
        Apexpages.currentPage().getParameters().put('oppid', opp.id);
        List<String> proList = new List<String>();
        proList.add(product1.Id);
        proList.add(product2.Id);
        String prostr = JSON.serialize(proList);
        Boolean SkipQuotefilgc = false;
        boolean WinOrDecideAlertc = false;
        String activitiesCan = lexNewQuoteEntryController.selectQuoteLineItem(quote.Id,opp.Id);
        List<lexNewQuoteEntryController.QELine> activities = (List<lexNewQuoteEntryController.QELine>)JSON.deserialize(activitiesCan,List<lexNewQuoteEntryController.QELine>.class);
        List<QuoteLineItem> bbb = new List<QuoteLineItem>();
        Integer i = 0;
        activities[0].pageObject.Id__c = product1.Id;
        activities[0].pageObject.Quantity__c = 2;
        activities[0].pageObject.PricebookEntryId = pE.Id;
        activities[0].pageObject.SFDA_Status__c = '暂停出库（短期）';
        for(lexNewQuoteEntryController.QELine aa:activities){
            bbb.add(aa.pageObject);
            i++;
        }
        String CheckItemCan =JSON.serialize(bbb);
        activitiesCan = JSON.serialize(activities);
        Boolean changedAfterPrintc = false;
        boolean enableSalesc = false;
        boolean newQuoteFlagc = false;
        String oppIdc = opp.Id;
        String oppInfoc = JSON.serialize(opp);
        boolean productStatusUpdatedc = false;
        String quoIdc = '';
        String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
        Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
        quos.Agency1__c = sellerA.id;
        quos.IsQuoteTrial__c = true;
        quoc = JSON.serialize(quos);
        String quoteGurantee_Periodc = null;
        Boolean quoteflg = false;
        String quotemultiYearWarrantyc = null;
        String selection_hpc = '杭州市丁桥医院';
        lexNewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
        oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
        quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,'');
    }
    @isTest
    static void Test11(){
        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;
        sellerA.Tax_Practice_No__c = '001';
        sellerA.Sales_Shop_Class__c = '特約販売店（区域）';
        sellerA.Business_Authorization_No__c = '001';
        sellerA.Tax_Practice_Expiration_Date__c =  Date.today().addDays(20);
        sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
        insert sellerA;
        
        RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
        Account contractA = new Account(Name = '*');
        contractA.RecordTypeId = recKeiyaku.id;
        contractA.Agent_Ref__c = sellerA.id;
        contractA.Hospital__c=hospital.id;
        contractA.ParentId = sellerA.id;
        insert contractA;
        StaticParameter.EscapeOppandStaTrigger = true;
        Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
        opp.Trade__c = '外貿';
        //opp.CurrencyIsoCode = CurrencyIso;
        opp.Sales_Root__c = '販売店';
        opp.StageName = '引合';
        opp.Fixed_Check__c = false;
        opp.owner_not_automatically_update__c = true;
        //opp.Pricebook2Id = pricebook.id;
        opp.Purchase_Type__c = '一般引合';
        opp.Promise_Class__c = '外貿';
        opp.Fund_Basis__c = '政府資金';
        opp.AccountId = contractA.id;
        opp.Hospital__c = contractA.id;
        opp.Agency1__c = sellerA.id;
        opp.Wholesale_Price__c = 9000;
        opp.Opportunity_stage__c = '还没申请预算';
        opp.Close_Forecasted_Date__c = Date.today().addDays(50);
        opp.Special_Opp_lanhai__c = false;
        insert opp;
        Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss();
        lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
        User us =  lexNewQuoteEntryController.selecUser();
        Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
        String oppvalue = JSON.serialize(opp1);
        lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue);
        Product2 product1 = new Product2( Name = '11111');
            product1.SFDA_Status__c = '不要';
            product1.Intra_Trade_List_RMB_1__c = 100;
            product1.Intra_Trade_List_RMB_Date1__c = date.today();
            product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
            product1.Intra_Trade_Cost_RMB_1__c = 200;
            product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
            product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
            product1.Manual_Entry__c = false;
            product1.Asset_Model_No__c = '11111';
            product1.MDM_Model_No__c = '11111';
            product1.ProductCode = 'OTV-SP1H-NA-12E';
            insert product1;
            system.debug('##product.Id=[' + product1.Id + ']' );

            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;
            system.debug('##product1.Id=[' + product1.Id + ']' );
            system.debug('##product2.Id=[' + product2.Id + ']' );

            Pricebook2 pricebook = ControllerUtil.getStandardPricebook();

            PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);

            pE.UnitPrice = 0;
            pE.IsActive = true;
            pE.UseStandardPrice = false;
            pE.CurrencyIsoCode = 'USD';
            //pE.
            insert pE;

            PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);

            pE2.UnitPrice = 0;
            pE2.IsActive = true;
            pE2.UseStandardPrice = false;
            pE2.CurrencyIsoCode = 'USD';
            //pE.
            insert pE2;
            Product_Set__c ps1 = new Product_Set__c();
            ps1.Name = 'セット品１';
            ps1.Product_Set_CD__c = '111111';
            ps1.Description__c = '説明';
            ps1.Qty__c = 10;
            //ps1.Valid__c = true;
            ps1.Valid_Date__c = date.today().addDays(-5);
            insert ps1;

            Product_Set_Detail__c psd1 = new Product_Set_Detail__c();
            psd1.Product_Set__c = ps1.id;
            psd1.Price__c = 100;
            psd1.Quantity__c = 10;
            psd1.Product__c = product1.id;

            insert psd1;
        List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('12','121','122');
        // PageReference page = new PageReference('/apex/lexNewQuoteEntry');
        // System.Test.setCurrentPage(page);
        Apexpages.currentPage().getParameters().put('oppid', opp.id);
        List<Product_Set__c> pstc = lexNewQuoteEntryController.serSetContact('品','1','');
        String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H170L:电子大肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H170L:电子大肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170系列","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H170L:电子大肠内窥镜","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170系列","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"有效","Name__c":"CF-H170L:电子大肠内窥镜","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H190I:电子结肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"市场","warrantyType__c":"市场多年保修","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H190I:电子结肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"市场","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190系列","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H190I:电子结肠内窥镜","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"市场","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190系列","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"市场多年保修","NoDiscountTotal__c":31000,"SFDA_Status__c":"有效","Name__c":"CF-H190I:电子结肠内窥镜","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]';
        String oppInfoc = JSON.serialize(opp);
        String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
        Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
        quos.Agency1__c = sellerA.id;
        quoc = JSON.serialize(quos);
        String setProduct_text = ps1.Id;
        String setprd = lexNewQuoteEntryController.setProductEntry(setProduct_text,activitiesCan,oppInfoc,quoc);
        String excel_text = product1.ProductCode+'\t1\n'+product2.ProductCode+'\t1';
        String eximt = lexNewQuoteEntryController.excelImport(excel_text,activitiesCan,oppInfoc,quoc);
        StaticParameter.EscapeOppandStaTrigger = false;
    }

    @isTest
    static void Test12(){
        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;
        sellerA.Tax_Practice_No__c = '001';
        sellerA.Sales_Shop_Class__c = '特約販売店（区域）';
        sellerA.Business_Authorization_No__c = '001';
        sellerA.Tax_Practice_Expiration_Date__c =  Date.today().addDays(20);
        sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
        insert sellerA;
        
        RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
        Account contractA = new Account(Name = '*');
        contractA.RecordTypeId = recKeiyaku.id;
        contractA.Agent_Ref__c = sellerA.id;
        contractA.ParentId = sellerA.id;
        insert contractA;
        StaticParameter.EscapeOppandStaTrigger = true;
        Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
        opp.Trade__c = '内貿';
        //opp.CurrencyIsoCode = CurrencyIso;
        opp.Sales_Root__c = '販売店';
        opp.StageName = '引合';
        opp.Fixed_Check__c = false;
        opp.owner_not_automatically_update__c = true;
        //opp.Pricebook2Id = pricebook.id;
        opp.Purchase_Type__c = 'ET24時間販売';
        opp.Promise_Class__c = '外貿';
        opp.Fund_Basis__c = '政府資金';
        opp.AccountId = contractA.id;
        opp.Hospital__c = contractA.id;
        opp.Agency1__c = sellerA.id;
        opp.Wholesale_Price__c = 9000;
        opp.Opportunity_stage__c = '还没申请预算';
        opp.Close_Forecasted_Date__c = Date.today().addDays(50);
        opp.Special_Opp_lanhai__c = false;
        opp.CurrencyIsoCode = 'CNY';
        opp.Is_Corrosion__c=true;
        opp.SAP_Province__c='上海市';
        insert opp;
        Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss();
        lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
        User us =  lexNewQuoteEntryController.selecUser();
        Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
        String oppvalue = JSON.serialize(opp1);
        lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue);
        Product2 product1 = new Product2( Name = '11111');
            product1.SFDA_Status__c = '不要';
            product1.Intra_Trade_List_RMB_1__c = 100;
            product1.Intra_Trade_List_RMB_Date1__c = date.today();
            product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
            product1.Intra_Trade_Cost_RMB_1__c = 200;
            product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
            product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
            product1.Manual_Entry__c = false;
            product1.Asset_Model_No__c = '11111';
            product1.MDM_Model_No__c = '11111';
            product1.ProductCode = 'OTV-SP1H-NA-12E';
            insert product1;
            system.debug('##product.Id=[' + product1.Id + ']' );

            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;
            system.debug('##product1.Id=[' + product1.Id + ']' );
            system.debug('##product2.Id=[' + product2.Id + ']' );

            Pricebook2 pricebook = ControllerUtil.getStandardPricebook();

            PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);

            pE.UnitPrice = 0;
            pE.IsActive = true;
            pE.UseStandardPrice = false;
            pE.CurrencyIsoCode = CurrencyIso;
            //pE.
            insert pE;

            PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);

            pE2.UnitPrice = 0;
            pE2.IsActive = true;
            pE2.UseStandardPrice = false;
            pE2.CurrencyIsoCode = CurrencyIso;
            //pE.
            insert pE2;
        List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('','','');
        PageReference page = new PageReference('/apex/lexNewQuoteEntry');
        System.Test.setCurrentPage(page);
        Apexpages.currentPage().getParameters().put('oppid', opp.id);
        String CheckItemCan = null;
        Boolean SkipQuotefilgc = false;
        boolean WinOrDecideAlertc = false;
        String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H170L:电子大肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H170L:电子大肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170系列","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H170L:电子大肠内窥镜","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170系列","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"有效","Name__c":"CF-H170L:电子大肠内窥镜","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H190I:电子结肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"市场","warrantyType__c":"市场多年保修","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H190I:电子结肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"市场","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190系列","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H190I:电子结肠内窥镜","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"市场","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190系列","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"市场多年保修","NoDiscountTotal__c":31000,"SFDA_Status__c":"有效","Name__c":"CF-H190I:电子结肠内窥镜","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]';
        Boolean changedAfterPrintc = false;
        boolean enableSalesc = true;
        boolean newQuoteFlagc = false;
        String oppIdc = opp.Id;
        String oppInfoc = JSON.serialize(opp);
        boolean productStatusUpdatedc = false;
        String quoIdc = '';
        String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
        Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
        quos.Agency1__c = sellerA.id;
        quoc = JSON.serialize(quos);
        String quoteGurantee_Periodc = null;
        Boolean quoteflg = false;
        String quotemultiYearWarrantyc = null;
        String selection_hpc = '杭州市丁桥医院';
        lexNewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
        oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
        quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg,'');
        quoteflg = true;
        lexNewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
        oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
        quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg,'');
        lexNewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
        oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
        quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,'');
        StaticParameter.EscapeOppandStaTrigger = false;
        lexNewQuoteEntryController.setOppFromOppInfo();
        
    }

}