去除引用common.props
This commit is contained in:
@@ -3,7 +3,6 @@ using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
@@ -11,7 +10,6 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.BasicData.Entities.Dto;
|
||||
using Tnb.BasicData.Entitys.Dto.BasProcess;
|
||||
using Tnb.BasicData.Interfaces;
|
||||
|
||||
namespace Tnb.BasicData
|
||||
@@ -22,23 +20,22 @@ namespace Tnb.BasicData
|
||||
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 1102)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
[OverideVisualDev(ModelId)]
|
||||
public class BasEbomService : IBasEbomService,IOverideVisualDevService,IDynamicApiController, ITransient
|
||||
public class BasEbomService : IBasEbomService, IOverideVisualDevService, IDynamicApiController, ITransient
|
||||
{
|
||||
public const string ModelId = "25487105536805";
|
||||
private readonly ISqlSugarRepository<BasMaterial> _repository;
|
||||
private readonly DataBaseManager _dbManager;
|
||||
private readonly IDictionaryDataService _dictionaryDataService;
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
|
||||
|
||||
public BasEbomService(
|
||||
ISqlSugarRepository<BasMaterial> repository,DataBaseManager dbManager,IDictionaryDataService dictionaryDataService)
|
||||
ISqlSugarRepository<BasMaterial> repository, DataBaseManager dbManager, IDictionaryDataService dictionaryDataService)
|
||||
{
|
||||
_repository = repository;
|
||||
_dbManager = dbManager;
|
||||
_dictionaryDataService = dictionaryDataService;
|
||||
OverideFuncs.GetListAsync = GetList;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 物料清单列表
|
||||
@@ -47,15 +44,15 @@ namespace Tnb.BasicData
|
||||
/// <returns></returns>
|
||||
public async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
Dictionary<string, object>? queryJson = (input==null || string.IsNullOrEmpty(input.queryJson)) ? null : input.queryJson.ToObject<Dictionary<string, object>>();
|
||||
ISqlSugarClient db = _repository.AsSugarClient();
|
||||
Dictionary<string, object>? queryJson = (input == null || string.IsNullOrEmpty(input.queryJson)) ? null : input.queryJson.ToObject<Dictionary<string, object>>();
|
||||
string materialInfo = queryJson?["query_info"]?.ToString() ?? "";
|
||||
var list = await db.Queryable<BasEbomH, BasMaterial, BasRouteH>((a, b, c) => new object[]
|
||||
SqlSugarPagedList<EbomListOutput> list = await db.Queryable<BasEbomH, BasMaterial, BasRouteH>((a, b, c) => new object[]
|
||||
{
|
||||
JoinType.Left, a.material_id == b.id,
|
||||
JoinType.Left, a.route_id == c.id,
|
||||
})
|
||||
.WhereIF(!string.IsNullOrEmpty(materialInfo),(a,b,c)=>b.code.Contains(materialInfo) || b.name.Contains(materialInfo))
|
||||
.WhereIF(!string.IsNullOrEmpty(materialInfo), (a, b, c) => b.code.Contains(materialInfo) || b.name.Contains(materialInfo))
|
||||
.Select((a, b, c) => new EbomListOutput
|
||||
{
|
||||
id = a.id,
|
||||
@@ -67,12 +64,11 @@ namespace Tnb.BasicData
|
||||
version = a.version,
|
||||
route_id = c.name,
|
||||
route_id_id = c.id,
|
||||
}).ToPagedListAsync(input?.currentPage ?? 1, input?.pageSize ?? 50);
|
||||
|
||||
}).ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50));
|
||||
|
||||
return PageResult<EbomListOutput>.SqlSugarPageResult(list);
|
||||
return PageResult<EbomListOutput>.SqlSugarPageResult(list);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取物料清单树.
|
||||
/// </summary>
|
||||
@@ -80,9 +76,9 @@ namespace Tnb.BasicData
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetTree(EbomTreeQueryInput queryInput)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
var dic = await _dictionaryDataService.GetDicByKey(DictConst.MeasurementUnit);
|
||||
|
||||
ISqlSugarClient db = _repository.AsSugarClient();
|
||||
Dictionary<string, object> dic = await _dictionaryDataService.GetDicByKey(DictConst.MeasurementUnit);
|
||||
|
||||
// var momDbLink = await _repository.AsSugarClient().Queryable<DbLinkEntity>().FirstAsync(x => x.FullName == DbName.TNBMON);
|
||||
// if (momDbLink != null)
|
||||
// {
|
||||
@@ -91,14 +87,14 @@ namespace Tnb.BasicData
|
||||
|
||||
if (string.IsNullOrEmpty(queryInput.materialId))
|
||||
{
|
||||
var data = await db.Queryable<BasEbomD>()
|
||||
.LeftJoin<BasEbomH>((a,b)=>a.ebom_id==b.id)
|
||||
.LeftJoin<BasMaterial>((a,b,c)=>a.material_id==c.id)
|
||||
.LeftJoin<BasEbomH>((a,b,c,d)=>a.material_id==d.material_id)
|
||||
.LeftJoin<BasRouteH>((a,b,c,d,e)=>d.route_id==e.id)
|
||||
.LeftJoin<BasMaterial>((a,b,c,d,e,f)=>a.substitute_material_id==f.id)
|
||||
.Where((a,b,c)=>a.ebom_id==queryInput.ebomId)
|
||||
.Select((a,b,c,d,e,f)=>new EbomTreeOutput
|
||||
List<EbomTreeOutput> data = await db.Queryable<BasEbomD>()
|
||||
.LeftJoin<BasEbomH>((a, b) => a.ebom_id == b.id)
|
||||
.LeftJoin<BasMaterial>((a, b, c) => a.material_id == c.id)
|
||||
.LeftJoin<BasEbomH>((a, b, c, d) => a.material_id == d.material_id)
|
||||
.LeftJoin<BasRouteH>((a, b, c, d, e) => d.route_id == e.id)
|
||||
.LeftJoin<BasMaterial>((a, b, c, d, e, f) => a.substitute_material_id == f.id)
|
||||
.Where((a, b, c) => a.ebom_id == queryInput.ebomId)
|
||||
.Select((a, b, c, d, e, f) => new EbomTreeOutput
|
||||
{
|
||||
material_id = c.name,
|
||||
material_id_descrip = c.descrip,
|
||||
@@ -112,7 +108,7 @@ namespace Tnb.BasicData
|
||||
route_name = e.name,
|
||||
version = d.version,
|
||||
substitute_material_id = f.name,
|
||||
hasChildren = SqlFunc.Subqueryable<BasEbomH>().Where(x=>x.material_id==a.material_id).Any(),
|
||||
hasChildren = SqlFunc.Subqueryable<BasEbomH>().Where(x => x.material_id == a.material_id).Any(),
|
||||
}).Mapper(it =>
|
||||
{
|
||||
it.material_id_unit_id = !string.IsNullOrEmpty(it.material_id_unit_id) ? dic[it.material_id_unit_id].ToString() : "";
|
||||
@@ -121,14 +117,14 @@ namespace Tnb.BasicData
|
||||
}
|
||||
else
|
||||
{
|
||||
var data = await db.Queryable<BasEbomD>()
|
||||
.LeftJoin<BasEbomH>((a,b)=>a.ebom_id==b.id)
|
||||
.LeftJoin<BasMaterial>((a,b,c)=>a.material_id==c.id)
|
||||
.LeftJoin<BasEbomH>((a,b,c,d)=>a.material_id==d.material_id)
|
||||
.LeftJoin<BasRouteH>((a,b,c,d,e)=>d.route_id==e.id)
|
||||
.LeftJoin<BasMaterial>((a,b,c,d,e,f)=>a.substitute_material_id==f.id)
|
||||
.Where((a,b,c)=>b.material_id==queryInput.materialId && a.ebom_id==b.id)
|
||||
.Select((a,b,c,d,e,f)=>new EbomTreeOutput
|
||||
List<EbomTreeOutput> data = await db.Queryable<BasEbomD>()
|
||||
.LeftJoin<BasEbomH>((a, b) => a.ebom_id == b.id)
|
||||
.LeftJoin<BasMaterial>((a, b, c) => a.material_id == c.id)
|
||||
.LeftJoin<BasEbomH>((a, b, c, d) => a.material_id == d.material_id)
|
||||
.LeftJoin<BasRouteH>((a, b, c, d, e) => d.route_id == e.id)
|
||||
.LeftJoin<BasMaterial>((a, b, c, d, e, f) => a.substitute_material_id == f.id)
|
||||
.Where((a, b, c) => b.material_id == queryInput.materialId && a.ebom_id == b.id)
|
||||
.Select((a, b, c, d, e, f) => new EbomTreeOutput
|
||||
{
|
||||
material_id = c.name,
|
||||
material_id_descrip = c.descrip,
|
||||
@@ -142,15 +138,13 @@ namespace Tnb.BasicData
|
||||
route_name = e.name,
|
||||
version = d.version,
|
||||
substitute_material_id = f.name,
|
||||
hasChildren = SqlFunc.Subqueryable<BasEbomH>().Where(x=>x.material_id==a.material_id).Any(),
|
||||
hasChildren = SqlFunc.Subqueryable<BasEbomH>().Where(x => x.material_id == a.material_id).Any(),
|
||||
}).Mapper(it =>
|
||||
{
|
||||
it.material_id_unit_id = !string.IsNullOrEmpty(it.material_id_unit_id) ? dic[it.material_id_unit_id].ToString() : "";
|
||||
}).ToListAsync();
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -159,11 +153,11 @@ namespace Tnb.BasicData
|
||||
/// <param name="parameters">物料id materialId</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<Dictionary<string,string>> GetEbomVersionAndRouteName(Dictionary<string,string> parameters)
|
||||
public async Task<Dictionary<string, string>> GetEbomVersionAndRouteName(Dictionary<string, string> parameters)
|
||||
{
|
||||
string materialId = parameters["materialId"];
|
||||
var db = _repository.AsSugarClient();
|
||||
|
||||
ISqlSugarClient db = _repository.AsSugarClient();
|
||||
|
||||
// var momDbLink = await _repository.AsSugarClient().Queryable<DbLinkEntity>().FirstAsync(x => x.FullName == DbName.TNBMON);
|
||||
// if (momDbLink != null)
|
||||
// {
|
||||
@@ -171,16 +165,16 @@ namespace Tnb.BasicData
|
||||
// }
|
||||
|
||||
var ebom = await db.Queryable<BasEbomH>()
|
||||
.LeftJoin<BasRouteH>((a,b)=>a.route_id==b.id)
|
||||
.OrderByDescending((a,b)=>a.create_time)
|
||||
.Where((a,b) => a.material_id == materialId)
|
||||
.Select((a,b)=>new
|
||||
.LeftJoin<BasRouteH>((a, b) => a.route_id == b.id)
|
||||
.OrderByDescending((a, b) => a.create_time)
|
||||
.Where((a, b) => a.material_id == materialId)
|
||||
.Select((a, b) => new
|
||||
{
|
||||
a.id,
|
||||
a.version,
|
||||
b.name,
|
||||
}).FirstAsync();
|
||||
return new Dictionary<string,string>()
|
||||
return new Dictionary<string, string>()
|
||||
{
|
||||
["version"] = ebom?.version ?? "",
|
||||
["routeName"] = ebom?.name ?? "",
|
||||
|
||||
Reference in New Issue
Block a user