From 826e9ef971289f2afe0077387fbb7eeec51fbe8f Mon Sep 17 00:00:00 2001
From: 刘磊 <1161824510@qq.com>
Date: 星期二, 10 十二月 2024 14:52:08 +0800
Subject: [PATCH] 1
---
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/CellState/CellStateService.cs | 64 ++++++++++++++++---------------
1 files changed, 33 insertions(+), 31 deletions(-)
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/CellState/CellStateService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/CellState/CellStateService.cs
index bb14e28..2746a02 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/CellState/CellStateService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/CellState/CellStateService.cs
@@ -3,9 +3,14 @@
using Newtonsoft.Json;
using WIDESEA_Common;
using WIDESEA_Core;
+using WIDESEA_Core.Const;
+using WIDESEA_Core.Helper;
using WIDESEA_DTO;
+using WIDESEA_IRepository;
+using WIDESEA_IServices;
using WIDESEA_IStorageBasicService;
using WIDESEA_IStoragIntegrationServices;
+using static Org.BouncyCastle.Math.EC.ECCurve;
namespace WIDESEA_StoragIntegrationServices;
@@ -14,10 +19,12 @@
private readonly LogFactory LogFactory = new LogFactory();
private readonly IBoxingInfoService _boxingInfoService;
+ private readonly ISys_ConfigService _configService;
- public CellStateService(IBoxingInfoService boxingInfoService)
+ public CellStateService(IBoxingInfoService boxingInfoService, ISys_ConfigService configRepository)
{
_boxingInfoService = boxingInfoService;
+ _configService = configRepository;
}
/// <summary>
@@ -34,7 +41,17 @@
input.EmployeeNo = "MITest";
input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
var inputJson = input.ToDictionary();
- var x = await HttpsClient.PostAsync("http://c24-cellmi3:12020/api/MachineIntegration/CellState", inputJson);
+ var configs = _configService.GetConfigsByCategory(CateGoryConst.SYS_MOMIPAddress);
+ var wmsBase = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.MOMBaseIP)?.ConfigValue;
+ var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.CellState)?.ConfigValue;
+ if (wmsBase == null || ipAddress == null)
+ {
+ throw new InvalidOperationException("WMS IP 鏈厤缃�");
+ }
+ var wmsIpAddress = wmsBase + ipAddress;
+
+ var result = HttpsClient.PostAsync(wmsIpAddress, inputJson).Result;
+ //var x = await HttpsClient.PostAsync("http://c24-cellmi3:12020/api/MachineIntegration/CellState", inputJson);
#region
//if (x != null)
//{
@@ -65,8 +82,8 @@
#endregion
LogFactory.GetLog("鍗曠數鑺睘鎬ц幏鍙�").Info(true, $"\r\r--------------------------------------");
- LogFactory.GetLog("鍗曠數鑺睘鎬ц幏鍙�").Info(true, x);
- return x;
+ LogFactory.GetLog("鍗曠數鑺睘鎬ц幏鍙�").Info(true, result);
+ return result;
}
catch (Exception err)
{
@@ -93,36 +110,21 @@
input.EmployeeNo = "MITest";
input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
var inputJson = input.ToDictionary();
- var x = await HttpsClient.PostAsync("http://c24-cellmi3:12020/api/MachineIntegration/TrayCellsStatus", inputJson);
- if (x != null)
+ var configs = _configService.GetConfigsByCategory(CateGoryConst.SYS_MOMIPAddress);
+ var wmsBase = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.MOMBaseIP)?.ConfigValue;
+ var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.TrayCellsStatus)?.ConfigValue;
+ if (wmsBase == null || ipAddress == null)
{
- // 鍙嶅簭鍒楀寲ResultTrayCellsStatus瀵硅薄
- //ResultTrayCellsStatus result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(x);
-
- //// 鍒涘缓DtBoxingInfo瀵硅薄
- //DtBoxingInfo boxingInfo = new DtBoxingInfo
- //{
- // IsFull = true,
- // PalletCode = result.TrayBarcode,
- //};
-
- //// 浣跨敤LINQ鍒涘缓DtBoxingInfoDetail瀵硅薄鍒楄〃
- //var details = result.SerialNos.Select(item => new DtBoxingInfoDetail
- //{
- // SerialNumber = item.SerialNo,
- // OrderNo = item.PositionNo.ToString(),
- // Status = item.SerialNoStatus,
- // Remark = result.TrayBarcodePropertys.ToJsonString(),
- // MaterielCode = result.BindCode,
- //}).ToList();
-
- //// 璧嬪�糄tBoxingInfoDetails
- //boxingInfo.BoxingInfoDetails = details;
- //var abc = await _boxingInfoService.AddBoxingInfoAsync(boxingInfo);
- content.OK("缁勭洏鎴愬姛", x);
+ throw new InvalidOperationException("WMS IP 鏈厤缃�");
}
+ var wmsIpAddress = wmsBase + ipAddress;
+
+ var result = HttpsClient.PostAsync(wmsIpAddress, inputJson).Result;
+ //var x = await HttpsClient.PostAsync("http://c24-cellmi3:12020/api/MachineIntegration/TrayCellsStatus", inputJson);
+
LogFactory.GetLog("鏁寸洏鐢佃姱灞炴�ц幏鍙�").Info(true, $"\r\r--------------------------------------");
- LogFactory.GetLog("鏁寸洏鐢佃姱灞炴�ц幏鍙�").Info(true, x);
+ LogFactory.GetLog("鏁寸洏鐢佃姱灞炴�ц幏鍙�").Info(true, result);
+ content.OK(data: result);
}
catch (Exception err)
{
--
Gitblit v1.9.3