ucResEaf.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. using System;
  2. using System.Collections;
  3. using System.Windows.Forms;
  4. using Infragistics.Win;
  5. using Infragistics.Win.UltraWinGrid;
  6. using System.Drawing;
  7. using System.Data;
  8. namespace Core.StlMes.Client.LgCommon
  9. {
  10. //public delegate void GetDataDelegate();
  11. public partial class ucResEaf : ucResBase
  12. {
  13. /// <summary>
  14. /// 吹氧次数按钮点击事件代理
  15. /// </summary>
  16. public GetDataDelegate GetOxygenBlastTimesHandler = null;
  17. /// <summary>
  18. /// 氧枪历史按钮点击事件代理
  19. /// </summary>
  20. public GetDataDelegate GetOxygenLanceHistoryHandler = null;
  21. public bool allowSave = true; //是否允许修改实绩
  22. public bool allowSave1 = true; //是否允许修改实绩
  23. public bool allowSave2 = true; //是否允许修改实绩
  24. public bool allowSave3 = true; //是否允许修改实绩
  25. public DataSet dsTept = new DataSet(); //出钢温度
  26. public ucResEaf()
  27. {
  28. InitializeComponent();
  29. try
  30. {
  31. if (ultraDataSource1.Rows.Count>0)
  32. ultraDataSource1.Rows[0]["OXYGENLANCEHISTORY"] = "氧枪历史";
  33. }
  34. catch { }
  35. }
  36. protected override void InitValuelist()
  37. {
  38. base.InitValuelist();
  39. try
  40. {
  41. ValueList vlist = ClsBusinessPack.GetValuelistBlockSlagEffect();
  42. ClsControlPack.SetGridValuelist(ref ultraGrid1, "BLKREDEFFECTS", ref vlist);
  43. ValueList vlist1 = ClsBusinessPack.GetValuelistBlockSlagMode();
  44. ClsControlPack.SetGridValuelist(ref ultraGrid1, "BLKREDMODE", ref vlist1);
  45. ValueList vlist2 = ClsBusinessPack.GetValuelistIronSourceForBOF();
  46. ClsControlPack.SetGridValuelist(ref ultraGrid1, "MOLIRNTYPE", ref vlist2);
  47. }
  48. catch { }
  49. }
  50. public override void ResetData()
  51. {
  52. base.ResetData();
  53. try
  54. {
  55. UltraGridRow row = ultraGrid1.Rows[0];
  56. row.Cells["OXYGENLANCEHISTORY"].Value = "氧枪枪位曲线";
  57. }
  58. catch { }
  59. }
  60. public override void SetData(Hashtable ar)
  61. {
  62. base.SetData(ar);
  63. try
  64. {
  65. UltraGridRow row = ultraGrid1.Rows[0];
  66. row.Cells["OXYGENLANCEHISTORY"].Value = "氧枪枪位曲线";
  67. ClsBusinessPack.GetTimeSpanfromUI(row.Cells["CHANGESTARTTIME"], row.Cells["CHANGEENDTIME"], row.Cells["CHANGETIME"]);
  68. ClsBusinessPack.GetTimeSpanfromUI(row.Cells["OPENOXYGENTIME"], row.Cells["STOPOXYGENTIME"], row.Cells["SUPPLYOXYGENTIME"]);
  69. ClsBusinessPack.GetTimeSpanfromUI(row.Cells["TAPPINGSTARTTIME"], row.Cells["TAPPINGENDTIME"], row.Cells["TAPPINGTIME"]);
  70. ClsBusinessPack.GetTimeSpanfromUI(row.Cells["PSSTARTTIME"], row.Cells["PSENDTIME"], row.Cells["BRPSTIME"]);
  71. if (dsTept != null && dsTept.Tables[0].Rows.Count > 0)
  72. {
  73. ValueList vlist3 = ClsBusinessPack.GetValuelistTeptForBOF(dsTept);
  74. ClsControlPack.SetGridValuelist(ref ultraGrid1, "TERMINUSTEPT", ref vlist3);
  75. }
  76. else
  77. {
  78. ultraGrid1.DisplayLayout.Bands[0].Columns["TERMINUSTEPT"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.EditButton;
  79. }
  80. allowSave = true; //是否允许修改实绩
  81. allowSave1 = true; //是否允许修改实绩
  82. allowSave2 = true; //是否允许修改实绩
  83. allowSave3 = true; //是否允许修改实绩
  84. }
  85. catch { }
  86. }
  87. private void ultraGrid1_KeyPress(object sender, KeyPressEventArgs e)
  88. {
  89. string strKey = this.ultraGrid1.ActiveCell.Column.ToString();
  90. if (strKey == "OGGNUMID" || strKey == "GAGE" || strKey == "SAGE" ||
  91. strKey == "BLOWO2TIMES" || strKey == "EMOLSTLTIME" || strKey == "IRONPOTID")
  92. {
  93. if (!(Char.IsNumber(e.KeyChar) && ultraGrid1.ActiveRow.Cells[strKey].Value.ToString().Length <= 6) && e.KeyChar != '\b')
  94. {
  95. e.Handled = true;
  96. }
  97. }
  98. if (strKey == "RSSTOVENO")
  99. {
  100. if (!(Char.IsNumber(e.KeyChar) && ultraGrid1.ActiveRow.Cells[strKey].Value.ToString().Length <= 8) && e.KeyChar != '\b')
  101. {
  102. e.Handled = true;
  103. }
  104. }
  105. if (strKey == "IRONPOTWGT" || strKey == "IRONTEMPERATURE" || strKey == "WSTEELWGT" ||
  106. strKey == "PIGIRONWGT" || strKey == "O2CONSUME" || strKey == "TOPN2CONSUME" ||
  107. strKey == "TERMINUSC" || strKey == "TERMINUSO2" || strKey == "TERMINUSTEPT" ||
  108. strKey == "RSWGT" )
  109. {
  110. if (!(e.KeyChar == '\b') && ultraGrid1.ActiveRow.Cells[strKey].Value.ToString().Length >= 6)
  111. {
  112. e.Handled = true;
  113. }
  114. if (!(Char.IsNumber(e.KeyChar) || e.KeyChar == '\b' || e.KeyChar == '.'))
  115. {
  116. e.Handled = true;
  117. }
  118. if (e.KeyChar == '.')
  119. {
  120. char[] arrary = ultraGrid1.ActiveRow.Cells[strKey].Text.ToCharArray();
  121. if (arrary.Length == 0)
  122. {
  123. ultraGrid1.ActiveRow.Cells[strKey].Value = "0.";
  124. ultraGrid1.ActiveRow.Cells[strKey].SelStart = ultraGrid1.ActiveRow.Cells[strKey].Value.ToString().Length;
  125. e.Handled = true;
  126. }
  127. else
  128. {
  129. for (int i = 0; i < arrary.Length; i++)
  130. {
  131. if (arrary[i] == '.')
  132. e.Handled = true;
  133. }
  134. }
  135. }
  136. }
  137. if (strKey == "MEMO")
  138. {
  139. char[] arrary = ultraGrid1.ActiveRow.Cells[strKey].Text.ToCharArray();
  140. if (!(e.KeyChar == '\b') && arrary.Length >= 40)
  141. {
  142. // MessageBox.Show("生产记事不能超过40个字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  143. e.Handled = true;
  144. }
  145. }
  146. if (strKey == "PROTECTDTEG")
  147. {
  148. char[] arrary = ultraGrid1.ActiveRow.Cells[strKey].Text.ToCharArray();
  149. if (!(e.KeyChar == '\b') && arrary.Length >= 10)
  150. {
  151. // MessageBox.Show("保护渣名称不能超过10个字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  152. e.Handled = true;
  153. }
  154. }
  155. }
  156. protected override void ultraGrid1_AfterCellUpdate(object sender, CellEventArgs e)
  157. {
  158. base.ultraGrid1_AfterCellUpdate(sender, e);
  159. try
  160. {
  161. if (!e.Cell.Column.Hidden && e.Cell.Column.CellActivation == Activation.AllowEdit)
  162. {
  163. string strKey = e.Cell.Column.Key.ToUpper();
  164. UltraGridRow row = e.Cell.Row;
  165. if (strKey.Equals("CHANGESTARTTIME") || strKey.Equals("CHANGEENDTIME"))
  166. {
  167. if ((DateTime)ultraGrid1.ActiveRow.Cells["CHANGESTARTTIME"].Value > (DateTime)ultraGrid1.ActiveRow.Cells["CHANGEENDTIME"].Value)
  168. {
  169. e.Cell.Appearance.BackColor = Color.Red;
  170. MessageBox.Show("兑铁结束时刻不能早于开始时刻", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  171. allowSave = false;
  172. return;
  173. }
  174. else
  175. {
  176. if (ultraGrid1.ActiveRow.Cells["CHANGESTARTTIME"].Appearance.BackColor == Color.Red)
  177. {
  178. ultraGrid1.ActiveRow.Cells["CHANGESTARTTIME"].Appearance.BackColor = Color.Orange;
  179. }
  180. if (ultraGrid1.ActiveRow.Cells["CHANGEENDTIME"].Appearance.BackColor == Color.Red)
  181. {
  182. ultraGrid1.ActiveRow.Cells["CHANGEENDTIME"].Appearance.BackColor = Color.Orange;
  183. }
  184. allowSave = true;
  185. }
  186. ClsBusinessPack.GetTimeSpanfromUI(row.Cells["CHANGESTARTTIME"], row.Cells["CHANGEENDTIME"], row.Cells["CHANGETIME"]);
  187. }
  188. else if (strKey.Equals("OPENOXYGENTIME") || strKey.Equals("STOPOXYGENTIME"))
  189. {
  190. if ((DateTime)ultraGrid1.ActiveRow.Cells["OPENOXYGENTIME"].Value > (DateTime)ultraGrid1.ActiveRow.Cells["STOPOXYGENTIME"].Value)
  191. {
  192. e.Cell.Appearance.BackColor = Color.Red;
  193. MessageBox.Show("停氧时刻不能早于开氧时刻", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  194. allowSave1 = false;
  195. return;
  196. }
  197. else
  198. {
  199. if (ultraGrid1.ActiveRow.Cells["OPENOXYGENTIME"].Appearance.BackColor == Color.Red)
  200. {
  201. ultraGrid1.ActiveRow.Cells["OPENOXYGENTIME"].Appearance.BackColor = Color.Orange;
  202. }
  203. if (ultraGrid1.ActiveRow.Cells["STOPOXYGENTIME"].Appearance.BackColor == Color.Red)
  204. {
  205. ultraGrid1.ActiveRow.Cells["STOPOXYGENTIME"].Appearance.BackColor = Color.Orange;
  206. }
  207. allowSave1 = true;
  208. }
  209. ClsBusinessPack.GetTimeSpanfromUI(row.Cells["OPENOXYGENTIME"], row.Cells["STOPOXYGENTIME"], row.Cells["SUPPLYOXYGENTIME"]);
  210. }
  211. else if (strKey.Equals("TAPPINGSTARTTIME") || strKey.Equals("TAPPINGENDTIME"))
  212. {
  213. if ((DateTime)ultraGrid1.ActiveRow.Cells["TAPPINGSTARTTIME"].Value > (DateTime)ultraGrid1.ActiveRow.Cells["TAPPINGENDTIME"].Value)
  214. {
  215. e.Cell.Appearance.BackColor = Color.Red;
  216. MessageBox.Show("出钢结束时刻不能早于出钢开始时刻", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  217. allowSave2 = false;
  218. return;
  219. }
  220. else
  221. {
  222. if (ultraGrid1.ActiveRow.Cells["TAPPINGSTARTTIME"].Appearance.BackColor == Color.Red)
  223. {
  224. ultraGrid1.ActiveRow.Cells["TAPPINGSTARTTIME"].Appearance.BackColor = Color.Orange;
  225. }
  226. if (ultraGrid1.ActiveRow.Cells["TAPPINGENDTIME"].Appearance.BackColor == Color.Red)
  227. {
  228. ultraGrid1.ActiveRow.Cells["TAPPINGENDTIME"].Appearance.BackColor = Color.Orange;
  229. }
  230. allowSave2 = true;
  231. }
  232. ClsBusinessPack.GetTimeSpanfromUI(row.Cells["TAPPINGSTARTTIME"], row.Cells["TAPPINGENDTIME"], row.Cells["TAPPINGTIME"]);
  233. }
  234. else if (strKey.Equals("PSSTARTTIME") || strKey.Equals("PSENDTIME"))
  235. {
  236. if ((DateTime)ultraGrid1.ActiveRow.Cells["PSSTARTTIME"].Value > (DateTime)ultraGrid1.ActiveRow.Cells["PSENDTIME"].Value)
  237. {
  238. e.Cell.Appearance.BackColor = Color.Red;
  239. MessageBox.Show("溅渣结束时刻不能早于溅渣开始时刻", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  240. allowSave3 = false;
  241. return;
  242. }
  243. else
  244. {
  245. if (ultraGrid1.ActiveRow.Cells["PSSTARTTIME"].Appearance.BackColor == Color.Red)
  246. {
  247. ultraGrid1.ActiveRow.Cells["PSSTARTTIME"].Appearance.BackColor = Color.Orange;
  248. }
  249. if (ultraGrid1.ActiveRow.Cells["PSENDTIME"].Appearance.BackColor == Color.Red)
  250. {
  251. ultraGrid1.ActiveRow.Cells["PSENDTIME"].Appearance.BackColor = Color.Orange;
  252. }
  253. allowSave3 = true;
  254. }
  255. ClsBusinessPack.GetTimeSpanfromUI(row.Cells["PSSTARTTIME"], row.Cells["PSENDTIME"], row.Cells["BRPSTIME"]);
  256. }
  257. }
  258. }
  259. catch { }
  260. }
  261. protected override void ultraGrid1_ClickCellButton(object sender, CellEventArgs e)
  262. {
  263. base.ultraGrid1_ClickCellButton(sender, e);
  264. try
  265. {
  266. string strKey = e.Cell.Column.Key.ToUpper();
  267. if (e.Cell.Column.DataType != typeof(DateTime))
  268. {
  269. if (strKey.Equals("RSSTOVENO"))
  270. {
  271. frmHeatNoEditor frm = new frmHeatNoEditor();
  272. frm.InputText = Convert.ToString(e.Cell.Text);
  273. frm.Location = ClsControlPack.GetChildWindowLocation(frm.Size);
  274. if (frm.ShowDialog() == DialogResult.OK)
  275. {
  276. e.Cell.Value = frm.InputText;
  277. ultraGrid1.UpdateData();
  278. }
  279. }
  280. else if (strKey.Equals("BLOWO2TIMES"))
  281. {
  282. if (GetOxygenBlastTimesHandler != null)
  283. this.Invoke(GetOxygenBlastTimesHandler);
  284. }
  285. else if (strKey.Equals("OXYGENLANCEHISTORY"))
  286. {
  287. if (GetOxygenLanceHistoryHandler != null)
  288. this.Invoke(GetOxygenLanceHistoryHandler);
  289. }
  290. else
  291. {
  292. frmInputDecimal frm = new frmInputDecimal(Convert.ToString(e.Cell.Text));
  293. frm.Location = ClsControlPack.GetChildWindowLocation(frm.Size);
  294. if (frm.ShowDialog() == DialogResult.OK)
  295. {
  296. if (!frm.ValueChanged) return;
  297. e.Cell.Value = frm.Value;
  298. ultraGrid1.UpdateData();
  299. }
  300. }
  301. }
  302. }
  303. catch { }
  304. }
  305. }
  306. }