@isTest
public with sharing class ConsumableOrderMinorBatchTest {
    public ConsumableOrderMinorBatchTest() {

    }

    @isTest
    static void test(){
        StaticParameter.ConsumableAssetHanderTrigger = true;
        // 消耗品明细2
        Consumable_order_details2__c cod = new Consumable_order_details2__c();
        cod.SerialLotNo__c  = '86K';
        cod.TracingCode__c = 'EPWBM';
        cod.TextName__c = '';
        cod.Bar_Code__c = '011495317032589911180600172105001086K250EPWBM';
        insert cod;
        System.debug('cod+++++'+cod);

        // 保有设备
        Asset sobj = new Asset(
            New_logic_data__c = false,                                      // New logic data
            Status = '不明',                                                  // 状态
            unknow_serial_NO_product__c = false,                            // 无机身号码设备
            IsCompetitorProduct = false,                                    // 竞争对手产品
            Request_manager_deleter_manaual_input__c = false,               // 申请手动输入产品删掉
            sorc__c = false,                                                // 品质问题_直送SORC修理
            Product2Id = '01t10000000TiaE',                                 // 产品
            SerialNumber = '86K(EPWBM)',                                    // 机身编码
            Barcode__c = '011495317032589911180600172105311086K250EPWBM',   // Barcode(后五位为管理编码）
            Hospital__c = '0011000000V9Qaj',                                // 医院
            Backorder__c = 'a0N10000014H8au',                               // 销售凭证号
            Order_No__c = 'SH-ET-181244',                                   // 合同编码
            AccountId = '0011000000VAHEW',                                  // 客户
            Asset_Owner__c = '医院资产',                                        // 资产所属
            Posting_Date__c = Date.valueOf('2018-09-03'),                   // 发货日
            DeliveryNote__c = '0065149419',                                 // 发货单
            Guarantee_period_for_products__c = Date.valueOf('2018-09-03'),  // 保修期限
            WarrantyChanges__c = false,                                     // 保修期限变更
            EGFlg_fromContract_asset__c = false,                            // 新合同备品确保提供
            CIC_call_back_check__c = false,                                 // 安装状态确认
            Delete_Flag__c = false,                                         // 逻辑删除
            Return_Flag__c = false,                                         // 退货Flag
            AssetMark__c = '耗材',                                            // 保有设备标记
            Name = 'KD-612L:一次性使用黏膜切开刀',                                    // 保有设备名
            RemarkFlg__c = false,                                           // 联络栏更新
            Product_Serial_No__c = 'N4468930:86K(EPWBM)',                   // 产品 + 机体编码
            IF_Information_From__c = true,                                  // IF信息来源
            Tracing_Information_From__c = true                             // 追溯系统信息来源
        );
        insert sobj;
        
        System.Test.startTest();
        List<String> ids = new List<String>();
        ids.add(cod.id);
        Database.executeBatch(new ConsumableOrderMinorBatch(ids));
        System.Test.stopTest();
        cod = [select id,sNo__c,TextName__c,Agencyinfo_fromSAP__c,TracingCode__c,Bar_Code__c,Consumable_order_minor__c from Consumable_order_details2__c where id = :cod.id];
        System.debug('asset++'+sobj.Id);
        System.debug('cod+++++22'+cod);
    }

}