diff --git a/ZR.Admin.WebApi/Controllers/MES/andon/AndonFaultRecordController.cs b/ZR.Admin.WebApi/Controllers/MES/andon/AndonFaultRecordController.cs
new file mode 100644
index 0000000..7077fc0
--- /dev/null
+++ b/ZR.Admin.WebApi/Controllers/MES/andon/AndonFaultRecordController.cs
@@ -0,0 +1,110 @@
+using Microsoft.AspNetCore.Mvc;
+using ZR.Model.Dto;
+using ZR.Model.MES.andon;
+using ZR.Model.MES.andon.Dto;
+using ZR.Service.MES.andon.IService;
+using ZR.Admin.WebApi.Filters;
+
+//创建时间:2024-06-20
+namespace ZR.Admin.WebApi.Controllers
+{
+ ///
+ /// 故障记录表
+ ///
+ [Verify]
+ [Route("mes/andonManagement/AndonFaultRecord")]
+ public class AndonFaultRecordController : BaseController
+ {
+ ///
+ /// 故障记录表接口
+ ///
+ private readonly IAndonFaultRecordService _AndonFaultRecordService;
+
+ public AndonFaultRecordController(IAndonFaultRecordService AndonFaultRecordService)
+ {
+ _AndonFaultRecordService = AndonFaultRecordService;
+ }
+
+ ///
+ /// 查询故障记录表列表
+ ///
+ ///
+ ///
+ [HttpPost("list")]
+ [ActionPermissionFilter(Permission = "andonManagement:andonfaultrecord:list")]
+ public IActionResult QueryAndonFaultRecord([FromBody] AndonFaultRecordQueryDto parm)
+ {
+
+ var response = _AndonFaultRecordService.GetList(parm);
+ return SUCCESS(response);
+ }
+
+
+ ///
+ /// 查询故障记录表详情
+ ///
+ ///
+ ///
+ [HttpGet("{Id}")]
+ [ActionPermissionFilter(Permission = "andonManagement:andonfaultrecord:query")]
+ public IActionResult GetAndonFaultRecord(string Id)
+ {
+ var response = _AndonFaultRecordService.GetInfo(Id);
+
+ var info = response.Adapt();
+ return SUCCESS(info);
+ }
+
+ ///
+ /// 添加故障记录表
+ ///
+ ///
+ [HttpPost]
+ [ActionPermissionFilter(Permission = "andonManagement:andonfaultrecord:add")]
+ [Log(Title = "故障记录表", BusinessType = BusinessType.INSERT)]
+ public IActionResult AddAndonFaultRecord([FromBody] AndonFaultRecordDto parm)
+ {
+ var modal = parm.Adapt().ToCreate(HttpContext);
+
+ var response = _AndonFaultRecordService.AddAndonFaultRecord(modal);
+
+ return SUCCESS(response);
+ }
+
+ ///
+ /// 更新故障记录表
+ ///
+ ///
+ [HttpPut]
+ [ActionPermissionFilter(Permission = "andonManagement:andonfaultrecord:edit")]
+ [Log(Title = "故障记录表", BusinessType = BusinessType.UPDATE)]
+ public IActionResult UpdateAndonFaultRecord([FromBody] AndonFaultRecordDto parm)
+ {
+ var modal = parm.Adapt().ToUpdate(HttpContext);
+ var response = _AndonFaultRecordService.UpdateAndonFaultRecord(modal);
+
+ return ToResponse(response);
+ }
+
+ ///
+ /// 删除故障记录表
+ ///
+ ///
+ [HttpDelete("{ids}")]
+ [ActionPermissionFilter(Permission = "andonManagement:andonfaultrecord:delete")]
+ [Log(Title = "故障记录表", BusinessType = BusinessType.DELETE)]
+ public IActionResult DeleteAndonFaultRecord(string ids)
+ {
+ int[] idsArr = Tools.SpitIntArrary(ids);
+ if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
+
+ var response = _AndonFaultRecordService.Delete(idsArr);
+
+ return ToResponse(response);
+ }
+
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/ZR.Model/MES/andon/Dto/AndonFaultRecordDto.cs b/ZR.Model/MES/andon/Dto/AndonFaultRecordDto.cs
index 86926f3..f42380a 100644
--- a/ZR.Model/MES/andon/Dto/AndonFaultRecordDto.cs
+++ b/ZR.Model/MES/andon/Dto/AndonFaultRecordDto.cs
@@ -36,7 +36,7 @@ namespace ZR.Model.Dto
///
/// 安灯签到
///
- public class AndonResponseQueryDto
+ public class AndonResponseQueryDto
{
///
/// 表单id
@@ -48,7 +48,7 @@ namespace ZR.Model.Dto
///
public string ResponsePerson { get; set; }
-
+
}
///
@@ -56,7 +56,10 @@ namespace ZR.Model.Dto
///
public class AndonFaultRecordQueryDto : PagerInfo
{
-
+ public string LineCode { get; set; }
+ public string AskPerson { get; set; }
+ public string FaultDict { get; set; }
+ public DateTime[] DateTimeRange { get; set; }
}
///
diff --git a/ZR.Service/MES/andon/AndonFaultRecordService.cs b/ZR.Service/MES/andon/AndonFaultRecordService.cs
new file mode 100644
index 0000000..d61cc94
--- /dev/null
+++ b/ZR.Service/MES/andon/AndonFaultRecordService.cs
@@ -0,0 +1,113 @@
+using System;
+using SqlSugar;
+using Infrastructure.Attribute;
+using Infrastructure.Extensions;
+using ZR.Model;
+using ZR.Model.Dto;
+using ZR.Model.MES.andon;
+using ZR.Model.MES.andon.Dto;
+using ZR.Repository;
+using ZR.Service.MES.andon.IService;
+using System.Linq;
+using Aliyun.OSS;
+
+namespace ZR.Service.MES.andon
+{
+ ///
+ /// 故障记录表Service业务层处理
+ ///
+ [AppService(ServiceType = typeof(IAndonFaultRecordService), ServiceLifetime = LifeTime.Transient)]
+ public class AndonFaultRecordService : BaseService, IAndonFaultRecordService
+ {
+ ///
+ /// 查询故障记录表列表
+ ///
+ ///
+ ///
+ public PagedInfo GetList(AndonFaultRecordQueryDto parm)
+ {
+ var predicate = Expressionable.Create()
+ .AndIF(!string.IsNullOrEmpty(parm.LineCode),it=>it.LineCode.Contains(parm.LineCode))
+ .AndIF(!string.IsNullOrEmpty(parm.AskPerson),it=>it.AskPerson.Contains(parm.AskPerson))
+ .AndIF(!string.IsNullOrEmpty(parm.FaultDict),it=>it.FaultDict.Contains(parm.FaultDict))
+ .AndIF(!string.IsNullOrEmpty(parm.FaultDict),it=>it.FaultDict.Contains(parm.FaultDict))
+ .AndIF(parm.DateTimeRange.Count()==2&&parm.DateTimeRange[0]>DateTime.MinValue,it=>it.StartTime>= parm.DateTimeRange[0])
+ .AndIF(parm.DateTimeRange.Count() == 2&&parm.DateTimeRange[1]>DateTime.MinValue,it=>it.StartTime<= parm.DateTimeRange[1])
+ ;
+
+ var response = Queryable()
+ .Where(predicate.ToExpression())
+ .ToPage(parm);
+
+ return response;
+ }
+
+
+ ///
+ /// 获取详情
+ ///
+ ///
+ ///
+ public AndonFaultRecord GetInfo(string Id)
+ {
+ var response = Queryable()
+ .Where(x => x.Id == Id)
+ .First();
+
+ return response;
+ }
+
+ ///
+ /// 添加故障记录表
+ ///
+ ///
+ ///
+ public AndonFaultRecord AddAndonFaultRecord(AndonFaultRecord model)
+ {
+ model.Id = SnowFlakeSingle.Instance.NextId().ToString();
+ if(model.StartTime>DateTime.MinValue&&model.EndTime>DateTime.MinValue)
+ {
+ TimeSpan timeDifference = model.EndTime.Value - model.StartTime.Value;
+ model.Duration = (decimal)timeDifference.TotalMinutes;
+ }
+
+ return Context.Insertable(model).ExecuteReturnEntity();
+ }
+
+ ///
+ /// 修改故障记录表
+ ///
+ ///
+ ///
+ public int UpdateAndonFaultRecord(AndonFaultRecord model)
+ {
+ if (model.StartTime > DateTime.MinValue && model.EndTime > DateTime.MinValue)
+ {
+ TimeSpan timeDifference = model.EndTime.Value - model.StartTime.Value;
+ model.Duration = (decimal)timeDifference.TotalMinutes;
+ }
+ else
+ {
+ model.Duration = 0;
+ }
+ //var response = Update(w => w.Id == model.Id, it => new AndonFaultRecord()
+ //{
+ // LineCode = model.LineCode,
+ // FaultDict = model.FaultDict,
+ // FaultContext = model.FaultContext,
+ // StartTime = model.StartTime,
+ // EndTime = model.EndTime,
+ // Duration = model.Duration,
+ // AskPerson = model.AskPerson,
+ // ResponsePerson = model.ResponsePerson,
+ // 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/ZR.Service/MES/andon/IService/IAndonFaultRecordService.cs b/ZR.Service/MES/andon/IService/IAndonFaultRecordService.cs
new file mode 100644
index 0000000..7b607b4
--- /dev/null
+++ b/ZR.Service/MES/andon/IService/IAndonFaultRecordService.cs
@@ -0,0 +1,25 @@
+using System;
+using ZR.Model;
+using ZR.Model.Dto;
+using ZR.Model.MES.andon;
+using ZR.Model.MES.andon.Dto;
+
+using System.Collections.Generic;
+
+namespace ZR.Service.MES.andon.IService
+{
+ ///
+ /// 故障记录表service接口
+ ///
+ public interface IAndonFaultRecordService : IBaseService
+ {
+ PagedInfo GetList(AndonFaultRecordQueryDto parm);
+
+ AndonFaultRecord GetInfo(string Id);
+
+ AndonFaultRecord AddAndonFaultRecord(AndonFaultRecord parm);
+
+ int UpdateAndonFaultRecord(AndonFaultRecord parm);
+
+ }
+}
diff --git a/ZR.Service/ZR.Service.csproj b/ZR.Service/ZR.Service.csproj
index eef146c..4aeb1ae 100644
--- a/ZR.Service/ZR.Service.csproj
+++ b/ZR.Service/ZR.Service.csproj
@@ -17,8 +17,5 @@
-
-
-