using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace RDH.Data.Models
{
    [Serializable]
    [DataContract]
    public partial class OperationTakeItem : BaseSnapshotModel, IModel //, INotifyPropertyChanged
    {
        #region Fields
        private Guid _snapshotkey;
        private Guid? _key;
        private Guid? _takebagkey;
        private Guid? _itemkey;
        private DateTime? _starttime;
        private DateTime? _endtime;
        private Guid? _createby;
        private Decimal? _takequantity;
        private Decimal? _returnquantity;
        private Decimal? _checkquantity;
        private Decimal? _transferquantity;
        private Decimal? _abolishquantity;
        private Decimal? _returnstorequantity;
        private bool? _isoutsid;
        private Guid? _replaceby;
        private string _status;
        private Guid? _devicekey;
        private bool? _flag;
        private DateTime? _clienttime;
        private DateTime? _servertime;
        private string _ext01;
        private string _ext02;
        private string _ext03;
        private string _ext04;
        private string _ext05;
        private string _ext06;
        private string _ext07;
        private string _ext08;
        private string _ext09;
        private string _ext10;
        private Decimal? _disposequantity;
        private Guid? _witnessuser;
        private OperationTakeItemBag _operationtakeitembag;
        private Item _item;
        private ItemLot _itemLot;
        private Decimal? _maxQuantity;
        private Decimal? _inventoryQuantity;
        #endregion

        #region Public Properties

        [DataMember]
        public virtual Guid SnapshotKey
        {
            get { return _snapshotkey; }
            set
            {
                _snapshotkey = value;
                OnPropertyChanged("SnapshotKey");
            }
        }
        [DataMember]
        public virtual Guid? Key
        {
            get { return _key; }
            set
            {
                _key = value;
                OnPropertyChanged("Key");
            }
        }
        [DataMember]
        public virtual Guid? TakeBagKey
        {
            get { return _takebagkey; }
            set
            {
                _takebagkey = value;
                OnPropertyChanged("TakeBagKey");
            }
        }
        [DataMember]
        public virtual Guid? ItemKey
        {
            get { return _itemkey; }
            set
            {
                _itemkey = value;
                OnPropertyChanged("ItemKey");
            }
        }
        [DataMember]
        public virtual DateTime? StartTime
        {
            get { return _starttime; }
            set
            {
                _starttime = value;
                OnPropertyChanged("StartTime");
            }
        }
        [DataMember]
        public virtual DateTime? EndTime
        {
            get { return _endtime; }
            set
            {
                _endtime = value;
                OnPropertyChanged("EndTime");
                EndFlag = value == null ? 0 : 1;
            }
        }
        [DataMember]
        public virtual Guid? CreateBy
        {
            get { return _createby; }
            set
            {
                _createby = value;
                OnPropertyChanged("CreateBy");
            }
        }
        [DataMember]
        public virtual Decimal? TakeQuantity
        {
            get { return _takequantity; }
            set
            {
                _takequantity = value;
                OnPropertyChanged("TakeQuantity");
            }
        }
        [DataMember]
        public virtual Decimal? ReturnQuantity
        {
            get { return _returnquantity; }
            set
            {
                _returnquantity = value;
                OnPropertyChanged("ReturnQuantity");
            }
        }
        [DataMember]
        public virtual Decimal? CheckQuantity
        {
            get { return _checkquantity; }
            set
            {
                _checkquantity = value;
                OnPropertyChanged("CheckQuantity");
            }
        }
        [DataMember]
        public virtual Decimal? TransferQuantity
        {
            get { return _transferquantity; }
            set
            {
                _transferquantity = value;
                OnPropertyChanged("TransferQuantity");
            }
        }
        [DataMember]
        public virtual Decimal? AbolishQuantity
        {
            get { return _abolishquantity; }
            set
            {
                _abolishquantity = value;
                OnPropertyChanged("AbolishQuantity");
            }
        }
        [DataMember]
        public virtual Decimal? ReturnstoreQuantity
        {
            get { return _returnstorequantity; }
            set
            {
                _returnstorequantity = value;
                OnPropertyChanged("ReturnstoreQuantity");
            }
        }
        [DataMember]
        public virtual bool? IsOutsid
        {
            get { return _isoutsid; }
            set
            {
                _isoutsid = value;
                OnPropertyChanged("IsOutsid");
            }
        }
        [DataMember]
        public virtual Guid? ReplaceBy
        {
            get { return _replaceby; }
            set
            {
                _replaceby = value;
                OnPropertyChanged("ReplaceBy");
            }
        }
        [DataMember]
        public virtual string Status
        {
            get { return _status; }
            set
            {
                _status = value;
                OnPropertyChanged("Status");
            }
        }
        [DataMember]
        public virtual Guid? DeviceKey
        {
            get { return _devicekey; }
            set
            {
                _devicekey = value;
                OnPropertyChanged("DeviceKey");
            }
        }
        [DataMember]
        public virtual bool? Flag
        {
            get { return _flag; }
            set
            {
                _flag = value;
                OnPropertyChanged("Flag");
            }
        }
        [DataMember]
        public virtual DateTime? ClientTime
        {
            get { return _clienttime; }
            set
            {
                _clienttime = value;
                OnPropertyChanged("ClientTime");
            }
        }
        [DataMember]
        public virtual DateTime? ServerTime
        {
            get { return _servertime; }
            set
            {
                _servertime = value;
                OnPropertyChanged("ServerTime");
            }
        }
        /// <summary>
        /// 获取或设置关联的批号KEY
        /// </summary>
        [DataMember]
        public virtual string Ext01
        {
            get { return _ext01; }
            set
            {
                _ext01 = value;
                OnPropertyChanged("Ext01");
            }
        }
        /// <summary>
        /// 获取或设置残余液处理方式
        /// </summary>
        [DataMember]
        public virtual string Ext02
        {
            get { return _ext02; }
            set
            {
                _ext02 = value;
                OnPropertyChanged("Ext02");
            }
        }
        /// <summary>
        /// 获取或设置残余液是否已回收
        /// </summary>
        [DataMember]
        public virtual string Ext03
        {
            get { return _ext03; }
            set
            {
                _ext03 = value;
                OnPropertyChanged("Ext03");
            }
        }
        [DataMember]
        public virtual string Ext04
        {
            get { return _ext04; }
            set
            {
                _ext04 = value;
                OnPropertyChanged("Ext04");
            }
        }
        /// <summary>
        /// 获取或设置回收人姓名
        /// </summary>
        [DataMember]
        public virtual string Ext05
        {
            get { return _ext05; }
            set
            {
                _ext05 = value;
                OnPropertyChanged("Ext05");
            }
        }
        /// <summary>
        /// 获取或设置见证人姓名
        /// </summary>
        [DataMember]
        public virtual string Ext06
        {
            get { return _ext06; }
            set
            {
                _ext06 = value;
                OnPropertyChanged("Ext06");
            }
        }
        /// <summary>
        /// 获取或设置用药方式
        /// </summary>
        [DataMember]
        public virtual string Ext07
        {
            get { return _ext07; }
            set
            {
                _ext07 = value;
                OnPropertyChanged("Ext07");
            }
        }
        [DataMember]
        public virtual string Ext08
        {
            get { return _ext08; }
            set
            {
                _ext08 = value;
                OnPropertyChanged("Ext08");
            }
        }
        [DataMember]
        public virtual string Ext09
        {
            get { return _ext09; }
            set
            {
                _ext09 = value;
                OnPropertyChanged("Ext09");
            }
        }
        [DataMember]
        public virtual string Ext10
        {
            get { return _ext10; }
            set
            {
                _ext10 = value;
                OnPropertyChanged("Ext10");
            }
        }
        [DataMember]
        public virtual Decimal? DisposeQuantity
        {
            get { return _disposequantity; }
            set
            {
                _disposequantity = value;
                OnPropertyChanged("DisposeQuantity");
            }
        }
        [DataMember]
        public virtual Guid? WitnessUser
        {
            get { return _witnessuser; }
            set
            {
                _witnessuser = value;
                OnPropertyChanged("WitnessUser");
            }
        }
        [DataMember]
        public OperationTakeItemBag OperationTakeItemBag
        {
            get { return _operationtakeitembag; }
            set
            {
                _operationtakeitembag = value;
                OnPropertyChanged("OperationTakeItemBag");
            }
        }
        [DataMember]
        public Item Item
        {
            get { return _item; }
            set
            {
                _item = value;
                OnPropertyChanged("Item");
            }
        }

        [DataMember]
        public ItemLot ItemLot
        {
            get { return _itemLot; }
            set
            {
                _itemLot = value;
                OnPropertyChanged("ItemLot");
            }
        }
        public Decimal? MaxQuantity
        {
            get { return _maxQuantity; }
            set
            {
                _maxQuantity = value;
                OnPropertyChanged("MaxQuantity");
            }
        }
        public Decimal? InventoryQuantity
        {
            get { return _inventoryQuantity; }
            set
            {
                _inventoryQuantity = value;
                OnPropertyChanged("InventoryQuantity");
            }
        }
        #endregion
        public override string ToString()
        {
            return String.Format("{0}, 数量：{1}, 药品：{2}",
                _createtime.GetValueOrDefault().ToString(),
                _takequantity.GetValueOrDefault().ToString(),
                _item == null ? _itemkey.GetValueOrDefault().ToString() : _item.ToString());
        }
    }
}
