ProductionLineController.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. /// <summary>
  40. ///带汇总
  41. /// </summary>
  42. /// <returns></returns>
  43. [HttpGet]
  44. public IActionResult GetProductionLineMachineTreeV1()
  45. {
  46. return Ok(_productionLineService.GetProductionLineMachineTreeV1().Nodes);
  47. }
  48. [HttpPost]
  49. public IActionResult GetMachineDayData([FromBody]ReadDayDto dto)
  50. {
  51. return Ok(_productionLineService.GetMachineDayData(dto.Id, dto.DateTime));
  52. }
  53. [HttpPost]
  54. public IActionResult GetProductionLineDayData([FromBody] ReadDayDto dto)
  55. {
  56. return Ok(_productionLineService.GetProductionLineDayData(dto.Id, dto.DateTime));
  57. }
  58. }
  59. }