|
@@ -73,17 +73,32 @@ namespace SCADA_DAQ.Customer
|
|
|
OeeAVGChart("亚威PBC折弯机", YaWeiPBCDevice.OeeValueAGV.Values = DeviceOeePercenValue.ChartOeeAVGAxisYList);
|
|
|
OeeAVGChart("百超折弯机", BaiChaoDevice.OeeValueAGV.Values = DeviceOeePercenValue.ChartOeeAVGAxisYList);
|
|
|
}
|
|
|
+ public List<TimeSection> Days { get; set; }
|
|
|
+ public void GetOeeData()
|
|
|
+ {
|
|
|
+ Days = DateTimeHelper.GetDays(DateTimeHelper.ToMonthStart(DateTime.Now), DateTimeHelper.ToMonthEnd(DateTime.Now));
|
|
|
+ var first = DateTime.Parse(Days.First().StartTime.ToString());
|
|
|
+ var last = DateTime.Parse(Days.Last().EndTime.ToString());
|
|
|
+ OeeData = Env.SqlDAL.App_Vertiv_MachineInfoOeeData.GetData<OEEDataModel>().Where(t => t.CreateTime >= first & t.CreateTime <= last);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
public void OeeChart(string deviceName, IList<string> DeviceAisxX, IChartValues DeviceAxisY)
|
|
|
{
|
|
|
-
|
|
|
+ var dayCount = DateTime.Now.Day;
|
|
|
var listdouble = OeePercent(deviceName);
|
|
|
for (int i = 0; i < listdouble.Count; i++)
|
|
|
{
|
|
|
- DeviceAxisY.Add(listdouble[i]);
|
|
|
+ if (i < dayCount)
|
|
|
+ {
|
|
|
+ DeviceAxisY.Add(listdouble[i]);
|
|
|
+ }
|
|
|
+
|
|
|
DeviceAisxX.Add(((i + 1).ToString() + "日"));
|
|
|
|
|
|
}
|
|
|
+
|
|
|
DeviceOeePercenValue.ChartOeeAxisYList = new ChartValues<double>();
|
|
|
DeviceOeePercenValue.ChartOeeAxisXList = new List<string>();
|
|
|
|
|
@@ -92,26 +107,21 @@ namespace SCADA_DAQ.Customer
|
|
|
|
|
|
public void OeeAVGChart(string deviceName, IChartValues DeviceAxisY)
|
|
|
{
|
|
|
+ var dayCount = DateTime.Now.Day;
|
|
|
var deviceAVG = OeePercentAVG(deviceName);
|
|
|
for (int i = 0; i < deviceAVG.Count(); i++)
|
|
|
{
|
|
|
- DeviceAxisY.Add(deviceAVG[i]);
|
|
|
+
|
|
|
+ DeviceAxisY.Add(deviceAVG[i]);
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
DeviceOeePercenValue.ChartOeeAVGAxisYList = new ChartValues<double>();
|
|
|
}
|
|
|
|
|
|
public IEnumerable<OEEDataModel> OeeData { get; set; }
|
|
|
|
|
|
- public List<TimeSection> Days { get; set; }
|
|
|
- public void GetOeeData()
|
|
|
- {
|
|
|
- Days = DateTimeHelper.GetDays(DateTimeHelper.ToMonthStart(DateTime.Now), DateTimeHelper.ToMonthEnd(DateTime.Now));
|
|
|
- var first = DateTime.Parse(Days.First().StartTime.ToString());
|
|
|
- var last = DateTime.Parse(Days.Last().EndTime.ToString());
|
|
|
- OeeData = Env.SqlDAL.App_Vertiv_MachineInfoOeeData.GetData<OEEDataModel>().Where(t => t.CreateTime >= first & t.CreateTime <= last);
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
+
|
|
|
public List<double> OeePercent(string deviceName)
|
|
|
{
|
|
|
var allOeePercentage = new List<double>();
|
|
@@ -145,9 +155,9 @@ namespace SCADA_DAQ.Customer
|
|
|
public List<double> OeePercentAVG(string deviceName)
|
|
|
{
|
|
|
var hourStartResult = DateTime.Parse(Days.First().StartTime.ToString());
|
|
|
- var hourEndResult = DateTime.Parse(DateTime.Now.ToString("00:00:00"));
|
|
|
+ var hourEndResult = DateTime.Parse(DateTime.Now.ToString("23:59:59"));
|
|
|
var OeePercentStingAVG = OeeData.ToLookup(t => t.DeviceName)[deviceName]
|
|
|
- .Where(t => t.CreateTime >= DateTime.Parse(hourStartResult.Format()) & t.CreateTime < DateTime.Parse(hourEndResult.Format()));
|
|
|
+ .Where(t => t.CreateTime >= DateTime.Parse(hourStartResult.Format()) & t.CreateTime <= DateTime.Parse(hourEndResult.Format()));
|
|
|
double aVGValue = 0;
|
|
|
var aVGOeePercentage = new List<double>();
|
|
|
foreach (var item in OeePercentStingAVG)
|
|
@@ -155,9 +165,11 @@ namespace SCADA_DAQ.Customer
|
|
|
aVGValue = double.Parse(item.OeePercentage) + aVGValue;
|
|
|
}
|
|
|
var allAVGValue = aVGValue / OeePercentStingAVG.Count();
|
|
|
+
|
|
|
for (int i = 0; i < Days.Count; i++)
|
|
|
{
|
|
|
- aVGOeePercentage.Add(allAVGValue * 100);
|
|
|
+ aVGOeePercentage.Add(allAVGValue * 100);
|
|
|
+
|
|
|
}
|
|
|
return aVGOeePercentage;
|
|
|
}
|