Files
WMS-Api/src/WMS.Web.Domain/Entitys/InstockTask.cs
tongfei d63f2320e0 test
2023-11-06 16:56:23 +08:00

122 lines
3.1 KiB
C#

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
{
/// <summary>
/// erp入库任务表
/// </summary>
[Serializable]
[Table("t_erp_instock_task")]
public class InStockTask : EntityBase
{
/// <summary>
/// ID
/// </summary>
public override int Id { get; set; }
/// <summary>
/// 单据编号
/// </summary>
public string BillNo { get; set; }
/// <summary>
/// 来源单号
/// </summary>
public string SourceBillNo { get; set; }
/// <summary>
/// 入库状态
/// </summary>
public InstockStatus Status { get; set; }
/// <summary>
/// 入库类型
/// </summary>
public InstockType Type { get; set; }
/// <summary>
/// 收货人
/// </summary>
public int? ReceiverId { get; set; }
/// <summary>
/// 收货时间
/// </summary>
public DateTime? ReceiveTime { get; set; }
/// <summary>
/// 上架人
/// </summary>
public int? ShelferId { get; set; }
/// <summary>
/// 入库时间(上架时间)
/// </summary>
public DateTime? ShelfTime { get; set; }
/// <summary>
/// 箱信息集合
/// </summary>
[NotMapped]
public virtual List<InStockTaskBox> Boxs { get; set; }
/// <summary>
/// 明细
/// </summary>
[NotMapped]
public virtual List<InStockTaskDetails> Details { get; set; }
/// <summary>
/// 创建
/// </summary>
/// <param name="type"></param>
public void Create(InstockType type)
{
this.Status = InstockStatus.Wait;
this.Type = type;
}
/// <summary>
/// 创建订单号
/// </summary>
/// <param name="newId"></param>
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();
}
}
/// <summary>
/// 收货
/// </summary>
/// <param name="creatorId"></param>
public void Receive(int creatorId)
{
this.ReceiverId = creatorId;
this.ReceiveTime = DateTime.Now;
}
/// <summary>
/// 上架
/// </summary>
/// <param name="creatorId"></param>
public void Shelf(int creatorId)
{
this.ShelferId = creatorId;
this.ShelfTime = DateTime.Now;
}
}
}