1
z8018
2025-03-12 17e4c7e3e7b3ef60d9da6de3b2a39a14a53c38a0
WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/Service/DispatchInfoService.cs
@@ -31,22 +31,30 @@
namespace WIDESEAWCS_QuartzJob.Service
{
    /// <summary>
    /// 调度服务配置业务层
    /// </summary>
    public class DispatchInfoService : ServiceBase<Dt_DispatchInfo, IDispatchInfoRepository>, IDispatchInfoService
    {
        private readonly IUnitOfWorkManage _unitOfWorkManage;
        private readonly IDeviceInfoRepository _deviceInfoRepository;
        /// <summary>
        /// 调度服务配置业务层
        /// </summary>
        public DispatchInfoService(IDispatchInfoRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, IDeviceInfoRepository deviceInfoRepository) : base(BaseDal)
        {
            _unitOfWorkManage = unitOfWorkManage;
            _deviceInfoRepository = deviceInfoRepository;
        }
        /// <summary>
        /// 查询调度服务Job与对应的设备信息。
        /// </summary>
        /// <returns>返回调度服务JobDTO集合。</returns>
        public List<DispatchInfoDTO> QueryDispatchInfos()
        {
            List<Dt_DispatchInfo> dispatchInfos = BaseDal.QueryData();
            List<Dt_DeviceInfo> deviceInfos = _deviceInfoRepository.QueryData();
            return Db.Queryable<Dt_DispatchInfo, Dt_DeviceInfo>((a, b) => a.JobGroup == b.DeviceType && b.DeviceStatus == ((int)DeviceStatusEnum.Enable).ToString()).Select((a, b) => new DispatchInfoDTO
            return Db.Queryable<Dt_DispatchInfo>().LeftJoin<Dt_DeviceInfo>((a, b) => a.Id == b.DispatchId).Select((a, b) => new DispatchInfoDTO
            {
                JobGroup = a.JobGroup,
                AssemblyName = a.AssemblyName,
@@ -62,8 +70,9 @@
                ModifyDate = a.ModifyDate,
                Name = a.Name,
                Remark = a.Remark,
                DeviceStatus = b.DeviceType
            }).ToList();
                DeviceType = b.DeviceType,
                Enable = (b.DeviceStatus) ?? (((int)DeviceStatusEnum.Enable).ToString())
            }).ToList().Where(b => b.Enable == ((int)DeviceStatusEnum.Enable).ToString()).ToList();
        }
    }
}