From d8dc84a3d56df839895f1c417a4d9cbee763d262 Mon Sep 17 00:00:00 2001
From: 高章伟 <gaozhangwei@prec-tech.com>
Date: 星期五, 03 三月 2023 14:50:59 +0800
Subject: [PATCH] gzw 测试环境代码更新

---
 force-app/main/default/classes/NFM206RestTest.cls |  106 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 104 insertions(+), 2 deletions(-)

diff --git a/force-app/main/default/classes/NFM206RestTest.cls b/force-app/main/default/classes/NFM206RestTest.cls
index bf29dde..8bb6b99 100644
--- a/force-app/main/default/classes/NFM206RestTest.cls
+++ b/force-app/main/default/classes/NFM206RestTest.cls
@@ -64,6 +64,9 @@
         GeData.Assistant_Applied_Date = String.valueOf(Date.today()-1);
         GeData.ApprovedType = '1';
         GeData.SPOApprovedQuote = 'test';//20200430 add
+        // 2022-10-20 SWAG-CKB5S6 xxf start
+        GeData.IsEsign = '1';
+        // 2022-10-20 SWAG-CKB5S6 xxf end
         System.Test.startTest();
         NFMUtil.Monitoring Monitoring = GeDatas.Monitoring;
         BatchIF_Log__c rowData = NFMUtil.saveRowData(Monitoring, 'NFM206', GeDatas.GeData);
@@ -155,6 +158,9 @@
         GeData.Assistant_Applied_Date = null;
         GeData.ContractType = '1';
         GeData.ApprovedType = '1';
+        // 2022-10-20 SWAG-CKB5S6 xxf start
+        GeData.IsEsign = '0';
+        // 2022-10-20 SWAG-CKB5S6 xxf end
         System.Test.startTest();
         NFMUtil.Monitoring Monitoring = GeDatas.Monitoring;
         BatchIF_Log__c rowData = NFMUtil.saveRowData(Monitoring, 'NFM206', GeDatas.GeData);
@@ -204,11 +210,13 @@
                                            //songxiaoqi-------start
                                             Estimation_Decision__c = true,
                                            Estimation_No__c = 'test',
-                                           Estimation_Id__c='002'
+                                           Estimation_Id__c='002',
+                                           Close_Forecasted_Date__c = Date.today() + 60
                                            //StageName='寮曞悎'
                                            //songxiaoqi--------end
                                            //SAP_Send_OK__c = true
                                            );
+        opp.CloseDate = Date.today() + 90;
         insert opp;
         //2020/11/4 songxiaoqi  update
         opp.Estimation_Decision__c=true;
@@ -257,7 +265,7 @@
         RestRequest req = new RestRequest();
         RestResponse res = new RestResponse();
 
-        String JsonMsg = '{"Monitoring":{"TransmissionDateTime":"201812201320","Text":"","Tag":"MSGH","Sender":"SFDC","Receiver":"SPO","NumberOfRecord":"1","MessageType":"NFM206","MessageGroupNumber":"20180001722190"},"GeData":[{"Opportunity_No":"BJ-SP-BJ0577783","OCM_Agent1_Price_DB":"950000","NotesApprovedNo":"MGZHTSQHN201812009","Contract_DB_SalesDept_complite_day":null,"Contract_DB_request_reason":"","Contract_DB_complite_day":"20181218","Closing_Bid_Date":"20181206","Assistant_Applied_Date":"20181218","ApprovedType":"3","SPOApprovedQuote":"test"}]}';
+        String JsonMsg = '{"Monitoring":{"TransmissionDateTime":"201812201320","Text":"","Tag":"MSGH","Sender":"SFDC","Receiver":"SPO","NumberOfRecord":"2","MessageType":"NFM206","MessageGroupNumber":"20180001722190"},"GeData":[{"Opportunity_No":"BJ-SP-BJ0577782","OCM_Agent1_Price_DB":"950000","NotesApprovedNo":"MGZHTSQHN201812009","Contract_DB_SalesDept_complite_day":null,"Contract_DB_request_reason":"","Contract_DB_complite_day":"20181218","Closing_Bid_Date":"20181206","Assistant_Applied_Date":"20181218","ApprovedType":"3","SPOApprovedQuote":"test1"},{"Opportunity_No":"BJ-SP-BJ0577783","OCM_Agent1_Price_DB":"950000","NotesApprovedNo":"MGZHTSQHN201812009","Contract_DB_SalesDept_complite_day":null,"Contract_DB_request_reason":"","Contract_DB_complite_day":"20181218","Closing_Bid_Date":"20181206","Assistant_Applied_Date":"20181218","ApprovedType":"3","SPOApprovedQuote":"test"}]}';
         req.requestURI = 'services/apexrest/NFM206/execute';
         req.httpMethod = 'POST';
         req.requestBody = Blob.valueof(JsonMsg);
@@ -270,5 +278,99 @@
         //Test.setMock(HttpCalloutMock.class, new NFM205RestCalloutMock());
         //NFM205Rest.execute1('{"Monitoring":{"TransmissionDateTime":"201812201320","Text":"","Tag":"MSGH","Sender":"SFDC","Receiver":"SPO","NumberOfRecord":"1","MessageType":"NFM205","MessageGroupNumber":"20180001722190"},"GeData":[{"Opportunity_Code":"HKBJ-GI-BJ0588881","Bidding_No":"as123121","Bidding_Content":"鎷涙爣鍐呭","Bid_Project_Name":"鎷涙爣椤圭洰鍚�","Bid_Date":"20181203","Authorized_Status":"1","Authorized_Finish_Sales":"30033","Authorized_DB_No":"MGZWESQHN201812001","Authorized_Date":"20190316","Autholization_Activated_Date":"20190415"}]}');
     }
+    // 20220921 ljh add 
+    @isTest static void test_method_five() {
+        Integer batch_retry_max_cnt = Integer.valueOf(System.Label.batch_retry_max_cnt);
+        // Implement test code
+        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+        if (rectCo.size() == 0) {
+            return;
+        }
+        List<RecordType> rectContract = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '濂戠磩'];
+        if (rectCo.size() == 0) {
+            return;
+        }
+        StaticParameter.EscapeNFM007Trigger = true;
+        StaticParameter.EscapeOpportunityBefUpdTrigger = true;
+        StaticParameter.EscapeOpportunityHpDeptUpdTrigger = true;
+        StaticParameter.EscapeSyncOpportunityTrigger = true;
+        StaticParameter.EscapeAccountTrigger = true;
+        //缁忛攢鍟�
+        Account myAccount1 = new Account(name='Testaccount001',
+                                        Dealer_discount__c =20,
+                                        RecordTypeId = rectCo[0].Id);
+        insert myAccount1;
+
+
+        Date authorized_Date = Date.today()-1;
+        Date autholization_Activated = Date.today()-1;
+        Date bid_Date = Date.today()-1;
+        Date dtlast = Date.today()+1;
+
+
+        Opportunity  opp = new Opportunity(Authorized_Finish_Sales__c='11',
+                                           Authorized_DB_No__c='1008', Authorized_Date__c = authorized_Date, 
+                                           Autholization_Activated_Date__c = autholization_Activated ,Bidding_Content__c='qwer',
+                                           Bid_Date__c = bid_Date, Bidding_No__c='4035',Agency1__c = myAccount1.Id,
+                                           Agency2__c = myAccount1.Id, Bidding_Project_Name__c='efg',StageName='鐩',
+                                           Name='xunjia',CloseDate=dtlast,
+                                           Contract_DB_complite_day__c = bid_Date,
+                                           //songxiaoqi-------start
+                                            Estimation_Decision__c = true,
+                                           Estimation_No__c = 'test',
+                                           Estimation_Id__c='002',
+                                           Close_Forecasted_Date__c = Date.today() + 60
+                                           //StageName='寮曞悎'
+                                           //songxiaoqi--------end
+                                           //SAP_Send_OK__c = true
+                                           );
+        // opp.CloseDate = Date.today() + 90;
+        opp.CloseDate = Date.today() + 59;
+        insert opp;
+        //2020/11/4 songxiaoqi  update
+        opp.Estimation_Decision__c=true;
+        opp.StageName= '寮曞悎';
+        //2020/11/4 songxiaoqi  end
+        update opp;
+        Opportunity opplist =  [select Id,Name,Opportunity_No__c ,Estimation_Decision__c from Opportunity where Id = :opp.Id ];
+        System.assertEquals(true, opplist.Estimation_Decision__c);
+        NFM206Rest.GeDatas GeDatas = new NFM206Rest.GeDatas();
+        NFM206Rest.GeData GeData = new NFM206Rest.GeData();
+        GeDatas.GeData = new NFM206Rest.GeData[]{GeData};
+
+        Datetime nowDT = Datetime.now();
+        String nowStr = nowDT.format('yyyyMMddHHmm');
+        GeDatas.Monitoring = new NFMUtil.Monitoring();
+        GeDatas.Monitoring.MessageGroupNumber = nowStr + '01';
+        
+        // GeData.Opportunity_No = opplist.get(0).Opportunity_No__c;
+        GeData.Opportunity_No = opplist.Opportunity_No__c;
+        GeData.OCM_Agent1_Price_DB = '1130000';
+        GeData.NotesApprovedNo = '';
+        GeData.SPOApprovedQuote = 'test';//20200430 add
+        GeData.Contract_DB_SalesDept_complite_day = null;
+        GeData.Contract_DB_request_reason = '';
+        GeData.Contract_DB_complite_day = null;
+        GeData.Closing_Bid_Date = null;
+        GeData.Assistant_Applied_Date = null;
+        GeData.ContractType = '2';
+        GeData.ApprovedType = '1';
+        GeData.SealDate ='20221220';
+        //songxiaoqi--------start
+        //娴嬭瘯鍚堝悓缁堟
+        GeData.IsTermination ='true';
+         //songxiaoqi--------缁撴潫
+        System.Test.startTest();
+        NFMUtil.Monitoring Monitoring = GeDatas.Monitoring;
+        BatchIF_Log__c rowData = NFMUtil.saveRowData(Monitoring, 'NFM206', GeDatas.GeData);
+        //  Batch User 缃垚false 
+        User us = 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 =System.Label.ProfileId_SystemAdmin);
+        insert us;
+        System.runAs(us) {
+            NFM206Rest.main(rowData.Id); 
+        }
+         
+        System.Test.stopTest();
+    }
      
 }
\ No newline at end of file

--
Gitblit v1.9.1