80 lines
2.0 KiB
C#
80 lines
2.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Text;
|
|
using WMS.Web.Core;
|
|
|
|
namespace WMS.Web.Domain.Entitys
|
|
{
|
|
/// <summary>
|
|
/// 箱唛表-编号表
|
|
/// </summary>
|
|
[Serializable]
|
|
[Table("t_wms_box_mark_billno")]
|
|
public class BoxMarkBillNo : EntityBase
|
|
{
|
|
/// <summary>
|
|
/// ID
|
|
/// </summary>
|
|
public override int Id { get; set; }
|
|
|
|
/// <summary>
|
|
/// 上级ID
|
|
/// </summary>
|
|
public int Fid { get; set; }
|
|
|
|
/// <summary>
|
|
/// 箱唛编号
|
|
/// </summary>
|
|
public string BillNo { get; set; }
|
|
|
|
/// <summary>
|
|
/// 箱唛编号-首位
|
|
/// </summary>
|
|
public int FirstBillNo { get; set; }
|
|
|
|
/// <summary>
|
|
/// 箱唛编号-末尾序号
|
|
/// </summary>
|
|
public int LastBillNo { get; set; }
|
|
|
|
/// <summary>
|
|
/// 是否是尾箱
|
|
/// </summary>
|
|
public bool IsTail { get; set; }
|
|
|
|
/// <summary>
|
|
/// 排序
|
|
/// </summary>
|
|
public int Sort { get; set; }
|
|
|
|
/// <summary>
|
|
/// 生成编号
|
|
/// </summary>
|
|
/// <param name="firstBillNo"></param>
|
|
/// <param name="lastBillNo"></param>
|
|
public void GenerateBillNo(int firstBillNo, int lastBillNo)
|
|
{
|
|
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 >= 5)
|
|
{
|
|
this.BillNo = "XM" + this.FirstBillNo + this.LastBillNo;
|
|
return;
|
|
}
|
|
|
|
string lastStr = this.LastBillNo.ToString();
|
|
while (true)
|
|
{
|
|
lastStr = "0" + lastStr;
|
|
if (lastStr.Length >= 5) break;
|
|
}
|
|
this.BillNo = "XM" + this.FirstBillNo + lastStr;
|
|
}
|
|
}
|
|
}
|