diff --git a/DOAN.Admin.WebApi/Controllers/MES/dev/DeviceMaintenancePerformanceController.cs b/DOAN.Admin.WebApi/Controllers/MES/dev/DeviceMaintenancePerformanceController.cs
new file mode 100644
index 0000000..7edfac3
--- /dev/null
+++ b/DOAN.Admin.WebApi/Controllers/MES/dev/DeviceMaintenancePerformanceController.cs
@@ -0,0 +1,38 @@
+using DOAN.Model.MES.dev.Dto;
+using DOAN.Service.MES.dev;
+using DOAN.Service.MES.dev.IService;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+
+namespace DOAN.WebApi.Controllers.MES.dev
+{
+ [Route("api/DeviceMaintenancePerformance")]
+ [ApiController]
+ public class DeviceMaintenancePerformanceController : BaseController
+ {
+ ///
+ /// 设备保全率接口
+ ///
+ private readonly IDeviceMaintenancePerformanceService _deviceMaintenancePerformance;
+
+ public DeviceMaintenancePerformanceController(IDeviceMaintenancePerformanceService deviceMaintenancePerformance)
+ {
+ _deviceMaintenancePerformance = deviceMaintenancePerformance;
+ }
+
+ ///
+ /// 查询设备运行绩效分析列表
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpGet]
+ public async Task QueryDevicePerformance(string startTime, string endTime, string workshop)
+ {
+
+ var response = await _deviceMaintenancePerformance.DeviceUptimesAsync(startTime, endTime, workshop);
+ return SUCCESS(response);
+ }
+ }
+}
diff --git a/DOAN.Admin.WebApi/Controllers/MES/dev/DeviceUptimeController.cs b/DOAN.Admin.WebApi/Controllers/MES/dev/DeviceUptimeController.cs
new file mode 100644
index 0000000..730142e
--- /dev/null
+++ b/DOAN.Admin.WebApi/Controllers/MES/dev/DeviceUptimeController.cs
@@ -0,0 +1,109 @@
+using DOAN.Admin.WebApi.Filters;
+using DOAN.Model.MES.dev.Dto;
+using DOAN.Model.MES.dev;
+using DOAN.Service.MES.dev;
+using DOAN.Service.MES.dev.IService;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using SqlSugar;
+
+namespace DOAN.WebApi.Controllers.MES.dev
+{
+ ///
+ /// 设备保全率
+ ///
+ [Verify]
+ [Route("business/DeviceUptime")]
+ public class DeviceUptimeController : BaseController
+ {
+ ///
+ /// 设备保全率接口
+ ///
+ private readonly IDeviceUptimeService _DeviceUptimeService;
+
+ public DeviceUptimeController(IDeviceUptimeService DeviceUptimeService)
+ {
+ _DeviceUptimeService = DeviceUptimeService;
+ }
+
+ ///
+ /// 查询设备保全率列表
+ ///
+ ///
+ ///
+ [HttpGet("list")]
+ [ActionPermissionFilter(Permission = "business:deviceuptime:list")]
+ public IActionResult QueryDeviceUptime([FromQuery] DeviceUptimeQueryDto parm)
+ {
+ var response = _DeviceUptimeService.GetList(parm);
+ return SUCCESS(response);
+ }
+
+
+ ///
+ /// 查询设备保全率详情
+ ///
+ ///
+ ///
+ [HttpGet("{Id}")]
+ [ActionPermissionFilter(Permission = "business:deviceuptime:query")]
+ public IActionResult GetDeviceUptime(string Id)
+ {
+ var response = _DeviceUptimeService.GetInfo(Id);
+
+ var info = response.Adapt();
+ return SUCCESS(info);
+ }
+
+ ///
+ /// 添加设备保全率
+ ///
+ ///
+ [HttpPost]
+ [ActionPermissionFilter(Permission = "business:deviceuptime:add")]
+ [Log(Title = "设备保全率", BusinessType = BusinessType.INSERT)]
+ public IActionResult AddDeviceUptime([FromBody] DeviceUptimeDto parm)
+ {
+ var modal = parm.Adapt().ToCreate(HttpContext);
+ modal.Id = SnowFlakeSingle.Instance.NextId().ToString();
+ var response = _DeviceUptimeService.AddDeviceUptime(modal);
+ return SUCCESS(response);
+ }
+
+ ///
+ /// 更新设备保全率
+ ///
+ ///
+ [HttpPut]
+ [ActionPermissionFilter(Permission = "business:deviceuptime:edit")]
+ [Log(Title = "设备保全率", BusinessType = BusinessType.UPDATE)]
+ public IActionResult UpdateDeviceUptime([FromBody] DeviceUptimeDto parm)
+ {
+ var modal = parm.Adapt().ToUpdate(HttpContext);
+ var response = _DeviceUptimeService.UpdateDeviceUptime(modal);
+
+ return ToResponse(response);
+ }
+
+ ///
+ /// 删除设备保全率
+ ///
+ ///
+ [HttpDelete("{ids}")]
+ [ActionPermissionFilter(Permission = "business:deviceuptime:delete")]
+ [Log(Title = "设备保全率", BusinessType = BusinessType.DELETE)]
+ public IActionResult DeleteDeviceUptime(string ids)
+ {
+ int[] idsArr = Tools.SpitIntArrary(ids);
+ if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
+
+ var response = _DeviceUptimeService.Delete(idsArr);
+
+ return ToResponse(response);
+ }
+
+
+
+
+ }
+}
diff --git a/DOAN.Model/MES/dev/DeviceUptime.cs b/DOAN.Model/MES/dev/DeviceUptime.cs
new file mode 100644
index 0000000..4b9c947
--- /dev/null
+++ b/DOAN.Model/MES/dev/DeviceUptime.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DOAN.Model.MES.dev
+{
+ ///
+ /// 设备保全率
+ ///
+ [SugarTable("device_uptime")]
+ public class DeviceUptime
+ {
+ ///
+ /// 主键id
+ ///
+ public string Id { get; set; }
+
+ ///
+ /// 目标率
+ ///
+ [SugarColumn(ColumnName = "target_value")]
+ public string targetValue{ get; set; }
+
+ ///
+ /// 实际率
+ ///
+ [SugarColumn(ColumnName = "actual_value")]
+ public string ActualValue { get; set; }
+
+ ///
+ /// 车间
+ ///
+ public string Workshop { get; set; }
+
+ ///
+ /// 填写时间
+ ///
+ [SugarColumn(ColumnName = "fill_time")]
+ public string FillTime { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "cREATED_BY")]
+ public string CreatedBy { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "cREATED_TIME")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 更新人
+ ///
+ [SugarColumn(ColumnName = "uPDATED_BY")]
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ [SugarColumn(ColumnName = "uPDATED_TIME")]
+ public DateTime? UpdatedTime { get; set; }
+
+ ///
+ /// 类别区分
+ ///
+ public string Type { get; set; }
+ }
+}
diff --git a/DOAN.Model/MES/dev/Dto/DeviceUptimeQueryDto.cs b/DOAN.Model/MES/dev/Dto/DeviceUptimeQueryDto.cs
new file mode 100644
index 0000000..3b67385
--- /dev/null
+++ b/DOAN.Model/MES/dev/Dto/DeviceUptimeQueryDto.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DOAN.Model.MES.dev.Dto
+{
+ ///
+ /// 设备保全率查询对象
+ ///
+ public class DeviceUptimeQueryDto : PagerInfo
+ {
+ }
+
+ ///
+ /// 设备保全率输入输出对象
+ ///
+ public class DeviceUptimeDto
+ {
+ public string Id { get; set; }
+
+ public string targetValue{ get; set; }
+
+ public string ActualValue { get; set; }
+
+ public string Workshop { get; set; }
+
+ public string FillTime { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+ public string Type { get; set; }
+ }
+}
diff --git a/DOAN.Service/MES/dev/DeviceMaintenancePerformanceService.cs b/DOAN.Service/MES/dev/DeviceMaintenancePerformanceService.cs
new file mode 100644
index 0000000..cd277b2
--- /dev/null
+++ b/DOAN.Service/MES/dev/DeviceMaintenancePerformanceService.cs
@@ -0,0 +1,33 @@
+using Aliyun.OSS;
+using DOAN.Model.MES.dev;
+using DOAN.Model.MES.dev.Dto;
+using DOAN.Repository;
+using DOAN.Service.MES.dev.IService;
+using Infrastructure.Attribute;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DOAN.Service.MES.dev
+{
+ [AppService(ServiceType = typeof(IDeviceMaintenancePerformanceService), ServiceLifetime = LifeTime.Transient)]
+ public class DeviceMaintenancePerformanceService:BaseService,IDeviceMaintenancePerformanceService
+ {
+ public async Task>> DeviceUptimesAsync(string startTime, string endTime,string workshop)
+ {
+
+ var query = Context.Queryable()
+ .Where(x => x.Workshop == workshop)
+ .Where(x => x.FillTime.CompareTo($"{startTime}") >= 0)
+ .Where(x => x.FillTime.CompareTo($"{endTime}") <= 0)
+ .OrderBy(x=>x.FillTime);
+
+ var result = (await query.ToListAsync()).GroupBy(x => x.Type)
+ .ToDictionary(g => g.Key, g => g.ToList());
+ return result;
+ }
+ }
+
+}
diff --git a/DOAN.Service/MES/dev/DeviceUptimeService.cs b/DOAN.Service/MES/dev/DeviceUptimeService.cs
new file mode 100644
index 0000000..a4d2259
--- /dev/null
+++ b/DOAN.Service/MES/dev/DeviceUptimeService.cs
@@ -0,0 +1,88 @@
+using Aliyun.OSS;
+using DOAN.Model;
+using DOAN.Model.MES.dev;
+using DOAN.Model.MES.dev.Dto;
+using DOAN.Repository;
+using DOAN.Service.MES.dev.IService;
+using Infrastructure.Attribute;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DOAN.Service.MES.dev
+{
+ ///
+ /// 设备保全率Service业务层处理
+ ///
+ [AppService(ServiceType = typeof(IDeviceUptimeService), ServiceLifetime = LifeTime.Transient)]
+ public class DeviceUptimeService : BaseService, IDeviceUptimeService
+ {
+ ///
+ /// 查询设备保全率列表
+ ///
+ ///
+ ///
+ public PagedInfo GetList(DeviceUptimeQueryDto parm)
+ {
+ var predicate = Expressionable.Create();
+
+ var response = Queryable()
+ .Where(predicate.ToExpression())
+ .ToPage(parm);
+
+ return response;
+ }
+
+
+ ///
+ /// 获取详情
+ ///
+ ///
+ ///
+ public DeviceUptime GetInfo(string Id)
+ {
+ var response = Queryable()
+ .Where(x => x.Id == Id)
+ .First();
+
+ return response;
+ }
+
+ ///
+ /// 添加设备保全率
+ ///
+ ///
+ ///
+ public DeviceUptime AddDeviceUptime(DeviceUptime model)
+ {
+ return Context.Insertable(model).ExecuteReturnEntity();
+ }
+
+ ///
+ /// 修改设备保全率
+ ///
+ ///
+ ///
+ public int UpdateDeviceUptime(DeviceUptime model)
+ {
+ var response = Update(w => w.Id == model.Id, it => new DeviceUptime()
+ {
+
+ targetValue = model.targetValue,
+ ActualValue = model.ActualValue,
+ Workshop = model.Workshop,
+ FillTime = model.FillTime,
+ CreatedBy = model.CreatedBy,
+ CreatedTime = model.CreatedTime,
+ UpdatedBy = model.UpdatedBy,
+ Type = model.Type,
+ UpdatedTime = model.UpdatedTime,
+ });
+ return response;
+ //return Update(model, true);
+ }
+
+ }
+}
diff --git a/DOAN.Service/MES/dev/IService/IDeviceMaintenancePerformanceService.cs b/DOAN.Service/MES/dev/IService/IDeviceMaintenancePerformanceService.cs
new file mode 100644
index 0000000..635f941
--- /dev/null
+++ b/DOAN.Service/MES/dev/IService/IDeviceMaintenancePerformanceService.cs
@@ -0,0 +1,14 @@
+using DOAN.Model.MES.dev;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DOAN.Service.MES.dev.IService
+{
+ public interface IDeviceMaintenancePerformanceService
+ {
+ public Task>> DeviceUptimesAsync(string startTime, string endTime, string workshop);
+ }
+}
diff --git a/DOAN.Service/MES/dev/IService/IDeviceUptimeIService.cs b/DOAN.Service/MES/dev/IService/IDeviceUptimeIService.cs
new file mode 100644
index 0000000..37faaa2
--- /dev/null
+++ b/DOAN.Service/MES/dev/IService/IDeviceUptimeIService.cs
@@ -0,0 +1,26 @@
+using DOAN.Model;
+using DOAN.Model.MES.dev;
+using DOAN.Model.MES.dev.Dto;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DOAN.Service.MES.dev.IService
+{
+ ///
+ /// 设备保全率service接口
+ ///
+ public interface IDeviceUptimeService : IBaseService
+ {
+ PagedInfo GetList(DeviceUptimeQueryDto parm);
+
+ DeviceUptime GetInfo(string Id);
+
+ DeviceUptime AddDeviceUptime(DeviceUptime parm);
+
+ int UpdateDeviceUptime(DeviceUptime parm);
+
+ }
+}