From f42c1482108953bf4530113c9cfd6e09c73c7ae8 Mon Sep 17 00:00:00 2001 From: WenJY Date: Fri, 29 May 2026 10:26:30 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E6=8F=90=E5=8D=87=E6=9C=BASDK=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=8C=E5=B0=81=E8=A3=85=E6=8F=90=E5=8D=87?= =?UTF-8?q?=E6=9C=BA=E7=8A=B6=E6=80=81=E8=8E=B7=E5=8F=96=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dto/GetHoistStatus/GetHoistStatusDto.cs | 71 ++++++++++++++++ .../GetHoistStatus/GetHoistStatusResultDto.cs | 82 +++++++++++++++++++ Sln.Wcs.HoistSdk/HoistSdk.cs | 61 ++++++++++++++ Sln.Wcs.HoistSdk/IHoistSdk.cs | 11 ++- 4 files changed, 223 insertions(+), 2 deletions(-) create mode 100644 Sln.Wcs.HoistSdk/Dto/GetHoistStatus/GetHoistStatusDto.cs create mode 100644 Sln.Wcs.HoistSdk/Dto/GetHoistStatus/GetHoistStatusResultDto.cs diff --git a/Sln.Wcs.HoistSdk/Dto/GetHoistStatus/GetHoistStatusDto.cs b/Sln.Wcs.HoistSdk/Dto/GetHoistStatus/GetHoistStatusDto.cs new file mode 100644 index 0000000..05252b3 --- /dev/null +++ b/Sln.Wcs.HoistSdk/Dto/GetHoistStatus/GetHoistStatusDto.cs @@ -0,0 +1,71 @@ +#region << 版 本 注 释 >> + +/*-------------------------------------------------------------------- +* 版权所有 (c) 2026 WenJY 保留所有权利。 +* CLR版本:4.0.30319.42000 +* 机器名称:Mr.Wen's MacBook Pro +* 命名空间:Sln.Wcs.HoistSdk.Dto.GetHoistStatus +* 唯一标识:981CC5F0-DFD1-49A7-AABC-7903408521FC +* +* 创建者:WenJY +* 电子邮箱: +* 创建时间:2026-05-26 11:16:59 +* 版本:V1.0.0 +* 描述: +* +*-------------------------------------------------------------------- +* 修改人: +* 时间: +* 修改说明: +* +* 版本:V1.0.0 +*--------------------------------------------------------------------*/ + +#endregion << 版 本 注 释 >> + +namespace Sln.Wcs.HoistSdk.Dto.GetHoistStatus; + +public class GetHoistStatusDto +{ + /// + /// 提升机编号 + /// + public string hoistCode { get; set; } + + /// + /// 反馈任务执行指令:是否可以下发任务 + /// + public string canDispatchTask { get; set; } + + /// + /// 当前楼层 + /// + public string currentFloor { get; set; } + + /// + /// 接驳位状态(1~5 楼) + /// 索引 0 → 1楼,索引 1 → 2楼,... 索引 4 → 5楼 + /// + public List transferStationStatus { get; set; } + + /// + /// 读写器触发状态(1~5 楼) + /// 索引 0 → 1楼,索引 1 → 2楼,... 索引 4 → 5楼 + /// + public List readerTriggerStatus { get; set; } + + /// + /// 自动状态:true = 自动模式,false = 手动模式 + /// + public string isAutoMode { get; set; } + + /// + /// 屏蔽调度:true = 屏蔽中,false = 未屏蔽 + /// + public string isDispatchBlocked { get; set; } + + /// + /// 状态指示(详见 ) + /// + public string stateIndicator { get; set; } +} \ No newline at end of file diff --git a/Sln.Wcs.HoistSdk/Dto/GetHoistStatus/GetHoistStatusResultDto.cs b/Sln.Wcs.HoistSdk/Dto/GetHoistStatus/GetHoistStatusResultDto.cs new file mode 100644 index 0000000..9dbcfb6 --- /dev/null +++ b/Sln.Wcs.HoistSdk/Dto/GetHoistStatus/GetHoistStatusResultDto.cs @@ -0,0 +1,82 @@ +#region << 版 本 注 释 >> + +/*-------------------------------------------------------------------- +* 版权所有 (c) 2026 WenJY 保留所有权利。 +* CLR版本:4.0.30319.42000 +* 机器名称:Mr.Wen's MacBook Pro +* 命名空间:Sln.Wcs.HoistSdk.Dto.GetHoistStatus +* 唯一标识:45891DDF-A22B-4259-BBEE-7960917D6A0E +* +* 创建者:WenJY +* 电子邮箱: +* 创建时间:2026-05-26 11:13:56 +* 版本:V1.0.0 +* 描述: +* +*-------------------------------------------------------------------- +* 修改人: +* 时间: +* 修改说明: +* +* 版本:V1.0.0 +*--------------------------------------------------------------------*/ + +#endregion << 版 本 注 释 >> + +namespace Sln.Wcs.HoistSdk.Dto.GetHoistStatus; + +public class GetHoistStatusResultDto +{ + + /// + /// 返回码 + /// + public string code { get; set; } + + /// + /// 返回消息 + /// + public string message { get; set; } + + /// + /// 提升机编号 + /// + public string hoistCode { get; set; } + + /// + /// 反馈任务执行指令:是否可以下发任务 + /// + public int canDispatchTask { get; set; } + + /// + /// 当前楼层 + /// + public int currentFloor { get; set; } + + /// + /// 接驳位状态(1~5 楼) + /// 索引 0 → 1楼,索引 1 → 2楼,... 索引 4 → 5楼 + /// + public int[] transferStationStatus { get; set; } = new int[5]; + + /// + /// 读写器触发状态(1~5 楼) + /// 索引 0 → 1楼,索引 1 → 2楼,... 索引 4 → 5楼 + /// + public int[] readerTriggerStatus { get; set; } = new int[5]; + + /// + /// 自动状态:true = 自动模式,false = 手动模式 + /// + public int isAutoMode { get; set; } + + /// + /// 屏蔽调度:true = 屏蔽中,false = 未屏蔽 + /// + public int isDispatchBlocked { get; set; } + + /// + /// 状态指示(详见 ) + /// + public int stateIndicator { get; set; } +} \ No newline at end of file diff --git a/Sln.Wcs.HoistSdk/HoistSdk.cs b/Sln.Wcs.HoistSdk/HoistSdk.cs index 3173d72..5b17f77 100644 --- a/Sln.Wcs.HoistSdk/HoistSdk.cs +++ b/Sln.Wcs.HoistSdk/HoistSdk.cs @@ -24,6 +24,7 @@ #endregion << 版 本 注 释 >> using Sln.Wcs.HoistSdk.Config; +using Sln.Wcs.HoistSdk.Dto.GetHoistStatus; using Sln.Wcs.HoistSdk.Dto.HoistControl; using Sln.Wcs.HoistSdk.Dto.HoistTaskExecutor; using Sln.Wcs.Plc.Service; @@ -72,4 +73,64 @@ public class HoistSdk:IHoistSdk { throw new NotImplementedException(); } + + public GetHoistStatusResultDto GetHoistStatus(GetHoistStatusDto hoistStatusDto) + { + //一号提升机 + //反馈任务执行指令:是否可以下发任务 + //当前楼层 + //接驳位状态:1-5楼 + //读写器触发状态:1-5楼 + //自动状态:true/1-自动模式 + //屏蔽调度:true/1-屏蔽中 + //状态指示:0-静态;1-上升;2-下降;3-进料;4-出料 + + GetHoistStatusResultDto result = new GetHoistStatusResultDto(); + try + { + var plc = _plcs.Where(x => x.ConfigKey.Equals(hoistStatusDto.hoistCode)).ToList().First(); + + result.hoistCode = hoistStatusDto.hoistCode; + result.canDispatchTask = plc.readInt16ByAddress(hoistStatusDto.canDispatchTask); + result.currentFloor = plc.readInt16ByAddress(hoistStatusDto.currentFloor); + + //读取接驳位状态 + List transferStationStatus = new List(); + foreach (var item in hoistStatusDto.transferStationStatus) + { + transferStationStatus.Add(plc.readInt16ByAddress(item)); + } + result.transferStationStatus = transferStationStatus.ToArray(); + + //读取读写器触发状态 + List readerTriggerStatus = new List(); + foreach (var item in hoistStatusDto.readerTriggerStatus) + { + readerTriggerStatus.Add(plc.readInt16ByAddress(item)); + } + result.readerTriggerStatus = readerTriggerStatus.ToArray(); + + result.isAutoMode = plc.readInt16ByAddress(hoistStatusDto.isAutoMode); + result.isDispatchBlocked = plc.readInt16ByAddress(hoistStatusDto.isDispatchBlocked); + result.stateIndicator = plc.readInt16ByAddress(hoistStatusDto.stateIndicator); + + // hoistStatusDto.hoistCode = ""; + // hoistStatusDto.canDispatchTask = "D3101"; + // hoistStatusDto.currentFloor = "D3102"; + // hoistStatusDto.transferStationStatus = new List(){"D3104","D3105","D3106","D3107","D3108"}; + // hoistStatusDto.readerTriggerStatus = new List(){"D3109","D3110","D3111","D3112","D3113"}; + // hoistStatusDto.isAutoMode = "D3124"; + // hoistStatusDto.isDispatchBlocked = "D3125"; + // hoistStatusDto.stateIndicator = "D3127"; + + result.code = "0"; + result.message = "状态更新成功"; + } + catch (Exception e) + { + result.code = "99"; + result.message = e.Message; + } + return result; + } } \ No newline at end of file diff --git a/Sln.Wcs.HoistSdk/IHoistSdk.cs b/Sln.Wcs.HoistSdk/IHoistSdk.cs index d09baf6..2a3301b 100644 --- a/Sln.Wcs.HoistSdk/IHoistSdk.cs +++ b/Sln.Wcs.HoistSdk/IHoistSdk.cs @@ -23,6 +23,7 @@ #endregion << 版 本 注 释 >> +using Sln.Wcs.HoistSdk.Dto.GetHoistStatus; using Sln.Wcs.HoistSdk.Dto.HoistControl; using Sln.Wcs.HoistSdk.Dto.HoistTaskExecutor; @@ -47,6 +48,12 @@ public interface IHoistSdk /// /// HoistTaskExeResultDto HoistTaskExecutor(HoistTaskExeDto hoistTaskExeDto); - - + + /// + /// 获取提升机状态 + /// + /// + /// + GetHoistStatusResultDto GetHoistStatus(GetHoistStatusDto hoistStatusDto); + } \ No newline at end of file