盘点单编号生成
This commit is contained in:
@@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user