From deb1079692d620377c5cdee9ed02b59223a2206f Mon Sep 17 00:00:00 2001
From: 陈勇 <chenyong@hnkhzn.com>
Date: 星期二, 19 十一月 2024 10:21:05 +0800
Subject: [PATCH] 合并
---
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/CellState/CellStateService.cs | 85 ++++++++++++++++++++++++++++++++++++++----
1 files changed, 77 insertions(+), 8 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 f703f06..f0ccf06 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
@@ -1,7 +1,10 @@
锘縰sing LogLibrary.Log;
using Masuit.Tools;
+using Newtonsoft.Json;
using WIDESEA_Common;
+using WIDESEA_Core;
using WIDESEA_DTO;
+using WIDESEA_IStorageBasicService;
using WIDESEA_IStoragIntegrationServices;
namespace WIDESEA_StoragIntegrationServices;
@@ -10,6 +13,13 @@
{
private readonly LogFactory LogFactory = new LogFactory();
+ private readonly IBoxingInfoService _boxingInfoService;
+
+ public CellStateService(IBoxingInfoService boxingInfoService)
+ {
+ _boxingInfoService = boxingInfoService;
+ }
+
/// <summary>
/// 鍗曠數鑺睘鎬ц幏鍙�
/// </summary>
@@ -17,22 +27,53 @@
/// <returns></returns>
public async Task<dynamic> GetCellStateAsync(CellStateDto input)
{
+ WebResponseContent content = new WebResponseContent();
try
{
input.SessionId = Guid.NewGuid().ToString();
- input.Software = "闄堝寲鏈�";
- input.EquipmentCode = "P1K10040";
- input.EmployeeNo = "T00001";
+ 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://ts-momapp01:12020/api/MachineIntegration/CellState", inputJson);
+ #region
+ //if (x != null)
+ //{
+ // ResultCellState result = JsonConvert.DeserializeObject<ResultCellState>(x);
+ // DtBoxingInfo boxingInfo = new DtBoxingInfo()
+ // {
+ // IsFull = true,
+ // PalletCode = "",
+ // };
+ // var details = new List<DtBoxingInfoDetail>();
+ // foreach (var item in result.SerialNos)
+ // {
+ // DtBoxingInfoDetail detail = new DtBoxingInfoDetail()
+ // {
+ // SerialNumber = item.SerialNo,
+ // OrderNo = item.BindCode,
+ // Status = item.SerialNoStatus,
+ // };
+ // details.Add(detail);
+ // }
+ // boxingInfo.BoxingInfoDetails = details;
+ // var abc = await _boxingInfoService.AddBoxingInfoAsync(boxingInfo);
+ // if (abc.Status)
+ // return content.OK("缁勭洏鎴愬姛");
+ // else
+ // return content.Error("缁勭洏澶辫触");
+ //}
+ #endregion
+
LogFactory.GetLog("鍗曠數鑺睘鎬ц幏鍙�").Info(true, $"\r\r--------------------------------------");
LogFactory.GetLog("鍗曠數鑺睘鎬ц幏鍙�").Info(true, x);
+ return x;
}
catch (Exception err)
{
Console.WriteLine(err.Message.ToString());
LogFactory.GetLog("鍗曠數鑺睘鎬ц幏鍙�").Error(true, $"\r\r--------------------------------------");
+ LogFactory.GetLog("鍗曠數鑺睘鎬ц幏鍙�").Error(true, $"璇锋眰鍙傛暟: {JsonConvert.SerializeObject(input)}");
+ LogFactory.GetLog("鍗曠數鑺睘鎬ц幏鍙�").Error(true, err.Message);
LogFactory.GetLog("鍗曠數鑺睘鎬ц幏鍙�").Error(true, err.StackTrace);
}
return Task.FromResult<dynamic>(null);
@@ -43,17 +84,43 @@
/// </summary>
/// <param name="input">鐢佃姱鏁版嵁</param>
/// <returns></returns>
- public async Task<dynamic> GetTrayCellStatusAsync(TrayCellsStatusDto input)
+ public async Task<WebResponseContent> GetTrayCellStatusAsync(TrayCellsStatusDto input)
{
+ WebResponseContent content = new WebResponseContent();
try
{
input.SessionId = Guid.NewGuid().ToString();
- input.Software = "闄堝寲鏈�";
- input.EquipmentCode = "P1K10040";
- input.EmployeeNo = "T00001";
+ 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://ts-momapp01:12020/api/MachineIntegration/TrayCellsStatus", inputJson);
+ if (x != 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);
+ }
LogFactory.GetLog("鏁寸洏鐢佃姱灞炴�ц幏鍙�").Info(true, $"\r\r--------------------------------------");
LogFactory.GetLog("鏁寸洏鐢佃姱灞炴�ц幏鍙�").Info(true, x);
}
@@ -61,8 +128,10 @@
{
Console.WriteLine(err.Message.ToString());
LogFactory.GetLog("鏁寸洏鐢佃姱灞炴�ц幏鍙�").Error(true, $"\r\r--------------------------------------");
+ LogFactory.GetLog("鏁寸洏鐢佃姱灞炴�ц幏鍙�").Error(true, $"璇锋眰鍙傛暟: {JsonConvert.SerializeObject(input)}");
+ LogFactory.GetLog("鏁寸洏鐢佃姱灞炴�ц幏鍙�").Error(true, err.Message);
LogFactory.GetLog("鏁寸洏鐢佃姱灞炴�ц幏鍙�").Error(true, err.StackTrace);
}
- return Task.FromResult<dynamic>(null);
+ return content;
}
}
\ No newline at end of file
--
Gitblit v1.9.3