批号添加

This commit is contained in:
tongfei
2024-03-28 09:04:27 +08:00
parent e246d3800e
commit 7714e8e376
8 changed files with 134 additions and 5 deletions

View File

@@ -55,5 +55,51 @@ namespace WMS.Web.Domain.Entitys
/// </summary>
public string ErpSyncBillNo { get; set; }
/// <summary>
/// 批号
/// </summary>
public string BatchBillNo { get; set; }
/// <summary>
/// 箱唛编号-首位
/// </summary>
public int FirstBillNo { get; set; }
/// <summary>
/// 箱唛编号-末尾序号
/// </summary>
public int LastBillNo { get; set; }
/// <summary>
/// 生成批号
/// </summary>
/// <param name="firstBillNo"></param>
/// <param name="lastBillNo"></param>
public void GenerateBatchBillNo(int firstBillNo,int lastBillNo,bool isBatchManage)
{
if (isBatchManage)
{
this.FirstBillNo = Convert.ToInt32(DateTime.Now.ToString("yyMMdd"));
if (this.FirstBillNo == firstBillNo)
this.LastBillNo = lastBillNo + 1;
else
this.LastBillNo = 1;
if (this.LastBillNo.ToString().Length >= 6)
{
this.BatchBillNo = "W" + this.FirstBillNo + this.LastBillNo;
return;
}
string lastStr = this.LastBillNo.ToString();
while (true)
{
lastStr = "0" + lastStr;
if (lastStr.Length >= 6) break;
}
this.BatchBillNo = "W" + this.FirstBillNo + lastStr;
}
}
}
}