From a4c0e9759befb4e8efa91e322370afe9d4673d4b Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期一, 02 三月 2026 10:36:56 +0800
Subject: [PATCH] 优化
---
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/KLSTaskExtend.cs | 2
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/TrackloginfoService.cs | 3 +
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/WMS/WMSController.cs | 113 +++++++++++---------------------------------------------
3 files changed, 26 insertions(+), 92 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/TrackloginfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/TrackloginfoService.cs"
index 83dd713..3ed9c70 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/TrackloginfoService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/TrackloginfoService.cs"
@@ -43,7 +43,8 @@
Dt_trackloginfo trackloginfo = new Dt_trackloginfo()
{
tracklog_name = logName,
- tracklog_content = JsonConvert.SerializeObject(entity),
+ //tracklog_content = JsonConvert.SerializeObject(entity),
+ tracklog_content = entity is string strEntity ? strEntity : JsonConvert.SerializeObject(entity),//濡傛灉entity鏄瓧绗︿覆绫诲瀷锛屽垯鐩存帴浣跨敤锛屽惁鍒欏簭鍒楀寲涓篔SON瀛楃涓�
tracklog_createtime = DateTime.Now,
tracklog_type = content.Status ? "鎴愬姛" : "澶辫触",
tracklog_code = content.Status ? logCode : ("4" + logCode),
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/WMS/WMSController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/WMS/WMSController.cs"
index d2a3697..59a8897 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/WMS/WMSController.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/WMS/WMSController.cs"
@@ -18,32 +18,29 @@
{
_taskService = taskService;
}
+
+
+ public WMSReturn ReturnWMS(WebResponseContent content, int successCode = 0, int failCode = 404)
+ {
+ return new WMSReturn
+ {
+ code = content.Status ? successCode : failCode,
+ msg = content.Message ?? (content.Status ? "鎿嶄綔鎴愬姛" : "鎿嶄綔澶辫触"),
+ data = content.Status ? content.Data : null
+ };
+ }
+
+
/// <summary>
/// WMS涓嬪彂浠诲姟
/// </summary>
/// <param name="taskDTOs"></param>
/// <returns></returns>
[HttpPost, Route("ReceiveTask"), AllowAnonymous]
- public object ReceiveWMSTask([FromBody] List<WMSTasksDTO> taskDTOs)
+ public WMSReturn ReceiveWMSTask([FromBody] List<WMSTasksDTO> taskDTOs)
{
WebResponseContent content = _taskService.ReceiveWMSTask(taskDTOs);
- if (!content.Status)
- {
- return new
- {
- code = "404",
- msg = content.Message
- };
- }
- else
- {
- return new
- {
- code = "0",
- msg = content.Message,
- data = content.Data
- };
- }
+ return ReturnWMS(content);
}
/// <summary>
@@ -52,26 +49,10 @@
/// <param name="wMSCancelTask"></param>
/// <returns></returns>
[HttpPost, Route("CancelWMSTask"), AllowAnonymous]
- public object CancelWMSTask([FromBody] WMSCancelTask wMSCancelTask)
+ public WMSReturn CancelWMSTask([FromBody] WMSCancelTask wMSCancelTask)
{
WebResponseContent content = _taskService.CancelWMSTask(wMSCancelTask);
- if (!content.Status)
- {
- return new
- {
- code = "404",
- msg = content.Message
- };
- }
- else
- {
- return new
- {
- code = "0",
- msg = content.Message,
- data = content.Data
- };
- }
+ return ReturnWMS(content);
}
/// <summary>
@@ -80,26 +61,10 @@
/// <param name="updateTaskPriority"></param>
/// <returns></returns>
[HttpPost, Route("UpdateWMSTaskPriority"), AllowAnonymous]
- public object UpdateWMSTaskPriority([FromBody] WMSUpdateTaskPriority updateTaskPriority)
+ public WMSReturn UpdateWMSTaskPriority([FromBody] WMSUpdateTaskPriority updateTaskPriority)
{
WebResponseContent content = _taskService.UpdateWMSTaskPriority(updateTaskPriority);
- if (!content.Status)
- {
- return new
- {
- code = "404",
- msg = content.Message
- };
- }
- else
- {
- return new
- {
- code = "0",
- msg = content.Message,
- data = content.Data
- };
- }
+ return ReturnWMS(content);
}
/// <summary>
@@ -108,26 +73,10 @@
/// <param name="WMSUpdateLocationArea"></param>
/// <returns></returns>
[HttpPost, Route("ModifyWMSLayoutZone"), AllowAnonymous]
- public object ModifyWMSLayoutZone([FromBody] WMSUpdateLocationArea wMSUpdateLocationArea)
+ public WMSReturn ModifyWMSLayoutZone([FromBody] WMSUpdateLocationArea wMSUpdateLocationArea)
{
WebResponseContent content = _taskService.ModifyWMSLayoutZone(wMSUpdateLocationArea);
- if (!content.Status)
- {
- return new
- {
- code = "404",
- msg = content.Message
- };
- }
- else
- {
- return new
- {
- code = "0",
- msg = content.Message,
- data = content.Data
- };
- }
+ return ReturnWMS(content);
}
/// <summary>
@@ -136,26 +85,10 @@
/// <param name="AreaCode">鍖哄煙鍙�</param>
/// <returns></returns>
[HttpPost, Route("LocationInquiry"), AllowAnonymous]
- public object LocationInquiry(string AreaCode)
+ public WMSReturn LocationInquiry(string AreaCode)
{
WebResponseContent content = _taskService.LocationInquiry(AreaCode);
- if (!content.Status)
- {
- return new
- {
- code = "404",
- msg = content.Message
- };
- }
- else
- {
- return new
- {
- code = "0",
- msg = content.Message,
- data = content.Data
- };
- }
+ return ReturnWMS(content);
}
}
}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/KLSTaskExtend.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/KLSTaskExtend.cs"
index e18593a..510a784 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/KLSTaskExtend.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/KLSTaskExtend.cs"
@@ -60,7 +60,7 @@
}
finally
{
- _trackloginfoService.AddTrackLog(gALAXISTaskInfo.Serialize(), content, "涓嬪彂鍑箰澹獳GV浠诲姟","","");
+ _trackloginfoService.AddTrackLog(gALAXISTaskInfo, content, "涓嬪彂鍑箰澹獳GV浠诲姟","","");
//dt_trackloginfoService.Instance.AddTrackLog(outTaskInfo, content, "鎺ユ敹瀹囪埅WMS鍑哄簱浠诲姟涓嬪彂", "", $"{msg},鍙樻洿缁撴灉:{content.Status}");
}
}
--
Gitblit v1.9.3