123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- using ProductionLineMonitor.Core.Models;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ProductionLineMonitor.Application.Services.OEEService.Dtos
- {
- public class MachineOEEInfo
- {
- public List<MachineOutPutPerHour> OutPutPerHours { get; set; }
- = new List<MachineOutPutPerHour>();
- public DateTime StartTime { get; set; }
- public DateTime EndTime { get; set; }
- public string Date
- {
- get
- {
- return StartTime.ToString("MM/dd");
- }
- }
- public string Shift
- {
- get
- {
- if (StartTime.Hour == 8)
- {
- return "白班";
- }
- if (StartTime.Hour == 20)
- {
- return "夜班";
- }
- return "";
- }
- }
- public int Outputs { get; private set; }
- public int RunTime { get; private set; }
- public int IdelTime { get; private set; }
- public int DownTime { get; private set; }
- public int TotalTime { get; private set; }
- public int LoadMATTime { get; private set; }
- public double IdelTimeRate
- {
- get
- {
- if (TotalTime == 0)
- {
- return 0;
- }
- return Math.Round(IdelTime * 1.0 / TotalTime * 100, 2);
- }
- }
- public double RunTimeRate
- {
- get
- {
- if (TotalTime == 0)
- {
- return 0;
- }
- return Math.Round(RunTime * 1.0 / TotalTime * 100, 2);
- }
- }
- public double DownTimeRate
- {
- get
- {
- if (TotalTime == 0)
- {
- return 0;
- }
- return Math.Round(DownTime * 1.0 / TotalTime * 100, 2);
- }
- }
- public double LoadMATTimeRate
- {
- get
- {
- if (TotalTime == 0)
- {
- return 0;
- }
- return Math.Round(LoadMATTime * 1.0 / TotalTime * 100, 2);
- }
- }
- public void CalculateOEE()
- {
- Outputs = OutPutPerHours.Sum(s => s.OutPut.Value);
- RunTime = OutPutPerHours.Sum(s => s.AutoRunTime.Value);
- IdelTime = OutPutPerHours.Sum(s => s.IdleTime.Value);
- DownTime = OutPutPerHours.Sum(s => s.AlarmTime.Value);
- LoadMATTime = OutPutPerHours.Sum(s => s.LoadMATTime.Value);
- TotalTime = OutPutPerHours.Count() * 60 * 60;
- }
- }
- public class MachineOEE
- {
- public List<MachineOEEInfo> Infos { get; set; }
- = new List<MachineOEEInfo>();
- }
- }
|