| | |
| | | } |
| | | |
| | | //限次合同产品信息维护相关测试 FXK 2021/3/8 Start |
| | | static testMethod void test04(){ |
| | | // 病院、戦略科室、診療科の情報を作成します |
| | | Account hospital = createHospital( 'test hospital'); |
| | | Account[] strategicDep = selectStrategicDep( hospital); |
| | | Account dep = createDep( hospital, strategicDep[0]); |
| | | // static testMethod void test04(){ |
| | | // // 病院、戦略科室、診療科の情報を作成します |
| | | // Account hospital = createHospital( 'test hospital'); |
| | | // Account[] strategicDep = selectStrategicDep( hospital); |
| | | // Account dep = createDep( hospital, strategicDep[0]); |
| | | |
| | | // 納入機器を作る |
| | | Asset asset = createAsset( hospital, strategicDep[0], dep); |
| | | // 维修合同を作成する |
| | | Maintenance_Contract__c contract = createMaintenanceContract( hospital, strategicDep[0], dep); |
| | | // 中間テーブルを設ける |
| | | Maintenance_Contract_Asset__c middleTable = createMiddleTable( asset, contract); |
| | | // // 納入機器を作る |
| | | // Asset asset = createAsset( hospital, strategicDep[0], dep); |
| | | // // 维修合同を作成する |
| | | // Maintenance_Contract__c contract = createMaintenanceContract( hospital, strategicDep[0], dep); |
| | | // // 中間テーブルを設ける |
| | | // Maintenance_Contract_Asset__c middleTable = createMiddleTable( asset, contract); |
| | | |
| | | |
| | | // 修理を作成する01 |
| | | Repair__c repair01 = new Repair__c(); |
| | | repair01.Account__c = dep.Id; |
| | | repair01.Department_Class__c = strategicDep[0].Id; |
| | | repair01.Hospital__c = hospital.Id; |
| | | repair01.Delivered_Product__c = asset.Id; |
| | | repair01.SERVICE_CONTRACT_JUDEGE_DAY__C = Date.today().addDays( -1000); // 维修合同判断日がサービス契約のだいぶ前 |
| | | repair01.Failure_Occurrence_Date__c =Date.today(); |
| | | repair01.SalesOfficeCode_selection__c = '杭州'; |
| | | repair01.On_site_repair__c = 'RC修理'; |
| | | insert repair01; |
| | | // // 修理を作成する01 |
| | | // Repair__c repair01 = new Repair__c(); |
| | | // repair01.Account__c = dep.Id; |
| | | // repair01.Department_Class__c = strategicDep[0].Id; |
| | | // repair01.Hospital__c = hospital.Id; |
| | | // repair01.Delivered_Product__c = asset.Id; |
| | | // repair01.SERVICE_CONTRACT_JUDEGE_DAY__C = Date.today().addDays( -1000); // 维修合同判断日がサービス契約のだいぶ前 |
| | | // repair01.Failure_Occurrence_Date__c =Date.today(); |
| | | // repair01.SalesOfficeCode_selection__c = '杭州'; |
| | | // repair01.On_site_repair__c = 'RC修理'; |
| | | // insert repair01; |
| | | |
| | | repair01.SalesOfficeCode_selection__c = '北京'; |
| | | update repair01; |
| | | repair01.SalesOfficeCode_selection__c = '哈尔滨'; |
| | | update repair01; |
| | | repair01.SalesOfficeCode_selection__c = '上海'; |
| | | update repair01; |
| | | repair01.SalesOfficeCode_selection__c = '广州'; |
| | | update repair01; |
| | | repair01.SalesOfficeCode_selection__c = '太原'; |
| | | update repair01; |
| | | repair01.SalesOfficeCode_selection__c = '成都'; |
| | | update repair01; |
| | | repair01.SalesOfficeCode_selection__c = '杭州'; |
| | | update repair01; |
| | | // repair01.SalesOfficeCode_selection__c = '北京'; |
| | | // update repair01; |
| | | // repair01.SalesOfficeCode_selection__c = '哈尔滨'; |
| | | // update repair01; |
| | | // repair01.SalesOfficeCode_selection__c = '上海'; |
| | | // update repair01; |
| | | // repair01.SalesOfficeCode_selection__c = '广州'; |
| | | // update repair01; |
| | | // repair01.SalesOfficeCode_selection__c = '太原'; |
| | | // update repair01; |
| | | // repair01.SalesOfficeCode_selection__c = '成都'; |
| | | // update repair01; |
| | | // repair01.SalesOfficeCode_selection__c = '杭州'; |
| | | // update repair01; |
| | | |
| | | repair01.On_site_repair__c = '服务方式'; |
| | | update repair01; |
| | | } |
| | | // repair01.On_site_repair__c = '服务方式'; |
| | | // update repair01; |
| | | // } |
| | | |
| | | static testMethod void test05(){ |
| | | //客户 |
| | |
| | | update repair02; |
| | | |
| | | } |
| | | static testMethod void test07(){ |
| | | //客户 |
| | | Account hospital = createHospital( 'test hospital'); |
| | | Account[] strategicDep = selectStrategicDep( hospital); |
| | | Account dep = createDep( hospital, strategicDep[0]); |
| | | // 保有设备 |
| | | 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.Maintenance_Contract_No__c = 'Kami_Contract_No'; |
| | | contract.Contract_Conclusion_Date__c = Date.today(); |
| | | contract.Hospital__c = hospital.Id; |
| | | contract.Department_Class__c = strategicDep[0].Id; |
| | | contract.Department__c = dep.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='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_Asset_Estimate__c Asset_Estimate = new Maintenance_Contract_Asset_Estimate__c(); |
| | | Asset_Estimate.Maintenance_Contract_Estimate__c = Estimate.Id; |
| | | Asset_Estimate.CurrencyIsoCode = 'CNY'; |
| | | Asset_Estimate.Series_MaxRepairCount__c = 10; |
| | | Asset_Estimate.Series_RepairCount__c = 5; |
| | | insert Asset_Estimate; |
| | | //创建维修合同/保有设备 |
| | | Maintenance_Contract_Asset__c middleTable = new Maintenance_Contract_Asset__c(); |
| | | middleTable.Asset__c = asset.Id; |
| | | middleTable.Maintenance_Contract__c = contract.Id; |
| | | middleTable.CurrencyIsoCode= 'CNY'; |
| | | middleTable.startDateGurantee_Text__c =Date.today().addDays( 5); |
| | | middleTable.endDateGurantee_Text__c =Date.today().addDays( 30); |
| | | middleTable.Maintenance_Contract_Asset_Estimate__c = Asset_Estimate.Id; |
| | | insert middleTable; |
| | | // 修理を作成する01 |
| | | Repair__c repair01 = new Repair__c(); |
| | | repair01.Account__c = dep.Id; |
| | | repair01.Department_Class__c = strategicDep[0].Id; |
| | | repair01.Hospital__c = hospital.Id; |
| | | repair01.SERVICE_CONTRACT_JUDEGE_DAY__C = Date.today(); // 维修合同判断日在合同开始日与合同结束日之间 |
| | | repair01.Failure_Occurrence_Date__c =Date.today(); |
| | | repair01.Delivered_Product__c = asset.Id; |
| | | repair01.Status__c = '草案中'; |
| | | repair01.Return_Without_Repair_IF__c =true; |
| | | repair01.SalesOfficeCode_selection__c = '西安RC'; |
| | | repair01.Return_Without_Repair_Reason__c = '1.修理价格太高'; |
| | | 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.Department_Class__c = strategicDep[0].Id; |
| | | repair02.Hospital__c = hospital.Id; |
| | | repair02.SERVICE_CONTRACT_JUDEGE_DAY__C = Date.today(); // 维修合同判断日在合同开始日与合同结束日之间 |
| | | repair02.Failure_Occurrence_Date__c =Date.today(); |
| | | repair02.Delivered_Product__c = asset.Id; |
| | | repair02.Return_Without_Repair_Reason__c = '4.坚持继续使用'; |
| | | repair02.Return_Without_Repair_IF__c =true; |
| | | insert repair02; |
| | | delete repair02; |
| | | |
| | | checkRepair.On_site_repair__c = '办事处修理'; |
| | | contract.SalesOfficeCode_selection__c = '广州RC'; |
| | | update contract; |
| | | checkRepair.SalesOfficeCode_selection__c = '成都'; |
| | | update checkRepair; |
| | | contract.SalesOfficeCode_selection__c = '北京RC'; |
| | | update contract; |
| | | checkRepair.SalesOfficeCode_selection__c = '太原'; |
| | | update checkRepair; |
| | | checkRepair.SalesOfficeCode_selection__c = '杭州'; |
| | | update checkRepair; |
| | | } |
| | | |
| | | static testMethod void test08(){ |
| | | //客户 |
| | | Account hospital = createHospital( 'test hospital'); |
| | | Account[] strategicDep = selectStrategicDep( hospital); |
| | | Account dep = createDep( hospital, strategicDep[0]); |
| | | // 保有设备 |
| | | 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.Maintenance_Contract_No__c = 'Kami_Contract_No'; |
| | | contract.Contract_Conclusion_Date__c = Date.today(); |
| | | contract.Hospital__c = hospital.Id; |
| | | contract.Department_Class__c = strategicDep[0].Id; |
| | | contract.Department__c = dep.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='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_Asset_Estimate__c Asset_Estimate = new Maintenance_Contract_Asset_Estimate__c(); |
| | | Asset_Estimate.Maintenance_Contract_Estimate__c = Estimate.Id; |
| | | Asset_Estimate.CurrencyIsoCode = 'CNY'; |
| | | Asset_Estimate.Series_MaxRepairCount__c = 10; |
| | | Asset_Estimate.Series_RepairCount__c = 5; |
| | | insert Asset_Estimate; |
| | | //创建维修合同/保有设备 |
| | | Maintenance_Contract_Asset__c middleTable = new Maintenance_Contract_Asset__c(); |
| | | middleTable.Asset__c = asset.Id; |
| | | middleTable.Maintenance_Contract__c = contract.Id; |
| | | middleTable.CurrencyIsoCode= 'CNY'; |
| | | middleTable.startDateGurantee_Text__c =Date.today().addDays( 5); |
| | | middleTable.endDateGurantee_Text__c =Date.today().addDays( 30); |
| | | middleTable.Maintenance_Contract_Asset_Estimate__c = Asset_Estimate.Id; |
| | | insert middleTable; |
| | | // 修理を作成する01 |
| | | Repair__c repair01 = new Repair__c(); |
| | | repair01.Account__c = dep.Id; |
| | | repair01.Department_Class__c = strategicDep[0].Id; |
| | | repair01.Hospital__c = hospital.Id; |
| | | repair01.SERVICE_CONTRACT_JUDEGE_DAY__C = Date.today(); // 维修合同判断日在合同开始日与合同结束日之间 |
| | | repair01.Failure_Occurrence_Date__c =Date.today(); |
| | | repair01.Delivered_Product__c = asset.Id; |
| | | repair01.Status__c = '草案中'; |
| | | repair01.SalesOfficeCode_selection__c = '西安RC'; |
| | | repair01.Return_Without_Repair_Reason__c = 'I/F理由、確認'; |
| | | repair01.CancellationReason__c = '修理价格高'; |
| | | repair01.Return_Without_Repair_IF__c =true; |
| | | 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.Department_Class__c = strategicDep[0].Id; |
| | | repair02.Hospital__c = hospital.Id; |
| | | repair02.SERVICE_CONTRACT_JUDEGE_DAY__C = Date.today(); // 维修合同判断日在合同开始日与合同结束日之间 |
| | | repair02.Failure_Occurrence_Date__c =Date.today(); |
| | | repair02.Delivered_Product__c = asset.Id; |
| | | repair02.Return_Without_Repair_Reason__c = 'I/F理由、確認'; |
| | | repair02.CancellationReason__c = '无法修理返品'; |
| | | repair02.Return_Without_Repair_IF__c =true; |
| | | insert repair02; |
| | | delete repair02; |
| | | |
| | | checkRepair.On_site_repair__c = '办事处修理'; |
| | | contract.SalesOfficeCode_selection__c = '广州RC'; |
| | | update contract; |
| | | checkRepair.SalesOfficeCode_selection__c = '成都'; |
| | | update checkRepair; |
| | | contract.SalesOfficeCode_selection__c = '北京RC'; |
| | | update contract; |
| | | checkRepair.SalesOfficeCode_selection__c = '太原'; |
| | | update checkRepair; |
| | | checkRepair.SalesOfficeCode_selection__c = '杭州'; |
| | | update checkRepair; |
| | | } |
| | | |
| | | } |