123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- 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();
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="id"></param>
- /// <param name="startTime"></param>
- /// <param name="endTime"></param>
- /// <param name="peroid"></param>//0:按班;1:天;2:周;3:月
- /// <param name="dayOrnight"></param>//peroid为0时有效,0:汇总,1:白班数据,2:夜班数据
- /// <returns></returns>
- [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<Dictionary<string, List<MachineOEEInfoByPeriod>>>.Success(list));
- }
- [HttpPost]
- public IActionResult GetOEEExtendSetting(string ids)
- {
- var idList = ids.Split(',');
- var machine = _unitOfWork.Repository<Machine>().GetList().Where(x => idList.Contains(x.Id));
- Dictionary<string, string> DicOEEExtend = new Dictionary<string, string>();
- if (machine != null && machine.Count() != 0)
- {
- foreach (var item in machine)
- {
- DicOEEExtend.Add(item.Id, string.IsNullOrEmpty(item.OEEExtendSettings) ? "" : item.OEEExtendSettings);
- }
- }
- return Ok(ResultDto<Dictionary<string, string>>.Success(DicOEEExtend));
- }
- /// <summary>
- ///带汇总
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public IActionResult GetProductionLineMachineTreeV1()
- {
- return Ok(_productionLineService.GetProductionLineMachineTreeV1().Nodes);
- }
- }
- }
|