TaskAlertAction.cs
2.43 KB
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
using System;
using System.Collections.Generic;
using System.Data;
using Infrastructure;
using Quartz;
using WebApp;
using WebRepository;
namespace WebMvc
{
/// <summary>
/// 任务预警
/// </summary>
[PersistJobDataAfterExecution]
[DisallowConcurrentExecution]
public class TaskAlertAction
{
private string ConnString { set; get; }
IJobExecutionContext Context { set; get; }
public TaskAlertAction(string _ConnString, IJobExecutionContext _Context)
{
ConnString = _ConnString;
Context = _Context;
}
public void Execute(JobContainer jobContainer)
{
DbHelp dbHelp = new DbHelp(ConnString);
try
{
string sql = "";
string sqlia = "";
string sqliac = "";
string sqlup = "";
sql = string.Format(@"INSERT INTO dbo.task_alert (taskNo, taskType, sourceCode, containerCode, orderCode, materialCode, materialName, batch, lot, oderQty, containerQty, hadQty, inventoryId, sourceLocation, destinationLocation, roadway, station, status, priority, isOccupy, error, startTime, endTime, createTime, createBy, updateTime, updateBy)
SELECT taskNo, taskType, sourceCode, containerCode, orderCode, materialCode, materialName, batch, lot, oderQty, containerQty, hadQty, inventoryId, sourceLocation, destinationLocation, roadway, station, status, priority, isOccupy, error, startTime, endTime, createTime, createBy, updateTime, updateBy FROM dbo.task_detail
WHERE datediff(ss,createTime,getdate()) > 1800
AND taskNo NOT IN (SELECT taskNo FROM dbo.task_alert)
AND taskType in ('{0}','{1}','{2}','{3}','{4}','{5}','{6}') ORDER BY createTime",
TaskType.空容器入库, TaskType.容器出库, TaskType.容器回库, TaskType.站台到站台, TaskType.空容器出库, TaskType.直接出库, TaskType.盘点);
DataSet ds = dbHelp.SelectGet(sql);
sqliac = string.Format(@"DELETE FROM dbo.task_alert
WHERE taskNo NOT IN (SELECT taskNo FROM dbo.task_detail)");
dbHelp.DataOperator(sqliac);
}
catch (Exception ex)
{
throw ex;
}
}
}
}