You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.0 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* 版权所有 (c) 2026 WenJY 保留所有权利。
* CLR版本4.0.30319.42000
* 机器名称Mr.Wen's MacBook Pro
* 命名空间Sln.Wcs.HoistSdk
* 唯一标识6BE2CE90-15BA-43B1-88B0-78853870ECDA
*
* 创建者WenJY
* 电子邮箱:
* 创建时间2026-05-06 14:09:47
* 版本V1.0.0
* 描述:
*
*--------------------------------------------------------------------
* 修改人:
* 时间:
* 修改说明:
*
* 版本V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
using Sln.Wcs.HoistSdk.Config;
using Sln.Wcs.HoistSdk.Dto.HoistControl;
using Sln.Wcs.HoistSdk.Dto.HoistTaskExecutor;
using Sln.Wcs.Plc.Service;
namespace Sln.Wcs.HoistSdk;
public class HoistSdk:IHoistSdk
{
private readonly HoistConfig hoistConfig;
private readonly List<IPlc> _plcs;
public HoistSdk(HoistConfig hoistConfig, List<IPlc> plcs)
{
this.hoistConfig = hoistConfig;
_plcs = plcs;
}
public HoistControlResultDto HoistControl(HoistControlDto hoistControlDto)
{
HoistControlResultDto result = new HoistControlResultDto();
try
{
var plc = _plcs.Where(x => x.ConfigKey.Equals(hoistControlDto.hoistCode)).ToList().First();
var res = plc.writeInt16ByAddress(hoistConfig.hoist_control_addr, (int)hoistControlDto.action);
if (res)
{
result.code = "0";
result.message = "写入成功";
}
else
{
result.code = "99";
result.message = "写入失败";
}
}
catch (Exception e)
{
result.code = "99";
result.message = e.Message;
}
return result;
}
public HoistTaskExeResultDto HoistTaskExecutor(HoistTaskExeDto hoistTaskExeDto)
{
throw new NotImplementedException();
}
}