PointValueAI.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using IntelligentControlForsx.Service.WindturbineInfo;
  11. namespace IntelligentControlForsx.MyControls.windturbine
  12. {
  13. public partial class PointValueAI : UserControl
  14. {
  15. public PointValueAI()
  16. {
  17. InitializeComponent();
  18. }
  19. private string nameString;
  20. public string NameString
  21. {
  22. set
  23. {
  24. nameString = value;
  25. lblName.Text = value;
  26. }
  27. get { return nameString; }
  28. }
  29. private string unitString;
  30. public string UnitString
  31. {
  32. set
  33. {
  34. unitString = value;
  35. lblUnit.Text = value;
  36. }
  37. get { return unitString; }
  38. }
  39. private string valueString;
  40. public string ValueString
  41. {
  42. set
  43. {
  44. valueString = value;
  45. lblValue.ValueString = value;
  46. }
  47. get { return valueString; }
  48. }
  49. public void BindData(UniformCodeInfo data)
  50. {
  51. if (string.IsNullOrEmpty(data.Name))
  52. {
  53. lblValue.Visible = false;
  54. lblUnit.Text = "";
  55. lblName.Text = "";
  56. }
  57. else
  58. {
  59. lblValue.Visible = true;
  60. lblName.Text = data.Name;
  61. if (data.Name.Contains("总发电量") || data.Name.Contains("发电量") || data.Name.Contains("量"))
  62. {
  63. double? pointValue = Convert.ToDouble(data.PointValue);
  64. double finalValue = pointValue.Value / 10000;
  65. lblValue.BindData(data.WindturbineId, data.UniformCode, finalValue.ToString("f2"), data.Name);
  66. }
  67. else if (data.Name.Contains("发电机转速") && data.ModelId == "UP105-2000-S")
  68. {
  69. double? pointValue = Convert.ToDouble(data.PointValue);
  70. double finalValue = pointValue.Value * 9.55;
  71. lblValue.BindData(data.WindturbineId, data.UniformCode, finalValue.ToString("f2"), data.Name);
  72. }
  73. else
  74. {
  75. lblValue.ValueString = data.PointValue;
  76. lblValue.BindData(data.WindturbineId, data.UniformCode, data.PointValue, data.Name);
  77. }
  78. lblUnit.Text = data.Unit;
  79. }
  80. }
  81. }
  82. }