| | |
| | | |
| | | // 产品 |
| | | 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__c='modlen01',Serial_Lot_No__c='S/N tracing', |
| | | Fixture_Model_No_T__c = 'n01', Asset_Model_No__c = 'Pro1', |
| | | ProductCode_Ext__c='pc01',Manual_Entry__c=false); |
| | | Product2 pro2 = new Product2(Name='name02',IsActive=true,Family='GI', |
| | |
| | | Fixture_Set__c fsObj1 = new Fixture_Set__c(); |
| | | //fsObj1.Name = 'set1'; |
| | | fsObj1.Name = 'n01'; |
| | | fsObj1.Fixture_Set_Body_Model_No__c = 'n01'; |
| | | fsObj1.Fixture_Set_Body_Model_No__c = 'modlen01'; |
| | | fsObj1.Loaner_name__c = 'name1'; |
| | | insert fsObj1; |
| | | |
| | |
| | | raesdObj3.Product_category_text__c = 'GI'; |
| | | raesdObj3.Equipment_Type_text__c = '产品试用'; |
| | | raesdObj3.Cancel_Select__c=false; |
| | | insert new Rental_Apply_Equipment_Set_Detail__c[] {raesdObj1,raesdObj2,raesdObj3}; |
| | | |
| | | Rental_Apply_Equipment_Set_Detail__c raesdObj4 = new Rental_Apply_Equipment_Set_Detail__c(); |
| | | raesdObj4.Rental_Apply__c = raObj.Id; //raesdObj3.Asset__c = asset3.Id; |
| | | raesdObj4.Fixture_Set_Detail__c = fsdObjA3.Id; |
| | | raesdObj4.Rental_Num__c = 1; |
| | | raesdObj4.Queue_Number__c = null; |
| | | raesdObj4.Is_Body__c = false; |
| | | raesdObj4.Rental_Apply_Equipment_Set__c = raesObj.Id; |
| | | raesdObj4.IndexFromUniqueKey__c = 4; |
| | | raesdObj4.UniqueKey__c = '1:'+ raesObj.Id + ':' + fsdObjA3.Id + ':4'; |
| | | raesdObj4.FSD_OneToOneAccessory_Cnt__c = 2; |
| | | raesdObj4.FSD_Is_Optional__c = false; |
| | | raesdObj4.FSD_Is_OneToOne__c = false; |
| | | raesdObj4.ApplyPersonAppended__c = false; |
| | | raesdObj4.FSD_Fixture_Model_No__c = 'n04'; |
| | | raesdObj4.Fixture_Model_No_text__c = 'n04'; |
| | | raesdObj4.Salesdepartment_before__c = '1.华北营业本部'; |
| | | raesdObj4.Internal_asset_location_before__c = '北京 备品中心'; |
| | | raesdObj4.Product_category_text__c = 'GI'; |
| | | raesdObj4.Equipment_Type_text__c = '产品试用'; |
| | | raesdObj4.Cancel_Select__c=true; |
| | | raesdObj4.Cancel_Reason__c= '主动取消'; |
| | | insert new Rental_Apply_Equipment_Set_Detail__c[] {raesdObj1,raesdObj2,raesdObj3,raesdObj4}; |
| | | |
| | | // 申请单变为已批准 |
| | | raObj.Status__c = '已批准'; |
| | |
| | | |
| | | System.assertEquals(false, controller.done_flg); |
| | | System.debug('init Success'); |
| | | |
| | | } |
| | | |
| | | @isTest |
| | | public static void test_cancelSet3() { |
| | | |
| | | List<Rental_Apply__c> esList = [SELECT Id FROM Rental_Apply__c]; |
| | | |
| | | PageReference ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id); |
| | | Test.setCurrentPage(ref); |
| | | |
| | | RentalFixtureSetAssignAgencyController controller = new RentalFixtureSetAssignAgencyController(); |
| | | Test.startTest(); |
| | | |
| | | controller.init(); |
| | | controller.esdList[0].checked = false; |
| | | // 20210916 ljh update start |
| | | // controller.cancelReason = '主动取消'; |
| | | // controller.cancelReasonRemark = 'aaaa'; |
| | | controller.parentObj.Cancel_Reason__c = '主动取消'; |
| | | controller.parentObj.Loaner_cancel_reason__c = '重复申请'; |
| | | // 20210916 ljh update end |
| | | controller.cancelSet(); |
| | | Test.stopTest(); |
| | | |
| | | //System.assertEquals(true, controller.done_flg); |
| | | //System.debug('init Success'); |
| | | |
| | | } |
| | | |
| | |
| | | System.debug('init Success'); |
| | | } |
| | | |
| | | //20210521 ljh add 1829 start |
| | | @isTest |
| | | public static void test_assignSub() { |
| | | @isTest |
| | | public static void test_assign() { |
| | | |
| | | changeData(); |
| | | |
| | | List<Rental_Apply__c> esList = [SELECT Id FROM Rental_Apply__c]; |
| | | |
| | | PageReference ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id); |
| | | Test.setCurrentPage(ref); |
| | | |
| | | RentalFixtureSetAssignAgencyController controller = new RentalFixtureSetAssignAgencyController(); |
| | | Test.startTest(); |
| | | |
| | | controller.init(); |
| | | // 第一次分配 |
| | | controller.esdList[0].checked = true; |
| | | controller.parentObj.Asset_loaner_start_day__c = Date.today()+1;//20210513 ljh update |
| | | controller.applyDate(); |
| | | controller.stepName = '分配'; |
| | | |
| | | controller.qrcode = '511100000;2;'+controller.esdList[0].rec.Rental_Apply_Equipment_Set__c; |
| | | controller.scanAndMatch(); |
| | | controller.assign(); |
| | | |
| | | // controller.stepName = '下架'; |
| | | // controller.esdList[0].checked = true; |
| | | // controller.stockDown();// 20210624 ljh update SFDC-C448GR |
| | | |
| | | ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id); |
| | | controller = new RentalFixtureSetAssignAgencyController(); |
| | | // 下架后重新分配 |
| | | controller.init(); |
| | | controller.stepName = '分配'; |
| | | controller.esdList[0].checked = true; |
| | | controller.qrcode = '51110001;2;'+controller.esdList[0].rec.Rental_Apply_Equipment_Set__c; |
| | | controller.scanAndMatch(); |
| | | controller.assign(); |
| | | |
| | | Test.stopTest(); |
| | | |
| | | //System.assertEquals(true, controller.done_flg); |
| | | System.debug('init Success'); |
| | | } |
| | | |
| | | |
| | | @isTest |
| | | public static void test_assignSub3() { |
| | | |
| | | List<Rental_Apply__c> esList = [SELECT Id FROM Rental_Apply__c]; |
| | | |
| | | PageReference ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id); |
| | | Test.setCurrentPage(ref); |
| | | |
| | | RentalFixtureSetAssignAgencyController controller = new RentalFixtureSetAssignAgencyController(); |
| | | Test.startTest(); |
| | | |
| | | controller.init(); |
| | | // 第一次分配 |
| | | controller.esdList[0].checked = true; |
| | | controller.parentObj.Asset_loaner_start_day__c = Date.today()+1;//20210513 ljh update |
| | | controller.applyDate(); |
| | | controller.stepName = '分配'; |
| | | |
| | | controller.qrcode = '511100000;2;'+controller.esdList[1].rec.Rental_Apply_Equipment_Set__c; |
| | | controller.scanAndMatch(); |
| | | controller.assign(); |
| | | |
| | | // controller.stepName = '下架'; |
| | | // controller.esdList[0].checked = true; |
| | | // controller.stockDown();// 20210624 ljh update SFDC-C448GR |
| | | |
| | | ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id); |
| | | controller = new RentalFixtureSetAssignAgencyController(); |
| | | // 下架后重新分配 |
| | | controller.init(); |
| | | controller.stepName = '分配'; |
| | | controller.esdList[0].checked = true; |
| | | controller.qrcode = '51110001;2;'+controller.esdList[2].rec.Rental_Apply_Equipment_Set__c; |
| | | controller.scanAndMatch(); |
| | | controller.assign(); |
| | | |
| | | Test.stopTest(); |
| | | |
| | | //System.assertEquals(true, controller.done_flg); |
| | | System.debug('init Success'); |
| | | } |
| | | |
| | | @isTest |
| | | public static void test_assign() { |
| | | List<Rental_Apply__c> esList = [SELECT Id FROM Rental_Apply__c]; |
| | | |
| | | PageReference ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id); |
| | |
| | | System.debug('init Success'); |
| | | } |
| | | |
| | | //20210521 ljh add 1829 start |
| | | @isTest |
| | | public static void test_assignSub() { |
| | | List<Rental_Apply__c> esList = [SELECT Id FROM Rental_Apply__c]; |
| | | |
| | | PageReference ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id); |
| | | Test.setCurrentPage(ref); |
| | | List<Rental_Apply_Equipment_Set__c> raesone=[select Id from Rental_Apply_Equipment_Set__c]; |
| | | RentalFixtureSetAssignAgencyController controller = new RentalFixtureSetAssignAgencyController(); |
| | | Test.startTest(); |
| | | |
| | | controller.init(); |
| | | // 第一次分配 |
| | | controller.esdList[0].checked = true; |
| | | controller.parentObj.Asset_loaner_start_day__c = Date.today()+1;//20210513 ljh update |
| | | controller.applyDate(); |
| | | controller.stepName = '分配'; |
| | | |
| | | controller.qrcode = '511100000;2;'+controller.esdList[1].rec.Rental_Apply_Equipment_Set__c; |
| | | //controller.qrcode = '511100000;2;'+raesone[0].Id; |
| | | controller.scanAndMatch(); |
| | | controller.assign(); |
| | | |
| | | // controller.stepName = '下架'; |
| | | // controller.esdList[0].checked = true; |
| | | // controller.stockDown();// 20210624 ljh update SFDC-C448GR |
| | | |
| | | ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id); |
| | | controller = new RentalFixtureSetAssignAgencyController(); |
| | | // 下架后重新分配 |
| | | controller.init(); |
| | | controller.stepName = '分配'; |
| | | controller.esdList[0].checked = false; |
| | | //controller.qrcode = '511100000;2;'+controller.esdList[0].rec.Rental_Apply_Equipment_Set__c; |
| | | controller.qrcode = '511100000;2;'+raesone[0].Id; |
| | | controller.scanAndMatch(); |
| | | controller.assign(); |
| | | |
| | | Test.stopTest(); |
| | | |
| | | //System.assertEquals(true, controller.done_flg); |
| | | System.debug('init Success'); |
| | | } |
| | | |
| | | @isTest |
| | | public static void test_assignSub03() { |
| | | |
| | | List<Rental_Apply__c> esList = [SELECT Id FROM Rental_Apply__c]; |
| | | |
| | | PageReference ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id); |
| | | Test.setCurrentPage(ref); |
| | | |
| | | RentalFixtureSetAssignAgencyController controller = new RentalFixtureSetAssignAgencyController(); |
| | | Test.startTest(); |
| | | |
| | | controller.init(); |
| | | // 第一次分配 |
| | | controller.esdList[0].checked = true; |
| | | controller.parentObj.Asset_loaner_start_day__c = Date.today()+1;//20210513 ljh update |
| | | controller.applyDate(); |
| | | controller.stepName = '分配'; |
| | | |
| | | controller.qrcode = '511100000;2;'+controller.esdList[0].rec.Rental_Apply_Equipment_Set__c; |
| | | controller.scanAndMatch(); |
| | | controller.assign(); |
| | | |
| | | // controller.stepName = '下架'; |
| | | // controller.esdList[0].checked = true; |
| | | // controller.stockDown();// 20210624 ljh update SFDC-C448GR |
| | | |
| | | ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id); |
| | | Test.setCurrentPage(ref); |
| | | controller = new RentalFixtureSetAssignAgencyController(); |
| | | // 下架后重新分配 |
| | | controller.init(); |
| | | controller.stepName = '分配'; |
| | | controller.esdList[0].checked = true; |
| | | controller.qrcode = '51110001;2;'+controller.esdList[0].rec.Rental_Apply_Equipment_Set__c; |
| | | List<Asset> mainAssetList = [ |
| | | SELECT Id |
| | | , Fixture_Model_No_F__c |
| | | , Internal_asset_location__c |
| | | , SerialNumber |
| | | , Salesdepartment__c |
| | | , SalesProvince__c |
| | | , Product_category__c |
| | | , Equipment_Type__c |
| | | , Internal_Asset_number_key__c |
| | | FROM Asset |
| | | WHERE Fixture_QRCode__c ='51110001' |
| | | //AND Main_OneToOne__c = true //20210508 ljh add 1834 |
| | | AND You_Xiao_Ku_Cun__c > 0 |
| | | LIMIT 1 |
| | | ]; |
| | | List<Product2> pro2l=[select id from Product2 where Fixture_Model_No_T__c != 'n01']; |
| | | mainAssetList[0].Product2=pro2l[0]; |
| | | update mainAssetList; |
| | | controller.scanAndMatch(); |
| | | controller.assign(); |
| | | Test.stopTest(); |
| | | //System.assertEquals(true, controller.done_flg); |
| | | System.debug('init Success'); |
| | | } |
| | | |
| | | |
| | | @isTest |
| | | public static void test_assignSub04() { |
| | | List<Rental_Apply__c> esList = [SELECT Id FROM Rental_Apply__c]; |
| | | |
| | | PageReference ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id); |
| | | Test.setCurrentPage(ref); |
| | | List<Rental_Apply_Equipment_Set__c> raesone=[select Id from Rental_Apply_Equipment_Set__c]; |
| | | RentalFixtureSetAssignAgencyController controller = new RentalFixtureSetAssignAgencyController(); |
| | | Test.startTest(); |
| | | |
| | | controller.init(); |
| | | // 第一次分配 |
| | | controller.esdList[0].checked = true; |
| | | controller.parentObj.Asset_loaner_start_day__c = Date.today()+1;//20210513 ljh update |
| | | controller.applyDate(); |
| | | controller.stepName = '分配'; |
| | | |
| | | controller.qrcode = '511100000;2;'+controller.esdList[1].rec.Rental_Apply_Equipment_Set__c; |
| | | //controller.qrcode = '511100000;2;'+raesone[0].Id; |
| | | controller.scanAndMatch(); |
| | | controller.assign(); |
| | | |
| | | ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id); |
| | | controller = new RentalFixtureSetAssignAgencyController(); |
| | | // 下架后重新分配 |
| | | controller.init(); |
| | | controller.stepName = '分配'; |
| | | integer i=controller.esdList.size(); |
| | | for(integer j=0;i<i;j++){ |
| | | controller.esdList[j].checked = false; |
| | | } |
| | | //controller.qrcode = '511100000;2;'+controller.esdList[0].rec.Rental_Apply_Equipment_Set__c; |
| | | controller.qrcode = '511100000;2;'+raesone[0].Id; |
| | | controller.scanAndMatch(); |
| | | controller.assign(); |
| | | |
| | | Test.stopTest(); |
| | | |
| | | //System.assertEquals(true, controller.done_flg); |
| | | System.debug('init Success'); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |