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 { /// /// agv接口对接 /// [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初始化"); } /// ///Agv反馈交互接口 /// /// /// [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 平板相关接口 /// /// 根据库位编号获取托盘编号及库存信息 /// [HttpPost("getLocationInfo")] public PadResponse GetLocationInfo(List locationCodes) { // _logger.Agv($"机台:{machineCode}"); PadResponse response = _application.GetLocationInfo(locationCodes); return response; } /// /// 根据托盘号托盘解绑 /// /// [HttpGet("unBindPalletInfo")] public PadResponse UnBindPalletInfo(string palletInfoCode) { PadResponse response = _application.UnBindPalletInfo(palletInfoCode); return response; } /// /// pad获取指定机台的RFID设备状态 /// /// [HttpGet("getRfidInfo")] public PadResponse GetRfidInfo(string machineCode) { // _logger.Agv($"机台:{machineCode}"); PadResponse response = _application.GetRfidInfo(machineCode); return response; } ///// ///// 接收MES核减数量接口 ///// ///// ///// //[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; //} ///// ///// pad获取所有机台库存列表信息 ///// ///// [HttpPost("getAllMachineInfos")] public PadResponse GetAllMachineInfos() { PadResponse response = _application.GetAllMachineInfos(); return response; } ///// /////指定机台优先级接口:加急/不加急 /////priority:0-不加急 1-加急 ///// ///// //[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 平板相关接口 } }