dengjunjie
2025-04-14 970d9c5c36d526a587138232ae9dae719dbcd16d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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);
        }
    }
}