ProductionLineController.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using Microsoft.AspNetCore.Mvc;
  2. using Microsoft.CodeAnalysis.Operations;
  3. using ProductionLineMonitor.Core.Dtos;
  4. using ProductionLineMonitor.Core.IRepositories;
  5. using ProductionLineMonitor.Core.Services;
  6. namespace ProductionLineMonitor.Web.Controllers
  7. {
  8. public class ProductionLineController : BaseController
  9. {
  10. private readonly IProductionLineCoreService _productionLineService;
  11. private readonly IUnitOfWork _unitOfWork;
  12. public ProductionLineController(
  13. IProductionLineCoreService productionLineService,
  14. IUnitOfWork unitOfWork)
  15. {
  16. _productionLineService = productionLineService;
  17. _unitOfWork = unitOfWork;
  18. }
  19. [HttpGet]
  20. public IActionResult Index()
  21. {
  22. return View();
  23. }
  24. [HttpGet]
  25. public IActionResult GetProductionLines()
  26. {
  27. return Ok(_productionLineService.GetProductionLines());
  28. }
  29. [HttpGet]
  30. public IActionResult GetProductionLineTree()
  31. {
  32. return Ok(_productionLineService.GetProductionLineTree().Nodes);
  33. }
  34. [HttpGet]
  35. public IActionResult GetProductionLineMachineTree()
  36. {
  37. return Ok(_productionLineService.GetProductionLineMachineTree().Nodes);
  38. }
  39. [HttpPost]
  40. public IActionResult GetMachineDayData([FromBody]ReadDayDto dto)
  41. {
  42. return Ok(_productionLineService.GetMachineDayData(dto.Id, dto.DateTime));
  43. }
  44. [HttpPost]
  45. public IActionResult GetProductionLineDayData([FromBody] ReadDayDto dto)
  46. {
  47. return Ok(_productionLineService.GetProductionLineDayData(dto.Id, dto.DateTime));
  48. }
  49. }
  50. }