| | |
| | | @isTest |
| | | private class LexRemoveBoxControllerTest { |
| | | private class LexRemoveBoxControllerTest |
| | | { |
| | | |
| | | static testMethod void myUnitTest() { |
| | | user myUser_test; |
| | | Account myAccount2; |
| | | User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()]; |
| | | User thisUser = [ select Id from User where Id = :UserInfo.getUserId()]; |
| | | System.runAs(thisUser) { |
| | | 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)' |
| | | ]; |
| | | myAccount2 = new Account( |
| | | name = 'Testaccount002', |
| | | Dealer_discount__c = 20, |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '9999900' |
| | | ); |
| | | Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)']; |
| | | myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900'); |
| | | insert myAccount2; |
| | | Contact core = new Contact( |
| | | email = 'jplumber@salesforce.com', |
| | | firstname = 'Joe', |
| | | lastname = 'Plumber', |
| | | accountid = myAccount2.id |
| | | ); |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.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 = prof.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 = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '重庆'); |
| | | insert MyUser_Test; |
| | | } |
| | | |
| | |
| | | StaticParameter.EscapeOpportunityHpDeptUpdTrigger = true; |
| | | StaticParameter.EscapeSyncOpportunityTrigger = true; |
| | | StaticParameter.EscapeSyncProduct2Trigger = true; |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200311', |
| | | Packing_list_manual__c = 12, |
| | | 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', |
| | | Packing_list_manual__c = 10, |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod03 = new Product2( |
| | | Name = 'Test03', |
| | | ProductCode = 'Test03', |
| | | Asset_Model_No__c = 'Test03', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200313', |
| | | Packing_list_manual__c = 1, |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02, prod03 }; |
| | | 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 |
| | | ); |
| | | Product2__c pro3 = new Product2__c( |
| | | Name = 'Pro003', |
| | | OT_CODE_Text__c = 'Test003', |
| | | Product2__c = prod03.Id |
| | | ); |
| | | insert new List<Product2__c>{ pro1, pro2, pro3 }; |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Packing_list_manual__c=12,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',Packing_list_manual__c=10,Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod03 = new Product2(Name='Test03',ProductCode='Test03',Asset_Model_No__c = 'Test03',SFDA_Status__c = '有効',JANCODE__c = '04953170200313',Packing_list_manual__c=1,Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[]{prod01,prod02,prod03}; |
| | | 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); |
| | | Product2__c pro3 = new Product2__c(Name='Pro003',OT_CODE_Text__c='Test003',Product2__c = prod03.Id); |
| | | insert new Product2__c[] {pro1, pro2,pro3}; |
| | | //订单 |
| | | Consumable_order__c Order1 = new Consumable_order__c(); |
| | | Order1.Name = 'OCM_01_001'; |
| | |
| | | Orderdet3.Lose_Flag__c = false; |
| | | Orderdet3.Return_date__c = null; |
| | | conList1.add(Orderdet3); |
| | | |
| | | |
| | | //sale |
| | | Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c(); |
| | |
| | | insert conList1; |
| | | insert conList; |
| | | |
| | | |
| | | System.Test.startTest(); |
| | | LexRemoveBoxController Controller = new LexRemoveBoxController(); |
| | | LexRemoveBoxController.init(); |
| | | LexRemoveBoxController.searchConsumableorderdetails( |
| | | '01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRA\n011495317020843711170400172003311074K250CXSDS\n010495317014059411170400172203311074K250DCWQW\n010495317014059411170400172203311074K250DBVUD\n010495317014059411170400172203311074K250DBVUC', |
| | | myAccount2.Id, |
| | | '深圳', |
| | | 'ET' |
| | | ); |
| | | LexRemoveBoxController.searchConsumableorderdetails( |
| | | '', |
| | | myAccount2.Id, |
| | | '重庆', |
| | | 'ET' |
| | | ); |
| | | LexRemoveBoxController.searchConsumableorderdetails('01049531702003111115120017181000105ZK250BXJRF\n01049531702003111115120017181000105ZK250BXJRA\n011495317020843711170400172003311074K250CXSDS\n010495317014059411170400172203311074K250DCWQW\n010495317014059411170400172203311074K250DBVUD\n010495317014059411170400172203311074K250DBVUC' |
| | | ,myAccount2.Id,'深圳','ET'); |
| | | LexRemoveBoxController.searchConsumableorderdetails('',myAccount2.Id,'重庆','ET'); |
| | | LexRemoveBoxController.barcode = '1004\n1003\n1002\n1001'; |
| | | LexRemoveBoxController.getinventorysize(); |
| | | LexRemoveBoxController.removeBoxConfirm( |
| | | JSON.serialize(conList), |
| | | 'Testaccount002', |
| | | '重庆', |
| | | 'ENG' |
| | | ); |
| | | LexRemoveBoxController.removeBoxConfirm(JSON.serialize(conList),'Testaccount002','重庆','ENG'); |
| | | List<Consumable_order_details2__c> orderDetaList = new List<Consumable_order_details2__c>(); |
| | | LexRemoveBoxController.removeBoxConfirm( |
| | | JSON.serialize(orderDetaList), |
| | | 'Testaccount002', |
| | | '重庆', |
| | | 'ENG' |
| | | ); |
| | | LexRemoveBoxController.removeBoxConfirm(JSON.serialize(orderDetaList),'Testaccount002','重庆','ENG'); |
| | | System.Test.stopTest(); |
| | | |
| | | } |
| | | } |
| | | static testMethod void testMethod1() { |
| | | user myUser_test; |
| | | Account myAccount2; |
| | | User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()]; |
| | | User thisUser = [ select Id from User where Id = :UserInfo.getUserId()]; |
| | | System.runAs(thisUser) { |
| | | 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)' |
| | | ]; |
| | | myAccount2 = new Account( |
| | | name = 'Testaccount002', |
| | | Dealer_discount__c = 20, |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '9999900' |
| | | ); |
| | | Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)']; |
| | | myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900'); |
| | | insert myAccount2; |
| | | Contact core = new Contact( |
| | | email = 'jplumber@salesforce.com', |
| | | firstname = 'Joe', |
| | | lastname = 'Plumber', |
| | | accountid = myAccount2.id |
| | | ); |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.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 = prof.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 = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',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 = '有効', |
| | | JANCODE__c = '04953170200311', |
| | | Packing_list_manual__c = 12, |
| | | 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', |
| | | Packing_list_manual__c = 10, |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod03 = new Product2( |
| | | Name = 'Test03', |
| | | ProductCode = 'Test03', |
| | | Asset_Model_No__c = 'Test03', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200313', |
| | | Dealer_special_Object__c = true, |
| | | Packing_list_manual__c = 1, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02, prod03 }; |
| | | 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 |
| | | ); |
| | | Product2__c pro3 = new Product2__c( |
| | | Name = 'Pro003', |
| | | OT_CODE_Text__c = 'Test003', |
| | | Product2__c = prod03.Id |
| | | ); |
| | | insert new List<Product2__c>{ pro1, pro2, pro3 }; |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Packing_list_manual__c=12,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',Packing_list_manual__c=10,Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod03 = new Product2(Name='Test03',ProductCode='Test03',Asset_Model_No__c = 'Test03',SFDA_Status__c = '有効',JANCODE__c = '04953170200313',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false); |
| | | insert new Product2[]{prod01,prod02,prod03}; |
| | | 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); |
| | | Product2__c pro3 = new Product2__c(Name='Pro003',OT_CODE_Text__c='Test003',Product2__c = prod03.Id); |
| | | insert new Product2__c[] {pro1, pro2,pro3}; |
| | | //订单 |
| | | Consumable_order__c Order1 = new Consumable_order__c(); |
| | | Order1.Name = 'OCM_01'; |
| | |
| | | |
| | | insert conList1; |
| | | System.Test.startTest(); |
| | | LexRemoveBoxController.searchConsumableorderdetails( |
| | | '10011', |
| | | 'Testaccount002', |
| | | '重庆', |
| | | 'ET' |
| | | ); |
| | | LexRemoveBoxController.searchConsumableorderdetails( |
| | | '10031\n10032', |
| | | 'Testaccount002', |
| | | '重庆', |
| | | 'ENG' |
| | | ); |
| | | LexRemoveBoxController.searchConsumableorderdetails('10011','Testaccount002','重庆','ET'); |
| | | LexRemoveBoxController.searchConsumableorderdetails('10031\n10032','Testaccount002','重庆','ENG'); |
| | | System.Test.stopTest(); |
| | | } |
| | | } |
| | |
| | | Product2__c pro2; |
| | | Product2__c pro3; |
| | | Product2__c pro1; |
| | | User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()]; |
| | | User thisUser = [ select Id from User where Id = :UserInfo.getUserId()]; |
| | | System.runAs(thisUser) { |
| | | 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)' |
| | | ]; |
| | | myAccount2 = new Account( |
| | | name = 'Testaccount002', |
| | | Dealer_discount__c = 20, |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '9999900' |
| | | ); |
| | | Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)']; |
| | | myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900'); |
| | | insert myAccount2; |
| | | Contact core = new Contact( |
| | | email = 'jplumber@salesforce.com', |
| | | firstname = 'Joe', |
| | | lastname = 'Plumber', |
| | | accountid = myAccount2.id |
| | | ); |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.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 = prof.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 = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',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 = '有効', |
| | | JANCODE__c = '04953170200311', |
| | | Packing_list_manual__c = 12, |
| | | 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', |
| | | Packing_list_manual__c = 10, |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod03 = new Product2( |
| | | Name = 'Test03', |
| | | ProductCode = 'Test03', |
| | | Asset_Model_No__c = 'Test03', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200313', |
| | | Dealer_special_Object__c = true, |
| | | Packing_list_manual__c = 1, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02, prod03 }; |
| | | pro1 = new Product2__c( |
| | | Name = 'Pro001', |
| | | OT_CODE_Text__c = 'Test001', |
| | | Product2__c = prod01.Id |
| | | ); |
| | | pro2 = new Product2__c( |
| | | Name = 'Pro002', |
| | | OT_CODE_Text__c = 'Test002', |
| | | Product2__c = prod02.Id |
| | | ); |
| | | pro3 = new Product2__c( |
| | | Name = 'Pro003', |
| | | OT_CODE_Text__c = 'Test003', |
| | | Product2__c = prod03.Id |
| | | ); |
| | | insert new List<Product2__c>{ pro1, pro2, pro3 }; |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Packing_list_manual__c=12,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',Packing_list_manual__c=10,Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod03 = new Product2(Name='Test03',ProductCode='Test03',Asset_Model_No__c = 'Test03',SFDA_Status__c = '有効',JANCODE__c = '04953170200313',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false); |
| | | insert new Product2[]{prod01,prod02,prod03}; |
| | | pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id); |
| | | pro3 = new Product2__c(Name='Pro003',OT_CODE_Text__c='Test003',Product2__c = prod03.Id); |
| | | insert new Product2__c[] {pro1, pro2, pro3}; |
| | | List<Consumable_order__c> orderList = new List<Consumable_order__c>(); |
| | | List<Consumable_order__c> orderList1 = new List<Consumable_order__c>(); |
| | | //到货 |
| | |
| | | |
| | | insert conList1; |
| | | System.Test.startTest(); |
| | | LexRemoveBoxController.searchConsumableorderdetails( |
| | | '10031\n10032\n', |
| | | 'Testaccount002', |
| | | '重庆', |
| | | 'ENG' |
| | | ); |
| | | LexRemoveBoxController.searchConsumableorderdetails('10031\n10032\n','Testaccount002','重庆','ENG'); |
| | | System.Test.stopTest(); |
| | | } |
| | | } |
| | |
| | | Product2__c pro2; |
| | | Product2__c pro3; |
| | | Product2__c pro1; |
| | | User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()]; |
| | | User thisUser = [ select Id from User where Id = :UserInfo.getUserId()]; |
| | | System.runAs(thisUser) { |
| | | 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)' |
| | | ]; |
| | | myAccount2 = new Account( |
| | | name = 'Testaccount002', |
| | | Dealer_discount__c = 20, |
| | | RecordTypeId = rectCo[0].Id, |
| | | AgentCode_Ext__c = '9999900' |
| | | ); |
| | | Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)']; |
| | | myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900'); |
| | | insert myAccount2; |
| | | Contact core = new Contact( |
| | | email = 'jplumber@salesforce.com', |
| | | firstname = 'Joe', |
| | | lastname = 'Plumber', |
| | | accountid = myAccount2.id |
| | | ); |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.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 = prof.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 = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',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 = '有効', |
| | | JANCODE__c = '04953170200311', |
| | | Packing_list_manual__c = 12, |
| | | 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', |
| | | Packing_list_manual__c = 10, |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | Product2 prod03 = new Product2( |
| | | Name = 'Test03', |
| | | ProductCode = 'Test03', |
| | | Asset_Model_No__c = 'Test03', |
| | | SFDA_Status__c = '有効', |
| | | JANCODE__c = '04953170200313', |
| | | Dealer_special_Object__c = true, |
| | | Packing_list_manual__c = 1, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02, prod03 }; |
| | | pro1 = new Product2__c( |
| | | Name = 'Pro001', |
| | | OT_CODE_Text__c = 'Test001', |
| | | Product2__c = prod01.Id |
| | | ); |
| | | pro2 = new Product2__c( |
| | | Name = 'Pro002', |
| | | OT_CODE_Text__c = 'Test002', |
| | | Product2__c = prod02.Id |
| | | ); |
| | | pro3 = new Product2__c( |
| | | Name = 'Pro003', |
| | | OT_CODE_Text__c = 'Test003', |
| | | Product2__c = prod03.Id |
| | | ); |
| | | insert new List<Product2__c>{ pro1, pro2, pro3 }; |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Packing_list_manual__c=12,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',Packing_list_manual__c=10,Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod03 = new Product2(Name='Test03',ProductCode='Test03',Asset_Model_No__c = 'Test03',SFDA_Status__c = '有効',JANCODE__c = '04953170200313',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false); |
| | | insert new Product2[]{prod01,prod02,prod03}; |
| | | pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id); |
| | | pro3 = new Product2__c(Name='Pro003',OT_CODE_Text__c='Test003',Product2__c = prod03.Id); |
| | | insert new Product2__c[] {pro1, pro2,pro3}; |
| | | List<Consumable_order__c> orderList = new List<Consumable_order__c>(); |
| | | //到货 |
| | | Consumable_order__c Order1 = new Consumable_order__c(); |
| | |
| | | |
| | | insert conList1; |
| | | System.Test.startTest(); |
| | | LexRemoveBoxController.searchConsumableorderdetails( |
| | | '10011\n10031', |
| | | 'Testaccount002', |
| | | '重庆', |
| | | 'ENG' |
| | | ); |
| | | LexRemoveBoxController.searchConsumableorderdetails( |
| | | '10032', |
| | | 'Testaccount002', |
| | | '上海', |
| | | 'ENG' |
| | | ); |
| | | LexRemoveBoxController.removeBoxConfirm( |
| | | JSON.serialize(conList1), |
| | | 'Testaccount002', |
| | | '重庆', |
| | | 'ENG' |
| | | ); |
| | | LexRemoveBoxController.searchConsumableorderdetails('10011\n10031','Testaccount002','重庆','ENG'); |
| | | LexRemoveBoxController.searchConsumableorderdetails('10032','Testaccount002','上海','ENG'); |
| | | LexRemoveBoxController.removeBoxConfirm(JSON.serialize(conList1),'Testaccount002','重庆','ENG'); |
| | | System.Test.stopTest(); |
| | | |
| | | |
| | | } |
| | | } |
| | | } |