From ef4e456bb392c7260f2d8af886d7786f471b6ae0 Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期一, 02 三月 2026 10:41:03 +0800
Subject: [PATCH] 11
---
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/WMS/WMSController.cs | 103 ++++++++++++++-------------------------------------
1 files changed, 28 insertions(+), 75 deletions(-)
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 25ee068..0675f11 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"
@@ -5,6 +5,7 @@
using System.Threading.Tasks;
using WIDESEAWCS_Core;
using WIDESEAWCS_DTO.WMS;
+using WIDESEAWCS_IBasicInfoService;
using WIDESEAWCS_ITaskInfoService;
namespace WIDESEAWCS_Server.Controllers.WMS
@@ -14,19 +15,35 @@
public class WMSController : ControllerBase
{
private readonly ITaskService _taskService;
- public WMSController(ITaskService taskService)
+ private readonly IStationMangerService _stationMangerService;
+ public WMSController(ITaskService taskService, IStationMangerService stationMangerService)
{
_taskService = taskService;
+ _stationMangerService = stationMangerService;
}
+
+
+ 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 WebResponseContent ReceiveWMSTask([FromBody] List<WMSTasksDTO> taskDTOs)
+ public WMSReturn ReceiveWMSTask([FromBody] List<WMSTasksDTO> taskDTOs)
{
- return _taskService.ReceiveWMSTask(taskDTOs);
+ WebResponseContent content = _taskService.ReceiveWMSTask(taskDTOs);
+ return ReturnWMS(content);
}
/// <summary>
@@ -35,26 +52,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>
@@ -63,26 +64,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>
@@ -91,26 +76,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>
@@ -119,26 +88,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);
}
}
}
--
Gitblit v1.9.3