1
hutongqing
2024-12-22 5be086f36d5fbcde9aaa6f775961f292aaae6ec1
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ÓÍÄ«²Ö/StackerCraneJob_YM.cs
@@ -7,7 +7,9 @@
using System.Text;
using System.Threading.Tasks;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.Enums;
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_IBasicInfoRepository;
using WIDESEAWCS_ITaskInfoRepository;
using WIDESEAWCS_ITaskInfoService;
@@ -23,6 +25,9 @@
namespace WIDESEAWCS_Tasks
{
    /// <summary>
    /// æ²¹å¢¨ä»“堆垛机
    /// </summary>
    [DisallowConcurrentExecution]
    public class StackerCraneJob_YM : JobBase, IJob
    {
@@ -69,7 +74,17 @@
                                    if (sendFlag)
                                    {
                                        commonStackerCrane.LastTaskType = task.TaskType;
                                        _taskService.UpdateTaskStatusToNext(task.TaskNum);
                                        int oldState = task.TaskState;
                                        if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
                                        {
                                            task.TaskState = TaskInStatusEnum.SC_InExecuting.ObjToInt();
                                        }
                                        else
                                        {
                                            task.TaskState = TaskOutStatusEnum.SC_OutExecuting.ObjToInt();
                                        }
                                        _taskRepository.UpdateData(task);
                                        _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"系统自动流程,任务状态从【{oldState}】转到【{task.TaskState}】");
                                    }
                                }
                            }
@@ -94,10 +109,18 @@
            CommonStackerCrane? commonStackerCrane = sender as CommonStackerCrane;
            if (commonStackerCrane != null)
            {
                WriteInfo(commonStackerCrane.DeviceName, $"读取到任务完成信号,{e.TaskNum}");
                if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5)
                {
                    Console.Out.WriteLine("TaskCompleted" + e.TaskNum);
                    _taskService.StackCraneTaskCompleted(e.TaskNum);
                    Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == e.TaskNum);
                    if (task != null)
                    {
                    }
                    else
                    {
                        WriteInfo(commonStackerCrane.DeviceName, $"读取到任务完成信号,未找到对应的任务信息,{e.TaskNum}");
                    }
                    commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5);
                }
            }