WCS
dengjunjie
2024-10-14 901c64f294ee75784f3fec80b47ae6b77932fff3
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#region << 版 本 注 释 >>
/*----------------------------------------------------------------
 * 命名空间:WIDESEAWCS_QuartzJob
 * 创建者:胡童庆
 * 创建时间:2024/8/2 16:13:36
 * 版本:V1.0.0
 * 描述:调度服务配置业务实现层
 *
 * ----------------------------------------------------------------
 * 修改人:
 * 修改时间:
 * 版本:V1.0.1
 * 修改说明:
 * 
 *----------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEAWCS_Core.BaseRepository;
using WIDESEAWCS_Core.BaseServices;
using WIDESEAWCS_Core.Helper;
 
using WIDESEAWCS_QuartzJob.DeviceEnum;
using WIDESEAWCS_QuartzJob.DTO;
using WIDESEAWCS_QuartzJob.Models;
using WIDESEAWCS_QuartzJob.Repository;
 
namespace WIDESEAWCS_QuartzJob.Service
{
    public class DispatchInfoService : ServiceBase<Dt_DispatchInfo, IDispatchInfoRepository>, IDispatchInfoService
    {
        private readonly IUnitOfWorkManage _unitOfWorkManage;
        private readonly IDeviceInfoRepository _deviceInfoRepository;
        public DispatchInfoService(IDispatchInfoRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, IDeviceInfoRepository deviceInfoRepository) : base(BaseDal)
        {
            _unitOfWorkManage = unitOfWorkManage;
            _deviceInfoRepository = deviceInfoRepository;
        }
 
        /// <summary>
        /// 查询调度服务Job与对应的设备信息。
        /// </summary>
        /// <returns>返回调度服务JobDTO集合。</returns>
        public List<DispatchInfoDTO> QueryDispatchInfos()
        {
            return Db.Queryable<Dt_DispatchInfo, Dt_DeviceInfo>((a, b) => a.JobGroup == b.DeviceType && b.DeviceStatus == ((int)DeviceStatusEnum.Enable).ToString()).Select((a, b) => new DispatchInfoDTO
            {
                JobGroup = a.JobGroup,
                AssemblyName = a.AssemblyName,
                BeginTime = a.BeginTime,
                ClassName = a.ClassName,
                CreateDate = a.CreateDate,
                Creater = a.Creater,
                CycleHasRunTimes = 0,
                EndTime = a.EndTime,
                Id = b.Id,
                IntervalSecond = a.IntervalSecond,
                Modifier = a.Modifier,
                ModifyDate = a.ModifyDate,
                Name = a.Name,
                Remark = a.Remark,
                DeviceType = b.DeviceType
            }).ToList();
        }
    }
}