1.记录日志优化 清空日志间隔调整为10日 减小日志存储内容

2.发送任务限制优化 工位上小车已送走后允许重新发送任务
This commit is contained in:
hehaibing-1996
2025-03-14 08:29:18 +08:00
parent 8f1d6e77b7
commit f9db16ee55
2 changed files with 36 additions and 14 deletions

View File

@ -27,7 +27,7 @@ namespace WCS.BLL.Manager
while (true) while (true)
{ {
//每5秒同步一次 //每3秒同步一次
Thread.Sleep(3000); Thread.Sleep(3000);
try try
{ {
@ -49,7 +49,7 @@ namespace WCS.BLL.Manager
var data = new AGVQueryTaskStatusRequest(); var data = new AGVQueryTaskStatusRequest();
data.taskCodes.Add(tasks[i].TaskCode); data.taskCodes.Add(tasks[i].TaskCode);
var result = ApiHelp.GetDataFromHttp<AGVQueryTaskStatusResponse>(url, data, "POST", true); var result = ApiHelp.GetDataFromHttp<AGVQueryTaskStatusResponse>(url, data, "POST", false);
if (result != null && result.code == "0" && result.data != null && result.data.Count > 0) if (result != null && result.code == "0" && result.data != null && result.data.Count > 0)
{ {
var isUpdate = false; var isUpdate = false;
@ -102,6 +102,7 @@ namespace WCS.BLL.Manager
} }
Thread.Sleep(50); Thread.Sleep(50);
} }
Logs.Write("【定时任务】获取任务状态 结束", LogsType.Tasks);
} }
else else
{ {
@ -126,7 +127,7 @@ namespace WCS.BLL.Manager
{ {
var url = @"http://192.168.18.150:8181/rcms/services/rest/hikRpcService/syncMapDatas"; var url = @"http://192.168.18.150:8181/rcms/services/rest/hikRpcService/syncMapDatas";
var data = new AGVSyncMapDatasRequest(); var data = new AGVSyncMapDatasRequest();
var result = ApiHelp.GetDataFromHttp<AGVSyncMapDatasResponse>(url, data, "POST", true); var result = ApiHelp.GetDataFromHttp<AGVSyncMapDatasResponse>(url, data, "POST", false);
if (result != null && result.data != null && result.data.Count > 0) if (result != null && result.data != null && result.data.Count > 0)
{ {
//获取RCS地图上所有的货架 //获取RCS地图上所有的货架
@ -258,11 +259,18 @@ namespace WCS.BLL.Manager
//校验起点 //校验起点
if (tasks.Where(t => t.StratLocationId == startLocation.Id).Any()) 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()) 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()) 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()) if (tasks.Where(t => t.EndLocationId == endLocation.Id).Any())

View File

@ -10,6 +10,7 @@ using WCS.BLL.DbModels;
using WCS.BLL.Manager; using WCS.BLL.Manager;
using WCS.BLL.Services.IService; using WCS.BLL.Services.IService;
using WCS.BLL.Services.Service; using WCS.BLL.Services.Service;
using WCS.DAL.Db;
using WCS.WebApi; using WCS.WebApi;
using WCS.WebApi.Controllers; using WCS.WebApi.Controllers;
@ -52,12 +53,18 @@ namespace WebApi
try try
{ {
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>־ //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>־
WCS.BLL.Logs.Clear(TimeSpan.FromDays(92)); WCS.BLL.Logs.Clear(TimeSpan.FromDays(10));
//<2F><><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD>ǰ<EFBFBD>Ľӿ<C4BD><D3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־
DbHelp.dbLog.Deleteable<SystemApiLogRecord>()
.Where(t => t.ResponseTime < DateTime.Now.AddMonths(-1))
.ExecuteCommand();
//ÿһ<C3BF><D2BB>ִ<EFBFBD><D6B4>һ<EFBFBD><D2BB> //ÿһ<C3BF><D2BB>ִ<EFBFBD><D6B4>һ<EFBFBD><D2BB>
await Task.Delay(1000 * 60 * 60 * 24); await Task.Delay(1000 * 60 * 60 * 24);
} }
catch (Exception ex) catch (Exception ex)
{ {
} }
} }
}); });
@ -85,7 +92,7 @@ namespace WebApi
builder.Services.AddScoped<IInOutRecordService, InOutRecordService>(); builder.Services.AddScoped<IInOutRecordService, InOutRecordService>();
builder.Services.AddScoped<IUploadService, UploadService>(); builder.Services.AddScoped<IUploadService, UploadService>();
builder.Services.AddScoped<ILocationInfoService, LocationInfoService>(); builder.Services.AddScoped<ILocationInfoService, LocationInfoService>();
builder.Services.AddScoped<IMatDetailCurrentInfoService,MatDetailCurrentInfoService>(); builder.Services.AddScoped<IMatDetailCurrentInfoService, MatDetailCurrentInfoService>();
builder.Services.AddScoped<IBatchBindMatDetailService, BatchBindMatDetailService>(); builder.Services.AddScoped<IBatchBindMatDetailService, BatchBindMatDetailService>();
builder.Services.AddScoped<IPDAShelfLocationBindUnbindService, PDAShelfLocationBindUnbindService>(); builder.Services.AddScoped<IPDAShelfLocationBindUnbindService, PDAShelfLocationBindUnbindService>();