Files
WMS-Api/src/WMS.Web.Domain/Entitys/InstockTask.cs
tongfei 5f71e20802 优化
2023-11-24 14:29:57 +08:00

149 lines
4.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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>
/// 创建时间erp那边的创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 箱信息集合
/// </summary>
public List<InStockTaskBox> Boxs { get; set; }
/// <summary>
/// 明细
/// </summary>
public List<InStockTaskDetails> Details { get; set; }
/// <summary>
/// 创建
/// </summary>
/// <param name="type"></param>
/// <param name="sourceBillNo"></param>
/// <param name="createTime"></param>
public void Create(InstockType type,string sourceBillNo, DateTime createTime)
{
this.Status = InstockStatus.Wait;
this.Type = type;
this.SourceBillNo = sourceBillNo;
this.CreateTime = createTime;
}
/// <summary>
/// 作废
/// </summary>
public void Repeal(int creatorId)
{
this.Status = InstockStatus.Repeal;
}
/// <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;
}
/// <summary>
/// 非采购上架
/// </summary>
/// <param name="creatorId"></param>
public void NoPurchaseShelf(int creatorId)
{
this.ReceiverId = creatorId;
this.ReceiveTime = DateTime.Now;
this.ShelferId = creatorId;
this.ShelfTime = DateTime.Now;
}
}
}