You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
4.6 KiB
C#

7 months ago
using Application.Interface;
using HslCommunication;
using Microsoft.AspNetCore.Mvc;
using SlnMesnac.Model.domain;
using SlnMesnac.Model.dto.webapi;
using SlnMesnac.Serilog;
using System.Collections.Generic;
using System.Net;
using System.Text.Json;
namespace SlnMesnac.Controllers
{
/// <summary>
/// agv接口对接
/// </summary>
[Route("api/[controller]")]
[ApiController]
public class RecieveRcsController
{
public readonly SerilogHelper _logger;
private readonly IWcsTaskApplication _application;
public RecieveRcsController(SerilogHelper logger, IWcsTaskApplication application)
{
//_logger = logger;
_logger = logger;
_application = application;
// _logger.Info("RecieveRcsController初始化");
}
/// <summary>
///Agv反馈交互接口
/// </summary>
/// <param name="agvCallbackDto"></param>
/// <returns></returns>
[HttpPost("agvCallback")]
public ReponseagvCallbackDto agvCallback(agvCallbackDto agvCallbackDto)
{
string jsonString = JsonSerializer.Serialize(agvCallbackDto);
_logger.Agv($"接收agv任务通知接口信息{jsonString}");
ReponseagvCallbackDto reponseagvCallbackDto = _application.AgvCallback(agvCallbackDto);
_logger.Agv($"Agv反馈交互接口api响应{JsonSerializer.Serialize(reponseagvCallbackDto)}");
return reponseagvCallbackDto;
}
#region 平板相关接口
/// <summary>
/// 根据库位编号获取托盘编号及库存信息
/// </summary>
[HttpPost("getLocationInfo")]
public PadResponse GetLocationInfo(List<string> locationCodes)
{
// _logger.Agv($"机台:{machineCode}");
PadResponse response = _application.GetLocationInfo(locationCodes);
return response;
}
/// <summary>
/// 根据托盘号托盘解绑
/// </summary>
/// <returns></returns>
[HttpGet("unBindPalletInfo")]
public PadResponse UnBindPalletInfo(string palletInfoCode)
{
PadResponse response = _application.UnBindPalletInfo(palletInfoCode);
return response;
}
/// <summary>
/// pad获取指定机台的RFID设备状态
/// </summary>
/// <returns></returns>
[HttpGet("getRfidInfo")]
public PadResponse GetRfidInfo(string machineCode)
{
// _logger.Agv($"机台:{machineCode}");
PadResponse response = _application.GetRfidInfo(machineCode);
return response;
}
///// <summary>
///// 接收MES核减数量接口
///// </summary>
///// <param name="taskContinue"></param>
///// <returns></returns>
//[HttpPost("mesReduction")]
//public ReponseagvCallbackDto MesReduction(MesRequest mesRequest)
//{
// string jsonString = JsonSerializer.Serialize(mesRequest);
// _logger.Agv($"MesReduction 接口收到消息: {jsonString}");
// // ReponseagvCallbackDto reponseagvCallbackDto = new ReponseagvCallbackDto() { code = "200", message = "核减成功", reqCode = mesRequest.reqCode };
// ReponseagvCallbackDto reponseagvCallbackDto = _application.MesReduction(mesRequest);
// _logger.Agv($"MES核减数量接口api响应{JsonSerializer.Serialize(reponseagvCallbackDto)}");
// return reponseagvCallbackDto;
//}
///// <summary>
///// pad获取所有机台库存列表信息
///// </summary>
///// <returns></returns>
[HttpPost("getAllMachineInfos")]
public PadResponse GetAllMachineInfos()
{
PadResponse response = _application.GetAllMachineInfos();
return response;
}
7 months ago
///// <summary>
/////指定机台优先级接口:加急/不加急
/////priority:0-不加急 1-加急
///// </summary>
///// <returns></returns>
//[HttpPost("setPriorityByMachineCode")]
//public PadResponse SetPriorityByMachineCode(string machineCode, int priority)
//{
// _logger.Agv($"指定机台优先级接口,机台:{machineCode},优先级:{priority}");
// PadResponse response = _application.SetPriorityByMachineCode(machineCode, priority);
// _logger.Agv($"指定机台优先级接口api响应{JsonSerializer.Serialize(response)}");
// return response;
//}
#endregion 平板相关接口
}
}