zhao
2021-07-07 2fdf959ac739edd6de84aa8053b8b9683dce8e8b
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
using HH.WMS.BLL;
using HH.WMS.BLL.External;
using HH.WMS.BLL.MiddleDB;
using HH.WMS.BLL.Pda;
using HH.WMS.Common;
using HH.WMS.Common.External;
using HH.WMS.Common.Response;
using HH.WMS.Entitys;
using HH.WMS.Entitys.Basic;
using HH.WMS.Entitys.Dto;
using HH.WMS.Entitys.Entitys.Mes;
using HH.WMS.Entitys.External;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Timers;
using System.Web;
 
namespace HH.WMS.WebApi.Extension
{
    public class ExecTransferTask : IExecuteThreadTimed
    {
        private static object locko = new object();
        public void Run(object source, ElapsedEventArgs elapsedEventArgs)
        {
            try
            {
                //防止Timer重入
                lock (locko)
                {
                    var transportReqs = BLLCreator.CreateDapper<TN_MES_TASK>().GetList(new
                    {
                        NeedTrig = Constants.Y
                    }).OrderBy(o => o.CreateDate).ToList();
 
                    var serviceExecs = BLLCreator.CreateDapper<TN_WM_SERVICE_EXECEntity>().GetList(new
                    {
                        CN_C_COMPLETE = Constants.N,
                        CN_S_TASK_TYPE = "移送"
                    });
 
                    transportReqs = transportReqs.FindAll(f => !serviceExecs.Exists(e => e.CN_S_TASK_NO == f.task_no));
 
                    if (transportReqs.Any())
                    {
                        BLLCreator.Create<ZCBLL>().ExecTransferTask(transportReqs);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.DomainInfo("移送任务 Error", ex.Message);
            }
        }
    }
}