肖洋
2024-12-13 27aa02de7f3e5079334fb2d13b6facf67eec813c
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -188,10 +188,11 @@
                object obj = new
                {
                    childDeviceCode,
                    command,
                    commandWrite
                };
                _noticeService.StackerData(userIds?.FirstOrDefault(), userTokenIds, new { conveyorLine.DeviceName, data = obj });
                _noticeService.LineData(userIds?.FirstOrDefault(), userTokenIds, new { conveyorLine.DeviceName, data = obj });
                #endregion 调用事件总线通知前端
            }
@@ -271,9 +272,25 @@
                ConsoleHelper.WriteWarningLine($"【{conveyorLine._deviceName}】任务号:【{command.TaskNum}】,托盘条码:【{command.Barcode}】已到达【{childDeviceCode}】输送线入库完成,下一目标地址【等待分配货位】");
                ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
                WebResponseContent content = _taskService.UpdateTaskStatusToNext(task);
                if (task.TaskType == (int)TaskInboundTypeEnum.InNG)
                {
                    int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskInStatusEnum>();
                Console.Out.WriteLine(content.Serialize());
                    var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.SourceAddress);
                    task.CurrentAddress = station.stationLocation;
                    task.NextAddress = station.stationNGLocation;
                    task.TargetAddress = task.NextAddress;
                    task.TaskState = nextStatus;
                    task.ModifyDate = DateTime.Now;
                    task.Modifier = "System";
                    _taskRepository.UpdateData(task);
                }
                else
                {
                    WebResponseContent content = _taskService.UpdateTaskStatusToNext(task);
                    Console.Out.WriteLine(content.ToJsonString());
                }
            }
        }
@@ -417,7 +434,7 @@
                    taskOutboundTypeEnum = TaskOutboundTypeEnum.OutTray;
                else
                    taskOutboundTypeEnum = TaskOutboundTypeEnum.Outbound;
                await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform.Stacker);
                await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform.Stacker, platform);
            }
            catch (Exception)
            {
@@ -427,7 +444,7 @@
        /// <summary>
        /// 检查任务并创建新任务
        /// </summary>
        private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, string roadWay, List<string> roadways = null)
        private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, string roadWay, Platform platform)
        {
            var tasks = _taskRepository.QueryData(x => x.TaskType == (int)taskType && x.TargetAddress == childDeviceCode);
            if (tasks.Count < index)
@@ -448,7 +465,7 @@
                var wmsIpAddress = wmsBase + requestTrayOutTask;
                var result = await HttpHelper.PostAsync(wmsIpAddress, new { position = childDeviceCode, tag = (int)taskType, areaCdoe = roadWay, roadways = roadways }.ToJsonString());
                var result = await HttpHelper.PostAsync(wmsIpAddress, new { position = childDeviceCode, tag = (int)taskType, areaCdoe = roadWay, platform.ProductionLine }.ToJsonString());
                //var result = await HttpHelper.PostAsync("http://localhost:5000/api/Task/RequestTrayOutTaskAsync", dynamic.ToJsonString());
                WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);