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_takestock")] public class TakeStock : EntityBase { public TakeStock() { } /// /// 主键 订单编号 /// [Column("Id")] public override int Id { get; set; } /// /// 单据编号 /// [Column("BillNo")] public string BillNo { get; set; } /// /// 盘点日期 /// [Column("Date")] public DateTime Date { get; set; } = DateTime.Now; /// /// 盘点人员 /// [Column("CreatorId")] public int CreatorId { get; set; } /// /// 同步成功或者失败 null 就是未同步 /// [Column("SuccessSync")] public bool? SuccessSync { get; set; } /// /// 箱Id /// [Column("BoxId")] public int BoxId { get; set; } /// /// 物料ID /// [Column("MaterialId")] public int MaterialId { get; set; } /// /// 仓库ID /// [Column("StockId")] public int StockId { get; set; } /// /// 仓位ID /// [Column("SubStockId")] public int SubStockId { get; set; } /// /// 盘点前数量(wms系统数量) /// [Column("BeforeQty")] public decimal BeforeQty { get; set; } /// /// 盘点实际数量(实际仓库数量) /// [Column("AfterQty")] public decimal AfterQty { get; set; } /// /// 盘点数量 /// [Column("FinalQty")] public decimal FinalQty { get; set; } /// /// 盘点结果类型:1为盘盈,2位盘亏 /// 实际仓库数量-WMS系统数量 大于0为盘盈 小于0为盘亏 /// [Column("ResultType")] public TakeStockType ResultType { get; set; } = TakeStockType.Profit; /// /// 备注 /// [Column("Remark")] public string Remark { get; set; } /// /// 创建 /// /// public void Create(int creatorId) { this.CreatorId = creatorId; this.Date = DateTime.Now; } /// /// 同步金蝶结果 /// /// /// public void Sync(bool isSuccess,string remark) { if (isSuccess) { this.SuccessSync = true; this.Remark = ""; } else { this.SuccessSync = false; this.Remark = remark; } } /// /// 生成单据号 /// public void GenerateNo() { //用户手动输入了 就不自动生成了 if (!string.IsNullOrEmpty(this.BillNo)) return; if (this.Id.ToString().Length >= 8) { this.BillNo = "PD" + this.Id.ToString(); return; } string idStr = this.Id.ToString(); while (true) { idStr = "0" + idStr; if (idStr.Length >= 8) break; } this.BillNo = "PD" + idStr; } } }