Files
sy_hx_pbl_backend/DOAN.Admin.WebApi/Controllers/PBL/MESInteractionController.cs

78 lines
1.9 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Microsoft.AspNetCore.Mvc;
using DOAN.Model.PBL.Dto;
using DOAN.Model.PBL;
using DOAN.Service.PBL.IService;
using DOAN.Admin.WebApi.Filters;
using DOAN.ServiceCore.Middleware;
using DOAN.Infrastructure.PLC;
using System.Collections.Generic;
//创建时间2024-09-23
namespace DOAN.Admin.WebApi.Controllers.PBL
{
/// <summary>
/// 与MES交互
/// </summary>
[AllowAnonymous]
[Route("PBL/mes_interation")]
public class MESInteractionController : BaseController
{
private readonly IMESInteractionServcie mesInteraction;
public MESInteractionController(IMESInteractionServcie mesInteraction)
{
this.mesInteraction = mesInteraction;
}
//TODO 测试传感器地址
[HttpGet("test_plc")]
[DoanPlcActionFilter]
public IActionResult TestPLc(string address, PLCTool pLCTool)
{
var response = mesInteraction.TestPLc(address, pLCTool);
return SUCCESS(response);
}
//TODO 接受工单 亮灯
[HttpPost("mes_light_up")]
[DoanPlcActionFilter]
public IActionResult MESLightUp([FromBody] LightUpDto light, PLCTool pLCTool)
{
try
{
var response = mesInteraction.MESLightUp(light, pLCTool);
return SUCCESS(response);
}
catch (Exception e)
{
return ToResponse(500, e.Message);
}
}
//TODO 扫码灭灯
[HttpGet("mes_light_down")]
[DoanPlcActionFilter]
public IActionResult MESLightDown(string scan_code, PLCTool pLCTool)
{
try
{
var response = mesInteraction.MESLightDown(scan_code, pLCTool);
return SUCCESS(response);
}
catch (Exception e)
{
return ToResponse(500, e.Message);
}
}
}
}