using CommunityToolkit.Mvvm.ComponentModel; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Media; using System.Windows.Media.TextFormatting; namespace Common.Models { /// /// 原液瓶的状态 /// public enum SourceBottleStateEnum { /// /// 空闲,没有在使用 /// Idl = 0, /// /// 使用中 /// Using, } /// /// 原液瓶盖子的状态 /// public enum SourceBottleLidStateEnum { Close, Open, } [Serializable] public class SourceLiquidBottleModel : ObservableObject { private bool _haveBottle = false; /// /// 是否有液体瓶子 /// public bool HaveBottle { get => _haveBottle; set { SetProperty(ref _haveBottle, value); } } private int _posId = 1; /// /// 液体原液瓶在工装中的位置(1-8) /// public int PosId_InBox { get => _posId; set { SetProperty(ref _posId, value); } } private string _boxsn = string.Empty; /// /// 液体原液瓶所在载具的二维码信息 /// public string BoxSNCode { get => _boxsn; set { SetProperty(ref _boxsn, value); } } private string _sn = string.Empty; /// /// 液体原液瓶的二维码信息 /// public string SNCode { get => _sn; set { SetProperty(ref _sn, value); } } private string _sourceLiquidName = string.Empty; /// /// 液体原液瓶中液体名称 /// public string SourceLiquidName { get => _sourceLiquidName; set { if (_sourceLiquidName != value) { _sourceLiquidName = value; OnPropertyChanged(nameof(SourceLiquidName)); OnPropertyChanged(nameof(LiquidDisplayColor)); } } } public Brush LiquidDisplayColor { get { if (string.IsNullOrEmpty(SourceLiquidName)) //没有有名称 { return (Brush)new BrushConverter().ConvertFrom("#dcd8d8"); } else { return (Brush)new BrushConverter().ConvertFrom("#cab2ec"); } } } private double _originVolume = 0; /// /// 初始体积 /// public double OriginVolume { get => _originVolume; set { if (_originVolume != value) { _originVolume = value; _remainVolume = value; OnPropertyChanged(nameof(OriginVolume)); OnPropertyChanged(nameof(RemainVolume)); } } } private double _remainVolume = 0; /// /// 剩余体积 单位ML /// public double RemainVolume { get => _remainVolume; set { SetProperty(ref _remainVolume, value); } } //private double _density = 1.00; ///// ///// 密度,单位g/mL ///// //public double Density //{ // get => _density; // set // { // SetProperty(ref _density, value); // } //} private SourceBottleStateEnum _sourceBottleState = SourceBottleStateEnum.Idl; /// /// 液体原液瓶状态 /// public SourceBottleStateEnum SourceLiquidBottleState { get => _sourceBottleState; set { SetProperty(ref _sourceBottleState, value); } } private SourceBottleLidStateEnum _LiquidBottleLidState = SourceBottleLidStateEnum.Close; /// /// 液体原液瓶盖子的状态 /// public SourceBottleLidStateEnum LiquidBottleLidState { get => _LiquidBottleLidState; set { SetProperty(ref _LiquidBottleLidState, value); } } public SourceLiquidBottleModel() { } } }