From 74d731cd8ac6bd995fbda485ee3371300af29a74 Mon Sep 17 00:00:00 2001 From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com> Date: 星期一, 21 七月 2025 18:05:07 +0800 Subject: [PATCH] 优化时间段查询不出数据问题,PDA出库抽检出库任务卡控 --- 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/AGVController.cs | 66 ++++++++++++++++++++++++++------- 1 files changed, 52 insertions(+), 14 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/AGVController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/AGVController.cs" index 8940f04..9ea87aa 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/AGVController.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/AGVController.cs" @@ -1,6 +1,9 @@ 锘縰sing Microsoft.AspNetCore.Mvc; +using NewLife.Net; +using System.Threading.Tasks; using WIDESEA_DTO.AGV; using WIDESEA_IStoragIntegrationServices; +using WIDESEA_StorageSocketServices; namespace WIDESEA_WMSServer.Controllers { @@ -13,6 +16,7 @@ { private readonly IHttpContextAccessor _httpContextAccessor; private readonly IAGVService _service; + public static bool Islock = true; // 閿侊紝闃叉閲嶅璇锋眰 public AGVController(IAGVService service, IHttpContextAccessor httpContextAccessor) { @@ -22,13 +26,12 @@ /// <summary> /// 璇锋眰鍏ュ簱浠诲姟 /// </summary> - /// <param name="TaskNum"></param> - /// <param name="SourceAddress"></param> + /// <param name="aGVDTO"></param> /// <returns></returns> - [HttpGet,HttpPost, Route("RequestInTask"), AllowAnonymous] - public WebResponseContent RequestInTask(string PalletCode, string SourceAddress) + [HttpGet, HttpPost, Route("RequestInTask"), AllowAnonymous] + public WebResponseContent RequestInTask([FromBody] AGVDTO aGVDTO) { - return _service.RequestInTask(PalletCode, SourceAddress); + return _service.RequestInTask(aGVDTO); } /// <summary> @@ -37,7 +40,7 @@ /// <param name="Status"></param> /// <returns></returns> [HttpGet, HttpPost, Route("ReceiveAGVRuntimeStatus"), AllowAnonymous] - public WebResponseContent ReceiveAGVRuntimeStatus(AGVStatus Status) + public WebResponseContent ReceiveAGVRuntimeStatus([FromBody] AGVStatus Status) { return _service.ReceiveAGVRuntimeStatus(Status); } @@ -45,25 +48,60 @@ /// <summary> /// AGV浠诲姟寮�濮嬫垨缁撴潫 /// </summary> - /// <param name="Status"></param> - /// <param name="TaskNum"></param> + /// <param name="aGVDTO"></param> /// <returns></returns> [HttpGet, HttpPost, Route("AGVStartOrEndJob"), AllowAnonymous] - public WebResponseContent AGVStartOrEndJob(string Status, int TaskNum) + public WebResponseContent AGVStartOrEndJob([FromBody] AGVDTO aGVDTO) { - return _service.AGVStartOrEndJob(Status, TaskNum); + return _service.AGVStartOrEndJob(aGVDTO); } /// <summary> /// 璁惧鐘舵�佷笂鎶� /// </summary> - /// <param name="Message"></param> - /// <param name="PallteCode"></param> + /// <param name="aGVDTO"></param> /// <returns></returns> [HttpGet, HttpPost, Route("DeviceErrorResponse"), AllowAnonymous] - public WebResponseContent DeviceErrorResponse(string Message,int TaskNum) + public WebResponseContent DeviceErrorResponse([FromBody] AGVDTO aGVDTO) { - return _service.DeviceErrorResponse(Message,TaskNum); + return _service.DeviceErrorResponse(aGVDTO); + } + + /// <summary> + /// 璁惧寮傚父涓婃姤 + /// </summary> + /// <param name="DTO"></param> + /// <returns></returns> + [HttpGet, HttpPost, Route("DeviceWarning"), AllowAnonymous] + [TypeFilter(typeof(ThrottleFilter), Arguments = new object[] { 10 })] // 10绉掕妭娴� + public async Task<WebResponseContent> DeviceWarning([FromBody] AGVDTO DTO) + { + WebResponseContent responseContent = new WebResponseContent(); + try + { + // 浣跨敤鐪熸鐨勯攣缁撴瀯 + if (Islock) + { + Islock = false; + try + { + return await Task.Run(()=> _service.DeviceWarning(DTO)); + } + finally + { + Islock = true; + } + } + else + { + return responseContent.Error("璇锋眰杩囦簬棰戠箒锛岃绋嶅悗鍐嶈瘯"); + } + } + catch (Exception ex) + { + // 涓嶉渶瑕佸湪杩欓噷閲婃斁閿侊紝鍥犱负TryEnter鎴愬姛鍚庝細鍦╢inally涓噴鏀� + return responseContent.Error($"璁惧寮傚父涓婃姤澶辫触: {ex.Message}"); + } } } } -- Gitblit v1.9.3