设备档案
This commit is contained in:
@@ -11,6 +11,10 @@ public static class DictConst
|
||||
/// 区域类型-工位Code
|
||||
/// </summary>
|
||||
public const string RegionCategoryStationCode = "workstation";
|
||||
/// <summary>
|
||||
/// 备品备件类型
|
||||
/// </summary>
|
||||
public const string SparePartsType = "SparePartsType";
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
14
EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipFileQueryOutput.cs
Normal file
14
EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipFileQueryOutput.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace Tnb.EquipMgr.Entities.Dto
|
||||
{
|
||||
public class EquipFileQueryOutput
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string attachment { get; set; }
|
||||
public string create_id { get; set; }
|
||||
public string create_id_id { get; set; }
|
||||
public string create_time { get; set; }
|
||||
public string equip_id { get; set; }
|
||||
public string equip_id_id { get; set; }
|
||||
public string file_name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace Tnb.EquipMgr.Entities.Dto
|
||||
{
|
||||
public class EquipMaintainRecordQueryOutput
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string attachment { get; set; }
|
||||
public string create_time { get; set; }
|
||||
public string equip_id { get; set; }
|
||||
public string equip_id_id { get; set; }
|
||||
public string execute_time { get; set; }
|
||||
public string execute_user_id { get; set; }
|
||||
public string repeat_remark { get; set; }
|
||||
public string repeat_result { get; set; }
|
||||
public string repeat_time { get; set; }
|
||||
public string repeat_user_id { get; set; }
|
||||
public string result { get; set; }
|
||||
public string result_remark { get; set; }
|
||||
public string maintain_tem_equip_id { get; set; }
|
||||
public string status { get; set; }
|
||||
}
|
||||
}
|
||||
19
EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipQueryInput.cs
Normal file
19
EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipQueryInput.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace Tnb.EquipMgr.Entities.Dto
|
||||
{
|
||||
public class EquipQueryInput
|
||||
{
|
||||
public string equip_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前页码:pageIndex.
|
||||
/// </summary>
|
||||
public virtual int currentPage { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 每页行数.
|
||||
/// </summary>
|
||||
public virtual int pageSize { get; set; } = 50;
|
||||
|
||||
public string queryJson { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace Tnb.EquipMgr.Entities.Dto
|
||||
{
|
||||
public class EquipRepairRecordQueryOutput
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string code { get; set; }
|
||||
public string name { get; set; }
|
||||
public string equip_id { get; set; }
|
||||
public string apply_user_id { get; set; }
|
||||
public string is_ugent { get; set; }
|
||||
public string description { get; set; }
|
||||
public string complete_time { get; set; }
|
||||
public string repairer_id { get; set; }
|
||||
public string repair_description { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Tnb.EquipMgr.Entities.Dto
|
||||
{
|
||||
public class EquipSparePartsInput
|
||||
{
|
||||
public string equip_id { get; set; }
|
||||
|
||||
public List<string> spare_parts_ids { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Tnb.EquipMgr.Entities.Dto
|
||||
{
|
||||
public class EquipSparePartsQueryOutput
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string type_code { get; set; }
|
||||
public string type_name { get; set; }
|
||||
public string code { get; set; }
|
||||
public string name { get; set; }
|
||||
public string specification { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace Tnb.EquipMgr.Entities.Dto
|
||||
{
|
||||
public class EquipSpotInsRecordQueryOutput
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string attachment { get; set; }
|
||||
public string create_time { get; set; }
|
||||
public string equip_id { get; set; }
|
||||
public string repeat_remark { get; set; }
|
||||
public string repeat_result { get; set; }
|
||||
public string repeat_time { get; set; }
|
||||
public string repeat_user_id { get; set; }
|
||||
public string result { get; set; }
|
||||
public string result_remark { get; set; }
|
||||
public string spot_ins_tem_equip_id { get; set; }
|
||||
public string spot_record_date_time { get; set; }
|
||||
public string spot_record_user_id { get; set; }
|
||||
public string status { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace Tnb.EquipMgr.Entities.Dto
|
||||
{
|
||||
public class EquipTechnologyParameterQueryOutput
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string definition { get; set; }
|
||||
public string remark { get; set; }
|
||||
}
|
||||
}
|
||||
18
EquipMgr/Tnb.EquipMgr.Entities/Dto/SubEquipQueryOutput.cs
Normal file
18
EquipMgr/Tnb.EquipMgr.Entities/Dto/SubEquipQueryOutput.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace Tnb.EquipMgr.Entities.Dto
|
||||
{
|
||||
public class SubEquipQueryOutput
|
||||
{
|
||||
public string code { get; set; }
|
||||
public string create_id { get; set; }
|
||||
public string create_id_id { get; set; }
|
||||
public string create_time { get; set; }
|
||||
public string equip_id { get; set; }
|
||||
public string equip_id_id { get; set; }
|
||||
public string id { get; set; }
|
||||
public string modify_id { get; set; }
|
||||
public string modify_time { get; set; }
|
||||
public string name { get; set; }
|
||||
public string org_id { get; set; }
|
||||
public string specification { get; set; }
|
||||
}
|
||||
}
|
||||
52
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpEquipSpareParts.cs
Normal file
52
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpEquipSpareParts.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.EquipMgr.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 设备备品备件关联表
|
||||
/// </summary>
|
||||
[SugarTable("eqp_equip_spare_parts")]
|
||||
public partial class EqpEquipSpareParts : BaseEntity<string>
|
||||
{
|
||||
public EqpEquipSpareParts()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 设备id
|
||||
/// </summary>
|
||||
public string equip_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 备品备件id
|
||||
/// </summary>
|
||||
public string spare_parts_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string? create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? create_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
/// </summary>
|
||||
public string? modify_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属组织
|
||||
/// </summary>
|
||||
public string? org_id { get; set; }
|
||||
|
||||
}
|
||||
67
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpareParts.cs
Normal file
67
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpareParts.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.EquipMgr.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 备品备件
|
||||
/// </summary>
|
||||
[SugarTable("eqp_spare_parts")]
|
||||
public partial class EqpSpareParts : BaseEntity<string>
|
||||
{
|
||||
public EqpSpareParts()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 类型id
|
||||
/// </summary>
|
||||
public string type_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
public string code { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 规格型号
|
||||
/// </summary>
|
||||
public string? specification { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string? create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? create_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
/// </summary>
|
||||
public string? modify_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属组织
|
||||
/// </summary>
|
||||
public string? org_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? remark { get; set; }
|
||||
|
||||
}
|
||||
62
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSubEquip.cs
Normal file
62
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSubEquip.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.EquipMgr.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 设备子设备关联表
|
||||
/// </summary>
|
||||
[SugarTable("eqp_sub_equip")]
|
||||
public partial class EqpSubEquip : BaseEntity<string>
|
||||
{
|
||||
public EqpSubEquip()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
public string code { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 规格型号
|
||||
/// </summary>
|
||||
public string? specification { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string? create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? create_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
/// </summary>
|
||||
public string? modify_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属组织
|
||||
/// </summary>
|
||||
public string? org_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备id
|
||||
/// </summary>
|
||||
public string equip_id { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.EquipMgr.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 设备技术参数
|
||||
/// </summary>
|
||||
[SugarTable("eqp_technology_parameter")]
|
||||
public partial class EqpTechnologyParameter : BaseEntity<string>
|
||||
{
|
||||
public EqpTechnologyParameter()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 定义
|
||||
/// </summary>
|
||||
public string definition { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string? create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? create_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
/// </summary>
|
||||
public string? modify_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属组织
|
||||
/// </summary>
|
||||
public string? org_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备id
|
||||
/// </summary>
|
||||
public string equip_id { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
@@ -11,5 +11,11 @@ namespace Tnb.EquipMgr.Interfaces
|
||||
///// <param name="file"></param>
|
||||
///// <returns></returns>
|
||||
//public Task<string> Upload(string equip_id,IFormFile file);
|
||||
|
||||
/// <summary>
|
||||
/// 根据设备id获取设备附件
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> GetEquipFileList(EquipQueryInput input);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
|
||||
namespace Tnb.EquipMgr.Interfaces
|
||||
{
|
||||
public interface IEqpEquipSparePartsService
|
||||
{
|
||||
/// <summary>
|
||||
/// 新增备品备件
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public Task AddEquipSpareParts(EquipSparePartsInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 根据设备id获取备品备件
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> GetEquipSparePartsList(EquipQueryInput input);
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,12 @@ namespace Tnb.EquipMgr.Interfaces
|
||||
/// <param name="pageInput"></param>
|
||||
/// <returns></returns>
|
||||
public Task<string> RepeatMaintain(MaintainRecordRepeatInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 根据设备id获取设备保养记录
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> GetMaintainRecordList(EquipQueryInput input);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -53,5 +53,11 @@ namespace Tnb.EquipMgr.Interfaces
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
public Task<RepairApplyDetailOutput> GetRepairApplyDetail(Dictionary<string, string> dic);
|
||||
|
||||
/// <summary>
|
||||
/// 根据设备id获取维修记录
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> GetRepairRecordList(EquipQueryInput input);
|
||||
}
|
||||
}
|
||||
13
EquipMgr/Tnb.EquipMgr.Interfaces/IEqpSubEquipService.cs
Normal file
13
EquipMgr/Tnb.EquipMgr.Interfaces/IEqpSubEquipService.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
|
||||
namespace Tnb.EquipMgr.Interfaces
|
||||
{
|
||||
public interface IEqpSubEquipService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据设备id获取子设备
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> GetSubEquipList(EquipQueryInput input);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
namespace Tnb.EquipMgr.Interfaces
|
||||
{
|
||||
public interface IEqpTechnologyParameterService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据设备id获取技术参数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> GetEquipTechnologyParameterList(EquipQueryInput input);
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,12 @@ namespace Tnb.EquipMgr.Interfaces
|
||||
/// <param name="pageInput"></param>
|
||||
/// <returns></returns>
|
||||
public Task RepeatSpotIns(SpotInsRecordRepeatInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 根据设备id获取点巡检记录
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> GetSpotInsRecordList(EquipQueryInput input);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,14 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Models;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Logging;
|
||||
using JNPF.Systems.Common;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Interfaces.Common;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
@@ -56,7 +58,8 @@ namespace Tnb.EquipMgr
|
||||
equip_id = equip_id,
|
||||
create_id = _userManager.UserId,
|
||||
create_time = DateTime.Now,
|
||||
attachment = JsonConvert.SerializeObject(attachment)
|
||||
attachment = JsonConvert.SerializeObject(attachment),
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
};
|
||||
|
||||
await _repository.InsertAsync(eqpEquipFile);
|
||||
@@ -71,5 +74,35 @@ namespace Tnb.EquipMgr
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetEquipFileList(EquipQueryInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
Dictionary<string, string> queryJson = new Dictionary<string, string>();
|
||||
if (!string.IsNullOrEmpty(input.queryJson))
|
||||
{
|
||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson);
|
||||
}
|
||||
var result = await db.Queryable<EqpEquipFile>()
|
||||
.LeftJoin<UserEntity >((a, b) => a.create_id == b.Id)
|
||||
.LeftJoin<UserEntity >((a, b,c) => a.modify_id == c.Id)
|
||||
.LeftJoin<EqpEquipment >((a, b,c,d) => a.equip_id == d.id)
|
||||
.Where((a,b,c,d)=>a.equip_id==input.equip_id)
|
||||
.WhereIF(queryJson.ContainsKey("file_name"),(a,b,c,d)=>a.file_name.Contains(queryJson["file_name"]))
|
||||
.Select((a, b, c,d) => new EquipFileQueryOutput
|
||||
{
|
||||
id = a.id,
|
||||
attachment = a.attachment,
|
||||
create_id = b.RealName,
|
||||
create_id_id = a.create_id,
|
||||
create_time = a.create_time.Value.ToString("yyyy-MM-dd"),
|
||||
equip_id=d.name,
|
||||
equip_id_id= a.equip_id,
|
||||
file_name=a.file_name,
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
return PageResult<EquipFileQueryOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
85
EquipMgr/Tnb.EquipMgr/EqpEquipSparePartsService.cs
Normal file
85
EquipMgr/Tnb.EquipMgr/EqpEquipSparePartsService.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
{
|
||||
/// 设备备品备件
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
public class EqpEquipSparePartsService : IEqpEquipSparePartsService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<EqpEquipSpareParts> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
public EqpEquipSparePartsService(ISqlSugarRepository<EqpEquipSpareParts> repository, IUserManager userManager)
|
||||
{
|
||||
_userManager = userManager;
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task AddEquipSpareParts(EquipSparePartsInput input)
|
||||
{
|
||||
List<EqpEquipSpareParts> oldList = await _repository.GetListAsync(x => x.equip_id == input.equip_id);
|
||||
List<EqpEquipSpareParts> list = new List<EqpEquipSpareParts>();
|
||||
string orgId = _userManager.GetUserInfo().Result.organizeId;
|
||||
foreach (var spare_parts_id in input.spare_parts_ids)
|
||||
{
|
||||
if (oldList.Any(x => x.spare_parts_id == spare_parts_id))
|
||||
continue;
|
||||
list.Add(new EqpEquipSpareParts()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId(),
|
||||
equip_id = input.equip_id,
|
||||
spare_parts_id = spare_parts_id,
|
||||
create_id = _userManager.UserId,
|
||||
create_time = DateTime.Now,
|
||||
org_id = orgId,
|
||||
});
|
||||
}
|
||||
|
||||
await _repository.InsertRangeAsync(list);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetEquipSparePartsList(EquipQueryInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
Dictionary<string, string> queryJson = new Dictionary<string, string>();
|
||||
if (!string.IsNullOrEmpty(input.queryJson))
|
||||
{
|
||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson);
|
||||
}
|
||||
var result = await db.Queryable<EqpEquipSpareParts>()
|
||||
.LeftJoin<EqpSpareParts>((a,b)=>a.spare_parts_id==b.id)
|
||||
.LeftJoin<DictionaryTypeEntity>((a, b, c) => c.EnCode == Tnb.BasicData.DictConst.SparePartsType && c.DeleteMark == null)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b,c,d) => d.DictionaryTypeId == c.Id && b.type_id == d.EnCode)
|
||||
.Where((a,b,c,d)=>a.equip_id==input.equip_id)
|
||||
.WhereIF(queryJson.ContainsKey("code"),(a,b,c,d)=>b.code.Contains(queryJson["code"]))
|
||||
.WhereIF(queryJson.ContainsKey("name"),(a,b,c,d)=>b.name.Contains(queryJson["name"]))
|
||||
.Select((a, b, c,d) => new EquipSparePartsQueryOutput
|
||||
{
|
||||
id = a.id,
|
||||
type_code = d.EnCode,
|
||||
type_name = d.FullName,
|
||||
code = b.code,
|
||||
name = b.name,
|
||||
specification = b.specification
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
return PageResult<EquipSparePartsQueryOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
@@ -129,5 +132,35 @@ namespace Tnb.EquipMgr
|
||||
eqpRepairOutApply = eqpRepairOutApply,
|
||||
};
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetRepairRecordList(EquipQueryInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
Dictionary<string, string> queryJson = new Dictionary<string, string>();
|
||||
if (!string.IsNullOrEmpty(input.queryJson))
|
||||
{
|
||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson);
|
||||
}
|
||||
var 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)
|
||||
.Where(a=>a.equip_id==input.equip_id)
|
||||
.Select((a,b,c) => new EquipRepairRecordQueryOutput
|
||||
{
|
||||
id = a.id,
|
||||
equip_id = a.equip_id,
|
||||
code = a.code,
|
||||
name = a.name,
|
||||
apply_user_id =b.RealName,
|
||||
is_ugent = a.is_ugent==1 ? "是" : "否",
|
||||
description = a.description,
|
||||
repair_description = a.repair_description,
|
||||
complete_time = a.complete_time.Value.ToString("yyyy-MM-dd HH:mm"),
|
||||
repairer_id = c.RealName
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
return PageResult<EquipRepairRecordQueryOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,6 @@ namespace Tnb.EquipMgr
|
||||
|
||||
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
|
||||
//todo 退回流程
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
if (string.IsNullOrEmpty(input.id))
|
||||
|
||||
67
EquipMgr/Tnb.EquipMgr/EqpSubEquipService.cs
Normal file
67
EquipMgr/Tnb.EquipMgr/EqpSubEquipService.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
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]")]
|
||||
public class EqpSubEquipService : IEqpSubEquipService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<EqpSubEquip> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
public EqpSubEquipService(ISqlSugarRepository<EqpSubEquip> repository,
|
||||
IUserManager userManager)
|
||||
{
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetSubEquipList(EquipQueryInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
Dictionary<string, string> queryJson = new Dictionary<string, string>();
|
||||
if (!string.IsNullOrEmpty(input.queryJson))
|
||||
{
|
||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson);
|
||||
}
|
||||
var result = await db.Queryable<EqpSubEquip>()
|
||||
.LeftJoin<UserEntity >((a, b) => a.create_id == b.Id)
|
||||
.LeftJoin<UserEntity >((a, b,c) => a.modify_id == c.Id)
|
||||
.LeftJoin<EqpEquipment >((a, b,c,d) => a.equip_id == d.id)
|
||||
.Where((a,b,c,d)=>a.equip_id==input.equip_id)
|
||||
.WhereIF(queryJson.ContainsKey("code"),(a,b,c,d)=>a.code.Contains(queryJson["code"]))
|
||||
.WhereIF(queryJson.ContainsKey("name"),(a,b,c,d)=>a.name.Contains(queryJson["name"]))
|
||||
.Select((a, b, c,d) => new SubEquipQueryOutput
|
||||
{
|
||||
id = a.id,
|
||||
create_id = b.RealName,
|
||||
create_id_id = a.create_id,
|
||||
create_time = a.create_time.Value.ToString("yyyy-MM-dd"),
|
||||
equip_id=d.name,
|
||||
equip_id_id= a.equip_id,
|
||||
code = a.code,
|
||||
modify_id = c.RealName,
|
||||
modify_time = a.modify_time.Value.ToString("yyyy-MM-dd"),
|
||||
name = a.name,
|
||||
org_id = a.org_id,
|
||||
specification = a.specification,
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
return PageResult<SubEquipQueryOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
52
EquipMgr/Tnb.EquipMgr/EqpTechnologyParameterService.cs
Normal file
52
EquipMgr/Tnb.EquipMgr/EqpTechnologyParameterService.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
{
|
||||
/// 设备备品备件
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
public class EqpTechnologyParameterService : IEqpTechnologyParameterService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<EqpTechnologyParameter> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
public EqpTechnologyParameterService(ISqlSugarRepository<EqpTechnologyParameter> repository, IUserManager userManager)
|
||||
{
|
||||
_userManager = userManager;
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetEquipTechnologyParameterList(EquipQueryInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
Dictionary<string, string> queryJson = new Dictionary<string, string>();
|
||||
if (!string.IsNullOrEmpty(input.queryJson))
|
||||
{
|
||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson);
|
||||
}
|
||||
var result = await db.Queryable<EqpTechnologyParameter>()
|
||||
.Where(a=>a.equip_id==input.equip_id)
|
||||
.WhereIF(queryJson.ContainsKey("name"),a=>a.name.Contains(queryJson["name"]))
|
||||
.Select(a => new EquipTechnologyParameterQueryOutput
|
||||
{
|
||||
id = a.id,
|
||||
name = a.name,
|
||||
definition = a.definition,
|
||||
remark = a.remark
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
return PageResult<EquipTechnologyParameterQueryOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
@@ -142,5 +144,41 @@ namespace Tnb.EquipMgr
|
||||
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result.IsSuccess ? "复核成功" : result.ErrorMessage;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetMaintainRecordList(EquipQueryInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
Dictionary<string, string> queryJson = new Dictionary<string, string>();
|
||||
if (!string.IsNullOrEmpty(input.queryJson))
|
||||
{
|
||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson);
|
||||
}
|
||||
var result = await db.Queryable<EqpMaintainRecordH>()
|
||||
.LeftJoin<EqpEquipment>((a,b)=>a.equip_id==b.id)
|
||||
.LeftJoin<UserEntity>((a,b,c)=>a.execute_user_id==c.Id)
|
||||
.LeftJoin<UserEntity>((a,b,c,d)=>a.repeat_user_id==d.Id)
|
||||
.Where(a=>a.equip_id==input.equip_id)
|
||||
.Select((a,b,c,d) => new EquipMaintainRecordQueryOutput
|
||||
{
|
||||
id = a.id,
|
||||
attachment = a.attachment,
|
||||
create_time = a.create_time.Value.ToString("yyyy-MM-dd HH:mm"),
|
||||
equip_id = b.code,
|
||||
equip_id_id = a.equip_id,
|
||||
repeat_remark = a.repeat_remark,
|
||||
repeat_result = a.repeat_result=="1"?"合格":"不合格",
|
||||
repeat_time = a.repeat_time.Value.ToString("yyyy-MM-dd HH:mm"),
|
||||
repeat_user_id = d.RealName,
|
||||
result = a.result=="1"?"合格":"不合格",
|
||||
result_remark = a.result_remark,
|
||||
maintain_tem_equip_id = a.maintain_tem_equip_id,
|
||||
execute_time = a.execute_time.Value.ToString("yyyy-MM-dd HH:mm"),
|
||||
execute_user_id = c.RealName,
|
||||
status = SqlFunc.IF(a.status.Equals("1")).Return("待执行").ElseIF(a.status.Equals("2")).Return("待复核").ElseIF(a.status.Equals("3")).Return("已完成").End("")
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
return PageResult<EquipMaintainRecordQueryOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
@@ -126,5 +128,38 @@ namespace Tnb.EquipMgr
|
||||
status = SpotInsRecordExecutionStatus.COMPLETED
|
||||
}, x => x.id == input.id);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetSpotInsRecordList(EquipQueryInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
Dictionary<string, string> queryJson = new Dictionary<string, string>();
|
||||
if (!string.IsNullOrEmpty(input.queryJson))
|
||||
{
|
||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson);
|
||||
}
|
||||
var result = await db.Queryable<EqpSpotInsRecordH>()
|
||||
.LeftJoin<UserEntity>((a,b)=>a.repeat_user_id==b.Id)
|
||||
.Where(a=>a.equip_id==input.equip_id)
|
||||
.Select((a,b) => new EquipSpotInsRecordQueryOutput
|
||||
{
|
||||
id = a.id,
|
||||
attachment = a.attachment,
|
||||
create_time = a.create_time.Value.ToString("yyyy-MM-dd HH:mm"),
|
||||
equip_id = a.equip_id,
|
||||
repeat_remark = a.repeat_remark,
|
||||
repeat_result = a.repeat_result=="1"?"合格":"不合格",
|
||||
repeat_time = a.repeat_time.Value.ToString("yyyy-MM-dd HH:mm"),
|
||||
repeat_user_id = b.RealName,
|
||||
result = a.result=="1"?"合格":"不合格",
|
||||
result_remark = a.result_remark,
|
||||
spot_ins_tem_equip_id = a.spot_ins_tem_equip_id,
|
||||
spot_record_date_time = a.spot_record_date_time.Value.ToString("yyyy-MM-dd HH:mm"),
|
||||
spot_record_user_id = a.spot_record_user_id,
|
||||
status = SqlFunc.IF(a.status.Equals("1")).Return("待执行").ElseIF(a.status.Equals("2")).Return("待复核").ElseIF(a.status.Equals("3")).Return("已完成").End("")
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
return PageResult<EquipSpotInsRecordQueryOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,7 @@ public partial class WmsCarryH : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 载具状态
|
||||
/// </summary>
|
||||
public int carry_status { get; set; };
|
||||
public int carry_status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 载具分类ID
|
||||
|
||||
Reference in New Issue
Block a user