盘点单编号生成

This commit is contained in:
18942506660
2023-10-30 15:53:38 +08:00
parent fef6a72439
commit c47dcab431
2 changed files with 27 additions and 5 deletions

View File

@@ -52,5 +52,27 @@ namespace WMS.Web.Domain.Entitys
this.CreatorId = creatorId; this.CreatorId = creatorId;
this.Date = DateTime.Now; this.Date = DateTime.Now;
} }
/// <summary>
/// 生成单据号
/// </summary>
public void GenerateNo()
{
//用户手动输入了 就不自动生成了
if (!string.IsNullOrEmpty(this.BillNo)) return;
if (this.Id.ToString().Length >= 8)
{
this.BillNo = "PD" + this.Id.ToString();
return;
}
string idStr = this.Id.ToString();
while (true)
{
idStr = "0" + idStr;
if (idStr.Length >= 8) break;
}
this.BillNo = "PD" + idStr;
}
} }
} }

View File

@@ -52,11 +52,11 @@ namespace WMS.Web.Repositories
await _context.TakeStock.AddAsync(entity); await _context.TakeStock.AddAsync(entity);
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
//if (string.IsNullOrEmpty(entity.OutSourcFeedNo)) if (string.IsNullOrEmpty(entity.BillNo))
//{ {
// entity.GenerateNo(); entity.GenerateNo();
// await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
//} }
if (_transaction != null) if (_transaction != null)
_transaction.Commit(); _transaction.Commit();