AgvConvingController.cs
3.54 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
using MassTransit;
using MassTransit.Mediator;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Rcs.Application.Common;
using Rcs.Application.MessageBus.Commands;
using Rcs.Application.MessageBus.Commands.PlatformInteraction;
using Rcs.Domain.Repositories;
using Rcs.Domain.Settings;
namespace Rcs.Api.Controllers
{
[ApiController]
[Route("api/[controller]")]
public class AgvConvingController : ControllerBase
{
private readonly ILogger<AgvConvingController> _logger;
private readonly IMediator _mediator;
private readonly PlatformPickRepository _pickRepository;
private readonly AppSettings _appSettings;
public AgvConvingController(
ILogger<AgvConvingController> logger,
IMediator mediator,
PlatformPickRepository pickRepository,
IOptions<AppSettings> appSettings)
{
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_mediator = mediator;
_pickRepository = pickRepository;
_appSettings = appSettings.Value;
}
/// <summary>
/// 取货
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
[HttpPost("PickUp")]
public async Task<IActionResult> PLCStationInteraction([FromBody] PLCStationInteraction command)
{
var client = _mediator.CreateRequestClient<PLCStationInteraction>();
var response = await client.GetResponse<ApiResponse>(command);
return Ok(response.Message);
}
/// <summary>
/// 放货
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
[HttpPost("PutDown")]
public async Task<IActionResult> PLCStationReleaseInteraction([FromBody] PLCStationReleaseInteraction command)
{
var client = _mediator.CreateRequestClient<PLCStationReleaseInteraction>();
var response = await client.GetResponse<ApiResponse>(command);
return Ok(response.Message);
}
/// <summary>
/// 站台信号
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
[HttpPost("OutOrPut")]
public async Task<IActionResult> PLCStationoutandpull([FromBody] PLCStationConvingExtend command)
{
var client = _mediator.CreateRequestClient<PLCStationConvingExtend>();
var response = await client.GetResponse<ApiResponse>(command);
return Ok(response.Message);
}
/// <summary>
/// 门控信号
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
[HttpPost("OpenOrClose")]
public async Task<IActionResult> PLCStationOpenOrClose([FromBody] PLCStaionGating command)
{
var client = _mediator.CreateRequestClient<PLCStaionGating>();
var response = await client.GetResponse<ApiResponse>(command);
return Ok(response.Message);
}
/// <summary>
/// 获取气缸状态
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
[HttpPost("GetCyliderStatu")]
public async Task<IActionResult> GetCyliderStatu([FromBody] GetCylinderStatu command)
{
var client = _mediator.CreateRequestClient<GetCylinderStatu>();
var response = await client.GetResponse<ApiResponse>(command);
return Ok(response.Message);
}
}
}