@isTest
private class ConsumApplyEquipmentSetDetailHandlerTest {

    @TestSetup
    static void setTestData(){
        StaticParameter.EscapeNFM001AgencyContractTrigger = true;
        StaticParameter.EscapeNFM001Trigger = true;
        StaticParameter.EscapeAccountTrigger = true;
        ControllerUtil.EscapeNFM001Trigger = true;

        Oly_TriggerHandler.bypass(ContactTriggerHandler.class.getName());
        Oly_TriggerHandler.bypass(AgencyHospitalHandler.class.getName());
        // 省
        Address_Level__c al = new Address_Level__c();
        al.Name = '東京';
        al.Level1_Code__c = 'CN-99';
        al.Level1_Sys_No__c = '999999';
        insert al;
        // 市
        Address_Level2__c al2 = new Address_Level2__c();
        al2.Level1_Code__c = 'CN-99';
        al2.Level1_Sys_No__c = '999999';
        al2.Level1_Name__c = '東京';
        al2.Name = '渋谷区';
        al2.Level2_Code__c = 'CN-9999';
        al2.Level2_Sys_No__c = '9999999';
        al2.Address_Level__c = al.id;
        insert al2;
        // 病院を作る
        Account hospital = new Account();
        hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id;
        hospital.Name = 'test hospital';
        hospital.Is_Active__c = '有効';
        hospital.Attribute_Type__c = '卫生部';
        hospital.Speciality_Type__c = '综合医院';
        hospital.Grade__c = '一级';
        hospital.OCM_Category__c = 'SLTV';
        hospital.Is_Medical__c = '医疗机构';
        hospital.State_Master__c = al.id;
        hospital.City_Master__c = al2.id;
        hospital.Town__c = '东京';
        insert hospital;

        // 戦略科室を得る
        Account strategicDep = new Account();
        strategicDep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_Class_OTH'].id;
        strategicDep.Name = 'Olympus社内 其他';
        strategicDep.Department_Class_Label__c = '其他';
        strategicDep.Hospital__c = hospital.Id;
        strategicDep.ParentId = hospital.Id;
        insert strategicDep;

        // 診療科を作る
        Account dep = new Account();
        dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_OTH'].id;
        dep.Name = 'test dep';
        dep.AgentCode_Ext__c = '9999998';
        dep.ParentId = strategicDep.Id;
        dep.Department_Class__c = strategicDep.Id;
        dep.Hospital__c = hospital.Id;
        insert dep;

        // 产品
        Product2 pro1 = new Product2(Name='name01',IsActive=true,Family='GI',
                Fixture_Model_No__c='n01',Serial_Lot_No__c='S/N tracing',
                Fixture_Model_No_T__c = 'n01', Asset_Model_No__c = 'Pro1',
                ProductCode_Ext__c='pc01',Manual_Entry__c=false);
        Product2 pro2 = new Product2(Name='name02',IsActive=true,Family='GI',
                Fixture_Model_No__c='n02',Serial_Lot_No__c='Lot tracing',
                Fixture_Model_No_T__c = 'n02', Asset_Model_No__c = 'Pro2',
                ProductCode_Ext__c='pc02',Manual_Entry__c=false);

        insert new Product2[] {pro1, pro2};
        Asset asset2 = new Asset(Asset_Owner__c = 'Olympus');
        asset2.RecordTypeId = System.Label.Asset_RecordType;
        asset2.SerialNumber = 'asset2';
        asset2.Name = 'asset2';
        asset2.AccountId = dep.Id;
        asset2.Department_Class__c = strategicDep.Id;
        asset2.Hospital__c = hospital.Id;
        asset2.Product2Id = pro2.Id;
        asset2.Quantity = 100;
        asset2.Status = '不明';
        asset2.Manage_type__c = '数量管理';
        asset2.Loaner_accsessary__c = true;
        asset2.Out_of_wh__c = 1;
        asset2.Salesdepartment__c = '1.华北营业本部';
        asset2.Internal_asset_location__c = '北京 备品中心';
        asset2.Product_category__c = 'GI';
        asset2.Equipment_Type__c = '产品试用';
        asset2.SalesProvince__c = '北京';
        asset2.CompanyOfEquipment__c = '北京';
        asset2.Internal_Asset_number__c = '0002';
        asset2.AssetManageConfirm__c = true;

        insert asset2;
        Consum_Apply__c ca = new Consum_Apply__c();
        ca.Name = 'XXXX-YYYY_ZZZZ_1';
        ca.Status__c = '批准';
        ca.DataMigration_Flag__c = true;
        insert ca;
        Consum_Apply_Equipment_Set__c caes = new Consum_Apply_Equipment_Set__c();
        caes.Consum_Apply__c = ca.Id;
        caes.Consum_Start_Date__c = Date.today().addDays(20);
        caes.DataMigration_Flag__c = true;
        insert caes;
       
        Consum_Apply_Equipment_Set_Detail__c caesd = new Consum_Apply_Equipment_Set_Detail__c();
        caesd.Name = 'test';
        caesd.Shipment_request_time2__c = System.now();
        caesd.DataMigration_Flag__c = false;
        caesd.Consum_Apply__c = ca.Id;
        caesd.Consum_Apply_Equipment_Set__c = caes.Id;
        caesd.Consum_Start_Date__c = caes.Consum_Start_Date__c;
        caesd.Trial_User__c = '我';
        caesd.Asset__c = asset2.id;
        caesd.IndexFromUniqueKey__c = 0;
        caesd.UniqueKey__c = '123';
        caesd.Cancel_Select__c = false;
        caesd.Follower_User__c = UserInfo.getUserId();
        insert caesd; // 草案中
    }
    // @isTest static testMethod void testTest1() {
    //     System.Test.startTest();
    //     Consum_Apply__c ca = new Consum_Apply__c();
    //     ca.DataMigration_Flag__c = true;
    //     insert ca;
    //     Consum_Apply_Equipment_Set__c caes = new Consum_Apply_Equipment_Set__c();
    //     caes.Consum_Apply__c = ca.Id;
    //     caes.Consum_Start_Date__c = Date.today().addDays(20);
    //     caes.DataMigration_Flag__c = true;
    //     insert caes;
    //     Consum_Apply_Equipment_Set_Detail__c caesd = new Consum_Apply_Equipment_Set_Detail__c();
    //     caesd.DataMigration_Flag__c = true;
    //     caesd.Consum_Apply__c = ca.Id;
    //     caesd.Consum_Apply_Equipment_Set__c = caes.Id;
    //     caesd.Consum_Start_Date__c = caes.Consum_Start_Date__c;
    //     caesd.Trial_User__c = '我';
    //     caesd.Follower_User__c = UserInfo.getUserId();
    //     insert caesd; // 草案中
    //     Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c where Id =: caesd.id];
    //     FixtureDeliverySlip__c fdsObj = new FixtureDeliverySlip__c();
    //     fdsObj.Name = '00001';
    //     fdsObj.DeliveryCompany__c = '利讯';
    //     fdsObj.Distributor_method__c = '陆运';
    //     fdsObj.DeliveryType__c = '回寄';
    //     fdsObj.Wh_Staff__c = Userinfo.getUserId();
    //     fdsObj.Shippment_loaner_time__c = System.now();
    //     insert fdsObj;
    //     ncaesd.Return_DeliverySlip__c = fdsObj.Id;
    //     update ncaesd;
    //     delete caesd;
    //     delete caes;
    //     delete ca;
    //     System.Test.stopTest();
    // }

    @isTest static void test1(){
        OlympusCalendar__c olympus_calendar = new OlympusCalendar__c();
        olympus_calendar.Date__c = System.today().addDays(10);
        olympus_calendar.OwnerId = UserInfo.getUserId();
        insert olympus_calendar;
        FixtureDeliverySlip__c fdsObj1 = new FixtureDeliverySlip__c();
        fdsObj1.Name = '00001';
        fdsObj1.DeliveryCompany__c = '利讯';
        fdsObj1.Distributor_method__c = '陆运';
        fdsObj1.DeliveryType__c = '回寄';
        fdsObj1.Wh_Staff__c = Userinfo.getUserId();
        fdsObj1.Shippment_loaner_time__c = System.now();
        insert fdsObj1;
        FixtureDeliverySlip__c fdsObj2 = new FixtureDeliverySlip__c();
        fdsObj2.Name = '00002';
        fdsObj2.DeliveryCompany__c = '利讯';
        fdsObj2.Distributor_method__c = '陆运';
        fdsObj2.DeliveryType__c = '发货';
        fdsObj2.Wh_Staff__c = Userinfo.getUserId();
        fdsObj2.Shippment_loaner_time__c = System.now();
        insert fdsObj2;
        Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
        ncaesd.Received_Confirm__c = 'OK';
        ncaesd.Return_DeliverySlip__c = fdsObj1.id;
        ncaesd.DeliverySlip__c = fdsObj2.id;
        ncaesd.Consum_Start_Date__c = System.today().addDays(10);
        ncaesd.Select_Time__c = System.now();
        update ncaesd;
        ConsumApplyEquipmentSetDetailHandler.test();
    }
    @isTest static void testTest2() {
        FixtureDeliverySlip__c fdsObj1 = new FixtureDeliverySlip__c();
        fdsObj1.Name = '00001';
        fdsObj1.DeliveryCompany__c = '利讯';
        fdsObj1.Distributor_method__c = '陆运';
        fdsObj1.DeliveryType__c = '回寄';
        fdsObj1.Wh_Staff__c = Userinfo.getUserId();
        fdsObj1.Shippment_loaner_time__c = System.now();
        insert fdsObj1;
        FixtureDeliverySlip__c fdsObj2 = new FixtureDeliverySlip__c();
        fdsObj2.Name = '00002';
        fdsObj2.DeliveryCompany__c = '利讯';
        fdsObj2.Distributor_method__c = '陆运';
        fdsObj2.DeliveryType__c = '发货';
        fdsObj2.Wh_Staff__c = Userinfo.getUserId();
        fdsObj2.Shippment_loaner_time__c = System.now();
        insert fdsObj2;
        Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
        ncaesd.Received_Confirm__c = 'OK';
        ncaesd.Return_DeliverySlip__c = fdsObj1.id;
        ncaesd.DeliverySlip__c = fdsObj2.id;
        update ncaesd;
        ncaesd.Received_Confirm__c = '';
        ncaesd.Asset_Center_Confirm__c = 'Ok';
        ncaesd.Inspection_result__c = 'Ok';
        ncaesd.Check_lost_Item_Final__c = '消耗';
        ncaesd.Check_lost_Item__c = '消耗';
        ncaesd.Inspection_result_after_Final__c = 'OK';
        ncaesd.Inspection_result_after__c = 'OK';
        ncaesd.Cancel_Select__c = true;
        ncaesd.StockDown__c = true;
        ncaesd.NG_Select_Again__C = false;
        ncaesd.Cancel_Reason__c = '主动取消';
        update ncaesd;
        delete ncaesd;
    }

    @isTest static void testTest3(){
        Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
        ncaesd.Check_lost_Item_Final__c = 'OK';
        ncaesd.Asset__c = null;
        update ncaesd;
        ncaesd.Lost_item_giveup__c = false;
        ncaesd.Check_lost_Item_Final__c = '欠品';
        update ncaesd;
    }

    @isTest static void testTest4(){
        Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
        ncaesd.Check_lost_Item_Final__c = '';
        update ncaesd;
        ncaesd.Lost_item_giveup__c = false;
        ncaesd.Check_lost_Item_Final__c = '欠品';
        update ncaesd;
    }

    @isTest static void testTest5(){
        Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
        ncaesd.Check_lost_Item_Final__c = '';
        ncaesd.Confirm_Lost_Date__c = System.today();
        update ncaesd;
        ncaesd.Lost_item_giveup__c = true;
        ncaesd.Check_lost_Item_Final__c = '欠品';
        update ncaesd;
    }

    @isTest static void testTest6(){
        Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
        ncaesd.Check_lost_Item_Final__c = '';
        update ncaesd;
        ncaesd.Lost_item_giveup__c = true;
        ncaesd.Check_lost_Item_Final__c = '消耗';
        update ncaesd;
    }

    @isTest static void testTest7(){
        Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
        ncaesd.Check_lost_Item_Final__c = 'OK';
        ncaesd.Confirm_Lost_Date__c = System.today();
        update ncaesd;
        ncaesd.Lost_item_giveup__c = true;
        ncaesd.Check_lost_Item_Final__c = '欠品';
        update ncaesd;
    }

    @isTest static void testTest8(){
        Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
        ncaesd.Check_lost_Item_Final__c = 'OK';
        update ncaesd;
        ncaesd.Lost_item_giveup__c = false;
        ncaesd.Check_lost_Item_Final__c = '欠品';
        update ncaesd;
    }

    @isTest static void testTest9(){
        Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
        ncaesd.Check_lost_Item_Final__c = 'OK';
        update ncaesd;
        ncaesd.Check_lost_Item_Final__c = '消耗';
        update ncaesd;
    }

    @isTest static void testTest10(){
        Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
        ncaesd.Check_lost_Item_Final__c = '欠品';
        ncaesd.Lost_item_giveup__c = false;
        ncaesd.Confirm_Lost_Date__c = System.today();
        update ncaesd;
        ncaesd.Check_lost_Item_Final__c = '';
        update ncaesd;
    }

    @isTest static void testTest11(){
        Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
        ncaesd.Check_lost_Item_Final__c = '欠品';
        ncaesd.Lost_item_giveup__c = false;
        ncaesd.Confirm_Lost_Date__c = System.today();
        update ncaesd;
        ncaesd.Check_lost_Item_Final__c = 'OK';
        update ncaesd;
    }

    @isTest static void testTest12(){
        Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
        ncaesd.Check_lost_Item_Final__c = '欠品';
        ncaesd.Lost_item_giveup__c = false;
        ncaesd.Confirm_Lost_Date__c = System.today();
        update ncaesd;
        ncaesd.Lost_item_giveup__c = false;
        update ncaesd;
    }

    @isTest static void testTest13(){
        Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
        ncaesd.Check_lost_Item_Final__c = '欠品';
        ncaesd.Lost_item_giveup__c = false;
        ncaesd.Confirm_Lost_Date__c = System.today();
        update ncaesd;
        ncaesd.Check_lost_Item_Final__c = '消耗';
        update ncaesd;
    }

    @isTest static void testTest14(){
        Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
        ncaesd.DataMigration_Flag__c  = true;
        ncaesd.Check_lost_Item_Final__c = '欠品';
        ncaesd.Lost_item_giveup__c = true;
        update ncaesd;
        ncaesd.Lost_item_giveup__c = false;
        ncaesd.Check_lost_Item_Final__c = '';
        update ncaesd;
    }

    @isTest static void testTest15(){
        Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
        ncaesd.DataMigration_Flag__c = true;
        ncaesd.Check_lost_Item_Final__c = '欠品';
        ncaesd.Lost_item_giveup__c = true;
        update ncaesd;
        ncaesd.Lost_item_giveup__c = false;
        ncaesd.Check_lost_Item_Final__c = 'OK';
        update ncaesd;
    }

    @isTest static void testTest16(){
        Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
        ncaesd.DataMigration_Flag__c = true;
        ncaesd.Check_lost_Item_Final__c = '欠品';
        ncaesd.Lost_item_giveup__c = true;
        update ncaesd;
        ncaesd.Lost_item_giveup__c = false;
        ncaesd.Check_lost_Item_Final__c = '消耗';
        update ncaesd;
    }

    @isTest static void testTest17(){
        Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
        ncaesd.DataMigration_Flag__c = true;
        ncaesd.Check_lost_Item_Final__c = '消耗';
        update ncaesd;
        ncaesd.Check_lost_Item_Final__c = '';
        update ncaesd;
    }


    @isTest static void testTest18(){
        Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
        ncaesd.DataMigration_Flag__c = true;
        ncaesd.Check_lost_Item_Final__c = '消耗';
        update ncaesd;
        ncaesd.Check_lost_Item_Final__c = 'OK';
        update ncaesd;
    }

    @isTest static void testTest19(){
        Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
        ncaesd.DataMigration_Flag__c = true;
        ncaesd.Check_lost_Item_Final__c = '消耗';
        update ncaesd;
        ncaesd.Check_lost_Item_Final__c = '欠品';
        ncaesd.Lost_item_giveup__c = false;
        update ncaesd;
    }

    @isTest static void testTest20(){
        Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
        ncaesd.DataMigration_Flag__c = true;
        ncaesd.Check_lost_Item_Final__c = '消耗';
        update ncaesd;
        ncaesd.Check_lost_Item_Final__c = '欠品';
        ncaesd.Lost_item_giveup__c = true;
        update ncaesd;
    }


    @isTest static void testTest21(){
        Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
        ncaesd.Arrival_in_wh__c = false;
        update ncaesd;
        ncaesd.Arrival_in_wh__c = true;
        ncaesd.Inspection_result_NG__c = '废弃';
        update ncaesd;
    }

    @isTest static void testTest22(){
        Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
        ncaesd.Arrival_in_wh__c = true;
        ncaesd.DataMigration_Flag__c = true;
        ncaesd.Inspection_result_NG__c = '废弃';
        update ncaesd;
        ncaesd.Arrival_in_wh__c = false;
        update ncaesd;
    }

    // @isTest static void testTest5(){
    //     FixtureDeliverySlip__c fdsObj1 = new FixtureDeliverySlip__c();
    //     fdsObj1.Name = '00001';
    //     fdsObj1.DeliveryCompany__c = '利讯';
    //     fdsObj1.Distributor_method__c = '陆运';
    //     fdsObj1.DeliveryType__c = '回寄';
    //     fdsObj1.Wh_Staff__c = Userinfo.getUserId();
    //     fdsObj1.Shippment_loaner_time__c = System.now();
    //     insert fdsObj1;
    //     FixtureDeliverySlip__c fdsObj2 = new FixtureDeliverySlip__c();
    //     fdsObj2.Name = '00002';
    //     fdsObj2.DeliveryCompany__c = '利讯';
    //     fdsObj2.Distributor_method__c = '陆运';
    //     fdsObj2.DeliveryType__c = '发货';
    //     fdsObj2.Wh_Staff__c = Userinfo.getUserId();
    //     fdsObj2.Shippment_loaner_time__c = System.now();
    //     insert fdsObj2;
    //     Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
    //     ncaesd.Shipment_request_time2__c = System.now();
    //     ncaesd.Return_DeliverySlip__c = fdsObj1.Id;
    //     ncaesd.DeliverySlip__c = fdsObj2.Id;
    //     update ncaesd;
    //     ncaesd.Received_Confirm__c = 'OK';
    //     update ncaesd;
    //     ncaesd.Received_Confirm__c = '';
    //     ncaesd.Asset_Center_Confirm__c = 'Ok';
    //     ncaesd.Inspection_result__c = 'Ok';
    //     ncaesd.Check_lost_Item_Final__c = '消耗';
    //     ncaesd.Check_lost_Item__c = '消耗';
    //     ncaesd.Inspection_result_after_Final__c = 'OK';
    //     ncaesd.Inspection_result_after__c = 'OK';
    //     ncaesd.Cancel_Select__c = true;
    //     ncaesd.StockDown__c = true;
    //     ncaesd.NG_Select_Again__C = false;
    //     ncaesd.Cancel_Reason__c = '主动取消';
    //     update ncaesd;
    //     ncaesd.Check_lost_Item_Final__c = '欠品';
    //     update ncaesd;
    //     ncaesd.Check_lost_Item_Final__c = '';
    //     update ncaesd;
    // }

    // @isTest static void testTest6(){
    //     FixtureDeliverySlip__c fdsObj1 = new FixtureDeliverySlip__c();
    //     fdsObj1.Name = '00001';
    //     fdsObj1.DeliveryCompany__c = '利讯';
    //     fdsObj1.Distributor_method__c = '陆运';
    //     fdsObj1.DeliveryType__c = '回寄';
    //     fdsObj1.Wh_Staff__c = Userinfo.getUserId();
    //     fdsObj1.Shippment_loaner_time__c = System.now();
    //     insert fdsObj1;
    //     FixtureDeliverySlip__c fdsObj2 = new FixtureDeliverySlip__c();
    //     fdsObj2.Name = '00002';
    //     fdsObj2.DeliveryCompany__c = '利讯';
    //     fdsObj2.Distributor_method__c = '陆运';
    //     fdsObj2.DeliveryType__c = '发货';
    //     fdsObj2.Wh_Staff__c = Userinfo.getUserId();
    //     fdsObj2.Shippment_loaner_time__c = System.now();
    //     insert fdsObj2;
    //     Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
    //     ncaesd.Shipment_request_time2__c = System.now();
    //     ncaesd.Return_DeliverySlip__c = fdsObj1.Id;
    //     ncaesd.DeliverySlip__c = fdsObj2.Id;
    //     update ncaesd;
    //     ncaesd.Received_Confirm__c = 'OK';
    //     update ncaesd;
    //     ncaesd.Received_Confirm__c = '';
    //     ncaesd.Asset_Center_Confirm__c = 'Ok';
    //     ncaesd.Inspection_result__c = 'Ok';
    //     ncaesd.Check_lost_Item_Final__c = '消耗';
    //     ncaesd.Check_lost_Item__c = '消耗';
    //     ncaesd.Inspection_result_after_Final__c = 'OK';
    //     ncaesd.Inspection_result_after__c = 'OK';
    //     ncaesd.Cancel_Select__c = true;
    //     ncaesd.StockDown__c = true;
    //     ncaesd.NG_Select_Again__C = false;
    //     ncaesd.Cancel_Reason__c = '主动取消';
    //     update ncaesd;
    //     ncaesd.Check_lost_Item_Final__c = '欠品';
    //     update ncaesd;
    //     ncaesd.Check_lost_Item_Final__c = 'OK';
    //     update ncaesd;
    // }


    // @isTest static void testTest7(){
    //     FixtureDeliverySlip__c fdsObj1 = new FixtureDeliverySlip__c();
    //     fdsObj1.Name = '00001';
    //     fdsObj1.DeliveryCompany__c = '利讯';
    //     fdsObj1.Distributor_method__c = '陆运';
    //     fdsObj1.DeliveryType__c = '回寄';
    //     fdsObj1.Wh_Staff__c = Userinfo.getUserId();
    //     fdsObj1.Shippment_loaner_time__c = System.now();
    //     insert fdsObj1;
    //     FixtureDeliverySlip__c fdsObj2 = new FixtureDeliverySlip__c();
    //     fdsObj2.Name = '00002';
    //     fdsObj2.DeliveryCompany__c = '利讯';
    //     fdsObj2.Distributor_method__c = '陆运';
    //     fdsObj2.DeliveryType__c = '发货';
    //     fdsObj2.Wh_Staff__c = Userinfo.getUserId();
    //     fdsObj2.Shippment_loaner_time__c = System.now();
    //     insert fdsObj2;
    //     Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
    //     ncaesd.Shipment_request_time2__c = System.now();
    //     ncaesd.Return_DeliverySlip__c = fdsObj1.Id;
    //     ncaesd.DeliverySlip__c = fdsObj2.Id;
    //     update ncaesd;
    //     ncaesd.Received_Confirm__c = 'OK';
    //     update ncaesd;
    //     ncaesd.Received_Confirm__c = '';
    //     ncaesd.Asset_Center_Confirm__c = 'Ok';
    //     ncaesd.Inspection_result__c = 'Ok';
    //     ncaesd.Check_lost_Item_Final__c = '消耗';
    //     ncaesd.Check_lost_Item__c = '消耗';
    //     ncaesd.Inspection_result_after_Final__c = 'OK';
    //     ncaesd.Inspection_result_after__c = 'OK';
    //     ncaesd.Cancel_Select__c = true;
    //     ncaesd.StockDown__c = true;
    //     ncaesd.NG_Select_Again__C = false;
    //     ncaesd.Cancel_Reason__c = '主动取消';
    //     update ncaesd;
    //     ncaesd.Check_lost_Item_Final__c = '欠品';
    //     ncaesd.Lost_item_giveup__c = false;
    //     update ncaesd;
    //     ncaesd.Lost_item_giveup__c = true;
    //     update ncaesd;
    // }

    // @isTest static void testTest8(){
    //     FixtureDeliverySlip__c fdsObj1 = new FixtureDeliverySlip__c();
    //     fdsObj1.Name = '00001';
    //     fdsObj1.DeliveryCompany__c = '利讯';
    //     fdsObj1.Distributor_method__c = '陆运';
    //     fdsObj1.DeliveryType__c = '回寄';
    //     fdsObj1.Wh_Staff__c = Userinfo.getUserId();
    //     fdsObj1.Shippment_loaner_time__c = System.now();
    //     insert fdsObj1;
    //     FixtureDeliverySlip__c fdsObj2 = new FixtureDeliverySlip__c();
    //     fdsObj2.Name = '00002';
    //     fdsObj2.DeliveryCompany__c = '利讯';
    //     fdsObj2.Distributor_method__c = '陆运';
    //     fdsObj2.DeliveryType__c = '发货';
    //     fdsObj2.Wh_Staff__c = Userinfo.getUserId();
    //     fdsObj2.Shippment_loaner_time__c = System.now();
    //     insert fdsObj2;
    //     Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
    //     ncaesd.Shipment_request_time2__c = System.now();
    //     ncaesd.Return_DeliverySlip__c = fdsObj1.Id;
    //     ncaesd.DeliverySlip__c = fdsObj2.Id;
    //     update ncaesd;
    //     ncaesd.Received_Confirm__c = 'OK';
    //     update ncaesd;
    //     ncaesd.Received_Confirm__c = '';
    //     ncaesd.Asset_Center_Confirm__c = 'Ok';
    //     ncaesd.Inspection_result__c = 'Ok';
    //     ncaesd.Check_lost_Item_Final__c = '消耗';
    //     ncaesd.Check_lost_Item__c = '消耗';
    //     ncaesd.Inspection_result_after_Final__c = 'OK';
    //     ncaesd.Inspection_result_after__c = 'OK';
    //     ncaesd.Cancel_Select__c = true;
    //     ncaesd.StockDown__c = true;
    //     ncaesd.NG_Select_Again__C = false;
    //     ncaesd.Cancel_Reason__c = '主动取消';
    //     update ncaesd;
    //     ncaesd.Check_lost_Item_Final__c = '消耗';
    //     ncaesd.Lost_item_giveup__c = false;
    //     update ncaesd;
    //     ncaesd.Check_lost_Item_Final__c = '';
    //     ncaesd.Lost_item_giveup__c = true;
    //     update ncaesd;
    // }

    // @isTest static void testTest9(){
    //     FixtureDeliverySlip__c fdsObj1 = new FixtureDeliverySlip__c();
    //     fdsObj1.Name = '00001';
    //     fdsObj1.DeliveryCompany__c = '利讯';
    //     fdsObj1.Distributor_method__c = '陆运';
    //     fdsObj1.DeliveryType__c = '回寄';
    //     fdsObj1.Wh_Staff__c = Userinfo.getUserId();
    //     fdsObj1.Shippment_loaner_time__c = System.now();
    //     insert fdsObj1;
    //     FixtureDeliverySlip__c fdsObj2 = new FixtureDeliverySlip__c();
    //     fdsObj2.Name = '00002';
    //     fdsObj2.DeliveryCompany__c = '利讯';
    //     fdsObj2.Distributor_method__c = '陆运';
    //     fdsObj2.DeliveryType__c = '发货';
    //     fdsObj2.Wh_Staff__c = Userinfo.getUserId();
    //     fdsObj2.Shippment_loaner_time__c = System.now();
    //     insert fdsObj2;
    //     Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
    //     ncaesd.Shipment_request_time2__c = System.now();
    //     ncaesd.Return_DeliverySlip__c = fdsObj1.Id;
    //     ncaesd.DeliverySlip__c = fdsObj2.Id;
    //     update ncaesd;
    //     ncaesd.Received_Confirm__c = 'OK';
    //     update ncaesd;
    //     ncaesd.Received_Confirm__c = '';
    //     ncaesd.Asset_Center_Confirm__c = 'Ok';
    //     ncaesd.Inspection_result__c = 'Ok';
    //     ncaesd.Check_lost_Item_Final__c = '消耗';
    //     ncaesd.Check_lost_Item__c = '消耗';
    //     ncaesd.Inspection_result_after_Final__c = 'OK';
    //     ncaesd.Inspection_result_after__c = 'OK';
    //     ncaesd.Cancel_Select__c = true;
    //     ncaesd.StockDown__c = true;
    //     ncaesd.NG_Select_Again__C = false;
    //     ncaesd.Cancel_Reason__c = '主动取消';
    //     update ncaesd;
    //     ncaesd.Check_lost_Item_Final__c = '欠品';
    //     update ncaesd;
    //     ncaesd.Check_lost_Item_Final__c = 'OK';
    //     update ncaesd;
    // }


    // @isTest static void testTest10(){
    //     FixtureDeliverySlip__c fdsObj1 = new FixtureDeliverySlip__c();
    //     fdsObj1.Name = '00001';
    //     fdsObj1.DeliveryCompany__c = '利讯';
    //     fdsObj1.Distributor_method__c = '陆运';
    //     fdsObj1.DeliveryType__c = '回寄';
    //     fdsObj1.Wh_Staff__c = Userinfo.getUserId();
    //     fdsObj1.Shippment_loaner_time__c = System.now();
    //     insert fdsObj1;
    //     FixtureDeliverySlip__c fdsObj2 = new FixtureDeliverySlip__c();
    //     fdsObj2.Name = '00002';
    //     fdsObj2.DeliveryCompany__c = '利讯';
    //     fdsObj2.Distributor_method__c = '陆运';
    //     fdsObj2.DeliveryType__c = '发货';
    //     fdsObj2.Wh_Staff__c = Userinfo.getUserId();
    //     fdsObj2.Shippment_loaner_time__c = System.now();
    //     insert fdsObj2;
    //     Consum_Apply_Equipment_Set_Detail__c ncaesd = [select Return_DeliverySlip__c from Consum_Apply_Equipment_Set_Detail__c limit 1];
    //     ncaesd.Shipment_request_time2__c = System.now();
    //     ncaesd.Return_DeliverySlip__c = fdsObj1.Id;
    //     ncaesd.DeliverySlip__c = fdsObj2.Id;
    //     update ncaesd;
    //     ncaesd.Received_Confirm__c = 'OK';
    //     update ncaesd;
    //     ncaesd.Received_Confirm__c = '';
    //     ncaesd.Asset_Center_Confirm__c = 'Ok';
    //     ncaesd.Inspection_result__c = 'Ok';
    //     ncaesd.Check_lost_Item_Final__c = '消耗';
    //     ncaesd.Check_lost_Item__c = '消耗';
    //     ncaesd.Inspection_result_after_Final__c = 'OK';
    //     ncaesd.Inspection_result_after__c = 'OK';
    //     ncaesd.Cancel_Select__c = true;
    //     ncaesd.StockDown__c = true;
    //     ncaesd.NG_Select_Again__C = false;
    //     ncaesd.Cancel_Reason__c = '主动取消';
    //     update ncaesd;
    //     ncaesd.Check_lost_Item_Final__c = '欠品';
    //     update ncaesd;
    //     ncaesd.Lost_item_giveup__c = false;
    //     update ncaesd;
    // }
    

    // static testMethod void testTest2() {
    //     Consum_Apply__c ca = new Consum_Apply__c();
    //     ca.DataMigration_Flag__c = true;
    //     insert ca;
    //     Consum_Apply_Equipment_Set__c caes = new Consum_Apply_Equipment_Set__c();
    //     caes.Consum_Apply__c = ca.Id;
    //     caes.Consum_Start_Date__c = Date.today().addDays(20);
    //     caes.DataMigration_Flag__c = true;
    //     insert caes;
    //     Consum_Apply_Equipment_Set_Detail__c caesd = new Consum_Apply_Equipment_Set_Detail__c();
    //     caesd.DataMigration_Flag__c = true;
    //     caesd.Consum_Apply__c = ca.Id;
    //     caesd.Consum_Apply_Equipment_Set__c = caes.Id;
    //     caesd.Consum_Start_Date__c = caes.Consum_Start_Date__c;
    //     caesd.Trial_User__c = '我';
    //     caesd.Follower_User__c = UserInfo.getUserId();
    //     insert caesd; // 草案中
        
    //     System.Test.stopTest();
    // }

    // static testMethod void testTest3() {
    //     System.Test.startTest();
    //     Consum_Apply__c ca = new Consum_Apply__c();
    //     ca.DataMigration_Flag__c = true;
    //     insert ca;
    //     Consum_Apply_Equipment_Set__c caes = new Consum_Apply_Equipment_Set__c();
    //     caes.Consum_Apply__c = ca.Id;
    //     caes.Consum_Start_Date__c = Date.today().addDays(20);
    //     caes.DataMigration_Flag__c = true;
    //     insert caes;
    //     Consum_Apply_Equipment_Set_Detail__c caesd = new Consum_Apply_Equipment_Set_Detail__c();
    //     caesd.DataMigration_Flag__c = true;
    //     caesd.Consum_Apply__c = ca.Id;
    //     caesd.Consum_Apply_Equipment_Set__c = caes.Id;
    //     caesd.Consum_Start_Date__c = caes.Consum_Start_Date__c;
    //     caesd.Trial_User__c = '我';
    //     caesd.Follower_User__c = UserInfo.getUserId();
    //     insert caesd; // 草案中
    //     System.Test.stopTest();
    // }
   
   
}