liulb@mesnac.com 1 year ago
parent e0a5718fac
commit 2ce12dd9f9

@ -10,13 +10,16 @@ using log4net;
using Org.BouncyCastle.Asn1.Tsp;
using System.Linq;
using Admin.Core.Common;
using Admin.Core.Model.Sys;
using NPOI.SS.Formula.Functions;
namespace Admin.Core.Service
{
public class RealTaskInfoServices : BaseServices<RealTaskInfo>, IRealTaskInfoServices
{
private static readonly log4net.ILog logHelper = LogManager.GetLogger(typeof(RealTaskInfoServices));
private readonly IBaseRepository<RealTaskInfo> _dal;
IBaseRepository<RealTaskInfo> _dal;
private readonly IRealTaskInfoRepository _realTaskInfoRepository;
public RealTaskInfoServices(IBaseRepository<RealTaskInfo> dal, IRealTaskInfoRepository realTaskInfoRepository)
{
@ -147,7 +150,11 @@ namespace Admin.Core.Service
RealTaskInfo taskInfo = null;
try
{
taskInfo = (await _dal.QueryAsync(x => x.StoreCode == storeCode && x.TaskStatus == 1 && x.TaskType == taskType)).OrderBy(x => x.CreateTime).FirstOrDefault();
var list = await _dal.QueryAsync(x => x.StoreCode == storeCode && x.TaskStatus == 1 && x.TaskType == taskType);
if (list.Count()>0)
{
taskInfo = list.OrderBy(x => x.CreateTime).FirstOrDefault();
}
}
catch (Exception ex)
{
@ -210,7 +217,14 @@ namespace Admin.Core.Service
List<RealTaskInfo> taskInfos = null;
try
{
taskInfos =await _dal.QueryAsync(x => x.TaskType == taskType);
//Expression<Func<RealTaskInfo, bool>> exp = s1 => true;
//exp = exp.And(d =>d.TaskType == taskType && storeCode.Contains(d.StoreCode));
Expression<Func<RealTaskInfo, bool>> whereExpression = x => true;
whereExpression = whereExpression.And(d => d.TaskType == taskType && storeCode.Contains(d.StoreCode));
taskInfos = await _dal.QueryAsync(whereExpression);
if (taskStatus != 0)
{
taskInfos = taskInfos.Where(x => x.TaskStatus == taskStatus).ToList();

@ -199,8 +199,9 @@ namespace Aucma.Scada.UI
private SemaphoreSlim linerSemaphore = new SemaphoreSlim(0);
/// <summary>
/// 任务下发
/// 任务下发 ——迁移到任务调度中去
/// </summary>
[Obsolete("迁移到任务调度中去,废弃")]
private void StartPassDown()
{
@ -210,16 +211,16 @@ namespace Aucma.Scada.UI
while (true)
{
PassDownShellTask();
Thread.Sleep(2000);
Thread.Sleep(5000);
}
});
Task.Run(() =>
Task.Run(async () =>
{
while (true)
{
PassDownLinerTaskAsync();
Thread.Sleep(2000);
await PassDownLinerTaskAsync();
Thread.Sleep(5000);
}
});
}

Loading…
Cancel
Save