using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
using WMS.Web.Core;
namespace WMS.Web.Domain.Entitys
{
///
/// 箱唛表-编号表
///
[Serializable]
[Table("t_wms_box_mark_billno")]
public class BoxMarkBillNo : EntityBase
{
///
/// ID
///
public override int Id { get; set; }
///
/// 上级ID
///
public int Fid { get; set; }
///
/// 箱唛编号
///
public string BillNo { get; set; }
///
/// 箱唛编号-首位
///
public int FirstBillNo { get; set; }
///
/// 箱唛编号-末尾序号
///
public int LastBillNo { get; set; }
///
/// 是否是尾箱
///
public bool IsTail { get; set; }
///
/// 排序
///
public int Sort { get; set; }
///
/// 生成编号
///
///
///
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;
}
}
}