using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
using WMS.Web.Domain.Values;
namespace WMS.Web.Domain.Entitys
{
///
/// wms出入库回退记录表
///
[Serializable]
[Table("t_wms_back_record")]
public class BackRecord
{
///
/// ID
///
public int Id { get; set; }
///
/// 单据编号
///
public string BillNo { get; set; }
///
/// 类型:1为入库回退下架,2为出库回退上架
///
public BackRecordType Type { get; set; }
///
/// 操作人
///
public int CreatorId { get; set; }
///
/// 操作时间
///
public DateTime CreateTime { get; set; }
///
/// 明细
///
public List Details { get; set; } = new List();
///
/// 创建
///
///
public void Create(int creatorId)
{
this.CreatorId = creatorId;
this.CreateTime = DateTime.Now;
}
///
/// 生成单据号
///
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;
}
}
}