ProductionRecord.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using Prism.Mvvm;
  2. namespace SKMC.Api.Product.Record
  3. {
  4. /// <summary>
  5. /// 生产数据记录
  6. /// </summary>
  7. public class ProductionRecord : BindableBase
  8. {
  9. private int _total;
  10. public int Total
  11. {
  12. get { return _total; }
  13. set { _total = value; RaisePropertyChanged(); }
  14. }
  15. private long _consumeAll;
  16. public long ConsumeAll
  17. {
  18. get { return _consumeAll; }
  19. set { _consumeAll = value; }
  20. }
  21. private int _numOK;
  22. public int NumOK
  23. {
  24. get { return _numOK; }
  25. set { _numOK = value; RaisePropertyChanged(); }
  26. }
  27. private int _numNG;
  28. public int NumNG
  29. {
  30. get { return _numNG; }
  31. set { _numNG = value; RaisePropertyChanged(); }
  32. }
  33. private float _yield;
  34. public float Yield
  35. {
  36. get { return _yield; }
  37. set { _yield = value; RaisePropertyChanged(); }
  38. }
  39. public float GetYield() => (_numOK + _numNG == 0) ? 0 : (float)_numOK / (float)(_numOK + _numNG);
  40. private float _uph;
  41. public float Uph
  42. {
  43. get { return _uph; }
  44. set { _uph = value; RaisePropertyChanged(); }
  45. }
  46. public float GetUph() => (float)Total * 3600 / (float)(_consumeAll / 10000000);
  47. public override string ToString() => $"numOK: {NumOK}, numNG: {NumNG}, total: {Total}, yield: {Yield}, UPH: {Uph}";
  48. }
  49. }