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

namespace ButcherFactory.BO
{
  public class SaleOutStoreInfo
  {
    public DateTime? Date { get; set; }
    public string DeliverGoodsLine_Name { get; set; }
    public string Customer_Name { get; set; }
    public long BillID { get; set; }
    public long DetailID { get; set; }
    public string Goods_Name { get; set; }
    public string Goods_Spec { get; set; }
    public string Goods_Code { get; set; }
    public decimal? SecondNumber { get; set; }
    public decimal? UnitNum { get; set; }
    public decimal? SSecondNumber { get; set; }
    public decimal? SUnitNum { get; set; }
    public bool StandardPic { get; set; }
    public bool StockUpBySecondNum { get; set; }
    public bool FinishAssign { get; set; }
    public long? DeliverLineGroup_ID { get; set; }
    public bool Finishd
    {
      get
      {
        if (FinishAssign)
          return true;
        if (StockUpBySecondNum)
          return (SecondNumber ?? 0) <= (SSecondNumber ?? 0);
        return (UnitNum ?? 0) <= (SUnitNum ?? 0) + (DownFloat ?? 0);
      }
    }
    public long? SendQueue { get; set; }

    public decimal? DownFloat { get; set; }
  }

  [KeyField("ID", KeyGenType.identity)]
  [MapToTable("Butcher_SegmentStockUp")]
  public class SegmentStockUp
  {
    public long ID { get; set; }

    public bool Sync { get; set; }

    public DateTime Date { get; set; }

    public long DetailID { get; set; }

    public string BarCode { get; set; }

    public decimal? SecondNumber { get; set; }

    public decimal? UnitNumber { get; set; }

    [DbColumn(DefaultValue = 0)]
    public bool StandardPic { get; set; }

    [NonDmoProperty]
    public string ShortCode
    {
      get
      {
        if (string.IsNullOrEmpty(BarCode))
          return null;
        if (BarCode.Contains("260912011"))
          return BarCode.Replace("260912011", "");
        return BarCode;
      }
    }

    public string Goods_Name { get; set; }

    public string DeliverGoodsLine_Name { get; set; }

    public string Customer_Name { get; set; }

    [NonDmoProperty]
    public long BillID { get; set; }
  }

  public class AlreadyStockUp
  {
    public int State { get; set; }
    public long DetailID { get; set; }
    public long MaxID { get; set; }
    //public bool StandardPic { get; set; }
    public decimal? UnitNum { get; set; }
    public decimal? SecondNumber { get; set; }
  }

  public class DeliverLineGroup
  {
    public long ID { get; set; }
    public string Name { get; set; }
    public int Order { get; set; }
  }
}
