Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -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<Dictionary<string,string>> details { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Tnb.EquipMgr.Entities.Dto
|
||||
{
|
||||
public class MaintainRecordRepeatOutput
|
||||
{
|
||||
public EqpMaintainRecordH model { get; set; }
|
||||
|
||||
public List<EqpMaintainRecordD> details { get; set; }
|
||||
}
|
||||
}
|
||||
82
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpEquipScrap.cs
Normal file
82
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpEquipScrap.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.EquipMgr.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 设备报废表
|
||||
/// </summary>
|
||||
[SugarTable("eqp_equip_scrap")]
|
||||
public partial class EqpEquipScrap : BaseEntity<string>
|
||||
{
|
||||
public EqpEquipScrap()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
public string code { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 报废时间
|
||||
/// </summary>
|
||||
public DateTime scrap_time { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 设备id
|
||||
/// </summary>
|
||||
public string equip_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 负责人id
|
||||
/// </summary>
|
||||
public string charger_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 负责人姓名
|
||||
/// </summary>
|
||||
public string charger_name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 负责人电话
|
||||
/// </summary>
|
||||
public string? charger_phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string? create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? create_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
/// </summary>
|
||||
public string? modify_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属组织
|
||||
/// </summary>
|
||||
public string? org_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 附件
|
||||
/// </summary>
|
||||
public string? attachment { get; set; }
|
||||
|
||||
}
|
||||
13
EquipMgr/Tnb.EquipMgr.Interfaces/IEqpEquipScrapService.cs
Normal file
13
EquipMgr/Tnb.EquipMgr.Interfaces/IEqpEquipScrapService.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Tnb.EquipMgr.Entities;
|
||||
|
||||
namespace Tnb.EquipMgr.Interfaces
|
||||
{
|
||||
public interface IEqpEquipScrapService
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备报废
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<string> Scrap(EqpEquipScrap eqpEquipScrap);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
|
||||
namespace Tnb.EquipMgr.Interfaces
|
||||
{
|
||||
public interface IEqpMaintainRecordService
|
||||
{
|
||||
/// <summary>
|
||||
/// 执行设备保养计划
|
||||
/// </summary>
|
||||
/// <param name="pageInput"></param>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> ExecuteMaintain(SpotInsRecordExecuteInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备保养计划复核信息
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
/// <returns></returns>
|
||||
public Task<MaintainRecordRepeatOutput> GetMaintainRecordRepeatInfo(Dictionary<string, string> dic);
|
||||
|
||||
/// <summary>
|
||||
/// 复核备保养计划
|
||||
/// </summary>
|
||||
/// <param name="pageInput"></param>
|
||||
/// <returns></returns>
|
||||
public Task<string> RepeatMaintain(MaintainRecordRepeatInput input);
|
||||
|
||||
}
|
||||
}
|
||||
58
EquipMgr/Tnb.EquipMgr/EqpEquipScrapService.cs
Normal file
58
EquipMgr/Tnb.EquipMgr/EqpEquipScrapService.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备保养计划执行管理
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
public class EqpEquipScrapService : IEqpEquipScrapService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<EqpEquipScrap> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
public EqpEquipScrapService(ISqlSugarRepository<EqpEquipScrap> repository,
|
||||
IUserManager userManager)
|
||||
{
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
// OverideFuncs.UpdateAsync = ExecuteSpotIns;
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
public async Task<string> Scrap(EqpEquipScrap eqpEquipScrap)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
eqpEquipScrap.create_id = _userManager.UserId;
|
||||
eqpEquipScrap.create_time = DateTime.Now;
|
||||
|
||||
await _repository.InsertAsync(eqpEquipScrap);
|
||||
|
||||
await db.Updateable<EqpEquipment>().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;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
146
EquipMgr/Tnb.EquipMgr/EquMaintainRecordService.cs
Normal file
146
EquipMgr/Tnb.EquipMgr/EquMaintainRecordService.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备保养计划执行管理
|
||||
/// </summary>
|
||||
[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<EqpMaintainRecordH> _repository;
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
private readonly IRunService _runService;
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
public EqpMaintainRecordService(ISqlSugarRepository<EqpMaintainRecordH> repository,
|
||||
IRunService runService,
|
||||
IUserManager userManager,
|
||||
IVisualDevService visualDevService)
|
||||
{
|
||||
_repository = repository;
|
||||
_visualDevService = visualDevService;
|
||||
_runService = runService;
|
||||
_userManager = userManager;
|
||||
// OverideFuncs.UpdateAsync = ExecuteSpotIns;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行设备保养计划
|
||||
/// </summary>
|
||||
/// <param name="pageInput"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> ExecuteMaintain(SpotInsRecordExecuteInput input)
|
||||
{
|
||||
DbResult<bool> 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<EqpMaintainRecordD>()
|
||||
.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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备保养计划复核信息
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<MaintainRecordRepeatOutput> GetMaintainRecordRepeatInfo(Dictionary<string, string> dic)
|
||||
{
|
||||
string id = dic["id"];
|
||||
EqpMaintainRecordH eqpSpotInsRecordH = await _repository.GetSingleAsync(x => x.id == id);
|
||||
List<EqpMaintainRecordD> eqpSpotInsRecordDs = await _repository.AsSugarClient().Queryable<EqpMaintainRecordD>()
|
||||
.Where(x => x.maintain_record_id == id).ToListAsync();
|
||||
MaintainRecordRepeatOutput output = new MaintainRecordRepeatOutput()
|
||||
{
|
||||
model = eqpSpotInsRecordH,
|
||||
details = eqpSpotInsRecordDs,
|
||||
};
|
||||
return output;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 复核设备保养计划
|
||||
/// </summary>
|
||||
/// <param name="pageInput"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<string> RepeatMaintain(MaintainRecordRepeatInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
|
||||
foreach (var item in input.details)
|
||||
{
|
||||
await db.Updateable<EqpMaintainRecordD>()
|
||||
.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ namespace JNPF.TaskScheduler.Listener
|
||||
|
||||
foreach (var item in eqpSpotInsTemEquipHsByOne)
|
||||
{
|
||||
if (item.start_time.AddHours((double)item.plan_cycle).ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd"))
|
||||
if (item.start_time.AddDays((double)item.plan_cycle).ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd"))
|
||||
{
|
||||
tobeCreateTemplets.Add(item);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user