物料清单 生产bom添加物料查询
This commit is contained in:
@@ -0,0 +1,30 @@
|
|||||||
|
namespace Tnb.BasicData.Entities.Dto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 物料清单列表输出类
|
||||||
|
/// </summary>
|
||||||
|
public class EbomListOutput
|
||||||
|
{
|
||||||
|
public string id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 物料编码-物料名称
|
||||||
|
/// </summary>
|
||||||
|
public string material_id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 物料id
|
||||||
|
/// </summary>
|
||||||
|
public string material_id_id { get; set; }
|
||||||
|
public string status { get; set; }
|
||||||
|
public string descrip { get; set; }
|
||||||
|
public string unit_id { get; set; }
|
||||||
|
public string version { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 工艺路线名称
|
||||||
|
/// </summary>
|
||||||
|
public string route_id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 工艺路线id
|
||||||
|
/// </summary>
|
||||||
|
public string route_id_id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
namespace Tnb.BasicData.Entities.Dto
|
||||||
|
{
|
||||||
|
public class MbomListOutput
|
||||||
|
{
|
||||||
|
public string id { get; set; }
|
||||||
|
public string ebom_id { get; set; }
|
||||||
|
public string num { get; set; }
|
||||||
|
public string unit_id { get; set; }
|
||||||
|
public string version { get; set; }
|
||||||
|
public string start_time { get; set; }
|
||||||
|
public string end_time { get; set; }
|
||||||
|
public string material_id { get; set; }
|
||||||
|
public string material_id_id { get; set; }
|
||||||
|
public string route_id { get; set; }
|
||||||
|
public string route_id_id { get; set; }
|
||||||
|
public string is_first { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -117,6 +117,14 @@ namespace Tnb.BasicData.Entities
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnName="modify_id")]
|
[SugarColumn(ColumnName="modify_id")]
|
||||||
public string modify_id {get;set;}
|
public string modify_id {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:仅用于关联表字段查询用不存储数据
|
||||||
|
/// Default:NULL::character varying
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName="query_info")]
|
||||||
|
public string query_info {get;set;}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,5 +125,12 @@ namespace Tnb.BasicData.Entities
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string modify_id {get;set;}
|
public string modify_id {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:仅用于关联表字段查询用不存储数据
|
||||||
|
/// Default:NULL::character varying
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName="query_info")]
|
||||||
|
public string query_info {get;set;}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\common\Tnb.Common\Tnb.Common.csproj" />
|
<ProjectReference Include="..\..\common\Tnb.Common\Tnb.Common.csproj" />
|
||||||
|
<ProjectReference Include="..\..\visualdev\Tnb.VisualDev.Entitys\Tnb.VisualDev.Entitys.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,11 +1,17 @@
|
|||||||
using JNPF.Common.Core.Manager;
|
using JNPF.Common.Core.Manager;
|
||||||
|
using JNPF.Common.Filter;
|
||||||
|
using JNPF.Common.Security;
|
||||||
using JNPF.DependencyInjection;
|
using JNPF.DependencyInjection;
|
||||||
using JNPF.DynamicApiController;
|
using JNPF.DynamicApiController;
|
||||||
|
using JNPF.Systems.Entitys.Permission;
|
||||||
using JNPF.Systems.Interfaces.System;
|
using JNPF.Systems.Interfaces.System;
|
||||||
|
using JNPF.VisualDev;
|
||||||
|
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.BasicData.Entities;
|
using Tnb.BasicData.Entities;
|
||||||
using Tnb.BasicData.Entities.Dto;
|
using Tnb.BasicData.Entities.Dto;
|
||||||
|
using Tnb.BasicData.Entitys.Dto.BasProcess;
|
||||||
using Tnb.BasicData.Interfaces;
|
using Tnb.BasicData.Interfaces;
|
||||||
|
|
||||||
namespace Tnb.BasicData
|
namespace Tnb.BasicData
|
||||||
@@ -15,11 +21,14 @@ namespace Tnb.BasicData
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 1102)]
|
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 1102)]
|
||||||
[Route("api/[area]/[controller]/[action]")]
|
[Route("api/[area]/[controller]/[action]")]
|
||||||
public class BasEbomService : IBasEbomService,IDynamicApiController, ITransient
|
[OverideVisualDev(ModelId)]
|
||||||
|
public class BasEbomService : IBasEbomService,IOverideVisualDevService,IDynamicApiController, ITransient
|
||||||
{
|
{
|
||||||
|
public const string ModelId = "25487105536805";
|
||||||
private readonly ISqlSugarRepository<BasMaterial> _repository;
|
private readonly ISqlSugarRepository<BasMaterial> _repository;
|
||||||
private readonly DataBaseManager _dbManager;
|
private readonly DataBaseManager _dbManager;
|
||||||
private readonly IDictionaryDataService _dictionaryDataService;
|
private readonly IDictionaryDataService _dictionaryDataService;
|
||||||
|
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||||
|
|
||||||
public BasEbomService(
|
public BasEbomService(
|
||||||
ISqlSugarRepository<BasMaterial> repository,DataBaseManager dbManager,IDictionaryDataService dictionaryDataService)
|
ISqlSugarRepository<BasMaterial> repository,DataBaseManager dbManager,IDictionaryDataService dictionaryDataService)
|
||||||
@@ -27,6 +36,40 @@ namespace Tnb.BasicData
|
|||||||
_repository = repository;
|
_repository = repository;
|
||||||
_dbManager = dbManager;
|
_dbManager = dbManager;
|
||||||
_dictionaryDataService = dictionaryDataService;
|
_dictionaryDataService = dictionaryDataService;
|
||||||
|
OverideFuncs.GetListAsync = GetList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料清单列表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||||
|
{
|
||||||
|
var db = _repository.AsSugarClient();
|
||||||
|
Dictionary<string, object> queryJson = 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[]
|
||||||
|
{
|
||||||
|
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))
|
||||||
|
.Select((a, b, c) => new EbomListOutput
|
||||||
|
{
|
||||||
|
id = a.id,
|
||||||
|
material_id = b.code + "-" + b.name,
|
||||||
|
material_id_id = b.id,
|
||||||
|
status = SqlFunc.IIF(a.status == "0", "禁用", "启用"),
|
||||||
|
descrip = a.descrip,
|
||||||
|
version = a.version,
|
||||||
|
route_id = c.name,
|
||||||
|
route_id_id = c.id,
|
||||||
|
|
||||||
|
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||||
|
|
||||||
|
return PageResult<EbomListOutput>.SqlSugarPageResult(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
using JNPF.Common.Core.Manager;
|
using JNPF.Common.Core.Manager;
|
||||||
|
using JNPF.Common.Filter;
|
||||||
using JNPF.Common.Security;
|
using JNPF.Common.Security;
|
||||||
using JNPF.DependencyInjection;
|
using JNPF.DependencyInjection;
|
||||||
using JNPF.DynamicApiController;
|
using JNPF.DynamicApiController;
|
||||||
using JNPF.Systems.Interfaces.System;
|
using JNPF.Systems.Interfaces.System;
|
||||||
using JNPF.VisualDev;
|
using JNPF.VisualDev;
|
||||||
|
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.BasicData.Entities;
|
using Tnb.BasicData.Entities;
|
||||||
@@ -18,7 +20,7 @@ namespace Tnb.BasicData
|
|||||||
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 1102)]
|
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 1102)]
|
||||||
[Route("api/[area]/[controller]/[action]")]
|
[Route("api/[area]/[controller]/[action]")]
|
||||||
[OverideVisualDev(ModelId)]
|
[OverideVisualDev(ModelId)]
|
||||||
public class BasMbomService : IBasMbomService,IDynamicApiController, ITransient
|
public class BasMbomService : IBasMbomService,IOverideVisualDevService,IDynamicApiController, ITransient
|
||||||
{
|
{
|
||||||
public const string ModelId = "25574817510421";
|
public const string ModelId = "25574817510421";
|
||||||
private readonly ISqlSugarRepository<BasMbom> _repository;
|
private readonly ISqlSugarRepository<BasMbom> _repository;
|
||||||
@@ -37,7 +39,42 @@ namespace Tnb.BasicData
|
|||||||
_dbManager = dbManager;
|
_dbManager = dbManager;
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
_dictionaryDataService = dictionaryDataService;
|
_dictionaryDataService = dictionaryDataService;
|
||||||
OverideFuncs.GetAsync = GetInfo;
|
// OverideFuncs.GetAsync = GetInfo;
|
||||||
|
OverideFuncs.GetListAsync = GetList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生产bom列表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||||
|
{
|
||||||
|
var db = _repository.AsSugarClient();
|
||||||
|
Dictionary<string, object> queryJson = string.IsNullOrEmpty(input.queryJson) ? null : input.queryJson.ToObject<Dictionary<string, object>>();
|
||||||
|
string materialInfo = queryJson?["query_info"]?.ToString();
|
||||||
|
var list = await db.Queryable<BasMbom, BasMaterial, BasEbomH, BasRouteH>((a, b, c,d) => new object[]
|
||||||
|
{
|
||||||
|
JoinType.Left, a.material_id == b.id,
|
||||||
|
JoinType.Left, a.ebom_id == c.id,
|
||||||
|
JoinType.Left, a.route_id == d.id,
|
||||||
|
})
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(materialInfo),(a,b,c,d)=>b.code.Contains(materialInfo) || b.name.Contains(materialInfo))
|
||||||
|
.Select((a, b, c,d) => new MbomListOutput
|
||||||
|
{
|
||||||
|
id = a.id,
|
||||||
|
material_id = b.code + "-" + b.name,
|
||||||
|
material_id_id = b.id,
|
||||||
|
version = a.version,
|
||||||
|
ebom_id = c.version,
|
||||||
|
route_id = d.name,
|
||||||
|
route_id_id = c.id,
|
||||||
|
start_time = a.start_time.Value.ToString("yyyy-MM-dd"),
|
||||||
|
end_time = a.start_time.Value.ToString("yyyy-MM-dd"),
|
||||||
|
is_first = SqlFunc.IIF(a.is_first==0 , "否","是"),
|
||||||
|
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||||
|
|
||||||
|
return PageResult<MbomListOutput>.SqlSugarPageResult(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -136,6 +173,7 @@ namespace Tnb.BasicData
|
|||||||
preparation_time = process.preparation_time,
|
preparation_time = process.preparation_time,
|
||||||
station = process.station,
|
station = process.station,
|
||||||
byproduct_status = process.byproduct_status,
|
byproduct_status = process.byproduct_status,
|
||||||
|
production_method = process.production_method,
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -225,35 +263,42 @@ namespace Tnb.BasicData
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
foreach (var input in process.inputs)
|
if (process.inputs != null)
|
||||||
{
|
{
|
||||||
string inputId = SnowflakeIdHelper.NextId();
|
foreach (var input in process.inputs)
|
||||||
inputs.Add(new BasMbomInput()
|
|
||||||
{
|
{
|
||||||
id = inputId,
|
string inputId = SnowflakeIdHelper.NextId();
|
||||||
mbom_id = mbomSaveDataInput.id,
|
inputs.Add(new BasMbomInput()
|
||||||
mbom_process_id = mbomProcessId,
|
{
|
||||||
process_id = process.process_id,
|
id = inputId,
|
||||||
material_id = input.material_id,
|
mbom_id = mbomSaveDataInput.id,
|
||||||
num = input.num,
|
mbom_process_id = mbomProcessId,
|
||||||
org_id = orgId,
|
process_id = process.process_id,
|
||||||
});
|
material_id = input.material_id,
|
||||||
|
num = input.num,
|
||||||
|
org_id = orgId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.outputs != null)
|
||||||
|
{
|
||||||
|
foreach (var output in process.outputs)
|
||||||
|
{
|
||||||
|
string outputId = SnowflakeIdHelper.NextId();
|
||||||
|
outputs.Add(new BasMbomOutput()
|
||||||
|
{
|
||||||
|
id = outputId,
|
||||||
|
mbom_id = mbomSaveDataInput.id,
|
||||||
|
mbom_process_id = mbomProcessId,
|
||||||
|
process_id = process.process_id,
|
||||||
|
material_id = output.material_id,
|
||||||
|
num = output.num,
|
||||||
|
org_id = orgId,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var output in process.outputs)
|
|
||||||
{
|
|
||||||
string outputId = SnowflakeIdHelper.NextId();
|
|
||||||
outputs.Add(new BasMbomOutput()
|
|
||||||
{
|
|
||||||
id = outputId,
|
|
||||||
mbom_id = mbomSaveDataInput.id,
|
|
||||||
mbom_process_id = mbomProcessId,
|
|
||||||
process_id = process.process_id,
|
|
||||||
material_id = output.material_id,
|
|
||||||
num = output.num,
|
|
||||||
org_id = orgId,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await _repository.AsSugarClient().Deleteable<BasMbomProcess>().Where(x=>x.mbom_id==mbomSaveDataInput.id).ExecuteCommandAsync();
|
await _repository.AsSugarClient().Deleteable<BasMbomProcess>().Where(x=>x.mbom_id==mbomSaveDataInput.id).ExecuteCommandAsync();
|
||||||
|
|||||||
Reference in New Issue
Block a user