生产bom添加获取编辑信息接口
This commit is contained in:
@@ -3,6 +3,7 @@ using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
@@ -16,12 +17,15 @@ namespace Tnb.BasicData
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 1102)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
[OverideVisualDev(ModelId)]
|
||||
public class BasMbomService : IBasMbomService,IDynamicApiController, ITransient
|
||||
{
|
||||
public const string ModelId = "25574817510421";
|
||||
private readonly ISqlSugarRepository<BasMbom> _repository;
|
||||
private readonly DataBaseManager _dbManager;
|
||||
private readonly IDictionaryDataService _dictionaryDataService;
|
||||
private readonly IUserManager _userManager;
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
|
||||
public BasMbomService(
|
||||
ISqlSugarRepository<BasMbom> repository,
|
||||
@@ -33,6 +37,53 @@ namespace Tnb.BasicData
|
||||
_dbManager = dbManager;
|
||||
_userManager = userManager;
|
||||
_dictionaryDataService = dictionaryDataService;
|
||||
OverideFuncs.GetAsync = GetInfo;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取编辑信息
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<dynamic> GetInfo(string id)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
BasMbom mbom = await _repository.GetSingleAsync(x=>x.id==id);
|
||||
List<BasMbomProcess> processes = await db.Queryable<BasMbomProcess>().Where(x => x.mbom_id == id).ToListAsync();
|
||||
List<BasMbomInput> inputs = await db.Queryable<BasMbomInput>().Where(x => x.mbom_id == id).ToListAsync();
|
||||
List<BasMbomOutput> outputs = await db.Queryable<BasMbomOutput>().Where(x => x.mbom_id == id).ToListAsync();
|
||||
MbomDataOutput mbomDataOutput = new MbomDataOutput();
|
||||
List<MbomProcessOutDto> mbomProcessOutDtos = new List<MbomProcessOutDto>();
|
||||
|
||||
mbomDataOutput.id = mbom.id;
|
||||
mbomDataOutput.ebom_id = mbom.ebom_id;
|
||||
mbomDataOutput.is_first = mbom.is_first;
|
||||
mbomDataOutput.material_id = mbom.material_id;
|
||||
mbomDataOutput.num = mbom.num;
|
||||
mbomDataOutput.remark = mbom.remark;
|
||||
mbomDataOutput.route_id = mbom.route_id;
|
||||
mbomDataOutput.start_time = mbom.start_time;
|
||||
mbomDataOutput.end_time = mbom.end_time;
|
||||
mbomDataOutput.unit_id = mbom.unit_id;
|
||||
mbomDataOutput.version = mbom.version;
|
||||
|
||||
foreach (BasMbomProcess process in processes)
|
||||
{
|
||||
mbomProcessOutDtos.Add(new MbomProcessOutDto()
|
||||
{
|
||||
mbom_id = mbom.id,
|
||||
process_id = process.process_id,
|
||||
preparation_time = process.preparation_time,
|
||||
station = process.station,
|
||||
byproduct_status = process.byproduct_status,
|
||||
production_method = process.production_method,
|
||||
inputs = inputs.Where(x => x.process_id == process.process_id).ToList(),
|
||||
outputs = outputs.Where(x => x.process_id == process.process_id).ToList(),
|
||||
|
||||
});
|
||||
}
|
||||
mbomDataOutput.processes = mbomProcessOutDtos;
|
||||
return mbomDataOutput;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -170,6 +221,7 @@ namespace Tnb.BasicData
|
||||
preparation_time = process.preparation_time,
|
||||
station = process.station,
|
||||
byproduct_status = process.byproduct_status,
|
||||
production_method = process.production_method,
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user