| | |
| | | StaticParameter.EscapeNFM001Trigger = true; |
| | | // 病院を作る |
| | | Account hospital = new Account(); |
| | | hospital.recordtypeId = [Select Id FROM RecordType WHERE DeveloperName = 'HP'].id; |
| | | hospital.recordtypeId = [Select Id FROM RecordType WHERE DeveloperName = :'HP'].id; |
| | | hospital.Name = hospitalName; |
| | | insert hospital; |
| | | StaticParameter.EscapeAccountTrigger = true; |
| | |
| | | static Account createDep( Account hospital, Account strategicDep) { |
| | | // 診療科を作る |
| | | Account dep = new Account(); |
| | | dep.recordtypeId = [Select Id FROM RecordType WHERE DeveloperName = 'Department_GI'].id; |
| | | dep.recordtypeId = [Select Id FROM RecordType WHERE DeveloperName = :'Department_GI'].id; |
| | | dep.Name = 'test dep'; |
| | | dep.ParentId = strategicDep.Id; |
| | | dep.Department_Class__c = strategicDep.Id; |
| | |
| | | contract.Contract_Start_Date__c = Date.today().addDays( -10); // 10日前 |
| | | contract.Contract_End_Date__c = Date.today().addDays( 5); // 5日後 |
| | | contract.SalesOfficeCode_selection__c = '北京RC'; |
| | | contract.RecordTypeId='01210000000gTYv'; |
| | | ID RecordTypeId = Schema.SObjectType.Maintenance_Contract__c.getRecordTypeInfosByName().get('多年保合同').getRecordTypeId(); |
| | | // contract.RecordTypeId='01210000000gTYv'; |
| | | contract.RecordTypeId=RecordTypeId; |
| | | |
| | | insert contract; |
| | | return contract; |
| | |
| | | } |
| | | //限次合同产品信息维护相关测试 FXK 2021/3/8 Start |
| | | static testMethod void test03(){ |
| | | Oly_TriggerHandler.bypass('AccountTrigger'); |
| | | Oly_TriggerHandler.bypass('RepairHandler'); |
| | | Oly_TriggerHandler.bypass('RepairBeforeInsertHandler'); |
| | | Oly_TriggerHandler.bypass('UpdateContractAimAmountHandler'); |
| | | Oly_TriggerHandler.bypass('PaymentMaintenanceContractTriggerHandler'); |
| | | Oly_TriggerHandler.bypass('SetContractEstimatePriceHandler'); |
| | | Oly_TriggerHandler.bypass('SyncRepairFromMCAETrigger'); |
| | | Oly_TriggerHandler.bypass('ContactTriggerHandler'); |
| | | StaticParameter.EscapeMaintenanceContractAfterUpdateTrigger = true; |
| | | StaticParameter.EscapeNFM001Trigger = true; |
| | | StaticParameter.EscapeNFM001AgencyContractTrigger = true; |
| | | StaticParameter.EscapeNFM001AgencyContractTrigger2 = true; |
| | | StaticParameter.EscapeSyncProduct2Trigger = true; |
| | | StaticParameter.EscapeContactInsUpdUser = true; |
| | | StaticParameter.EscapeContactToUser = true; |
| | | StaticParameter.EscapeNFM010UpsertStatuAchievementsTrigger = true; |
| | | StaticParameter.EscapeAccountTrigger = true; |
| | | StaticParameter.EscapeNFM106Trigger = true; |
| | | //客户 |
| | | Account hospital = createHospital( 'test hospital'); |
| | | Account[] strategicDep = selectStrategicDep( hospital); |
| | | Account dep = createDep( hospital, strategicDep[0]); |
| | | // Account hospital = createHospital( 'test hospital'); |
| | | // Account[] strategicDep = selectStrategicDep( hospital); |
| | | // Account dep = createDep( hospital, strategicDep[0]); |
| | | // 保有设备 |
| | | Asset asset = createAsset( hospital, strategicDep[0], dep); |
| | | // Asset asset = createAsset( hospital, strategicDep[0], strategicDep[0]); |
| | | // 病院を作る |
| | | // 省 |
| | | 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(); |
| | | hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id; |
| | | hospital.Name = 'test hospital'; |
| | | hospital.Is_Active__c = '有効'; |
| | | hospital.Attribute_Type__c = '卫生部'; |
| | | hospital.Speciality_Type__c = '综合医院'; |
| | | hospital.Grade__c = '一级'; |
| | | hospital.OCM_Category__c = 'SLTV'; |
| | | hospital.Is_Medical__c = '医疗机构'; |
| | | hospital.State_Master__c = al.id; |
| | | hospital.City_Master__c = al2.id; |
| | | hospital.Town__c = '东京'; |
| | | insert hospital; |
| | | |
| | | // 戦略科室を得る |
| | | Account[] strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_OTH']; |
| | | // 診療科を作る |
| | | Account dep = new Account(); |
| | | 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; |
| | | Asset asset = new Asset(); |
| | | asset.Name = 'テスト機器'; |
| | | asset.AccountId = dep.Id; |
| | | asset.Department_Class__c = strategicDep[0].Id; |
| | | asset.Hospital__c = hospital.Id; |
| | | asset.SerialNumber = 'testserial'; |
| | | insert asset; |
| | | |
| | | // 创建维修合同 |
| | | Maintenance_Contract__c contract = new Maintenance_Contract__c(); |
| | | // ID RecordTypeId1 = Schema.SObjectType.Maintenance_Contract__c.getRecordTypeInfosByName().get('服务合同').getRecordTypeId(); |
| | | // ID RecordTypeId2 = Schema.SObjectType.Maintenance_Contract_Estimate__c.getRecordTypeInfosByName().get('服务合同报价').getRecordTypeId(); |
| | | contract.Name = 'tect contract'; |
| | | contract.status__c = '契約'; |
| | | contract.URF_Contract__c=true; |
| | |
| | | contract.Contract_End_Date__c = Date.today().addDays( 5); // 5日後 |
| | | contract.SalesOfficeCode_selection__c = '北京RC'; |
| | | contract.RecordTypeId='01210000000gTYq'; |
| | | // contract.RecordTypeId=RecordTypeId1; |
| | | contract.URF_Contract__c = true; |
| | | contract.agree_Upper_limit__c = true; |
| | | insert contract; |
| | |
| | | Maintenance_Contract_Estimate__c Estimate = new Maintenance_Contract_Estimate__c(); |
| | | Estimate.Maintenance_Contract__c = contract.Id; |
| | | Estimate.recordtypeId = '01210000000gTZA'; |
| | | // Estimate.recordtypeId = RecordTypeId2; |
| | | Estimate.Name = '报价1'; |
| | | insert Estimate; |
| | | //创建维修合同报价/保有设备 |
| | |
| | | middleTable.Maintenance_Contract_Asset_Estimate__c = Asset_Estimate.Id; |
| | | insert middleTable; |
| | | // 修理を作成する01 |
| | | Test.startTest(); |
| | | Repair__c repair01 = new Repair__c(); |
| | | repair01.Account__c = dep.Id; |
| | | repair01.Department_Class__c = strategicDep[0].Id; |
| | | repair01.Account__c = strategicDep[0].Id; |
| | | repair01.Department_Class__c = dep.Id; |
| | | repair01.Hospital__c = hospital.Id; |
| | | repair01.SERVICE_CONTRACT_JUDEGE_DAY__C = Date.today(); // 维修合同判断日在合同开始日与合同结束日之间 |
| | | repair01.Failure_Occurrence_Date__c =Date.today(); |
| | |
| | | repair01.Status__c = '草案中'; |
| | | repair01.SalesOfficeCode_selection__c = '西安RC'; |
| | | insert repair01; |
| | | |
| | | |
| | | Repair__c checkRepair = null; |
| | | checkRepair = [SELECT Id, Name , Maintenance_Contract__c,MaintenanceContractType__c FROM Repair__c WHERE ID = :repair01.id]; |
| | | System.assertEquals( contract.Id, checkRepair.Maintenance_Contract__c); |
| | | |
| | | // 修理を作成する01 |
| | | Repair__c repair02 = new Repair__c(); |
| | | repair02.Account__c = dep.Id; |
| | | repair02.Account__c = strategicDep[0].Id; |
| | | repair02.Department_Class__c = strategicDep[0].Id; |
| | | repair02.Hospital__c = hospital.Id; |
| | | repair02.SERVICE_CONTRACT_JUDEGE_DAY__C = Date.today(); // 维修合同判断日在合同开始日与合同结束日之间 |
| | |
| | | repair02.Delivered_Product__c = asset.Id; |
| | | insert repair02; |
| | | delete repair02; |
| | | |
| | | checkRepair.NewProductGuarante_Txt__c = '2: 服务多年保修'; |
| | | update checkRepair; |
| | | |
| | | checkRepair.NewProductGuarante_Txt__c = '8: 市场多年保修'; |
| | | checkRepair.On_site_repair__c = 'RC修理'; |
| | | checkRepair.Maintenance_Contract__c = contract.Id; |
| | | checkRepair.SalesOfficeCode_selection__c = '杭州RC'; |
| | | update checkRepair; |
| | | |
| | | contract.SalesOfficeCode_selection__c = '上海RC'; |
| | | update contract; |
| | | checkRepair.SalesOfficeCode_selection__c = '杭州RC'; |
| | | update checkRepair; |
| | | |
| | | checkRepair.SalesOfficeCode_selection__c = '杭州RC'; |
| | | checkRepair.NewProductGuarante_Txt__c = '2: 服务多年保修'; |
| | | update checkRepair; |
| | | |
| | | Test.stopTest(); |
| | | asset.Order_No__c = '上海分公司'; |
| | | update asset; |
| | | checkRepair.SalesOfficeCode_selection__c = '杭州'; |
| | | update checkRepair; |
| | | |
| | | asset.Order_No__c = '广州分公司'; |
| | | update asset; |
| | | checkRepair.On_site_repair__c = '办事处修理'; |
| | |
| | | |
| | | contract.SalesOfficeCode_selection__c = '广州RC'; |
| | | update contract; |
| | | |
| | | } |
| | | //限次合同产品信息维护相关测试 FXK 2021/3/8 End |
| | | |
| | |
| | | Asset asset = createAsset( hospital, strategicDep[0], dep); |
| | | // 创建维修合同 |
| | | Maintenance_Contract__c contract = new Maintenance_Contract__c(); |
| | | // ID RecordTypeId1 = Schema.SObjectType.Maintenance_Contract__c.getRecordTypeInfosByName().get('服务合同').getRecordTypeId(); |
| | | // ID RecordTypeId2 = Schema.SObjectType.Maintenance_Contract_Estimate__c.getRecordTypeInfosByName().get('服务合同报价').getRecordTypeId(); |
| | | contract.Name = 'tect contract'; |
| | | contract.status__c = '契約'; |
| | | contract.URF_Contract__c=true; |
| | |
| | | contract.Contract_End_Date__c = Date.today().addDays( 5); // 5日後 |
| | | contract.SalesOfficeCode_selection__c = '北京RC'; |
| | | contract.RecordTypeId='01210000000gTYq'; |
| | | // contract.RecordTypeId=RecordTypeId1; |
| | | contract.URF_Contract__c = true; |
| | | contract.agree_Upper_limit__c = true; |
| | | insert contract; |
| | |
| | | Maintenance_Contract_Estimate__c Estimate = new Maintenance_Contract_Estimate__c(); |
| | | Estimate.Maintenance_Contract__c = contract.Id; |
| | | Estimate.recordtypeId = '01210000000gTZA'; |
| | | // Estimate.recordtypeId = RecordTypeId2; |
| | | Estimate.Name = '报价1'; |
| | | insert Estimate; |
| | | //创建维修合同报价/保有设备 |
| | |
| | | |
| | | // 创建维修合同 |
| | | Maintenance_Contract__c contract = new Maintenance_Contract__c(); |
| | | // ID RecordTypeId1 = Schema.SObjectType.Maintenance_Contract__c.getRecordTypeInfosByName().get('服务合同').getRecordTypeId(); |
| | | contract.Name = 'tect contract'; |
| | | contract.status__c = '契約'; |
| | | contract.URF_Contract__c=true; |
| | |
| | | contract.Contract_Start_Date__c = Date.today().addDays( -10); // 10日前 |
| | | contract.Contract_End_Date__c = Date.today().addDays( 5); // 5日後 |
| | | contract.SalesOfficeCode_selection__c = '北京RC'; |
| | | // contract.RecordTypeId=RecordTypeId1; |
| | | contract.RecordTypeId='01210000000gTYq'; |
| | | contract.URF_Contract__c = true; |
| | | contract.agree_Upper_limit__c = true; |