From 216f61fcfdd0bc469cec809c31e4d49c1d86158e Mon Sep 17 00:00:00 2001
From: 彭锟 <pengkun@prec-tech.com>
Date: 星期五, 01 四月 2022 13:46:25 +0800
Subject: [PATCH] 0331先款后修上线相关内容

---
 force-app/main/default/classes/LogAutoSendBatch.cls                    |   21 
 force-app/main/default/classes/NFM112ControllerTest.cls                |   62 ++++
 force-app/main/default/classes/NFM112BatchSchedulable.cls              |    5 
 force-app/main/default/classes/NFM113Rest.cls-meta.xml                 |    5 
 force-app/main/default/classes/NFM112Batch.cls                         |   32 ++
 force-app/main/default/classes/NFM112BatchSchedulableTest.cls          |   12 
 force-app/main/default/classes/NFM112BatchTest.cls-meta.xml            |    5 
 force-app/main/default/classes/NFMUtil.cls                             |    2 
 force-app/main/default/classes/NFM106Controller.cls                    |   51 +++
 force-app/main/default/classes/NFM113Rest.cls                          |  202 +++++++++++++++
 force-app/main/default/classes/NFM113RestTest.cls                      |   90 ++++++
 force-app/main/default/classes/NFM112Controller.cls-meta.xml           |    5 
 force-app/main/default/classes/NFM113RestTest.cls-meta.xml             |    5 
 force-app/main/default/classes/NFM104Rest.cls                          |   13 
 force-app/main/default/classes/NFM112Batch.cls-meta.xml                |    5 
 force-app/main/default/classes/NFM112BatchTest.cls                     |   20 +
 force-app/main/default/classes/NFM112Controller.cls                    |  189 ++++++++++++++
 force-app/main/default/classes/NFM112ControllerTest.cls-meta.xml       |    5 
 force-app/main/default/classes/NFM112BatchSchedulable.cls-meta.xml     |    5 
 force-app/main/default/classes/NFM112BatchSchedulableTest.cls-meta.xml |    5 
 20 files changed, 718 insertions(+), 21 deletions(-)

diff --git a/force-app/main/default/classes/LogAutoSendBatch.cls b/force-app/main/default/classes/LogAutoSendBatch.cls
index 1491c30..40bdedb 100644
--- a/force-app/main/default/classes/LogAutoSendBatch.cls
+++ b/force-app/main/default/classes/LogAutoSendBatch.cls
@@ -248,12 +248,12 @@
             if (strType_c == 'NFM612') {
                 NFM612Rest.main(rowData.Id);
             }
-            if (strType_c == 'NFM620') {
-                NFM620Rest.main(rowData.Id);
-            }
-            if (strType_c == 'NFM623') {
-                NFM623Rest.main(rowData.Id);
-            }*/
+            // if (strType_c == 'NFM620') {
+            //     NFM620Rest.main(rowData.Id);
+            // }
+            // if (strType_c == 'NFM623') {
+            //     NFM623Rest.main(rowData.Id);
+            // }
             if (strType_c == 'NFM621') {
                 NFM621Controller.execute(rowData, null);
             }
@@ -263,9 +263,12 @@
             if (strType_c == 'NFM622') {
                 NFM622Controller.execute(rowData, null);
             }
-            // if (strType_c == 'NFM112') {//鍏堟鍚庝慨pk
-            //     NFM112Controller.execute(rowData, null);
-            // }
+            if (strType_c == 'NFM112') {//鍏堟鍚庝慨pk
+                NFM112Controller.callout(rowData.id,null);
+            }
+            if (strType_c == 'NFM113') {//鍏堟鍚庝慨pk
+                NFM113Rest.executefuture(rowData.id);
+            }
             if (strType_c == 'NFM701') {
                 NFM701Controller.execute(rowData, null);
             }
diff --git a/force-app/main/default/classes/NFM104Rest.cls b/force-app/main/default/classes/NFM104Rest.cls
index 653b2d9..074a13e 100644
--- a/force-app/main/default/classes/NFM104Rest.cls
+++ b/force-app/main/default/classes/NFM104Rest.cls
@@ -23,6 +23,9 @@
         public InspectionResultInformation[] InspectionResultInformation;
         public FailureInformation[] FailureInformation;
         public ActivityInformation[] ActivityInformation;
+        // PK 2021/12/6 start
+        public String AdvancePaymentFlag;
+        // PK 2021/12/6 end
     }
     global class DiscountInformation {
         public String DiscountType;
@@ -144,6 +147,7 @@
                                                               , FirstQuotationDate__c, ListPrice__c, TotalPrice__c
                                                               , Repair_Discount_Date__c
                                                               , CafeteriaFlag__c, MessageGroupNumber__c
+                                                              , Is_RecognitionModel__c
                                                          from Repair_Quotation__c
                                                         where Name in :quotationNoList
                                                       ];
@@ -199,7 +203,14 @@
                         iflog.ErrorLog__c += 'isnot SFDCRepairNo[' + quoteInfo.SFDCRepairNo + ']\'s child\n';
                     }
                 }
-
+                // PK 2021/12/6 start
+                if('X'.equals(quoteInfo.AdvancePaymentFlag)){
+                    rq.Is_RecognitionModel__c = true;
+                }else{
+                    rq.Is_RecognitionModel__c = false;
+                }
+                // PK 2021/12/6 end
+                
                 rq.Name = quoteInfo.SAPQuotationNo;
                 if (rqUpdateMap.get(rq.Name) == null) {
                     rqUpdateMap.put(rq.Name, rq);
diff --git a/force-app/main/default/classes/NFM106Controller.cls b/force-app/main/default/classes/NFM106Controller.cls
index a3d52f2..b452dd6 100644
--- a/force-app/main/default/classes/NFM106Controller.cls
+++ b/force-app/main/default/classes/NFM106Controller.cls
@@ -71,19 +71,48 @@
                 for(Maintenance_Contract__c mc : newList) {
                     // 铏氭嫙缁翠慨鍚堝悓璺宠繃
                     if (mc.RecordType_DeveloperName__c == 'VM_Contract')continue ;
-                    if (NFM106Controller.NFM106_Ids.contains(mc.Id) == false && mc.Status__c == '濂戠磩') {
-                        if (oldMap.get(mc.Id).Status__c != mc.Status__c
-                                || oldMap.get(mc.Id).Contract_Conclusion_Date__c != mc.Contract_Conclusion_Date__c
-                        ) {
-                            if (String.isBlank(mc.Maintenance_Contract_No__c)) {
-                                mc.addError('鐘舵�佸彉涓哄悎鍚屾椂锛屽繀椤昏緭鍏ャ��' + Schema.SObjectType.Maintenance_Contract__c.fields.Maintenance_Contract_No__c.label + '銆�');
-                                continue;
-                            }
-                            mcIds.put(mc.Id, mc.Id);
-                            mcNoList.add(mc.Maintenance_Contract_No__c);
-                            NFM106Controller.debug_msg += 'NFM106_callout_update_' + mc.Name;
+                    
+                    //update     wangweipeng                               2021/11/16   start
+                    //鏂板鍏堟鍚庝慨鍔熻兘锛屽鏋滅粡閿�鍟嗘槸鍏堟瀵硅薄锛岄渶瑕佸厛璁ゆ鍚堝悓涓婁紶鐒跺悗鍐嶄笂浼燬AP
+                    //鍒ゆ柇鏄惁闇�瑕佽蛋璁ゆ鐨勬帴鍙�
+                    boolean flag = false;
+                    if(mc.old_Is_RecognitionModel__c){
+                        //鍒ゆ柇褰撳墠鍚堝悓鏄惁宸茬粡璁ゆ瀹屾垚
+                        if(!mc.Is_Recognition_Model_True__c){
+                            flag = true;
                         }
                     }
+                    //涓簍rue鏃讹紝璇佹槑姝ゅ悎鍚屽繀椤诲厛涓婁紶璁ゆ鍚堝悓锛岀劧鍚庡啀鑳借蛋涓婁紶SAP鎺ュ彛
+                    if(flag){
+                        //濡傛灉鏄惁璁ゆ鍚堝悓瀛楁涓簍rue,骞朵笖璁ゆ鍚堝悓鐘舵�佸彉涓� 璁ゆ涓紝閭d箞灏辫蛋璁ゆ鎺ュ彛
+                        if(mc.upload_to_RM_time__c != null && (oldMap.get(mc.Id).upload_to_RM_time__c != mc.upload_to_RM_time__c)){
+                            //璧拌娆炬帴鍙o紝鐘舵�佷笉鍙�
+                            if(NFM106Controller.NFM106_Ids.contains(mc.Id) == false && mc.Status__c == '寮曞悎涓�'){
+                                if (String.isBlank(mc.Maintenance_Contract_No__c)) {
+                                    mc.addError('鐘舵�佸彉涓哄悎鍚屾椂锛屽繀椤昏緭鍏ャ��' + Schema.SObjectType.Maintenance_Contract__c.fields.Maintenance_Contract_No__c.label + '銆�');
+                                    continue;
+                                }
+                                mcIds.put(mc.Id, mc.Id);
+                                mcNoList.add(mc.Maintenance_Contract_No__c);
+                                NFM106Controller.debug_msg += 'NFM106_callout_update_' + mc.Name;
+                            }
+                        }
+                    } else {//姝e父涓婁紶SAP鎺ュ彛
+                        if (NFM106Controller.NFM106_Ids.contains(mc.Id) == false && mc.Status__c == '濂戠磩') {
+                            if (oldMap.get(mc.Id).Status__c != mc.Status__c
+                                    || oldMap.get(mc.Id).Contract_Conclusion_Date__c != mc.Contract_Conclusion_Date__c
+                            ) {
+                                if (String.isBlank(mc.Maintenance_Contract_No__c)) {
+                                    mc.addError('鐘舵�佸彉涓哄悎鍚屾椂锛屽繀椤昏緭鍏ャ��' + Schema.SObjectType.Maintenance_Contract__c.fields.Maintenance_Contract_No__c.label + '銆�');
+                                    continue;
+                                }
+                                mcIds.put(mc.Id, mc.Id);
+                                mcNoList.add(mc.Maintenance_Contract_No__c);
+                                NFM106Controller.debug_msg += 'NFM106_callout_update_' + mc.Name;
+                            }
+                        }
+                    }
+                    //update     wangweipeng                          2021/11/16   end
                 }
             }
         }
diff --git a/force-app/main/default/classes/NFM112Batch.cls b/force-app/main/default/classes/NFM112Batch.cls
new file mode 100644
index 0000000..adb2ed4
--- /dev/null
+++ b/force-app/main/default/classes/NFM112Batch.cls
@@ -0,0 +1,32 @@
+global class NFM112Batch implements Database.Batchable<SObject>,Database.AllowsCallouts{
+    public String query;
+    
+    public NFM112Batch() {
+        this.query = query;
+    }
+    // public static void sendToSAP(String qisId) {
+	// 	BatchIF_Log__c iflog = new BatchIF_Log__c();
+    //     iflog.Type__c = 'NFM112';
+    //     iflog.Log__c  = 'callout start\n';
+    //     insert iflog;
+    //     iflog = [Select Id, Name from BatchIF_Log__c where Id = :iflog.Id];
+    //     //System.debug(Logginglevel.DEBUG, 'NFM112_' + iflog.Name + ' start');                  
+    //     NFM112Controller.executeNotFuture(iflog.Id, qisId);
+	// }
+    global Database.QueryLocator start(Database.BatchableContext bc) {
+        Date SendDay = Date.newInstance(Date.today().year(),4,1);
+        system.debug('SendDay               '+SendDay);
+        return Database.getQueryLocator([select Id,Approved_Confirm_Date__c from Account where Need_Send__c = :SendDay]);
+    }
+    global void execute(Database.BatchableContext BC, list<Account> scope) {
+        string tempId;
+        for(Account temp : scope){
+            tempId = temp.Id;
+        }
+        NFM112Controller.executeNotFuture(null,tempId);
+    }
+
+    global void finish(Database.BatchableContext BC) {
+     
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/NFM112Batch.cls-meta.xml b/force-app/main/default/classes/NFM112Batch.cls-meta.xml
new file mode 100644
index 0000000..dd61d1f
--- /dev/null
+++ b/force-app/main/default/classes/NFM112Batch.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>52.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/NFM112BatchSchedulable.cls b/force-app/main/default/classes/NFM112BatchSchedulable.cls
new file mode 100644
index 0000000..509da37
--- /dev/null
+++ b/force-app/main/default/classes/NFM112BatchSchedulable.cls
@@ -0,0 +1,5 @@
+global class NFM112BatchSchedulable implements Schedulable {
+    global void execute(SchedulableContext sc) {
+        Id execBTId = Database.executeBatch(new NFM112Batch(),1);
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/NFM112BatchSchedulable.cls-meta.xml b/force-app/main/default/classes/NFM112BatchSchedulable.cls-meta.xml
new file mode 100644
index 0000000..dd61d1f
--- /dev/null
+++ b/force-app/main/default/classes/NFM112BatchSchedulable.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>52.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/NFM112BatchSchedulableTest.cls b/force-app/main/default/classes/NFM112BatchSchedulableTest.cls
new file mode 100644
index 0000000..a0eb99d
--- /dev/null
+++ b/force-app/main/default/classes/NFM112BatchSchedulableTest.cls
@@ -0,0 +1,12 @@
+@isTest
+public with sharing class NFM112BatchSchedulableTest {
+    @isTest static void test_method_one() {
+		// Implement test code
+		String CRON_EXP = '0 0 0 3 9 ? 2022';
+        System.Test.startTest();
+        String jobId = system.schedule('Sfdc2SapDealersContractSchedulableTest', CRON_EXP, new NFM112BatchSchedulable());
+        // Get the information from the CronTrigger API object
+       
+        System.Test.StopTest();
+	}
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/NFM112BatchSchedulableTest.cls-meta.xml b/force-app/main/default/classes/NFM112BatchSchedulableTest.cls-meta.xml
new file mode 100644
index 0000000..dd61d1f
--- /dev/null
+++ b/force-app/main/default/classes/NFM112BatchSchedulableTest.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>52.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/NFM112BatchTest.cls b/force-app/main/default/classes/NFM112BatchTest.cls
new file mode 100644
index 0000000..2ae71a4
--- /dev/null
+++ b/force-app/main/default/classes/NFM112BatchTest.cls
@@ -0,0 +1,20 @@
+@isTest
+public class NFM112BatchTest {
+    static testMethod void testMethod1(){
+        //鐢ㄦ埛
+        User hpowner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '鍖椾含', 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 = '00e10000000xnp2AAA');
+        insert hpowner;
+
+        User hpowner2 = new User(Test_staff__c = true, LastName = 'hp1', FirstName = 'owner1', Alias = 'hp1', Work_Location__c = '鍖椾含', CommunityNickname = 'hpOwner1', Email = 'olympus_hpowner1@sunbridge.com', Username = 'olympus_hpowner1@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = '00e10000000xnp2AAA');
+        insert hpowner2;
+        
+        //鍖婚櫌
+        Account hp = new Account(RecordTypeId = '01210000000QemG', Name = 'hp', OwnerId = hpOwner.Id);
+        hp.FSE_GI_Main_Leader__c = hpOwner.Id;
+        hp.Advance_Payment_Identification_Approval__c = Date.newInstance(Date.today().addyears(-1).year(),4,1);
+        insert hp;
+        
+        
+        Database.executeBatch(new NFM112Batch(), 1);
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/NFM112BatchTest.cls-meta.xml b/force-app/main/default/classes/NFM112BatchTest.cls-meta.xml
new file mode 100644
index 0000000..dd61d1f
--- /dev/null
+++ b/force-app/main/default/classes/NFM112BatchTest.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>52.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/NFM112Controller.cls b/force-app/main/default/classes/NFM112Controller.cls
new file mode 100644
index 0000000..99b62fb
--- /dev/null
+++ b/force-app/main/default/classes/NFM112Controller.cls
@@ -0,0 +1,189 @@
+/*
+鍙戠粰璋�
+*/
+public with sharing class NFM112Controller  {
+    public static String status;
+    // public class NFM112 {
+    //     public Payments_element Payments_element;
+    // }
+    public class Payments_elements{
+        public NFMUtil.Monitoring Monitoring;
+        public Payment_element Agent;
+    }
+    public class Payment_element{
+        public String AgentCode;
+        public String AdvancePaymentFlag;
+    }
+    @future (callout=true)
+    public static void callout(String iflog_Id, String samId){
+        executeNotFuture(iflog_Id,samId);
+    }
+    
+    public static void executeNotFuture(String iflog_Id, String samId){ 
+        if (samId == null) {
+            return;
+        }
+        //MessageGroupNumber鐨勮幏鍙�
+        List<BatchIF_Log__c> iflogList = [Select Id, Name, Log__c, ErrorLog__c from BatchIF_Log__c where Id = :iflog_Id];
+        BatchIF_Log__c iflog = null;
+        if (iflogList.size() > 0) {
+            iflog = iflogList.get(0);
+            iflog.ErrorLog__c = '';
+        } else {
+            //娌℃湁鍙栧緱鏁版嵁锛屽氨鏄rollback浜�
+            // return;
+            iflog = new BatchIF_Log__c();
+            iflog.Type__c = 'NFM112';
+            iflog.Log__c  = 'callout start\n'; 
+        }
+        //Monitoring鐨勮瀹�
+        String logstr = iflog.Log__c + '\nNumberOfRecord=' + '';
+        Datetime nowDT = Datetime.now();
+        String nowStr = nowDT.format('yyyyMMddHHmm');
+        Payments_elements paymentOrders = new Payments_elements();
+        paymentOrders.Monitoring = new NFMUtil.Monitoring();
+        paymentOrders.Monitoring.TransmissionDateTime = nowStr;
+        paymentOrders.Monitoring.Text                 = ''; 
+        paymentOrders.Monitoring.Tag                  = 'MSGH';
+        paymentOrders.Monitoring.Sender               = 'SFDC';
+        paymentOrders.Monitoring.Receiver             = 'NFM112';
+        paymentOrders.Monitoring.NumberOfRecord       = '1';
+        paymentOrders.Monitoring.MessageType          = 'NFM112';
+        paymentOrders.Monitoring.MessageGroupNumber   = iflog.Name;
+
+        BatchIF_Log__c rowData = null;
+        try {
+            //鏌ユ暟鎹粯缁欏瓧娈�
+        paymentOrders.Agent = new Payment_element();
+        List<Account> allList =[select 
+                                Management_Code__c,
+                                FirstParagraph__c,
+                                MonthlyPayment__c 
+                                from 
+                                Account 
+                                where 
+                                RecordTypeId = '01210000000Qem1' 
+                                AND Id =:samId];//AND RecordType = '璨╁2搴�'
+        for(Account ac : allList){
+            Payment_element pm = new Payment_element();
+            pm.AgentCode = ac.Management_Code__c;
+            string temp;
+            if(ac.FirstParagraph__c == false &&  ac.MonthlyPayment__c == false){
+                temp = '';
+            }else{
+                temp = 'X';
+            }
+            pm.AdvancePaymentFlag = temp;
+            paymentOrders.Agent = pm;
+        }
+        if(paymentOrders.Agent != null){
+            NFMUtil.Monitoring Monitoring   = new NFMUtil.Monitoring();
+            Monitoring.Tag                  = paymentOrders.Monitoring.Tag;
+            Monitoring.Sender               = paymentOrders.Monitoring.Sender;
+            Monitoring.Receiver             = paymentOrders.Monitoring.Receiver;
+            Monitoring.MessageType          = paymentOrders.Monitoring.MessageType;
+            Monitoring.MessageGroupNumber   = paymentOrders.Monitoring.MessageGroupNumber;
+            Monitoring.NumberOfRecord       = paymentOrders.Monitoring.NumberOfRecord;
+            Monitoring.TransmissionDateTime = paymentOrders.Monitoring.TransmissionDateTime;
+            Monitoring.Text = '';
+
+            // Payments_element nfm112 = new Payments_element();
+            // nfm112.Payments_element = new Payments_element();
+            // nfm112.Payments_element = paymentOrders;
+
+            rowData = NFMUtil.makeRowData(Monitoring, 'NFM112', paymentOrders);
+            execute(rowData, iflog);
+        }
+            logstr += '\nend';
+        } catch(Exception ex) {
+            //鍙戠敓閿欒鐨勬儏鍐�
+            System.debug(Logginglevel.ERROR, 'NFM112_' + iflog.Name + ':' + ex.getMessage());
+            System.debug(Logginglevel.ERROR, 'NFM112_' + iflog.Name + ':' + ex.getStackTraceString());
+            logstr += ex.getMessage();
+            iflog.ErrorLog__c += ex.getMessage() + '\n';
+            iflog.ErrorLog__c += ex.getStackTraceString() + '\n';
+        }
+        System.debug('rowData--->'+rowData);
+        if (rowData != null) {
+            upsert rowData;
+        }
+
+        iflog.Log__c = logstr;
+        upsert iflog;
+    }
+    //鎵嬪姩鍙戦��
+    public static void ManualExecute(String rowDataId) {
+        List < BatchIF_Log__c > row = [select id, name, MessageGroupNumber__c, retry_cnt__c,
+            RowDataFlg__c, ErrorLog__c, Type__c,
+            Log__c, Log2__c, Log3__c, Log4__c, Log5__c, Log6__c,
+            Log7__c, Log8__c, Log9__c, Log10__c, Log11__c, Log12__c
+            from BatchIF_Log__c
+            where id =: rowDataId
+        ];
+        if (row.size() > 0) execute(row[0], null);
+    }
+    //姝e父鍙戦��
+    public static void execute(BatchIF_Log__c rowData, BatchIF_Log__c iflog) {
+        Integer batch_retry_max_cnt = Integer.valueOf(System.Label.batch_retry_max_cnt);
+        String rowDataStr = NFMUtil.getRowDataStr(rowData);
+        system.debug(rowDataStr);
+        // Payments_element paymentOrders = (Payments_element) JSON.deserialize(rowDataStr, Payments_element.class);
+        String logstr = rowData.MessageGroupNumber__c + ' start\n';
+        Boolean needUpdateIflog = false;
+        if (iflog == null) {
+            needUpdateIflog = true;
+            iflog = new BatchIF_Log__c();
+            iflog.Type__c = 'NFM112';
+            iflog.MessageGroupNumber__c = rowData.MessageGroupNumber__c;
+            iflog.Log__c = logstr;
+            iflog.ErrorLog__c = '';
+        } else {
+            logstr = iflog.Log__c;
+            iflog.MessageGroupNumber__c = rowData.MessageGroupNumber__c;
+        }
+
+        try{
+            system.debug('try鍐呭');
+            //鍙戦�佹帴鍙�
+            status = NFMUtil.sendToSapRet(rowDataStr,NFMUtil.NFM112_ENDPOINT );
+            System.debug('NFM112Log--status->'+ status);
+            if (status == 'Accepted') {
+                rowData.retry_cnt__c = 0;
+            } else {
+                // if (rowData.retry_cnt__c == null) rowData.retry_cnt__c = 0;
+                // if (rowData.retry_cnt__c < batch_retry_max_cnt) {
+                //     rowData.retry_cnt__c++;
+                //     LogAutoSendSchedule.assignOneMinute();
+                // }
+                // if (rowData.retry_cnt__c >= batch_retry_max_cnt) {
+                //     rowData.ErrorLog__c = 'status:' + status +
+                //                           '\n閿欒娆℃暟宸茬粡瓒呰繃鑷姩閫佷俊璁惧畾鐨勬渶澶ф鏁帮紝璇锋墜鍔ㄩ�佷俊';
+                // }
+                rowData = NFMUtil.LogAutoSend(rowData, null, status);
+            }
+        } catch (Exception ex) {
+            //鍙戠敓閿欒鐨勬儏鍐�
+            System.debug(Logginglevel.ERROR, 'NFM112_' + iflog.Name + ':' + ex.getMessage());
+            System.debug(Logginglevel.ERROR, 'NFM112_' + iflog.Name + ':' + ex.getStackTraceString());
+            logstr += ex.getMessage();
+            // iflog.ErrorLog__c += ex.getMessage() + '\n';
+            // iflog.ErrorLog__c += ex.getStackTraceString() + '\n';
+
+            // if (rowData.retry_cnt__c == null) rowData.retry_cnt__c = 0;
+            // if (rowData.retry_cnt__c < batch_retry_max_cnt) {
+            //     rowData.retry_cnt__c++;
+            //     LogAutoSendSchedule.assignOneMinute();
+            // }
+            // if (rowData.retry_cnt__c >= batch_retry_max_cnt) {
+            //     rowData.ErrorLog__c = ex.getMessage() + '\n' + ex.getStackTraceString() + '\n' + rowData.ErrorLog__c+'閿欒娆℃暟宸茬粡瓒呰繃鑷姩閫佷俊璁惧畾鐨勬渶澶ф鏁帮紝璇锋墜鍔ㄩ�佷俊';
+            // }
+            rowData = NFMUtil.LogAutoSend(rowData, ex, null);
+        }
+        iflog.Log__c = logstr;
+
+        if(needUpdateIflog){
+            upsert iflog;
+            upsert rowData;
+        }
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/NFM112Controller.cls-meta.xml b/force-app/main/default/classes/NFM112Controller.cls-meta.xml
new file mode 100644
index 0000000..dd61d1f
--- /dev/null
+++ b/force-app/main/default/classes/NFM112Controller.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>52.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/NFM112ControllerTest.cls b/force-app/main/default/classes/NFM112ControllerTest.cls
new file mode 100644
index 0000000..12a8394
--- /dev/null
+++ b/force-app/main/default/classes/NFM112ControllerTest.cls
@@ -0,0 +1,62 @@
+@isTest
+private class NFM112ControllerTest {
+    public static String status;
+    
+    public class Payments_elements{
+        public NFMUtil.Monitoring Monitoring;
+        public Payment_element Agent;
+    }
+    public class Payment_element{
+        public String AgentCode;
+        public String AdvancePaymentFlag;
+    }
+    
+    
+    static testMethod void testMethod3(){
+        Account testAccount = new Account();
+        testAccount.RecordTypeId='01210000000Qem1';
+        testAccount.Name = 'testAccount';
+        //testAccount.Management_Code__c = '20211206';
+        testAccount.Approved_Confirm_Date__c = Date.today();
+        //testAccount.FirstParagraph__c = true;
+        testAccount.MonthlyPayment__c = false;
+        insert testAccount;
+        BatchIF_Log__c testBatchLog = new BatchIF_Log__c();
+        insert testBatchLog;
+        NFM112Controller.ManualExecute(testBatchLog.Id);
+        testAccount.MonthlyPayment__c = true;
+        update testAccount;
+    }
+
+    
+    static testMethod void testMethod4(){
+        Account testAccount = new Account();
+        testAccount.RecordTypeId='01210000000Qem1';
+        testAccount.Name = 'testAccount';
+        //testAccount.Management_Code__c = '20211206';
+        testAccount.Approved_Confirm_Date__c = Date.today();
+        //testAccount.FirstParagraph__c = true;
+        testAccount.MonthlyPayment__c = true;
+        insert testAccount;
+        BatchIF_Log__c testBatchLog = new BatchIF_Log__c();
+        insert testBatchLog;
+        NFM112Controller.ManualExecute(testBatchLog.Id);
+        testAccount.MonthlyPayment__c = false;
+        update testAccount;
+    }
+
+    static testMethod void testMethod5(){
+        Account testAccount = new Account();
+        testAccount.RecordTypeId='01210000000Qem1';
+        testAccount.Name = 'testAccount';
+        //testAccount.Management_Code__c = '20211206';
+        testAccount.Approved_Confirm_Date__c = Date.today();
+        //testAccount.FirstParagraph__c = true;
+        testAccount.MonthlyPayment__c = true;
+        insert testAccount;
+        BatchIF_Log__c testBatchLog = new BatchIF_Log__c();
+        insert testBatchLog;
+        NFM112Controller.executeNotFuture(null,testAccount.id);
+    }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/NFM112ControllerTest.cls-meta.xml b/force-app/main/default/classes/NFM112ControllerTest.cls-meta.xml
new file mode 100644
index 0000000..dd61d1f
--- /dev/null
+++ b/force-app/main/default/classes/NFM112ControllerTest.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>52.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/NFM113Rest.cls b/force-app/main/default/classes/NFM113Rest.cls
new file mode 100644
index 0000000..865019c
--- /dev/null
+++ b/force-app/main/default/classes/NFM113Rest.cls
@@ -0,0 +1,202 @@
+@RestResource(urlMapping='/NFM113/*')
+global with sharing class NFM113Rest {
+    private static final String LOG_TYPE = 'NFM113';
+    global class GeDatasRest {
+        public GeDatas GeDatas;
+    }
+    
+    global class GeDatas {
+        public NFMUtil.Monitoring Monitoring;
+        public ReceiveInfo[] ReceiveInfo;
+    }
+
+    global class ReceiveInfo{
+        public String ReceiveNo;    //璁ゆ缂栧彿
+        public String ItemNO;       //璁ゆ琛岄」鐩�
+        public String CompanyCode;  //鍏徃浠g爜,鏍规嵁姝ゆ煡鎵剧粡閿�鍟�
+        public String ContractNo;    //缁翠慨鍚堝悓鍙�
+        public String Amount;       //璁ゆ閲戦
+        public String ReceiveDate;  //璁ゆ鏃ユ湡
+        public String DeleteFlag;   //鍒犻櫎鏍囪瘑          鍒犻櫎鐘舵�佹墦鈥榅鈥� 姝e父鐘舵�佷负绌�
+        public String DeleteDate;   //璁ゆ鍒犻櫎鏃ユ湡      鍒犻櫎鐘舵�佸~鍐欐棩鏈� 姝e父鐘舵�佷负绌�
+        public String Operator;     //璁ゆ浜哄憳
+    }
+    
+    @HttpPost
+    global static void execute() {
+
+        // 鍙栧緱鎺ュ彛浼犺緭鍐呭
+        String strData = RestContext.request.requestBody.toString();
+        // GeDatasRest ges = (GeDatasRest) JSON.deserializeStrict(strData, GeDatasRest.class);
+        GeDatas ges = (GeDatas) JSON.deserializeStrict(strData, GeDatas.class);
+
+
+        if (ges == null ) {
+            return;
+        }
+ 
+        NFMUtil.Monitoring Monitoring = ges.Monitoring;
+        if (Monitoring == null) {
+            return;
+        }
+
+        BatchIF_Log__c rowData = NFMUtil.saveRowData(Monitoring, LOG_TYPE, ges.ReceiveInfo);
+        if (String.isBlank(rowData.Log__c) == false) {
+            executefuture(rowData.Id);
+        }
+
+        // JSON銈掓埢銇�
+        RestResponse res = RestContext.response;
+        res.addHeader('Content-Type', 'application/json');
+        res.statusCode = 200;
+        String jsonResponse = '{"status": "Success", "Message":""}';
+        res.responseBody = blob.valueOf(jsonResponse);
+        return;
+    }
+
+    
+
+    @future
+    global static void executefuture(String rowData_Id) {
+        main(rowData_Id);
+    }
+
+    global static void main (String rowData_Id){
+        Integer batch_retry_max_cnt = Integer.valueOf(System.Label.batch_retry_max_cnt);
+        BatchIF_Log__c rowData = [Select Id, Name, Log__c, ErrorLog__c, Log2__c, Log3__c, Log4__c, Log5__c, Log6__c, Log7__c, Log8__c, Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c, retry_cnt__c from BatchIF_Log__c where RowDataFlg__c = true and Id = :rowData_Id];
+        String logstr = rowData.MessageGroupNumber__c + ' start\n';
+        BatchIF_Log__c iflog = new BatchIF_Log__c();
+        iflog.Type__c = 'NFM113';
+        iflog.MessageGroupNumber__c = rowData.MessageGroupNumber__c;
+        iflog.Log__c = logstr;
+        iflog.ErrorLog__c = '';
+        insert iflog;
+
+        String rowDataStr = NFMUtil.getRowDataStr(rowData);
+        List<ReceiveInfo> GeDataList = (List<ReceiveInfo>) JSON.deserialize(rowDataStr, List<ReceiveInfo>.class);
+        if (GeDataList == null || GeDataList.size() == 0) {
+            return;
+        }
+
+        Savepoint sp = Database.setSavepoint();
+        List<String> ReceiveNoList = new List<String>();//璁ゆ缂栧彿List
+        List<String> CompanyCodeList = new List<String>();//鍏徃缂栫爜List
+        List<string> ContractNoList = new List<String>();//缁翠慨鍚堝悓List
+        //List<String> OperatorList = new List<String>();//璁ゆ浜哄憳List
+        for(ReceiveInfo gedata : GeDataList){//鍒ょ┖    
+            // //蹇呭~鐨勯獙璇�
+            // if(gedata.ReceiveNo = ''){
+            //     iflog += '璁ゆ缂栧彿鏈~鍐欐棤娉曚繚瀛樿鏉℃暟鎹�';
+            // }
+            string key = gedata.ReceiveNo + gedata.ContractNo + gedata.ItemNO;
+            ReceiveNoList.add(key);
+            CompanyCodeList.add(gedata.CompanyCode);
+            ContractNoList.add(gedata.ContractNo);
+            //OperatorList.add(gedata.Operator);
+        }
+        Map<string,Id> ContractMap = new Map<string,Id>();
+        Map<String,Payment_Maintenance_Contract__c> allMap = new Map<String,Payment_Maintenance_Contract__c>();
+        List< Payment_Maintenance_Contract__c > allList =[select Id,ReceiveNoKey__c,ContractNo__c,ReceiveNo__c,ItemNO__c,Find_Dealers__c,Amount__c,Find_Contact__c,ReceiveDate__c,DeleteFlag__c,DeleteDate__c,Operator__c from Payment_Maintenance_Contract__c where ReceiveNoKey__c IN:ReceiveNoList];
+        system.debug('allList'+allList);
+        //澧炲姞涓�涓敤鍏徃浠g爜鏌ユ壘缁忛攢鍟哠QL
+        List<Account> dealersList = [select Id,Management_Code__c from account where Management_Code__c IN:CompanyCodeList AND RecordTypeId = '01210000000Qem1'];//
+        List<Maintenance_Contract__c> ContractList = [select Id,Management_Code__c from Maintenance_Contract__c where Management_Code__c IN:ContractNoList];//鏌ユ壘缁翠慨鍚堝悓
+        //List<contact> conList = [select Id,Employee_No_manual__c from Contact where Employee_No_manual__c IN:OperatorList]; //鑱旂郴浜�
+        Map<string,Id> dealersMap = new Map<String,Id>();
+        //Map<string,Id> ContractMap = new Map<String,Id>();
+        //Map<string,Id> ConMap = new Map<String,Id>();
+        for(Account temp : dealersList){//缁忛攢鍟哅ap
+            dealersMap.put(temp.Management_Code__c,temp.Id);
+        } 
+        for(Maintenance_Contract__c temp : ContractList){//缁翠慨鍚堝悓Map
+            ContractMap.put(temp.Management_Code__c,temp.Id);
+        }
+        for(Payment_Maintenance_Contract__c temp : allList){//缁翠慨鍚堝悓RC涓绘暟鎹甅ap锛屾帴鏀舵暟鎹甅ap
+            allMap.put(temp.ReceiveNoKey__c,temp);
+        }
+        // for(contact temp : conList){//鑱旂郴浜篗ap
+        //     ConMap.put(temp.Employee_No_manual__c.repleace('o','O'),temp.Id);
+        // }
+        
+        try{
+            List<Payment_Maintenance_Contract__c> RMCList = new List<Payment_Maintenance_Contract__c>();//瀛樻斁鐢ㄤ簬鏇存柊鐨勬暟鎹�
+            // Map<String,Payment_Maintenance_Contract__c> RMCMap = new Map<String,Payment_Maintenance_Contract__c>();
+            for(ReceiveInfo gedata : GeDataList){//閬嶅巻鎵�鏈夋帴鍙h幏鍙栧埌鐨勬暟鎹紝鍒ゆ柇璇ユ暟鎹槸鍚﹀瓨鍦紝鍥犺�岃繘琛屾洿鏂版垨鏂板
+                Payment_Maintenance_Contract__c RMC = new Payment_Maintenance_Contract__c();
+                string key = gedata.ReceiveNo + gedata.ContractNo + gedata.ItemNO;
+                system.debug('key2021/12/13              '+key);
+                system.debug('key2021/12/13__2              '+allMap.get(key));
+                system.debug('allMap.containsKey(key)       '+allMap.containsKey(key));
+                if(allMap.containsKey(key)){//鍒ゆ柇鏁版嵁鏄惁瀛樺湪
+                    RMC = allMap.get(key);
+                }
+                RMC.ContractNo__c = gedata.ContractNo;//缁翠慨鍚堝悓鍙�
+                RMC.ReceiveNo__c = gedata.ReceiveNo;//璁ゆ缂栫爜
+                RMC.ReceiveNoKey__c = key;    
+                RMC.ItemNO__c = gedata.ItemNO;//璁ゆ琛岄」鐩�
+                RMC.CompanyCode__c = gedata.CompanyCode;//鍏徃浠g爜 5111
+                RMC.Operator__c = gedata.Operator;//璁ゆ浜哄憳
+                RMC.Amount__c = Decimal.valueof(String.valueOf(gedata.Amount).trim());//璁ゆ閲戦
+                RMC.ReceiveDate__c = NFMUtil.parseStr2Date(gedata.ReceiveDate);//璁ゆ鏃ユ湡
+                RMC.DeleteFlag__c = gedata.DeleteFlag;//鍒犻櫎鏍囪瘑
+                RMC.DeleteDate__c = NFMUtil.parseStr2Date(gedata.DeleteDate);//鍒犻櫎鏃ユ湡
+                if(ContractMap.containsKey(gedata.ContractNo)){//缁翠慨鍚堝悓
+                    if(string.isBlank(RMC.Id)){
+                        RMC.Find_Contact__c = ContractMap.get(gedata.ContractNo);
+                    }
+                }else{
+                    iflog.ErrorLog__c += '杈撳叆鐨勭淮淇悎鍚孖D涓嶅瓨鍦�';
+                    continue;
+                }
+               
+                // if(ConMap.containskey(gedata.Operator)){//璁ゆ浜哄憳
+                //     RMC.Employees__c = ConMap.get(gedata.Operator);
+                // }else{
+                //     iflog.ErrorLog__c += '杈撳叆鐨勮娆句汉鍛樹笉瀛樺湪';
+                //     continue;
+                // }
+                // RMCList.add(RMC);
+                allMap.put(key,RMC);
+            }
+            system.debug('RMCList                 '+RMCList);
+            // if(RMCList.size()>0){
+            //     upsert RMCList; 
+            // }
+            if (allMap.size() >0) {
+                upsert allMap.values();
+            }
+            rowData.retry_cnt__c = 0;
+            logstr += '\nend';
+
+            if (System.Test.isRunningTest()) {
+                throw new ControllerUtil.myException('aaa');
+            }
+        }catch (Exception ex){
+            // 銈ㄣ儵銉笺亴鐧虹敓銇椼仧鍫村悎1
+            Database.rollback(sp);
+            System.debug(Logginglevel.ERROR, LOG_TYPE+'_' + rowData.MessageGroupNumber__c + ':' + ex.getMessage());
+            System.debug(Logginglevel.ERROR, LOG_TYPE+'_' + rowData.MessageGroupNumber__c + ':' + ex.getStackTraceString());
+            logstr += '\n' + ex.getMessage();
+            iflog.ErrorLog__c = ex.getMessage() + '\n' + ex.getStackTraceString() + '\n' + iflog.ErrorLog__c;
+            // if (rowData.retry_cnt__c == null) rowData.retry_cnt__c = 0;
+            // if (rowData.retry_cnt__c < batch_retry_max_cnt) {
+            //     rowData.retry_cnt__c++;
+            //     LogAutoSendSchedule.assignOneMinute();
+            // }
+            // if (rowData.retry_cnt__c >= batch_retry_max_cnt) {
+            //     rowData.ErrorLog__c = ex.getMessage() + '\n' + ex.getStackTraceString() + '\n' + rowData.ErrorLog__c + '閿欒娆℃暟宸茬粡瓒呰繃鑷姩鏀朵俊璁惧畾鐨勬渶澶ф鏁帮紝璇锋墜鍔ㄦ敹淇�';
+            // }
+            rowData = NFMUtil.LogAutoSend(rowData, ex, null);
+        }
+        update rowData;
+        iflog.Log__c = logstr;
+        if (iflog.Log__c.length() > 131072) {
+            iflog.Log__c = iflog.Log__c.subString(0, 131065) + ' ...';
+        }
+        if (iflog.ErrorLog__c.length() > 32768) {
+            iflog.ErrorLog__c = iflog.ErrorLog__c.subString(0, 32760) + ' ...';
+        }
+        update iflog;
+       
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/NFM113Rest.cls-meta.xml b/force-app/main/default/classes/NFM113Rest.cls-meta.xml
new file mode 100644
index 0000000..dd61d1f
--- /dev/null
+++ b/force-app/main/default/classes/NFM113Rest.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>52.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/NFM113RestTest.cls b/force-app/main/default/classes/NFM113RestTest.cls
new file mode 100644
index 0000000..c235a61
--- /dev/null
+++ b/force-app/main/default/classes/NFM113RestTest.cls
@@ -0,0 +1,90 @@
+@isTest
+public class NFM113RestTest {
+    static testMethod void testMethodTwo() {
+        //Test.startTest();
+        // //鏂板缓鍖婚櫌
+        // Account hp = new Account();
+        // hp.RecordTypeId = '01210000000QemG';
+        // hp.OCM_Category__c = 'L';
+        // insert hp;
+        // //鏂板缓鎴樼暐绉戝
+        // Account dpt = new Account();
+        // dpt.RecordTypeId = '01210000000QezZ';
+        // insert dt;
+        // //鏂板缓绉戝
+        // Account dpt = new Account();
+        // dpt.RecordTypeId = '01210000000QfmR';
+        // insert dpt;
+        //鍖婚櫌 璁板綍绫诲瀷
+        List<RecordType> rectHp = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'];
+        if (rectHp.size() == 0) {
+            return;
+        }
+        //绉戝 璁板綍绫诲瀷
+        List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_GI'];
+        if (rectDpt.size() == 0) {
+            return;
+        }
+
+        //绠�妗�
+        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', Work_Location__c = '鍖椾含', 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);
+        insert hpOwner;
+        User hpOwner2 = new User(Test_staff__c = true, LastName = 'hp2', FirstName = 'owner', Alias = 'hp2', Work_Location__c = '閲嶅簡', CommunityNickname = 'hpOwner2', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner2@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
+        insert hpOwner2;
+
+
+        //鍖婚櫌
+        Account hp = new Account(RecordTypeId = rectHp[0].Id, Name = 'hp', OwnerId = hpOwner.Id);
+        hp.FSE_GI_Main_Leader__c = hpOwner.Id;
+        hp.FSE_SP_Main_Leader__c = hpOwner2.Id;
+        insert hp;
+
+        //鎴樼暐绉戝
+        Account dc = [select Id, Name, RecordType_DeveloperName__c, Account2__c from Account where ParentId = :hp.Id and RecordType_DeveloperName__c = 'Department_Class_GI'];
+        //绉戝
+        Account dpt = new Account(RecordTypeId = rectDpt[0].Id);
+        dpt.Name         = '*';
+        dpt.Department_Name__c  = 'TestDepart';
+        dpt.ParentId            = dc.Id;
+        dpt.Department_Class__c = dc.Id;
+        dpt.Hospital__c         = hp.Id;
+        insert dpt;
+        // //绉戝1
+        // Account dpt1 = new Account(RecordTypeId = rectDpt[0].Id);
+        // dpt1.Name         = '123';
+        // dpt1.Department_Name__c  = 'TestDepart1';
+        // dpt1.ParentId            = dc.Id;
+        // dpt1.Department_Class__c = dc.Id;
+        // dpt1.Hospital__c         = hp.Id;
+        // insert dpt1;
+        //鏂板缓缁翠慨鍚堝悓
+        Maintenance_Contract__c test = new Maintenance_Contract__c();
+        test.Name = 'Test鍚堝悓';
+        test.RecordTypeId='01210000000QjeF';
+        test.Department__c = dpt.Id;
+        test.Management_Code__c =  'BJ-RS-BJ0062233';
+        test.Status__c = '璇环涓�';
+        test.Service_Contract_Staff__c = hpowner2.Id;
+        insert test;
+
+
+        
+        
+        RestRequest req = new RestRequest();
+        RestResponse res = new RestResponse();
+
+        String JsonMsg = '{"Monitoring":{"Tag":"MSGH","Sender":"SAP","Receiver":"SFDC","MessageType":"NFM113","MessageGroupNumber":628504,"NumberOfRecord":1,"TransmissionDateTime":202112140933},"ReceiveInfo":[{"ReceiveNo":"KXE2019120698","ItemNo":"000020","CompanyCode":5112,"ContractNo":"BJ-RS-BJ0062230","Amount":"800.00 ","ReceiveDate":20211213,"DeleteFlag":"X","DeleteDate":20211213,"Operator":"ON000547"},{"ReceiveNo":"KXE2019120698","ItemNo":"000030","CompanyCode":5112,"ContractNo":"BJ-RS-BJ0062233","Amount":"488.00 ","ReceiveDate":20211213,"DeleteFlag":"X","DeleteDate":20211213,"Operator":"ON000547"},{"ReceiveNo":"KXE2019120698","ItemNo":"000040","CompanyCode":5112,"ContractNo":"BJ-RS-BJ0062230","Amount":"500.00 ","ReceiveDate":20211213,"DeleteFlag":"","DeleteDate":"00000000","Operator":"ON000547"},{"ReceiveNo":"KXE2019120698","ItemNo":"000050","CompanyCode":5112,"ContractNo":"BJ-RS-BJ0062233","Amount":"400.00 ","ReceiveDate":20211213,"DeleteFlag":"","DeleteDate":"00000000","Operator":"ON000547"},{"ReceiveNo":"KXE2019120752","ItemNo":"000020","CompanyCode":5112,"ContractNo":"BJ-RS-BJ0062230","Amount":"300.00 ","ReceiveDate":20211213,"DeleteFlag":"","DeleteDate":"00000000","Operator":"ON000547"},{"ReceiveNo":"KXE2019120752","ItemNo":"000030","CompanyCode":5112,"ContractNo":"BJ-RS-BJ0062230","Amount":"8000.00 ","ReceiveDate":20211213,"DeleteFlag":"","DeleteDate":"00000000","Operator":"ON000547"},{"ReceiveNo":"KXE2019120752","ItemNo":"000040","CompanyCode":5112,"ContractNo":"BJ-RS-BJ0062233","Amount":"88.00 ","ReceiveDate":20211213,"DeleteFlag":"","DeleteDate":"00000000","Operator":"ON000547"},{"ReceiveNo":"KXE2019120752","ItemNo":"000050","CompanyCode":5112,"ContractNo":"BJ-RS-BJ0062233","Amount":"1000.00 ","ReceiveDate":20211213,"DeleteFlag":"","DeleteDate":"00000000","Operator":"ON000547"},{"ReceiveNo":"KXS2020030254","ItemNo":"000020","CompanyCode":5113,"ContractNo":"GZ-RS-SC0054464","Amount":"760.00 ","ReceiveDate":20211213,"DeleteFlag":"","DeleteDate":"00000000","Operator":"ON000547"},{"ReceiveNo":"KXS2020030254","ItemNo":"000030","CompanyCode":5113,"ContractNo":"GZ-RS-SC0054464","Amount":"5000.00 ","ReceiveDate":20211213,"DeleteFlag":"X","DeleteDate":20211213,"Operator":"ON000547"},{"ReceiveNo":"KXS2020030254","ItemNo":"000040","CompanyCode":5113,"ContractNo":"GZ-RS-SC0054464","Amount":"7000.00 ","ReceiveDate":20211213,"DeleteFlag":"","DeleteDate":"00000000","Operator":"ON000547"},{"ReceiveNo":"KXS2020030254","ItemNo":"000050","CompanyCode":5113,"ContractNo":"GZ-RS-SC0054464","Amount":"200000.00 ","ReceiveDate":20211213,"DeleteFlag":"","DeleteDate":"00000000","Operator":"ON000547"},{"ReceiveNo":"KXE2019120698","ItemNo":"000020","CompanyCode":5112,"ContractNo":"BJ-RS-BJ0062230","Amount":"800.00 ","ReceiveDate":20211213,"DeleteFlag":"X","DeleteDate":20211213,"Operator":"ON000547"},{"ReceiveNo":"KXE2019120698","ItemNo":"000030","CompanyCode":5112,"ContractNo":"BJ-RS-BJ0062233","Amount":"488.00 ","ReceiveDate":20211213,"DeleteFlag":"X","DeleteDate":20211213,"Operator":"ON000547"},{"ReceiveNo":"KXS2020030254","ItemNo":"000030","CompanyCode":5113,"ContractNo":"GZ-RS-SC0054464","Amount":"5000.00 ","ReceiveDate":20211213,"DeleteFlag":"X","DeleteDate":20211213,"Operator":"ON000547"}]}';
+        req.requestURI = 'services/apexrest/NFM113/execute';
+        req.httpMethod = 'POST';
+        req.requestBody = Blob.valueof(JsonMsg);
+        RestContext.request = req;
+        RestContext.response= res;
+
+        NFM113Rest.execute();
+
+        //Test.stopTest();
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/NFM113RestTest.cls-meta.xml b/force-app/main/default/classes/NFM113RestTest.cls-meta.xml
new file mode 100644
index 0000000..dd61d1f
--- /dev/null
+++ b/force-app/main/default/classes/NFM113RestTest.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>52.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/NFMUtil.cls b/force-app/main/default/classes/NFMUtil.cls
index d1bd09b..064e12f 100644
--- a/force-app/main/default/classes/NFMUtil.cls
+++ b/force-app/main/default/classes/NFMUtil.cls
@@ -178,6 +178,8 @@
             NFM702_ENDPOINT = 'https://wdp.olympus.com.cn:44302/RESTAdapter/NFM702';
             NFM703_ENDPOINT = 'https://wdp.olympus.com.cn:44302/RESTAdapter/NFM703';
 
+            //鍏堟鍚庝慨
+            NFM112_ENDPOINT = 'http://wdp.olympus.com.cn:8089/RESTAdapter/NFM112';
             //鏍锋湰绠$悊
             NFM115_ENDPOINT = 'https://wdp.olympus.com.cn:44302/RESTAdapter/NFM115';
 

--
Gitblit v1.9.1