From d79fcb2a960e8b0e18fe039d892f98187b08866d Mon Sep 17 00:00:00 2001 From: 李彤 <litong@prec-tech.com> Date: 星期五, 23 九月 2022 18:24:58 +0800 Subject: [PATCH] 招标项目失单报告 --- force-app/main/default/classes/OpportunityTriggerTest.cls | 160 +++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 130 insertions(+), 30 deletions(-) diff --git a/force-app/main/default/classes/OpportunityTriggerTest.cls b/force-app/main/default/classes/OpportunityTriggerTest.cls index 0131d31..f3f0d17 100644 --- a/force-app/main/default/classes/OpportunityTriggerTest.cls +++ b/force-app/main/default/classes/OpportunityTriggerTest.cls @@ -121,7 +121,7 @@ Body = EncodingUtil.base64Decode('test') ); insert att3; - delete att3; + //delete att3; Rental_Apply__c rentalApply = new Rental_Apply__c(); // '寮曞綋瀹屼簡' -> 宸叉壒鍑� @@ -139,26 +139,27 @@ rentalApply.Hope_Lonaer_date_Num__c = 6; insert rentalApply; - Attachment att4 = new Attachment( - Name = 'ORDER-123456.pdf', - parentId = rentalApply.Id, - Body = EncodingUtil.base64Decode('test') - ); - insert att4; - delete att4; + // Attachment att4 = new Attachment( + // Name = 'ORDER-123456.pdf', + // parentId = rentalApply.Id, + // Body = EncodingUtil.base64Decode('test') + // ); + // insert att4; + // delete att4; - Consumable_order__c co = new Consumable_order__c(); - insert co; + // Consumable_order__c co = new Consumable_order__c(); + // insert co; - Attachment att5 = new Attachment( - Name = 'ORDER-123456.pdf', - parentId = co.Id, - Body = EncodingUtil.base64Decode('test') - ); - insert att5; + // Attachment att5 = new Attachment( + // Name = 'ORDER-123456.pdf', + // parentId = co.Id, + // Body = EncodingUtil.base64Decode('test') + // ); + // insert att5; //delete att5; System.Test.stopTest(); + // OpportunityTrigger.intI(); } } @@ -322,9 +323,16 @@ opp1.Authorized_DB_No__c = '123'; opp1.Contract_DB_SalesDept_complite_day__c = Date.today(); opp1.NotesApprovedNo__c = '123'; + update opp1; - - + LastbuyProduct__c wqe = new LastbuyProduct__c(); + wqe.InquiryCode__c=opp1.Id; + wqe.LastbuyQuantity__c=1; + wqe.ActualQuantity__c=1; + insert wqe; + opp1.SAP_Send_OK__c = false; + opp1.Reason_Cancel_WIN__c = '1.缁堟鍚堝悓'; + update opp1; //lt 娉ㄩ噴鎺� te1 // //鎷涙爣椤圭洰 // Tender_information__c te1 = new Tender_information__c(); @@ -341,18 +349,18 @@ //鏂板缓璇环鏃�,璧嬪�兼嫑鎶曟爣椤圭洰,鎵撲笂鏍囪瘑 - Opportunity opp2 = new Opportunity( - Name = 'test opp1', - StageName = '寮曞悎', - CurrencyIsoCode = 'USD', - CloseDate = Date.today(), - AccountId = depart.Id, - Closing_Bid_Date__c = Date.today().addDays(-5), - Hospital__c = company.Id, - Competitor__c = 'A' - //,Bidding_Project_Name_Bid__c = te1.Id //lt 20220316 - ); - insert opp2; + // Opportunity opp2 = new Opportunity( + // Name = 'test opp1', + // StageName = '寮曞悎', + // CurrencyIsoCode = 'USD', + // CloseDate = Date.today(), + // AccountId = depart.Id, + // Closing_Bid_Date__c = Date.today().addDays(-5), + // Hospital__c = company.Id + // // ,Competitor__c = 'A' + // //,Bidding_Project_Name_Bid__c = te1.Id //lt 20220316 + // ); + // insert opp2; System.Test.stopTest(); @@ -389,4 +397,96 @@ } //LastBuy 棰勭暀浜у搧 lt 20220315 end + + //add start 20220623 + @isTest + static void test_createTaskByOppConfirmationofAward() { + User user = new User(Test_staff__c = true); + user.LastName = '_銈点兂銉栥儶銉冦偢'; + user.FirstName = '銇�'; + user.Alias = '銇�'; + user.Email = 'olympusTest03@sunbridge.com'; + user.Username = 'olympusTest03@sunbridge.com'; + user.CommunityNickname = '銇�'; + user.IsActive = true; + user.EmailEncodingKey = 'ISO-2022-JP'; + user.TimeZoneSidKey = 'Asia/Tokyo'; + user.LocaleSidKey = 'ja_JP'; + user.LanguageLocaleKey = 'ja'; + user.ProfileId = System.Label.ProfileId_SystemAdmin; + user.Job_Category__c = '閿�鍞帹骞�'; + user.Province__c = '涓婃捣甯�'; + user.Use_Start_Date__c = Date.today().addMonths(-6); + user.SalesManager__c = UserInfo.getUserId(); + user.BuchangApprovalManagerSales__c = UserInfo.getUserId(); + user.JingliApprovalManager__c = UserInfo.getUserId(); + user.BuchangApprovalManager__c = UserInfo.getUserId(); + user.ZongjianApprovalManager__c = UserInfo.getUserId(); + + List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌']; + if (rectCo.size() == 0) { + return; + } + List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�']; + if (rectSct.size() == 0) { + return; + } + List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '瑷虹檪绉� 娑堝寲绉�']; + if (rectDpt.size() == 0) { + return; + } + + + StaticParameter.EscapeOpportunityBefUpdTrigger = true; + StaticParameter.EscapeSyncOpportunityTrigger = true; + StaticParameter.EscapeNFM007Trigger = true; + StaticParameter.EscapeOpportunityHpDeptUpdTrigger = true; + StaticParameter.EscapeSyncOpportunityTrigger = true; + + System.runAs(new User(Id = Userinfo.getUserId())) { + insert user; + // 銉嗐偣銉堛儑銉笺偪 + Account company = new Account(); + company.RecordTypeId = rectCo[0].Id; + company.Name = 'NFM007TestCompany'; + upsert company; + Account section = new Account(); + section.RecordTypeId = rectSct[0].Id; + section.Name = '*'; + section.Department_Class_Label__c = '娑堝寲绉�'; + section.ParentId = company.Id; + section.Hospital_Department_Class__c = company.Id; + upsert section; + Account depart = new Account(); + depart.RecordTypeId = rectDpt[0].Id; + depart.Name = '*'; + depart.Department_Name__c = 'NFM007TestDepart'; + depart.ParentId = section.Id; + depart.Department_Class__c = section.Id; + depart.Hospital__c = company.Id; + upsert depart; + + Opportunity opp = new Opportunity(); + opp.AccountId = depart.Id; + opp.Department_Class__c = section.Id; + opp.Hospital__c = company.Id; + opp.SAP_Send_OK__c = false; + opp.Name = 'GZ-SP-NFM007_1'; + opp.Trade__c = '鍐呰部'; + opp.StageName = '璇环'; + opp.ConfirmationofAward__c='OLY涓爣'; + opp.CloseDate = date.newinstance(2022, 11, 30); + insert opp; + + System.Test.startTest(); + opp.ConfirmationofAward__c='绔炰簤瀵规墜涓爣'; + update opp; + + + System.Test.stopTest(); + + } +} +//end start 20220623 + } \ No newline at end of file -- Gitblit v1.9.1