| | |
| | | NoteStay__c n = new NoteStay__c(Name = 'NoteStay', IsStay__c = true); |
| | | insert n; |
| | | System.runAs(currentUser) { |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | myAccount1 = new Account( |
| | | name = 'testaccount001', |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '9999900' |
| | | ); |
| | | myAccount1 = new Account(name='testaccount001',RecordTypeId = rectCo[0].Id ,AgentCode_Ext__c = '9999900'); |
| | | insert myAccount1; |
| | | core = new Contact( |
| | | email = 'jplumber@salesforce.com', |
| | | core = new Contact(email='jplumber@salesforce.com', |
| | | firstname = 'Joe', |
| | | lastname = 'Plumber', |
| | | accountid = myAccount1.id |
| | | ); |
| | | accountid=myAccount1.id); |
| | | insert core; |
| | | myUser_test = new User( |
| | | myUser_test = New User( |
| | | ContactId = core.id, |
| | | Alias = 'newUser', |
| | | Email = 'newuser@testorg.com', |
| | |
| | | ProfileId = prof.Id, |
| | | TimeZoneSidKey = 'Asia/Shanghai', |
| | | UserName = 'testUser@testorg.com', |
| | | Work_Location__c = '北京' |
| | | ); |
| | | Work_Location__c='北京'); |
| | | insert myUser_test; |
| | | } |
| | | System.runAs(myUser_test) { |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod02 = new Product2( |
| | | Name = 'Test02', |
| | | ProductCode = 'Test02', |
| | | Asset_Model_No__c = 'Test02', |
| | | SFDA_Status__c = '有効', |
| | | 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 }; |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',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( |
| | | Name = 'OCM_01_001', |
| | | RecordTypeId = System.Label.RT_ConOrder_Delivery, |
| | | Order_type__c = '订单', |
| | | Dealer_info__c = myAccount1.Id, |
| | | Order_ProType__c = 'ET' |
| | | ); |
| | | Order_ProType__c = 'ET'); |
| | | Consumable_order__c Order2 = new Consumable_order__c( |
| | | Name = 'OCM_01_002', |
| | | RecordTypeId = System.Label.RT_ConOrder_Delivery, |
| | | Order_type__c = '订单', |
| | | Dealer_info__c = myAccount1.Id, |
| | | Order_ProType__c = 'ET' |
| | | ); |
| | | insert new List<Consumable_order__c>{ Order1, Order2 }; |
| | | Order_ProType__c = 'ET'); |
| | | insert new Consumable_order__c[] {Order1, Order2}; |
| | | |
| | | //明细1 |
| | | Consumable_orderdetails__c createDetail = new Consumable_orderdetails__c(); |
| | |
| | | Consumable_order_minor__c = Order1.Id, |
| | | Arrive_date__c = Date.today(), |
| | | Consumable_Product__c = pro1.id, |
| | | RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery |
| | | ); |
| | | RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery); |
| | | Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c( |
| | | Name = 'OCM_01_001002', |
| | | Consumable_order_minor__c = Order2.Id, |
| | | Arrive_date__c = Date.today(), |
| | | Consumable_Product__c = pro2.id, |
| | | RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery |
| | | ); |
| | | RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery); |
| | | Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c( |
| | | Name = 'OCM_01_001003', |
| | | Consumable_order_minor__c = Order1.Id, |
| | | //Arrive_date__c = Date.today(), |
| | | Consumable_Product__c = pro1.id, |
| | | RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery |
| | | ); |
| | | RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery); |
| | | Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c( |
| | | Name = 'OCM_01_001004', |
| | | Consumable_order_minor__c = Order2.Id, |
| | | Arrive_date__c = Date.today(), |
| | | Consumable_Product__c = pro2.id, |
| | | RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery |
| | | ); |
| | | insert new List<Consumable_order_details2__c>{ |
| | | Orderdet1, |
| | | Orderdet2, |
| | | Orderdet3, |
| | | Orderdet4 |
| | | }; |
| | | RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery); |
| | | insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2, Orderdet3, Orderdet4}; |
| | | |
| | | LexArriveGoodsMainController.init(); |
| | | LexArriveGoodsMainController.searchConsumableorderdetails( |
| | | 'Too001', |
| | | null, |
| | | myAccount1.Id, |
| | | '北京', |
| | | 'ET' |
| | | ); |
| | | LexArriveGoodsMainController.searchConsumableorderdetails('Too001', null, myAccount1.Id, '北京', 'ET'); |
| | | } |
| | | } |
| | | } |