This commit is contained in:
Administrator
2026-07-07 10:32:25 +08:00
parent 773aea0c5d
commit 991893c2d0
2 changed files with 101 additions and 89 deletions

View File

@@ -41,17 +41,21 @@ namespace WPFWCSDemo.Schedules.CircleRGV
if (!isNotException) return false;
//校验---同输送口相邻任务生成时间间隔过短
if (!CheckSendTaskTimeInterval(targetLocation, 999)) return false;
if (!CheckSendTaskTimeInterval(targetLocation, 120))
return false;
//校验---如果已经存在处于【取货阶段】的某个【空托】任务
//由于【空托任务】输送线的源站点唯一,因此必须等待该任务取货完成才能生成新的【空托】任务
if (!IsPalletLineHasTask()) return false;
if (!IsPalletLineHasTask())
return false;
//校验---当前输送线存在【空托】任务
if (!GetRGVTaskForPalletsIsExist(targetLocation)) return false;
if (!GetRGVTaskForPalletsIsExist(targetLocation))
return false;
//校验5.当前同一【目标站点】是否已经生成任务
if (!CheckSendTaskIsRepeat(sourceLocation, TaskType.Pallet)) return false;
if (!CheckSendTaskIsRepeat(sourceLocation, TaskType.Pallet))
return false;
//校验---上位是否手动禁止生成
if (LineTaskForPermission(targetLocation) == 0) return false;

View File

@@ -74,109 +74,117 @@ namespace WPFWCSDemo.Schedules.CircleRGV
if (taskRT is null) continue;
//有【允许下发】
//if (circleRGVState.Read_Permission) continue;
//无【允许下发】---表示小车有执行中的任务
switch (circleRGVState.Read_Phase)
try
{
case 1:
if (taskRT.ScheduleState == ScheduleStateCode.Trans_CircleRGV_Ready && !circleRGVState.Read_Permission)
{
taskRT.ScheduleState = ScheduleStateCode.Trans_CircleRGV_PickOnTheWay;
//有【允许下发】
//if (circleRGVState.Read_Permission) continue;
if (context.SaveChanges() == 1) Log.Information($"【WCS更新调度状态】任务号:{circleRGVState.Read_TaskNumber}--->取货途中");
}
continue;
case 2:
if (taskRT.ScheduleState != ScheduleStateCode.Trans_CircleRGV_Picking && !circleRGVState.Read_Permission)
{
taskRT.ScheduleState = ScheduleStateCode.Trans_CircleRGV_Picking;
if (context.SaveChanges() == 1) Log.Information($"【WCS更新调度状态】任务号:{circleRGVState.Read_TaskNumber}--->取货中");
//更新取货时间
if (taskRT.TaskType == TaskType.Goods)
//无【允许下发】---表示小车有执行中的任务
switch (circleRGVState.Read_Phase)
{
case 1:
if (taskRT.ScheduleState == ScheduleStateCode.Trans_CircleRGV_Ready && !circleRGVState.Read_Permission)
{
var loadedState = context.LoadedState
.FirstOrDefault(s => s.Station.ToString() == taskRT.SourceLocation);
taskRT.ScheduleState = ScheduleStateCode.Trans_CircleRGV_PickOnTheWay;
loadedState!.LoadingTime = DateTime.Now;
if (context.SaveChanges() == 1) Log.Information($"【WCS更新调度状态】任务号:{circleRGVState.Read_TaskNumber}--->取货途中");
}
if (taskRT.TaskType == TaskType.Pallet)
continue;
case 2:
if (taskRT.ScheduleState != ScheduleStateCode.Trans_CircleRGV_Picking && !circleRGVState.Read_Permission)
{
var loadedState = context.LoadedState
.FirstOrDefault(s => s.Station.ToString() == taskRT.TargetLocation);
taskRT.ScheduleState = ScheduleStateCode.Trans_CircleRGV_Picking;
loadedState!.LoadingTime = DateTime.Now;
if (context.SaveChanges() == 1) Log.Information($"【WCS更新调度状态】任务号:{circleRGVState.Read_TaskNumber}--->取货中");
//更新取货时间
if (taskRT.TaskType == TaskType.Goods)
{
var loadedState = context.LoadedState
.FirstOrDefault(s => s.Station.ToString() == taskRT.SourceLocation);
loadedState!.LoadingTime = DateTime.Now;
}
if (taskRT.TaskType == TaskType.Pallet)
{
var loadedState = context.LoadedState
.FirstOrDefault(s => s.Station.ToString() == taskRT.TargetLocation);
loadedState!.LoadingTime = DateTime.Now;
}
context.SaveChanges();
}
context.SaveChanges();
}
continue;
case 3:
if (taskRT.ScheduleState != ScheduleStateCode.Trans_CircleRGV_PutOnTheWay && !circleRGVState.Read_Permission)
{
taskRT.ScheduleState = ScheduleStateCode.Trans_CircleRGV_PutOnTheWay;
taskRT.JobId = i.ToString();
if (context.SaveChanges() == 1) Log.Information($"【WCS更新调度状态】任务号:{circleRGVState.Read_TaskNumber}--->放货途中");
//更新取货时间
if (taskRT.TaskType == TaskType.Goods)
continue;
case 3:
if (taskRT.ScheduleState != ScheduleStateCode.Trans_CircleRGV_PutOnTheWay && !circleRGVState.Read_Permission)
{
var loadedState = context.LoadedState
.FirstOrDefault(s => s.Station.ToString() == taskRT.SourceLocation);
taskRT.ScheduleState = ScheduleStateCode.Trans_CircleRGV_PutOnTheWay;
taskRT.JobId = i.ToString();
if (context.SaveChanges() == 1) Log.Information($"【WCS更新调度状态】任务号:{circleRGVState.Read_TaskNumber}--->放货途中");
//更新取货时间
if (taskRT.TaskType == TaskType.Goods)
{
var loadedState = context.LoadedState
.FirstOrDefault(s => s.Station.ToString() == taskRT.SourceLocation);
loadedState!.LoadedTime = DateTime.Now;
}
if (taskRT.TaskType == TaskType.Pallet)
{
var loadedState = context.LoadedState
.FirstOrDefault(s => s.Station.ToString() == taskRT.TargetLocation);
loadedState!.LoadedTime = DateTime.Now;
}
context.SaveChanges();
loadedState!.LoadedTime = DateTime.Now;
}
if (taskRT.TaskType == TaskType.Pallet)
continue;
case 4:
if (taskRT.ScheduleState != ScheduleStateCode.Trans_CircleRGV_Putting && !circleRGVState.Read_Permission)
{
var loadedState = context.LoadedState
.FirstOrDefault(s => s.Station.ToString() == taskRT.TargetLocation);
taskRT.ScheduleState = ScheduleStateCode.Trans_CircleRGV_Putting;
loadedState!.LoadedTime = DateTime.Now;
if (context.SaveChanges() == 1) Log.Information($"【WCS更新调度状态】任务号:{circleRGVState.Read_TaskNumber}--->放货中");
//更新取货时间
if (taskRT.TaskType == TaskType.Goods)
{
var loadedState = context.LoadedState
.FirstOrDefault(s => s.Station.ToString() == taskRT.SourceLocation);
loadedState!.PuttingTime = DateTime.Now;
}
if (taskRT.TaskType == TaskType.Pallet)
{
var loadedState = context.LoadedState
.FirstOrDefault(s => s.Station.ToString() == taskRT.TargetLocation);
loadedState!.PuttingTime = DateTime.Now;
}
context.SaveChanges();
}
context.SaveChanges();
}
continue;
case 4:
if (taskRT.ScheduleState != ScheduleStateCode.Trans_CircleRGV_Putting && !circleRGVState.Read_Permission)
{
taskRT.ScheduleState = ScheduleStateCode.Trans_CircleRGV_Putting;
if (context.SaveChanges() == 1) Log.Information($"【WCS更新调度状态】任务号:{circleRGVState.Read_TaskNumber}--->放货中");
//更新取货时间
if (taskRT.TaskType == TaskType.Goods)
continue;
case 5:
if (taskRT.ScheduleState != ScheduleStateCode.Trans_CircleRGV_Ready)
{
var loadedState = context.LoadedState
.FirstOrDefault(s => s.Station.ToString() == taskRT.SourceLocation);
taskRT.ScheduleState = ScheduleStateCode.Trans_CircleRGV_Finish;
loadedState!.PuttingTime = DateTime.Now;
if (context.SaveChanges() == 1) Log.Information($"【WCS更新调度状态】任务号:{circleRGVState.Read_TaskNumber}--->放货完成");
}
if (taskRT.TaskType == TaskType.Pallet)
{
var loadedState = context.LoadedState
.FirstOrDefault(s => s.Station.ToString() == taskRT.TargetLocation);
loadedState!.PuttingTime = DateTime.Now;
}
context.SaveChanges();
}
continue;
case 5:
if (taskRT.ScheduleState != ScheduleStateCode.Trans_CircleRGV_Ready)
{
taskRT.ScheduleState = ScheduleStateCode.Trans_CircleRGV_Finish;
if (context.SaveChanges() == 1) Log.Information($"【WCS更新调度状态】任务号:{circleRGVState.Read_TaskNumber}--->放货完成");
}
continue;
continue;
}
}
catch (Exception ex)
{
Log.Error("【更新任务阶段】执行异常," + ex.Message);
}