Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -280,6 +280,10 @@ public static class DictConst
|
||||
/// 设备保养类型
|
||||
/// </summary>
|
||||
public const string EqpMaintainType = "EqpMaintainType";
|
||||
/// <summary>
|
||||
/// 设备生命周期
|
||||
/// </summary>
|
||||
public const string EquipmentLife = "EquipmentLife";
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using Aop.Api.Domain;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Filter;
|
||||
@@ -167,15 +168,21 @@ namespace Tnb.BasicData
|
||||
public async Task<dynamic> GetMaterialByType(Dictionary<string, string> dic)
|
||||
{
|
||||
string types = dic["types"];
|
||||
int currentPage = int.Parse(dic["currentPage"].ToString());
|
||||
int pagesize = int.Parse(dic["pageSize"].ToString());
|
||||
string queryJson = dic["queryJson"];
|
||||
string[] typeArr = types.Split(",");
|
||||
List<BasMaterial> list = await _repository.AsSugarClient().Queryable<BasMaterial>().Where(x => x.state == "1").ToListAsync();
|
||||
List<BasMaterial> result = new();
|
||||
List<string> ids = new();
|
||||
foreach (string type in typeArr)
|
||||
{
|
||||
result.AddRange(list.Where(x => x.category_id.Contains(type)));
|
||||
ids.AddRange(list.Where(x => x.category_id.Contains(type)).Select(p => p.id));
|
||||
}
|
||||
|
||||
return result;
|
||||
SqlSugarPagedList<BasMaterial> result = await _repository.AsSugarClient().Queryable<BasMaterial>()
|
||||
.WhereIF(ids.Count > 0, a => ids.Contains(a.id))
|
||||
.WhereIF(!string.IsNullOrEmpty(queryJson), a => a.name.Contains(queryJson) || a.code.Contains(queryJson))
|
||||
.Select(a => a).ToPagedListAsync(currentPage, pagesize);
|
||||
return PageResult<BasMaterial>.SqlSugarPageResult(result);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
|
||||
230
EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipListOuput.cs
Normal file
230
EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipListOuput.cs
Normal 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; }
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.EquipMgr.Entities
|
||||
{
|
||||
public class ToolMoldReturnListOutput
|
||||
{
|
||||
public string? id { get; set; }
|
||||
public string? code { get; set; }
|
||||
public string? mold_id { get; set; }
|
||||
public string? return_id { get; set; }
|
||||
public string? location_id { get; set; }
|
||||
public string? location_id_id { get; set; }
|
||||
public string? return_time { get; set; }
|
||||
public string? remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.DependencyInjection;
|
||||
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;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Org.BouncyCastle.Crypto;
|
||||
using Spire.Doc.Documents;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.BasicData.Entities;
|
||||
@@ -47,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>
|
||||
@@ -161,8 +246,14 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
string typeIds = dic["typeIds"];
|
||||
string[] typeIdArr = typeIds.Split(",");
|
||||
return await _repository.AsSugarClient().Queryable<EqpEquipment>().Where(x => typeIdArr.Contains(x.equip_type_id))
|
||||
.ToListAsync();
|
||||
int currentPage = int.Parse(dic["currentPage"].ToString());
|
||||
int pagesize = int.Parse(dic["pageSize"].ToString());
|
||||
string queryJson = dic["queryJson"];
|
||||
SqlSugarPagedList<EqpEquipment> result = await _repository.AsSugarClient().Queryable<EqpEquipment>()
|
||||
.WhereIF(typeIdArr.Length > 0, a => typeIdArr.Contains(a.equip_type_id))
|
||||
.WhereIF(!string.IsNullOrEmpty(queryJson), a => a.name.Contains(queryJson) || a.code.Contains(queryJson))
|
||||
.Select(a => a).ToPagedListAsync(currentPage, pagesize);
|
||||
return PageResult<EqpEquipment>.SqlSugarPageResult(result);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
|
||||
@@ -16,6 +16,7 @@ using JNPF.VisualDev.Interfaces;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using SqlSugar;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
@@ -61,7 +62,7 @@ namespace Tnb.EquipMgr
|
||||
private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||
{
|
||||
Dictionary<string, object>? queryJson = new();
|
||||
string? requisitionCode = "";
|
||||
string? code = "";
|
||||
DateTime[]? requisitionTimeArr = null;
|
||||
DateTime[]? estimatedReturnArr = null;
|
||||
if (input != null && !string.IsNullOrEmpty(input.queryJson))
|
||||
@@ -69,9 +70,9 @@ namespace Tnb.EquipMgr
|
||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, object>>(input?.queryJson ?? "");
|
||||
}
|
||||
|
||||
if (queryJson!.TryGetValue("requisition_code", out object? value))
|
||||
if (queryJson!.TryGetValue("code", out object? value))
|
||||
{
|
||||
requisitionCode = value.ToString();
|
||||
code = value.ToString();
|
||||
}
|
||||
if (queryJson!.TryGetValue("requisition_time", out object? value1))
|
||||
{
|
||||
@@ -87,7 +88,7 @@ namespace Tnb.EquipMgr
|
||||
.LeftJoin<EqpEquipment>((a, b, c) => a.equip_id == c.id)
|
||||
.LeftJoin<UserEntity>((a, b, c, d) => a.recipient_id == d.Id)
|
||||
.LeftJoin<ToolMolds>((a, b, c, d, e) => a.mold_id == e.id)
|
||||
.WhereIF(!string.IsNullOrEmpty(requisitionCode), (a, b, c, d) => a.code.Contains(requisitionCode))
|
||||
.WhereIF(!string.IsNullOrEmpty(code), (a, b, c, d) => a.code.Contains(code))
|
||||
.WhereIF(requisitionTimeArr != null, (a, b, c, d) => a.requisition_time >= requisitionTimeArr[0] && a.requisition_time <= requisitionTimeArr[1])
|
||||
.WhereIF(estimatedReturnArr != null, (a, b, c, d) => a.estimated_return_time >= estimatedReturnArr[0] && a.estimated_return_time <= estimatedReturnArr[1])
|
||||
.Select((a, b, c, d, e) => new ToolMoldRequisitionListOutput
|
||||
|
||||
@@ -1,16 +1,24 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
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.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using NPOI.Util;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
@@ -45,6 +53,47 @@ namespace Tnb.EquipMgr
|
||||
OverideFuncs.CreateAsync = Create;
|
||||
_billRuleService= billRullService;
|
||||
_userManager = userManager;
|
||||
OverideFuncs.GetListAsync = GetList;
|
||||
}
|
||||
private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||
{
|
||||
Dictionary<string, object>? queryJson = new();
|
||||
string? code = "";
|
||||
DateTime[]? returntime = null;
|
||||
if (input != null && !string.IsNullOrEmpty(input.queryJson))
|
||||
{
|
||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, object>>(input?.queryJson ?? "");
|
||||
}
|
||||
|
||||
if (queryJson!.TryGetValue("code", out object? value))
|
||||
{
|
||||
code = value.ToString();
|
||||
}
|
||||
if (queryJson!.TryGetValue("return_time", out object? value1))
|
||||
{
|
||||
returntime = value1.ToObject<long[]>().Select(x => DateTimeOffset.FromUnixTimeSeconds(x / 1000).ToLocalTime().DateTime).ToArray();
|
||||
}
|
||||
|
||||
|
||||
SqlSugarPagedList<ToolMoldReturnListOutput> result = await _db.Queryable<ToolMoldReturn>()
|
||||
.LeftJoin<ToolLocation> ((a, b) => a.location_id == b.id)
|
||||
.LeftJoin<UserEntity>((a, b, c) => a.return_id == c.Id)
|
||||
.LeftJoin<ToolMolds>((a, b, c, d) => a.mold_id == d.id)
|
||||
.WhereIF(!string.IsNullOrEmpty(code), (a, b, c, d) => a.code.Contains(code))
|
||||
.WhereIF(returntime != null, (a, b, c, d) => a.return_time >= returntime[0] && a.return_time <= returntime[1])
|
||||
.Select((a, b, c, d) => new ToolMoldReturnListOutput
|
||||
{
|
||||
id = a.id,
|
||||
code = a.code,
|
||||
mold_id = d.mold_code,
|
||||
return_id = c.RealName,
|
||||
location_id = b.location_code,
|
||||
location_id_id = a.location_id,
|
||||
return_time = a.return_time == null ? "" : a.return_time.Value.ToString("yyyy-MM-dd"),
|
||||
remark = a.remark
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
return PageResult<ToolMoldReturnListOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
private DateTime GetDateTime(long value)
|
||||
{
|
||||
|
||||
@@ -200,4 +200,9 @@ public class ModuleConsts
|
||||
/// </summary>
|
||||
public const string MODULE_BASREGIONMAT_ID = "26187428200229";
|
||||
|
||||
/// <summary>
|
||||
/// 模块标识-盘点签收配置
|
||||
/// </summary>
|
||||
public const string MODULE_WMSCHECKSIGNCONFIG_ID = "30059737083669";
|
||||
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto
|
||||
/// <summary>
|
||||
/// 进出库策略状态修改输入参数s
|
||||
/// </summary>
|
||||
public class ModifyPoliciesStatusInput
|
||||
public class ModifyEnabledInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 1、入库 2我、出库
|
||||
@@ -4,6 +4,7 @@ using System.DirectoryServices.Protocols;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Tnb.WarehouseMgr.Entities.Enums;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Dto.Queries
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
public interface IInOutStockCode
|
||||
{
|
||||
string bill_d_id { get; set; }
|
||||
|
||||
//string line_status { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,12 @@ namespace Tnb.WarehouseMgr.Entities
|
||||
public interface IInOutStockDetail<TStockCode> where TStockCode : BaseEntity<string>, new()
|
||||
{
|
||||
string? line_status { get; set; }
|
||||
/// <summary>
|
||||
/// 仓库Id
|
||||
/// </summary>
|
||||
string? warehouse_id { get; set; }
|
||||
|
||||
|
||||
List<TStockCode> CodeDetails { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Entity.Constraints
|
||||
{
|
||||
public interface IInOutStockHEntity
|
||||
{
|
||||
string warehouse_id { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Entity.Constraints
|
||||
{
|
||||
public interface IUpdateEnabledEntity
|
||||
{
|
||||
public int enabled { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -29,10 +29,6 @@ public partial class WmsCheckSignConfig : BaseEntity<string>
|
||||
/// </summary>
|
||||
public string? location_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public int? enabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
using Tnb.WarehouseMgr.Entities.Entity.Constraints;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 盘点签收配置
|
||||
/// </summary>
|
||||
public partial class WmsCheckSignConfig : IUpdateEnabledEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public int enabled { get; set; }
|
||||
|
||||
}
|
||||
@@ -39,10 +39,6 @@ public partial class WmsCollocationSchemeH : BaseEntity<string>
|
||||
/// </summary>
|
||||
public int seq { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public int status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 产品ID
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
using Tnb.WarehouseMgr.Entities.Entity.Constraints;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 齐套搭配方案主表
|
||||
/// </summary>
|
||||
public partial class WmsCollocationSchemeH : IUpdateEnabledEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "status")]
|
||||
public int enabled { get; set; }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using SqlSugar;
|
||||
using Tnb.WarehouseMgr.Entities.Entity.Constraints;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities;
|
||||
|
||||
@@ -6,7 +7,7 @@ namespace Tnb.WarehouseMgr.Entities;
|
||||
/// WMS电梯设定主表
|
||||
/// </summary>
|
||||
|
||||
public partial class WmsElevatorH
|
||||
public partial class WmsElevatorH : IUpdateEnabledEntity
|
||||
{
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public int end_floor { get; set; }
|
||||
@@ -64,6 +65,6 @@ public partial class WmsElevatorH
|
||||
/// 状态
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "status")]
|
||||
public int enable_mark { get; set; }
|
||||
public int enabled { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -39,10 +39,6 @@ public partial class WmsInstockCode : BaseEntity<string>, IInOutStockCode
|
||||
/// </summary>
|
||||
public int? bill_d_line { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 明细状态
|
||||
/// </summary>
|
||||
public string line_status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物品ID
|
||||
|
||||
@@ -5,5 +5,9 @@ namespace Tnb.WarehouseMgr.Entities;
|
||||
/// </summary>
|
||||
public partial class WmsInstockCode : IInOutStockCode
|
||||
{
|
||||
/// <summary>
|
||||
/// 明细状态
|
||||
/// </summary>
|
||||
public string line_status { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Interfaces
|
||||
{
|
||||
public interface IWmsBasicDataBaseService
|
||||
{
|
||||
Task<bool> IsEnabledMark(IEnumerable<string> ids, int status);
|
||||
}
|
||||
}
|
||||
@@ -148,7 +148,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
EnumInOutStockType.In => await FetchInOutStockCodesById<WmsInstockD, InStockDetailOutput, WmsInstockCode>(input.bill_d_id),
|
||||
EnumInOutStockType.Out => await FetchInOutStockCodesById<WmsOutstockD, OutStockDetailOutput, WmsOutstockCode>(input.bill_d_id),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(input.inoutStockType), $"Not expected EnumInOutStockType value: {input.inoutStockType}"),
|
||||
_ => throw new NotImplementedException(),
|
||||
};
|
||||
return result ?? Enumerable.Empty<dynamic>();
|
||||
}
|
||||
@@ -706,7 +706,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
_ = await _db.Updateable<WmsDistaskH>().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_RUNING_ID,act_start_date = DateTime.Now }).Where(it => input.disTaskIds.Contains(it.id)).ExecuteCommandAsync();
|
||||
_ = await _db.Updateable<WmsDistaskH>().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_RUNING_ID, act_start_date = DateTime.Now }).Where(it => input.disTaskIds.Contains(it.id)).ExecuteCommandAsync();
|
||||
//清空载具库位数据
|
||||
var carryAndLocIds = await _db.Queryable<WmsDistaskH>().Where(it => input.disTaskIds.Contains(it.id)).Select(it => new { it.carry_id, it.startlocation_id }).ToListAsync();
|
||||
if (carryAndLocIds?.Count > 0)
|
||||
@@ -741,7 +741,7 @@ namespace Tnb.WarehouseMgr
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
//更新任务执行表,单据状态为 完成
|
||||
_ = await _db.Updateable<WmsDistaskH>().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID,act_end_date = DateTime.Now }).Where(it => input.disTaskIds.Contains(it.id)).ExecuteCommandAsync();
|
||||
_ = await _db.Updateable<WmsDistaskH>().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID, act_end_date = DateTime.Now }).Where(it => input.disTaskIds.Contains(it.id)).ExecuteCommandAsync();
|
||||
List<WmsDistaskH> disTasks = await _db.Queryable<WmsDistaskH>().InnerJoin<WmsCarryH>((a, b) => a.carry_id == b.id).Where(a => input.disTaskIds.Contains(a.id)).Select((a, b) => new WmsDistaskH { carry_status = b.carry_status }, true).ToListAsync();
|
||||
if (disTasks?.Count > 0)
|
||||
{
|
||||
@@ -849,9 +849,9 @@ namespace Tnb.WarehouseMgr
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task ModifyPoliciesStatus(ModifyPoliciesStatusInput input)
|
||||
public async Task ModifyPoliciesStatus(ModifyEnabledInput input)
|
||||
{
|
||||
async Task _updateStatus<T>(ModifyPoliciesStatusInput input) where T : BaseEntity<string>, IUpdatePoliciesStatus, new()
|
||||
async Task _updateStatus<T>(ModifyEnabledInput input) where T : BaseEntity<string>, IUpdatePoliciesStatus, new()
|
||||
{
|
||||
T obj = new() { status = input.status };
|
||||
_ = await _db.Updateable(obj).UpdateColumns(it => it.status).Where(it => input.ids.Contains(it.id)).ExecuteCommandAsync();
|
||||
@@ -977,9 +977,9 @@ namespace Tnb.WarehouseMgr
|
||||
if (curEleDs?.Count > 0)
|
||||
{
|
||||
//当前电梯
|
||||
WmsElevatorH curEle = await _db.Queryable<WmsElevatorH>().SingleAsync(it => it.id == curEleDs.First().bill_id && it.enable_mark == 1);
|
||||
WmsElevatorH curEle = await _db.Queryable<WmsElevatorH>().SingleAsync(it => it.id == curEleDs.First().bill_id && it.enabled == 1);
|
||||
//同电梯组电梯
|
||||
List<WmsElevatorH> sGpEle = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.enable_mark == 1).ToListAsync();
|
||||
List<WmsElevatorH> sGpEle = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.enabled == 1).ToListAsync();
|
||||
|
||||
if (curEle == null && sGpEle?.Count > 0)
|
||||
{
|
||||
@@ -1048,9 +1048,9 @@ namespace Tnb.WarehouseMgr
|
||||
if (curEleDs?.Count > 0)
|
||||
{
|
||||
//当前电梯
|
||||
WmsElevatorH curEle = await _db.Queryable<WmsElevatorH>().SingleAsync(it => it.id == curEleDs.First().bill_id && it.enable_mark == 1);
|
||||
WmsElevatorH curEle = await _db.Queryable<WmsElevatorH>().SingleAsync(it => it.id == curEleDs.First().bill_id && it.enabled == 1);
|
||||
//同电梯组电梯
|
||||
List<WmsElevatorH> sGpEle = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.enable_mark == 1).ToListAsync();
|
||||
List<WmsElevatorH> sGpEle = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.enabled == 1).ToListAsync();
|
||||
|
||||
if (curEle == null && sGpEle?.Count > 0)
|
||||
{
|
||||
@@ -1256,8 +1256,13 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
CodeDetails = SqlFunc.Subqueryable<TStockCode>().Where(it => it.bill_d_id == a.id).ToList(),
|
||||
}, true)
|
||||
.Mapper(it => it.line_status = it.line_status != null && dic.ContainsKey(key: it.line_status) ? dic[it.line_status]?.ToString() : "")
|
||||
.Mapper(it =>
|
||||
{
|
||||
it.line_status = it.line_status != null && dic.ContainsKey(key: it.line_status) ? dic[it.line_status]?.ToString() : "";
|
||||
it.warehouse_id = _db.Queryable<BasWarehouse>().Single(y => y.id == it.warehouse_id)?.whname ?? "";
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
#endregion
|
||||
|
||||
40
WarehouseMgr/Tnb.WarehouseMgr/WmsBasicConfBase`1.cs
Normal file
40
WarehouseMgr/Tnb.WarehouseMgr/WmsBasicConfBase`1.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aop.Api.Domain;
|
||||
using JNPF.Common.Contracts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Entities.Entity.Constraints;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// Wms基础数据基类
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity"></typeparam>
|
||||
public class WmsBasicConfBase<TEntity> : BaseWareHouseService where TEntity : BaseEntity<string>, IUpdateEnabledEntity, new()
|
||||
{
|
||||
protected ISqlSugarClient DbContext { get; set; }
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
/// <param name="input">
|
||||
/// <br/>{
|
||||
/// <br/> strategyType:入库策略 1、入库 2我、出库(出入库策略参数,其它接口可忽略)
|
||||
/// <br/> ids:选中的主键pkId列表
|
||||
/// <br/> status:状态 0:禁用 1:启用
|
||||
/// <br/>}
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<bool> IsEnabledMark(ModifyEnabledInput input)
|
||||
{
|
||||
return await DbContext.Updateable<TEntity>().SetColumns(it => it.enabled == input.status).Where(it => input.ids.Contains(it.id)).ExecuteCommandHasChangeAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Contracts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// Wms基础数据基类
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity"></typeparam>
|
||||
//public class WmsBasicDataBase<TEntity> : BaseWareHouseService where TEntity : BaseEntity<string>, new()
|
||||
//{
|
||||
// private readonly ISqlSugarClient _db;
|
||||
// public WmsBasicDataBase()
|
||||
// {
|
||||
|
||||
// }
|
||||
// [HttpPost]
|
||||
// public async Task<bool> IsEnabledMark(IEnumerable<string> ids,int status)
|
||||
// {
|
||||
|
||||
// }
|
||||
//}
|
||||
}
|
||||
23
WarehouseMgr/Tnb.WarehouseMgr/WmsCheckSignConfigService.cs
Normal file
23
WarehouseMgr/Tnb.WarehouseMgr/WmsCheckSignConfigService.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.VisualDev;
|
||||
using SqlSugar;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 盘点签收配置
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSCHECKSIGNCONFIG_ID)]
|
||||
public class WmsCheckSignConfigService : WmsBasicConfBase<WmsCheckSignConfig>
|
||||
{
|
||||
public WmsCheckSignConfigService(ISqlSugarRepository<WmsCheckSignConfig> repo)
|
||||
{
|
||||
DbContext = repo.AsSugarClient();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -110,15 +110,18 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
areaIds = input.data[nameof(WmsCheckstockH.area_id)].ToObject<string[]>();
|
||||
}
|
||||
|
||||
Expression<Func<BasLocation, WmsCarryCode, WmsCarryH, bool>> filterExp = (a, b, c) => false;
|
||||
var filerExpable = Expressionable.Create<BasLocation, WmsCarryCode, WmsCarryH>()
|
||||
.And((a, b, c) => a.wh_id == input.data[nameof(WmsCheckstockH.warehouse_id)].ToString())
|
||||
.And((a, b, c) => a.is_type == ((int)EnumLocationType.存储库位).ToString())
|
||||
.And((a, b, c) => c.is_lock == 0);
|
||||
|
||||
|
||||
switch (checkType?.ToEnum<EnumCheckType>())
|
||||
{
|
||||
case EnumCheckType.全库盘点:
|
||||
{
|
||||
filterExp = (a, b, c) => a.wh_id == input.data[nameof(WmsCheckstockH.warehouse_id)].ToString()
|
||||
&& a.is_type == ((int)EnumLocationType.存储库位).ToString()
|
||||
&& c.is_lock == 0;
|
||||
filterExp = filerExpable.ToExpression();
|
||||
}
|
||||
break;
|
||||
case EnumCheckType.物料盘点:
|
||||
@@ -129,7 +132,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EnumCheckType.批次盘点:
|
||||
case EnumCheckType.区域盘点:
|
||||
{
|
||||
if (areaIds?.Length > 0)
|
||||
{
|
||||
@@ -311,8 +314,8 @@ namespace Tnb.WarehouseMgr
|
||||
/// <summary>
|
||||
/// 根据盘点任务ID获取盘点任务明细
|
||||
/// </summary>
|
||||
/// <param name="checkStockId"></param>
|
||||
/// <returns></returns>
|
||||
/// <param name="checkStockId">盘点任务主表ID</param>
|
||||
/// <returns>盘点任务明细列表</returns>
|
||||
[HttpGet("checkStockId")]
|
||||
public async Task<List<WmsCheckstockD>> GetCheckStockDList(string checkStockId)
|
||||
{
|
||||
@@ -332,8 +335,8 @@ namespace Tnb.WarehouseMgr
|
||||
/// <br/>}
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<dynamic> GetTaskDetailByCheckType([FromQuery] CheckDetailQuery input)
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetTaskDetailByCheckType(CheckDetailQuery input)
|
||||
{
|
||||
if (_carryMap.Count == 0)
|
||||
{
|
||||
@@ -341,23 +344,24 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
|
||||
Expression<Func<BasLocation, WmsCarryCode, WmsCarryH, bool>> filterExp = (a, b, c) => false;
|
||||
var filerExpable = Expressionable.Create<BasLocation, WmsCarryCode, WmsCarryH>()
|
||||
.And((a, b, c) => a.wh_id == input.warehouse_id)
|
||||
.And((a, b, c) => a.is_type == ((int)EnumLocationType.存储库位).ToString())
|
||||
.And((a, b, c) => c.is_lock == 0);
|
||||
|
||||
|
||||
switch (input.CheckType)
|
||||
{
|
||||
case EnumCheckType.全库盘点:
|
||||
{
|
||||
filterExp = (a, b, c) => a.wh_id == input.warehouse_id
|
||||
&& a.is_type == ((int)EnumLocationType.存储库位).ToString()
|
||||
&& c.is_lock == 0;
|
||||
filterExp = filerExpable.ToExpression();
|
||||
}
|
||||
break;
|
||||
case EnumCheckType.物料盘点:
|
||||
{
|
||||
if (!input.material_id.IsNullOrWhiteSpace())
|
||||
{
|
||||
filterExp = (a, b, c) => a.wh_id == input.warehouse_id
|
||||
&& b.material_id == input.material_id
|
||||
&& a.is_type == ((int)EnumLocationType.存储库位).ToString()
|
||||
&& c.is_lock == 0;
|
||||
filterExp = filerExpable.And((a, b, c) => b.material_id == input.material_id).ToExpression();
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -365,10 +369,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
if (input.regionIds?.Count > 0)
|
||||
{
|
||||
filterExp = (a, b, c) => a.wh_id == input.warehouse_id
|
||||
&& input.regionIds.Contains(a.region_id)
|
||||
&& a.is_type == ((int)EnumLocationType.存储库位).ToString()
|
||||
&& c.is_lock == 0;
|
||||
filterExp = filerExpable.And((a, b, c) => input.regionIds.Contains(a.region_id)).ToExpression();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// 齐套配套方案服务
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleId)]
|
||||
public class WmsCollocationSchemeSevice : BaseWareHouseService, IWmsCollocationSchemeSevice
|
||||
public class WmsCollocationSchemeSevice : WmsBasicConfBase<WmsCollocationSchemeH>, IWmsCollocationSchemeSevice
|
||||
{
|
||||
private const string ModuleId = "26167204892965";
|
||||
private readonly ISqlSugarClient _db;
|
||||
@@ -36,7 +36,7 @@ namespace Tnb.WarehouseMgr
|
||||
)
|
||||
{
|
||||
_repository = repository;
|
||||
_db = repository.AsSugarClient();
|
||||
DbContext = _db = repository.AsSugarClient();
|
||||
_runService = runService;
|
||||
_visualDevService = visualDevService;
|
||||
OverideFuncs.CreateAsync = Create;
|
||||
|
||||
21
WarehouseMgr/Tnb.WarehouseMgr/WmsElevatorService.cs
Normal file
21
WarehouseMgr/Tnb.WarehouseMgr/WmsElevatorService.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SqlSugar;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 电梯业务类
|
||||
/// </summary>
|
||||
public class WmsElevatorService : WmsBasicConfBase<WmsElevatorH>
|
||||
{
|
||||
public WmsElevatorService(ISqlSugarRepository<WmsElevatorH> repo)
|
||||
{
|
||||
DbContext = repo.AsSugarClient();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,12 @@ using JNPF.API.Entry.Handlers;
|
||||
using JNPF.Common.Core.Filter;
|
||||
using JNPF.JsonSerialization;
|
||||
using JNPF.UnifyResult;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Tnb.Vengine;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
@@ -22,6 +24,7 @@ public static class ConfigureMvcControllerExtensions
|
||||
/// <returns></returns>
|
||||
public static IServiceCollection ConfigureMvcController(this IServiceCollection services)
|
||||
{
|
||||
AdapterCfg.ConfigGlobal();
|
||||
services.AddControllers()
|
||||
.AddMvcFilter<RequestActionFilter>()
|
||||
.AddInjectWithUnifyResult<RESTfulResultProvider>()
|
||||
|
||||
@@ -4,17 +4,17 @@
|
||||
/// 字典对象
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class VmodelSettingAttribute : Attribute
|
||||
public class VmodelAttribute : Attribute
|
||||
{
|
||||
public string? Id { get; set; }
|
||||
public string? Area { get; set; }
|
||||
public string? Code { get; set; }
|
||||
|
||||
public VmodelSettingAttribute(string id)
|
||||
public VmodelAttribute(string id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
public VmodelSettingAttribute(string area, string? code = null)
|
||||
public VmodelAttribute(string area, string? code)
|
||||
{
|
||||
Area = area;
|
||||
Code = code;
|
||||
@@ -1,8 +1,9 @@
|
||||
using SqlSugar;
|
||||
using Tnb;
|
||||
|
||||
namespace JNPF.Common.Contracts;
|
||||
|
||||
public class BaseEntity<TKey> : IEntity where TKey : IEquatable<TKey>
|
||||
public class BaseEntity<TKey> : Entity, IEntity where TKey : IEquatable<TKey>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置 编号.
|
||||
@@ -10,6 +11,8 @@ public class BaseEntity<TKey> : IEntity where TKey : IEquatable<TKey>
|
||||
[SugarColumn(ColumnName = "id", ColumnDescription = "主键", IsPrimaryKey = true)]
|
||||
public TKey id { get; set; }
|
||||
|
||||
|
||||
|
||||
public override object[] GetKeys()
|
||||
{
|
||||
return new object[] { id };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
using JNPF.Common.Contracts;
|
||||
|
||||
namespace Tnb.Vengine.Domain;
|
||||
namespace Tnb;
|
||||
|
||||
[Serializable]
|
||||
public abstract class Entity : IEntity
|
||||
@@ -1,4 +1,7 @@
|
||||
namespace Tnb.Core;
|
||||
using Mapster;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 字典对象
|
||||
@@ -13,33 +16,39 @@ public class DObject : Dictionary<string, object>
|
||||
public DObject(Dictionary<string, object> dictionary) : base(dictionary)
|
||||
{
|
||||
}
|
||||
public void AddCascade(string code, object value)
|
||||
|
||||
/// <summary>
|
||||
/// 将平面结构转换为树形嵌套结构
|
||||
/// </summary>
|
||||
/// <param name="codePath">以.号分隔的多级路径</param>
|
||||
/// <param name="value"></param>
|
||||
public void AddToCascade(string codePath, object value)
|
||||
{
|
||||
var keys = code.Split('.');
|
||||
var keys = codePath.Split('.');
|
||||
if (keys.Length == 1)
|
||||
{
|
||||
Add(code, value);
|
||||
Add(codePath, value);
|
||||
return;
|
||||
}
|
||||
DObject temp = this;
|
||||
for (int i = 0; i < keys.Length; i++)
|
||||
{
|
||||
DObject temp = this;
|
||||
var key = keys[i];
|
||||
if (i < keys.Length - 1)
|
||||
{
|
||||
if (!ContainsKey(keys[i]))
|
||||
{
|
||||
temp = new DObject();
|
||||
Add(keys[i], temp);
|
||||
}
|
||||
else
|
||||
{
|
||||
temp = (DObject)temp[keys[i]];
|
||||
}
|
||||
var obj = new DObject();
|
||||
temp[key] = obj;
|
||||
temp = obj;
|
||||
}
|
||||
else
|
||||
{
|
||||
temp.Add(keys[i], value);
|
||||
temp[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static DObject? FromObject(object? data)
|
||||
{
|
||||
return data?.Adapt<DObject>(AdapterCfg.ExactCase);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,22 +3,29 @@
|
||||
// https://git.tuotong-tech.com/tnb/tnb.server //
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using Mapster;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Tnb.Vengine;
|
||||
namespace Mapster;
|
||||
|
||||
public class TypeAdapter
|
||||
public class AdapterCfg
|
||||
{
|
||||
public static TypeAdapterConfig IgnoreNull { get; }
|
||||
public static TypeAdapterConfig IgnoreNull { get; internal set; }
|
||||
public static TypeAdapterConfig ExactCase { get; internal set; }
|
||||
|
||||
static TypeAdapter()
|
||||
static AdapterCfg()
|
||||
{
|
||||
IgnoreNull = TypeAdapterConfig.GlobalSettings.Clone();
|
||||
IgnoreNull.Default.IgnoreNullValues(true);
|
||||
|
||||
ExactCase = TypeAdapterConfig.GlobalSettings.Clone();
|
||||
ExactCase.Default.NameMatchingStrategy(NameMatchingStrategy.Exact);
|
||||
}
|
||||
|
||||
public static void ConfigGlobal()
|
||||
{
|
||||
TypeAdapterConfig.GlobalSettings.Default.PreserveReference(true);
|
||||
TypeAdapterConfig.GlobalSettings.NewConfig<JToken, JToken>().MapWith(json => json);
|
||||
TypeAdapterConfig.GlobalSettings.NewConfig<JObject, JObject>().MapWith(json => json);
|
||||
TypeAdapterConfig.GlobalSettings.NewConfig<JArray, JArray>().MapWith(json => json);
|
||||
IgnoreNull = TypeAdapterConfig.GlobalSettings.Clone();
|
||||
IgnoreNull.Default.IgnoreNullValues(true);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using Tnb.Vengine.DataAccess;
|
||||
using Tnb.Vengine.Domain;
|
||||
|
||||
namespace Tnb.Vengine.AppService;
|
||||
|
||||
@@ -13,6 +15,37 @@ namespace Tnb.Vengine.AppService;
|
||||
/// </summary>
|
||||
public class BaseAppService : IDynamicApiController, ITransient
|
||||
{
|
||||
protected readonly IDataAccess _dataAccess;
|
||||
private readonly Dictionary<string, Vmodel> _models = new();
|
||||
|
||||
public BaseAppService(IDataAccess dataAccess)
|
||||
{
|
||||
_dataAccess = dataAccess;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据id获取Vmodel
|
||||
/// </summary>
|
||||
protected async Task<Vmodel> GetVmodelAsync(string id)
|
||||
{
|
||||
if (!_models.ContainsKey(id))
|
||||
{
|
||||
_models[id] = await _dataAccess.GetVmodelAsync(id, false);
|
||||
}
|
||||
return _models[id];
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据areaCode和vmCode获取Vmodel
|
||||
/// </summary>
|
||||
protected async Task<Vmodel> GetVmodelAsync(string areaCode, string vmCode)
|
||||
{
|
||||
var key = areaCode + "/" + vmCode;
|
||||
if (!_models.ContainsKey(key))
|
||||
{
|
||||
_models[key] = await _dataAccess.GetVmodelAsync(areaCode, vmCode, false);
|
||||
}
|
||||
return _models[key];
|
||||
}
|
||||
}
|
||||
|
||||
//[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 100)]
|
||||
|
||||
@@ -22,34 +22,28 @@ namespace Tnb.Vengine.AppService;
|
||||
[Route("/")]
|
||||
public class VengineAppService : BaseAppService, IVengineAppService
|
||||
{
|
||||
private readonly IDataAccess _dataAccess;
|
||||
private readonly ISqlSugarClient _db;
|
||||
//private readonly ISqlSugarClient _db;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
public VengineAppService(IDataAccess da)
|
||||
public VengineAppService(IDataAccess da):base(da)
|
||||
{
|
||||
_dataAccess = da;
|
||||
_db = _dataAccess.GetSqlSugar();
|
||||
//_db = _dataAccess.GetSqlSugar();
|
||||
}
|
||||
|
||||
#region 按模型的id进行增删改查接口
|
||||
|
||||
/// <summary>
|
||||
/// 获取一条 数据信息
|
||||
/// </summary>
|
||||
[HttpGet("api/[area]/[controller]/{vmid}/get")]
|
||||
public async Task<dynamic?> GetAsync(string vmid, [FromQuery] VmGetInput input)
|
||||
{
|
||||
var vm = await _dataAccess.GetVmodelAsync(vmid, true);
|
||||
VmQueryInput arg = input.Adapt<VmQueryInput>();
|
||||
if (input.id != null)
|
||||
{
|
||||
if (arg.q == null) arg.q = new DObject();
|
||||
arg.q.Add(vm.GetPrimary().code, input.id);
|
||||
}
|
||||
var ls = await _dataAccess.QueryDataAsync(vm, arg);
|
||||
var vm = await GetVmodelAsync(vmid);
|
||||
var arg = input.Adapt<VmQueryInput>();
|
||||
arg.AddQueryParaIf(!string.IsNullOrEmpty(input.id), vm.GetPrimary().code, input.id!);
|
||||
|
||||
var ls = await ListAsync(vmid, arg);
|
||||
return ls.items.FirstOrDefault();
|
||||
}
|
||||
|
||||
@@ -59,14 +53,7 @@ public class VengineAppService : BaseAppService, IVengineAppService
|
||||
[HttpGet("api/[area]/[controller]/{vmid}/get-list")]
|
||||
public async Task<VmPagedOutput> GetListAsync(string vmid, [FromQuery] VmGetListInput input)
|
||||
{
|
||||
var vm = await _dataAccess.GetVmodelAsync(vmid, true);
|
||||
VmQueryInput arg = input.Adapt<VmQueryInput>();
|
||||
if (!string.IsNullOrEmpty(input.q))
|
||||
{
|
||||
arg.q = input.q.ToObject<DObject>();
|
||||
}
|
||||
var ls = await _dataAccess.QueryDataAsync(vm, arg);
|
||||
return ls;
|
||||
return await ListAsync(vmid, input.Adapt<VmQueryInput>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -75,7 +62,7 @@ public class VengineAppService : BaseAppService, IVengineAppService
|
||||
[HttpPost("api/[area]/[controller]/{vmid}/list")]
|
||||
public async Task<VmPagedOutput> ListAsync(string vmid, [FromBody] VmQueryInput input)
|
||||
{
|
||||
var vm = await _dataAccess.GetVmodelAsync(vmid, true);
|
||||
var vm = await GetVmodelAsync(vmid);
|
||||
var ls = await _dataAccess.QueryDataAsync(vm, input);
|
||||
return ls;
|
||||
}
|
||||
@@ -84,9 +71,9 @@ public class VengineAppService : BaseAppService, IVengineAppService
|
||||
/// 新增 数据
|
||||
/// </summary>
|
||||
[HttpPost("api/[area]/[controller]/{vmid}/create")]
|
||||
public async Task<dynamic> CreateAsync(string vmid, [FromBody] VmCreateInput input)
|
||||
public async Task<dynamic> CreateAsync(string vmid, [FromBody] VmEditInput input)
|
||||
{
|
||||
var vm = await _dataAccess.GetVmodelAsync(vmid);
|
||||
var vm = await GetVmodelAsync(vmid);
|
||||
var ret = await _dataAccess.CreateDataAsync(vm, input);
|
||||
return ret;
|
||||
}
|
||||
@@ -95,9 +82,9 @@ public class VengineAppService : BaseAppService, IVengineAppService
|
||||
/// 更新 数据
|
||||
/// </summary>
|
||||
[HttpPut("api/[area]/[controller]/{vmid}/update")]
|
||||
public async Task<dynamic> UpdateAsync(string vmid, [FromBody] VmUpdateInput input)
|
||||
public async Task<dynamic> UpdateAsync(string vmid, [FromBody] VmEditInput input)
|
||||
{
|
||||
var vm = await _dataAccess.GetVmodelAsync(vmid);
|
||||
var vm = await GetVmodelAsync(vmid);
|
||||
var ret = await _dataAccess.UpdateDataAsync(vm, input);
|
||||
return ret;
|
||||
}
|
||||
@@ -108,7 +95,7 @@ public class VengineAppService : BaseAppService, IVengineAppService
|
||||
[HttpDelete("api/[area]/[controller]/{vmid}/delete")]
|
||||
public async Task<dynamic> DeleteAsync(string vmid, [FromQuery] VmDeleteInput input)
|
||||
{
|
||||
var vm = await _dataAccess.GetVmodelAsync(vmid);
|
||||
var vm = await GetVmodelAsync(vmid);
|
||||
var ret = await _dataAccess.DeleteDataAsync(vm, input);
|
||||
return ret;
|
||||
}
|
||||
@@ -116,13 +103,6 @@ public class VengineAppService : BaseAppService, IVengineAppService
|
||||
#endregion 按模型的id进行增删改查接口
|
||||
|
||||
#region 按模型的areaCode和vmcode进行增删改查接口
|
||||
|
||||
private async Task<Vmodel> GetVmodelAsync(string areaCode, string vmCode)
|
||||
{
|
||||
var vm = await _dataAccess.GetVmodelAsync(areaCode, vmCode, false);
|
||||
return vm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取一条 数据信息
|
||||
/// </summary>
|
||||
@@ -130,13 +110,10 @@ public class VengineAppService : BaseAppService, IVengineAppService
|
||||
public async Task<dynamic?> GetAsync(string areaCode, string vmCode, [FromQuery] VmGetInput input)
|
||||
{
|
||||
var vm = await GetVmodelAsync(areaCode, vmCode);
|
||||
VmQueryInput arg = input.Adapt<VmQueryInput>();
|
||||
if (input.id != null)
|
||||
{
|
||||
if (arg.q == null) arg.q = new DObject();
|
||||
arg.q.Add(vm.GetPrimary().code, input.id);
|
||||
}
|
||||
var ls = await _dataAccess.QueryDataAsync(vm, arg);
|
||||
var arg = input.Adapt<VmQueryInput>();
|
||||
arg.AddQueryParaIf(!string.IsNullOrEmpty(input.id), vm.GetPrimary().code, input.id!);
|
||||
|
||||
var ls = await ListAsync(areaCode, vmCode, arg);
|
||||
return ls.items.FirstOrDefault();
|
||||
}
|
||||
|
||||
@@ -146,14 +123,7 @@ public class VengineAppService : BaseAppService, IVengineAppService
|
||||
[HttpGet("api/{areaCode}/{vmCode}/get-list")]
|
||||
public async Task<VmPagedOutput> GetListAsync(string areaCode, string vmCode, [FromQuery] VmGetListInput input)
|
||||
{
|
||||
var vm = await GetVmodelAsync(areaCode, vmCode);
|
||||
VmQueryInput arg = input.Adapt<VmQueryInput>();
|
||||
if (!string.IsNullOrEmpty(input.q))
|
||||
{
|
||||
arg.q = input.q.ToObject<DObject>();
|
||||
}
|
||||
var ls = await _dataAccess.QueryDataAsync(vm, arg);
|
||||
return ls;
|
||||
return await ListAsync(areaCode, vmCode, input.Adapt<VmQueryInput>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -171,7 +141,7 @@ public class VengineAppService : BaseAppService, IVengineAppService
|
||||
/// 新增 数据
|
||||
/// </summary>
|
||||
[HttpPost("api/{areaCode}/{vmCode}/create")]
|
||||
public async Task<dynamic> CreateAsync(string areaCode, string vmCode, [FromBody] VmCreateInput input)
|
||||
public async Task<dynamic> CreateAsync(string areaCode, string vmCode, [FromBody] VmEditInput input)
|
||||
{
|
||||
var vm = await GetVmodelAsync(areaCode, vmCode);
|
||||
var ret = await _dataAccess.CreateDataAsync(vm, input);
|
||||
@@ -182,7 +152,7 @@ public class VengineAppService : BaseAppService, IVengineAppService
|
||||
/// 更新 数据
|
||||
/// </summary>
|
||||
[HttpPut("api/{areaCode}/{vmCode}/update")]
|
||||
public async Task<dynamic> UpdateAsync(string areaCode, string vmCode, [FromBody] VmUpdateInput input)
|
||||
public async Task<dynamic> UpdateAsync(string areaCode, string vmCode, [FromBody] VmEditInput input)
|
||||
{
|
||||
var vm = await GetVmodelAsync(areaCode, vmCode);
|
||||
var ret = await _dataAccess.UpdateDataAsync(vm, input);
|
||||
|
||||
@@ -4,9 +4,16 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography;
|
||||
using Aop.Api.Domain;
|
||||
using JNPF;
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Extension;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||
using SqlSugar;
|
||||
using Tnb.Core;
|
||||
using Tnb.Vengine.DataAccess;
|
||||
@@ -20,91 +27,107 @@ namespace Tnb.Vengine.AppService;
|
||||
[Authorize]
|
||||
//[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 1102)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
public class VengineAppService<TEntity> : BaseAppService where TEntity : Entity
|
||||
public class VengineAppService<TEntity, TGetInput, TGetOutput, TQueryInput, TGetListInput, TGetListOutput, TCreateInput, TUpdateInput> : BaseAppService
|
||||
where TEntity : Entity
|
||||
where TGetInput : VmGetInput
|
||||
where TQueryInput : VmQueryInput
|
||||
where TGetListInput : VmGetListInput
|
||||
where TCreateInput : VmEditInput
|
||||
where TUpdateInput : VmEditInput
|
||||
{
|
||||
protected readonly IDataAccess _dataAccess;
|
||||
protected readonly ISqlSugarClient _db;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
public VengineAppService(IDataAccess dataAccess)
|
||||
public VengineAppService(IDataAccess dataAccess) : base(dataAccess)
|
||||
{
|
||||
_dataAccess = dataAccess;
|
||||
_db = _dataAccess.GetSqlSugar();
|
||||
_db = dataAccess.GetSqlSugar();
|
||||
}
|
||||
|
||||
protected virtual async Task<Vmodel> GetVmodelAsync()
|
||||
{
|
||||
string? areaCode = null, vmCode = null;
|
||||
// 1.优先从路由中获取模型code
|
||||
IHttpContextAccessor httpContextAccessor = App.GetService<IHttpContextAccessor>();
|
||||
var routes = httpContextAccessor.HttpContext?.Request.RouteValues;
|
||||
//HttpContext.GetEndpoint()?.Metadata.GetMetadata<ControllerActionDescriptor>();
|
||||
if (routes != null)
|
||||
{
|
||||
areaCode = routes.GetOrDefault("area")?.ToString();
|
||||
vmCode = routes.GetOrDefault("controller")?.ToString();
|
||||
if (!string.IsNullOrEmpty(areaCode) && !string.IsNullOrEmpty(vmCode))
|
||||
{
|
||||
return await GetVmodelAsync(areaCode, vmCode);
|
||||
}
|
||||
}
|
||||
// 2.其次从实体特性中获取模型code
|
||||
var tp = typeof(TEntity);
|
||||
string? area = null, code = null;
|
||||
var vset = tp.GetCustomAttribute<VmodelSettingAttribute>();
|
||||
var vset = tp.GetCustomAttribute<VmodelAttribute>();
|
||||
if (vset != null)
|
||||
{
|
||||
area = vset.Area;
|
||||
code = vset.Code;
|
||||
if (!string.IsNullOrEmpty(vset.Id))
|
||||
{
|
||||
return await GetVmodelAsync(vset.Id);
|
||||
}
|
||||
areaCode = vset.Area;
|
||||
vmCode = vset.Code;
|
||||
}
|
||||
if (string.IsNullOrEmpty(area))
|
||||
// 3.从实体命名空间中获取模型code
|
||||
if (string.IsNullOrEmpty(areaCode))
|
||||
{
|
||||
ThrowIf.IsNullOrEmpty(tp.Namespace, $"类型 {nameof(tp)} 的命名空间不可为空");
|
||||
area = tp.Namespace.RemovePreFix(ModuleConst.NsPrefix + ".").Replace(".Domain", "").Replace(".Entities", "").ToKebab();
|
||||
areaCode = tp.Namespace.RemovePreFix(ModuleConst.NsPrefix + ".").Replace(".Domain", "").Replace(".Entities", "").ToKebab();
|
||||
}
|
||||
if (string.IsNullOrEmpty(code))
|
||||
if (string.IsNullOrEmpty(vmCode))
|
||||
{
|
||||
code = tp.Name.ToKebab();
|
||||
vmCode = tp.Name.ToKebab();
|
||||
}
|
||||
var vm = await _dataAccess.GetVmodelAsync(area, code, false);
|
||||
|
||||
return vm;
|
||||
return await GetVmodelAsync(areaCode, vmCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取一条 数据信息
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
public virtual async Task<dynamic> GetAsync([FromQuery] VmGetInput input)
|
||||
public virtual async Task<TGetOutput> GetAsync([FromQuery] TGetInput input)
|
||||
{
|
||||
var vm = await GetVmodelAsync();
|
||||
VmQueryInput arg = input.Adapt<VmQueryInput>();
|
||||
if (input.id != null)
|
||||
{
|
||||
if (arg.q == null) arg.q = new DObject();
|
||||
arg.q.Add(vm.GetPrimary().code, input.id);
|
||||
}
|
||||
var ls = await _dataAccess.QueryDataAsync(vm, arg);
|
||||
return ls.items.FirstOrDefault()!;
|
||||
TQueryInput arg = input.Adapt<TQueryInput>();
|
||||
arg.AddQueryParaIf(!string.IsNullOrEmpty(input.id), vm.GetPrimary().code, input.id!);
|
||||
|
||||
var data = (await ListAsync(arg)).items.FirstOrDefault();
|
||||
return data == null ? default! : data.Adapt<TGetOutput>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取多条 数据列表
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
public virtual async Task<VmPagedOutput> GetListAsync([FromQuery] VmGetListInput input)
|
||||
public virtual async Task<PagedOutput<TGetListOutput>> GetListAsync([FromQuery] TGetListInput input)
|
||||
{
|
||||
var vm = await GetVmodelAsync();
|
||||
var ls = await _dataAccess.QueryDataAsync(vm, input.ToListInput());
|
||||
return ls;
|
||||
return await ListAsync(input.Adapt<TQueryInput>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取多条 数据列表
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
public virtual async Task<VmPagedOutput> ListAsync([FromBody] VmQueryInput input)
|
||||
public virtual async Task<PagedOutput<TGetListOutput>> ListAsync([FromBody] TQueryInput input)
|
||||
{
|
||||
var vm = await GetVmodelAsync();
|
||||
var ls = await _dataAccess.QueryDataAsync(vm, input);
|
||||
return ls;
|
||||
return ls.ToPagedOutput<TGetListOutput>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新增 数据
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
public virtual async Task<dynamic> CreateAsync([FromBody] VmCreateInput input)
|
||||
public virtual async Task<dynamic> CreateAsync([FromBody] TCreateInput input)
|
||||
{
|
||||
var vm = await GetVmodelAsync();
|
||||
var ret = await _dataAccess.CreateDataAsync(vm, input);
|
||||
var ret = await _dataAccess.CreateDataAsync(vm, input.ToEditInput());
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -112,10 +135,10 @@ public class VengineAppService<TEntity> : BaseAppService where TEntity : Entity
|
||||
/// 更新 数据
|
||||
/// </summary>
|
||||
[HttpPut]
|
||||
public virtual async Task<dynamic> UpdateAsync([FromBody] VmUpdateInput input)
|
||||
public virtual async Task<dynamic> UpdateAsync([FromBody] TUpdateInput input)
|
||||
{
|
||||
var vm = await GetVmodelAsync();
|
||||
var ret = await _dataAccess.UpdateDataAsync(vm, input);
|
||||
var ret = await _dataAccess.UpdateDataAsync(vm, input.ToEditInput());
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -129,4 +152,47 @@ public class VengineAppService<TEntity> : BaseAppService where TEntity : Entity
|
||||
var ret = await _dataAccess.DeleteDataAsync(vm, input);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region 泛型变种
|
||||
public class VengineAppService<TEntity, TGetInput, TGetOutput, TQueryInput, TGetListInput, TGetListOutput> :
|
||||
VengineAppService<TEntity, TGetInput, TGetOutput, TQueryInput, TGetListInput, TGetListOutput, VmEditInput, VmEditInput>
|
||||
where TEntity : Entity
|
||||
where TGetInput : VmGetInput
|
||||
where TGetListInput : VmGetListInput
|
||||
where TQueryInput : VmQueryInput
|
||||
{
|
||||
public VengineAppService(IDataAccess da) : base(da)
|
||||
{
|
||||
}
|
||||
}
|
||||
public class VengineAppService<TEntity, TGetInput, TGetOutput, TQueryInput, TGetListInput> :
|
||||
VengineAppService<TEntity, TGetInput, TGetOutput, TQueryInput, TGetListInput, dynamic, VmEditInput, VmEditInput>
|
||||
where TEntity : Entity
|
||||
where TGetInput : VmGetInput
|
||||
where TGetListInput : VmGetListInput
|
||||
where TQueryInput : VmQueryInput
|
||||
{
|
||||
public VengineAppService(IDataAccess da) : base(da)
|
||||
{
|
||||
}
|
||||
}
|
||||
public class VengineAppService<TEntity, TGetInput, TGetOutput> :
|
||||
VengineAppService<TEntity, TGetInput, TGetOutput, VmQueryInput, VmGetListInput, dynamic, VmEditInput, VmEditInput>
|
||||
where TEntity : Entity
|
||||
where TGetInput : VmGetInput
|
||||
{
|
||||
public VengineAppService(IDataAccess da) : base(da)
|
||||
{
|
||||
}
|
||||
}
|
||||
public class VengineAppService<TEntity> :
|
||||
VengineAppService<TEntity, VmGetInput, dynamic, VmQueryInput, VmGetListInput, dynamic, VmEditInput, VmEditInput>
|
||||
where TEntity : Entity
|
||||
{
|
||||
public VengineAppService(IDataAccess da) : base(da)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using JNPF;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Manager;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.ViewEngine;
|
||||
using Mapster;
|
||||
@@ -12,45 +14,45 @@ using SqlSugar;
|
||||
using Tnb.Core;
|
||||
using Tnb.Vengine.DataAccess;
|
||||
using Tnb.Vengine.Domain;
|
||||
using Yitter.IdGenerator;
|
||||
|
||||
namespace Tnb.Vengine.AppService;
|
||||
|
||||
/// <summary>
|
||||
/// 视图模型服务类
|
||||
/// 视图模型服务类,
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, KeepVerb = true, Order = 1102)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
public class VmodelAppService : VengineAppService<Vmodel>, IVmodelAppService
|
||||
//[Route("api/[area]/[controller]/[action]")]
|
||||
public class VmodelAppService : VengineAppService<Vmodel, VmodelGetInput, Vmodel, VmQueryInput, VmGetListInput, Vmodel, VmodelCreateInput, VmodelUpdateInput>, IVmodelAppService
|
||||
{
|
||||
private readonly IViewEngine _viewEngine;
|
||||
private readonly ICacheManager _cache;
|
||||
private readonly IUserManager _user;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
public VmodelAppService(IDataAccess da, IViewEngine viewEngine) : base(da)
|
||||
public VmodelAppService(IDataAccess da, IViewEngine viewEngine, ICacheManager cache, IUserManager user) : base(da)
|
||||
{
|
||||
_viewEngine = viewEngine;
|
||||
_cache = cache;
|
||||
_user = user;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取一条 数据信息
|
||||
/// 获取一条 数据信息, q参数无效
|
||||
/// </summary>
|
||||
public override async Task<dynamic> GetAsync(VmGetInput input)
|
||||
public override async Task<Vmodel> GetAsync(VmodelGetInput input)
|
||||
{
|
||||
VmodelGetInput para = new VmodelGetInput();
|
||||
if (!string.IsNullOrEmpty(input.q))
|
||||
{
|
||||
para = input.q.ToObject<VmodelGetInput>();
|
||||
}
|
||||
var query = _db.Queryable<Vmodel>().Where(a => a.deleted == 0);
|
||||
Vmodel? vm = null;
|
||||
if (!string.IsNullOrEmpty(input.id))
|
||||
{
|
||||
vm = await _dataAccess.GetVmodelAsync(input.id, para.drill);
|
||||
vm = await _dataAccess.GetVmodelAsync(input.id, input.drill);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(para.areaCode) && !string.IsNullOrEmpty(para.vmCode))
|
||||
else if (!string.IsNullOrEmpty(input.areaCode) && !string.IsNullOrEmpty(input.vmCode))
|
||||
{
|
||||
vm = await _dataAccess.GetVmodelAsync(para.areaCode, para.vmCode, para.drill);
|
||||
vm = await _dataAccess.GetVmodelAsync(input.areaCode, input.vmCode, input.drill);
|
||||
}
|
||||
ThrowIf.IsNull(vm, "输入参数有误, id 和 areaCode,vmCode 不可同时为空");
|
||||
return vm;
|
||||
@@ -59,33 +61,33 @@ public class VmodelAppService : VengineAppService<Vmodel>, IVmodelAppService
|
||||
/// <summary>
|
||||
/// 获取多条 数据列表
|
||||
/// </summary>
|
||||
public override async Task<VmPagedOutput> GetListAsync(VmGetListInput input)
|
||||
public override async Task<PagedOutput<Vmodel>> GetListAsync(VmGetListInput input)
|
||||
{
|
||||
VmPagedOutput ret = new();
|
||||
var q = _db.Queryable<Vmodel>().WhereIF(!string.IsNullOrEmpty(input.k), a => a.vmCode.Contains(input.k!) || a.vmName.Contains(input.k!));
|
||||
RefAsync<int> total = 0;
|
||||
var data = await q.OrderBy(input.sort).ToPageListAsync((input.pnum - 1) * input.psize, input.psize, total);
|
||||
ret.total = total;
|
||||
ret.items = data.Adapt<List<DObject>>();
|
||||
return ret;
|
||||
return await ListAsync(input.Adapt<VmQueryInput>());
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
public override Task<VmPagedOutput> ListAsync(VmQueryInput input)
|
||||
public override async Task<PagedOutput<Vmodel>> ListAsync(VmQueryInput input)
|
||||
{
|
||||
return base.ListAsync(input);
|
||||
var q = _db.Queryable<Vmodel>().Where(a => a.deleted == 0)
|
||||
.WhereIF(!string.IsNullOrEmpty(input.k), a => a.vmCode.Contains(input.k!) || a.vmName.Contains(input.k!));
|
||||
RefAsync<int> total = 0;
|
||||
var data = await q.OrderBy(input.sort).ToPageListAsync((input.pnum - 1) * input.psize, input.psize, total);
|
||||
return PagedOutput.Create(total, data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新增 模型
|
||||
/// </summary>
|
||||
public override async Task<dynamic> CreateAsync(VmCreateInput input)
|
||||
public override async Task<dynamic> CreateAsync(VmodelCreateInput input)
|
||||
{
|
||||
ThrowIf.IsNull(input.data);
|
||||
//ArgumentNullException.ThrowIfNull(input.data);
|
||||
Vmodel vm = input.data.ToObject<Vmodel>();
|
||||
Vmodel vm = input.data.Adapt<Vmodel>();
|
||||
vm.id = YitIdHelper.NextId().ToString();
|
||||
vm.areaCode = vm.areaCode.ToKebab();
|
||||
vm.vmCode = vm.vmCode.ToKebab();
|
||||
vm.createTime = DateTime.Now;
|
||||
vm.createId = _user.UserId;
|
||||
await _db.Insertable(vm).ExecuteCommandAsync();
|
||||
return vm;
|
||||
}
|
||||
@@ -93,16 +95,20 @@ public class VmodelAppService : VengineAppService<Vmodel>, IVmodelAppService
|
||||
/// <summary>
|
||||
/// 更新 数据
|
||||
/// </summary>
|
||||
public override async Task<dynamic> UpdateAsync(VmUpdateInput input)
|
||||
public override async Task<dynamic> UpdateAsync(VmodelUpdateInput input)
|
||||
{
|
||||
ThrowIf.IsNull(input.data);
|
||||
//ArgumentNullException.ThrowIfNull(input.data);
|
||||
Vmodel vm = input.data.ToObject<Vmodel>();
|
||||
ThrowIf.IsNullOrEmpty(input.data.id, $"更新数据时主键(id)不可为空");
|
||||
|
||||
Vmodel vm = input.data.Adapt<Vmodel>();
|
||||
vm.areaCode = vm.areaCode.ToKebab();
|
||||
vm.vmCode = vm.vmCode.ToKebab();
|
||||
vm.navProps.ForEach(a => a.naviModel = null);
|
||||
vm.modifyTime = DateTime.Now;
|
||||
vm.modifyId = _user.UserId;
|
||||
await _db.Updateable(vm).WhereColumns(a => a.id).ExecuteCommandAsync();
|
||||
return input;
|
||||
await _cache.DelAsync(_dataAccess.GetVmodelCacheKey(vm.id));
|
||||
return vm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -110,7 +116,8 @@ public class VmodelAppService : VengineAppService<Vmodel>, IVmodelAppService
|
||||
/// </summary>
|
||||
public override async Task<dynamic> DeleteAsync(VmDeleteInput input)
|
||||
{
|
||||
var ret = await _db.Deleteable<Vmodel>(input.id).ExecuteCommandAsync();
|
||||
var ret = await _db.Updateable<Vmodel>().SetColumns(a => a.deleted, 1).Where(a => a.id == input.id).ExecuteCommandAsync();
|
||||
await _cache.DelAsync(_dataAccess.GetVmodelCacheKey(input.id!));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,47 @@
|
||||
// https://git.tuotong-tech.com/tnb/tnb.server //
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using Mapster;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.Core;
|
||||
using Tnb.Vengine.Domain;
|
||||
|
||||
namespace Tnb.Vengine.AppService;
|
||||
|
||||
public record VmodelCreateData(string areaCode, string vmCode, string vmName, string? dbCode, string tableName, List<VmDbProp> dbProps, List<VmNavPropCreateData> navProps, List<VmCalProp> calProps, int ordinal, short softDelete, short enabled, string? descrip);
|
||||
public record VmNavPropCreateData(string code, string name, string vmid, eNavigateType navType, string refCode, string refProp, string fkProp);
|
||||
public record VmodelUpdateData(string id, string areaCode, string vmCode, string vmName, string? dbCode, string tableName, List<VmDbProp> dbProps, List<VmNavPropCreateData> navProps, List<VmCalProp> calProps, int ordinal, short softDelete, short enabled, string? descrip);
|
||||
|
||||
public class VmodelGetInput : VmGetInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 模块code, areaCode和vmCode为一组
|
||||
/// </summary>
|
||||
public string? areaCode { get; set; }
|
||||
/// <summary>
|
||||
/// 模型code, areaCode和vmCode为一组
|
||||
/// </summary>
|
||||
public string? vmCode { get; set; }
|
||||
/// <summary>
|
||||
/// 是否钻取子模型
|
||||
/// </summary>
|
||||
public bool drill { get; set; } = false;
|
||||
}
|
||||
public class VmodelCreateInput : VmEditInput
|
||||
{
|
||||
public new VmodelCreateData? data { get; set; }
|
||||
public override VmEditInput ToEditInput()
|
||||
{
|
||||
VmEditInput input = this;
|
||||
input.data = DObject.FromObject(data);
|
||||
return input;
|
||||
}
|
||||
}
|
||||
public class VmodelUpdateInput : VmEditInput
|
||||
{
|
||||
public new VmodelUpdateData? data { get; set; }
|
||||
}
|
||||
public class VmodelCreateFromTableInput
|
||||
{
|
||||
public string? dbCode { get; set; }
|
||||
@@ -15,17 +54,31 @@ public class VmodelCreateFromTableInput
|
||||
public string areaCode { get; set; } = "edp";
|
||||
}
|
||||
|
||||
public class CreatePageFromVmodelInput
|
||||
public class VmodelPageCreateInput : VmEditInput
|
||||
{
|
||||
public new VmodelPage? data { get; set; }
|
||||
public override VmEditInput ToEditInput()
|
||||
{
|
||||
VmEditInput input = this;
|
||||
input.data = DObject.FromObject(data);
|
||||
return input;
|
||||
}
|
||||
}
|
||||
|
||||
public class VmodelPageUpdateInput : VmEditInput
|
||||
{
|
||||
public new VmodelPage? data { get; set; }
|
||||
public override VmEditInput ToEditInput()
|
||||
{
|
||||
VmEditInput input = this;
|
||||
input.data = DObject.FromObject(data);
|
||||
return input;
|
||||
}
|
||||
}
|
||||
|
||||
public class VmodelPageCreateFromVmodelInput
|
||||
{
|
||||
public Guid? viewId { get; set; }
|
||||
public string? vmid { get; set; }
|
||||
}
|
||||
|
||||
public class VmodelGetInput
|
||||
{
|
||||
public string? areaCode { get; set; }
|
||||
public string? vmCode { get; set; }
|
||||
public string? dbCode { get; set; }
|
||||
public string? tableName { get; set; }
|
||||
public bool drill { get; set; } = false;
|
||||
}
|
||||
@@ -19,8 +19,7 @@ namespace Tnb.Vengine.AppService;
|
||||
/// 视图模型服务类
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 1104, KeepVerb = true)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
public class VmodelPageAppService : VengineAppService<VmodelPage>, IVmodelPageAppService
|
||||
public class VmodelPageAppService : VengineAppService<VmodelPage, VmGetInput, VmodelPage, VmQueryInput, VmGetListInput, VmodelPage, VmodelPageCreateInput, VmodelPageUpdateInput>, IVmodelPageAppService
|
||||
{
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
@@ -29,72 +28,10 @@ public class VmodelPageAppService : VengineAppService<VmodelPage>, IVmodelPageAp
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取一条 数据信息
|
||||
/// </summary>
|
||||
public override async Task<dynamic> GetAsync(VmGetInput input)
|
||||
{
|
||||
var query = _db.Queryable<VmodelPage>().Where(a => a.deleted == 0 && a.id == input.id);
|
||||
VmodelPage vm = await query.FirstAsync();
|
||||
return vm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取多条 数据列表
|
||||
/// </summary>
|
||||
public override async Task<VmPagedOutput> GetListAsync(VmGetListInput input)
|
||||
{
|
||||
VmPagedOutput ret = new();
|
||||
var q = _db.Queryable<VmodelPage>().WhereIF(!string.IsNullOrEmpty(input.k), a => a.code.Contains(input.k!) || a.name.Contains(input.k!));
|
||||
RefAsync<int> total = 0;
|
||||
var data = await q.OrderBy(input.sort).ToPageListAsync((input.pnum - 1) * input.psize, input.psize, total);
|
||||
ret.total = total;
|
||||
ret.items = data.Adapt<List<DObject>>();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新增 模型
|
||||
/// </summary>
|
||||
public override async Task<dynamic> CreateAsync(VmCreateInput input)
|
||||
{
|
||||
ThrowIf.IsNull(input.data);
|
||||
VmodelPage vpage = input.data.Adapt<VmodelPage>();
|
||||
await _db.Insertable(vpage).ExecuteCommandAsync();
|
||||
return vpage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新 数据
|
||||
/// </summary>
|
||||
public override async Task<dynamic> UpdateAsync(VmUpdateInput input)
|
||||
{
|
||||
ThrowIf.IsNull(input.data);
|
||||
if (!input.data.ContainsKey(nameof(VmodelPage.id)))
|
||||
{
|
||||
throw new Exception($"更新数据时主键({nameof(VmodelPage.id)})不可为空");
|
||||
}
|
||||
var id = input.data[nameof(VmodelPage.id)].ToString();
|
||||
var model = await _db.Queryable<VmodelPage>().FirstAsync(a => a.id == id);
|
||||
ThrowIf.IsNull(model, $"找不到id={id}的视图页面数据");
|
||||
input.data.Adapt(model, TypeAdapter.IgnoreNull);
|
||||
await _db.Updateable(model).WhereColumns(a => a.id).ExecuteCommandAsync();
|
||||
return model;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除 数据
|
||||
/// </summary>
|
||||
public override async Task<dynamic> DeleteAsync(VmDeleteInput input)
|
||||
{
|
||||
var ret = await _db.Deleteable<VmodelPage>(input.id).ExecuteCommandAsync();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从数据表创建模型
|
||||
/// </summary>
|
||||
public async Task<VmodelPage> CreateByVmodel(CreatePageFromVmodelInput input)
|
||||
public async Task<VmodelPage> CreateByVmodel(VmodelPageCreateFromVmodelInput input)
|
||||
{
|
||||
ThrowIf.IsNull(input.vmid);
|
||||
var vm = await _dataAccess.GetVmodelAsync(input.vmid);
|
||||
|
||||
@@ -101,6 +101,14 @@ public class DataAccess : IDataAccess, ITransient, IDisposable
|
||||
return model;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取 Vmodel 的缓存键
|
||||
/// </summary>
|
||||
public string GetVmodelCacheKey(string id)
|
||||
{
|
||||
return $"tnb.vmodel:{id}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取 Vmodel, 为空时不抛异常
|
||||
/// </summary>
|
||||
@@ -119,7 +127,7 @@ public class DataAccess : IDataAccess, ITransient, IDisposable
|
||||
/// </summary>
|
||||
public async Task<Vmodel> GetVmodelAsync(string id, bool loadNavigate = false)
|
||||
{
|
||||
var key = $"tnb.vmodel:{id}";
|
||||
var key = GetVmodelCacheKey(id);
|
||||
var vm = await _cache.GetAsync<Vmodel>(key);
|
||||
if (vm == null)
|
||||
{
|
||||
@@ -129,7 +137,7 @@ public class DataAccess : IDataAccess, ITransient, IDisposable
|
||||
{
|
||||
await LoadVmodelNavigateAsync(vm);
|
||||
}
|
||||
await _cache.SetAsync(id, vm, TimeSpan.FromMinutes(10));
|
||||
await _cache.SetAsync(key, vm, TimeSpan.FromMinutes(10));
|
||||
}
|
||||
return vm;
|
||||
}
|
||||
@@ -203,7 +211,6 @@ public class DataAccess : IDataAccess, ITransient, IDisposable
|
||||
ISqlSugarClient db = GetSqlSugar(vm.dbCode);
|
||||
ISugarQueryable<object> query = db.Queryable<object>().AS(vm.tableName, VmQueryParser.MAIN_ALIES);
|
||||
VmQueryParser parser = new(this, vm, input);
|
||||
parser.ParseQueryInput();
|
||||
await parser.LoadNavigateAsync();
|
||||
// 处理导航属性联表
|
||||
List<JoinInfoParameter> joins = parser.GetJoinInfos();
|
||||
@@ -312,7 +319,7 @@ public class DataAccess : IDataAccess, ITransient, IDisposable
|
||||
/// <summary>
|
||||
/// 新增数据 默认方法
|
||||
/// </summary>
|
||||
public async Task<dynamic> CreateDataAsync(Vmodel vm, VmCreateInput input)
|
||||
public async Task<dynamic> CreateDataAsync(Vmodel vm, VmEditInput input)
|
||||
{
|
||||
ISqlSugarClient db = GetSqlSugar(vm.dbCode);
|
||||
ThrowIf.When(input.data == null && input.items == null, "新增数据时,data和items不可同时为空");
|
||||
@@ -378,7 +385,7 @@ public class DataAccess : IDataAccess, ITransient, IDisposable
|
||||
/// <summary>
|
||||
/// 更新数据 默认方法
|
||||
/// </summary>
|
||||
public async Task<dynamic> UpdateDataAsync(Vmodel vm, VmUpdateInput input)
|
||||
public async Task<dynamic> UpdateDataAsync(Vmodel vm, VmEditInput input)
|
||||
{
|
||||
ISqlSugarClient db = GetSqlSugar(vm.dbCode);
|
||||
VmDbProp pk = vm.GetPrimary();
|
||||
@@ -387,14 +394,7 @@ public class DataAccess : IDataAccess, ITransient, IDisposable
|
||||
if (input.data != null)
|
||||
{
|
||||
DObject model = vm.ToUpdateEntity(input.data, _user);
|
||||
if (!model.ContainsKey(pk.field))
|
||||
{
|
||||
throw new Exception($"更新数据时主键({pk.code})不可为空");
|
||||
}
|
||||
//if (!model.ContainsKey(pk.field) && input.id != null)
|
||||
//{
|
||||
// model.Add(pk.field, input.id);
|
||||
//}
|
||||
ThrowIf.When(!model.ContainsKey(pk.field), $"更新数据时主键({pk.code})不可为空");
|
||||
num = await db.Updateable(model).AS(vm.tableName).WhereColumns(pk.field).ExecuteCommandAsync();
|
||||
}
|
||||
//批量修改数据
|
||||
|
||||
@@ -28,6 +28,11 @@ public interface IDataAccess : ITransient
|
||||
/// </summary>
|
||||
Task<Vmodel?> TryGetVmodelAsync(string id, bool loadNavigate = false);
|
||||
|
||||
/// <summary>
|
||||
/// 获取 Vmodel 的缓存键
|
||||
/// </summary>
|
||||
string GetVmodelCacheKey(string id);
|
||||
|
||||
/// <summary>
|
||||
/// 获取 Vmodel, 为空时抛异常
|
||||
/// </summary>
|
||||
@@ -54,13 +59,13 @@ public interface IDataAccess : ITransient
|
||||
/// <summary>
|
||||
/// 新增数据 默认方法
|
||||
/// </summary>
|
||||
Task<dynamic> CreateDataAsync(Vmodel vm, VmCreateInput input);
|
||||
Task<dynamic> CreateDataAsync(Vmodel vm, VmEditInput input);
|
||||
|
||||
//Task<dynamic> UpdateDataAsync(VmUpdateInput input);
|
||||
/// <summary>
|
||||
/// 更新数据 默认方法
|
||||
/// </summary>
|
||||
Task<dynamic> UpdateDataAsync(Vmodel vm, VmUpdateInput input);
|
||||
Task<dynamic> UpdateDataAsync(Vmodel vm, VmEditInput input);
|
||||
|
||||
//Task<int> DeleteDataAsync(VmDeleteInput input);
|
||||
/// <summary>
|
||||
|
||||
@@ -11,10 +11,10 @@ namespace Tnb.Vengine.Domain;
|
||||
|
||||
public class VmBaseInput
|
||||
{
|
||||
///// <summary>
|
||||
///// 视图模型id
|
||||
///// </summary>
|
||||
//public string vmid { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 附加参数
|
||||
/// </summary>
|
||||
public object? extra { get; set; }
|
||||
}
|
||||
|
||||
public class VmGetInput : VmBaseInput
|
||||
@@ -33,6 +33,7 @@ public class VmGetInput : VmBaseInput
|
||||
/// 输出字段
|
||||
/// </summary>
|
||||
public string o { get; set; } = "*";
|
||||
|
||||
}
|
||||
|
||||
public class VmGetListInput : VmBaseInput
|
||||
@@ -66,18 +67,6 @@ public class VmGetListInput : VmBaseInput
|
||||
/// 输出字段
|
||||
/// </summary>
|
||||
public string o { get; set; } = "*";
|
||||
|
||||
public VmQueryInput ToListInput()
|
||||
{
|
||||
VmQueryInput arg = this.Adapt<VmQueryInput>();
|
||||
|
||||
if (!string.IsNullOrEmpty(q))
|
||||
{
|
||||
arg.q = q.ToObject<DObject>();
|
||||
}
|
||||
|
||||
return arg;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -91,15 +80,31 @@ public class VmQueryInput : VmGetListInput
|
||||
public new DObject? q { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 高级查询
|
||||
/// 添加一个查询条件
|
||||
/// </summary>
|
||||
public DObject? adv { get; set; }
|
||||
/// <param name="key"></param>
|
||||
/// <param name="value"></param>
|
||||
public void AddQueryPara(string key, object value)
|
||||
{
|
||||
if (q == null) q = new DObject();
|
||||
q.Add(key, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加一个查询条件
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="value"></param>
|
||||
public void AddQueryParaIf(bool condition, string key, object value)
|
||||
{
|
||||
if(condition) AddQueryPara(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新增数据输入参数
|
||||
/// </summary>
|
||||
public class VmCreateInput : VmBaseInput
|
||||
public class VmEditInput : VmBaseInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据
|
||||
@@ -110,17 +115,11 @@ public class VmCreateInput : VmBaseInput
|
||||
/// 批量添加
|
||||
/// </summary>
|
||||
public List<DObject>? items { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改数据输入参数
|
||||
/// </summary>
|
||||
public class VmUpdateInput : VmCreateInput
|
||||
{
|
||||
///// <summary>
|
||||
///// 要更新的数据id
|
||||
///// </summary>
|
||||
//public string? id { get; set; }
|
||||
public virtual VmEditInput ToEditInput()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -139,14 +138,32 @@ public class VmDeleteInput : VmBaseInput
|
||||
public List<string>? ids { get; set; }
|
||||
}
|
||||
|
||||
public class PagedOutput
|
||||
{
|
||||
public int total { get; set; }
|
||||
public object? extra { get; set; }
|
||||
public static PagedOutput<T> Create<T>(int totalNum, List<T> ls)
|
||||
{
|
||||
return new PagedOutput<T>(totalNum, ls);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页列表输出对象
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class PagedOutput<T>
|
||||
public class PagedOutput<T> : PagedOutput
|
||||
{
|
||||
public int total { get; set; }
|
||||
public List<T> items { get; set; } = new List<T>();
|
||||
|
||||
public PagedOutput()
|
||||
{
|
||||
}
|
||||
public PagedOutput(int totalNum, List<T> ls)
|
||||
{
|
||||
total = totalNum;
|
||||
items = ls;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -154,18 +171,12 @@ public class PagedOutput<T>
|
||||
/// </summary>
|
||||
public class VmPagedOutput : PagedOutput<DObject>
|
||||
{
|
||||
public PagedOutput<T> ToPagedOutput<T>()
|
||||
{
|
||||
return new PagedOutput<T>()
|
||||
{
|
||||
total = total,
|
||||
items = items.Adapt<List<T>>()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// 查询属性信息
|
||||
///// </summary>
|
||||
//public class VmSelectProp
|
||||
//{
|
||||
// public const string MAIN_ALIES = "m";
|
||||
// public string code { get; set; } = string.Empty;
|
||||
// public string field { get; set; } = string.Empty;
|
||||
// public List<string> navPath { get; set; } = new List<string>();
|
||||
// public string navCode { get; set; } = MAIN_ALIES;
|
||||
// public ePropType propType { get; set; }
|
||||
// public eNavigateType navType { get; set; }
|
||||
//}
|
||||
@@ -24,11 +24,12 @@ internal class VmQueryParser
|
||||
_dataAccess = dataAccess;
|
||||
_root = rootModel;
|
||||
_input = input;
|
||||
ParseQueryInput();
|
||||
}
|
||||
/// <summary>
|
||||
/// 解析查询参数
|
||||
/// </summary>
|
||||
public void ParseQueryInput()
|
||||
private void ParseQueryInput()
|
||||
{
|
||||
// 初始化根模型
|
||||
Navigates.Clear();
|
||||
@@ -56,9 +57,9 @@ internal class VmQueryParser
|
||||
{
|
||||
// t1.t2.id
|
||||
List<string> outputs = output.Split(',').Distinct().ToList();
|
||||
foreach (string? outStr in outputs)
|
||||
foreach (string? s in outputs)
|
||||
{
|
||||
_ = ClearStr(outStr);
|
||||
var outStr = ClearStr(s);
|
||||
if (string.IsNullOrWhiteSpace(outStr))
|
||||
{
|
||||
continue;
|
||||
@@ -126,15 +127,15 @@ internal class VmQueryParser
|
||||
}
|
||||
|
||||
string[] orders = sort.Split(',');
|
||||
foreach (string orderStr in orders)
|
||||
foreach (string s in orders)
|
||||
{
|
||||
_ = ClearStr(orderStr);
|
||||
var orderStr = ClearStr(s);
|
||||
if (string.IsNullOrWhiteSpace(orderStr))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// 拆分 m.code desc
|
||||
string[] codes = orderStr.Split(' ', 1);
|
||||
string[] codes = orderStr.Split(' ', 2);
|
||||
// 拆分 m.code
|
||||
(string?, string) orderPath = codes[0].GetParent(NAVI_SEPERATE);
|
||||
orderPath.Item1 ??= MAIN_ALIES;
|
||||
@@ -263,6 +264,92 @@ internal class VmQueryParser
|
||||
/// <param name="filter"></param>
|
||||
/// <returns></returns>
|
||||
public List<IConditionalModel> GetConditionalModels()
|
||||
{
|
||||
List<IConditionalModel> wheres = new();
|
||||
// 处理软删除
|
||||
var softDeletedProp = _root.GetSoftDeleted();
|
||||
if (softDeletedProp != null && !Navigates[MAIN_ALIES].wheres.Any(a => a.code == softDeletedProp.code))
|
||||
{
|
||||
wheres.Add(new ConditionalModel { FieldName = MAIN_ALIES + "." + softDeletedProp.field, FieldValue = "0", ConditionalType = ConditionalType.Equal, CSharpTypeName = softDeletedProp.csType });
|
||||
}
|
||||
|
||||
foreach (VmNavigate? nav in Navigates.Values.Where(a => (a.path == MAIN_ALIES || a.navConfig.navType == eNavigateType.OneToOne) && a.wheres.Count > 0))
|
||||
{
|
||||
foreach (VmWhereProp where in nav.wheres)
|
||||
{
|
||||
// 当条件为集合数据时
|
||||
if (where.value is IEnumerable<object> arrObj)
|
||||
{
|
||||
object[] val = arrObj.ToArray();
|
||||
string op = val[0].ToString()!;
|
||||
switch (op)
|
||||
{
|
||||
case "><":
|
||||
wheres.Add(new ConditionalModel { FieldName = where.fieldName, FieldValue = val[1].ToString(), ConditionalType = ConditionalType.GreaterThan, CSharpTypeName = where.csType });
|
||||
wheres.Add(new ConditionalModel { FieldName = where.fieldName, FieldValue = val[2].ToString(), ConditionalType = ConditionalType.LessThan, CSharpTypeName = where.csType });
|
||||
break;
|
||||
case ">=<":
|
||||
wheres.Add(new ConditionalModel { FieldName = where.fieldName, FieldValue = val[1].ToString(), ConditionalType = ConditionalType.GreaterThanOrEqual, CSharpTypeName = where.csType });
|
||||
wheres.Add(new ConditionalModel { FieldName = where.fieldName, FieldValue = val[2].ToString(), ConditionalType = ConditionalType.LessThan, CSharpTypeName = where.csType });
|
||||
break;
|
||||
case "><=":
|
||||
wheres.Add(new ConditionalModel { FieldName = where.fieldName, FieldValue = val[1].ToString(), ConditionalType = ConditionalType.GreaterThan, CSharpTypeName = where.csType });
|
||||
wheres.Add(new ConditionalModel { FieldName = where.fieldName, FieldValue = val[2].ToString(), ConditionalType = ConditionalType.LessThanOrEqual, CSharpTypeName = where.csType });
|
||||
break;
|
||||
case ">=<=":
|
||||
wheres.Add(new ConditionalModel { FieldName = where.fieldName, FieldValue = val[1].ToString(), ConditionalType = ConditionalType.GreaterThanOrEqual, CSharpTypeName = where.csType });
|
||||
wheres.Add(new ConditionalModel { FieldName = where.fieldName, FieldValue = val[2].ToString(), ConditionalType = ConditionalType.LessThanOrEqual, CSharpTypeName = where.csType });
|
||||
break;
|
||||
case "in":
|
||||
wheres.Add(new ConditionalModel { FieldName = where.fieldName, FieldValue = string.Join(',', val.Skip(1)), ConditionalType = ConditionalType.In, CSharpTypeName = where.csType });
|
||||
break;
|
||||
default: op = string.Empty; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ConditionalType conditionalType = ConditionalType.Equal;
|
||||
string? value = where.value?.ToString();
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (value.Length >= 2)
|
||||
{
|
||||
string op = value[..2];
|
||||
switch (op)
|
||||
{
|
||||
case "%%": conditionalType = ConditionalType.Like; break;
|
||||
case ">>": conditionalType = ConditionalType.GreaterThan; break;
|
||||
case "<<": conditionalType = ConditionalType.LessThan; break;
|
||||
case ">=": conditionalType = ConditionalType.GreaterThanOrEqual; break;
|
||||
case "<=": conditionalType = ConditionalType.LessThanOrEqual; break;
|
||||
case "==": conditionalType = ConditionalType.Equal; break;
|
||||
default: op = string.Empty; break;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(op))
|
||||
{
|
||||
value = value.RemovePreFix(op);
|
||||
if (value.ToLower() == "null")
|
||||
{
|
||||
value = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
wheres.Add(new ConditionalModel { FieldName = where.fieldName, FieldValue = value, ConditionalType = conditionalType, CSharpTypeName = where.csType });
|
||||
}
|
||||
}
|
||||
}
|
||||
return wheres;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成查询过滤条件
|
||||
/// </summary>
|
||||
/// <param name="filter"></param>
|
||||
/// <returns></returns>
|
||||
public List<IConditionalModel> FilterSofeDeleted()
|
||||
{
|
||||
List<IConditionalModel> wheres = new();
|
||||
foreach (VmNavigate? nav in Navigates.Values.Where(a => (a.path == MAIN_ALIES || a.navConfig.navType == eNavigateType.OneToOne) && a.wheres.Count > 0))
|
||||
|
||||
@@ -7,10 +7,10 @@ using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Reflection;
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Extension;
|
||||
using Mapster;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SqlSugar;
|
||||
using Tnb.Core;
|
||||
using Yitter.IdGenerator;
|
||||
@@ -23,6 +23,8 @@ namespace Tnb.Vengine.Domain;
|
||||
[SugarTable("sys_vmodel")]
|
||||
public partial class Vmodel : Entity
|
||||
{
|
||||
private static string[] SOFT_DELETED = new string[] { "deleted", "isDeleted", "softDeleted" };
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
@@ -86,7 +88,7 @@ public partial class Vmodel : Entity
|
||||
public int ordinal { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 软删除
|
||||
/// 是否软删除
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "soft_delete", IsNullable = false)]
|
||||
public short softDelete { get; set; }
|
||||
@@ -101,7 +103,7 @@ public partial class Vmodel : Entity
|
||||
/// 是否删除
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "deleted", IsNullable = false)]
|
||||
public short deleted { get; set; }
|
||||
public short deleted { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 描述
|
||||
@@ -134,8 +136,7 @@ public partial class Vmodel : Entity
|
||||
public string? modifyId { get; set; }
|
||||
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public string fullCode
|
||||
{ get { return areaCode + "/" + vmCode; } }
|
||||
public string fullCode => areaCode + "/" + vmCode;
|
||||
|
||||
/// <summary>
|
||||
/// 主键
|
||||
@@ -157,7 +158,7 @@ public partial class Vmodel : Entity
|
||||
public static Vmodel CreateByEntity(Type tpEntity, string? dbCode = null)
|
||||
{
|
||||
Vmodel model = new() { dbCode = dbCode, vmCode = tpEntity.Name };
|
||||
var sugarTableAttr = tpEntity.GetCustomAttribute<SugarTable>();
|
||||
SugarTable? sugarTableAttr = tpEntity.GetCustomAttribute<SugarTable>();
|
||||
if (sugarTableAttr != null)
|
||||
{
|
||||
model.tableName = sugarTableAttr.TableName;
|
||||
@@ -171,12 +172,12 @@ public partial class Vmodel : Entity
|
||||
{
|
||||
model.vmName = tpEntity.GetCustomAttribute<DisplayAttribute>()?.Name ?? tpEntity.GetCustomAttribute<DescriptionAttribute>()?.Description ?? model.vmCode;
|
||||
}
|
||||
var props = tpEntity.GetProperties(BindingFlags.Public);
|
||||
PropertyInfo[] props = tpEntity.GetProperties(BindingFlags.Public);
|
||||
int n = 1;
|
||||
foreach (var p in props)
|
||||
foreach (PropertyInfo p in props)
|
||||
{
|
||||
VmDbProp prop = new();
|
||||
var sugarColumn = p.GetCustomAttribute<SugarColumn>();
|
||||
SugarColumn? sugarColumn = p.GetCustomAttribute<SugarColumn>();
|
||||
if (sugarColumn != null)
|
||||
{
|
||||
prop = sugarColumn.Adapt<VmDbProp>();
|
||||
@@ -189,12 +190,23 @@ public partial class Vmodel : Entity
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取模型的主键字段属性
|
||||
/// 获取模型的主键属性
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public VmDbProp GetPrimary()
|
||||
{
|
||||
return dbProps.First(a => a.pkey);
|
||||
var key = dbProps.FirstOrDefault(a => a.pkey);
|
||||
ThrowIf.IsNull(key, $"模型({fullCode})没有定义主键属性");
|
||||
return key;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取模型的软删除属性
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public VmDbProp? GetSoftDeleted()
|
||||
{
|
||||
return dbProps.FirstOrDefault(a => SOFT_DELETED.Contains(a.code));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -204,10 +216,7 @@ public partial class Vmodel : Entity
|
||||
/// <returns></returns>
|
||||
public string? PropToFieldCode(string propCode)
|
||||
{
|
||||
if(_mapProps == null)
|
||||
{
|
||||
_mapProps = dbProps.ToDictionary(a=>a.code);
|
||||
}
|
||||
_mapProps ??= dbProps.ToDictionary(a => a.code);
|
||||
return _mapProps.GetOrDefault(propCode)?.field;
|
||||
}
|
||||
|
||||
@@ -219,10 +228,7 @@ public partial class Vmodel : Entity
|
||||
/// <returns></returns>
|
||||
public VmDbProp? GetDbProp(string propCode)
|
||||
{
|
||||
if (_mapProps == null)
|
||||
{
|
||||
_mapProps = dbProps.ToDictionary(a => a.code);
|
||||
}
|
||||
_mapProps ??= dbProps.ToDictionary(a => a.code);
|
||||
return _mapProps.GetOrDefault(propCode);
|
||||
}
|
||||
|
||||
@@ -232,8 +238,8 @@ public partial class Vmodel : Entity
|
||||
/// <returns></returns>
|
||||
public DObject GetDefaultDObject()
|
||||
{
|
||||
DObject obj = new();
|
||||
foreach (var p in dbProps)
|
||||
DObject obj = new ();
|
||||
foreach (VmDbProp p in dbProps)
|
||||
{
|
||||
obj.Add(p.code, p.GetDefaultValue()!);
|
||||
}
|
||||
@@ -246,8 +252,8 @@ public partial class Vmodel : Entity
|
||||
/// <returns></returns>
|
||||
public DObject ToCreateEntity(DObject input, IUserManager user)
|
||||
{
|
||||
DObject obj = new();
|
||||
foreach (var p in dbProps)
|
||||
DObject obj = new ();
|
||||
foreach (VmDbProp p in dbProps)
|
||||
{
|
||||
if (input.ContainsKey(p.code))
|
||||
{
|
||||
@@ -280,8 +286,8 @@ public partial class Vmodel : Entity
|
||||
/// <returns></returns>
|
||||
public DObject ToUpdateEntity(DObject input, IUserManager user)
|
||||
{
|
||||
DObject obj = new();
|
||||
foreach (var p in dbProps)
|
||||
DObject obj = new ();
|
||||
foreach (VmDbProp p in dbProps)
|
||||
{
|
||||
if (input.ContainsKey(p.code))
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// https://git.tuotong-tech.com/tnb/tnb.server //
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using JNPF.Common.Contracts;
|
||||
using SqlSugar;
|
||||
using Yitter.IdGenerator;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// https://git.tuotong-tech.com/tnb/tnb.server //
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using JNPF.Common.Contracts;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SqlSugar;
|
||||
using Yitter.IdGenerator;
|
||||
|
||||
Reference in New Issue
Block a user