From 5431646d7fc6bd18e3fe9484b875084e620d6dc6 Mon Sep 17 00:00:00 2001 From: 肖洋 <cathay_xy@163.com> Date: 星期日, 15 十二月 2024 09:28:05 +0800 Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/HuaYiZhongHeng/BaiBuLiKu --- Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 62 ++++++++++++++++++++++++++----- 1 files changed, 52 insertions(+), 10 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..5dee342 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; @@ -163,7 +167,24 @@ } var task = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString()); - return ReceiveWMSTask(new List<WMSTaskDTO> { task }); + if (task.TaskType == (int)TaskInboundTypeEnum.InNG) + { + var station = await _stationManagerRepository.QueryFirstAsync(x => x.stationChildCode == task.SourceAddress); + Dt_Task _Task = _mapper.Map<Dt_Task>(task); + _Task.TaskState = (int)TaskInStatusEnum.InNew; + _Task.CurrentAddress = task.SourceAddress; + _Task.NextAddress = station.stationNGChildCode; + _Task.TargetAddress = station.stationNGLocation; + _Task.Roadway = station.Roadway; + + BaseDal.AddData(_Task); + _taskExecuteDetailService.AddTaskExecuteDetail(_Task.TaskNum, "鎺ユ敹WMS浠诲姟"); + return content.OK(); + } + else + { + return ReceiveWMSTask(new List<WMSTaskDTO> { task }); + } } catch (Exception ex) { @@ -602,8 +623,19 @@ else { task.TaskState = (int)TaskOutStatusEnum.OutFinish; - BaseDal.UpdateData(task); + //濡傞珮娓╁嚭搴撳悗 NG 鍒欏皢浠诲姟鏍囪涓篘G 骞跺湪鍑哄簱鐢宠鍚庡皢浠诲姟鍑鸿嚦NG鍙� + if (task.Remark == "NG") + { + BaseDal.UpdateData(task); + } + else + { + BaseDal.DeleteData(task); + ConsoleHelper.WriteWarningLine($"楂樻俯鍑哄簱鐩殑鍦板潃{task.TargetAddress}"); + } + var taskHty = task.Adapt<Dt_Task_Hty>(); + _taskHtyRepository.AddData(taskHty); _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄嚭搴撳畬鎴�"); } @@ -640,15 +672,15 @@ #region 鏇存柊浠诲姟鐘舵�� - var updateTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.UpdateTask)?.ConfigValue; - if (wmsBase == null || updateTask == null) - { - throw new InvalidOperationException("WMS IP 鏈厤缃�"); - } - wmsIpAddress = wmsBase + updateTask; + //var updateTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.UpdateTask)?.ConfigValue; + //if (wmsBase == null || updateTask == null) + //{ + // throw new InvalidOperationException("WMS IP 鏈厤缃�"); + //} + //wmsIpAddress = wmsBase + updateTask; - result = HttpHelper.PostAsync(wmsIpAddress, new { TaskNum = task.TaskNum, TaskState = task.TaskState }.ToJsonString()).Result; - content = JsonConvert.DeserializeObject<WebResponseContent>(result); + //result = HttpHelper.PostAsync(wmsIpAddress, new { TaskNum = task.TaskNum, TaskState = task.TaskState }.ToJsonString()).Result; + //content = JsonConvert.DeserializeObject<WebResponseContent>(result); #endregion //content = WebResponseContent.Instance.OK(); } @@ -748,5 +780,15 @@ } return content; } + + public Dt_Task QueryRelocationTask(string deviceNo) + { + return BaseDal.QueryFirst(x => x.Roadway == deviceNo && x.TaskType == (int)TaskRelocationTypeEnum.Relocation && x.TaskState == (int)TaskStatus.Created); + } + + public Dt_Task QueryExecutingTaskByBarcode(string barcode, string nextAddress) + { + return BaseDal.QueryFirst(x => x.PalletCode == barcode && x.NextAddress == nextAddress && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting), TaskOrderBy); + } } } \ No newline at end of file -- Gitblit v1.9.3