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
{
///
/// 序列号
///
[Serializable]
[Table("t_wms_serialnumbers")]
public class SerialNumbers : EntityBase
{
public SerialNumbers() { }
public SerialNumbers(string serialNumber, int materialId, int boxId, int opsBoxId, string creator, DateTime? createTime)
{
this.SerialNumber = serialNumber;
this.MaterialId = materialId;
this.BoxId = boxId;
this.OpsBoxId = opsBoxId;
this.Creator = creator;
this.CreateTime = createTime == null ? DateTime.Now : (DateTime)createTime;
}
///
/// 主键 订单编号
///
[Column("Id")]
public override int Id { get; set; }
///
/// 序列号
///
[Column("SerialNumber")]
public string SerialNumber { get; set; }
///
/// 物料ID
///
[Column("MaterialId")]
public int MaterialId { get; set; }
///
/// wms箱ID
///
[Column("BoxId")]
public int BoxId { get; set; }
///
/// 对应老OPS的箱ID
///
[Column("OpsBoxId")]
public int OpsBoxId { get; set; }
///
/// 创建人(老ops过来)
///
[Column("Creator")]
public string Creator { get; set; }
///
/// 创建时间(老ops过来)
///
[Column("CreateTime")]
public DateTime CreateTime { get; set; } = DateTime.Now;
///
/// 出库单号
///
[Column("OutStockBillNo")]
public string OutStockBillNo { get; set; }
///
/// 入库单号/采购单号
///
[Column("InStockBillNo")]
public string InStockBillNo { get; set; }
///
/// 操作(绑定箱信息)
///
/// 目标箱号
public void Bind(int destBoxId)
{
this.BoxId = destBoxId;
}
///
/// 解绑
///
public void UnBind()
{
this.BoxId = 0;
}
///
/// 出库
///
/// 出库单号
public void OutStock(string outStockBillNo, OutStockType type)
{
this.BoxId = 0;
if (type == OutStockType.Sal)
this.OutStockBillNo = outStockBillNo;
}
///
/// 入库
///
/// 出库单号
public void InStock(string inStockBillNo, OrderType type)
{
if (type == OrderType.Purchase_In)
this.InStockBillNo = inStockBillNo;
}
}
}