| | |
| | | private class updateESignBatchTest { |
| | | //测试经销商收货 |
| | | static testMethod void testMethod1() { |
| | | 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; |
| | | } |
| | | List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 呼吸科']; |
| | | 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, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('診療科 消化科', '診療科 呼吸科') order by Name desc]; |
| | | List<RecordType> rectDpt = [ |
| | | SELECT Id, Name |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('診療科 消化科', '診療科 呼吸科') |
| | | ORDER BY Name DESC |
| | | ]; |
| | | if (rectDpt.size() == 0) { |
| | | return; |
| | | } |
| | | List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '备品']; |
| | | List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '备品']; |
| | | if (rectAs.size() == 0) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | // insert hospital |
| | | Account company1 = new Account(); |
| | | company1.RecordTypeId = rectCo[0].Id; |
| | | company1.Name = '病院テスト1'; |
| | | company1.OCM_man_province_txt__c = '江西'; |
| | | List<Account> hps = new Account[]{company1}; |
| | | List<Account> hps = new List<Account>{ company1 }; |
| | | insert hps; |
| | | |
| | | List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c]; |
| | | |
| | | |
| | | List<Account> dc1s = [ |
| | | SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c |
| | | FROM Account |
| | | WHERE Parent.Id = :company1.Id |
| | | ORDER BY Department_Class_Label__c |
| | | ]; |
| | | |
| | | Account depart1 = new Account(); |
| | | depart1.RecordTypeId = rectDpt[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Department_Class__c = dc1s[0].Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.OCM_man_province_txt__c = '江西'; |
| | | |
| | | insert new Account[] {depart1}; |
| | | |
| | | insert new List<Account>{ depart1 }; |
| | | |
| | | List<Product2> prdList = new List<Product2>(); |
| | | Product2 prd1 = new Product2(); |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.Repair_Product_Code__c = 'HistoryPrd1_RP'; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Extend_new_product_gurantee__c = true; |
| | | prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60); |
| | | prd1.Extend_Gurantee_End__c = Date.today().addDays(60); |
| | | prdList.add(prd1); |
| | | insert prdList; |
| | | |
| | | |
| | | Asset ast = new Asset(); |
| | | |
| | | ast.RecordTypeId = rectAs[0].Id; |
| | | ast.SerialNumber = 'abcdefg'; |
| | | ast.Name = '测试资产1'; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.Guarantee_period_for_products__c = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.Manage_type__c = '个体管理'; |
| | | ast.FirstApproveDate_old__c = Date.today().addDays(-30); |
| | | |
| | | Oly_TriggerHandler.bypass('AssetHandler'); |
| | | |
| | | insert ast; |
| | | |
| | | Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID , ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ]; |
| | | Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID, ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [ |
| | | SELECT id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity' |
| | | ]; |
| | | Opportunity opp = new Opportunity( |
| | | Name='testOpp1', |
| | | StageName='引合', |
| | | CloseDate=Date.today(), |
| | | AccountId=depart1.Id, |
| | | Sales_Root__c = '販売店', |
| | | Competitor__c ='A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | Name = 'testOpp1', |
| | | StageName = '引合', |
| | | CloseDate = Date.today(), |
| | | AccountId = depart1.Id, |
| | | Sales_Root__c = '販売店', |
| | | Competitor__c = 'A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | ); |
| | | insert opp; |
| | | |
| | |
| | | insert Sac; |
| | | |
| | | //新建电子签收单 |
| | | eSignForm__c eSignForm = new eSignForm__c(); |
| | | eSignForm.Statu_Achievements__c = Sac.Id; |
| | | eSignForm.Name = '::测试电子签收单'; |
| | | eSignForm__c eSignForm = new eSignForm__c(); |
| | | eSignForm.Statu_Achievements__c = Sac.Id; |
| | | eSignForm.Name = '::测试电子签收单'; |
| | | |
| | | |
| | | insert eSignForm; |
| | | insert eSignForm; |
| | | |
| | | eSignFormEntry__c eSignFormEntry1 = new eSignFormEntry__c(); |
| | | eSignFormEntry1.Name = '::电子签收单录入表1'; |
| | | eSignFormEntry1.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry1.entryType__c = '经销商收货'; |
| | | |
| | | |
| | | insert eSignFormEntry1; |
| | | |
| | | eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c(); |
| | | eSignFormEntry2.Name = '::电子签收单录入表2'; |
| | | eSignFormEntry2.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry2.entryType__c = '经销商收货'; |
| | | eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c(); |
| | | eSignFormEntry2.Name = '::电子签收单录入表2'; |
| | | eSignFormEntry2.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry2.entryType__c = '经销商收货'; |
| | | eSignFormEntry2.IsSubmit__c = true; |
| | | eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencySignUpDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.agencyConfirmDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPScanDayBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPSignUpDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.agencySignUpDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencyConfirmDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPSignUpDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2); |
| | | // eSignFormEntry2.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry2; |
| | | |
| | | // eSignFormEntry2.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry2; |
| | | |
| | | //新建电子签收单明细 |
| | | eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c(); |
| | |
| | | |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry1.Name = '::电子签收单明细录入1'; |
| | | eSignFormLineItemEntry1.eSignFormEntry__c =eSignFormEntry1.Id; |
| | | eSignFormLineItemEntry1.eSignFormEntry__c = eSignFormEntry1.Id; |
| | | eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry1; |
| | | |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry2.Name = '::电子签收单明细录入2'; |
| | | eSignFormLineItemEntry2.eSignFormEntry__c =eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry2.eSignFormEntry__c = eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry2; |
| | | |
| | | list<Attachment> attachmentList = new list<Attachment>(); |
| | | Attachment attach=new Attachment(); |
| | | attach.Name='Unit Test Attachment'; |
| | | Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body=bodyBlob; |
| | | attach.parentId=eSignFormEntry2.id; |
| | | list<Attachment> attachmentList = new List<Attachment>(); |
| | | Attachment attach = new Attachment(); |
| | | attach.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body = bodyBlob; |
| | | attach.parentId = eSignFormEntry2.id; |
| | | attach.ContentType = 'application/pdf'; |
| | | |
| | | attachmentList.add(attach); |
| | | |
| | | // insert attach; |
| | | Attachment attach1=new Attachment(); |
| | | attach1.Name='Unit Test Attachment'; |
| | | Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body=bodyBlob1; |
| | | attach1.parentId=eSignForm.id; |
| | | Attachment attach1 = new Attachment(); |
| | | attach1.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body = bodyBlob1; |
| | | attach1.parentId = eSignForm.id; |
| | | attach1.ContentType = 'application/pdf'; |
| | | |
| | | |
| | | attachmentList.add(attach1); |
| | | |
| | | insert attachmentList; |
| | | |
| | | Test.startTest(); |
| | | |
| | | |
| | | Database.executeBatch(new updateESignBatch(), 20); |
| | | Test.stopTest(); |
| | |
| | | |
| | | //测试经销商确认 |
| | | static testMethod void testMethod2() { |
| | | 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; |
| | | } |
| | | List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 呼吸科']; |
| | | 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, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('診療科 消化科', '診療科 呼吸科') order by Name desc]; |
| | | List<RecordType> rectDpt = [ |
| | | SELECT Id, Name |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('診療科 消化科', '診療科 呼吸科') |
| | | ORDER BY Name DESC |
| | | ]; |
| | | if (rectDpt.size() == 0) { |
| | | return; |
| | | } |
| | | List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '备品']; |
| | | List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '备品']; |
| | | if (rectAs.size() == 0) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | // insert hospital |
| | | Account company1 = new Account(); |
| | | company1.RecordTypeId = rectCo[0].Id; |
| | | company1.Name = '病院テスト1'; |
| | | company1.OCM_man_province_txt__c = '江西'; |
| | | List<Account> hps = new Account[]{company1}; |
| | | List<Account> hps = new List<Account>{ company1 }; |
| | | insert hps; |
| | | |
| | | List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c]; |
| | | |
| | | |
| | | List<Account> dc1s = [ |
| | | SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c |
| | | FROM Account |
| | | WHERE Parent.Id = :company1.Id |
| | | ORDER BY Department_Class_Label__c |
| | | ]; |
| | | |
| | | Account depart1 = new Account(); |
| | | depart1.RecordTypeId = rectDpt[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Department_Class__c = dc1s[0].Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.OCM_man_province_txt__c = '江西'; |
| | | |
| | | insert new Account[] {depart1}; |
| | | |
| | | insert new List<Account>{ depart1 }; |
| | | |
| | | List<Product2> prdList = new List<Product2>(); |
| | | Product2 prd1 = new Product2(); |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.Repair_Product_Code__c = 'HistoryPrd1_RP'; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Extend_new_product_gurantee__c = true; |
| | | prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60); |
| | | prd1.Extend_Gurantee_End__c = Date.today().addDays(60); |
| | | prdList.add(prd1); |
| | | insert prdList; |
| | | |
| | | |
| | | Asset ast = new Asset(); |
| | | |
| | | ast.RecordTypeId = rectAs[0].Id; |
| | | ast.SerialNumber = 'abcdefg'; |
| | | ast.Name = '测试资产1'; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.Guarantee_period_for_products__c = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.Manage_type__c = '个体管理'; |
| | | ast.FirstApproveDate_old__c = Date.today().addDays(-30); |
| | | |
| | | Oly_TriggerHandler.bypass('AssetHandler'); |
| | | |
| | | insert ast; |
| | | |
| | | Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID , ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ]; |
| | | Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID, ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [ |
| | | SELECT id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity' |
| | | ]; |
| | | Opportunity opp = new Opportunity( |
| | | Name='testOpp1', |
| | | StageName='引合', |
| | | CloseDate=Date.today(), |
| | | AccountId=depart1.Id, |
| | | Sales_Root__c = '販売店', |
| | | Competitor__c ='A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp |
| | | Name = 'testOpp1', |
| | | StageName = '引合', |
| | | CloseDate = Date.today(), |
| | | AccountId = depart1.Id, |
| | | Sales_Root__c = '販売店', |
| | | Competitor__c = 'A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp |
| | | ); |
| | | insert opp; |
| | | |
| | |
| | | eSignFormEntry1.Name = '::电子签收单录入表1'; |
| | | eSignFormEntry1.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry1.entryType__c = '经销商确认'; |
| | | |
| | | |
| | | insert eSignFormEntry1; |
| | | |
| | | eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c(); |
| | |
| | | eSignFormEntry2.entryType__c = '经销商确认'; |
| | | eSignFormEntry2.IsSubmit__c = true; |
| | | eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencySignUpDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.agencyConfirmDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPScanDayBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPSignUpDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.agencySignUpDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencyConfirmDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPSignUpDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2); |
| | | // eSignFormEntry2.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry2; |
| | | |
| | | |
| | | //新建电子签收单明细 |
| | | eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c(); |
| | |
| | | |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry1.Name = '::电子签收单明细录入1'; |
| | | eSignFormLineItemEntry1.eSignFormEntry__c =eSignFormEntry1.Id; |
| | | eSignFormLineItemEntry1.eSignFormEntry__c = eSignFormEntry1.Id; |
| | | eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry1; |
| | | |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry2.Name = '::电子签收单明细录入2'; |
| | | eSignFormLineItemEntry2.eSignFormEntry__c =eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry2.eSignFormEntry__c = eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry2; |
| | | |
| | | list<Attachment> attachmentList = new list<Attachment>(); |
| | | Attachment attach=new Attachment(); |
| | | attach.Name='Unit Test Attachment'; |
| | | Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body=bodyBlob; |
| | | attach.parentId=eSignFormEntry2.id; |
| | | attach.ContentType='image/jpeg'; |
| | | list<Attachment> attachmentList = new List<Attachment>(); |
| | | Attachment attach = new Attachment(); |
| | | attach.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body = bodyBlob; |
| | | attach.parentId = eSignFormEntry2.id; |
| | | attach.ContentType = 'image/jpeg'; |
| | | |
| | | attachmentList.add(attach); |
| | | |
| | | // insert attach; |
| | | Attachment attach1=new Attachment(); |
| | | attach1.Name='Unit Test Attachment'; |
| | | Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body=bodyBlob1; |
| | | attach1.parentId=eSignForm.id; |
| | | attach1.ContentType='image/jpeg'; |
| | | |
| | | Attachment attach1 = new Attachment(); |
| | | attach1.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body = bodyBlob1; |
| | | attach1.parentId = eSignForm.id; |
| | | attach1.ContentType = 'image/jpeg'; |
| | | |
| | | attachmentList.add(attach1); |
| | | |
| | | insert attachmentList; |
| | |
| | | |
| | | //测试医院收货 |
| | | static testMethod void testMethod3() { |
| | | 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; |
| | | } |
| | | List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 呼吸科']; |
| | | 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, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('診療科 消化科', '診療科 呼吸科') order by Name desc]; |
| | | List<RecordType> rectDpt = [ |
| | | SELECT Id, Name |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('診療科 消化科', '診療科 呼吸科') |
| | | ORDER BY Name DESC |
| | | ]; |
| | | if (rectDpt.size() == 0) { |
| | | return; |
| | | } |
| | | List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '备品']; |
| | | List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '备品']; |
| | | if (rectAs.size() == 0) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | // insert hospital |
| | | Account company1 = new Account(); |
| | | company1.RecordTypeId = rectCo[0].Id; |
| | | company1.Name = '病院テスト1'; |
| | | company1.OCM_man_province_txt__c = '江西'; |
| | | List<Account> hps = new Account[]{company1}; |
| | | List<Account> hps = new List<Account>{ company1 }; |
| | | insert hps; |
| | | |
| | | List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c]; |
| | | |
| | | |
| | | List<Account> dc1s = [ |
| | | SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c |
| | | FROM Account |
| | | WHERE Parent.Id = :company1.Id |
| | | ORDER BY Department_Class_Label__c |
| | | ]; |
| | | |
| | | Account depart1 = new Account(); |
| | | depart1.RecordTypeId = rectDpt[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Department_Class__c = dc1s[0].Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.OCM_man_province_txt__c = '江西'; |
| | | |
| | | insert new Account[] {depart1}; |
| | | |
| | | insert new List<Account>{ depart1 }; |
| | | |
| | | List<Product2> prdList = new List<Product2>(); |
| | | Product2 prd1 = new Product2(); |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.Repair_Product_Code__c = 'HistoryPrd1_RP'; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Extend_new_product_gurantee__c = true; |
| | | prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60); |
| | | prd1.Extend_Gurantee_End__c = Date.today().addDays(60); |
| | | prdList.add(prd1); |
| | | insert prdList; |
| | | |
| | | |
| | | Asset ast = new Asset(); |
| | | |
| | | ast.RecordTypeId = rectAs[0].Id; |
| | | ast.SerialNumber = 'abcdefg'; |
| | | ast.Name = '测试资产1'; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.Guarantee_period_for_products__c = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.Manage_type__c = '个体管理'; |
| | | ast.FirstApproveDate_old__c = Date.today().addDays(-30); |
| | | |
| | | Oly_TriggerHandler.bypass('AssetHandler'); |
| | | |
| | | insert ast; |
| | | |
| | | Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID , ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ]; |
| | | Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID, ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [ |
| | | SELECT id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity' |
| | | ]; |
| | | Opportunity opp = new Opportunity( |
| | | Name='testOpp1', |
| | | StageName='引合', |
| | | CloseDate=Date.today(), |
| | | AccountId=depart1.Id, |
| | | Sales_Root__c = '販売店', |
| | | Competitor__c ='A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | Name = 'testOpp1', |
| | | StageName = '引合', |
| | | CloseDate = Date.today(), |
| | | AccountId = depart1.Id, |
| | | Sales_Root__c = '販売店', |
| | | Competitor__c = 'A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | ); |
| | | insert opp; |
| | | |
| | |
| | | eSignFormEntry1.Name = '::电子签收单录入表1'; |
| | | eSignFormEntry1.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry1.entryType__c = '医院收货'; |
| | | |
| | | |
| | | insert eSignFormEntry1; |
| | | |
| | | eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c(); |
| | |
| | | eSignFormEntry2.entryType__c = '医院收货'; |
| | | eSignFormEntry2.IsSubmit__c = true; |
| | | eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencySignUpDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.agencyConfirmDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPScanDayBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPSignUpDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.agencySignUpDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencyConfirmDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPSignUpDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2); |
| | | // eSignFormEntry2.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry2; |
| | | |
| | | |
| | | //新建电子签收单明细 |
| | | eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c(); |
| | |
| | | |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry1.Name = '::电子签收单明细录入1'; |
| | | eSignFormLineItemEntry1.eSignFormEntry__c =eSignFormEntry1.Id; |
| | | eSignFormLineItemEntry1.eSignFormEntry__c = eSignFormEntry1.Id; |
| | | eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry1; |
| | | |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry2.Name = '::电子签收单明细录入2'; |
| | | eSignFormLineItemEntry2.eSignFormEntry__c =eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry2.eSignFormEntry__c = eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry2; |
| | | |
| | | list<Attachment> attachmentList = new list<Attachment>(); |
| | | Attachment attach=new Attachment(); |
| | | attach.Name='Unit Test Attachment'; |
| | | Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body=bodyBlob; |
| | | attach.parentId=eSignFormEntry2.id; |
| | | list<Attachment> attachmentList = new List<Attachment>(); |
| | | Attachment attach = new Attachment(); |
| | | attach.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body = bodyBlob; |
| | | attach.parentId = eSignFormEntry2.id; |
| | | |
| | | attachmentList.add(attach); |
| | | |
| | | // insert attach; |
| | | Attachment attach1=new Attachment(); |
| | | attach1.Name='Unit Test Attachment'; |
| | | Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body=bodyBlob1; |
| | | attach1.parentId=eSignForm.id; |
| | | |
| | | Attachment attach1 = new Attachment(); |
| | | attach1.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body = bodyBlob1; |
| | | attach1.parentId = eSignForm.id; |
| | | |
| | | attachmentList.add(attach1); |
| | | |
| | | insert attachmentList; |
| | |
| | | |
| | | //测试医院确认 |
| | | static testMethod void testMethod4() { |
| | | 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; |
| | | } |
| | | List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 呼吸科']; |
| | | 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, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('診療科 消化科', '診療科 呼吸科') order by Name desc]; |
| | | List<RecordType> rectDpt = [ |
| | | SELECT Id, Name |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('診療科 消化科', '診療科 呼吸科') |
| | | ORDER BY Name DESC |
| | | ]; |
| | | if (rectDpt.size() == 0) { |
| | | return; |
| | | } |
| | | List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '备品']; |
| | | List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '备品']; |
| | | if (rectAs.size() == 0) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | // insert hospital |
| | | Account company1 = new Account(); |
| | | company1.RecordTypeId = rectCo[0].Id; |
| | | company1.Name = '病院テスト1'; |
| | | company1.OCM_man_province_txt__c = '江西'; |
| | | List<Account> hps = new Account[]{company1}; |
| | | List<Account> hps = new List<Account>{ company1 }; |
| | | insert hps; |
| | | |
| | | List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c]; |
| | | |
| | | |
| | | List<Account> dc1s = [ |
| | | SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c |
| | | FROM Account |
| | | WHERE Parent.Id = :company1.Id |
| | | ORDER BY Department_Class_Label__c |
| | | ]; |
| | | |
| | | Account depart1 = new Account(); |
| | | depart1.RecordTypeId = rectDpt[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Department_Class__c = dc1s[0].Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.OCM_man_province_txt__c = '江西'; |
| | | |
| | | insert new Account[] {depart1}; |
| | | |
| | | insert new List<Account>{ depart1 }; |
| | | |
| | | List<Product2> prdList = new List<Product2>(); |
| | | Product2 prd1 = new Product2(); |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.Repair_Product_Code__c = 'HistoryPrd1_RP'; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Extend_new_product_gurantee__c = true; |
| | | prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60); |
| | | prd1.Extend_Gurantee_End__c = Date.today().addDays(60); |
| | | prdList.add(prd1); |
| | | insert prdList; |
| | | |
| | | |
| | | Asset ast = new Asset(); |
| | | |
| | | ast.RecordTypeId = rectAs[0].Id; |
| | | ast.SerialNumber = 'abcdefg'; |
| | | ast.Name = '测试资产1'; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.Guarantee_period_for_products__c = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.Manage_type__c = '个体管理'; |
| | | ast.FirstApproveDate_old__c = Date.today().addDays(-30); |
| | | |
| | | Oly_TriggerHandler.bypass('AssetHandler'); |
| | | |
| | | insert ast; |
| | | |
| | | Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID , ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ]; |
| | | Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID, ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [ |
| | | SELECT id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity' |
| | | ]; |
| | | Opportunity opp = new Opportunity( |
| | | Name='testOpp1', |
| | | StageName='引合', |
| | | CloseDate=Date.today(), |
| | | AccountId=depart1.Id, |
| | | Sales_Root__c = '販売店', |
| | | Competitor__c ='A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | Name = 'testOpp1', |
| | | StageName = '引合', |
| | | CloseDate = Date.today(), |
| | | AccountId = depart1.Id, |
| | | Sales_Root__c = '販売店', |
| | | Competitor__c = 'A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | ); |
| | | insert opp; |
| | | |
| | |
| | | eSignFormEntry1.Name = '::电子签收单录入表1'; |
| | | eSignFormEntry1.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry1.entryType__c = '医院确认'; |
| | | |
| | | |
| | | insert eSignFormEntry1; |
| | | |
| | | eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c(); |
| | |
| | | eSignFormEntry2.entryType__c = '医院确认'; |
| | | eSignFormEntry2.IsSubmit__c = true; |
| | | eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencySignUpDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.agencyConfirmDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPScanDayBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPSignUpDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.agencySignUpDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencyConfirmDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPSignUpDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2); |
| | | // eSignFormEntry2.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry2; |
| | | |
| | | |
| | | //新建电子签收单明细 |
| | | eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c(); |
| | |
| | | |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry1.Name = '::电子签收单明细录入1'; |
| | | eSignFormLineItemEntry1.eSignFormEntry__c =eSignFormEntry1.Id; |
| | | eSignFormLineItemEntry1.eSignFormEntry__c = eSignFormEntry1.Id; |
| | | eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry1; |
| | | |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry2.Name = '::电子签收单明细录入2'; |
| | | eSignFormLineItemEntry2.eSignFormEntry__c =eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry2.eSignFormEntry__c = eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry2; |
| | | |
| | | list<Attachment> attachmentList = new list<Attachment>(); |
| | | Attachment attach=new Attachment(); |
| | | attach.Name='Unit Test Attachment'; |
| | | Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body=bodyBlob; |
| | | attach.parentId=eSignFormEntry2.id; |
| | | list<Attachment> attachmentList = new List<Attachment>(); |
| | | Attachment attach = new Attachment(); |
| | | attach.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body = bodyBlob; |
| | | attach.parentId = eSignFormEntry2.id; |
| | | |
| | | attachmentList.add(attach); |
| | | |
| | | // insert attach; |
| | | Attachment attach1=new Attachment(); |
| | | attach1.Name='Unit Test Attachment'; |
| | | Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body=bodyBlob1; |
| | | attach1.parentId=eSignForm.id; |
| | | |
| | | Attachment attach1 = new Attachment(); |
| | | attach1.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body = bodyBlob1; |
| | | attach1.parentId = eSignForm.id; |
| | | |
| | | attachmentList.add(attach1); |
| | | |
| | | insert attachmentList; |
| | |
| | | Test.stopTest(); |
| | | } |
| | | |
| | | |
| | | static testMethod void testMethod5() { |
| | | 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; |
| | | } |
| | | List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 呼吸科']; |
| | | 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, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('診療科 消化科', '診療科 呼吸科') order by Name desc]; |
| | | List<RecordType> rectDpt = [ |
| | | SELECT Id, Name |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('診療科 消化科', '診療科 呼吸科') |
| | | ORDER BY Name DESC |
| | | ]; |
| | | if (rectDpt.size() == 0) { |
| | | return; |
| | | } |
| | | List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '备品']; |
| | | List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '备品']; |
| | | if (rectAs.size() == 0) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | // insert hospital |
| | | Account company1 = new Account(); |
| | | company1.RecordTypeId = rectCo[0].Id; |
| | | company1.Name = '病院テスト1'; |
| | | company1.OCM_man_province_txt__c = '江西'; |
| | | List<Account> hps = new Account[]{company1}; |
| | | List<Account> hps = new List<Account>{ company1 }; |
| | | insert hps; |
| | | |
| | | List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c]; |
| | | |
| | | |
| | | List<Account> dc1s = [ |
| | | SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c |
| | | FROM Account |
| | | WHERE Parent.Id = :company1.Id |
| | | ORDER BY Department_Class_Label__c |
| | | ]; |
| | | |
| | | Account depart1 = new Account(); |
| | | depart1.RecordTypeId = rectDpt[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Department_Class__c = dc1s[0].Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.OCM_man_province_txt__c = '江西'; |
| | | |
| | | insert new Account[] {depart1}; |
| | | |
| | | insert new List<Account>{ depart1 }; |
| | | |
| | | List<Product2> prdList = new List<Product2>(); |
| | | Product2 prd1 = new Product2(); |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.Repair_Product_Code__c = 'HistoryPrd1_RP'; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Extend_new_product_gurantee__c = true; |
| | | prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60); |
| | | prd1.Extend_Gurantee_End__c = Date.today().addDays(60); |
| | | prdList.add(prd1); |
| | | insert prdList; |
| | | |
| | | |
| | | Asset ast = new Asset(); |
| | | |
| | | ast.RecordTypeId = rectAs[0].Id; |
| | | ast.SerialNumber = 'abcdefg'; |
| | | ast.Name = '测试资产1'; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.Guarantee_period_for_products__c = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.Manage_type__c = '个体管理'; |
| | | ast.FirstApproveDate_old__c = Date.today().addDays(-30); |
| | | |
| | | Oly_TriggerHandler.bypass('AssetHandler'); |
| | | |
| | | insert ast; |
| | | |
| | | Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id]; |
| | | |
| | | |
| | | Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID , ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ]; |
| | | System.assertEquals(RecordTypeID, ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [ |
| | | SELECT id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity' |
| | | ]; |
| | | Opportunity opp = new Opportunity( |
| | | Name='testOpp1', |
| | | StageName='引合', |
| | | CloseDate=Date.today(), |
| | | AccountId=depart1.Id, |
| | | Sales_Root__c = 'OCM直接販売', |
| | | Competitor__c ='A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | ); |
| | | insert opp; |
| | | //注残 |
| | | Statu_Achievements__c Sac = new Statu_Achievements__c( |
| | | name = 'zhucan_one', |
| | | Opportunity__c = opp.id, |
| | | DeliveryDate__c = Date.today(), |
| | | ContractNO__c = 'ContractNO1', |
| | | ContractAmount__c = 1000 |
| | | ); |
| | | insert Sac; |
| | | |
| | | //新建电子签收单 |
| | | eSignForm__c eSignForm = new eSignForm__c(); |
| | | eSignForm.Statu_Achievements__c = Sac.Id; |
| | | eSignForm.Name = '::测试电子签收单'; |
| | | |
| | | insert eSignForm; |
| | | |
| | | //新建电子签收单7 |
| | | eSignFormEntry__c eSignFormEntry = new eSignFormEntry__c(); |
| | | eSignFormEntry.Name = '::电子签收单录入表'; |
| | | eSignFormEntry.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry.entryType__c = '经销商收货'; |
| | | // eSignFormEntry.createdDate = Date.today().addDays(-7); |
| | | insert eSignFormEntry; |
| | | |
| | | eSignFormEntry__c eSignFormEntry1 = new eSignFormEntry__c(); |
| | | eSignFormEntry1.Name = '::电子签收单录入表'; |
| | | eSignFormEntry1.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry1.entryType__c = '经销商收货'; |
| | | // eSignFormEntry1.createdDate = Date.today().addDays(-3); |
| | | insert eSignFormEntry1; |
| | | |
| | | eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c(); |
| | | eSignFormEntry2.Name = '::电子签收单录入表'; |
| | | eSignFormEntry2.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry2.entryType__c = '经销商收货'; |
| | | eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencySignUpDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.agencyConfirmDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPScanDayBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPSignUpDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2); |
| | | // eSignFormEntry2.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry2; |
| | | |
| | | eSignFormEntry__c eSignFormEntry3 = new eSignFormEntry__c(); |
| | | eSignFormEntry3.Name = '::电子签收单录入表'; |
| | | eSignFormEntry3.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry3.entryType__c = '经销商确认'; |
| | | // eSignFormEntry3.createdDate = Date.today().addDays(-7); |
| | | insert eSignFormEntry3; |
| | | |
| | | eSignFormEntry__c eSignFormEntry4 = new eSignFormEntry__c(); |
| | | eSignFormEntry4.Name = '::电子签收单录入表'; |
| | | eSignFormEntry4.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry4.entryType__c = '经销商确认'; |
| | | // eSignFormEntry4.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry4; |
| | | |
| | | eSignFormEntry__c eSignFormEntry5 = new eSignFormEntry__c(); |
| | | eSignFormEntry5.Name = '::电子签收单录入表'; |
| | | eSignFormEntry5.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry5.entryType__c = '医院收货'; |
| | | // eSignFormEntry5.createdDate = Date.today().addDays(-7); |
| | | insert eSignFormEntry5; |
| | | |
| | | eSignFormEntry__c eSignFormEntry6 = new eSignFormEntry__c(); |
| | | eSignFormEntry6.Name = '::电子签收单录入表'; |
| | | eSignFormEntry6.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry6.entryType__c = '医院收货'; |
| | | // eSignFormEntry6.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry6; |
| | | |
| | | eSignFormEntry__c eSignFormEntry8 = new eSignFormEntry__c(); |
| | | eSignFormEntry8.Name = '::电子签收单录入表'; |
| | | eSignFormEntry8.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry8.entryType__c = '医院确认'; |
| | | |
| | | insert eSignFormEntry8; |
| | | |
| | | eSignFormEntry__c eSignFormEntry7 = new eSignFormEntry__c(); |
| | | eSignFormEntry7.Name = '::电子签收单录入表'; |
| | | eSignFormEntry7.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry7.entryType__c = '医院确认'; |
| | | |
| | | insert eSignFormEntry7; |
| | | |
| | | //新建电子签收单明细 |
| | | eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c(); |
| | | eSignFormLineItem.Name = '::电子签收单明细'; |
| | | eSignFormLineItem.eSignForm__c = eSignForm.Id; |
| | | |
| | | insert eSignFormLineItem; |
| | | |
| | | //新建电子签收单明细录入表 |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry1.Name = '::电子签收单明细录入1'; |
| | | eSignFormLineItemEntry1.eSignFormEntry__c =eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry1; |
| | | |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry2.Name = '::电子签收单明细录入2'; |
| | | eSignFormLineItemEntry2.eSignFormEntry__c =eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry2; |
| | | |
| | | list<Attachment> attachmentList = new list<Attachment>(); |
| | | Attachment attach=new Attachment(); |
| | | attach.Name='Unit Test Attachment'; |
| | | Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body=bodyBlob; |
| | | attach.parentId=eSignFormEntry2.id; |
| | | |
| | | attachmentList.add(attach); |
| | | |
| | | // insert attach; |
| | | Attachment attach1=new Attachment(); |
| | | attach1.Name='Unit Test Attachment'; |
| | | Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body=bodyBlob1; |
| | | attach1.parentId=eSignForm.id; |
| | | |
| | | attachmentList.add(attach1); |
| | | |
| | | insert attachmentList; |
| | | |
| | | Test.startTest(); |
| | | |
| | | Date d = Date.today(); |
| | | Database.executeBatch(new updateESignBatch(d), 20); |
| | | Test.stopTest(); |
| | | } |
| | | |
| | | static testMethod void testMethod6() { |
| | | 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, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('診療科 消化科', '診療科 呼吸科') order by Name desc]; |
| | | if (rectDpt.size() == 0) { |
| | | return; |
| | | } |
| | | List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '备品']; |
| | | if (rectAs.size() == 0) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | // insert hospital |
| | | Account company1 = new Account(); |
| | | company1.RecordTypeId = rectCo[0].Id; |
| | | company1.Name = '病院テスト1'; |
| | | company1.OCM_man_province_txt__c = '江西'; |
| | | List<Account> hps = new Account[]{company1}; |
| | | insert hps; |
| | | |
| | | List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c]; |
| | | |
| | | Account depart1 = new Account(); |
| | | depart1.RecordTypeId = rectDpt[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Department_Class__c = dc1s[0].Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.OCM_man_province_txt__c = '江西'; |
| | | |
| | | insert new Account[] {depart1}; |
| | | |
| | | List<Product2> prdList = new List<Product2>(); |
| | | Product2 prd1 = new Product2(); |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.Repair_Product_Code__c = 'HistoryPrd1_RP'; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Extend_new_product_gurantee__c = true; |
| | | prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60); |
| | | prd1.Extend_Gurantee_End__c = Date.today().addDays(60); |
| | | prdList.add(prd1); |
| | | insert prdList; |
| | | |
| | | Asset ast = new Asset(); |
| | | |
| | | ast.RecordTypeId = rectAs[0].Id; |
| | | ast.SerialNumber = 'abcdefg'; |
| | | ast.Name = '测试资产1'; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.Guarantee_period_for_products__c = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.Manage_type__c = '个体管理'; |
| | | ast.FirstApproveDate_old__c = Date.today().addDays(-30); |
| | | |
| | | Oly_TriggerHandler.bypass('AssetHandler'); |
| | | |
| | | insert ast; |
| | | |
| | | Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID , ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ]; |
| | | Opportunity opp = new Opportunity( |
| | | Name='testOpp1', |
| | | StageName='引合', |
| | | CloseDate=Date.today(), |
| | | AccountId=depart1.Id, |
| | | Sales_Root__c = 'OCM直接販売', |
| | | Competitor__c ='A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | ); |
| | | insert opp; |
| | | //注残 |
| | | Statu_Achievements__c Sac = new Statu_Achievements__c( |
| | | name = 'zhucan_one', |
| | | Opportunity__c = opp.id, |
| | | DeliveryDate__c = Date.today(), |
| | | ContractNO__c = 'ContractNO1', |
| | | ContractAmount__c = 1000 |
| | | ); |
| | | insert Sac; |
| | | |
| | | //新建电子签收单 |
| | | eSignForm__c eSignForm = new eSignForm__c(); |
| | | eSignForm.Statu_Achievements__c = Sac.Id; |
| | | eSignForm.Name = '::测试电子签收单'; |
| | | |
| | | insert eSignForm; |
| | | |
| | | //新建电子签收单7 |
| | | eSignFormEntry__c eSignFormEntry = new eSignFormEntry__c(); |
| | | eSignFormEntry.Name = '::电子签收单录入表'; |
| | | eSignFormEntry.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry.entryType__c = '经销商收货'; |
| | | // eSignFormEntry.createdDate = Date.today().addDays(-7); |
| | | insert eSignFormEntry; |
| | | |
| | | eSignFormEntry__c eSignFormEntry1 = new eSignFormEntry__c(); |
| | | eSignFormEntry1.Name = '::电子签收单录入表'; |
| | | eSignFormEntry1.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry1.entryType__c = '经销商收货'; |
| | | // eSignFormEntry1.createdDate = Date.today().addDays(-3); |
| | | insert eSignFormEntry1; |
| | | |
| | | eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c(); |
| | | eSignFormEntry2.Name = '::电子签收单录入表'; |
| | | eSignFormEntry2.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry2.entryType__c = '经销商收货'; |
| | | eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencySignUpDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.agencyConfirmDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPScanDayBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPSignUpDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2); |
| | | // eSignFormEntry2.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry2; |
| | | |
| | | eSignFormEntry__c eSignFormEntry3 = new eSignFormEntry__c(); |
| | | eSignFormEntry3.Name = '::电子签收单录入表'; |
| | | eSignFormEntry3.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry3.entryType__c = '经销商确认'; |
| | | // eSignFormEntry3.createdDate = Date.today().addDays(-7); |
| | | insert eSignFormEntry3; |
| | | |
| | | eSignFormEntry__c eSignFormEntry4 = new eSignFormEntry__c(); |
| | | eSignFormEntry4.Name = '::电子签收单录入表'; |
| | | eSignFormEntry4.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry4.entryType__c = '经销商确认'; |
| | | // eSignFormEntry4.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry4; |
| | | |
| | | eSignFormEntry__c eSignFormEntry5 = new eSignFormEntry__c(); |
| | | eSignFormEntry5.Name = '::电子签收单录入表'; |
| | | eSignFormEntry5.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry5.entryType__c = '医院收货'; |
| | | // eSignFormEntry5.createdDate = Date.today().addDays(-7); |
| | | insert eSignFormEntry5; |
| | | |
| | | eSignFormEntry__c eSignFormEntry6 = new eSignFormEntry__c(); |
| | | eSignFormEntry6.Name = '::电子签收单录入表'; |
| | | eSignFormEntry6.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry6.entryType__c = '医院收货'; |
| | | // eSignFormEntry6.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry6; |
| | | |
| | | eSignFormEntry__c eSignFormEntry8 = new eSignFormEntry__c(); |
| | | eSignFormEntry8.Name = '::电子签收单录入表'; |
| | | eSignFormEntry8.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry8.entryType__c = '医院确认'; |
| | | |
| | | insert eSignFormEntry8; |
| | | |
| | | eSignFormEntry__c eSignFormEntry7 = new eSignFormEntry__c(); |
| | | eSignFormEntry7.Name = '::电子签收单录入表'; |
| | | eSignFormEntry7.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry7.entryType__c = '医院确认'; |
| | | |
| | | insert eSignFormEntry7; |
| | | |
| | | //新建电子签收单明细 |
| | | eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c(); |
| | | eSignFormLineItem.Name = '::电子签收单明细'; |
| | | eSignFormLineItem.eSignForm__c = eSignForm.Id; |
| | | |
| | | insert eSignFormLineItem; |
| | | |
| | | //新建电子签收单明细录入表 |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry1.Name = '::电子签收单明细录入1'; |
| | | eSignFormLineItemEntry1.eSignFormEntry__c =eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry1; |
| | | |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry2.Name = '::电子签收单明细录入2'; |
| | | eSignFormLineItemEntry2.eSignFormEntry__c =eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry2; |
| | | |
| | | list<Attachment> attachmentList = new list<Attachment>(); |
| | | Attachment attach=new Attachment(); |
| | | attach.Name='Unit Test Attachment'; |
| | | Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body=bodyBlob; |
| | | attach.parentId=eSignFormEntry2.id; |
| | | |
| | | attachmentList.add(attach); |
| | | |
| | | // insert attach; |
| | | Attachment attach1=new Attachment(); |
| | | attach1.Name='Unit Test Attachment'; |
| | | Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body=bodyBlob1; |
| | | attach1.parentId=eSignForm.id; |
| | | |
| | | attachmentList.add(attach1); |
| | | |
| | | insert attachmentList; |
| | | Test.startTest(); |
| | | Date startDate = Date.today(); |
| | | Date enDdate = Date.today().addDays(-1); |
| | | Database.executeBatch(new updateESignBatch(startDate,enDdate), 20); |
| | | Test.stopTest(); |
| | | } |
| | | |
| | | static testMethod void testMethod7() { |
| | | 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, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('診療科 消化科', '診療科 呼吸科') order by Name desc]; |
| | | if (rectDpt.size() == 0) { |
| | | return; |
| | | } |
| | | List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '备品']; |
| | | if (rectAs.size() == 0) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | // insert hospital |
| | | Account company1 = new Account(); |
| | | company1.RecordTypeId = rectCo[0].Id; |
| | | company1.Name = '病院テスト1'; |
| | | company1.OCM_man_province_txt__c = '江西'; |
| | | List<Account> hps = new Account[]{company1}; |
| | | insert hps; |
| | | |
| | | List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c]; |
| | | |
| | | Account depart1 = new Account(); |
| | | depart1.RecordTypeId = rectDpt[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Department_Class__c = dc1s[0].Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.OCM_man_province_txt__c = '江西'; |
| | | |
| | | insert new Account[] {depart1}; |
| | | |
| | | List<Product2> prdList = new List<Product2>(); |
| | | Product2 prd1 = new Product2(); |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.Repair_Product_Code__c = 'HistoryPrd1_RP'; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Extend_new_product_gurantee__c = true; |
| | | prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60); |
| | | prd1.Extend_Gurantee_End__c = Date.today().addDays(60); |
| | | prdList.add(prd1); |
| | | insert prdList; |
| | | |
| | | Asset ast = new Asset(); |
| | | |
| | | ast.RecordTypeId = rectAs[0].Id; |
| | | ast.SerialNumber = 'abcdefg'; |
| | | ast.Name = '测试资产1'; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.Guarantee_period_for_products__c = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.Manage_type__c = '个体管理'; |
| | | ast.FirstApproveDate_old__c = Date.today().addDays(-30); |
| | | |
| | | Oly_TriggerHandler.bypass('AssetHandler'); |
| | | |
| | | insert ast; |
| | | |
| | | Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID , ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ]; |
| | | Opportunity opp = new Opportunity( |
| | | Name='testOpp1', |
| | | StageName='引合', |
| | | CloseDate=Date.today(), |
| | | AccountId=depart1.Id, |
| | | Sales_Root__c = 'OCM直接販売', |
| | | Competitor__c ='A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | Name = 'testOpp1', |
| | | StageName = '引合', |
| | | CloseDate = Date.today(), |
| | | AccountId = depart1.Id, |
| | | Sales_Root__c = 'OCM直接販売', |
| | | Competitor__c = 'A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | ); |
| | | insert opp; |
| | | //注残 |
| | |
| | | eSignFormEntry2.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry2.entryType__c = '经销商收货'; |
| | | eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencySignUpDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.agencyConfirmDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPScanDayBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPSignUpDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.agencySignUpDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencyConfirmDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPSignUpDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2); |
| | | // eSignFormEntry2.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry2; |
| | |
| | | eSignFormEntry7.Name = '::电子签收单录入表'; |
| | | eSignFormEntry7.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry7.entryType__c = '医院确认'; |
| | | |
| | | |
| | | insert eSignFormEntry7; |
| | | |
| | | //新建电子签收单明细 |
| | |
| | | //新建电子签收单明细录入表 |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry1.Name = '::电子签收单明细录入1'; |
| | | eSignFormLineItemEntry1.eSignFormEntry__c =eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry1.eSignFormEntry__c = eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry1; |
| | | |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry2.Name = '::电子签收单明细录入2'; |
| | | eSignFormLineItemEntry2.eSignFormEntry__c =eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry2.eSignFormEntry__c = eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry2; |
| | | |
| | | list<Attachment> attachmentList = new list<Attachment>(); |
| | | Attachment attach=new Attachment(); |
| | | attach.Name='Unit Test Attachment'; |
| | | Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body=bodyBlob; |
| | | attach.parentId=eSignFormEntry2.id; |
| | | list<Attachment> attachmentList = new List<Attachment>(); |
| | | Attachment attach = new Attachment(); |
| | | attach.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body = bodyBlob; |
| | | attach.parentId = eSignFormEntry2.id; |
| | | |
| | | attachmentList.add(attach); |
| | | |
| | | // insert attach; |
| | | Attachment attach1=new Attachment(); |
| | | attach1.Name='Unit Test Attachment'; |
| | | Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body=bodyBlob1; |
| | | attach1.parentId=eSignForm.id; |
| | | |
| | | Attachment attach1 = new Attachment(); |
| | | attach1.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body = bodyBlob1; |
| | | attach1.parentId = eSignForm.id; |
| | | |
| | | attachmentList.add(attach1); |
| | | |
| | | insert attachmentList; |
| | | |
| | | Test.startTest(); |
| | | |
| | | Date d = Date.today(); |
| | | Database.executeBatch(new updateESignBatch(d), 20); |
| | | Test.stopTest(); |
| | | } |
| | | |
| | | static testMethod void testMethod6() { |
| | | 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, Name |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('診療科 消化科', '診療科 呼吸科') |
| | | ORDER BY Name DESC |
| | | ]; |
| | | if (rectDpt.size() == 0) { |
| | | return; |
| | | } |
| | | List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '备品']; |
| | | if (rectAs.size() == 0) { |
| | | return; |
| | | } |
| | | |
| | | // insert hospital |
| | | Account company1 = new Account(); |
| | | company1.RecordTypeId = rectCo[0].Id; |
| | | company1.Name = '病院テスト1'; |
| | | company1.OCM_man_province_txt__c = '江西'; |
| | | List<Account> hps = new List<Account>{ company1 }; |
| | | insert hps; |
| | | |
| | | List<Account> dc1s = [ |
| | | SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c |
| | | FROM Account |
| | | WHERE Parent.Id = :company1.Id |
| | | ORDER BY Department_Class_Label__c |
| | | ]; |
| | | |
| | | Account depart1 = new Account(); |
| | | depart1.RecordTypeId = rectDpt[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Department_Class__c = dc1s[0].Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.OCM_man_province_txt__c = '江西'; |
| | | |
| | | insert new List<Account>{ depart1 }; |
| | | |
| | | List<Product2> prdList = new List<Product2>(); |
| | | Product2 prd1 = new Product2(); |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.Repair_Product_Code__c = 'HistoryPrd1_RP'; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Extend_new_product_gurantee__c = true; |
| | | prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60); |
| | | prd1.Extend_Gurantee_End__c = Date.today().addDays(60); |
| | | prdList.add(prd1); |
| | | insert prdList; |
| | | |
| | | Asset ast = new Asset(); |
| | | |
| | | ast.RecordTypeId = rectAs[0].Id; |
| | | ast.SerialNumber = 'abcdefg'; |
| | | ast.Name = '测试资产1'; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.Guarantee_period_for_products__c = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.Manage_type__c = '个体管理'; |
| | | ast.FirstApproveDate_old__c = Date.today().addDays(-30); |
| | | |
| | | Oly_TriggerHandler.bypass('AssetHandler'); |
| | | |
| | | insert ast; |
| | | |
| | | Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID, ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [ |
| | | SELECT id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity' |
| | | ]; |
| | | Opportunity opp = new Opportunity( |
| | | Name = 'testOpp1', |
| | | StageName = '引合', |
| | | CloseDate = Date.today(), |
| | | AccountId = depart1.Id, |
| | | Sales_Root__c = 'OCM直接販売', |
| | | Competitor__c = 'A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | ); |
| | | insert opp; |
| | | //注残 |
| | | Statu_Achievements__c Sac = new Statu_Achievements__c( |
| | | name = 'zhucan_one', |
| | | Opportunity__c = opp.id, |
| | | DeliveryDate__c = Date.today(), |
| | | ContractNO__c = 'ContractNO1', |
| | | ContractAmount__c = 1000 |
| | | ); |
| | | insert Sac; |
| | | |
| | | //新建电子签收单 |
| | | eSignForm__c eSignForm = new eSignForm__c(); |
| | | eSignForm.Statu_Achievements__c = Sac.Id; |
| | | eSignForm.Name = '::测试电子签收单'; |
| | | |
| | | insert eSignForm; |
| | | |
| | | //新建电子签收单7 |
| | | eSignFormEntry__c eSignFormEntry = new eSignFormEntry__c(); |
| | | eSignFormEntry.Name = '::电子签收单录入表'; |
| | | eSignFormEntry.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry.entryType__c = '经销商收货'; |
| | | // eSignFormEntry.createdDate = Date.today().addDays(-7); |
| | | insert eSignFormEntry; |
| | | |
| | | eSignFormEntry__c eSignFormEntry1 = new eSignFormEntry__c(); |
| | | eSignFormEntry1.Name = '::电子签收单录入表'; |
| | | eSignFormEntry1.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry1.entryType__c = '经销商收货'; |
| | | // eSignFormEntry1.createdDate = Date.today().addDays(-3); |
| | | insert eSignFormEntry1; |
| | | |
| | | eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c(); |
| | | eSignFormEntry2.Name = '::电子签收单录入表'; |
| | | eSignFormEntry2.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry2.entryType__c = '经销商收货'; |
| | | eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencySignUpDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencyConfirmDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPSignUpDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2); |
| | | // eSignFormEntry2.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry2; |
| | | |
| | | eSignFormEntry__c eSignFormEntry3 = new eSignFormEntry__c(); |
| | | eSignFormEntry3.Name = '::电子签收单录入表'; |
| | | eSignFormEntry3.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry3.entryType__c = '经销商确认'; |
| | | // eSignFormEntry3.createdDate = Date.today().addDays(-7); |
| | | insert eSignFormEntry3; |
| | | |
| | | eSignFormEntry__c eSignFormEntry4 = new eSignFormEntry__c(); |
| | | eSignFormEntry4.Name = '::电子签收单录入表'; |
| | | eSignFormEntry4.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry4.entryType__c = '经销商确认'; |
| | | // eSignFormEntry4.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry4; |
| | | |
| | | eSignFormEntry__c eSignFormEntry5 = new eSignFormEntry__c(); |
| | | eSignFormEntry5.Name = '::电子签收单录入表'; |
| | | eSignFormEntry5.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry5.entryType__c = '医院收货'; |
| | | // eSignFormEntry5.createdDate = Date.today().addDays(-7); |
| | | insert eSignFormEntry5; |
| | | |
| | | eSignFormEntry__c eSignFormEntry6 = new eSignFormEntry__c(); |
| | | eSignFormEntry6.Name = '::电子签收单录入表'; |
| | | eSignFormEntry6.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry6.entryType__c = '医院收货'; |
| | | // eSignFormEntry6.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry6; |
| | | |
| | | eSignFormEntry__c eSignFormEntry8 = new eSignFormEntry__c(); |
| | | eSignFormEntry8.Name = '::电子签收单录入表'; |
| | | eSignFormEntry8.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry8.entryType__c = '医院确认'; |
| | | |
| | | insert eSignFormEntry8; |
| | | |
| | | eSignFormEntry__c eSignFormEntry7 = new eSignFormEntry__c(); |
| | | eSignFormEntry7.Name = '::电子签收单录入表'; |
| | | eSignFormEntry7.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry7.entryType__c = '医院确认'; |
| | | |
| | | insert eSignFormEntry7; |
| | | |
| | | //新建电子签收单明细 |
| | | eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c(); |
| | | eSignFormLineItem.Name = '::电子签收单明细'; |
| | | eSignFormLineItem.eSignForm__c = eSignForm.Id; |
| | | |
| | | insert eSignFormLineItem; |
| | | |
| | | //新建电子签收单明细录入表 |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry1.Name = '::电子签收单明细录入1'; |
| | | eSignFormLineItemEntry1.eSignFormEntry__c = eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry1; |
| | | |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry2.Name = '::电子签收单明细录入2'; |
| | | eSignFormLineItemEntry2.eSignFormEntry__c = eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry2; |
| | | |
| | | list<Attachment> attachmentList = new List<Attachment>(); |
| | | Attachment attach = new Attachment(); |
| | | attach.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body = bodyBlob; |
| | | attach.parentId = eSignFormEntry2.id; |
| | | |
| | | attachmentList.add(attach); |
| | | |
| | | // insert attach; |
| | | Attachment attach1 = new Attachment(); |
| | | attach1.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body = bodyBlob1; |
| | | attach1.parentId = eSignForm.id; |
| | | |
| | | attachmentList.add(attach1); |
| | | |
| | | insert attachmentList; |
| | | Test.startTest(); |
| | | Date startDate = Date.today(); |
| | | Date enDdate = Date.today().addDays(-1); |
| | | Database.executeBatch(new updateESignBatch(startDate, enDdate), 20); |
| | | Test.stopTest(); |
| | | } |
| | | |
| | | static testMethod void testMethod7() { |
| | | 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, Name |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('診療科 消化科', '診療科 呼吸科') |
| | | ORDER BY Name DESC |
| | | ]; |
| | | if (rectDpt.size() == 0) { |
| | | return; |
| | | } |
| | | List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '备品']; |
| | | if (rectAs.size() == 0) { |
| | | return; |
| | | } |
| | | |
| | | // insert hospital |
| | | Account company1 = new Account(); |
| | | company1.RecordTypeId = rectCo[0].Id; |
| | | company1.Name = '病院テスト1'; |
| | | company1.OCM_man_province_txt__c = '江西'; |
| | | List<Account> hps = new List<Account>{ company1 }; |
| | | insert hps; |
| | | |
| | | List<Account> dc1s = [ |
| | | SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c |
| | | FROM Account |
| | | WHERE Parent.Id = :company1.Id |
| | | ORDER BY Department_Class_Label__c |
| | | ]; |
| | | |
| | | Account depart1 = new Account(); |
| | | depart1.RecordTypeId = rectDpt[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Department_Class__c = dc1s[0].Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.OCM_man_province_txt__c = '江西'; |
| | | |
| | | insert new List<Account>{ depart1 }; |
| | | |
| | | List<Product2> prdList = new List<Product2>(); |
| | | Product2 prd1 = new Product2(); |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.Repair_Product_Code__c = 'HistoryPrd1_RP'; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Extend_new_product_gurantee__c = true; |
| | | prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60); |
| | | prd1.Extend_Gurantee_End__c = Date.today().addDays(60); |
| | | prdList.add(prd1); |
| | | insert prdList; |
| | | |
| | | Asset ast = new Asset(); |
| | | |
| | | ast.RecordTypeId = rectAs[0].Id; |
| | | ast.SerialNumber = 'abcdefg'; |
| | | ast.Name = '测试资产1'; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.Guarantee_period_for_products__c = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.Manage_type__c = '个体管理'; |
| | | ast.FirstApproveDate_old__c = Date.today().addDays(-30); |
| | | |
| | | Oly_TriggerHandler.bypass('AssetHandler'); |
| | | |
| | | insert ast; |
| | | |
| | | Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID, ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [ |
| | | SELECT id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity' |
| | | ]; |
| | | Opportunity opp = new Opportunity( |
| | | Name = 'testOpp1', |
| | | StageName = '引合', |
| | | CloseDate = Date.today(), |
| | | AccountId = depart1.Id, |
| | | Sales_Root__c = 'OCM直接販売', |
| | | Competitor__c = 'A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | ); |
| | | insert opp; |
| | | //注残 |
| | | Statu_Achievements__c Sac = new Statu_Achievements__c( |
| | | name = 'zhucan_one', |
| | | Opportunity__c = opp.id, |
| | | DeliveryDate__c = Date.today(), |
| | | ContractNO__c = 'ContractNO1', |
| | | ContractAmount__c = 1000 |
| | | ); |
| | | insert Sac; |
| | | |
| | | //新建电子签收单 |
| | | eSignForm__c eSignForm = new eSignForm__c(); |
| | | eSignForm.Statu_Achievements__c = Sac.Id; |
| | | eSignForm.Name = '::测试电子签收单'; |
| | | |
| | | insert eSignForm; |
| | | |
| | | //新建电子签收单7 |
| | | eSignFormEntry__c eSignFormEntry = new eSignFormEntry__c(); |
| | | eSignFormEntry.Name = '::电子签收单录入表'; |
| | | eSignFormEntry.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry.entryType__c = '经销商收货'; |
| | | // eSignFormEntry.createdDate = Date.today().addDays(-7); |
| | | insert eSignFormEntry; |
| | | |
| | | eSignFormEntry__c eSignFormEntry1 = new eSignFormEntry__c(); |
| | | eSignFormEntry1.Name = '::电子签收单录入表'; |
| | | eSignFormEntry1.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry1.entryType__c = '经销商收货'; |
| | | // eSignFormEntry1.createdDate = Date.today().addDays(-3); |
| | | insert eSignFormEntry1; |
| | | |
| | | eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c(); |
| | | eSignFormEntry2.Name = '::电子签收单录入表'; |
| | | eSignFormEntry2.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry2.entryType__c = '经销商收货'; |
| | | eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencySignUpDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencyConfirmDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPSignUpDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2); |
| | | // eSignFormEntry2.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry2; |
| | | |
| | | eSignFormEntry__c eSignFormEntry3 = new eSignFormEntry__c(); |
| | | eSignFormEntry3.Name = '::电子签收单录入表'; |
| | | eSignFormEntry3.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry3.entryType__c = '经销商确认'; |
| | | // eSignFormEntry3.createdDate = Date.today().addDays(-7); |
| | | insert eSignFormEntry3; |
| | | |
| | | eSignFormEntry__c eSignFormEntry4 = new eSignFormEntry__c(); |
| | | eSignFormEntry4.Name = '::电子签收单录入表'; |
| | | eSignFormEntry4.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry4.entryType__c = '经销商确认'; |
| | | // eSignFormEntry4.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry4; |
| | | |
| | | eSignFormEntry__c eSignFormEntry5 = new eSignFormEntry__c(); |
| | | eSignFormEntry5.Name = '::电子签收单录入表'; |
| | | eSignFormEntry5.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry5.entryType__c = '医院收货'; |
| | | // eSignFormEntry5.createdDate = Date.today().addDays(-7); |
| | | insert eSignFormEntry5; |
| | | |
| | | eSignFormEntry__c eSignFormEntry6 = new eSignFormEntry__c(); |
| | | eSignFormEntry6.Name = '::电子签收单录入表'; |
| | | eSignFormEntry6.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry6.entryType__c = '医院收货'; |
| | | // eSignFormEntry6.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry6; |
| | | |
| | | eSignFormEntry__c eSignFormEntry8 = new eSignFormEntry__c(); |
| | | eSignFormEntry8.Name = '::电子签收单录入表'; |
| | | eSignFormEntry8.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry8.entryType__c = '医院确认'; |
| | | |
| | | insert eSignFormEntry8; |
| | | |
| | | eSignFormEntry__c eSignFormEntry7 = new eSignFormEntry__c(); |
| | | eSignFormEntry7.Name = '::电子签收单录入表'; |
| | | eSignFormEntry7.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry7.entryType__c = '医院确认'; |
| | | |
| | | insert eSignFormEntry7; |
| | | |
| | | //新建电子签收单明细 |
| | | eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c(); |
| | | eSignFormLineItem.Name = '::电子签收单明细'; |
| | | eSignFormLineItem.eSignForm__c = eSignForm.Id; |
| | | |
| | | insert eSignFormLineItem; |
| | | |
| | | //新建电子签收单明细录入表 |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry1.Name = '::电子签收单明细录入1'; |
| | | eSignFormLineItemEntry1.eSignFormEntry__c = eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry1; |
| | | |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry2.Name = '::电子签收单明细录入2'; |
| | | eSignFormLineItemEntry2.eSignFormEntry__c = eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry2; |
| | | |
| | | list<Attachment> attachmentList = new List<Attachment>(); |
| | | Attachment attach = new Attachment(); |
| | | attach.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body = bodyBlob; |
| | | attach.parentId = eSignFormEntry2.id; |
| | | |
| | | attachmentList.add(attach); |
| | | |
| | | // insert attach; |
| | | Attachment attach1 = new Attachment(); |
| | | attach1.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body = bodyBlob1; |
| | | attach1.parentId = eSignForm.id; |
| | | |
| | | attachmentList.add(attach1); |
| | | |
| | | insert attachmentList; |
| | |
| | | } |
| | | |
| | | static testMethod void testMethod8() { |
| | | 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; |
| | | } |
| | | List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 呼吸科']; |
| | | 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, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('診療科 消化科', '診療科 呼吸科') order by Name desc]; |
| | | List<RecordType> rectDpt = [ |
| | | SELECT Id, Name |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('診療科 消化科', '診療科 呼吸科') |
| | | ORDER BY Name DESC |
| | | ]; |
| | | if (rectDpt.size() == 0) { |
| | | return; |
| | | } |
| | | List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '备品']; |
| | | List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '备品']; |
| | | if (rectAs.size() == 0) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | // insert hospital |
| | | Account company1 = new Account(); |
| | | company1.RecordTypeId = rectCo[0].Id; |
| | | company1.Name = '病院テスト1'; |
| | | company1.OCM_man_province_txt__c = '江西'; |
| | | List<Account> hps = new Account[]{company1}; |
| | | List<Account> hps = new List<Account>{ company1 }; |
| | | insert hps; |
| | | |
| | | List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c]; |
| | | |
| | | |
| | | List<Account> dc1s = [ |
| | | SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c |
| | | FROM Account |
| | | WHERE Parent.Id = :company1.Id |
| | | ORDER BY Department_Class_Label__c |
| | | ]; |
| | | |
| | | Account depart1 = new Account(); |
| | | depart1.RecordTypeId = rectDpt[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Department_Class__c = dc1s[0].Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.OCM_man_province_txt__c = '江西'; |
| | | |
| | | insert new Account[] {depart1}; |
| | | |
| | | insert new List<Account>{ depart1 }; |
| | | |
| | | List<Product2> prdList = new List<Product2>(); |
| | | Product2 prd1 = new Product2(); |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.Repair_Product_Code__c = 'HistoryPrd1_RP'; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Extend_new_product_gurantee__c = true; |
| | | prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60); |
| | | prd1.Extend_Gurantee_End__c = Date.today().addDays(60); |
| | | prdList.add(prd1); |
| | | insert prdList; |
| | | |
| | | |
| | | Asset ast = new Asset(); |
| | | |
| | | ast.RecordTypeId = rectAs[0].Id; |
| | | ast.SerialNumber = 'abcdefg'; |
| | | ast.Name = '测试资产1'; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.Guarantee_period_for_products__c = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.Manage_type__c = '个体管理'; |
| | | ast.FirstApproveDate_old__c = Date.today().addDays(-30); |
| | | |
| | | Oly_TriggerHandler.bypass('AssetHandler'); |
| | | |
| | | insert ast; |
| | | |
| | | Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id]; |
| | | |
| | | |
| | | Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID , ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ]; |
| | | System.assertEquals(RecordTypeID, ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [ |
| | | SELECT id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity' |
| | | ]; |
| | | Opportunity opp = new Opportunity( |
| | | Name='testOpp1', |
| | | StageName='引合', |
| | | CloseDate=Date.today(), |
| | | AccountId=depart1.Id, |
| | | Sales_Root__c = 'OCM直接販売', |
| | | Competitor__c ='A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | ); |
| | | insert opp; |
| | | //注残 |
| | | Statu_Achievements__c Sac = new Statu_Achievements__c( |
| | | name = 'zhucan_one', |
| | | Opportunity__c = opp.id, |
| | | DeliveryDate__c = Date.today(), |
| | | ContractNO__c = 'ContractNO1', |
| | | ContractAmount__c = 1000 |
| | | ); |
| | | insert Sac; |
| | | |
| | | //新建电子签收单 |
| | | eSignForm__c eSignForm = new eSignForm__c(); |
| | | eSignForm.Statu_Achievements__c = Sac.Id; |
| | | eSignForm.Name = '::测试电子签收单'; |
| | | |
| | | insert eSignForm; |
| | | |
| | | //新建电子签收单7 |
| | | eSignFormEntry__c eSignFormEntry = new eSignFormEntry__c(); |
| | | eSignFormEntry.Name = '::电子签收单录入表'; |
| | | eSignFormEntry.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry.entryType__c = '经销商收货'; |
| | | // eSignFormEntry.createdDate = Date.today().addDays(-7); |
| | | insert eSignFormEntry; |
| | | |
| | | eSignFormEntry__c eSignFormEntry1 = new eSignFormEntry__c(); |
| | | eSignFormEntry1.Name = '::电子签收单录入表'; |
| | | eSignFormEntry1.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry1.entryType__c = '经销商收货'; |
| | | // eSignFormEntry1.createdDate = Date.today().addDays(-3); |
| | | insert eSignFormEntry1; |
| | | |
| | | eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c(); |
| | | eSignFormEntry2.Name = '::电子签收单录入表'; |
| | | eSignFormEntry2.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry2.entryType__c = '经销商收货'; |
| | | eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencySignUpDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.agencyConfirmDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPScanDayBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPSignUpDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2); |
| | | // eSignFormEntry2.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry2; |
| | | |
| | | eSignFormEntry__c eSignFormEntry3 = new eSignFormEntry__c(); |
| | | eSignFormEntry3.Name = '::电子签收单录入表'; |
| | | eSignFormEntry3.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry3.entryType__c = '经销商确认'; |
| | | // eSignFormEntry3.createdDate = Date.today().addDays(-7); |
| | | insert eSignFormEntry3; |
| | | |
| | | eSignFormEntry__c eSignFormEntry4 = new eSignFormEntry__c(); |
| | | eSignFormEntry4.Name = '::电子签收单录入表'; |
| | | eSignFormEntry4.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry4.entryType__c = '经销商确认'; |
| | | // eSignFormEntry4.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry4; |
| | | |
| | | eSignFormEntry__c eSignFormEntry5 = new eSignFormEntry__c(); |
| | | eSignFormEntry5.Name = '::电子签收单录入表'; |
| | | eSignFormEntry5.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry5.entryType__c = '医院收货'; |
| | | // eSignFormEntry5.createdDate = Date.today().addDays(-7); |
| | | insert eSignFormEntry5; |
| | | |
| | | eSignFormEntry__c eSignFormEntry6 = new eSignFormEntry__c(); |
| | | eSignFormEntry6.Name = '::电子签收单录入表'; |
| | | eSignFormEntry6.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry6.entryType__c = '医院收货'; |
| | | // eSignFormEntry6.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry6; |
| | | |
| | | eSignFormEntry__c eSignFormEntry8 = new eSignFormEntry__c(); |
| | | eSignFormEntry8.Name = '::电子签收单录入表'; |
| | | eSignFormEntry8.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry8.entryType__c = '医院确认'; |
| | | |
| | | insert eSignFormEntry8; |
| | | |
| | | eSignFormEntry__c eSignFormEntry7 = new eSignFormEntry__c(); |
| | | eSignFormEntry7.Name = '::电子签收单录入表'; |
| | | eSignFormEntry7.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry7.entryType__c = '医院确认'; |
| | | |
| | | insert eSignFormEntry7; |
| | | |
| | | //新建电子签收单明细 |
| | | eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c(); |
| | | eSignFormLineItem.Name = '::电子签收单明细'; |
| | | eSignFormLineItem.eSignForm__c = eSignForm.Id; |
| | | |
| | | insert eSignFormLineItem; |
| | | |
| | | //新建电子签收单明细录入表 |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry1.Name = '::电子签收单明细录入1'; |
| | | eSignFormLineItemEntry1.eSignFormEntry__c =eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry1; |
| | | |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry2.Name = '::电子签收单明细录入2'; |
| | | eSignFormLineItemEntry2.eSignFormEntry__c =eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry2; |
| | | |
| | | list<Attachment> attachmentList = new list<Attachment>(); |
| | | Attachment attach=new Attachment(); |
| | | attach.Name='Unit Test Attachment'; |
| | | Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body=bodyBlob; |
| | | attach.parentId=eSignFormEntry2.id; |
| | | |
| | | attachmentList.add(attach); |
| | | |
| | | // insert attach; |
| | | Attachment attach1=new Attachment(); |
| | | attach1.Name='Unit Test Attachment'; |
| | | Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body=bodyBlob1; |
| | | attach1.parentId=eSignForm.id; |
| | | |
| | | attachmentList.add(attach1); |
| | | |
| | | insert attachmentList; |
| | | |
| | | Test.startTest(); |
| | | |
| | | String type = '经销商收货'; |
| | | Database.executeBatch(new updateESignBatch(type), 20); |
| | | Test.stopTest(); |
| | | } |
| | | |
| | | static testMethod void testMethod9() { |
| | | 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, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('診療科 消化科', '診療科 呼吸科') order by Name desc]; |
| | | if (rectDpt.size() == 0) { |
| | | return; |
| | | } |
| | | List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '备品']; |
| | | if (rectAs.size() == 0) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | // insert hospital |
| | | Account company1 = new Account(); |
| | | company1.RecordTypeId = rectCo[0].Id; |
| | | company1.Name = '病院テスト1'; |
| | | company1.OCM_man_province_txt__c = '江西'; |
| | | List<Account> hps = new Account[]{company1}; |
| | | insert hps; |
| | | |
| | | List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c]; |
| | | |
| | | Account depart1 = new Account(); |
| | | depart1.RecordTypeId = rectDpt[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Department_Class__c = dc1s[0].Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.OCM_man_province_txt__c = '江西'; |
| | | |
| | | insert new Account[] {depart1}; |
| | | |
| | | List<Product2> prdList = new List<Product2>(); |
| | | Product2 prd1 = new Product2(); |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.Repair_Product_Code__c = 'HistoryPrd1_RP'; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Extend_new_product_gurantee__c = true; |
| | | prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60); |
| | | prd1.Extend_Gurantee_End__c = Date.today().addDays(60); |
| | | prdList.add(prd1); |
| | | insert prdList; |
| | | |
| | | Asset ast = new Asset(); |
| | | |
| | | ast.RecordTypeId = rectAs[0].Id; |
| | | ast.SerialNumber = 'abcdefg'; |
| | | ast.Name = '测试资产1'; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.Guarantee_period_for_products__c = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.Manage_type__c = '个体管理'; |
| | | ast.FirstApproveDate_old__c = Date.today().addDays(-30); |
| | | |
| | | Oly_TriggerHandler.bypass('AssetHandler'); |
| | | |
| | | insert ast; |
| | | |
| | | Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID , ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ]; |
| | | Opportunity opp = new Opportunity( |
| | | Name='testOpp1', |
| | | StageName='引合', |
| | | CloseDate=Date.today(), |
| | | AccountId=depart1.Id, |
| | | Sales_Root__c = 'OCM直接販売', |
| | | Competitor__c ='A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | Name = 'testOpp1', |
| | | StageName = '引合', |
| | | CloseDate = Date.today(), |
| | | AccountId = depart1.Id, |
| | | Sales_Root__c = 'OCM直接販売', |
| | | Competitor__c = 'A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | ); |
| | | insert opp; |
| | | //注残 |
| | |
| | | eSignFormEntry2.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry2.entryType__c = '经销商收货'; |
| | | eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencySignUpDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.agencyConfirmDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPScanDayBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPSignUpDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.agencySignUpDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencyConfirmDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPSignUpDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2); |
| | | // eSignFormEntry2.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry2; |
| | |
| | | eSignFormEntry7.Name = '::电子签收单录入表'; |
| | | eSignFormEntry7.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry7.entryType__c = '医院确认'; |
| | | |
| | | |
| | | insert eSignFormEntry7; |
| | | |
| | | //新建电子签收单明细 |
| | |
| | | //新建电子签收单明细录入表 |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry1.Name = '::电子签收单明细录入1'; |
| | | eSignFormLineItemEntry1.eSignFormEntry__c =eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry1.eSignFormEntry__c = eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry1; |
| | | |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry2.Name = '::电子签收单明细录入2'; |
| | | eSignFormLineItemEntry2.eSignFormEntry__c =eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry2.eSignFormEntry__c = eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry2; |
| | | |
| | | list<Attachment> attachmentList = new list<Attachment>(); |
| | | Attachment attach=new Attachment(); |
| | | attach.Name='Unit Test Attachment'; |
| | | Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body=bodyBlob; |
| | | attach.parentId=eSignFormEntry2.id; |
| | | list<Attachment> attachmentList = new List<Attachment>(); |
| | | Attachment attach = new Attachment(); |
| | | attach.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body = bodyBlob; |
| | | attach.parentId = eSignFormEntry2.id; |
| | | |
| | | attachmentList.add(attach); |
| | | |
| | | // insert attach; |
| | | Attachment attach1=new Attachment(); |
| | | attach1.Name='Unit Test Attachment'; |
| | | Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body=bodyBlob1; |
| | | attach1.parentId=eSignForm.id; |
| | | |
| | | Attachment attach1 = new Attachment(); |
| | | attach1.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body = bodyBlob1; |
| | | attach1.parentId = eSignForm.id; |
| | | |
| | | attachmentList.add(attach1); |
| | | |
| | | insert attachmentList; |
| | | |
| | | Test.startTest(); |
| | | |
| | | List<String> ids = new List<String>(); |
| | | ids.add(eSignForm.Id); |
| | | Database.executeBatch(new updateESignBatch(ids,true), 20); |
| | | String type = '经销商收货'; |
| | | Database.executeBatch(new updateESignBatch(type), 20); |
| | | Test.stopTest(); |
| | | } |
| | | |
| | | static testMethod void testMethod10() { |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院']; |
| | | static testMethod void testMethod9() { |
| | | 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 = '戦略科室分類 呼吸科']; |
| | | 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, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('診療科 消化科', '診療科 呼吸科') order by Name desc]; |
| | | List<RecordType> rectDpt = [ |
| | | SELECT Id, Name |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('診療科 消化科', '診療科 呼吸科') |
| | | ORDER BY Name DESC |
| | | ]; |
| | | if (rectDpt.size() == 0) { |
| | | return; |
| | | } |
| | | List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '备品']; |
| | | List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '备品']; |
| | | if (rectAs.size() == 0) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | // insert hospital |
| | | Account company1 = new Account(); |
| | | company1.RecordTypeId = rectCo[0].Id; |
| | | company1.Name = '病院テスト1'; |
| | | company1.OCM_man_province_txt__c = '江西'; |
| | | List<Account> hps = new Account[]{company1}; |
| | | List<Account> hps = new List<Account>{ company1 }; |
| | | insert hps; |
| | | |
| | | List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c]; |
| | | |
| | | |
| | | List<Account> dc1s = [ |
| | | SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c |
| | | FROM Account |
| | | WHERE Parent.Id = :company1.Id |
| | | ORDER BY Department_Class_Label__c |
| | | ]; |
| | | |
| | | Account depart1 = new Account(); |
| | | depart1.RecordTypeId = rectDpt[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Department_Class__c = dc1s[0].Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.OCM_man_province_txt__c = '江西'; |
| | | |
| | | insert new Account[] {depart1}; |
| | | |
| | | insert new List<Account>{ depart1 }; |
| | | |
| | | List<Product2> prdList = new List<Product2>(); |
| | | Product2 prd1 = new Product2(); |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.Repair_Product_Code__c = 'HistoryPrd1_RP'; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Extend_new_product_gurantee__c = true; |
| | | prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60); |
| | | prd1.Extend_Gurantee_End__c = Date.today().addDays(60); |
| | | prdList.add(prd1); |
| | | insert prdList; |
| | | |
| | | |
| | | Asset ast = new Asset(); |
| | | |
| | | ast.RecordTypeId = rectAs[0].Id; |
| | | ast.SerialNumber = 'abcdefg'; |
| | | ast.Name = '测试资产1'; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.Guarantee_period_for_products__c = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.Manage_type__c = '个体管理'; |
| | | ast.FirstApproveDate_old__c = Date.today().addDays(-30); |
| | | |
| | | Oly_TriggerHandler.bypass('AssetHandler'); |
| | | |
| | | insert ast; |
| | | |
| | | Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID , ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ]; |
| | | Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID, ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [ |
| | | SELECT id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity' |
| | | ]; |
| | | Opportunity opp = new Opportunity( |
| | | Name='testOpp1', |
| | | StageName='引合', |
| | | CloseDate=Date.today(), |
| | | AccountId=depart1.Id, |
| | | Sales_Root__c = 'OCM直接販売', |
| | | Competitor__c ='A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | Name = 'testOpp1', |
| | | StageName = '引合', |
| | | CloseDate = Date.today(), |
| | | AccountId = depart1.Id, |
| | | Sales_Root__c = 'OCM直接販売', |
| | | Competitor__c = 'A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | ); |
| | | insert opp; |
| | | //注残 |
| | |
| | | insert Sac; |
| | | |
| | | //新建电子签收单 |
| | | eSignForm__c eSignForm = new eSignForm__c(); |
| | | eSignForm.Statu_Achievements__c = Sac.Id; |
| | | eSignForm.Name = '::测试电子签收单'; |
| | | eSignForm__c eSignForm = new eSignForm__c(); |
| | | eSignForm.Statu_Achievements__c = Sac.Id; |
| | | eSignForm.Name = '::测试电子签收单'; |
| | | |
| | | insert eSignForm; |
| | | insert eSignForm; |
| | | |
| | | //新建电子签收单7 |
| | | eSignFormEntry__c eSignFormEntry = new eSignFormEntry__c(); |
| | | eSignFormEntry.Name = '::电子签收单录入表'; |
| | | eSignFormEntry.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry.entryType__c = '经销商收货'; |
| | | // eSignFormEntry.createdDate = Date.today().addDays(-7); |
| | | insert eSignFormEntry; |
| | | //新建电子签收单7 |
| | | eSignFormEntry__c eSignFormEntry = new eSignFormEntry__c(); |
| | | eSignFormEntry.Name = '::电子签收单录入表'; |
| | | eSignFormEntry.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry.entryType__c = '经销商收货'; |
| | | // eSignFormEntry.createdDate = Date.today().addDays(-7); |
| | | insert eSignFormEntry; |
| | | |
| | | eSignFormEntry__c eSignFormEntry1 = new eSignFormEntry__c(); |
| | | eSignFormEntry1.Name = '::电子签收单录入表'; |
| | | eSignFormEntry1.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry1.entryType__c = '经销商收货'; |
| | | // eSignFormEntry1.createdDate = Date.today().addDays(-3); |
| | | insert eSignFormEntry1; |
| | | eSignFormEntry__c eSignFormEntry1 = new eSignFormEntry__c(); |
| | | eSignFormEntry1.Name = '::电子签收单录入表'; |
| | | eSignFormEntry1.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry1.entryType__c = '经销商收货'; |
| | | // eSignFormEntry1.createdDate = Date.today().addDays(-3); |
| | | insert eSignFormEntry1; |
| | | |
| | | eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c(); |
| | | eSignFormEntry2.Name = '::电子签收单录入表'; |
| | | eSignFormEntry2.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry2.entryType__c = '经销商收货'; |
| | | eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c(); |
| | | eSignFormEntry2.Name = '::电子签收单录入表'; |
| | | eSignFormEntry2.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry2.entryType__c = '经销商收货'; |
| | | eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencySignUpDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.agencyConfirmDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPScanDayBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPSignUpDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.agencySignUpDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencyConfirmDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPSignUpDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2); |
| | | // eSignFormEntry2.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry2; |
| | | // eSignFormEntry2.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry2; |
| | | |
| | | eSignFormEntry__c eSignFormEntry3 = new eSignFormEntry__c(); |
| | | eSignFormEntry3.Name = '::电子签收单录入表'; |
| | | eSignFormEntry3.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry3.entryType__c = '经销商确认'; |
| | | // eSignFormEntry3.createdDate = Date.today().addDays(-7); |
| | | insert eSignFormEntry3; |
| | | eSignFormEntry__c eSignFormEntry3 = new eSignFormEntry__c(); |
| | | eSignFormEntry3.Name = '::电子签收单录入表'; |
| | | eSignFormEntry3.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry3.entryType__c = '经销商确认'; |
| | | // eSignFormEntry3.createdDate = Date.today().addDays(-7); |
| | | insert eSignFormEntry3; |
| | | |
| | | eSignFormEntry__c eSignFormEntry4 = new eSignFormEntry__c(); |
| | | eSignFormEntry4.Name = '::电子签收单录入表'; |
| | | eSignFormEntry4.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry4.entryType__c = '经销商确认'; |
| | | // eSignFormEntry4.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry4; |
| | | eSignFormEntry__c eSignFormEntry4 = new eSignFormEntry__c(); |
| | | eSignFormEntry4.Name = '::电子签收单录入表'; |
| | | eSignFormEntry4.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry4.entryType__c = '经销商确认'; |
| | | // eSignFormEntry4.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry4; |
| | | |
| | | eSignFormEntry__c eSignFormEntry5 = new eSignFormEntry__c(); |
| | | eSignFormEntry5.Name = '::电子签收单录入表'; |
| | | eSignFormEntry5.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry5.entryType__c = '医院收货'; |
| | | // eSignFormEntry5.createdDate = Date.today().addDays(-7); |
| | | insert eSignFormEntry5; |
| | | eSignFormEntry__c eSignFormEntry5 = new eSignFormEntry__c(); |
| | | eSignFormEntry5.Name = '::电子签收单录入表'; |
| | | eSignFormEntry5.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry5.entryType__c = '医院收货'; |
| | | // eSignFormEntry5.createdDate = Date.today().addDays(-7); |
| | | insert eSignFormEntry5; |
| | | |
| | | eSignFormEntry__c eSignFormEntry6 = new eSignFormEntry__c(); |
| | | eSignFormEntry6.Name = '::电子签收单录入表'; |
| | | eSignFormEntry6.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry6.entryType__c = '医院收货'; |
| | | // eSignFormEntry6.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry6; |
| | | eSignFormEntry__c eSignFormEntry6 = new eSignFormEntry__c(); |
| | | eSignFormEntry6.Name = '::电子签收单录入表'; |
| | | eSignFormEntry6.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry6.entryType__c = '医院收货'; |
| | | // eSignFormEntry6.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry6; |
| | | |
| | | eSignFormEntry__c eSignFormEntry8 = new eSignFormEntry__c(); |
| | | eSignFormEntry8.Name = '::电子签收单录入表'; |
| | |
| | | eSignFormEntry7.Name = '::电子签收单录入表'; |
| | | eSignFormEntry7.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry7.entryType__c = '医院确认'; |
| | | |
| | | |
| | | insert eSignFormEntry7; |
| | | |
| | | //新建电子签收单明细 |
| | |
| | | //新建电子签收单明细录入表 |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry1.Name = '::电子签收单明细录入1'; |
| | | eSignFormLineItemEntry1.eSignFormEntry__c =eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry1.eSignFormEntry__c = eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry1; |
| | | |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry2.Name = '::电子签收单明细录入2'; |
| | | eSignFormLineItemEntry2.eSignFormEntry__c =eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry2.eSignFormEntry__c = eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry2; |
| | | |
| | | list<Attachment> attachmentList = new list<Attachment>(); |
| | | Attachment attach=new Attachment(); |
| | | attach.Name='Unit Test Attachment'; |
| | | Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body=bodyBlob; |
| | | attach.parentId=eSignFormEntry2.id; |
| | | list<Attachment> attachmentList = new List<Attachment>(); |
| | | Attachment attach = new Attachment(); |
| | | attach.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body = bodyBlob; |
| | | attach.parentId = eSignFormEntry2.id; |
| | | |
| | | attachmentList.add(attach); |
| | | |
| | | // insert attach; |
| | | Attachment attach1=new Attachment(); |
| | | attach1.Name='Unit Test Attachment'; |
| | | Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body=bodyBlob1; |
| | | attach1.parentId=eSignForm.id; |
| | | |
| | | Attachment attach1 = new Attachment(); |
| | | attach1.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body = bodyBlob1; |
| | | attach1.parentId = eSignForm.id; |
| | | |
| | | attachmentList.add(attach1); |
| | | |
| | | insert attachmentList; |
| | | |
| | | Test.startTest(); |
| | | |
| | | List<String> ids = new List<String>(); |
| | | ids.add(eSignForm.Id); |
| | | Database.executeBatch(new updateESignBatch(ids, true), 20); |
| | | Test.stopTest(); |
| | | } |
| | | |
| | | static testMethod void testMethod10() { |
| | | 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, Name |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('診療科 消化科', '診療科 呼吸科') |
| | | ORDER BY Name DESC |
| | | ]; |
| | | if (rectDpt.size() == 0) { |
| | | return; |
| | | } |
| | | List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '备品']; |
| | | if (rectAs.size() == 0) { |
| | | return; |
| | | } |
| | | |
| | | // insert hospital |
| | | Account company1 = new Account(); |
| | | company1.RecordTypeId = rectCo[0].Id; |
| | | company1.Name = '病院テスト1'; |
| | | company1.OCM_man_province_txt__c = '江西'; |
| | | List<Account> hps = new List<Account>{ company1 }; |
| | | insert hps; |
| | | |
| | | List<Account> dc1s = [ |
| | | SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c |
| | | FROM Account |
| | | WHERE Parent.Id = :company1.Id |
| | | ORDER BY Department_Class_Label__c |
| | | ]; |
| | | |
| | | Account depart1 = new Account(); |
| | | depart1.RecordTypeId = rectDpt[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Department_Class__c = dc1s[0].Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.OCM_man_province_txt__c = '江西'; |
| | | |
| | | insert new List<Account>{ depart1 }; |
| | | |
| | | List<Product2> prdList = new List<Product2>(); |
| | | Product2 prd1 = new Product2(); |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.Repair_Product_Code__c = 'HistoryPrd1_RP'; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Extend_new_product_gurantee__c = true; |
| | | prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60); |
| | | prd1.Extend_Gurantee_End__c = Date.today().addDays(60); |
| | | prdList.add(prd1); |
| | | insert prdList; |
| | | |
| | | Asset ast = new Asset(); |
| | | |
| | | ast.RecordTypeId = rectAs[0].Id; |
| | | ast.SerialNumber = 'abcdefg'; |
| | | ast.Name = '测试资产1'; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.Guarantee_period_for_products__c = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.Manage_type__c = '个体管理'; |
| | | ast.FirstApproveDate_old__c = Date.today().addDays(-30); |
| | | |
| | | Oly_TriggerHandler.bypass('AssetHandler'); |
| | | |
| | | insert ast; |
| | | |
| | | Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID, ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [ |
| | | SELECT id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity' |
| | | ]; |
| | | Opportunity opp = new Opportunity( |
| | | Name = 'testOpp1', |
| | | StageName = '引合', |
| | | CloseDate = Date.today(), |
| | | AccountId = depart1.Id, |
| | | Sales_Root__c = 'OCM直接販売', |
| | | Competitor__c = 'A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | ); |
| | | insert opp; |
| | | //注残 |
| | | Statu_Achievements__c Sac = new Statu_Achievements__c( |
| | | name = 'zhucan_one', |
| | | Opportunity__c = opp.id, |
| | | DeliveryDate__c = Date.today(), |
| | | ContractNO__c = 'ContractNO1', |
| | | ContractAmount__c = 1000 |
| | | ); |
| | | insert Sac; |
| | | |
| | | //新建电子签收单 |
| | | eSignForm__c eSignForm = new eSignForm__c(); |
| | | eSignForm.Statu_Achievements__c = Sac.Id; |
| | | eSignForm.Name = '::测试电子签收单'; |
| | | |
| | | insert eSignForm; |
| | | |
| | | //新建电子签收单7 |
| | | eSignFormEntry__c eSignFormEntry = new eSignFormEntry__c(); |
| | | eSignFormEntry.Name = '::电子签收单录入表'; |
| | | eSignFormEntry.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry.entryType__c = '经销商收货'; |
| | | // eSignFormEntry.createdDate = Date.today().addDays(-7); |
| | | insert eSignFormEntry; |
| | | |
| | | eSignFormEntry__c eSignFormEntry1 = new eSignFormEntry__c(); |
| | | eSignFormEntry1.Name = '::电子签收单录入表'; |
| | | eSignFormEntry1.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry1.entryType__c = '经销商收货'; |
| | | // eSignFormEntry1.createdDate = Date.today().addDays(-3); |
| | | insert eSignFormEntry1; |
| | | |
| | | eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c(); |
| | | eSignFormEntry2.Name = '::电子签收单录入表'; |
| | | eSignFormEntry2.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry2.entryType__c = '经销商收货'; |
| | | eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencySignUpDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencyConfirmDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPSignUpDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2); |
| | | // eSignFormEntry2.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry2; |
| | | |
| | | eSignFormEntry__c eSignFormEntry3 = new eSignFormEntry__c(); |
| | | eSignFormEntry3.Name = '::电子签收单录入表'; |
| | | eSignFormEntry3.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry3.entryType__c = '经销商确认'; |
| | | // eSignFormEntry3.createdDate = Date.today().addDays(-7); |
| | | insert eSignFormEntry3; |
| | | |
| | | eSignFormEntry__c eSignFormEntry4 = new eSignFormEntry__c(); |
| | | eSignFormEntry4.Name = '::电子签收单录入表'; |
| | | eSignFormEntry4.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry4.entryType__c = '经销商确认'; |
| | | // eSignFormEntry4.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry4; |
| | | |
| | | eSignFormEntry__c eSignFormEntry5 = new eSignFormEntry__c(); |
| | | eSignFormEntry5.Name = '::电子签收单录入表'; |
| | | eSignFormEntry5.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry5.entryType__c = '医院收货'; |
| | | // eSignFormEntry5.createdDate = Date.today().addDays(-7); |
| | | insert eSignFormEntry5; |
| | | |
| | | eSignFormEntry__c eSignFormEntry6 = new eSignFormEntry__c(); |
| | | eSignFormEntry6.Name = '::电子签收单录入表'; |
| | | eSignFormEntry6.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry6.entryType__c = '医院收货'; |
| | | // eSignFormEntry6.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry6; |
| | | |
| | | eSignFormEntry__c eSignFormEntry8 = new eSignFormEntry__c(); |
| | | eSignFormEntry8.Name = '::电子签收单录入表'; |
| | | eSignFormEntry8.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry8.entryType__c = '医院确认'; |
| | | |
| | | insert eSignFormEntry8; |
| | | |
| | | eSignFormEntry__c eSignFormEntry7 = new eSignFormEntry__c(); |
| | | eSignFormEntry7.Name = '::电子签收单录入表'; |
| | | eSignFormEntry7.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry7.entryType__c = '医院确认'; |
| | | |
| | | insert eSignFormEntry7; |
| | | |
| | | //新建电子签收单明细 |
| | | eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c(); |
| | | eSignFormLineItem.Name = '::电子签收单明细'; |
| | | eSignFormLineItem.eSignForm__c = eSignForm.Id; |
| | | |
| | | insert eSignFormLineItem; |
| | | |
| | | //新建电子签收单明细录入表 |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry1.Name = '::电子签收单明细录入1'; |
| | | eSignFormLineItemEntry1.eSignFormEntry__c = eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry1; |
| | | |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry2.Name = '::电子签收单明细录入2'; |
| | | eSignFormLineItemEntry2.eSignFormEntry__c = eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry2; |
| | | |
| | | list<Attachment> attachmentList = new List<Attachment>(); |
| | | Attachment attach = new Attachment(); |
| | | attach.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body = bodyBlob; |
| | | attach.parentId = eSignFormEntry2.id; |
| | | |
| | | attachmentList.add(attach); |
| | | |
| | | // insert attach; |
| | | Attachment attach1 = new Attachment(); |
| | | attach1.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body = bodyBlob1; |
| | | attach1.parentId = eSignForm.id; |
| | | |
| | | attachmentList.add(attach1); |
| | | |
| | | insert attachmentList; |
| | |
| | | String type = '经销商收货'; |
| | | Date startDate = Date.today(); |
| | | Date enDdate = Date.today().addDays(-1); |
| | | Database.executeBatch(new updateESignBatch(type,true), 20); |
| | | Database.executeBatch(new updateESignBatch(type, true), 20); |
| | | Test.stopTest(); |
| | | } |
| | | |
| | | //测试经销商收货 |
| | | static testMethod void testMethod11() { |
| | | 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; |
| | | } |
| | | List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 呼吸科']; |
| | | 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, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('診療科 消化科', '診療科 呼吸科') order by Name desc]; |
| | | List<RecordType> rectDpt = [ |
| | | SELECT Id, Name |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('診療科 消化科', '診療科 呼吸科') |
| | | ORDER BY Name DESC |
| | | ]; |
| | | if (rectDpt.size() == 0) { |
| | | return; |
| | | } |
| | | List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '备品']; |
| | | List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '备品']; |
| | | if (rectAs.size() == 0) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | // insert hospital |
| | | Account company1 = new Account(); |
| | | company1.RecordTypeId = rectCo[0].Id; |
| | | company1.Name = '病院テスト1'; |
| | | company1.OCM_man_province_txt__c = '江西'; |
| | | List<Account> hps = new Account[]{company1}; |
| | | List<Account> hps = new List<Account>{ company1 }; |
| | | insert hps; |
| | | |
| | | List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c]; |
| | | |
| | | |
| | | List<Account> dc1s = [ |
| | | SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c |
| | | FROM Account |
| | | WHERE Parent.Id = :company1.Id |
| | | ORDER BY Department_Class_Label__c |
| | | ]; |
| | | |
| | | Account depart1 = new Account(); |
| | | depart1.RecordTypeId = rectDpt[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Department_Class__c = dc1s[0].Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.OCM_man_province_txt__c = '江西'; |
| | | |
| | | insert new Account[] {depart1}; |
| | | |
| | | insert new List<Account>{ depart1 }; |
| | | |
| | | List<Product2> prdList = new List<Product2>(); |
| | | Product2 prd1 = new Product2(); |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.Repair_Product_Code__c = 'HistoryPrd1_RP'; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Extend_new_product_gurantee__c = true; |
| | | prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60); |
| | | prd1.Extend_Gurantee_End__c = Date.today().addDays(60); |
| | | prdList.add(prd1); |
| | | insert prdList; |
| | | |
| | | |
| | | Asset ast = new Asset(); |
| | | |
| | | ast.RecordTypeId = rectAs[0].Id; |
| | | ast.SerialNumber = 'abcdefg'; |
| | | ast.Name = '测试资产1'; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.Guarantee_period_for_products__c = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.Manage_type__c = '个体管理'; |
| | | ast.FirstApproveDate_old__c = Date.today().addDays(-30); |
| | | |
| | | Oly_TriggerHandler.bypass('AssetHandler'); |
| | | |
| | | insert ast; |
| | | |
| | | Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID , ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ]; |
| | | Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID, ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [ |
| | | SELECT id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity' |
| | | ]; |
| | | Opportunity opp = new Opportunity( |
| | | Name='testOpp1', |
| | | StageName='引合', |
| | | CloseDate=Date.today(), |
| | | AccountId=depart1.Id, |
| | | Sales_Root__c = '販売店', |
| | | Competitor__c ='A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | Name = 'testOpp1', |
| | | StageName = '引合', |
| | | CloseDate = Date.today(), |
| | | AccountId = depart1.Id, |
| | | Sales_Root__c = '販売店', |
| | | Competitor__c = 'A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | ); |
| | | insert opp; |
| | | |
| | |
| | | eSignFormEntry1.Name = '::电子签收单录入表1'; |
| | | eSignFormEntry1.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry1.entryType__c = '经销商收货'; |
| | | |
| | | |
| | | insert eSignFormEntry1; |
| | | |
| | | eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c(); |
| | |
| | | eSignFormEntry2.entryType__c = '经销商收货'; |
| | | eSignFormEntry2.IsSubmit__c = true; |
| | | eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencySignUpDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.agencyConfirmDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPScanDayBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPSignUpDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.agencySignUpDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencyConfirmDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPSignUpDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2); |
| | | // eSignFormEntry2.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry2; |
| | |
| | | eSignFormEntry3.Name = '::电子签收单录入表1'; |
| | | eSignFormEntry3.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry3.entryType__c = '医院收货'; |
| | | |
| | | |
| | | insert eSignFormEntry3; |
| | | |
| | | eSignFormEntry__c eSignFormEntry4 = new eSignFormEntry__c(); |
| | |
| | | eSignFormEntry4.IsSubmit__c = true; |
| | | // eSignFormEntry2.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry4; |
| | | |
| | | |
| | | //新建电子签收单明细 |
| | | eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c(); |
| | |
| | | |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry1.Name = '::电子签收单明细录入1'; |
| | | eSignFormLineItemEntry1.eSignFormEntry__c =eSignFormEntry1.Id; |
| | | eSignFormLineItemEntry1.eSignFormEntry__c = eSignFormEntry1.Id; |
| | | eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry1; |
| | | |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry2.Name = '::电子签收单明细录入2'; |
| | | eSignFormLineItemEntry2.eSignFormEntry__c =eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry2.eSignFormEntry__c = eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry2; |
| | | |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry3 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry3.Name = '::电子签收单明细录入3'; |
| | | eSignFormLineItemEntry3.eSignFormEntry__c =eSignFormEntry3.Id; |
| | | eSignFormLineItemEntry3.eSignFormEntry__c = eSignFormEntry3.Id; |
| | | eSignFormLineItemEntry3.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry3; |
| | | |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry4 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry4.Name = '::电子签收单明细录入4'; |
| | | eSignFormLineItemEntry4.eSignFormEntry__c =eSignFormEntry4.Id; |
| | | eSignFormLineItemEntry4.eSignFormEntry__c = eSignFormEntry4.Id; |
| | | eSignFormLineItemEntry4.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry4; |
| | | |
| | | list<Attachment> attachmentList = new list<Attachment>(); |
| | | Attachment attach=new Attachment(); |
| | | attach.Name='Unit Test Attachment'; |
| | | Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body=bodyBlob; |
| | | attach.parentId=eSignFormEntry2.id; |
| | | list<Attachment> attachmentList = new List<Attachment>(); |
| | | Attachment attach = new Attachment(); |
| | | attach.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body = bodyBlob; |
| | | attach.parentId = eSignFormEntry2.id; |
| | | |
| | | attachmentList.add(attach); |
| | | |
| | | // insert attach; |
| | | Attachment attach1=new Attachment(); |
| | | attach1.Name='Unit Test Attachment'; |
| | | Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body=bodyBlob1; |
| | | attach1.parentId=eSignForm.id; |
| | | |
| | | Attachment attach1 = new Attachment(); |
| | | attach1.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body = bodyBlob1; |
| | | attach1.parentId = eSignForm.id; |
| | | |
| | | attachmentList.add(attach1); |
| | | |
| | | insert attachmentList; |
| | |
| | | } |
| | | //测试医院确认 |
| | | static testMethod void testMethod12() { |
| | | 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; |
| | | } |
| | | List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 呼吸科']; |
| | | 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, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('診療科 消化科', '診療科 呼吸科') order by Name desc]; |
| | | List<RecordType> rectDpt = [ |
| | | SELECT Id, Name |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('診療科 消化科', '診療科 呼吸科') |
| | | ORDER BY Name DESC |
| | | ]; |
| | | if (rectDpt.size() == 0) { |
| | | return; |
| | | } |
| | | List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '备品']; |
| | | List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '备品']; |
| | | if (rectAs.size() == 0) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | // insert hospital |
| | | Account company1 = new Account(); |
| | | company1.RecordTypeId = rectCo[0].Id; |
| | | company1.Name = '病院テスト1'; |
| | | company1.OCM_man_province_txt__c = '江西'; |
| | | List<Account> hps = new Account[]{company1}; |
| | | List<Account> hps = new List<Account>{ company1 }; |
| | | insert hps; |
| | | |
| | | List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c]; |
| | | |
| | | |
| | | List<Account> dc1s = [ |
| | | SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c |
| | | FROM Account |
| | | WHERE Parent.Id = :company1.Id |
| | | ORDER BY Department_Class_Label__c |
| | | ]; |
| | | |
| | | Account depart1 = new Account(); |
| | | depart1.RecordTypeId = rectDpt[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Department_Class__c = dc1s[0].Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.OCM_man_province_txt__c = '江西'; |
| | | |
| | | insert new Account[] {depart1}; |
| | | |
| | | insert new List<Account>{ depart1 }; |
| | | |
| | | List<Product2> prdList = new List<Product2>(); |
| | | Product2 prd1 = new Product2(); |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.Repair_Product_Code__c = 'HistoryPrd1_RP'; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Extend_new_product_gurantee__c = true; |
| | | prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60); |
| | | prd1.Extend_Gurantee_End__c = Date.today().addDays(60); |
| | | prdList.add(prd1); |
| | | insert prdList; |
| | | |
| | | |
| | | Asset ast = new Asset(); |
| | | |
| | | ast.RecordTypeId = rectAs[0].Id; |
| | | ast.SerialNumber = 'abcdefg'; |
| | | ast.Name = '测试资产1'; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.Guarantee_period_for_products__c = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.Manage_type__c = '个体管理'; |
| | | ast.FirstApproveDate_old__c = Date.today().addDays(-30); |
| | | |
| | | Oly_TriggerHandler.bypass('AssetHandler'); |
| | | |
| | | insert ast; |
| | | |
| | | Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID , ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ]; |
| | | Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID, ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [ |
| | | SELECT id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity' |
| | | ]; |
| | | Opportunity opp = new Opportunity( |
| | | Name='testOpp1', |
| | | StageName='引合', |
| | | CloseDate=Date.today(), |
| | | AccountId=depart1.Id, |
| | | Sales_Root__c = '販売店', |
| | | Competitor__c ='A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | Name = 'testOpp1', |
| | | StageName = '引合', |
| | | CloseDate = Date.today(), |
| | | AccountId = depart1.Id, |
| | | Sales_Root__c = '販売店', |
| | | Competitor__c = 'A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | ); |
| | | insert opp; |
| | | |
| | |
| | | eSignFormEntry1.Name = '::电子签收单录入表1'; |
| | | eSignFormEntry1.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry1.entryType__c = '医院确认'; |
| | | |
| | | |
| | | insert eSignFormEntry1; |
| | | |
| | | eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c(); |
| | |
| | | // eSignFormEntry2.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry2; |
| | | |
| | | |
| | | //新建电子签收单明细 |
| | | eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c(); |
| | | eSignFormLineItem.Name = '::电子签收单明细'; |
| | |
| | | |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry1.Name = '::电子签收单明细录入1'; |
| | | eSignFormLineItemEntry1.eSignFormEntry__c =eSignFormEntry1.Id; |
| | | eSignFormLineItemEntry1.eSignFormEntry__c = eSignFormEntry1.Id; |
| | | eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry1; |
| | | |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry2.Name = '::电子签收单明细录入2'; |
| | | eSignFormLineItemEntry2.eSignFormEntry__c =eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry2.eSignFormEntry__c = eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry2; |
| | | |
| | | list<Attachment> attachmentList = new list<Attachment>(); |
| | | Attachment attach=new Attachment(); |
| | | attach.Name='Unit Test Attachment'; |
| | | Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body=bodyBlob; |
| | | attach.parentId=eSignFormEntry2.id; |
| | | list<Attachment> attachmentList = new List<Attachment>(); |
| | | Attachment attach = new Attachment(); |
| | | attach.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body = bodyBlob; |
| | | attach.parentId = eSignFormEntry2.id; |
| | | |
| | | attachmentList.add(attach); |
| | | |
| | | // insert attach; |
| | | Attachment attach1=new Attachment(); |
| | | attach1.Name='Unit Test Attachment'; |
| | | Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body=bodyBlob1; |
| | | attach1.parentId=eSignForm.id; |
| | | |
| | | Attachment attach1 = new Attachment(); |
| | | attach1.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body = bodyBlob1; |
| | | attach1.parentId = eSignForm.id; |
| | | |
| | | attachmentList.add(attach1); |
| | | |
| | | insert attachmentList; |
| | |
| | | Test.stopTest(); |
| | | } |
| | | |
| | | //测试经销商收货 |
| | | //测试经销商收货 |
| | | static testMethod void testMethod13() { |
| | | 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; |
| | | } |
| | | List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 呼吸科']; |
| | | 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, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('診療科 消化科', '診療科 呼吸科') order by Name desc]; |
| | | List<RecordType> rectDpt = [ |
| | | SELECT Id, Name |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('診療科 消化科', '診療科 呼吸科') |
| | | ORDER BY Name DESC |
| | | ]; |
| | | if (rectDpt.size() == 0) { |
| | | return; |
| | | } |
| | | List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '备品']; |
| | | List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '备品']; |
| | | if (rectAs.size() == 0) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | // insert hospital |
| | | Account company1 = new Account(); |
| | | company1.RecordTypeId = rectCo[0].Id; |
| | | company1.Name = '病院テスト1'; |
| | | company1.OCM_man_province_txt__c = '江西'; |
| | | List<Account> hps = new Account[]{company1}; |
| | | List<Account> hps = new List<Account>{ company1 }; |
| | | insert hps; |
| | | |
| | | List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c]; |
| | | |
| | | |
| | | List<Account> dc1s = [ |
| | | SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c |
| | | FROM Account |
| | | WHERE Parent.Id = :company1.Id |
| | | ORDER BY Department_Class_Label__c |
| | | ]; |
| | | |
| | | Account depart1 = new Account(); |
| | | depart1.RecordTypeId = rectDpt[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Department_Class__c = dc1s[0].Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.OCM_man_province_txt__c = '江西'; |
| | | |
| | | insert new Account[] {depart1}; |
| | | |
| | | insert new List<Account>{ depart1 }; |
| | | |
| | | List<Product2> prdList = new List<Product2>(); |
| | | Product2 prd1 = new Product2(); |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.Repair_Product_Code__c = 'HistoryPrd1_RP'; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Extend_new_product_gurantee__c = true; |
| | | prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60); |
| | | prd1.Extend_Gurantee_End__c = Date.today().addDays(60); |
| | | prdList.add(prd1); |
| | | insert prdList; |
| | | |
| | | |
| | | Asset ast = new Asset(); |
| | | |
| | | ast.RecordTypeId = rectAs[0].Id; |
| | | ast.SerialNumber = 'abcdefg'; |
| | | ast.Name = '测试资产1'; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.Guarantee_period_for_products__c = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.Manage_type__c = '个体管理'; |
| | | ast.FirstApproveDate_old__c = Date.today().addDays(-30); |
| | | |
| | | Oly_TriggerHandler.bypass('AssetHandler'); |
| | | |
| | | insert ast; |
| | | |
| | | Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID , ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ]; |
| | | Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID, ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [ |
| | | SELECT id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity' |
| | | ]; |
| | | Opportunity opp = new Opportunity( |
| | | Name='testOpp1', |
| | | StageName='引合', |
| | | CloseDate=Date.today(), |
| | | AccountId=depart1.Id, |
| | | Sales_Root__c = '販売店', |
| | | Competitor__c ='A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | Name = 'testOpp1', |
| | | StageName = '引合', |
| | | CloseDate = Date.today(), |
| | | AccountId = depart1.Id, |
| | | Sales_Root__c = '販売店', |
| | | Competitor__c = 'A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | ); |
| | | insert opp; |
| | | |
| | |
| | | eSignForm.RC_Manager__c = UserInfo.getUserId(); |
| | | // eSignForm.RC_Manager2__c = UserInfo.getUserId(); |
| | | // eSignForm.RC_Manager3__c = UserInfo.getUserId(); |
| | | eSignForm.agencyRejectDate__c = Date.today().addDays(2); |
| | | eSignForm.HPRejectDate__c = Date.today().addDays(2); |
| | | |
| | | |
| | | eSignForm.agencyRejectDate__c = Date.today().addDays(2); |
| | | eSignForm.HPRejectDate__c = Date.today().addDays(2); |
| | | |
| | | insert eSignForm; |
| | | |
| | | /* eSignFormEntry__c eSignFormEntry1 = new eSignFormEntry__c(); |
| | | /* eSignFormEntry__c eSignFormEntry1 = new eSignFormEntry__c(); |
| | | eSignFormEntry1.Name = '::电子签收单录入表1'; |
| | | eSignFormEntry1.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry1.entryType__c = '经销商收货'; |
| | |
| | | // eSignFormEntry2.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry2;*/ |
| | | |
| | | |
| | | //新建电子签收单明细 |
| | | eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c(); |
| | | eSignFormLineItem.Name = '::电子签收单明细'; |
| | | eSignFormLineItem.eSignForm__c = eSignForm.Id; |
| | | |
| | | |
| | | insert eSignFormLineItem; |
| | | |
| | |
| | | |
| | | insert eSignFormLineItemEntry2;*/ |
| | | |
| | | list<Attachment> attachmentList = new list<Attachment>(); |
| | | Attachment attach=new Attachment(); |
| | | attach.Name='Unit Test Attachment'; |
| | | Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body=bodyBlob; |
| | | attach.parentId=eSignForm.id; |
| | | list<Attachment> attachmentList = new List<Attachment>(); |
| | | Attachment attach = new Attachment(); |
| | | attach.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body = bodyBlob; |
| | | attach.parentId = eSignForm.id; |
| | | attach.ContentType = 'application/pdf'; |
| | | |
| | | attachmentList.add(attach); |
| | | |
| | | // insert attach; |
| | | Attachment attach1=new Attachment(); |
| | | attach1.Name='Unit Test Attachment'; |
| | | Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body=bodyBlob1; |
| | | attach1.parentId=eSignForm.id; |
| | | Attachment attach1 = new Attachment(); |
| | | attach1.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body = bodyBlob1; |
| | | attach1.parentId = eSignForm.id; |
| | | attach1.ContentType = 'application/pdf'; |
| | | |
| | | |
| | | attachmentList.add(attach1); |
| | | |
| | | insert attachmentList; |
| | | |
| | | Test.startTest(); |
| | | |
| | | |
| | | Database.executeBatch(new updateESignBatch(), 20); |
| | | Test.stopTest(); |
| | | |
| | | } |
| | | //跑单独方法 |
| | | //跑单独方法 |
| | | @isTest |
| | | private static void test_upsertESignLineItems() { |
| | | |
| | | 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; |
| | | } |
| | | List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 呼吸科']; |
| | | 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, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('診療科 消化科', '診療科 呼吸科') order by Name desc]; |
| | | List<RecordType> rectDpt = [ |
| | | SELECT Id, Name |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('診療科 消化科', '診療科 呼吸科') |
| | | ORDER BY Name DESC |
| | | ]; |
| | | if (rectDpt.size() == 0) { |
| | | return; |
| | | } |
| | | List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '备品']; |
| | | List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '备品']; |
| | | if (rectAs.size() == 0) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | // insert hospital |
| | | Account company1 = new Account(); |
| | | company1.RecordTypeId = rectCo[0].Id; |
| | | company1.Name = '病院テスト1'; |
| | | company1.OCM_man_province_txt__c = '江西'; |
| | | List<Account> hps = new Account[]{company1}; |
| | | List<Account> hps = new List<Account>{ company1 }; |
| | | insert hps; |
| | | |
| | | List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c]; |
| | | |
| | | |
| | | List<Account> dc1s = [ |
| | | SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c |
| | | FROM Account |
| | | WHERE Parent.Id = :company1.Id |
| | | ORDER BY Department_Class_Label__c |
| | | ]; |
| | | |
| | | Account depart1 = new Account(); |
| | | depart1.RecordTypeId = rectDpt[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Department_Class__c = dc1s[0].Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.OCM_man_province_txt__c = '江西'; |
| | | |
| | | insert new Account[] {depart1}; |
| | | |
| | | insert new List<Account>{ depart1 }; |
| | | |
| | | List<Product2> prdList = new List<Product2>(); |
| | | Product2 prd1 = new Product2(); |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.Repair_Product_Code__c = 'HistoryPrd1_RP'; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Extend_new_product_gurantee__c = true; |
| | | prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60); |
| | | prd1.Extend_Gurantee_End__c = Date.today().addDays(60); |
| | | prdList.add(prd1); |
| | | insert prdList; |
| | | |
| | | |
| | | Asset ast = new Asset(); |
| | | |
| | | ast.RecordTypeId = rectAs[0].Id; |
| | | ast.SerialNumber = 'abcdefg'; |
| | | ast.Name = '测试资产1'; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.Guarantee_period_for_products__c = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.Manage_type__c = '个体管理'; |
| | | ast.FirstApproveDate_old__c = Date.today().addDays(-30); |
| | | |
| | | Oly_TriggerHandler.bypass('AssetHandler'); |
| | | |
| | | insert ast; |
| | | |
| | | Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID , ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ]; |
| | | Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID, ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [ |
| | | SELECT id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity' |
| | | ]; |
| | | Opportunity opp = new Opportunity( |
| | | Name='testOpp1', |
| | | StageName='引合', |
| | | CloseDate=Date.today(), |
| | | AccountId=depart1.Id, |
| | | Sales_Root__c = '販売店', |
| | | Competitor__c ='A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | Name = 'testOpp1', |
| | | StageName = '引合', |
| | | CloseDate = Date.today(), |
| | | AccountId = depart1.Id, |
| | | Sales_Root__c = '販売店', |
| | | Competitor__c = 'A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | ); |
| | | insert opp; |
| | | |
| | |
| | | ); |
| | | insert Sac; |
| | | |
| | | |
| | | //新建电子签收单 |
| | | eSignForm__c eSignForm = new eSignForm__c(); |
| | | eSignForm.Statu_Achievements__c = Sac.Id; |
| | | eSignForm.Name = '::测试电子签收单'; |
| | | |
| | | |
| | | insert eSignForm; |
| | | |
| | | |
| | | |
| | | //新建电子签收单明细 |
| | | eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c(); |
| | |
| | | eSignFormLineItem.eSignForm__c = eSignForm.Id; |
| | | |
| | | insert eSignFormLineItem; |
| | | |
| | | |
| | | |
| | | /*list<Attachment> attachmentList = new list<Attachment>(); |
| | | Attachment attach=new Attachment(); |
| | |
| | | |
| | | // } |
| | | |
| | | |
| | | OCM_Management_Province__c mp1 = new OCM_Management_Province__c(); |
| | | mp1.Name = '江西'; |
| | | mp1.GI_assistant__c = UserInfo.getUserId(); |
| | |
| | | |
| | | insert mp1; |
| | | |
| | | List <String> provinceList = new List<String>{'江西'}; |
| | | Map < Id, String > provinceMap = new Map < Id, String >(); |
| | | List<String> provinceList = new List<String>{ '江西' }; |
| | | Map<Id, String> provinceMap = new Map<Id, String>(); |
| | | Id i = eSignForm.id; |
| | | // provinceMap.put(i,'北京市'); |
| | | // provinceMap.put(i,'山西省'); |
| | | provinceMap.put(i,'江西'); |
| | | provinceMap.put(i, '江西'); |
| | | |
| | | List < eSignForm__c > eSignFormList = new List < eSignForm__c >(); |
| | | List<eSignForm__c> eSignFormList = new List<eSignForm__c>(); |
| | | eSignFormList.add(eSignForm); |
| | | |
| | | updateESignBatch.updateOwner(provinceList,provinceMap,eSignFormList,true); |
| | | |
| | | updateESignBatch.updateOwner(provinceList, provinceMap, eSignFormList, true); |
| | | } |
| | | |
| | | //测试经销商收货 |
| | | //测试经销商收货 |
| | | static testMethod void testMethod14() { |
| | | 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; |
| | | } |
| | | List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 呼吸科']; |
| | | 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, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('診療科 消化科', '診療科 呼吸科') order by Name desc]; |
| | | List<RecordType> rectDpt = [ |
| | | SELECT Id, Name |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('診療科 消化科', '診療科 呼吸科') |
| | | ORDER BY Name DESC |
| | | ]; |
| | | if (rectDpt.size() == 0) { |
| | | return; |
| | | } |
| | | List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '备品']; |
| | | List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '备品']; |
| | | if (rectAs.size() == 0) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | // insert hospital |
| | | Account company1 = new Account(); |
| | | company1.RecordTypeId = rectCo[0].Id; |
| | | company1.Name = '病院テスト1'; |
| | | company1.OCM_man_province_txt__c = '江西'; |
| | | List<Account> hps = new Account[]{company1}; |
| | | List<Account> hps = new List<Account>{ company1 }; |
| | | insert hps; |
| | | |
| | | List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c]; |
| | | |
| | | |
| | | List<Account> dc1s = [ |
| | | SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c |
| | | FROM Account |
| | | WHERE Parent.Id = :company1.Id |
| | | ORDER BY Department_Class_Label__c |
| | | ]; |
| | | |
| | | Account depart1 = new Account(); |
| | | depart1.RecordTypeId = rectDpt[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Department_Class__c = dc1s[0].Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | depart1.OCM_man_province_txt__c = '江西'; |
| | | |
| | | insert new Account[] {depart1}; |
| | | |
| | | insert new List<Account>{ depart1 }; |
| | | |
| | | List<Product2> prdList = new List<Product2>(); |
| | | Product2 prd1 = new Product2(); |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.ProductCode_Ext__c = 'HistoryPrd1'; |
| | | prd1.ProductCode = 'HistoryPrd1'; |
| | | prd1.Repair_Product_Code__c = 'HistoryPrd1_RP'; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Name = 'HistoryPrd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Extend_new_product_gurantee__c = true; |
| | | prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60); |
| | | prd1.Extend_Gurantee_End__c = Date.today().addDays(60); |
| | | prdList.add(prd1); |
| | | insert prdList; |
| | | |
| | | |
| | | Asset ast = new Asset(); |
| | | |
| | | ast.RecordTypeId = rectAs[0].Id; |
| | | ast.SerialNumber = 'abcdefg'; |
| | | ast.Name = '测试资产1'; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.AccountId = depart1.Id; |
| | | ast.Department_Class__c = dc1s[0].Id; |
| | | ast.Hospital__c = company1.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.Guarantee_period_for_products__c = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | ast.Manage_type__c = '个体管理'; |
| | | ast.FirstApproveDate_old__c = Date.today().addDays(-30); |
| | | |
| | | Oly_TriggerHandler.bypass('AssetHandler'); |
| | | |
| | | insert ast; |
| | | |
| | | Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID , ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ]; |
| | | Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id]; |
| | | |
| | | String RecordTypeID = ast1.RecordTypeID__c; |
| | | |
| | | System.assertEquals(RecordTypeID, ast.RecordTypeId); |
| | | |
| | | RecordType rectOpp = [ |
| | | SELECT id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity' |
| | | ]; |
| | | Opportunity opp = new Opportunity( |
| | | Name='testOpp1', |
| | | StageName='引合', |
| | | CloseDate=Date.today(), |
| | | AccountId=depart1.Id, |
| | | Sales_Root__c = '販売店', |
| | | Competitor__c ='A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | Name = 'testOpp1', |
| | | StageName = '引合', |
| | | CloseDate = Date.today(), |
| | | AccountId = depart1.Id, |
| | | Sales_Root__c = '販売店', |
| | | Competitor__c = 'A', |
| | | Click_Close_Date__c = null, |
| | | RecordType = rectOpp, |
| | | Trade__c = '内貿' |
| | | ); |
| | | insert opp; |
| | | |
| | |
| | | eSignForm__c eSignForm = new eSignForm__c(); |
| | | eSignForm.Statu_Achievements__c = Sac.Id; |
| | | eSignForm.Name = '::测试电子签收单'; |
| | | eSignForm.agencyRejectDate__c = Date.today().addDays(2); |
| | | eSignForm.HPRejectDate__c = Date.today().addDays(2); |
| | | |
| | | eSignForm.agencyRejectDate__c = Date.today().addDays(2); |
| | | eSignForm.HPRejectDate__c = Date.today().addDays(2); |
| | | |
| | | insert eSignForm; |
| | | |
| | |
| | | eSignFormEntry1.eSignForm__c = eSignForm.Id; |
| | | eSignFormEntry1.entryType__c = '经销商收货'; |
| | | |
| | | |
| | | insert eSignFormEntry1; |
| | | |
| | | eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c(); |
| | |
| | | eSignFormEntry2.entryType__c = '经销商收货'; |
| | | eSignFormEntry2.IsSubmit__c = true; |
| | | eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencySignUpDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.agencyConfirmDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPScanDayBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.HPSignUpDateBack__c =Date.today().addDays(-2); |
| | | eSignFormEntry2.agencySignUpDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.agencyConfirmDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPScanDayBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPSignUpDateBack__c = Date.today().addDays(-2); |
| | | eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2); |
| | | // eSignFormEntry2.createdDate = Date.today().addDays(-2); |
| | | insert eSignFormEntry2; |
| | | |
| | | |
| | | //新建电子签收单明细 |
| | | eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c(); |
| | |
| | | |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry1.Name = '::电子签收单明细录入1'; |
| | | eSignFormLineItemEntry1.eSignFormEntry__c =eSignFormEntry1.Id; |
| | | eSignFormLineItemEntry1.eSignFormEntry__c = eSignFormEntry1.Id; |
| | | eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry1; |
| | | |
| | | eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c(); |
| | | eSignFormLineItemEntry2.Name = '::电子签收单明细录入2'; |
| | | eSignFormLineItemEntry2.eSignFormEntry__c =eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry2.eSignFormEntry__c = eSignFormEntry2.Id; |
| | | eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id; |
| | | |
| | | insert eSignFormLineItemEntry2; |
| | | |
| | | list<Attachment> attachmentList = new list<Attachment>(); |
| | | Attachment attach=new Attachment(); |
| | | attach.Name='Unit Test Attachment'; |
| | | Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body=bodyBlob; |
| | | attach.parentId=eSignFormEntry2.id; |
| | | list<Attachment> attachmentList = new List<Attachment>(); |
| | | Attachment attach = new Attachment(); |
| | | attach.Name = 'Unit Test Attachment'; |
| | | Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body = bodyBlob; |
| | | attach.parentId = eSignFormEntry2.id; |
| | | attach.ContentType = 'application/pdf'; |
| | | |
| | | attachmentList.add(attach); |
| | | |
| | | // insert attach; |
| | | Attachment attach1=new Attachment(); |
| | | attach1.Name='H-65224941-20200923--10.jpg'; |
| | | Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body=bodyBlob1; |
| | | attach1.parentId=eSignForm.id; |
| | | Attachment attach1 = new Attachment(); |
| | | attach1.Name = 'H-65224941-20200923--10.jpg'; |
| | | Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach1.body = bodyBlob1; |
| | | attach1.parentId = eSignForm.id; |
| | | attach1.ContentType = 'application/pdf'; |
| | | |
| | | |
| | | |
| | | attachmentList.add(attach1); |
| | | |
| | | Attachment attach2=new Attachment(); |
| | | attach2.Name='A-65224945-20200928--8.jpg'; |
| | | Blob bodyBlob2=Blob.valueOf('Unit Test Attachment Body'); |
| | | attach2.body=bodyBlob2; |
| | | attach2.parentId=eSignForm.id; |
| | | Attachment attach2 = new Attachment(); |
| | | attach2.Name = 'A-65224945-20200928--8.jpg'; |
| | | Blob bodyBlob2 = Blob.valueOf('Unit Test Attachment Body'); |
| | | attach2.body = bodyBlob2; |
| | | attach2.parentId = eSignForm.id; |
| | | attach2.ContentType = 'application/pdf'; |
| | | |
| | | |
| | | |
| | | attachmentList.add(attach2); |
| | | |
| | | insert attachmentList; |
| | | |
| | | Test.startTest(); |
| | | |
| | | |
| | | Database.executeBatch(new updateESignBatch(), 20); |
| | | Test.stopTest(); |
| | | } |
| | | |
| | | static testMethod void testMethod15(){ |
| | | Test.startTest(); |
| | | updateESignBatch.improveTestRate(); |
| | | Test.stopTest(); |
| | | } |
| | | } |
| | | } |