using Microsoft.AspNetCore.Mvc; using ProductionLineMonitor.Application.Services.OEEService.Dtos; using System.Collections.Generic; using System; using ProductionLineMonitor.Application.Services.OEEService; using ProductionLineMonitor.Application.Services; using ProductionLineMonitor.Core.IRepositories; using ProductionLineMonitor.Core.Services; using ProductionLineMonitor.Core.Dtos; using System.Linq; using ProductionLineMonitor.Core.Models; namespace ProductionLineMonitor.Web.Controllers { public class EYZManufacturingPlatformController : Controller { private readonly IReportFormService _reportFormService; private readonly IOEEService _oeeService; private readonly IExcelService _excelService; private readonly IProductionLineCoreService _productionLineService; private readonly IUnitOfWork _unitOfWork; public EYZManufacturingPlatformController( IReportFormService reportFormService, IOEEService oeeService, IExcelService excelService, IProductionLineCoreService productionLineService, IUnitOfWork unitOfWork) { _reportFormService = reportFormService; _oeeService = oeeService; _excelService = excelService; _productionLineService = productionLineService; _unitOfWork = unitOfWork; } [HttpGet] public IActionResult Y5OEE() { return View(); } /// /// /// /// /// /// /// //0:按班;1:天;2:周;3:月 /// //peroid为0时有效,0:汇总,1:白班数据,2:夜班数据 /// [HttpPost] public IActionResult GetMachineStatisticV4(string id, DateTime startTime, DateTime endTime, int peroid, int dayOrnight) { var list = _oeeService.GetOEEByPeriod(id, startTime, endTime, peroid, dayOrnight); return Ok(ResultDto>>.Success(list)); } [HttpPost] public IActionResult GetOEEExtendSetting(string ids) { var idList = ids.Split(','); var machine = _unitOfWork.Repository().GetList().Where(x => idList.Contains(x.Id)); Dictionary DicOEEExtend = new Dictionary(); if (machine != null && machine.Count() != 0) { foreach (var item in machine) { DicOEEExtend.Add(item.Id, string.IsNullOrEmpty(item.OEEExtendSettings) ? "" : item.OEEExtendSettings); } } return Ok(ResultDto>.Success(DicOEEExtend)); } /// ///带汇总 /// /// [HttpGet] public IActionResult GetProductionLineMachineTreeV1() { return Ok(_productionLineService.GetProductionLineMachineTreeV1().Nodes); } } }