AcsPushBuild.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
54
55
56
57
58
59
60
61
62
63
64
using HslCommunication.Enthernet;
using XingYe_ACS.BaseStruct;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace XingYe_ACS.WebApi
{
public static class AcsPushBuild
{
private static NetPushServer netPushServer;
public static void AcsPushBuildInit()
{
netPushServer = new NetPushServer();
//netPushServer.Token = new Guid("WcsPushServer");
netPushServer.ServerStart(94);
}
public static void PushAgv(Agv agv)
{
//PushAgv pushAgv = new PushAgv();
//pushAgv.strAgvNo = agv.strAgvNo;
//pushAgv.agvState = (int)agv.agvState;
//Point currentPoint = App.PointList.Find(a => a.strBarcode == agv.strBarcode);
//if (currentPoint != null)
//{
// pushAgv.strBarcode = currentPoint.strBarcode;
// pushAgv.intX = currentPoint.intX;
// pushAgv.intY = 1000 - currentPoint.intY;
//}
//pushAgv.pointLength = agv.pointLength;
//pushAgv.intRunDistance = agv.intRunDistance;
//pushAgv.heightState = (int)agv.heightState;
//pushAgv.currentCharge = agv.currentCharge;
//pushAgv.agvHeart = agv.agvHeart;
//pushAgv.strAgvError = agv.strAgvError;
//if (agv.agvTask != null)
//{
// pushAgv.taskNo = agv.agvTask.strTaskNo;
// Point nextPoint = App.PointList.Find(a => a.strBarcode == agv.nextPoint);
// if (nextPoint != null)
// {
// pushAgv.intNextX = nextPoint.intX;
// pushAgv.intNextY = 1000 - nextPoint.intY;
// }
//}
//string json = JsonConvert.SerializeObject(pushAgv);
//netPushServer.PushString("PushAgv", json);
}
public static void PushLift(Station station,string status)
{
PushLift pushLift = new PushLift();
pushLift.stationNo = station.strStationNo;
pushLift.stationType = Enum.Parse(typeof(EnumMsg.StationType), station.stationType.ToString(), true).ToString();
pushLift.status = "运行";
pushLift.error = "";
string json = JsonConvert.SerializeObject(pushLift);
netPushServer.PushString("PushLift", json);
}
}
}