using SqlSugar;
using System;
using System.Collections.Generic;
using System.Security.Principal;
using System.Text;

namespace SlnMesnac.Model.domain
{
    [SugarTable("wms_raw_stock"), TenantAttribute("mes")]
    public class WmsRawStock
    {
        /// <summary>
        /// 原材料库存ID
        /// </summary>
        [SugarColumn(ColumnName = "raw_stock_id", IsPrimaryKey = true, IsIdentity = true)]
        public long RawStockId { get; set; }

        /// <summary>
        /// 仓库ID
        /// </summary>
        [SugarColumn(ColumnName = "warehouse_id")]
        public long WarehouseId { get; set; }

        /// <summary>
        /// 仓库楼层
        /// </summary>
        [SugarColumn(ColumnName = "warehouse_floor")]
        public int? WarehouseFloor { get; set; }

        /// <summary>
        /// 库位编码
        /// </summary>
        [SugarColumn(ColumnName = "location_code", Length = 64)]
        public string LocationCode { get; set; }

        /// <summary>
        /// 库存类型：1原材料
        /// </summary>
        [SugarColumn(ColumnName = "stock_type", Length = 1)]
        public string StockType { get; set; }

        /// <summary>
        /// 物料ID
        /// </summary>
        [SugarColumn(ColumnName = "material_id")]
        public long MaterialId { get; set; }

        /// <summary>
        /// 物料条码，非批次号;当柜体不完整时存物料条码
        /// </summary>
        [SugarColumn(ColumnName = "instock_batch", Length = 64)]
        public string InstockBatch { get; set; }

        /// <summary>
        /// 托盘RFID代码
        /// </summary>
        [SugarColumn(ColumnName = "pallet_info_code", Length = 64, IsNullable = true)]
        public string PalletInfoCode { get; set; }

        /// <summary>
        /// 销售订单ID
        /// </summary>
        [SugarColumn(ColumnName = "sale_order_id", DefaultValue = "0")]
        public long SaleOrderId { get; set; }

        /// <summary>
        /// 安全库存标识(1是，0否)
        /// </summary>
        [SugarColumn(ColumnName = "safe_flag", Length = 1)]
        public string SafeFlag { get; set; }

        /// <summary>
        /// 入库时间;此入库时间从批次信息中获取，accepted_date
        /// </summary>
        [SugarColumn(ColumnName = "instock_date")]
        public DateTime? InstockDate { get; set; }

        /// <summary>
        /// 最晚出库时间;根据物料信“存放周期“计算出来的时间
        /// </summary>
        [SugarColumn(ColumnName = "last_outstock_time")]
        public DateTime? LastOutstockTime { get; set; }

        /// <summary>
        /// 质检状态(0待质检,1检验中,2质检通过,3质检不通过)
        /// </summary>
        [SugarColumn(ColumnName = "quality_status", Length = 1, IsNullable = true)]
        public string QualityStatus { get; set; }

        /// <summary>
        /// 完整标识(1是0否)拆分后为0
        /// </summary>
        [SugarColumn(ColumnName = "complete_flag", Length = 1, DefaultValue = "1")]
        public string CompleteFlag { get; set; }

        /// <summary>
        /// 总数量;库位存放的总数量
        /// </summary>
        [SugarColumn(ColumnName = "total_amount", DecimalDigits = 6)]
        public decimal TotalAmount { get; set; }

        /// <summary>
        /// 冻结数量;手动冻结的，暂时可不用
        /// </summary>
        [SugarColumn(ColumnName = "frozen_amount", DecimalDigits = 6, DefaultValue = "0.000000")]
        public decimal FrozenAmount { get; set; }

        /// <summary>
        /// 占用数量;申请时占用的数量，在出库时要减去出库数量，并且总数量要同步更新;
        /// </summary>
        [SugarColumn(ColumnName = "occupy_amount", DecimalDigits = 6, DefaultValue = "0.000000")]
        public decimal OccupyAmount { get; set; }

        /// <summary>
        /// 供应商ID
        /// </summary>
        [SugarColumn(ColumnName = "supplier_id", IsNullable = true)]
        public long? SupplierId { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        [SugarColumn(ColumnName = "create_by", Length = 64, IsNullable = true)]
        public string CreateBy { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(ColumnName = "create_date")]
        public DateTime? CreateDate { get; set; }

        /// <summary>
        /// 最后更新人
        /// </summary>
        [SugarColumn(ColumnName = "update_by", Length = 64, IsNullable = true)]
        public string UpdateBy { get; set; }

        /// <summary>
        /// 最后更新时间
        /// </summary>
        [SugarColumn(ColumnName = "update_date")]
        public DateTime? UpdateDate { get; set; }

        /// <summary>
        /// 有效标记
        /// </summary>
        [SugarColumn(ColumnName = "active_flag", Length = 1, DefaultValue = "1")]
        public string ActiveFlag { get; set; }
    }
}
