@isTest
|
private class RepairOrderHandlerTest {
|
final static string ra1 = [select id , SobjectType, developername from recordtype where SobjectType='Rental_Apply__c' and developername='StandardRequest'][0].id;
|
final static string acc1 = [select id , SobjectType, developername from recordtype where SobjectType='Account' and developername='HP'][0].id;
|
|
static testMethod void testMethod1() {
|
RepairSubOrder__c subOrder = new RepairSubOrder__c();
|
subOrder.AttachmentDownload__c = true;
|
subOrder.AttachmentLink__c = 'https://albsylfw.s3.cn-northwest-1.amazonaws.com.cn/20211220/14/11/30/lessthan12/5e8cb69e-f935-48f5-825e-b8344d60f6d4.zip';
|
subOrder.AttachmentName__c = '测试附件下载';
|
insert subOrder;
|
Account hp = new Account(RecordTypeId = acc1, Name = 'AccountTestHp1');
|
insert hp;
|
|
Product2 prd1 = new Product2();
|
prd1.ProductCode_Ext__c = 'Prd1';
|
prd1.ProductCode = 'Prd1';
|
prd1.Repair_Product_Code__c = 'Prd1_RP';
|
prd1.Name = 'Prd1';
|
prd1.Manual_Entry__c = false;
|
prd1.Category2__c = '本体';
|
prd1.Category3__c = '纤维镜';
|
prd1.Category4__c = 'CV';
|
prd1.Category5__c = '260SL系列';
|
prd1.Asset_Model_No__c = '1001';
|
insert prd1;
|
|
Asset ast1 = new Asset();
|
ast1.Name = '保有設備1';
|
ast1.Hospital__c = hp.Id;
|
ast1.AccountId = hp.Id;
|
ast1.Product2Id = prd1.Id;
|
ast1.SerialNumber = 'SerialNumber1';
|
ast1.Guarantee_period_for_products__c = Date.today();
|
ast1.InstallDate = Date.today();
|
insert ast1;
|
|
final string acc2 = [select id , SobjectType, developername from recordtype where SobjectType='Account' and developername='Department_Class_BF'][0].id; //戦略科室分類 呼吸科
|
Account Department_Class_BF = new Account(RecordTypeId = acc2, Name = 'Department_Class_BF',ParentId=hp.id,Department_Class_Label__c='呼吸科');
|
insert Department_Class_BF;
|
final string acc3 = [select id , SobjectType, developername from recordtype where SobjectType='Account' and developername='Department_BF'][0].id; //戦略科室分類 呼吸科
|
Account Department_BF = new Account(RecordTypeId = acc3, Name = 'Department_BF',ParentId=Department_Class_BF.id,Hospital__c=hp.id,Department_Class__c=Department_Class_BF.id);
|
insert Department_BF;
|
|
Repair__c repair1 = new Repair__c();
|
repair1.Service_Repair_No__c = 'repair1';
|
repair1.Hospital__c = hp.Id;
|
repair1.Account__c = Department_BF.Id;
|
repair1.Department_Class__c = Department_Class_BF.id;
|
repair1.Delivered_Product__c = ast1.Id;
|
repair1.Repair_List_Price__c = 100;
|
repair1.Billing_Amount__c = 10;
|
repair1.Paid_Amount__c = 1;
|
repair1.Failure_Occurrence_Date__c = Date.today().addDays(-1);
|
repair1.Repair_Returned_To_HP_Date__c = Date.today().addDays(3);
|
repair1.Repair_Shipped_Date__c = Date.today().addDays(1);
|
repair1.RepairSubOrder__c = subOrder.Id;
|
repair1.DeliveryLogisticsMode__c = '其他';
|
|
insert repair1;
|
}
|
}
|