using HslCommunication;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEAWCS_QuartzJob.DTO;
using WIDESEAWCS_QuartzJob;
namespace WIDESEAWCS_Tasks
{
public partial class CommonStackerCraneJob
{
///
/// 读取堆垛机信息
///
///
///
///
///
///
public T ReadCustomer(SpeStackerCrane commonStackerCrane, string deviceChildCode) where T : IDataTransfer, new()
{
string deviceChildCode2 = deviceChildCode;
if (!commonStackerCrane.IsConnected)
{
throw new Exception("通讯连接错误,请检查网络");
}
DeviceProDTO? deviceProDTO = (from x in commonStackerCrane.DeviceProDTOs
where x.DeviceProParamType == "ReadDeviceCommand" && x.DeviceChildCode == deviceChildCode2
orderby x.DeviceProOffset
select x).FirstOrDefault();
if (deviceProDTO == null)
{
throw new Exception("未找到协议信息");
}
return commonStackerCrane.Communicator.ReadCustomer(deviceProDTO.DeviceProAddress);
}
}
}