移箱支持多个
This commit is contained in:
@@ -71,6 +71,38 @@ namespace WMS.Web.Repositories
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async Task<bool> AddRange(List<MoveBoxRecord> entitys, bool isTransaction = true)
|
||||
{
|
||||
IDbContextTransaction _transaction = null;
|
||||
if (isTransaction)
|
||||
_transaction = _context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
if (entitys != null && entitys.Count != 0)
|
||||
{
|
||||
await _context.MoveBoxRecord.AddRangeAsync(entitys);
|
||||
await _context.SaveChangesAsync();
|
||||
foreach (var item in entitys)
|
||||
{
|
||||
if (string.IsNullOrEmpty(item.BillNo))
|
||||
//自动生成单据编号
|
||||
item.GenerateNo();
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
if (_transaction != null)
|
||||
_transaction.Commit();
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
if (_transaction != null)
|
||||
_transaction.Rollback();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 列表
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user