设备保养
This commit is contained in:
@@ -5,7 +5,7 @@ using SqlSugar;
|
|||||||
namespace Tnb.EquipMgr.Entities;
|
namespace Tnb.EquipMgr.Entities;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 保养项目
|
/// 设备保养项目
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarTable("eqp_maintain_item")]
|
[SugarTable("eqp_maintain_item")]
|
||||||
public partial class EqpMaintainItem : BaseEntity<string>
|
public partial class EqpMaintainItem : BaseEntity<string>
|
||||||
@@ -34,25 +34,20 @@ public partial class EqpMaintainItem : BaseEntity<string>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string? modify_id { get; set; }
|
public string? modify_id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 设备类型
|
|
||||||
/// </summary>
|
|
||||||
public string? equip_type_id { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 项目编码
|
/// 项目编码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? item_code { get; set; }
|
public string? code { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 项目名称
|
/// 项目名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? item_name { get; set; }
|
public string? name { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 保养类型
|
/// 保养类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? maintain_type { get; set; }
|
public string maintain_type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 保养内容
|
/// 保养内容
|
||||||
@@ -74,76 +69,6 @@ public partial class EqpMaintainItem : BaseEntity<string>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int? ordinal { get; set; }
|
public int? ordinal { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否启用
|
|
||||||
/// </summary>
|
|
||||||
public int? enabled { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// TODO
|
|
||||||
/// </summary>
|
|
||||||
public string? extend01 { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// TODO
|
|
||||||
/// </summary>
|
|
||||||
public string? extend02 { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// TODO
|
|
||||||
/// </summary>
|
|
||||||
public string? extend03 { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// TODO
|
|
||||||
/// </summary>
|
|
||||||
public string? extend04 { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// TODO
|
|
||||||
/// </summary>
|
|
||||||
public string? extend05 { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// TODO
|
|
||||||
/// </summary>
|
|
||||||
public string? extend06 { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// TODO
|
|
||||||
/// </summary>
|
|
||||||
public string? extend07 { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// TODO
|
|
||||||
/// </summary>
|
|
||||||
public string? extend08 { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// TODO
|
|
||||||
/// </summary>
|
|
||||||
public string? extend09 { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// TODO
|
|
||||||
/// </summary>
|
|
||||||
public string? extend10 { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 删除用户
|
|
||||||
/// </summary>
|
|
||||||
public string? delete_id { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 删除时间
|
|
||||||
/// </summary>
|
|
||||||
public DateTime? delete_time { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 删除标志
|
|
||||||
/// </summary>
|
|
||||||
public short? deleted { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 所属组织
|
/// 所属组织
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
92
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainRecordD.cs
Normal file
92
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainRecordD.cs
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
using JNPF.Common.Contracts;
|
||||||
|
using JNPF.Common.Security;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace Tnb.EquipMgr.Entities;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备保养执行记录子表
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("eqp_maintain_record_d")]
|
||||||
|
public partial class EqpMaintainRecordD : BaseEntity<string>
|
||||||
|
{
|
||||||
|
public EqpMaintainRecordD()
|
||||||
|
{
|
||||||
|
id = SnowflakeIdHelper.NextId();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 设备保养执行记录id
|
||||||
|
/// </summary>
|
||||||
|
public string maintain_record_id { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备保养检项id
|
||||||
|
/// </summary>
|
||||||
|
public string maintain_item_id { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 编码
|
||||||
|
/// </summary>
|
||||||
|
public string? code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
public string? name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 结果 1 通过 2 不通过
|
||||||
|
/// </summary>
|
||||||
|
public string? result { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
public string? remark { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 排序
|
||||||
|
/// </summary>
|
||||||
|
public long ordinal { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备保养设备模板id
|
||||||
|
/// </summary>
|
||||||
|
public string? maintain_tem_equip_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否通过
|
||||||
|
/// </summary>
|
||||||
|
public string? is_pass { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保养项描述
|
||||||
|
/// </summary>
|
||||||
|
public string? descrip { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保养类型
|
||||||
|
/// </summary>
|
||||||
|
public string maintain_type { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保养内容
|
||||||
|
/// </summary>
|
||||||
|
public string? maintain_content { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保养结果描述
|
||||||
|
/// </summary>
|
||||||
|
public string? maintain_descrip { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 复核 1 通过 2 不通过
|
||||||
|
/// </summary>
|
||||||
|
public string? repeat_result { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 复核结果描述
|
||||||
|
/// </summary>
|
||||||
|
public string? repeat_descrip { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
167
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainRecordH.cs
Normal file
167
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainRecordH.cs
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
using JNPF.Common.Contracts;
|
||||||
|
using JNPF.Common.Security;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace Tnb.EquipMgr.Entities;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备保养执行记录主表
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("eqp_maintain_record_h")]
|
||||||
|
public partial class EqpMaintainRecordH : BaseEntity<string>
|
||||||
|
{
|
||||||
|
public EqpMaintainRecordH()
|
||||||
|
{
|
||||||
|
id = SnowflakeIdHelper.NextId();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? create_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建用户
|
||||||
|
/// </summary>
|
||||||
|
public string? create_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? modify_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改用户
|
||||||
|
/// </summary>
|
||||||
|
public string? modify_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备id
|
||||||
|
/// </summary>
|
||||||
|
public string equip_id { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备保养设备模板id
|
||||||
|
/// </summary>
|
||||||
|
public string maintain_tem_equip_id { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 结果1 合格2不合格
|
||||||
|
/// </summary>
|
||||||
|
public string? result { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 点巡检结果备注
|
||||||
|
/// </summary>
|
||||||
|
public string? result_remark { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? execute_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态 1待执行 2 待复核 3 已完成
|
||||||
|
/// </summary>
|
||||||
|
public string? status { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行人id
|
||||||
|
/// </summary>
|
||||||
|
public string? execute_user_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备类型id
|
||||||
|
/// </summary>
|
||||||
|
public string? equip_type_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 不合格推送
|
||||||
|
/// </summary>
|
||||||
|
public int? is_send { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 推送时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? send_date_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 推送人id
|
||||||
|
/// </summary>
|
||||||
|
public string? send_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 编码
|
||||||
|
/// </summary>
|
||||||
|
public string? code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 计划执行通知提前量
|
||||||
|
/// </summary>
|
||||||
|
public int? plan_run_notice { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 计划执行通知提前量单位 1 小时 2 天 3 周
|
||||||
|
/// </summary>
|
||||||
|
public string? plan_run_notice_unit { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行滞后推送时间
|
||||||
|
/// </summary>
|
||||||
|
public int? plan_delay { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行滞后推送时间单位 1 小时 2 天 3 周
|
||||||
|
/// </summary>
|
||||||
|
public string? plan_delay_unit { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 复核岗位id
|
||||||
|
/// </summary>
|
||||||
|
public string? repeat_post_info_user_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 责任岗位id
|
||||||
|
/// </summary>
|
||||||
|
public string? send_post_info_user_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否复核
|
||||||
|
/// </summary>
|
||||||
|
public string? is_repeat { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 复核时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? repeat_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 复核备注
|
||||||
|
/// </summary>
|
||||||
|
public string? repeat_remark { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 复核人id
|
||||||
|
/// </summary>
|
||||||
|
public string? repeat_user_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 仅用于关联表字段查询用不存储数据
|
||||||
|
/// </summary>
|
||||||
|
public string? query_info { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 附件
|
||||||
|
/// </summary>
|
||||||
|
public string? attachment { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 复核结果
|
||||||
|
/// </summary>
|
||||||
|
public string? repeat_result { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 所属组织
|
||||||
|
/// </summary>
|
||||||
|
public string? org_id { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
27
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainTemD.cs
Normal file
27
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainTemD.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
using JNPF.Common.Contracts;
|
||||||
|
using JNPF.Common.Security;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace Tnb.EquipMgr.Entities;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备保养模板子表
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("eqp_maintain_tem_d")]
|
||||||
|
public partial class EqpMaintainTemD : BaseEntity<string>
|
||||||
|
{
|
||||||
|
public EqpMaintainTemD()
|
||||||
|
{
|
||||||
|
id = SnowflakeIdHelper.NextId();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 设备保养模板主表id
|
||||||
|
/// </summary>
|
||||||
|
public string maintain_tem_id { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备保养项id
|
||||||
|
/// </summary>
|
||||||
|
public string maintain_item_id { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
using JNPF.Common.Contracts;
|
||||||
|
using JNPF.Common.Security;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace Tnb.EquipMgr.Entities;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备保养设备模板子表
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("eqp_maintain_tem_equip_d")]
|
||||||
|
public partial class EqpMaintainTemEquipD : BaseEntity<string>
|
||||||
|
{
|
||||||
|
public EqpMaintainTemEquipD()
|
||||||
|
{
|
||||||
|
id = SnowflakeIdHelper.NextId();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 设备保养设备模板主表id
|
||||||
|
/// </summary>
|
||||||
|
public string maintain_tem_equip_id { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备保养项id
|
||||||
|
/// </summary>
|
||||||
|
public string maintain_item_id { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
}
|
||||||
137
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainTemEquipH.cs
Normal file
137
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainTemEquipH.cs
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
using JNPF.Common.Contracts;
|
||||||
|
using JNPF.Common.Security;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace Tnb.EquipMgr.Entities;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备保养设备模板主表
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("eqp_maintain_tem_equip_h")]
|
||||||
|
public partial class EqpMaintainTemEquipH : BaseEntity<string>
|
||||||
|
{
|
||||||
|
public EqpMaintainTemEquipH()
|
||||||
|
{
|
||||||
|
id = SnowflakeIdHelper.NextId();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime create_time { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建用户
|
||||||
|
/// </summary>
|
||||||
|
public string? create_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? modify_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改用户
|
||||||
|
/// </summary>
|
||||||
|
public string? modify_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备保养模板表id
|
||||||
|
/// </summary>
|
||||||
|
public string? maintain_tem_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备id
|
||||||
|
/// </summary>
|
||||||
|
public string? equip_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
public string? remark { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 排序
|
||||||
|
/// </summary>
|
||||||
|
public int ordinal { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 编码
|
||||||
|
/// </summary>
|
||||||
|
public string code { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
public string name { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 周期
|
||||||
|
/// </summary>
|
||||||
|
public int plan_cycle { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 周期方式 1 单次 2 循环
|
||||||
|
/// </summary>
|
||||||
|
public string? plan_cycle_unit { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 计划执行通知提前量
|
||||||
|
/// </summary>
|
||||||
|
public int? plan_run_notice { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 计划执行通知提前量单位 1 小时 2 天 3 周
|
||||||
|
/// </summary>
|
||||||
|
public string? plan_run_notice_unit { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行滞后推送时间
|
||||||
|
/// </summary>
|
||||||
|
public int? plan_delay { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行滞后推送时间单位 1 小时 2 天 3 周
|
||||||
|
/// </summary>
|
||||||
|
public string? plan_delay_unit { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 启用时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime start_time { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否启用
|
||||||
|
/// </summary>
|
||||||
|
public string is_start { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否复核
|
||||||
|
/// </summary>
|
||||||
|
public string is_repeat { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 复核岗位id
|
||||||
|
/// </summary>
|
||||||
|
public string repeat_post_info_user_id { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 不合格推送 0 不推送 1 推送
|
||||||
|
/// </summary>
|
||||||
|
public int is_send { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 推送人id
|
||||||
|
/// </summary>
|
||||||
|
public string? send_post_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 责任岗位id
|
||||||
|
/// </summary>
|
||||||
|
public string send_post_info_user_id { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 所属组织
|
||||||
|
/// </summary>
|
||||||
|
public string? org_id { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
132
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainTemH.cs
Normal file
132
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainTemH.cs
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
using JNPF.Common.Contracts;
|
||||||
|
using JNPF.Common.Security;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace Tnb.EquipMgr.Entities;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备保养模板主表
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("eqp_maintain_tem_h")]
|
||||||
|
public partial class EqpMaintainTemH : BaseEntity<string>
|
||||||
|
{
|
||||||
|
public EqpMaintainTemH()
|
||||||
|
{
|
||||||
|
id = SnowflakeIdHelper.NextId();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? create_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建用户
|
||||||
|
/// </summary>
|
||||||
|
public string? create_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? modify_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改用户
|
||||||
|
/// </summary>
|
||||||
|
public string? modify_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备类型id
|
||||||
|
/// </summary>
|
||||||
|
public string? equip_type_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 编码
|
||||||
|
/// </summary>
|
||||||
|
public string code { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
public string name { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 周期
|
||||||
|
/// </summary>
|
||||||
|
public int plan_cycle { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 周期方式 1 单次 2 循环
|
||||||
|
/// </summary>
|
||||||
|
public string plan_cycle_unit { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 计划执行通知提前量
|
||||||
|
/// </summary>
|
||||||
|
public int? plan_run_notice { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 计划执行通知提前量单位 1 小时 2 天 3 周
|
||||||
|
/// </summary>
|
||||||
|
public string? plan_run_notice_unit { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行滞后推送时间
|
||||||
|
/// </summary>
|
||||||
|
public int? plan_delay { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行滞后推送时间单位 1 小时 2 天 3 周
|
||||||
|
/// </summary>
|
||||||
|
public string? plan_delay_unit { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 启用时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime start_time { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否启用
|
||||||
|
/// </summary>
|
||||||
|
public int is_start { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否复核
|
||||||
|
/// </summary>
|
||||||
|
public int is_repeat { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 复核岗位id
|
||||||
|
/// </summary>
|
||||||
|
public string repeat_post_info_user_id { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
public string? remark { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 排序
|
||||||
|
/// </summary>
|
||||||
|
public int? ordinal { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 不合格推送 0 不推送 1 推送
|
||||||
|
/// </summary>
|
||||||
|
public int is_send { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 推送人id
|
||||||
|
/// </summary>
|
||||||
|
public string? send_post_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 责任岗位id
|
||||||
|
/// </summary>
|
||||||
|
public string send_post_info_user_id { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 所属组织
|
||||||
|
/// </summary>
|
||||||
|
public string? org_id { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
@@ -72,7 +72,7 @@ public partial class EqpSpotInsRecordD : BaseEntity<string>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 单位id
|
/// 单位id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string unit_id { get; set; } = string.Empty;
|
public string? unit_id { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 点巡检方法
|
/// 点巡检方法
|
||||||
@@ -109,4 +109,9 @@ public partial class EqpSpotInsRecordD : BaseEntity<string>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string? is_pass { get; set; }
|
public string? is_pass { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 所属组织
|
||||||
|
/// </summary>
|
||||||
|
public string? org_id { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
namespace Tnb.EquipMgr.Interfaces
|
||||||
|
{
|
||||||
|
public interface IEqpMaintainTemEquipService
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 停止计划
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dic"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Task Stop(Dictionary<string, string> parameters);
|
||||||
|
}
|
||||||
|
}
|
||||||
12
EquipMgr/Tnb.EquipMgr.Interfaces/IEqpMaintainTemService.cs
Normal file
12
EquipMgr/Tnb.EquipMgr.Interfaces/IEqpMaintainTemService.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using Tnb.EquipMgr.Entities.Dto;
|
||||||
|
namespace Tnb.EquipMgr.Interfaces
|
||||||
|
{
|
||||||
|
public interface IEqpMaintainTemService
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 根据模板id发布到设备
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dic"></param>
|
||||||
|
public Task<string> Publish(SpotInsTemPublishInput input);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,13 +2,6 @@ namespace Tnb.EquipMgr.Interfaces
|
|||||||
{
|
{
|
||||||
public interface IEquSpotInsTemEquipService
|
public interface IEquSpotInsTemEquipService
|
||||||
{
|
{
|
||||||
// /// <summary>
|
|
||||||
// /// 获取数
|
|
||||||
// /// </summary>
|
|
||||||
// /// <param name="dic"></param>
|
|
||||||
// /// <returns></returns>
|
|
||||||
// public Task<dynamic> GetTree();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 停止计划
|
/// 停止计划
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
52
EquipMgr/Tnb.EquipMgr/EqpMaintainTemEquipService.cs
Normal file
52
EquipMgr/Tnb.EquipMgr/EqpMaintainTemEquipService.cs
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
using JNPF.Common.Enums;
|
||||||
|
using JNPF.Common.Security;
|
||||||
|
using JNPF.DependencyInjection;
|
||||||
|
using JNPF.DynamicApiController;
|
||||||
|
using JNPF.FriendlyException;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using SqlSugar;
|
||||||
|
using Tnb.EquipMgr.Interfaces;
|
||||||
|
using Tnb.EquipMgr.Entities;
|
||||||
|
|
||||||
|
namespace Tnb.EquipMgr
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 设备保养设备模板
|
||||||
|
/// </summary>
|
||||||
|
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
||||||
|
[Route("api/[area]/[controller]/[action]")]
|
||||||
|
public class EqpMaintainTemEquipService : IEqpMaintainTemEquipService, IDynamicApiController, ITransient
|
||||||
|
{
|
||||||
|
private readonly ISqlSugarRepository<EqpMaintainTemEquipH> _repository;
|
||||||
|
|
||||||
|
public EqpMaintainTemEquipService(ISqlSugarRepository<EqpMaintainTemEquipH> repository)
|
||||||
|
{
|
||||||
|
_repository = repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task Stop(Dictionary<string, string> parameters)
|
||||||
|
{
|
||||||
|
string id = parameters["id"];
|
||||||
|
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||||
|
{
|
||||||
|
await _repository.UpdateAsync(x => new EqpMaintainTemEquipH()
|
||||||
|
{
|
||||||
|
is_start = "0"
|
||||||
|
}, x => x.id == id);
|
||||||
|
List<string> ids = await _repository.AsSugarClient().Queryable<EqpMaintainRecordH>()
|
||||||
|
.Where(x => x.maintain_tem_equip_id == id && x.status == SpotInsRecordExecutionStatus.TOBEEXECUTED)
|
||||||
|
.Select(x => x.id).ToListAsync();
|
||||||
|
await _repository.AsSugarClient().Deleteable<EqpMaintainRecordH>()
|
||||||
|
.Where(x => x.maintain_tem_equip_id == id && x.status == SpotInsRecordExecutionStatus.TOBEEXECUTED).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
await _repository.AsSugarClient().Deleteable<EqpMaintainRecordD>()
|
||||||
|
.Where(x => ids.Contains(x.maintain_record_id)).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
119
EquipMgr/Tnb.EquipMgr/EqpMaintainTemService.cs
Normal file
119
EquipMgr/Tnb.EquipMgr/EqpMaintainTemService.cs
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
using JNPF.Common.Core.Manager;
|
||||||
|
using JNPF.Common.Enums;
|
||||||
|
using JNPF.Common.Security;
|
||||||
|
using JNPF.DependencyInjection;
|
||||||
|
using JNPF.DynamicApiController;
|
||||||
|
using JNPF.FriendlyException;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
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 EqpMaintainTemService : IEqpMaintainTemService, IDynamicApiController, ITransient
|
||||||
|
{
|
||||||
|
private const string ModuleId = "26123080740885";
|
||||||
|
private readonly ISqlSugarRepository<EqpMaintainTemH> _repository;
|
||||||
|
private readonly IUserManager _userManager;
|
||||||
|
|
||||||
|
public EqpMaintainTemService(ISqlSugarRepository<EqpMaintainTemH> repository,
|
||||||
|
IUserManager userManager)
|
||||||
|
{
|
||||||
|
_repository = repository;
|
||||||
|
_userManager = userManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据模板id发布到设备
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dic"></param>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<string> Publish(SpotInsTemPublishInput input)
|
||||||
|
{
|
||||||
|
var db = _repository.AsSugarClient();
|
||||||
|
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||||
|
{
|
||||||
|
EqpMaintainTemH eqpMaintainTemH = await _repository.GetSingleAsync(x => x.id == input.id);
|
||||||
|
List<EqpMaintainTemD> eqpMaintainTemDs = await db.Queryable<EqpMaintainTemD>().Where(x=>x.maintain_tem_id==input.id).ToListAsync();
|
||||||
|
|
||||||
|
if (input.equipIds != null && input.equipIds.Length > 0)
|
||||||
|
{
|
||||||
|
List<EqpMaintainTemEquipH> insertEqpMaintainTemEquipHs = new List<EqpMaintainTemEquipH>();
|
||||||
|
List<EqpMaintainTemEquipD> insertEqpMaintainTemEquipDs = new List<EqpMaintainTemEquipD>();
|
||||||
|
foreach (var equipId in input.equipIds)
|
||||||
|
{
|
||||||
|
string id = SnowflakeIdHelper.NextId();
|
||||||
|
string code = $"{DateTime.Now.ToString("yyyyMMdd") + equipId}";
|
||||||
|
EqpMaintainTemEquipH eqpMaintainTemEquipH = new EqpMaintainTemEquipH()
|
||||||
|
{
|
||||||
|
id = id,
|
||||||
|
code = code,
|
||||||
|
name = eqpMaintainTemH.name+equipId,
|
||||||
|
plan_cycle = eqpMaintainTemH.plan_cycle,
|
||||||
|
plan_cycle_unit = eqpMaintainTemH.plan_cycle_unit,
|
||||||
|
plan_run_notice = eqpMaintainTemH.plan_run_notice,
|
||||||
|
plan_delay = eqpMaintainTemH.plan_delay,
|
||||||
|
start_time = eqpMaintainTemH.start_time,
|
||||||
|
is_start = eqpMaintainTemH.is_start.ToString(),
|
||||||
|
is_repeat = eqpMaintainTemH.is_repeat.ToString(),
|
||||||
|
is_send = eqpMaintainTemH.is_send,
|
||||||
|
maintain_tem_id = input.id,
|
||||||
|
equip_id = equipId,
|
||||||
|
remark = eqpMaintainTemH.remark,
|
||||||
|
plan_run_notice_unit = eqpMaintainTemH.plan_run_notice_unit,
|
||||||
|
plan_delay_unit = eqpMaintainTemH.plan_delay_unit,
|
||||||
|
repeat_post_info_user_id = eqpMaintainTemH.repeat_post_info_user_id,
|
||||||
|
send_post_info_user_id = eqpMaintainTemH.send_post_info_user_id,
|
||||||
|
send_post_id = eqpMaintainTemH.send_post_id,
|
||||||
|
org_id = eqpMaintainTemH.org_id,
|
||||||
|
create_id = _userManager.UserId,
|
||||||
|
create_time = DateTime.Now,
|
||||||
|
};
|
||||||
|
insertEqpMaintainTemEquipHs.Add(eqpMaintainTemEquipH);
|
||||||
|
|
||||||
|
if (eqpMaintainTemDs != null && eqpMaintainTemDs.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var eqpMaintainTem in eqpMaintainTemDs)
|
||||||
|
{
|
||||||
|
EqpMaintainTemEquipD eqpMaintainTemEquipD = new EqpMaintainTemEquipD()
|
||||||
|
{
|
||||||
|
id = SnowflakeIdHelper.NextId(),
|
||||||
|
maintain_item_id = eqpMaintainTem.maintain_item_id,
|
||||||
|
maintain_tem_equip_id = id,
|
||||||
|
};
|
||||||
|
insertEqpMaintainTemEquipDs.Add(eqpMaintainTemEquipD);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EqpMaintainTemEquipH oldMaintainTemEquipH = await db.Queryable<EqpMaintainTemEquipH>().Where(x => x.maintain_tem_id == input.id && x.equip_id == equipId).FirstAsync();
|
||||||
|
await db.Deleteable<EqpMaintainTemEquipH>().Where(x => x.maintain_tem_id == input.id && x.equip_id==equipId).ExecuteCommandAsync();
|
||||||
|
if(oldMaintainTemEquipH!=null)
|
||||||
|
await db.Deleteable<EqpMaintainTemEquipD>().Where(x => x.maintain_tem_equip_id==oldMaintainTemEquipH.id).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (insertEqpMaintainTemEquipHs != null && insertEqpMaintainTemEquipHs.Count > 0)
|
||||||
|
{
|
||||||
|
await db.Insertable(insertEqpMaintainTemEquipHs).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (insertEqpMaintainTemEquipDs != null && insertEqpMaintainTemEquipDs.Count > 0)
|
||||||
|
{
|
||||||
|
await db.Insertable(insertEqpMaintainTemEquipDs).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||||
|
return result.IsSuccess ? "发布成功" : result.ErrorMessage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@ using Tnb.EquipMgr.Entities;
|
|||||||
namespace Tnb.EquipMgr
|
namespace Tnb.EquipMgr
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设备管理
|
/// 点巡检设备模板
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
||||||
[Route("api/[area]/[controller]/[action]")]
|
[Route("api/[area]/[controller]/[action]")]
|
||||||
@@ -24,26 +24,7 @@ namespace Tnb.EquipMgr
|
|||||||
_repository = repository;
|
_repository = repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public async Task<dynamic> GetTree()
|
[HttpPost]
|
||||||
// {
|
|
||||||
// List<EqpEquipment> eqpEquipments =
|
|
||||||
// var data = _repository.AsSugarClient().Queryable<EqpEquipType>()
|
|
||||||
// .Where(x => x.status == 1)
|
|
||||||
// .Select((x) => new TreeModel
|
|
||||||
// {
|
|
||||||
// id = x.id,
|
|
||||||
// parentId = "-1",
|
|
||||||
// hasChildren = SqlFunc.Subqueryable<EqpEquipment>().Where(y=>y.eqp_type_id==x.id).Any(),
|
|
||||||
// isLeaf = false,
|
|
||||||
// num = SqlFunc.Subqueryable<EqpEquipment>().Where(y=>y.eqp_type_id==x.id).Count(),
|
|
||||||
// children = SqlFunc.Subqueryable<EqpEquipment>().Where(y=>y.eqp_type_id==x.id).Select(y=>new TreeModel()
|
|
||||||
// {
|
|
||||||
//
|
|
||||||
// }).ToList(model => ),
|
|
||||||
// });
|
|
||||||
// return new { list = 1 };
|
|
||||||
// }
|
|
||||||
|
|
||||||
public async Task Stop(Dictionary<string, string> parameters)
|
public async Task Stop(Dictionary<string, string> parameters)
|
||||||
{
|
{
|
||||||
string id = parameters["id"];
|
string id = parameters["id"];
|
||||||
|
|||||||
@@ -0,0 +1,153 @@
|
|||||||
|
using JNPF.Common.Security;
|
||||||
|
using JNPF.Logging;
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using SqlSugar;
|
||||||
|
using Tnb.EquipMgr.Entities;
|
||||||
|
|
||||||
|
namespace JNPF.TaskScheduler.Listener
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 生成设备保养计划
|
||||||
|
/// </summary>
|
||||||
|
public class GenerateMaintainPlanTimeWorker : ISpareTimeWorker
|
||||||
|
{
|
||||||
|
private ISqlSugarRepository<EqpMaintainTemEquipH> _repository => App.GetService<ISqlSugarRepository<EqpMaintainTemEquipH>>();
|
||||||
|
// public GenerateSpotInspectionPlanTimeWorker(ISqlSugarRepository<EqpMaintainTemEquipH> repository)
|
||||||
|
// {
|
||||||
|
// _repository = repository;
|
||||||
|
// }
|
||||||
|
|
||||||
|
[SpareTime("0 0 0 * * ?", "生成设备保养计划", ExecuteType = SpareTimeExecuteTypes.Serial,StartNow = false)]
|
||||||
|
public void GenerateSpotInspectionPlan(SpareTimer timer, long count)
|
||||||
|
{
|
||||||
|
Log.Information("----------------------开始生成设备保养计划----------------------");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<EqpMaintainTemEquipH> eqpSpotInsTemEquipHsByOne = _repository.GetList(x => x.is_start=="1" && x.plan_cycle_unit == "1");
|
||||||
|
List<EqpMaintainTemEquipH> eqpSpotInsTemEquipHsByCirculate = _repository.GetList(x => x.is_start=="1" && x.plan_cycle_unit == "2");
|
||||||
|
List<EqpMaintainRecordH> tobeCreateList = new List<EqpMaintainRecordH>();
|
||||||
|
List<EqpMaintainTemEquipH> tobeCreateTemplets = new List<EqpMaintainTemEquipH>();
|
||||||
|
var db = _repository.AsSugarClient();
|
||||||
|
|
||||||
|
foreach (var item in eqpSpotInsTemEquipHsByOne)
|
||||||
|
{
|
||||||
|
if (item.start_time.AddHours((double)item.plan_cycle).ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd"))
|
||||||
|
{
|
||||||
|
tobeCreateTemplets.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eqpSpotInsTemEquipHsByCirculate != null && eqpSpotInsTemEquipHsByCirculate.Count > 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
//整除表示一个周期到了
|
||||||
|
foreach (var item in eqpSpotInsTemEquipHsByCirculate)
|
||||||
|
{
|
||||||
|
TimeSpan ts1 = new TimeSpan(Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")).Ticks);
|
||||||
|
TimeSpan ts2 = new TimeSpan(Convert.ToDateTime(item.start_time.ToString("yyyy-MM-dd")).Ticks);
|
||||||
|
TimeSpan ts3 = ts1.Subtract(ts2).Duration();
|
||||||
|
if (ts3.TotalDays * 10 % (10 * (double)item.plan_cycle)==0)
|
||||||
|
{
|
||||||
|
tobeCreateTemplets.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tobeCreateTemplets != null && tobeCreateTemplets.Count > 0)
|
||||||
|
{
|
||||||
|
List<EqpEquipment> equipments = db.Queryable<EqpEquipment>().Where(x => x.life==Tnb.EquipMgr.EquipmentLife.ENABLE).ToList();
|
||||||
|
int index = 1;
|
||||||
|
foreach (var item in tobeCreateTemplets)
|
||||||
|
{
|
||||||
|
//只有启用设备才生成计划
|
||||||
|
if (equipments.FirstOrDefault(x => x.id == item.equip_id) == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
string code = $"{DateTime.Now.ToString("yyyyMMdd")+(index++).ToString().PadLeft(3,'0')}";
|
||||||
|
tobeCreateList.Add(new EqpMaintainRecordH()
|
||||||
|
{
|
||||||
|
id = SnowflakeIdHelper.NextId(),
|
||||||
|
code = code,
|
||||||
|
// equip_type_id = item.equip_type_id,
|
||||||
|
equip_id = item.equip_id,
|
||||||
|
maintain_tem_equip_id = item.id,
|
||||||
|
plan_run_notice = item.plan_run_notice,
|
||||||
|
plan_run_notice_unit = item.plan_run_notice_unit,
|
||||||
|
plan_delay = item.plan_delay,
|
||||||
|
plan_delay_unit = item.plan_delay_unit,
|
||||||
|
send_post_info_user_id = item.send_post_info_user_id,
|
||||||
|
is_repeat = item.is_repeat,
|
||||||
|
repeat_post_info_user_id = item.repeat_post_info_user_id,
|
||||||
|
is_send = item.is_send,
|
||||||
|
create_time = DateTime.Now,
|
||||||
|
status = Tnb.EquipMgr.SpotInsRecordExecutionStatus.TOBEEXECUTED
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (tobeCreateList != null && tobeCreateList.Count > 0)
|
||||||
|
{
|
||||||
|
List<string> templetIDs = tobeCreateList.Select(x => x.maintain_tem_equip_id).ToList();
|
||||||
|
List<EqpMaintainTemEquipD> spotInsTemEquipDs = db.Queryable<EqpMaintainTemEquipD>().Where(x => templetIDs.Contains(x.maintain_tem_equip_id)).ToList();
|
||||||
|
List<string> spotInsItemIDs = spotInsTemEquipDs.Select(x => x.maintain_item_id).ToList();
|
||||||
|
List<EqpMaintainItem> spotCheckItems = db.Queryable<EqpMaintainItem>().Where(x => spotInsItemIDs.Contains(x.id)).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var tobeCreatePlan in tobeCreateList)
|
||||||
|
{
|
||||||
|
List<EqpMaintainRecordD> spotInsRecordDs = new List<EqpMaintainRecordD>();
|
||||||
|
List<string> spotInsItems = spotInsTemEquipDs
|
||||||
|
.Where(x => x.maintain_tem_equip_id == tobeCreatePlan.maintain_tem_equip_id)
|
||||||
|
.Select(x => x.maintain_item_id).ToList();
|
||||||
|
List<EqpMaintainItem> tobeCreateItems = spotCheckItems.Where(x => spotInsItems.Contains(x.id)).ToList();
|
||||||
|
foreach (var tobeCreateItem in tobeCreateItems)
|
||||||
|
{
|
||||||
|
spotInsRecordDs.Add(new EqpMaintainRecordD()
|
||||||
|
{
|
||||||
|
id = SnowflakeIdHelper.NextId(),
|
||||||
|
maintain_record_id = tobeCreatePlan.id,
|
||||||
|
maintain_tem_equip_id = tobeCreatePlan.maintain_tem_equip_id,
|
||||||
|
maintain_item_id = tobeCreateItem.id,
|
||||||
|
code = tobeCreateItem.code,
|
||||||
|
name = tobeCreateItem.name,
|
||||||
|
maintain_type = tobeCreateItem.maintain_type,
|
||||||
|
maintain_content = tobeCreateItem.maintain_content,
|
||||||
|
descrip = tobeCreateItem.descrip,
|
||||||
|
remark = tobeCreateItem.remark
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var dbResult = db.Ado.UseTran(() =>
|
||||||
|
{
|
||||||
|
if (tobeCreateList != null && tobeCreateList.Count > 0)
|
||||||
|
{
|
||||||
|
db.Insertable<EqpMaintainRecordH>(tobeCreateList).ExecuteCommand();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (spotInsRecordDs != null && spotInsRecordDs.Count > 0)
|
||||||
|
{
|
||||||
|
db.Insertable<EqpMaintainRecordD>(spotInsRecordDs).ExecuteCommand();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (!dbResult.IsSuccess)
|
||||||
|
{
|
||||||
|
Console.WriteLine(dbResult.ErrorMessage);
|
||||||
|
Log.Error(dbResult.ErrorMessage);
|
||||||
|
}
|
||||||
|
Log.Information($"---------------生成{tobeCreateList.Count}个计划---------------");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e.Message);
|
||||||
|
Log.Error(e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Log.Information("----------------------结束生成设备保养计划----------------------");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,7 +17,7 @@ namespace JNPF.TaskScheduler.Listener
|
|||||||
// _repository = repository;
|
// _repository = repository;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//[SpareTime("0 0,30 * * * ?", "生成点巡检计划", ExecuteType = SpareTimeExecuteTypes.Serial,StartNow = false)]
|
[SpareTime("0 0,30 * * * ?", "生成点巡检计划", ExecuteType = SpareTimeExecuteTypes.Serial,StartNow = false)]
|
||||||
public void GenerateSpotInspectionPlan(SpareTimer timer, long count)
|
public void GenerateSpotInspectionPlan(SpareTimer timer, long count)
|
||||||
{
|
{
|
||||||
Log.Information("----------------------开始生成点巡检计划----------------------");
|
Log.Information("----------------------开始生成点巡检计划----------------------");
|
||||||
|
|||||||
Reference in New Issue
Block a user