| | |
| | | private class RentalFixtureSetAssignAgencyCtrlTest { |
| | | private static User u; |
| | | static void setupTestData(Boolean hasAnother) { |
| | | // 20220316 ljh add start |
| | | // 奥林巴斯日历 |
| | | OlympusCalendar__c oc = new OlympusCalendar__c(); |
| | | oc.Date__c = System.Today(); |
| | | oc.Before_1_WorkDay__c = oc.Date__c.addDays(-1); |
| | | insert oc; |
| | | // 20220316 ljh add end |
| | | System.runAs(new User(Id = Userinfo.getUserId())) { |
| | | StaticParameter.EscapeNFM001AgencyContractTrigger = true; |
| | | StaticParameter.EscapeNFM001Trigger = true; |
| | |
| | | insert dep; |
| | | |
| | | // 产品 |
| | | // 20220317 ljh Fixture_Model_No__c和配套的 主体备品配套明细型号应该一致 |
| | | Product2 pro1 = new Product2(Name='name01',IsActive=true,Family='GI', |
| | | Fixture_Model_No__c='n01',Serial_Lot_No__c='S/N tracing', |
| | | Fixture_Model_No_T__c = 'n01', Asset_Model_No__c = 'Pro1', |
| | | Fixture_Model_No__c='modelNo1',Serial_Lot_No__c='S/N tracing', |
| | | Fixture_Model_No_T__c = 'modelNo1', Asset_Model_No__c = 'Pro1', |
| | | ProductCode_Ext__c='pc01',Manual_Entry__c=false); |
| | | Product2 pro2 = new Product2(Name='name02',IsActive=true,Family='GI', |
| | | Fixture_Model_No__c='n02',Serial_Lot_No__c='Lot tracing', |
| | |
| | | //20210524 ljh add 1829 start |
| | | // 产品 |
| | | Product2 pro10 = new Product2(Name='name010',IsActive=true,Family='GI', |
| | | Fixture_Model_No__c='n010',Serial_Lot_No__c='S/N tracing', |
| | | Fixture_Model_No_T__c = 'n010', Asset_Model_No__c = 'Pro10', |
| | | Fixture_Model_No__c='modelNo10',Serial_Lot_No__c='S/N tracing', |
| | | Fixture_Model_No_T__c = 'modelNo10', Asset_Model_No__c = 'Pro10', |
| | | ProductCode_Ext__c='pc010',Manual_Entry__c=false); |
| | | Product2 pro20 = new Product2(Name='name020',IsActive=true,Family='GI', |
| | | Fixture_Model_No__c='n020',Serial_Lot_No__c='Lot tracing', |
| | |
| | | |
| | | // 申请单变为已批准 |
| | | raObj.Status__c = '已批准'; |
| | | raObj.Request_approval_time__c = Datetime.now().addDays(-1);// 20220317 ljh add 审批时间 |
| | | update raObj; |
| | | } |
| | | |
| | |
| | | controller.init(); |
| | | // 第一次分配 |
| | | controller.esdList[0].checked = true; |
| | | controller.parentObj.Asset_loaner_start_day__c = Date.today()+1;//20210513 ljh update |
| | | controller.parentObj.Asset_loaner_start_day__c = Date.today().addDays(1);//20210513 ljh update |
| | | controller.applyDate(); |
| | | controller.stepName = '分配'; |
| | | |
| | |
| | | // controller.esdList[0].checked = true; |
| | | // controller.stockDown();// 20210624 ljh update SFDC-C448GR |
| | | |
| | | ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id); |
| | | /*ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id); |
| | | Test.setCurrentPage(ref); |
| | | controller = new RentalFixtureSetAssignAgencyController(); |
| | | // 下架后重新分配 |
| | |
| | | controller.esdList[0].checked = true; |
| | | controller.qrcode = '51110001;2;'+controller.esdList[0].rec.Rental_Apply_Equipment_Set__c; |
| | | controller.scanAndMatch(); |
| | | controller.assign(); |
| | | controller.assign();*/ |
| | | |
| | | Test.stopTest(); |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | @isTest |
| | | // 20220317 ljh 控制必须填,写在前端了所以这个不需要了 |
| | | /*@isTest |
| | | public static void test_cancelSet_error() { |
| | | setupTestData(false); |
| | | |
| | |
| | | Test.stopTest(); |
| | | |
| | | List<Apexpages.message> msgs = ApexPages.getMessages(); |
| | | //System.assertEquals('取消理由和取消理由备注不可为空!', msgs[0].getDetail()); |
| | | //System.debug('init Error'); |
| | | |
| | | } |
| | | System.assertEquals('取消理由和取消理由备注不可为空!', msgs[0].getDetail()); |
| | | System.debug('init Error'); |
| | | }*/ |
| | | |
| | | @isTest |
| | | public static void test_shipment() { |
| | |
| | | controller.parentObj.Delivery_Agency__c = '北京市'; |
| | | controller.shipment(); |
| | | Test.stopTest(); |
| | | //System.assertEquals(true, controller.done_flg); |
| | | |
| | | //List<Apexpages.message> msgs = ApexPages.getMessages(); |
| | | //System.assertEquals('必须填写【物流公司】', msgs[0].getDetail()); |
| | | //System.debug('init Error'); |
| | | |
| | | System.assertEquals(true, controller.done_flg); |
| | | // 20220317 ljh add 验证数据使用 start |
| | | // List<Apexpages.message> msgs = ApexPages.getMessages(); |
| | | // System.assertEquals('test', msgs[0].getDetail()); |
| | | } |
| | | |
| | | @isTest |
| | |
| | | Test.stopTest(); |
| | | |
| | | List<Apexpages.message> msgs = ApexPages.getMessages(); |
| | | //System.assertEquals('n01未分配不可发货!', msgs[0].getDetail()); |
| | | System.debug('init Success'); |
| | | System.assertEquals('发货-办事处为空,不能发货', msgs[0].getDetail()); |
| | | System.debug('init Error'); |
| | | |
| | | } |
| | | |
| | |
| | | System.debug('init Success'); |
| | | |
| | | } |
| | | /** |
| | | static testMethod void updaue() { |
| | | RentalFixtureSetAssignAgencyController.test();//先调用这个,然后继续补充测试类 |
| | | } |
| | | **/ |
| | | } |