using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
using WMS.Web.Core;
using WMS.Web.Domain.Values;
namespace WMS.Web.Domain.Entitys
{
///
/// erp入库任务表
///
[Serializable]
[Table("t_erp_instock_task")]
public class InStockTask : EntityBase
{
///
/// ID
///
public override int Id { get; set; }
///
/// 单据编号
///
public string BillNo { get; set; }
///
/// 来源单号
///
public string SourceBillNo { get; set; }
///
/// 入库状态
///
public InstockStatus Status { get; set; }
///
/// 入库类型
///
public InstockType Type { get; set; }
///
/// 收货人
///
public int? ReceiverId { get; set; }
///
/// 收货时间
///
public DateTime? ReceiveTime { get; set; }
///
/// 上架人
///
public int? ShelferId { get; set; }
///
/// 入库时间(上架时间)
///
public DateTime? ShelfTime { get; set; }
///
/// 箱信息集合
///
public List Boxs { get; set; }
///
/// 明细
///
public List Details { get; set; }
///
/// 创建
///
///
public void Create(InstockType type)
{
this.Status = InstockStatus.Wait;
this.Type = type;
}
///
/// 创建订单号
///
///
public void MakeBillNo(int newId)
{
//生成订单号
var length = newId.ToString().Length;
if (length >= 8)
{
this.BillNo = $"RKRW{newId.ToString()}";
}
else
{
var needLength = 8 - length;
var needStr = "";
for (int i = 0; i < needLength; i++)
{
needStr += "0";
}
this.BillNo = "RKRW" + needStr + newId.ToString();
}
}
///
/// 收货
///
///
public void Receive(int creatorId)
{
this.ReceiverId = creatorId;
this.ReceiveTime = DateTime.Now;
}
///
/// 上架
///
///
public void Shelf(int creatorId)
{
this.ShelferId = creatorId;
this.ShelfTime = DateTime.Now;
}
}
}