设备运行绩效分析
This commit is contained in:
parent
a7d09807c3
commit
938696d513
@ -9,113 +9,117 @@ using Infrastructure.Converter;
|
||||
//创建时间:2024-05-27
|
||||
namespace DOAN.Admin.WebApi.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备运行绩效分析
|
||||
/// </summary>
|
||||
[Verify]
|
||||
[Route("mes/deviceManagement/DevicePerformance")]
|
||||
public class DevicePerformanceController : BaseController
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备运行绩效分析接口
|
||||
/// </summary>
|
||||
private readonly IDevicePerformanceService _DevicePerformanceService;
|
||||
/// <summary>
|
||||
/// 设备运行绩效分析
|
||||
/// </summary>
|
||||
[Verify]
|
||||
[Route("mes/deviceManagement/DevicePerformance")]
|
||||
public class DevicePerformanceController : BaseController
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备运行绩效分析接口
|
||||
/// </summary>
|
||||
private readonly IDevicePerformanceService _DevicePerformanceService;
|
||||
|
||||
public DevicePerformanceController(IDevicePerformanceService DevicePerformanceService)
|
||||
{
|
||||
_DevicePerformanceService = DevicePerformanceService;
|
||||
}
|
||||
public DevicePerformanceController(IDevicePerformanceService DevicePerformanceService)
|
||||
{
|
||||
_DevicePerformanceService = DevicePerformanceService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询设备运行绩效分析列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("list")]
|
||||
[ActionPermissionFilter(Permission = "business:deviceperformance:list")]
|
||||
public IActionResult QueryDevicePerformance([FromBody] DevicePerformanceQueryDto parm)
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 查询设备运行绩效分析列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("list")]
|
||||
[ActionPermissionFilter(Permission = "business:deviceperformance:list")]
|
||||
public IActionResult QueryDevicePerformance([FromBody] DevicePerformanceQueryDto parm)
|
||||
{
|
||||
|
||||
var response = _DevicePerformanceService.GetList(parm);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询设备运行绩效分析详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{Id}")]
|
||||
[ActionPermissionFilter(Permission = "business:deviceperformance:query")]
|
||||
public IActionResult GetDevicePerformance(string Id)
|
||||
{
|
||||
var response = _DevicePerformanceService.GetInfo(Id);
|
||||
|
||||
var info = response.Adapt<DevicePerformance>();
|
||||
return SUCCESS(info);
|
||||
}
|
||||
/// <summary>
|
||||
/// 查询设备运行绩效分析详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{Id}")]
|
||||
[ActionPermissionFilter(Permission = "business:deviceperformance:query")]
|
||||
public IActionResult GetDevicePerformance(string Id)
|
||||
{
|
||||
var response = _DevicePerformanceService.GetInfo(Id);
|
||||
|
||||
/// <summary>
|
||||
/// 添加设备运行绩效分析
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ActionPermissionFilter(Permission = "business:deviceperformance:add")]
|
||||
[Log(Title = "设备运行绩效分析", BusinessType = BusinessType.INSERT)]
|
||||
public IActionResult AddDevicePerformance([FromBody] DevicePerformanceDto parm)
|
||||
{
|
||||
var modal = parm.Adapt<DevicePerformance>().ToCreate(HttpContext);
|
||||
var info = response.Adapt<DevicePerformance>();
|
||||
return SUCCESS(info);
|
||||
}
|
||||
|
||||
var response = _DevicePerformanceService.AddDevicePerformance(modal);
|
||||
string data = "";
|
||||
if (response == -1)
|
||||
{
|
||||
data = "填写日期不能重复";
|
||||
/// <summary>
|
||||
/// 添加设备运行绩效分析
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ActionPermissionFilter(Permission = "business:deviceperformance:add")]
|
||||
[Log(Title = "设备运行绩效分析", BusinessType = BusinessType.INSERT)]
|
||||
public IActionResult AddDevicePerformance([FromBody] DevicePerformanceDto parm)
|
||||
{
|
||||
var modal = parm.Adapt<DevicePerformance>().ToCreate(HttpContext);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var response = _DevicePerformanceService.AddDevicePerformance(modal);
|
||||
string data = "";
|
||||
if (response == -1)
|
||||
{
|
||||
data = "填写日期不能重复";
|
||||
|
||||
}
|
||||
else if (response == -2)
|
||||
{
|
||||
data = "填写日期不能为空";
|
||||
}
|
||||
else
|
||||
{
|
||||
data = "成功";
|
||||
}
|
||||
|
||||
return SUCCESS(data);
|
||||
}
|
||||
return SUCCESS(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新设备运行绩效分析
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
[ActionPermissionFilter(Permission = "business:deviceperformance:edit")]
|
||||
[Log(Title = "设备运行绩效分析", BusinessType = BusinessType.UPDATE)]
|
||||
public IActionResult UpdateDevicePerformance([FromBody] DevicePerformanceDto parm)
|
||||
{
|
||||
var modal = parm.Adapt<DevicePerformance>().ToUpdate(HttpContext);
|
||||
var response = _DevicePerformanceService.UpdateDevicePerformance(modal);
|
||||
/// <summary>
|
||||
/// 更新设备运行绩效分析
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
[ActionPermissionFilter(Permission = "business:deviceperformance:edit")]
|
||||
[Log(Title = "设备运行绩效分析", BusinessType = BusinessType.UPDATE)]
|
||||
public IActionResult UpdateDevicePerformance([FromBody] DevicePerformanceDto parm)
|
||||
{
|
||||
var modal = parm.Adapt<DevicePerformance>().ToUpdate(HttpContext);
|
||||
var response = _DevicePerformanceService.UpdateDevicePerformance(modal);
|
||||
|
||||
return ToResponse(response);
|
||||
}
|
||||
return ToResponse(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除设备运行绩效分析
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{ids}")]
|
||||
[ActionPermissionFilter(Permission = "business:deviceperformance:delete")]
|
||||
[Log(Title = "设备运行绩效分析", BusinessType = BusinessType.DELETE)]
|
||||
public IActionResult DeleteDevicePerformance(string ids)
|
||||
{
|
||||
string [] idsArr = Tools.SpitStrArrary(ids);
|
||||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||||
/// <summary>
|
||||
/// 删除设备运行绩效分析
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{ids}")]
|
||||
[ActionPermissionFilter(Permission = "business:deviceperformance:delete")]
|
||||
[Log(Title = "设备运行绩效分析", BusinessType = BusinessType.DELETE)]
|
||||
public IActionResult DeleteDevicePerformance(string ids)
|
||||
{
|
||||
string[] idsArr = Tools.SpitStrArrary(ids);
|
||||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||||
|
||||
var response = _DevicePerformanceService.Delete(idsArr);
|
||||
var response = _DevicePerformanceService.Delete(idsArr);
|
||||
|
||||
return ToResponse(response);
|
||||
}
|
||||
return ToResponse(response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -29,7 +29,6 @@ namespace DOAN.Service.MES.dev
|
||||
{
|
||||
|
||||
var response = Queryable();
|
||||
|
||||
|
||||
if (parm.FillDateTime != null && parm.FillDateTime.Length == 2)
|
||||
{
|
||||
@ -71,16 +70,24 @@ namespace DOAN.Service.MES.dev
|
||||
/// <returns></returns>
|
||||
public int AddDevicePerformance(DevicePerformance model)
|
||||
{
|
||||
if (Queryable().Where(x => x.FillDate.Value.ToString("yyyy-MM-dd") == model.FillDate.Value.ToString("yyyy-MM-dd")).Count() > 0)
|
||||
if (model.FillDate!=null)
|
||||
{
|
||||
return -1;//填写日期不能重复
|
||||
if (Queryable().Where(x => x.FillDate.Value.ToString("yyyy-MM-dd") == model.FillDate.Value.ToString("yyyy-MM-dd")).Count() > 0)
|
||||
{
|
||||
return -1;//填写日期不能重复
|
||||
}
|
||||
else
|
||||
{
|
||||
model.Id = XueHua;
|
||||
AutoCalculation(ref model);
|
||||
return Context.Insertable(model).ExecuteCommand();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
model.Id = XueHua;
|
||||
AutoCalculation(ref model);
|
||||
return Context.Insertable(model).ExecuteCommand();
|
||||
return -2;//填写日期不能为空
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -135,27 +142,40 @@ namespace DOAN.Service.MES.dev
|
||||
|
||||
|
||||
//故障停机率
|
||||
if (model.ActualUsableTime > 0)
|
||||
if (model.ActualUsableTime > 0 || model.ActualUsableTime < 0)
|
||||
{
|
||||
model.FaultShutdownRate = Math.Round(model.AccidentDeviceFailureTime / model.ActualUsableTime, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
model.FaultShutdownRate = -1;
|
||||
}
|
||||
|
||||
//设备完好率
|
||||
if (model.ActualUsableTime > 0)
|
||||
if (model.ActualUsableTime > 0 || model.ActualUsableTime < 0)
|
||||
{
|
||||
model.GoodConditionRate = Math.Round(model.DeviceActualRuntime / model.ActualUsableTime, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
model.GoodConditionRate = -1;
|
||||
}
|
||||
|
||||
//计划外停机率
|
||||
model.AccidentShutdownRate = 1 - model.DeviceActualRuntime;
|
||||
model.AccidentShutdownRate = 1 - model.GoodConditionRate;
|
||||
|
||||
//综合设备开机率
|
||||
if(model.PlanRuntime>0)
|
||||
if (model.PlanRuntime > 0|| model.PlanRuntime <0)
|
||||
{
|
||||
model.ComprehensiveEquipmentOperatingRate = model.DeviceActualRuntime / model.PlanRuntime;
|
||||
model.ComprehensiveEquipmentOperatingRate = Math.Round( model.DeviceActualRuntime / model.PlanRuntime,2);
|
||||
}
|
||||
else
|
||||
{
|
||||
model.ComprehensiveEquipmentOperatingRate = 0;
|
||||
|
||||
}
|
||||
//MTBF(设备实际运行时间/故障总次数/60
|
||||
model.Mtbf = Math.Round(model.DeviceActualRuntime / model.FaultShutdownQuantity??0 / 60,2);
|
||||
model.Mtbf = Math.Round((model.DeviceActualRuntime / model.FaultShutdownQuantity??0) / 60,2);
|
||||
|
||||
//MTTR(设备故障停机时间/故障总次数)
|
||||
model.Mttr = Math.Round(model.AccidentDeviceFailureTime / model.FaultShutdownQuantity ?? 0, 2);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user