模具物料关联

This commit is contained in:
qianjiawei
2023-05-17 16:52:55 +08:00
parent 8971b48984
commit 3978cc9e3a
7 changed files with 412 additions and 67 deletions

View File

@@ -68,9 +68,12 @@ namespace Tnb.EquipMgr
{
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
{
var his= await _repository.AsSugarClient().Queryable<ToolMoldsEquipment>().ToListAsync();
var list = new List<ToolMoldsEquipment>();
foreach (var equip in ToolMoldInput.equipid)
{
if (his.Where(p => p.mold_id == ToolMoldInput.mold && p.equipment_id == equip).ToList().Count > 0)
continue;
var entity = new ToolMoldsEquipment();
entity.id = SnowflakeIdHelper.NextId();
entity.mold_id = ToolMoldInput.mold;
@@ -83,8 +86,6 @@ namespace Tnb.EquipMgr
});
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
return result.IsSuccess ? "保存成功" : result.ErrorMessage;
}
/// <summary>
/// 批量删除模具设备绑定