Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
58
EquipMgr/Tnb.EquipMgr.Entities/Consts/RepairApplyStatus.cs
Normal file
58
EquipMgr/Tnb.EquipMgr.Entities/Consts/RepairApplyStatus.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
namespace Tnb.EquipMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备维修状态
|
||||
/// </summary>
|
||||
public static class RepairApplyStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// 待执行
|
||||
/// </summary>
|
||||
public const string TOBEEXECUTED = "1";
|
||||
/// <summary>
|
||||
/// 待接收
|
||||
/// </summary>
|
||||
public const string TOBERECEIVED = "2";
|
||||
/// <summary>
|
||||
/// 已接收
|
||||
/// </summary>
|
||||
public const string RECEIVED = "3";
|
||||
/// <summary>
|
||||
/// 拒绝
|
||||
/// </summary>
|
||||
public const string REFUSE = "4";
|
||||
/// <summary>
|
||||
/// 已维修
|
||||
/// </summary>
|
||||
public const string REPAIRED = "5";
|
||||
/// <summary>
|
||||
/// 已完成
|
||||
/// </summary>
|
||||
public const string COMPLETED = "6";
|
||||
/// <summary>
|
||||
/// 外修申请待审批
|
||||
/// </summary>
|
||||
public const string OUTAPPLYAPPROVE = "7";
|
||||
/// <summary>
|
||||
/// 审批通过
|
||||
/// </summary>
|
||||
public const string APPROVEPASS = "8";
|
||||
/// <summary>
|
||||
/// 审批拒绝
|
||||
/// </summary>
|
||||
public const string APPROVENOTPASS = "9";
|
||||
/// <summary>
|
||||
/// 已关闭
|
||||
/// </summary>
|
||||
public const string CLOSE = "10";
|
||||
/// <summary>
|
||||
/// 已作废
|
||||
/// </summary>
|
||||
public const string REPEAL = "11";
|
||||
/// <summary>
|
||||
/// 申请外修
|
||||
/// </summary>
|
||||
public const string TOBEOUTAPPLY = "12";
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace Tnb.EquipMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备维修状态
|
||||
/// </summary>
|
||||
public static class RepairOutApplyStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// 待审批
|
||||
/// </summary>
|
||||
public const string TOBEAPPROVE = "1";
|
||||
/// <summary>
|
||||
/// 退回
|
||||
/// </summary>
|
||||
public const string BACK = "2";
|
||||
/// <summary>
|
||||
/// 通过
|
||||
/// </summary>
|
||||
public const string PASS = "3";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
namespace Tnb.EquipMgr.Entities.Dto
|
||||
{
|
||||
public class RepairApplyRegisterInput
|
||||
{
|
||||
public string id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 故障ID
|
||||
/// </summary>
|
||||
public string fault_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否完成
|
||||
/// </summary>
|
||||
public string? is_complete { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 完成时间
|
||||
/// </summary>
|
||||
public DateTime? complete_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 维修耗时
|
||||
/// </summary>
|
||||
public string? repair_take_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否停机
|
||||
/// </summary>
|
||||
public int? is_halt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 停机时长
|
||||
/// </summary>
|
||||
public string? halt_take_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 维修描述
|
||||
/// </summary>
|
||||
public string? repair_description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 附件
|
||||
/// </summary>
|
||||
public string? attachment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否外修
|
||||
/// </summary>
|
||||
public int? is_out_apply { get; set; }
|
||||
}
|
||||
}
|
||||
17
EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairDelayInput.cs
Normal file
17
EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairDelayInput.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
15
EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairOutApplyInput.cs
Normal file
15
EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairOutApplyInput.cs
Normal file
@@ -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; }
|
||||
|
||||
}
|
||||
}
|
||||
83
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairDelay.cs
Normal file
83
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairDelay.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.EquipMgr.Entities
|
||||
{
|
||||
///<summary>
|
||||
///设备延期
|
||||
///</summary>
|
||||
[SugarTable("eqp_repair_delay")]
|
||||
public partial class EqpRepairDelay
|
||||
{
|
||||
public EqpRepairDelay()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:主键
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public string id { get; set; } = SnowflakeIdHelper.NextId();
|
||||
|
||||
/// <summary>
|
||||
/// Desc:设备id
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public string equip_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Desc:报修id
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string? repair_apply_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:报修抄送人员id
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string? repair_request_sender_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:维修抄送人员id
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string? repair_sender_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:预期维修时间
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public DateTime expected_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:延期原因
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string delay_reason { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:创建用户
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string? create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:创建时间
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public DateTime? create_time { get; set; }
|
||||
}
|
||||
}
|
||||
117
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairOutApply.cs
Normal file
117
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairOutApply.cs
Normal file
@@ -0,0 +1,117 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.EquipMgr.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 设备外修申请表
|
||||
/// </summary>
|
||||
[SugarTable("eqp_repair_out_apply")]
|
||||
public partial class EqpRepairOutApply : BaseEntity<string>
|
||||
{
|
||||
public EqpRepairOutApply()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 设备id
|
||||
/// </summary>
|
||||
public string equip_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 报修id
|
||||
/// </summary>
|
||||
public string repair_apply_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 供应商
|
||||
/// </summary>
|
||||
public string? supplier_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 预估费用
|
||||
/// </summary>
|
||||
public decimal? estimated_cost { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 费用
|
||||
/// </summary>
|
||||
public decimal? cost { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工期要求
|
||||
/// </summary>
|
||||
public string? construction_period_requirement { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 外修理由
|
||||
/// </summary>
|
||||
public string? out_apply_reason { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 外修备注
|
||||
/// </summary>
|
||||
public string? remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 审批状态 0待审批 1 退回 2 通过
|
||||
/// </summary>
|
||||
public string? approve_status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修复时间
|
||||
/// </summary>
|
||||
public DateTime? repair_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 维修耗时
|
||||
/// </summary>
|
||||
public decimal? repair_take_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 维修备注
|
||||
/// </summary>
|
||||
public string? repair_remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登记备注
|
||||
/// </summary>
|
||||
public string? register_remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string? create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? create_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
/// </summary>
|
||||
public string? modify_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 审批人id
|
||||
/// </summary>
|
||||
public string? approve_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 审批时间
|
||||
/// </summary>
|
||||
public DateTime? approve_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属组织
|
||||
/// </summary>
|
||||
public string? org_id { get; set; }
|
||||
|
||||
}
|
||||
52
EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairApplyService.cs
Normal file
52
EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairApplyService.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
|
||||
namespace Tnb.EquipMgr.Interfaces
|
||||
{
|
||||
public interface IEqpRepairApplyService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 维修作废
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
public Task<string> Repeal(Dictionary<string,string> dic);
|
||||
|
||||
/// <summary>
|
||||
/// 维修关闭
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
public Task<string> Close(Dictionary<string,string> dic);
|
||||
|
||||
/// <summary>
|
||||
/// 维修指派
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
public Task<string> Assign(Dictionary<string,string> dic);
|
||||
|
||||
/// <summary>
|
||||
/// 维修接收
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
public Task<string> Receive(Dictionary<string,string> dic);
|
||||
|
||||
/// <summary>
|
||||
/// 维修拒绝
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
public Task<string> Refuse(Dictionary<string,string> dic);
|
||||
|
||||
/// <summary>
|
||||
/// 维修信息
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
public Task<EqpRepairApply> GetInfo(Dictionary<string,string> dic);
|
||||
|
||||
/// <summary>
|
||||
/// 维修登记
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
public Task<string> Register(RepairApplyRegisterInput input);
|
||||
|
||||
}
|
||||
}
|
||||
14
EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairDelayService.cs
Normal file
14
EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairDelayService.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
|
||||
namespace Tnb.EquipMgr.Interfaces
|
||||
{
|
||||
public interface IEqpRepairDelayService
|
||||
{
|
||||
/// <summary>
|
||||
/// 维修延期
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
public Task<string> Delay(RepairDelayInput input);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
|
||||
namespace Tnb.EquipMgr.Interfaces
|
||||
{
|
||||
public interface IEqpRepairOutApplyService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 外修申请
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
public Task<string> OutApply(RepairOutApplyInput input);
|
||||
|
||||
}
|
||||
}
|
||||
118
EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs
Normal file
118
EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备维修延期
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
public class EqpRepairApplyService : IEqpRepairApplyService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<EqpRepairApply> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
public EqpRepairApplyService(ISqlSugarRepository<EqpRepairApply> repository,
|
||||
IUserManager userManager)
|
||||
{
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<string> Repeal(Dictionary<string, string> dic)
|
||||
{
|
||||
string id = dic["id"];
|
||||
await _repository.UpdateAsync(x => new EqpRepairApply()
|
||||
{
|
||||
status = RepairApplyStatus.REPEAL
|
||||
}, x => x.id == id);
|
||||
return "作废成功";
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<string> Close(Dictionary<string, string> dic)
|
||||
{
|
||||
string id = dic["id"];
|
||||
await _repository.UpdateAsync(x => new EqpRepairApply()
|
||||
{
|
||||
status = RepairApplyStatus.CLOSE
|
||||
}, x => x.id == id);
|
||||
return "关闭成功";
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<string> Assign(Dictionary<string, string> 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<string> Receive(Dictionary<string, string> dic)
|
||||
{
|
||||
string id = dic["id"];
|
||||
await _repository.UpdateAsync(x => new EqpRepairApply()
|
||||
{
|
||||
status = RepairApplyStatus.RECEIVED,
|
||||
}, x => x.id == id);
|
||||
return "接收成功";
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<string> Refuse(Dictionary<string, string> dic)
|
||||
{
|
||||
string id = dic["id"];
|
||||
await _repository.UpdateAsync(x => new EqpRepairApply()
|
||||
{
|
||||
status = RepairApplyStatus.REFUSE,
|
||||
}, x => x.id == id);
|
||||
return "拒绝成功";
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<EqpRepairApply> GetInfo(Dictionary<string, string> dic)
|
||||
{
|
||||
string id = dic["id"];
|
||||
return await _repository.GetSingleAsync(x => x.id == id);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<string> 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 "登记成功";
|
||||
}
|
||||
}
|
||||
}
|
||||
68
EquipMgr/Tnb.EquipMgr/EqpRepairDelayService.cs
Normal file
68
EquipMgr/Tnb.EquipMgr/EqpRepairDelayService.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备维修延期
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
public class EqpRepairDelayService : IEqpRepairDelayService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<EqpRepairDelay> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
public EqpRepairDelayService(ISqlSugarRepository<EqpRepairDelay> repository,
|
||||
IUserManager userManager)
|
||||
{
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 维修延期
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
[HttpPost]
|
||||
public async Task<string> Delay(RepairDelayInput input)
|
||||
{
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
{
|
||||
EqpRepairApply eqpRepairApply = await _repository.AsSugarClient().Queryable<EqpRepairApply>().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<EqpRepairApply>()
|
||||
.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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
82
EquipMgr/Tnb.EquipMgr/EqpRepairOutApplyService.cs
Normal file
82
EquipMgr/Tnb.EquipMgr/EqpRepairOutApplyService.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备维修延期
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
public class EqpRepairOutApplyService : IEqpRepairOutApplyService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<EqpRepairOutApply> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
public EqpRepairOutApplyService(ISqlSugarRepository<EqpRepairOutApply> repository,
|
||||
IUserManager userManager)
|
||||
{
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
}
|
||||
|
||||
public async Task<string> OutApply(RepairOutApplyInput input)
|
||||
{
|
||||
|
||||
var db = _repository.AsSugarClient();
|
||||
DbResult<bool> 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<EqpRepairApply>()
|
||||
.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -165,7 +165,7 @@ namespace Tnb.EquipMgr
|
||||
id = a.id,
|
||||
mold_code = a.mold_code,
|
||||
mold_name = a.mold_name,
|
||||
cavity_qty = a.cavity_qty.HasValue ? a.cavity_qty.Value : 0,
|
||||
cavity_qty = a.mold_cavity.HasValue ? a.mold_cavity.Value : 0,
|
||||
real_cavity_qty = b.real_cavity_qty.HasValue ? b.real_cavity_qty.Value : 0
|
||||
}).ToListAsync();
|
||||
return list;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Net.WebSockets;
|
||||
using System.Net.Sockets;
|
||||
using System.Net.WebSockets;
|
||||
using Aop.Api.Domain;
|
||||
using JNPF.Common.Configuration;
|
||||
using JNPF.Common.Const;
|
||||
using JNPF.Common.Enums;
|
||||
@@ -86,6 +88,23 @@ public class IMHandler : WebSocketHandler
|
||||
}
|
||||
}
|
||||
|
||||
public override async Task OnDisconnected(WebSocket socket)
|
||||
{
|
||||
var connId = WebSocketConnectionManager.GetId(socket);
|
||||
if (!string.IsNullOrWhiteSpace(connId))
|
||||
{
|
||||
var wsClient = WebSocketConnectionManager.GetSocketById(connId);
|
||||
if (wsClient != null)
|
||||
{
|
||||
string tenantId = wsClient.ConnectionConfig.ConfigId;
|
||||
List<UserOnlineModel> list = await GetOnlineUserList(tenantId);
|
||||
list.RemoveAll((x) => x.connectionId == connId);
|
||||
await SetOnlineUserList(tenantId, list);
|
||||
}
|
||||
await WebSocketConnectionManager.RemoveSocket(connId).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 消息通道.
|
||||
/// </summary>
|
||||
@@ -214,6 +233,10 @@ public class IMHandler : WebSocketHandler
|
||||
token = message.token
|
||||
});
|
||||
await SetOnlineUserList(client.ConnectionConfig.ConfigId, list);
|
||||
|
||||
//var allUsers = WebSocketConnectionManager.GetAllFromTenant(client.ConnectionConfig.ConfigId);
|
||||
//list.RemoveAll(a=>!allUsers.Contains(a.connectionId));
|
||||
//await SetOnlineUserList(client.ConnectionConfig.ConfigId, list);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -432,13 +455,13 @@ public class IMHandler : WebSocketHandler
|
||||
var getuiUrl = "{0}?clientId={1}&title={2}&content={3}1&text={4}&create=true";
|
||||
if (toUserIds.Any())
|
||||
{
|
||||
var clientIdList = await _sqlSugarClient.Queryable<UserDeviceEntity>().Where(x => toUserIds==x.UserId && x.DeleteMark == null).Select(x => x.ClientId).ToListAsync();
|
||||
var clientIdList = await _sqlSugarClient.Queryable<UserDeviceEntity>().Where(x => toUserIds == x.UserId && x.DeleteMark == null).Select(x => x.ClientId).ToListAsync();
|
||||
if (clientIdList.Any())
|
||||
{
|
||||
var clientId = string.Join(",", clientIdList);
|
||||
var textDic = new Dictionary<string, string>();
|
||||
textDic.Add("type", "3");
|
||||
textDic.Add("name", client.UserName+"/"+ client.Account);
|
||||
textDic.Add("name", client.UserName + "/" + client.Account);
|
||||
textDic.Add("formUserId", client.UserId);
|
||||
textDic.Add("headIcon", "/api/File/Image/userAvatar/" + client.HeadIcon);
|
||||
getuiUrl = string.Format(getuiUrl, _messageOptions.AppPushUrl, clientId, client.UserName + "/" + client.Account, "您有一条新消息", textDic.ToJsonString());
|
||||
|
||||
@@ -362,17 +362,17 @@ public class OAuthService : IDynamicApiController, ITransient
|
||||
var httpContext = _httpContextAccessor.HttpContext;
|
||||
httpContext.SignoutToSwagger();
|
||||
|
||||
// 清除IM中的webSocket
|
||||
var list = await GetOnlineUserList();
|
||||
if (list != null)
|
||||
{
|
||||
var onlineUser = list.Find(it => it.tenantId == _userManager.TenantId && it.userId == _userManager.UserId);
|
||||
if (onlineUser != null)
|
||||
{
|
||||
list.RemoveAll((x) => x.connectionId == onlineUser.connectionId);
|
||||
await SetOnlineUserList(list);
|
||||
}
|
||||
}
|
||||
// 清除IM中的webSocket, modified by PhilPan 改为在IMHandle中处理
|
||||
//var list = await GetOnlineUserList();
|
||||
//if (list != null)
|
||||
//{
|
||||
// var onlineUser = list.Find(it => it.tenantId == _userManager.TenantId && it.userId == _userManager.UserId);
|
||||
// if (onlineUser != null)
|
||||
// {
|
||||
// list.RemoveAll((x) => x.connectionId == onlineUser.connectionId);
|
||||
// await SetOnlineUserList(list);
|
||||
// }
|
||||
//}
|
||||
|
||||
await DelUserInfo();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user