From 7d2fd750dc14c4f5fb31a166727b259d3f2d3b33 Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期四, 26 十二月 2024 21:47:20 +0800 Subject: [PATCH] agv --- 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGVJob.cs | 101 +++++++++++++++++++++++++++++++++ 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs | 2 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs | 12 ++++ 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/Agv/AgvTaskDTO.cs | 8 ++ 4 files changed, 121 insertions(+), 2 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs" index e8a052b..ea1acd6 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs" @@ -58,6 +58,18 @@ ProductionReturn = 550, /// <summary> + /// 绾胯竟浠撳叆搴� + /// </summary> + [Description("绾胯竟浠撳叆搴�")] + InboundXB = 560, + + /// <summary> + /// 鏈哄彴鍏ュ簱 + /// </summary> + [Description("鏈哄彴鍏ュ簱")] + InboundJT = 570, + + /// <summary> /// 宸烽亾鍐呯Щ搴� /// </summary> [Description("宸烽亾鍐呯Щ搴�")] diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/Agv/AgvTaskDTO.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/Agv/AgvTaskDTO.cs" index 583c83c..59634bc 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/Agv/AgvTaskDTO.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/Agv/AgvTaskDTO.cs" @@ -26,7 +26,7 @@ /// <summary> /// 浣嶇疆璺緞 /// </summary> - public List<object> PositionCodePath { get; set; } + public List<CodePath> PositionCodePath { get; set; } /// <summary> /// 杞藉叿缂栧彿 /// </summary> @@ -69,4 +69,10 @@ /// </summary> public string Data { get; set; } } + + public class CodePath + { + public string type { get; set; } + public string positionCode { get; set; } + } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs" index 18b5cc0..5f367e3 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs" @@ -78,7 +78,7 @@ return content; } /// <summary> - /// AGV浠诲姟鐘舵�佸埛鏂� + /// AGV浠诲姟鐘舵�佸埛鏂�/AGV浠诲姟瀹屾垚 /// </summary> /// <param name="agvUpdateModel"></param> /// <returns></returns> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGVJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGVJob.cs" new file mode 100644 index 0000000..09bcf17 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGVJob.cs" @@ -0,0 +1,101 @@ +锘縰sing AutoMapper; +using Newtonsoft.Json; +using Quartz; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection.Metadata; +using System.Text; +using System.Threading.Tasks; +using WIDESEA_DTO.Agv; +using WIDESEAWCS_Common.TaskEnum; +using WIDESEAWCS_Core; +using WIDESEAWCS_Core.Helper; +using WIDESEAWCS_DTO.TaskInfo; +using WIDESEAWCS_ITaskInfoService; +using WIDESEAWCS_Model.Models; +using WIDESEAWCS_QuartzJob; +using WIDESEAWCS_QuartzJob.Service; + +namespace WIDESEAWCS_Tasks +{ + [DisallowConcurrentExecution] + public class AGVJob : JobBase, IJob + { + public readonly ITaskService _taskService; + private readonly ITaskExecuteDetailService _taskExecuteDetailService; + private readonly IRouterService _routerService; + private readonly IMapper _mapper; + + public AGVJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper) + { + _taskService = taskService; + _taskExecuteDetailService = taskExecuteDetailService; + _routerService = routerService; + _mapper = mapper; + } + public Task Execute(IJobExecutionContext context) + { + try + { + List<Dt_Task> UpTasks = new List<Dt_Task>(); + var newTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt() || x.TaskState == TaskStatusEnum.New.ObjToInt()).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); + foreach (var agvTask in newTasks) + { + AgvTaskDTO taskDTO = new AgvTaskDTO() + { + ReqCode = agvTask.TaskNum.ToString(), + TaskTyp = AgvTaskType(agvTask.TaskType, agvTask.DeviceCode), + PositionCodePath = new List<CodePath>() + { + new CodePath() + { + type="", + positionCode="" + }, + new CodePath() + { + type="", + positionCode="" + } + }, + PodTyp = agvTask.PalletType == 1 ? "XX" : "DD", + }; + WebResponseContent content = _taskService.AgvSendTask(taskDTO); + if (content.Status) + { + agvTask.TaskState = TaskStatusEnum.AGV_Execute.ObjToInt(); + UpTasks.Add(agvTask); + } + } + _taskService.UpdateData(UpTasks); + } + catch (Exception ex) + { + Console.Out.WriteLine(nameof(AGVJob) + ":" + ex.Message); + } + return Task.CompletedTask; + } + + public string AgvTaskType(int TaskType, string DeviceCode) + { + switch (DeviceCode) + { + case "SC01-CSJ": + { + return TaskType == TaskTypeEnum.ProductionReturn.ObjToInt() ? "23" : "24"; + } + case "SC01-ZH": + { + if (TaskType == TaskTypeEnum.InboundXB.ObjToInt()) + return "20"; + else if (TaskType == TaskTypeEnum.InboundJT.ObjToInt()) + return "21"; + else return "22"; + } + default: + throw new NotImplementedException(); + } + } + } +} -- Gitblit v1.9.3