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 { /// /// wms移箱记录 /// [Serializable] [Table("t_wms_movebox_record")] public class MoveBoxRecord : EntityBase { public MoveBoxRecord() { } /// /// 主键 订单编号 /// [Column("Id")] public override int Id { get; set; } /// /// 单据编号 /// [Column("BillNo")] public string BillNo { get; set; } /// /// 箱号ID /// [Column("BoxId")] public int BoxId { get; set; } /// /// 组织编码 /// [Column("OrgCode")] public string OrgCode { get; set; } /// /// 仓库 /// [Column("StockCode")] public string StockCode { get; set; } ///// ///// 原仓位Id ///// //[Column("SrcSubStockId")] //public int SrcSubStockId { get; set; } ///// ///// 目标仓位Id ///// //[Column("DestSubStockId")] //public int DestSubStockId { get; set; } /// /// 原仓位编码 /// [Column("SrcSubStockCode")] public string SrcSubStockCode { get; set; } /// /// 目标仓位编码 /// [Column("DestSubStockCode")] public string DestSubStockCode { get; set; } /// /// 数量 /// [Column("Qty")] public decimal Qty { get; set; } /// /// 类型:1-整箱移货上架,2-整箱移货下架 /// [Column("Type")] public MoveBoxType Type { get; set; } = MoveBoxType.Up; /// /// 操作人 /// [Column("CreatorId")] public int CreatorId { get; set; } /// /// 操作时间 /// [Column("CreateTime")] public DateTime CreateTime { get; set; } = DateTime.Now; /// /// 明细信息 /// public List Details { get; set; } = new List(); /// /// 创建 /// /// public void Create(MoveBoxType type, int boxId,decimal qty, string orgCode, string stockCode, int creatorId,string subStockCode) { 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 SrcSubStockCode = type == MoveBoxType.Up ? "" : subStockCode;//上架 原仓位是0 目标仓位有值 DestSubStockCode = type == MoveBoxType.Up ? subStockCode : ""; //下架 原仓位有值 目标仓位是0 this.Qty = qty; this.CreatorId = creatorId; this.CreateTime = DateTime.Now; } /// /// 生成单据号 /// 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; } } }