| | |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_TaskInfoRepository; |
| | | using static Microsoft.IO.RecyclableMemoryStreamManager; |
| | | |
| | | namespace WIDESEAWCS_TaskInfoService |
| | |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | | private readonly ITaskExecuteDetailRepository _taskExecuteDetailRepository; |
| | | private readonly ITask_HtyService _task_HtyService; |
| | | private readonly ITask_HtyRepository _task_HtyRepository; |
| | | private readonly IMapper _mapper; |
| | | |
| | | private Dictionary<string, OrderByType> _taskOrderBy = new() |
| | |
| | | |
| | | public List<int> TaskOutboundTypes => typeof(TaskOutboundTypeEnum).GetEnumIndexList(); |
| | | |
| | | public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper, ITask_HtyService task_HtyService) : base(BaseDal) |
| | | public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper, ITask_HtyService task_HtyService, ITask_HtyRepository task_HtyRepository) : base(BaseDal) |
| | | { |
| | | _routerService = routerService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | | _taskExecuteDetailRepository = taskExecuteDetailRepository; |
| | | _task_HtyService = task_HtyService; |
| | | _task_HtyRepository = task_HtyRepository; |
| | | _mapper = mapper; |
| | | } |
| | | |
| | |
| | | WriteLog.GetLog("PLCæ¥å¿åºåºæ¥å¿").Write($"空æåºåºå¤±è´¥ï¼è¯¦æ
ï¼{content.Message}", "éè¦ç©ºæ"); |
| | | } |
| | | } |
| | | return content = WebResponseContent.Instance.Error(); |
| | | return content; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content = WebResponseContent.Instance.Error(ex.Message); |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | |
| | | if (task.TaskNum != _Task.TaskNum) |
| | | { |
| | | WriteLog.GetLog("æ¥æ¶ä»»å¡").Write("ç§»åºä»»å¡ï¼" + JsonConvert.SerializeObject(task), "æ¥æ¶ä»»å¡"); |
| | | task.TaskState = (int)TaskRelocationTypeEnum.Relocation; |
| | | task.TaskState = (int)TaskOutStatusEnum.ResRestNet; |
| | | task.Roadway = task.Roadway == "1" ? task.Roadway = "SC01" : task.Roadway = "SC02"; |
| | | task.TaskNum = task.TaskNum; |
| | | task.Grade = 3; |
| | |
| | | return content = WebResponseContent.Instance.Error($"该任å¡ç¶æä¸å¯è·³è½¬å°ä¸ä¸æ¥,ä»»å¡å·:ã{task.TaskNum}ã,ä»»å¡ç¶æ:ã{task.TaskState}ã"); |
| | | } |
| | | |
| | | int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskOutStatusEnum>(); |
| | | //int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskOutStatusEnum>(); |
| | | |
| | | task.TaskState = nextStatus; |
| | | if (task.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting) |
| | | { |
| | | task.Dispatchertime = DateTime.Now; |
| | | } |
| | | task.TaskState = (int)TaskOutStatusEnum.SC_OutExecuting; |
| | | task.Dispatchertime = DateTime.Now; |
| | | } |
| | | else if (task.TaskType == (int)TaskInboundTypeEnum.Inbound) |
| | | { |
| | |
| | | return content = WebResponseContent.Instance.Error($"该任å¡ç¶æä¸å¯è·³è½¬å°ä¸ä¸æ¥,ä»»å¡å·:ã{task.TaskNum}ã,ä»»å¡ç¶æ:ã{task.TaskState}ã"); |
| | | } |
| | | |
| | | int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskInStatusEnum>(); |
| | | task.TaskState = nextStatus; |
| | | if (task.TaskState == (int)TaskInStatusEnum.SC_InExecuting) |
| | | { |
| | | task.Dispatchertime = DateTime.Now; |
| | | } |
| | | if (task.TaskState == (int)TaskRelocationTypeEnum.Relocation) |
| | | { |
| | | Random random = new Random(); |
| | | task.CurrentAddress = task.NextAddress; |
| | | task.NextAddress = $"{random.Next(1, 100).ToString().PadLeft(3, '0')}-{random.Next(1, 100).ToString().PadLeft(3, '0')}-{random.Next(1, 100).ToString().PadLeft(3, '0')}"; |
| | | task.TargetAddress = task.NextAddress; |
| | | } |
| | | //int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskInStatusEnum>(); |
| | | task.TaskState = (int)TaskInStatusEnum.SC_InExecuting; |
| | | task.Dispatchertime = DateTime.Now; |
| | | } |
| | | else if (task.TaskType == (int)TaskInboundTypeEnum.Inbound) |
| | | else if (task.TaskType == (int)TaskRelocationTypeEnum.Relocation) |
| | | { |
| | | if (task.TaskState <= (int)TaskRelocationStatusEnum.SC_RelocationFinish) |
| | | if (task.TaskState != (int)TaskOutStatusEnum.ResRestNet) |
| | | { |
| | | |
| | | return content = WebResponseContent.Instance.Error($"该任å¡ç¶æä¸å¯è·³è½¬å°ä¸ä¸æ¥,ä»»å¡å·:ã{task.TaskNum}ã,ä»»å¡ç¶æ:ã{task.TaskState}ã"); |
| | | } |
| | | |
| | | int nextStatus = (int)TaskRelocationStatusEnum.SC_RelocationExecuting; |
| | | task.TaskState = nextStatus; |
| | | if (task.TaskState == (int)TaskRelocationStatusEnum.SC_RelocationExecuting) |
| | | { |
| | | task.Dispatchertime = DateTime.Now; |
| | | } |
| | | task.TaskState = (int)TaskOutStatusEnum.ResRest; //ä¸åç§»åºä»»å¡ |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | content = HttpHelper.Get<WebResponseContent>($"{urlTaskCompleted}?TaskNum={task.TaskNum}&HowWorks=2"); |
| | | |
| | | wcs_PLCto09("åºåºä»»å¡",$"æ¡ç ï¼{task.PalletCode},ä»»å¡å·ï¼{task.TaskNum}",$"è°åwmsä»»å¡åé¦ï¼{JsonConvert.SerializeObject(content)}"); |
| | | wcs_PLCto09("åºåºä»»å¡", $"æ¡ç ï¼{task.PalletCode},ä»»å¡å·ï¼{task.TaskNum}", $"è°åwmsä»»å¡åé¦ï¼{JsonConvert.SerializeObject(content)}"); |
| | | |
| | | task.ModifyDate = DateTime.Now; |
| | | BaseDal.DeleteData(task); |
| | |
| | | return content; |
| | | } |
| | | |
| | | public WebResponseContent StackCraneTashty(int taskNum) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | int taskcount = _task_HtyRepository.QueryData(x =>x.TaskNum == taskNum && x.CreateDate >= DateTime.Now.AddMinutes(-30)).Count(); |
| | | |
| | | if (taskcount>0) return WebResponseContent.Instance.OK(); |
| | | |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°è¯¥ä»»å¡ä¿¡æ¯ï¼æ¶é´ä¸å¨èå´å
,ä»»å¡å·ä¸ºï¼{taskNum}"); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¢å¤æèµ·ä»»å¡ |
| | | /// </summary> |