出入库回退加单据编号

This commit is contained in:
tongfei
2023-11-11 17:55:02 +08:00
parent 9890a8589d
commit 20bb9d96e3
3 changed files with 44 additions and 1 deletions

View File

@@ -14,6 +14,11 @@
ID
</summary>
</member>
<member name="P:WMS.Web.Domain.Entitys.BackRecord.BillNo">
<summary>
单据编号
</summary>
</member>
<member name="P:WMS.Web.Domain.Entitys.BackRecord.Type">
<summary>
类型1为入库回退下架2为出库回退上架
@@ -40,6 +45,11 @@
</summary>
<param name="creatorId"></param>
</member>
<member name="M:WMS.Web.Domain.Entitys.BackRecord.GenerateNo">
<summary>
生成单据号
</summary>
</member>
<member name="T:WMS.Web.Domain.Entitys.BackRecordDetails">
<summary>
wms出入库回退记录表

View File

@@ -16,7 +16,11 @@ namespace WMS.Web.Domain.Entitys
/// <summary>
/// ID
/// </summary>
public int Id { get; set; }
public int Id { get; set; }
/// <summary>
/// 单据编号
/// </summary>
public string BillNo { get; set; }
/// <summary>
/// 类型1为入库回退下架2为出库回退上架
/// </summary>
@@ -44,5 +48,28 @@ namespace WMS.Web.Domain.Entitys
this.CreatorId = creatorId;
this.CreateTime = DateTime.Now;
}
/// <summary>
/// 生成单据号
/// </summary>
public void GenerateNo()
{
//用户手动输入了 就不自动生成了
if (!string.IsNullOrEmpty(this.BillNo)) return;
if (this.Id.ToString().Length >= 8)
{
this.BillNo = "CR" + this.Id.ToString();
return;
}
string idStr = this.Id.ToString();
while (true)
{
idStr = "0" + idStr;
if (idStr.Length >= 8) break;
}
this.BillNo = "CR" + idStr;
}
}
}

View File

@@ -106,6 +106,12 @@ namespace WMS.Web.Repositories
{
await _context.BackRecord.AddAsync(entity);
await _context.SaveChangesAsync();
if (string.IsNullOrEmpty(entity.BillNo))
{
entity.GenerateNo();
await _context.SaveChangesAsync();
}
if (_transaction != null)
_transaction.Commit();
return entity;