From 9b567a8304c3d202ddd1f716cb63c2a4535b6417 Mon Sep 17 00:00:00 2001 From: 肖洋 <cathay_xy@163.com> Date: 星期一, 09 十二月 2024 22:47:06 +0800 Subject: [PATCH] 高温出库堆垛机完成给线体写入托盘号 --- Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs | 29 ++++++++++++++++------------- Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 9 ++++++++- Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs | 22 +++++++++++++++++++++- 3 files changed, 45 insertions(+), 15 deletions(-) diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs index 9af8fbf..77f1978 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs @@ -1,6 +1,8 @@ 锘� using AutoMapper; using HslCommunication; +using Mapster; +using Microsoft.AspNetCore.Components.Routing; using Newtonsoft.Json; using SqlSugar; using System.Diagnostics.CodeAnalysis; @@ -19,6 +21,8 @@ using WIDESEAWCS_ITaskInfoRepository; using WIDESEAWCS_ITaskInfoService; using WIDESEAWCS_Model.Models; +using WIDESEAWCS_QuartzJob; +using WIDESEAWCS_QuartzJob.DeviceBase; using WIDESEAWCS_QuartzJob.Models; using WIDESEAWCS_QuartzJob.Repository; using WIDESEAWCS_QuartzJob.Service; @@ -602,8 +606,11 @@ else { task.TaskState = (int)TaskOutStatusEnum.OutFinish; - BaseDal.UpdateData(task); + BaseDal.DeleteData(task); + ConsoleHelper.WriteWarningLine($"楂樻俯鍑哄簱鐩殑鍦板潃{task.TargetAddress}"); + var taskHty = task.Adapt<Dt_Task_Hty>(); + _taskHtyRepository.AddData(taskHty); _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄嚭搴撳畬鎴�"); } diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs index a92dfca..4ea6b5c 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs @@ -14,6 +14,7 @@ using HslCommunication; using WIDESEAWCS_DTO.WMS; using WIDESEAWCS_Common; +using Masuit.Tools; namespace WIDESEAWCS_Tasks { @@ -157,17 +158,17 @@ ConveyorLineOutFinish(conveyorLine, command, childDeviceCode); break; case 6: - CreateAndSendEmptyTrayTask(conveyorLine,command, childDeviceCode); + CreateAndSendEmptyTrayTask(conveyorLine, command, childDeviceCode); break; case 1: - if (stationManager.stationArea.Contains("GW")) - { - var taskGW = _taskRepository.QueryFirst(x => x.TargetAddress == childDeviceCode && (x.TaskState == (int)TaskOutStatusEnum.OutFinish|| x.TaskState == (int)TaskOutStatusEnum.OutPending)); - if (taskGW != null) - { - command.ConveyorLineBarcode = taskGW.PalletCode; - } - } + //if (stationManager.stationArea.Contains("GW")) + //{ + // var taskGW = _taskRepository.QueryFirst(x => x.TargetAddress == childDeviceCode && (x.TaskState == (int)TaskOutStatusEnum.OutFinish || x.TaskState == (int)TaskOutStatusEnum.OutPending)); + // if (taskGW != null) + // { + // command.ConveyorLineBarcode = taskGW.PalletCode; + // } + //} RequestWmsTask(conveyorLine, command, childDeviceCode); break; } @@ -281,9 +282,10 @@ /// </summary> private async void RequestWmsTask(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode) { - var taskGW = _taskRepository.QueryFirst(x => x.TargetAddress == childDeviceCode && (x.TaskState == (int)TaskOutStatusEnum.OutFinish || x.TaskState == (int)TaskOutStatusEnum.OutPending)); - if (taskGW != null) - _taskRepository.DeleteData(taskGW); + //var taskGW = _taskRepository.QueryFirst(x => x.TargetAddress == childDeviceCode && (x.TaskState == (int)TaskOutStatusEnum.OutFinish || x.TaskState == (int)TaskOutStatusEnum.OutPending)); + //if (taskGW != null) + // _taskRepository.DeleteData(taskGW); + if (command.ConveyorLineBarcode.IsNullOrEmpty()) return; var content = await _taskService.RequestWMSTask(command.ConveyorLineBarcode, childDeviceCode); if (content.Status) { @@ -303,7 +305,8 @@ else { WriteInfo(conveyorLine.DeviceName, content.Message); - _taskRepository.AddData(taskGW); + ConsoleHelper.WriteErrorLine($"銆恵conveyorLine.DeviceName}銆戞墭鐩樺彿锛氥�恵command.ConveyorLineBarcode}銆戣姹傜偣浣嶏細銆恵childDeviceCode}銆戝紓甯镐俊鎭�恵content.Message}銆�"); + //_taskRepository.AddData(taskGW); } } } diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs index a2a6076..1375410 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs @@ -1,8 +1,10 @@ 锘縰sing Autofac.Core; using HslCommunication; +using Mapster; using Newtonsoft.Json; using Quartz; using System.Diagnostics.CodeAnalysis; +using WIDESEAWCS_BasicInfoRepository; using WIDESEAWCS_Common.TaskEnum; using WIDESEAWCS_Core.Caches; using WIDESEAWCS_Core.Helper; @@ -19,6 +21,7 @@ using WIDESEAWCS_QuartzJob.Service; using WIDESEAWCS_QuartzJob.StackerCrane.Enum; using WIDESEAWCS_SignalR; +using WIDESEAWCS_Tasks.ConveyorLineJob; using WIDESEAWCS_Tasks.StackerCraneJob; namespace WIDESEAWCS_Tasks @@ -33,8 +36,9 @@ private readonly IProcessRepository _processRepository; private readonly ICacheService _cacheService; private readonly INoticeService _noticeService; + private readonly IDt_StationManagerRepository _stationManagerRepository; - public CommonStackerCraneJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IProcessRepository processRepository, ICacheService cacheService, INoticeService noticeService) + public CommonStackerCraneJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IProcessRepository processRepository, ICacheService cacheService, INoticeService noticeService, IDt_StationManagerRepository stationManagerRepository) { _taskService = taskService; _taskExecuteDetailService = taskExecuteDetailService; @@ -43,6 +47,7 @@ _processRepository = processRepository; _cacheService = cacheService; _noticeService = noticeService; + _stationManagerRepository = stationManagerRepository; } public Task Execute(IJobExecutionContext context) @@ -136,6 +141,21 @@ { //Console.Out.WriteLine("TaskCompleted" + e.TaskNum); ConsoleHelper.WriteColorLine($"銆恵commonStackerCrane.DeviceName}銆戜换鍔″畬鎴�,浠诲姟鍙凤細銆恵e.TaskNum}銆�", ConsoleColor.Blue); + if (commonStackerCrane.DeviceCode.Contains("GW")) + { + var task = _taskRepository.QueryFirst(x => x.TaskNum == e.TaskNum); + + var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.TargetAddress); + + IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == station.stationPLC); + if (device != null) + { + CommonConveyorLine_GW conveyorLine = (CommonConveyorLine_GW)device; + conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, task.PalletCode, task.TargetAddress); + } + else + return; + } _taskService.StackCraneTaskCompleted(e.TaskNum); commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); } -- Gitblit v1.9.3