@isTest private class ISO_DemandOperAndDemonsNewControllerTest { static testMethod void testMethod1() { Oly_TriggerHandler.bypass('ContactTrigger'); Oly_TriggerHandler.bypass('ContactTriggerHandler'); Oly_TriggerHandler.bypass('PIHelper'); Oly_TriggerHandler.bypass('ContactTrigger'); Profile pf = [select Id from Profile where Id =:system.label.ProfileId_SystemAdmin]; RecordType rtHP = [select id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName =:'HP']; RecordType rtDepClass = [select id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName =:'Department_Class_ENT']; // 耳鼻喉科 RecordType rtDep = [select id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName =:'Department_ENT']; RecordType rtDoc = [select id from RecordType where IsActive = true and SobjectType = 'Contact' and DeveloperName =:'Doctor']; Address_Level__c al = new Address_Level__c(); al.Name = '東京'; al.Level1_Code__c = 'CN-99'; al.Level1_Sys_No__c = '999999'; insert al; Address_Level2__c al2 = new Address_Level2__c(); al2.Level1_Code__c = 'CN-99'; al2.Level1_Sys_No__c = '999999'; al2.Level1_Name__c = '東京'; al2.Name = '渋谷区'; al2.Level2_Code__c = 'CN-9999'; al2.Level2_Sys_No__c = '9999999'; al2.Address_Level__c = al.id; insert al2; // 病院を作る Account hospital = new Account(); String rid = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id; hospital.Name = 'test hospital'; hospital.recordtypeId = rid; hospital.Is_Active__c = '有効'; insert hospital; // 戦略科室を得る Account[] strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_OTH']; // 診療科を作る Account dep = new Account(); dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_OTH'].id; dep.Name = 'test dep'; dep.AgentCode_Ext__c = '9999998'; dep.ParentId = strategicDep[0].Id; dep.Department_Class__c = strategicDep[0].Id; dep.Hospital__c = hospital.Id; insert dep; List conList = new List(); Contact con1 = new Contact(); con1.Firstname='ZZ1'; con1.LastName = '取引先責任者1'; con1.RecordTypeId = rtDoc.id; con1.AccountId = dep.Id; conList.add(con1); insert conList; RecordType Type = [select id from RecordType where DeveloperName='SI_Oppor']; String TypeID = Type.Id; Opportunity opp1 = new Opportunity(); opp1.Name = '引合1'; opp1.AccountId = dep.Id; opp1.Opportunity_Category__c = 'ENT'; opp1.Trade__c = '外貿'; opp1.StageName = '引合'; opp1.CurrencyIsoCode = 'CNY'; opp1.Close_Forecasted_Date__c = date.today().addMonths(1); opp1.CloseDate = date.today().addMonths(1); opp1.Competitor__c = 'B'; opp1.Purchase_Type__c ='SI(手術室案件)'; opp1.Sales_Root__c = 'OCM直接販売'; opp1.Hospital__c = hospital.id; opp1.StageName = '引合'; opp1.RecordTypeid = TypeID; insert opp1; // SI需求表 IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c(); ISOhead.Operating_Room_Count__c = '2'; ISOhead.Demonstration_Number__c = '1'; ISOhead.Opportunity_ID__c = opp1.Id; ISOhead.Transmission_Mode__c = '光线直连'; ISOhead.Demand_DemonstrationType__c = 'HD示教系统'; ISOhead.OperatingRoomName__c = 'test1'; insert ISOhead; ISO_DemandOperAndDemonsJumpController isojump = new ISO_DemandOperAndDemonsJumpController(ISOhead); isojump.init(); // SI询价手术间 List ISOdoList = new List(); IS_Opportunity_Demand_Operating__c ISOdo11 = new IS_Opportunity_Demand_Operating__c(); ISOdo11.Name__c = '手术间1'; ISOdo11.IS_Opportunity_Demand__c = ISOhead.Id; ISOdo11.Operating_Room_Type__c = 'HD整体手术间'; ISOdoList.add(ISOdo11); IS_Opportunity_Demand_Operating__c ISOdo12 = new IS_Opportunity_Demand_Operating__c(); ISOdo12.Name__c = '手术间1'; ISOdo12.IS_Opportunity_Demand__c = ISOhead.Id; ISOdo12.Operating_Room_Type__c= '3D整体手术间'; ISOdoList.add(ISOdo12); IS_Opportunity_Demand_Operating__c ISOdo13 = new IS_Opportunity_Demand_Operating__c(); ISOdo13.Name__c = '手术间1'; ISOdo13.IS_Opportunity_Demand__c = ISOhead.Id; ISOdo13.Operating_Room_Type__c= '4K整体手术间'; ISOdoList.add(ISOdo13); IS_Opportunity_Demand_Operating__c ISOdo14 = new IS_Opportunity_Demand_Operating__c(); ISOdo14.Name__c = '手术间1'; ISOdo14.IS_Opportunity_Demand__c = ISOhead.Id; ISOdo14.Operating_Room_Type__c= '3D/4K整体手术间'; ISOdoList.add(ISOdo14); IS_Opportunity_Demand_Operating__c ISOdo21 = new IS_Opportunity_Demand_Operating__c(); ISOdo21.Name__c = '手术间2'; ISOdo21.IS_Opportunity_Demand__c = ISOhead.Id; ISOdo21.Operating_Room_Type__c = 'HD整体手术间'; ISOdoList.add(ISOdo21); IS_Opportunity_Demand_Operating__c ISOdo22 = new IS_Opportunity_Demand_Operating__c(); ISOdo22.Name__c = '手术间2'; ISOdo22.IS_Opportunity_Demand__c = ISOhead.Id; ISOdo22.Operating_Room_Type__c= '3D整体手术间'; ISOdoList.add(ISOdo22); IS_Opportunity_Demand_Operating__c ISOdo23 = new IS_Opportunity_Demand_Operating__c(); ISOdo23.Name__c = '手术间2'; ISOdo23.IS_Opportunity_Demand__c = ISOhead.Id; ISOdo23.Operating_Room_Type__c= '4K整体手术间'; ISOdoList.add(ISOdo23); IS_Opportunity_Demand_Operating__c ISOdo24 = new IS_Opportunity_Demand_Operating__c(); ISOdo24.Name__c = '手术间2'; ISOdo24.IS_Opportunity_Demand__c = ISOhead.Id; ISOdo24.Operating_Room_Type__c= '3D/4K整体手术间'; ISOdoList.add(ISOdo24); IS_Opportunity_Demand_Operating__c ISOdo31 = new IS_Opportunity_Demand_Operating__c(); ISOdo31.Name__c = '手术间3'; ISOdo31.IS_Opportunity_Demand__c = ISOhead.Id; ISOdo31.Operating_Room_Type__c = 'HD整体手术间'; ISOdoList.add(ISOdo31); IS_Opportunity_Demand_Operating__c ISOdo32 = new IS_Opportunity_Demand_Operating__c(); ISOdo32.Name__c = '手术间3'; ISOdo32.IS_Opportunity_Demand__c = ISOhead.Id; ISOdo32.Operating_Room_Type__c= '3D整体手术间'; ISOdoList.add(ISOdo32); IS_Opportunity_Demand_Operating__c ISOdo33 = new IS_Opportunity_Demand_Operating__c(); ISOdo33.Name__c = '手术间3'; ISOdo33.IS_Opportunity_Demand__c = ISOhead.Id; ISOdo33.Operating_Room_Type__c= '4K整体手术间'; ISOdoList.add(ISOdo33); IS_Opportunity_Demand_Operating__c ISOdo34 = new IS_Opportunity_Demand_Operating__c(); ISOdo34.Name__c = '手术间3'; ISOdo34.IS_Opportunity_Demand__c = ISOhead.Id; ISOdo34.Operating_Room_Type__c= '3D/4K整体手术间'; ISOdoList.add(ISOdo34); IS_Opportunity_Demand_Operating__c ISOdo4 = new IS_Opportunity_Demand_Operating__c(); ISOdo4.Name__c = '术间数量>3间'; ISOdo4.IS_Opportunity_Demand__c = ISOhead.Id; ISOdoList.add(ISOdo4); insert ISOdoList; // 示教点 List ISOddList = new List(); IS_Opportunity_Demand_Demonstration__c ISOdd1 = new IS_Opportunity_Demand_Demonstration__c(); ISOdd1.Name__c = '示教点1'; ISOdd1.IS_Opportunity_Demand__c = ISOhead.Id; ISOdd1.Other_Require_Text__c = '其他要求'; ISOddList.add(ISOdd1); IS_Opportunity_Demand_Demonstration__c ISOdd2 = new IS_Opportunity_Demand_Demonstration__c(); ISOdd2.Name__c = '示教点2'; ISOdd2.IS_Opportunity_Demand__c = ISOhead.Id; ISOddList.add(ISOdd2); IS_Opportunity_Demand_Demonstration__c ISOdd3 = new IS_Opportunity_Demand_Demonstration__c(); ISOdd3.Name__c = '示教点数量>2'; ISOdd3.IS_Opportunity_Demand__c = ISOhead.Id; ISOddList.add(ISOdd3); insert ISOddList; // SI询价配置单 List ISOdcList = new List(); IS_Opportunity_Demand_Configuration__c ISOdc11 = new IS_Opportunity_Demand_Configuration__c(); ISOdc11.IS_Opportunity_Demand_Operating__c = ISOdo11.Id; ISOdc11.Configuration_Type__c= '01 _ HD整体手术间配置单'; ISOdcList.add(ISOdc11); IS_Opportunity_Demand_Configuration__c ISOdc21 = new IS_Opportunity_Demand_Configuration__c(); ISOdc21.IS_Opportunity_Demand_Operating__c = ISOdo21.Id; ISOdc21.Configuration_Type__c= '01 _ HD整体手术间配置单'; ISOdcList.add(ISOdc21); IS_Opportunity_Demand_Configuration__c ISOdc31 = new IS_Opportunity_Demand_Configuration__c(); ISOdc31.IS_Opportunity_Demand_Operating__c = ISOdo31.Id; ISOdc31.Configuration_Type__c= '01 _ HD整体手术间配置单'; ISOdcList.add(ISOdc31); IS_Opportunity_Demand_Configuration__c ISOdc12 = new IS_Opportunity_Demand_Configuration__c(); ISOdc12.IS_Opportunity_Demand_Operating__c = ISOdo12.Id; ISOdc12.Configuration_Type__c = '02 _ 3D整体手术间配置单'; ISOdcList.add(ISOdc12); IS_Opportunity_Demand_Configuration__c ISOdc22 = new IS_Opportunity_Demand_Configuration__c(); ISOdc22.IS_Opportunity_Demand_Operating__c = ISOdo22.Id; ISOdc22.Configuration_Type__c = '02 _ 3D整体手术间配置单'; ISOdcList.add(ISOdc22); IS_Opportunity_Demand_Configuration__c ISOdc32 = new IS_Opportunity_Demand_Configuration__c(); ISOdc32.IS_Opportunity_Demand_Operating__c = ISOdo32.Id; ISOdc32.Configuration_Type__c = '02 _ 3D整体手术间配置单'; ISOdcList.add(ISOdc32); IS_Opportunity_Demand_Configuration__c ISOdc13 = new IS_Opportunity_Demand_Configuration__c(); ISOdc13.IS_Opportunity_Demand_Operating__c = ISOdo13.Id; ISOdc13.Configuration_Type__c = '03 _ 4K整体手术间配置单'; ISOdcList.add(ISOdc13); IS_Opportunity_Demand_Configuration__c ISOdc23 = new IS_Opportunity_Demand_Configuration__c(); ISOdc23.IS_Opportunity_Demand_Operating__c = ISOdo23.Id; ISOdc23.Configuration_Type__c = '03 _ 4K整体手术间配置单'; ISOdcList.add(ISOdc23); IS_Opportunity_Demand_Configuration__c ISOdc33 = new IS_Opportunity_Demand_Configuration__c(); ISOdc33.IS_Opportunity_Demand_Operating__c = ISOdo33.Id; ISOdc33.Configuration_Type__c = '03 _ 4K整体手术间配置单'; ISOdcList.add(ISOdc33); IS_Opportunity_Demand_Configuration__c ISOdc14 = new IS_Opportunity_Demand_Configuration__c(); ISOdc14.IS_Opportunity_Demand_Operating__c = ISOdo14.Id; ISOdc14.Configuration_Type__c = '04 _ 3D/4K整体手术间配置单'; ISOdcList.add(ISOdc14); IS_Opportunity_Demand_Configuration__c ISOdc24 = new IS_Opportunity_Demand_Configuration__c(); ISOdc24.IS_Opportunity_Demand_Operating__c = ISOdo24.Id; ISOdc24.Configuration_Type__c = '04 _ 3D/4K整体手术间配置单'; ISOdcList.add(ISOdc24); IS_Opportunity_Demand_Configuration__c ISOdc34 = new IS_Opportunity_Demand_Configuration__c(); ISOdc34.IS_Opportunity_Demand_Operating__c = ISOdo34.Id; ISOdc34.Configuration_Type__c = '04 _ 3D/4K整体手术间配置单'; ISOdcList.add(ISOdc34); insert ISOdcList; PageReference page = new PageReference('apex/ISO_DemandOperAndDemonsNew?OppoerID='+opp1.Id+'&id='+ISOhead.Id+'&fileName=testaaa'); System.Test.setCurrentPage(page); ISO_DemandOperAndDemonsNewController ISOcanc = new ISO_DemandOperAndDemonsNewController(); ISO_NewDemandOAD_PDFController IOSPDF = new ISO_NewDemandOAD_PDFController(); ISOcanc.init(); ISOcanc.save(); IOSPDF.init(); } static testMethod void testMethod2() { Oly_TriggerHandler.bypass('ContactTrigger'); Oly_TriggerHandler.bypass('ContactTriggerHandler'); Oly_TriggerHandler.bypass('PIHelper'); Oly_TriggerHandler.bypass('ContactTrigger'); Profile pf = [select Id from Profile where Id =:system.label.ProfileId_SystemAdmin]; RecordType rtHP = [select id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName =:'HP']; RecordType rtDepClass = [select id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName =:'Department_Class_ENT']; // 耳鼻喉科 RecordType rtDep = [select id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName =:'Department_ENT']; RecordType rtDoc = [select id from RecordType where IsActive = true and SobjectType = 'Contact' and DeveloperName =:'Doctor']; Address_Level__c al = new Address_Level__c(); al.Name = '東京'; al.Level1_Code__c = 'CN-99'; al.Level1_Sys_No__c = '999999'; insert al; Address_Level2__c al2 = new Address_Level2__c(); al2.Level1_Code__c = 'CN-99'; al2.Level1_Sys_No__c = '999999'; al2.Level1_Name__c = '東京'; al2.Name = '渋谷区'; al2.Level2_Code__c = 'CN-9999'; al2.Level2_Sys_No__c = '9999999'; al2.Address_Level__c = al.id; insert al2; // 病院を作る Account hospital = new Account(); String rid = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id; hospital.Name = 'test hospital'; hospital.recordtypeId = rid; hospital.Is_Active__c = '有効'; insert hospital; // 戦略科室を得る Account[] strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_OTH']; // 診療科を作る Account dep = new Account(); dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_OTH'].id; dep.Name = 'test dep'; dep.AgentCode_Ext__c = '9999998'; dep.ParentId = strategicDep[0].Id; dep.Department_Class__c = strategicDep[0].Id; dep.Hospital__c = hospital.Id; insert dep; List conList = new List(); Contact con1 = new Contact(); con1.Firstname='ZZ1'; con1.LastName = '取引先責任者1'; con1.RecordTypeId = rtDoc.id; con1.AccountId = dep.Id; conList.add(con1); insert conList; RecordType Type = [select id from RecordType where DeveloperName='SI_Oppor']; String TypeID = Type.Id; Opportunity opp1 = new Opportunity(); opp1.Name = '引合1'; opp1.AccountId = dep.Id; opp1.Opportunity_Category__c = 'ENT'; opp1.Trade__c = '外貿'; opp1.StageName = '引合'; opp1.CurrencyIsoCode = 'CNY'; opp1.Close_Forecasted_Date__c = date.today().addMonths(1); opp1.CloseDate = date.today().addMonths(1); opp1.Competitor__c = 'B'; opp1.Purchase_Type__c ='SI(手術室案件)'; opp1.Sales_Root__c = 'OCM直接販売'; opp1.Hospital__c = hospital.id; opp1.StageName = '引合'; opp1.RecordTypeid = TypeID; insert opp1; // SI需求表 IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c(); ISOhead.Operating_Room_Count__c = '3'; ISOhead.Demonstration_Number__c = '2'; ISOhead.Opportunity_ID__c = opp1.Id; ISOhead.Transmission_Mode__c = '光线直连'; ISOhead.Demand_DemonstrationType__c = 'HD示教系统'; ISOhead.OperatingRoomName__c = 'test1'; insert ISOhead; // SI询价手术间 List ISOdoList = new List(); IS_Opportunity_Demand_Operating__c ISOdo12 = new IS_Opportunity_Demand_Operating__c(); ISOdo12.Name__c = '手术间1'; ISOdo12.IS_Opportunity_Demand__c = ISOhead.Id; ISOdo12.Operating_Room_Type__c= '3D整体手术间'; ISOdoList.add(ISOdo12); IS_Opportunity_Demand_Operating__c ISOdo22 = new IS_Opportunity_Demand_Operating__c(); ISOdo22.Name__c = '手术间2'; ISOdo22.IS_Opportunity_Demand__c = ISOhead.Id; ISOdo22.Operating_Room_Type__c= '3D整体手术间'; ISOdoList.add(ISOdo22); IS_Opportunity_Demand_Operating__c ISOdo32 = new IS_Opportunity_Demand_Operating__c(); ISOdo32.Name__c = '手术间3'; ISOdo32.IS_Opportunity_Demand__c = ISOhead.Id; ISOdo32.Operating_Room_Type__c= '3D整体手术间'; ISOdoList.add(ISOdo32); IS_Opportunity_Demand_Operating__c ISOdo4 = new IS_Opportunity_Demand_Operating__c(); ISOdo4.Name__c = '术间数量>3间'; ISOdo4.IS_Opportunity_Demand__c = ISOhead.Id; ISOdoList.add(ISOdo4); insert ISOdoList; // 示教点 List ISOddList = new List(); IS_Opportunity_Demand_Demonstration__c ISOdd1 = new IS_Opportunity_Demand_Demonstration__c(); ISOdd1.Name__c = '示教点1'; ISOdd1.IS_Opportunity_Demand__c = ISOhead.Id; ISOddList.add(ISOdd1); IS_Opportunity_Demand_Demonstration__c ISOdd2 = new IS_Opportunity_Demand_Demonstration__c(); ISOdd2.Name__c = '示教点2'; ISOdd2.IS_Opportunity_Demand__c = ISOhead.Id; ISOddList.add(ISOdd2); IS_Opportunity_Demand_Demonstration__c ISOdd3 = new IS_Opportunity_Demand_Demonstration__c(); ISOdd3.Name__c = '示教点数量>2'; ISOdd3.IS_Opportunity_Demand__c = ISOhead.Id; ISOddList.add(ISOdd3); insert ISOddList; // SI询价配置单 List ISOdcList = new List(); IS_Opportunity_Demand_Configuration__c ISOdc1 = new IS_Opportunity_Demand_Configuration__c(); ISOdc1.Standard_Configuration__c = true; ISOdc1.Configuration_Type__c= '01 _ HD整体手术间配置单'; ISOdcList.add(ISOdc1); IS_Opportunity_Demand_Configuration__c ISOdc2 = new IS_Opportunity_Demand_Configuration__c(); ISOdc2.Standard_Configuration__c = true; ISOdc2.Configuration_Type__c = '02 _ 3D整体手术间配置单'; ISOdcList.add(ISOdc2); IS_Opportunity_Demand_Configuration__c ISOdc3 = new IS_Opportunity_Demand_Configuration__c(); ISOdc3.Standard_Configuration__c = true; ISOdc3.Configuration_Type__c = '03 _ 4K整体手术间配置单'; ISOdcList.add(ISOdc3); IS_Opportunity_Demand_Configuration__c ISOdc4 = new IS_Opportunity_Demand_Configuration__c(); ISOdc4.Standard_Configuration__c = true; ISOdc4.Configuration_Type__c = '04 _ 3D/4K整体手术间配置单'; ISOdcList.add(ISOdc4); insert ISOdcList; PageReference page = new PageReference('apex/ISO_DemandOperAndDemonsNew?OppoerID='+opp1.Id+'&id='+ISOhead.Id+'&fileName=testaaa'); System.Test.setCurrentPage(page); ISO_DemandOperAndDemonsNewController ISOcanc = new ISO_DemandOperAndDemonsNewController(); ISOcanc.init(); ISOcanc.save(); ISO_NewDemandOAD_PDFController IOSPDF = new ISO_NewDemandOAD_PDFController(); IOSPDF.init(); } static testMethod void testMethod3() { Oly_TriggerHandler.bypass('ContactTrigger'); Oly_TriggerHandler.bypass('ContactTriggerHandler'); Oly_TriggerHandler.bypass('PIHelper'); Oly_TriggerHandler.bypass('ContactTrigger'); Profile pf = [select Id from Profile where Id =:system.label.ProfileId_SystemAdmin]; RecordType rtHP = [select id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName =:'HP']; RecordType rtDepClass = [select id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName =:'Department_Class_ENT']; // 耳鼻喉科 RecordType rtDep = [select id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName =:'Department_ENT']; RecordType rtDoc = [select id from RecordType where IsActive = true and SobjectType = 'Contact' and DeveloperName =:'Doctor']; Address_Level__c al = new Address_Level__c(); al.Name = '東京'; al.Level1_Code__c = 'CN-99'; al.Level1_Sys_No__c = '999999'; insert al; Address_Level2__c al2 = new Address_Level2__c(); al2.Level1_Code__c = 'CN-99'; al2.Level1_Sys_No__c = '999999'; al2.Level1_Name__c = '東京'; al2.Name = '渋谷区'; al2.Level2_Code__c = 'CN-9999'; al2.Level2_Sys_No__c = '9999999'; al2.Address_Level__c = al.id; insert al2; // 病院を作る Account hospital = new Account(); String rid = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id; hospital.Name = 'test hospital'; hospital.recordtypeId = rid; hospital.Is_Active__c = '有効'; insert hospital; // 戦略科室を得る Account[] strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_OTH']; // 診療科を作る Account dep = new Account(); dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_OTH'].id; dep.Name = 'test dep'; dep.AgentCode_Ext__c = '9999998'; dep.ParentId = strategicDep[0].Id; dep.Department_Class__c = strategicDep[0].Id; dep.Hospital__c = hospital.Id; insert dep; List conList = new List(); Contact con1 = new Contact(); con1.Firstname='ZZ1'; con1.LastName = '取引先責任者1'; con1.RecordTypeId = rtDoc.id; con1.AccountId = dep.Id; conList.add(con1); insert conList; RecordType Type = [select id from RecordType where DeveloperName='SI_Oppor']; String TypeID = Type.Id; Opportunity opp1 = new Opportunity(); opp1.Name = '引合1'; opp1.AccountId = dep.Id; opp1.Opportunity_Category__c = 'ENT'; opp1.Trade__c = '外貿'; opp1.StageName = '引合'; opp1.CurrencyIsoCode = 'CNY'; opp1.Close_Forecasted_Date__c = date.today().addMonths(1); opp1.CloseDate = date.today().addMonths(1); opp1.Competitor__c = 'B'; opp1.Purchase_Type__c ='SI(手術室案件)'; opp1.Sales_Root__c = 'OCM直接販売'; opp1.Hospital__c = hospital.id; opp1.StageName = '引合'; opp1.RecordTypeid = TypeID; insert opp1; // SI需求表 IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c(); ISOhead.Operating_Room_Count__c = '>3'; ISOhead.Demonstration_Number__c = '>2'; ISOhead.Opportunity_ID__c = opp1.Id; ISOhead.Transmission_Mode__c = '光线直连'; ISOhead.Demand_DemonstrationType__c = 'HD示教系统'; ISOhead.OperatingRoomName__c = 'test1'; insert ISOhead; // SI询价手术间 List ISOdoList = new List(); IS_Opportunity_Demand_Operating__c ISOdo11 = new IS_Opportunity_Demand_Operating__c(); ISOdo11.Name__c = '手术间1'; ISOdo11.IS_Opportunity_Demand__c = ISOhead.Id; ISOdo11.Operating_Room_Type__c = 'HD整体手术间'; ISOdoList.add(ISOdo11); IS_Opportunity_Demand_Operating__c ISOdo21 = new IS_Opportunity_Demand_Operating__c(); ISOdo21.Name__c = '手术间2'; ISOdo21.IS_Opportunity_Demand__c = ISOhead.Id; ISOdo21.Operating_Room_Type__c = 'HD整体手术间'; ISOdoList.add(ISOdo21); IS_Opportunity_Demand_Operating__c ISOdo31 = new IS_Opportunity_Demand_Operating__c(); ISOdo31.Name__c = '手术间3'; ISOdo31.IS_Opportunity_Demand__c = ISOhead.Id; ISOdo31.Operating_Room_Type__c = 'HD整体手术间'; ISOdoList.add(ISOdo31); IS_Opportunity_Demand_Operating__c ISOdo4 = new IS_Opportunity_Demand_Operating__c(); ISOdo4.Name__c = '术间数量>3间'; ISOdo4.IS_Opportunity_Demand__c = ISOhead.Id; ISOdoList.add(ISOdo4); insert ISOdoList; // 示教点 List ISOddList = new List(); IS_Opportunity_Demand_Demonstration__c ISOdd1 = new IS_Opportunity_Demand_Demonstration__c(); ISOdd1.Name__c = '示教点1'; ISOdd1.IS_Opportunity_Demand__c = ISOhead.Id; ISOddList.add(ISOdd1); IS_Opportunity_Demand_Demonstration__c ISOdd2 = new IS_Opportunity_Demand_Demonstration__c(); ISOdd2.Name__c = '示教点2'; ISOdd2.IS_Opportunity_Demand__c = ISOhead.Id; ISOddList.add(ISOdd2); IS_Opportunity_Demand_Demonstration__c ISOdd3 = new IS_Opportunity_Demand_Demonstration__c(); ISOdd3.Name__c = '示教点数量>2'; ISOdd3.IS_Opportunity_Demand__c = ISOhead.Id; ISOddList.add(ISOdd3); insert ISOddList; // SI询价配置单 List ISOdcList = new List(); IS_Opportunity_Demand_Configuration__c ISOdc1 = new IS_Opportunity_Demand_Configuration__c(); ISOdc1.Standard_Configuration__c = true; ISOdc1.Configuration_Type__c= '01 _ HD整体手术间配置单'; ISOdcList.add(ISOdc1); IS_Opportunity_Demand_Configuration__c ISOdc2 = new IS_Opportunity_Demand_Configuration__c(); ISOdc2.Standard_Configuration__c = true; ISOdc2.Configuration_Type__c = '02 _ 3D整体手术间配置单'; ISOdcList.add(ISOdc2); IS_Opportunity_Demand_Configuration__c ISOdc3 = new IS_Opportunity_Demand_Configuration__c(); ISOdc3.Standard_Configuration__c = true; ISOdc3.Configuration_Type__c = '03 _ 4K整体手术间配置单'; ISOdcList.add(ISOdc3); IS_Opportunity_Demand_Configuration__c ISOdc4 = new IS_Opportunity_Demand_Configuration__c(); ISOdc4.Standard_Configuration__c = true; ISOdc4.Configuration_Type__c = '04 _ 3D/4K整体手术间配置单'; ISOdcList.add(ISOdc4); insert ISOdcList; PageReference page = new PageReference('apex/ISO_DemandOperAndDemonsNew?OppoerID='+opp1.Id+'&id='+ISOhead.Id+'&fileName=testaaa'); System.Test.setCurrentPage(page); ISO_DemandOperAndDemonsNewController ISOcanc = new ISO_DemandOperAndDemonsNewController(); ISOcanc.init(); ISOcanc.save(); } static testMethod void testMethod4() { Oly_TriggerHandler.bypass('ContactTrigger'); Oly_TriggerHandler.bypass('ContactTriggerHandler'); Oly_TriggerHandler.bypass('PIHelper'); Oly_TriggerHandler.bypass('ContactTrigger'); Profile pf = [select Id from Profile where Id =:system.label.ProfileId_SystemAdmin]; RecordType rtHP = [select id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName =:'HP']; RecordType rtDepClass = [select id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName =:'Department_Class_ENT']; // 耳鼻喉科 RecordType rtDep = [select id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName =:'Department_ENT']; RecordType rtDoc = [select id from RecordType where IsActive = true and SobjectType = 'Contact' and DeveloperName =:'Doctor']; Address_Level__c al = new Address_Level__c(); al.Name = '東京'; al.Level1_Code__c = 'CN-99'; al.Level1_Sys_No__c = '999999'; insert al; Address_Level2__c al2 = new Address_Level2__c(); al2.Level1_Code__c = 'CN-99'; al2.Level1_Sys_No__c = '999999'; al2.Level1_Name__c = '東京'; al2.Name = '渋谷区'; al2.Level2_Code__c = 'CN-9999'; al2.Level2_Sys_No__c = '9999999'; al2.Address_Level__c = al.id; insert al2; // 病院を作る Account hospital = new Account(); String rid = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id; hospital.Name = 'test hospital'; hospital.recordtypeId = rid; hospital.Is_Active__c = '有効'; insert hospital; // 戦略科室を得る Account[] strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_OTH']; // 診療科を作る Account dep = new Account(); dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_OTH'].id; dep.Name = 'test dep'; dep.AgentCode_Ext__c = '9999998'; dep.ParentId = strategicDep[0].Id; dep.Department_Class__c = strategicDep[0].Id; dep.Hospital__c = hospital.Id; insert dep; List conList = new List(); Contact con1 = new Contact(); con1.Firstname='ZZ1'; con1.LastName = '取引先責任者1'; con1.RecordTypeId = rtDoc.id; con1.AccountId = dep.Id; conList.add(con1); insert conList; RecordType Type = [select id from RecordType where DeveloperName='SI_Oppor']; String TypeID = Type.Id; Opportunity opp1 = new Opportunity(); opp1.Name = '引合1'; opp1.AccountId = dep.Id; opp1.Opportunity_Category__c = 'ENT'; opp1.Trade__c = '外貿'; opp1.StageName = '引合'; opp1.CurrencyIsoCode = 'CNY'; opp1.Close_Forecasted_Date__c = date.today().addMonths(1); opp1.CloseDate = date.today().addMonths(1); opp1.Competitor__c = 'B'; opp1.Purchase_Type__c ='SI(手術室案件)'; opp1.Sales_Root__c = 'OCM直接販売'; opp1.Hospital__c = hospital.id; opp1.StageName = '引合'; opp1.RecordTypeid = TypeID; insert opp1; // SI需求表 IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c(); ISOhead.Operating_Room_Count__c = '1'; ISOhead.Demonstration_Number__c = ''; ISOhead.Opportunity_ID__c = opp1.Id; ISOhead.Transmission_Mode__c = '光线直连'; ISOhead.Demand_DemonstrationType__c = 'HD示教系统'; ISOhead.OperatingRoomName__c = 'test1'; insert ISOhead; // SI询价手术间 List ISOdoList = new List(); IS_Opportunity_Demand_Operating__c ISOdo12 = new IS_Opportunity_Demand_Operating__c(); ISOdo12.Name__c = '手术间1'; ISOdo12.IS_Opportunity_Demand__c = ISOhead.Id; ISOdo12.Operating_Room_Type__c= '4K整体手术间'; ISOdoList.add(ISOdo12); IS_Opportunity_Demand_Operating__c ISOdo22 = new IS_Opportunity_Demand_Operating__c(); ISOdo22.Name__c = '手术间2'; ISOdo22.IS_Opportunity_Demand__c = ISOhead.Id; ISOdo22.Operating_Room_Type__c= '4K整体手术间'; ISOdoList.add(ISOdo22); IS_Opportunity_Demand_Operating__c ISOdo32 = new IS_Opportunity_Demand_Operating__c(); ISOdo32.Name__c = '手术间3'; ISOdo32.IS_Opportunity_Demand__c = ISOhead.Id; ISOdo32.Operating_Room_Type__c= '4K整体手术间'; ISOdoList.add(ISOdo32); IS_Opportunity_Demand_Operating__c ISOdo4 = new IS_Opportunity_Demand_Operating__c(); ISOdo4.Name__c = '术间数量>3间'; ISOdo4.IS_Opportunity_Demand__c = ISOhead.Id; ISOdoList.add(ISOdo4); insert ISOdoList; // 示教点 List ISOddList = new List(); IS_Opportunity_Demand_Demonstration__c ISOdd1 = new IS_Opportunity_Demand_Demonstration__c(); ISOdd1.Name__c = '示教点1'; ISOdd1.IS_Opportunity_Demand__c = ISOhead.Id; ISOddList.add(ISOdd1); IS_Opportunity_Demand_Demonstration__c ISOdd2 = new IS_Opportunity_Demand_Demonstration__c(); ISOdd2.Name__c = '示教点2'; ISOdd2.IS_Opportunity_Demand__c = ISOhead.Id; ISOddList.add(ISOdd2); IS_Opportunity_Demand_Demonstration__c ISOdd3 = new IS_Opportunity_Demand_Demonstration__c(); ISOdd3.Name__c = '示教点数量>2'; ISOdd3.IS_Opportunity_Demand__c = ISOhead.Id; ISOddList.add(ISOdd3); insert ISOddList; // SI询价配置单 List ISOdcList = new List(); IS_Opportunity_Demand_Configuration__c ISOdc1 = new IS_Opportunity_Demand_Configuration__c(); ISOdc1.Standard_Configuration__c = true; ISOdc1.Configuration_Type__c= '01 _ HD整体手术间配置单'; ISOdcList.add(ISOdc1); IS_Opportunity_Demand_Configuration__c ISOdc2 = new IS_Opportunity_Demand_Configuration__c(); ISOdc2.Standard_Configuration__c = true; ISOdc2.Configuration_Type__c = '02 _ 3D整体手术间配置单'; ISOdcList.add(ISOdc2); IS_Opportunity_Demand_Configuration__c ISOdc3 = new IS_Opportunity_Demand_Configuration__c(); ISOdc3.Standard_Configuration__c = true; ISOdc3.Configuration_Type__c = '03 _ 4K整体手术间配置单'; ISOdcList.add(ISOdc3); IS_Opportunity_Demand_Configuration__c ISOdc4 = new IS_Opportunity_Demand_Configuration__c(); ISOdc4.Standard_Configuration__c = true; ISOdc4.Configuration_Type__c = '04 _ 3D/4K整体手术间配置单'; ISOdcList.add(ISOdc4); insert ISOdcList; PageReference page = new PageReference('apex/ISO_DemandOperAndDemonsNew?OppoerID='+opp1.Id+'&id='+ISOhead.Id+'&fileName=testaaa'); System.Test.setCurrentPage(page); ISO_DemandOperAndDemonsNewController ISOcanc = new ISO_DemandOperAndDemonsNewController(); ISOcanc.init(); ISOcanc.save(); } static testMethod void testMethod5() { Oly_TriggerHandler.bypass('ContactTrigger'); Oly_TriggerHandler.bypass('ContactTriggerHandler'); Oly_TriggerHandler.bypass('PIHelper'); Oly_TriggerHandler.bypass('ContactTrigger'); Profile pf = [select Id from Profile where Id =:system.label.ProfileId_SystemAdmin]; RecordType rtHP = [select id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName =:'HP']; RecordType rtDepClass = [select id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName =:'Department_Class_ENT']; // 耳鼻喉科 RecordType rtDep = [select id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName =:'Department_ENT']; RecordType rtDoc = [select id from RecordType where IsActive = true and SobjectType = 'Contact' and DeveloperName =:'Doctor']; Address_Level__c al = new Address_Level__c(); al.Name = '東京'; al.Level1_Code__c = 'CN-99'; al.Level1_Sys_No__c = '999999'; insert al; Address_Level2__c al2 = new Address_Level2__c(); al2.Level1_Code__c = 'CN-99'; al2.Level1_Sys_No__c = '999999'; al2.Level1_Name__c = '東京'; al2.Name = '渋谷区'; al2.Level2_Code__c = 'CN-9999'; al2.Level2_Sys_No__c = '9999999'; al2.Address_Level__c = al.id; insert al2; // 病院を作る Account hospital = new Account(); String rid = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id; hospital.Name = 'test hospital'; hospital.recordtypeId = rid; hospital.Is_Active__c = '有効'; insert hospital; // 戦略科室を得る Account[] strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_OTH']; // 診療科を作る Account dep = new Account(); dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_OTH'].id; dep.Name = 'test dep'; dep.AgentCode_Ext__c = '9999998'; dep.ParentId = strategicDep[0].Id; dep.Department_Class__c = strategicDep[0].Id; dep.Hospital__c = hospital.Id; insert dep; List conList = new List(); Contact con1 = new Contact(); con1.Firstname='ZZ1'; con1.LastName = '取引先責任者1'; con1.RecordTypeId = rtDoc.id; con1.AccountId = dep.Id; conList.add(con1); insert conList; RecordType Type = [select id from RecordType where DeveloperName='SI_Oppor']; String TypeID = Type.Id; Opportunity opp1 = new Opportunity(); opp1.Name = '引合1'; opp1.AccountId = dep.Id; opp1.Opportunity_Category__c = 'ENT'; opp1.Trade__c = '外貿'; opp1.StageName = '引合'; opp1.CurrencyIsoCode = 'CNY'; opp1.Close_Forecasted_Date__c = date.today().addMonths(1); opp1.CloseDate = date.today().addMonths(1); opp1.Competitor__c = 'B'; opp1.Purchase_Type__c ='SI(手術室案件)'; opp1.Sales_Root__c = 'OCM直接販売'; opp1.Hospital__c = hospital.id; opp1.StageName = '引合'; opp1.RecordTypeid = TypeID; insert opp1; // SI需求表 IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c(); ISOhead.Operating_Room_Count__c = '1'; ISOhead.Demonstration_Number__c = ''; ISOhead.Opportunity_ID__c = opp1.Id; ISOhead.Transmission_Mode__c = '光线直连'; ISOhead.Demand_DemonstrationType__c = 'HD示教系统'; ISOhead.OperatingRoomName__c = 'test1'; insert ISOhead; // SI询价手术间 List ISOdoList = new List(); IS_Opportunity_Demand_Operating__c ISOdo12 = new IS_Opportunity_Demand_Operating__c(); ISOdo12.Name__c = '手术间1'; ISOdo12.IS_Opportunity_Demand__c = ISOhead.Id; ISOdoList.add(ISOdo12); IS_Opportunity_Demand_Operating__c ISOdo22 = new IS_Opportunity_Demand_Operating__c(); ISOdo22.Name__c = '手术间2'; ISOdo22.IS_Opportunity_Demand__c = ISOhead.Id; ISOdoList.add(ISOdo22); IS_Opportunity_Demand_Operating__c ISOdo32 = new IS_Opportunity_Demand_Operating__c(); ISOdo32.Name__c = '手术间3'; ISOdo32.IS_Opportunity_Demand__c = ISOhead.Id; ISOdoList.add(ISOdo32); IS_Opportunity_Demand_Operating__c ISOdo4 = new IS_Opportunity_Demand_Operating__c(); ISOdo4.Name__c = '术间数量>3间'; ISOdo4.IS_Opportunity_Demand__c = ISOhead.Id; ISOdoList.add(ISOdo4); insert ISOdoList; // 示教点 List ISOddList = new List(); IS_Opportunity_Demand_Demonstration__c ISOdd1 = new IS_Opportunity_Demand_Demonstration__c(); ISOdd1.Name__c = '示教点1'; ISOdd1.IS_Opportunity_Demand__c = ISOhead.Id; ISOddList.add(ISOdd1); IS_Opportunity_Demand_Demonstration__c ISOdd2 = new IS_Opportunity_Demand_Demonstration__c(); ISOdd2.Name__c = '示教点2'; ISOdd2.IS_Opportunity_Demand__c = ISOhead.Id; ISOddList.add(ISOdd2); IS_Opportunity_Demand_Demonstration__c ISOdd3 = new IS_Opportunity_Demand_Demonstration__c(); ISOdd3.Name__c = '示教点数量>2'; ISOdd3.IS_Opportunity_Demand__c = ISOhead.Id; ISOddList.add(ISOdd3); insert ISOddList; // SI询价配置单 List ISOdcList = new List(); IS_Opportunity_Demand_Configuration__c ISOdc1 = new IS_Opportunity_Demand_Configuration__c(); ISOdc1.Standard_Configuration__c = true; ISOdc1.Configuration_Type__c= '01 _ HD整体手术间配置单'; ISOdcList.add(ISOdc1); IS_Opportunity_Demand_Configuration__c ISOdc2 = new IS_Opportunity_Demand_Configuration__c(); ISOdc2.Standard_Configuration__c = true; ISOdc2.Configuration_Type__c = '02 _ 3D整体手术间配置单'; ISOdcList.add(ISOdc2); IS_Opportunity_Demand_Configuration__c ISOdc3 = new IS_Opportunity_Demand_Configuration__c(); ISOdc3.Standard_Configuration__c = true; ISOdc3.Configuration_Type__c = '03 _ 4K整体手术间配置单'; ISOdcList.add(ISOdc3); IS_Opportunity_Demand_Configuration__c ISOdc4 = new IS_Opportunity_Demand_Configuration__c(); ISOdc4.Standard_Configuration__c = true; ISOdc4.Configuration_Type__c = '04 _ 3D/4K整体手术间配置单'; ISOdcList.add(ISOdc4); insert ISOdcList; PageReference page = new PageReference('apex/ISO_DemandOperAndDemonsNew?OppoerID='+opp1.Id+'&id='+ISOhead.Id+'&fileName=testaaa'); System.Test.setCurrentPage(page); ISO_DemandOperAndDemonsNewController ISOcanc = new ISO_DemandOperAndDemonsNewController(); ISOcanc.init(); ISOcanc.save(); } static testMethod void testMethod6() { Oly_TriggerHandler.bypass('ContactTrigger'); Oly_TriggerHandler.bypass('ContactTriggerHandler'); Oly_TriggerHandler.bypass('PIHelper'); Oly_TriggerHandler.bypass('ContactTrigger'); Profile pf = [select Id from Profile where Id =:system.label.ProfileId_SystemAdmin]; RecordType rtHP = [select id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName =:'HP']; RecordType rtDepClass = [select id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName =:'Department_Class_ENT']; // 耳鼻喉科 RecordType rtDep = [select id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName =:'Department_ENT']; RecordType rtDoc = [select id from RecordType where IsActive = true and SobjectType = 'Contact' and DeveloperName =:'Doctor']; Address_Level__c al = new Address_Level__c(); al.Name = '東京'; al.Level1_Code__c = 'CN-99'; al.Level1_Sys_No__c = '999999'; insert al; Address_Level2__c al2 = new Address_Level2__c(); al2.Level1_Code__c = 'CN-99'; al2.Level1_Sys_No__c = '999999'; al2.Level1_Name__c = '東京'; al2.Name = '渋谷区'; al2.Level2_Code__c = 'CN-9999'; al2.Level2_Sys_No__c = '9999999'; al2.Address_Level__c = al.id; insert al2; // 病院を作る Account hospital = new Account(); String rid = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id; hospital.Name = 'test hospital'; hospital.recordtypeId = rid; hospital.Is_Active__c = '有効'; insert hospital; // 戦略科室を得る Account[] strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_OTH']; // 診療科を作る Account dep = new Account(); dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_OTH'].id; dep.Name = 'test dep'; dep.AgentCode_Ext__c = '9999998'; dep.ParentId = strategicDep[0].Id; dep.Department_Class__c = strategicDep[0].Id; dep.Hospital__c = hospital.Id; insert dep; List conList = new List(); Contact con1 = new Contact(); con1.Firstname='ZZ1'; con1.LastName = '取引先責任者1'; con1.RecordTypeId = rtDoc.id; con1.AccountId = dep.Id; conList.add(con1); insert conList; RecordType Type = [select id from RecordType where DeveloperName='SI_Oppor']; String TypeID = Type.Id; Opportunity opp1 = new Opportunity(); opp1.Name = '引合1'; opp1.AccountId = dep.Id; opp1.Opportunity_Category__c = 'ENT'; opp1.Trade__c = '外貿'; opp1.StageName = '引合'; opp1.CurrencyIsoCode = 'CNY'; opp1.Close_Forecasted_Date__c = date.today().addMonths(1); opp1.CloseDate = date.today().addMonths(1); opp1.Competitor__c = 'B'; opp1.Purchase_Type__c ='SI(手術室案件)'; opp1.Sales_Root__c = 'OCM直接販売'; opp1.Hospital__c = hospital.id; opp1.StageName = '引合'; opp1.RecordTypeid = TypeID; insert opp1; // // SI需求表 // IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c(); // ISOhead.Operating_Room_Count__c = '1'; // ISOhead.Demonstration_Number__c = '0'; // ISOhead.Opportunity_ID__c = opp1.Id; // ISOhead.Transmission_Mode__c = '光线直连'; // ISOhead.Demand_DemonstrationType__c = 'HD示教系统'; // ISOhead.OperatingRoomName__c = 'test1'; // insert ISOhead; // // SI询价手术间 // List ISOdoList = new List(); // IS_Opportunity_Demand_Operating__c ISOdo12 = new IS_Opportunity_Demand_Operating__c(); // ISOdo12.Name__c = '手术间1'; // ISOdo12.IS_Opportunity_Demand__c = ISOhead.Id; // ISOdoList.add(ISOdo12); // IS_Opportunity_Demand_Operating__c ISOdo22 = new IS_Opportunity_Demand_Operating__c(); // ISOdo22.Name__c = '手术间2'; // ISOdo22.IS_Opportunity_Demand__c = ISOhead.Id; // ISOdoList.add(ISOdo22); // IS_Opportunity_Demand_Operating__c ISOdo32 = new IS_Opportunity_Demand_Operating__c(); // ISOdo32.Name__c = '手术间3'; // ISOdo32.IS_Opportunity_Demand__c = ISOhead.Id; // ISOdoList.add(ISOdo32); // IS_Opportunity_Demand_Operating__c ISOdo4 = new IS_Opportunity_Demand_Operating__c(); // ISOdo4.Name__c = '术间数量>3'; // ISOdo4.IS_Opportunity_Demand__c = ISOhead.Id; // ISOdoList.add(ISOdo4); // insert ISOdoList; // // 示教点 // List ISOddList = new List(); // IS_Opportunity_Demand_Demonstration__c ISOdd1 = new IS_Opportunity_Demand_Demonstration__c(); // ISOdd1.Name__c = '示教点1'; // ISOdd1.IS_Opportunity_Demand__c = ISOhead.Id; // ISOddList.add(ISOdd1); // IS_Opportunity_Demand_Demonstration__c ISOdd2 = new IS_Opportunity_Demand_Demonstration__c(); // ISOdd2.Name__c = '示教点2'; // ISOdd2.IS_Opportunity_Demand__c = ISOhead.Id; // ISOddList.add(ISOdd2); // IS_Opportunity_Demand_Demonstration__c ISOdd3 = new IS_Opportunity_Demand_Demonstration__c(); // ISOdd3.Name__c = '示教点数量>2'; // ISOdd3.IS_Opportunity_Demand__c = ISOhead.Id; // ISOddList.add(ISOdd3); // insert ISOddList; // // SI询价配置单 // List ISOdcList = new List(); // IS_Opportunity_Demand_Configuration__c ISOdc1 = new IS_Opportunity_Demand_Configuration__c(); // ISOdc1.Standard_Configuration__c = true; // ISOdc1.Configuration_Type__c= '01 _ HD整体手术间配置单'; // ISOdcList.add(ISOdc1); // IS_Opportunity_Demand_Configuration__c ISOdc2 = new IS_Opportunity_Demand_Configuration__c(); // ISOdc2.Standard_Configuration__c = true; // ISOdc2.Configuration_Type__c = '02 _ 3D整体手术间配置单'; // ISOdcList.add(ISOdc2); // IS_Opportunity_Demand_Configuration__c ISOdc3 = new IS_Opportunity_Demand_Configuration__c(); // ISOdc3.Standard_Configuration__c = true; // ISOdc3.Configuration_Type__c = '03 _ 4K整体手术间配置单'; // ISOdcList.add(ISOdc3); // IS_Opportunity_Demand_Configuration__c ISOdc4 = new IS_Opportunity_Demand_Configuration__c(); // ISOdc4.Standard_Configuration__c = true; // ISOdc4.Configuration_Type__c = '04 _ 3D/4K整体手术间配置单'; // ISOdcList.add(ISOdc4); // insert ISOdcList; PageReference page = new PageReference('apex/ISO_DemandOperAndDemonsNew?OppoerID='+opp1.Id); System.Test.setCurrentPage(page); ISO_DemandOperAndDemonsNewController ISOcanc = new ISO_DemandOperAndDemonsNewController(); ISOcanc.init(); ISOcanc.save(); ISOcanc.returnOpp(); ISOcanc.completenessCheck(); ISOcanc.saveAndReturn(); } }