|
using WIDESEA_Services.IRepositories;
|
using WIDESEA_Core.BaseProvider;
|
using WIDESEA_Core.EFDbContext;
|
using WIDESEA_Core.Extensions.AutofacManager;
|
using WIDESEA_Entity.DomainModels;
|
using System.Collections.Generic;
|
using System.Linq.Expressions;
|
using System;
|
using WIDESEA_Common.CutomerModel;
|
using System.Linq;
|
|
namespace WIDESEA_Services.Repositories
|
{
|
public partial class VV_DispatchRepository : RepositoryBase<VV_Dispatch>, IVV_DispatchRepository
|
{
|
public VV_DispatchRepository(VOLContext dbContext)
|
: base(dbContext)
|
{
|
|
}
|
public static IVV_DispatchRepository Instance
|
{
|
get { return AutofacContainerModule.GetService<IVV_DispatchRepository>(); }
|
}
|
|
public override List<VV_Dispatch> Find(Expression<Func<VV_Dispatch, bool>> predicate)
|
{
|
return base.Find(predicate);
|
}
|
|
public List<JobOptions> FindToJobOptions(Expression<Func<VV_Dispatch, bool>> predicate)
|
{
|
List<JobOptions> jobOptions = new List<JobOptions>();
|
List<VV_Dispatch> dispatches = base.Find(predicate);
|
List<dt_plcinfohead> heads = dt_plcinfoheadRepository.Instance.Find(x => true);
|
var jobs = dispatches.Join(heads, x => x.JobName, y => y.plcinfo_name, (x, y) => new
|
{
|
AssemblyName = x.AssemblyName,
|
BeginTime = x.BeginTime,
|
ClassName = x.ClassName,
|
Cron = x.Cron,
|
CycleRuntiems = x.CycleRuntiems,
|
EndTime = x.EndTime,
|
IntervalSecond = x.IntervalSecond,
|
JobGroup = x.JobGroup,
|
JobName = x.JobName,
|
Remark = x.Remark,
|
TriggerType = x.TriggerType,
|
}).ToList();
|
for (int i = 0; i < jobs.Count; i++)
|
{
|
JobOptions options = new JobOptions()
|
{
|
AssemblyName = jobs[i].AssemblyName,
|
BeginTime = jobs[i].BeginTime,
|
ClassName = jobs[i].ClassName,
|
Cron = jobs[i].Cron,
|
CycleRunTimes = jobs[i].CycleRuntiems ?? 0,
|
EndTime = jobs[i].EndTime,
|
IntervalSecond = jobs[i].IntervalSecond,
|
IsStart = false,
|
JobGroup = jobs[i].JobGroup,
|
JobName = jobs[i].JobName,
|
JobParams = null,
|
Remark = jobs[i].Remark,
|
TriggerType = jobs[i].TriggerType
|
};
|
jobOptions.Add(options);
|
}
|
return jobOptions;
|
}
|
|
public List<JobOptions> FindJobOptions(Expression<Func<VV_Dispatch, bool>> predicate)
|
{
|
List<JobOptions> jobOptions = new List<JobOptions>();
|
List<VV_Dispatch> dispatches = base.Find(predicate);
|
|
for (int i = 0; i < dispatches.Count; i++)
|
{
|
JobOptions options = new JobOptions()
|
{
|
AssemblyName = dispatches[i].AssemblyName,
|
BeginTime = dispatches[i].BeginTime,
|
ClassName = dispatches[i].ClassName,
|
Cron = dispatches[i].Cron,
|
CycleRunTimes = dispatches[i].CycleRuntiems ?? 0,
|
EndTime = dispatches[i].EndTime,
|
IntervalSecond = dispatches[i].IntervalSecond,
|
IsStart = false,
|
JobGroup = dispatches[i].JobGroup,
|
JobName = dispatches[i].JobName,
|
JobParams = null,
|
Remark = dispatches[i].Remark,
|
TriggerType = dispatches[i].TriggerType,
|
PLCConnectState = "δÁ¬½ÓPLC"
|
};
|
jobOptions.Add(options);
|
}
|
return jobOptions;
|
}
|
}
|
|
}
|