张宇恒
2022-04-28 e5e7ddf81d380f7241bcafd15d81c08a25e21b7f
force-app/main/default/classes/NFM603ControllerTest.cls
@@ -74,7 +74,11 @@
        ast = [select Id, Name, Product_Serial_No__c, AccountId, Department_Class__c, Department_Class__r.Management_Code_Auto__c, Hospital__c, Product2Id, Product2.ProductCode, Product2.Repair_Product_Code__c, SerialNumber
               from Asset
               where Id = :ast.Id];
        RepairSubOrder__c subOrder = new RepairSubOrder__c();
        subOrder.AttachmentDownload__c = true;
        subOrder.AttachmentLink__c = 'https://albsylfw.s3.cn-northwest-1.amazonaws.com.cn/20211220/14/11/30/lessthan12/5e8cb69e-f935-48f5-825e-b8344d60f6d4.zip';
        subOrder.AttachmentName__c = '测试附件下载';
        insert subOrder;
        Repair__c rpr = new Repair__c();
        rpr.PAE_Determine__c = 'PAE' ;   //-- 
        rpr.ifDeadHurt__c = '有';        //-- R1
@@ -83,12 +87,16 @@
        rpr.Account__c             = depart.Id;
        rpr.Department_Class__c    = section.Id;
        rpr.Hospital__c            = company.Id;
        rpr.DeliveryLogisticsMode__c = '其他';
        rpr.RepairSubOrder__c = subOrder.Id;
        rpr.Delivered_Product__c   = ast.Id;
        rpr.Status__c              = '1.受理完毕';
        rpr.SAP_Transfer_time__c = null;
        rpr.Incharge_Staff__c = Userinfo.getUserId();
        rpr.Repair_Detail__c = 'test';
        rpr.GeneratedPDFField__c = null;
        rpr.AsyncData__c    = true;
        rpr.AwaitToSendAWS__c = false;
        rpr.Complaint_Number__c = null;
        rpr.ReportAdverseEvents__c = '有';
        rpr.ProblemOccurred__c = '到货验收';
@@ -99,6 +107,7 @@
        rpr.Failure_Occurrence_Date__c = Date.today();
        rpr.Repair_Ordered_Date__c = Date.today();
        rpr.Repair_Shipped_Date__c = Date.today();
        rpr.Repair_Ordered_DateTime__c = Datetime.newInstance(2022,04,13,18,18,18);
        rpr.ReturnType__c = 'A20';
        rpr.AwaitToSendAWS__c = true;
        //rpr.Returns_Product_waySAP__c = '返送医院';
@@ -230,6 +239,29 @@
        Test.stopTest();
    }
    @isTest
    static void testCallOut1_2(){
      List<Repair__c> repairList = [select id,Repair_Ordered_DateTime__c,OTSRepairOrder__c,SAP_Transfer_time__c,Status__c from Repair__c];
      Test.startTest();
        List<Id> idList = new List<Id>();
        for(Repair__c repair : repairList){
            repair.Repair_Ordered_DateTime__c = Datetime.newInstance(2022,04,13,05,18,18);
        repair.SAP_Transfer_time__c = Datetime.newInstance(2022,04,13,18,18,18);
            repair.OTSRepairOrder__c = '123123123';
          // idList.add(repair.Id);
        }
        upsert repairList;
        for(Repair__c repair : repairList){
          idList.add(repair.Id);
        }
        BatchIF_Log__c iflog = new BatchIF_Log__c();
        iflog.Log__c = 'test start \n';
        insert iflog;
        NFM603Controller.executefuture(iflog,idList);
        Test.stopTest();
    }
    // @isTest
    // static void testcallout2(){
@@ -246,11 +278,11 @@
    //     Test.stopTest();
    // }
    @isTest
    static void testcallout3(){
      BatchIF_Log__c iflog = [select id from BatchIF_Log__c where Type__c = '603test'];
        NFM603Controller.ManualExecute(iflog.Id);
    }
    // @isTest
    // static void testcallout3(){
    //   BatchIF_Log__c iflog = [select id from BatchIF_Log__c where Type__c = '603test' limit 1];
    //     NFM603Controller.ManualExecute(iflog.Id);
    // }
    @isTest
    static void NFM603BatchTest01(){