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_instock")]
public class InStock
{
///
/// ID
///
public int Id { get; set; }
///
/// 单据编号
///
public string BillNo { get; set; }
///
/// 入库类型
///
public InstockType Type { get; set; }
///
/// 创建人
///
public int CreatorId { get; set; }
///
/// 创建时间(入库时间)
///
public DateTime CreateTime { get; set; }
///
/// 同步成功或者失败
///
public bool? SuccessSync { get; set; }
///
/// 操作人
///
public int OperateId { get; set; }
///
/// 同步时间
///
public DateTime? SyncTime { get; set; }
///
/// 备注
///
public string Remark { get; set; }
///
/// 明细
///
public List Details = new List();
///
/// 创建
///
///
public void Create(int creatorId)
{
this.CreatorId = creatorId;
this.CreateTime = DateTime.Now;
}
///
/// 同步金蝶
///
///
///
///
public void Sync(bool isSuccess, int operateId, string remark)
{
this.SuccessSync = isSuccess;
this.Remark = remark;
this.OperateId = operateId;
this.SyncTime = DateTime.Now;
}
///
/// 生成单据号
///
public void GenerateNo()
{
//用户手动输入了 就不自动生成了
if (!string.IsNullOrEmpty(this.BillNo)) return;
if (this.Id.ToString().Length >= 8)
{
this.BillNo = "RK" + this.Id.ToString();
return;
}
string idStr = this.Id.ToString();
while (true)
{
idStr = "0" + idStr;
if (idStr.Length >= 8) break;
}
this.BillNo = "RK" + idStr;
}
}
}