Merge branch 'dev' of ssh://git.tuotong-tech.com:9105/tnb/tnb.server into dev
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
|
||||
|
||||
|
||||
@@ -90,8 +90,8 @@ namespace Tnb.BasicData
|
||||
BasEbomH ebom = await db.Queryable<BasEbomH>().Where(x => x.id == queryInput.ebom_id).SingleAsync();
|
||||
ids.Add(ebom.material_id);
|
||||
var result = await db.Queryable<BasMaterial>()
|
||||
.LeftJoin<DictionaryDataEntity>((a, b) => a.unit_id == b.EnCode)
|
||||
.LeftJoin<DictionaryTypeEntity>((a, b, c) => b.DictionaryTypeId == c.Id && c.EnCode == DictConst.MeasurementUnit && c.DeleteMark == null)
|
||||
.LeftJoin<DictionaryTypeEntity>((a, b) => b.EnCode == DictConst.MeasurementUnit && b.DeleteMark == null)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c) => c.DictionaryTypeId == b.Id && a.unit_id == c.EnCode)
|
||||
.WhereIF(!string.IsNullOrEmpty(queryInput.material_info), (a, b, c) => a.code.Contains(queryInput.material_info) || a.name.Contains(queryInput.material_info))
|
||||
.WhereIF(!string.IsNullOrEmpty(queryInput.ebom_id), (a, b, c) => ids.Contains(a.id))
|
||||
.Select((a, b, c) => new MaterialSelectOutput()
|
||||
@@ -101,7 +101,7 @@ namespace Tnb.BasicData
|
||||
name = a.name,
|
||||
descrip = a.descrip,
|
||||
unit_id = a.unit_id,
|
||||
unit_name = b.FullName,
|
||||
unit_name = c.FullName,
|
||||
}).ToPagedListAsync(queryInput.currentPage, queryInput.pageSize);
|
||||
|
||||
return PageResult<MaterialSelectOutput>.SqlSugarPageResult(result);
|
||||
@@ -110,8 +110,8 @@ namespace Tnb.BasicData
|
||||
else
|
||||
{
|
||||
var result = await db.Queryable<BasMaterial>()
|
||||
.LeftJoin<DictionaryDataEntity>((a, b) => a.unit_id == b.EnCode)
|
||||
.LeftJoin<DictionaryTypeEntity>((a, b, c) => b.DictionaryTypeId == c.Id && c.EnCode == DictConst.MeasurementUnit && c.DeleteMark == null)
|
||||
.LeftJoin<DictionaryTypeEntity>((a, b) => b.EnCode == DictConst.MeasurementUnit && b.DeleteMark == null)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c) => c.DictionaryTypeId == b.Id && a.unit_id == c.EnCode)
|
||||
.WhereIF(!string.IsNullOrEmpty(queryInput.material_info), (a, b, c) => a.code.Contains(queryInput.material_info) || a.name.Contains(queryInput.material_info))
|
||||
.Select((a, b, c) => new MaterialSelectOutput()
|
||||
{
|
||||
@@ -120,7 +120,7 @@ namespace Tnb.BasicData
|
||||
name = a.name,
|
||||
descrip = a.descrip,
|
||||
unit_id = a.unit_id,
|
||||
unit_name = b.FullName,
|
||||
unit_name = c.FullName,
|
||||
}).ToPagedListAsync(queryInput.currentPage, queryInput.pageSize);
|
||||
|
||||
return PageResult<MaterialSelectOutput>.SqlSugarPageResult(result);
|
||||
|
||||
@@ -11,6 +11,10 @@ namespace Tnb.EquipMgr.Entities.Consts
|
||||
/// <summary>
|
||||
/// 模具使用状态在库状态ID
|
||||
/// </summary>
|
||||
public const string MOLDUSESTATUSZKID = "26149307089941";
|
||||
public const string MOLD_USE_STATUS_ZK_ID = "26149307089941";
|
||||
/// <summary>
|
||||
/// 模具使用状态-保养Id
|
||||
/// </summary>
|
||||
public const string MOLD_USE_STATUS_MAINTAIN_ID = "26149311082005";
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
@@ -66,6 +66,10 @@ public partial class ToolMoldMaintainItem : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 保养项完成状态 0,未完成,1,已完成
|
||||
/// </summary>
|
||||
public int? status { get; set; }
|
||||
public int status { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 模具id
|
||||
/// </summary>
|
||||
public string mold_id { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.EquipMgr.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 模具保养
|
||||
/// </summary>
|
||||
[SugarTable("tool_mold_maintain_item_record")]
|
||||
public partial class ToolMoldMaintainItemRecord : BaseEntity<string>
|
||||
{
|
||||
public ToolMoldMaintainItemRecord()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 保养项 保养状态 0 未完成,1 已完成
|
||||
/// </summary>
|
||||
public int status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 保养组Id
|
||||
/// </summary>
|
||||
public string? item_group_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 保养组名称
|
||||
/// </summary>
|
||||
public string? item_group_name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 保养项Id
|
||||
/// </summary>
|
||||
public string? item_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 保养项名称
|
||||
/// </summary>
|
||||
public string? item_name { get; set; }
|
||||
/// <summary>
|
||||
/// 模具ID
|
||||
/// </summary>
|
||||
public string mold_id { get; set; }
|
||||
|
||||
}
|
||||
@@ -59,26 +59,6 @@ public partial class ToolMoldMaintainRunRecord : BaseEntity<string>
|
||||
/// </summary>
|
||||
public string? eqp_name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 保养组编码
|
||||
/// </summary>
|
||||
public string? group_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 保养组名称
|
||||
/// </summary>
|
||||
public string? group_name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 保养项编号
|
||||
/// </summary>
|
||||
public string? check_item_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 保养项名称
|
||||
/// </summary>
|
||||
public string? check_item_name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 计划开始时间
|
||||
/// </summary>
|
||||
@@ -94,4 +74,14 @@ public partial class ToolMoldMaintainRunRecord : BaseEntity<string>
|
||||
/// </summary>
|
||||
public decimal? plan_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 维保人
|
||||
/// </summary>
|
||||
public string? maintain_person { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 异常记录
|
||||
/// </summary>
|
||||
public string? exception_record { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.EquipMgr.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 模具保养计划记录表子表
|
||||
/// </summary>
|
||||
[SugarTable("tool_mold_maintain_run_record_d")]
|
||||
public partial class ToolMoldMaintainRunRecordD : BaseEntity<string>
|
||||
{
|
||||
public ToolMoldMaintainRunRecordD()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 模具编号
|
||||
/// </summary>
|
||||
public string? mold_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 保养组编码
|
||||
/// </summary>
|
||||
public string? group_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 保养组名称
|
||||
/// </summary>
|
||||
public string? group_name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 保养项编号
|
||||
/// </summary>
|
||||
public string? check_item_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 保养项名称
|
||||
/// </summary>
|
||||
public string? check_item_name { get; set; }
|
||||
|
||||
}
|
||||
@@ -133,5 +133,9 @@ public partial class ToolMolds : BaseEntity<string>
|
||||
/// 模具型号
|
||||
/// </summary>
|
||||
public string? mold_type_code { get; set; }
|
||||
/// <summary>
|
||||
/// 关联保养项信息
|
||||
/// </summary>
|
||||
public string item_json { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,8 @@ using JNPF.Common.Contracts;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
using Senparc.Weixin.MP.AdvancedAPIs.GroupMessage;
|
||||
using Aop.Api.Domain;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
{
|
||||
@@ -79,8 +81,60 @@ namespace Tnb.EquipMgr
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task RelevanceMaintianGroupAndItem(MoldMaintainGroupItemInput input) =>
|
||||
await Relevance<MoldMaintainGroupItemInput, ToolMoldMaintainGroupItem>(input, nameof(ToolMoldMaintainGroupItem.item_group_id), nameof(ToolMoldMaintainGroupItem.item_id), it => it.item_group_id == input.id);
|
||||
public async Task RelevanceMaintianGroupAndItem(MoldMaintainGroupItemInput input)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
if (input.ids == null || input.ids.Count == 0) throw new ArgumentException($"parameter {nameof(input.ids)} not be null or count not be zero");
|
||||
await Relevance<MoldMaintainGroupItemInput, ToolMoldMaintainGroupItem>(input, nameof(ToolMoldMaintainGroupItem.item_group_id), nameof(ToolMoldMaintainGroupItem.item_id), it => it.item_group_id == input.id);
|
||||
List<ToolMoldMaintainItemRecord> itemRecords = new();
|
||||
var grpIds = await _db.Queryable<ToolMoldMaintainGroupItem>().Where(it => input.ids.Contains(it.item_id)).Select(it => it.item_group_id).Distinct().ToListAsync();
|
||||
if (grpIds?.Count > 0)
|
||||
{
|
||||
var grps = await _db.Queryable<ToolMoldMaintainGroup>().Where(it => grpIds.Contains(it.id)).ToListAsync();
|
||||
foreach (var grp in grps)
|
||||
{
|
||||
var molds = await _db.Queryable<ToolMoldMaintainGroupRelation>().Where(it => it.item_group_id == grp.id).ToListAsync();
|
||||
if (molds?.Count > 0)
|
||||
{
|
||||
foreach (var mold in molds)
|
||||
{
|
||||
var dbItIds = await _db.Queryable<ToolMoldMaintainItemRecord>().Where(it => it.mold_id == mold.id && it.item_group_id == grp.id && input.ids.Contains(it.id)).Select(it => it.item_id).ToListAsync();
|
||||
input.ids = input.ids.Except(dbItIds).ToList();
|
||||
if (input.ids?.Count > 0)
|
||||
{
|
||||
var items = await _db.Queryable<ToolMoldMaintainItem>().Where(it => input.ids.Contains(it.id)).ToListAsync();
|
||||
if (items?.Count > 0)
|
||||
{
|
||||
foreach (var item in items)
|
||||
{
|
||||
ToolMoldMaintainItemRecord record = new();
|
||||
record.mold_id = mold.id;
|
||||
record.item_group_id = grp.id;
|
||||
record.item_group_name = grp.name;
|
||||
record.item_id = item.id;
|
||||
record.item_name = item.name;
|
||||
record.status = 0;
|
||||
itemRecords.Add(record);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
await _db.Insertable(itemRecords).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 关联项目组与模具
|
||||
@@ -88,8 +142,45 @@ namespace Tnb.EquipMgr
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task RelevanceMaintianGroupAndMold(MoldMaintainGroupItemRelationInput input) =>
|
||||
public async Task RelevanceMaintianGroupAndMold(MoldMaintainGroupItemRelationInput input)
|
||||
{
|
||||
await Relevance<MoldMaintainGroupItemRelationInput, ToolMoldMaintainGroupRelation>(input, nameof(ToolMoldMaintainGroupRelation.item_group_id), nameof(ToolMoldMaintainGroupRelation.mold_id), it => it.item_group_id == input.id);
|
||||
List<ToolMoldMaintainItemRecord> itemRecords = new();
|
||||
foreach (var moldId in input.ids)
|
||||
{
|
||||
var grpIds = await _db.Queryable<ToolMoldMaintainGroupRelation>().Where(it => it.mold_id == moldId).Select(it => it.item_group_id).Distinct().ToListAsync();
|
||||
if (grpIds?.Count > 0)
|
||||
{
|
||||
var grps = await _db.Queryable<ToolMoldMaintainGroup>().Where(it => grpIds.Contains(it.id)).ToListAsync();
|
||||
foreach (var grp in grps)
|
||||
{
|
||||
var itemIds = await _db.Queryable<ToolMoldMaintainGroupItem>().Where(it => it.item_group_id == grp.id).Select(it => it.item_id).ToListAsync();
|
||||
if (itemIds?.Count > 0)
|
||||
{
|
||||
var dbItemIds = await _db.Queryable<ToolMoldMaintainItemRecord>().Where(it => it.mold_id == moldId && it.item_group_id == grp.id && itemIds.Contains(it.item_id)).Select(it => it.item_id).ToListAsync();
|
||||
itemIds = itemIds.Except(dbItemIds).ToList();
|
||||
if (itemIds?.Count > 0)
|
||||
{
|
||||
var items = await _db.Queryable<ToolMoldMaintainItem>().Where(it => itemIds.Contains(it.id)).ToListAsync();
|
||||
foreach (var item in items)
|
||||
{
|
||||
ToolMoldMaintainItemRecord record = new();
|
||||
record.mold_id = moldId;
|
||||
record.item_group_id = grp.id;
|
||||
record.item_group_name = grp.name;
|
||||
record.item_id = item.id;
|
||||
record.item_name = item.name;
|
||||
record.status = 0;
|
||||
itemRecords.Add(record);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
await _db.Insertable(itemRecords).ExecuteCommandAsync();
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 删除项目组与模具检查项信息
|
||||
/// </summary>
|
||||
@@ -98,14 +189,15 @@ namespace Tnb.EquipMgr
|
||||
[HttpPost]
|
||||
public async Task Delete(MoldMaintainDelInput input)
|
||||
{
|
||||
|
||||
if (input.table_name == "item")
|
||||
{
|
||||
await Delete<ToolMoldMaintainGroupItem>(it => it.item_group_id == input.id && input.ids.Contains(it.item_id));
|
||||
await Delete<ToolMoldMaintainItemRecord>(it => it.item_group_id == input.id && input.ids.Contains(it.item_id));
|
||||
}
|
||||
else
|
||||
{
|
||||
await Delete<ToolMoldMaintainGroupRelation>(it => it.item_group_id == input.id && input.ids.Contains(it.mold_id));
|
||||
await Delete<ToolMoldMaintainItemRecord>(it => it.item_group_id == input.id && input.ids.Contains(it.mold_id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aspose.Cells.Drawing;
|
||||
using DingTalk.Api.Request;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
@@ -14,6 +15,7 @@ using JNPF.FriendlyException;
|
||||
using JNPF.Logging;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using StackExchange.Profiling.Internal;
|
||||
using Tnb.BasicData;
|
||||
@@ -51,8 +53,8 @@ namespace Tnb.EquipMgr
|
||||
[HttpGet]
|
||||
public async Task<dynamic> GetMaintainInfoFromByPlanId([FromRoute] string planId)
|
||||
{
|
||||
dynamic info = new ExpandoObject();
|
||||
var planMoldRelation = await _db.Queryable<ToolMoldMaintainPlanRelation>()
|
||||
List<dynamic> result = new();
|
||||
var planMoldRelations = await _db.Queryable<ToolMoldMaintainPlanRelation>()
|
||||
.LeftJoin<ToolMoldMaintainPlan>((a, b) => a.maintain_plan_id == b.id)//ToolMoldMaintainPlan
|
||||
.LeftJoin<ToolMoldMaintainRunRecord>((a, b, c) => b.plan_code == c.plan_code)
|
||||
.Where(a => a.maintain_plan_id == planId)
|
||||
@@ -61,27 +63,35 @@ namespace Tnb.EquipMgr
|
||||
mold_id = a.mold_id,
|
||||
plan_start_time = c.plan_start_time,
|
||||
})
|
||||
.FirstAsync();
|
||||
if (planMoldRelation != null)
|
||||
.ToListAsync();
|
||||
if (planMoldRelations?.Count > 0)
|
||||
{
|
||||
var mold = await _db.Queryable<ToolMolds>().FirstAsync(it => it.id == planMoldRelation.mold_id);
|
||||
if (mold != null)
|
||||
var mids = planMoldRelations.Select(x => x.mold_id).ToList();
|
||||
var molds = await _db.Queryable<ToolMolds>().Where(it => mids.Contains(it.id)).ToListAsync();
|
||||
if (molds?.Count > 0)
|
||||
{
|
||||
info.mold_code = mold.mold_code;
|
||||
info.mold_name = mold.mold_name;
|
||||
info.mold_status = (await _dictionaryDataService.GetInfo(mold.mold_status))?.FullName;
|
||||
info.maintain_qty = mold.maintain_qty;
|
||||
info.plan_start_time = planMoldRelation.plan_start_time;
|
||||
var moldEqpRelation = await _db.Queryable<ToolMoldsEquipment>().FirstAsync(it => it.mold_id == mold.id);
|
||||
if (moldEqpRelation != null)
|
||||
for (int i = 0, cnt = molds.Count; i < cnt; i++)
|
||||
{
|
||||
var eqp = await _db.Queryable<EqpEquipment>().FirstAsync(it => it.id == moldEqpRelation.equipment_id);
|
||||
info.eqp_code = eqp.code;
|
||||
info.eqp_name = eqp.name;
|
||||
var mold = molds[i];
|
||||
dynamic info = new ExpandoObject();
|
||||
info.mold_id = mold.id;
|
||||
info.mold_code = mold.mold_code;
|
||||
info.mold_name = mold.mold_name;
|
||||
info.mold_status = (await _dictionaryDataService.GetInfo(mold.mold_status))?.FullName;
|
||||
info.maintain_qty = mold.maintain_qty;
|
||||
info.plan_start_time = planMoldRelations[i].plan_start_time;
|
||||
var moldEqpRelation = await _db.Queryable<ToolMoldsEquipment>().FirstAsync(it => it.mold_id == mold.id);
|
||||
if (moldEqpRelation != null)
|
||||
{
|
||||
var eqp = await _db.Queryable<EqpEquipment>().FirstAsync(it => it.id == moldEqpRelation.equipment_id);
|
||||
info.eqp_code = eqp.code;
|
||||
info.eqp_name = eqp.name;
|
||||
}
|
||||
result.Add(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
return info;
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据模具ID获取,保养组及项目信息
|
||||
@@ -92,23 +102,32 @@ namespace Tnb.EquipMgr
|
||||
public async Task<dynamic> GetCheckItemAndGrpByMoldId([FromRoute] string moldId)
|
||||
{
|
||||
if (moldId.IsNullOrEmpty()) throw new ArgumentException($"parameter {nameof(moldId)} not be null or empty");
|
||||
|
||||
var itemGroupRelation = await _db.Queryable<ToolMoldMaintainGroupRelation>().FirstAsync(it => it.mold_id == moldId);
|
||||
if (itemGroupRelation != null)
|
||||
{
|
||||
var checkItems = await _db.Queryable<ToolMoldMaintainGroup, ToolMoldMaintainGroupItem, ToolMoldMaintainItem>((a, b, c) => new JoinQueryInfos
|
||||
(
|
||||
JoinType.Left, a.id == b.item_group_id,
|
||||
JoinType.Left, b.item_id == c.id
|
||||
))
|
||||
.Where(a => a.id == itemGroupRelation.item_group_id)
|
||||
.Select((a, b, c) => new
|
||||
{
|
||||
item_group_id = a.id,
|
||||
item_group_name = a.name,
|
||||
item_id = c.id,
|
||||
item_name = c.name,
|
||||
}).ToListAsync();
|
||||
|
||||
var checkItems = await _db.Queryable<ToolMoldMaintainItemRecord>().Where(it => it.mold_id == moldId).Select(it => new
|
||||
{
|
||||
item_group_id = it.item_group_id,
|
||||
item_group_name = it.item_group_name,
|
||||
item_id = it.item_id,
|
||||
item_name = it.item_name,
|
||||
status = it.status,
|
||||
}).ToListAsync();
|
||||
|
||||
//var checkItems = await _db.Queryable<ToolMoldMaintainGroupRelation, ToolMoldMaintainGroup, ToolMoldMaintainGroupItem, ToolMoldMaintainItem>((a, b, c, d) => new JoinQueryInfos
|
||||
// (
|
||||
// JoinType.Inner, a.item_group_id == b.id,
|
||||
// JoinType.Inner, b.id == c.item_group_id,
|
||||
// JoinType.Inner, c.item_id == d.id
|
||||
// ))
|
||||
// .Where(a => a.mold_id == moldId)
|
||||
// .Select((a, b, c, d) => new
|
||||
// {
|
||||
// item_group_id = b.id,
|
||||
// item_group_name = b.name,
|
||||
// item_id = d.id,
|
||||
// item_name = d.name,
|
||||
// status = d.status,
|
||||
// }).ToListAsync();
|
||||
return checkItems;
|
||||
}
|
||||
return Enumerable.Empty<dynamic>();
|
||||
@@ -127,48 +146,67 @@ namespace Tnb.EquipMgr
|
||||
[HttpPost]
|
||||
public async Task MaintainStart(MoldMaintainRunUpInput input)
|
||||
{
|
||||
if (input == null) throw new ArgumentNullException("input");
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
var dic = await _dictionaryDataService.GetDicByTypeId(DictConst.MaintainStatusTypeId);
|
||||
var plan = await _db.Queryable<ToolMoldMaintainPlan>().FirstAsync(it => it.id == input.plan_id);
|
||||
if (plan != null)
|
||||
var mold = await _db.Queryable<ToolMolds>().FirstAsync(it => it.id == input.mold_id);
|
||||
if (mold != null)
|
||||
{
|
||||
plan.status = DictConst.MoldMaintainStatusDBYCode;
|
||||
var row = await _db.Updateable(plan).ExecuteCommandAsync();
|
||||
if (row < 1) throw Oops.Oh(ErrorCode.COM1001);
|
||||
ToolMoldMaintainRunRecord record = new();
|
||||
record.plan_code = plan.plan_code;
|
||||
record.mode = plan.mode;
|
||||
record.plan_status = dic.ContainsKey(plan.plan_code) ? dic[plan.plan_code].ToString() : "";
|
||||
record.designer = _userManager.RealName;
|
||||
record.designer_time = DateTime.Now;
|
||||
var moldPlanRelation = await _db.Queryable<ToolMoldMaintainPlanRelation>().FirstAsync(it => it.maintain_plan_id == input.plan_id);
|
||||
if (moldPlanRelation != null)
|
||||
mold.mold_status = MoldUseStatus.MOLD_USE_STATUS_MAINTAIN_ID;
|
||||
var isOk = await _db.Updateable<ToolMolds>(mold).Where(it => it.id == input.mold_id).ExecuteCommandHasChangeAsync();
|
||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||
var plan = await _db.Queryable<ToolMoldMaintainPlanRelation>().LeftJoin<ToolMoldMaintainPlan>((a, b) => a.maintain_plan_id == b.id)
|
||||
.Where(a => a.mold_id == input.mold_id).Select((a, b) => b).FirstAsync();
|
||||
|
||||
if (plan is not null)
|
||||
{
|
||||
var mold = await _db.Queryable<ToolMolds>().FirstAsync(it => it.id == moldPlanRelation.mold_id);
|
||||
record.mold_code = mold?.mold_code;
|
||||
record.mold_name = mold?.mold_name;
|
||||
var moldGroupRelation = await _db.Queryable<ToolMoldMaintainGroupRelation>().FirstAsync(it => it.mold_id == mold.id);
|
||||
if (moldGroupRelation != null)
|
||||
{
|
||||
var maintainGroup = await _db.Queryable<ToolMoldMaintainGroup>().FirstAsync(it => it.id == moldGroupRelation.item_group_id);
|
||||
record.group_name = maintainGroup.name;
|
||||
var itemGrpRelation = await _db.Queryable<ToolMoldMaintainGroupItem>().FirstAsync(it => it.item_group_id == maintainGroup.id);
|
||||
if (itemGrpRelation != null)
|
||||
//插入保养计划记录
|
||||
ToolMoldMaintainRunRecord record = new();
|
||||
record.plan_code = plan.plan_code;
|
||||
record.mode = plan.mode;
|
||||
record.plan_status = dic.ContainsKey(plan.plan_code) ? dic[plan.plan_code].ToString() : "";
|
||||
record.designer = _userManager.RealName;
|
||||
record.designer_time = DateTime.Now;
|
||||
record.mold_code = mold.mold_code;
|
||||
record.mold_name = mold.mold_name;
|
||||
record.plan_start_time = DateTime.Now;
|
||||
var row = await _db.Insertable(record).ExecuteCommandAsync();
|
||||
if (row < 1) throw Oops.Oh(ErrorCode.COM1001);
|
||||
|
||||
var maintainInfos = await _db.Queryable<ToolMoldMaintainGroupRelation>()
|
||||
.LeftJoin<ToolMoldMaintainGroup>((a, b) => a.item_group_id == b.id)
|
||||
.LeftJoin<ToolMoldMaintainGroupItem>((a, b, c) => b.id == c.item_group_id)
|
||||
.LeftJoin<ToolMoldMaintainItem>((a, b, c, d) => c.item_id == d.id)
|
||||
.Where(a => a.mold_id == input.mold_id)
|
||||
.Select((a, b, c, d) => new
|
||||
{
|
||||
var checkItem = await _db.Queryable<ToolMoldMaintainItem>().FirstAsync(it => it.id == itemGrpRelation.item_id);
|
||||
record.check_item_name = checkItem.name;
|
||||
group_id = b.id,
|
||||
group_name = b.name,
|
||||
check_item_id = d.id,
|
||||
check_item_name = d.name
|
||||
})
|
||||
.ToListAsync();
|
||||
if (maintainInfos?.Count > 0)
|
||||
{
|
||||
List<ToolMoldMaintainRunRecordD> recordDs = new();
|
||||
foreach (var info in maintainInfos)
|
||||
{
|
||||
ToolMoldMaintainRunRecordD record_d = new();
|
||||
record_d.group_id = info.group_id;
|
||||
record_d.group_name = info.group_name;
|
||||
record_d.check_item_id = info.check_item_id;
|
||||
record_d.check_item_name = info.check_item_name;
|
||||
recordDs.Add(record_d);
|
||||
}
|
||||
row = await _db.Insertable(recordDs).ExecuteCommandAsync();
|
||||
if (row < 1) throw Oops.Oh(ErrorCode.COM1001);
|
||||
}
|
||||
}
|
||||
record.plan_start_time = DateTime.Now;
|
||||
row = await _db.Insertable(record).ExecuteCommandAsync();
|
||||
if (row < 1) throw Oops.Oh(ErrorCode.COM1001);
|
||||
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -183,9 +221,10 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
if (input == null) throw new ArgumentNullException("input");
|
||||
if (input.itemIds == null || input.itemIds.Count == 0) throw new ArgumentException($"parameter {nameof(input.itemIds)} not be null or empty");
|
||||
var row = await _db.Updateable<ToolMoldMaintainItem>().SetColumns(it => new ToolMoldMaintainItem { status = input.status }).Where(it => input.itemIds.Contains(it.id)).ExecuteCommandAsync();
|
||||
var row = await _db.Updateable<ToolMoldMaintainItemRecord>().SetColumns(it => new ToolMoldMaintainItemRecord { status = 1 }).Where(it => input.itemIds.Contains(it.id)).ExecuteCommandAsync();
|
||||
if (row < 1) throw Oops.Oh(ErrorCode.COM1001);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 模具保养计划执行-保养完成
|
||||
/// </summary>
|
||||
@@ -204,18 +243,18 @@ namespace Tnb.EquipMgr
|
||||
var itemIds = await _db.Queryable<ToolMoldMaintainGroupItem>().Where(it => grpIds.Contains(it.item_group_id)).Select(it => it.item_id).ToListAsync();
|
||||
if (itemIds?.Count > 0)
|
||||
{
|
||||
var items = await _db.Queryable<ToolMoldMaintainItem>().Where(it => itemIds.Contains(it.id) && it.status.HasValue && it.status.Value == 1).ToListAsync();
|
||||
var items = await _db.Queryable<ToolMoldMaintainItemRecord>().Where(it => it.mold_id == input.mold_id && it.status == 1).ToListAsync();
|
||||
if (items?.Count < itemIds.Count)
|
||||
{
|
||||
throw new AppFriendlyException("当前模具有未完成的保养项目", 500);
|
||||
}
|
||||
var row = await _db.Updateable<ToolMolds>().SetColumns(it => new ToolMolds { mold_status = MoldUseStatus.MOLDUSESTATUSZKID }).Where(it => it.id == input.mold_id).ExecuteCommandAsync();
|
||||
var row = await _db.Updateable<ToolMolds>().SetColumns(it => new ToolMolds { mold_status = MoldUseStatus.MOLD_USE_STATUS_ZK_ID }).Where(it => it.id == input.mold_id).ExecuteCommandAsync();
|
||||
if (row < 1) throw Oops.Oh(ErrorCode.COM1001);
|
||||
var allMoldStatus = await _db.Queryable<ToolMoldMaintainPlanRelation>().InnerJoin<ToolMolds>((a, b) => a.mold_id == b.id)
|
||||
.Where((a, b) => a.maintain_plan_id == input.plan_id)
|
||||
.Select((a, b) => b.mold_status)
|
||||
.ToListAsync();
|
||||
if (allMoldStatus?.Count > 0 && allMoldStatus.All(x => x == MoldUseStatus.MOLDUSESTATUSZKID))
|
||||
if (allMoldStatus?.Count > 0 && allMoldStatus.All(x => x == MoldUseStatus.MOLD_USE_STATUS_ZK_ID))
|
||||
{
|
||||
row = await _db.Updateable<ToolMoldMaintainPlan>().SetColumns(it => new ToolMoldMaintainPlan { status = MoldPlanMaintainStatus.MOLDPLAN_MAINTAIN_STATUS_COMPLETED_CODE }).Where(it => it.id == input.plan_id).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 更换载具输入参数
|
||||
/// </summary>
|
||||
|
||||
public class ExChangeCarryInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 老载具ID
|
||||
/// </summary>
|
||||
public string old_carry_id { get; set; }
|
||||
/// <summary>
|
||||
/// 新载具ID
|
||||
/// </summary>
|
||||
public string new_carry_id { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -97,12 +97,12 @@ public partial class WmsCarryCode : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string create_id { get; set; } = string.Empty;
|
||||
public string? create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime create_time { get; set; } = DateTime.Now;
|
||||
public DateTime? create_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
|
||||
@@ -42,12 +42,12 @@ public partial class WmsCarryD : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string create_id { get; set; } = string.Empty;
|
||||
public string? create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime create_time { get; set; } = DateTime.Now;
|
||||
public DateTime? create_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后修改人员ID
|
||||
|
||||
@@ -42,7 +42,7 @@ public partial class WmsCarryH : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 载具状态
|
||||
/// </summary>
|
||||
public string carry_status { get; set; } = string.Empty;
|
||||
public int carry_status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 载具分类ID
|
||||
@@ -114,4 +114,19 @@ public partial class WmsCarryH : BaseEntity<string>
|
||||
/// </summary>
|
||||
public DateTime? timestamp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 打包号
|
||||
/// </summary>
|
||||
public string? bale_num { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 齐套搭配方案ID
|
||||
/// </summary>
|
||||
public string? collocation_scheme_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 齐套搭配方案编号
|
||||
/// </summary>
|
||||
public string? collocation_scheme_code { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -82,12 +82,12 @@ public partial class WmsCarryMat : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 时间戳
|
||||
/// </summary>
|
||||
public DateTime time_stamp { get; set; } = DateTime.Now;
|
||||
public DateTime? time_stamp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string create_id { get; set; } = string.Empty;
|
||||
public string? create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
|
||||
@@ -77,12 +77,12 @@ public partial class WmsCarryReplaceCode : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string create_id { get; set; } = string.Empty;
|
||||
public string? create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime create_time { get; set; } = DateTime.Now;
|
||||
public DateTime? create_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
@@ -94,9 +94,4 @@ public partial class WmsCarryReplaceCode : BaseEntity<string>
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 行号
|
||||
/// </summary>
|
||||
public int no { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public partial class WmsCarryReplaceH : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 租户ID
|
||||
/// </summary>
|
||||
public string tenant_id { get; set; } = string.Empty;
|
||||
public string? tenant_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属组织ID
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// 载具状态枚举
|
||||
/// </summary>
|
||||
public enum EnumCarryStatus
|
||||
{
|
||||
空闲 = 0,
|
||||
占用 = 1,
|
||||
齐套 = 3,
|
||||
寄存 = 4,
|
||||
齐套分拣 = 5,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// 出库状态
|
||||
/// </summary>
|
||||
public enum EnumOutStatus
|
||||
{
|
||||
正常 = 0,
|
||||
全部出 = 1,
|
||||
分拣出 = 2,
|
||||
齐套出 = 3,
|
||||
寄存出 = 4,
|
||||
齐套分拣出 = 5,
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace Tnb.WarehouseMgr.Interfaces
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
13
WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryEntity.cs
Normal file
13
WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryEntity.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Interfaces
|
||||
{
|
||||
public class IWmsCarryEntity
|
||||
{
|
||||
string carry_id { get; set; }
|
||||
}
|
||||
}
|
||||
17
WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryService.cs
Normal file
17
WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryService.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// 载具服务接口
|
||||
/// </summary>
|
||||
public interface IWmsCarryService
|
||||
{
|
||||
/// <summary>
|
||||
/// 更新空载具
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
Task<int> UpdateNullCarry(WmsCarryH carryObj);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
137
WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs
Normal file
137
WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs
Normal file
@@ -0,0 +1,137 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.Common.Utils;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Entities.Enums;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 载具服务
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
|
||||
public class WmsCarryService : IWmsCarryService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IUserManager _userManager;
|
||||
public WmsCarryService(ISqlSugarRepository<WmsCarryH> repository, IUserManager userManager)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
_userManager = userManager;
|
||||
}
|
||||
/// <summary>
|
||||
/// 更换载具
|
||||
/// </summary>
|
||||
/// <param name="input">
|
||||
/// 输入参数:
|
||||
/// <br/>{
|
||||
/// <br/> old_carry_id:老载具id
|
||||
/// <br/> new_carry_id:新载具ID
|
||||
/// <br/>}
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
[HttpPost]
|
||||
public async Task Exchange(ExChangeCarryInput input)
|
||||
{
|
||||
var row = -1;
|
||||
if (input == null) throw new ArgumentNullException("input");
|
||||
var oldCarry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == input.old_carry_id && it.is_lock == 0 && it.status == 0 && it.carry_status != 0);
|
||||
var newCarry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == input.new_carry_id && it.is_lock == 0 && it.status == 0 && it.carry_status == 0);
|
||||
if (oldCarry != null && newCarry != null)
|
||||
{
|
||||
var subCarrys = await _db.Queryable<WmsCarryD>().Where(it => it.carry_id == oldCarry.id).ToListAsync();
|
||||
if (subCarrys?.Count > 0)
|
||||
{
|
||||
List<WmsCarryD> newSubCarrys = DeepCopyHelper<WmsCarryD>.DeepCopyList(subCarrys);
|
||||
if (newSubCarrys?.Count > 0)
|
||||
{
|
||||
newSubCarrys.ForEach(x => x.carry_id = newCarry.id);
|
||||
row = await _db.Insertable(newSubCarrys).ExecuteCommandAsync();
|
||||
}
|
||||
if (row > 0)
|
||||
{
|
||||
row = await _db.Deleteable(subCarrys).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
var subCarryMats = await _db.Queryable<WmsCarryMat>().Where(it => it.carry_id == oldCarry.id).ToListAsync();
|
||||
if (subCarryMats?.Count > 0)
|
||||
{
|
||||
List<WmsCarryMat> newCarryMats = DeepCopyHelper<WmsCarryMat>.DeepCopyList(subCarryMats);
|
||||
if (newCarryMats?.Count > 0)
|
||||
{
|
||||
newCarryMats.ForEach(x => x.carry_id = newCarry.id);
|
||||
row = await _db.Insertable(newCarryMats).ExecuteCommandAsync();
|
||||
}
|
||||
if (row > 0)
|
||||
{
|
||||
row = await _db.Deleteable(subCarryMats).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
var subCarryCodes = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == oldCarry.id).ToListAsync();
|
||||
if (subCarryCodes?.Count > 0)
|
||||
{
|
||||
List<WmsCarryCode> newCarrayCodes = DeepCopyHelper<WmsCarryCode>.DeepCopyList(subCarryCodes);
|
||||
if (newCarrayCodes?.Count > 0)
|
||||
{
|
||||
newCarrayCodes.ForEach(x => x.carry_id = newCarry.id);
|
||||
row = await _db.Insertable(newCarrayCodes).ExecuteCommandAsync();
|
||||
}
|
||||
if (row > 0)
|
||||
{
|
||||
row = await _db.Deleteable(subCarryCodes).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
if (row > 0)
|
||||
{
|
||||
newCarry.carry_name = oldCarry.carry_name;
|
||||
newCarry.status = oldCarry.status;
|
||||
newCarry.carry_status = oldCarry.carry_status;
|
||||
newCarry.carrystd_id = oldCarry.carrystd_id;
|
||||
newCarry.location_id = oldCarry.location_id;
|
||||
newCarry.carry_code = oldCarry.location_code;
|
||||
newCarry.is_lock = oldCarry.is_lock;
|
||||
newCarry.out_status = oldCarry.out_status;
|
||||
newCarry.is_check = oldCarry.is_check;
|
||||
newCarry.bale_num = oldCarry.bale_num;
|
||||
newCarry.collocation_scheme_id = oldCarry.collocation_scheme_id;
|
||||
newCarry.collocation_scheme_code = oldCarry.collocation_scheme_code;
|
||||
newCarry.source_id = oldCarry.source_id;
|
||||
newCarry.source_code = oldCarry.source_code;
|
||||
newCarry.create_id = _userManager.UserId;
|
||||
newCarry.create_time = DateTime.Now;
|
||||
row = await _db.Updateable(newCarry).ExecuteCommandAsync();
|
||||
row = await UpdateNullCarry(oldCarry);
|
||||
}
|
||||
}
|
||||
if (row < 1) throw Oops.Oh(ErrorCode.COM1001);
|
||||
}
|
||||
|
||||
public Task<int> UpdateNullCarry(WmsCarryH carryObj)
|
||||
{
|
||||
carryObj.carry_name = null;
|
||||
carryObj.status = 0;
|
||||
carryObj.carry_status = 0;
|
||||
carryObj.carrystd_id = null;
|
||||
carryObj.location_id = null;
|
||||
carryObj.carry_code = null;
|
||||
carryObj.out_status = null;
|
||||
carryObj.is_check = 0;
|
||||
carryObj.bale_num = null;
|
||||
carryObj.collocation_scheme_id = null;
|
||||
carryObj.collocation_scheme_code = null;
|
||||
carryObj.source_id = null;
|
||||
carryObj.source_code = null;
|
||||
return _db.Updateable(carryObj).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
76
common/Tnb.Common/Utils/DeepCopyHelper.cs
Normal file
76
common/Tnb.Common/Utils/DeepCopyHelper.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.Common.Utils
|
||||
{
|
||||
public class DeepCopyHelper<T> where T : class, new() // 需要无参构造函数,构造表达式树的时候需要利用无参构造函数创建对象
|
||||
{
|
||||
/// <summary>
|
||||
/// 映射表达式,泛型缓存每个类型存一份
|
||||
/// </summary>
|
||||
private static readonly Func<T, T> s_CopyFunc = null;
|
||||
|
||||
/// <summary>
|
||||
/// 静态构造函数,每个泛型类型会且只会执行一次
|
||||
/// </summary>
|
||||
static DeepCopyHelper()
|
||||
{
|
||||
BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
|
||||
ParameterExpression parameterExpression = Expression.Parameter(typeof(T), "m"); // 参数m :m =>
|
||||
List<MemberBinding> memberBindingList = new List<MemberBinding>();
|
||||
foreach (var item in typeof(T).GetProperties(bindingFlags))
|
||||
{
|
||||
if (!item.CanWrite) // 只读属性不拷贝
|
||||
{
|
||||
continue;
|
||||
}
|
||||
MemberExpression property = Expression.Property(parameterExpression, item); // m.Name
|
||||
MemberBinding memberBinding = Expression.Bind(item, property); // Name = m.Name
|
||||
memberBindingList.Add(memberBinding);
|
||||
}
|
||||
foreach (var item in typeof(T).GetFields(bindingFlags))
|
||||
{
|
||||
MemberExpression property = Expression.Field(parameterExpression, item);
|
||||
MemberBinding memberBinding = Expression.Bind(item, property);
|
||||
memberBindingList.Add(memberBinding);
|
||||
}
|
||||
MemberInitExpression memberInitExpression = Expression.MemberInit(Expression.New(typeof(T)), memberBindingList.ToArray());// new T() {Name = m.Name}
|
||||
Expression<Func<T, T>> lambda = Expression.Lambda<Func<T, T>>(memberInitExpression, new ParameterExpression[]
|
||||
{
|
||||
parameterExpression
|
||||
}); // m => new T() {Name = m.Name}
|
||||
|
||||
s_CopyFunc = lambda.Compile();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 对象拷贝(拷贝private/public:实例成员、属性、静态成员)
|
||||
/// </summary>
|
||||
/// <param name="data">源</param>
|
||||
/// <returns></returns>
|
||||
public static T DeepCopy(T data)
|
||||
{
|
||||
return s_CopyFunc(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 集合拷贝(拷贝private/public:实例成员、属性、静态成员)
|
||||
/// </summary>
|
||||
/// <param name="data">源</param>
|
||||
/// <returns></returns>
|
||||
public static List<T> DeepCopyList(List<T> data)
|
||||
{
|
||||
if (data == null || data.Count < 1)
|
||||
{
|
||||
return Enumerable.Empty<T>().ToList();
|
||||
}
|
||||
return data.Select(a => DeepCopy(a)).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user