diff --git a/CVDEMCS/Common/Constant/Constant.cs b/CVDEMCS/Common/Constant/Constant.cs index c46fb5b..b988157 100644 --- a/CVDEMCS/Common/Constant/Constant.cs +++ b/CVDEMCS/Common/Constant/Constant.cs @@ -1,7 +1,7 @@ namespace PVDEMCS.Common.Constant { - + /// /// 点位所属动作 /// @@ -24,19 +24,19 @@ public sealed class EquipmentType { /// - /// Ionbond + /// 国产炉 /// - public const String Ionbond = "Ionbond"; + public const String Homegrown = "国产炉"; /// - /// Balzers + /// 进口炉 /// - public const String Balzers = "Balzers"; + public const String Import = "进口炉"; /// /// Cemecon /// - public const String CemeCon = "CemeCon"; + // public const String CemeCon = "CemeCon"; } /// @@ -45,19 +45,19 @@ public sealed class EquipmentTypeOffset { /// - /// Ionbond补偿时间 + /// 国产炉补偿时间 /// - public const String IonbondOffset = "IonbondOffset"; + public const String HomegrownOffset = "HomegrownOffset"; /// - /// Balzers补偿时间 + /// 进口炉补偿时间 /// - public const String BalzersOffset = "BalzersOffset"; + public const String ImportOffset = "ImportOffset"; /// /// Cemecon补偿时间 /// - public const String CemeConOffset = "CemeConOffset"; + // public const String CemeConOffset = "CemeConOffset"; } @@ -81,7 +81,7 @@ public static readonly string[] States = new string[] { Run, Stop, Alarm }; - public static bool HaveState(string state) + public static bool HaveState(string state) { return States.Contains(state); } diff --git a/CVDEMCS/Controllers/EquipmentRecordController.cs b/CVDEMCS/Controllers/EquipmentRecordController.cs index fead807..502d991 100644 --- a/CVDEMCS/Controllers/EquipmentRecordController.cs +++ b/CVDEMCS/Controllers/EquipmentRecordController.cs @@ -204,7 +204,7 @@ namespace PVDEMCS.Controllers /// 结束时间 /// [HttpGet] - public Result GetEquipmentOEEMonthTotal(string equipmentId, DateTime begDate, DateTime endDate) + public Result GetEquipmentOEEMonthTotal(string equipmentId, DateTime begDate, DateTime endDate) { var result = _equipmentRecordService.GetEquipmentOEEMonthTotal(equipmentId, begDate, endDate); if (result.IsSuccess && !result.Content.IsNullOrEmpty()) @@ -256,7 +256,7 @@ namespace PVDEMCS.Controllers State = f.Key.State, count = f.Count() }).ToList(); - var equimentTypes = new string[] { EquipmentType.Balzers, EquipmentType.CemeCon, EquipmentType.Ionbond }; + var equimentTypes = new string[] { EquipmentType.Homegrown, EquipmentType.Import }; foreach (var type in equimentTypes) { equipmentStateView = new EquipmentStateView(); @@ -333,7 +333,7 @@ namespace PVDEMCS.Controllers /// /// [HttpGet] - public Result> GetEquipmentRecordOEEMonthTotal() + public Result> GetEquipmentRecordOEEMonthTotal() { var result = _equipmentRecordService.GetEquipmentRecordOEEMonthTotal(); return result; diff --git a/CVDEMCS/Properties/launchSettings.json b/CVDEMCS/Properties/launchSettings.json index c00bb2d..510df19 100644 --- a/CVDEMCS/Properties/launchSettings.json +++ b/CVDEMCS/Properties/launchSettings.json @@ -1,24 +1,24 @@ { "profiles": { - "WSL": { - "commandName": "WSL2", - "distributionName": "" - }, - "cvdemcs": { - "commandName": "Project", + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, "launchUrl": "swagger", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, - "applicationUrl": "http://localhost:34771" + "dotnetRunMessages": true, + "applicationUrl": "http://127.0.0.1:34771" }, - "IIS Express": { - "commandName": "IISExpress", + "CVDEMCS": { + "commandName": "Project", "launchBrowser": true, "launchUrl": "swagger", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:34771" } }, "$schema": "https://json.schemastore.org/launchsettings.json", @@ -26,7 +26,7 @@ "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { - "applicationUrl": "http://127.0.0.1:34771", + "applicationUrl": "http://localhost:34771", "sslPort": 0 } } diff --git a/CVDEMCS/Services/Repositories/Impl/EquipmentRecordRepository.cs b/CVDEMCS/Services/Repositories/Impl/EquipmentRecordRepository.cs index f4c4ee4..c0ed1d2 100644 --- a/CVDEMCS/Services/Repositories/Impl/EquipmentRecordRepository.cs +++ b/CVDEMCS/Services/Repositories/Impl/EquipmentRecordRepository.cs @@ -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; }