|
|
|
@ -137,7 +137,7 @@ namespace PVDEMCS.Services.Repositories.Impl
|
|
|
|
|
var endDateTime = dateTime.AddDays(-3);
|
|
|
|
|
var entity = context.EquipmentRecords.Where(f => f.EquipmentId == equipmentId && f.StartTime <= endDateTime).OrderByDescending(f => f.StartTime).FirstOrDefault();
|
|
|
|
|
//如果3天内没有找到
|
|
|
|
|
if (entity == null)
|
|
|
|
|
if (entity == null)
|
|
|
|
|
{
|
|
|
|
|
entity = context.EquipmentRecords.Where(f => f.EquipmentId == equipmentId).OrderByDescending(f => f.StartTime).FirstOrDefault();
|
|
|
|
|
}
|
|
|
|
@ -237,9 +237,9 @@ namespace PVDEMCS.Services.Repositories.Impl
|
|
|
|
|
var result = new Result();
|
|
|
|
|
using (var context = new EFContext())
|
|
|
|
|
{
|
|
|
|
|
var query = context.EquipmentRecords.Where(f => (f.StartTime >= begDate && f.StartTime <= endDate)).ToList();
|
|
|
|
|
var query = context.EquipmentRecords.Where(f => (f.StartTime >= begDate && f.StartTime <= endDate)).ToList();
|
|
|
|
|
//过滤跨天的数据部分
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取状态统计时间
|
|
|
|
|
var total = query.GroupBy(f => new { f.EquipmentId, f.State })
|
|
|
|
|
.Select(f => new TotalRecord
|
|
|
|
@ -269,24 +269,24 @@ namespace PVDEMCS.Services.Repositories.Impl
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取配置的设备的阈值
|
|
|
|
|
var balzersConfig = _configRepository.GetSysConfigDetailNameOrKey("", EquipmentType.Balzers).Content;
|
|
|
|
|
var cemeconConfig = _configRepository.GetSysConfigDetailNameOrKey("", EquipmentType.CemeCon).Content;
|
|
|
|
|
var ionbondConfig = _configRepository.GetSysConfigDetailNameOrKey("", EquipmentType.Ionbond).Content;
|
|
|
|
|
var balzers = 200;
|
|
|
|
|
var cemecon = 300;
|
|
|
|
|
var ionbond = 200;
|
|
|
|
|
if (balzersConfig != null && !balzersConfig.ConfigValue.IsNullOrEmpty())
|
|
|
|
|
{
|
|
|
|
|
int.TryParse(balzersConfig.ConfigValue, out balzers);
|
|
|
|
|
}
|
|
|
|
|
if (cemeconConfig != null && !cemeconConfig.ConfigValue.IsNullOrEmpty())
|
|
|
|
|
var homegrownConfig = _configRepository.GetSysConfigDetailNameOrKey("", EquipmentType.Homegrown).Content;
|
|
|
|
|
var importConfig = _configRepository.GetSysConfigDetailNameOrKey("", EquipmentType.Import).Content;
|
|
|
|
|
//var ionbondConfig = _configRepository.GetSysConfigDetailNameOrKey("", EquipmentType.Ionbond).Content;
|
|
|
|
|
var homegrown = 200;
|
|
|
|
|
var import = 300;
|
|
|
|
|
//var ionbond = 200;
|
|
|
|
|
if (homegrownConfig != null && !homegrownConfig.ConfigValue.IsNullOrEmpty())
|
|
|
|
|
{
|
|
|
|
|
int.TryParse(cemeconConfig.ConfigValue, out cemecon);
|
|
|
|
|
int.TryParse(homegrownConfig.ConfigValue, out homegrown);
|
|
|
|
|
}
|
|
|
|
|
if (ionbondConfig != null && !ionbondConfig.ConfigValue.IsNullOrEmpty())
|
|
|
|
|
if (importConfig != null && !importConfig.ConfigValue.IsNullOrEmpty())
|
|
|
|
|
{
|
|
|
|
|
int.TryParse(ionbondConfig.ConfigValue, out ionbond);
|
|
|
|
|
int.TryParse(importConfig.ConfigValue, out import);
|
|
|
|
|
}
|
|
|
|
|
//if (ionbondConfig != null && !ionbondConfig.ConfigValue.IsNullOrEmpty())
|
|
|
|
|
//{
|
|
|
|
|
// int.TryParse(ionbondConfig.ConfigValue, out ionbond);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var dayTotals = context.EquipmentRecordDayTotals.Where(f => f.TotalDay >= begDate && f.TotalDay <= endDate).ToList();
|
|
|
|
@ -334,24 +334,24 @@ namespace PVDEMCS.Services.Repositories.Impl
|
|
|
|
|
var minutes = (furnace.EndTime - furnace.StartTime).TotalMinutes;
|
|
|
|
|
switch (furnace.EquipmentType)
|
|
|
|
|
{
|
|
|
|
|
case EquipmentType.Balzers:
|
|
|
|
|
if (minutes >= balzers)
|
|
|
|
|
{
|
|
|
|
|
value.FurnaceNum++;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case EquipmentType.Ionbond:
|
|
|
|
|
if (minutes >= ionbond)
|
|
|
|
|
case EquipmentType.Homegrown:
|
|
|
|
|
if (minutes >= homegrown)
|
|
|
|
|
{
|
|
|
|
|
value.FurnaceNum++;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case EquipmentType.CemeCon:
|
|
|
|
|
if (minutes >= cemecon)
|
|
|
|
|
case EquipmentType.Import:
|
|
|
|
|
if (minutes >= import)
|
|
|
|
|
{
|
|
|
|
|
value.FurnaceNum++;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
//case EquipmentType.CemeCon:
|
|
|
|
|
// if (minutes >= import)
|
|
|
|
|
// {
|
|
|
|
|
// value.FurnaceNum++;
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -518,7 +518,7 @@ namespace PVDEMCS.Services.Repositories.Impl
|
|
|
|
|
{
|
|
|
|
|
query = query.Where(f => f.TotalDay <= endTime);
|
|
|
|
|
}
|
|
|
|
|
// query = query.Where(f => f.TotalDay >= begTime && f.TotalDay <= endTime);
|
|
|
|
|
// query = query.Where(f => f.TotalDay >= begTime && f.TotalDay <= endTime);
|
|
|
|
|
|
|
|
|
|
return query;
|
|
|
|
|
}
|
|
|
|
@ -714,24 +714,24 @@ namespace PVDEMCS.Services.Repositories.Impl
|
|
|
|
|
|
|
|
|
|
//计算OEE
|
|
|
|
|
//获取配置的设备的初尝值
|
|
|
|
|
var balzersConfig = _configRepository.GetSysConfigDetailNameOrKey("", EquipmentTypeOffset.BalzersOffset).Content;
|
|
|
|
|
var cemeconConfig = _configRepository.GetSysConfigDetailNameOrKey("", EquipmentTypeOffset.CemeConOffset).Content;
|
|
|
|
|
var ionbondConfig = _configRepository.GetSysConfigDetailNameOrKey("", EquipmentTypeOffset.IonbondOffset).Content;
|
|
|
|
|
var balzers = 0m;
|
|
|
|
|
var cemecon = 0m;
|
|
|
|
|
var ionbond = 0m;
|
|
|
|
|
if (balzersConfig != null && !balzersConfig.ConfigValue.IsNullOrEmpty())
|
|
|
|
|
var homegrownConfig = _configRepository.GetSysConfigDetailNameOrKey("", EquipmentTypeOffset.HomegrownOffset).Content;
|
|
|
|
|
var importConfig = _configRepository.GetSysConfigDetailNameOrKey("", EquipmentTypeOffset.ImportOffset).Content;
|
|
|
|
|
//var ionbondConfig = _configRepository.GetSysConfigDetailNameOrKey("", EquipmentTypeOffset.IonbondOffset).Content;
|
|
|
|
|
var homegrown = 0m;
|
|
|
|
|
var import = 0m;
|
|
|
|
|
//var ionbond = 0m;
|
|
|
|
|
if (homegrownConfig != null && !homegrownConfig.ConfigValue.IsNullOrEmpty())
|
|
|
|
|
{
|
|
|
|
|
decimal.TryParse(balzersConfig.ConfigValue, out balzers);
|
|
|
|
|
decimal.TryParse(homegrownConfig.ConfigValue, out homegrown);
|
|
|
|
|
}
|
|
|
|
|
if (cemeconConfig != null && !cemeconConfig.ConfigValue.IsNullOrEmpty())
|
|
|
|
|
if (importConfig != null && !importConfig.ConfigValue.IsNullOrEmpty())
|
|
|
|
|
{
|
|
|
|
|
decimal.TryParse(cemeconConfig.ConfigValue, out cemecon);
|
|
|
|
|
}
|
|
|
|
|
if (ionbondConfig != null && !ionbondConfig.ConfigValue.IsNullOrEmpty())
|
|
|
|
|
{
|
|
|
|
|
decimal.TryParse(ionbondConfig.ConfigValue, out ionbond);
|
|
|
|
|
decimal.TryParse(importConfig.ConfigValue, out import);
|
|
|
|
|
}
|
|
|
|
|
//if (ionbondConfig != null && !ionbondConfig.ConfigValue.IsNullOrEmpty())
|
|
|
|
|
//{
|
|
|
|
|
// decimal.TryParse(ionbondConfig.ConfigValue, out ionbond);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
foreach (var item in list)
|
|
|
|
|
{
|
|
|
|
@ -742,7 +742,7 @@ namespace PVDEMCS.Services.Repositories.Impl
|
|
|
|
|
if (item.TotalMonth == DateTime.Now.ToString("yyyy-MM"))
|
|
|
|
|
{
|
|
|
|
|
//初尝值不包括今天
|
|
|
|
|
// days = now.Day - 1;
|
|
|
|
|
// days = now.Day - 1;
|
|
|
|
|
//获取当月到当前的分钟
|
|
|
|
|
minutes = days * 60 * 24 + (now.Hour - 1) * 60 + now.Minute;
|
|
|
|
|
}
|
|
|
|
@ -759,15 +759,15 @@ namespace PVDEMCS.Services.Repositories.Impl
|
|
|
|
|
var value = 0m;
|
|
|
|
|
switch (item.EquipmentType)
|
|
|
|
|
{
|
|
|
|
|
case EquipmentType.Balzers:
|
|
|
|
|
value = days * balzers;
|
|
|
|
|
case EquipmentType.Homegrown:
|
|
|
|
|
value = days * homegrown;
|
|
|
|
|
break;
|
|
|
|
|
case EquipmentType.Ionbond:
|
|
|
|
|
value = days * ionbond;
|
|
|
|
|
break;
|
|
|
|
|
case EquipmentType.CemeCon:
|
|
|
|
|
value = days * cemecon;
|
|
|
|
|
case EquipmentType.Import:
|
|
|
|
|
value = days * import;
|
|
|
|
|
break;
|
|
|
|
|
//case EquipmentType.CemeCon:
|
|
|
|
|
// value = days * cemecon;
|
|
|
|
|
// break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -828,24 +828,24 @@ namespace PVDEMCS.Services.Repositories.Impl
|
|
|
|
|
var detail = list[0];
|
|
|
|
|
|
|
|
|
|
//获取配置的设备的初尝值
|
|
|
|
|
var balzersConfig = _configRepository.GetSysConfigDetailNameOrKey("", EquipmentTypeOffset.BalzersOffset).Content;
|
|
|
|
|
var cemeconConfig = _configRepository.GetSysConfigDetailNameOrKey("", EquipmentTypeOffset.CemeConOffset).Content;
|
|
|
|
|
var ionbondConfig = _configRepository.GetSysConfigDetailNameOrKey("", EquipmentTypeOffset.IonbondOffset).Content;
|
|
|
|
|
var balzers = 0m;
|
|
|
|
|
var cemecon = 0m;
|
|
|
|
|
var ionbond = 0m;
|
|
|
|
|
if (balzersConfig != null && !balzersConfig.ConfigValue.IsNullOrEmpty())
|
|
|
|
|
{
|
|
|
|
|
decimal.TryParse(balzersConfig.ConfigValue, out balzers);
|
|
|
|
|
}
|
|
|
|
|
if (cemeconConfig != null && !cemeconConfig.ConfigValue.IsNullOrEmpty())
|
|
|
|
|
var homegrownConfig = _configRepository.GetSysConfigDetailNameOrKey("", EquipmentTypeOffset.HomegrownOffset).Content;
|
|
|
|
|
var importConfig = _configRepository.GetSysConfigDetailNameOrKey("", EquipmentTypeOffset.ImportOffset).Content;
|
|
|
|
|
//var ionbondConfig = _configRepository.GetSysConfigDetailNameOrKey("", EquipmentTypeOffset.IonbondOffset).Content;
|
|
|
|
|
var homegrown = 0m;
|
|
|
|
|
var import = 0m;
|
|
|
|
|
//var ionbond = 0m;
|
|
|
|
|
if (homegrownConfig != null && !homegrownConfig.ConfigValue.IsNullOrEmpty())
|
|
|
|
|
{
|
|
|
|
|
decimal.TryParse(cemeconConfig.ConfigValue, out cemecon);
|
|
|
|
|
decimal.TryParse(homegrownConfig.ConfigValue, out homegrown);
|
|
|
|
|
}
|
|
|
|
|
if (ionbondConfig != null && !ionbondConfig.ConfigValue.IsNullOrEmpty())
|
|
|
|
|
if (importConfig != null && !importConfig.ConfigValue.IsNullOrEmpty())
|
|
|
|
|
{
|
|
|
|
|
decimal.TryParse(ionbondConfig.ConfigValue, out ionbond);
|
|
|
|
|
decimal.TryParse(importConfig.ConfigValue, out import);
|
|
|
|
|
}
|
|
|
|
|
//if (ionbondConfig != null && !ionbondConfig.ConfigValue.IsNullOrEmpty())
|
|
|
|
|
//{
|
|
|
|
|
// decimal.TryParse(ionbondConfig.ConfigValue, out ionbond);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
var now = DateTime.Now;
|
|
|
|
|
var minutes = 0m;
|
|
|
|
@ -871,15 +871,15 @@ namespace PVDEMCS.Services.Repositories.Impl
|
|
|
|
|
var value = 0m;
|
|
|
|
|
switch (detail.EquipmentType)
|
|
|
|
|
{
|
|
|
|
|
case EquipmentType.Balzers:
|
|
|
|
|
value = days * balzers;
|
|
|
|
|
break;
|
|
|
|
|
case EquipmentType.Ionbond:
|
|
|
|
|
value = days * ionbond;
|
|
|
|
|
case EquipmentType.Homegrown:
|
|
|
|
|
value = days * homegrown;
|
|
|
|
|
break;
|
|
|
|
|
case EquipmentType.CemeCon:
|
|
|
|
|
value = days * cemecon;
|
|
|
|
|
case EquipmentType.Import:
|
|
|
|
|
value = days * import;
|
|
|
|
|
break;
|
|
|
|
|
//case EquipmentType.CemeCon:
|
|
|
|
|
// value = days * import;
|
|
|
|
|
// break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|