@isTest
private class OpdPlanWebServiceTest {
    //@isTest
    //static  void testMethod1() {



    //    // 产品
    //    Product2 pro5 = new Product2(Name = 'name05', IsActive = true, Family = 'SP',
    //                                 Fixture_Model_No__c = 'n05', Serial_Lot_No__c = 'S/N tracing',
    //                                 Fixture_Model_No_T__c = 'n05',
    //                                 ProductCode_Ext__c = 'pc05', Manual_Entry__c = false);
    //    insert pro5;

    //    // 备品配套(只有附属品)
    //    Fixture_Set__c fsObjC1 = new Fixture_Set__c();
    //    fsObjC1.Name = 'setC1';
    //    fsObjC1.Fixture_Set_Body_Model_No__c = 'modelNoC1';
    //    fsObjC1.Loaner_name__c = 'nameC1';
    //    insert fsObjC1;
    //    // 备品配套明细(只有附属品)
    //    Fixture_Set_Detail__c fsdObjC1 = new Fixture_Set_Detail__c();
    //    fsdObjC1.Name = 'detailAccessory';
    //    fsdObjC1.Name_CHN_Created__c = 'detailAccessoryName';
    //    fsdObjC1.Product2__c = pro5.Id;
    //    fsdObjC1.Fixture_Set__c = fsObjC1.Id;
    //    fsdObjC1.Is_Body__c = false;
    //    fsdObjC1.Is_Optional__c = true;
    //    fsdObjC1.UniqueKey__c = fsObjC1.Id + ':' + pro5.Id;
    //    fsdObjC1.SortInt__c = 1;

    //    insert fsdObjC1;


    //    OPDPlan__c oPDPlan0 = new OPDPlan__c();
    //    oPDPlan0.Status__c = '草案中';
    //    oPDPlan0.OPDPlan_ImplementDate__c = Date.today();
    //    oPDPlan0.NoOpp_Reason__c = 'HCP对应';
    //    insert oPDPlan0;
    //    Rental_Apply__c raObj = new Rental_Apply__c();
    //    raObj.Name = 'testra';
    //    raObj.Product_category__c = 'GI';
    //    raObj.Demo_purpose1__c = '维修代用';
    //    raObj.demo_purpose2__c = FixtureUtil.raDemo_purpose2MAP.get('baoxiuyonghu');
    //    raObj.direct_send__c = '医疗机构';
    //    raObj.Loaner_received_staff__c = '王五';
    //    raObj.Loaner_received_staff_phone__c = '110';
    //    raObj.direct_shippment_address__c = '北京市';

    //    raObj.Request_shipping_day__c = Date.toDay();  // 希望到货日
    //    //raObj.Hope_Lonaer_date_Num__c = 1;  // 希望借用天数
    //    raObj.Phone_number__c = '1234567890';
    //    raObj.OPDPlan__c = oPDPlan0.Id;
    //    insert raObj;


    //    Rental_Apply_Equipment_Set__c raesObjC1 = new Rental_Apply_Equipment_Set__c();
    //    raesObjC1.Rental_Apply__c = raObj.Id;
    //    raesObjC1.Fixture_Set__c = fsObjC1.Id;
    //    raesObjC1.Cancel_Select__c = false;
    //    raesObjC1.Shipment_request_time__c = Date.toDay();
    //    raesObjC1.Rental_Start_Date__c = Date.toDay();
    //    raesObjC1.Rental_End_Date__c = Date.toDay();
    //    raesObjC1.IndexFromUniqueKey__c = 1;
    //    raesObjC1.UniqueKey__c = '1:' + fsObjC1.Id + ':1';
    //    insert raesObjC1;

    //    Rental_Apply_Equipment_Set_Detail__c raesd = new Rental_Apply_Equipment_Set_Detail__c();
    //    raesd.name = 'test';
    //    raesd.Rental_Apply_Equipment_Set__c = raesObjC1.id;
    //    raesd.Rental_Apply__c = raObj.Id;
    //    raesd.Fixture_Set_Detail__c = fsdObjC1.Id;
    //    raesd.Cancel_Select__c = false;
    //    raesd.Shippment_loaner_time__c = Date.today();
    //    raesd.IndexFromUniqueKey__c = 1;
    //    raesd.UniqueKey__c = '1:' + raesObjC1.Id + ':' + fsdObjC1.Id + ':1';
    //    raesd.Salesdepartment_before__c = '0.备品中心';
    //    raesd.Internal_asset_location_before__c = '北京 备品中心';
    //    raesd.Product_category_text__c = 'GI';
    //    raesd.Equipment_Type_text__c = '产品试用';
    //    insert raesd;

    //    Test.startTest();
    //    OpdPlanWebService.test();
    //    //OpdPlanWebService.changeTrade(oPDPlan0.id);
    //    Test.stopTest();
    //}

    @isTest
    static  void changeCampaign_Test() {

        Campaign cam = new Campaign();
        cam.Name = 'cam1';
        cam.Name2__c = 'cam1';
        cam.CeremonyDate__c = Date.today().addDays(7);
        cam.Lesson1Date__c = Date.today().addDays(10);
        cam.Mailflg_after45__c = true;
        cam.Mailflg_cancel__c = true;
        cam.Mailflg_before15__c = true;
        cam.Mailflg_before7__c = true;
        cam.Mailflg_after3__c = true;
        cam.TeachingFrequency__c = '连续四天';
        cam.status = '公开中';
        cam.Mailflg_6Month_service__c = 6;
        cam.StartDate = Date.today();
        cam.EndDate = Date.today();
        cam.Mailflgafter3serviceDate__c = true;
        cam.Mailflg_Approval_service__c = true;
        cam.Mailflg_before7_service__c = true;
        cam.Mailflg_Cancel_Service__c = true;
        cam.HostName__c = '奥林巴斯';
        cam.cooperatorCompany__c = '精琢科技';
        insert cam;

        Rental_Apply__c raObj = new Rental_Apply__c();
        raObj.Name = 'testra';
        raObj.Product_category__c = 'GI';
        raObj.Demo_purpose1__c = '维修代用';
        raObj.demo_purpose2__c = FixtureUtil.raDemo_purpose2MAP.get('baoxiuyonghu');
        raObj.direct_send__c = '医疗机构';
        raObj.Loaner_received_staff__c = '王五';
        raObj.Loaner_received_staff_phone__c = '110';
        raObj.direct_shippment_address__c = '北京市';

        raObj.Request_shipping_day__c = Date.toDay();  // 希望到货日
        //raObj.Hope_Lonaer_date_Num__c = 1;  // 希望借用天数
        raObj.Phone_number__c = '1234567890';
        raObj.Campaign__c = cam.Id;
        raObj.SupplementCreated__c = true;
        insert raObj;

        Test.startTest();
        OpdPlanWebService.test();
        OpdPlanWebService.changeCampaign(cam.id);
        OpdPlanWebService.dataCheck(raObj.Id);
        OpdPlanWebService.raesCountCheck(raObj.Id);
        Test.stopTest();

    }

}