2024-11-01 14:19:17 +08:00
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
using DOAN.Model.PBL.Dto;
|
|
|
|
|
|
using DOAN.Model.PBL;
|
|
|
|
|
|
using DOAN.Service.PBL.IService;
|
|
|
|
|
|
using DOAN.Admin.WebApi.Filters;
|
2024-11-08 08:42:33 +08:00
|
|
|
|
using DOAN.ServiceCore.Middleware;
|
2024-11-13 15:53:15 +08:00
|
|
|
|
using DOAN.Infrastructure.PLC;
|
|
|
|
|
|
using System.Collections.Generic;
|
2024-11-01 14:19:17 +08:00
|
|
|
|
|
|
|
|
|
|
//创建时间: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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-11-13 15:53:15 +08:00
|
|
|
|
//TODO 测试传感器地址
|
|
|
|
|
|
[HttpGet("test_plc")]
|
|
|
|
|
|
[DoanPlcActionFilter]
|
|
|
|
|
|
public IActionResult TestPLc(string address, PLCTool pLCTool)
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = mesInteraction.TestPLc(address, pLCTool);
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-01 14:19:17 +08:00
|
|
|
|
//TODO 接受工单 亮灯
|
|
|
|
|
|
|
|
|
|
|
|
[HttpPost("mes_light_up")]
|
2024-11-08 08:42:33 +08:00
|
|
|
|
[DoanPlcActionFilter]
|
2024-11-13 15:53:15 +08:00
|
|
|
|
public IActionResult MESLightUp([FromBody] LightUpDto light, PLCTool pLCTool)
|
2024-11-01 14:19:17 +08:00
|
|
|
|
{
|
2024-11-13 15:53:15 +08:00
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = mesInteraction.MESLightUp(light, pLCTool);
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
|
{
|
|
|
|
|
|
return ToResponse(500, e.Message);
|
|
|
|
|
|
}
|
2024-11-01 14:19:17 +08:00
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//TODO 扫码灭灯
|
|
|
|
|
|
[HttpGet("mes_light_down")]
|
2024-11-08 08:42:33 +08:00
|
|
|
|
[DoanPlcActionFilter]
|
2024-11-13 15:53:15 +08:00
|
|
|
|
public IActionResult MESLightDown(string scan_code, PLCTool pLCTool)
|
2024-11-01 14:19:17 +08:00
|
|
|
|
{
|
2024-11-13 15:53:15 +08:00
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = mesInteraction.MESLightDown(scan_code, pLCTool);
|
2024-11-07 21:27:56 +08:00
|
|
|
|
|
2024-11-13 15:53:15 +08:00
|
|
|
|
return SUCCESS(response);
|
2024-11-01 14:19:17 +08:00
|
|
|
|
|
2024-11-13 15:53:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
|
{
|
|
|
|
|
|
return ToResponse(500, e.Message);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-11-01 14:19:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|