设备维修记录
This commit is contained in:
171
EquipMgr/Tnb.EquipMgr.Entities/Dto/EqpRepairRecordOutput.cs
Normal file
171
EquipMgr/Tnb.EquipMgr.Entities/Dto/EqpRepairRecordOutput.cs
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
namespace Tnb.EquipMgr.Entities.Dto
|
||||||
|
{
|
||||||
|
public class EqpRepairRecordOutput
|
||||||
|
{
|
||||||
|
public string id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
public string? create_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建用户
|
||||||
|
/// </summary>
|
||||||
|
public string? create_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改时间
|
||||||
|
/// </summary>
|
||||||
|
public string? modify_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改用户
|
||||||
|
/// </summary>
|
||||||
|
public string? modify_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 申请编码
|
||||||
|
/// </summary>
|
||||||
|
public string? code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 申请名称
|
||||||
|
/// </summary>
|
||||||
|
public string? name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备ID
|
||||||
|
/// </summary>
|
||||||
|
public string? equip_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 申请用户ID
|
||||||
|
/// </summary>
|
||||||
|
public string? apply_user_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 故障ID
|
||||||
|
/// </summary>
|
||||||
|
public string? fault_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 期望完成时间
|
||||||
|
/// </summary>
|
||||||
|
public string? expect_complete_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否紧急
|
||||||
|
/// </summary>
|
||||||
|
public int? is_ugent { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 现象描述
|
||||||
|
/// </summary>
|
||||||
|
public string? description { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态
|
||||||
|
/// </summary>
|
||||||
|
public string status { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 原因
|
||||||
|
/// </summary>
|
||||||
|
public string? reason { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
public string? remark { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否启用
|
||||||
|
/// </summary>
|
||||||
|
public int? enabled { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 所属组织
|
||||||
|
/// </summary>
|
||||||
|
public string? org_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否外修
|
||||||
|
/// </summary>
|
||||||
|
public int? is_out_apply { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 安装位置
|
||||||
|
/// </summary>
|
||||||
|
public string? installation_position { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否完成
|
||||||
|
/// </summary>
|
||||||
|
public string? is_complete { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 完成时间
|
||||||
|
/// </summary>
|
||||||
|
public string? complete_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 维修耗时
|
||||||
|
/// </summary>
|
||||||
|
public int? repair_take_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否停机
|
||||||
|
/// </summary>
|
||||||
|
public int? is_halt { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 停机时长
|
||||||
|
/// </summary>
|
||||||
|
public int? halt_take_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 维修描述
|
||||||
|
/// </summary>
|
||||||
|
public string? repair_description { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 维修人id/责任人id
|
||||||
|
/// </summary>
|
||||||
|
public string? repairer_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 附件
|
||||||
|
/// </summary>
|
||||||
|
public string? attachment { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 维修图片
|
||||||
|
/// </summary>
|
||||||
|
public string? repair_img { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生产任务单id
|
||||||
|
/// </summary>
|
||||||
|
public string? mo_task_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生产任务单号
|
||||||
|
/// </summary>
|
||||||
|
public string? mo_task_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 复核结果
|
||||||
|
/// </summary>
|
||||||
|
public string repeat_result { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 复核描述
|
||||||
|
/// </summary>
|
||||||
|
public string repeat_descrip { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 接受时间
|
||||||
|
/// </summary>
|
||||||
|
public string? receive_time { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -174,4 +174,9 @@ public partial class EqpRepairApply : BaseEntity<string>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string repeat_descrip { get; set; } = string.Empty;
|
public string repeat_descrip { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 接收时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? receive_time { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,6 +202,7 @@ namespace Tnb.EquipMgr
|
|||||||
{
|
{
|
||||||
repairer_id = _userManager.UserId,
|
repairer_id = _userManager.UserId,
|
||||||
status = RepairApplyStatus.RECEIVED,
|
status = RepairApplyStatus.RECEIVED,
|
||||||
|
receive_time = DateTime.Now,
|
||||||
}, x => x.id == id);
|
}, x => x.id == id);
|
||||||
return "接收成功";
|
return "接收成功";
|
||||||
}else
|
}else
|
||||||
|
|||||||
110
EquipMgr/Tnb.EquipMgr/EqpRepairReocrdService.cs
Normal file
110
EquipMgr/Tnb.EquipMgr/EqpRepairReocrdService.cs
Normal file
@@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 设备维修记录
|
||||||
|
/// </summary>
|
||||||
|
[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<EqpRepairApply> _repository;
|
||||||
|
private readonly IVisualDevService _visualDevService;
|
||||||
|
private readonly IRunService _runService;
|
||||||
|
private readonly IBillRullService _billRuleService;
|
||||||
|
private readonly IUserManager _userManager;
|
||||||
|
|
||||||
|
private readonly Dictionary<string, string> _dic = new Dictionary<string, string>()
|
||||||
|
{
|
||||||
|
[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<EqpRepairApply> 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<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||||
|
{
|
||||||
|
ISqlSugarClient db = _repository.AsSugarClient();
|
||||||
|
Dictionary<string, string>? queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson) : new Dictionary<string, string>();
|
||||||
|
string code = queryJson.ContainsKey("code") ? queryJson["code"].ToString() : "";
|
||||||
|
string equipId = queryJson.ContainsKey("equip_id") ? queryJson["equip_id"].ToString() : "";
|
||||||
|
SqlSugarPagedList<EqpRepairRecordOutput> result = await db.Queryable<EqpRepairApply>()
|
||||||
|
.LeftJoin<UserEntity>((a,b)=>a.apply_user_id==b.Id)
|
||||||
|
.LeftJoin<UserEntity>((a,b,c)=>a.repairer_id==c.Id)
|
||||||
|
.LeftJoin<EqpEquipment>((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<EqpRepairRecordOutput>.SqlSugarPageResult(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user