pda设备维修
This commit is contained in:
@@ -183,6 +183,11 @@ public static class DictConst
|
|||||||
/// 模具维修TypeId
|
/// 模具维修TypeId
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string WXTypeId = "26149320818965";
|
public const string WXTypeId = "26149320818965";
|
||||||
|
/// <summary>
|
||||||
|
/// 设备维修状态
|
||||||
|
/// </summary>
|
||||||
|
public const string RepairStatus = "RepairStatus";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
namespace Tnb.EquipMgr.Entities.Dto
|
||||||
|
{
|
||||||
|
public class PdaRepairApplyListOutput
|
||||||
|
{
|
||||||
|
public string id { get; set; }
|
||||||
|
public string code { get; set; }
|
||||||
|
public string name { get; set; }
|
||||||
|
public string equip_id { get; set; }
|
||||||
|
public string equip_id_id { get; set; }
|
||||||
|
public string? expect_complete_time { get; set; }
|
||||||
|
public string? is_ugent { get; set; }
|
||||||
|
public string description { get; set; }
|
||||||
|
public string status { get; set; }
|
||||||
|
public string repairer_id { get; set; }
|
||||||
|
public string? repairer_id_id { get; set; }
|
||||||
|
|
||||||
|
public string apply_user_id { get; set; }
|
||||||
|
public string apply_user_id_id { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
119
EquipMgr/Tnb.EquipMgr/App/AppEqpRepairApplyService.cs
Normal file
119
EquipMgr/Tnb.EquipMgr/App/AppEqpRepairApplyService.cs
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
using JNPF.Common.Core.Manager;
|
||||||
|
using JNPF.Common.Enums;
|
||||||
|
using JNPF.Common.Filter;
|
||||||
|
using JNPF.Common.Security;
|
||||||
|
using JNPF.DependencyInjection;
|
||||||
|
using JNPF.DynamicApiController;
|
||||||
|
using JNPF.FriendlyException;
|
||||||
|
using JNPF.Systems.Entitys.Permission;
|
||||||
|
using JNPF.Systems.Entitys.System;
|
||||||
|
using JNPF.VisualDev;
|
||||||
|
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||||
|
using JNPF.VisualDev.Interfaces;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using SqlSugar;
|
||||||
|
using Tnb.BasicData;
|
||||||
|
using Tnb.EquipMgr.Entities;
|
||||||
|
using Tnb.EquipMgr.Entities.Dto;
|
||||||
|
using Tnb.EquipMgr.Interfaces;
|
||||||
|
|
||||||
|
namespace Tnb.EquipMgr
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// app设备维修登记
|
||||||
|
/// </summary>
|
||||||
|
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
||||||
|
[Route("api/[area]/[controller]/[action]")]
|
||||||
|
[OverideVisualDev(ModuleId)]
|
||||||
|
public class AppEqpRepairApplyService : IOverideVisualDevService,IDynamicApiController, ITransient
|
||||||
|
{
|
||||||
|
private const string ModuleId = "28621611210261";
|
||||||
|
private readonly ISqlSugarRepository<EqpRepairApply> _repository;
|
||||||
|
private readonly IUserManager _userManager;
|
||||||
|
private readonly IRunService _runService;
|
||||||
|
private readonly IVisualDevService _visualDevService;
|
||||||
|
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||||
|
|
||||||
|
public AppEqpRepairApplyService(ISqlSugarRepository<EqpRepairApply> repository,
|
||||||
|
IRunService runService,
|
||||||
|
IVisualDevService visualDevService,
|
||||||
|
IUserManager userManager)
|
||||||
|
{
|
||||||
|
_repository = repository;
|
||||||
|
_userManager = userManager;
|
||||||
|
_runService = runService;
|
||||||
|
_visualDevService = visualDevService;
|
||||||
|
OverideFuncs.GetListAsync = GetList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||||
|
{
|
||||||
|
var db = _repository.AsSugarClient();
|
||||||
|
Dictionary<string, object> queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject<Dictionary<string, object>>(input.queryJson) : new Dictionary<string, object>();
|
||||||
|
string code = queryJson!=null && queryJson.ContainsKey("code") ? queryJson["code"].ToString() : "";
|
||||||
|
string name = queryJson!=null && queryJson.ContainsKey("name") ? queryJson["name"].ToString() : "";
|
||||||
|
string userId = _userManager.UserId;
|
||||||
|
var result = await db.Queryable<EqpRepairApply>()
|
||||||
|
.LeftJoin<EqpEquipment>((a, b) => a.equip_id == b.id)
|
||||||
|
.LeftJoin<UserEntity>((a, b, c) => a.apply_user_id == c.Id)
|
||||||
|
.LeftJoin<DictionaryTypeEntity>((a,b,c,d)=>d.EnCode==DictConst.RepairStatus)
|
||||||
|
.LeftJoin<DictionaryDataEntity>((a,b,c,d,e)=>a.status==e.EnCode && d.Id==e.DictionaryTypeId)
|
||||||
|
.WhereIF(!string.IsNullOrEmpty("code"), (a, b, c) => a.code.Contains(code))
|
||||||
|
.WhereIF(!string.IsNullOrEmpty("name"), (a, b, c) => a.name.Contains(name))
|
||||||
|
.Where((a, b, c) => a.repairer_id == userId)
|
||||||
|
.Where((a, b, c) => a.status == "2" || a.status=="3")
|
||||||
|
.Select((a, b, c,d,e) => new PdaRepairApplyListOutput
|
||||||
|
{
|
||||||
|
id = a.id,
|
||||||
|
code = a.code,
|
||||||
|
name = a.name,
|
||||||
|
equip_id = b.code+"/"+b.name,
|
||||||
|
equip_id_id = a.equip_id,
|
||||||
|
expect_complete_time = a.expect_complete_time==null ? "" : a.expect_complete_time.Value.ToString("yyyy-MM-dd"),
|
||||||
|
is_ugent = a.is_ugent==null ? "" : a.is_ugent==0 ? "否" : "是",
|
||||||
|
description = a.description,
|
||||||
|
status = e.FullName,
|
||||||
|
apply_user_id = SqlFunc.IsNull(c.RealName,"异常停机"),
|
||||||
|
apply_user_id_id = a.create_id,
|
||||||
|
// repairer_id = c.RealName,
|
||||||
|
// repairer_id_id = a.repairer_id,
|
||||||
|
}).ToPagedListAsync(input.currentPage,input.pageSize);
|
||||||
|
|
||||||
|
return PageResult<PdaRepairApplyListOutput>.SqlSugarPageResult(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据id获取维修相关信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dic"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<dynamic> GetRepairInfoById(Dictionary<string,string> dic)
|
||||||
|
{
|
||||||
|
string id = dic.ContainsKey("id") ? dic["id"] : "";
|
||||||
|
if (string.IsNullOrEmpty(id)) return null;
|
||||||
|
var db = _repository.AsSugarClient();
|
||||||
|
return await db.Queryable<EqpRepairApply>()
|
||||||
|
.LeftJoin<EqpEquipment>((a, b) => a.equip_id == b.id)
|
||||||
|
.Where((a, b) => a.id == id)
|
||||||
|
.Select((a, b) => new
|
||||||
|
{
|
||||||
|
id = a.id,
|
||||||
|
a.code,
|
||||||
|
a.name,
|
||||||
|
equip_id = a.equip_id,
|
||||||
|
equip_code = b.code,
|
||||||
|
equip_name = b.name,
|
||||||
|
expect_complete_time = a.expect_complete_time==null?"":a.expect_complete_time.Value.ToString("yyyy-MM-dd"),
|
||||||
|
is_ugent = a.is_ugent,
|
||||||
|
description = a.description,
|
||||||
|
status = a.status,
|
||||||
|
repairer_id = a.repairer_id,
|
||||||
|
}).FirstAsync();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,7 +16,7 @@ using Tnb.EquipMgr.Interfaces;
|
|||||||
namespace Tnb.EquipMgr
|
namespace Tnb.EquipMgr
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设备维修延期
|
/// 设备维修登记
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
||||||
[Route("api/[area]/[controller]/[action]")]
|
[Route("api/[area]/[controller]/[action]")]
|
||||||
|
|||||||
Reference in New Issue
Block a user