| | |
| | | @isTest |
| | | private class ArriveGoodsControllerTest { |
| | | |
| | | //选择等待入库,包括01 和241 |
| | | @isTest |
| | | static void arriveWithID() { |
| | | // // TO DO: implement unit test |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)']; |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | |
| | | Account myAccount2 = new Account( |
| | | name = 'Testaccount002', |
| | | Dealer_discount__c = 20, |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '9999900' |
| | | ); |
| | | Account myAccount1 = new Account(name = 'Testaccount001', Dealer_discount__c = 30, RecordTypeId = rectCo[0].Id); |
| | | insert new List<account>{ myAccount1, myAccount2 }; |
| | | |
| | | Contact core = new Contact(email = 'jplumber@salesforce.com', firstname = 'Joe', lastname = 'Plumber', accountid = myAccount1.id); |
| | | Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900'); |
| | | Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id); |
| | | insert new account[]{myAccount1,myAccount2}; |
| | | |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id); |
| | | insert core; |
| | | user MyUser_Test = new User( |
| | | ContactId = core.id, |
| | | Alias = 'newUser', |
| | | Email = 'newuser@testorg.com', |
| | | EmailEncodingKey = 'UTF-8', |
| | | LastName = 'TestUser', |
| | | LanguageLocaleKey = 'zh_CN', |
| | | LocaleSidKey = 'zh_CN', |
| | | ProfileId = prof.Id, |
| | | TimeZoneSidKey = 'Asia/Shanghai', |
| | | UserName = 'testUser@testorg.com', |
| | | UserPro_Type__c = 'ET' |
| | | ); |
| | | System.runAs(new User(Id = UserInfo.getUserId())) { |
| | | user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET'); |
| | | System.runAs(new User(Id = UserInfo.getUserId())){ |
| | | insert MyUser_Test; |
| | | } |
| | | |
| | |
| | | // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // insert new Product2[] {prod01,prod02}; |
| | | System.runAs(MyUser_Test) { |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200311', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod02 = new Product2( |
| | | Name = 'Test02', |
| | | ProductCode = 'Test02', |
| | | Asset_Model_No__c = 'Test02', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200312', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2__c pro1 = new Product2__c(Name = 'Pro001', OT_CODE_Text__c = 'N3047730', Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name = 'Pro002', OT_CODE_Text__c = 'N3047731', Product2__c = prod02.Id); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | system.runAs(MyUser_Test){ |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01,prod02}; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='N3047730',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='N3047731',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | //订单 |
| | | |
| | | Consumable_order__c Order1 = new Consumable_order__c(); |
| | |
| | | // System.assertEquals(1, Controller.ConsumableorderdetailsRecords.size()); |
| | | // System.assertEquals(2, Controller.consumableInventory.size()); |
| | | Controller.ArriveGoodsConfim(); |
| | | List<Consumable_order_details2__c> ins = [ |
| | | SELECT Id, Name |
| | | FROM Consumable_order_details2__c |
| | | ]; |
| | | List<Consumable_order_details2__c> ins = [SELECT Id,Name FROM Consumable_order_details2__c]; |
| | | // System.assertEquals(3, ins.size()); |
| | | System.Test.stopTest(); |
| | | } |
| | | } |
| | | |
| | | |
| | | //产品直接入库,包括01 和241 |
| | | @isTest |
| | | static void arriveWithoutID() { |
| | | static void arriveWithoutID() { |
| | | // // TO DO: implement unit test |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)']; |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | |
| | | Account myAccount2 = new Account( |
| | | name = 'Testaccount002', |
| | | Dealer_discount__c = 20, |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '9999900' |
| | | ); |
| | | Account myAccount1 = new Account(name = 'Testaccount001', Dealer_discount__c = 30, RecordTypeId = rectCo[0].Id); |
| | | insert new List<account>{ myAccount1, myAccount2 }; |
| | | |
| | | Contact core = new Contact(email = 'jplumber@salesforce.com', firstname = 'Joe', lastname = 'Plumber', accountid = myAccount1.id); |
| | | Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900'); |
| | | Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id); |
| | | insert new account[]{myAccount1,myAccount2}; |
| | | |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id); |
| | | insert core; |
| | | user MyUser_Test = new User( |
| | | ContactId = core.id, |
| | | Alias = 'newUser', |
| | | Email = 'newuser@testorg.com', |
| | | EmailEncodingKey = 'UTF-8', |
| | | LastName = 'TestUser', |
| | | LanguageLocaleKey = 'zh_CN', |
| | | LocaleSidKey = 'zh_CN', |
| | | ProfileId = prof.Id, |
| | | TimeZoneSidKey = 'Asia/Shanghai', |
| | | UserName = 'testUser@testorg.com', |
| | | UserPro_Type__c = 'ET' |
| | | ); |
| | | System.runAs(new User(Id = UserInfo.getUserId())) { |
| | | user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET'); |
| | | System.runAs(new User(Id = UserInfo.getUserId())){ |
| | | insert MyUser_Test; |
| | | } |
| | | |
| | |
| | | // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',ProductCode_Ext__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // Product2 prod02 = new Product2(Name='Test02',ProductCode='N3047731',ProductCode_Ext__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // insert new Product2[] {prod01,prod02}; |
| | | System.runAs(MyUser_Test) { |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200311', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod02 = new Product2( |
| | | Name = 'Test02', |
| | | ProductCode = 'Test02', |
| | | Asset_Model_No__c = 'Test02', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200312', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2__c pro1 = new Product2__c(Name = 'Pro001', OT_CODE_Text__c = 'Test01', Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name = 'Pro002', OT_CODE_Text__c = 'N3047731', Product2__c = prod02.Id); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | system.runAs(MyUser_Test){ |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01,prod02}; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test01',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='N3047731',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | PageReference page = new PageReference('/apex/ArriveGoods?ArrType=Arr'); |
| | | System.Test.setCurrentPage(page); |
| | | ArriveGoodsController Controller = new ArriveGoodsController(); |
| | |
| | | Controller.barcode = '01049531702003111115120017181000105ZK250BXJRF\n241N30477311115120017181000105ZK250BXJRA\n241Test021115120017181000105ZK250\n01049531702003111115120017181000105ZK250'; |
| | | Controller.SearchPro(); |
| | | Controller.ArriveGoodsConfim(); |
| | | List<Consumable_order_details2__c> ins = [ |
| | | SELECT Id, Name |
| | | FROM Consumable_order_details2__c |
| | | WHERE Bar_Code__c IN ('01049531702003111115120017181000105ZK250BXJRF', '241N30477311115120017181000105ZK250BXJRA') |
| | | ]; |
| | | List<Consumable_order_details2__c> ins = [SELECT Id,Name FROM Consumable_order_details2__c WHERE Bar_Code__c in ('01049531702003111115120017181000105ZK250BXJRF','241N30477311115120017181000105ZK250BXJRA')]; |
| | | // System.assertEquals(2, ins.size()); |
| | | System.Test.stopTest(); |
| | | } |
| | | } |
| | | //整体到货 |
| | | @isTest |
| | | static void ArriveTest() { |
| | | static void ArriveTest() { |
| | | // // TO DO: implement unit test |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)']; |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | |
| | | Oly_TriggerHandler.bypass('ConsumableAssetHander'); |
| | | Account myAccount2 = new Account( |
| | | name = 'Testaccount002', |
| | | Dealer_discount__c = 20, |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '9999900' |
| | | ); |
| | | Account myAccount1 = new Account(name = 'Testaccount001', Dealer_discount__c = 30, RecordTypeId = rectCo[0].Id); |
| | | insert new List<account>{ myAccount1, myAccount2 }; |
| | | Contact core = new Contact(email = 'jplumber@salesforce.com', firstname = 'Joe', lastname = 'Plumber', accountid = myAccount1.id); |
| | | Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900'); |
| | | Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id); |
| | | insert new account[]{myAccount1,myAccount2}; |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id); |
| | | insert core; |
| | | user MyUser_Test = new User( |
| | | ContactId = core.id, |
| | | Alias = 'newUser', |
| | | Email = 'newuser@testorg.com', |
| | | EmailEncodingKey = 'UTF-8', |
| | | LastName = 'TestUser', |
| | | LanguageLocaleKey = 'zh_CN', |
| | | LocaleSidKey = 'zh_CN', |
| | | ProfileId = prof.Id, |
| | | TimeZoneSidKey = 'Asia/Shanghai', |
| | | UserName = 'testUser@testorg.com', |
| | | UserPro_Type__c = 'ET' |
| | | ); |
| | | System.runAs(new User(Id = UserInfo.getUserId())) { |
| | | user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET'); |
| | | System.runAs(new User(Id = UserInfo.getUserId())){ |
| | | insert MyUser_Test; |
| | | } |
| | | |
| | |
| | | // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // insert new Product2[] {prod01,prod02}; |
| | | System.runAs(MyUser_Test) { |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200311', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod02 = new Product2( |
| | | Name = 'Test02', |
| | | ProductCode = 'Test02', |
| | | Asset_Model_No__c = 'Test02', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200312', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2__c pro1 = new Product2__c(Name = 'Pro001', OT_CODE_Text__c = 'Test001', Product2__c = prod01.Id); |
| | | insert new List<Product2__c>{ pro1 }; |
| | | system.runAs(MyUser_Test){ |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01,prod02}; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | insert new Product2__c[] {pro1}; |
| | | // Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id); |
| | | // insert myAccount1; |
| | | Consumable_order__c Order2 = new Consumable_order__c(); |
| | |
| | | Orderdet3.SerialLotNo__c = '5ZK'; |
| | | //Orderdet3.Box_Piece__c = '个'; |
| | | |
| | | |
| | | //出库产品 |
| | | Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c(); |
| | | Orderdet4.Name = 'OCM_01_001005'; |
| | |
| | | Orderdet4.Asset_Model_No__c = 'Test01'; |
| | | Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRD'; |
| | | Orderdet4.Send_Date__c = Date.today(); |
| | | Orderdet4.Send_Date__c = Date.today(); |
| | | Orderdet4.Arrive_date__c = Date.today(); |
| | | Orderdet4.Box_Piece__c = '盒'; |
| | | Orderdet4.TracingCode__c = 'BXJRD'; |
| | |
| | | Orderdet5.Consumable_Shipment_order__c = Order1.Id; |
| | | Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRE'; |
| | | Orderdet5.Arrive_date__c = Date.today(); |
| | | Orderdet5.Arrive_date__c = Date.today(); |
| | | Orderdet5.Box_Piece__c = '盒'; |
| | | Orderdet5.TracingCode__c = 'BXJRE'; |
| | | Orderdet5.SerialLotNo__c = '5ZK'; |
| | | insert new List<Consumable_order_details2__c>{ Orderdet1, Orderdet2, Orderdet3, Orderdet4, Orderdet5 }; |
| | | insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5}; |
| | | |
| | | |
| | | |
| | | ArriveGoodsController Controller = new ArriveGoodsController(); |
| | | PageReference page = new PageReference('/apex/ArriveGoods?ArrType=Arr'); |
| | |
| | | System.assertEquals('OCM_01_001002', controller.ConsumableorderdetailsRecords[0].esd.Name); |
| | | // System.assertEquals(2, controller.ConsumableorderdetailsRecordserror.size()); |
| | | System.Test.stopTest(); |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | //整体到货 |
| | | @isTest |
| | | static void ArriveTest1() { |
| | | static void ArriveTest1() { |
| | | // // TO DO: implement unit test |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)']; |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | |
| | | Oly_TriggerHandler.bypass('ConsumableAssetHander'); |
| | | Account myAccount2 = new Account( |
| | | name = 'Testaccount002', |
| | | Dealer_discount__c = 20, |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '9999900' |
| | | ); |
| | | Account myAccount1 = new Account(name = 'Testaccount001', Dealer_discount__c = 30, RecordTypeId = rectCo[0].Id); |
| | | insert new List<account>{ myAccount1, myAccount2 }; |
| | | Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900'); |
| | | Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id); |
| | | insert new account[]{myAccount1,myAccount2}; |
| | | |
| | | Contact core = new Contact(email = 'jplumber@salesforce.com', firstname = 'Joe', lastname = 'Plumber', accountid = myAccount1.id); |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id); |
| | | insert core; |
| | | user MyUser_Test = new User( |
| | | ContactId = core.id, |
| | | Alias = 'newUser', |
| | | Email = 'newuser@testorg.com', |
| | | EmailEncodingKey = 'UTF-8', |
| | | LastName = 'TestUser', |
| | | LanguageLocaleKey = 'zh_CN', |
| | | LocaleSidKey = 'zh_CN', |
| | | ProfileId = prof.Id, |
| | | TimeZoneSidKey = 'Asia/Shanghai', |
| | | UserName = 'testUser@testorg.com', |
| | | UserPro_Type__c = 'ET' |
| | | ); |
| | | System.runAs(new User(Id = UserInfo.getUserId())) { |
| | | user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET'); |
| | | System.runAs(new User(Id = UserInfo.getUserId())){ |
| | | insert MyUser_Test; |
| | | } |
| | | |
| | |
| | | // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // insert new Product2[] {prod01,prod02}; |
| | | System.runAs(MyUser_Test) { |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200311', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod02 = new Product2( |
| | | Name = 'Test02', |
| | | ProductCode = 'Test02', |
| | | Asset_Model_No__c = 'Test02', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200312', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2__c pro1 = new Product2__c(Name = 'Pro001', OT_CODE_Text__c = 'Test001', Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name = 'Pro002', OT_CODE_Text__c = 'Test002', Product2__c = prod02.Id); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | system.runAs(MyUser_Test){ |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01,prod02}; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | // Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id); |
| | | // insert myAccount1; |
| | | Consumable_order__c Order2 = new Consumable_order__c(); |
| | |
| | | Orderdet3.TracingCode__c = 'BXJRC'; |
| | | Orderdet3.SerialLotNo__c = '5ZK'; |
| | | |
| | | |
| | | //出库产品 |
| | | Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c(); |
| | | Orderdet4.Name = 'OCM_01_001005'; |
| | |
| | | Orderdet4.Asset_Model_No__c = 'Test01'; |
| | | Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRD'; |
| | | Orderdet4.Send_Date__c = Date.today(); |
| | | Orderdet4.Send_Date__c = Date.today(); |
| | | Orderdet4.TracingCode__c = 'BXJRD'; |
| | | Orderdet4.SerialLotNo__c = '5ZK'; |
| | | //Orderdet4.Box_Piece__c = '盒'; |
| | |
| | | Orderdet5.Consumable_Shipment_order__c = Order1.Id; |
| | | Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRE'; |
| | | Orderdet5.Arrive_date__c = Date.today(); |
| | | Orderdet5.Arrive_date__c = Date.today(); |
| | | Orderdet5.Box_Piece__c = '盒'; |
| | | Orderdet5.TracingCode__c = 'BXJRE'; |
| | | Orderdet5.SerialLotNo__c = '5ZK'; |
| | | insert new List<Consumable_order_details2__c>{ Orderdet1, Orderdet2, Orderdet3, Orderdet4, Orderdet5 }; |
| | | insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5}; |
| | | |
| | | |
| | | |
| | | ArriveGoodsController Controller = new ArriveGoodsController(); |
| | | PageReference page = new PageReference('/apex/ArriveGoods?ArrType=Arr'); |
| | |
| | | System.assertEquals('OCM_01_001002', controller.ConsumableorderdetailsRecords[0].esd.Name); |
| | | // System.assertEquals(1, controller.ConsumableorderdetailsRecordserror.size()); |
| | | System.Test.stopTest(); |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | //返品 |
| | | @isTest |
| | | static void productReturn() { |
| | | static void productReturn() { |
| | | // // TO DO: implement unit test |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)']; |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | |
| | | Account myAccount2 = new Account( |
| | | name = 'Testaccount002', |
| | | Dealer_discount__c = 20, |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '9999900' |
| | | ); |
| | | Account myAccount1 = new Account(name = 'Testaccount001', Dealer_discount__c = 30, RecordTypeId = rectCo[0].Id); |
| | | insert new List<account>{ myAccount1, myAccount2 }; |
| | | |
| | | Contact core = new Contact(email = 'jplumber@salesforce.com', firstname = 'Joe', lastname = 'Plumber', accountid = myAccount1.id); |
| | | Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900'); |
| | | Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id); |
| | | insert new account[]{myAccount1,myAccount2}; |
| | | |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id); |
| | | insert core; |
| | | user MyUser_Test = new User( |
| | | ContactId = core.id, |
| | | Alias = 'newUser', |
| | | Email = 'newuser@testorg.com', |
| | | EmailEncodingKey = 'UTF-8', |
| | | LastName = 'TestUser', |
| | | LanguageLocaleKey = 'zh_CN', |
| | | LocaleSidKey = 'zh_CN', |
| | | ProfileId = prof.Id, |
| | | TimeZoneSidKey = 'Asia/Shanghai', |
| | | UserName = 'testUser@testorg.com', |
| | | UserPro_Type__c = 'ET' |
| | | ); |
| | | System.runAs(new User(Id = UserInfo.getUserId())) { |
| | | user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET'); |
| | | System.runAs(new User(Id = UserInfo.getUserId())){ |
| | | insert MyUser_Test; |
| | | } |
| | | |
| | |
| | | // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // insert new Product2[] {prod01,prod02}; |
| | | System.runAs(MyUser_Test) { |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200311', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod02 = new Product2( |
| | | Name = 'Test02', |
| | | ProductCode = 'Test02', |
| | | Asset_Model_No__c = 'Test02', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200312', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2__c pro1 = new Product2__c(Name = 'Pro001', OT_CODE_Text__c = 'Test001', Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name = 'Pro002', OT_CODE_Text__c = 'Test002', Product2__c = prod02.Id); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | system.runAs(MyUser_Test){ |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01,prod02}; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | //订单 |
| | | |
| | | Consumable_order__c Order1 = new Consumable_order__c(); |
| | |
| | | Orderdet3.Consumable_Sale_order__c = Order1.Id; |
| | | Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRJ'; |
| | | Orderdet3.Box_Piece__c = '盒'; |
| | | Orderdet3.Box_Piece__c ='盒'; |
| | | Orderdet3.TracingCode__c = 'BXJRF'; |
| | | //出库 |
| | | Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c(); |
| | |
| | | Orderdet4.Consumable_Shipment_order__c = Order1.Id; |
| | | Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRN'; |
| | | Orderdet4.Box_Piece__c = '个'; |
| | | Orderdet4.Box_Piece__c ='个'; |
| | | Orderdet4.TracingCode__c = 'BXJRF'; |
| | | //quxiao |
| | | Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c(); |
| | |
| | | Orderdet5.Cancellation_Date__c = Date.today(); |
| | | Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRZ'; |
| | | Orderdet5.Box_Piece__c = '盒'; |
| | | Orderdet5.Box_Piece__c ='盒'; |
| | | Orderdet5.TracingCode__c = 'BXJRF'; |
| | | //fanpin |
| | | Consumable_order_details2__c Orderdet6 = new Consumable_order_details2__c(); |
| | |
| | | Orderdet6.Consumable_Return_order__c = Order2.Id; |
| | | Orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet6.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA'; |
| | | Orderdet6.Box_Piece__c = '个'; |
| | | Orderdet6.Box_Piece__c ='个'; |
| | | Orderdet6.TracingCode__c = 'BXJRF'; |
| | | |
| | | insert new List<Consumable_order_details2__c>{ Orderdet1, Orderdet2, Orderdet3, Orderdet4, Orderdet5, Orderdet6 }; |
| | | insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5,Orderdet6}; |
| | | PageReference page = new PageReference('/apex/ArriveGoods?ArrType=ReG'); |
| | | System.Test.setCurrentPage(page); |
| | | ArriveGoodsController Controller = new ArriveGoodsController(); |
| | |
| | | //System.assertEquals('OCM_01_001002', controller.ConsumableorderdetailsRecordserror[2].esd.Name); |
| | | //System.assertEquals('OCM_02_001001', controller.ConsumableorderdetailsRecordserror[3].esd.Name); |
| | | Controller.GoodsReturnCheck(); |
| | | controller.ShowGoodsofReturnList[0].esd.Return_reason__c = '多发'; |
| | | controller.ShowGoodsofReturnList[0].esd.Rrturn_count__c = 1; |
| | | controller.ShowGoodsofReturnList[0].esd.Return_reason__c='多发'; |
| | | controller.ShowGoodsofReturnList[0].esd.Rrturn_count__c =1; |
| | | //System.assertEquals(1, controller.ShowGoodsofReturnList.size()); |
| | | Controller.UpdateGoodsOfReturn(); |
| | | Controller.ToReturnGoodsPage(); |
| | | Controller.geterrorsize(); |
| | | System.Test.stopTest(); |
| | | |
| | | } |
| | | } |
| | | |
| | | //返品 |
| | | @isTest |
| | | static void productReturn_new() { |
| | | static void productReturn_new() { |
| | | // // TO DO: implement unit test |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)']; |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | |
| | | Account myAccount2 = new Account( |
| | | name = 'Testaccount002', |
| | | Dealer_discount__c = 20, |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '9999900' |
| | | ); |
| | | Account myAccount1 = new Account(name = 'Testaccount001', Dealer_discount__c = 30, RecordTypeId = rectCo[0].Id); |
| | | insert new List<account>{ myAccount1, myAccount2 }; |
| | | |
| | | Contact core = new Contact(email = 'jplumber@salesforce.com', firstname = 'Joe', lastname = 'Plumber', accountid = myAccount1.id); |
| | | Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900'); |
| | | Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id); |
| | | insert new account[]{myAccount1,myAccount2}; |
| | | |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id); |
| | | insert core; |
| | | user MyUser_Test = new User( |
| | | ContactId = core.id, |
| | | Alias = 'newUser', |
| | | Email = 'newuser@testorg.com', |
| | | EmailEncodingKey = 'UTF-8', |
| | | LastName = 'TestUser', |
| | | LanguageLocaleKey = 'zh_CN', |
| | | LocaleSidKey = 'zh_CN', |
| | | ProfileId = prof.Id, |
| | | TimeZoneSidKey = 'Asia/Shanghai', |
| | | UserName = 'testUser@testorg.com', |
| | | UserPro_Type__c = 'ET' |
| | | ); |
| | | System.runAs(new User(Id = UserInfo.getUserId())) { |
| | | user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET'); |
| | | System.runAs(new User(Id = UserInfo.getUserId())){ |
| | | insert MyUser_Test; |
| | | } |
| | | |
| | |
| | | // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // insert new Product2[] {prod01,prod02}; |
| | | System.runAs(MyUser_Test) { |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200311', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod02 = new Product2( |
| | | Name = 'Test02', |
| | | ProductCode = 'Test02', |
| | | Asset_Model_No__c = 'Test02', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200312', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2__c pro1 = new Product2__c(Name = 'Pro001', OT_CODE_Text__c = 'Test001', Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name = 'Pro002', OT_CODE_Text__c = 'Test002', Product2__c = prod02.Id); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | system.runAs(MyUser_Test){ |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01,prod02}; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | //订单 |
| | | Consumable_order__c Order1 = new Consumable_order__c(); |
| | | Order1.Name = 'OCM_01_001'; |
| | |
| | | Orderdet3.Consumable_Arrived_order__c = Order1.Id; |
| | | //Orderdet3.IsArrival__c = true; |
| | | Orderdet3.Consumable_Sale_order__c = Order1.Id; |
| | | Orderdet3.Box_Piece__c = '盒'; |
| | | Orderdet3.Used_date__c = Date.today(); |
| | | Orderdet3.Box_Piece__c ='盒'; |
| | | Orderdet3.Used_date__c= Date.today(); |
| | | Orderdet3.Arrive_date__c = Date.today(); |
| | | Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF'; |
| | |
| | | Orderdet4.Consumable_Arrived_order__c = Order1.Id; |
| | | //Orderdet4.IsArrival__c = true; |
| | | Orderdet4.Consumable_Shipment_order__c = Order1.Id; |
| | | Orderdet4.Box_Piece__c = '个'; |
| | | Orderdet4.Box_Piece__c ='个'; |
| | | Orderdet4.Send_Date__c = Date.today(); |
| | | Orderdet4.Arrive_date__c = Date.today(); |
| | | Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | |
| | | Orderdet5.Cancellation_Flag__c = true; |
| | | Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRZ'; |
| | | Orderdet5.Box_Piece__c = '个'; |
| | | Orderdet5.Box_Piece__c ='个'; |
| | | Orderdet5.TracingCode__c = 'BXJRZ'; |
| | | Orderdet5.SerialLotNo__c = '5ZK'; |
| | | insert new List<Consumable_order_details2__c>{ Orderdet3, Orderdet4, Orderdet5 }; |
| | | insert new Consumable_order_details2__c[] {Orderdet3,Orderdet4,Orderdet5}; |
| | | |
| | | PageReference page = new PageReference('/apex/ArriveGoods?ArrType=ReG'); |
| | | System.Test.setCurrentPage(page); |
| | |
| | | Controller.SearchPro(); |
| | | // System.assertEquals(1, controller.ConsumableorderdetailsRecordserror.size()); |
| | | System.assertEquals(2, controller.ShowGoodsofReturnList.size()); |
| | | controller.ShowGoodsofReturnList[0].esd.Return_reason__c = '多发'; |
| | | controller.ShowGoodsofReturnList[1].esd.Return_reason__c = '多发'; |
| | | controller.ShowGoodsofReturnList[0].esd.Rrturn_count__c = 1; |
| | | controller.ShowGoodsofReturnList[0].esd.Return_reason__c='多发'; |
| | | controller.ShowGoodsofReturnList[1].esd.Return_reason__c='多发'; |
| | | controller.ShowGoodsofReturnList[0].esd.Rrturn_count__c =1; |
| | | Controller.UpdateGoodsOfReturn(); |
| | | |
| | | list<String> list1 = new List<String>(); |
| | | list<String> list1 = new list<String>(); |
| | | list1.add(Controller.barcode = '01234567898'); |
| | | Controller.inventoryEntryNoESetId(list1); |
| | | |
| | |
| | | list1.add(Controller.barcode = '0112345678901231106789012105625001234'); |
| | | Controller.inventoryEntryNoESetId(list1); |
| | | System.Test.stopTest(); |
| | | |
| | | } |
| | | } |
| | | |
| | | //直接到货 |
| | | @isTest |
| | | static void arrivedirect() { |
| | | static void arrivedirect() { |
| | | // // TO DO: implement unit test |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)']; |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | |
| | | Account myAccount2 = new Account( |
| | | name = 'Testaccount002', |
| | | Dealer_discount__c = 20, |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '9999900' |
| | | ); |
| | | Account myAccount1 = new Account(name = 'Testaccount001', Dealer_discount__c = 30, RecordTypeId = rectCo[0].Id); |
| | | insert new List<account>{ myAccount1, myAccount2 }; |
| | | |
| | | Contact core = new Contact(email = 'jplumber@salesforce.com', firstname = 'Joe', lastname = 'Plumber', accountid = myAccount1.id); |
| | | Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900'); |
| | | Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id); |
| | | insert new account[]{myAccount1,myAccount2}; |
| | | |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id); |
| | | insert core; |
| | | user MyUser_Test = new User( |
| | | ContactId = core.id, |
| | | Alias = 'newUser', |
| | | Email = 'newuser@testorg.com', |
| | | EmailEncodingKey = 'UTF-8', |
| | | LastName = 'TestUser', |
| | | LanguageLocaleKey = 'zh_CN', |
| | | LocaleSidKey = 'zh_CN', |
| | | ProfileId = prof.Id, |
| | | TimeZoneSidKey = 'Asia/Shanghai', |
| | | UserName = 'testUser@testorg.com', |
| | | UserPro_Type__c = 'ET' |
| | | ); |
| | | System.runAs(new User(Id = UserInfo.getUserId())) { |
| | | user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET'); |
| | | System.runAs(new User(Id = UserInfo.getUserId())){ |
| | | insert MyUser_Test; |
| | | } |
| | | |
| | |
| | | // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // insert new Product2[] {prod01,prod02}; |
| | | System.runAs(MyUser_Test) { |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200311', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod02 = new Product2( |
| | | Name = 'Test02', |
| | | ProductCode = 'Test02', |
| | | Asset_Model_No__c = 'Test02', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200312', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2__c pro1 = new Product2__c(Name = 'Pro001', OT_CODE_Text__c = '2344', Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name = 'Pro002', OT_CODE_Text__c = '82324', Product2__c = prod02.Id); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | system.runAs(MyUser_Test){ |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01,prod02}; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='2344',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='82324',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | //产品注册证 |
| | | Product_Register__c prc = new Product_Register__c( |
| | | Name = '国械注进20162220210', |
| | | MedPrdClass__c = '3', |
| | | ValidFrom__c = date.newinstance(2018, 7, 22), |
| | | ValidTo__c = date.newinstance(2028, 7, 22), |
| | | RegisterNoClass_Old__c = '6815', |
| | | RegisterNoClass_New__c = '6815', |
| | | RegisterNoStatus__c = '有效' |
| | | ); |
| | | Product_Register__c prc = new Product_Register__c(Name = '国械注进20162220210', |
| | | MedPrdClass__c = '3', |
| | | ValidFrom__c = date.newinstance(2018, 07, 22), |
| | | ValidTo__c = date.newinstance(2028, 07, 22), |
| | | RegisterNoClass_Old__c = '6815', |
| | | RegisterNoClass_New__c = '6815', |
| | | RegisterNoStatus__c = '有效' |
| | | ); |
| | | insert prc; |
| | | //新旧关系对照表 |
| | | //Product_Register_contrast__c prcc = new Product_Register_contrast__c( |
| | |
| | | // ); |
| | | //insert prcc; |
| | | //产品-产品注册证关系 prod01 |
| | | Product_Register_Link__c prlc = new Product_Register_Link__c(Product2__c = prod01.Id, Product_Register__c = prc.Id); |
| | | Product_Register_Link__c prlc = new Product_Register_Link__c( |
| | | Product2__c = prod01.Id, |
| | | Product_Register__c = prc.Id |
| | | ); |
| | | insert prlc; |
| | | //产品-产品注册证关系 prod02 |
| | | Product_Register_Link__c prlc2 = new Product_Register_Link__c(Product2__c = prod02.Id, Product_Register__c = prc.Id); |
| | | Product_Register_Link__c prlc2 = new Product_Register_Link__c( |
| | | Product2__c = prod02.Id, |
| | | Product_Register__c = prc.Id |
| | | ); |
| | | insert prlc2; |
| | | //订单 |
| | | |
| | |
| | | //List<Product2> proList = [select name,Estimation_Entry_Possibility__c from Product2 where id = :prod01.Id]; |
| | | //System.assertEquals('○', proList[0].Estimation_Entry_Possibility__c); |
| | | |
| | | insert new List<Consumable_order_details2__c>{ Orderdet1, Orderdet2, Orderdet3, Orderdet4 }; |
| | | insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4}; |
| | | PageReference page = new PageReference('/apex/ArriveGoods?Esetid=' + Order1.Id); |
| | | System.Test.setCurrentPage(page); |
| | | ArriveGoodsController Controller = new ArriveGoodsController(); |
| | |
| | | |
| | | //直接到货 |
| | | @isTest |
| | | static void arrivedirect241() { |
| | | static void arrivedirect241() { |
| | | // // TO DO: implement unit test |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)']; |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | |
| | | Account myAccount2 = new Account( |
| | | name = 'Testaccount002', |
| | | Dealer_discount__c = 20, |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '9999900' |
| | | ); |
| | | Account myAccount1 = new Account(name = 'Testaccount001', Dealer_discount__c = 30, RecordTypeId = rectCo[0].Id); |
| | | insert new List<account>{ myAccount1, myAccount2 }; |
| | | Contact core = new Contact(email = 'jplumber@salesforce.com', firstname = 'Joe', lastname = 'Plumber', accountid = myAccount1.id); |
| | | |
| | | Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900'); |
| | | Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id); |
| | | insert new account[]{myAccount1,myAccount2}; |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id); |
| | | insert core; |
| | | user MyUser_Test = new User( |
| | | ContactId = core.id, |
| | | Alias = 'newUser', |
| | | Email = 'newuser@testorg.com', |
| | | EmailEncodingKey = 'UTF-8', |
| | | LastName = 'TestUser', |
| | | LanguageLocaleKey = 'zh_CN', |
| | | LocaleSidKey = 'zh_CN', |
| | | ProfileId = prof.Id, |
| | | TimeZoneSidKey = 'Asia/Shanghai', |
| | | UserName = 'testUser@testorg.com', |
| | | UserPro_Type__c = 'ET' |
| | | ); |
| | | System.runAs(new User(Id = UserInfo.getUserId())) { |
| | | user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET'); |
| | | System.runAs(new User(Id = UserInfo.getUserId())){ |
| | | insert MyUser_Test; |
| | | } |
| | | |
| | |
| | | // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // insert new Product2[] {prod01,prod02}; |
| | | System.runAs(MyUser_Test) { |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200311', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod02 = new Product2( |
| | | Name = 'Test02', |
| | | ProductCode = 'Test02', |
| | | Asset_Model_No__c = 'Test02', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200312', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2__c pro1 = new Product2__c(Name = 'Pro001', OT_CODE_Text__c = 'Test001', Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name = 'Pro002', OT_CODE_Text__c = 'Test002', Product2__c = prod02.Id); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | system.runAs(MyUser_Test){ |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01,prod02}; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | //产品注册证 |
| | | Product_Register__c prc = new Product_Register__c( |
| | | Name = '国械注进20162220210', |
| | | MedPrdClass__c = '3', |
| | | ValidFrom__c = date.newinstance(2018, 7, 22), |
| | | ValidTo__c = date.newinstance(2028, 7, 22), |
| | | RegisterNoClass_Old__c = '6815', |
| | | RegisterNoClass_New__c = '6815', |
| | | RegisterNoStatus__c = '有效' |
| | | ); |
| | | Product_Register__c prc = new Product_Register__c(Name = '国械注进20162220210', |
| | | MedPrdClass__c = '3', |
| | | ValidFrom__c = date.newinstance(2018, 07, 22), |
| | | ValidTo__c = date.newinstance(2028, 07, 22), |
| | | RegisterNoClass_Old__c = '6815', |
| | | RegisterNoClass_New__c = '6815', |
| | | RegisterNoStatus__c = '有效' |
| | | ); |
| | | insert prc; |
| | | //新旧关系对照表 |
| | | //Product_Register_contrast__c prcc = new Product_Register_contrast__c( |
| | |
| | | // ); |
| | | //insert prcc; |
| | | //产品-产品注册证关系 prod01 |
| | | Product_Register_Link__c prlc = new Product_Register_Link__c(Product2__c = prod01.Id, Product_Register__c = prc.Id); |
| | | Product_Register_Link__c prlc = new Product_Register_Link__c( |
| | | Product2__c = prod01.Id, |
| | | Product_Register__c = prc.Id |
| | | ); |
| | | insert prlc; |
| | | //产品-产品注册证关系 prod02 |
| | | Product_Register_Link__c prlc2 = new Product_Register_Link__c(Product2__c = prod02.Id, Product_Register__c = prc.Id); |
| | | Product_Register_Link__c prlc2 = new Product_Register_Link__c( |
| | | Product2__c = prod02.Id, |
| | | Product_Register__c = prc.Id |
| | | ); |
| | | insert prlc2; |
| | | //订单 |
| | | |
| | |
| | | Consumable_order__c Order2 = new Consumable_order__c(); |
| | | Order2.Name = 'OCM_01_002'; |
| | | Order2.Order_status__c = '批准'; |
| | | Order2.Order_type__c = '到货'; |
| | | Order2.Order_type__c = '到货'; |
| | | Order2.Dealer_Info__c = myAccount1.id; |
| | | Order2.RecordTypeid = System.Label.RT_ConOrder_Delivery; |
| | | Order2.Deliver_date__c = Date.today(); |
| | | Order2.Order_date__c = Date.today(); |
| | | Order2.Order_date__c = Date.today(); |
| | | insert Order2; |
| | | Order2 = new Consumable_order__c(); |
| | | Order2.Name = 'OCM_01_002'; |
| | | Order2.Order_status__c = '批准'; |
| | | Order2.Order_type__c = '返品'; |
| | | Order2.Order_type__c = '返品'; |
| | | Order2.Dealer_Info__c = myAccount1.id; |
| | | Order2.RecordTypeid = System.Label.RT_ConOrder_Delivery; |
| | | Order2.Deliver_date__c = Date.today(); |
| | | Order2.Order_date__c = Date.today(); |
| | | Order2.Order_date__c = Date.today(); |
| | | Order2.ReturnGs_Upload_Date__c = Date.today(); |
| | | insert Order2; |
| | | |
| | |
| | | Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF'; |
| | | Orderdet1.Arrive_date__c = Date.today(); |
| | | Orderdet1.Rrturn_count__c = 1; |
| | | Orderdet1.Rrturn_count__c =1; |
| | | Orderdet1.TracingCode__c = '20170808'; |
| | | //daohuo |
| | | Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c(); |
| | |
| | | Orderdet4.Consumable_Sale_order__c = Order2.Id; |
| | | Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR3'; |
| | | Orderdet4.Used_date__c = Date.today(); |
| | | Orderdet4.Used_date__c =Date.today(); |
| | | Orderdet4 = new Consumable_order_details2__c(); |
| | | Orderdet4.Name = 'OCM_01_001003'; |
| | | Orderdet4.Consumable_order_minor__c = Order1.Id; |
| | |
| | | Orderdet4.Consumable_Sale_order__c = Order2.Id; |
| | | Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJ13'; |
| | | Orderdet4.Used_date__c = Date.today(); |
| | | Orderdet4.Used_date__c =Date.today(); |
| | | Orderdet4.TracingCode__c = '20170808'; |
| | | Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c(); |
| | | Orderdet5.Name = 'OCM_01_001003'; |
| | |
| | | Orderdet5.Send_Date__c = null; |
| | | Orderdet5.Used_date__c = null; |
| | | Orderdet5.Lose_Flag__c = false; |
| | | Orderdet5.Return_date__c = null; |
| | | Orderdet5.Cancellation_Date__c = Date.today().addDays(1); |
| | | Orderdet5.Return_date__c= null; |
| | | Orderdet5.Cancellation_Date__c= Date.today().addDays(1); |
| | | Orderdet5.Box_Piece__c = '盒'; |
| | | Orderdet5.TracingCode__c = '20170808'; |
| | | |
| | |
| | | Orderdet6.Consumable_Shipment_order__c = Order1.Id; |
| | | Orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet6.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR4'; |
| | | Orderdet6.Send_Date__c = Date.today(); |
| | | Orderdet6.Return_date__c = null; |
| | | Orderdet6.Send_Date__c = Date.today(); |
| | | Orderdet6.Return_date__c= null; |
| | | Orderdet6.Box_Piece__c = '盒'; |
| | | Orderdet6.Rrturn_count__c = 1; |
| | | Orderdet6.Rrturn_count__c =1; |
| | | Orderdet6.TracingCode__c = '20170808'; |
| | | |
| | | // 单位为个的Barcode对应的出库单 |
| | |
| | | Orderdet7.Consumable_Shipment_order__c = Order1.Id; |
| | | Orderdet7.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet7.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR1'; |
| | | Orderdet7.Send_Date__c = Date.today(); |
| | | Orderdet7.Send_Date__c = Date.today(); |
| | | Orderdet7.Box_Piece__c = '个'; |
| | | Orderdet7.Used_date__c = Date.today(); |
| | | Orderdet7.Return_date__c = null; |
| | | Orderdet7.RemoveBox_No__c = 1; |
| | | Orderdet7.Consumable_ZS_order__c = Order1.Id; |
| | | Orderdet7.Rrturn_count__c = 1; |
| | | Orderdet7.Used_date__c = Date.today(); |
| | | Orderdet7.Return_date__c= null; |
| | | Orderdet7.RemoveBox_No__c =1; |
| | | Orderdet7.Consumable_ZS_order__c= Order1.Id; |
| | | Orderdet7.Rrturn_count__c =1; |
| | | Orderdet7.TracingCode__c = '20170808'; |
| | | |
| | | Orderdet7 = new Consumable_order_details2__c(); |
| | |
| | | Orderdet7.Consumable_Shipment_order__c = Order1.Id; |
| | | Orderdet7.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet7.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR7'; |
| | | Orderdet7.Send_Date__c = Date.today(); |
| | | Orderdet7.Send_Date__c = Date.today(); |
| | | Orderdet7.Box_Piece__c = '个'; |
| | | Orderdet7.Used_date__c = Date.today(); |
| | | Orderdet7.Return_date__c = null; |
| | | Orderdet7.RemoveBox_No__c = 1; |
| | | Orderdet7.Consumable_ZS_order__c = Order1.Id; |
| | | Orderdet7.Rrturn_count__c = 0; |
| | | Orderdet7.Used_date__c = Date.today(); |
| | | Orderdet7.Return_date__c= null; |
| | | Orderdet7.RemoveBox_No__c =1; |
| | | Orderdet7.Consumable_ZS_order__c= Order1.Id; |
| | | Orderdet7.Rrturn_count__c =0; |
| | | Orderdet7.TracingCode__c = '20170808'; |
| | | |
| | | Consumable_order_details2__c Orderdet8 = new Consumable_order_details2__c(); |
| | |
| | | Orderdet8.Consumable_Shipment_order__c = Order1.Id; |
| | | Orderdet8.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet8.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR9'; |
| | | Orderdet8.Send_Date__c = Date.today(); |
| | | Orderdet8.Send_Date__c = Date.today(); |
| | | Orderdet8.Box_Piece__c = '个'; |
| | | Orderdet8.Used_date__c = Date.today(); |
| | | Orderdet8.Return_date__c = null; |
| | | Orderdet8.RemoveBox_No__c = 1; |
| | | Orderdet8.Consumable_ZS_order__c = Order1.Id; |
| | | Orderdet8.Rrturn_count__c = null; |
| | | Orderdet8.RemoveBox_date__c = Date.today(); |
| | | Orderdet8.Used_date__c = Date.today(); |
| | | Orderdet8.Return_date__c= null; |
| | | Orderdet8.RemoveBox_No__c =1; |
| | | Orderdet8.Consumable_ZS_order__c= Order1.Id; |
| | | Orderdet8.Rrturn_count__c =null; |
| | | Orderdet8.RemoveBox_date__c = Date.today(); |
| | | Orderdet8.Intra_Trade_List_RMB__c = 1; |
| | | Orderdet8.Sterilization_limit__c = Date.today(); |
| | | Orderdet8.SerialLotNo__c = '11批次'; |
| | | Orderdet8.Sterilization_limit__c = Date.today(); |
| | | Orderdet8.SerialLotNo__c ='11批次'; |
| | | Orderdet8.TracingCode__c = '20170808'; |
| | | Orderdet8.Arrive_date__c = Date.today(); |
| | | Orderdet8.Arrive_date__c = Date.today(); |
| | | |
| | | Consumable_order_details2__c Orderdet9 = new Consumable_order_details2__c(); |
| | | Orderdet9.Name = 'OCM_01_001004'; |
| | |
| | | Orderdet9.Consumable_Shipment_order__c = Order1.Id; |
| | | Orderdet9.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet9.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR8'; |
| | | Orderdet9.Send_Date__c = Date.today(); |
| | | Orderdet9.Send_Date__c = Date.today(); |
| | | Orderdet9.Box_Piece__c = '个'; |
| | | Orderdet9.Used_date__c = Date.today(); |
| | | Orderdet9.Return_date__c = null; |
| | | Orderdet9.Consumable_ZS_order__c = Order1.Id; |
| | | Orderdet9.Arrive_date__c = Date.today(); |
| | | Orderdet9.Rrturn_count__c = 10; |
| | | Orderdet9.Used_date__c = Date.today(); |
| | | Orderdet9.Return_date__c= null; |
| | | Orderdet9.Consumable_ZS_order__c= Order1.Id; |
| | | Orderdet9.Arrive_date__c = Date.today(); |
| | | Orderdet9.Rrturn_count__c =10; |
| | | Orderdet9.TracingCode__c = '20170808'; |
| | | Consumable_order_details2__c lose = new Consumable_order_details2__c(); |
| | | lose.Name = 'OCM_01_001004'; |
| | |
| | | lose.Consumable_Shipment_order__c = Order1.Id; |
| | | lose.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | lose.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR5'; |
| | | lose.Send_Date__c = null; |
| | | lose.Arrive_date__c = null; |
| | | lose.Used_date__c = null; |
| | | lose.Send_Date__c = null; |
| | | lose.Arrive_date__c = null; |
| | | lose.Used_date__c = null; |
| | | lose.Box_Piece__c = '盒'; |
| | | lose.TracingCode__c = '20170808'; |
| | | Consumable_order_details2__c lose1 = new Consumable_order_details2__c(); |
| | |
| | | lose1.Consumable_Shipment_order__c = Order1.Id; |
| | | lose1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | lose1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR6'; |
| | | lose1.Send_Date__c = null; |
| | | lose1.Arrive_date__c = Date.today(); |
| | | lose1.Used_date__c = null; |
| | | lose1.Send_Date__c = null; |
| | | lose1.Arrive_date__c = Date.today(); |
| | | lose1.Used_date__c = null; |
| | | lose1.Box_Piece__c = '盒'; |
| | | lose1.TracingCode__c = '20170808'; |
| | | Consumable_order_details2__c lose2 = new Consumable_order_details2__c(); |
| | |
| | | lose2.Consumable_Shipment_order__c = Order2.Id; |
| | | lose2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | lose2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJR7'; |
| | | lose2.Send_Date__c = null; |
| | | lose2.Arrive_date__c = Date.today(); |
| | | lose2.Used_date__c = null; |
| | | lose2.Send_Date__c = null; |
| | | lose2.Arrive_date__c = Date.today(); |
| | | lose2.Used_date__c = null; |
| | | lose2.Box_Piece__c = '盒'; |
| | | lose2.Intra_Trade_List_RMB__c = 1; |
| | | lose2.Direct_Arrive_Product__c = true; |
| | | lose2.Sterilization_limit__c = Date.today(); |
| | | lose2.SerialLotNo__c = '11批次'; |
| | | lose2.Sterilization_limit__c = Date.today(); |
| | | lose2.SerialLotNo__c ='11批次'; |
| | | lose2.TracingCode__c = '20170808'; |
| | | |
| | | //List<Product2> proList = [select name,Estimation_Entry_Possibility__c from Product2 where id = :prod01.Id]; |
| | | //System.assertEquals('○', proList[0].Estimation_Entry_Possibility__c); |
| | | |
| | | insert new List<Consumable_order_details2__c>{ |
| | | Orderdet1, |
| | | Orderdet2, |
| | | Orderdet3, |
| | | Orderdet4, |
| | | Orderdet5, |
| | | Orderdet6, |
| | | Orderdet7, |
| | | Orderdet8, |
| | | Orderdet9, |
| | | lose, |
| | | lose1, |
| | | lose2 |
| | | }; |
| | | insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5,Orderdet6,Orderdet7,Orderdet8,Orderdet9,lose,lose1,lose2}; |
| | | PageReference page = new PageReference('/apex/ArriveGoods?Esetid=' + Order1.Id); |
| | | System.Test.setCurrentPage(page); |
| | | ArriveGoodsController Controller = new ArriveGoodsController(); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | //返品 明细2不存在的对应的到货订单明细 |
| | | @isTest |
| | | static void productReturn_oldbarcode() { |
| | | static void productReturn_oldbarcode() { |
| | | // // TO DO: implement unit test |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)']; |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | |
| | | Account myAccount2 = new Account( |
| | | name = 'Testaccount002', |
| | | Dealer_discount__c = 20, |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '9999900' |
| | | ); |
| | | Account myAccount1 = new Account(name = 'Testaccount001', Dealer_discount__c = 30, RecordTypeId = rectCo[0].Id); |
| | | insert new List<account>{ myAccount1, myAccount2 }; |
| | | |
| | | Contact core = new Contact(email = 'jplumber@salesforce.com', firstname = 'Joe', lastname = 'Plumber', accountid = myAccount1.id); |
| | | Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900'); |
| | | Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id); |
| | | insert new account[]{myAccount1,myAccount2}; |
| | | |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id); |
| | | insert core; |
| | | user MyUser_Test = new User( |
| | | ContactId = core.id, |
| | | Alias = 'newUser', |
| | | Email = 'newuser@testorg.com', |
| | | EmailEncodingKey = 'UTF-8', |
| | | LastName = 'TestUser', |
| | | LanguageLocaleKey = 'zh_CN', |
| | | LocaleSidKey = 'zh_CN', |
| | | ProfileId = prof.Id, |
| | | TimeZoneSidKey = 'Asia/Shanghai', |
| | | UserName = 'testUser@testorg.com', |
| | | UserPro_Type__c = 'ET' |
| | | ); |
| | | System.runAs(new User(Id = UserInfo.getUserId())) { |
| | | user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET'); |
| | | System.runAs(new User(Id = UserInfo.getUserId())){ |
| | | insert MyUser_Test; |
| | | } |
| | | |
| | |
| | | // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // insert new Product2[] {prod01,prod02}; |
| | | System.runAs(MyUser_Test) { |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200311', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod02 = new Product2( |
| | | Name = 'Test02', |
| | | ProductCode = 'Test02', |
| | | Asset_Model_No__c = 'Test02', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200312', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2__c pro1 = new Product2__c(Name = 'Pro001', OT_CODE_Text__c = 'Test001', Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name = 'Pro002', OT_CODE_Text__c = 'Test002', Product2__c = prod02.Id); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | system.runAs(MyUser_Test){ |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01,prod02}; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | //订单 |
| | | |
| | | Consumable_order__c Order1 = new Consumable_order__c(); |
| | |
| | | Orderdet5.Cancellation_Date__c = Date.today(); |
| | | Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRZ'; |
| | | Orderdet5.Box_Piece__c = '个'; |
| | | Orderdet5.Box_Piece__c ='个'; |
| | | Orderdet5.TracingCode__c = 'BXSYS'; |
| | | //fanpin |
| | | Consumable_order_details2__c Orderdet6 = new Consumable_order_details2__c(); |
| | |
| | | Orderdet6.Consumable_Return_order__c = Order2.Id; |
| | | Orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet6.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA'; |
| | | Orderdet6.Box_Piece__c = '个'; |
| | | Orderdet6.Box_Piece__c ='个'; |
| | | Orderdet6.TracingCode__c = 'BXSYS'; |
| | | |
| | | //发货明细 |
| | |
| | | Orderdet7.Bar_Code__c = '01049531702003111115120017181000105ZK250BX333'; |
| | | Orderdet7.TracingCode__c = 'BXSYS'; |
| | | |
| | | insert new List<Consumable_order_details2__c>{ Orderdet1, Orderdet2, Orderdet3, Orderdet4, Orderdet5, Orderdet6, Orderdet7 }; |
| | | insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5,Orderdet6,Orderdet7}; |
| | | PageReference page = new PageReference('/apex/ArriveGoods?ArrType=ReG'); |
| | | System.Test.setCurrentPage(page); |
| | | ArriveGoodsController Controller = new ArriveGoodsController(); |
| | |
| | | |
| | | controller.getinventorysize(); |
| | | System.Test.stopTest(); |
| | | |
| | | } |
| | | } |
| | | @isTest |
| | | static void barcodecheck() { |
| | | static void barcodecheck() { |
| | | // // TO DO: implement unit test |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)']; |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | |
| | | Account myAccount2 = new Account( |
| | | name = 'Testaccount002', |
| | | Dealer_discount__c = 20, |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '9999900' |
| | | ); |
| | | Account myAccount1 = new Account(name = 'Testaccount001', Dealer_discount__c = 30, RecordTypeId = rectCo[0].Id); |
| | | insert new List<account>{ myAccount1, myAccount2 }; |
| | | |
| | | Contact core = new Contact(email = 'jplumber@salesforce.com', firstname = 'Joe', lastname = 'Plumber', accountid = myAccount1.id); |
| | | Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900'); |
| | | Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id); |
| | | insert new account[]{myAccount1,myAccount2}; |
| | | |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id); |
| | | insert core; |
| | | user MyUser_Test = new User( |
| | | ContactId = core.id, |
| | | Alias = 'newUser', |
| | | Email = 'newuser@testorg.com', |
| | | EmailEncodingKey = 'UTF-8', |
| | | LastName = 'TestUser', |
| | | LanguageLocaleKey = 'zh_CN', |
| | | LocaleSidKey = 'zh_CN', |
| | | ProfileId = prof.Id, |
| | | TimeZoneSidKey = 'Asia/Shanghai', |
| | | UserName = 'testUser@testorg.com', |
| | | UserPro_Type__c = 'ET' |
| | | ); |
| | | System.runAs(new User(Id = UserInfo.getUserId())) { |
| | | user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET'); |
| | | System.runAs(new User(Id = UserInfo.getUserId())){ |
| | | insert MyUser_Test; |
| | | } |
| | | // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ]; |
| | | // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // insert new Product2[] {prod01,prod02}; |
| | | System.runAs(MyUser_Test) { |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200311', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod02 = new Product2( |
| | | Name = 'Test02', |
| | | ProductCode = 'Test02', |
| | | Asset_Model_No__c = 'Test02', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200312', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2__c pro1 = new Product2__c(Name = 'Pro001', OT_CODE_Text__c = '2344', Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name = 'Pro002', OT_CODE_Text__c = '8232', Product2__c = prod02.Id); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | system.runAs(MyUser_Test){ |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01,prod02}; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='2344',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='8232',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | ArriveGoodsController Controller = new ArriveGoodsController(); |
| | | //初始化测试 |
| | | list<String> list1 = new List<String>(); |
| | | list<String> list1 = new list<String>(); |
| | | list1.clear(); |
| | | list1.add(Controller.barcode = '2413456250BBBBA'); |
| | | Controller.inventoryEntry(list1); |
| | |
| | | } |
| | | } |
| | | @isTest |
| | | static void barcodechkeck_2() { |
| | | static void barcodechkeck_2() { |
| | | // // TO DO: implement unit test |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)']; |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | |
| | | Account myAccount2 = new Account( |
| | | name = 'Testaccount002', |
| | | Dealer_discount__c = 20, |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '9999900' |
| | | ); |
| | | Account myAccount1 = new Account(name = 'Testaccount001', Dealer_discount__c = 30, RecordTypeId = rectCo[0].Id); |
| | | insert new List<account>{ myAccount1, myAccount2 }; |
| | | |
| | | Contact core = new Contact(email = 'jplumber@salesforce.com', firstname = 'Joe', lastname = 'Plumber', accountid = myAccount1.id); |
| | | Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900'); |
| | | Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id); |
| | | insert new account[]{myAccount1,myAccount2}; |
| | | |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id); |
| | | insert core; |
| | | user MyUser_Test = new User( |
| | | ContactId = core.id, |
| | | Alias = 'newUser', |
| | | Email = 'newuser@testorg.com', |
| | | EmailEncodingKey = 'UTF-8', |
| | | LastName = 'TestUser', |
| | | LanguageLocaleKey = 'zh_CN', |
| | | LocaleSidKey = 'zh_CN', |
| | | ProfileId = prof.Id, |
| | | TimeZoneSidKey = 'Asia/Shanghai', |
| | | UserName = 'testUser@testorg.com', |
| | | UserPro_Type__c = 'ET' |
| | | ); |
| | | System.runAs(new User(Id = UserInfo.getUserId())) { |
| | | user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET'); |
| | | System.runAs(new User(Id = UserInfo.getUserId())){ |
| | | insert MyUser_Test; |
| | | } |
| | | // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ]; |
| | | // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // insert new Product2[] {prod01,prod02}; |
| | | System.runAs(MyUser_Test) { |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200311', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod02 = new Product2( |
| | | Name = 'Test02', |
| | | ProductCode = 'Test02', |
| | | Asset_Model_No__c = 'Test02', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200312', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2__c pro1 = new Product2__c(Name = 'Pro001', OT_CODE_Text__c = '2344', Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name = 'Pro002', OT_CODE_Text__c = '82324', Product2__c = prod02.Id); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | system.runAs(MyUser_Test){ |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01,prod02}; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='2344',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='82324',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | //产品注册证 |
| | | Product_Register__c prc = new Product_Register__c( |
| | | Name = '国械注进20162220210', |
| | | MedPrdClass__c = '3', |
| | | ValidFrom__c = date.newinstance(2018, 7, 22), |
| | | ValidTo__c = date.newinstance(2028, 7, 22), |
| | | RegisterNoClass_Old__c = '6815', |
| | | RegisterNoClass_New__c = '6815', |
| | | RegisterNoStatus__c = '有效' |
| | | ); |
| | | Product_Register__c prc = new Product_Register__c(Name = '国械注进20162220210', |
| | | MedPrdClass__c = '3', |
| | | ValidFrom__c = date.newinstance(2018, 07, 22), |
| | | ValidTo__c = date.newinstance(2028, 07, 22), |
| | | RegisterNoClass_Old__c = '6815', |
| | | RegisterNoClass_New__c = '6815', |
| | | RegisterNoStatus__c = '有效' |
| | | ); |
| | | insert prc; |
| | | //新旧关系对照表 |
| | | //Product_Register_contrast__c prcc = new Product_Register_contrast__c( |
| | |
| | | // ); |
| | | //insert prcc; |
| | | //产品-产品注册证关系 prod01 |
| | | Product_Register_Link__c prlc = new Product_Register_Link__c(Product2__c = prod01.Id, Product_Register__c = prc.Id); |
| | | Product_Register_Link__c prlc = new Product_Register_Link__c( |
| | | Product2__c = prod01.Id, |
| | | Product_Register__c = prc.Id |
| | | ); |
| | | insert prlc; |
| | | //产品-产品注册证关系 prod02 |
| | | Product_Register_Link__c prlc2 = new Product_Register_Link__c(Product2__c = prod02.Id, Product_Register__c = prc.Id); |
| | | Product_Register_Link__c prlc2 = new Product_Register_Link__c( |
| | | Product2__c = prod02.Id, |
| | | Product_Register__c = prc.Id |
| | | ); |
| | | insert prlc2; |
| | | PageReference page = new PageReference('/apex/ArriveGoods?ArrType=ReG'); |
| | | System.Test.setCurrentPage(page); |
| | |
| | | ArriveGoodsController Controller = new ArriveGoodsController(); |
| | | //List<Product2> proList = [select name,Estimation_Entry_Possibility__c from Product2 where id = :prod01.Id]; |
| | | //System.assertEquals('○', proList[0].Estimation_Entry_Possibility__c); |
| | | List<Product2__c> product2InStore = [ |
| | | SELECT Id, Name, Name__c, Intra_Trade_List_RMB__c, Asset_Model_No__c, OT_CODE__c |
| | | FROM Product2__c |
| | | WHERE Estimation_Entry_Possibility__c = '○' AND Pro2_Dealer_Object__c = TRUE AND OT_CODE__c = 'test' |
| | | ]; |
| | | List<Product2__c> product2InStore = [SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,OT_CODE__c |
| | | FROM Product2__c |
| | | WHERE Estimation_Entry_Possibility__c = '○' |
| | | AND Pro2_Dealer_Object__c = true |
| | | AND OT_CODE__c ='test' ]; |
| | | //System.assertEquals(1, product2InStore.size()); |
| | | list<String> list1 = new List<String>(); |
| | | list<String> list1 = new list<String>(); |
| | | list1.clear(); |
| | | list1.add(Controller.barcode = '2413456250BBBBA'); |
| | | Controller.inventoryEntryNoESetId(list1); |
| | |
| | | list1.add(Controller.barcode = '241test111204121778900034567890250BBBBQ'); |
| | | Controller.inventoryEntryNoESetId(list1); |
| | | |
| | | |
| | | list1.clear(); |
| | | list1.add(Controller.barcode = '0111234101204120118901231712a4001234250BBBBR'); |
| | | Controller.inventoryEntryNoESetId(list1); |
| | |
| | | list1.clear(); |
| | | list1.add(Controller.barcode = '011123410120412017120100250AAAAA'); |
| | | Controller.inventoryEntryNoESetId(list1); |
| | | |
| | | } |
| | | } |
| | | |
| | | //自动出库 |
| | | @isTest |
| | | static void addSaleOrderAuto() { |
| | | static void addSaleOrderAuto() { |
| | | // // TO DO: implement unit test |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)']; |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | |
| | | Account myAccount2 = new Account( |
| | | name = 'Testaccount002', |
| | | Dealer_discount__c = 20, |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '9999900' |
| | | ); |
| | | Account myAccount1 = new Account(name = 'Testaccount001', Dealer_discount__c = 30, RecordTypeId = rectCo[0].Id); |
| | | insert new List<account>{ myAccount1, myAccount2 }; |
| | | |
| | | Contact core = new Contact(email = 'jplumber@salesforce.com', firstname = 'Joe', lastname = 'Plumber', accountid = myAccount1.id); |
| | | Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900'); |
| | | Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id); |
| | | insert new account[]{myAccount1,myAccount2}; |
| | | |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id); |
| | | insert core; |
| | | user MyUser_Test = new User( |
| | | ContactId = core.id, |
| | | Alias = 'newUser', |
| | | Email = 'newuser@testorg.com', |
| | | EmailEncodingKey = 'UTF-8', |
| | | LastName = 'TestUser', |
| | | LanguageLocaleKey = 'zh_CN', |
| | | LocaleSidKey = 'zh_CN', |
| | | ProfileId = prof.Id, |
| | | TimeZoneSidKey = 'Asia/Shanghai', |
| | | UserName = 'testUser@testorg.com', |
| | | UserPro_Type__c = 'ET' |
| | | ); |
| | | System.runAs(new User(Id = UserInfo.getUserId())) { |
| | | user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET'); |
| | | System.runAs(new User(Id = UserInfo.getUserId())){ |
| | | insert MyUser_Test; |
| | | } |
| | | // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ]; |
| | | // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // insert new Product2[] {prod01,prod02}; |
| | | System.runAs(MyUser_Test) { |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200311', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod02 = new Product2( |
| | | Name = 'Test02', |
| | | ProductCode = 'Test02', |
| | | Asset_Model_No__c = 'Test02', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200312', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2__c pro1 = new Product2__c(Name = 'Pro001', OT_CODE_Text__c = 'Test001', Product2__c = prod01.Id); |
| | | insert new List<Product2__c>{ pro1 }; |
| | | system.runAs(MyUser_Test){ |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01,prod02}; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | insert new Product2__c[] {pro1}; |
| | | // Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id); |
| | | // insert myAccount1; |
| | | Consumable_order__c Order2 = new Consumable_order__c(); |
| | |
| | | |
| | | // UPDATE TCM TEST1 |
| | | @isTest |
| | | static void methodTest1() { |
| | | static void methodTest1() { |
| | | // // TO DO: implement unit test |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)']; |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | |
| | | Account myAccount2 = new Account( |
| | | name = 'Testaccount002', |
| | | Dealer_discount__c = 20, |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '9999900' |
| | | ); |
| | | Account myAccount1 = new Account(name = 'Testaccount001', Dealer_discount__c = 30, RecordTypeId = rectCo[0].Id); |
| | | insert new List<account>{ myAccount1, myAccount2 }; |
| | | |
| | | Contact core = new Contact(email = 'jplumber@salesforce.com', firstname = 'Joe', lastname = 'Plumber', accountid = myAccount1.id); |
| | | Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900'); |
| | | Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id); |
| | | insert new account[]{myAccount1,myAccount2}; |
| | | |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id); |
| | | insert core; |
| | | user MyUser_Test = new User( |
| | | ContactId = core.id, |
| | | Alias = 'newUser', |
| | | Email = 'newuser@testorg.com', |
| | | EmailEncodingKey = 'UTF-8', |
| | | LastName = 'TestUser', |
| | | LanguageLocaleKey = 'zh_CN', |
| | | LocaleSidKey = 'zh_CN', |
| | | ProfileId = prof.Id, |
| | | TimeZoneSidKey = 'Asia/Shanghai', |
| | | UserName = 'testUser@testorg.com', |
| | | UserPro_Type__c = 'ET' |
| | | ); |
| | | System.runAs(new User(Id = UserInfo.getUserId())) { |
| | | user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET'); |
| | | System.runAs(new User(Id = UserInfo.getUserId())){ |
| | | insert MyUser_Test; |
| | | } |
| | | // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ]; |
| | | // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // insert new Product2[] {prod01,prod02}; |
| | | System.runAs(MyUser_Test) { |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200311', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod02 = new Product2( |
| | | Name = 'Test02', |
| | | ProductCode = 'Test02', |
| | | Asset_Model_No__c = 'Test02', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200312', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2__c pro1 = new Product2__c(Name = 'Pro001', OT_CODE_Text__c = 'N3047730', Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name = 'Pro002', OT_CODE_Text__c = 'N3047731', Product2__c = prod02.Id); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | system.runAs(MyUser_Test){ |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01,prod02}; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='N3047730',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='N3047731',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | //订单 |
| | | |
| | | Consumable_order__c Order1 = new Consumable_order__c(); |
| | |
| | | Orderdet1.Asset_Model_No__c = 'Test01'; |
| | | Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF'; |
| | | Orderdet1.Arrive_date__c = Date.today(); |
| | | Orderdet1.Arrive_date__c=Date.today(); |
| | | // Orderdet1.Send_Date__c=Date.today(); |
| | | // Orderdet1.Used_date__c=Date.today(); |
| | | Orderdet1.TracingCode__c = 'BXJRF'; |
| | |
| | | Orderdet2.Asset_Model_No__c = 'Test01'; |
| | | Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet2.Bar_Code__c = '01049531702003111115120017181234105ZK250BXJRF'; |
| | | Orderdet2.Arrive_date__c = Date.today(); |
| | | Orderdet2.Arrive_date__c=Date.today(); |
| | | Orderdet2.TracingCode__c = 'BXJRF'; |
| | | Orderdet2.SerialLotNo__c = '5ZK'; |
| | | insert Orderdet2; |
| | |
| | | // System.assertEquals(1, Controller.ConsumableorderdetailsRecords.size()); |
| | | // System.assertEquals(2, Controller.consumableInventory.size()); |
| | | Controller.ArriveGoodsConfim(); |
| | | List<Consumable_order_details2__c> ins = [ |
| | | SELECT Id, Name |
| | | FROM Consumable_order_details2__c |
| | | ]; |
| | | List<Consumable_order_details2__c> ins = [SELECT Id,Name FROM Consumable_order_details2__c]; |
| | | // System.assertEquals(3, ins.size()); |
| | | System.Test.stopTest(); |
| | | } |
| | | } |
| | | |
| | | |
| | | //返品 |
| | | @isTest |
| | | static void methodTest2() { |
| | | static void methodTest2() { |
| | | // // TO DO: implement unit test |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)']; |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | |
| | | Account myAccount2 = new Account( |
| | | name = 'Testaccount002', |
| | | Dealer_discount__c = 20, |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '9999900' |
| | | ); |
| | | Account myAccount1 = new Account(name = 'Testaccount001', Dealer_discount__c = 30, RecordTypeId = rectCo[0].Id); |
| | | insert new List<account>{ myAccount1, myAccount2 }; |
| | | |
| | | Contact core = new Contact(email = 'jplumber@salesforce.com', firstname = 'Joe', lastname = 'Plumber', accountid = myAccount1.id); |
| | | Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900'); |
| | | Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id); |
| | | insert new account[]{myAccount1,myAccount2}; |
| | | |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id); |
| | | insert core; |
| | | user MyUser_Test = new User( |
| | | ContactId = core.id, |
| | | Alias = 'newUser', |
| | | Email = 'newuser@testorg.com', |
| | | EmailEncodingKey = 'UTF-8', |
| | | LastName = 'TestUser', |
| | | LanguageLocaleKey = 'zh_CN', |
| | | LocaleSidKey = 'zh_CN', |
| | | ProfileId = prof.Id, |
| | | TimeZoneSidKey = 'Asia/Shanghai', |
| | | UserName = 'testUser@testorg.com', |
| | | UserPro_Type__c = 'ET' |
| | | ); |
| | | System.runAs(new User(Id = UserInfo.getUserId())) { |
| | | user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET'); |
| | | System.runAs(new User(Id = UserInfo.getUserId())){ |
| | | insert MyUser_Test; |
| | | } |
| | | // User MyUser_Test = [select id,Contact.accountid from User WHERE ProfileId = :prof.Id and IsActive = true and UserPro_Type__c = 'ET' limit 1 ]; |
| | | // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // insert new Product2[] {prod01,prod02}; |
| | | System.runAs(MyUser_Test) { |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200311', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod02 = new Product2( |
| | | Name = 'Test02', |
| | | ProductCode = 'Test02', |
| | | Asset_Model_No__c = 'Test02', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200312', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2__c pro1 = new Product2__c(Name = 'Pro001', OT_CODE_Text__c = 'Test001', Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name = 'Pro002', OT_CODE_Text__c = 'Test002', Product2__c = prod02.Id); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | system.runAs(MyUser_Test){ |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01,prod02}; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | //订单 |
| | | Consumable_order__c Order1 = new Consumable_order__c(); |
| | | Order1.Name = 'OCM_01_001'; |
| | |
| | | //发货明细 |
| | | //fahuo |
| | | Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c(); |
| | | Orderdet1.Name = 'OCM_01_001001'; |
| | | Orderdet1.Consumable_order_minor__c = Order1.Id; |
| | | Orderdet1.Consumable_Product__c = pro1.Id; |
| | | Orderdet1.Asset_Model_No__c = 'Pro001'; |
| | | Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet1.Box_Piece__c = '盒'; |
| | | Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF'; |
| | | //daohuo |
| | | Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c(); |
| | | Orderdet2.Name = 'OCM_01_001002'; |
| | | Orderdet2.Consumable_order_minor__c = Order1.Id; |
| | | Orderdet2.Consumable_Product__c = pro1.Id; |
| | | Orderdet2.Asset_Model_No__c = 'Pro001'; |
| | | Orderdet2.Consumable_Arrived_order__c = Order1.Id; |
| | | //Orderdet2.IsArrival__c = true; |
| | | Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet2.Box_Piece__c = '盒'; |
| | | Orderdet2.Arrive_date__c = Date.today(); |
| | | //Orderdet2.Send_Date__c = Date.today(); |
| | | //Orderdet2.Used_date__c= Date.today(); |
| | | Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF'; |
| | | Orderdet1.Name = 'OCM_01_001001'; |
| | | Orderdet1.Consumable_order_minor__c = Order1.Id; |
| | | Orderdet1.Consumable_Product__c = pro1.Id; |
| | | Orderdet1.Asset_Model_No__c = 'Pro001'; |
| | | Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet1.Box_Piece__c ='盒'; |
| | | Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF'; |
| | | //daohuo |
| | | Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c(); |
| | | Orderdet2.Name = 'OCM_01_001002'; |
| | | Orderdet2.Consumable_order_minor__c = Order1.Id; |
| | | Orderdet2.Consumable_Product__c = pro1.Id; |
| | | Orderdet2.Asset_Model_No__c = 'Pro001'; |
| | | Orderdet2.Consumable_Arrived_order__c = Order1.Id; |
| | | //Orderdet2.IsArrival__c = true; |
| | | Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet2.Box_Piece__c ='盒'; |
| | | Orderdet2.Arrive_date__c = Date.today(); |
| | | //Orderdet2.Send_Date__c = Date.today(); |
| | | //Orderdet2.Used_date__c= Date.today(); |
| | | Orderdet2.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF'; |
| | | //sale |
| | | Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c(); |
| | | Orderdet3.Name = 'OCM_01_001003'; |
| | |
| | | Orderdet3.Consumable_Arrived_order__c = Order1.Id; |
| | | //Orderdet3.IsArrival__c = true; |
| | | Orderdet3.Consumable_Sale_order__c = Order1.Id; |
| | | Orderdet3.Box_Piece__c = '盒'; |
| | | Orderdet3.Used_date__c = Date.today(); |
| | | Orderdet3.Box_Piece__c ='盒'; |
| | | Orderdet3.Used_date__c= Date.today(); |
| | | Orderdet3.Arrive_date__c = Date.today(); |
| | | Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF'; |
| | |
| | | Orderdet4.Consumable_Arrived_order__c = Order1.Id; |
| | | //Orderdet4.IsArrival__c = true; |
| | | Orderdet4.Consumable_Shipment_order__c = Order1.Id; |
| | | Orderdet4.Box_Piece__c = '个'; |
| | | Orderdet4.Box_Piece__c ='个'; |
| | | Orderdet4.Send_Date__c = Date.today(); |
| | | Orderdet4.Arrive_date__c = Date.today(); |
| | | Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | |
| | | Orderdet5.Cancellation_Flag__c = true; |
| | | Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRZ'; |
| | | Orderdet5.Box_Piece__c = '个'; |
| | | Orderdet5.Box_Piece__c ='个'; |
| | | Orderdet5.TracingCode__c = 'BXJRZ'; |
| | | Orderdet5.SerialLotNo__c = '5ZK'; |
| | | insert new List<Consumable_order_details2__c>{ Orderdet1, Orderdet3, Orderdet4, Orderdet5 }; |
| | | insert new Consumable_order_details2__c[] {Orderdet1,Orderdet3,Orderdet4,Orderdet5}; |
| | | |
| | | PageReference page = new PageReference('/apex/ArriveGoods?ArrType=ReG'); |
| | | System.Test.setCurrentPage(page); |
| | |
| | | Controller.SearchPro(); |
| | | System.assertEquals(1, controller.ConsumableorderdetailsRecordserror.size()); |
| | | // System.assertEquals(2, controller.ShowGoodsofReturnList.size()); |
| | | controller.ShowGoodsofReturnList[0].esd.Return_reason__c = '多发'; |
| | | controller.ShowGoodsofReturnList[0].esd.Return_reason__c='多发'; |
| | | // controller.ShowGoodsofReturnList[1].esd.Return_reason__c='多发'; |
| | | // controller.ShowGoodsofReturnList[0].esd.Rrturn_count__c =1; |
| | | Controller.UpdateGoodsOfReturn(); |
| | | |
| | | list<String> list1 = new List<String>(); |
| | | list<String> list1 = new list<String>(); |
| | | list1.add(Controller.barcode = '01234567898'); |
| | | Controller.inventoryEntryNoESetId(list1); |
| | | |
| | |
| | | list1.add(Controller.barcode = '0112345678901231106789012105625001234'); |
| | | Controller.inventoryEntryNoESetId(list1); |
| | | System.Test.stopTest(); |
| | | |
| | | } |
| | | } |
| | | |
| | | //整体到货 |
| | | @isTest |
| | | static void ArrivejancodeTest() { |
| | | static void ArrivejancodeTest() { |
| | | // // TO DO: implement unit test |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)']; |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | |
| | | Oly_TriggerHandler.bypass('ConsumableAssetHander'); |
| | | Account myAccount2 = new Account( |
| | | name = 'Testaccount002', |
| | | Dealer_discount__c = 20, |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '9999900' |
| | | ); |
| | | Account myAccount1 = new Account(name = 'Testaccount001', Dealer_discount__c = 30, RecordTypeId = rectCo[0].Id); |
| | | insert new List<account>{ myAccount1, myAccount2 }; |
| | | Contact core = new Contact(email = 'jplumber@salesforce.com', firstname = 'Joe', lastname = 'Plumber', accountid = myAccount1.id); |
| | | Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900'); |
| | | Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id); |
| | | insert new account[]{myAccount1,myAccount2}; |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id); |
| | | insert core; |
| | | user MyUser_Test = new User( |
| | | ContactId = core.id, |
| | | Alias = 'newUser', |
| | | Email = 'newuser@testorg.com', |
| | | EmailEncodingKey = 'UTF-8', |
| | | LastName = 'TestUser', |
| | | LanguageLocaleKey = 'zh_CN', |
| | | LocaleSidKey = 'zh_CN', |
| | | ProfileId = prof.Id, |
| | | TimeZoneSidKey = 'Asia/Shanghai', |
| | | UserName = 'testUser@testorg.com', |
| | | UserPro_Type__c = 'ET' |
| | | ); |
| | | System.runAs(new User(Id = UserInfo.getUserId())) { |
| | | user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET'); |
| | | System.runAs(new User(Id = UserInfo.getUserId())){ |
| | | insert MyUser_Test; |
| | | } |
| | | |
| | |
| | | // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // insert new Product2[] {prod01,prod02}; |
| | | System.runAs(MyUser_Test) { |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200311', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod02 = new Product2( |
| | | Name = 'Test02', |
| | | ProductCode = 'Test02', |
| | | Asset_Model_No__c = 'Test02', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200312', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2__c pro1 = new Product2__c(Name = 'Pro001', OT_CODE_Text__c = 'Test001', Product2__c = prod01.Id); |
| | | insert new List<Product2__c>{ pro1 }; |
| | | system.runAs(MyUser_Test){ |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01,prod02}; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | insert new Product2__c[] {pro1}; |
| | | // Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id); |
| | | // insert myAccount1; |
| | | Consumable_order__c Order2 = new Consumable_order__c(); |
| | |
| | | Orderdet3.SerialLotNo__c = '5ZK'; |
| | | //Orderdet3.Box_Piece__c = '个'; |
| | | |
| | | |
| | | //出库产品 |
| | | Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c(); |
| | | Orderdet4.Name = 'OCM_01_001005'; |
| | |
| | | Orderdet4.Asset_Model_No__c = 'Test01'; |
| | | Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRD'; |
| | | Orderdet4.Send_Date__c = Date.today(); |
| | | Orderdet4.Send_Date__c = Date.today(); |
| | | Orderdet4.Arrive_date__c = Date.today(); |
| | | Orderdet4.Box_Piece__c = '盒'; |
| | | Orderdet4.TracingCode__c = 'BXJRD'; |
| | |
| | | Orderdet5.Consumable_Shipment_order__c = Order1.Id; |
| | | Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRE'; |
| | | Orderdet5.Arrive_date__c = Date.today(); |
| | | Orderdet5.Arrive_date__c = Date.today(); |
| | | Orderdet5.Box_Piece__c = '盒'; |
| | | Orderdet5.TracingCode__c = 'BXJRE'; |
| | | Orderdet5.SerialLotNo__c = '5ZK'; |
| | | insert new List<Consumable_order_details2__c>{ Orderdet1, Orderdet2, Orderdet3, Orderdet4, Orderdet5 }; |
| | | insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5}; |
| | | |
| | | |
| | | |
| | | ArriveGoodsController Controller = new ArriveGoodsController(); |
| | | PageReference page = new PageReference('/apex/ArriveGoods?ArrType=Arr'); |
| | |
| | | System.assertEquals('OCM_01_001002', controller.ConsumableorderdetailsRecords[0].esd.Name); |
| | | // System.assertEquals(2, controller.ConsumableorderdetailsRecordserror.size()); |
| | | System.Test.stopTest(); |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | //发错货 入库 |
| | | @isTest |
| | | static void ArriveotheragencyTest() { |
| | | static void ArriveotheragencyTest() { |
| | | // // TO DO: implement unit test |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)']; |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | |
| | | Oly_TriggerHandler.bypass('ConsumableAssetHander'); |
| | | Account myAccount2 = new Account( |
| | | name = 'Testaccount002', |
| | | Dealer_discount__c = 20, |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '9999900' |
| | | ); |
| | | Account myAccount1 = new Account(name = 'Testaccount001', Dealer_discount__c = 30, RecordTypeId = rectCo[0].Id); |
| | | insert new List<account>{ myAccount1, myAccount2 }; |
| | | Contact core = new Contact(email = 'jplumber@salesforce.com', firstname = 'Joe', lastname = 'Plumber', accountid = myAccount1.id); |
| | | Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900'); |
| | | Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id); |
| | | insert new account[]{myAccount1,myAccount2}; |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id); |
| | | insert core; |
| | | user MyUser_Test = new User( |
| | | ContactId = core.id, |
| | | Alias = 'newUser', |
| | | Email = 'newuser@testorg.com', |
| | | EmailEncodingKey = 'UTF-8', |
| | | LastName = 'TestUser', |
| | | LanguageLocaleKey = 'zh_CN', |
| | | LocaleSidKey = 'zh_CN', |
| | | ProfileId = prof.Id, |
| | | TimeZoneSidKey = 'Asia/Shanghai', |
| | | UserName = 'testUser@testorg.com', |
| | | UserPro_Type__c = 'ET' |
| | | ); |
| | | System.runAs(new User(Id = UserInfo.getUserId())) { |
| | | user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET'); |
| | | System.runAs(new User(Id = UserInfo.getUserId())){ |
| | | insert MyUser_Test; |
| | | } |
| | | |
| | |
| | | // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // insert new Product2[] {prod01,prod02}; |
| | | System.runAs(MyUser_Test) { |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200311', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod02 = new Product2( |
| | | Name = 'Test02', |
| | | ProductCode = 'Test02', |
| | | Asset_Model_No__c = 'Test02', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200312', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2__c pro1 = new Product2__c(Name = 'Pro001', OT_CODE_Text__c = 'Test001', Product2__c = prod01.Id); |
| | | insert new List<Product2__c>{ pro1 }; |
| | | Account myAccount3 = new Account(name = 'Testaccount003', Dealer_discount__c = 30, RecordTypeId = rectCo[0].Id); |
| | | system.runAs(MyUser_Test){ |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01,prod02}; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | insert new Product2__c[] {pro1}; |
| | | Account myAccount3 = new Account(name='Testaccount003',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id); |
| | | insert myAccount3; |
| | | Consumable_order__c Order2 = new Consumable_order__c(); |
| | | Order2.Name = 'OCM_02_001'; |
| | |
| | | // Orderdet3.SerialLotNo__c = '5ZK'; |
| | | // //Orderdet3.Box_Piece__c = '个'; |
| | | |
| | | |
| | | // //出库产品 |
| | | // Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c(); |
| | | // Orderdet4.Name = 'OCM_01_001005'; |
| | |
| | | // Orderdet5.SerialLotNo__c = '5ZK'; |
| | | // insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5}; |
| | | |
| | | |
| | | |
| | | ArriveGoodsController Controller = new ArriveGoodsController(); |
| | | PageReference page = new PageReference('/apex/ArriveGoods?ArrType=Arr'); |
| | | System.Test.setCurrentPage(page); |
| | |
| | | |
| | | // System.assertEquals(2, controller.ConsumableorderdetailsRecordserror.size()); |
| | | System.Test.stopTest(); |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | //返品 |
| | | @isTest |
| | | static void addInventoryDetails1() { |
| | | static void addInventoryDetails1() { |
| | | // // TO DO: implement unit test |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)']; |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | |
| | | Account myAccount2 = new Account( |
| | | name = 'Testaccount002', |
| | | Dealer_discount__c = 20, |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '9999900' |
| | | ); |
| | | Account myAccount1 = new Account(name = 'Testaccount001', Dealer_discount__c = 30, RecordTypeId = rectCo[0].Id); |
| | | insert new List<account>{ myAccount1, myAccount2 }; |
| | | |
| | | Contact core = new Contact(email = 'jplumber@salesforce.com', firstname = 'Joe', lastname = 'Plumber', accountid = myAccount1.id); |
| | | Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900'); |
| | | Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id); |
| | | insert new account[]{myAccount1,myAccount2}; |
| | | |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id); |
| | | insert core; |
| | | user MyUser_Test = new User( |
| | | ContactId = core.id, |
| | | Alias = 'newUser', |
| | | Email = 'newuser@testorg.com', |
| | | EmailEncodingKey = 'UTF-8', |
| | | LastName = 'TestUser', |
| | | LanguageLocaleKey = 'zh_CN', |
| | | LocaleSidKey = 'zh_CN', |
| | | ProfileId = prof.Id, |
| | | TimeZoneSidKey = 'Asia/Shanghai', |
| | | UserName = 'testUser@testorg.com', |
| | | UserPro_Type__c = 'ET' |
| | | ); |
| | | System.runAs(new User(Id = UserInfo.getUserId())) { |
| | | user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET'); |
| | | System.runAs(new User(Id = UserInfo.getUserId())){ |
| | | insert MyUser_Test; |
| | | } |
| | | |
| | |
| | | // Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | // insert new Product2[] {prod01,prod02}; |
| | | System.runAs(MyUser_Test) { |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200311', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod02 = new Product2( |
| | | Name = 'Test02', |
| | | ProductCode = 'Test02', |
| | | Asset_Model_No__c = 'Test02', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200312', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2__c pro1 = new Product2__c(Name = 'Pro001', OT_CODE_Text__c = 'Test001', Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name = 'Pro002', OT_CODE_Text__c = 'Test002', Product2__c = prod02.Id); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | system.runAs(MyUser_Test){ |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01,prod02}; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | //订单 |
| | | Oly_TriggerHandler.bypass('ConsumableAssetHander'); |
| | | Consumable_order__c Order1 = new Consumable_order__c(); |
| | |
| | | Orderdet3.Consumable_Sale_order__c = Order1.Id; |
| | | Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet3.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRJ'; |
| | | Orderdet3.Box_Piece__c = '盒'; |
| | | Orderdet3.Box_Piece__c ='盒'; |
| | | Orderdet3.TracingCode__c = 'BXJRF'; |
| | | //出库 |
| | | Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c(); |
| | |
| | | Orderdet4.Consumable_Shipment_order__c = Order1.Id; |
| | | Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet4.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRN'; |
| | | Orderdet4.Box_Piece__c = '个'; |
| | | Orderdet4.Box_Piece__c ='个'; |
| | | Orderdet4.TracingCode__c = 'BXJRF'; |
| | | //quxiao |
| | | Consumable_order_details2__c Orderdet5 = new Consumable_order_details2__c(); |
| | |
| | | Orderdet5.Cancellation_Date__c = Date.today(); |
| | | Orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet5.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRZ'; |
| | | Orderdet5.Box_Piece__c = '盒'; |
| | | Orderdet5.Box_Piece__c ='盒'; |
| | | Orderdet5.TracingCode__c = 'BXJRF'; |
| | | //fanpin |
| | | Consumable_order_details2__c Orderdet6 = new Consumable_order_details2__c(); |
| | |
| | | Orderdet6.Consumable_Return_order__c = Order2.Id; |
| | | Orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet6.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRA'; |
| | | Orderdet6.Box_Piece__c = '个'; |
| | | Orderdet6.Box_Piece__c ='个'; |
| | | Orderdet6.TracingCode__c = 'BXJRF'; |
| | | |
| | | // 丢失 |
| | |
| | | Orderdet7.Arrive_date__c = Date.today(); |
| | | Orderdet7.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet7.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJQT'; |
| | | Orderdet7.Box_Piece__c = '个'; |
| | | Orderdet7.Box_Piece__c ='个'; |
| | | Orderdet7.TracingCode__c = 'BXJQT'; |
| | | |
| | | insert new List<Consumable_order_details2__c>{ Orderdet1, Orderdet2, Orderdet3, Orderdet4, Orderdet5, Orderdet6, Orderdet7 }; |
| | | insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4,Orderdet5,Orderdet6,Orderdet7}; |
| | | PageReference page = new PageReference('/apex/ArriveGoods?ArrType=ReG'); |
| | | System.Test.setCurrentPage(page); |
| | | ArriveGoodsController Controller = new ArriveGoodsController(); |
| | |
| | | //System.assertEquals('OCM_01_001002', controller.ConsumableorderdetailsRecordserror[2].esd.Name); |
| | | //System.assertEquals('OCM_02_001001', controller.ConsumableorderdetailsRecordserror[3].esd.Name); |
| | | // Controller.GoodsReturnCheck(); |
| | | controller.ShowGoodsofReturnList[0].esd.Return_reason__c = '多发'; |
| | | controller.ShowGoodsofReturnList[0].esd.Rrturn_count__c = 1; |
| | | controller.ShowGoodsofReturnList[0].esd.Return_reason__c='多发'; |
| | | controller.ShowGoodsofReturnList[0].esd.Rrturn_count__c =1; |
| | | //System.assertEquals(1, controller.ShowGoodsofReturnList.size()); |
| | | Controller.UpdateGoodsOfReturn(); |
| | | Controller.ToReturnGoodsPage(); |
| | | Controller.geterrorsize(); |
| | | System.Test.stopTest(); |
| | | |
| | | } |
| | | } |
| | | |
| | | @isTest |
| | | static void makeRecordsVieweTest() { |
| | | Integer count = 1001; |
| | | static void makeRecordsVieweTest() { |
| | | Integer count = 1001; |
| | | List<ArriveGoodsController.ConsumableorderdetailsInfo> conList = new List<ArriveGoodsController.ConsumableorderdetailsInfo>(); |
| | | for (Integer i = 0; i < 1001; i++) { |
| | | for(Integer i = 0; i < 1001; i++){ |
| | | conList.add(new ArriveGoodsController.ConsumableorderdetailsInfo()); |
| | | } |
| | | ArriveGoodsController arr = new ArriveGoodsController(); |
| | | arr.makeRecordsView(conList); |
| | | ArriveGoodsController arr1 = new ArriveGoodsController('', ''); |
| | | ArriveGoodsController arr1 = new ArriveGoodsController('',''); |
| | | } |
| | | |
| | | @isTest |
| | | static void compareToTest() { |
| | | static void compareToTest() { |
| | | ArriveGoodsController.ConsumableorderdetailsInfo c1 = new ArriveGoodsController.ConsumableorderdetailsInfo(); |
| | | ArriveGoodsController.ConsumableorderdetailsInfo c2 = new ArriveGoodsController.ConsumableorderdetailsInfo(); |
| | | c1.compareTo(c2); |
| | | } |
| | | |
| | | @isTest |
| | | static void searchProTest1() { |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | static void searchProTest1() { |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | Account myAccount2 = new Account( |
| | | name = 'Testaccount002', |
| | | Dealer_discount__c = 20, |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '9999900' |
| | | ); |
| | | Account myAccount1 = new Account(name = 'Testaccount001', Dealer_discount__c = 30, RecordTypeId = rectCo[0].Id); |
| | | insert new List<account>{ myAccount1, myAccount2 }; |
| | | Contact core = new Contact(email = 'jplumber@salesforce.com', firstname = 'Joe', lastname = 'Plumber', accountid = myAccount1.id); |
| | | Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900'); |
| | | Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id); |
| | | insert new account[]{myAccount1,myAccount2}; |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id); |
| | | insert core; |
| | | user MyUser_Test = new User( |
| | | ContactId = core.id, |
| | | Alias = 'newUser', |
| | | Email = 'newuser@testorg.com', |
| | | EmailEncodingKey = 'UTF-8', |
| | | LastName = 'TestUser', |
| | | LanguageLocaleKey = 'zh_CN', |
| | | LocaleSidKey = 'zh_CN', |
| | | ProfileId = prof.Id, |
| | | TimeZoneSidKey = 'Asia/Shanghai', |
| | | UserName = 'testUser@testorg.com', |
| | | UserPro_Type__c = 'ET' |
| | | ); |
| | | System.runAs(new User(Id = UserInfo.getUserId())) { |
| | | user MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',UserPro_Type__c = 'ET'); |
| | | System.runAs(new User(Id = UserInfo.getUserId())){ |
| | | insert MyUser_Test; |
| | | } |
| | | |
| | | System.runAs(MyUser_Test) { |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200311', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod02 = new Product2( |
| | | Name = 'Test02', |
| | | ProductCode = 'Test02', |
| | | Asset_Model_No__c = 'Test02', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200312', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2__c pro1 = new Product2__c(Name = 'Pro001', OT_CODE_Text__c = 'N3047730', Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name = 'Pro002', OT_CODE_Text__c = 'N3047731', Product2__c = prod02.Id); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | System.runAs(MyUser_Test){ |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01,prod02}; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='N3047730',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='N3047731',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | |
| | | Consumable_order__c Order1 = new Consumable_order__c(); |
| | | Order1.Name = 'OCM_01_001'; |
| | |
| | | Orderdet1.TracingCode__c = 'BXJRF'; |
| | | Orderdet1.SerialLotNo__c = '5ZK'; |
| | | insert Orderdet1; |
| | | System.debug('Orderdet1:' + Orderdet1); |
| | | System.debug('Orderdet1:'+Orderdet1); |
| | | Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c(); |
| | | Orderdet2.Name = 'OCM_01_001001'; |
| | | Orderdet2.Consumable_order_minor__c = Order1.Id; |
| | |
| | | Controller.barcode = '01049531702003111115120017181000105ZK250BXJRF'; |
| | | Controller.SearchPro(); |
| | | Controller.ArriveGoodsConfim(); |
| | | List<Consumable_order_details2__c> ins = [ |
| | | SELECT Id, Name |
| | | FROM Consumable_order_details2__c |
| | | ]; |
| | | List<Consumable_order_details2__c> ins = [SELECT Id,Name FROM Consumable_order_details2__c]; |
| | | System.Test.stopTest(); |
| | | } |
| | | } |
| | | } |
| | | } |