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/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..f8aca2cc
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairOutApply.cs
@@ -0,0 +1,117 @@
+using JNPF.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
diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldMaterialService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldMaterialService.cs
index 35fdc17c..5020a9ee 100644
--- a/EquipMgr/Tnb.EquipMgr/ToolMoldMaterialService.cs
+++ b/EquipMgr/Tnb.EquipMgr/ToolMoldMaterialService.cs
@@ -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;
diff --git a/common/Tnb.Common.Core/Handlers/IMHandler.cs b/common/Tnb.Common.Core/Handlers/IMHandler.cs
index 0463f5eb..06c30585 100644
--- a/common/Tnb.Common.Core/Handlers/IMHandler.cs
+++ b/common/Tnb.Common.Core/Handlers/IMHandler.cs
@@ -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 list = await GetOnlineUserList(tenantId);
+ list.RemoveAll((x) => x.connectionId == connId);
+ await SetOnlineUserList(tenantId, list);
+ }
+ await WebSocketConnectionManager.RemoveSocket(connId).ConfigureAwait(false);
+ }
+ }
+
///
/// 消息通道.
///
@@ -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().Where(x => toUserIds==x.UserId && x.DeleteMark == null).Select(x => x.ClientId).ToListAsync();
+ var clientIdList = await _sqlSugarClient.Queryable().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();
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());
diff --git a/system/Tnb.OAuth/OAuthService.cs b/system/Tnb.OAuth/OAuthService.cs
index 0be37cf7..10de81ef 100644
--- a/system/Tnb.OAuth/OAuthService.cs
+++ b/system/Tnb.OAuth/OAuthService.cs
@@ -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();
}