This commit is contained in:
2024-06-26 14:00:36 +08:00
parent ece89a101e
commit dce72c4899
2 changed files with 20 additions and 9 deletions

View File

@@ -1,5 +1,6 @@
using JNPF;
using JNPF.Common.Core.Manager;
using JNPF.Common.Enums;
using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
using JNPF.Extras.CollectiveOAuth.Models;
@@ -457,15 +458,17 @@ namespace Tnb.ProductionMgr
}
}
if (insertHList.Count <= 0 || insertDList.Count <= 0)
{
throw Oops.Bah(ErrorCode.COM1000);
}
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
int row1 = await db.Insertable(insertHList).ExecuteCommandAsync();
int row2 = await db.Insertable(insertDList).ExecuteCommandAsync();
if (row1 <= 0 || row2 <= 0)
{
await db.Insertable(insertHList).ExecuteCommandAsync();
await db.Insertable(insertDList).ExecuteCommandAsync();
});
if (!result.IsSuccess)
{
throw Oops.Bah(result.ErrorMessage);
throw Oops.Bah(ErrorCode.COM1000);
}
}
}