| | |
| | | ); |
| | | insert lcr1; |
| | | |
| | | // 20220720 ljh add start |
| | | lcr1.Report_Status__c = '申请中'; |
| | | update lcr1; |
| | | // 20220720 ljh add edn |
| | | //test |
| | | lcr1.Report_Status__c = '批准'; |
| | | update lcr1; |
| | |
| | | Product2 pro1 = new Product2(Name='name01', Brand_Name__c='蛇牌',Category5__c='竞争对手',IsActive=true,Family='SP',Fixture_Model_No__c='n01',Serial_Lot_No__c='S/N tracing',Fixture_Model_No_T__c = 'n01',ProductCode_Ext__c='pc01',Manual_Entry__c=false); |
| | | Product2 pro2 = new Product2(Name='name02', Brand_Name__c='其他',Category5__c='竞争对手',IsActive=true,Family='SP2',Fixture_Model_No__c='n02',Serial_Lot_No__c='S/N tracing',Fixture_Model_No_T__c = 'n02',ProductCode_Ext__c='pc02',Manual_Entry__c=false); |
| | | // Product2 pro3 = new Product2(Name='name03',Lost_By_Company__c='其他',IsActive=true,Family='SP3',Fixture_Model_No__c='n03',Serial_Lot_No__c='S/N tracing',Fixture_Model_No_T__c = 'n03',ProductCode_Ext__c='pc03',Manual_Entry__c=false); |
| | | if(NFMUtil.isSandbox()){ |
| | | pro1.RecordTypeId = '0129D000001NacD'; |
| | | pro2.RecordTypeId = '0129D000001NacD'; |
| | | } else { |
| | | pro1.RecordTypeId = '01210000000aMAE'; |
| | | pro2.RecordTypeId = '01210000000aMAE'; |
| | | } |
| | | |
| | | insert new List<Product2> {pro1,pro2}; |
| | | |
| | | |
| | |
| | | |
| | | } |
| | | // add tcm 20211212 end |
| | | // 20221206 ljh start |
| | | @isTest static void test_method_three() { |
| | | // recode type を取得 |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院']; |
| | | if (rectCo.size() == 0) { |
| | | throw new ControllerUtil.myException('not found 病院 recodetype'); |
| | | } |
| | | List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 呼吸科']; |
| | | if (rectSct.size() == 0) { |
| | | throw new ControllerUtil.myException('not found 戦略科室分類 recodetype'); |
| | | } |
| | | 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) { |
| | | throw new ControllerUtil.myException('not found 診療科 recodetype'); |
| | | } |
| | | List<RecordType> rectLost = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Lost_cancel_report__c' and DeveloperName IN ('PCL_Lost_report', 'PCL_Cancel_report') order by DeveloperName desc]; |
| | | if (rectLost.size() == 0) { |
| | | throw new ControllerUtil.myException('not found Lost_cancel_report recodetype'); |
| | | } |
| | | |
| | | // insert |
| | | Account company1 = new Account(); |
| | | company1.RecordTypeId = rectCo[0].Id; |
| | | company1.Name = '病院テスト1'; |
| | | insert company1; |
| | | |
| | | 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; |
| | | insert depart1; |
| | | |
| | | // 商談 |
| | | Opportunity opp1 = new Opportunity(Name='aiueo', StageName='contact', CloseDate=Date.today(), |
| | | Hospital__c = company1.Id, |
| | | Department_Class__c = dc1s[0].Id, |
| | | AccountId = depart1.Id |
| | | ); |
| | | insert opp1; |
| | | |
| | | // 失单 |
| | | Lost_cancel_report__c lcr1 = new Lost_cancel_report__c( |
| | | Opportunity__c = opp1.Id, |
| | | RecordTypeId = rectLost[0].Id |
| | | ); |
| | | insert lcr1; |
| | | |
| | | // 20220720 ljh add start |
| | | lcr1.Report_Status__c = '申请中'; |
| | | update lcr1; |
| | | // 20220720 ljh add edn |
| | | //test |
| | | lcr1.Report_Status__c = '批准'; |
| | | update lcr1; |
| | | |
| | | Opportunity opptest = [SELECT Id, Lost_Cancel_Report__c FROM Opportunity WHERE Id =: opp1.Id]; |
| | | delete lcr1; |
| | | // System.assertEquals(lcr1.Id, opptest.Lost_Cancel_Report__c); |
| | | } |
| | | // 20221206 ljh start |
| | | |
| | | } |