FrmConfiguration.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using Core.Mes.Client.Comm.Server;
  10. using CoreFS.CA06;
  11. using System.Collections;
  12. using Core.Mes.Client.Comm.Control;
  13. using Infragistics.Win.UltraWinGrid;
  14. using Core.Mes.Client.Comm.Tool;
  15. namespace Core.StlMes.Client.Mcp.Coupling
  16. {
  17. public partial class FrmConfiguration : FrmBase
  18. {
  19. public FrmConfiguration()
  20. {
  21. InitializeComponent();
  22. this.IsLoadUserView = true;
  23. }
  24. private void FrmConfiguration_Load(object sender, EventArgs e)
  25. {
  26. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.FrmConfiguration.getQueryPline", null, this.ob);
  27. cmbCx.DataSource = dt;
  28. cmbCx.DisplayMember = "PLINE_NAME";
  29. cmbCx.ValueMember = "PLINE_CODE";
  30. cmbCname.DataSource = dt;
  31. cmbCname.DisplayMember = "PLINE_NAME";
  32. cmbCname.ValueMember = "PLINE_CODE";
  33. }
  34. public override void ToolBar_Click(object sender, string ToolbarKey)
  35. {
  36. switch (ToolbarKey)
  37. {
  38. case "DoQuery":
  39. DoQuery();
  40. break;
  41. case "DoSave":
  42. DoSave();
  43. break;
  44. case "DoUpdate":
  45. DoUpdate();
  46. break;
  47. case "DoDelete":
  48. DoDelete();
  49. break;
  50. case "DoClose":
  51. this.Close();
  52. break;
  53. }
  54. }
  55. /// <summary>
  56. /// 查询
  57. /// </summary>
  58. private void DoQuery()
  59. {
  60. string testName = txtJcxm.Text.ToString();
  61. string plineName = "";
  62. if (cmbCname.SelectedIndex == -1) { plineName = ""; }
  63. else
  64. {
  65. plineName = cmbCname.Value.ToString();
  66. }
  67. ArrayList list = new ArrayList();
  68. list.Add(testName);
  69. list.Add(plineName);
  70. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.FrmConfiguration.getQueryPhosphateItem", new object[] { list }, this.ob);
  71. GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
  72. }
  73. /// <summary>
  74. /// 新增
  75. /// </summary>
  76. private void DoSave()
  77. {
  78. ultraGrid1.UpdateData();
  79. int AddCount = 0;
  80. ArrayList list1 = new ArrayList();
  81. foreach (UltraGridRow ugr in ultraGrid1.Rows)
  82. {
  83. if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true)
  84. {
  85. AddCount += 1;
  86. ArrayList list = new ArrayList();
  87. //list.Add(ugr.Cells["ITEM_NO"].Text.ToString());
  88. list.Add(ugr.Cells["PLINE_CODE"].Value.ToString());
  89. list.Add(ugr.Cells["PROCEDUR_NO"].Text.ToString());
  90. list.Add(ugr.Cells["TEST_ITEMS"].Text.ToString());
  91. list.Add(ugr.Cells["SPAN"].Text.ToString());
  92. list.Add(ugr.Cells["SETTING_TEMPERATURE"].Text.ToString());
  93. list1.Add(list);
  94. }
  95. }
  96. if (AddCount == 0) { MessageUtil.ShowTips("请选择数据!"); return; }
  97. if (MessageUtil.ShowYesNoAndQuestion("是否新增磷化检测项目?") == DialogResult.No) { return; }
  98. int count = ServerHelper.SetData("com.steering.mes.mcp.coup.FrmConfiguration.getAddPhosphateItem", new object[] { list1 }, this.ob);
  99. if (count == 1)
  100. {
  101. MessageUtil.ShowTips("保存成功!");
  102. DoQuery();
  103. }
  104. else { MessageUtil.ShowTips("保存失败!"); }
  105. }
  106. /// <summary>
  107. /// 修改
  108. /// </summary>
  109. private void DoUpdate()
  110. {
  111. ultraGrid1.UpdateData();
  112. int updateCount = 0;
  113. ArrayList list1 = new ArrayList();
  114. foreach (UltraGridRow ugr in ultraGrid1.Rows)
  115. {
  116. if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true)
  117. {
  118. updateCount += 1;
  119. ArrayList list = new ArrayList();
  120. list.Add(ugr.Cells["PLINE_CODE"].Value.ToString());
  121. list.Add(ugr.Cells["PROCEDUR_NO"].Text.ToString());
  122. list.Add(ugr.Cells["TEST_ITEMS"].Text.ToString());
  123. list.Add(ugr.Cells["SPAN"].Text.ToString());
  124. list.Add(ugr.Cells["SETTING_TEMPERATURE"].Text.ToString());
  125. list.Add(ugr.Cells["ITEM_NO"].Text.ToString());
  126. list1.Add(list);
  127. }
  128. }
  129. if (updateCount == 0) { MessageUtil.ShowTips("请选择数据!"); return; }
  130. if (MessageUtil.ShowYesNoAndQuestion("是否修改磷化检测项目?") == DialogResult.No) { return; }
  131. int count = ServerHelper.SetData("com.steering.mes.mcp.coup.FrmConfiguration.getUpdatePhosphateItem", new object[] { list1 }, this.ob);
  132. if (count == 1)
  133. {
  134. MessageUtil.ShowTips("修改成功!");
  135. DoQuery();
  136. }
  137. else { MessageUtil.ShowTips("修改失败!"); }
  138. }
  139. /// <summary>
  140. /// 删除
  141. /// </summary>
  142. private void DoDelete()
  143. {
  144. ultraGrid1.UpdateData();
  145. int updateCount = 0;
  146. ArrayList list1 = new ArrayList();
  147. foreach (UltraGridRow ugr in ultraGrid1.Rows)
  148. {
  149. if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true)
  150. {
  151. updateCount += 1;
  152. ArrayList list = new ArrayList();
  153. list.Add(ugr.Cells["ITEM_NO"].Text.ToString());
  154. list1.Add(list);
  155. }
  156. }
  157. if (updateCount == 0) { MessageUtil.ShowTips("请选择数据!"); return; }
  158. if (MessageUtil.ShowYesNoAndQuestion("是否删除磷化检测项目?") == DialogResult.No) { return; }
  159. int count = ServerHelper.SetData("com.steering.mes.mcp.coup.FrmConfiguration.getDeletePhosphateItem", new object[] { list1 }, this.ob);
  160. if (count == 1)
  161. {
  162. MessageUtil.ShowTips("删除成功!");
  163. DoQuery();
  164. }
  165. else { MessageUtil.ShowTips("删除失败!"); }
  166. }
  167. }
  168. }