using CommunityToolkit.Mvvm.ComponentModel; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Media; namespace Common.Models { /// /// 粉末瓶类型 /// public enum PowderBottleTypeEnum { /// /// 如果是16ml 一个工装放4个 /// _16mL, /// /// 如果是125ml, 一个工装放2个 /// _125mL, } [Serializable] public class SourcePowderBottleModel : ObservableObject { private PowderBottleTypeEnum powderbottletype = PowderBottleTypeEnum._125mL; public PowderBottleTypeEnum PowderBottleType { get { return powderbottletype; } set { SetProperty(ref powderbottletype, value); } } private bool _haveBottle = false; /// /// 是否有粉末瓶子 /// public bool HaveBottle { get => _haveBottle; set { SetProperty(ref _haveBottle, value); } } private int _sourceInde = 0; /// /// 粉末原液瓶在工装中的原本位置 /// public int SourceIndex { get => _sourceInde; set { SetProperty(ref _sourceInde, value); } } private int _pos = 1; /// /// 粉末原液瓶在工装中的位置(1-4 对于125ml的粉末,位置对应1-2) /// public int PosId_InBox { get => _pos; set { SetProperty(ref _pos, value); } } private string _sn = string.Empty; /// /// 粉末瓶的二维码信息 /// public string SNCode { get => _sn; set { SetProperty(ref _sn, value); } } private string _boxsn = string.Empty; /// /// 粉末瓶所在载具的二维码信息 /// public string BoxSNCode { get => _boxsn; set { SetProperty(ref _boxsn, value); } } private string _sourcePowderName = string.Empty; /// /// 粉末原液瓶中粉末名称 /// public string SourcePowderName { get => _sourcePowderName; set { if (_sourcePowderName != value) { _sourcePowderName = value; OnPropertyChanged(nameof(SourcePowderName)); OnPropertyChanged(nameof(PowderDisplayColor)); } } } public Brush PowderDisplayColor { get { if (string.IsNullOrEmpty(SourcePowderName)) //没有有名称 { return (Brush)new BrushConverter().ConvertFrom("#dcd8d8"); } else { return (Brush)new BrushConverter().ConvertFrom("#b9cbf5"); //#FFFAFAF7 } } } private double _originWeight = 0.00; /// /// 粉末原液瓶初始重量 /// public double OriginWeight { get => _originWeight; set { if (_originWeight != value) { _originWeight = value; _remainWeight = value; OnPropertyChanged(nameof(OriginWeight)); OnPropertyChanged(nameof(RemainWeight)); } } } private double _remainWeight = 0; /// /// 剩余重量 单位g /// public double RemainWeight { get => _remainWeight; set { SetProperty(ref _remainWeight, value); } } private SourceBottleStateEnum _state = SourceBottleStateEnum.Idl; /// /// 粉末原液瓶状态 /// public SourceBottleStateEnum SourcePowderBottleState { get => _state; set { SetProperty(ref _state, value); } } private int _pos_inDosePowderHC = 1; /// /// 粉末原液瓶在投料工站中的10个粉末瓶缓存的位置(1-10) /// public int Pos_InDosePowderHC { get => _pos_inDosePowderHC; set { SetProperty(ref _pos_inDosePowderHC, value); } } } }