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();