ucPlan.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using System.Collections;
  9. using Core.LgMes.Client.Comm;
  10. using CoreFS.CA06;
  11. using Core.Mes.Client.Common;
  12. namespace Core.LgMes.Client.LgResMgt
  13. {
  14. public partial class ucPlan : UserControl
  15. {
  16. public Hashtable _htPlanInfo; // 用于作业计划信息的表字段数据
  17. public OpeBase ob = null;
  18. public ucPlan()
  19. {
  20. InitializeComponent();
  21. CStaticMethod.SetUltraGridStyle(ultraGrid1, 2); //设置样式
  22. }
  23. private void ucPlan_Load(object sender, EventArgs e)
  24. {
  25. ultraDataSource1.Rows.Add(new object[] { "", "", "", "", "", "", "" });
  26. _htPlanInfo = new Hashtable();
  27. }
  28. /// <summary>
  29. /// 初始计划信息
  30. /// </summary>
  31. public void ResetData()
  32. {
  33. try
  34. {
  35. for (int i = 0; i < this.ultraDataSource1.Band.Columns.Count; i++)
  36. {
  37. if (this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.DateTime))
  38. this.ultraDataSource1.Rows[0][i] = null;
  39. else
  40. this.ultraDataSource1.Rows[0][i] = "";
  41. }
  42. }
  43. catch { }
  44. }
  45. /// <summary>
  46. /// 获取计划信息
  47. /// </summary>
  48. public void GetPlanInfo(string _smeltingID)
  49. {
  50. string strErr = "", szWhere = "";
  51. if (_smeltingID == "")
  52. return;
  53. try
  54. {
  55. ArrayList arry = new ArrayList();
  56. arry.Add("GetPlanInfo.select");
  57. arry.Add(_smeltingID);
  58. arry.Add(_smeltingID);
  59. arry.Add(_smeltingID);
  60. CommonClientToServer cctos = new CommonClientToServer();
  61. cctos.ob = ob;
  62. DataSet ds = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery",
  63. "doSimpleQuery", arry, out strErr);
  64. if (strErr == "" && ds != null)
  65. {
  66. if (ds.Tables[0].Rows.Count > 0)
  67. {
  68. for (int i = 0; i < ds.Tables[0].Columns.Count; i++)
  69. {
  70. if (_htPlanInfo.Contains(ds.Tables[0].Columns[i].ColumnName))
  71. _htPlanInfo.Remove(ds.Tables[0].Columns[i].ColumnName);
  72. _htPlanInfo.Add(ds.Tables[0].Columns[i].ColumnName, ds.Tables[0].Rows[0][i].ToString());
  73. }
  74. SetData(_htPlanInfo); //显示计划
  75. }
  76. else
  77. _htPlanInfo.Clear();
  78. }
  79. }
  80. catch { }
  81. }
  82. /// <summary>
  83. /// 显示计划信息
  84. /// </summary>
  85. /// <param name="ar"></param>
  86. public void SetData(Hashtable ar)
  87. {
  88. if (ar == null || ar.Count == 0)
  89. return;
  90. int count = this.ultraDataSource1.Band.Columns.Count;
  91. string strKey = "";
  92. for (int i = 0; i < count; i++)
  93. {
  94. try
  95. {
  96. strKey = this.ultraDataSource1.Band.Columns[i].Key;
  97. if (ar.Contains(strKey))
  98. {
  99. if (strKey == "SHIFTCODE") // 班次转换
  100. ultraDataSource1.Rows[0][i] = CStaticMethod.ClassConvert(ar[strKey].ToString());
  101. else if (strKey == "FACT_ROUTE")
  102. ultraDataSource1.Rows[0][i] = CStaticMethod.analysPath(ar[strKey].ToString());
  103. else
  104. ultraDataSource1.Rows[0][i] = ar[strKey];
  105. }
  106. else
  107. {
  108. if (this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.DateTime))
  109. this.ultraDataSource1.Rows[0][i] = null;
  110. else
  111. this.ultraDataSource1.Rows[0][i] = "";
  112. }
  113. }
  114. catch { }
  115. }
  116. }
  117. }
  118. }