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

@@ -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);
}