ucResBofc.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 ucResBofc : 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 ucResBofc()
  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. }
  81. catch { }
  82. }
  83. private void ultraGrid1_KeyPress(object sender, KeyPressEventArgs e)
  84. {
  85. string strKey = this.ultraGrid1.ActiveCell.Column.ToString();
  86. if (strKey == "OGGNUMID" || strKey == "GAGE" || strKey == "SAGE" ||
  87. strKey == "BLOWO2TIMES" || strKey == "EMOLSTLTIME" || strKey == "IRONPOTID")
  88. {
  89. if (!(Char.IsNumber(e.KeyChar) && ultraGrid1.ActiveRow.Cells[strKey].Value.ToString().Length <= 6) && e.KeyChar != '\b')
  90. {
  91. e.Handled = true;
  92. }
  93. }
  94. if (strKey == "RSSTOVENO")
  95. {
  96. if (!(Char.IsNumber(e.KeyChar) && ultraGrid1.ActiveRow.Cells[strKey].Value.ToString().Length <= 8) && e.KeyChar != '\b')
  97. {
  98. e.Handled = true;
  99. }
  100. }
  101. if (strKey == "IRONPOTWGT" || strKey == "IRONTEMPERATURE" || strKey == "WSTEELWGT" ||
  102. strKey == "PIGIRONWGT" || strKey == "O2CONSUME" || strKey == "TOPN2CONSUME" ||
  103. strKey == "TERMINUSC" || strKey == "TERMINUSO2" || strKey == "TERMINUSTEPT" ||
  104. strKey == "RSWGT" )
  105. {
  106. if (!(e.KeyChar == '\b') && ultraGrid1.ActiveRow.Cells[strKey].Value.ToString().Length >= 6)
  107. {
  108. e.Handled = true;
  109. }
  110. if (!(Char.IsNumber(e.KeyChar) || e.KeyChar == '\b' || e.KeyChar == '.'))
  111. {
  112. e.Handled = true;
  113. }
  114. if (e.KeyChar == '.')
  115. {
  116. char[] arrary = ultraGrid1.ActiveRow.Cells[strKey].Text.ToCharArray();
  117. if (arrary.Length == 0)
  118. {
  119. ultraGrid1.ActiveRow.Cells[strKey].Value = "0.";
  120. ultraGrid1.ActiveRow.Cells[strKey].SelStart = ultraGrid1.ActiveRow.Cells[strKey].Value.ToString().Length;
  121. e.Handled = true;
  122. }
  123. else
  124. {
  125. for (int i = 0; i < arrary.Length; i++)
  126. {
  127. if (arrary[i] == '.')
  128. e.Handled = true;
  129. }
  130. }
  131. }
  132. }
  133. if (strKey == "MEMO")
  134. {
  135. char[] arrary = ultraGrid1.ActiveRow.Cells[strKey].Text.ToCharArray();
  136. if (!(e.KeyChar == '\b') && arrary.Length >= 40)
  137. {
  138. // MessageBox.Show("生产记事不能超过40个字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  139. e.Handled = true;
  140. }
  141. }
  142. if (strKey == "PROTECTDTEG")
  143. {
  144. char[] arrary = ultraGrid1.ActiveRow.Cells[strKey].Text.ToCharArray();
  145. if (!(e.KeyChar == '\b') && arrary.Length >= 10)
  146. {
  147. // MessageBox.Show("保护渣名称不能超过10个字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  148. e.Handled = true;
  149. }
  150. }
  151. }
  152. protected override void ultraGrid1_AfterCellUpdate(object sender, CellEventArgs e)
  153. {
  154. base.ultraGrid1_AfterCellUpdate(sender, e);
  155. try
  156. {
  157. if (!e.Cell.Column.Hidden && e.Cell.Column.CellActivation == Activation.AllowEdit)
  158. {
  159. string strKey = e.Cell.Column.Key.ToUpper();
  160. UltraGridRow row = e.Cell.Row;
  161. if (strKey.Equals("CHANGESTARTTIME") || strKey.Equals("CHANGEENDTIME"))
  162. {
  163. if ((DateTime)ultraGrid1.ActiveRow.Cells["CHANGESTARTTIME"].Value > (DateTime)ultraGrid1.ActiveRow.Cells["CHANGEENDTIME"].Value)
  164. {
  165. e.Cell.Appearance.BackColor = Color.Red;
  166. MessageBox.Show("兑铁结束时刻不能早于开始时刻", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  167. allowSave = false;
  168. return;
  169. }
  170. else
  171. {
  172. if (ultraGrid1.ActiveRow.Cells["CHANGESTARTTIME"].Appearance.BackColor == Color.Red)
  173. {
  174. ultraGrid1.ActiveRow.Cells["CHANGESTARTTIME"].Appearance.BackColor = Color.Orange;
  175. }
  176. if (ultraGrid1.ActiveRow.Cells["CHANGEENDTIME"].Appearance.BackColor == Color.Red)
  177. {
  178. ultraGrid1.ActiveRow.Cells["CHANGEENDTIME"].Appearance.BackColor = Color.Orange;
  179. }
  180. allowSave = true;
  181. }
  182. ClsBusinessPack.GetTimeSpanfromUI(row.Cells["CHANGESTARTTIME"], row.Cells["CHANGEENDTIME"], row.Cells["CHANGETIME"]);
  183. }
  184. else if (strKey.Equals("OPENOXYGENTIME") || strKey.Equals("STOPOXYGENTIME"))
  185. {
  186. if ((DateTime)ultraGrid1.ActiveRow.Cells["OPENOXYGENTIME"].Value > (DateTime)ultraGrid1.ActiveRow.Cells["STOPOXYGENTIME"].Value)
  187. {
  188. e.Cell.Appearance.BackColor = Color.Red;
  189. MessageBox.Show("停氧时刻不能早于开氧时刻", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  190. allowSave1 = false;
  191. return;
  192. }
  193. else
  194. {
  195. if (ultraGrid1.ActiveRow.Cells["OPENOXYGENTIME"].Appearance.BackColor == Color.Red)
  196. {
  197. ultraGrid1.ActiveRow.Cells["OPENOXYGENTIME"].Appearance.BackColor = Color.Orange;
  198. }
  199. if (ultraGrid1.ActiveRow.Cells["STOPOXYGENTIME"].Appearance.BackColor == Color.Red)
  200. {
  201. ultraGrid1.ActiveRow.Cells["STOPOXYGENTIME"].Appearance.BackColor = Color.Orange;
  202. }
  203. allowSave1 = true;
  204. }
  205. ClsBusinessPack.GetTimeSpanfromUI(row.Cells["OPENOXYGENTIME"], row.Cells["STOPOXYGENTIME"], row.Cells["SUPPLYOXYGENTIME"]);
  206. }
  207. else if (strKey.Equals("TAPPINGSTARTTIME") || strKey.Equals("TAPPINGENDTIME"))
  208. {
  209. if ((DateTime)ultraGrid1.ActiveRow.Cells["TAPPINGSTARTTIME"].Value > (DateTime)ultraGrid1.ActiveRow.Cells["TAPPINGENDTIME"].Value)
  210. {
  211. e.Cell.Appearance.BackColor = Color.Red;
  212. MessageBox.Show("出钢结束时刻不能早于出钢开始时刻", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  213. allowSave2 = false;
  214. return;
  215. }
  216. else
  217. {
  218. if (ultraGrid1.ActiveRow.Cells["TAPPINGSTARTTIME"].Appearance.BackColor == Color.Red)
  219. {
  220. ultraGrid1.ActiveRow.Cells["TAPPINGSTARTTIME"].Appearance.BackColor = Color.Orange;
  221. }
  222. if (ultraGrid1.ActiveRow.Cells["TAPPINGENDTIME"].Appearance.BackColor == Color.Red)
  223. {
  224. ultraGrid1.ActiveRow.Cells["TAPPINGENDTIME"].Appearance.BackColor = Color.Orange;
  225. }
  226. allowSave2 = true;
  227. }
  228. ClsBusinessPack.GetTimeSpanfromUI(row.Cells["TAPPINGSTARTTIME"], row.Cells["TAPPINGENDTIME"], row.Cells["TAPPINGTIME"]);
  229. }
  230. else if (strKey.Equals("PSSTARTTIME") || strKey.Equals("PSENDTIME"))
  231. {
  232. if ((DateTime)ultraGrid1.ActiveRow.Cells["PSSTARTTIME"].Value > (DateTime)ultraGrid1.ActiveRow.Cells["PSENDTIME"].Value)
  233. {
  234. e.Cell.Appearance.BackColor = Color.Red;
  235. MessageBox.Show("溅渣结束时刻不能早于溅渣开始时刻", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  236. allowSave3 = false;
  237. return;
  238. }
  239. else
  240. {
  241. if (ultraGrid1.ActiveRow.Cells["PSSTARTTIME"].Appearance.BackColor == Color.Red)
  242. {
  243. ultraGrid1.ActiveRow.Cells["PSSTARTTIME"].Appearance.BackColor = Color.Orange;
  244. }
  245. if (ultraGrid1.ActiveRow.Cells["PSENDTIME"].Appearance.BackColor == Color.Red)
  246. {
  247. ultraGrid1.ActiveRow.Cells["PSENDTIME"].Appearance.BackColor = Color.Orange;
  248. }
  249. allowSave3 = true;
  250. }
  251. ClsBusinessPack.GetTimeSpanfromUI(row.Cells["PSSTARTTIME"], row.Cells["PSENDTIME"], row.Cells["BRPSTIME"]);
  252. }
  253. }
  254. }
  255. catch { }
  256. }
  257. protected override void ultraGrid1_ClickCellButton(object sender, CellEventArgs e)
  258. {
  259. base.ultraGrid1_ClickCellButton(sender, e);
  260. try
  261. {
  262. string strKey = e.Cell.Column.Key.ToUpper();
  263. if (e.Cell.Column.DataType != typeof(DateTime))
  264. {
  265. if (strKey.Equals("RSSTOVENO"))
  266. {
  267. frmHeatNoEditor frm = new frmHeatNoEditor();
  268. frm.InputText = Convert.ToString(e.Cell.Text);
  269. frm.Location = ClsControlPack.GetChildWindowLocation(frm.Size);
  270. if (frm.ShowDialog() == DialogResult.OK)
  271. {
  272. e.Cell.Value = frm.InputText;
  273. ultraGrid1.UpdateData();
  274. }
  275. }
  276. else if (strKey.Equals("BLOWO2TIMES"))
  277. {
  278. if (GetOxygenBlastTimesHandler != null)
  279. this.Invoke(GetOxygenBlastTimesHandler);
  280. }
  281. else if (strKey.Equals("OXYGENLANCEHISTORY"))
  282. {
  283. if (GetOxygenLanceHistoryHandler != null)
  284. this.Invoke(GetOxygenLanceHistoryHandler);
  285. }
  286. else
  287. {
  288. frmInputDecimal frm = new frmInputDecimal(Convert.ToString(e.Cell.Text));
  289. frm.Location = ClsControlPack.GetChildWindowLocation(frm.Size);
  290. if (frm.ShowDialog() == DialogResult.OK)
  291. {
  292. if (!frm.ValueChanged) return;
  293. e.Cell.Value = frm.Value;
  294. ultraGrid1.UpdateData();
  295. }
  296. }
  297. }
  298. }
  299. catch { }
  300. }
  301. private void ultraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e)
  302. {
  303. }
  304. }
  305. }