From f9db16ee55ff6cbdd710f90874c70734b72d3079 Mon Sep 17 00:00:00 2001 From: hehaibing-1996 Date: Fri, 14 Mar 2025 08:29:18 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=AE=B0=E5=BD=95=E6=97=A5=E5=BF=97=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20=E6=B8=85=E7=A9=BA=E6=97=A5=E5=BF=97=E9=97=B4?= =?UTF-8?q?=E9=9A=94=E8=B0=83=E6=95=B4=E4=B8=BA10=E6=97=A5=20=E5=87=8F?= =?UTF-8?q?=E5=B0=8F=E6=97=A5=E5=BF=97=E5=AD=98=E5=82=A8=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2.发送任务限制优化 工位上小车已送走后允许重新发送任务 --- WCS.BLL/Manager/AGVManager.cs | 37 ++++++++++++++++++++++++----------- WCS.WebApi/Program.cs | 13 +++++++++--- 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/WCS.BLL/Manager/AGVManager.cs b/WCS.BLL/Manager/AGVManager.cs index db9cfc6..bca4d35 100644 --- a/WCS.BLL/Manager/AGVManager.cs +++ b/WCS.BLL/Manager/AGVManager.cs @@ -27,7 +27,7 @@ namespace WCS.BLL.Manager while (true) { - //每5秒同步一次 + //每3秒同步一次 Thread.Sleep(3000); try { @@ -49,7 +49,7 @@ namespace WCS.BLL.Manager var data = new AGVQueryTaskStatusRequest(); data.taskCodes.Add(tasks[i].TaskCode); - var result = ApiHelp.GetDataFromHttp(url, data, "POST", true); + var result = ApiHelp.GetDataFromHttp(url, data, "POST", false); if (result != null && result.code == "0" && result.data != null && result.data.Count > 0) { var isUpdate = false; @@ -102,6 +102,7 @@ namespace WCS.BLL.Manager } Thread.Sleep(50); } + Logs.Write("【定时任务】获取任务状态 结束", LogsType.Tasks); } else { @@ -126,7 +127,7 @@ namespace WCS.BLL.Manager { var url = @"http://192.168.18.150:8181/rcms/services/rest/hikRpcService/syncMapDatas"; var data = new AGVSyncMapDatasRequest(); - var result = ApiHelp.GetDataFromHttp(url, data, "POST", true); + var result = ApiHelp.GetDataFromHttp(url, data, "POST", false); if (result != null && result.data != null && result.data.Count > 0) { //获取RCS地图上所有的货架 @@ -258,11 +259,18 @@ namespace WCS.BLL.Manager //校验起点 if (tasks.Where(t => t.StratLocationId == startLocation.Id).Any()) { - return new AGVResponseModel() + //相同货架 + var isSameShelf = tasks.Where(t => t.StratLocationId == startLocation.Id && t.ShelfCode == shelfCode) + .Any(); + if (isSameShelf) { - code = "-999", - message = $"工位[{startLocation.LocationCode}]作为起点已有执行中的任务!", - }; + //获取对应任务 + return new AGVResponseModel() + { + code = "-999", + message = $"工位[{startLocation.LocationCode}]作为起点已有执行中的任务!", + }; + } } //校验终点 if (tasks.Where(t => t.EndLocationId == endLocation.Id).Any()) @@ -336,11 +344,18 @@ namespace WCS.BLL.Manager //校验起点 if (tasks.Where(t => t.StratLocationId == startLocation.Id).Any()) { - return new AGVResponseModel() + //相同货架 + var isSameShelf = tasks.Where(t => t.StratLocationId == startLocation.Id && t.ShelfCode == shelfCode) + .Any(); + if (isSameShelf) { - code = "-999", - message = $"工位[{startLocation.LocationCode}]作为起点已有执行中的任务!", - }; + //获取对应任务 + return new AGVResponseModel() + { + code = "-999", + message = $"工位[{startLocation.LocationCode}]作为起点已有执行中的任务!", + }; + } } //校验终点 if (tasks.Where(t => t.EndLocationId == endLocation.Id).Any()) diff --git a/WCS.WebApi/Program.cs b/WCS.WebApi/Program.cs index 5bc454f..7b27775 100644 --- a/WCS.WebApi/Program.cs +++ b/WCS.WebApi/Program.cs @@ -10,6 +10,7 @@ using WCS.BLL.DbModels; using WCS.BLL.Manager; using WCS.BLL.Services.IService; using WCS.BLL.Services.Service; +using WCS.DAL.Db; using WCS.WebApi; using WCS.WebApi.Controllers; @@ -52,12 +53,18 @@ namespace WebApi try { //ǰ־ - WCS.BLL.Logs.Clear(TimeSpan.FromDays(92)); + WCS.BLL.Logs.Clear(TimeSpan.FromDays(10)); + + //1ǰĽӿ־ + DbHelp.dbLog.Deleteable() + .Where(t => t.ResponseTime < DateTime.Now.AddMonths(-1)) + .ExecuteCommand(); + //ÿһִһ await Task.Delay(1000 * 60 * 60 * 24); } catch (Exception ex) - { + { } } }); @@ -85,7 +92,7 @@ namespace WebApi builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); - builder.Services.AddScoped(); + builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped();