@isTest
public class LogAutoSendBatchTest {

    static Account company;
    static Account section1;        // 呼吸科
    static Account section2;        // 消化科
    static Account olympus;
    static Account olympus1;        // 呼吸科
    static Account olympus2;        // 消化科
    static Account depart1;
    static Account depart2;

    static void initHpData() {
        StaticParameter.EscapeNFM007Trigger = true;
        ControllerUtil.EscapeNFM001Trigger = true;
        RecordType rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
        RecordType rectDpt1 = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '診療科 呼吸科'];
        RecordType rectDpt2 = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '診療科 消化科'];
        // テストデータ
        company = new Account(RecordTypeId = rectCo.Id, Name = 'NFM110TestCompany');
        olympus = new Account(RecordTypeId = rectCo.Id, AgentCode_Ext__c = '9999999', Name = 'olympus');
        insert new Account[] {company, olympus};
        // company = [select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where Id =:company.Id];
        // section1 = [select Management_Code__c, Management_Code_Auto__c, Name, Id, Department_Class_Label__c from Account where ParentId =:company.Id and RecordType.name = '戦略科室分類 呼吸科'];
        // section2 = [select Management_Code__c, Management_Code_Auto__c, Name, Id, Department_Class_Label__c from Account where ParentId =:company.Id and RecordType.name = '戦略科室分類 消化科'];
        // olympus1 = [select Management_Code__c, Management_Code_Auto__c, Name, Id, Department_Class_Label__c from Account where ParentId =:olympus.Id and RecordType.name = '戦略科室分類 呼吸科'];
        // olympus2 = [select Management_Code__c, Management_Code_Auto__c, Name, Id, Department_Class_Label__c from Account where ParentId =:olympus.Id and RecordType.name = '戦略科室分類 消化科'];
        company = [select Management_Code__c, Name, Id from Account where Id =:company.Id];
        section1 = [select Management_Code__c, Name, Id, Department_Class_Label__c from Account where ParentId =:company.Id and RecordType.name = '戦略科室分類 呼吸科'];
        section2 = [select Management_Code__c, Name, Id, Department_Class_Label__c from Account where ParentId =:company.Id and RecordType.name = '戦略科室分類 消化科'];
        olympus1 = [select Management_Code__c, Name, Id, Department_Class_Label__c from Account where ParentId =:olympus.Id and RecordType.name = '戦略科室分類 呼吸科'];
        olympus2 = [select Management_Code__c, Name, Id, Department_Class_Label__c from Account where ParentId =:olympus.Id and RecordType.name = '戦略科室分類 消化科'];
System.debug('section1.Department_Class_Label__c='+section1.Department_Class_Label__c);
System.debug('section2.Department_Class_Label__c='+section2.Department_Class_Label__c);
        depart1 = new Account(RecordTypeId = rectDpt1.Id, Name = '*', ParentId  = section1.Id, Department_Class__c = section1.Id, Hospital__c = company.Id,
                Department_Name__c = 'NFM110TestDepart1');
        depart2 = new Account(RecordTypeId = rectDpt2.Id, Name = '*', ParentId  = section2.Id, Department_Class__c = section2.Id, Hospital__c = company.Id,
                Department_Name__c = 'NFM110TestDepart2');
        Account ocm = new Account(RecordTypeId = rectDpt2.Id, Name = '*', ParentId  = section2.Id, Department_Class__c = section2.Id, Hospital__c = company.Id,
                AgentCode_Ext__c = '9999900', Department_Name__c = 'NFM110TestDepart3');
        Account olympus_return = new Account(RecordTypeId = rectDpt2.Id, Name = '*', ParentId  = olympus2.Id, Department_Class__c = olympus2.Id, Hospital__c = olympus.Id,
                AgentCode_Ext__c = '9999901', Department_Name__c = 'olympus_return');
        insert new Account[] {depart1, depart2, ocm,olympus_return};
        // depart1 = [select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where Id =:depart1.Id];
        // depart2 = [select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where Id =:depart2.Id];
        depart1 = [select Management_Code__c, Name, Id from Account where Id =:depart1.Id];
        depart2 = [select Management_Code__c, Name, Id from Account where Id =:depart2.Id];
    }
    
    
    
    @isTest
    static void test_insert() {
        initHpData();
        Product2 prd = new Product2(Name = 'NFM110Prd1', ProductCode = 'NFM110Prd1', ProductCode_Ext__c = 'NFM110Prd1', Manual_Entry__c = false);
        insert prd;
        Product2__c pro1 = new Product2__c(Name='NFM110Prd1',OT_CODE_Text__c='NFM110Prd1',Product2__c=prd.id);
        insert pro1;

        NFM110Rest.GeneralData generalData1 = new NFM110Rest.GeneralData();
        NFM110Rest.ProductsDelivery ProductsDelivery = new NFM110Rest.ProductsDelivery();

        Datetime nowDT = Datetime.now();
        String nowStr = nowDT.format('yyyyMMddHHmm');
        ProductsDelivery.Monitoring = new NFMUtil.Monitoring();
        ProductsDelivery.Monitoring.MessageGroupNumber = nowStr + '01';

        ProductsDelivery.GeneralData = new NFM110Rest.GeneralData[] { generalData1 };
        generalData1.DeliveryNote = 'DeliveryNote';
        NFM110Rest.DnInformation dnInfo1 = new NFM110Rest.DnInformation();
        generalData1.DnInformation = new NFM110Rest.DnInformation[] { dnInfo1 };
        // generalData1.EndUserNo     = company.Management_Code_Auto__c;
        // generalData1.DepartmentNo  = depart1.Management_Code_Auto__c;
        generalData1.InquiryNo = 'test0001' + ',';
        dnInfo1.SorLMark        = 'S';
        dnInfo1.OTCode          = prd.ProductCode_Ext__c;
        dnInfo1.SerialNoorLotNo = '2577010001675';

        System.Test.startTest();
        //NFM110Rest.NFM110(ProductsDelivery);
        BatchIF_Log__c rowData = NFMUtil.saveRowData(ProductsDelivery.Monitoring, 'NFM110', ProductsDelivery.GeneralData);
        if (String.isBlank(rowData.Log__c) == false) 
        NFM110Rest.executefuture(rowData.Id);
        System.Test.stopTest();

        Asset[] rslts = [select Id, Return_Flag__c, AccountId, Department_Class__c, Hospital__c, Product2Id, SerialNumber, SLMark__c, IF_Information_From__c, InstallDate from Asset];
        List<BatchIF_Log__c> rowbl = [Select Id, Log__c, ErrorLog__c from BatchIF_Log__c where RowDataFlg__c = false and Type__c = 'NFM110' order by CreatedDate desc];
        //System.assertEquals('1', rowbl[0].ErrorLog__c);
        //System.assertEquals(1, rslts.size());
        if(rslts.size() > 0){
            System.assertEquals(1, rslts.size());
            System.assertEquals(false, rslts[0].Return_Flag__c);
            System.assertEquals(depart1.Id, rslts[0].AccountId);
            System.assertEquals(section1.Id, rslts[0].Department_Class__c);
            System.assertEquals(company.Id, rslts[0].Hospital__c);
            System.assertEquals(prd.Id, rslts[0].Product2Id);
            System.assertEquals(dnInfo1.SerialNoorLotNo, rslts[0]. SerialNumber);
            System.assertEquals('Serial Number', rslts[0]. SLMark__c);
            System.assertEquals(true, rslts[0]. IF_Information_From__c);
            System.assertEquals(null, rslts[0]. InstallDate);
        }

        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM110'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        System.assertEquals(1, logs[0].retry_cnt__c);

        System.assertEquals('NFM110', logs[0].Type__c);

        Id execBTId = Database.executeBatch(new LogAutoSendBatch(), 5);
        BatchIF_Log__c[] logss =[Select Id, Name, Log__c, ErrorLog__c, Log2__c,retry_cnt__c from BatchIF_Log__c where  id = :logs[0].id];
        System.assertEquals(1, logss[0].retry_cnt__c);

        List<BatchIF_Log__c> ll = [SELECT Id, Name, Log__c, ErrorLog__c, Log2__c, Log3__c, Log4__c, Log5__c, Log6__c,
                        Log7__c, Log8__c, Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c,Type__c,
                        retry_cnt__c
                   FROM BatchIF_Log__c
                  WHERE RowDataFlg__c = true
                    AND Type__c = :logs[0].Type__c AND CreatedDate >= :logs[0].CreatedDate  AND MessageGroupNumber__c >= :logs[0].MessageGroupNumber__c ];
        System.assertEquals(1, ll.size());   

        Database.executeBatch(new LogAutoSendBatch(logs[0].Type__c,logs[0].MessageGroupNumber__c,logs[0].CreatedDate), 1);
        BatchIF_Log__c[] logsss =[Select Id, Name, Log__c, ErrorLog__c, Log2__c,retry_cnt__c from BatchIF_Log__c where  id = :logs[0].id];
        System.assertEquals(1, logsss[0].retry_cnt__c);
    }
    @isTest
    static void test_insert_1() {
        initHpData();
        Product2 prd = new Product2(Name = 'NFM110Prd1', ProductCode = 'NFM110Prd1', ProductCode_Ext__c = 'NFM110Prd1', Manual_Entry__c = false);
        insert prd;
        Product2__c pro1 = new Product2__c(Name='NFM110Prd1',OT_CODE_Text__c='NFM110Prd1',Product2__c=prd.id);
        insert pro1;

        NFM110Rest.GeneralData generalData1 = new NFM110Rest.GeneralData();
        NFM110Rest.ProductsDelivery ProductsDelivery = new NFM110Rest.ProductsDelivery();

        Datetime nowDT = Datetime.now();
        String nowStr = nowDT.format('yyyyMMddHHmm');
        ProductsDelivery.Monitoring = new NFMUtil.Monitoring();
        ProductsDelivery.Monitoring.MessageGroupNumber = nowStr + '01';

        ProductsDelivery.GeneralData = new NFM110Rest.GeneralData[] { generalData1 };
        generalData1.DeliveryNote = 'DeliveryNote';
        NFM110Rest.DnInformation dnInfo1 = new NFM110Rest.DnInformation();
        generalData1.DnInformation = new NFM110Rest.DnInformation[] { dnInfo1 };
        // generalData1.EndUserNo     = company.Management_Code_Auto__c;
        // generalData1.DepartmentNo  = depart1.Management_Code_Auto__c;
        generalData1.InquiryNo = 'test0001' + ',';
        dnInfo1.SorLMark        = 'S';
        dnInfo1.OTCode          = prd.ProductCode_Ext__c;
        dnInfo1.SerialNoorLotNo = '2577010001675';

        System.Test.startTest();
        //NFM110Rest.NFM110(ProductsDelivery);
        BatchIF_Log__c rowData = NFMUtil.saveRowData(ProductsDelivery.Monitoring, 'NFM110', ProductsDelivery.GeneralData);
        if (String.isBlank(rowData.Log__c) == false) 
        NFM110Rest.executefuture(rowData.Id);
        System.Test.stopTest();

        Asset[] rslts = [select Id, Return_Flag__c, AccountId, Department_Class__c, Hospital__c, Product2Id, SerialNumber, SLMark__c, IF_Information_From__c, InstallDate from Asset];
        List<BatchIF_Log__c> rowbl = [Select Id, Log__c, ErrorLog__c from BatchIF_Log__c where RowDataFlg__c = false and Type__c = 'NFM110' order by CreatedDate desc];
        //System.assertEquals('1', rowbl[0].ErrorLog__c);
        //System.assertEquals(1, rslts.size());
        if(rslts.size() > 0){
            System.assertEquals(1, rslts.size());
            System.assertEquals(false, rslts[0].Return_Flag__c);
            System.assertEquals(depart1.Id, rslts[0].AccountId);
            System.assertEquals(section1.Id, rslts[0].Department_Class__c);
            System.assertEquals(company.Id, rslts[0].Hospital__c);
            System.assertEquals(prd.Id, rslts[0].Product2Id);
            System.assertEquals(dnInfo1.SerialNoorLotNo, rslts[0]. SerialNumber);
            System.assertEquals('Serial Number', rslts[0]. SLMark__c);
            System.assertEquals(true, rslts[0]. IF_Information_From__c);
            System.assertEquals(null, rslts[0]. InstallDate);
        }

        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM110'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        System.assertEquals(1, logs[0].retry_cnt__c);

        System.assertEquals('NFM110', logs[0].Type__c);

        Id execBTId = Database.executeBatch(new LogAutoSendBatch(), 5);
        BatchIF_Log__c[] logss =[Select Id, Name, Log__c, ErrorLog__c, Log2__c,retry_cnt__c from BatchIF_Log__c where  id = :logs[0].id];
        System.assertEquals(1, logss[0].retry_cnt__c);

        List<BatchIF_Log__c> ll = [SELECT Id, Name, Log__c, ErrorLog__c, Log2__c, Log3__c, Log4__c, Log5__c, Log6__c,
                        Log7__c, Log8__c, Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c,Type__c,
                        retry_cnt__c
                   FROM BatchIF_Log__c
                  WHERE RowDataFlg__c = true
                    AND Type__c = :logs[0].Type__c AND CreatedDate >= :logs[0].CreatedDate  AND MessageGroupNumber__c >= :logs[0].MessageGroupNumber__c ];
        System.assertEquals(1, ll.size());   

        Database.executeBatch(new LogAutoSendBatch(logs[0].Type__c,logs[0].MessageGroupNumber__c), 1);
        BatchIF_Log__c[] logsss =[Select Id, Name, Log__c, ErrorLog__c, Log2__c,retry_cnt__c from BatchIF_Log__c where  id = :logs[0].id];
        System.assertEquals(1, logsss[0].retry_cnt__c);
    }
    @isTest
    static void test_insert_1_1() {
        initHpData();
        Product2 prd = new Product2(Name = 'NFM110Prd1', ProductCode = 'NFM110Prd1', ProductCode_Ext__c = 'NFM110Prd1', Manual_Entry__c = false);
        insert prd;
        Product2__c pro1 = new Product2__c(Name='NFM110Prd1',OT_CODE_Text__c='NFM110Prd1',Product2__c=prd.id);
        insert pro1;

        NFM110Rest.GeneralData generalData1 = new NFM110Rest.GeneralData();
        NFM110Rest.ProductsDelivery ProductsDelivery = new NFM110Rest.ProductsDelivery();

        Datetime nowDT = Datetime.now();
        String nowStr = nowDT.format('yyyyMMddHHmm');
        ProductsDelivery.Monitoring = new NFMUtil.Monitoring();
        ProductsDelivery.Monitoring.MessageGroupNumber = nowStr + '01';

        ProductsDelivery.GeneralData = new NFM110Rest.GeneralData[] { generalData1 };
        generalData1.DeliveryNote = 'DeliveryNote';
        NFM110Rest.DnInformation dnInfo1 = new NFM110Rest.DnInformation();
        generalData1.DnInformation = new NFM110Rest.DnInformation[] { dnInfo1 };
        // generalData1.EndUserNo     = company.Management_Code_Auto__c;
        // generalData1.DepartmentNo  = depart1.Management_Code_Auto__c;
        generalData1.InquiryNo = 'test0001' + ',';
        dnInfo1.SorLMark        = 'S';
        dnInfo1.OTCode          = prd.ProductCode_Ext__c;
        dnInfo1.SerialNoorLotNo = '2577010001675';

        System.Test.startTest();
        //NFM110Rest.NFM110(ProductsDelivery);
        BatchIF_Log__c rowData = NFMUtil.saveRowData(ProductsDelivery.Monitoring, 'NFM110', ProductsDelivery.GeneralData);
        if (String.isBlank(rowData.Log__c) == false) 
        NFM110Rest.executefuture(rowData.Id);
        System.Test.stopTest();

        Asset[] rslts = [select Id, Return_Flag__c, AccountId, Department_Class__c, Hospital__c, Product2Id, SerialNumber, SLMark__c, IF_Information_From__c, InstallDate from Asset];
        List<BatchIF_Log__c> rowbl = [Select Id, Log__c, ErrorLog__c from BatchIF_Log__c where RowDataFlg__c = false and Type__c = 'NFM110' order by CreatedDate desc];
        //System.assertEquals('1', rowbl[0].ErrorLog__c);
        //System.assertEquals(1, rslts.size());
        if(rslts.size() > 0){
            System.assertEquals(1, rslts.size());
            System.assertEquals(false, rslts[0].Return_Flag__c);
            System.assertEquals(depart1.Id, rslts[0].AccountId);
            System.assertEquals(section1.Id, rslts[0].Department_Class__c);
            System.assertEquals(company.Id, rslts[0].Hospital__c);
            System.assertEquals(prd.Id, rslts[0].Product2Id);
            System.assertEquals(dnInfo1.SerialNoorLotNo, rslts[0]. SerialNumber);
            System.assertEquals('Serial Number', rslts[0]. SLMark__c);
            System.assertEquals(true, rslts[0]. IF_Information_From__c);
            System.assertEquals(null, rslts[0]. InstallDate);
        }

        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM110'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        logs[0].NFM501Future_Count__c=1;
        update logs;
        System.assertEquals(1, logs[0].retry_cnt__c);

        System.assertEquals('NFM110', logs[0].Type__c);

        Id execBTId = Database.executeBatch(new LogAutoSendBatch(), 5);
        BatchIF_Log__c[] logss =[Select Id, Name, Log__c, ErrorLog__c, Log2__c,retry_cnt__c from BatchIF_Log__c where  id = :logs[0].id];
        System.assertEquals(1, logss[0].retry_cnt__c);

        List<BatchIF_Log__c> ll = [SELECT Id, Name, Log__c, ErrorLog__c, Log2__c, Log3__c, Log4__c, Log5__c, Log6__c,
                        Log7__c, Log8__c, Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c,Type__c,
                        retry_cnt__c
                   FROM BatchIF_Log__c
                  WHERE RowDataFlg__c = true
                    AND Type__c = :logs[0].Type__c AND CreatedDate >= :logs[0].CreatedDate  AND MessageGroupNumber__c >= :logs[0].MessageGroupNumber__c ];
        System.assertEquals(1, ll.size());   
        Boolean check = true;
        Database.executeBatch(new LogAutoSendBatch('NFM501','123123'), 1);
        BatchIF_Log__c[] logsss =[Select Id, Name, Log__c, ErrorLog__c, Log2__c,retry_cnt__c from BatchIF_Log__c where  id = :logs[0].id];
        System.assertEquals(1, logsss[0].retry_cnt__c);
    }
    @isTest
    static void test_insert_2() {
        initHpData();
        Product2 prd = new Product2(Name = 'NFM110Prd1', ProductCode = 'NFM110Prd1', ProductCode_Ext__c = 'NFM110Prd1', Manual_Entry__c = false);
        insert prd;
        Product2__c pro1 = new Product2__c(Name='NFM110Prd1',OT_CODE_Text__c='NFM110Prd1',Product2__c=prd.id);
        insert pro1;

        NFM110Rest.GeneralData generalData1 = new NFM110Rest.GeneralData();
        NFM110Rest.ProductsDelivery ProductsDelivery = new NFM110Rest.ProductsDelivery();

        Datetime nowDT = Datetime.now();
        String nowStr = nowDT.format('yyyyMMddHHmm');
        ProductsDelivery.Monitoring = new NFMUtil.Monitoring();
        ProductsDelivery.Monitoring.MessageGroupNumber = nowStr + '01';

        ProductsDelivery.GeneralData = new NFM110Rest.GeneralData[] { generalData1 };
        generalData1.DeliveryNote = 'DeliveryNote';
        NFM110Rest.DnInformation dnInfo1 = new NFM110Rest.DnInformation();
        generalData1.DnInformation = new NFM110Rest.DnInformation[] { dnInfo1 };
        // generalData1.EndUserNo     = company.Management_Code_Auto__c;
        // generalData1.DepartmentNo  = depart1.Management_Code_Auto__c;
        generalData1.InquiryNo = 'test0001' + ',';
        dnInfo1.SorLMark        = 'S';
        dnInfo1.OTCode          = prd.ProductCode_Ext__c;
        dnInfo1.SerialNoorLotNo = '2577010001675';

        System.Test.startTest();
        //NFM110Rest.NFM110(ProductsDelivery);
        BatchIF_Log__c rowData = NFMUtil.saveRowData(ProductsDelivery.Monitoring, 'NFM110', ProductsDelivery.GeneralData);
        if (String.isBlank(rowData.Log__c) == false) 
        NFM110Rest.executefuture(rowData.Id);
        System.Test.stopTest();

        Asset[] rslts = [select Id, Return_Flag__c, AccountId, Department_Class__c, Hospital__c, Product2Id, SerialNumber, SLMark__c, IF_Information_From__c, InstallDate from Asset];
        List<BatchIF_Log__c> rowbl = [Select Id, Log__c, ErrorLog__c from BatchIF_Log__c where RowDataFlg__c = false and Type__c = 'NFM110' order by CreatedDate desc];
        //System.assertEquals('1', rowbl[0].ErrorLog__c);
        //System.assertEquals(1, rslts.size());
        if(rslts.size() > 0){
            System.assertEquals(1, rslts.size());
            System.assertEquals(false, rslts[0].Return_Flag__c);
            System.assertEquals(depart1.Id, rslts[0].AccountId);
            System.assertEquals(section1.Id, rslts[0].Department_Class__c);
            System.assertEquals(company.Id, rslts[0].Hospital__c);
            System.assertEquals(prd.Id, rslts[0].Product2Id);
            System.assertEquals(dnInfo1.SerialNoorLotNo, rslts[0]. SerialNumber);
            System.assertEquals('Serial Number', rslts[0]. SLMark__c);
            System.assertEquals(true, rslts[0]. IF_Information_From__c);
            System.assertEquals(null, rslts[0]. InstallDate);
        }

        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM110'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        System.assertEquals(1, logs[0].retry_cnt__c);

        System.assertEquals('NFM110', logs[0].Type__c);

        Id execBTId = Database.executeBatch(new LogAutoSendBatch(), 5);
        BatchIF_Log__c[] logss =[Select Id, Name, Log__c, ErrorLog__c, Log2__c,retry_cnt__c from BatchIF_Log__c where  id = :logs[0].id];
        System.assertEquals(1, logss[0].retry_cnt__c);

        List<BatchIF_Log__c> ll = [SELECT Id, Name, Log__c, ErrorLog__c, Log2__c, Log3__c, Log4__c, Log5__c, Log6__c,
                        Log7__c, Log8__c, Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c,Type__c,
                        retry_cnt__c
                   FROM BatchIF_Log__c
                  WHERE RowDataFlg__c = true
                    AND Type__c = :logs[0].Type__c AND CreatedDate >= :logs[0].CreatedDate  AND MessageGroupNumber__c >= :logs[0].MessageGroupNumber__c ];
        System.assertEquals(1, ll.size());   
        Boolean check = true;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Type__c,check), 1);
        BatchIF_Log__c[] logsss =[Select Id, Name, Log__c, ErrorLog__c, Log2__c,retry_cnt__c from BatchIF_Log__c where  id = :logs[0].id];
        System.assertEquals(1, logsss[0].retry_cnt__c);
    }
    @isTest
    static void test_insert1() {
        initHpData();
        Product2 prd = new Product2(Name = 'NFM110Prd1', ProductCode = 'NFM110Prd1', ProductCode_Ext__c = 'NFM110Prd1', Manual_Entry__c = false);
        insert prd;
        Product2__c pro1 = new Product2__c(Name='NFM110Prd1',OT_CODE_Text__c='NFM110Prd1',Product2__c=prd.id);
        insert pro1;

        NFM110Rest.GeneralData generalData1 = new NFM110Rest.GeneralData();
        NFM110Rest.ProductsDelivery ProductsDelivery = new NFM110Rest.ProductsDelivery();

        Datetime nowDT = Datetime.now();
        String nowStr = nowDT.format('yyyyMMddHHmm');
        ProductsDelivery.Monitoring = new NFMUtil.Monitoring();
        ProductsDelivery.Monitoring.MessageGroupNumber = nowStr + '01';

        ProductsDelivery.GeneralData = new NFM110Rest.GeneralData[] { generalData1 };
        generalData1.DeliveryNote = 'DeliveryNote';
        NFM110Rest.DnInformation dnInfo1 = new NFM110Rest.DnInformation();
        generalData1.DnInformation = new NFM110Rest.DnInformation[] { dnInfo1 };
        // generalData1.EndUserNo     = company.Management_Code_Auto__c;
        // generalData1.DepartmentNo  = depart1.Management_Code_Auto__c;
        generalData1.InquiryNo = 'test0001' + ',';
        dnInfo1.SorLMark        = 'S';
        dnInfo1.OTCode          = prd.ProductCode_Ext__c;
        dnInfo1.SerialNoorLotNo = '2577010001675';

        System.Test.startTest();
        //NFM110Rest.NFM110(ProductsDelivery);
        // BatchIF_Log__c rowData = NFMUtil.saveRowData(ProductsDelivery.Monitoring, 'NFM110', ProductsDelivery.GeneralData);
        BatchIF_Log__c rowData1 = new BatchIF_Log__c();
        rowData1.Log__c = '[{"userReturnDate":null,"userAgreeDAte":null,"supplySpareEquip":"false","strategicDepartmenCd":"354044其他","SparePartsLendingRecord":null,"SorcOgzDate":null,"SorcAcceptDate":null,"SAPRepairOrderCreateDate":null,"SAPrepairNo":null,"SAPrepairApplyDate":null,"returnStage":null,"ReturnsProductWay":"返送办事处","returnLogisticsSendTime":null,"returnLogisticsRemark":null,"returnLogisticsReceiveTime":null,"returnLogisticsNo":null,"returnLogisticsMode":"快递","RepairType":null,"repairStartDate":null,"repairproductsRevDate":null,"repairOrderNo2":"SR-20230529-00003-01","repairOrderNo":"SR-20230529-00003","repairOrderCompleteDate":null,"repairNo":"RS-202305-615954","repairCompleteExpectedDate":null,"repairCompleteDate":null,"repairApplicantID":"om001744","repairApplicant":"om001744","region":"1.华北","RcSorcDate":null,"RCreturnDate":"20230529105000","RCacceptanceDate":"20230529104100","QuotationGread":null,"quotationDate":"20230529105039","province":"天津市","priceApprovalDate":null,"planQuotationDate":null,"payCompleteDate":null,"partsCompleteDate":null,"OTSRepairOrder":null,"On_site_repair":"办事处修理","oldRepairNo":null,"OgzAcceptDate":null,"officeLogisticsReceiveDate":null,"MultiYearContractStartDate":null,"MultiYearContractNo":null,"MultiYearContractName":null,"MultiYearContractEndDate":null,"MultiYearContractData":null,"logisticsSendDate":null,"logisticsReceiveDate":null,"latestPayDate":null,"isRepairWarrantyObj":false,"isContractUser":"false","invoiceReceiveDate":null,"invoiceDate":null,"inspectionDate":null,"incomeReckoninDate":null,"hospitalCd":"354044","FSERepairOrderCreateDate":"20230529104200","FSErepairApplyDate":"20230529104200","FirstQuotationDate":"20230529105039","finalTestDate":null,"finalQuotationPrice":50.00,"FaultDesc":null,"equipmentModel":"A22005A:光学视管","equipmentCd":"20100818","engineerSendDate":"20230529090000","detectionResult":null,"departmentCd":"371770","deliveryLogisticsNo":null,"deliveryLogisticsMode":"快递","DeliveryLogisticsAnnotation":null,"cus_dn":null,"ContractStartDate":null,"ContractNo":null,"ContractName":null,"ContractEndDate":null,"ContractData":null,"closeRepairDate":null,"city":"滨海新区","cancelRepairDate":null,"applySpareEquip":false,"ActualQuotationDate":null,"acceptanceFormSendDate":null,"acceptanceFormReceivedDate":null,"abandonPayDate":null}]';
        rowData1.retry_cnt__c = 1;
        rowData1.Type__c = 'NFM603';
        rowData1.RowDataFlg__c = true;
        insert rowData1;
        // if (String.isBlank(rowData.Log__c) == false) 
        // NFM110Rest.executefuture(rowData.Id);
        System.Test.stopTest();

        Asset[] rslts = [select Id, Return_Flag__c, AccountId, Department_Class__c, Hospital__c, Product2Id, SerialNumber, SLMark__c, IF_Information_From__c, InstallDate from Asset];
        List<BatchIF_Log__c> rowbl = [Select Id, Log__c, ErrorLog__c from BatchIF_Log__c where RowDataFlg__c = false and Type__c = 'NFM110' order by CreatedDate desc];
        //System.assertEquals('1', rowbl[0].ErrorLog__c);
        //System.assertEquals(1, rslts.size());
        if(rslts.size() > 0){
            System.assertEquals(1, rslts.size());
            System.assertEquals(false, rslts[0].Return_Flag__c);
            System.assertEquals(depart1.Id, rslts[0].AccountId);
            System.assertEquals(section1.Id, rslts[0].Department_Class__c);
            System.assertEquals(company.Id, rslts[0].Hospital__c);
            System.assertEquals(prd.Id, rslts[0].Product2Id);
            System.assertEquals(dnInfo1.SerialNoorLotNo, rslts[0]. SerialNumber);
            System.assertEquals('Serial Number', rslts[0]. SLMark__c);
            System.assertEquals(true, rslts[0]. IF_Information_From__c);
            System.assertEquals(null, rslts[0]. InstallDate);
        }

        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM603'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        System.assertEquals(1, logs[0].retry_cnt__c);

        System.assertEquals('NFM603', logs[0].Type__c);

        Id execBTId = Database.executeBatch(new LogAutoSendBatch(), 5);
        BatchIF_Log__c[] logss =[Select Id, Name, Log__c, ErrorLog__c, Log2__c,retry_cnt__c from BatchIF_Log__c where  id = :logs[0].id];
        System.assertEquals(1, logss[0].retry_cnt__c);

        List<BatchIF_Log__c> ll = [SELECT Id, Name, Log__c, ErrorLog__c, Log2__c, Log3__c, Log4__c, Log5__c, Log6__c,
                        Log7__c, Log8__c, Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c,Type__c,
                        retry_cnt__c
                   FROM BatchIF_Log__c
                  WHERE RowDataFlg__c = true
                    AND Type__c = :logs[0].Type__c AND CreatedDate >= :logs[0].CreatedDate  AND MessageGroupNumber__c >= :logs[0].MessageGroupNumber__c ];
        System.assertEquals(1, ll.size());   

        Database.executeBatch(new LogAutoSendBatch(logs[0].Id), 1);
        BatchIF_Log__c[] logsss =[Select Id, Name, Log__c, ErrorLog__c, Log2__c,retry_cnt__c from BatchIF_Log__c where  id = :logs[0].id];
        System.assertEquals(1, logsss[0].retry_cnt__c);
    }
    @isTest
    static void test_nfm606() {
        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM606';
        rowData.Log__c = '{"GeDatas":{"Monitoring":{"TransmissionDateTime":"20211228181808","timestamp":null,"Text":"","Tag":"MSGH","sign":null,"Sender":"SFDC","Receiver":"智慧医疗/服务新系统","NumberOfRecord":"1","MessageType":"NFM606","MessageGroupNumber":"20211228181808","appKey":null,"API_TOKEN":"c74a8215c69e75a4b04ec001f701f74c","API_TIME":"1640686688942","API_RANDOM_STR":"B62A9C6C5255281D"},"GeData":[{"Status":true,"State":"CN-22","ServiceUserId":"","SalesBusinessDivision":null,"PersonManagementCode":"C000135975","Name":"翁旭","Mobile":"13250294119","Hospital":"","Email":null,"Department":"","ContactId":"","City":"CN-2259","AgentUserType":"ASE","AgentFlag":true,"AgentCode":"0000024063","Account":"深圳市盈信科技贸易有限公司"}]}}';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM606'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }
    @isTest
    static void test_nfm602() {
        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM602';
        rowData.Log__c = '{"spotInspectionreport":[{"strategicDepartmenCd":"354044妇科","spotCheckUnifiedAuthId":"SFDC-05","spotCheckPerson":"SFDC-05","spotCheckEquipTotalQty":2,"spotCheckDate":"20221111000000","spotCheckBatch":null,"spotCheckAbnormalQty":2,"ListOfAbnormalDevicesInfo":[{"problemDesc":"漏水严重，无法修理","equipmentModel":"0.018”A260","equipmentCd":"127-1"},{"problemDesc":"绝缘外漏","equipmentModel":"0.018”B200","equipmentCd":"test-1"}],"hospitalCd":"354044","departmentCd":"760130","ContractStattus":"有效","contractStartDate":"20221111000000","contractEquipQty":3,"contractEndDate":"20231110000000","contractCd":"test20221111","checkStartDate":"20221111101500","checkEndDate":"20221111120200"}]}';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM602'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }
    @isTest
    static void test_nfm601() {
        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM601';
        rowData.Log__c = '{"GeDatas":{"Monitoring":{"TransmissionDateTime":"20230530171054","timestamp":"1685437857964","Text":"","Tag":"MSGH","sign":"DF371499D9DE531FEF5456553E73795A","Sender":"SFDC","Receiver":"智慧医疗/服务新系统","NumberOfRecord":"1","MessageType":"NFM601","MessageGroupNumber":"20230530171054","appKey":"39111FC57691491190C1D137A1EE3962","API_TOKEN":"230baaf1bc5f0387d1588045d422de52","API_TIME":"1685437857964","API_RANDOM_STR":"9102F871AEADDEE1"},"GeData":[{"ZIPCode":"000000","Status":true,"State":"CN-01","SalesBusinessDivision":"1.华北","QuolifiedValidityDate":"","Phone":"","OCSMCategory":"H0","Name":"Test20230531","ManageCode2":"","ManageCode":"8104306","Identification":"1","HospitalLevel":"一级","HospitalCode":"","DepartmentClass":"","ContractEndDate":"","City":"CN-0131","Alias2":"","Alias1":"","Address":"北京市朝阳区0309","Abbreviation":""}]}}';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM601'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }
    @isTest
    static void test_nfm001() {
        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM001';
        rowData.Log__c = '{"Endusers":{"Monitoring":{"TransmissionDateTime":"202305301710","Text":"","Tag":"MSGH","Sender":"8402","Receiver":"1330","NumberOfRecord":"1","MessageType":"NFM001","MessageGroupNumber":"20230006104553"},"Enduser":[{"PurposeOfAdvice":"3","DepartmentTelephone":null,"DepartmentPostalCode":null,"DepartmentFax":null,"DepartmentEffectiveDateTo":"99991231","DepartmentDescription":"Test20230531","DepartmentCode":"8104306","DepartmentCategory":null,"DepartmentAddress":"北京市朝阳区0309","CompanyDescription2":"null,公立","CompanyDescription":"Test20230531","CompanyCode":"8104306","CompanyCategory":"H0","CompanyAreaCode":"353672"}]}}';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM001'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }
    @isTest
    static void test_nfm007() {
        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM007';
        rowData.Log__c = '{"Quotations":{"Quotation":[{"SalesPriceForEnduser":0,"SalesPriceForAgent2":0,"SalesPriceForAgent1":459.00,"SalesPoint":"OSH-AHSP","SalesPersonName":"汪 红芬","SalesPersonCode":"om000894","SalesChannel":"2.Agent","QuotationCode":"HD-FY2024-05-S285185","PurposeOfAdvice":"2","ProspectCategory":"PRO-00110","PresalesPerson":[],"Other1":"5","InspectionCertificateComment":"0","InspectionCertificate":"0","FundSource":"1001","EnduserCode":"8089156","Detail":[{"ServicePrice":0.00,"SalesPrice":459.00,"ProvistonPeriod":null,"PROCODE":null,"MaintenancePrice":0.00,"ListPrice":850.00,"ItemQuantity":1.0,"ItemCode":"2285800","GuaranteeType":",","GuaranteePrice":0.00,"GuaranteePeriod":"01","Discount":391.00,"DetailLine":"1"}],"DepartmentCode":"8089156","DealerContractNo":null,"Currency_x":"CNY","ContractType":"4000","ContractPeriod":"01","ContractApplicationNo":null,"CLBICCategory":"CLBIC-00200","AuthorizationNo":"HD-FY2024-05-S285185","Agent2Code":null,"Agent1Code":"0000021858"}],"Monitoring":{"TransmissionDateTime":"202305291701","Text":"","Tag":"MSGH","Sender":"8402","Receiver":"1330","NumberOfRecord":"1","MessageType":"NFM007","MessageGroupNumber":"20230006096471"}}}';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM007'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }/*
    @isTest
    static void test_nfm103() {
        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM103';
        rowData.Log__c = '{"Quotations":{"Quotation":[{"SalesPriceForEnduser":0,"SalesPriceForAgent2":0,"SalesPriceForAgent1":459.00,"SalesPoint":"OSH-AHSP","SalesPersonName":"汪 红芬","SalesPersonCode":"om000894","SalesChannel":"2.Agent","QuotationCode":"HD-FY2024-05-S285185","PurposeOfAdvice":"2","ProspectCategory":"PRO-00110","PresalesPerson":[],"Other1":"5","InspectionCertificateComment":"0","InspectionCertificate":"0","FundSource":"1001","EnduserCode":"8089156","Detail":[{"ServicePrice":0.00,"SalesPrice":459.00,"ProvistonPeriod":null,"PROCODE":null,"MaintenancePrice":0.00,"ListPrice":850.00,"ItemQuantity":1.0,"ItemCode":"2285800","GuaranteeType":",","GuaranteePrice":0.00,"GuaranteePeriod":"01","Discount":391.00,"DetailLine":"1"}],"DepartmentCode":"8089156","DealerContractNo":null,"Currency_x":"CNY","ContractType":"4000","ContractPeriod":"01","ContractApplicationNo":null,"CLBICCategory":"CLBIC-00200","AuthorizationNo":"HD-FY2024-05-S285185","Agent2Code":null,"Agent1Code":"0000021858"}],"Monitoring":{"TransmissionDateTime":"202305291701","Text":"","Tag":"MSGH","Sender":"8402","Receiver":"1330","NumberOfRecord":"1","MessageType":"NFM007","MessageGroupNumber":"20230006096471"}}}';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM103'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }*/
    @isTest
    static void test_nfm608() {
        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM608';
        rowData.Log__c = '{"visitStartDate":"","visitPurpose":"","visitInfo":"","visitEndDate":"","visitDistinction":"","synchroDate":"","replyResult":"","replyID":"","mngCd":"","departmentCd":"","applicantId":"","activityDifferentiation":""}';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM608'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }
    @isTest
    static void test_nfm115() {
        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM115';
        rowData.Log__c = '{"Sample":[{"Detail":[{"ItemQuantity":"50","ItemCode":"W7053470"},{"ItemQuantity":"50","ItemCode":"N8600618"}],"DeliveryPhone":"18616536216","DeliveryContact":"李海红","DeliveryAddress":"上海市淮海中路1010号11楼","AreaCode":null,"AgentCode":"8098078"}],"Monitoring":{"TransmissionDateTime":"202206301549","Text":"","Tag":"MSGH","Sender":"SFDC","Receiver":"SAP","NumberOfRecord":"1","MessageType":"NFM115","MessageGroupNumber":"20220004764959"}}';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM115'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }/*
    @isTest
    static void test_nfm106() {
        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM106';
        rowData.Log__c = '{"RepairRequest":{"Monitoring":{"TransmissionDateTime":"202305261517","Text":"","Tag":"MSGH","Sender":"8402","Receiver":"1330","NumberOfRecord":"1","MessageType":"NFM103","MessageGroupNumber":"20230005969629"},"GeneralData":[{"ZFLAG_SX":"X","ZFLAG_CGSX":"","Workshop":"OCM-CDGT","UpdateStatus":"X","TradeType":null,"Telephone":"***********","SFDCRepairNo":"RS-202305-615943","Series":null,"SerialNo":"2124623","SAPAgentNo":null,"SalesOfficeCode":"2501","ReturnType":"办事处","ReRepairObject":"","RepairTypeQIS":null,"RepairType":"RC修理","RepairSource":"普通修理","RepairOTCode":"N3823530","RepairModel":"ENF-T3(CHINA)","RepairCostType":"","RepairContractObject":"X","RepairContractNumber":"BJ-RS-BJ0069485SX","RepairCancellationHistory":"","RecordPersonID":"huang","RecordPersonEmail":"ishuangqianlong@163.com","Reanalysis":null,"QuotationDate":"","ProvinceCodeOfEquipment":"230","ProductDeliveryDate":null,"Postal":"******","PaperRepairRequestNo":null,"OfferRental":"","NewProductGuaranteeObject":"","MAINITIAL":"","LastSFDCRepairNo":"RS-201309-263710","LastSFDCrepairCancellationReason":null,"LastSFDCRepairCancellationNo":null,"IntakeInfo":[{"IntakeUniversalCode":"001"}],"InstallationDate":"20110727","InquiryNo":null,"IfRentalApply":"","GuaranteeStartDate":"20110727","GuaranteeEndDate":"20120726","FSEReceiveDate":null,"FSEPersonEmail":"bowen_xiao@olympus.com.cn.invalid","FSEPerson":"肖博文","FSEDeliverDate":"20230526","FailureSymptomDescription":"111","EtQManagementNo":null,"EquipmentFixedAssetNo":null,"EndUserNo":"368290","DepartmentNo":"1805738","DataId":"1111672008732573697","CustomerName":"Olympus社内 其他 社内用户","ContactPerson":"何学琼","CompanyCodeOfEquipment":"5113","City":"成都市","BreakdownStartDate":"20230526","BollowDate":null,"AnimalExperiment":"","Address":"四川省成都市**********"}]}}';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM106'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }*/
    @isTest
    static void test_nfm620() {
        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM620';
        rowData.Log__c = '[{"RequestDetail":"111111111","Request":"需要报价","Product":"胃镜;治疗附件;肠镜","Name":"胃镜, 治疗附件, 肠镜","InquiryNo":"","DataId":"","ContactWayEncrypted":"","ContactWay":"***********","ContactType":2,"ContactId":"","Campaign":"","ApproverID":""}]';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM620'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }
    @isTest
    static void test_nfm623() {
        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM623';
        rowData.Log__c = '[{"ViewContactIdS":[{"ViewContactId":""}],"Num":"","Name":"","LabelTypeS":[{"LabelType":"","Label":""},{"LabelType":"","Label":""}]}]';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM623'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }
    @isTest
    static void test_nfm704() {
        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM704';
        rowData.Log__c = '[{"WorkingSeniorityEncrypted":"","WorkingSeniority":"**","TechnicalTitleEncrypted":"","TechnicalTitle":"*****","State":"","StaffMCode":"","SpecialityEncrypted":"","Speciality":"**********","Society1":"","ProfessionalFieldEncrypted":"c6cb4ee7a227c9f398f297cfbd1b22c3","ProfessionalField":"*****","OfficeMCode":"消化内科","NameEncrypted":"","Name":"***","MobileEncrypted":"","Mobile":"","HospitalMCode":"","HcpNo":"","HCPLevelEncrypted":"","HCPLevel":"*****","EventStatusEncryptedList":[],"EventStatus":"","DataId":"","City":""}]';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM704'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }
    @isTest
    static void test_nfm116() {
        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM116';
        rowData.Log__c = '{"OnlineSign":[{"SoNo":"0030149297","HospitalResult":"全部验收","HospitalDate":"20210622","DeliveryNote":"0065253505","DealerResult":"全部验收","DealerDate":"20210531"},{"SoNo":"0030166869","HospitalResult":"全部验收","HospitalDate":"20220506","DeliveryNote":"0065284947","DealerResult":"全部验收","DealerDate":"20220309"},{"SoNo":"0030167537","HospitalResult":"全部验收","HospitalDate":"20220412","DeliveryNote":"0065285396","DealerResult":"全部验收","DealerDate":"20220516"},{"SoNo":"0030167691","HospitalResult":"全部验收","HospitalDate":"20220516","DeliveryNote":"0065286634","DealerResult":"全部验收","DealerDate":"20220329"},{"SoNo":"0030167691","HospitalResult":"全部验收","HospitalDate":"20220516","DeliveryNote":"0065286635","DealerResult":"全部验收","DealerDate":"20220329"},{"SoNo":"0030171288","HospitalResult":"全部验收","HospitalDate":"20220331","DeliveryNote":"0065285967","DealerResult":"全部验收","DealerDate":"20220516"},{"SoNo":"0030167692","HospitalResult":"全部验收","HospitalDate":"20220516","DeliveryNote":"0065286630","DealerResult":"全部验收","DealerDate":"20220329"},{"SoNo":"0030171768","HospitalResult":"全部验收","HospitalDate":"20220516","DeliveryNote":"0065287472","DealerResult":"全部验收","DealerDate":"20220401"},{"SoNo":"0030169709","HospitalResult":"全部验收","HospitalDate":"20220507","DeliveryNote":"0065287013","DealerResult":"全部验收","DealerDate":"20220321"},{"SoNo":"0030169704","HospitalResult":"全部验收","HospitalDate":"20220507","DeliveryNote":"0065287014","DealerResult":"全部验收","DealerDate":"20220321"},{"SoNo":"0030171286","HospitalResult":"全部验收","HospitalDate":"20220507","DeliveryNote":"0065287012","DealerResult":"全部验收","DealerDate":"20220321"},{"SoNo":"0030171513","HospitalResult":"全部验收","HospitalDate":"20220513","DeliveryNote":"0065287785","DealerResult":"全部验收","DealerDate":"20220512"},{"SoNo":"0030171511","HospitalResult":"全部验收","HospitalDate":"20220516","DeliveryNote":"0065287635","DealerResult":"全部验收","DealerDate":"20220328"},{"SoNo":"0030170032","HospitalResult":"全部验收","HospitalDate":"20220507","DeliveryNote":"0065287645","DealerResult":"全部验收","DealerDate":"20220324"},{"SoNo":"0030171491","HospitalResult":"全部验收","HospitalDate":"20220513","DeliveryNote":"0065287851","DealerResult":"全部验收","DealerDate":"20220401"},{"SoNo":"0030169991","HospitalResult":"全部验收","HospitalDate":"20220513","DeliveryNote":"0065287853","DealerResult":"全部验收","DealerDate":"20220401"},{"SoNo":"0030167691","HospitalResult":"全部验收","HospitalDate":"20220516","DeliveryNote":"0065287916","DealerResult":"全部验收","DealerDate":"20220402"},{"SoNo":"0030171393","HospitalResult":"全部验收","HospitalDate":"20220516","DeliveryNote":"0065288195","DealerResult":"全部验收","DealerDate":"20220328"},{"SoNo":"0030169990","HospitalResult":"全部验收","HospitalDate":"20220516","DeliveryNote":"0065288193","DealerResult":"全部验收","DealerDate":"20220328"},{"SoNo":"0030171393","HospitalResult":"全部验收","HospitalDate":"20220516","DeliveryNote":"0065288196","DealerResult":"全部验收","DealerDate":"20220329"},{"SoNo":"0030169990","HospitalResult":"全部验收","HospitalDate":"20220516","DeliveryNote":"0065288194","DealerResult":"全部验收","DealerDate":"20220329"},{"SoNo":"0030172019","HospitalResult":"全部验收","HospitalDate":"20220513","DeliveryNote":"0065288279","DealerResult":"全部验收","DealerDate":"20220512"},{"SoNo":"0030170032","HospitalResult":"全部验收","HospitalDate":"20220507","DeliveryNote":"0065288686","DealerResult":"全部验收","DealerDate":"20220328"},{"SoNo":"0030169709","HospitalResult":"全部验收","HospitalDate":"20220507","DeliveryNote":"0065288705","DealerResult":"全部验收","DealerDate":"20220328"},{"SoNo":"0030171953","HospitalResult":"全部验收","HospitalDate":"20220507","DeliveryNote":"0065288685","DealerResult":"全部验收","DealerDate":"20220328"}],"Monitoring":{"TransmissionDateTime":"202205170230","Text":"","Tag":"MSGH","Sender":"SFDC","Receiver":"SAP","NumberOfRecord":"25","MessageType":"NFM116","MessageGroupNumber":null}}';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM116'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }
    @isTest
    static void test_nfm201() {
        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM201';
        rowData.Log__c = '{"Monitoring":{"TransmissionDateTime":"201906140824","Text":"","Tag":"MSGH","Sender":"SFDC","Receiver":"SPO","NumberOfRecord":"1","MessageType":"NFM201","MessageGroupNumber":"20190001996478"},"GeData":[{"ZIPCode":"524005","Town":"霞山区","TermDate":"2999-12-31","Telehone":null,"State":"广东省","SpecialityType":"综合医院","SectionName":"中国人民解放军南方战区海军第一医院 耳鼻喉科 耳鼻喉科","SectionCode":"8068192","SectionCategory":"ENT","PurposeOfAdvice":"2","NeedQuolified":false,"ManageCode":"364165","HospitalName":"中国人民解放军南方战区海军第一医院","HospitalAlias":"","Grade":"三级甲","GovermentKeyCustomer":null,"Fax":null,"City":"湛江市","Category":"H1","AttributeType":"军队","Address":"湛江市海滨三路40号"}]}';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM201'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }
    @isTest
    static void test_nfm202() {
        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM202';
        rowData.Log__c = '{"Monitoring":{"TransmissionDateTime":"201909242313","Text":"","Tag":"MSGH","Sender":"SFDC","Receiver":"SPO","NumberOfRecord":"1","MessageType":"NFM202","MessageGroupNumber":"20190002169812"},"GeData":[{"TransType":"1","Trade":"内贸","TermContractNo":null,"SubmitUser":"om002442","STMSPackage":false,"SpecialLanhai":false,"SpecialDealerCode":"0000024659","SpecialAohui":false,"Special170":false,"SpeciaDealerCode_2":"0000031195","Situation":null,"SalesType":"经销商分销","SalesRoot":"经销","SalesPoint":"甘肃省","SalesMethod":"政府招标","Quote_Code":"BJ-GI-GS0617304-01","Province":"甘肃省","OwnerNo":"om003300","OwnerDepartment":"3.西北","OrderType":null,"OppCategory":"CLBIC-00100","ListPrice":2890000.0000,"Items":[{"SalesPackagingUnit_c":"件","RegistrationNo":"CFDA(I)20132224692;国械注进20172220671","Quantity":1.00,"ProductionCompany":"奥林巴斯医疗株式会社","ProductCode":"N3805860","MasterPrice":598000.00},{"SalesPackagingUnit_c":"件","RegistrationNo":"CFDA(I)20142220533;国械注进20172226484","Quantity":1.00,"ProductionCompany":"奥林巴斯医疗株式会社","ProductCode":"N3805760","MasterPrice":342000.00},{"SalesPackagingUnit_c":"件","RegistrationNo":"FYL","Quantity":1.00,"ProductionCompany":"奥林巴斯医疗株式会社","ProductCode":"N5374330","MasterPrice":125000.00},{"SalesPackagingUnit_c":"件","RegistrationNo":"FYL","Quantity":1.00,"ProductionCompany":"KeyMed(Medical & Industrial Equipement)Ltd.","ProductCode":"K10021768","MasterPrice":84000.00},{"SalesPackagingUnit_c":"件","RegistrationNo":"CFDA(I)20143221945;国械注进20173222125","Quantity":2.00,"ProductionCompany":"奥林巴斯医疗株式会社","ProductCode":"N3803830","MasterPrice":498000.00},{"SalesPackagingUnit_c":"件","RegistrationNo":"CFDA(I)20143220518;国械注进20173221606","Quantity":1.00,"ProductionCompany":"奥林巴斯医疗株式会社","ProductCode":"N3803330","MasterPrice":660000.00},{"SalesPackagingUnit_c":"件","RegistrationNo":"国械注进20172221931;CFDA(I)20132224686","Quantity":1.00,"ProductionCompany":"生产企业名称:KeyMed (Medical & Industrial Equipment)Ltd.卡麦德医疗器械有限公司","ProductCode":"K10001145","MasterPrice":80000.00},{"SalesPackagingUnit_c":"件","RegistrationNo":"国械注进20172221931;CFDA(I)20132224686","Quantity":1.00,"ProductionCompany":"生产企业名称:KeyMed (Medical & Industrial Equipment)Ltd.卡麦德医疗器械有限公司","ProductCode":"K10016135","MasterPrice":5000.00}],"InquiryCode":"BJ-GI-GS0617304","HPCode":"370992","GroupPurchase":false,"DepartmentCode":"7396995","DealerFinalPrice":2300000.00,"Cost":706891.0000,"ContractPrice":1502800.00,"City":"临夏回族自治州","Authorized_DB_No":null,"Agent12Price":null}]}';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM202'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }
    @isTest
    static void test_nfm207() {
        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM207';
        rowData.Log__c = '{"Monitoring":{"TransmissionDateTime":"201906141716","Text":"","Tag":"MSGH","Sender":"SFDC","Receiver":"SPO","NumberOfRecord":"1","MessageType":"NFM207","MessageGroupNumber":"20190001998065"},"GeData":[{"QISCode":"OCSM-华北-152PA-06037","Products":[{"SerialNumber":"191W","ProductName":"WA22367A:工作把手","ProductCode":"WA22367A","ManagementNumber":"FMYJU","ContractNumber":"BJ-GYN-190314"}],"AssistantNo":"om001379"}]}';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM207'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }
    @isTest
    static void test_nfm009() {
        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM009';
        rowData.Log__c = '{"Monitoring":{"TransmissionDateTime":"201906141716","Text":"","Tag":"MSGH","Sender":"SFDC","Receiver":"SPO","NumberOfRecord":"1","MessageType":"NFM207","MessageGroupNumber":"20190001998065"},"GeData":[{"QISCode":"OCSM-华北-152PA-06037","Products":[{"SerialNumber":"191W","ProductName":"WA22367A:工作把手","ProductCode":"WA22367A","ManagementNumber":"FMYJU","ContractNumber":"BJ-GYN-190314"}],"AssistantNo":"om001379"}]}';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM009'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }
    @isTest
    static void test_nfm401() {
        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM401';
        rowData.Log__c = '{"GeneralDatadummy":[{"SYSTEM_STATUS":"R3","SYSTEM_SOURCEID":"a0J1000000aYwRpEAK"}]}';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM401'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }
    @isTest
    static void test_nfm605() {
        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM605';
        rowData.Log__c = '[{"strategicDepartmenCd":"359015其他","reportSendTime":"20220107000000","reportSeasonStartDate":"20211008000000","reportSeasonEndDate":"20220107000000","reportSeason":"第4季度","hospitalCd":"359015","departmentCd":"1123914","CurDistributionTimes":5,"contractStartDate":"20210108000000","contractEquipQty":"33","contractEndDate":"20240107000000","contractCd":"BJ-RS-SD0058690","ActDistributionTimes":4}]';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM605'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }
    @isTest
    static void test_nfm621() {
        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM621';
        rowData.Log__c = '{"GeDatas":{"Monitoring":{"TransmissionDateTime":"202112131319","timestamp":null,"Text":"","Tag":"MSGH","sign":null,"Sender":"SFDC","Receiver":"共通平台/服务新系统","NumberOfRecord":"1","MessageType":"NFM621","MessageGroupNumber":"202112131319","appKey":null,"API_TOKEN":"4f8242feab3fa2de26e4ff5d795cb143","API_TIME":"1639372799348","API_RANDOM_STR":"51F12A59378AFA4B"},"GeData":[{"ZongjianApprovalManager":"aa156618","StayOrNot":"在职","StatePlatForm":"","State":"北京市","OnlinePlatformManager":null,"OnlinePlatformBuchang":null,"Name":"刘 璐","JobStartDate":"2021-06-16","JobCategoryPicklist":"IT","GroupDep":"应用支援课","FederationIdentifier":"om003669@olympus.com.cn","EmployeeNo":"om003669","Email":"lu_liu@olympus.com.cn","Department":"应用系统推进部","BusinessDivision":"7.能量"}]}}';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM621'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }
    @isTest
    static void test_nfm622() {
        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM622';
        rowData.Log__c = '{"Monitoring":{"username":"SFDC","TransmissionDateTime":"202112131337","Text":"","Tag":"MSGH","Sender":"SFDC","Receiver":"智慧医疗","password":"sfdcsendtoonline","NumberOfRecord":"1","MessageType":"NFM622","MessageGroupNumber":"20210003799464"},"GeData":[{"Status":"公开中","StartDate":"20210420","Num":"MT-XB-202104-5495","Name":"肿瘤医院现地OPD","EndDate":"20210422"}]}';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM622'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }
    @isTest
    static void test_nfm112() {
        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM112';
        rowData.Log__c = '{"Monitoring":{"TransmissionDateTime":"202206161922","Text":"","Tag":"MSGH","Sender":"SFDC","Receiver":"NFM112","NumberOfRecord":"1","MessageType":"NFM112","MessageGroupNumber":"20220004668540"},"Agent":{"AgentCode":"0002580370","AdvancePaymentFlag":""}}';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM112'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }
    @isTest
    static void test_nfm701() {
        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM701';
        rowData.Log__c = '{"Monitoring":{"TransmissionDateTime":"20220314132919","Text":"","Tag":"MSGH","Sender":"SFDC","Receiver":"OBPM","NumberOfRecord":"1","MessageType":"NFM701","MessageGroupNumber":"20220314132919"},"GeData":[{"StateMaster":"西藏自治区","LinkedHospitalMCode":"","IsMerge":false,"IsActive":true,"HospitalName":"白朗县卫生服务中心","HospitalMCode":"8098004","Grade":"一级","DataType":"Hospital","CityMaster":"日喀则地区","Address":"西藏自治区日喀则地区白朗县文化街中段2号"}]}';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM701'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }
    @isTest
    static void test_nfm702() {
        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM702';
        rowData.Log__c = '{"Monitoring":{"TransmissionDateTime":"20220402112137","Text":"","Tag":"MSGH","Sender":"SFDC","Receiver":"OBPM","NumberOfRecord":"1","MessageType":"NFM702","MessageGroupNumber":"20220402112137"},"GeData":[{"UpdateStatus":"I","StaffMCode":"C000138492","OfficeName":"普外科","Name":"***","Mobile":"***********","IsActive":true,"HospitalName":"TEST BJ 医院","HcpNo":null,"DataId":"959746874405818369"}]}';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM702'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }
    @isTest
    static void test_nfm703() {
        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM703';
        rowData.Log__c = '{"Monitoring":{"TransmissionDateTime":"20220315094306","Text":"","Tag":"MSGH","Sender":"SFDC","Receiver":"OBPM","NumberOfRecord":"1","MessageType":"NFM703","MessageGroupNumber":"20220315094306"},"GeData":[{"WorkshopPlace":"北京协和学术会堂","StateMaster":"北京市","StartDate":"2022-04-15","SharedEditing":"om002406,om000586","OfficeCategory":"GS（MEBG）","Num":"MT-HB-202203-7131","Name":"2022年北京协和医院普通外科微创技术论坛 (2022/04/15 - 2022/04/17)","MeetingType":"赞助会","HostName":"中国研究型医院学会","ExpectedOlympusAttendance":"10","ExpectedHcpAttendance":"50","EndDate":"2022-04-17","CooperatorCompany":"北京协和医院","CityMaster":"西城区","BudgetType":"产品推广","ActivityTypeName":null}]}';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM703'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }
    @isTest
    static void test_nfm607() {

        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM607';
        // rowData.Log__c = '[{"workDesc":"1227测试","visitDistinction":"用户拜访","taskItem":"工作活动","strategicDepartmenCd":"2075104普外科","purposeOfVisit":"新品装机","mngCd":"C000026119","departmentCd":"2184651","customerNm":"庞传虎","activityStartTime":"20211227113512","activityID":"99","activityEndTime":"20211227113513","activityDifferentiation":"设备安装","activityDailyDate":"2021-12-27"}]';
        rowData.Log__c = '[{"workDesc":"","visitDistinction":"","taskItem":"","strategicDepartmenCd":"","purposeOfVisit":"","mngCd":"","departmentCd":"","customerNm":"","activityStartTime":"","activityID":"","activityEndTime":"","activityDifferentiation":"","activityDailyDate":""}]';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM607'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }
    @isTest
    static void test_nfm705() {

        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM705';
        // rowData.Log__c = '[{"workDesc":"1227测试","visitDistinction":"用户拜访","taskItem":"工作活动","strategicDepartmenCd":"2075104普外科","purposeOfVisit":"新品装机","mngCd":"C000026119","departmentCd":"2184651","customerNm":"庞传虎","activityStartTime":"20211227113512","activityID":"99","activityEndTime":"20211227113513","activityDifferentiation":"设备安装","activityDailyDate":"2021-12-27"}]';
        rowData.Log__c = '[{"WorkshopPlace":"","StateMaster":"","StartDate":"","SponsorshipCategory":",","SharedEditing":"","ProcessState":130,"OfficeCategory":"GYN（MEBG）,","Num":"","Name":"","MeetingType":"","MeetingApprovedNo":"","IsPaidToSponsor":"Y","IsCoOrganizingActivities":"N","HostName":"  ","ExpectedOlympusAttendance":0,"ExpectedHcpAttendance":0,"EndDate":"","CooperatorCompany":"","ConveningParticipantsNum":0,"CityMaster":"","BudgetType":"","Applicant":"","ActivityTypeName":""}]';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM705'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }
    @isTest
    static void test_nfm706() {

        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM706';
        // rowData.Log__c = '[{"workDesc":"1227测试","visitDistinction":"用户拜访","taskItem":"工作活动","strategicDepartmenCd":"2075104普外科","purposeOfVisit":"新品装机","mngCd":"C000026119","departmentCd":"2184651","customerNm":"庞传虎","activityStartTime":"20211227113512","activityID":"99","activityEndTime":"20211227113513","activityDifferentiation":"设备安装","activityDailyDate":"2021-12-27"}]';
        rowData.Log__c = '[{"ProcessState":130,"Num":"","MeetingApprovedNo":""}]';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM706'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }
    @isTest
    static void test_nfm707() {

        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM707';
        // rowData.Log__c = '[{"workDesc":"1227测试","visitDistinction":"用户拜访","taskItem":"工作活动","strategicDepartmenCd":"2075104普外科","purposeOfVisit":"新品装机","mngCd":"C000026119","departmentCd":"2184651","customerNm":"庞传虎","activityStartTime":"20211227113512","activityID":"99","activityEndTime":"20211227113513","activityDifferentiation":"设备安装","activityDailyDate":"2021-12-27"}]';
        rowData.Log__c = '[{"SocietyHoldPlace":"","Publicity":"","Num":"","MeetingApprovedNo":"","Competitor":""}]';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM707'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }
    @isTest
    static void test_nfm611() {

        BatchIF_Log__c rowData = new BatchIF_Log__c();
        rowData.Type__c = 'NFM611';
        // rowData.Log__c = '[{"workDesc":"1227测试","visitDistinction":"用户拜访","taskItem":"工作活动","strategicDepartmenCd":"2075104普外科","purposeOfVisit":"新品装机","mngCd":"C000026119","departmentCd":"2184651","customerNm":"庞传虎","activityStartTime":"20211227113512","activityID":"99","activityEndTime":"20211227113513","activityDifferentiation":"设备安装","activityDailyDate":"2021-12-27"}]';
        rowData.Log__c = '[{"repairOrderInfo":{"repairOrderNo":"","repairNo":"","api_type":2},"quotationInfo":{"PlanQuotationDate":null,"ActualQuotationEndTime":"","ActualQuotationDate":null},"logisticsInfo":{"logisticsSendTime":null,"logisticsReceiveTime":null,"logisticsNo":null,"logisticsLatestStatus":null,"carrier":null},"equipReturnInfo":{"PlanReturnDate":"","engineerType":"","ActualReturnStartTime":"","ActualReturnDate":""}}]';
        rowData.retry_cnt__c = 1;
        rowData.MessageGroupNumber__c = '123123';
        rowData.RowDataFlg__c = true;
        insert rowData;
        BatchIF_Log__c[] logs =[Select Id,
                                    Name,
                                    Log__c,
                                    Type__c,
                                    ErrorLog__c,
                                    Log2__c,
                                    Log3__c,
                                    Log4__c,
                                    Log5__c,
                                    Log6__c,
                                    Log7__c,
                                    Log8__c,
                                    Log9__c,
                                    Log10__c,
                                    Log11__c,
                                    Log12__c,
                                    MessageGroupNumber__c,
                                    CreatedDate,
                                    retry_cnt__c
                                from BatchIF_Log__c
                                where RowDataFlg__c = true
                                and Type__c = 'NFM611'
                                order by CreatedDate desc ];

        logs[0].retry_cnt__c=1;
        update logs;
        Database.executeBatch(new LogAutoSendBatch(logs[0].Id),1);
    }
}