From 942e47f8987bd8c266e58863bed3895d9cb4ded0 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期一, 23 十二月 2024 20:51:38 +0800
Subject: [PATCH] 增加任务类型枚举,增加测试出库上报

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_External/ERPService/InvokeERPService.cs |   42 ++++++++++++++++++++++++++++++++----------
 1 files changed, 32 insertions(+), 10 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/ERPService/InvokeERPService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/ERPService/InvokeERPService.cs"
index fef6edc..9f898a1 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/ERPService/InvokeERPService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_External/ERPService/InvokeERPService.cs"
@@ -3,8 +3,11 @@
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using WIDESEA_Common.APIEnum;
 using WIDESEA_Core.Helper;
 using WIDESEA_External.Model;
+using WIDESEA_IBasicRepository;
+using WIDESEA_Model.Models;
 
 namespace WIDESEA_External.ERPService
 {
@@ -13,8 +16,11 @@
     /// </summary>
     public class InvokeERPService : IInvokeERPService
     {
-        string serviceIp = "";
-
+        private readonly IApiInfoRepository _apiInfoRepository;
+        public InvokeERPService(IApiInfoRepository apiInfoRepository)
+        {
+            _apiInfoRepository= apiInfoRepository;
+        }
         /// <summary>
         /// ERP鏀惰揣鍗曟帴鍙h皟鐢�
         /// </summary>
@@ -22,8 +28,7 @@
         /// <returns></returns>
         public string InvokeMatReceiveApi(ERPReceiveModel receiveModel)
         {
-            string serviceAddress = "";
-
+            Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x=>x.ApiCode==APIEnum.InvokeMatReceiveApi.ToString());
             ERPBaseModel<ERPReceiveModel> model = new ERPBaseModel<ERPReceiveModel>()
             {
                 Data = receiveModel,
@@ -31,8 +36,7 @@
                 Type = "toTCWMSReceive",
                 SecurityCode = ""
             };
-
-            string response = HttpHelper.Post(serviceIp + serviceAddress, model.Serialize());
+            string response = HttpHelper.Post(apiInfo.ApiAddress, model.Serialize());
             return response;
         }
 
@@ -43,7 +47,7 @@
         /// <returns></returns>
         public string InvokeCheckOrderApi(ERPCheckModel checkModel)
         {
-            string serviceAddress = "";
+            Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.InvokeCheckOrderApi.ToString());
             ERPBaseModel<ERPCheckModel> model = new ERPBaseModel<ERPCheckModel>()
             {
                 Data = checkModel,
@@ -52,7 +56,7 @@
                 SecurityCode = ""
             };
 
-            string response = HttpHelper.Post(serviceIp + serviceAddress, model.Serialize());
+            string response = HttpHelper.Post(apiInfo.ApiAddress, model.Serialize());
             return response;
         }
 
@@ -63,7 +67,7 @@
         /// <returns></returns>
         public string InvokeInboundOrderApi(ERPInboundModel inboundModel)
         {
-            string serviceAddress = "";
+            Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.InvokeInboundOrderApi.ToString());
             ERPBaseModel<ERPInboundModel> model = new ERPBaseModel<ERPInboundModel>()
             {
                 Data = inboundModel,
@@ -72,7 +76,25 @@
                 SecurityCode = ""
             };
 
-            string response = HttpHelper.Post(serviceIp + serviceAddress, model.Serialize());
+            string response = HttpHelper.Post(apiInfo.ApiAddress, model.Serialize());
+            return response;
+        }
+        /// <summary>
+        /// ERP鐗╂枡鍑哄簱鎺ュ彛璋冪敤
+        /// </summary>
+        /// <param name="outboundModel"></param>
+        /// <returns></returns>
+        public string InvokeOutboundOrderApi(ERPOutboundModel outboundModel)
+        {
+            Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.InvokeOutboundOrderApi.ToString());
+            ERPBaseModel<ERPOutboundModel> model = new ERPBaseModel<ERPOutboundModel>()
+            {
+                Data = outboundModel,
+                Desc = "鏉愭枡鍑哄簱",
+                Type = "toBomMaterialOutTC",
+                SecurityCode = "LxkgPgN3$U"
+            };
+            string response = HttpHelper.Post(apiInfo.ApiAddress, model.Serialize());
             return response;
         }
     }

--
Gitblit v1.9.3