| | |
| | | @isTest |
| | | public class PrintConsumblePDFControllertTest { |
| | | static testMethod void PrintConsumblePDFControllertTest(){ |
| | | // 20220824 ljh start |
| | | @isTest(SeeAllData=true) |
| | | static void PrintConsumblePDFControllertTest() { |
| | | // static testMethod void PrintConsumblePDFControllertTest(){ |
| | | // 20220824 ljh end |
| | | Profile prof1 = [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) { |
| | |
| | | insert myAccount2; |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.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 = prof1.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com'); |
| | | insert MyUser_Test; |
| | | // 20220824 ljh start |
| | | // 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 = prof1.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com'); |
| | | // insert MyUser_Test; |
| | | Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | 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:123',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,ProduceCompany__c='生产企业名称:卡麦德医疗器械有限公司 KeyMed (Medical & Industrial Equipment) Ltd;住所:KeyMed House Stock Road Southend-on-sea Essex SS2 5QH United Kingdom;联系方式:(01702)616333'); |
| | | Product2 prod02 = new Product2(Name='Test02:123',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,ProduceCompany__c='生产企业名称:卡麦德医疗器械有限公司 KeyMed (Medical & Industrial Equipment) Ltd;住所:KeyMed House Stock Road Southend-on-sea Essex SS2 5QH United Kingdom;联系方式:(01702)616333'); |
| | | Product2 prod03 = new Product2(Name='Test03123',ProductCode='Test03',Asset_Model_No__c = 'Test03',SFDA_Status__c = '有効',Dealer_special_Object__c = true,ProduceCompany__c='生产企业名称:卡麦德医疗器械有限公司 KeyMed (Medical & Industrial Equipment) Ltd;住所:KeyMed House Stock Road Southend-on-sea Essex SS2 5QH United Kingdom;联系方式:(01702)616333'); |
| | | Product2 prod04 = new Product2(Name='Test04:123',ProductCode='Test04',Asset_Model_No__c = 'Test04',SFDA_Status__c = '有効',Dealer_special_Object__c = true,ProduceCompany__c='生产企业名称:卡麦德医疗器械有限公司 KeyMed (Medical & Industrial Equipment) Ltd;住所:KeyMed House Stock Road Southend-on-sea Essex SS2 5QH United Kingdom;联系方式:(01702)616333'); |
| | | Product2 prod05 = new Product2(Name='Test05123',ProductCode='Test05',Asset_Model_No__c = 'Test05',SFDA_Status__c = '有効',Dealer_special_Object__c = true,ProduceCompany__c='生产企业名称:卡麦德医疗器械有限公司 KeyMed (Medical & Industrial Equipment) Ltd;住所:KeyMed House Stock Road Southend-on-sea Essex SS2 5QH United Kingdom;联系方式:(01702)616333'); |
| | | Product2 prod06 = new Product2(Name='Test06:123',ProductCode='Test06',Asset_Model_No__c = 'Test06',SFDA_Status__c = '有効',Dealer_special_Object__c = true,ProduceCompany__c='生产企业名称:卡麦德医疗器械有限公司 KeyMed (Medical & Industrial Equipment) Ltd;住所:KeyMed House Stock Road Southend-on-sea Essex SS2 5QH United Kingdom;联系方式:(01702)616333'); |
| | | insert new Product2[] {prod01,prod02,prod03,prod04,prod05,prod06}; |
| | | // 20220824 ljh end |
| | | system.runAs(MyUser_Test){ |
| | | Product2 prod01 = new Product2(Name='Test01:123',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,ProduceCompany__c='生产企业名称:卡麦德医疗器械有限公司 KeyMed (Medical & Industrial Equipment) Ltd;住所:KeyMed House Stock Road Southend-on-sea Essex SS2 5QH United Kingdom;联系方式:(01702)616333'); |
| | | Product2 prod02 = new Product2(Name='Test02:123',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,ProduceCompany__c='生产企业名称:卡麦德医疗器械有限公司 KeyMed (Medical & Industrial Equipment) Ltd;住所:KeyMed House Stock Road Southend-on-sea Essex SS2 5QH United Kingdom;联系方式:(01702)616333'); |
| | | Product2 prod03 = new Product2(Name='Test03123',ProductCode='Test03',Asset_Model_No__c = 'Test03',SFDA_Status__c = '有効',Dealer_special_Object__c = true,ProduceCompany__c='生产企业名称:卡麦德医疗器械有限公司 KeyMed (Medical & Industrial Equipment) Ltd;住所:KeyMed House Stock Road Southend-on-sea Essex SS2 5QH United Kingdom;联系方式:(01702)616333'); |
| | | Product2 prod04 = new Product2(Name='Test04:123',ProductCode='Test04',Asset_Model_No__c = 'Test04',SFDA_Status__c = '有効',Dealer_special_Object__c = true,ProduceCompany__c='生产企业名称:卡麦德医疗器械有限公司 KeyMed (Medical & Industrial Equipment) Ltd;住所:KeyMed House Stock Road Southend-on-sea Essex SS2 5QH United Kingdom;联系方式:(01702)616333'); |
| | | Product2 prod05 = new Product2(Name='Test05123',ProductCode='Test05',Asset_Model_No__c = 'Test05',SFDA_Status__c = '有効',Dealer_special_Object__c = true,ProduceCompany__c='生产企业名称:卡麦德医疗器械有限公司 KeyMed (Medical & Industrial Equipment) Ltd;住所:KeyMed House Stock Road Southend-on-sea Essex SS2 5QH United Kingdom;联系方式:(01702)616333'); |
| | | Product2 prod06 = new Product2(Name='Test06:123',ProductCode='Test06',Asset_Model_No__c = 'Test06',SFDA_Status__c = '有効',Dealer_special_Object__c = true,ProduceCompany__c='生产企业名称:卡麦德医疗器械有限公司 KeyMed (Medical & Industrial Equipment) Ltd;住所:KeyMed House Stock Road Southend-on-sea Essex SS2 5QH United Kingdom;联系方式:(01702)616333'); |
| | | insert new Product2[] {prod01,prod02,prod03,prod04,prod05,prod06}; |
| | | // Product2 prod01 = new Product2(Name='Test01:123',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,ProduceCompany__c='生产企业名称:卡麦德医疗器械有限公司 KeyMed (Medical & Industrial Equipment) Ltd;住所:KeyMed House Stock Road Southend-on-sea Essex SS2 5QH United Kingdom;联系方式:(01702)616333'); |
| | | // Product2 prod02 = new Product2(Name='Test02:123',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,ProduceCompany__c='生产企业名称:卡麦德医疗器械有限公司 KeyMed (Medical & Industrial Equipment) Ltd;住所:KeyMed House Stock Road Southend-on-sea Essex SS2 5QH United Kingdom;联系方式:(01702)616333'); |
| | | // Product2 prod03 = new Product2(Name='Test03123',ProductCode='Test03',Asset_Model_No__c = 'Test03',SFDA_Status__c = '有効',Dealer_special_Object__c = true,ProduceCompany__c='生产企业名称:卡麦德医疗器械有限公司 KeyMed (Medical & Industrial Equipment) Ltd;住所:KeyMed House Stock Road Southend-on-sea Essex SS2 5QH United Kingdom;联系方式:(01702)616333'); |
| | | // Product2 prod04 = new Product2(Name='Test04:123',ProductCode='Test04',Asset_Model_No__c = 'Test04',SFDA_Status__c = '有効',Dealer_special_Object__c = true,ProduceCompany__c='生产企业名称:卡麦德医疗器械有限公司 KeyMed (Medical & Industrial Equipment) Ltd;住所:KeyMed House Stock Road Southend-on-sea Essex SS2 5QH United Kingdom;联系方式:(01702)616333'); |
| | | // Product2 prod05 = new Product2(Name='Test05123',ProductCode='Test05',Asset_Model_No__c = 'Test05',SFDA_Status__c = '有効',Dealer_special_Object__c = true,ProduceCompany__c='生产企业名称:卡麦德医疗器械有限公司 KeyMed (Medical & Industrial Equipment) Ltd;住所:KeyMed House Stock Road Southend-on-sea Essex SS2 5QH United Kingdom;联系方式:(01702)616333'); |
| | | // Product2 prod06 = new Product2(Name='Test06:123',ProductCode='Test06',Asset_Model_No__c = 'Test06',SFDA_Status__c = '有効',Dealer_special_Object__c = true,ProduceCompany__c='生产企业名称:卡麦德医疗器械有限公司 KeyMed (Medical & Industrial Equipment) Ltd;住所:KeyMed House Stock Road Southend-on-sea Essex SS2 5QH United Kingdom;联系方式:(01702)616333'); |
| | | // insert new Product2[] {prod01,prod02,prod03,prod04,prod05,prod06}; |
| | | |
| | | 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 pro6 = new Product2__c(Name='Pro006',OT_CODE_Text__c='Test006',Product2__c = prod06.Id); |
| | | insert new Product2__c[] {pro4, pro5,pro6,pro1, pro2, pro3}; |
| | | |
| | | Consumable_order__c createId = new Consumable_order__c(); |
| | | /*Consumable_order__c createId = new Consumable_order__c(); |
| | | createId.Name = 'testMing'; |
| | | createId.Order_status__c = '草案中'; |
| | | createId.Order_date__c = Date.today(); |
| | | createId.Dealer_Info__c = myAccount2.Id; |
| | | createId.Order_Reason__c = '其他'; |
| | | createId.RecordTypeid = System.Label.RT_ConOrder_Order; |
| | | insert createId; |
| | | insert createId;*/ |
| | | |
| | | Consumable_order__c createId = new Consumable_order__c(); |
| | | createId.Name = 'OCM_01_001'; |
| | | createId.Order_status__c = '批准'; |
| | | createId.Order_type__c = '订单'; |
| | | // Order1.Dealer_Info__c = MyUser_Test.Contact.accountid; |
| | | createId.Dealer_Info__c = MyUser_Test.Contact.accountid; |
| | | createId.RecordTypeid = System.Label.RT_ConOrder_Order; |
| | | createId.Total_num__c = 3; |
| | | createId.OrderNumber_arrived__c =1; |
| | | createId.Delivery_detail_count__c=1; |
| | | createId.Order_ProType__c = 'ET'; |
| | | insert createId; |
| | | |
| | | |
| | | |
| | | |
| | | Consumable_orderdetails__c good = new Consumable_orderdetails__c(); |
| | | good.recordtypeid= System.Label.RT_ConOrderDetail1_Order; |
| | | good.Name = 'OCM0001'; |