using Forks.EnterpriseServices.DataDictionary;
using Forks.EnterpriseServices.DomainObjects2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ButcherFactory.BO
{
  [MapToTable("Butcher_CarcassInStore")]
  [DBIndex("IDX_Butcher_CarcassInStore_Clustered", "BarCode", false, 0)]
  [DBIndexType("IDX_Butcher_CarcassInStore_Clustered", IndexType.Clustered)]
  public class CarcassInStore : SyncBill
  {
    public string BarCode { get; set; }

    public long? WorkUnit_ID { get; set; }

    public long? ProductBatch_ID { get; set; }

    public long? Goods_ID { get; set; }

    public decimal? Weight { get; set; }

    public decimal? BeforeWeight { get; set; }

    [NonDmoProperty]
    public decimal? Discont
    {
      get
      {
        if (Weight.HasValue && BeforeWeight.HasValue)
          return BeforeWeight.Value - Weight.Value;
        return null;
      }
    }

    public bool FromPad { get; set; }

    [ReferenceTo(typeof(Goods), "Name")]
    [Join("Goods_ID", "ID")]
    public string Goods_Name { get; set; }
  }

  public class PadCarcassInStore
  {
    public long ID { get; set; }
    public long Goods_ID { get; set; }
    public string BarCode { get; set; }
    public int RowVersion { get; set; }

  }
}
