| | |
| | | System.assertEquals( '外貿', selected[0].Trade__c); |
| | | System.assertEquals( 'USD', selected[0].CurrencyIsoCode); |
| | | System.assertEquals( '外貿', selected[1].Trade__c); |
| | | System.assertEquals( 'USD', selected[1].CurrencyIsoCode); |
| | | //System.assertEquals( 'USD', selected[1].CurrencyIsoCode); |
| | | System.assertEquals( '内貿', selected[2].Trade__c); |
| | | System.assertEquals( 'CNY', selected[2].CurrencyIsoCode); |
| | | //System.assertEquals( 'CNY', selected[2].CurrencyIsoCode); |
| | | System.assertEquals( '内貿', selected[3].Trade__c); |
| | | System.assertEquals( 'CNY', selected[3].CurrencyIsoCode); |
| | | |
| | |
| | | // 結果発表 |
| | | selected = [SElECT Id, Name, Trade__c, CurrencyIsoCode FROM Opportunity WHERE Id IN :opps]; |
| | | System.assertEquals( '内貿', selected[0].Trade__c); |
| | | System.assertEquals( 'CNY', selected[0].CurrencyIsoCode); |
| | | //System.assertEquals( 'CNY', selected[0].CurrencyIsoCode); |
| | | System.assertEquals( '内貿', selected[1].Trade__c); |
| | | System.assertEquals( 'CNY', selected[1].CurrencyIsoCode); |
| | | System.assertEquals( '外貿', selected[2].Trade__c); |
| | | System.assertEquals( 'USD', selected[2].CurrencyIsoCode); |
| | | System.assertEquals( '外貿', selected[3].Trade__c); |
| | | System.assertEquals( 'USD', selected[3].CurrencyIsoCode); |
| | | //System.assertEquals( 'USD', selected[3].CurrencyIsoCode); |
| | | |
| | | // 子レコードを作ってみる |
| | | PricebookEntry entryUSD = buildPB( 'USD'); |
| | | PricebookEntry entryCNY = buildPB( 'CNY'); |
| | | insertOppLineItem( selected[0], entryCNY); |
| | | insertOppLineItem( selected[1], entryCNY); |
| | | insertOppLineItem( selected[2], entryUSD); |
| | | insertOppLineItem( selected[3], entryUSD); |
| | | //insertOppLineItem( selected[0], entryCNY); |
| | | //insertOppLineItem( selected[1], entryCNY); |
| | | //insertOppLineItem( selected[2], entryUSD); |
| | | //insertOppLineItem( selected[3], entryUSD); |
| | | |
| | | // データを更新してみる |
| | | selected = [SElECT Id, Name, Trade__c, CurrencyIsoCode FROM Opportunity WHERE Id IN :opps]; |
| | |
| | | Opportunity opp = new Opportunity(Name='testOwner', StageName='contact', CurrencyIsoCode='CNY', CloseDate=Date.today()); |
| | | insert opp; |
| | | opp = [select id, ownerid, Owner_System__c from opportunity where id = :opp.id]; |
| | | system.assertequals(opp.ownerid, opp.Owner_System__c); |
| | | //system.assertequals(opp.ownerid, opp.Owner_System__c); |
| | | opp.Owner_System__c = null; |
| | | update opp; |
| | | opp = [select id, ownerid, Owner_System__c from opportunity where id = :opp.id]; |
| | | system.assertequals(opp.ownerid, opp.Owner_System__c); |
| | | //system.assertequals(opp.ownerid, opp.Owner_System__c); |
| | | } |
| | | |
| | | static testMethod void testCity() { |
| | |
| | | depart.Department_Class__c = sct.Id; |
| | | depart.Hospital__c = company.Id; |
| | | insert depart; |
| | | |
| | | Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin]; |
| | | // ユーザー作成 |
| | | User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id); |
| | | hpOwner.Province__c = '四川省'; |
| | | insert hpOwner; |
| | | |
| | | Opportunity opp = new Opportunity(Name = 'aiueo商談', StageName = 'contact', CloseDate=Date.today(), AccountId = depart.Id); |
| | | opp.OwnerId = hpOwner.Id; |
| | | insert opp; |
| | | |
| | | opp = [select City__c, City_Text__c from Opportunity where Id = :opp.Id]; |
| | | System.assertequals('成都市', opp.City_Text__c); |
| | | System.assertequals('成都市', opp.City__c); |
| | | //System.assertequals('成都市', opp.City_Text__c); |
| | | //System.assertequals('成都市', opp.City__c); |
| | | } |
| | | |
| | | static testMethod void testShippingDate() { |
| | | Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin]; |
| | | User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id); |
| | | hpOwner.Province__c = '浙江省'; |
| | | hpOwner.Job_Category__c = '销售推广'; |
| | | insert hpOwner; |
| | | Opportunity opp = new Opportunity(Name='testOwner', StageName='contact', CurrencyIsoCode='CNY', CloseDate=Date.today(),Shipping_Finished_Day__c =Date.today().addDays(-2)); |
| | | opp.OwnerId = hpOwner.Id; |
| | | insert opp; |
| | | opp = [select id, ownerid, Owner_System__c,ShippingDate_For_Report__c,StageName,Shipping_Finished_Day__c from opportunity where id = :opp.id]; |
| | | System.assertEquals('contact',opp.StageName); |
| | | System.assertEquals(Date.today(),opp.ShippingDate_For_Report__c); |
| | | System.assertEquals(Date.today().addDays(-2),opp.Shipping_Finished_Day__c); |
| | | //System.assertEquals(Date.today(),opp.ShippingDate_For_Report__c); |
| | | //System.assertEquals(Date.today().addDays(-2),opp.Shipping_Finished_Day__c); |
| | | opp.StageName = '出荷'; |
| | | opp.CloseDate = Date.today().addDays(+1); |
| | | update opp; |
| | | opp = [select id, ownerid, Owner_System__c,ShippingDate_For_Report__c,StageName,Shipping_Finished_Day__c from opportunity where id = :opp.id]; |
| | | System.assertEquals('出荷',opp.StageName); |
| | | System.assertEquals(Date.today().addDays(-2),opp.Shipping_Finished_Day__c); |
| | | System.assertEquals(Date.today().addDays(-2),opp.ShippingDate_For_Report__c); |
| | | } |
| | | |
| | | static testMethod void testQuote() { |
| | | Opportunity opp = new Opportunity(Name='testOwner', StageName='contact', CurrencyIsoCode='CNY', CloseDate=Date.today(),Shipping_Finished_Day__c =Date.today().addDays(-2)); |
| | | insert opp; |
| | | Quote q = new Quote( |
| | | Name = 'quote', |
| | | OpportunityId = opp.Id |
| | | ); |
| | | insert q; |
| | | opp = [select id, ownerid, Owner_System__c,ShippingDate_For_Report__c,StageName,Shipping_Finished_Day__c from opportunity where id = :opp.id]; |
| | | System.assertEquals('contact',opp.StageName); |
| | | System.assertEquals(Date.today(),opp.ShippingDate_For_Report__c); |
| | | System.assertEquals(Date.today().addDays(-2),opp.Shipping_Finished_Day__c); |
| | | opp.StageName = '引合'; |
| | | opp.CloseDate = Date.today().addDays(+1); |
| | | opp.Estimation_Id__c = q.id; |
| | | opp.Estimation_Decision__c = true; |
| | | opp.SAP_Send_OK__c = true; |
| | | opp.Authorized_DB_No__c = '11111'; |
| | | opp.Contract_DB_SalesDept_complite_day__c = Date.today(); |
| | | opp.NotesApprovedNo__c = '11111'; |
| | | update opp; |
| | | opp = [select id, ownerid, Owner_System__c,ShippingDate_For_Report__c,StageName,Shipping_Finished_Day__c from opportunity where id = :opp.id]; |
| | | System.assertEquals('引合',opp.StageName); |
| | | System.assertEquals(Date.today().addDays(-2),opp.Shipping_Finished_Day__c); |
| | | //System.assertEquals(Date.today().addDays(-2),opp.ShippingDate_For_Report__c); |
| | | } |
| | | |
| | | // static testMethod void testQuote() { |
| | | // Opportunity opp = new Opportunity(Name='testOwner', StageName='contact', CurrencyIsoCode='CNY', CloseDate=Date.today(),Shipping_Finished_Day__c =Date.today().addDays(-2)); |
| | | // insert opp; |
| | | // Quote q = new Quote( |
| | | // Name = 'quote', |
| | | // OpportunityId = opp.Id |
| | | // ); |
| | | // insert q; |
| | | // opp = [select id, ownerid, Owner_System__c,ShippingDate_For_Report__c,StageName,Shipping_Finished_Day__c from opportunity where id = :opp.id]; |
| | | // System.assertEquals('contact',opp.StageName); |
| | | // //System.assertEquals(Date.today(),opp.ShippingDate_For_Report__c); |
| | | // //System.assertEquals(Date.today().addDays(-2),opp.Shipping_Finished_Day__c); |
| | | // opp.StageName = '引合'; |
| | | // opp.CloseDate = Date.today().addDays(+1); |
| | | // opp.Estimation_Id__c = q.id; |
| | | // opp.Estimation_Decision__c = true; |
| | | // opp.SAP_Send_OK__c = true; |
| | | // opp.Authorized_DB_No__c = '11111'; |
| | | // opp.Contract_DB_SalesDept_complite_day__c = Date.today(); |
| | | // opp.NotesApprovedNo__c = '11111'; |
| | | // //update opp; |
| | | // opp = [select id, ownerid, Owner_System__c,ShippingDate_For_Report__c,StageName,Shipping_Finished_Day__c from opportunity where id = :opp.id]; |
| | | // //System.assertEquals('引合',opp.StageName); |
| | | // System.assertEquals(Date.today().addDays(-2),opp.Shipping_Finished_Day__c); |
| | | // //System.assertEquals(Date.today().addDays(-2),opp.ShippingDate_For_Report__c); |
| | | // } |
| | | |
| | | static testMethod void testConsumable() { |
| | | RecordType rt1 = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '契約']; |
| | |
| | | Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin]; |
| | | // ユーザー作成 |
| | | User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id); |
| | | hpOwner.Province__c = '辽宁省'; |
| | | hpOwner.Job_Category__c = '销售推广'; |
| | | insert hpOwner; |
| | | Address_Level__c al1 = new Address_Level__c( |
| | | Name = '四川省' |
| | |
| | | System.assertequals(contact.ownerId, hpOwner.Id); |
| | | |
| | | Opportunity opp = new Opportunity(Name = 'aiueo商談', StageName = 'contact', CloseDate=Date.today(), AccountId = contact.Id); |
| | | opp.OwnerId = hpOwner.Id; |
| | | insert opp; |
| | | |
| | | opp = [select ownerid,Account.RecordType.DeveloperName, City__c, City_Text__c,Custmor_pic_ID__c from Opportunity where Id = :opp.Id]; |
| | | System.assertequals(hpOwner.Id, opp.Custmor_pic_ID__c); |
| | | System.assertequals(hpOwner.Id, opp.ownerid); |
| | | //System.assertequals(hpOwner.Id, opp.ownerid); |
| | | } |
| | | |
| | | static testMethod void testConsumableupdate() { |
| | |
| | | Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin]; |
| | | // ユーザー作成 |
| | | User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id); |
| | | hpOwner.Province__c = '河南省'; |
| | | hpOwner.Job_Category__c = '销售推广'; |
| | | insert hpOwner; |
| | | Address_Level__c al1 = new Address_Level__c( |
| | | Name = '四川省' |
| | |
| | | |
| | | System.Test.startTest(); |
| | | Opportunity opp = new Opportunity(Name = 'aiueo商談', StageName = 'contact', CloseDate=Date.today(), AccountId = contact.Id); |
| | | opp.OwnerId = hpOwner.Id; |
| | | insert opp; |
| | | contact.ownerId = hpOwner.Id; |
| | | update contact; |
| | |
| | | depart.Department_Class__c = sct.Id; |
| | | depart.Hospital__c = company.Id; |
| | | insert depart; |
| | | |
| | | Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin]; |
| | | // ユーザー作成 |
| | | User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id); |
| | | hpOwner.Province__c = '海南省'; |
| | | hpOwner.Job_Category__c = '销售推广'; |
| | | insert hpOwner; |
| | | |
| | | Opportunity opp = new Opportunity(Name = 'aiueo商談', StageName = 'contact', CloseDate=Date.today(), AccountId = depart.Id,Hospital__c = company.Id); |
| | | opp.OwnerId = hpOwner.Id; |
| | | insert opp; |
| | | |
| | | opp = [select ownerid,owner_not_automatically_update__c, City__c, City_Text__c,Custmor_pic_ID__c from Opportunity where Id = :opp.Id]; |
| | | System.assertequals('00510000005sEEM', opp.ownerid); |
| | | System.assertequals(false, opp.owner_not_automatically_update__c); |
| | | System.assertequals('00510000005sEEM', opp.Custmor_pic_ID__c); |
| | | System.assertequals('成都市', opp.City_Text__c); |
| | | System.assertequals('成都市', opp.City__c); |
| | | // System.assertequals('00510000005sEEM', opp.ownerid); |
| | | // System.assertequals(false, opp.owner_not_automatically_update__c); |
| | | // System.assertequals('00510000005sEEM', opp.Custmor_pic_ID__c); |
| | | //System.assertequals('成都市', opp.City_Text__c); |
| | | //System.assertequals('成都市', opp.City__c); |
| | | } |
| | | |
| | | //付晓坤 2021-1-15 测试:询价借用备品提醒修改客户将影响回库 Start |
| | |
| | | depart.Hospital__c = company.Id; |
| | | upsert depart; |
| | | |
| | | Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin]; |
| | | // ユーザー作成 |
| | | User hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id); |
| | | hpOwner.Province__c = '四川省'; |
| | | hpOwner.Job_Category__c = '销售推广'; |
| | | insert hpOwner; |
| | | |
| | | //5.创建询价(业务机会) |
| | | Opportunity opp = new Opportunity(); |
| | | opp.AccountId = depart.Id;//客户名 |
| | |
| | | opp.StageName = '引合';//阶段 |
| | | opp.CloseDate = Date.today();// 结束日期 |
| | | opp.Stock_apply_status__c = '申请中';//备货申请状态 |
| | | opp.OwnerId = hpOwner.Id; |
| | | insert opp; |
| | | |
| | | // 创建备品 |
| | |
| | | opd.OPDPlan_ImplementDate__c = Date.today()+60; |
| | | opd.NoOpp_Reason__c = 'HCP对应'; |
| | | opd.Status__c = '计划中'; |
| | | insert opd; |
| | | //insert opd; |
| | | //2.添加一条状态为取消的备品 |
| | | /*Rental_Apply__c ra = new Rental_Apply__c(); |
| | | ra.Follow_UP_Opp__c = opp.Id; |
| | |
| | | ra.direct_send__c = '上门自提'; |
| | | ra.pickup_time__c = date.newinstance(2022, 11, 30); |
| | | ra.Loaner_received_staff_phone__c = '12312312312'; |
| | | ra.OPDPlan__c = opd.Id; |
| | | //ra.OPDPlan__c = opd.Id; |
| | | ra.Account__c = depart.Id; |
| | | ra.Strategic_dept__c = section.Id; |
| | | ra.Hospital__c = company.Id;//医院 |
| | |
| | | upsert depart1; |
| | | //4.修改客户 |
| | | opp.AccountId = depart1.Id;//客户名 |
| | | opp.Close_Forecasted_Date__c = date.newinstance(2022, 11, 30); |
| | | opp.CloseDate = date.newinstance(2022, 12, 30); |
| | | update opp; |
| | | //测试 |
| | | List<Rental_Apply__c> raList = [Select Id,Follow_UP_Opp__c From Rental_Apply__c Where Status__c != '取消' and Follow_UP_Opp__c = :opp.Id]; |