From 9b091e3a119891bae2dd2bdd05524f4eafd05d05 Mon Sep 17 00:00:00 2001 From: zhoukeda <1315948824@qq.com> Date: Fri, 19 May 2023 17:39:09 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Consts/RepairApplyStatus.cs | 58 ++ .../Consts/RepairOutApplyStatus.cs | 21 + .../Dto/RepairApplyRegisterInput.cs | 52 ++ .../Dto/RepairDelayInput.cs | 17 + .../Dto/RepairOutApplyInput.cs | 15 + .../Entity/EqpRepairApply.cs | 558 +++++------------- .../Entity/EqpRepairDelay.cs | 83 +++ .../Entity/EqpRepairOutApply.cs | 117 ++++ .../IEqpRepairApplyService.cs | 52 ++ .../IEqpRepairDelayService.cs | 14 + .../IEqpRepairOutApplyService.cs | 16 + .../Tnb.EquipMgr/EqpRepairApplyService.cs | 118 ++++ .../Tnb.EquipMgr/EqpRepairDelayService.cs | 68 +++ .../Tnb.EquipMgr/EqpRepairOutApplyService.cs | 82 +++ 14 files changed, 858 insertions(+), 413 deletions(-) create mode 100644 EquipMgr/Tnb.EquipMgr.Entities/Consts/RepairApplyStatus.cs create mode 100644 EquipMgr/Tnb.EquipMgr.Entities/Consts/RepairOutApplyStatus.cs create mode 100644 EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairApplyRegisterInput.cs create mode 100644 EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairDelayInput.cs create mode 100644 EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairOutApplyInput.cs create mode 100644 EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairDelay.cs create mode 100644 EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairOutApply.cs create mode 100644 EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairApplyService.cs create mode 100644 EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairDelayService.cs create mode 100644 EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairOutApplyService.cs create mode 100644 EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs create mode 100644 EquipMgr/Tnb.EquipMgr/EqpRepairDelayService.cs create mode 100644 EquipMgr/Tnb.EquipMgr/EqpRepairOutApplyService.cs diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Consts/RepairApplyStatus.cs b/EquipMgr/Tnb.EquipMgr.Entities/Consts/RepairApplyStatus.cs new file mode 100644 index 00000000..97d82d49 --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr.Entities/Consts/RepairApplyStatus.cs @@ -0,0 +1,58 @@ +namespace Tnb.EquipMgr +{ + /// + /// 设备维修状态 + /// + public static class RepairApplyStatus + { + /// + /// 待执行 + /// + public const string TOBEEXECUTED = "1"; + /// + /// 待接收 + /// + public const string TOBERECEIVED = "2"; + /// + /// 已接收 + /// + public const string RECEIVED = "3"; + /// + /// 拒绝 + /// + public const string REFUSE = "4"; + /// + /// 已维修 + /// + public const string REPAIRED = "5"; + /// + /// 已完成 + /// + public const string COMPLETED = "6"; + /// + /// 外修申请待审批 + /// + public const string OUTAPPLYAPPROVE = "7"; + /// + /// 审批通过 + /// + public const string APPROVEPASS = "8"; + /// + /// 审批拒绝 + /// + public const string APPROVENOTPASS = "9"; + /// + /// 已关闭 + /// + public const string CLOSE = "10"; + /// + /// 已作废 + /// + public const string REPEAL = "11"; + /// + /// 申请外修 + /// + public const string TOBEOUTAPPLY = "12"; + + } +} \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Consts/RepairOutApplyStatus.cs b/EquipMgr/Tnb.EquipMgr.Entities/Consts/RepairOutApplyStatus.cs new file mode 100644 index 00000000..5cc8274f --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr.Entities/Consts/RepairOutApplyStatus.cs @@ -0,0 +1,21 @@ +namespace Tnb.EquipMgr +{ + /// + /// 设备维修状态 + /// + public static class RepairOutApplyStatus + { + /// + /// 待审批 + /// + public const string TOBEAPPROVE = "1"; + /// + /// 退回 + /// + public const string BACK = "2"; + /// + /// 通过 + /// + public const string PASS = "3"; + } +} \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairApplyRegisterInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairApplyRegisterInput.cs new file mode 100644 index 00000000..6004ec09 --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairApplyRegisterInput.cs @@ -0,0 +1,52 @@ +namespace Tnb.EquipMgr.Entities.Dto +{ + public class RepairApplyRegisterInput + { + public string id { get; set; } + + /// + /// 故障ID + /// + public string fault_id { get; set; } + + /// + /// 是否完成 + /// + public string? is_complete { get; set; } + + /// + /// 完成时间 + /// + public DateTime? complete_time { get; set; } + + /// + /// 维修耗时 + /// + public string? repair_take_time { get; set; } + + /// + /// 是否停机 + /// + public int? is_halt { get; set; } + + /// + /// 停机时长 + /// + public string? halt_take_time { get; set; } + + /// + /// 维修描述 + /// + public string? repair_description { get; set; } + + /// + /// 附件 + /// + public string? attachment { get; set; } + + /// + /// 是否外修 + /// + public int? is_out_apply { get; set; } + } +} \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairDelayInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairDelayInput.cs new file mode 100644 index 00000000..7c68740e --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairDelayInput.cs @@ -0,0 +1,17 @@ +namespace Tnb.EquipMgr.Entities.Dto +{ + public class RepairDelayInput + { + public string repair_apply_id { get; set; } + + public string equip_id { get; set; } + + public string repair_request_sender_id { get; set; } + + public string repair_sender_id { get; set; } + + public DateTime expected_time { get; set; } + + public string delay_reason { get; set; } + } +} \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairOutApplyInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairOutApplyInput.cs new file mode 100644 index 00000000..9a7242a2 --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairOutApplyInput.cs @@ -0,0 +1,15 @@ +namespace Tnb.EquipMgr.Entities.Dto +{ + public class RepairOutApplyInput + { + public string id { get; set; } + public string repair_apply_id { get; set; } + public string equip_id { get; set; } + public string? supplier_id { get; set; } + public decimal? estimated_cost { get; set; } + public string? construction_period_requirement { get; set; } + public string out_apply_reason { get; set; } + public string? remark { get; set; } + + } +} \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairApply.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairApply.cs index bf174db1..da613276 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairApply.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairApply.cs @@ -1,420 +1,152 @@ -using System; -using System.Linq; -using System.Text; using JNPF.Common.Security; using SqlSugar; +using Tnb.Common.Contracts; -namespace Tnb.EquipMgr.Entities +namespace Tnb.EquipMgr.Entities; + +/// +/// 设备报修申请 +/// +[SugarTable("eqp_repair_apply")] +public partial class EqpRepairApply : BaseEntity { - /// - ///TODO - /// - [SugarTable("eqp_repair_apply")] - public partial class EqpRepairApply + public EqpRepairApply() { - public EqpRepairApply(){ - - - } - /// - /// Desc:创建时间 - /// Default: - /// Nullable:False - /// - public DateTime create_time {get;set;} - - /// - /// Desc:创建用户 - /// Default: - /// Nullable:True - /// - public string? create_id {get;set;} - - /// - /// Desc:修改时间 - /// Default: - /// Nullable:True - /// - public DateTime? modify_time {get;set;} - - /// - /// Desc:修改用户 - /// Default: - /// Nullable:True - /// - public string? modify_id {get;set;} - - /// - /// Desc:编号 - /// Default: - /// Nullable:False - /// - [SugarColumn(IsPrimaryKey=true)] - public string id {get;set;} = SnowflakeIdHelper.NextId(); - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? apply_code {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? apply_name {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? equip_id {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? apply_user_id {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? tel {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? fault_id {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public DateTime? expect_complete_time {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:False - /// - public int is_ugent {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? charge_user_id {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? fault_phenomenon {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:False - /// - public int status {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? reason {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? remark {get;set;} - - /// - /// Desc:排序 - /// Default: - /// Nullable:False - /// - public int ordinal {get;set;} - - /// - /// Desc:是否启用 - /// Default: - /// Nullable:False - /// - public int enabled {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? extend01 {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? extend02 {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? extend03 {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? extend04 {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? extend05 {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? extend06 {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? extend07 {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? extend08 {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? extend09 {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? extend10 {get;set;} - - /// - /// Desc:删除用户 - /// Default: - /// Nullable:True - /// - public string? delete_id {get;set;} - - /// - /// Desc:删除时间 - /// Default: - /// Nullable:True - /// - public DateTime? delete_time {get;set;} - - /// - /// Desc:删除标志 - /// Default: - /// Nullable:False - /// - public short deleted {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? closing_remark {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? invalid_remark {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public int? professional_choice {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? address {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? instructions {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public DateTime? start_date {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? use_department_id {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:False - /// - public int is_equip {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public DateTime? reject_time {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? reject_user_id {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? reject_user_name {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? shift_remarks {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public DateTime? shift_time {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? shift_user_id {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? shift_user_name {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public int? is_send {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public DateTime? send_date_time {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public int? is_msg_send {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public DateTime? to_received_time {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public DateTime? to_repair_time {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public int? is_untreated_send {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public DateTime? send_reive_date_time {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public DateTime? send_untreated_date_time {get;set;} - - /// - /// Desc:TODO - /// Default: - /// Nullable:True - /// - public string? section_id {get;set;} - + 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; } + + /// + /// 申请编码 + /// + public string? code { get; set; } + + /// + /// 申请名称 + /// + public string? name { get; set; } + + /// + /// 设备ID + /// + public string? equip_id { get; set; } + + /// + /// 申请用户ID + /// + public string? apply_user_id { get; set; } + + /// + /// 故障ID + /// + public string? fault_id { get; set; } + + /// + /// 期望完成时间 + /// + public DateTime? expect_complete_time { get; set; } + + /// + /// 是否紧急 + /// + public int? is_ugent { get; set; } + + /// + /// 现象描述 + /// + public string? description { get; set; } + + /// + /// 状态 + /// + public string status { get; set; } = string.Empty; + + /// + /// 原因 + /// + public string? reason { get; set; } + + /// + /// 备注 + /// + public string? remark { get; set; } + + /// + /// 是否启用 + /// + public int? enabled { get; set; } + + /// + /// 所属组织 + /// + public string? org_id { get; set; } + + /// + /// 是否外修 + /// + public int? is_out_apply { get; set; } + + /// + /// 安装位置 + /// + public string? installation_position { get; set; } + + /// + /// 是否完成 + /// + public string? is_complete { get; set; } + + /// + /// 完成时间 + /// + public DateTime? complete_time { get; set; } + + /// + /// 维修耗时 + /// + public string? repair_take_time { get; set; } + + /// + /// 是否停机 + /// + public int? is_halt { get; set; } + + /// + /// 停机时长 + /// + public string? halt_take_time { get; set; } + + /// + /// 维修描述 + /// + public string? repair_description { get; set; } + + /// + /// 维修人id/责任人id + /// + public string? repairer_id { get; set; } + + /// + /// 附件 + /// + public string? attachment { get; set; } + } diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairDelay.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairDelay.cs new file mode 100644 index 00000000..dee65e54 --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairDelay.cs @@ -0,0 +1,83 @@ +using System; +using System.Linq; +using System.Text; +using JNPF.Common.Security; +using SqlSugar; + +namespace Tnb.EquipMgr.Entities +{ + /// + ///设备延期 + /// + [SugarTable("eqp_repair_delay")] + public partial class EqpRepairDelay + { + public EqpRepairDelay() + { + } + + /// + /// Desc:主键 + /// Default: + /// Nullable:False + /// + [SugarColumn(IsPrimaryKey = true)] + public string id { get; set; } = SnowflakeIdHelper.NextId(); + + /// + /// Desc:设备id + /// Default: + /// Nullable:False + /// + public string equip_id { get; set; } = string.Empty; + + /// + /// Desc:报修id + /// Default:NULL::character varying + /// Nullable:True + /// + public string? repair_apply_id { get; set; } + + /// + /// Desc:报修抄送人员id + /// Default:NULL::character varying + /// Nullable:True + /// + public string? repair_request_sender_id { get; set; } + + /// + /// Desc:维修抄送人员id + /// Default:NULL::character varying + /// Nullable:True + /// + public string? repair_sender_id { get; set; } + + /// + /// Desc:预期维修时间 + /// Default:NULL::character varying + /// Nullable:True + /// + public DateTime expected_time { get; set; } + + /// + /// Desc:延期原因 + /// Default:NULL::character varying + /// Nullable:True + /// + public string delay_reason { get; set; } + + /// + /// Desc:创建用户 + /// Default:NULL::character varying + /// Nullable:True + /// + public string? create_id { get; set; } + + /// + /// Desc:创建时间 + /// Default: + /// Nullable:True + /// + public DateTime? create_time { get; set; } + } +} \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairOutApply.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairOutApply.cs new file mode 100644 index 00000000..83328022 --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairOutApply.cs @@ -0,0 +1,117 @@ +using Tnb.Common.Contracts; +using JNPF.Common.Security; +using SqlSugar; + +namespace Tnb.EquipMgr.Entities; + +/// +/// 设备外修申请表 +/// +[SugarTable("eqp_repair_out_apply")] +public partial class EqpRepairOutApply : BaseEntity +{ + public EqpRepairOutApply() + { + id = SnowflakeIdHelper.NextId(); + } + /// + /// 设备id + /// + public string equip_id { get; set; } = string.Empty; + + /// + /// 报修id + /// + public string repair_apply_id { get; set; } = string.Empty; + + /// + /// 供应商 + /// + public string? supplier_id { get; set; } + + /// + /// 预估费用 + /// + public decimal? estimated_cost { get; set; } + + /// + /// 费用 + /// + public decimal? cost { get; set; } + + /// + /// 工期要求 + /// + public string? construction_period_requirement { get; set; } + + /// + /// 外修理由 + /// + public string? out_apply_reason { get; set; } + + /// + /// 外修备注 + /// + public string? remark { get; set; } + + /// + /// 审批状态 0待审批 1 退回 2 通过 + /// + public string? approve_status { get; set; } + + /// + /// 修复时间 + /// + public DateTime? repair_time { get; set; } + + /// + /// 维修耗时 + /// + public decimal? repair_take_time { get; set; } + + /// + /// 维修备注 + /// + public string? repair_remark { get; set; } + + /// + /// 登记备注 + /// + public string? register_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; } + + /// + /// 审批人id + /// + public string? approve_id { get; set; } + + /// + /// 审批时间 + /// + public DateTime? approve_time { get; set; } + + /// + /// 所属组织 + /// + public string? org_id { get; set; } + +} diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairApplyService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairApplyService.cs new file mode 100644 index 00000000..d8ccb4cf --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairApplyService.cs @@ -0,0 +1,52 @@ +using Tnb.EquipMgr.Entities; +using Tnb.EquipMgr.Entities.Dto; + +namespace Tnb.EquipMgr.Interfaces +{ + public interface IEqpRepairApplyService + { + + /// + /// 维修作废 + /// + /// + public Task Repeal(Dictionary dic); + + /// + /// 维修关闭 + /// + /// + public Task Close(Dictionary dic); + + /// + /// 维修指派 + /// + /// + public Task Assign(Dictionary dic); + + /// + /// 维修接收 + /// + /// + public Task Receive(Dictionary dic); + + /// + /// 维修拒绝 + /// + /// + public Task Refuse(Dictionary dic); + + /// + /// 维修信息 + /// + /// + public Task GetInfo(Dictionary dic); + + /// + /// 维修登记 + /// + /// + public Task Register(RepairApplyRegisterInput input); + + } +} \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairDelayService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairDelayService.cs new file mode 100644 index 00000000..2864d32d --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairDelayService.cs @@ -0,0 +1,14 @@ +using Tnb.EquipMgr.Entities.Dto; + +namespace Tnb.EquipMgr.Interfaces +{ + public interface IEqpRepairDelayService + { + /// + /// 维修延期 + /// + /// + public Task Delay(RepairDelayInput input); + + } +} \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairOutApplyService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairOutApplyService.cs new file mode 100644 index 00000000..8416d5f7 --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairOutApplyService.cs @@ -0,0 +1,16 @@ +using Tnb.EquipMgr.Entities; +using Tnb.EquipMgr.Entities.Dto; + +namespace Tnb.EquipMgr.Interfaces +{ + public interface IEqpRepairOutApplyService + { + + /// + /// 外修申请 + /// + /// + public Task OutApply(RepairOutApplyInput input); + + } +} \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs b/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs new file mode 100644 index 00000000..f9f9f689 --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs @@ -0,0 +1,118 @@ +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 EqpRepairApplyService : IEqpRepairApplyService, IDynamicApiController, ITransient + { + private readonly ISqlSugarRepository _repository; + private readonly IUserManager _userManager; + + public EqpRepairApplyService(ISqlSugarRepository repository, + IUserManager userManager) + { + _repository = repository; + _userManager = userManager; + } + + [HttpPost] + public async Task Repeal(Dictionary dic) + { + string id = dic["id"]; + await _repository.UpdateAsync(x => new EqpRepairApply() + { + status = RepairApplyStatus.REPEAL + }, x => x.id == id); + return "作废成功"; + } + + [HttpPost] + public async Task Close(Dictionary dic) + { + string id = dic["id"]; + await _repository.UpdateAsync(x => new EqpRepairApply() + { + status = RepairApplyStatus.CLOSE + }, x => x.id == id); + return "关闭成功"; + } + + [HttpPost] + public async Task Assign(Dictionary dic) + { + string id = dic["id"]; + string repairerId = dic["repairerId"]; + await _repository.UpdateAsync(x => new EqpRepairApply() + { + repairer_id = repairerId, + status = RepairApplyStatus.TOBERECEIVED, + }, x => x.id == id); + return "指派成功"; + } + + [HttpPost] + public async Task Receive(Dictionary dic) + { + string id = dic["id"]; + await _repository.UpdateAsync(x => new EqpRepairApply() + { + status = RepairApplyStatus.RECEIVED, + }, x => x.id == id); + return "接收成功"; + } + + [HttpPost] + public async Task Refuse(Dictionary dic) + { + string id = dic["id"]; + await _repository.UpdateAsync(x => new EqpRepairApply() + { + status = RepairApplyStatus.REFUSE, + }, x => x.id == id); + return "拒绝成功"; + } + + [HttpPost] + public async Task GetInfo(Dictionary dic) + { + string id = dic["id"]; + return await _repository.GetSingleAsync(x => x.id == id); + } + + [HttpPost] + public async Task Register(RepairApplyRegisterInput input) + { + string status = input.is_out_apply==1 ? RepairApplyStatus.TOBEOUTAPPLY : RepairApplyStatus.COMPLETED; + + await _repository.UpdateAsync(x => new EqpRepairApply() + { + fault_id = input.fault_id, + is_complete = input.is_complete, + complete_time = input.complete_time, + repair_take_time = input.repair_take_time, + is_halt = input.is_halt, + halt_take_time = input.halt_take_time, + repair_description = input.repair_description, + attachment = input.attachment, + is_out_apply = input.is_out_apply, + status = status, + }, x => x.id == input.id); + + return "登记成功"; + } + } +} \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr/EqpRepairDelayService.cs b/EquipMgr/Tnb.EquipMgr/EqpRepairDelayService.cs new file mode 100644 index 00000000..c405d7d9 --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr/EqpRepairDelayService.cs @@ -0,0 +1,68 @@ +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 EqpRepairDelayService : IEqpRepairDelayService, IDynamicApiController, ITransient + { + private readonly ISqlSugarRepository _repository; + private readonly IUserManager _userManager; + + public EqpRepairDelayService(ISqlSugarRepository repository, + IUserManager userManager) + { + _repository = repository; + _userManager = userManager; + } + + + /// + /// 维修延期 + /// + /// + [HttpPost] + public async Task Delay(RepairDelayInput input) + { + DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => + { + EqpRepairApply eqpRepairApply = await _repository.AsSugarClient().Queryable().SingleAsync(x => x.id == input.repair_apply_id); + EqpRepairDelay repairDelay = new EqpRepairDelay() + { + id = SnowflakeIdHelper.NextId(), + equip_id = eqpRepairApply.equip_id, + repair_apply_id = input.repair_apply_id, + delay_reason = input.delay_reason, + expected_time = input.expected_time, + repair_request_sender_id = input.repair_request_sender_id, + repair_sender_id = input.repair_request_sender_id, + create_id = _userManager.UserId, + create_time = DateTime.Now, + + }; + await _repository.InsertAsync(repairDelay); + + await _repository.AsSugarClient().Updateable() + .SetColumns(x => x.expect_complete_time == input.expected_time) + .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/EqpRepairOutApplyService.cs b/EquipMgr/Tnb.EquipMgr/EqpRepairOutApplyService.cs new file mode 100644 index 00000000..02b29e68 --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr/EqpRepairOutApplyService.cs @@ -0,0 +1,82 @@ +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 EqpRepairOutApplyService : IEqpRepairOutApplyService, IDynamicApiController, ITransient + { + private readonly ISqlSugarRepository _repository; + private readonly IUserManager _userManager; + + public EqpRepairOutApplyService(ISqlSugarRepository repository, + IUserManager userManager) + { + _repository = repository; + _userManager = userManager; + } + + public async Task OutApply(RepairOutApplyInput input) + { + + var db = _repository.AsSugarClient(); + 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, + }); + } + 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 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); + return result.IsSuccess ? "操作成功" : result.ErrorMessage; + } + } +} \ No newline at end of file