数据实体对象
public class ProductInvLocationMapEntity:BaseDomain { #region Constructors public ProductInvLocationMapEntity() { } #endregion #region Properties /// /// /// AllowNull: False /// Length: 8 /// //public long Id { get; set; } /// /// 商品id /// AllowNull: False /// Length: 8 /// public long ProductId { get; set; } /// /// 商品货号 /// AllowNull: False /// Length: 50 /// public string ProductCode { get; set; } /// /// 库位编号 /// AllowNull: False /// Length: 50 /// public string LocationLabel { get; set; } /// /// 库位类型 /// AllowNull: False /// Length: 50 /// public string LocationType { get; set; } /// /// 生产日期 /// AllowNull: False /// Length: 8 /// public DateTime ManufactureDate { get; set; } /// /// 已存放数量 /// AllowNull: False /// Length: 4 /// public int StoredQty { get; set; } #endregion #region override Mehtods public override string ToString() { return base.ToString(); } #endregion /// /// 仓库Id /// public long WarehouseId { get; set; } }
数据操作方法
/// /// /// /// /// /// public Models.EF6_Test.ProductInvLocationMapEntity GetMatchedLocationMap(long product_id,DateTime manufacture_date) { DateTime maxValue = new DateTime(9999, 12, 31, 23, 59, 59);#if DEBUG this.OpenSqlRawOutput(Console.WriteLine);#endif var matched_entity = this.EntrySet .OrderBy(obj=>obj.ModifiedTime) .FirstOrDefault(obj => (obj.ProductId == product_id && obj.ManufactureDate == manufacture_date) || (obj.ProductId == product_id && obj.ManufactureDate == maxValue)); return matched_entity; }