diff --git a/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs b/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs
index c2d54a15..eecc7bef 100644
--- a/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs
+++ b/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs
@@ -19,7 +19,10 @@ public static class DictConst
/// 生产任务状态TypeId
///
public const string PrdTaskStatusTypeId = "25572555259157";
-
+ ///
+ /// 生产工单类型TypeId
+ ///
+ public const string PrdMoTypeTypeId = "25019155728149";
///
/// 工单状态-已排产
@@ -87,10 +90,6 @@ public static class DictConst
/// 模具保养状态-待保养编码
///
public const string MoldMaintainStatusDBYCode = "UnMaintain";
- ///
- /// 模具保养状态TypeId
- ///
- public const string MoldMaintainStatusTypeId = "26171564065301";
@@ -111,6 +110,10 @@ public static class DictConst
///
public const string MaintainStatusTypeId = "26171564065301";
///
+ /// 模具保养状态TypeId
+ ///
+ public const string MoldMaintainStatusTypeId = "26149299883285";
+ ///
/// 保养状态待保养Code
///
public const string UnMaintainStatusCode = "UnMaintain";
diff --git a/BasicData/Tnb.BasicData.Entities/Dto/SubBomListOutput.cs b/BasicData/Tnb.BasicData.Entities/Dto/SubBomListOutput.cs
index a666855d..7f382d40 100644
--- a/BasicData/Tnb.BasicData.Entities/Dto/SubBomListOutput.cs
+++ b/BasicData/Tnb.BasicData.Entities/Dto/SubBomListOutput.cs
@@ -26,7 +26,7 @@ namespace Tnb.BasicData.Entities.Dto
///
/// 物料型号
///
- public string material_category_code { get; set; }
+ public string material_standard { get; set; }
///
///输出数量
///
@@ -35,5 +35,34 @@ namespace Tnb.BasicData.Entities.Dto
/// 数量
///
public string num { get; set;}
+ ///
+ /// 单位id
+ ///
+ public string unit_id { get; set; }
+ ///
+ /// bomid
+ ///
+ public string bom_id { get; set; }
+ ///
+ /// 工艺路线id
+ ///
+ public string route_id { get; set; }
+ ///
+ /// 工序id
+ ///
+ public string process_id { get; set; }
+ ///
+ /// bom版本
+ ///
+ public string version { get; set; }
+
+ ///
+ /// 工艺路线名称
+ ///
+ public string route_name { get; set; }
+ ///
+ /// 工序排序序号
+ ///
+ public long? ordinal { get; set; }
}
}
diff --git a/BasicData/Tnb.BasicData/BasMbomService.cs b/BasicData/Tnb.BasicData/BasMbomService.cs
index 62ec0678..f92b105c 100644
--- a/BasicData/Tnb.BasicData/BasMbomService.cs
+++ b/BasicData/Tnb.BasicData/BasMbomService.cs
@@ -133,35 +133,54 @@ namespace Tnb.BasicData
///
/// 根据bomid获取对应的子bom列表
///
- ///
+ /// bomId
///
+ ///
+ ///
+ /// returns:
+ ///
{
+ ///
version:bom版本
+ ///
unit_id:单位id
+ ///
route_name:工艺路线名称
+ ///
process_id:工序id
+ ///
material_id:物料id
+ ///
material_code:物料编码
+ ///
material_name:物料名称
+ ///
material_category_code:类别code
+ ///
output_qty:输出参数
+ ///
}
+ ///
[HttpGet]
public async Task GetSubMoListByBomId([FromRoute] string bomId)
{
+
if (string.IsNullOrEmpty(bomId)) throw new ArgumentException($"parameter {nameof(bomId)} not be null or empty");
- var result = await _db.Queryable().LeftJoin((a, b) => a.route_id == b.route_id)
- .LeftJoin((a, b, c) => b.process_id == c.id)
- .LeftJoin((a, b, c, d) => c.id == d.process_id)
- .LeftJoin((a, b, c, d, e) => d.material_id == e.id)
- .LeftJoin((a, b, c, d, e, f) => e.category_id == f.id)
- .Where((a, b, c, d, e, f) => a.id == bomId)
- .Select((a, b, c, d, e, f) => new SubBomListOutput
- {
- material_id = e.id,
- material_code = e.code,
- material_name = e.name,
- material_category_code = f.category_code,
- num = d.num
- })
- .Mapper(it => it.output_qty = it.num.ParseToInt())
- .Distinct()
- .ToListAsync();
+
+ var result = await _db.Queryable()
+ .LeftJoin((a, b) => a.id == b.mbom_id)
+ .LeftJoin((a, b, c) => a.route_id == c.id)
+ .LeftJoin((a, b, c, d) => b.process_id == d.process_id && c.id == d.route_id)
+ .LeftJoin((a, b, c, d, e) => a.id == e.mbom_id && e.mbom_process_id == b.id)
+ .Where((a, b, c, d, e) => a.id == bomId)
+ .Select((a, b, c, d, e) => new SubBomListOutput
+ {
+ version = a.version,
+ unit_id = a.unit_id,
+ route_name = c.name,
+ process_id = b.process_id,
+ material_id = SqlFunc.Subqueryable().Where(it => it.id == e.material_id).Select(it => it.id),
+ material_code = SqlFunc.Subqueryable().Where(it => it.id == e.material_id).Select(it => it.code),
+ material_name = SqlFunc.Subqueryable().Where(it => it.id == e.material_id).Select(it => it.name),
+ material_standard = SqlFunc.Subqueryable().Where(it => it.id == e.material_id).Select(it => it.material_standard),
+ num = e.num,
+ ordinal = d.ordinal,
+ })
+ .Mapper(it => it.output_qty = it.num.ParseToInt())
+ .ToListAsync();
+
return result;
}
-
-
-
///
/// 根据物料id获取生产bom
///
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Consts/MoldPlanMaintainStatus.cs b/EquipMgr/Tnb.EquipMgr.Entities/Consts/MoldPlanMaintainStatus.cs
new file mode 100644
index 00000000..f013c856
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Consts/MoldPlanMaintainStatus.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tnb.EquipMgr.Entities.Consts
+{
+ public class MoldPlanMaintainStatus
+ {
+ ///
+ /// 模具保养计划状态-已完成CODE
+ ///
+ public const string MOLDPLAN_MAINTAIN_STATUS_COMPLETED_CODE = "Completed";
+ }
+}
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Consts/MoldUseStatus.cs b/EquipMgr/Tnb.EquipMgr.Entities/Consts/MoldUseStatus.cs
new file mode 100644
index 00000000..db9570c7
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Consts/MoldUseStatus.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tnb.EquipMgr.Entities.Consts
+{
+ public class MoldUseStatus
+ {
+ ///
+ /// 模具使用状态在库状态ID
+ ///
+ public const string MOLDUSESTATUSZKID = "26149307089941";
+ }
+}
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainRecordRepeatInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainRecordRepeatInput.cs
new file mode 100644
index 00000000..83b7df9a
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainRecordRepeatInput.cs
@@ -0,0 +1,13 @@
+namespace Tnb.EquipMgr.Entities.Dto
+{
+ public class MaintainRecordRepeatInput
+ {
+ public string id { get; set; }
+
+ public string repeat_result { get; set; }
+
+ public string repeat_remark { get; set; }
+
+ public List> details { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainRecordRepeatOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainRecordRepeatOutput.cs
new file mode 100644
index 00000000..d262d480
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainRecordRepeatOutput.cs
@@ -0,0 +1,9 @@
+namespace Tnb.EquipMgr.Entities.Dto
+{
+ public class MaintainRecordRepeatOutput
+ {
+ public EqpMaintainRecordH model { get; set; }
+
+ public List details { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainPlanRunQueryOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainPlanRunQueryOutput.cs
new file mode 100644
index 00000000..5a80c60a
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainPlanRunQueryOutput.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tnb.EquipMgr.Entities.Dto
+{
+ ///
+ /// 模具保养计划执行查询输出参数
+ ///
+ public class MoldMaintainPlanRunQueryOutput
+ {
+ ///
+ /// 保养开始时间
+ ///
+ public string? start_time { get; set; }
+ ///
+ /// 模具编码
+ ///
+ public string mold_code { get; set; }
+ ///
+ /// 模具名称
+ ///
+ public string mold_name { get; set; }
+ ///
+ /// 保养完成打磨次
+ ///
+ public int? maintain_qty { get; set; }
+ ///
+ /// 模具状态
+ ///
+ public string mold_status { get; set; }
+ ///
+ /// 设备编码
+ ///
+ public string eqp_code { get; set; }
+ ///
+ /// 设备名称
+ ///
+ public string eqp_name { get; set; }
+ ///
+ /// 保养人
+ ///
+ public string operator_name { get; set; }
+ ///
+ /// 保养项信息
+ ///
+ public List check_items { get; set; }
+
+ }
+
+ public class CheckItemInfo
+ {
+ ///
+ /// 项目组id
+ ///
+ public string item_group_id { get; set; }
+ ///
+ /// 项目组名称
+ ///
+ public string item_group_name { get; set; }
+ ///
+ /// 保养项id
+ ///
+ public string item_id { get; set; }
+ ///
+ /// 保养项名称
+ ///
+ public string item_name { get; set; }
+ }
+}
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainRunUpInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainRunUpInput.cs
index 7861402d..a286ba6f 100644
--- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainRunUpInput.cs
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainRunUpInput.cs
@@ -15,5 +15,17 @@ namespace Tnb.EquipMgr.Entities.Dto
/// 执行计划id
///
public string plan_id { get; set; }
+ ///
+ /// 保养项Ids
+ ///
+ public ListitemIds { get; set; }
+ ///
+ /// 保养项状态 0,未完成 1,已完成
+ ///
+ public int? status { get; set; }
+ ///
+ /// 模具id
+ ///
+ public string mold_id { get; set; }
}
}
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairApplyDetailOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairApplyDetailOutput.cs
new file mode 100644
index 00000000..34c6c8e0
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairApplyDetailOutput.cs
@@ -0,0 +1,8 @@
+namespace Tnb.EquipMgr.Entities.Dto
+{
+ public class RepairApplyDetailOutput
+ {
+ public EqpRepairApply eqpRepairApply { get; set; }
+ public EqpRepairOutApply eqpRepairOutApply { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairApplyOutRegisterInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairApplyOutRegisterInput.cs
new file mode 100644
index 00000000..22d61759
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairApplyOutRegisterInput.cs
@@ -0,0 +1,42 @@
+namespace Tnb.EquipMgr.Entities.Dto
+{
+ public class RepairApplyOutRegisterInput
+ {
+ public string id { get; set; }
+
+ ///
+ /// 实际维修供应商id
+ ///
+ public string? real_supplier_id { get; set; }
+
+ ///
+ /// 附件
+ ///
+ public string? attachment { get; set; }
+
+ ///
+ /// 费用
+ ///
+ public decimal? cost { get; set; }
+
+ ///
+ /// 修复时间
+ ///
+ public DateTime? repair_time { get; set; }
+
+ ///
+ /// 维修耗时
+ ///
+ public decimal? repair_take_time { get; set; }
+
+ ///
+ /// 维修备注
+ ///
+ public string? repair_remark { get; set; }
+
+ ///
+ /// 报修申请id
+ ///
+ public string repair_apply_id { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairApplyRegisterInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairApplyRegisterInput.cs
index 6004ec09..d7790a52 100644
--- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairApplyRegisterInput.cs
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairApplyRegisterInput.cs
@@ -40,9 +40,9 @@ namespace Tnb.EquipMgr.Entities.Dto
public string? repair_description { get; set; }
///
- /// 附件
+ /// 维修图片
///
- public string? attachment { get; set; }
+ public string? repair_img { get; set; }
///
/// 是否外修
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpEquipFile.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpEquipFile.cs
new file mode 100644
index 00000000..b2919f9b
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpEquipFile.cs
@@ -0,0 +1,57 @@
+using JNPF.Common.Contracts;
+using JNPF.Common.Security;
+using SqlSugar;
+
+namespace Tnb.EquipMgr.Entities;
+
+///
+/// 设备附件表
+///
+[SugarTable("eqp_equip_file")]
+public partial class EqpEquipFile : BaseEntity
+{
+ public EqpEquipFile()
+ {
+ id = SnowflakeIdHelper.NextId();
+ }
+ ///
+ /// 设备id
+ ///
+ public string equip_id { get; set; } = string.Empty;
+
+ ///
+ /// 附件
+ ///
+ public string attachment { get; set; } = string.Empty;
+
+ ///
+ /// 文件名
+ ///
+ public string file_name { get; set; } = string.Empty;
+
+ ///
+ /// 创建用户
+ ///
+ public string? create_id { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public DateTime? create_time { get; set; }
+
+ ///
+ /// 修改用户
+ ///
+ public string? modify_id { get; set; }
+
+ ///
+ /// 修改时间
+ ///
+ public DateTime? modify_time { get; set; }
+
+ ///
+ /// 所属组织
+ ///
+ public string? org_id { get; set; }
+
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpEquipScrap.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpEquipScrap.cs
new file mode 100644
index 00000000..faefe3ed
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpEquipScrap.cs
@@ -0,0 +1,82 @@
+using JNPF.Common.Contracts;
+using JNPF.Common.Security;
+using SqlSugar;
+
+namespace Tnb.EquipMgr.Entities;
+
+///
+/// 设备报废表
+///
+[SugarTable("eqp_equip_scrap")]
+public partial class EqpEquipScrap : BaseEntity
+{
+ public EqpEquipScrap()
+ {
+ id = SnowflakeIdHelper.NextId();
+ }
+ ///
+ /// 编码
+ ///
+ public string code { get; set; } = string.Empty;
+
+ ///
+ /// 报废时间
+ ///
+ public DateTime scrap_time { get; set; } = DateTime.Now;
+
+ ///
+ /// 设备id
+ ///
+ public string equip_id { get; set; } = string.Empty;
+
+ ///
+ /// 负责人id
+ ///
+ public string charger_id { get; set; } = string.Empty;
+
+ ///
+ /// 负责人姓名
+ ///
+ public string charger_name { get; set; } = string.Empty;
+
+ ///
+ /// 负责人电话
+ ///
+ public string? charger_phone { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string? remark { get; set; }
+
+ ///
+ /// 创建用户
+ ///
+ public string? create_id { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public DateTime? create_time { get; set; }
+
+ ///
+ /// 修改用户
+ ///
+ public string? modify_id { get; set; }
+
+ ///
+ /// 修改时间
+ ///
+ public DateTime? modify_time { get; set; }
+
+ ///
+ /// 所属组织
+ ///
+ public string? org_id { get; set; }
+
+ ///
+ /// 附件
+ ///
+ public string? attachment { get; set; }
+
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainItem.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainItem.cs
index 1c6c27be..754685cf 100644
--- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainItem.cs
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainItem.cs
@@ -5,7 +5,7 @@ using SqlSugar;
namespace Tnb.EquipMgr.Entities;
///
-/// 保养项目
+/// 设备保养项目
///
[SugarTable("eqp_maintain_item")]
public partial class EqpMaintainItem : BaseEntity
@@ -34,25 +34,20 @@ public partial class EqpMaintainItem : BaseEntity
///
public string? modify_id { get; set; }
- ///
- /// 设备类型
- ///
- public string? equip_type_id { get; set; }
-
///
/// 项目编码
///
- public string? item_code { get; set; }
+ public string? code { get; set; }
///
/// 项目名称
///
- public string? item_name { get; set; }
+ public string? name { get; set; }
///
/// 保养类型
///
- public int? maintain_type { get; set; }
+ public string maintain_type { get; set; }
///
/// 保养内容
@@ -74,79 +69,9 @@ public partial class EqpMaintainItem : BaseEntity
///
public int? ordinal { get; set; }
- ///
- /// 是否启用
- ///
- public int? enabled { get; set; }
-
- ///
- /// TODO
- ///
- public string? extend01 { get; set; }
-
- ///
- /// TODO
- ///
- public string? extend02 { get; set; }
-
- ///
- /// TODO
- ///
- public string? extend03 { get; set; }
-
- ///
- /// TODO
- ///
- public string? extend04 { get; set; }
-
- ///
- /// TODO
- ///
- public string? extend05 { get; set; }
-
- ///
- /// TODO
- ///
- public string? extend06 { get; set; }
-
- ///
- /// TODO
- ///
- public string? extend07 { get; set; }
-
- ///
- /// TODO
- ///
- public string? extend08 { get; set; }
-
- ///
- /// TODO
- ///
- public string? extend09 { get; set; }
-
- ///
- /// TODO
- ///
- public string? extend10 { get; set; }
-
- ///
- /// 删除用户
- ///
- public string? delete_id { get; set; }
-
- ///
- /// 删除时间
- ///
- public DateTime? delete_time { get; set; }
-
- ///
- /// 删除标志
- ///
- public short? deleted { get; set; }
-
///
/// 所属组织
///
public string? org_id { get; set; }
-}
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainRecordD.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainRecordD.cs
new file mode 100644
index 00000000..215c962a
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainRecordD.cs
@@ -0,0 +1,92 @@
+using JNPF.Common.Contracts;
+using JNPF.Common.Security;
+using SqlSugar;
+
+namespace Tnb.EquipMgr.Entities;
+
+///
+/// 设备保养执行记录子表
+///
+[SugarTable("eqp_maintain_record_d")]
+public partial class EqpMaintainRecordD : BaseEntity
+{
+ public EqpMaintainRecordD()
+ {
+ id = SnowflakeIdHelper.NextId();
+ }
+ ///
+ /// 设备保养执行记录id
+ ///
+ public string maintain_record_id { get; set; } = string.Empty;
+
+ ///
+ /// 设备保养检项id
+ ///
+ public string maintain_item_id { get; set; } = string.Empty;
+
+ ///
+ /// 编码
+ ///
+ public string? code { get; set; }
+
+ ///
+ /// 名称
+ ///
+ public string? name { get; set; }
+
+ ///
+ /// 结果 1 通过 2 不通过
+ ///
+ public string? result { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string? remark { get; set; }
+
+ ///
+ /// 排序
+ ///
+ public long ordinal { get; set; }
+
+ ///
+ /// 设备保养设备模板id
+ ///
+ public string? maintain_tem_equip_id { get; set; }
+
+ ///
+ /// 是否通过
+ ///
+ public string? is_pass { get; set; }
+
+ ///
+ /// 保养项描述
+ ///
+ public string? descrip { get; set; }
+
+ ///
+ /// 保养类型
+ ///
+ public string maintain_type { get; set; } = string.Empty;
+
+ ///
+ /// 保养内容
+ ///
+ public string? maintain_content { get; set; }
+
+ ///
+ /// 保养结果描述
+ ///
+ public string? maintain_descrip { get; set; }
+
+ ///
+ /// 复核 1 通过 2 不通过
+ ///
+ public string? repeat_result { get; set; }
+
+ ///
+ /// 复核结果描述
+ ///
+ public string? repeat_descrip { get; set; }
+
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainRecordH.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainRecordH.cs
new file mode 100644
index 00000000..0b5aebc5
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainRecordH.cs
@@ -0,0 +1,167 @@
+using JNPF.Common.Contracts;
+using JNPF.Common.Security;
+using SqlSugar;
+
+namespace Tnb.EquipMgr.Entities;
+
+///
+/// 设备保养执行记录主表
+///
+[SugarTable("eqp_maintain_record_h")]
+public partial class EqpMaintainRecordH : BaseEntity
+{
+ public EqpMaintainRecordH()
+ {
+ id = SnowflakeIdHelper.NextId();
+ }
+ ///
+ /// 创建时间
+ ///
+ public DateTime? create_time { get; set; }
+
+ ///
+ /// 创建用户
+ ///
+ public string? create_id { get; set; }
+
+ ///
+ /// 修改时间
+ ///
+ public DateTime? modify_time { get; set; }
+
+ ///
+ /// 修改用户
+ ///
+ public string? modify_id { get; set; }
+
+ ///
+ /// 设备id
+ ///
+ public string equip_id { get; set; } = string.Empty;
+
+ ///
+ /// 设备保养设备模板id
+ ///
+ public string maintain_tem_equip_id { get; set; } = string.Empty;
+
+ ///
+ /// 结果1 合格2不合格
+ ///
+ public string? result { get; set; }
+
+ ///
+ /// 点巡检结果备注
+ ///
+ public string? result_remark { get; set; }
+
+ ///
+ /// 执行时间
+ ///
+ public DateTime? execute_time { get; set; }
+
+ ///
+ /// 状态 1待执行 2 待复核 3 已完成
+ ///
+ public string? status { get; set; }
+
+ ///
+ /// 执行人id
+ ///
+ public string? execute_user_id { get; set; }
+
+ ///
+ /// 设备类型id
+ ///
+ public string? equip_type_id { get; set; }
+
+ ///
+ /// 不合格推送
+ ///
+ public int? is_send { get; set; }
+
+ ///
+ /// 推送时间
+ ///
+ public DateTime? send_date_time { get; set; }
+
+ ///
+ /// 推送人id
+ ///
+ public string? send_id { get; set; }
+
+ ///
+ /// 编码
+ ///
+ public string? code { get; set; }
+
+ ///
+ /// 计划执行通知提前量
+ ///
+ public int? plan_run_notice { get; set; }
+
+ ///
+ /// 计划执行通知提前量单位 1 小时 2 天 3 周
+ ///
+ public string? plan_run_notice_unit { get; set; }
+
+ ///
+ /// 执行滞后推送时间
+ ///
+ public int? plan_delay { get; set; }
+
+ ///
+ /// 执行滞后推送时间单位 1 小时 2 天 3 周
+ ///
+ public string? plan_delay_unit { get; set; }
+
+ ///
+ /// 复核岗位id
+ ///
+ public string? repeat_post_info_user_id { get; set; }
+
+ ///
+ /// 责任岗位id
+ ///
+ public string? send_post_info_user_id { get; set; }
+
+ ///
+ /// 是否复核
+ ///
+ public string? is_repeat { get; set; }
+
+ ///
+ /// 复核时间
+ ///
+ public DateTime? repeat_time { get; set; }
+
+ ///
+ /// 复核备注
+ ///
+ public string? repeat_remark { get; set; }
+
+ ///
+ /// 复核人id
+ ///
+ public string? repeat_user_id { get; set; }
+
+ ///
+ /// 仅用于关联表字段查询用不存储数据
+ ///
+ public string? query_info { get; set; }
+
+ ///
+ /// 附件
+ ///
+ public string? attachment { get; set; }
+
+ ///
+ /// 复核结果
+ ///
+ public string? repeat_result { get; set; }
+
+ ///
+ /// 所属组织
+ ///
+ public string? org_id { get; set; }
+
+}
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainTemD.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainTemD.cs
new file mode 100644
index 00000000..b33f7c47
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainTemD.cs
@@ -0,0 +1,27 @@
+using JNPF.Common.Contracts;
+using JNPF.Common.Security;
+using SqlSugar;
+
+namespace Tnb.EquipMgr.Entities;
+
+///
+/// 设备保养模板子表
+///
+[SugarTable("eqp_maintain_tem_d")]
+public partial class EqpMaintainTemD : BaseEntity
+{
+ public EqpMaintainTemD()
+ {
+ id = SnowflakeIdHelper.NextId();
+ }
+ ///
+ /// 设备保养模板主表id
+ ///
+ public string maintain_tem_id { get; set; } = string.Empty;
+
+ ///
+ /// 设备保养项id
+ ///
+ public string maintain_item_id { get; set; } = string.Empty;
+
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainTemEquipD.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainTemEquipD.cs
new file mode 100644
index 00000000..7f5cf251
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainTemEquipD.cs
@@ -0,0 +1,27 @@
+using JNPF.Common.Contracts;
+using JNPF.Common.Security;
+using SqlSugar;
+
+namespace Tnb.EquipMgr.Entities;
+
+///
+/// 设备保养设备模板子表
+///
+[SugarTable("eqp_maintain_tem_equip_d")]
+public partial class EqpMaintainTemEquipD : BaseEntity
+{
+ public EqpMaintainTemEquipD()
+ {
+ id = SnowflakeIdHelper.NextId();
+ }
+ ///
+ /// 设备保养设备模板主表id
+ ///
+ public string maintain_tem_equip_id { get; set; } = string.Empty;
+
+ ///
+ /// 设备保养项id
+ ///
+ public string maintain_item_id { get; set; } = string.Empty;
+
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainTemEquipH.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainTemEquipH.cs
new file mode 100644
index 00000000..27755b9c
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainTemEquipH.cs
@@ -0,0 +1,137 @@
+using JNPF.Common.Contracts;
+using JNPF.Common.Security;
+using SqlSugar;
+
+namespace Tnb.EquipMgr.Entities;
+
+///
+/// 设备保养设备模板主表
+///
+[SugarTable("eqp_maintain_tem_equip_h")]
+public partial class EqpMaintainTemEquipH : BaseEntity
+{
+ public EqpMaintainTemEquipH()
+ {
+ id = SnowflakeIdHelper.NextId();
+ }
+ ///
+ /// 创建时间
+ ///
+ public DateTime create_time { get; set; } = DateTime.Now;
+
+ ///
+ /// 创建用户
+ ///
+ public string? create_id { get; set; }
+
+ ///
+ /// 修改时间
+ ///
+ public DateTime? modify_time { get; set; }
+
+ ///
+ /// 修改用户
+ ///
+ public string? modify_id { get; set; }
+
+ ///
+ /// 设备保养模板表id
+ ///
+ public string? maintain_tem_id { get; set; }
+
+ ///
+ /// 设备id
+ ///
+ public string? equip_id { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string? remark { get; set; }
+
+ ///
+ /// 排序
+ ///
+ public int ordinal { get; set; }
+
+ ///
+ /// 编码
+ ///
+ public string code { get; set; } = string.Empty;
+
+ ///
+ /// 名称
+ ///
+ public string name { get; set; } = string.Empty;
+
+ ///
+ /// 周期
+ ///
+ public int plan_cycle { get; set; }
+
+ ///
+ /// 周期方式 1 单次 2 循环
+ ///
+ public string? plan_cycle_unit { get; set; }
+
+ ///
+ /// 计划执行通知提前量
+ ///
+ public int? plan_run_notice { get; set; }
+
+ ///
+ /// 计划执行通知提前量单位 1 小时 2 天 3 周
+ ///
+ public string? plan_run_notice_unit { get; set; }
+
+ ///
+ /// 执行滞后推送时间
+ ///
+ public int? plan_delay { get; set; }
+
+ ///
+ /// 执行滞后推送时间单位 1 小时 2 天 3 周
+ ///
+ public string? plan_delay_unit { get; set; }
+
+ ///
+ /// 启用时间
+ ///
+ public DateTime start_time { get; set; } = DateTime.Now;
+
+ ///
+ /// 是否启用
+ ///
+ public string is_start { get; set; }
+
+ ///
+ /// 是否复核
+ ///
+ public string is_repeat { get; set; }
+
+ ///
+ /// 复核岗位id
+ ///
+ public string repeat_post_info_user_id { get; set; } = string.Empty;
+
+ ///
+ /// 不合格推送 0 不推送 1 推送
+ ///
+ public int is_send { get; set; }
+
+ ///
+ /// 推送人id
+ ///
+ public string? send_post_id { get; set; }
+
+ ///
+ /// 责任岗位id
+ ///
+ public string send_post_info_user_id { get; set; } = string.Empty;
+
+ ///
+ /// 所属组织
+ ///
+ public string? org_id { get; set; }
+
+}
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainTemH.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainTemH.cs
new file mode 100644
index 00000000..a666bf62
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainTemH.cs
@@ -0,0 +1,132 @@
+using JNPF.Common.Contracts;
+using JNPF.Common.Security;
+using SqlSugar;
+
+namespace Tnb.EquipMgr.Entities;
+
+///
+/// 设备保养模板主表
+///
+[SugarTable("eqp_maintain_tem_h")]
+public partial class EqpMaintainTemH : BaseEntity
+{
+ public EqpMaintainTemH()
+ {
+ id = SnowflakeIdHelper.NextId();
+ }
+ ///
+ /// 创建时间
+ ///
+ public DateTime? create_time { get; set; }
+
+ ///
+ /// 创建用户
+ ///
+ public string? create_id { get; set; }
+
+ ///
+ /// 修改时间
+ ///
+ public DateTime? modify_time { get; set; }
+
+ ///
+ /// 修改用户
+ ///
+ public string? modify_id { get; set; }
+
+ ///
+ /// 设备类型id
+ ///
+ public string? equip_type_id { get; set; }
+
+ ///
+ /// 编码
+ ///
+ public string code { get; set; } = string.Empty;
+
+ ///
+ /// 名称
+ ///
+ public string name { get; set; } = string.Empty;
+
+ ///
+ /// 周期
+ ///
+ public int plan_cycle { get; set; }
+
+ ///
+ /// 周期方式 1 单次 2 循环
+ ///
+ public string plan_cycle_unit { get; set; }
+
+ ///
+ /// 计划执行通知提前量
+ ///
+ public int? plan_run_notice { get; set; }
+
+ ///
+ /// 计划执行通知提前量单位 1 小时 2 天 3 周
+ ///
+ public string? plan_run_notice_unit { get; set; }
+
+ ///
+ /// 执行滞后推送时间
+ ///
+ public int? plan_delay { get; set; }
+
+ ///
+ /// 执行滞后推送时间单位 1 小时 2 天 3 周
+ ///
+ public string? plan_delay_unit { get; set; }
+
+ ///
+ /// 启用时间
+ ///
+ public DateTime start_time { get; set; } = DateTime.Now;
+
+ ///
+ /// 是否启用
+ ///
+ public int is_start { get; set; }
+
+ ///
+ /// 是否复核
+ ///
+ public int is_repeat { get; set; }
+
+ ///
+ /// 复核岗位id
+ ///
+ public string repeat_post_info_user_id { get; set; } = string.Empty;
+
+ ///
+ /// 备注
+ ///
+ public string? remark { get; set; }
+
+ ///
+ /// 排序
+ ///
+ public int? ordinal { get; set; }
+
+ ///
+ /// 不合格推送 0 不推送 1 推送
+ ///
+ public int is_send { get; set; }
+
+ ///
+ /// 推送人id
+ ///
+ public string? send_post_id { get; set; }
+
+ ///
+ /// 责任岗位id
+ ///
+ public string send_post_info_user_id { get; set; } = string.Empty;
+
+ ///
+ /// 所属组织
+ ///
+ public string? org_id { get; set; }
+
+}
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairApply.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairApply.cs
index 874ef15f..ca95fcaa 100644
--- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairApply.cs
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairApply.cs
@@ -47,7 +47,7 @@ public partial class EqpRepairApply : BaseEntity
///
/// 设备ID
///
- public string? equip_id { get; set; }
+ public string equip_id { get; set; }
///
/// 申请用户ID
@@ -148,5 +148,10 @@ public partial class EqpRepairApply : BaseEntity
/// 附件
///
public string? attachment { get; set; }
+
+ ///
+ /// 维修图片
+ ///
+ public string? repair_img { get; set; }
}
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairOutApply.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairOutApply.cs
index f8aca2cc..adc2cfe6 100644
--- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairOutApply.cs
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairOutApply.cs
@@ -113,5 +113,27 @@ public partial class EqpRepairOutApply : BaseEntity
/// 所属组织
///
public string? org_id { get; set; }
+
+ ///
+ /// 附件
+ ///
+ public string? attachment { get; set; }
+
+ ///
+ /// 实际维修供应商
+ ///
+ public string? real_supplier_id { get; set; }
+
+ ///
+ /// 流程id
+ ///
+ [SugarColumn(ColumnName = "f_flowid")]
+ public string? flow_id { get; set; }
+
+ ///
+ /// 流程任务id
+ ///
+ [SugarColumn(ColumnName = "f_flowtaskid")]
+ public string? flow_task_id { get; set; }
}
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsItem.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsItem.cs
index 086cad89..35deb165 100644
--- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsItem.cs
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsItem.cs
@@ -82,7 +82,7 @@ public partial class EqpSpotInsItem : BaseEntity
///
/// 单位id
///
- public string unit_id { get; set; } = string.Empty;
+ public string? unit_id { get; set; } = string.Empty;
///
/// 点巡检方法
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsRecordD.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsRecordD.cs
index 2de21636..076469c0 100644
--- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsRecordD.cs
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsRecordD.cs
@@ -72,7 +72,7 @@ public partial class EqpSpotInsRecordD : BaseEntity
///
/// 单位id
///
- public string unit_id { get; set; } = string.Empty;
+ public string? unit_id { get; set; } = string.Empty;
///
/// 点巡检方法
@@ -108,5 +108,5 @@ public partial class EqpSpotInsRecordD : BaseEntity
/// 是否通过
///
public string? is_pass { get; set; }
-
+
}
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldMaintainItem.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldMaintainItem.cs
index a661a5ec..b4d9e4e4 100644
--- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldMaintainItem.cs
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldMaintainItem.cs
@@ -63,5 +63,9 @@ public partial class ToolMoldMaintainItem : BaseEntity
/// 修改时间
///
public DateTime? modify_time { get; set; }
+ ///
+ /// 保养项完成状态 0,未完成,1,已完成
+ ///
+ public int? status { get; set; }
}
diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpEquipFileService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpEquipFileService.cs
new file mode 100644
index 00000000..258e6439
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpEquipFileService.cs
@@ -0,0 +1,15 @@
+using Microsoft.AspNetCore.Http;
+using Tnb.EquipMgr.Entities.Dto;
+
+namespace Tnb.EquipMgr.Interfaces
+{
+ public interface IEqpEquipFileService
+ {
+ ///
+ /// 上传附件
+ ///
+ ///
+ ///
+ public Task Upload(string equip_id,IFormFile file);
+ }
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpEquipScrapService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpEquipScrapService.cs
new file mode 100644
index 00000000..b349ec38
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpEquipScrapService.cs
@@ -0,0 +1,13 @@
+using Tnb.EquipMgr.Entities;
+
+namespace Tnb.EquipMgr.Interfaces
+{
+ public interface IEqpEquipScrapService
+ {
+ ///
+ /// 设备报废
+ ///
+ ///
+ public Task Scrap(EqpEquipScrap eqpEquipScrap);
+ }
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpMaintainRecordService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpMaintainRecordService.cs
new file mode 100644
index 00000000..387129b3
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpMaintainRecordService.cs
@@ -0,0 +1,30 @@
+using JNPF.Common.Dtos.VisualDev;
+using Tnb.EquipMgr.Entities.Dto;
+
+namespace Tnb.EquipMgr.Interfaces
+{
+ public interface IEqpMaintainRecordService
+ {
+ ///
+ /// 执行设备保养计划
+ ///
+ ///
+ ///
+ public Task ExecuteMaintain(SpotInsRecordExecuteInput input);
+
+ ///
+ /// 获取设备保养计划复核信息
+ ///
+ ///
+ ///
+ public Task GetMaintainRecordRepeatInfo(Dictionary dic);
+
+ ///
+ /// 复核备保养计划
+ ///
+ ///
+ ///
+ public Task RepeatMaintain(MaintainRecordRepeatInput input);
+
+ }
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpMaintainTemEquipService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpMaintainTemEquipService.cs
new file mode 100644
index 00000000..1b6496a5
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpMaintainTemEquipService.cs
@@ -0,0 +1,13 @@
+namespace Tnb.EquipMgr.Interfaces
+{
+ public interface IEqpMaintainTemEquipService
+ {
+
+ ///
+ /// 停止计划
+ ///
+ ///
+ ///
+ public Task Stop(Dictionary parameters);
+ }
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpMaintainTemService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpMaintainTemService.cs
new file mode 100644
index 00000000..59962bce
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpMaintainTemService.cs
@@ -0,0 +1,12 @@
+using Tnb.EquipMgr.Entities.Dto;
+namespace Tnb.EquipMgr.Interfaces
+{
+ public interface IEqpMaintainTemService
+ {
+ ///
+ /// 根据模板id发布到设备
+ ///
+ ///
+ public Task Publish(SpotInsTemPublishInput input);
+ }
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairApplyService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairApplyService.cs
index d8ccb4cf..eee44398 100644
--- a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairApplyService.cs
+++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairApplyService.cs
@@ -47,6 +47,11 @@ namespace Tnb.EquipMgr.Interfaces
///
///
public Task Register(RepairApplyRegisterInput input);
-
+
+ ///
+ /// 根据id获取维修详细
+ ///
+ ///
+ public Task GetRepairApplyDetail(Dictionary dic);
}
}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairOutApplyService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairOutApplyService.cs
index 8416d5f7..5e3b57dd 100644
--- a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairOutApplyService.cs
+++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairOutApplyService.cs
@@ -6,11 +6,23 @@ namespace Tnb.EquipMgr.Interfaces
public interface IEqpRepairOutApplyService
{
+ ///
+ /// 获取外修申请信息
+ ///
+ ///
+ public Task GetInfo(Dictionary dic);
+
///
/// 外修申请
///
///
public Task OutApply(RepairOutApplyInput input);
+ ///
+ /// 外修登记
+ ///
+ ///
+ public Task Register(RepairApplyOutRegisterInput input);
+
}
}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEquSpotInsTemEquipService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEquSpotInsTemEquipService.cs
index 48b4b400..38790883 100644
--- a/EquipMgr/Tnb.EquipMgr.Interfaces/IEquSpotInsTemEquipService.cs
+++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEquSpotInsTemEquipService.cs
@@ -2,13 +2,6 @@ namespace Tnb.EquipMgr.Interfaces
{
public interface IEquSpotInsTemEquipService
{
- // ///
- // /// 获取数
- // ///
- // ///
- // ///
- // public Task GetTree();
-
///
/// 停止计划
///
diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEquipmentService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEquipmentService.cs
index 26d6b24e..13e35519 100644
--- a/EquipMgr/Tnb.EquipMgr.Interfaces/IEquipmentService.cs
+++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEquipmentService.cs
@@ -1,7 +1,14 @@
-namespace Tnb.EquipMgr.Interfaces
+using Tnb.EquipMgr.Entities;
+
+namespace Tnb.EquipMgr.Interfaces
{
public interface IEquipmentService
{
-
+ ///
+ /// 根据id查设备
+ ///
+ ///
+ ///
+ public Task GetEntityById(Dictionary dic);
}
}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldsService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldsService.cs
index 83bd40e9..e1e1f8d9 100644
--- a/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldsService.cs
+++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldsService.cs
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Tnb.EquipMgr.Entities;
using Tnb.EquipMgr.Entities.Dto;
+using Tnb.ProductionMgr.Entities.Dto;
namespace Tnb.EquipMgr.Interfaces
{
@@ -16,7 +17,7 @@ namespace Tnb.EquipMgr.Interfaces
///
///
///
- public Task> GetEquipmentLists(ToolMoldInput ToolMoldInput);
+ public Task> GetEquipmentLists(ToolMoldInput ToolMoldInput);
///
/// 增加模具设备绑定
///
diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/Tnb.EquipMgr.Interfaces.csproj b/EquipMgr/Tnb.EquipMgr.Interfaces/Tnb.EquipMgr.Interfaces.csproj
index 8bbf5496..510df9dd 100644
--- a/EquipMgr/Tnb.EquipMgr.Interfaces/Tnb.EquipMgr.Interfaces.csproj
+++ b/EquipMgr/Tnb.EquipMgr.Interfaces/Tnb.EquipMgr.Interfaces.csproj
@@ -8,6 +8,7 @@
+
diff --git a/EquipMgr/Tnb.EquipMgr/EqpEquipFileService.cs b/EquipMgr/Tnb.EquipMgr/EqpEquipFileService.cs
new file mode 100644
index 00000000..b664448f
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr/EqpEquipFileService.cs
@@ -0,0 +1,73 @@
+using JNPF.Common.Core.Manager;
+using JNPF.Common.Dtos.VisualDev;
+using JNPF.Common.Enums;
+using JNPF.DependencyInjection;
+using JNPF.DynamicApiController;
+using JNPF.FriendlyException;
+using JNPF.Logging;
+using JNPF.Systems.Common;
+using JNPF.Systems.Interfaces.Common;
+using JNPF.VisualDev;
+using JNPF.VisualDev.Entitys;
+using JNPF.VisualDev.Interfaces;
+using Microsoft.AspNetCore.Http;
+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
+{
+ ///
+ /// 设备保养计划执行管理
+ ///
+ [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
+ [Route("api/[area]/[controller]/[action]")]
+ public class EqpEquipFileService : IEqpEquipFileService, IDynamicApiController, ITransient
+ {
+ private readonly ISqlSugarRepository _repository;
+ private readonly IUserManager _userManager;
+ private readonly FileService _fileService;
+
+ public EqpEquipFileService(ISqlSugarRepository repository,
+ FileService fileService,
+ IUserManager userManager)
+ {
+ _repository = repository;
+ _userManager = userManager;
+ _fileService = fileService;
+ }
+
+ [HttpPost]
+ public async Task Upload([FromForm]string equip_id,[FromForm]IFormFile file)
+ {
+ string msg = "";
+ try
+ {
+ var attachment = await _fileService.Uploader("annexpic", file);
+
+ EqpEquipFile eqpEquipFile = new EqpEquipFile()
+ {
+ file_name = file.FileName,
+ equip_id = equip_id,
+ create_id = _userManager.UserId,
+ create_time = DateTime.Now,
+ attachment = JsonConvert.SerializeObject(attachment)
+ };
+
+ await _repository.InsertAsync(eqpEquipFile);
+ msg = "上传成功";
+ }
+ catch (Exception e)
+ {
+ msg = "上传失败";
+ Log.Error(e.Message);
+ throw Oops.Oh(ErrorCode.D8001);
+ }
+
+ return msg;
+ }
+ }
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr/EqpEquipScrapService.cs b/EquipMgr/Tnb.EquipMgr/EqpEquipScrapService.cs
new file mode 100644
index 00000000..0959a242
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr/EqpEquipScrapService.cs
@@ -0,0 +1,58 @@
+using JNPF.Common.Core.Manager;
+using JNPF.Common.Dtos.VisualDev;
+using JNPF.Common.Enums;
+using JNPF.DependencyInjection;
+using JNPF.DynamicApiController;
+using JNPF.FriendlyException;
+using JNPF.VisualDev;
+using JNPF.VisualDev.Entitys;
+using JNPF.VisualDev.Interfaces;
+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
+{
+ ///
+ /// 设备保养计划执行管理
+ ///
+ [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
+ [Route("api/[area]/[controller]/[action]")]
+ public class EqpEquipScrapService : IEqpEquipScrapService, IDynamicApiController, ITransient
+ {
+ private readonly ISqlSugarRepository _repository;
+ private readonly IUserManager _userManager;
+
+ public EqpEquipScrapService(ISqlSugarRepository repository,
+ IUserManager userManager)
+ {
+ _repository = repository;
+ _userManager = userManager;
+ // OverideFuncs.UpdateAsync = ExecuteSpotIns;
+ }
+
+
+ [HttpPost]
+ public async Task Scrap(EqpEquipScrap eqpEquipScrap)
+ {
+ var db = _repository.AsSugarClient();
+ DbResult result = await db.Ado.UseTranAsync(async () =>
+ {
+ eqpEquipScrap.create_id = _userManager.UserId;
+ eqpEquipScrap.create_time = DateTime.Now;
+
+ await _repository.InsertAsync(eqpEquipScrap);
+
+ await db.Updateable().SetColumns(x => x.life == EquipmentLife.SCRAP)
+ .Where(x => x.id == eqpEquipScrap.equip_id).ExecuteCommandAsync();
+ });
+ if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
+
+ return result.IsSuccess ? "报废成功" : result.ErrorMessage;
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr/EqpMaintainTemEquipService.cs b/EquipMgr/Tnb.EquipMgr/EqpMaintainTemEquipService.cs
new file mode 100644
index 00000000..fc9f254a
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr/EqpMaintainTemEquipService.cs
@@ -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
+{
+ ///
+ /// 设备保养设备模板
+ ///
+ [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
+ [Route("api/[area]/[controller]/[action]")]
+ public class EqpMaintainTemEquipService : IEqpMaintainTemEquipService, IDynamicApiController, ITransient
+ {
+ private readonly ISqlSugarRepository _repository;
+
+ public EqpMaintainTemEquipService(ISqlSugarRepository repository)
+ {
+ _repository = repository;
+ }
+
+
+ [HttpPost]
+ public async Task Stop(Dictionary parameters)
+ {
+ string id = parameters["id"];
+ DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
+ {
+ await _repository.UpdateAsync(x => new EqpMaintainTemEquipH()
+ {
+ is_start = "0"
+ }, x => x.id == id);
+ List ids = await _repository.AsSugarClient().Queryable()
+ .Where(x => x.maintain_tem_equip_id == id && x.status == SpotInsRecordExecutionStatus.TOBEEXECUTED)
+ .Select(x => x.id).ToListAsync();
+ await _repository.AsSugarClient().Deleteable()
+ .Where(x => x.maintain_tem_equip_id == id && x.status == SpotInsRecordExecutionStatus.TOBEEXECUTED).ExecuteCommandAsync();
+
+ await _repository.AsSugarClient().Deleteable()
+ .Where(x => ids.Contains(x.maintain_record_id)).ExecuteCommandAsync();
+
+ });
+
+ if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
+ }
+ }
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr/EqpMaintainTemService.cs b/EquipMgr/Tnb.EquipMgr/EqpMaintainTemService.cs
new file mode 100644
index 00000000..bc1bc84f
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr/EqpMaintainTemService.cs
@@ -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
+{
+ ///
+ /// 设备保养检模板管理
+ ///
+ [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 _repository;
+ private readonly IUserManager _userManager;
+
+ public EqpMaintainTemService(ISqlSugarRepository repository,
+ IUserManager userManager)
+ {
+ _repository = repository;
+ _userManager = userManager;
+ }
+
+ ///
+ /// 根据模板id发布到设备
+ ///
+ ///
+ [HttpPost]
+ public async Task Publish(SpotInsTemPublishInput input)
+ {
+ var db = _repository.AsSugarClient();
+ DbResult result = await db.Ado.UseTranAsync(async () =>
+ {
+ EqpMaintainTemH eqpMaintainTemH = await _repository.GetSingleAsync(x => x.id == input.id);
+ List eqpMaintainTemDs = await db.Queryable().Where(x=>x.maintain_tem_id==input.id).ToListAsync();
+
+ if (input.equipIds != null && input.equipIds.Length > 0)
+ {
+ List insertEqpMaintainTemEquipHs = new List();
+ List insertEqpMaintainTemEquipDs = new List();
+ 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().Where(x => x.maintain_tem_id == input.id && x.equip_id == equipId).FirstAsync();
+ await db.Deleteable().Where(x => x.maintain_tem_id == input.id && x.equip_id==equipId).ExecuteCommandAsync();
+ if(oldMaintainTemEquipH!=null)
+ await db.Deleteable().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;
+ }
+ }
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs b/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs
index f9f9f689..79cc078a 100644
--- a/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs
+++ b/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs
@@ -107,12 +107,27 @@ namespace Tnb.EquipMgr
is_halt = input.is_halt,
halt_take_time = input.halt_take_time,
repair_description = input.repair_description,
- attachment = input.attachment,
+ repair_img = input.repair_img,
is_out_apply = input.is_out_apply,
status = status,
}, x => x.id == input.id);
return "登记成功";
}
+
+ [HttpPost]
+ public async Task GetRepairApplyDetail(Dictionary dic)
+ {
+ string id = dic["id"];
+
+ EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x => x.id == id);
+ EqpRepairOutApply eqpRepairOutApply = await _repository.AsSugarClient().Queryable().FirstAsync(x=>x.repair_apply_id==id);
+
+ return new RepairApplyDetailOutput()
+ {
+ eqpRepairApply = eqpRepairApply,
+ eqpRepairOutApply = eqpRepairOutApply,
+ };
+ }
}
}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr/EqpRepairOutApplyService.cs b/EquipMgr/Tnb.EquipMgr/EqpRepairOutApplyService.cs
index 02b29e68..3d6f461a 100644
--- a/EquipMgr/Tnb.EquipMgr/EqpRepairOutApplyService.cs
+++ b/EquipMgr/Tnb.EquipMgr/EqpRepairOutApplyService.cs
@@ -1,10 +1,14 @@
using JNPF.Common.Core.Manager;
using JNPF.Common.Enums;
+using JNPF.Common.Models.WorkFlow;
using JNPF.Common.Security;
using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
using JNPF.FriendlyException;
+using JNPF.WorkFlow.Interfaces.Service;
+using JNPF.WorkFlow.Service;
using Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json.Linq;
using SqlSugar;
using Tnb.EquipMgr.Entities;
using Tnb.EquipMgr.Entities.Dto;
@@ -21,62 +25,158 @@ namespace Tnb.EquipMgr
{
private readonly ISqlSugarRepository _repository;
private readonly IUserManager _userManager;
+ private readonly FlowTaskService _flowTaskService;
+ ///
+ /// flow_templatejson 表的id
+ ///
+ private const string flowId = "26414803850262";
public EqpRepairOutApplyService(ISqlSugarRepository repository,
+ FlowTaskService flowTaskService,
IUserManager userManager)
{
_repository = repository;
_userManager = userManager;
+ _flowTaskService = flowTaskService;
}
+ [HttpPost]
+ public async Task GetInfo(Dictionary dic)
+ {
+ string id = dic["id"];
+ EqpRepairApply eqpRepairApply = await _repository.AsSugarClient().Queryable().SingleAsync(x => x.id == id);
+ return await _repository.GetSingleAsync(x => x.repair_apply_id==eqpRepairApply.id);
+ }
+
+ [HttpPost]
public async Task OutApply(RepairOutApplyInput input)
{
var db = _repository.AsSugarClient();
+ string id = string.IsNullOrEmpty(input.id) ? SnowflakeIdHelper.NextId() : input.id;
DbResult result = await db.Ado.UseTranAsync(async () =>
{
if (string.IsNullOrEmpty(input.id))
{
- await _repository.InsertAsync(new EqpRepairOutApply
- {
- id = SnowflakeIdHelper.NextId(),
- repair_apply_id = input.repair_apply_id,
- equip_id = input.equip_id,
- supplier_id = input.supplier_id,
- estimated_cost = input.estimated_cost,
- construction_period_requirement = input.construction_period_requirement,
- out_apply_reason = input.out_apply_reason,
- remark = input.remark,
- create_id = _userManager.UserId,
- create_time = DateTime.Now,
- approve_status = RepairOutApplyStatus.TOBEAPPROVE,
- });
+ // await _repository.InsertAsync(new EqpRepairOutApply
+ // {
+ // id = id,
+ // repair_apply_id = input.repair_apply_id,
+ // equip_id = input.equip_id,
+ // supplier_id = input.supplier_id,
+ // estimated_cost = input.estimated_cost,
+ // construction_period_requirement = input.construction_period_requirement,
+ // out_apply_reason = input.out_apply_reason,
+ // remark = input.remark,
+ // create_id = _userManager.UserId,
+ // create_time = DateTime.Now,
+ // approve_status = RepairOutApplyStatus.TOBEAPPROVE,
+ // });
}
else
{
- await _repository.UpdateAsync(x=>new EqpRepairOutApply
- {
- repair_apply_id = input.repair_apply_id,
- equip_id = input.equip_id,
- supplier_id = input.supplier_id,
- estimated_cost = input.estimated_cost,
- construction_period_requirement = input.construction_period_requirement,
- out_apply_reason = input.out_apply_reason,
- remark = input.remark,
- create_id = _userManager.UserId,
- create_time = DateTime.Now,
- approve_status = RepairOutApplyStatus.TOBEAPPROVE,
- },x=>x.id==input.id);
+ // await _repository.UpdateAsync(x=>new EqpRepairOutApply
+ // {
+ // repair_apply_id = input.repair_apply_id,
+ // equip_id = input.equip_id,
+ // supplier_id = input.supplier_id,
+ // estimated_cost = input.estimated_cost,
+ // construction_period_requirement = input.construction_period_requirement,
+ // out_apply_reason = input.out_apply_reason,
+ // remark = input.remark,
+ // create_id = _userManager.UserId,
+ // create_time = DateTime.Now,
+ // approve_status = RepairOutApplyStatus.TOBEAPPROVE,
+ // },x=>x.id==input.id);
}
await db.Updateable()
.SetColumns(x=>x.status == RepairApplyStatus.OUTAPPLYAPPROVE)
.Where(x=>x.id==input.repair_apply_id).ExecuteCommandAsync();
+
+
});
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
+
+ //todo 退回流程
+ if (result.IsSuccess)
+ {
+ if (string.IsNullOrEmpty(input.id))
+ {
+ _flowTaskService.Create(new FlowTaskSubmitModel()
+ {
+ flowId = flowId,
+ parentId = "0",
+ formData = new JObject()
+ {
+ {"id",id},
+ {"repair_apply_id",input.repair_apply_id},
+ {"equip_id",input.equip_id},
+ {"create_id",_userManager.UserId},
+ {"supplier_id",input.supplier_id},
+ {"estimated_cost",input.estimated_cost},
+ {"construction_period_requirement",input.construction_period_requirement},
+ {"out_apply_reason",input.out_apply_reason},
+ {"remark",input.remark},
+ {"approve_status",RepairOutApplyStatus.TOBEAPPROVE},
+ }
+
+ });
+ }
+ else
+ {
+ var entity = await _repository.GetSingleAsync(x=>x.id==input.id);
+ _flowTaskService.Update("",new FlowTaskSubmitModel()
+ {
+ flowId = flowId,
+ parentId = "0",
+ id = entity.flow_task_id,
+ formData = new JObject()
+ {
+ {"id",id},
+ {"repair_apply_id",input.repair_apply_id},
+ {"equip_id",input.equip_id},
+ {"create_id",_userManager.UserId},
+ {"supplier_id",input.supplier_id},
+ {"estimated_cost",input.estimated_cost},
+ {"construction_period_requirement",input.construction_period_requirement},
+ {"out_apply_reason",input.out_apply_reason},
+ {"remark",input.remark},
+ {"approve_status",RepairOutApplyStatus.TOBEAPPROVE},
+ }
+
+ });
+ }
+ }
return result.IsSuccess ? "操作成功" : result.ErrorMessage;
}
+
+ [HttpPost]
+ public async Task Register(RepairApplyOutRegisterInput input)
+ {
+
+ var db = _repository.AsSugarClient();
+ DbResult result = await db.Ado.UseTranAsync(async () =>
+ {
+ await _repository.UpdateAsync(x => new EqpRepairOutApply()
+ {
+ real_supplier_id = input.real_supplier_id,
+ cost = input.cost,
+ repair_time = input.repair_time,
+ repair_take_time = input.repair_take_time,
+ repair_remark = input.repair_remark,
+ attachment = input.attachment,
+ }, x => x.id == input.id);
+
+ await db.Updateable().SetColumns(x => x.status == RepairApplyStatus.COMPLETED)
+ .Where(x => x.id == input.repair_apply_id).ExecuteCommandAsync();
+ });
+ if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
+
+ return result.IsSuccess ? "登记成功" : result.ErrorMessage;
+ }
+
}
}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr/EquMaintainRecordService.cs b/EquipMgr/Tnb.EquipMgr/EquMaintainRecordService.cs
new file mode 100644
index 00000000..0d526d9b
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr/EquMaintainRecordService.cs
@@ -0,0 +1,146 @@
+using JNPF.Common.Core.Manager;
+using JNPF.Common.Dtos.VisualDev;
+using JNPF.Common.Enums;
+using JNPF.DependencyInjection;
+using JNPF.DynamicApiController;
+using JNPF.FriendlyException;
+using JNPF.VisualDev;
+using JNPF.VisualDev.Entitys;
+using JNPF.VisualDev.Interfaces;
+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
+{
+ ///
+ /// 设备保养计划执行管理
+ ///
+ [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
+ [Route("api/[area]/[controller]/[action]")]
+ [OverideVisualDev(ModuleId)]
+ public class EqpMaintainRecordService : IOverideVisualDevService, IEqpMaintainRecordService, IDynamicApiController, ITransient
+ {
+ public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
+ private const string ModuleId = "26304609081109";
+ private readonly ISqlSugarRepository _repository;
+ private readonly IVisualDevService _visualDevService;
+ private readonly IRunService _runService;
+ private readonly IUserManager _userManager;
+
+ public EqpMaintainRecordService(ISqlSugarRepository repository,
+ IRunService runService,
+ IUserManager userManager,
+ IVisualDevService visualDevService)
+ {
+ _repository = repository;
+ _visualDevService = visualDevService;
+ _runService = runService;
+ _userManager = userManager;
+ // OverideFuncs.UpdateAsync = ExecuteSpotIns;
+ }
+
+ ///
+ /// 执行设备保养计划
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task ExecuteMaintain(SpotInsRecordExecuteInput input)
+ {
+ DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
+ {
+ EqpMaintainRecordH eqpSpotInsRecordH = _repository.GetSingle(x=>x.id==input.id);
+ string status = "";
+ if (eqpSpotInsRecordH.is_repeat == "1")
+ {
+ status = SpotInsRecordExecutionStatus.TOBECHECK;
+ }
+ else
+ {
+ status = SpotInsRecordExecutionStatus.COMPLETED;
+ }
+ await _repository.UpdateAsync(x => new EqpMaintainRecordH()
+ {
+ result = input.result,
+ attachment = input.attachment,
+ result_remark = input.result_remark,
+ status = status,
+ execute_time = DateTime.Now,
+ execute_user_id = _userManager.UserId
+ }, x => x.id == input.id);
+
+ foreach (var item in input.details)
+ {
+ await _repository.AsSugarClient().Updateable()
+ .SetColumns(x=>x.result==item["result"])
+ .SetColumns(x=>x.maintain_descrip==item["maintain_descrip"])
+ .Where(x=>x.id==item["id"])
+ .ExecuteCommandAsync();
+ }
+
+
+ });
+
+ if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
+ return result.IsSuccess ? "执行成功" : result.ErrorMessage;
+ }
+
+ ///
+ /// 获取设备保养计划复核信息
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task GetMaintainRecordRepeatInfo(Dictionary dic)
+ {
+ string id = dic["id"];
+ EqpMaintainRecordH eqpSpotInsRecordH = await _repository.GetSingleAsync(x => x.id == id);
+ List eqpSpotInsRecordDs = await _repository.AsSugarClient().Queryable()
+ .Where(x => x.maintain_record_id == id).ToListAsync();
+ MaintainRecordRepeatOutput output = new MaintainRecordRepeatOutput()
+ {
+ model = eqpSpotInsRecordH,
+ details = eqpSpotInsRecordDs,
+ };
+ return output;
+ }
+
+ ///
+ /// 复核设备保养计划
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task RepeatMaintain(MaintainRecordRepeatInput input)
+ {
+ var db = _repository.AsSugarClient();
+ DbResult result = await db.Ado.UseTranAsync(async () =>
+ {
+
+ foreach (var item in input.details)
+ {
+ await db.Updateable()
+ .SetColumns(x => x.repeat_descrip == item["repeat_descrip"])
+ .SetColumns(x => x.repeat_result == item["repeat_result"])
+ .Where(x => x.id == item["id"]).ExecuteCommandAsync();
+ }
+
+ await _repository.UpdateAsync(x => new EqpMaintainRecordH()
+ {
+ repeat_result = input.repeat_result,
+ repeat_remark = input.repeat_remark,
+ repeat_user_id = _userManager.UserId,
+ repeat_time = DateTime.Now,
+ status = SpotInsRecordExecutionStatus.COMPLETED
+ }, x => x.id == input.id);
+ });
+
+ if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
+ return result.IsSuccess ? "复核成功" : result.ErrorMessage;
+ }
+ }
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr/EquSpotInsRecordService.cs b/EquipMgr/Tnb.EquipMgr/EquSpotInsRecordService.cs
index d7fc7a2f..cf3a76aa 100644
--- a/EquipMgr/Tnb.EquipMgr/EquSpotInsRecordService.cs
+++ b/EquipMgr/Tnb.EquipMgr/EquSpotInsRecordService.cs
@@ -121,7 +121,7 @@ namespace Tnb.EquipMgr
{
repeat_result = input.repeat_result,
repeat_remark = input.repeat_remark,
- repeat_post_info_user_id = _userManager.UserId,
+ repeat_user_id = _userManager.UserId,
repeat_time = DateTime.Now,
status = SpotInsRecordExecutionStatus.COMPLETED
}, x => x.id == input.id);
diff --git a/EquipMgr/Tnb.EquipMgr/EquSpotInsTemEquipService.cs b/EquipMgr/Tnb.EquipMgr/EquSpotInsTemEquipService.cs
index f866e77c..b4ff4caa 100644
--- a/EquipMgr/Tnb.EquipMgr/EquSpotInsTemEquipService.cs
+++ b/EquipMgr/Tnb.EquipMgr/EquSpotInsTemEquipService.cs
@@ -11,7 +11,7 @@ using Tnb.EquipMgr.Entities;
namespace Tnb.EquipMgr
{
///
- /// 设备管理
+ /// 点巡检设备模板
///
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
[Route("api/[area]/[controller]/[action]")]
@@ -24,26 +24,7 @@ namespace Tnb.EquipMgr
_repository = repository;
}
- // public async Task GetTree()
- // {
- // List eqpEquipments =
- // var data = _repository.AsSugarClient().Queryable()
- // .Where(x => x.status == 1)
- // .Select((x) => new TreeModel
- // {
- // id = x.id,
- // parentId = "-1",
- // hasChildren = SqlFunc.Subqueryable().Where(y=>y.eqp_type_id==x.id).Any(),
- // isLeaf = false,
- // num = SqlFunc.Subqueryable().Where(y=>y.eqp_type_id==x.id).Count(),
- // children = SqlFunc.Subqueryable().Where(y=>y.eqp_type_id==x.id).Select(y=>new TreeModel()
- // {
- //
- // }).ToList(model => ),
- // });
- // return new { list = 1 };
- // }
-
+ [HttpPost]
public async Task Stop(Dictionary parameters)
{
string id = parameters["id"];
diff --git a/EquipMgr/Tnb.EquipMgr/EquipmentService.cs b/EquipMgr/Tnb.EquipMgr/EquipmentService.cs
index 03d1183f..c059dbda 100644
--- a/EquipMgr/Tnb.EquipMgr/EquipmentService.cs
+++ b/EquipMgr/Tnb.EquipMgr/EquipmentService.cs
@@ -30,7 +30,6 @@ namespace Tnb.EquipMgr
public EquipmentService(ISqlSugarRepository repository)
{
_repository = repository;
- OverideFuncs.GetListAsync = GetList;
}
///
/// 在线开发-获取设备列表
@@ -63,5 +62,12 @@ namespace Tnb.EquipMgr
.ToPagedListAsync(input.currentPage, input.pageSize);
return pagedList;
}
+
+ [HttpPost]
+ public async Task GetEntityById(Dictionary dic)
+ {
+ string id = dic["id"];
+ return await _repository.GetSingleAsync(x => x.id == id);
+ }
}
}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr/Tnb.EquipMgr.csproj b/EquipMgr/Tnb.EquipMgr/Tnb.EquipMgr.csproj
index 520c0756..94325618 100644
--- a/EquipMgr/Tnb.EquipMgr/Tnb.EquipMgr.csproj
+++ b/EquipMgr/Tnb.EquipMgr/Tnb.EquipMgr.csproj
@@ -10,7 +10,9 @@
+
+
diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRuleService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRuleService.cs
index 3581442a..c39705c9 100644
--- a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRuleService.cs
+++ b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRuleService.cs
@@ -83,7 +83,7 @@ namespace Tnb.EquipMgr
})
.ToListAsync();
}
-
+
///
/// 关联模具
@@ -141,27 +141,29 @@ namespace Tnb.EquipMgr
await _db.Ado.BeginTranAsync();
var maintainRules = await _db.Queryable().Where(it => input.ruleIds.Contains(it.id)).ToListAsync();
- if (maintainRules?.Count > 0)
+ var ruleMoldRelations = await _db.Queryable().Where(it => input.ruleIds.Contains(it.rule_id)).ToListAsync();
+ if (ruleMoldRelations?.Count > 0)
{
List maintainPlans = new();
List maintainPlanRelations = new();
- foreach (var maintainRule in maintainRules)
+ foreach (var mrr in ruleMoldRelations)
{
- if (maintainRule.cycle.HasValue && maintainRule.cycle.Value > 0)
+ var rule = await _db.Queryable().FirstAsync(it => it.id == mrr.rule_id);
+ if (rule != null && rule.cycle.HasValue && rule.cycle.Value > 0)
{
ToolMoldMaintainPlan maintainPlan = new();
maintainPlan.plan_code = $"JHDM{DateTime.Now:yyyyMMddmmss}";
- maintainPlan.mode = maintainRule.mode;
+ maintainPlan.mode = rule.mode;
maintainPlan.status = DictConst.UnMaintainStatusCode;
maintainPlan.plan_start_date = DateTime.Now;
- maintainPlan.plan_end_date = DateTime.Now.AddDays(maintainRule.cycle.Value);
+ maintainPlan.plan_end_date = DateTime.Now.AddDays(rule.cycle.Value);
maintainPlan.create_id = _userManager.UserId;
maintainPlan.create_time = DateTime.Now;
maintainPlans.Add(maintainPlan);
ToolMoldMaintainPlanRelation maintainPlanReation = new();
maintainPlanReation.maintain_plan_id = maintainPlan.id;
- maintainPlanReation.mold_id = (await _db.Queryable().FirstAsync(it => it.rule_id == maintainRule.id))?.mold_id!;
+ maintainPlanReation.mold_id = mrr.mold_id;
maintainPlanRelations.Add(maintainPlanReation);
}
}
diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRunService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRunService.cs
index 12db28d5..970ce20d 100644
--- a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRunService.cs
+++ b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRunService.cs
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
using Aspose.Cells.Drawing;
using JNPF.Common.Core.Manager;
using JNPF.Common.Enums;
+using JNPF.Common.Extension;
using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
using JNPF.FriendlyException;
@@ -14,13 +15,18 @@ using JNPF.Logging;
using JNPF.Systems.Interfaces.System;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
+using StackExchange.Profiling.Internal;
using Tnb.BasicData;
using Tnb.EquipMgr.Entities;
+using Tnb.EquipMgr.Entities.Consts;
using Tnb.EquipMgr.Entities.Dto;
using Tnb.EquipMgr.Interfaces;
namespace Tnb.EquipMgr
{
+ ///
+ /// 模具维修任务执行
+ ///
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
[Route("api/[area]/[controller]/[action]")]
@@ -37,9 +43,8 @@ namespace Tnb.EquipMgr
_dictionaryDataService = dictionaryDataService;
}
-
///
- /// 根据计划id,获取相关联模具、设备、保养项目组、保养项,信息
+ /// 根据计划id,获取相关联模具、设备、信息
///
///
///
@@ -47,7 +52,16 @@ namespace Tnb.EquipMgr
public async Task GetMaintainInfoFromByPlanId([FromRoute] string planId)
{
dynamic info = new ExpandoObject();
- var planMoldRelation = await _db.Queryable().FirstAsync(it => it.id == planId);
+ var planMoldRelation = await _db.Queryable()
+ .LeftJoin((a, b) => a.maintain_plan_id == b.id)//ToolMoldMaintainPlan
+ .LeftJoin((a, b, c) => b.plan_code == c.plan_code)
+ .Where(a => a.maintain_plan_id == planId)
+ .Select((a, b, c) => new
+ {
+ mold_id = a.mold_id,
+ plan_start_time = c.plan_start_time,
+ })
+ .FirstAsync();
if (planMoldRelation != null)
{
var mold = await _db.Queryable().FirstAsync(it => it.id == planMoldRelation.mold_id);
@@ -55,6 +69,9 @@ namespace Tnb.EquipMgr
{
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().FirstAsync(it => it.mold_id == mold.id);
if (moldEqpRelation != null)
{
@@ -62,28 +79,41 @@ namespace Tnb.EquipMgr
info.eqp_code = eqp.code;
info.eqp_name = eqp.name;
}
- var itemGroupRelation = await _db.Queryable().FirstAsync(it => it.mold_id == mold.id);
- if (itemGroupRelation != null)
- {
- var itemGroup = await _db.Queryable().FirstAsync(it => it.id == itemGroupRelation.item_group_id);
- if (itemGroup != null)
- {
- info.item_group_name = itemGroup.name;
- }
- var itemRelation = await _db.Queryable().FirstAsync(it => it.item_group_id == itemGroupRelation.item_group_id);
- if (itemRelation != null)
- {
- var checkItem = await _db.Queryable().FirstAsync(it => it.id == itemRelation.item_id);
- if (checkItem != null)
- {
- info.item_name = checkItem.name;
- }
- }
- }
}
}
return info;
}
+ ///
+ /// 根据模具ID获取,保养组及项目信息
+ ///
+ /// 模具ID
+ ///
+ [HttpGet]
+ public async Task GetCheckItemAndGrpByMoldId([FromRoute] string moldId)
+ {
+ if (moldId.IsNullOrEmpty()) throw new ArgumentException($"parameter {nameof(moldId)} not be null or empty");
+
+ var itemGroupRelation = await _db.Queryable().FirstAsync(it => it.mold_id == moldId);
+ if (itemGroupRelation != null)
+ {
+ var checkItems = await _db.Queryable((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();
+ return checkItems;
+ }
+ return Enumerable.Empty();
+ }
+
///
/// 模具保养计划执行-开始模具保养
@@ -148,6 +178,14 @@ namespace Tnb.EquipMgr
}
}
+
+ public async Task MaintainItemFinish(MoldMaintainRunUpInput input)
+ {
+ 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().SetColumns(it => new ToolMoldMaintainItem { status = input.status }).Where(it => input.itemIds.Contains(it.id)).ExecuteCommandAsync();
+ if (row < 1) throw Oops.Oh(ErrorCode.COM1001);
+ }
///
/// 模具保养计划执行-保养完成
///
@@ -156,7 +194,34 @@ namespace Tnb.EquipMgr
[HttpPost]
public async Task MaintainFinish(MoldMaintainRunUpInput input)
{
-
+ if (input == null) throw new ArgumentNullException("input");
+ var grpIds = await _db.Queryable()
+ .LeftJoin((a, b) => a.mold_id == b.id)
+ .Where(a => a.mold_id == input.mold_id)
+ .Select((a, b) => a.item_group_id)
+ .Distinct()
+ .ToListAsync();
+ var itemIds = await _db.Queryable().Where(it => grpIds.Contains(it.item_group_id)).Select(it => it.item_id).ToListAsync();
+ if (itemIds?.Count > 0)
+ {
+ var items = await _db.Queryable().Where(it => itemIds.Contains(it.id) && it.status.HasValue && it.status.Value == 1).ToListAsync();
+ if (items?.Count < itemIds.Count)
+ {
+ throw new AppFriendlyException("当前模具有未完成的保养项目", 500);
+ }
+ var row = await _db.Updateable().SetColumns(it => new ToolMolds { mold_status = MoldUseStatus.MOLDUSESTATUSZKID }).Where(it => it.id == input.mold_id).ExecuteCommandAsync();
+ if (row < 1) throw Oops.Oh(ErrorCode.COM1001);
+ var allMoldStatus = await _db.Queryable().InnerJoin((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))
+ {
+ row = await _db.Updateable().SetColumns(it => new ToolMoldMaintainPlan { status = MoldPlanMaintainStatus.MOLDPLAN_MAINTAIN_STATUS_COMPLETED_CODE }).Where(it => it.id == input.plan_id).ExecuteCommandAsync();
+ }
+ if (row < 1) throw Oops.Oh(ErrorCode.COM1001);
+ }
}
+
}
}
diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldsService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldsService.cs
index d826c33b..86c41af4 100644
--- a/EquipMgr/Tnb.EquipMgr/ToolMoldsService.cs
+++ b/EquipMgr/Tnb.EquipMgr/ToolMoldsService.cs
@@ -18,6 +18,7 @@ using SqlSugar;
using Tnb.EquipMgr.Entities;
using Tnb.EquipMgr.Entities.Dto;
using Tnb.EquipMgr.Interfaces;
+using Tnb.ProductionMgr.Entities.Dto;
namespace Tnb.EquipMgr
{ ///
@@ -67,7 +68,7 @@ namespace Tnb.EquipMgr
///
///
[HttpPost]
- public async Task> GetEquipmentLists(ToolMoldInput ToolMoldInput)
+ public async Task> GetEquipmentLists(ToolMoldInput ToolMoldInput)
{
var db = _repository.AsSugarClient();
var list = await db.Queryable((a, b) => new object[]
@@ -75,7 +76,7 @@ namespace Tnb.EquipMgr
JoinType.Inner, a.id == b.equipment_id,
})
.Where((a, b) => b.mold_id == ToolMoldInput.mold)
- .Select((a, b) => new EquipmentListOutput
+ .Select((a, b) => new Tnb.EquipMgr.Entities.Dto.EquipmentListOutput
{
id = a.id,
eqp_code = a.code,
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/DictionaryTreeOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/DictionaryTreeOutput.cs
new file mode 100644
index 00000000..a5aaca03
--- /dev/null
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/DictionaryTreeOutput.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tnb.ProductionMgr.Entities.Dto
+{
+ public class DictionaryTreeOutput
+ {
+ public string id { get; set; }
+ public string parentId { get; set; }
+ public List Child { get; set; }
+ public bool HasChild { get; set; }
+ }
+}
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/GenSubMoCrInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/GenSubMoCrInput.cs
index aa6b1f76..049cf59f 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/GenSubMoCrInput.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/GenSubMoCrInput.cs
@@ -8,12 +8,14 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
{
public class GenSubMoCrInput
{
+ public string bom_id { get; set; }
+
///
/// 父工单id
///
public string mo_id { get; set; }
///
- /// 子物料ids
+ /// 工序ids
///
public List ids { get; set; }
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackReportTreeOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackReportTreeOutput.cs
new file mode 100644
index 00000000..0cd3de9f
--- /dev/null
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackReportTreeOutput.cs
@@ -0,0 +1,157 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using JNPF.Common.Security;
+
+namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
+{
+ ///
+ /// 组装、包装,生产任务管理树形输出类
+ ///
+ public class PackReportTreeOutput : TreeModel
+ {
+ ///
+ /// 生产任务编号
+ ///
+ public string? mo_task_code { get; set; }
+
+ ///
+ /// 工单Id
+ ///
+ public string? mo_id { get; set; }
+
+ ///
+ /// 物料Id
+ ///
+ public string? material_id { get; set; }
+ ///
+ /// 产线id
+ ///
+ public string? workline_id { get; set; }
+
+ ///
+ /// 工位id
+ ///
+ public string? workstation_id { get; set; }
+
+ ///
+ /// 工艺路线id
+ ///
+ public string? workroute_id { get; set; }
+
+ ///
+ /// 生产bom id
+ ///
+ public string? bom_id { get; set; }
+
+ ///
+ /// 任务单状态
+ ///
+ public string? mo_task_status { get; set; }
+
+ ///
+ /// 计划数量
+ ///
+ public int? plan_qty { get; set; }
+
+ ///
+ /// 已投入数量
+ ///
+ public int? input_qty { get; set; }
+
+ ///
+ /// 已完工数量
+ ///
+ public int? complete_qty { get; set; }
+
+ ///
+ /// 报废数量
+ ///
+ public int? scrap_qty { get; set; }
+
+ ///
+ /// 已排产数量
+ ///
+ public int? scheduled_qty { get; set; }
+
+ ///
+ /// 排产类型:1、注塑、挤出2、组装、包装
+ ///
+ public int? schedule_type { get; set; }
+
+ ///
+ /// 计划开始时间
+ ///
+ public string plan_start_date { get; set; }
+
+ ///
+ /// 计划结束时间
+ ///
+ public string plan_end_date { get; set; }
+
+ ///
+ /// 实际开工日期
+ ///
+ public DateTime? act_start_date { get; set; }
+
+ ///
+ /// 实际完工日期
+ ///
+ public DateTime? act_end_date { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ public string? create_id { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public DateTime? create_time { get; set; }
+
+ ///
+ /// 修改人
+ ///
+ public string? modify_id { get; set; }
+
+ ///
+ /// 修改时间
+ ///
+ public DateTime? modify_time { get; set; }
+
+ ///
+ /// 扩展字段
+ ///
+ public string? extras { get; set; }
+
+ ///
+ /// 生产顺序
+ ///
+ public int? prd_order { get; set; }
+
+ ///
+ /// 预计开始时间
+ ///
+ public DateTime? estimated_start_date { get; set; }
+
+ ///
+ /// 预计结束时间
+ ///
+ public DateTime? estimated_end_date { get; set; }
+ ///
+ /// 父任务Id
+ ///
+ public string? parent_id { get; set; }
+
+ ///
+ /// 工序任务量
+ ///
+ public int? process_task_qty { get; set; }
+ ///
+ /// 工序id
+ ///
+ public string process_id { get; set; }
+ }
+}
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackSchedlingCrInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackSchedlingCrInput.cs
index ad2901da..fe5d7e06 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackSchedlingCrInput.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackSchedlingCrInput.cs
@@ -31,7 +31,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
///
/// 排产数量
///
- public string scheduled_qty { get; set; }
+ public int scheduled_qty { get; set; }
///
/// Desc:预计开始时间
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackSechelToBeIssueListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackSechelToBeIssueListOutput.cs
index 9eedff4b..08bc9117 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackSechelToBeIssueListOutput.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackSechelToBeIssueListOutput.cs
@@ -21,6 +21,10 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
///
public string mo_task_code { get; set; }
///
+ /// 物料id
+ ///
+ public string material_id { get; set; }
+ ///
/// 物料编号
///
public string material_code { get; set; }
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskOutput.cs
index 0eb46fc1..c0a9d030 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskOutput.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskOutput.cs
@@ -75,6 +75,14 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
/// 预计完工时间
///
public DateTime? estimated_end_date { get; set; }
+ ///
+ /// 工序编码
+ ///
+ public string process_code { get; set; }
+ ///
+ /// 工序名称
+ ///
+ public string process_name { get; set;}
}
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMotreeOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMotreeOutput.cs
index f274fe7c..141c0095 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMotreeOutput.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMotreeOutput.cs
@@ -7,8 +7,12 @@ using JNPF.Common.Security;
namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
{
- public class PrdMotreeOutput : TreeModel
+ public class PrdMoTreeOutput : TreeModel
{
+
+ //public Dictionary row { get; set; }
+
+ #region 注释代码
public string? org_id { get; set; }
///
/// 工单id
@@ -25,6 +29,14 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
/// 物料编号
///
public string? material_code { get; set; }
+ ///
+ /// 物料名称
+ ///
+ public string material_name { get; set; }
+ ///
+ /// 物料规格型号
+ ///
+ public string material_standard { get; set; }
///
/// 工单类型:1-正常工单、2-返工工单、3-试制工单
@@ -39,37 +51,37 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
///
/// 计划生产数量
///
- public int? plan_qty { get; set; }
+ public string plan_qty { get; set; }
///
/// 已投入数量
///
- public int? input_qty { get; set; }
+ public string input_qty { get; set; }
///
/// 已完工数量
///
- public int? complete_qty { get; set; }
+ public string complete_qty { get; set; }
///
/// 报废数量
///
- public int? scrap_qty { get; set; }
+ public string scrap_qty { get; set; }
///
/// 计划开始时间
///
- public DateTime? plan_start_date { get; set; }
+ public string plan_start_date { get; set; }
///
/// 计划结束时间
///
- public DateTime? plan_end_date { get; set; }
+ public string plan_end_date { get; set; }
///
/// 是否生派工单
///
- public int? is_create_dispatch { get; set; }
+ public string is_create_dispatch { get; set; }
///
@@ -80,7 +92,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
///
/// 是否合并
///
- public int? is_merge { get; set; }
+ public string is_merge { get; set; }
///
/// 组合工单
@@ -100,7 +112,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
///
/// 创建时间
///
- public DateTime? create_time { get; set; }
+ public string create_time { get; set; }
///
/// 修改用户
@@ -110,19 +122,20 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
///
/// 修改时间
///
- public DateTime? modify_time { get; set; }
+ public string modify_time { get; set; }
///
/// 物料ID
///
public string? material_id { get; set; }
-
+ public string? material_id_id { get; set; }
///
/// 已排产数量
///
- public int? scheduled_qty { get; set; }
+ public string scheduled_qty { get; set; }
///
/// 父工单id
///
public string parent_id { get; set; }
+ #endregion
}
}
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdPackReportQueryInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdPackReportQueryInput.cs
new file mode 100644
index 00000000..5d32519b
--- /dev/null
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdPackReportQueryInput.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using JNPF.Common.Filter;
+using Microsoft.AspNetCore.Mvc.RazorPages;
+
+namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
+{
+ public class PrdPackReportQueryInput : PageInputBase
+ {
+ ///
+ /// 生产任务编号
+ ///
+ public string mo_task_code { get; set; }
+ }
+}
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdReportOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdReportOutput.cs
index 2de1be86..779e1b82 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdReportOutput.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdReportOutput.cs
@@ -46,5 +46,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
/// 物料属性
///
public string material_property { get; set; }
+
+
}
}
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.cs
index e53d8c16..663cdb9d 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.cs
@@ -168,5 +168,8 @@ public partial class PrdMoTask : BaseEntity
/// 工序任务量
///
public int? process_task_qty { get; set; }
-
+ ///
+ /// 工序id
+ ///
+ public string process_id { get; set; }
}
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.part.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.part.cs
index 33fa02c4..77b52b81 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.part.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.part.cs
@@ -31,5 +31,59 @@ namespace Tnb.ProductionMgr.Entities
///
[SugarColumn(IsIgnore = true)]
public int? mold_cavity_qty { get; set; }
+
+ ///
+ /// 任务计划数
+ ///
+ [SugarColumn(IsIgnore = true)]
+ public int? icmo_qty { get; set; }
+ ///
+ /// 已报工数量
+ ///
+ [SugarColumn(IsIgnore = true)]
+ public int? reported_work_qty { get; set; }
+ ///
+ /// 提报数
+ ///
+ [SugarColumn(IsIgnore = true)]
+ public int? reported_qty { get; set; }
+ ///
+ /// 生产数量
+ ///
+ [SugarColumn(IsIgnore = true)]
+ public int? prd_qty { get; set; }
+ ///
+ /// 设备编码
+ ///
+ [SugarColumn(IsIgnore = true)]
+ public string eqp_code { get; set; }
+ ///
+ /// 物料编码
+ [SugarColumn(IsIgnore = true)]
+ public string material_code { get; set; }
+ ///
+ /// 物料名称
+ [SugarColumn(IsIgnore = true)]
+ public string material_name { get; set; }
+ ///
+ /// 物料属性
+ ///
+ [SugarColumn(IsIgnore = true)]
+ public string material_property { get; set; }
+ ///
+ /// 工序名称
+ ///
+ [SugarColumn(IsIgnore = true)]
+ public string process_name { get; set; }
+ ///
+ /// 工序编码
+ ///
+ [SugarColumn(IsIgnore = true)]
+ public string process_code { get; set; }
+ ///
+ /// 产线编码
+ ///
+ [SugarColumn(IsIgnore = true)]
+ public string workline_code { get; set; }
}
}
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTaskDefect.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTaskDefect.cs
index a298e511..89a77326 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTaskDefect.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTaskDefect.cs
@@ -48,5 +48,11 @@ public partial class PrdMoTaskDefect : BaseEntity
/// 批次
///
public string? batch { get; set; }
+ ///
+ /// 报废数量
+ ///
+ public int scrap_qty { get; set; }
+
+ public int mo_task_type { get; set; }
}
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTaskDefectRecord.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTaskDefectRecord.cs
index 254eea97..6d06db85 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTaskDefectRecord.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTaskDefectRecord.cs
@@ -52,7 +52,7 @@ public partial class PrdMoTaskDefectRecord : BaseEntity
///
/// 报废数量
///
- public int? scrap_qty { get; set; }
+ public int scrap_qty { get; set; }
///
/// 生产任务单状态
@@ -78,5 +78,9 @@ public partial class PrdMoTaskDefectRecord : BaseEntity
/// 任务单编号
///
public string? mo_task_code { get; set; }
+ ///
+ /// 任务类型
+ ///
+ public string mo_task_type { get; set; }
}
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdReportRecord.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdReportRecord.cs
index 4113a839..7ed330d8 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdReportRecord.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdReportRecord.cs
@@ -47,11 +47,26 @@ public partial class PrdReportRecord : BaseEntity
///
/// 完成数量
///
- public int? completed_qty { get; set; }
+ public int completed_qty { get; set; }
///
/// 任务单号
///
public string? mo_task_code { get; set; }
-
+ ///
+ /// 任务单状态
+ ///
+ public string status { get; set; }
+ ///
+ /// 任务类型
+ ///
+ public string mo_task_type { get; set; }
+ ///
+ /// 生产任务id
+ ///
+ public string mo_task_id { get; set; }
+ ///
+ /// 已报工数量
+ ///
+ public int reported_work_qty { get; set; }
}
diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdPackReportService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdPackReportService.cs
new file mode 100644
index 00000000..c901ed4b
--- /dev/null
+++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdPackReportService.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tnb.ProductionMgr.Interfaces
+{
+ ///
+ /// 组装、包装 生产提报接口
+ ///
+ public interface IPrdPackReportService
+ {
+ }
+}
diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IProductionReportRecordService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IProductionReportRecordService.cs
new file mode 100644
index 00000000..b02102ed
--- /dev/null
+++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IProductionReportRecordService.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tnb.ProductionMgr.Interfaces
+{
+ public interface IProductionReportRecordService
+ {
+ }
+}
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdCancelCloseDownService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdCancelCloseDownService.cs
index 7238c247..77744e16 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdCancelCloseDownService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdCancelCloseDownService.cs
@@ -225,6 +225,7 @@ namespace Tnb.ProductionMgr
await _maintainTaskService.Create(maintaindTask);
}
+
}
else throw Oops.Oh(ErrorCode.COM1001);
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskIssueService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskIssueService.cs
index eb9b1f2e..28190f8d 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskIssueService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskIssueService.cs
@@ -19,6 +19,7 @@ using Tnb.ProductionMgr.Entities;
using Tnb.ProductionMgr.Interfaces;
using Aspose.Cells.Drawing;
using Microsoft.AspNetCore.Mvc;
+using JNPF.Common.Extension;
namespace Tnb.ProductionMgr
{
@@ -52,6 +53,8 @@ namespace Tnb.ProductionMgr
var data = await _runService.GetListResult(templateEntity, input);
if (data?.list?.Count > 0)
{
+ var scheduledTypeField = nameof(PrdMoTask.schedule_type);
+ data.list = data.list.Where(it => it[scheduledTypeField].IsNotEmptyOrNull() && it[scheduledTypeField].ParseToInt() == 1).ToList();
foreach (var row in data.list)
{
var dic = row.ToDictionary(x => x.Key, x => x.Value);
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
index cbcea7c3..bf27e4ff 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
@@ -35,6 +35,11 @@ using Aspose.Cells.Drawing.Texts;
using JNPF.Systems.Entitys.Permission;
using WebSocketSharp.Frame;
using JNPF.Logging;
+using System.Dynamic;
+using Tnb.EquipMgr.Entities.Dto;
+using JNPF.Common.Filter;
+using Tnb.BasicData.Entities.Dto;
+using NPOI.SS.Formula.Functions;
namespace Tnb.ProductionMgr
{
@@ -45,6 +50,7 @@ namespace Tnb.ProductionMgr
public class PrdMoTaskService : IOverideVisualDevService, IPrdMoTaskService, IDynamicApiController, ITransient
{
private const string ModuleId = "25567924238373";
+ private const string MoModuleId = "25018860321301";
private readonly ISqlSugarRepository _repository;
private readonly IUserManager _userManager;
private readonly IDictionaryDataService _dictionaryDataService;
@@ -98,14 +104,14 @@ namespace Tnb.ProductionMgr
[HttpGet("{materialId}")]
public async Task GetMoldListByItemId(string materialId)
{
- var result = new List();
+ var result = new List();
result = await _db.Queryable()
.InnerJoin((a, b) => a.mold_id == b.id)
.InnerJoin((a, b, c) => a.material_id == c.id)
.Where((a, b, c) => a.material_id == materialId)
- .Select((a, b, c) => new MoldListOutput
+ .Select((a, b, c) => new Tnb.ProductionMgr.Entities.Dto.MoldListOutput
{
- mold_id = a.id,
+ mold_id = b.id,
mold_code = b.mold_code,
mold_name = b.mold_name,
mold_type_code = b.mold_type_code,
@@ -125,7 +131,7 @@ namespace Tnb.ProductionMgr
{
var items = await _db.Queryable().InnerJoin((a, b) => a.equipment_id == b.id)
.Where((a, b) => a.mold_id == moldId)
- .Select((a, b) => new EquipmentListOutput
+ .Select((a, b) => new Entities.Dto.EquipmentListOutput
{
eqp_id = b.id,
eqp_code = b.code,
@@ -211,71 +217,6 @@ namespace Tnb.ProductionMgr
return data;
}
///
- /// 根据任务单号获取提报记录明细
- ///
- /// 任务单号
- ///
- /// returns:
- ///
{
- ///
icmo_qty:任务计划数量
- ///
reported_work_qty:已报工数量
- ///
reported_qty:报工数量
- ///
prd_qty:生产数量
- ///
}
- ///
- [HttpGet("{mo_task_code}")]
- public async Task GetPrdReportByIcmoCode(string mo_task_code)
- {
- var db = _repository.AsSugarClient();
- var prdTask = await db.Queryable().FirstAsync(it => it.mo_task_code == mo_task_code);
- var eqpCode = "";
- var moldCode = "";
- var materialCode = "";
- var materialName = "";
- var materialProp = "";
- if (prdTask != null)
- {
- var eqp = await db.Queryable().FirstAsync(it => it.id == prdTask.eqp_id);
- var mold = await db.Queryable().FirstAsync(it => it.id == prdTask.mold_id);
- var material = await db.Queryable().FirstAsync(it => it.id == prdTask.material_id);
- eqpCode = eqp != null ? eqp.code : "";
- moldCode = mold != null ? mold.mold_code : "";
- materialCode = material != null ? material.code : "";
- materialName = material != null ? material.name : "";
- materialProp = material != null ? material.material_property : "";
- }
-
- var res = await db.Queryable().Where(it => it.mo_task_code == mo_task_code)
- .Select(it => new PrdReportOutput
- {
- icmo_qty = it.icmo_qty,
- reported_work_qty = it.reported_work_qty,
- eqp_code = eqpCode,
- mold_code = moldCode,
- material_code = materialCode,
- material_name = materialName,
- prd_qty = it.prd_qty,
- //scrap_qty = SqlFunc.Subqueryable().Select(x => x.scrap_qty),
- })
- .Mapper(it =>
- {
- it.icmo_qty = it.icmo_qty ?? (db.Queryable().First(it => it.icmo_code == mo_task_code)?.scheduled_qty < 1 ? 0 : it.icmo_qty ?? db.Queryable().First(it => it.icmo_code == mo_task_code).scheduled_qty);
- it.reported_work_qty = it.reported_work_qty ?? 0;
- //it.reported_qty = it.reported_qty ?? 0;
- it.prd_qty = it.prd_qty ?? 0;
- it.scrap_qty = it.scrap_qty ?? 0;
- })
- .FirstAsync();
- res ??= new PrdReportOutput
- {
- icmo_qty = db.Queryable().First(it => it.mo_task_code == mo_task_code)?.scheduled_qty,
- reported_work_qty = 0,
- prd_qty = 0,
- //scrap_qty = 0,
- };
- return res;
- }
- ///
/// 获取自检报废批次记录
///
/// 任务单Id
@@ -337,7 +278,6 @@ namespace Tnb.ProductionMgr
[HttpGet("{moId}")]
public async Task GetPrdTaskInfoByMoId(string moId, int schedType = 1)
{
-
List result = new();
var dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId);
if (schedType == 1)
@@ -363,6 +303,8 @@ namespace Tnb.ProductionMgr
estimated_end_date = a.estimated_end_date,
plan_qty = b.plan_qty,
complete_qty = a.complete_qty,
+ process_code = SqlFunc.Subqueryable().Where(it => it.id == a.process_id).Select(it => it.process_code),
+ process_name = SqlFunc.Subqueryable().Where(it => it.id == a.process_id).Select(it => it.process_name),
})
.Mapper(it =>
{
@@ -375,7 +317,7 @@ namespace Tnb.ProductionMgr
result = await _db.Queryable().LeftJoin((a, b) => a.mo_id == b.id)
.LeftJoin((a, b, c) => a.material_id == c.id)
.LeftJoin((a, b, c, d) => a.workline_id == d.Id)
- .Where((a, b, c, d) => a.mo_id == moId)
+ .Where((a, b, c, d) => b.id == moId || b.parent_id == moId)
.Select((a, b, c, d) => new PrdMoTaskOutput
{
mo_task_code = a.mo_task_code,
@@ -408,28 +350,29 @@ namespace Tnb.ProductionMgr
public async Task GetPackScheldToBeIssueList([FromQuery] PackScheldToBeIssueListInput input)
{
var dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId);
- var result = await _db.Queryable().Where(it => it.schedule_type == 2)
- .LeftJoin((a, b) => a.material_id == b.id)
- .LeftJoin((a, b, c) => a.workline_id == c.Id)
- .LeftJoin((a, b, c, d) => a.mo_id == d.id)
- .LeftJoin((a, b, c, d, e) => a.bom_id == e.id)
- .WhereIF(!string.IsNullOrEmpty(input.mo_task_code), (a, b, c, d, e) => a.mo_task_code.Contains(input.mo_task_code))
- .Select((a, b, c, d, e) => new PackSechelToBeIssueListOutput
+ var result = await _db.Queryable()
+ .LeftJoin((a, b) => a.workline_id == b.Id)
+ .LeftJoin((a, b, c) => a.mo_id == c.id)
+ .LeftJoin((a, b, c, d) => a.bom_id == d.id)
+ .WhereIF(!string.IsNullOrEmpty(input.mo_task_code), (a, b, c, d) => a.mo_task_code.Contains(input.mo_task_code))
+ .Where((a, b, c, d) => a.schedule_type == 2 && string.IsNullOrEmpty(a.parent_id))
+ .Select((a, b, c, d) => new PackSechelToBeIssueListOutput
{
mo_task_id = a.id,
mo_task_code = a.mo_task_code,
- material_code = b.code,
- material_name = b.name,
+ material_id = a.material_id,
+ material_code = SqlFunc.Subqueryable().Where(it => it.id == a.material_id).Select(it => it.code),
+ material_name = SqlFunc.Subqueryable().Where(it => it.id == a.material_id).Select(it => it.name),
workline_id = a.workline_id,
- workline_code = c.EnCode,
- workline_name = c.FullName,
+ workline_code = b.EnCode,
+ workline_name = b.FullName,
mo_task_status = a.mo_task_status,
- scheduled_qty = a.scheduled_qty,
- plan_qty = d.plan_qty,
+ scheduled_qty = SqlFunc.Subqueryable().Where(it => it.mo_id == a.mo_id).Sum(it => it.scheduled_qty),
+ plan_qty = SqlFunc.Subqueryable().Where(it => it.id == a.mo_id).Select(it => it.plan_qty),
estimated_start_date = a.estimated_start_date,
estimated_end_date = a.estimated_end_date,
- bom_id = e.id,
- bom_version = e.version
+ bom_id = d.id,
+ bom_version = d.version
})
.Mapper(it => it.mo_task_status = dic.ContainsKey(it.mo_task_status) ? dic[it.mo_task_status].ToString()! : "")
.ToListAsync();
@@ -461,8 +404,10 @@ namespace Tnb.ProductionMgr
scheduled_qty = a.scheduled_qty,
plan_qty = d.plan_qty,
process_task_qty = a.process_task_qty,
+ bom_version = SqlFunc.Subqueryable().Where(it => it.material_id == a.material_id).Select(it => it.version)
})
.Mapper(it => it.mo_task_status = dic.ContainsKey(it.mo_task_status) ? dic[it.mo_task_status].ToString()! : "")
+ .OrderBy(a => a.mo_task_code, OrderByType.Asc)
.ToListAsync();
return result;
}
@@ -471,29 +416,80 @@ namespace Tnb.ProductionMgr
///
///
[HttpGet]
- public async Task GetUnSchedulingList()
+ public async Task GetUnSchedulingList([FromQuery] VisualDevModelListQueryInput input)
{
- List trees = new();
- var list = await _db.Queryable().Where(it => string.IsNullOrEmpty(it.parent_id) && it.mo_status == DictConst.ScheduledId).ToListAsync();
- foreach (var item in list)
+ List trees = new();
+ VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(MoModuleId, true);
+ var data = await _runService.GetListResult(templateEntity, input);
+
+ if (data?.list?.Count > 0)
{
- var node = item.Adapt();
- node.mo_id = item.id;
- node.id = SnowflakeIdHelper.NextId();
- node.parentId = "0";
- var items = await _db.Queryable().Where(it => it.parent_id == item.id).ToListAsync();
- if (items?.Count() > 0)
+ var parentIdField = nameof(PrdMo.parent_id);
+ var nodes = data.list.Where(it => it.ContainsKey(parentIdField) && it[parentIdField].IsNullOrEmpty()).ToList();
+ foreach (var row in nodes)
{
- var childNodes = items.Adapt>();
- for (int i = 0; i < items.Count; i++)
+ var pkName = "material_id_id";
+ var dic = row.ToDictionary(x => x.Key, x => x.Value);
+
+ PrdMoTreeOutput node = DictionaryToObject(row);
+ node.parentId = "0";
+ node.mo_id = node.id;
+ if (dic.ContainsKey(pkName))
{
- childNodes[i].mo_id = items[i].id;
+ var materialId = dic[pkName]?.ToString();
+ var material = await _db.Queryable().FirstAsync(it => it.id == materialId);
+ node.material_id_id = materialId;
+ node.material_code = material?.code;
+ node.material_name = material?.name;
+ node.material_standard = material?.material_standard;
}
- trees.AddRange(childNodes);
+ //
+ var scheldQtyCol = nameof(PrdMo.scheduled_qty);
+
+ node.scheduled_qty = _db.Queryable().Where(it => it.mo_id == dic["id"].ToString()).Sum(it => it.scheduled_qty)?.ToString();
+ var queryObj = new { parent_id = node.id };
+ input.superQueryJson = "";
+ input.queryJson = queryObj.ToJsonString();
+ var subData = await _runService.GetListResult(templateEntity, input);
+ if (subData?.list?.Count > 0)
+ {
+ var childNodes = new List();
+ foreach (var item in subData.list)
+ {
+ dic = item.ToDictionary(x => x.Key, x => x.Value);
+ PrdMoTreeOutput subNode = DictionaryToObject(item);
+ subNode.parentId = node.id;
+ subNode.mo_id = subNode.id;
+ if (dic.ContainsKey(pkName))
+ {
+ var materialId = dic[pkName]?.ToString();
+ var material = await _db.Queryable().FirstAsync(it => it.id == materialId);
+ subNode.material_id_id = materialId;
+ subNode.material_code = material?.code;
+ subNode.material_name = material?.name;
+ subNode.material_standard = material?.material_standard;
+ }
+ node.scheduled_qty = _db.Queryable().Where(it => it.mo_id == dic["id"].ToString()).Sum(it => it.scheduled_qty)?.ToString();
+ childNodes.Add(subNode);
+ }
+ trees.AddRange(childNodes);
+ }
+ trees.Add(node);
}
- trees.Add(node);
}
- return trees.ToTree();
+ var treeList = trees.ToTree();
+ var list = treeList.Skip(input.currentPage - 1).Take(input.pageSize).ToList();
+ SqlSugarPagedList pagedList = new()
+ {
+ list = treeList,
+ pagination = new Pagination
+ {
+ CurrentPage = input.currentPage,
+ PageSize = input.pageSize,
+ Total = treeList.Count
+ }
+ };
+ return PageResult.SqlSugarPageResult(pagedList);
}
#endregion
@@ -593,22 +589,22 @@ namespace Tnb.ProductionMgr
await db.Insertable(taskLog).ExecuteCommandAsync();
//将生产任务插入到自检报废记录表
- var sacipRecord = new PrdMoTaskDefectRecord();
- sacipRecord.id = SnowflakeIdHelper.NextId();
- sacipRecord.material_code = material?.code!;
- sacipRecord.material_name = material?.name!;
- sacipRecord.eqp_code = (await db.Queryable().FirstAsync(it => it.id == moTask.eqp_id))?.code!;
- sacipRecord.mold_name = (await db.Queryable().FirstAsync(it => it.id == moTask.mold_id))?.mold_name!;
- sacipRecord.estimated_start_date = moTask.plan_start_date;
- sacipRecord.estimated_end_date = moTask.plan_end_date;
- sacipRecord.plan_qty = moTask.plan_qty;
- sacipRecord.scrap_qty = moTask.scrap_qty;
- sacipRecord.status = moTask.mo_task_status;
- sacipRecord.create_id = _userManager.UserId;
- sacipRecord.create_time = DateTime.Now;
- sacipRecord.mo_task_id = moTask.id;
- sacipRecord.mo_task_code = moTask.mo_task_code;
- await db.Insertable(sacipRecord).ExecuteCommandAsync();
+ //var sacipRecord = new PrdMoTaskDefectRecord();
+ //sacipRecord.id = SnowflakeIdHelper.NextId();
+ //sacipRecord.material_code = material?.code!;
+ //sacipRecord.material_name = material?.name!;
+ //sacipRecord.eqp_code = (await db.Queryable().FirstAsync(it => it.id == moTask.eqp_id))?.code!;
+ //sacipRecord.mold_name = (await db.Queryable().FirstAsync(it => it.id == moTask.mold_id))?.mold_name!;
+ //sacipRecord.estimated_start_date = moTask.plan_start_date;
+ //sacipRecord.estimated_end_date = moTask.plan_end_date;
+ //sacipRecord.plan_qty = moTask.plan_qty;
+ //sacipRecord.scrap_qty = moTask.scrap_qty;
+ //sacipRecord.status = moTask.mo_task_status;
+ //sacipRecord.create_id = _userManager.UserId;
+ //sacipRecord.create_time = DateTime.Now;
+ //sacipRecord.mo_task_id = moTask.id;
+ //sacipRecord.mo_task_code = moTask.mo_task_code;
+ //await db.Insertable(sacipRecord).ExecuteCommandAsync();
await db.Ado.CommitTranAsync();
}
@@ -641,18 +637,22 @@ namespace Tnb.ProductionMgr
var moTask = input.Adapt();
moTask.id = SnowflakeIdHelper.NextId();
moTask.create_id = _userManager.UserId;
+ moTask.bom_id = input.bom_id;
+ moTask.workroute_id = (await _db.Queryable().FirstAsync(it => it.id == input.bom_id))?.route_id;
+ moTask.workline_id = input.workline_id;
moTask.create_time = DateTime.Now;
moTask.schedule_type = 2;
moTask.mo_task_status = DictConst.ToBeScheduledEncode;
moTask.estimated_start_date = input.estimated_start_date;
moTask.estimated_end_date = input.estimated_end_date;
+ moTask.scheduled_qty = input.scheduled_qty;
var mo = await _db.Queryable().FirstAsync(it => it.id == input.mo_id);
var moCode = mo?.mo_code;
- var taskCode = await _db.Queryable().Where(it => !string.IsNullOrEmpty(it.mo_task_code) && it.mo_task_code.Contains(moCode))
+ var taskCode = await _db.Queryable().Where(it => string.IsNullOrEmpty(it.parent_id) && !string.IsNullOrEmpty(it.mo_task_code) && it.mo_task_code.Contains(moCode))
.OrderByDescending(it => it.mo_task_code)
.Select(it => it.mo_task_code)
.FirstAsync();
- if (taskCode!.IsNullOrEmpty())
+ if (taskCode is null || taskCode.IsNullOrEmpty())
{
moTask.mo_task_code = $"{moCode}-01";
}
@@ -669,7 +669,7 @@ namespace Tnb.ProductionMgr
}
row = await _db.Insertable(moTask).ExecuteCommandAsync();
var material_h = await _db.Queryable().FirstAsync(it => it.id == moTask.material_id);
- //添加生产任务操作记录日志s
+ //添加生产任务操作记录日志
var taskLog = new PrdTaskLog();
taskLog.id = SnowflakeIdHelper.NextId();
taskLog.mo_code = (await _db.Queryable().FirstAsync(it => it.id == input.mo_id))?.mo_code!;
@@ -718,58 +718,64 @@ namespace Tnb.ProductionMgr
}
}
}
- //根据生产bomId 拆解生产子任务
- var outputList = new List();
- var bom = await _db.Queryable().FirstAsync(it => it.id == input.bom_id);
- if (bom != null && bom.route_id.IsNotEmptyOrNull())
+ var subTaskList = await _db.Queryable()
+ .LeftJoin((a, b) => a.id == b.mbom_id)
+ .LeftJoin((a, b, c) => a.route_id == c.id)
+ .LeftJoin((a, b, c, d) => b.process_id == d.process_id && c.id == d.route_id)
+ .LeftJoin((a, b, c, d, e) => a.id == e.mbom_id && e.mbom_process_id == b.id)
+ .Where((a, b, c, d, e) => a.id == input.bom_id)
+ .Select((a, b, c, d, e) => new SubBomListOutput
+ {
+ version = a.version,
+ unit_id = a.unit_id,
+ route_id = c.id,
+ process_id = b.process_id,
+ material_id = SqlFunc.Subqueryable().Where(it => it.id == e.material_id).Select(it => it.id),
+ num = e.num,
+ ordinal = d.ordinal,
+ })
+ .Mapper(it => it.output_qty = it.num.ParseToInt())
+ .ToListAsync();
+ if (subTaskList?.Count > 0)
{
- var routes = await _db.Queryable().Where(it => it.route_id == bom.route_id).ToListAsync();
- if (routes?.Count > 0)
+ List subMoTasks = new();
+ foreach (var item in subTaskList)
{
- var processIds = routes.Select(x => x.process_id).ToList();
- if (processIds?.Count > 0)
+ PrdMoTask subMoTask = new();
+ subMoTask.mo_id = input.mo_id;
+ subMoTask.material_id = item.material_id;
+ subMoTask.schedule_type = 2;
+ subMoTask.parent_id = moTask.id;
+ subMoTask.bom_id = input.bom_id;
+ subMoTask.process_id = item.process_id;
+ subMoTask.mo_task_status = DictConst.ToBeScheduledEncode;
+ subMoTask.workroute_id = item.route_id;
+ subMoTask.workline_id = input.workline_id;
+ subMoTask.material_id = item.material_id;
+ subMoTask.scheduled_qty = input.scheduled_qty;
+ subMoTask.process_task_qty = item.output_qty * moTask.scheduled_qty;
+ subMoTask.estimated_start_date = input.estimated_start_date;
+ subMoTask.estimated_end_date = input.estimated_end_date;
+ subMoTask.create_id = _userManager.UserId;
+ subMoTask.create_time = DateTime.Now;
+ subMoTasks.Add(subMoTask);
+ }
+ //根据生产任务编号生成子任务编号
+ if (moTask.mo_task_code!.IsNotEmptyOrNull())
+ {
+ for (int i = 1; i <= subMoTasks.Count; i++)
{
- var bomOutputs = await _db.Queryable().Where(it => processIds.Contains(it.process_id)).ToListAsync();
- if (bomOutputs?.Count > 0)
- {
- List subMoTasks = new();
- foreach (var item in bomOutputs)
- {
- var material = await _db.Queryable().FirstAsync(it => it.id == item.material_id);
- PrdMoTask subMoTask = new();
- subMoTask.id = SnowflakeIdHelper.NextId();
- subMoTask.schedule_type = 2;
- subMoTask.parent_id = moTask.id;
- subMoTask.bom_id = input.bom_id;
- subMoTask.mo_task_status = DictConst.ToBeScheduledEncode;
- subMoTask.workline_id = input.workline_id;
- subMoTask.material_id = item.material_id;
- subMoTask.process_task_qty = item.num.ParseToInt() * moTask.scheduled_qty;
- subMoTask.estimated_start_date = input.estimated_start_date;
- subMoTask.estimated_end_date = input.estimated_end_date;
- subMoTask.create_id = _userManager.UserId;
- subMoTask.create_time = DateTime.Now;
- subMoTasks.Add(subMoTask);
- }
- //根据生产任务编号生成子任务编号
- if (moTask.mo_task_code!.IsNotEmptyOrNull())
- {
- for (int i = 1; i <= subMoTasks.Count; i++)
- {
- string n = i.ToString();
- subMoTasks[i - 1].mo_task_code = $"{moTask.mo_task_code}-{n.PadLeft(2, '0')}";
- }
- }
- row = await _db.Insertable(subMoTasks).ExecuteCommandAsync();
- }
+ string n = i.ToString();
+ subMoTasks[i - 1].mo_task_code = $"{moTask.mo_task_code}-{n.PadLeft(2, '0')}";
}
}
+ row = await _db.Insertable(subMoTasks).ExecuteCommandAsync();
}
await _db.Ado.CommitTranAsync();
}
catch (Exception ex)
{
- Log.Error("组装包装排产时报错", ex);
+ JNPF.Logging.Log.Error("组装包装排产时报错", ex);
await _db.Ado.RollbackTranAsync();
}
return row > 0;
@@ -798,102 +804,185 @@ namespace Tnb.ProductionMgr
{
throw new ArgumentException($"{nameof(input.Behavior)} not be null or empty");
}
- string SetTaskStatus(PrdTaskBehavior behavior) => behavior switch
+ //var taskList = await _db.Queryable().Where(it => input.TaskIds.Contains(it.id) && it.mo_task_status == DictConst.ToBeScheduledEncode).ToListAsync();
+ //if (taskList?.Count > 0)
{
- PrdTaskBehavior.Release => DictConst.ToBeStartedEnCode,
- PrdTaskBehavior.Start => DictConst.InProgressEnCode,
- PrdTaskBehavior.Closed => DictConst.ClosedEnCode,
- PrdTaskBehavior.Compled => DictConst.ComplatedEnCode,
- _ => throw new NotImplementedException(),
- };
- PrdTaskBehavior behavior = input.Behavior.ToEnum();
- var status = SetTaskStatus(behavior);
- var db = _repository.AsSugarClient();
- var list = await db.Queryable().Where(it => input.TaskIds.Contains(it.id)).Select(it => it).ToListAsync();
- if (behavior == PrdTaskBehavior.Compled)
- {
-
- if (list?.Count > 0)
+ string SetTaskStatus(PrdTaskBehavior behavior) => behavior switch
{
- var schedQtySum = list.Sum(x => x.scheduled_qty);
- var planQtySum = list.Sum(x => x.plan_qty);
- if (schedQtySum < planQtySum)
+ PrdTaskBehavior.Release => DictConst.ToBeStartedEnCode,
+ PrdTaskBehavior.Start => DictConst.InProgressEnCode,
+ PrdTaskBehavior.Closed => DictConst.ClosedEnCode,
+ PrdTaskBehavior.Compled => DictConst.ComplatedEnCode,
+ _ => throw new NotImplementedException(),
+ };
+ PrdTaskBehavior behavior = input.Behavior.ToEnum();
+ var status = SetTaskStatus(behavior);
+ var db = _repository.AsSugarClient();
+ var list = await db.Queryable().Where(it => input.TaskIds.Contains(it.id)).Select(it => it).ToListAsync();
+ if (behavior == PrdTaskBehavior.Compled)
+ {
+ if (list?.Count > 0)
{
- throw new AppFriendlyException("任务数量必须大于等于生产计划数量,才可完成", 500);
- }
- }
- }
- row = await db.Updateable()
- .SetColumns(it => new PrdMoTask { mo_task_status = status })
- .Where(it => input.TaskIds.Contains(it.id))
- .ExecuteCommandAsync();
- if (row > 0)
- {
- //更新子任务
- var subMoTaskList = await db.Queryable().Where(it => input.TaskIds.Contains(it.parent_id)).ToListAsync();
- if (subMoTaskList?.Count > 0)
- {
- var subTaskIds = subMoTaskList.Select(it => it.id).ToList();
- row = await db.Updateable()
- .SetColumns(it => new PrdMoTask { mo_task_status = status })
- .Where(it => subTaskIds.Contains(it.id))
- .ExecuteCommandAsync();
- }
- }
- //插入操作记录日志
- var prdMOTasks = await _db.Queryable().Where(it => input.TaskIds.Contains(it.id) && string.IsNullOrEmpty(it.parent_id)).ToListAsync();
- if (prdMOTasks?.Count > 0)
- {
- List taskLogEntities = new();
- foreach (var taskId in input.TaskIds)
- {
- var taskLog = await db.Queryable().FirstAsync(it => it.mo_task_id == taskId);
- if (taskLog is null)
- {
- var taskItem = list?.Find(x => x.id == taskId);
- taskLog = new PrdTaskLog();
- taskLog.id = SnowflakeIdHelper.NextId();
- if (taskItem != null)
+ var schedQtySum = list.Sum(x => x.scheduled_qty);
+ var planQtySum = list.Sum(x => x.plan_qty);
+ if (schedQtySum < planQtySum)
{
- if (taskItem.mo_id!.IsNotEmptyOrNull())
- {
- taskLog.mo_code = (await db.Queryable().FirstAsync(it => it.id == taskItem.mo_id))?.mo_code!;
- }
- if (taskItem.eqp_id!.IsNotEmptyOrNull())
- {
- taskLog.eqp_code = (await db.Queryable().FirstAsync(it => it.id == taskItem.eqp_id))?.code!;
- }
- if (taskItem.mold_id!.IsNotEmptyOrNull())
- {
- taskLog.mold_code = (await db.Queryable().FirstAsync(it => it.id == taskItem.mold_id))?.mold_code!;
- }
- if (taskItem.material_id!.IsNotEmptyOrNull())
- {
- var material = await db.Queryable().FirstAsync(it => it.id == taskItem.material_id);
- taskLog.item_code = material?.code!;
- taskLog.item_standard = material?.material_standard!;
- }
- taskLog.operator_name = _userManager.RealName;
- taskLog.status = status;
- taskLog.create_id = _userManager.UserId;
- taskLog.create_time = DateTime.Now;
- taskLog.mo_task_id = taskItem.id;
+ throw new AppFriendlyException("任务数量必须大于等于生产计划数量,才可完成", 500);
}
- taskLogEntities.Add(taskLog);
}
- else
+ }
+
+ var taskReportLogs = new List();
+ var prdTaskList = await db.Queryable().Where(it => input.TaskIds.Contains(it.id)).ToListAsync();
+ if (prdTaskList?.Count > 0)
+ {
+ prdTaskList.ForEach(x => x.mo_task_status = status);
+ row = await db.Updateable(prdTaskList).ExecuteCommandAsync();
+ if (row > 0)
{
- var records = await db.Queryable().Where(it => it.mo_task_id == taskLog.mo_task_id).ToListAsync();
- if (records != null && !records.Select(x => x.status).Contains(status))
+ taskReportLogs.AddRange(prdTaskList);
+ }
+ }
+ if (row > 0)
+ {
+ //更新子任务
+ var subMoTaskList = await db.Queryable().Where(it => input.TaskIds.Contains(it.parent_id)).ToListAsync();
+ if (subMoTaskList?.Count > 0)
+ {
+ var subTaskIds = subMoTaskList.Select(it => it.id).ToList();
+ row = await db.Updateable()
+ .SetColumns(it => new PrdMoTask { mo_task_status = status })
+ .Where(it => subTaskIds.Contains(it.id))
+ .ExecuteCommandAsync();
+ if (row > 0)
{
+ taskReportLogs.AddRange(subMoTaskList);
+ }
+ }
+ }
+ //插入操作记录日志
+ var prdMOTasks = await _db.Queryable().Where(it => input.TaskIds.Contains(it.id) && string.IsNullOrEmpty(it.parent_id)).ToListAsync();
+ if (prdMOTasks?.Count > 0)
+ {
+ List taskLogEntities = new();
+ foreach (var taskId in input.TaskIds)
+ {
+ var taskLog = await db.Queryable().FirstAsync(it => it.mo_task_id == taskId);
+ if (taskLog is null)
+ {
+ var taskItem = list?.Find(x => x.id == taskId);
+ taskLog = new PrdTaskLog();
taskLog.id = SnowflakeIdHelper.NextId();
- taskLog.status = status;
+ if (taskItem != null)
+ {
+ if (taskItem.mo_id!.IsNotEmptyOrNull())
+ {
+ taskLog.mo_code = (await db.Queryable().FirstAsync(it => it.id == taskItem.mo_id))?.mo_code!;
+ }
+ if (taskItem.eqp_id!.IsNotEmptyOrNull())
+ {
+ taskLog.eqp_code = (await db.Queryable().FirstAsync(it => it.id == taskItem.eqp_id))?.code!;
+ }
+ if (taskItem.mold_id!.IsNotEmptyOrNull())
+ {
+ taskLog.mold_code = (await db.Queryable().FirstAsync(it => it.id == taskItem.mold_id))?.mold_code!;
+ }
+ if (taskItem.material_id!.IsNotEmptyOrNull())
+ {
+ var material = await db.Queryable().FirstAsync(it => it.id == taskItem.material_id);
+ taskLog.item_code = material?.code!;
+ taskLog.item_standard = material?.material_standard!;
+ }
+ taskLog.operator_name = _userManager.RealName;
+ taskLog.status = status;
+ taskLog.create_id = _userManager.UserId;
+ taskLog.create_time = DateTime.Now;
+ taskLog.mo_task_id = taskItem.id;
+ }
taskLogEntities.Add(taskLog);
}
+ else
+ {
+ var records = await db.Queryable().Where(it => it.mo_task_id == taskLog.mo_task_id).ToListAsync();
+ if (records != null && !records.Select(x => x.status).Contains(status))
+ {
+ taskLog.id = SnowflakeIdHelper.NextId();
+ taskLog.status = status;
+ taskLogEntities.Add(taskLog);
+ }
+ }
+ }
+ if (taskLogEntities?.Count > 0)
+ {
+ row = await db.Insertable(taskLogEntities).ExecuteCommandAsync();
+ }
+
+ List prdReportLogs = new();
+ List prdTaskDefectLogs = new();
+ if (taskReportLogs?.Count > 0)
+ {
+ foreach (var taskInfo in taskReportLogs)
+ {
+ //组装生产提报对象
+ var material = (await db.Queryable().FirstAsync(it => it.id == taskInfo.material_id));
+ var mo = await db.Queryable().FirstAsync(it => it.id == taskInfo.mo_id);
+ var record = taskInfo.Adapt();
+ record.id = SnowflakeIdHelper.NextId();
+ record.masterial_code = material?.code;
+ record.masterial_name = material?.name;
+ record.plan_start_date = taskInfo.estimated_start_date;
+ record.plan_end_date = taskInfo.estimated_end_date;
+ record.plan_qty = taskInfo.plan_qty;
+ record.eqp_code = (await db.Queryable().FirstAsync(it => it.id == taskInfo.eqp_id))?.code;
+ record.mo_task_type = mo?.mo_type;
+ record.status = taskInfo.mo_task_status;
+ record.mo_task_id = taskInfo.id;
+ //record.completed_qty = (await db.Queryable().Where(it => it.mo_task_code == taskInfo.mo_task_code).SumAsync(it => it.reported_work_qty)).Value;
+ prdReportLogs.Add(record);
+
+ //组装自检报废对象
+ var sacipRecord = new PrdMoTaskDefectRecord();
+ sacipRecord.id = SnowflakeIdHelper.NextId();
+ sacipRecord.material_code = material?.code!;
+ sacipRecord.material_name = material?.name!;
+ sacipRecord.eqp_code = (await db.Queryable().FirstAsync(it => it.id == taskInfo.eqp_id))?.code!;
+ sacipRecord.mold_name = (await db.Queryable().FirstAsync(it => it.id == taskInfo.mold_id))?.mold_name!;
+ sacipRecord.estimated_start_date = taskInfo.estimated_start_date;
+ sacipRecord.estimated_end_date = taskInfo.estimated_end_date;
+ sacipRecord.plan_qty = taskInfo.plan_qty;
+ sacipRecord.scrap_qty = taskInfo.scrap_qty.HasValue ? taskInfo.scrap_qty.Value : 0;
+ sacipRecord.status = taskInfo.mo_task_status;
+ sacipRecord.create_id = _userManager.UserId;
+ sacipRecord.create_time = DateTime.Now;
+ sacipRecord.mo_task_id = taskInfo.id;
+ sacipRecord.mo_task_code = taskInfo.mo_task_code;
+ sacipRecord.mo_task_type = mo?.mo_type;
+ sacipRecord.status = taskInfo.mo_task_status;
+ prdTaskDefectLogs.Add(sacipRecord);
+ }
+ }
+ var reportTaskIds = prdReportLogs.Select(it => it.mo_task_id).ToList();
+ if (reportTaskIds?.Count > 0)
+ {
+ var items = await db.Queryable().Where(it => reportTaskIds.Contains(it.mo_task_id)).ToListAsync();
+ if (items == null || items.Count < 1)
+ {
+ row = await db.Insertable(prdReportLogs).ExecuteCommandAsync();
+ }
+ }
+ var defectTaskIds = prdTaskDefectLogs.Select(it => it.mo_task_id).ToList();
+ if (defectTaskIds?.Count > 0)
+ {
+ var items = await db.Queryable().Where(it => defectTaskIds.Contains(it.mo_task_id)).ToListAsync();
+ if (items == null || items.Count < 1)
+ {
+ row = await db.Insertable(prdTaskDefectLogs).ExecuteCommandAsync();
+ }
}
}
- row = await db.Insertable(taskLogEntities).ExecuteCommandAsync();
}
+ //else
+ // throw new AppFriendlyException("只有待下发状态的任务才可下发", 500);
return (row > 0);
}
@@ -962,32 +1051,31 @@ namespace Tnb.ProductionMgr
{
var row = -1;
var db = _repository.AsSugarClient();
- var report = await db.Queryable().FirstAsync(it => it.mo_task_code == input.mo_task_code);
+ var report = await db.Queryable().FirstAsync(it => it.mo_task_id == input.mo_task_id);
- if (report is not null)
- {
- report.mo_task_code = input.mo_task_code;
- report.mo_task_id = input.mo_task_id;
- report.reported_work_qty += input.reported_qty;
- report.prd_qty += input.reported_qty;
-
- }
- else
+ //if (report is not null)
+ //{
+ // report.mo_task_code = input.mo_task_code;
+ // report.mo_task_id = input.mo_task_id;
+ // report.reported_work_qty += input.reported_qty;
+ // report.prd_qty += input.reported_qty;
+ //}
+ //else
{
report = input.Adapt();
report.id = SnowflakeIdHelper.NextId();
- report.reported_work_qty = input.reported_qty;
- report.prd_qty = input.reported_qty;
+ report.reported_qty = input.reported_qty;
+ report.create_id = _userManager.UserId;
+ report.create_time = DateTime.Now;
+
}
- row = await db.Storageable(report).ExecuteCommandAsync();
- var prdTask = await db.Queryable().FirstAsync(it => it.mo_task_code == input.mo_task_code);
- var record = prdTask.Adapt();
- if (prdTask != null)
+ row = await db.Insertable(report).ExecuteCommandAsync();
+ var master = await db.Queryable().FirstAsync(it => it.mo_task_id == input.mo_task_id);
+ if (master != null)
{
- record.id = SnowflakeIdHelper.NextId();
- record.eqp_code = (await db.Queryable().FirstAsync(it => it.id == prdTask.eqp_id))?.code;
- record.completed_qty = input.reported_qty;
- row = await db.Insertable(record).ExecuteCommandAsync();
+ master.reported_work_qty += input.reported_qty;
+ master.completed_qty += input.reported_qty;
+ await db.Updateable(master).ExecuteCommandAsync();
}
return row > 0;
}
@@ -1037,7 +1125,7 @@ namespace Tnb.ProductionMgr
defect.defective_item = dItem.defective_item;
defect.defective_item_qty = dItem.defective_item_qty;
defect.create_id = _userManager.UserId;
-
+ defect.scrap_qty = input.scrap_qty;
destDefects.Add(defect);
}
}
@@ -1048,6 +1136,18 @@ namespace Tnb.ProductionMgr
{
await db.Updateable().SetColumns(it => new PrdMoTask { scrap_qty = scrapQty.Value }).Where(it => it.id == input.mo_task_id).ExecuteCommandAsync();
}
+ var defectRecord = await db.Queryable().FirstAsync(it => it.mo_task_id == input.mo_task_id);
+ if (defectRecord != null)
+ {
+ defectRecord.scrap_qty += input.scrap_qty;
+ await db.Updateable(defectRecord).ExecuteCommandAsync();
+ }
+ var reportMaster = await db.Queryable().FirstAsync(it => it.mo_task_id == input.mo_task_id);
+ if (reportMaster != null)
+ {
+ reportMaster.completed_qty += input.scrap_qty;
+ await db.Updateable(reportMaster).ExecuteCommandAsync();
+ }
});
return result.IsSuccess;
@@ -1084,46 +1184,77 @@ namespace Tnb.ProductionMgr
if (input.ids is null || input.ids.Count == 0) throw new ArgumentException($"{nameof(input.ids)} not be null or count zero");
var curMo = await _db.Queryable().FirstAsync(it => it.id == input.mo_id);
if (curMo == null) throw new ArgumentNullException("创建子工单时的父工单不能为null");
- List subMoList = new();
- var outputMaterials = await _db.Queryable().LeftJoin((a, b) => a.id == b.material_id)
- .Where((a, b) => input.ids.Contains(a.id))
- .Select((a, b) => new
- {
- material_id = a.id,
- material_code = a.code,
- num = b.num,
- })
- .ToListAsync();
- foreach (var om in outputMaterials)
- {
- PrdMo subMo = new();
- subMo.material_id = om.material_id;
- subMo.material_code = om.material_code;
- subMo.plan_qty = om.num.ParseToInt() * curMo.plan_qty;
- subMo.mo_type = curMo.mo_type;
- subMo.parent_id = curMo.id;
- subMo.plan_start_date = curMo.plan_start_date;
- subMo.plan_end_date = curMo.plan_end_date;
- subMo.create_id = _userManager.UserId;
- subMo.create_time = DateTime.Now;
- subMo.mo_status = DictConst.WaitProductId;
- subMoList.Add(subMo);
- }
- //生成子工单编码
- for (int i = 0; i < subMoList.Count; i++)
- {
- var num = (i + 1).ToString().PadLeft(2, '0');
- subMoList[i].mo_code = $"{subMoList[i].mo_code}-{num}";
- }
- var row = await _db.Insertable(subMoList).ExecuteCommandAsync();
- if (row < 1) throw Oops.Oh(ErrorCode.COM1000);
+
+ var outMaterials = await _db.Queryable().InnerJoin((a, b) => a.id == b.mbom_id)
+ .InnerJoin((a, b, c) => a.id == c.mbom_id && b.id == c.mbom_process_id)
+ .Where((a, b, c) => a.id == input.bom_id && input.ids.Contains(b.process_id))
+ .Select((a, b, c) => new
+ {
+ material_id = c.material_id,
+ num = c.num,
+ })
+ .ToListAsync();
+
+ if (outMaterials?.Count > 0)
+ {
+ var ids = outMaterials.Select(x => x.material_id).ToList();
+ await _db.Deleteable().Where(it => it.parent_id == input.mo_id).ExecuteCommandAsync();
+ if (ids?.Count > 0)
+ {
+ var dicOutMaterialNum = outMaterials.DistinctBy(x => x.material_id).ToDictionary(x => x.material_id, x => x.num.ParseToInt());
+ List subMoList = new();
+ var outputMaterials = await _db.Queryable().Where(it => ids.Contains(it.id)).ToListAsync();
+ foreach (var om in outputMaterials)
+ {
+ PrdMo subMo = new();
+ subMo.material_id = om.id;
+ subMo.material_code = om.code;
+ subMo.plan_qty = dicOutMaterialNum.ContainsKey(om.id) ? dicOutMaterialNum[om.id] * curMo.plan_qty : 0;
+ subMo.mo_type = curMo.mo_type;
+ subMo.parent_id = curMo.id;
+ subMo.plan_start_date = curMo.plan_start_date;
+ subMo.plan_end_date = curMo.plan_end_date;
+ subMo.create_id = _userManager.UserId;
+ subMo.create_time = DateTime.Now;
+ subMo.mo_status = DictConst.WaitProductId;
+ subMoList.Add(subMo);
+ }
+ //生成子工单编码
+ for (int i = 0; i < subMoList.Count; i++)
+ {
+ var num = (i + 1).ToString().PadLeft(2, '0');
+ subMoList[i].mo_code = $"{curMo.mo_code}-{num}";
+ }
+ var row = await _db.Insertable(subMoList).ExecuteCommandAsync();
+ if (row < 1) throw Oops.Oh(ErrorCode.COM1000);
+ }
+
+ }
}
#endregion
-
+ private static Dictionary dicProperties = new Dictionary(StringComparer.OrdinalIgnoreCase);
+ private static T DictionaryToObject(IDictionary dictionary) where T : class, new()
+ {
+ var name = typeof(T).Name;
+ T instance = new();
+ if (!dicProperties.TryGetValue(name, out string[] properies))
+ {
+ properies = instance.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(p => p.Name).ToArray();
+ dicProperties[name] = properies;
+ }
+ foreach (var pn in properies)
+ {
+ if (dictionary.ContainsKey(pn))
+ {
+ instance.PropertySetValue(pn, dictionary[pn]);
+ }
+ }
+ return instance;
+ }
private async Task GetList(VisualDevModelListQueryInput input)
{
var db = _repository.AsSugarClient();
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs
new file mode 100644
index 00000000..6f426481
--- /dev/null
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs
@@ -0,0 +1,159 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Aspose.Cells.Drawing;
+using JNPF.Common.Extension;
+using JNPF.Common.Filter;
+using JNPF.Common.Security;
+using JNPF.DependencyInjection;
+using JNPF.DynamicApiController;
+using JNPF.Systems.Entitys.Permission;
+using JNPF.Systems.Interfaces.System;
+using Mapster;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.CodeAnalysis.Operations;
+using NPOI.POIFS.Properties;
+using Spire.Pdf.Widget;
+using SqlSugar;
+using Tnb.BasicData;
+using Tnb.BasicData.Entities;
+using Tnb.ProductionMgr.Entities;
+using Tnb.ProductionMgr.Entities.Dto.PrdManage;
+using Tnb.ProductionMgr.Interfaces;
+
+namespace Tnb.ProductionMgr
+{
+ ///