任务限制优化

This commit is contained in:
lsymicc
2026-07-07 14:00:05 +08:00
parent 991893c2d0
commit 6864256202
4 changed files with 38 additions and 23 deletions

View File

@@ -35,10 +35,12 @@ namespace WPFWCSDemo.Schedules.CircleRGV
if (QueryForIsRequestReset(sourceLocation, 3)) return false;
//校验---目标站点请求
if (QueryForIsRequestReset(targetLocation, 3)) return false;
if (QueryForIsRequestReset(targetLocation, 3))
return false;
//校验---系统异常
if (!isNotException) return false;
if (!isNotException)
return false;
//校验---同输送口相邻任务生成时间间隔过短
if (!CheckSendTaskTimeInterval(targetLocation, 120))
@@ -119,7 +121,7 @@ namespace WPFWCSDemo.Schedules.CircleRGV
/// <returns> true-相差大于x秒 false-相差小于x秒</returns>
public static bool CheckSendTaskTimeInterval(int location)
{
int diff = -15;
int diff = -20;
using var context = new AppDbContext();
@@ -184,7 +186,7 @@ namespace WPFWCSDemo.Schedules.CircleRGV
.Where(t => t.SourceLocation == location.ToString() && (t.ScheduleState==ScheduleStateCode.Trans_CircleRGV_Ready || t.ScheduleState == ScheduleStateCode.Trans_CircleRGV_PickOnTheWay || t.ScheduleState == ScheduleStateCode.Trans_CircleRGV_Picking))
.Count();
if (count < 1)
if (count == 0)
{
return true;
}
@@ -199,7 +201,7 @@ namespace WPFWCSDemo.Schedules.CircleRGV
.Where(t => t.TargetLocation == location.ToString())
.Count();
if (count1 < 1)
if (count1 == 0)
{
return true;
}
@@ -394,12 +396,11 @@ namespace WPFWCSDemo.Schedules.CircleRGV
if (states is null) return false;
//检查是否有符合条件的小车,如果有则标
//检查是否有符合条件的小车
//【源站点】匹配
// 任务处于【取货阶段】
// 无【允许下发】---表示小车在工作中
var count = states
.Where(a => a.Read_SourceLocation == (sourceLocation - 1000).ToString() && a.Read_Phase < 3 && !a.Read_Permission)
.Where(a => a.Read_SourceLocation == (sourceLocation - 1000).ToString() && a.Read_Phase < 3 && a.Read_Phase > 0)
.Count();
if (count > 0)

View File

@@ -174,6 +174,20 @@ namespace WPFWCSDemo.Schedules.CircleRGV
CreateTime = DateTime.Now,
};
var count = context.Tasks
.Where(t => t.SourceLocation == sourceLocation.ToString() &&
(t.ScheduleState == ScheduleStateCode.Trans_CircleRGV_Ready ||
t.ScheduleState == ScheduleStateCode.Trans_CircleRGV_Picking ||
t.ScheduleState == ScheduleStateCode.Trans_CircleRGV_PickOnTheWay))
.Count();
if (count > 0)
{
Log.Warning($"【提示】任务号:{taskNumber},取货站点:{sourceLocation}(该条可忽略)");
return;
}
context.Tasks.Add(taskRT);
if (sourceLocation == RGVStation.LineGH_Pallets_In)