200 lines
		
	
	
		
			6.4 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			200 lines
		
	
	
		
			6.4 KiB
		
	
	
	
		
			C#
		
	
	
	
using Prism.Mvvm;
 | 
						||
using SqlSugar;
 | 
						||
using System;
 | 
						||
using System.Collections.Generic;
 | 
						||
using System.Linq;
 | 
						||
using System.Security.Principal;
 | 
						||
using System.Text;
 | 
						||
using System.Threading.Tasks;
 | 
						||
 | 
						||
namespace DM_Weight.Models
 | 
						||
{
 | 
						||
    [SugarTable("dm_machine_record")]
 | 
						||
    public class MachineRecord : BindableBase
 | 
						||
    {
 | 
						||
        /// <summary>
 | 
						||
        /// 主键 
 | 
						||
        ///</summary>
 | 
						||
        [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)]
 | 
						||
        public int Id { get; set; }
 | 
						||
        /// <summary>
 | 
						||
        /// 设备id 
 | 
						||
        ///</summary>
 | 
						||
        [SugarColumn(ColumnName = "machine_id")]
 | 
						||
        public string MachineId { get; set; }
 | 
						||
        /// <summary>
 | 
						||
        /// 药品id 
 | 
						||
        ///</summary>
 | 
						||
        [SugarColumn(ColumnName = "drug_id")]
 | 
						||
        public string DrugId { get; set; }
 | 
						||
 | 
						||
        [Navigate(NavigateType.ManyToOne, nameof(DrugId))]
 | 
						||
        public DrugInfo DrugInfo { get; set; }
 | 
						||
        /// <summary>
 | 
						||
        /// 数量 
 | 
						||
        ///</summary>
 | 
						||
        [SugarColumn(ColumnName = "quantity")]
 | 
						||
        public int Quantity { get; set; }
 | 
						||
 | 
						||
 | 
						||
        //[SugarColumn(ColumnName = "stock_quantity")]
 | 
						||
        //public int? StockQuantity { get; set; }
 | 
						||
 | 
						||
        //[SugarColumn(ColumnName = "check_quantity")]
 | 
						||
        //public int? CheckQuantity { get; set; }
 | 
						||
 | 
						||
        /// <summary>
 | 
						||
        /// 批号 
 | 
						||
        ///</summary>
 | 
						||
        [SugarColumn(ColumnName = "manu_no")]
 | 
						||
        public string ManuNo { get; set; }
 | 
						||
        /// <summary>
 | 
						||
        /// 操作人id 
 | 
						||
        ///</summary>
 | 
						||
        [SugarColumn(ColumnName = "operator")]
 | 
						||
        public int? Operator { get; set; }
 | 
						||
 | 
						||
        [Navigate(NavigateType.ManyToOne, nameof(Operator))]
 | 
						||
        public UserList User { get; set; }
 | 
						||
        /// <summary>
 | 
						||
        /// 审核人id 
 | 
						||
        ///</summary>
 | 
						||
        [SugarColumn(ColumnName = "reviewer")]
 | 
						||
        public int? Reviewer { get; set; }
 | 
						||
        /// <summary>
 | 
						||
        /// 操作时间 
 | 
						||
        /// 默认值: CURRENT_TIMESTAMP
 | 
						||
        ///</summary>
 | 
						||
        [SugarColumn(ColumnName = "operation_time")]
 | 
						||
        public DateTime OperationTime { get; set; }
 | 
						||
        /// <summary>
 | 
						||
        /// 效期 
 | 
						||
        ///</summary>
 | 
						||
        [SugarColumn(ColumnName = "eff_date")]
 | 
						||
        public DateTime? EffDate { get; set; }
 | 
						||
        /// <summary>
 | 
						||
        /// 出库入库类型(1入库2出库31还药32还空瓶,21药箱移出移入,69药箱替换,55绑定药品操作(绑定、解绑、修改基数)) 70取出药箱、71还回药箱
 | 
						||
        ///</summary>
 | 
						||
        [SugarColumn(ColumnName = "type")]
 | 
						||
        public int Type { get; set; }
 | 
						||
        /// <summary>
 | 
						||
        ///操作类型(1放入药箱;0取走药箱) 
 | 
						||
        ///</summary>
 | 
						||
        [SugarColumn(ColumnName = "option_type")]
 | 
						||
        public int OptionType { get; set; }
 | 
						||
        /// <summary>
 | 
						||
        /// 出入库调拨单id 
 | 
						||
        ///</summary>
 | 
						||
        [SugarColumn(ColumnName = "invoice_id")]
 | 
						||
        public string InvoiceId { get; set; }
 | 
						||
        /// <summary>
 | 
						||
        /// 列号 
 | 
						||
        ///</summary>
 | 
						||
        [SugarColumn(ColumnName = "col_no")]
 | 
						||
        public int ColNo { get; set; }
 | 
						||
        /// <summary>
 | 
						||
        /// 抽屉号 
 | 
						||
        ///</summary>
 | 
						||
        [SugarColumn(ColumnName = "drawer_no")]
 | 
						||
        public int DrawerNo { get; set; }
 | 
						||
        /// <summary>
 | 
						||
        /// 取药科室 
 | 
						||
        ///</summary>
 | 
						||
        [SugarColumn(ColumnName = "department_id")]
 | 
						||
        public string DepartmentId { get; set; }
 | 
						||
        /// <summary>
 | 
						||
        /// 是否已经退药(0:没有1:还了部分2:完成)   取出药箱70还回药箱71
 | 
						||
        /// 默认值: 0
 | 
						||
        ///</summary>
 | 
						||
        [SugarColumn(ColumnName = "status")]
 | 
						||
        public int Status { get; set; }
 | 
						||
        /// <summary>
 | 
						||
        /// 退药量 
 | 
						||
        /// 默认值: 0
 | 
						||
        ///</summary>
 | 
						||
        private int returnQuantity1;
 | 
						||
        [SugarColumn(ColumnName = "return_quantity1", IsOnlyIgnoreInsert = true)]
 | 
						||
        public int ReturnQuantity1 { get => returnQuantity1; set => SetProperty(ref returnQuantity1, value); }
 | 
						||
        /// <summary>
 | 
						||
        /// 退空瓶量 
 | 
						||
        /// 默认值: 0
 | 
						||
        ///</summary>
 | 
						||
        private int returnQuantity2;
 | 
						||
        [SugarColumn(ColumnName = "return_quantity2", IsOnlyIgnoreInsert = true)]
 | 
						||
        public int ReturnQuantity2 { get => returnQuantity2; set => SetProperty(ref returnQuantity2, value); }
 | 
						||
        /// <summary>
 | 
						||
        /// 取药记录id 
 | 
						||
        ///</summary>
 | 
						||
        [SugarColumn(ColumnName = "get_id")]
 | 
						||
        public int? GetId { get; set; }
 | 
						||
        /// <summary>
 | 
						||
        /// 是否已经销毁 
 | 
						||
        /// 默认值: 0
 | 
						||
        ///</summary>
 | 
						||
        [SugarColumn(ColumnName = "is_destroy", IsOnlyIgnoreInsert = true)]
 | 
						||
        public int? IsDestroy { get; set; }
 | 
						||
 | 
						||
        /// <summary>
 | 
						||
        /// 销毁操作人 
 | 
						||
        /// 默认值: 0
 | 
						||
        ///</summary>
 | 
						||
        [SugarColumn(ColumnName = "take_user", IsOnlyIgnoreInsert = true)]
 | 
						||
        public string TakeUser { get; set; }
 | 
						||
 | 
						||
        /// <summary>
 | 
						||
        /// 销毁审核人 
 | 
						||
        /// 默认值: 0
 | 
						||
        ///</summary>
 | 
						||
        [SugarColumn(ColumnName = "fuzeren", IsOnlyIgnoreInsert = true)]
 | 
						||
        public string DestoryReviewerUser { get; set; }
 | 
						||
 | 
						||
 | 
						||
        [SugarColumn(IsIgnore = true)]
 | 
						||
        public int CanReturnQuantity
 | 
						||
        {
 | 
						||
            get => Quantity - ReturnQuantity1 - ReturnQuantity2;
 | 
						||
 | 
						||
        }
 | 
						||
 | 
						||
        [SugarColumn(IsIgnore = true)]
 | 
						||
        public bool IsSelected { get; set; }
 | 
						||
 | 
						||
        /// <summary>
 | 
						||
        /// 已核销数量
 | 
						||
        /// </summary>
 | 
						||
        private int hasCheckNum;
 | 
						||
        [SugarColumn(IsIgnore = true)]
 | 
						||
        public int HasCheckNum
 | 
						||
        {
 | 
						||
            get => hasCheckNum;
 | 
						||
            set => SetProperty(ref hasCheckNum, value);
 | 
						||
        }
 | 
						||
 | 
						||
 | 
						||
        private int checkQuantity;
 | 
						||
        /// <summary>
 | 
						||
        /// 核销数量
 | 
						||
        /// </summary>
 | 
						||
        [SugarColumn(IsIgnore = true)]
 | 
						||
        public int CheckQuantity
 | 
						||
        {
 | 
						||
            get => checkQuantity;
 | 
						||
            set
 | 
						||
            {
 | 
						||
                if (value > Quantity - hasCheckNum)
 | 
						||
                {
 | 
						||
                    throw new ArgumentException("核销数量不能大于取药数量");
 | 
						||
                }
 | 
						||
                //退空瓶
 | 
						||
                ReturnQuantity2 = value + hasCheckNum;
 | 
						||
                //退药量
 | 
						||
                ReturnQuantity1 = Quantity - value - hasCheckNum;
 | 
						||
                SetProperty(ref checkQuantity, value);
 | 
						||
            }
 | 
						||
        }
 | 
						||
 | 
						||
        [Navigate(NavigateType.OneToMany, nameof(SurgicalScheduleDetail.GetRecordId))]
 | 
						||
        public List<SurgicalScheduleDetail> _SurgicalScheduleDetailLst { get; set; }
 | 
						||
    }
 | 
						||
}
 |