123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- 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 IUnitOfWork _unitOfWork;
- public EYZManufacturingPlatformController(
- IReportFormService reportFormService,
- IOEEService oeeService,
- IExcelService excelService,
- IUnitOfWork unitOfWork)
- {
- _reportFormService = reportFormService;
- _oeeService = oeeService;
- _excelService = excelService;
- _unitOfWork = unitOfWork;
- }
- [HttpGet]
- public IActionResult Y5OEE()
- {
- return View();
- }
- [HttpPost]
- public IActionResult GetMachineStatisticV2(string id, DateTime startTime, DateTime endTime, int peroid)
- {
- //MachineOEE machine = new MachineOEE();
- Dictionary<string, List<MachineOEEInfoByPeriod>> lst = new Dictionary<string, List<MachineOEEInfoByPeriod>>();
- if (peroid == 3)
- {
- lst = _oeeService.GetOEEByPeriod(id,
- startTime.ToString("yyyy-MM"), endTime.ToString("yyyy-MM"), peroid);
- }
- else
- {
- lst = _oeeService.GetOEEByPeriod(id,
- startTime.ToString("yyyy-MM-dd"), endTime.ToString("yyyy-MM-dd"), peroid);
- }
- return Ok(ResultDto<Dictionary<string, List<MachineOEEInfoByPeriod>>>.Success(lst));
- }
- [HttpPost]
- public IActionResult GetMachineStatisticV1(string id, DateTime startTime, DateTime endTime)
- {
- //MachineOEE machine = new MachineOEE();
- List<MachineOEEInfo> lst = _oeeService.GetOEE(id,
- startTime.ToString("yyyy-MM-dd"), endTime.ToString("yyyy-MM-dd"));
- return Ok(ResultDto<List<MachineOEEInfo>>.Success(lst));
- }
- [HttpPost]
- public IActionResult GetOEEExtendSetting(string id)
- {
- var machine = _unitOfWork.Repository<Machine>().GetList().Where(x => x.Id == id);
- if (machine != null && machine.Count() != 0 && !String.IsNullOrEmpty(machine.First().OEEExtendSettings))
- {
- return Ok(ResultDto<string>.Success(machine.First().OEEExtendSettings));
- }
- else
- {
- return Ok(ResultDto<string>.Success(""));
- }
- }
- }
- }
|