异常开始结束带代码提交
This commit is contained in:
@@ -34,6 +34,33 @@ namespace Tnb.EquipMgr
|
||||
_userManager = userManager;
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取模具列表
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<List<ToolMolds>> GetListByIds(List<string> ids)
|
||||
{
|
||||
return await _repository.AsSugarClient().Queryable<ToolMolds>().Where(it => ids.Contains(it.id)).ToListAsync();
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据设备id 获取匹配的模具列表
|
||||
/// </summary>
|
||||
/// <param name="eqpId">设备Id</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<List<ToolMolds>> GetListByEqpId([FromRoute] string eqpId)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
var result = await db.Queryable<ToolMolds>().InnerJoin<ToolMoldsEquipment>((a, b) => a.id == b.mold_id)
|
||||
.Where((a, b) => b.equipment_id == eqpId)
|
||||
.Select((a, b) => a)
|
||||
.ToListAsync();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据模具id获取设备集合
|
||||
/// </summary>
|
||||
@@ -51,11 +78,12 @@ namespace Tnb.EquipMgr
|
||||
.Select((a, b) => new EquipmentListOutput
|
||||
{
|
||||
id = a.id,
|
||||
eqp_code=a.code,
|
||||
eqp_name=a.name
|
||||
eqp_code = a.code,
|
||||
eqp_name = a.name
|
||||
}).ToListAsync();
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加模具设备绑定
|
||||
/// </summary>
|
||||
@@ -65,9 +93,9 @@ namespace Tnb.EquipMgr
|
||||
[HttpPost]
|
||||
public async Task<dynamic> SaveData(ToolMoldInput ToolMoldInput)
|
||||
{
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
{
|
||||
var his= await _repository.AsSugarClient().Queryable<ToolMoldsEquipment>().ToListAsync();
|
||||
var his = await _repository.AsSugarClient().Queryable<ToolMoldsEquipment>().ToListAsync();
|
||||
var list = new List<ToolMoldsEquipment>();
|
||||
foreach (var equip in ToolMoldInput.equipid)
|
||||
{
|
||||
@@ -104,5 +132,10 @@ namespace Tnb.EquipMgr
|
||||
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result.IsSuccess ? "操作成功" : result.ErrorMessage;
|
||||
}
|
||||
|
||||
public Task<ToolMolds> GetListById(string moldId)
|
||||
{
|
||||
return _repository.GetFirstAsync(it => it.id == moldId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user