From 8d2f9cc3acddf67b7ccbefba9dbc92245d49b216 Mon Sep 17 00:00:00 2001
From: zhou keda <1315948824@qq.com>
Date: Mon, 9 Sep 2024 15:51:51 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=BB=B4=E4=BF=AE=E8=AE=B0?=
=?UTF-8?q?=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Dto/EqpRepairRecordOutput.cs | 171 ++++++++++++++++++
.../Entity/EqpRepairApply.cs | 5 +
.../Tnb.EquipMgr/EqpRepairApplyService.cs | 1 +
.../Tnb.EquipMgr/EqpRepairReocrdService.cs | 110 +++++++++++
4 files changed, 287 insertions(+)
create mode 100644 EquipMgr/Tnb.EquipMgr.Entities/Dto/EqpRepairRecordOutput.cs
create mode 100644 EquipMgr/Tnb.EquipMgr/EqpRepairReocrdService.cs
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/EqpRepairRecordOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EqpRepairRecordOutput.cs
new file mode 100644
index 00000000..c2536150
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EqpRepairRecordOutput.cs
@@ -0,0 +1,171 @@
+namespace Tnb.EquipMgr.Entities.Dto
+{
+ public class EqpRepairRecordOutput
+ {
+ public string id { get; set; }
+ ///
+ /// 创建时间
+ ///
+ public string? create_time { get; set; }
+
+ ///
+ /// 创建用户
+ ///
+ public string? create_id { get; set; }
+
+ ///
+ /// 修改时间
+ ///
+ public string? modify_time { get; set; }
+
+ ///
+ /// 修改用户
+ ///
+ public string? modify_id { get; set; }
+
+ ///
+ /// 申请编码
+ ///
+ public string? code { get; set; }
+
+ ///
+ /// 申请名称
+ ///
+ public string? name { get; set; }
+
+ ///
+ /// 设备ID
+ ///
+ public string? equip_id { get; set; }
+
+ ///
+ /// 申请用户ID
+ ///
+ public string? apply_user_id { get; set; }
+
+ ///
+ /// 故障ID
+ ///
+ public string? fault_id { get; set; }
+
+ ///
+ /// 期望完成时间
+ ///
+ public string? expect_complete_time { get; set; }
+
+ ///
+ /// 是否紧急
+ ///
+ public int? is_ugent { get; set; }
+
+ ///
+ /// 现象描述
+ ///
+ public string? description { get; set; }
+
+ ///
+ /// 状态
+ ///
+ public string status { get; set; } = string.Empty;
+
+ ///
+ /// 原因
+ ///
+ public string? reason { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string? remark { get; set; }
+
+ ///
+ /// 是否启用
+ ///
+ public int? enabled { get; set; }
+
+ ///
+ /// 所属组织
+ ///
+ public string? org_id { get; set; }
+
+ ///
+ /// 是否外修
+ ///
+ public int? is_out_apply { get; set; }
+
+ ///
+ /// 安装位置
+ ///
+ public string? installation_position { get; set; }
+
+ ///
+ /// 是否完成
+ ///
+ public string? is_complete { get; set; }
+
+ ///
+ /// 完成时间
+ ///
+ public string? complete_time { get; set; }
+
+ ///
+ /// 维修耗时
+ ///
+ public int? repair_take_time { get; set; }
+
+ ///
+ /// 是否停机
+ ///
+ public int? is_halt { get; set; }
+
+ ///
+ /// 停机时长
+ ///
+ public int? halt_take_time { get; set; }
+
+ ///
+ /// 维修描述
+ ///
+ public string? repair_description { get; set; }
+
+ ///
+ /// 维修人id/责任人id
+ ///
+ public string? repairer_id { get; set; }
+
+ ///
+ /// 附件
+ ///
+ public string? attachment { get; set; }
+
+ ///
+ /// 维修图片
+ ///
+ public string? repair_img { get; set; }
+
+ ///
+ /// 生产任务单id
+ ///
+ public string? mo_task_id { get; set; }
+
+ ///
+ /// 生产任务单号
+ ///
+ public string? mo_task_code { get; set; }
+
+ ///
+ /// 复核结果
+ ///
+ public string repeat_result { get; set; }
+
+ ///
+ /// 复核描述
+ ///
+ public string repeat_descrip { get; set; } = string.Empty;
+
+ ///
+ /// 接受时间
+ ///
+ public string? receive_time { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairApply.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairApply.cs
index da1c3e43..88bb192a 100644
--- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairApply.cs
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairApply.cs
@@ -173,5 +173,10 @@ public partial class EqpRepairApply : BaseEntity
/// 复核描述
///
public string repeat_descrip { get; set; } = string.Empty;
+
+ ///
+ /// 接收时间
+ ///
+ public DateTime? receive_time { get; set; }
}
diff --git a/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs b/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs
index c416c3f9..a7fa73ed 100644
--- a/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs
+++ b/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs
@@ -202,6 +202,7 @@ namespace Tnb.EquipMgr
{
repairer_id = _userManager.UserId,
status = RepairApplyStatus.RECEIVED,
+ receive_time = DateTime.Now,
}, x => x.id == id);
return "接收成功";
}else
diff --git a/EquipMgr/Tnb.EquipMgr/EqpRepairReocrdService.cs b/EquipMgr/Tnb.EquipMgr/EqpRepairReocrdService.cs
new file mode 100644
index 00000000..e5a49c09
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr/EqpRepairReocrdService.cs
@@ -0,0 +1,110 @@
+using JNPF.Common.Core.Manager;
+using JNPF.Common.Dtos.VisualDev;
+using JNPF.Common.Filter;
+using JNPF.DependencyInjection;
+using JNPF.DynamicApiController;
+using JNPF.FriendlyException;
+using JNPF.JsonSerialization;
+using JNPF.Systems.Entitys.Permission;
+using JNPF.Systems.Entitys.System;
+using JNPF.Systems.Interfaces.System;
+using JNPF.VisualDev;
+using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
+using JNPF.VisualDev.Interfaces;
+using Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json;
+using SQLitePCL;
+using SqlSugar;
+using Tnb.BasicData;
+using Tnb.EquipMgr.Entities;
+using Tnb.EquipMgr.Entities.Dto;
+using Tnb.EquipMgr.Interfaces;
+
+namespace Tnb.EquipMgr
+{
+ ///
+ /// 设备维修记录
+ ///
+ [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
+ [Route("api/[area]/[controller]/[action]")]
+ [OverideVisualDev(ModuleId)]
+ public class EqpRepairRecordService : IOverideVisualDevService, IDynamicApiController, ITransient
+ {
+ private const string ModuleId = "36783468797205";
+ private readonly ISqlSugarRepository _repository;
+ private readonly IVisualDevService _visualDevService;
+ private readonly IRunService _runService;
+ private readonly IBillRullService _billRuleService;
+ private readonly IUserManager _userManager;
+
+ private readonly Dictionary _dic = new Dictionary()
+ {
+ [RepairApplyStatus.TOBEEXECUTED] = "待执行",
+ [RepairApplyStatus.TOBERECEIVED] = "待接收",
+ [RepairApplyStatus.RECEIVED] = "已接收",
+ [RepairApplyStatus.REFUSE] = "拒绝",
+ [RepairApplyStatus.REPAIRED] = "已维修",
+ [RepairApplyStatus.COMPLETED] = "已完成",
+ [RepairApplyStatus.OUTAPPLYAPPROVE] = "外修申请待审批",
+ [RepairApplyStatus.APPROVEPASS] = "审批通过",
+ [RepairApplyStatus.APPROVENOTPASS] = "审批拒绝",
+ [RepairApplyStatus.CLOSE] = "已关闭",
+ [RepairApplyStatus.REPEAL] = "已作废",
+ [RepairApplyStatus.TOBEOUTAPPLY] = "申请外修",
+ [RepairApplyStatus.REPEATCHECKING] = "复核中",
+ };
+
+ public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
+
+ public EqpRepairRecordService(ISqlSugarRepository repository,
+ IVisualDevService visualDevService,
+ IRunService runService,
+ IBillRullService billRullService,
+ IUserManager userManager)
+ {
+ _repository = repository;
+ _visualDevService = visualDevService;
+ _runService = runService;
+ _userManager = userManager;
+ _billRuleService = billRullService;
+ OverideFuncs.GetListAsync = GetList;
+ }
+
+ private async Task GetList(VisualDevModelListQueryInput input)
+ {
+ ISqlSugarClient db = _repository.AsSugarClient();
+ Dictionary? queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary();
+ string code = queryJson.ContainsKey("code") ? queryJson["code"].ToString() : "";
+ string equipId = queryJson.ContainsKey("equip_id") ? queryJson["equip_id"].ToString() : "";
+ SqlSugarPagedList result = await db.Queryable()
+ .LeftJoin((a,b)=>a.apply_user_id==b.Id)
+ .LeftJoin((a,b,c)=>a.repairer_id==c.Id)
+ .LeftJoin((a,b,c,d)=>a.equip_id==d.id)
+ .WhereIF(!string.IsNullOrEmpty(code), (a, b, c) => a.code.Contains(code))
+ .WhereIF(!string.IsNullOrEmpty(equipId), (a, b, c,d) => a.equip_id==equipId)
+ .OrderByDescending(a => a.create_time)
+ .Select((a, b, c,d) => new EqpRepairRecordOutput
+ {
+ id = a.id,
+ code = a.code,
+ name = a.name,
+ equip_id = d.name,
+ apply_user_id = b.RealName,
+ create_time = a.create_time==null ? "" : a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
+ repairer_id = c.RealName,
+ receive_time = a.receive_time==null ? "" : a.receive_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
+ description = a.description,
+ complete_time = a.complete_time==null ? "" : a.complete_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
+ halt_take_time = a.halt_take_time,
+ repair_take_time = a.repair_take_time,
+ status = a.status
+ })
+ .Mapper(a =>
+ {
+ a.status = _dic[a.status];
+ })
+ .ToPagedListAsync(input.currentPage, input.pageSize);
+ return PageResult.SqlSugarPageResult(result);
+ }
+ }
+}
\ No newline at end of file