stopRollerController.cs
4.0 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
using DeviceLibrary;
using OnlineStore;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Security.Cryptography;
using System.Web.Http;
using WebApi.Schemas;
namespace WebApi.Controllers
{
[RoutePrefix("api")]
public class stopRollerController : ApiController
{
[HttpPost]
public Result_20861 Get([FromBody] InParam_20861 body)
{
Result_20861 result = new Result_20861();
try
{
var requestData = body;
if (string.IsNullOrEmpty(requestData.cid))
{
result.code = 202;
result.status = "cid is empty";
}
else
{
//IDLE
//ERROR
if (body.cid.Equals("B1") || body.cid.Equals("B2"))
{
if (!RobotManage.isRunning)
{
result.code = 201;
result.status = crc.GetString("Res0079", "机器尚未启动不能呼叫Agv");
return result;
}
}
else
{
result.code = -1;
result.status = $" cid {body.cid} not exist";
}
switch (body.cid)
{
case "B1"://NS200入料口上料任务
if (RobotManage.mainMachine.RightMoveInfo.MoveStep >= MoveStep.R40_InShelf)
{
result.code = 201;
result.status = crc.GetString("Res0109.d647c69c", "入料口正在进料");
}
else if (RobotManage.mainMachine.RightMoveInfo.MoveStep >= MoveStep.R30_OutShelf)
{
result.code = 202;
result.status = crc.GetString("Res0110.97f61551", "入料口正在出料");
}
else
{
RobotManage.mainMachine.IOMove(IO_Type.RightMoto_Reverse, IO_VALUE.HIGH, false, 500);
RobotManage.mainMachine.RightMoveInfo.log($"电滚停止");
result.status = "IDLE";
}
break;
case "B2"://NS200出料口上料任务
if (RobotManage.mainMachine.LeftMoveInfo.MoveStep >= MoveStep.L60_InShelf)
{
result.code = 201;
result.status = crc.GetString("Res0113.15f652b4", "出料口正在入料");
}
else if (RobotManage.mainMachine.LeftMoveInfo.MoveStep >= MoveStep.L50_OutShelf)
{
result.code = 202;
result.status = crc.GetString("Res0114.b6a35f01", "出料口正在出料");
}
else
{
RobotManage.mainMachine.IOMove(IO_Type.LeftMoto_Reverse, IO_VALUE.HIGH, false, 500);
RobotManage.mainMachine.LeftMoveInfo.log($"电滚停止");
result.status = "IDLE";
}
break;
}
}
LogUtil.info($"AGV请求 滚筒停止:【{JsonHelper.SerializeObject(body)} 】【 {JsonHelper.SerializeObject(result)}】");
}
catch (Exception ex)
{
result.code = 204;
result.status = $"parse error:{ex.Message}";
LogUtil.error("stopRoller", ex);
}
return result;
}
}
}