BroadCastAction.cs
1.34 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
54
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using Infrastructure;
using Newtonsoft.Json.Linq;
using Quartz;
using WebApp;
using WebRepository;
namespace WebMvc
{
/// <summary>
/// AGV
/// </summary>
public class AGVAction
{
private string ConnString { set; get; }
IJobExecutionContext Context { set; get; }
private static int I_x = 0;
private static int I_flag = 1;
private static int I_maxx = 100;
public AGVAction(string _ConnString, IJobExecutionContext _Context)
{
ConnString = _ConnString;
Context = _Context;
}
public void Execute(JobContainer jobContainer)
{
//初始化广播
JobContainer.InitBroadCaster();
I_x += I_flag;
if (I_x >= I_maxx)
{
I_flag = -1;
}
if (I_x <= 0)
{
I_flag = 1;
}
HslCommunication.OperateResult<JObject> read = null;
read = HslCommunication.OperateResult.CreateSuccessResult(new JObject()
{
{"X",new JValue(I_x) },
});
JobContainer.pushServer.PushString("AGV", read.Content.ToString());
}
}
}