副本 FrmFPRecall.cs 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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 CoreFS.CA03;
  10. using CoreFS.CA04;
  11. using CoreFS.CA06;
  12. using System.Collections;
  13. using Infragistics.Win.UltraWinGrid;
  14. using Core.Mes.Client.Comm.Server;
  15. using Core.Mes.Client.Comm.Control;
  16. using Core.Mes.Client.Comm.Tool;
  17. using Infragistics.Win.UltraWinEditors;
  18. using System.Text.RegularExpressions;
  19. namespace Core.StlMes.Client.MilCount
  20. {
  21. public partial class FrmFPRecall : FrmBase
  22. {
  23. public FrmFPRecall()
  24. {
  25. InitializeComponent();
  26. }
  27. /// <summary>
  28. /// 重写基类方法
  29. /// </summary>
  30. /// <param name="sender"></param>
  31. /// <param name="ToolbarKey"></param>
  32. public override void ToolBar_Click(object sender, string ToolbarKey)
  33. {
  34. switch (ToolbarKey)
  35. {
  36. case "doQuery":
  37. doQuery();
  38. break;
  39. case "doModify":
  40. Update();
  41. break;
  42. //case "doDelete":
  43. // this.doDeleteOrResume(true);
  44. // break;
  45. //case "doResume":
  46. // this.doDeleteOrResume(false);
  47. // break;
  48. //case "Close":
  49. // this.Close();
  50. //break;
  51. }
  52. }
  53. private void doQuery()
  54. {
  55. string titleName = "";
  56. if (ultraCheckEditor1.Checked)
  57. {
  58. titleName = txtyear.Text.Trim();
  59. DataTable dt = ServerHelper.GetData("com.steering.mes.fprecall.corefprecall.getLineList", new Object[] { titleName}, this.ob);
  60. GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
  61. }
  62. else
  63. {
  64. DataTable dt = ServerHelper.GetData("com.steering.mes.fprecall.corefprecall.getLineList_all", null, this.ob);
  65. GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
  66. }
  67. //不同颜色区分是否有效数据
  68. //Infragistics.Win.UltraWinGrid.UltraGridRow row = null;
  69. //for (int i = 0; i < ultraGrid2.Rows.Count; i++)
  70. //{
  71. // row = ultraGrid2.Rows[i];
  72. // if (!row.Cells["VALIDFLAG"].Value.ToString().Equals("1"))
  73. // {
  74. // row.Appearance.ForeColor = Color.Red;
  75. // }
  76. // else
  77. // {
  78. // row.Appearance.ForeColor = Color.Black;
  79. // }
  80. //}
  81. //列自适应
  82. //GridHelper.RefreshAndAutoSizeExceptRows(ultraGrid2, new UltraGridColumn[] {
  83. // ultraGrid2.DisplayLayout.Bands[0].Columns["MEMO"]
  84. //});
  85. }
  86. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  87. {
  88. Infragistics.Win.UltraWinGrid.UltraGridRow row = ultraGrid1.ActiveRow;
  89. if (row != null)
  90. {
  91. //STEELCODE,STEELNAME,STEELSTYLE
  92. txt_id.Text = row.Cells["标识ID"].Value.ToString();
  93. txt_lcode.Text = row.Cells["上料炉号"].Value.ToString();
  94. }
  95. }
  96. private void initJGDropDown(UltraComboEditor uce, string MethodId, string memberValue)
  97. {
  98. //初始化编辑区域下拉框
  99. DataTable dt = ServerHelper.GetData(MethodId, null, this.ob);
  100. if (dt != null && dt.Rows.Count > 0)
  101. {
  102. uce.DataSource = dt;
  103. uce.ValueMember = memberValue;
  104. }
  105. }
  106. private void FrmFPRecall_Load(object sender, EventArgs e)
  107. {
  108. InitCombo();
  109. }
  110. private void InitCombo()
  111. {
  112. initJGDropDown(cmbGXType, "com.steering.mes.fprecall.corefprecall.getGXType", "GX_Detail");
  113. initJGDropDown(cmbleixing, "com.steering.mes.fprecall.corefprecall.getLeiXing", "FP_Detail");
  114. }
  115. private void Update()
  116. {
  117. string para = @"^(\d+(\.\d+)?)|(\-1)$";//正则式
  118. Regex reg = new Regex(para);
  119. if (reg.IsMatch(txt_fd.Text) && reg.IsMatch(txt_fz.Text))
  120. {
  121. if (MessageUtil.ShowYesNoAndQuestion("是否确认修改?") == DialogResult.No)
  122. {
  123. return;
  124. }
  125. ArrayList list = new ArrayList();
  126. list.Add(txt_id.Text.Trim());//cmbGradeType.Value
  127. list.Add(cmbleixing.Value);
  128. list.Add(txt_fz.Text.Trim());
  129. list.Add(txt_fd.Text.Trim());
  130. list.Add(txt_length.Text.Trim());
  131. list.Add(txt_fgx.Text.Trim());
  132. list.Add(cmbGXType.Value);
  133. list.Add(ultraGrid1.ActiveRow.Cells["产出炉号"].Value.ToString());
  134. list.Add(ultraGrid1.ActiveRow.Cells["轧批号"].Value.ToString());
  135. list.Add(ultraGrid1.ActiveRow.Cells["外径"].Value.ToString());
  136. list.Add(ultraGrid1.ActiveRow.Cells["壁厚"].Value.ToString());
  137. ArrayList list2 = new ArrayList();
  138. //cmbGradeType.Value
  139. list2.Add(txt_id.Text.Trim());
  140. list2.Add(ultraGrid1.ActiveRow.Cells["轧批号"].Value.ToString());
  141. list2.Add(ultraGrid1.ActiveRow.Cells["产出炉号"].Value.ToString());
  142. list2.Add(txt_fz.Text.Trim());
  143. list2.Add(txt_fd.Text.Trim());
  144. ArrayList list3 = new ArrayList();
  145. //cmbGradeType.Value
  146. list3.Add(txt_fz.Text.Trim());
  147. list3.Add(txt_fd.Text.Trim());
  148. list3.Add(txt_id.Text.Trim());
  149. ServerHelper.SetData("com.steering.mes.fprecall.corefprecall.update", new object[] { list, list2, list3 }, ob);
  150. MessageUtil.ShowTips("修改成功!");
  151. doQuery();
  152. }
  153. else
  154. {
  155. MessageBox.Show("请输入数字!");
  156. return;
  157. }
  158. }
  159. private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e)
  160. {
  161. if (ultraCheckEditor1.Checked)
  162. {
  163. txtyear.ReadOnly = false;
  164. }
  165. else
  166. {
  167. txtyear.ReadOnly = true;
  168. }
  169. }
  170. private void txt_fd_KeyPress(object sender, KeyPressEventArgs e)
  171. {
  172. //if (!(Char.IsNumber(e.KeyChar)) && e.KeyChar != (char)8)
  173. //{
  174. // e.Handled = true;
  175. //}
  176. //else
  177. //{
  178. // MessageBox.Show("请输入数字!");
  179. //}
  180. }
  181. }
  182. }