wanshenmean
2025-04-11 0abd867230198628a88f54370104bee0306f1f7c
´úÂë¹ÜÀí/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Roast/CommonRoast.cs
@@ -1,4 +1,5 @@
#region << ç‰ˆ æœ¬ æ³¨ é‡Š >>
/*----------------------------------------------------------------
 * å‘½åç©ºé—´ï¼šWIDESEAWCS_QuartzJob
 * åˆ›å»ºè€…:胡童庆
@@ -11,22 +12,17 @@
 * ä¿®æ”¹æ—¶é—´ï¼š
 * ç‰ˆæœ¬ï¼šV1.0.1
 * ä¿®æ”¹è¯´æ˜Žï¼š
 *
 *
 *----------------------------------------------------------------*/
#endregion << ç‰ˆ æœ¬ æ³¨ é‡Š >>
using HslCommunication;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEAWCS_Communicator;
using WIDESEAWCS_QuartzJob.ConveyorLine.Enum;
using WIDESEAWCS_QuartzJob.DeviceBase;
using WIDESEAWCS_QuartzJob.DTO;
using WIDESEAWCS_QuartzJob.StackerCrane.Enum;
namespace WIDESEAWCS_QuartzJob
{
@@ -37,6 +33,7 @@
    public class CommonRoast : IRoast
    {
        #region Private Member
        /// <summary>
        /// çƒ˜çƒ¤é€šè®¯å¯¹è±¡
        /// </summary>
@@ -65,9 +62,11 @@
        private bool _heartStatr = true;
        private bool _isConnected = true;
        #endregion
        #region Public Member
        /// <summary>
        /// çƒ˜çƒ¤é€šè®¯å¯¹è±¡
        /// </summary>
@@ -101,6 +100,7 @@
        #endregion
        #region Constructor Function
        /// <summary>
        /// æž„造函数
        /// </summary>
@@ -118,9 +118,11 @@
            _deviceName = deviceName;
            CheckConnect();
        }
        #endregion
        #region Private Method
        private void CheckConnect()
        {
            Task.Run(() =>
@@ -144,9 +146,11 @@
                }
            });
        }
        #endregion
        #region Public Method
        /// <summary>
        /// è¯»å–PLC协议地址的数据
        /// </summary>
@@ -171,7 +175,7 @@
        }
        /// <summary>
        ///
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="command"></param>
@@ -180,7 +184,7 @@
        /// <exception cref="Exception"></exception>
        public bool SendCommand<T>(T command, string deviceChildCode) where T : IDataTransfer, new()
        {
            if(Communicator is SiemensS7)
            if (Communicator is MelsecA1ENetCommunicator)
            {
                if (!IsConnected) throw new Exception($"通讯连接错误,请检查网络");
                DeviceProDTO? devicePro = _deviceProDTOs.Where(x => x.DeviceProParamType == nameof(DeviceCommand) && x.DeviceChildCode == deviceChildCode).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
@@ -285,6 +289,7 @@
            // å‘Šè¯‰åžƒåœ¾å›žæ”¶å™¨ä¸å†è°ƒç”¨ç»ˆç»“器
            GC.SuppressFinalize(this);
        }
        #endregion
    }
}
}