using System; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Runtime.CompilerServices; using ChangKeTec.Wms.Models.Enums; using CK.SCP.Utils; namespace ChangKeTec.Wms.Models.Wms { public partial class TL_TRANSACTION { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public long UID { get; set; } [DisplayName("操作员")] [Required(AllowEmptyStrings = true)] [StringLength(80)] public string OperName { get; set; } [DisplayName("日志时间")] public DateTime LogTime { get; set; } [DisplayName("箱码")] [Required(AllowEmptyStrings = true)] [StringLength(50)] public string BarCode { get; set; } [DisplayName("单据编号")] [Required(AllowEmptyStrings = true)] [StringLength(50)] public string BillNum { get; set; } [DisplayName("单据类型码")] public EnumBillType BillType { get; set; } [NotMapped] [DisplayName("单据类型")] public string StrBillType => EnumHelper.GetDesc(BillType); [DisplayName("单据子类型码")] public int SubBillType { get; set; } = 0; [NotMapped] [DisplayName("单据子类型")] public string StrSubBillType => GetStringSubBillType(SubBillType); [DisplayName("事务类型")] public int TransType { get; set; } [DisplayName("物料号")] [Required(AllowEmptyStrings = true)] [StringLength(50)] public string PartCode { get; set; } [NotMapped] [DisplayName("物料描述")] public string PartDesc => WmsCache.GetPartDesc(PartCode); [DisplayName("批次")] [Required(AllowEmptyStrings = true)] [StringLength(50)] public string Batch { get; set; } [DisplayName("数量")] [Column(TypeName = "money")] public decimal Qty { get; set; } [DisplayName("状态")] public EnumStockState State { get; set; } [DisplayName("库位")] [Required(AllowEmptyStrings = true)] [StringLength(50)] public string LocCode { get; set; } [DisplayName("库区")] [NotMapped] public string AreaCode => WmsCache.GetAreaCode(LocCode); [NotMapped] public string ErpLocCode => WmsCache.GetErpLocCode(LocCode); [DisplayName("器具号")] [StringLength(50)] public string EqptCode { get; set; } [DisplayName("供应商编号")] [StringLength(50)] public string VendId { get; set; } [DisplayName("供应商批次")] [StringLength(50)] public string VendBatch { get; set; } [DisplayName("备注")] [StringLength(500)] public string Remark { get; set; } private string GetStringSubBillType(int subBillType) { string strSubBillType = string.Empty; try { var enumSubBillType = (EnumSubBillType) subBillType; strSubBillType = EnumHelper.GetDesc(enumSubBillType); } catch (Exception) { // ignored } return strSubBillType; } } }