UControl_ParaInfo.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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 MeasureData;
  11. using FileManager;
  12. using System.Xml;
  13. namespace HOZProject
  14. {
  15. public partial class UControl_ParaInfo : UserControl
  16. {
  17. /// <summary>
  18. /// 开始时间
  19. /// </summary>
  20. private string startTime;
  21. /// <summary>
  22. /// 结束时间
  23. /// </summary>
  24. private string endTime;
  25. /// <summary>
  26. /// 状态
  27. /// </summary>
  28. private string state;
  29. /// <summary>
  30. /// 位置
  31. /// </summary>
  32. private SemPosition position;
  33. private bool isSwitch;
  34. private string cutHoleName;
  35. private FormHOZMain formHOZMain;
  36. public FormHOZMain FormHOZMainObject { get => formHOZMain; set => formHOZMain = value; }
  37. public string StartTime { get => startTime; set => startTime = value; }
  38. public string EndTime { get => endTime; set => endTime = value; }
  39. public string State { get => state; set => state = value; }
  40. public SemPosition Position { get => position; set => position = value; }
  41. public string CutHoleName { get => cutHoleName; set => cutHoleName = value; }
  42. public bool IsSwitch { get => isSwitch; set => isSwitch = value; }
  43. public UControl_ParaInfo(FormHOZMain formHOZ)
  44. {
  45. InitializeComponent();
  46. FormHOZMainObject = formHOZ;
  47. ShowMeasureFlow("1");
  48. }
  49. private void btnClose_Click(object sender, EventArgs e)
  50. {
  51. foreach (Control item in FormHOZMainObject.plFill.Controls)
  52. {
  53. if (item is Panel)
  54. {
  55. foreach (Control itemControl in item.Controls)
  56. {
  57. if (itemControl.Name == this.Name)
  58. {
  59. item.Controls.Remove(this);
  60. this.Dispose();
  61. item.Visible = false;
  62. break;
  63. }
  64. }
  65. }
  66. }
  67. }
  68. public void ShowUCTimeLine(TimeLineItem[] tlItem)
  69. {
  70. if (plTimeLine.Controls.Count == 0)
  71. {
  72. UCTimeLine uCTimeLine = new UCTimeLine(tlItem);
  73. uCTimeLine.Dock = DockStyle.Fill;
  74. plTimeLine.Controls.Add(uCTimeLine);
  75. }
  76. }
  77. /// <summary>
  78. /// 显示切孔参数信息
  79. /// </summary>
  80. public void ShowParaInfo()
  81. {
  82. int multiple = 1000;
  83. //设置Position参数
  84. lblX.Text = (Position.X * multiple).ToString("f3");
  85. lblY.Text = (Position.Y * multiple).ToString("f3");
  86. lblZ.Text = (Position.Z * multiple).ToString("f3");
  87. lblR.Text = Position.R.ToString();
  88. lblT.Text = Position.T.ToString();
  89. lblM.Text = Position.M.ToString();
  90. lblShowStartTime.Text = StartTime;
  91. lblShowEndTime.Text = EndTime;
  92. lblShowState.Text = State;
  93. lblCutHoleName.Text = CutHoleName;
  94. CkIsSwitch.Checked = IsSwitch;
  95. }
  96. /// <summary>
  97. /// 绑定流程信息
  98. /// </summary>
  99. /// <param name="flowCode"></param>
  100. private void ShowMeasureFlow(string flowCode)
  101. {
  102. TimeLineItem[] tlItem = GetMeasureFlowStructInfo(flowCode);
  103. if (tlItem != null)
  104. {
  105. ShowUCTimeLine(tlItem);
  106. }
  107. }
  108. private TimeLineItem[] GetMeasureFlowStructInfo(string MeasureCode)
  109. {
  110. string xmlfullname = Application.StartupPath+ @"\MeasureXML\MeasureStructXml.xml";
  111. XmlNodeList nodeList = XmlManager.GetXmlMeasureFlowNodeInfo(xmlfullname, MeasureCode);
  112. if (nodeList != null)
  113. {
  114. return XmlConvertTimeListItem(nodeList);
  115. }
  116. return null;
  117. }
  118. private TimeLineItem[] XmlConvertTimeListItem(XmlNodeList nodeList)
  119. {
  120. TimeLineItem[] timeLineItem = new TimeLineItem[nodeList.Count];
  121. for (int i = 0; i < nodeList.Count; i++)
  122. {
  123. TimeLineItem tlItem = new TimeLineItem();
  124. tlItem.Details = nodeList[i].Attributes["Details"].Value;
  125. tlItem.Code = nodeList[i].Attributes["Code"].Value;
  126. tlItem.State = 0;
  127. tlItem.Title = nodeList[i].Attributes["Title"].Value;
  128. tlItem.IsData = Convert.ToBoolean(nodeList[i].Attributes["IsData"].Value);
  129. timeLineItem[i] = tlItem;
  130. }
  131. return timeLineItem;
  132. }
  133. }
  134. }