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
|
{
|
/// <summary>
|
/// 读取堆垛机信息
|
/// </summary>
|
/// <typeparam name="T"></typeparam>
|
/// <param name="shuttleCar"></param>
|
/// <param name="deviceChildCode"></param>
|
/// <returns></returns>
|
/// <exception cref="Exception"></exception>
|
public T ReadCustomer<T>(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<T>(deviceProDTO.DeviceProAddress);
|
}
|
}
|
}
|