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_outstock")] public class OutStock : EntityBase { public OutStock() { } /// /// 主键 订单编号 /// [Column("Id")] public override int Id { get; set; } /// /// 任务单ID /// [Column("TaskId")] public int TaskId { get; set; } /// /// 单据编号 /// [Column("BillNo")] public string BillNo { get; set; } /// /// 来源单号 /// [Column("SourceBillNo")] public string SourceBillNo { get; set; } /// /// 单据类型 /// [Column("Type")] public OutStockType Type { get; set; } = OutStockType.Sal; /// /// 发货组织 /// [Column("DeliveryOrgId")] public int DeliveryOrgId { get; set; } /// /// 收货客户 /// [Column("ReceiptCustomerId")] public int ReceiptCustomerId { get; set; } /// /// 创建人 /// [Column("CreatorId")] public int CreatorId { get; set; } /// /// 创建时间(出库时间) /// [Column("CreateTime")] public DateTime CreateTime { get; set; } = DateTime.Now; /// /// 同步成功或者失败 null 就是未同步 /// [Column("SuccessSync")] public bool? SuccessSync { get; set; } /// /// 明细 /// public List Details = new List(); /// /// 创建 /// /// public void Create(int creatorId,int taskId, OutStockType type) { this.TaskId = taskId; this.Type = type; this.CreatorId = creatorId; this.CreateTime = DateTime.Now; } /// /// 生成单据号 /// public void GenerateNo() { //用户手动输入了 就不自动生成了 if (!string.IsNullOrEmpty(this.BillNo)) return; if (this.Id.ToString().Length >= 8) { this.BillNo = "CK" + this.Id.ToString(); return; } string idStr = this.Id.ToString(); while (true) { idStr = "0" + idStr; if (idStr.Length >= 8) break; } this.BillNo = "CK" + idStr; } } }