生产bom添加获取编辑信息接口
This commit is contained in:
122
BasicData/Tnb.BasicData.Entitys/Dto/BasMbom/MbomDataOutput.cs
Normal file
122
BasicData/Tnb.BasicData.Entitys/Dto/BasMbom/MbomDataOutput.cs
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
using Tnb.BasicData.Entities;
|
||||||
|
|
||||||
|
namespace Tnb.BasicData.Entities.Dto
|
||||||
|
{
|
||||||
|
public class MbomDataOutput
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 生产bomid
|
||||||
|
/// </summary>
|
||||||
|
public string id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料id
|
||||||
|
/// </summary>
|
||||||
|
public string material_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数量
|
||||||
|
/// </summary>
|
||||||
|
public int num { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单位id
|
||||||
|
/// </summary>
|
||||||
|
public string unit_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 版本号
|
||||||
|
/// </summary>
|
||||||
|
public string version { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 有效开始时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? start_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 有效结束时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? end_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料清单id
|
||||||
|
/// </summary>
|
||||||
|
public string ebom_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 工艺路线id
|
||||||
|
/// </summary>
|
||||||
|
public string route_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料均再首道工序投产
|
||||||
|
/// </summary>
|
||||||
|
public int is_first { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
public string remark { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 工序
|
||||||
|
/// </summary>
|
||||||
|
public List<MbomProcessOutDto> processes { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MbomProcessOutDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:生产bomid
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
public string mbom_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:工序id
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
public string process_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:准备时间
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
public decimal preparation_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:工位
|
||||||
|
/// Default:NULL::character varying
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string station { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:副产出管控 0 不启用 1 启用
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
public int byproduct_status { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:投产方式
|
||||||
|
/// Default:NULL::character varying
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string production_method {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 投入物料
|
||||||
|
/// </summary>
|
||||||
|
public List<BasMbomInput> inputs { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 产出物料
|
||||||
|
/// </summary>
|
||||||
|
public List<BasMbomOutput> outputs { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -102,6 +102,13 @@ namespace Tnb.BasicData.Entities.Dto
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int byproduct_status { get; set; }
|
public int byproduct_status { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:投产方式
|
||||||
|
/// Default:NULL::character varying
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string production_method {get;set;}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 投入物料
|
/// 投入物料
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -54,5 +54,12 @@ namespace Tnb.BasicData.Entities
|
|||||||
/// Nullable:False
|
/// Nullable:False
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int byproduct_status { get; set; }
|
public int byproduct_status { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:投产方式
|
||||||
|
/// Default:NULL::character varying
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string production_method {get;set;}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@ 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 Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.BasicData.Entities;
|
using Tnb.BasicData.Entities;
|
||||||
@@ -16,12 +17,15 @@ 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]")]
|
||||||
|
[OverideVisualDev(ModelId)]
|
||||||
public class BasMbomService : IBasMbomService,IDynamicApiController, ITransient
|
public class BasMbomService : IBasMbomService,IDynamicApiController, ITransient
|
||||||
{
|
{
|
||||||
|
public const string ModelId = "25574817510421";
|
||||||
private readonly ISqlSugarRepository<BasMbom> _repository;
|
private readonly ISqlSugarRepository<BasMbom> _repository;
|
||||||
private readonly DataBaseManager _dbManager;
|
private readonly DataBaseManager _dbManager;
|
||||||
private readonly IDictionaryDataService _dictionaryDataService;
|
private readonly IDictionaryDataService _dictionaryDataService;
|
||||||
private readonly IUserManager _userManager;
|
private readonly IUserManager _userManager;
|
||||||
|
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||||
|
|
||||||
public BasMbomService(
|
public BasMbomService(
|
||||||
ISqlSugarRepository<BasMbom> repository,
|
ISqlSugarRepository<BasMbom> repository,
|
||||||
@@ -33,6 +37,53 @@ namespace Tnb.BasicData
|
|||||||
_dbManager = dbManager;
|
_dbManager = dbManager;
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
_dictionaryDataService = dictionaryDataService;
|
_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>
|
/// <summary>
|
||||||
@@ -170,6 +221,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,
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user