| | |
| | | static testMethod void InventoryControllerTest_PartBar() { |
| | | user myUser_test; |
| | | Account myAccount1; |
| | | User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()]; |
| | | User thisUser = [ select Id from User where Id = :UserInfo.getUserId()]; |
| | | System.runAs(thisUser) { |
| | | Profile prof1 = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET Email)' |
| | | ]; |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | Profile prof1 = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)']; |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | StaticParameter.EscapeOrderDetail2Trigger = true; |
| | | StaticParameter.EscapeConsumableOrderDetail2Trigger = true; |
| | | RecordType rectCoO = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院' |
| | | ]; |
| | | RecordType rectCoO = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院']; |
| | | |
| | | Account olympus = new Account( |
| | | RecordTypeId = rectCoO.Id, |
| | | AgentCode_Ext__c = '9999900', |
| | | Name = 'olympus' |
| | | ); |
| | | Account olympus = new Account(RecordTypeId = rectCoO.Id, AgentCode_Ext__c = '9999900', Name = 'olympus'); |
| | | insert olympus; |
| | | |
| | | myAccount1 = new Account( |
| | | name = 'Testaccount001', |
| | | Dealer_discount__c = 10, |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '8888888' |
| | | ); |
| | | myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '8888888'); |
| | | insert myAccount1; |
| | | |
| | | 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; |
| | | 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 = prof1.Id, |
| | | TimeZoneSidKey = 'Asia/Shanghai', |
| | | UserName = 'testUser@testorg.com', |
| | | Work_Location__c = '上海' |
| | | ); |
| | | 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 = prof1.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '上海'); |
| | | insert MyUser_Test; |
| | | } |
| | | System.runAs(MyUser_Test) { |
| | | Product2 prod07 = new Product2( |
| | | Name = 'Test07', |
| | | ProductCode = 'Test07', |
| | | Asset_Model_No__c = 'Test07', |
| | | SFDA_Status__c = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Packing_list_manual__c = 1, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod08 = new Product2( |
| | | Name = 'Test08', |
| | | ProductCode = 'Test08', |
| | | Asset_Model_No__c = 'Test08', |
| | | SFDA_Status__c = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Packing_list_manual__c = 1, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod09 = new Product2( |
| | | Name = 'Test09', |
| | | ProductCode = 'Test09', |
| | | Asset_Model_No__c = 'Test09', |
| | | SFDA_Status__c = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Packing_list_manual__c = 1, |
| | | Manual_Entry__c = false |
| | | ); |
| | | |
| | | insert new List<Product2>{ prod07, prod08, prod09 }; |
| | | } |
| | | system.runAs(MyUser_Test){ |
| | | Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false); |
| | | Product2 prod08 = new Product2(Name='Test08',ProductCode='Test08',Asset_Model_No__c = 'Test08',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false); |
| | | Product2 prod09 = new Product2(Name='Test09',ProductCode='Test09',Asset_Model_No__c = 'Test09',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false); |
| | | |
| | | insert new Product2[] {prod07,prod08,prod09}; |
| | | |
| | | //制作产品 |
| | | Product2__c proG = new Product2__c( |
| | | Name = 'MH-155:白平衡帽', |
| | | OT_CODE_Text__c = 'Test001', |
| | | Product2__c = prod07.Id |
| | | ); |
| | | Product2__c proG = new Product2__c(Name='MH-155:白平衡帽',OT_CODE_Text__c='Test001',Product2__c = prod07.Id); |
| | | insert proG; |
| | | Product2__c proH = new Product2__c( |
| | | Name = 'MB-677:BNC电缆', |
| | | OT_CODE_Text__c = 'Test002', |
| | | Product2__c = prod08.Id |
| | | ); |
| | | Product2__c proH = new Product2__c(Name='MB-677:BNC电缆',OT_CODE_Text__c='Test002',Product2__c = prod08.Id); |
| | | insert proH; |
| | | Product2__c proF = new Product2__c( |
| | | Name = 'TooMAJ-643R:水囊鞘管003', |
| | | OT_CODE_Text__c = 'Test003', |
| | | Product2__c = prod09.Id |
| | | ); |
| | | Product2__c proF = new Product2__c(Name='TooMAJ-643R:水囊鞘管003',OT_CODE_Text__c='Test003',Product2__c = prod09.Id); |
| | | insert proF; |
| | | |
| | | //预制头明细 |
| | |
| | | CreateId.Order_ProType__c = 'ET'; |
| | | insert CreateId; |
| | | List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>(); |
| | | |
| | | |
| | | //制作Consumable_order_details__c-------ProductCount |
| | | Consumable_order_details2__c dataForProductCount9 = new Consumable_order_details2__c(); |
| | |
| | | conList.add(dataForProductCount5); |
| | | insert conList; |
| | | |
| | | List<Consumable_order_details2__c> productCount_Res = [ |
| | | SELECT Id, Name |
| | | List<Consumable_order_details2__c> productCount_Res = [select Id,Name |
| | | FROM Consumable_order_details2__c |
| | | WHERE |
| | | Dealer_Arrive__c = TRUE |
| | | AND Dealer_Shipment__c = FALSE |
| | | AND Dealer_Saled__c = FALSE |
| | | AND Lose_Flag__c = FALSE |
| | | AND Bar_Code__c != NULL |
| | | AND Dealer_Info_text__c = :myAccount1.Name |
| | | ]; |
| | | WHERE Dealer_Arrive__c = true |
| | | AND Dealer_Shipment__c = false |
| | | AND Dealer_Saled__c = false |
| | | AND Lose_Flag__c = false |
| | | AND Bar_Code__c !=null |
| | | AND Dealer_Info_text__c = :myAccount1.Name]; |
| | | //查询库存 追加返品库存 |
| | | |
| | | List<Consumable_order_details2__c> conList1 = new List<Consumable_order_details2__c>(); |
| | |
| | | testList1.add(ass); |
| | | } |
| | | System.debug('testList1:' + testList1); |
| | | LexInventoryController.searchConsumableorderdetails( |
| | | 'ET', |
| | | '上海', |
| | | 'Testaccount001', |
| | | '12345678856\n1234567895\n1234567890\n12345678511\n1234567856\n1234567855\n1234567886\n12345678551\n1234567890\n1234567883\n1234567882\n1234567881\n1234567884\nn123456788412\n1234567885\n123456788512\n1234567891\n1234567892\n1234567893\n1234567894', |
| | | JSON.serialize(testList1), |
| | | 1, |
| | | 0, |
| | | 'Test', |
| | | 'ASC' |
| | | ); |
| | | LexInventoryController.searchConsumableorderdetails( |
| | | 'ET', |
| | | '上海', |
| | | 'Testaccount001', |
| | | '1234567882', |
| | | JSON.serialize(testList1), |
| | | 1, |
| | | 0, |
| | | 'Test', |
| | | 'ASC' |
| | | ); |
| | | LexInventoryController.searchConsumableorderdetails('ET','上海','Testaccount001','12345678856\n1234567895\n1234567890\n12345678511\n1234567856\n1234567855\n1234567886\n12345678551\n1234567890\n1234567883\n1234567882\n1234567881\n1234567884\nn123456788412\n1234567885\n123456788512\n1234567891\n1234567892\n1234567893\n1234567894',JSON.serialize(testList1),1,0,'Test','ASC'); |
| | | LexInventoryController.searchConsumableorderdetails('ET','上海','Testaccount001','1234567882',JSON.serialize(testList1),1,0,'Test','ASC'); |
| | | LexInventoryController.barcode = ''; |
| | | |
| | | } |
| | | } |
| | | static testMethod void InventoryControllerTest_PartPan() { |
| | | user MyUser_Test; |
| | | Account myAccount1; |
| | | User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()]; |
| | | System.runAs(thisUser) { |
| | | Profile prof1 = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET Email)' |
| | | ]; |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | User thisUser = [ select Id from User where Id = :UserInfo.getUserId()]; |
| | | system.runAs(thisUser){ |
| | | |
| | | Profile prof1 = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)']; |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | RecordType rectCoO = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院' |
| | | ]; |
| | | Account olympus = new Account( |
| | | RecordTypeId = rectCoO.Id, |
| | | AgentCode_Ext__c = '9999900', |
| | | Name = 'olympus' |
| | | ); |
| | | RecordType rectCoO = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院']; |
| | | Account olympus = new Account(RecordTypeId = rectCoO.Id, AgentCode_Ext__c = '9999900', Name = 'olympus'); |
| | | insert olympus; |
| | | |
| | | Product2 prod07 = new Product2( |
| | | Name = 'Test07', |
| | | ProductCode = 'Test07', |
| | | Asset_Model_No__c = 'Test07', |
| | | SFDA_Status__c = '有効', |
| | | Dealer_special_Object__c = true |
| | | ); |
| | | Product2 prod08 = new Product2( |
| | | Name = 'Test08', |
| | | ProductCode = 'Test08', |
| | | Asset_Model_No__c = 'Test08', |
| | | SFDA_Status__c = '有効', |
| | | Dealer_special_Object__c = true |
| | | ); |
| | | Product2 prod09 = new Product2( |
| | | Name = 'Test09', |
| | | ProductCode = 'Test09', |
| | | Asset_Model_No__c = 'Test09', |
| | | SFDA_Status__c = '有効', |
| | | Dealer_special_Object__c = true |
| | | ); |
| | | insert new List<Product2>{ prod07, prod08, prod09 }; |
| | | Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',SFDA_Status__c = '有効',Dealer_special_Object__c = true); |
| | | Product2 prod08 = new Product2(Name='Test08',ProductCode='Test08',Asset_Model_No__c = 'Test08',SFDA_Status__c = '有効',Dealer_special_Object__c = true); |
| | | Product2 prod09 = new Product2(Name='Test09',ProductCode='Test09',Asset_Model_No__c = 'Test09',SFDA_Status__c = '有効',Dealer_special_Object__c = true); |
| | | insert new Product2[] {prod07,prod08,prod09}; |
| | | |
| | | //制作产品 |
| | | Product2__c proG = new Product2__c( |
| | | Name = 'Too001', |
| | | OT_CODE_Text__c = 'Test001', |
| | | Product2__c = prod07.Id |
| | | ); |
| | | Product2__c proG = new Product2__c(Name='Too001',OT_CODE_Text__c='Test001',Product2__c = prod07.Id); |
| | | insert proG; |
| | | Product2__c proH = new Product2__c( |
| | | Name = 'Too002', |
| | | OT_CODE_Text__c = 'Test002', |
| | | Product2__c = prod08.Id |
| | | ); |
| | | Product2__c proH = new Product2__c(Name='Too002',OT_CODE_Text__c='Test002',Product2__c = prod08.Id); |
| | | insert proH; |
| | | Product2__c proF = new Product2__c( |
| | | Name = 'Too003', |
| | | OT_CODE_Text__c = 'Test001', |
| | | Product2__c = prod09.Id |
| | | ); |
| | | Product2__c proF = new Product2__c(Name='Too003',OT_CODE_Text__c='Test001',Product2__c = prod09.Id); |
| | | insert proF; |
| | | |
| | | myAccount1 = new Account( |
| | | name = 'Testaccount001', |
| | | Dealer_discount__c = 10, |
| | | RecordTypeId = rectCo[0].Id |
| | | ); |
| | | |
| | | myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id); |
| | | |
| | | insert myAccount1; |
| | | |
| | | 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; |
| | | 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 = prof1.Id, |
| | | TimeZoneSidKey = 'Asia/Shanghai', |
| | | UserName = 'testUser@testorg.com' |
| | | ); |
| | | 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 = prof1.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com'); |
| | | insert MyUser_Test; |
| | | } |
| | | System.runAs(MyUser_Test) { |
| | | system.runAs(MyUser_Test){ |
| | | |
| | | InventoryController OwnTest = new InventoryController(); |
| | | OwnTest.size = 2; |
| | | OwnTest.init(); |
| | |
| | | static testMethod void InventoryControllerTest_ge() { |
| | | user MyUser_Test; |
| | | Account myAccount1; |
| | | User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()]; |
| | | System.runAs(thisUser) { |
| | | Profile prof1 = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET Email)' |
| | | ]; |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | User thisUser = [ select Id from User where Id = :UserInfo.getUserId()]; |
| | | system.runAs(thisUser){ |
| | | |
| | | |
| | | Profile prof1 = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)']; |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | StaticParameter.EscapeConsumableOrderDetail2Trigger = true; |
| | | |
| | | RecordType rectCoO = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院' |
| | | ]; |
| | | Account olympus = new Account( |
| | | RecordTypeId = rectCoO.Id, |
| | | AgentCode_Ext__c = '9999900', |
| | | Name = 'olympus' |
| | | ); |
| | | RecordType rectCoO = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院']; |
| | | Account olympus = new Account(RecordTypeId = rectCoO.Id, AgentCode_Ext__c = '9999900', Name = 'olympus'); |
| | | insert olympus; |
| | | myAccount1 = new Account( |
| | | name = 'Testaccount001', |
| | | Dealer_discount__c = 10, |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '8888888' |
| | | ); |
| | | myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '8888888'); |
| | | insert myAccount1; |
| | | 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; |
| | | 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 = prof1.Id, |
| | | TimeZoneSidKey = 'Asia/Shanghai', |
| | | UserName = 'testUser@testorg.com' |
| | | ); |
| | | 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 = prof1.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com'); |
| | | insert MyUser_Test; |
| | | } |
| | | System.runAs(MyUser_Test) { |
| | | Product2 prod07 = new Product2( |
| | | Name = 'Test07', |
| | | ProductCode = 'Test07', |
| | | Asset_Model_No__c = 'Test07', |
| | | SFDA_Status__c = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Packing_list_manual__c = 1, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod08 = new Product2( |
| | | Name = 'Test08', |
| | | ProductCode = 'Test08', |
| | | Asset_Model_No__c = 'Test08', |
| | | SFDA_Status__c = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Packing_list_manual__c = 1, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod09 = new Product2( |
| | | Name = 'Test09', |
| | | ProductCode = 'Test09', |
| | | Asset_Model_No__c = 'Test09', |
| | | SFDA_Status__c = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Packing_list_manual__c = 1, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod07, prod08, prod09 }; |
| | | system.runAs(MyUser_Test){ |
| | | |
| | | Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false); |
| | | Product2 prod08 = new Product2(Name='Test08',ProductCode='Test08',Asset_Model_No__c = 'Test08',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false); |
| | | Product2 prod09 = new Product2(Name='Test09',ProductCode='Test09',Asset_Model_No__c = 'Test09',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false); |
| | | insert new Product2[] {prod07,prod08,prod09}; |
| | | |
| | | //制作产品 |
| | | Product2__c proG = new Product2__c( |
| | | Name = 'MH-155:白平衡帽', |
| | | OT_CODE_Text__c = 'Test001', |
| | | Product2__c = prod07.Id |
| | | ); |
| | | Product2__c proG = new Product2__c(Name='MH-155:白平衡帽',OT_CODE_Text__c='Test001',Product2__c = prod07.Id); |
| | | insert proG; |
| | | Product2__c proH = new Product2__c( |
| | | Name = 'MB-677:BNC电缆', |
| | | OT_CODE_Text__c = 'Test002', |
| | | Product2__c = prod08.Id |
| | | ); |
| | | Product2__c proH = new Product2__c(Name='MB-677:BNC电缆',OT_CODE_Text__c='Test002',Product2__c = prod08.Id); |
| | | insert proH; |
| | | Product2__c proF = new Product2__c( |
| | | Name = 'TooMAJ-643R:水囊鞘管003', |
| | | OT_CODE_Text__c = 'Test003', |
| | | Product2__c = prod09.Id |
| | | ); |
| | | Product2__c proF = new Product2__c(Name='TooMAJ-643R:水囊鞘管003',OT_CODE_Text__c='Test003',Product2__c = prod09.Id); |
| | | insert proF; |
| | | |
| | | //预制头明细 |
| | |
| | | CreateId.Order_ProType__c = 'ET'; |
| | | insert CreateId; |
| | | List<Consumable_order_details2__c> orderList = new List<Consumable_order_details2__c>(); |
| | | |
| | | |
| | | //制作Consumable_order_details__c-------ProductCount |
| | | Consumable_order_details2__c dataForProductCount9 = new Consumable_order_details2__c(); |
| | |
| | | //dataForProductCount3.RemoveBox_No__c = 1; |
| | | orderList.add(dataForProductCount3); |
| | | |
| | | |
| | | PageReference page = new Pagereference('/Inventory'); |
| | | page.setRedirect(true); |
| | | System.Test.setCurrentPage(page); |
| | | System.Test.startTest(); |
| | | LexInventoryController controller = new LexInventoryController(); |
| | | LexInventoryController.init(); |
| | | System.debug( |
| | | '===>值1' + LexInventoryController.consumableorderdetailsRecords |
| | | ); |
| | | System.debug( |
| | | '===>值2' + |
| | | JSON.serialize(LexInventoryController.consumableorderdetailsRecords) |
| | | ); |
| | | System.debug( |
| | | '===>2222222' + |
| | | JSON.serialize(LexInventoryController.consumableorderdetailsRecords) |
| | | ); |
| | | System.debug('===>值1'+LexInventoryController.consumableorderdetailsRecords); |
| | | System.debug('===>值2'+ JSON.serialize(LexInventoryController.consumableorderdetailsRecords)); |
| | | System.debug('===>2222222'+JSON.serialize(LexInventoryController.consumableorderdetailsRecords)); |
| | | List<LexInventoryController.ConsumableorderdetailsInfo> testList = LexInventoryController.consumableorderdetailsRecords; |
| | | List<LexInventoryController.ConsumableorderdetailsInfo> testList1 = new List<LexInventoryController.ConsumableorderdetailsInfo>(); |
| | | System.debug('testCount:' + testList.size()); |
| | |
| | | } |
| | | System.debug('testList1:' + testList1); |
| | | |
| | | LexInventoryController.searchConsumableorderdetails( |
| | | 'ET', |
| | | '上海', |
| | | 'Testaccount001', |
| | | '12345678856\n1234567895\n1234567890\n12345678511\n1234567856\n1234567855\n1234567886\n12345678551\n1234567890\n1234567883\n1234567882\n1234567881\n1234567884\nn123456788412\n1234567885\n123456788512\n1234567891\n1234567892\n1234567893\n1234567894', |
| | | JSON.serialize(testList1), |
| | | 1, |
| | | 0, |
| | | 'Test', |
| | | 'ASC' |
| | | ); |
| | | LexInventoryController.searchConsumableorderdetails('ET','上海','Testaccount001','12345678856\n1234567895\n1234567890\n12345678511\n1234567856\n1234567855\n1234567886\n12345678551\n1234567890\n1234567883\n1234567882\n1234567881\n1234567884\nn123456788412\n1234567885\n123456788512\n1234567891\n1234567892\n1234567893\n1234567894',JSON.serialize(testList1),1,0,'Test','ASC'); |
| | | System.Test.stopTest(); |
| | | } |
| | | } |
| | | static testMethod void InventoryControllerTest_xunhui() { |
| | | user MyUser_Test; |
| | | Account myAccount1; |
| | | User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()]; |
| | | System.runAs(thisUser) { |
| | | Profile prof1 = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET Email)' |
| | | ]; |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | User thisUser = [ select Id from User where Id = :UserInfo.getUserId()]; |
| | | system.runAs(thisUser){ |
| | | Profile prof1 = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)']; |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | StaticParameter.EscapeOrderDetail2Trigger = true; |
| | | StaticParameter.EscapeConsumableOrderDetail2Trigger = true; |
| | | RecordType rectCoO = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院' |
| | | ]; |
| | | Account olympus = new Account( |
| | | RecordTypeId = rectCoO.Id, |
| | | AgentCode_Ext__c = '9999900', |
| | | Name = 'olympus' |
| | | ); |
| | | RecordType rectCoO = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院']; |
| | | Account olympus = new Account(RecordTypeId = rectCoO.Id, AgentCode_Ext__c = '9999900', Name = 'olympus'); |
| | | insert olympus; |
| | | myAccount1 = new Account( |
| | | name = 'Testaccount001', |
| | | Dealer_discount__c = 10, |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '8888888' |
| | | ); |
| | | myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '8888888'); |
| | | insert myAccount1; |
| | | 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; |
| | | 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 = prof1.Id, |
| | | TimeZoneSidKey = 'Asia/Shanghai', |
| | | UserName = 'testUser@testorg.com' |
| | | ); |
| | | 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 = prof1.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com'); |
| | | insert MyUser_Test; |
| | | } |
| | | System.runAs(MyUser_Test) { |
| | | Product2 prod07 = new Product2( |
| | | Name = 'Test07', |
| | | ProductCode = 'Test07', |
| | | Asset_Model_No__c = 'Test07', |
| | | SFDA_Status__c = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Packing_list_manual__c = 1, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod08 = new Product2( |
| | | Name = 'Test08', |
| | | ProductCode = 'Test08', |
| | | Asset_Model_No__c = 'Test08', |
| | | SFDA_Status__c = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Packing_list_manual__c = 1, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod09 = new Product2( |
| | | Name = 'Test09', |
| | | ProductCode = 'Test09', |
| | | Asset_Model_No__c = 'Test09', |
| | | SFDA_Status__c = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Packing_list_manual__c = 1, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod07, prod08, prod09 }; |
| | | system.runAs(MyUser_Test){ |
| | | |
| | | Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false); |
| | | Product2 prod08 = new Product2(Name='Test08',ProductCode='Test08',Asset_Model_No__c = 'Test08',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false); |
| | | Product2 prod09 = new Product2(Name='Test09',ProductCode='Test09',Asset_Model_No__c = 'Test09',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false); |
| | | insert new Product2[] {prod07,prod08,prod09}; |
| | | |
| | | //制作产品 |
| | | Product2__c proG = new Product2__c( |
| | | Name = 'MH-155:白平衡帽', |
| | | OT_CODE_Text__c = 'Test001', |
| | | Product2__c = prod07.Id |
| | | ); |
| | | Product2__c proG = new Product2__c(Name='MH-155:白平衡帽',OT_CODE_Text__c='Test001',Product2__c = prod07.Id); |
| | | insert proG; |
| | | Product2__c proH = new Product2__c( |
| | | Name = 'MB-677:BNC电缆', |
| | | OT_CODE_Text__c = 'Test002', |
| | | Product2__c = prod08.Id |
| | | ); |
| | | Product2__c proH = new Product2__c(Name='MB-677:BNC电缆',OT_CODE_Text__c='Test002',Product2__c = prod08.Id); |
| | | insert proH; |
| | | Product2__c proF = new Product2__c( |
| | | Name = 'TooMAJ-643R:水囊鞘管003', |
| | | OT_CODE_Text__c = 'Test003', |
| | | Product2__c = prod09.Id |
| | | ); |
| | | Product2__c proF = new Product2__c(Name='TooMAJ-643R:水囊鞘管003',OT_CODE_Text__c='Test003',Product2__c = prod09.Id); |
| | | insert proF; |
| | | |
| | | //预制头明细 |
| | |
| | | Order2.Order_ProType__c = 'ENG'; |
| | | orderList.add(Order2); |
| | | insert orderList; |
| | | |
| | | |
| | | |
| | | //制作Consumable_order_details__c-------ProductCount |
| | | Consumable_order_details2__c dataForProductCount9 = new Consumable_order_details2__c(); |
| | |
| | | conlist.add(con6); |
| | | System.debug('conlist===>' + conlist); |
| | | |
| | | |
| | | //reset592 |
| | | Consumable_order_details2__c con4 = new Consumable_order_details2__c(); |
| | | con4.Arrive_date__c = Date.today(); |
| | |
| | | // con2.Asset_Model_No__c = proH.Asset_Model_No__c; |
| | | con4.Consumable_order_minor__c = CreateId.id; |
| | | conlist.add(con4); |
| | | |
| | | |
| | | //查询库存 追加返品库存 |
| | | Consumable_order_details2__c con5 = new Consumable_order_details2__c(); |
| | |
| | | testList1.add(ass); |
| | | } |
| | | System.debug('testList1:' + testList1); |
| | | LexInventoryController.searchConsumableorderdetails( |
| | | 'ET', |
| | | '上海', |
| | | 'Testaccount001', |
| | | '', |
| | | JSON.serialize(testList1), |
| | | 20, |
| | | 9, |
| | | 'Test', |
| | | 'ASC' |
| | | ); |
| | | LexInventoryController.searchConsumableorderdetails( |
| | | 'ET', |
| | | '上海', |
| | | 'Testaccount001', |
| | | '01210000000kUDKAA2\n10011', |
| | | JSON.serialize(testList1), |
| | | 20, |
| | | 9, |
| | | 'Test', |
| | | 'ASC' |
| | | ); |
| | | LexInventoryController.searchConsumableorderdetails( |
| | | 'ET', |
| | | '上海', |
| | | 'Testaccount001', |
| | | '12345678856\n1234567895\n1234567890\n12345678511\n1234567856\n1234567855\n1234567886\n12345678551\n1234567890\n1234567883\n1234567882\n1234567881\n1234567884\nn123456788412\n1234567885\n123456788512\n1234567891\n1234567892\n1234567893\n1234567894\n1001', |
| | | JSON.serialize(testList1), |
| | | 1, |
| | | 0, |
| | | 'Test', |
| | | 'ASC' |
| | | ); |
| | | LexInventoryController.save( |
| | | true, |
| | | JSON.serialize(testList1), |
| | | myAccount1.Id, |
| | | 'ET', |
| | | LexInventoryController.pandiandetailsMap, |
| | | LexInventoryController.reSet |
| | | ); |
| | | LexInventoryController.searchConsumableorderdetails( |
| | | 'ET', |
| | | '上海', |
| | | 'Testaccount001', |
| | | '', |
| | | '[{"sortBy": null,"refind": 0,"ProdId": "a0l0l000004EisKAAS","Prod": {"attributes": {"type": "Product2__c","url": "/services/data/v58.0/sobjects/Product2__c/a0l0l000004EisKAAS"},"Id": "a0l0l000004EisKAAS","Name": "MH-155:白平衡帽","Name__c": "Test07","SFDA_Status__c": "停止","Packing_list_manual__c": 1,"Asset_Model_No__c": "Test07"},"Pandian": 0,"overlimitCount": 0,"orderdetails2": null,"orderdetails1": null,"limitCount": 2,"DiffReason": null,"Diff": 0,"countid": 2,"check": true,"canSelect": true,"boxPiece": "盒"}]', |
| | | 20, |
| | | 9, |
| | | 'Test', |
| | | 'ASC' |
| | | ); |
| | | LexInventoryController.searchConsumableorderdetails('ET','上海','Testaccount001','',JSON.serialize(testList1),20,9,'Test','ASC'); |
| | | LexInventoryController.searchConsumableorderdetails('ET','上海','Testaccount001','01210000000kUDKAA2\n10011',JSON.serialize(testList1),20,9,'Test','ASC'); |
| | | LexInventoryController.searchConsumableorderdetails('ET','上海','Testaccount001','12345678856\n1234567895\n1234567890\n12345678511\n1234567856\n1234567855\n1234567886\n12345678551\n1234567890\n1234567883\n1234567882\n1234567881\n1234567884\nn123456788412\n1234567885\n123456788512\n1234567891\n1234567892\n1234567893\n1234567894\n1001',JSON.serialize(testList1),1,0,'Test','ASC'); |
| | | LexInventoryController.save(true,JSON.serialize(testList1),myAccount1.Id,'ET',LexInventoryController.pandiandetailsMap,LexInventoryController.reSet); |
| | | LexInventoryController.searchConsumableorderdetails('ET','上海','Testaccount001','','[{"sortBy": null,"refind": 0,"ProdId": "a0l0l000004EisKAAS","Prod": {"attributes": {"type": "Product2__c","url": "/services/data/v58.0/sobjects/Product2__c/a0l0l000004EisKAAS"},"Id": "a0l0l000004EisKAAS","Name": "MH-155:白平衡帽","Name__c": "Test07","SFDA_Status__c": "停止","Packing_list_manual__c": 1,"Asset_Model_No__c": "Test07"},"Pandian": 0,"overlimitCount": 0,"orderdetails2": null,"orderdetails1": null,"limitCount": 2,"DiffReason": null,"Diff": 0,"countid": 2,"check": true,"canSelect": true,"boxPiece": "盒"}]',20,9,'Test','ASC'); |
| | | |
| | | |
| | | |
| | | System.Test.stopTest(); |
| | | } |
| | |
| | | static testMethod void all() { |
| | | user MyUser_Test; |
| | | Account myAccount1; |
| | | User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()]; |
| | | System.runAs(thisUser) { |
| | | Profile prof1 = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET Email)' |
| | | ]; |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | User thisUser = [ select Id from User where Id = :UserInfo.getUserId()]; |
| | | system.runAs(thisUser){ |
| | | Profile prof1 = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)']; |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | StaticParameter.EscapeOrderDetail2Trigger = true; |
| | | StaticParameter.EscapeConsumableOrderDetail2Trigger = true; |
| | | RecordType rectCoO = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院' |
| | | ]; |
| | | Account olympus = new Account( |
| | | RecordTypeId = rectCoO.Id, |
| | | AgentCode_Ext__c = '9999900', |
| | | Name = 'olympus' |
| | | ); |
| | | RecordType rectCoO = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院']; |
| | | Account olympus = new Account(RecordTypeId = rectCoO.Id, AgentCode_Ext__c = '9999900', Name = 'olympus'); |
| | | insert olympus; |
| | | myAccount1 = new Account( |
| | | name = 'Testaccount001', |
| | | Dealer_discount__c = 10, |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '8888888' |
| | | ); |
| | | myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '8888888'); |
| | | insert myAccount1; |
| | | 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; |
| | | 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 = prof1.Id, |
| | | TimeZoneSidKey = 'Asia/Shanghai', |
| | | UserName = 'testUser@testorg.com', |
| | | Work_Location__c = '上海' |
| | | ); |
| | | 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 = prof1.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '上海'); |
| | | insert MyUser_Test; |
| | | } |
| | | System.runAs(MyUser_Test) { |
| | | Product2 prod07 = new Product2( |
| | | Name = 'Test07', |
| | | ProductCode = 'Test07', |
| | | Asset_Model_No__c = 'Test07', |
| | | SFDA_Status__c = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Packing_list_manual__c = 1, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod08 = new Product2( |
| | | Name = 'Test08', |
| | | ProductCode = 'Test08', |
| | | Asset_Model_No__c = 'Test08', |
| | | SFDA_Status__c = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Packing_list_manual__c = 1, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod09 = new Product2( |
| | | Name = 'Test09', |
| | | ProductCode = 'Test09', |
| | | Asset_Model_No__c = 'Test09', |
| | | SFDA_Status__c = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Packing_list_manual__c = 1, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod07, prod08, prod09 }; |
| | | system.runAs(MyUser_Test){ |
| | | |
| | | Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false); |
| | | Product2 prod08 = new Product2(Name='Test08',ProductCode='Test08',Asset_Model_No__c = 'Test08',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false); |
| | | Product2 prod09 = new Product2(Name='Test09',ProductCode='Test09',Asset_Model_No__c = 'Test09',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false); |
| | | insert new Product2[] {prod07,prod08,prod09}; |
| | | |
| | | //制作产品 |
| | | Product2__c proG = new Product2__c( |
| | | Name = 'MH-155:白平衡帽', |
| | | OT_CODE_Text__c = 'Test001', |
| | | Product2__c = prod07.Id |
| | | ); |
| | | Product2__c proG = new Product2__c(Name='MH-155:白平衡帽',OT_CODE_Text__c='Test001',Product2__c = prod07.Id); |
| | | insert proG; |
| | | Product2__c proH = new Product2__c( |
| | | Name = 'MB-677:BNC电缆', |
| | | OT_CODE_Text__c = 'Test002', |
| | | Product2__c = prod08.Id |
| | | ); |
| | | Product2__c proH = new Product2__c(Name='MB-677:BNC电缆',OT_CODE_Text__c='Test002',Product2__c = prod08.Id); |
| | | insert proH; |
| | | Product2__c proF = new Product2__c( |
| | | Name = 'TooMAJ-643R:水囊鞘管003', |
| | | OT_CODE_Text__c = 'Test003', |
| | | Product2__c = prod09.Id |
| | | ); |
| | | Product2__c proF = new Product2__c(Name='TooMAJ-643R:水囊鞘管003',OT_CODE_Text__c='Test003',Product2__c = prod09.Id); |
| | | insert proF; |
| | | List<Consumable_order__c> orderList = new List<Consumable_order__c>(); |
| | | //到货 |
| | |
| | | } |
| | | System.debug('testList1:' + testList1); |
| | | |
| | | LexInventoryController.searchConsumableorderdetails( |
| | | 'ET', |
| | | '上海', |
| | | 'Testaccount001', |
| | | '1001\n10011', |
| | | JSON.serialize(testList1), |
| | | 20, |
| | | 9, |
| | | 'Test', |
| | | 'ASC' |
| | | ); |
| | | LexInventoryController.searchConsumableorderdetails( |
| | | 'ET', |
| | | '上海', |
| | | 'Testaccount001', |
| | | '', |
| | | JSON.serialize(testList1), |
| | | 20, |
| | | 9, |
| | | 'Test', |
| | | 'ASC' |
| | | ); |
| | | LexInventoryController.searchConsumableorderdetails('ET','上海','Testaccount001','1001\n10011',JSON.serialize(testList1),20,9,'Test','ASC'); |
| | | LexInventoryController.searchConsumableorderdetails('ET','上海','Testaccount001','',JSON.serialize(testList1),20,9,'Test','ASC'); |
| | | } |
| | | } |
| | | } |