重写设备列表接口

This commit is contained in:
2023-11-17 10:35:51 +08:00
parent 9915cbd4f9
commit 48f390cdb7
4 changed files with 316 additions and 4 deletions

View File

@@ -280,6 +280,10 @@ public static class DictConst
/// 设备保养类型
/// </summary>
public const string EqpMaintainType = "EqpMaintainType";
/// <summary>
/// 设备生命周期
/// </summary>
public const string EquipmentLife = "EquipmentLife";
#endregion
}

View File

@@ -0,0 +1,230 @@
using JNPF.Common.Contracts;
using JNPF.Common.Security;
using SqlSugar;
namespace Tnb.EquipMgr.Entities;
public partial class EquipListOuput
{
public string id { get; set; }
/// <summary>
/// 所属组织
/// </summary>
public string? org_id { get; set; }
/// <summary>
/// 设备代码
/// </summary>
public string code { get; set; } = string.Empty;
/// <summary>
/// 设备名称
/// </summary>
public string name { get; set; } = string.Empty;
/// <summary>
/// 设备类型id
/// </summary>
public string equip_type_id { get; set; } = string.Empty;
/// <summary>
/// 设备类型id
/// </summary>
public string equip_type_id_id { get; set; } = string.Empty;
/// <summary>
/// 设备生产日期
/// </summary>
public string? product_date { get; set; }
/// <summary>
/// 设备生产厂家
/// </summary>
public string? manufacturer { get; set; }
/// <summary>
/// 使用部门id
/// </summary>
public string? use_department_id { get; set; }
public string? use_department_id_id { get; set; }
/// <summary>
/// 安装日期
/// </summary>
public string install_date { get; set; } = string.Empty;
/// <summary>
/// 使用日期
/// </summary>
public DateTime? use_date { get; set; }
/// <summary>
/// 验收日期
/// </summary>
public DateTime? accept_date { get; set; }
/// <summary>
/// 管理部门id
/// </summary>
public string? manage_department_id { get; set; }
public string? manage_department_id_id { get; set; }
/// <summary>
/// 设备生命周期
/// </summary>
public string? life { get; set; }
/// <summary>
/// 技改编码
/// </summary>
public string? techno_logy_code { get; set; }
/// <summary>
/// 备注
/// </summary>
public string remark { get; set; } = string.Empty;
/// <summary>
/// 时间戳
/// </summary>
public string? timestamp { get; set; }
/// <summary>
/// 创建用户
/// </summary>
public string? create_id { get; set; }
public string? create_id_id { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime? create_time { get; set; }
/// <summary>
/// 修改用户
/// </summary>
public string? modify_id { get; set; }
public string? modify_id_id { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public DateTime? modify_time { get; set; }
/// <summary>
/// 扩展字段
/// </summary>
public string? extras { get; set; }
/// <summary>
/// 供应商id
/// </summary>
public string? supplier_id { get; set; }
public string? supplier_id_id { get; set; }
/// <summary>
/// 出厂编码
/// </summary>
public string? factory_code { get; set; }
/// <summary>
/// 合同/采购单号
/// </summary>
public string? contract_no { get; set; }
/// <summary>
/// 维保单位
/// </summary>
public string? maintenance_unit { get; set; }
/// <summary>
/// 维保电话
/// </summary>
public string? maintenance_phone { get; set; }
/// <summary>
/// 规格型号
/// </summary>
public string? specification { get; set; }
/// <summary>
/// 安装地点
/// </summary>
public string? installation_location { get; set; }
/// <summary>
/// 是否成套设备
/// </summary>
public string is_complete_set { get; set; } = string.Empty;
/// <summary>
/// DCS-ID
/// </summary>
public string? dcs_id { get; set; }
/// <summary>
/// 技术参数
/// </summary>
public string? technology_parameter { get; set; }
/// <summary>
/// 状态
/// </summary>
public string? status { get; set; }
/// <summary>
/// 吨位
/// </summary>
public decimal? tonnage { get; set; }
/// <summary>
/// 设备机台号
/// </summary>
public string? eqp_machine_num { get; set; }
/// <summary>
/// 模具Id
/// </summary>
public string? mold_id { get; set; }
/// <summary>
/// 工位编码
/// </summary>
public string? station_code { get; set; }
/// <summary>
/// 质保开始时间
/// </summary>
public DateTime? warranty_start_time { get; set; }
/// <summary>
/// 质保结束时间
/// </summary>
public DateTime? warranty_end_time { get; set; }
/// <summary>
/// 责任人
/// </summary>
public string? responsibler_id { get; set; }
public string? responsibler_id_id { get; set; }
/// <summary>
/// 二维码
/// </summary>
public string? qrcode { get; set; }
/// <summary>
/// 入库库位id
/// </summary>
public string? as_location_id { get; set; }
public string? as_location_id_id { get; set; }
}

View File

@@ -213,9 +213,5 @@ public partial class EqpEquipment : BaseEntity<string>
/// </summary>
public string? as_location_id { get; set; }
/// <summary>
/// 第三方平台设备编号
/// </summary>
public string? third_equip_code { get; set; }
}

View File

@@ -6,6 +6,7 @@ using JNPF.DynamicApiController;
using JNPF.Extras.CollectiveOAuth.Models;
using JNPF.FriendlyException;
using JNPF.Systems.Entitys.Permission;
using JNPF.Systems.Entitys.System;
using JNPF.VisualDev;
using JNPF.VisualDev.Entitys;
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
@@ -50,7 +51,88 @@ namespace Tnb.EquipMgr
_userManager = userManager;
OverideFuncs.CreateAsync = Create;
OverideFuncs.UpdateAsync = Update;
OverideFuncs.GetListAsync = PageList;
}
private async Task<object> PageList(VisualDevModelListQueryInput input)
{
Dictionary<string, string>? queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson) : new Dictionary<string, string>();
string equip_type_id = queryJson.ContainsKey("equip_type_id") ? queryJson["equip_type_id"].ToString() : "";
string code = queryJson.ContainsKey("code") ? queryJson["code"].ToString() : "";
string name = queryJson.ContainsKey("name") ? queryJson["name"].ToString() : "";
string contract_no = queryJson.ContainsKey("contract_no") ? queryJson["contract_no"].ToString() : "";
var result = await _repository.AsSugarClient().Queryable<EqpEquipment, OrganizeEntity,OrganizeEntity,UserEntity,UserEntity,BasSupplier,UserEntity,BasLocation,DictionaryTypeEntity,DictionaryDataEntity>((a, b,c,d,e,f,g,h,i,j) =>
new JoinQueryInfos(
JoinType.Left, a.use_department_id == b.Id,
JoinType.Left, a.manage_department_id == c.Id,
JoinType.Left, a.create_id == d.Id,
JoinType.Left, a.modify_id == e.Id,
JoinType.Left, a.supplier_id == f.id,
JoinType.Left, a.responsibler_id == g.Id,
JoinType.Left, a.as_location_id == h.id,
JoinType.Left, i.EnCode==DictConst.EquipmentLife,
JoinType.Left, i.Id==j.DictionaryTypeId && a.life==j.EnCode
))
.WhereIF(!string.IsNullOrEmpty(equip_type_id),a=>a.equip_type_id==equip_type_id)
.WhereIF(!string.IsNullOrEmpty(code),a=>a.code.Contains(code))
.WhereIF(!string.IsNullOrEmpty(name),a=>a.name.Contains(name))
.WhereIF(!string.IsNullOrEmpty(contract_no),a=>a.contract_no.Contains(contract_no))
.Select((a, b,c,d,e,f,g,h,i,j) => new EquipListOuput()
{
id = a.id,
org_id = a.org_id,
code = a.code ,
name = a.name ,
equip_type_id = a.equip_type_id ,
product_date = a.product_date,
manufacturer = a.manufacturer,
use_department_id = b.FullName,
use_department_id_id = a.use_department_id,
install_date = a.install_date ,
use_date = a.use_date,
accept_date = a.accept_date,
manage_department_id = c.FullName,
manage_department_id_id = a.manage_department_id,
life = j.FullName,
techno_logy_code = a.techno_logy_code,
remark = a.remark ,
timestamp = a.timestamp,
create_id = d.RealName,
create_id_id = a.create_id,
create_time = a.create_time,
modify_id = e.RealName,
modify_id_id = a.modify_id,
modify_time = a.modify_time,
extras = a.extras,
supplier_id = f.supplier_name,
supplier_id_id = a.supplier_id,
factory_code = a.factory_code,
contract_no = a.contract_no,
maintenance_unit = a.maintenance_unit,
maintenance_phone = a.maintenance_phone,
specification = a.specification,
installation_location = a.installation_location,
is_complete_set = a.is_complete_set=="1" ? "是" : "否",
dcs_id = a.dcs_id,
technology_parameter = a.technology_parameter,
status = a.status,
tonnage = a.tonnage,
eqp_machine_num = a.eqp_machine_num,
mold_id = a.mold_id,
station_code = a.station_code,
warranty_start_time = a.warranty_start_time,
warranty_end_time = a.warranty_end_time,
responsibler_id = g.RealName,
responsibler_id_id = a.responsibler_id,
qrcode = a.qrcode,
as_location_id = h.location_name,
as_location_id_id = a.as_location_id,
}).ToPagedListAsync(input.currentPage,input.pageSize);
return PageResult<EquipListOuput>.SqlSugarPageResult(result);
}
/// <summary>
/// 在线开发-获取设备列表
/// </summary>