| | |
| | | |
| | | @isTest |
| | | static void test_method_one() { |
| | | |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | |
| | | ofile.Opportunity__c = opp.Id; |
| | | ofile.Oppor_File_Stage__c = 'G'; |
| | | insert ofile; |
| | | ContentVersion version = new ContentVersion( |
| | | Title = 'test', |
| | | VersionData = EncodingUtil.base64Decode('test'), |
| | | ContentLocation = 's', |
| | | PathOnClient = 'test.txt' |
| | | Attachment att1 = new Attachment( |
| | | Name = 'test', |
| | | ParentId = ofile.Id, |
| | | Body = EncodingUtil.base64Decode('test') |
| | | ); |
| | | insert version; |
| | | version = [select ContentDocumentId from ContentVersion where Id =: version.Id]; |
| | | ContentDocumentLink link = new ContentDocumentLink(); |
| | | link.ContentDocumentId = version.ContentDocumentId; |
| | | link.LinkedEntityId = ofile.Id; |
| | | link.ShareType = 'I'; |
| | | link.Visibility = 'AllUsers'; |
| | | insert link; |
| | | ContentDocument con = [select Id from ContentDocument where Id =: version.ContentDocumentId]; |
| | | delete con; |
| | | // Attachment att1 = new Attachment( |
| | | // Name = 'test', |
| | | // ParentId = ofile.Id, |
| | | // Body = EncodingUtil.base64Decode('test') |
| | | // ); |
| | | // System.Test.startTest(); |
| | | // insert att1; |
| | | // Attachment att = new Attachment( |
| | | // Name = 'test', |
| | | // ParentId = ofile.Id, |
| | | // Body = EncodingUtil.base64Decode('test') |
| | | // ); |
| | | // insert att; |
| | | System.Test.startTest(); |
| | | insert att1; |
| | | Attachment att = new Attachment( |
| | | Name = 'test', |
| | | ParentId = ofile.Id, |
| | | Body = EncodingUtil.base64Decode('test') |
| | | ); |
| | | insert att; |
| | | |
| | | //delete att1; |
| | | System.Test.stopTest(); |
| | | } |
| | | |
| | | //@isTest |
| | |
| | | System.Test.stopTest(); |
| | | |
| | | } |
| | | @isTest |
| | | /*@isTest |
| | | static void test_method_8() { |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 呼吸科']; |
| | | if (rectSct.size() == 0) { |
| | | return; |
| | | } |
| | | List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '診療科 消化科']; |
| | | if (rectDpt.size() == 0) { |
| | | return; |
| | | } |
| | | Oly_TriggerHandler.bypass(Product2Handler.Class.getName()); |
| | | Oly_TriggerHandler.bypass(ContactTriggerHandler.Class.getName()); |
| | | |
| | | Account company = new Account(); |
| | | company.RecordTypeId = rectCo[0].Id; |
| | | company.Name = 'TestCompany'; |
| | | upsert company; |
| | | Account section = new Account(); |
| | | section.RecordTypeId = rectSct[0].Id; |
| | | section.Name = '*'; |
| | | section.Department_Class_Label__c = '消化科'; |
| | | section.ParentId = company.Id; |
| | | section.Hospital_Department_Class__c = company.Id; |
| | | upsert section; |
| | | Account depart = new Account(); |
| | | depart.RecordTypeId = rectDpt[0].Id; |
| | | depart.Name = '*'; |
| | | depart.Department_Name__c = 'TestDepart'; |
| | | depart.ParentId = section.Id; |
| | | depart.Department_Class__c = section.Id; |
| | | depart.Hospital__c = company.Id; |
| | | upsert depart; |
| | | // 省 |
| | | Address_Level__c al = new Address_Level__c(); |
| | | al.Name = '東京'; |
| | | al.Level1_Code__c = 'CN-99'; |
| | | al.Level1_Sys_No__c = '999999'; |
| | | insert al; |
| | | // 市 |
| | | Address_Level2__c al2 = new Address_Level2__c(); |
| | | al2.Level1_Code__c = 'CN-99'; |
| | | al2.Level1_Sys_No__c = '999999'; |
| | | al2.Level1_Name__c = '東京'; |
| | | al2.Name = '渋谷区'; |
| | | al2.Level2_Code__c = 'CN-9999'; |
| | | al2.Level2_Sys_No__c = '9999999'; |
| | | al2.Address_Level__c = al.id; |
| | | insert al2; |
| | | // 病院を作る |
| | | Account hospital = new Account(); |
| | | String rtId = [SELECT ID FROM RecordType WHERE DeveloperName = 'HP'].Id; |
| | | hospital.recordtypeId = rtId; |
| | | hospital.Name = 'test hospital'; |
| | | hospital.Is_Active__c = '有効'; |
| | | hospital.Attribute_Type__c = '卫生部'; |
| | | hospital.Speciality_Type__c = '综合医院'; |
| | | hospital.Grade__c = '一级'; |
| | | hospital.OCM_Category__c = 'SLTV'; |
| | | hospital.Is_Medical__c = '医疗机构'; |
| | | hospital.State_Master__c = al.id; |
| | | hospital.City_Master__c = al2.id; |
| | | hospital.Town__c = '东京'; |
| | | insert hospital; |
| | | Account[] strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_OTH']; |
| | | // 診療科を作る |
| | | Account dep = new Account(); |
| | | String rtId1 = [SELECT ID FROM RecordType WHERE DeveloperName = 'Department_OTH'].Id; |
| | | dep.recordtypeId = rtId1; |
| | | dep.Name = 'test dep1'; |
| | | dep.AgentCode_Ext__c = '9999999'; |
| | | dep.ParentId = strategicDep[0].Id; |
| | | dep.Department_Class__c = strategicDep[0].Id; |
| | | dep.Hospital__c = hospital.Id; |
| | | insert dep; |
| | | |
| | | Contact contact2 = new Contact(); |
| | | contact2.AccountId = dep.Id; |
| | | contact2.FirstName = '責任者'; |
| | | contact2.LastName = 'test1经销商'; |
| | | insert contact2; |
| | | |
| | | OPDPlan__c opd = new OPDPlan__c(); |
| | | opd.Status__c = '计划中'; |
| | | opd.OPDPlan_ImplementDate__c = Date.today().addDays(5); |
| | | opd.NoOpp_Reason__c = 'HCP对应'; |
| | | opd.OPDType__c = '科室'; |
| | | |
| | | insert opd; |
| | | |
| | | |
| | | Rental_Apply__c rap = new Rental_Apply__c(); |
| | | rap.Name = 'testra'; |
| | | rap.Product_category__c = 'GI'; |
| | | rap.Hospital__c = company.Id; |
| | | rap.Strategic_dept__c = section .Id; |
| | | rap.Account__c = depart.Id; |
| | | rap.Hospital__c = hospital.Id; |
| | | rap.Strategic_dept__c = strategicDep[0].Id; |
| | | rap.Account__c = dep.Id; |
| | | rap.demo_purpose2__c = '试用(无询价)'; |
| | | rap.Request_shipping_day__c = Date.toDay(); |
| | | rap.Request_return_day__c = Date.toDay(); |
| | | rap.OPDPlan__c = opd.id; |
| | | rap.Demo_purpose1__c ='产品试用'; |
| | | rap.direct_send__c = '医疗机构'; |
| | | rap.Hope_Lonaer_date_Num__c = 16; |
| | | rap.OwnerId = getUser().Id; |
| | | rap.Loaner_received_staff__c = '王五'; |
| | | rap.Loaner_received_staff_phone__c = '110'; |
| | | rap.direct_shippment_address__c = '北京市'; |
| | | rap.Phone_number__c = '1234567890'; |
| | | |
| | | insert rap; |
| | | |
| | |
| | | insert att; |
| | | System.Test.stopTest(); |
| | | |
| | | } |
| | | }*/ |
| | | |
| | | // 20230206 lt start |
| | | @isTest |