From 75ef0dfecf2331c0828a1a182b1d3243d3041c51 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期二, 21 四月 2026 13:19:44 +0800
Subject: [PATCH] refactor: 统一日志组件为Serilog并优化相关功能
---
Code/WMS/WIDESEA_WMSServer/WIDESEA_Core/Filter/ApiAuthorizeFilter.cs | 2
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs | 2
Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoDetailController.cs | 71 +++++++-------
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/QuartzLogHelper.cs | 27 ++++-
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneTaskSelector.cs | 5
Code/WMS/WIDESEA_WMSClient/src/views/system/Mes_Log.vue | 14 ++
Code/WMS/WIDESEA_WMSServer/WIDESEA_Core/Middlewares/HttpRequestMiddleware.cs | 2
Code/WMS/WIDESEA_WMSClient/src/extension/system/Mes_Log.jsx | 6
Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs | 8
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineTaskFilter.cs | 5
Code/WMS/WIDESEA_WMSClient/src/extension/stock/stockInfo.jsx | 63 ++++++++++++
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json | 2
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs | 25 +++-
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineDispatchHandler.cs | 9 -
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs | 18 ++-
Code/WMS/WIDESEA_WMSClient/src/api/http.js | 2
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneCommandBuilder.cs | 10 -
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineTargetAddressSelector.cs | 7
18 files changed, 187 insertions(+), 91 deletions(-)
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs
index 9bd9909..815c704 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs
@@ -49,7 +49,7 @@
.Enrich.WithProperty("Application", "WCS")
// 璁剧疆Microsoft鍛藉悕绌洪棿鐨勬棩蹇楃骇鍒负Information
// 杩欐牱鍙互鍑忓皯Microsoft妗嗘灦鏈韩鐨勮缁嗘棩蹇楋紝閬垮厤杩囧鐨凞ebug鏃ュ織
- .MinimumLevel.Override("Microsoft", LogEventLevel.Information)
+ .MinimumLevel.Override("Microsoft", LogEventLevel.Debug)
.WriteTo.Console() // 娣诲姞鎺у埗鍙拌緭鍑烘帴鏀跺櫒锛屾棩蹇楀皢鏄剧ず鍦ㄦ帶鍒跺彴绐楀彛涓�
// 娣诲姞鏂囦欢杈撳嚭鎺ユ敹鍣紝灏嗘棩蹇楀啓鍏ユ枃浠剁郴缁�
.WriteTo.File(
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json
index caf766d..9d1eeae 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json
@@ -39,7 +39,7 @@
//璺ㄥ煙
"Cors": {
"PolicyName": "CorsIpAccess", //绛栫暐鍚嶇О
- "EnableAllIPs": false, //褰撲负true鏃讹紝寮�鏀炬墍鏈塈P鍧囧彲璁块棶銆�
+ "EnableAllIPs": true, //褰撲负true鏃讹紝寮�鏀炬墍鏈塈P鍧囧彲璁块棶銆�
// 鏀寔澶氫釜鍩熷悕绔彛锛屾敞鎰忕鍙e彿鍚庝笉瑕佸甫/鏂滄潌锛氭瘮濡俵ocalhost:8000/锛屾槸閿欑殑
// 娉ㄦ剰锛宧ttp://127.0.0.1:1818 鍜� http://localhost:1818 鏄笉涓�鏍风殑
"IPs": "http://127.0.0.1:8080,http://localhost:8080,http://localhost:8081"
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs
index c88e03c..79096d3 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs
@@ -1,15 +1,14 @@
using MapsterMapper;
using Masuit.Tools;
using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Quartz;
+using Serilog;
using SqlSugar;
using WIDESEA_Core;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.Helper;
-using WIDESEAWCS_Core.LogHelper;
using WIDESEAWCS_DTO.TaskInfo;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
@@ -41,7 +40,6 @@
/// 浠诲姟鏈嶅姟
/// </summary>
private readonly ITaskService _taskService;
-
/// <summary>
/// 鏈哄櫒浜轰换鍔℃湇鍔�
@@ -82,7 +80,7 @@
/// <summary>
/// 鏃ュ織璁板綍鍣�
/// </summary>
- private readonly ILogger<CommonConveyorLineNewJob> _logger;
+ private readonly ILogger _logger;
/// <summary>
/// 鐩爣鍦板潃鍒拌澶囩被鍨嬬殑鏄犲皠
@@ -90,6 +88,11 @@
/// <remarks>
/// </remarks>
private static List<string> AddressToDeviceType = new List<string> { "11020", "11028" };
+
+ /// <summary>
+ /// 鎵樼洏妫�鏌ヤ綅缃殑鏈�杩戞墽琛屾椂闂达紙鐢ㄤ簬30绉掗棿闅旈檺鍒讹級
+ /// </summary>
+ private static readonly Dictionary<string, DateTime> _lastPalletCheckTime = new();
/// <summary>
/// 鏋勯�犲嚱鏁�
@@ -100,7 +103,7 @@
/// <param name="mapper">瀵硅薄鏄犲皠鍣�</param>
/// <param name="httpClientHelper">HTTP 瀹㈡埛绔府鍔╃被</param>
/// <param name="logger">鏃ュ織璁板綍鍣�</param>
- public CommonConveyorLineNewJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, HttpClientHelper httpClientHelper, ILogger<CommonConveyorLineNewJob> logger, IRobotTaskService robotTaskService)
+ public CommonConveyorLineNewJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, HttpClientHelper httpClientHelper, ILogger logger, IRobotTaskService robotTaskService)
{
_taskService = taskService;
_taskExecuteDetailService = taskExecuteDetailService;
@@ -179,6 +182,13 @@
// 濡傛灉褰撳墠璁惧鍦ㄦ鏌ュ垪琛ㄤ腑
if (checkPalletPositions.Any(x => x.Code == childDeviceCode))
{
+ // 30绉掗棿闅旈檺鍒�
+ if (_lastPalletCheckTime.TryGetValue(childDeviceCode, out var lastTime) &&
+ (DateTime.Now - lastTime).TotalSeconds < 30)
+ {
+ continue;
+ }
+
// 妫�鏌ヨ緭閫佺嚎鐘舵�侊紙鏄惁鏈夋墭鐩橈級
if (command.CV_State == 2)
{
@@ -196,6 +206,8 @@
TargetAddress = childDeviceCode
}.Serialize());
+ _lastPalletCheckTime[childDeviceCode] = DateTime.Now;
+
// 濡傛灉璇锋眰鎴愬姛锛屾帴鏀� WMS 杩斿洖鐨勪换鍔�
if (responseResult.IsSuccess && responseResult.Data.Status)
{
@@ -208,7 +220,7 @@
}
}
- #endregion
+ #endregion 妫�娴嬫槸鍚﹂渶瑕佺┖鎵樼洏
// ========== 妫�鏌� PLC_STB 鏍囧織 ==========
// 鍙湁褰� PLC_STB 涓� 1 鏃舵墠澶勭悊浠诲姟
@@ -278,7 +290,6 @@
RobotTargetAddressLineCode = childDeviceCode,
RobotTaskNum = num, // 鐢熸垚浠诲姟鍙�
RobotDispatchertime = DateTime.Now,
-
};
if (_robotTaskService.AddData(robotTask).Status)
{
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineDispatchHandler.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineDispatchHandler.cs
index 614a8bd..2d946c4 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineDispatchHandler.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineDispatchHandler.cs
@@ -1,9 +1,7 @@
using MapsterMapper;
-using Microsoft.Extensions.Logging;
+using Serilog;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
-using WIDESEAWCS_Core.Helper;
-using WIDESEAWCS_Core.LogHelper;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob;
@@ -201,7 +199,6 @@
Dt_Task? task = _taskFilter.QueryExecutingTask(command.TaskNo, childDeviceCode);
if (task != null)
{
-
// 鏇存柊浠诲姟鐘舵�佸埌涓嬩竴闃舵锛堥�氬父鏄畬鎴愶級
if (_taskService.UpdateTaskStatusToNext(task).Status)
{
@@ -209,8 +206,6 @@
conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, (short)1, childDeviceCode);
QuartzLogHelper.LogInfo(_logger, "ConveyorLineInFinish锛氬叆搴撳畬鎴愶紝浠诲姟鍙�: {TaskNum}锛屽瓙璁惧: {ChildDeviceCode}", $"鍏ュ簱瀹屾垚锛屼换鍔″彿: {task.TaskNum}", conveyorLine.DeviceCode, task.TaskNum, childDeviceCode);
}
-
-
}
}
@@ -316,4 +311,4 @@
}
}
}
-}
+}
\ No newline at end of file
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineTargetAddressSelector.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineTargetAddressSelector.cs
index 24c16e3..1fd2000 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineTargetAddressSelector.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineTargetAddressSelector.cs
@@ -1,5 +1,4 @@
-using Microsoft.Extensions.Logging;
-using WIDESEAWCS_Core.LogHelper;
+using Serilog;
using WIDESEAWCS_QuartzJob;
namespace WIDESEAWCS_Tasks
@@ -276,7 +275,7 @@
if (device == null)
{
// 璁惧鏈壘鍒版椂璁板綍璋冭瘯鏃ュ織锛屾柟渚挎帓鏌ラ厤缃棶棰�
- _logger.LogDebug("FindDevice锛氭湭鎵惧埌 {DeviceName}", deviceName);
+ _logger.Debug("FindDevice锛氭湭鎵惧埌 {DeviceName}", deviceName);
}
return device; // 鍙兘涓� null锛岀敱璋冪敤鏂硅礋璐� null 妫�鏌�
}
@@ -456,4 +455,4 @@
QuartzLogHelper.LogDebug(_logger, "Handle{Scenario}锛氬瓙璁惧: {ChildDeviceCode}锛岀洰鏍囧湴鍧�: {NextAddress}", $"Handle{scenario}锛氬瓙璁惧: {childDeviceCode}锛岀洰鏍囧湴鍧�: {nextAddress}", conveyorLine.DeviceCode, scenario, childDeviceCode, nextAddress);
}
}
-}
+}
\ No newline at end of file
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineTaskFilter.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineTaskFilter.cs
index 1d3b938..5339fee 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineTaskFilter.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineTaskFilter.cs
@@ -1,5 +1,4 @@
-using Microsoft.Extensions.Logging;
-using WIDESEAWCS_Core.LogHelper;
+using Serilog;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
@@ -94,4 +93,4 @@
return result.Status;
}
}
-}
+}
\ No newline at end of file
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/QuartzLogHelper.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/QuartzLogHelper.cs
index 20d43ff..f09f4b6 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/QuartzLogHelper.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/QuartzLogHelper.cs
@@ -1,4 +1,4 @@
-using Microsoft.Extensions.Logging;
+using Serilog;
using WIDESEAWCS_Core.LogHelper;
namespace WIDESEAWCS_Tasks;
@@ -23,7 +23,7 @@
/// <param name="args">ILogger 缁撴瀯鍖栨棩蹇楃殑鍙傛暟</param>
public static void LogError(ILogger logger, Exception ex, string loggerMessage, string quartzMessage, string deviceCode, params object[] args)
{
- logger.LogError(ex, loggerMessage, args);
+ logger.Error(ex, loggerMessage, args);
QuartzLogger.Error(quartzMessage, deviceCode, ex);
}
@@ -37,7 +37,7 @@
/// <param name="args">ILogger 缁撴瀯鍖栨棩蹇楃殑鍙傛暟</param>
public static void LogError(ILogger logger, string loggerMessage, string quartzMessage, string deviceCode, params object[] args)
{
- logger.LogError(loggerMessage, args);
+ logger.Error(loggerMessage, args);
QuartzLogger.Error(quartzMessage, deviceCode);
}
@@ -51,8 +51,21 @@
/// <param name="args">ILogger 缁撴瀯鍖栨棩蹇楃殑鍙傛暟</param>
public static void LogInfo(ILogger logger, string loggerMessage, string quartzMessage, string deviceCode, params object[] args)
{
- logger.LogInformation(loggerMessage, args);
+ logger.Information(loggerMessage, args);
QuartzLogger.Info(quartzMessage, deviceCode);
+ }
+
+ /// <summary>
+ /// 璁板綍淇℃伅鏃ュ織
+ /// </summary>
+ /// <param name="logger">ILogger 瀹炰緥</param>
+ /// <param name="loggerMessage">ILogger 鐨勭粨鏋勫寲鏃ュ織妯℃澘</param>
+ /// <param name="quartzMessage">QuartzLogger 鐨勬棩蹇楁秷鎭�</param>
+ /// <param name="deviceCode">璁惧缂栫爜</param>
+ public static void LogInfo(ILogger logger, string loggerMessage, string deviceCode)
+ {
+ logger.Information(loggerMessage);
+ QuartzLogger.Info(loggerMessage, deviceCode);
}
/// <summary>
@@ -65,7 +78,7 @@
/// <param name="args">ILogger 缁撴瀯鍖栨棩蹇楃殑鍙傛暟</param>
public static void LogWarn(ILogger logger, string loggerMessage, string quartzMessage, string deviceCode, params object[] args)
{
- logger.LogWarning(loggerMessage, args);
+ logger.Warning(loggerMessage, args);
QuartzLogger.Warn(quartzMessage, deviceCode);
}
@@ -79,7 +92,7 @@
/// <param name="args">ILogger 缁撴瀯鍖栨棩蹇楃殑鍙傛暟</param>
public static void LogDebug(ILogger logger, string loggerMessage, string quartzMessage, string deviceCode, params object[] args)
{
- logger.LogDebug(loggerMessage, args);
+ logger.Debug(loggerMessage, args);
QuartzLogger.Debug(quartzMessage, deviceCode);
}
-}
+}
\ No newline at end of file
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
index 385b838..648454e 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -1,7 +1,8 @@
-using Microsoft.Extensions.Logging;
+//using Microsoft.Extensions.Logging;
using Quartz;
+using Serilog;
using WIDESEA_Core;
-using WIDESEAWCS_Core;
+using WIDESEAWCS_Common.Constants;
using WIDESEAWCS_Core.LogHelper;
using WIDESEAWCS_ITaskInfoRepository;
using WIDESEAWCS_ITaskInfoService;
@@ -10,7 +11,6 @@
using WIDESEAWCS_QuartzJob.Service;
using WIDESEAWCS_QuartzJob.StackerCrane;
using WIDESEAWCS_QuartzJob.StackerCrane.Enum;
-using WIDESEAWCS_Common.Constants;
using WIDESEAWCS_Tasks.StackerCraneJob;
namespace WIDESEAWCS_Tasks
@@ -81,7 +81,7 @@
/// <summary>
/// 鏃ュ織璁板綍鍣�
/// </summary>
- private readonly ILogger<CommonStackerCraneJob> _logger;
+ private readonly ILogger _logger;
/// <summary>
/// 鍫嗗灈鏈鸿澶囩紪鐮�
@@ -103,7 +103,7 @@
ITaskRepository taskRepository,
IRouterService routerService,
HttpClientHelper httpClientHelper,
- ILogger<CommonStackerCraneJob> logger)
+ ILogger logger)
{
_taskService = taskService;
_taskExecuteDetailService = taskExecuteDetailService;
@@ -169,10 +169,12 @@
{
try
{
+ //QuartzLogger.Info($"CommonStackerCraneJob Execute锛氬紑濮嬫墽琛屽爢鍨涙満浠诲姟璋冨害 銆恵DateTime.Now.ToString("F")}銆�", "CommonStackerCraneJob Execute ");
// 浠� JobDataMap 鑾峰彇鍫嗗灈鏈鸿澶囧弬鏁�
bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value);
if (!flag || value is not CommonStackerCrane commonStackerCrane)
{
+ _logger.Information("Execute锛氬弬鏁版棤鏁堬紝鏈壘鍒� JobParams 鎴栫被鍨嬩笉鍖归厤");
// 鍙傛暟鏃犳晥锛岀洿鎺ヨ繑鍥�
QuartzLogHelper.LogWarn(_logger, "Execute锛氬弬鏁版棤鏁�", "Execute锛氬弬鏁版棤鏁�", "CommonStackerCraneJob");
return Task.CompletedTask;
@@ -193,7 +195,7 @@
// ========== 妫�鏌ユ槸鍚﹀彲浠ュ彂閫佹柊浠诲姟 ==========
//if (!commonStackerCrane.IsCanSendTask(commonStackerCrane.Communicator, commonStackerCrane.DeviceProDTOs, commonStackerCrane.DeviceProtocolDetailDTOs))
- if (commonStackerCrane.StackerCraneStatusValue != StackerCraneStatus.Normal )
+ if (commonStackerCrane.StackerCraneStatusValue != StackerCraneStatus.Normal)
{
// 鍫嗗灈鏈轰笉鍙敤锛堝姝e湪鎵ц涓婁竴浠诲姟锛夛紝鐩存帴杩斿洖
return Task.CompletedTask;
@@ -240,6 +242,10 @@
// 璁板綍寮傚父
QuartzLogHelper.LogError(_logger, ex, "Execute锛氭墽琛屽紓甯革紝璁惧: {DeviceCode}", $"鎵ц寮傚父: {ex.Message}", _deviceCode, _deviceCode);
}
+ finally
+ {
+ QuartzLogHelper.LogInfo(_logger, $"CommonStackerCraneJob Execute锛氬爢鍨涙満浠诲姟璋冨害鎵ц瀹屾垚 銆恵DateTime.Now.ToString("F")}銆�", _deviceCode);
+ }
return Task.CompletedTask;
}
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneCommandBuilder.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneCommandBuilder.cs
index ae7cb04..1fd63c4 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneCommandBuilder.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneCommandBuilder.cs
@@ -1,9 +1,7 @@
-using Microsoft.Extensions.Logging;
-using System;
+using Serilog;
using System.Diagnostics.CodeAnalysis;
using WIDESEAWCS_Common.Constants;
using WIDESEAWCS_Common.TaskEnum;
-using WIDESEAWCS_Core.LogHelper;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob.Models;
@@ -68,7 +66,7 @@
/// <returns>鍫嗗灈鏈哄懡浠ゅ璞★紝杞崲澶辫触杩斿洖 null</returns>
public object? ConvertToStackerCraneTaskCommand([NotNull] Dt_Task task)
{
- return BuildCommand(task, CreateStandardCommand(task));
+ return BuildCommand(task, CreateStandardCommand(task));
// 鏍规嵁宸烽亾鑾峰彇鍛戒护绫诲瀷
//string commandType = GetCommandType(task.Roadway);
@@ -198,7 +196,7 @@
{
taskType = StackerCraneConst.EmptyPalletTaskType;
}
- else if(task.TaskType == (int)TaskInboundTypeEnum.InEmpty)
+ else if (task.TaskType == (int)TaskInboundTypeEnum.InEmpty)
{
taskType = StackerCraneConst.EmptyInPalletTaskType;
}
@@ -388,4 +386,4 @@
&& short.TryParse(parts[2], out layer);
}
}
-}
+}
\ No newline at end of file
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneTaskSelector.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneTaskSelector.cs
index bcb57da..5d14c3f 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneTaskSelector.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneTaskSelector.cs
@@ -1,12 +1,11 @@
-using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
+using Serilog;
using System.Diagnostics.CodeAnalysis;
using WIDESEA_Core;
using WIDESEAWCS_Common.Constants;
using WIDESEAWCS_Common.HttpEnum;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
-using WIDESEAWCS_Core.LogHelper;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob;
@@ -316,4 +315,4 @@
return isOccupied;
}
}
-}
+}
\ No newline at end of file
diff --git a/Code/WMS/WIDESEA_WMSClient/src/api/http.js b/Code/WMS/WIDESEA_WMSClient/src/api/http.js
index 30892ab..0a26762 100644
--- a/Code/WMS/WIDESEA_WMSClient/src/api/http.js
+++ b/Code/WMS/WIDESEA_WMSClient/src/api/http.js
@@ -12,7 +12,7 @@
let loadingInstance;
let loadingStatus = false;
if (process.env.NODE_ENV == 'development') {
- axios.defaults.baseURL = 'http://127.0.0.1:9291/';
+ axios.defaults.baseURL = window.webConfig.webApiProduction;
}
else if (process.env.NODE_ENV == 'debug') {
axios.defaults.baseURL = window.webConfig.webApiBaseUrl;
diff --git a/Code/WMS/WIDESEA_WMSClient/src/extension/stock/stockInfo.jsx b/Code/WMS/WIDESEA_WMSClient/src/extension/stock/stockInfo.jsx
index 809dd5f..8cb0983 100644
--- a/Code/WMS/WIDESEA_WMSClient/src/extension/stock/stockInfo.jsx
+++ b/Code/WMS/WIDESEA_WMSClient/src/extension/stock/stockInfo.jsx
@@ -28,6 +28,11 @@
<el-button
type="primary"
size="small"
+ onClick={($e) => { this.handleBind(row); }}
+ >缁戝畾</el-button>
+ <el-button
+ type="primary"
+ size="small"
onClick={($e) => { this.handleInbound(row); }}
>杩涚珯</el-button>
<el-button
@@ -36,10 +41,42 @@
style="margin-left: 8px"
onClick={($e) => { this.handleOutbound(row); }}
>鍑虹珯</el-button>
+ <el-button
+ type="success"
+ size="small"
+ style="margin-left: 8px"
+ onClick={($e) => { this.handleUnbind(row); }}
+ >瑙g粦</el-button>
</div>
);
}
});
+ },
+
+ // 鎵樼洏缁勭洏鎿嶄綔
+ async handleBind(row) {
+ try {
+ await this.$confirm(`纭鎵ц鎵樼洏缁勭洏鎿嶄綔锛焅n鎵樼洏缂栧彿锛�${row.palletCode}`, "缁勭洏纭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning"
+ });
+
+ const result = await this.http.post("/api/StockInfoDetail/BindContainer", {
+ palletCode: row.palletCode
+ }, "姝e湪璋冪敤MES鎺ュ彛...");
+
+ if (result.status) {
+ this.$Message.success(result.message || "鎵樼洏缁勭洏鎴愬姛");
+ this.$refs.table.load();
+ } else {
+ this.$error(result.message || "鎵樼洏缁勭洏澶辫触");
+ }
+ } catch (error) {
+ if (error !== "cancel") {
+ this.$error(error.message || "缃戠粶閿欒锛岃绋嶅悗閲嶈瘯");
+ }
+ }
},
// 鎵樼洏杩涚珯鎿嶄綔
@@ -96,6 +133,32 @@
}
},
+ // 鎵樼洏鎷嗙洏鎿嶄綔
+ async handleUnbind(row) {
+ try {
+ await this.$confirm(`纭鎵ц鎵樼洏鎷嗙洏鎿嶄綔锛焅n鎵樼洏缂栧彿锛�${row.palletCode}`, "鎷嗙洏纭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning"
+ });
+
+ const result = await this.http.post("/api/StockInfoDetail/UnbindContainer", {
+ palletCode: row.palletCode,
+ }, "姝e湪璋冪敤MES鎺ュ彛...");
+
+ if (result.status) {
+ this.$Message.success(result.message || "鎵樼洏鎷嗙洏鎴愬姛");
+ this.$refs.table.load();
+ } else {
+ this.$error(result.message || "鎵樼洏鎷嗙洏澶辫触");
+ }
+ } catch (error) {
+ if (error !== "cancel") {
+ this.$error(error.message || "缃戠粶閿欒锛岃绋嶅悗閲嶈瘯");
+ }
+ }
+ },
+
onInited() {
// 妗嗘灦鍒濆鍖栭厤缃悗
},
diff --git a/Code/WMS/WIDESEA_WMSClient/src/extension/system/Mes_Log.jsx b/Code/WMS/WIDESEA_WMSClient/src/extension/system/Mes_Log.jsx
index 560c165..71c12a9 100644
--- a/Code/WMS/WIDESEA_WMSClient/src/extension/system/Mes_Log.jsx
+++ b/Code/WMS/WIDESEA_WMSClient/src/extension/system/Mes_Log.jsx
@@ -48,13 +48,15 @@
this.showJsonDetail(row, 'request');
} else if (column.property === 'responseJson' && row.responseJson) {
this.showJsonDetail(row, 'response');
+ } else if (column.property === 'errorMessage' && row.errorMessage) {
+ this.showJsonDetail(row, 'errorMessage');
}
},
// 鏄剧ず JSON 璇︽儏鎶藉眽
showJsonDetail(row, type = 'request') {
- const jsonContent = type === 'request' ? row.requestJson : row.responseJson;
- const title = type === 'request' ? '馃搵 璇锋眰 JSON' : '馃摜 鍝嶅簲 JSON';
+ const jsonContent = type === 'request' ? row.requestJson : type === 'response' ? row.responseJson : row.errorMessage;
+ const title = type === 'request' ? '馃搵 璇锋眰 JSON' : type === 'response' ? '馃搵 璇锋眰 JSON': '馃摜 閿欒娑堟伅';
// 瑙f瀽 JSON 瀵硅薄锛岃В鏋愬け璐ュ垯淇濈暀鍘熷瀛楃涓�
let jsonData;
diff --git a/Code/WMS/WIDESEA_WMSClient/src/views/system/Mes_Log.vue b/Code/WMS/WIDESEA_WMSClient/src/views/system/Mes_Log.vue
index f74319b..bddd800 100644
--- a/Code/WMS/WIDESEA_WMSClient/src/views/system/Mes_Log.vue
+++ b/Code/WMS/WIDESEA_WMSClient/src/views/system/Mes_Log.vue
@@ -81,7 +81,19 @@
return `<span style="color: #409EFF; cursor: pointer;">${preview}</span>`;
}
},
- { field: "errorMessage", title: "閿欒淇℃伅", width: 250 },
+ {
+ field: "errorMessage",
+ title: "閿欒淇℃伅",
+ width: 250,
+
+ formatter: (row) => {
+ if (!row.responseJson) return '-';
+ const preview = row.responseJson.length > 50
+ ? row.responseJson.substring(0, 50) + '...'
+ : row.responseJson;
+ return `<span style="color: #409EFF; cursor: pointer;">${preview}</span>`;
+ }
+ },
{ field: "elapsedMs", title: "鑰楁椂(ms)", width: 100, sortable: true },
{ field: "createDate", title: "璋冪敤鏃堕棿", width: 160, sortable: true },
{ field: "creator", title: "鎿嶄綔浜�", width: 100 }
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_Core/Filter/ApiAuthorizeFilter.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_Core/Filter/ApiAuthorizeFilter.cs
index dc951cf..f7c4618 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_Core/Filter/ApiAuthorizeFilter.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_Core/Filter/ApiAuthorizeFilter.cs
@@ -84,7 +84,7 @@
int ExpMinutes = AppSettings.Get("ExpMinutes").ObjToInt();
if ((expDate.GetValueOrDefault() - DateTime.Now).TotalMinutes < ExpMinutes / 3 && context.HttpContext.Request.Path != ReplaceTokenPath)
{
- context.HttpContext.Response.Headers.Add("widesea_exp", "1");
+ context.HttpContext.Response.Headers.Append("widesea_exp", "1");
}
}
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_Core/Middlewares/HttpRequestMiddleware.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_Core/Middlewares/HttpRequestMiddleware.cs
index deb4a6d..a4e86d0 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_Core/Middlewares/HttpRequestMiddleware.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_Core/Middlewares/HttpRequestMiddleware.cs
@@ -18,7 +18,7 @@
public async Task InvokeAsync(HttpContext context)
{
- context.Response.Headers.Add("Access-Control-Expose-Headers", "widesea_exp");
+ context.Response.Headers.Append("Access-Control-Expose-Headers", "widesea_exp");
await _next(context);
}
}
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs
index c04b982..ec09348 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs
@@ -113,9 +113,9 @@
? _mesService.InboundInContainer(mesRequest)
: _mesService.InboundInContainer(mesRequest, token);
return (
- result?.IsSuccess ?? false,
+ result.Data?.IsSuccess ?? false,
System.Text.Json.JsonSerializer.Serialize(result),
- result?.ErrorMessage ?? "鏈煡閿欒"
+ result?.Data?.Msg ?? result?.ErrorMessage ?? "鏈煡閿欒"
);
},
App.User.UserName);
@@ -203,9 +203,9 @@
? _mesService.OutboundInContainer(mesRequest)
: _mesService.OutboundInContainer(mesRequest, token);
return (
- result?.IsSuccess ?? false,
+ result?.Data?.IsSuccess ?? false,
System.Text.Json.JsonSerializer.Serialize(result),
- result?.ErrorMessage ?? "鏈煡閿欒"
+ result?.Data?.Msg ?? result?.ErrorMessage ?? "鏈煡閿欒"
);
},
App.User.UserName);
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoDetailController.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoDetailController.cs
index 1b3f335..de85b5f 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoDetailController.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoDetailController.cs
@@ -1,14 +1,13 @@
-锘縰sing Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
+锘縰sing Microsoft.AspNetCore.Mvc;
+using WIDESEA_Common.Constants;
+using WIDESEA_Common.StockEnum;
using WIDESEA_Core;
using WIDESEA_Core.BaseController;
using WIDESEA_DTO.MES;
-using WIDESEA_IStockService;
using WIDESEA_IBasicService;
+using WIDESEA_IStockService;
using WIDESEA_ISystemService;
using WIDESEA_Model.Models;
-using WIDESEA_Common.Constants;
-using WIDESEA_Common.StockEnum;
namespace WIDESEA_WMSServer.Controllers.Stock
{
@@ -52,19 +51,19 @@
try
{
- // 1. 鍙傛暟楠岃瘉
- if (dto.SfcList == null || !dto.SfcList.Any())
- {
- return response.Error("鐢佃姱鐮佸垪琛ㄤ笉鑳戒负绌�");
- }
+ //// 1. 鍙傛暟楠岃瘉
+ //if (dto.SfcList == null || !dto.SfcList.Any())
+ //{
+ // return response.Error("鐢佃姱鐮佸垪琛ㄤ笉鑳戒负绌�");
+ //}
// 2. 楠岃瘉鐢佃姱鐘舵�侊紙闈�'宸查攣瀹�'鐘舵�佸厑璁哥粦瀹氾級
- var stockDetail = await Service.Repository.QueryFirstAsync(x => dto.SfcList.Contains(x.SerialNumber));
- if (stockDetail != null && stockDetail.Status == 99)
- {
- return response.Error("褰撳墠搴撳瓨鏄庣粏鍖呭惈宸查攣瀹氱姸鎬侊紝涓嶅厑璁告墽琛岀粦瀹氭搷浣�");
- }
- var stockInfo = await _stockInfoService.Repository.QueryFirstAsync(x => stockDetail.StockId == x.Id);
+ //var stockDetail = await Service.Repository.QueryFirstAsync(x => dto.SfcList.Contains(x.SerialNumber));
+ //if (stockDetail != null && stockDetail.Status == 99)
+ //{
+ // return response.Error("褰撳墠搴撳瓨鏄庣粏鍖呭惈宸查攣瀹氱姸鎬侊紝涓嶅厑璁告墽琛岀粦瀹氭搷浣�");
+ //}
+ var stockInfo = await _stockInfoService.Repository.QueryDataNavFirstAsync(x => x.PalletCode == dto.PalletCode);
// 3. 鍔ㄦ�佽幏鍙朚ES鍑瘉
var mesConfig = _mesDeviceConfigService.GetByDeviceName("缁勭洏鏈烘鎵�");
@@ -79,10 +78,10 @@
ResourceCode = resourceCode,
LocalTime = DateTime.Now,
ContainerCode = stockInfo.PalletCode,
- ContainerSfcList = dto.SfcList.Select(sfc => new ContainerSfcItem
+ ContainerSfcList = stockInfo.Details.Select(sfc => new ContainerSfcItem
{
- Sfc = sfc,
- Location = dto.Location ?? ""
+ Sfc = sfc.SerialNumber,
+ Location = sfc.InboundOrderRowNo.ToString() ?? ""
}).ToList(),
OperationType = dto.OperationType
};
@@ -101,9 +100,9 @@
? _mesService.BindContainer(mesRequest)
: _mesService.BindContainer(mesRequest, token);
return (
- result?.IsSuccess ?? false,
+ result?.Data?.IsSuccess ?? false,
System.Text.Json.JsonSerializer.Serialize(result),
- result?.ErrorMessage ?? "鏈煡閿欒"
+ result?.Data?.Msg ?? result?.ErrorMessage ?? "鏈煡閿欒"
);
},
App.User.UserName);
@@ -130,18 +129,18 @@
try
{
// 1. 鍙傛暟楠岃瘉
- if (dto.SfcList == null || !dto.SfcList.Any())
- {
- return response.Error("鐢佃姱鐮佸垪琛ㄤ笉鑳戒负绌�");
- }
+ //if (dto.SfcList == null || !dto.SfcList.Any())
+ //{
+ // return response.Error("鐢佃姱鐮佸垪琛ㄤ笉鑳戒负绌�");
+ //}
- // 2. 楠岃瘉鐢佃姱鐘舵�侊紙闈�'宸查攣瀹�'鐘舵�佸厑璁歌В缁戯級
- var stockDetail = await Service.Repository.QueryFirstAsync(x => dto.SfcList.Contains(x.SerialNumber));
- if (stockDetail != null && stockDetail.Status == 99)
- {
- return response.Error("褰撳墠搴撳瓨鏄庣粏鍖呭惈宸查攣瀹氱姸鎬侊紝涓嶅厑璁告墽琛岃В缁戞搷浣�");
- }
- var stockInfo = await _stockInfoService.Repository.QueryFirstAsync(x => stockDetail.StockId == x.Id);
+ //// 2. 楠岃瘉鐢佃姱鐘舵�侊紙闈�'宸查攣瀹�'鐘舵�佸厑璁歌В缁戯級
+ //var stockDetail = await Service.Repository.QueryFirstAsync(x => dto.SfcList.Contains(x.SerialNumber));
+ //if (stockDetail != null && stockDetail.Status == 99)
+ //{
+ // return response.Error("褰撳墠搴撳瓨鏄庣粏鍖呭惈宸查攣瀹氱姸鎬侊紝涓嶅厑璁告墽琛岃В缁戞搷浣�");
+ //}
+ var stockInfo = await _stockInfoService.Repository.QueryDataNavFirstAsync(x => dto.PalletCode == x.PalletCode);
// 3. 鍔ㄦ�佽幏鍙朚ES鍑瘉
var mesConfig = _mesDeviceConfigService.GetByDeviceName("缁勭洏鏈烘鎵�");
@@ -156,7 +155,7 @@
ResourceCode = resourceCode,
LocalTime = DateTime.Now,
ContainCode = stockInfo.PalletCode,
- SfcList = dto.SfcList
+ SfcList = stockInfo.Details.Select(x => x.SerialNumber).ToList(),
};
string requestJson = System.Text.Json.JsonSerializer.Serialize(mesRequest);
@@ -173,9 +172,9 @@
? _mesService.UnBindContainer(mesRequest)
: _mesService.UnBindContainer(mesRequest, token);
return (
- result?.IsSuccess ?? false,
+ result?.Data?.IsSuccess ?? false,
System.Text.Json.JsonSerializer.Serialize(result),
- result?.ErrorMessage ?? "鏈煡閿欒"
+ result?.Data?.Msg ?? result?.ErrorMessage ?? "鏈煡閿欒"
);
},
App.User.UserName);
@@ -315,4 +314,4 @@
return defaultValue;
}
}
-}
+}
\ No newline at end of file
--
Gitblit v1.9.3