118 lines
3.5 KiB
C#
118 lines
3.5 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>
|
||
/// wms移箱记录
|
||
/// </summary>
|
||
[Serializable]
|
||
[Table("t_wms_movebox_record")]
|
||
public class MoveBoxRecord : EntityBase
|
||
{
|
||
public MoveBoxRecord() { }
|
||
/// <summary>
|
||
/// 主键 订单编号
|
||
/// </summary>
|
||
[Column("Id")]
|
||
public override int Id { get; set; }
|
||
/// <summary>
|
||
/// 单据编号
|
||
/// </summary>
|
||
[Column("BillNo")]
|
||
public string BillNo { get; set; }
|
||
/// <summary>
|
||
/// 箱号ID
|
||
/// </summary>
|
||
[Column("BoxId")]
|
||
public int BoxId { get; set; }
|
||
/// <summary>
|
||
/// 组织编码
|
||
///</summary>
|
||
[Column("OrgCode")]
|
||
public string OrgCode { get; set; }
|
||
/// <summary>
|
||
/// 仓库
|
||
///</summary>
|
||
[Column("StockCode")]
|
||
public string StockCode { get; set; }
|
||
/// <summary>
|
||
/// 原仓位Id
|
||
/// </summary>
|
||
[Column("SrcSubStockId")]
|
||
public int SrcSubStockId { get; set; }
|
||
/// <summary>
|
||
/// 目标仓位Id
|
||
/// </summary>
|
||
[Column("DestSubStockId")]
|
||
public int DestSubStockId { get; set; }
|
||
/// <summary>
|
||
/// 数量
|
||
/// </summary>
|
||
[Column("Qty")]
|
||
public decimal Qty { get; set; }
|
||
/// <summary>
|
||
/// 类型:1-整箱移货上架,2-整箱移货下架
|
||
/// </summary>
|
||
[Column("Type")]
|
||
public MoveBoxType Type { get; set; } = MoveBoxType.Up;
|
||
/// <summary>
|
||
/// 操作人
|
||
/// </summary>
|
||
[Column("CreatorId")]
|
||
public int CreatorId { get; set; }
|
||
/// <summary>
|
||
/// 操作时间
|
||
/// </summary>
|
||
[Column("CreateTime")]
|
||
public DateTime CreateTime { get; set; } = DateTime.Now;
|
||
/// <summary>
|
||
/// 明细信息
|
||
/// </summary>
|
||
public List<MoveBoxRecordDetails> Details { get; set; } = new List<MoveBoxRecordDetails>();
|
||
|
||
/// <summary>
|
||
/// 创建
|
||
/// </summary>
|
||
/// <param name="creatorId"></param>
|
||
public void Create(MoveBoxType type, int boxId,decimal qty, string orgCode, string stockCode, int subStockId, int creatorId)
|
||
{
|
||
this.BoxId = boxId;
|
||
this.Type = type;
|
||
this.OrgCode = orgCode;
|
||
this.StockCode = stockCode;
|
||
SrcSubStockId = type == MoveBoxType.Up ? 0 : subStockId;//上架 原仓位是0 目标仓位有值
|
||
DestSubStockId = type == MoveBoxType.Up ? subStockId : 0; //下架 原仓位有值 目标仓位是0
|
||
this.Qty = qty;
|
||
this.CreatorId = creatorId;
|
||
this.CreateTime = DateTime.Now;
|
||
}
|
||
/// <summary>
|
||
/// 生成单据号
|
||
/// </summary>
|
||
public void GenerateNo()
|
||
{
|
||
//用户手动输入了 就不自动生成了
|
||
if (!string.IsNullOrEmpty(this.BillNo)) return;
|
||
|
||
if (this.Id.ToString().Length >= 8)
|
||
{
|
||
this.BillNo = "YX" + this.Id.ToString();
|
||
return;
|
||
}
|
||
|
||
string idStr = this.Id.ToString();
|
||
while (true)
|
||
{
|
||
idStr = "0" + idStr;
|
||
if (idStr.Length >= 8) break;
|
||
}
|
||
this.BillNo = "YX" + idStr;
|
||
}
|
||
}
|
||
}
|