diff --git a/DOAN.Admin.WebApi/Controllers/MES/dev/DeviceDowntimeRecordController.cs b/DOAN.Admin.WebApi/Controllers/MES/dev/DeviceDowntimeRecordController.cs
new file mode 100644
index 0000000..6d68054
--- /dev/null
+++ b/DOAN.Admin.WebApi/Controllers/MES/dev/DeviceDowntimeRecordController.cs
@@ -0,0 +1,113 @@
+using Microsoft.AspNetCore.Mvc;
+using DOAN.Model.Dto;
+using DOAN.Service.MES.dev.IService;
+using DOAN.Model.MES.dev.Dto;
+using DOAN.Admin.WebApi.Filters;
+
+using DOAN.Model.MES.dev;
+using Infrastructure.Converter;
+
+namespace DOAN.Admin.WebApi.Controllers
+{
+ ///
+ /// 设备停机时间
+ ///
+ [Verify]
+ [Route("mes/deviceManagement/DeviceDowntimeRecord")]
+ public class DeviceDowntimeRecordController : BaseController
+ {
+ ///
+ /// 设备停机时间接口
+ ///
+ private readonly IDeviceDowntimeRecordService _DeviceDowntimeRecordService;
+
+ public DeviceDowntimeRecordController(IDeviceDowntimeRecordService DeviceDowntimeRecordService)
+ {
+ _DeviceDowntimeRecordService = DeviceDowntimeRecordService;
+ }
+
+
+ ///
+ /// 查询设备停机时间列表
+ ///
+ ///
+ ///
+ [HttpPost("list")]
+ [ActionPermissionFilter(Permission = "deviceManagement:devicedowntimerecord:list")]
+ public IActionResult QueryDeviceDowntimeRecord([FromBody] DeviceDowntimeRecordQueryDto parm)
+ {
+ parm.DateTimeRange[0] = DOANConvertDateTime.ConvertLocalDateTime(parm.DateTimeRange[0]);
+ parm.DateTimeRange[1] = DOANConvertDateTime.ConvertLocalDateTime(parm.DateTimeRange[1]);
+ var response = _DeviceDowntimeRecordService.GetList(parm);
+ return SUCCESS(response);
+ }
+
+
+ ///
+ /// 查询设备停机时间详情
+ ///
+ ///
+ ///
+ [HttpGet("{Id}")]
+ [ActionPermissionFilter(Permission = "deviceManagement:devicedowntimerecord:query")]
+ public IActionResult GetDeviceDowntimeRecord(int Id)
+ {
+ var response = _DeviceDowntimeRecordService.GetInfo(Id);
+
+ var info = response.Adapt();
+ return SUCCESS(info);
+ }
+
+ ///
+ /// 添加设备停机时间
+ ///
+ ///
+ [HttpPost]
+ [ActionPermissionFilter(Permission = "deviceManagement:devicedowntimerecord:add")]
+ [Log(Title = "设备停机时间", BusinessType = BusinessType.INSERT)]
+ public IActionResult AddDeviceDowntimeRecord([FromBody] DeviceDowntimeRecordDto parm)
+ {
+ var modal = parm.Adapt().ToCreate(HttpContext);
+
+ var response = _DeviceDowntimeRecordService.AddDeviceDowntimeRecord(modal);
+
+ return SUCCESS(response);
+ }
+
+ ///
+ /// 更新设备停机时间
+ ///
+ ///
+ [HttpPut]
+ [ActionPermissionFilter(Permission = "deviceManagement:devicedowntimerecord:edit")]
+ [Log(Title = "设备停机时间", BusinessType = BusinessType.UPDATE)]
+ public IActionResult UpdateDeviceDowntimeRecord([FromBody] DeviceDowntimeRecordDto parm)
+ {
+ var modal = parm.Adapt().ToUpdate(HttpContext);
+ var response = _DeviceDowntimeRecordService.UpdateDeviceDowntimeRecord(modal);
+
+ return ToResponse(response);
+ }
+
+ ///
+ /// 删除设备停机时间
+ ///
+ ///
+ [HttpDelete("{ids}")]
+ [ActionPermissionFilter(Permission = "deviceManagement:devicedowntimerecord:delete")]
+ [Log(Title = "设备停机时间", BusinessType = BusinessType.DELETE)]
+ public IActionResult DeleteDeviceDowntimeRecord(string ids)
+ {
+ int[] idsArr = Tools.SpitIntArrary(ids);
+ if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
+
+ var response = _DeviceDowntimeRecordService.Delete(idsArr);
+
+ return ToResponse(response);
+ }
+
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Admin.WebApi/Controllers/MES/dev/DeviceFormConfigController.cs b/DOAN.Admin.WebApi/Controllers/MES/dev/DeviceFormConfigController.cs
index 51a7226..f898422 100644
--- a/DOAN.Admin.WebApi/Controllers/MES/dev/DeviceFormConfigController.cs
+++ b/DOAN.Admin.WebApi/Controllers/MES/dev/DeviceFormConfigController.cs
@@ -32,7 +32,7 @@ namespace DOAN.Admin.WebApi.Controllers
///
///
[HttpGet("list")]
- [ActionPermissionFilter(Permission = "business:deviceformconfig:list")]
+ [ActionPermissionFilter(Permission = "deviceManagement:deviceformconfig:list")]
public IActionResult QueryDeviceFormConfig([FromQuery] DeviceFormConfigQueryDto parm)
{
var response = _DeviceFormConfigService.GetList(parm);
@@ -46,7 +46,7 @@ namespace DOAN.Admin.WebApi.Controllers
///
///
[HttpGet("{Id}")]
- [ActionPermissionFilter(Permission = "business:deviceformconfig:query")]
+ [ActionPermissionFilter(Permission = "deviceManagement:deviceformconfig:query")]
public IActionResult GetDeviceFormConfig(string Id)
{
var response = _DeviceFormConfigService.GetInfo(Id);
@@ -60,7 +60,7 @@ namespace DOAN.Admin.WebApi.Controllers
///
///
[HttpPost]
- [ActionPermissionFilter(Permission = "business:deviceformconfig:add")]
+ [ActionPermissionFilter(Permission = "deviceManagement:deviceformconfig:add")]
[Log(Title = "设备检查项表单配置表", BusinessType = BusinessType.INSERT)]
public IActionResult AddDeviceFormConfig([FromBody] DeviceFormConfigDto parm)
{
@@ -76,7 +76,7 @@ namespace DOAN.Admin.WebApi.Controllers
///
///
[HttpPut]
- [ActionPermissionFilter(Permission = "business:deviceformconfig:edit")]
+ [ActionPermissionFilter(Permission = "deviceManagement:deviceformconfig:edit")]
[Log(Title = "设备检查项表单配置表", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateDeviceFormConfig([FromBody] DeviceFormConfigDto parm)
{
@@ -91,7 +91,7 @@ namespace DOAN.Admin.WebApi.Controllers
///
///
[HttpDelete("{ids}")]
- [ActionPermissionFilter(Permission = "business:deviceformconfig:delete")]
+ [ActionPermissionFilter(Permission = "deviceManagement:deviceformconfig:delete")]
[Log(Title = "设备检查项表单配置表", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteDeviceFormConfig(string ids)
{
diff --git a/DOAN.Model/MES/dev/DeviceDowntimeRecord.cs b/DOAN.Model/MES/dev/DeviceDowntimeRecord.cs
new file mode 100644
index 0000000..fb5133c
--- /dev/null
+++ b/DOAN.Model/MES/dev/DeviceDowntimeRecord.cs
@@ -0,0 +1,112 @@
+
+namespace DOAN.Model.MES.dev
+{
+ ///
+ /// 设备停机时间
+ ///
+ [SugarTable("device_downtime_record")]
+ public class DeviceDowntimeRecord
+ {
+ ///
+ /// Id
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+ public int Id { get; set; }
+
+ ///
+ /// 设备名称
+ ///
+ [SugarColumn(ColumnName = "device_name")]
+ public string DeviceName { get; set; }
+
+ ///
+ /// 设备id
+ ///
+ [SugarColumn(ColumnName = "device_id")]
+ public int? DeviceId { get; set; }
+
+ ///
+ /// 停机日期
+ ///
+ public DateTime? Downdate { get; set; }
+
+ ///
+ /// 开始时间
+ ///
+ [SugarColumn(ColumnName = "start_time")]
+ public DateTime? StartTime { get; set; }
+
+ ///
+ /// 结束时间
+ ///
+ [SugarColumn(ColumnName = "end_time")]
+ public DateTime? EndTime { get; set; }
+
+ ///
+ /// 停机时间合计
+ ///
+ [SugarColumn(ColumnName = "consume_time")]
+ public DateTime? ConsumeTime { get; set; }
+
+ ///
+ /// 故障现象
+ ///
+ [SugarColumn(ColumnName = "fault_phenomenon")]
+ public string FaultPhenomenon { get; set; }
+
+ ///
+ /// 故障原因
+ ///
+ [SugarColumn(ColumnName = "fault_reason")]
+ public string FaultReason { get; set; }
+
+ ///
+ /// 临时措施
+ ///
+ [SugarColumn(ColumnName = "temporary_measure")]
+ public string TemporaryMeasure { get; set; }
+
+ ///
+ /// 永居措施
+ ///
+ [SugarColumn(ColumnName = "permanent_measure")]
+ public string PermanentMeasure { get; set; }
+
+ ///
+ /// 维修人
+ ///
+ [SugarColumn(ColumnName = "repair_person")]
+ public string RepairPerson { get; set; }
+
+ ///
+ /// 维修结果
+ ///
+ [SugarColumn(ColumnName = "repair_result")]
+ public string RepairResult { get; set; }
+
+ ///
+ /// CreatedBy
+ ///
+ [SugarColumn(ColumnName = "created_by")]
+ public string CreatedBy { get; set; }
+
+ ///
+ /// CreatedTime
+ ///
+ [SugarColumn(ColumnName = "created_time")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// UpdatedBy
+ ///
+ [SugarColumn(ColumnName = "updated_by")]
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// UpdatedTime
+ ///
+ [SugarColumn(ColumnName = "updated_time")]
+ public DateTime? UpdatedTime { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/dev/Dto/DeviceDowntimeRecordDto.cs b/DOAN.Model/MES/dev/Dto/DeviceDowntimeRecordDto.cs
new file mode 100644
index 0000000..31e7fe2
--- /dev/null
+++ b/DOAN.Model/MES/dev/Dto/DeviceDowntimeRecordDto.cs
@@ -0,0 +1,57 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace DOAN.Model.MES.dev.Dto
+{
+ ///
+ /// 设备停机时间查询对象
+ ///
+ public class DeviceDowntimeRecordQueryDto : PagerInfo
+ {
+ public DateTime[] DateTimeRange { get; set; } = new DateTime[2];
+ public string DeviceName { get; set; }
+ }
+
+ ///
+ /// 设备停机时间输入输出对象
+ ///
+ public class DeviceDowntimeRecordDto
+ {
+ [Required(ErrorMessage = "Id不能为空")]
+ public int Id { get; set; }
+
+ public string DeviceName { get; set; }
+
+ public int? DeviceId { get; set; }
+
+ public DateTime? Downdate { get; set; }
+
+ public DateTime? StartTime { get; set; }
+
+ public DateTime? EndTime { get; set; }
+
+ public DateTime? ConsumeTime { get; set; }
+
+ public string FaultPhenomenon { get; set; }
+
+ public string FaultReason { get; set; }
+
+ public string TemporaryMeasure { get; set; }
+
+ public string PermanentMeasure { get; set; }
+
+ public string RepairPerson { get; set; }
+
+ public string RepairResult { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Service/MES/dev/DeviceDowntimeRecordService.cs b/DOAN.Service/MES/dev/DeviceDowntimeRecordService.cs
new file mode 100644
index 0000000..050d317
--- /dev/null
+++ b/DOAN.Service/MES/dev/DeviceDowntimeRecordService.cs
@@ -0,0 +1,99 @@
+using Infrastructure.Attribute;
+using Infrastructure.Extensions;
+using Microsoft.AspNetCore.Components.Forms;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using DOAN.Model;
+using DOAN.Model.MES.dev;
+using DOAN.Model.MES.dev.Dto;
+using DOAN.Model.System;
+using DOAN.Repository;
+using DOAN.Service.MES.dev.IService;
+
+namespace DOAN.Service.MES.dev
+{
+ ///
+ /// 设备停机时间Service业务层处理
+ ///
+ [AppService(ServiceType = typeof(IDeviceDowntimeRecordService), ServiceLifetime = LifeTime.Transient)]
+ public class DeviceDowntimeRecordService : BaseService, IDeviceDowntimeRecordService
+ {
+ ///
+ /// 查询设备停机时间列表
+ ///
+ ///
+ ///
+ public PagedInfo GetList(DeviceDowntimeRecordQueryDto parm)
+ {
+ var predicate = Expressionable.Create()
+ .AndIF(!string.IsNullOrEmpty(parm.DeviceName), it => it.DeviceName.Contains(parm.DeviceName))
+ .AndIF(parm.DateTimeRange!=null&&parm.DateTimeRange.Length>0&&parm.DateTimeRange[0]>DateTime.MinValue,it=>it.CreatedTime >= parm.DateTimeRange[0])
+ .AndIF(parm.DateTimeRange!=null&&parm.DateTimeRange.Length>0&&parm.DateTimeRange[1]>DateTime.MinValue,it=>it.CreatedTime <= parm.DateTimeRange[1])
+ ;
+
+ var response = Queryable()
+ .Where(predicate.ToExpression())
+ .ToPage(parm);
+
+ return response;
+ }
+
+
+ ///
+ /// 获取详情
+ ///
+ ///
+ ///
+ public DeviceDowntimeRecord GetInfo(int Id)
+ {
+ var response = Queryable()
+ .Where(x => x.Id == Id)
+ .First();
+
+ return response;
+ }
+
+ ///
+ /// 添加设备停机时间
+ ///
+ ///
+ ///
+ public DeviceDowntimeRecord AddDeviceDowntimeRecord(DeviceDowntimeRecord model)
+ {
+ return Context.Insertable(model).ExecuteReturnEntity();
+ }
+
+ ///
+ /// 修改设备停机时间
+ ///
+ ///
+ ///
+ public int UpdateDeviceDowntimeRecord(DeviceDowntimeRecord model)
+ {
+ //var response = Update(w => w.Id == model.Id, it => new DeviceDowntimeRecord()
+ //{
+ // DeviceName = model.DeviceName,
+ // Downdate = model.Downdate,
+ // StartTime = model.StartTime,
+ // EndTime = model.EndTime,
+ // ConsumeTime = model.ConsumeTime,
+ // FaultPhenomenon = model.FaultPhenomenon,
+ // FaultReason = model.FaultReason,
+ // TemporaryMeasure = model.TemporaryMeasure,
+ // PermanentMeasure = model.PermanentMeasure,
+ // RepairPerson = model.RepairPerson,
+ // RepairResult = model.RepairResult,
+ // CreatedBy = model.CreatedBy,
+ // CreatedTime = model.CreatedTime,
+ // UpdatedBy = model.UpdatedBy,
+ // UpdatedTime = model.UpdatedTime,
+ //});
+ //return response;
+ return Update(model, true);
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Service/MES/dev/IService/IDeviceDowntimeRecordService.cs b/DOAN.Service/MES/dev/IService/IDeviceDowntimeRecordService.cs
new file mode 100644
index 0000000..a4781ab
--- /dev/null
+++ b/DOAN.Service/MES/dev/IService/IDeviceDowntimeRecordService.cs
@@ -0,0 +1,23 @@
+using System;
+using DOAN.Model.MES.dev;
+using DOAN.Model.MES.dev.Dto;
+using System.Collections.Generic;
+using DOAN.Model;
+
+namespace DOAN.Service.MES.dev.IService
+{
+ ///
+ /// 设备停机时间service接口
+ ///
+ public interface IDeviceDowntimeRecordService : IBaseService
+ {
+ PagedInfo GetList(DeviceDowntimeRecordQueryDto parm);
+
+ DeviceDowntimeRecord GetInfo(int Id);
+
+ DeviceDowntimeRecord AddDeviceDowntimeRecord(DeviceDowntimeRecord parm);
+
+ int UpdateDeviceDowntimeRecord(DeviceDowntimeRecord parm);
+
+ }
+}