using Microsoft.AspNetCore.Mvc;
using Microsoft.CodeAnalysis.Operations;
using ProductionLineMonitor.Core.Dtos;
using ProductionLineMonitor.Core.IRepositories;
using ProductionLineMonitor.Core.Services;
namespace ProductionLineMonitor.Web.Controllers
{
public class ProductionLineController : BaseController
{
private readonly IProductionLineCoreService _productionLineService;
private readonly IUnitOfWork _unitOfWork;
public ProductionLineController(
IProductionLineCoreService productionLineService,
IUnitOfWork unitOfWork)
{
_productionLineService = productionLineService;
_unitOfWork = unitOfWork;
}
[HttpGet]
public IActionResult Index()
{
return View();
}
[HttpGet]
public IActionResult GetProductionLines()
{
return Ok(_productionLineService.GetProductionLines());
}
[HttpGet]
public IActionResult GetProductionLineTree()
{
return Ok(_productionLineService.GetProductionLineTree().Nodes);
}
[HttpGet]
public IActionResult GetProductionLineMachineTree()
{
return Ok(_productionLineService.GetProductionLineMachineTree().Nodes);
}
///
///带汇总
///
///
[HttpGet]
public IActionResult GetProductionLineMachineTreeV1()
{
return Ok(_productionLineService.GetProductionLineMachineTreeV1().Nodes);
}
[HttpPost]
public IActionResult GetMachineDayData([FromBody]ReadDayDto dto)
{
return Ok(_productionLineService.GetMachineDayData(dto.Id, dto.DateTime));
}
[HttpPost]
public IActionResult GetProductionLineDayData([FromBody] ReadDayDto dto)
{
return Ok(_productionLineService.GetProductionLineDayData(dto.Id, dto.DateTime));
}
}
}