frmCasResults.cs.svn-base 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using CoreFS.CA06;
  9. using System.Diagnostics;
  10. using System.Threading;
  11. using Infragistics.Win.UltraWinEditors;
  12. using System.Collections;
  13. using Core.LgMes.Client.Comm;
  14. using Core.Mes.Client;
  15. using Core.Mes.Client.Common;
  16. namespace Core.LgMes.Client.LgResMgt
  17. {
  18. public partial class frmCasResults : CoreFS.CA06.FrmBase // Core.Mes.Client.Common.frmStyleBase
  19. {
  20. System.Threading.Thread myThread;
  21. private bool threadGoOn = true;
  22. private bool m_bJJBFlag = false, m_bDelay = false;
  23. private string DEVICE_POSITION = "";
  24. private int DEVICE_POS = 0;
  25. private DataSet m_dsLFSCZXX = new DataSet();
  26. private string m_szJRCLH = "", m_szLH = "",m_strDisposaTime="";//, _szBC = "";
  27. string datetime = System.DateTime.Now.ToString("HH:mm:ss");
  28. private Hashtable _htCasJobInfo; // 用于作业信息的表字段数据
  29. private Hashtable _UpdateBefore; //修改之前值
  30. private Hashtable _UpdateAfter; //修改之后值
  31. private Hashtable _UpdateColumnName; //修改字段名
  32. public frmCasResults()
  33. {
  34. InitializeComponent();
  35. CheckForIllegalCrossThreadCalls = false;
  36. }
  37. /// <summary>
  38. /// 如果加热处理号的第五位不为1的话,该行的背景色设为red
  39. /// </summary>
  40. private void SetColumnRGB()
  41. {
  42. try
  43. {
  44. if (this.udLH != null && udLH.Rows.Count > 0)
  45. {
  46. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.udLH.Rows)
  47. {
  48. if (row.Cells["DisposalTime"].Value.ToString() != "01")
  49. {
  50. row.Appearance.BackColor = Color.Red;
  51. }
  52. else
  53. {
  54. row.Appearance.BackColor = Color.White;
  55. }
  56. if (row.Cells["HEATPROCESSNO"].Value.ToString() == m_szJRCLH)
  57. {
  58. if (udLH.ActiveRow != null)
  59. udLH.ActiveRow = row;
  60. }
  61. }
  62. }
  63. }
  64. catch
  65. {
  66. }
  67. }
  68. private void frmCAS_Load(object sender, EventArgs e)
  69. {
  70. string strErr = "";
  71. ultraDateTimeEditor4.Enabled = false;
  72. ultraDateTimeEditor3.Enabled = false;
  73. SetUserControlDelegate();
  74. //获取牌号信息
  75. ArrayList arrySteel = new ArrayList();
  76. arrySteel.Add("GetSteelInfo.select");
  77. CommonClientToServer cctos = new CommonClientToServer();
  78. cctos.ob = this.ob;
  79. DataSet ds = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery",
  80. "doSimpleQuery", arrySteel, out strErr);
  81. if (strErr == "" && ds != null)
  82. {
  83. Core.Mes.Client.Common.Globals.FillUltraComboItems(urlCb_steelNo, ds);
  84. }
  85. //初始化
  86. panel3.BackColor = Color.Snow;
  87. ultraGroupBox1.BackColor = Color.Snow;
  88. ultraDataSource1.Rows.Add(new object[] { null });
  89. _htCasJobInfo = new Hashtable();
  90. _UpdateAfter = new Hashtable();
  91. _UpdateBefore = new Hashtable();
  92. _UpdateColumnName = new Hashtable();
  93. if (this.Tag != null)
  94. {
  95. DEVICE_POSITION = "CAS0" + this.Tag.ToString().Substring(0, 1);
  96. DEVICE_POS = Convert.ToInt32(this.Tag.ToString().Substring(0, 1));
  97. }
  98. else
  99. {
  100. DEVICE_POSITION = this.CustomInfo.ToString();
  101. DEVICE_POS = Convert.ToInt32(this.CustomInfo.Substring(this.CustomInfo.Length - 1, 1));
  102. }
  103. this.ultraDateTimeEditor4.Value = System.DateTime.Now;
  104. this.ultraDateTimeEditor3.Value = System.DateTime.Now;
  105. // 初始化吹氩站信息
  106. dsCas.Tables["dtbCas"].Rows.Add(new object[] { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" });
  107. dsCas_AddItives.Tables["dtbCas_AddItives"].Rows.Add(new object[] { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" });
  108. dsCas_Element.Tables["dtbCas_Element"].Rows.Add(new object[] { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" ,"",""});
  109. this.cbbBC.Text = this.cbbBC.Items[cbbBC.Items.Count - 1].ToString();
  110. RefreshStoveInfo(DateTime.Now.ToString("yyyy-MM-dd"), DateTime.Now.ToString("yyyy-MM-dd"), " where 1=1");
  111. this.ucAdditives1.ob = this.ob;
  112. ucAdditives1.GetMaterialData();
  113. ucAdditives1.SetHopperInfo(DEVICE_POSITION);
  114. //给熔炼号ultragrid绑定列
  115. // SetCaption();
  116. SetColumnRGB();
  117. //判断是否交班 同时刷新熔炼号信息
  118. JudgeIfChangeClass();
  119. //SetGridColumns();
  120. }
  121. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  122. {
  123. if (this.checkBox1.Checked == true)
  124. {
  125. threadGoOn = false;
  126. this.button1.Enabled = true;
  127. this.ultraDateTimeEditor4.Enabled = true;
  128. this.ultraDateTimeEditor3.Enabled = true;
  129. }
  130. else
  131. {
  132. this.button1.Enabled = false;
  133. threadGoOn = true;
  134. QueryLHInfo();
  135. this.ultraDateTimeEditor4.Enabled = false;
  136. this.ultraDateTimeEditor3.Enabled = false;
  137. }
  138. }
  139. private void button1_Click(object sender, EventArgs e)
  140. {
  141. if (this.checkBox1.Checked)
  142. {
  143. string strShifcode = "", strPsteel = "", strHeatNo = "";
  144. if (this.cbbBC.Text != "全部")
  145. {
  146. int numBC = this.cbbBC.SelectedIndex + 1;
  147. strShifcode = numBC.ToString();
  148. }
  149. if (this.urlCb_steelNo.SelectedIndex>-1)
  150. strPsteel = urlCb_steelNo.Value.ToString();
  151. if (this.utLH.Text.Trim() != "")
  152. strHeatNo = utLH.Text.Trim();
  153. QueryStoveInfo(Convert.ToDateTime(this.ultraDateTimeEditor4.Value.ToString()).ToString("yyyy-MM-dd"), Convert.ToDateTime(ultraDateTimeEditor3.Value.ToString()).ToString("yyyy-MM-dd"), strShifcode, strPsteel, strHeatNo);
  154. SetColumnRGB();
  155. //SetCaption();
  156. }
  157. else
  158. {
  159. MessageBox.Show("请选择起止日期!", "提示");
  160. }
  161. }
  162. /// <summary>
  163. /// 查询熔炼号信息
  164. /// </summary>
  165. /// <param name="szDate1"></param>
  166. /// <param name="szDate2"></param>
  167. /// <param name="szAnd"></param>
  168. private void QueryStoveInfo(string szDate1, string szDate2, string strShifcode, string strPsteel, string strHeatNo)
  169. {
  170. string strErr = "";
  171. ArrayList arry = new ArrayList();
  172. arry.Add("GetCaSStoveInfo.select");
  173. arry.Add(DEVICE_POS);
  174. arry.Add(strShifcode);
  175. arry.Add(strShifcode);
  176. arry.Add(strPsteel);
  177. arry.Add(strPsteel);
  178. arry.Add(strHeatNo);
  179. arry.Add(strHeatNo);
  180. arry.Add(szDate1);
  181. arry.Add(szDate2);
  182. arry.Add(DEVICE_POS);
  183. arry.Add(strShifcode);
  184. arry.Add(strShifcode);
  185. arry.Add(strPsteel);
  186. arry.Add(strPsteel);
  187. arry.Add(strHeatNo);
  188. arry.Add(strHeatNo);
  189. arry.Add(szDate1);
  190. arry.Add(szDate2);
  191. CommonClientToServer cctos = new CommonClientToServer();
  192. cctos.ob = this.ob;
  193. DataSet ds = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery",
  194. "doSimpleQuery", arry, out strErr);
  195. if (strErr == "" && ds != null)
  196. {
  197. if (ds.Tables[0].Rows.Count != 0)
  198. {
  199. dsLH.Tables[0].Clear();
  200. dsLH.Tables[0].Merge(ds.Tables[0]);
  201. DataTable dt = ds.Tables[0];
  202. dt.TableName = "LHXX";
  203. if (m_dsLFSCZXX.Tables.Contains("LHXX"))
  204. m_dsLFSCZXX.Tables["LHXX"].Clear();
  205. m_dsLFSCZXX.Merge(dt);
  206. }
  207. else
  208. {
  209. dsLH.Clear();
  210. }
  211. }
  212. else
  213. {
  214. MessageBox.Show("查询失败!!!", "提示");
  215. dsLH.Clear();
  216. }
  217. }
  218. /// <summary>
  219. /// 判断是否交班
  220. /// </summary>
  221. private void JudgeIfChangeClass()
  222. {
  223. try
  224. {
  225. myThread = new Thread(new ThreadStart(QueryClass));
  226. myThread.Priority = ThreadPriority.Normal;
  227. myThread.Start();
  228. }
  229. catch (Exception ex)
  230. {
  231. MessageBox.Show(ex.Message);
  232. }
  233. }
  234. /// <summary>
  235. /// 扫描线程,判断是否是交班时间,并实时刷新熔炼号信息
  236. /// </summary>
  237. private void QueryClass()
  238. {
  239. try
  240. {
  241. int i = 0, scanLH = 5;
  242. System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;
  243. while (true)
  244. {
  245. if (!!this.On_Off_Thread)
  246. {
  247. System.Threading.Thread.Sleep(500);
  248. continue;
  249. }
  250. Thread.Sleep(1000 * 5);
  251. string strError = "";
  252. DateTime currTime = DateTime.Now;
  253. if (strError == "")
  254. {
  255. datetime = currTime.ToString("HH:mm:ss");
  256. }
  257. string Z1 = "07:45:00", Z2 = "08:16:00", Z3 = "15:45:00", Z4 = "16:16:00",Z5="23:45:00",Z6="23:59:59",Z7="00:00:00",Z8="00:00:16";
  258. if ((string.Compare(datetime, Z1) >= 0 && string.Compare(datetime, Z2) < 0)
  259. || (string.Compare(datetime, Z3) >= 0 && string.Compare(datetime, Z4) < 0)
  260. || (string.Compare(datetime,Z5)>=0 && string.Compare(datetime,Z6)<0)
  261. || (string.Compare(datetime,Z7)>=0 && string.Compare(datetime,Z8)<0))
  262. {
  263. ucPlan1.ultraGrid1.Rows[0].Cells["cue"].Value = "交接班时间到!";
  264. ucPlan1.ultraGrid1.Rows[0].Cells["cue"].Appearance.FontData.SizeInPoints = 15;
  265. ucPlan1.ultraGrid1.Rows[0].Cells["cue"].Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True;
  266. switch (i)
  267. {
  268. case 0:
  269. ucPlan1.ultraGrid1.Rows[0].Cells["cue"].Appearance.ForeColor = Color.Blue;
  270. break;
  271. case 1:
  272. ucPlan1.ultraGrid1.Rows[0].Cells["cue"].Appearance.ForeColor = Color.Red;
  273. break;
  274. case 2:
  275. ucPlan1.ultraGrid1.Rows[0].Cells["cue"].Appearance.ForeColor = Color.SeaGreen;
  276. break;
  277. case 3:
  278. ucPlan1.ultraGrid1.Rows[0].Cells["cue"].Appearance.ForeColor = Color.Green;
  279. break;
  280. case 4:
  281. ucPlan1.ultraGrid1.Rows[0].Cells["cue"].Appearance.ForeColor = Color.Gray;
  282. break;
  283. default:
  284. ucPlan1.ultraGrid1.Rows[0].Cells["cue"].Appearance.ForeColor = Color.LightSeaGreen;
  285. i = -1;
  286. break;
  287. }
  288. i++;
  289. if (ubJJB.Enabled == false)
  290. ubJJB.Enabled = true;
  291. }
  292. else
  293. {
  294. if (ubJJB.Enabled == true)
  295. ubJJB.Enabled = false;
  296. m_bJJBFlag = false;
  297. m_bDelay = false;
  298. //label10.Text = "";
  299. }
  300. scanLH++;
  301. if (scanLH == 6)
  302. {
  303. scanLH = 0;
  304. QueryLHInfo();
  305. }
  306. }
  307. }
  308. catch
  309. {
  310. myThread.Abort();
  311. }
  312. }
  313. public override void ToolBar_Click(object sender, string ToolbarKey)
  314. {
  315. switch (ToolbarKey)
  316. {
  317. case "Relieve":
  318. foreach (Form mdiChild in this.MdiParent.MdiChildren)
  319. {
  320. if (mdiChild.Text == DEVICE_POS + "#炼钢转炉交接班管理")
  321. {
  322. mdiChild.Activate();
  323. return;
  324. }
  325. }
  326. frmCcmMgt frm = new frmCcmMgt(DEVICE_POSITION);
  327. frm.Text = DEVICE_POS + "#炼钢转炉交接班管理";
  328. frm.MdiParent = this.MdiParent;
  329. frm.AutoSize = true;
  330. frm.Show();
  331. break;
  332. case "Refresh":
  333. DialogResult result = DialogResult.No;
  334. result = MessageBox.Show(this, "刷新将撤消界面上所做的修改,继续?", "提示", MessageBoxButtons.YesNo,
  335. MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
  336. if (result == DialogResult.Yes)
  337. {
  338. RefreshData();
  339. }
  340. break;
  341. case "Save"://新增
  342. udLH.Select(); //释放焦点
  343. Save();
  344. break;
  345. case "Exit":
  346. this.Close();
  347. break;
  348. default:
  349. break;
  350. }
  351. }
  352. /// <summary>
  353. /// 刷新熔炼号信息
  354. /// </summary>
  355. private void QueryLHInfo()
  356. {
  357. if (threadGoOn)
  358. {
  359. RefreshStoveInfo(DateTime.Now.ToString("yyyy-MM-dd"), DateTime.Now.ToString("yyyy-MM-dd"), " where 1=1");
  360. SetColumnRGB();
  361. }
  362. }
  363. /// <summary>
  364. /// 取当前班次
  365. /// </summary>
  366. private string GetClassCode()
  367. {
  368. #region "取班次编码"
  369. string szCurrClass = "";
  370. return (szCurrClass);
  371. #endregion
  372. }
  373. /// <summary>
  374. /// 刷新熔炼号信息
  375. /// </summary>
  376. private void RefreshStoveInfo(string szDate1, string szDate2, string szAnd)
  377. {
  378. try
  379. {
  380. string strErr = "", szWhere = "";
  381. //WSID:工位号
  382. //OPTDATE:操作时间
  383. szWhere = szAnd + " and STATIONCODE='0" + DEVICE_POS.ToString() + "' and to_char(OPTDATE,'yyyy-MM-dd')>='" + szDate1 + "' and to_char(OPTDATE,'yyyy-MM-dd')<='" + szDate2 + "'";
  384. ArrayList arry = new ArrayList();
  385. arry.Add("GetCaSStoveInfo_Load.select");
  386. arry.Add(DEVICE_POS);
  387. arry.Add(szDate1);
  388. arry.Add(szDate2);
  389. arry.Add(DEVICE_POS);
  390. arry.Add(szDate1);
  391. arry.Add(szDate2);
  392. CommonClientToServer cctos = new CommonClientToServer();
  393. cctos.ob = this.ob;
  394. DataSet ds = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery",
  395. "doSimpleQuery", arry, out strErr);
  396. if (strErr == "")
  397. {
  398. DataTable dt = ds.Tables[0];
  399. if (dt != null)
  400. {
  401. dsLH.Tables[0].Clear();
  402. dsLH.Tables[0].Merge(ds.Tables[0]);
  403. dt.TableName = "LHXX";
  404. if (m_dsLFSCZXX.Tables.Contains("LHXX"))
  405. m_dsLFSCZXX.Tables["LHXX"].Clear();
  406. m_dsLFSCZXX.Merge(dt);
  407. }
  408. }
  409. }
  410. catch
  411. {
  412. }
  413. }
  414. /// <summary>
  415. /// 给熔炼号ultragrid绑定列
  416. /// </summary>
  417. private void SetCaption()
  418. {
  419. try
  420. {
  421. //HEATPROCESSNO:加热处理号
  422. //HEATNO:熔炼号(熔炼号)
  423. if (m_dsLFSCZXX.Tables["LHXX"] != null && m_dsLFSCZXX.Tables["LHXX"].Rows != null)
  424. {
  425. this.udLH.DataSource = m_dsLFSCZXX.Tables["LHXX"];
  426. this.udLH.DisplayLayout.Bands[0].Columns["HEATNO"].Width = 150;
  427. this.udLH.DisplayLayout.Bands[0].Columns["HEATNO"].Header.Caption = "熔炼号";
  428. this.udLH.DisplayLayout.Bands[0].Columns["HEATNO"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  429. this.udLH.DisplayLayout.Bands[0].Columns["HEATNO"].SortIndicator = Infragistics.Win.UltraWinGrid.SortIndicator.Descending;
  430. this.udLH.DisplayLayout.Bands[0].Columns["HEATPROCESSNO"].Hidden = true;
  431. this.udLH.DisplayLayout.Bands[0].Columns["DisposalTime"].Hidden = true;
  432. }
  433. }
  434. catch
  435. {
  436. }
  437. }
  438. /// <summary>
  439. /// 点击熔炼号显示相关信息
  440. /// </summary>
  441. /// <param name="sender"></param>
  442. /// <param name="e"></param>
  443. private void udLH_AfterRowActivate(object sender, EventArgs e)
  444. {
  445. GetHeatnoInfo();
  446. }
  447. /// <summary>
  448. /// 获取熔炼号相关信息
  449. /// </summary>
  450. /// <param name="sender"></param>
  451. /// <param name="e"></param>
  452. public void GetHeatnoInfo()
  453. {
  454. //初使化窗体
  455. // FormatThisForm();
  456. ResetData();
  457. if (udLH.ActiveRow != null)
  458. {
  459. m_szJRCLH = udLH.ActiveRow.Cells["HEATPROCESSNO"].Value.ToString();//加热处理号
  460. m_szLH = udLH.ActiveRow.Cells["HEATNO"].Value.ToString(); //熔炼号
  461. m_strDisposaTime = udLH.ActiveRow.Cells["DISPOSALTIME"].Value.ToString(); //处理次数
  462. //计划
  463. ucPlan1.ResetData();
  464. this.ucPlan1.ob = this.ob;
  465. this.ucPlan1.GetPlanInfo(m_szLH);
  466. //吹氩作业信息
  467. GetCASData();
  468. //物料
  469. if (_htCasJobInfo != null && !string.IsNullOrEmpty(_htCasJobInfo["HEATNO"].ToString()))
  470. this.ucAdditives1.GetAdditiveData(_htCasJobInfo["HEATNO"].ToString(), "D" + _htCasJobInfo["STATIONCODE"].ToString(), _htCasJobInfo["DISPOSALTIME"].ToString());
  471. //化学成分
  472. ucResChemelEment1.ResetData();
  473. this.ucResChemelEment1.ob = this.ob;
  474. ucResChemelEment1.GetCraftEleInfo(_htCasJobInfo["HEATNO"].ToString(), "D0" + DEVICE_POS, "S", "");
  475. //化学成分标准
  476. if (ucPlan1._htPlanInfo["V_HEAT_ID"] != null)
  477. ucResChemelEment1.GetStandardElement(_htCasJobInfo["HEATNO"].ToString());
  478. // //化学成分标准
  479. //if (_htCasJobInfo != null && _htCasJobInfo["PLANSTEEL"] != null)
  480. // ucResChemelEment1.GetStandardElement(_htCasJobInfo["PLANSTEEL"].ToString(), ucPlan1.ultraDataSource1.Rows[0]["CAST_ID"].ToString());
  481. ucResChemelEment1.FillCraftElement();
  482. //温度采样信息
  483. this.ucTempSampling1.ob = this.ob;
  484. ucTempSampling1.GetSampleData(_htCasJobInfo["HEATNO"].ToString(), "D" + _htCasJobInfo["STATIONCODE"].ToString(), _htCasJobInfo["DISPOSALTIME"].ToString());
  485. ucTempSampling1.FillTemperatureData("TEMPERATURE");
  486. _UpdateColumnName.Clear();
  487. _UpdateBefore.Clear();
  488. _UpdateAfter.Clear();
  489. }
  490. }
  491. /// <summary>
  492. /// 获取作业信息
  493. /// </summary>
  494. private void GetCASData()
  495. {
  496. try
  497. {
  498. string strErr = "";
  499. ArrayList arry = new ArrayList();
  500. arry.Add("GetCasOperateInfo.select");
  501. arry.Add(m_szJRCLH);
  502. arry.Add(m_szJRCLH);
  503. CommonClientToServer cctos = new CommonClientToServer();
  504. cctos.ob = this.ob;
  505. DataSet ds = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery",
  506. "doSimpleQuery", arry, out strErr);
  507. if (strErr == "")
  508. {
  509. DataTable dt = ds.Tables[0];
  510. if (dt.Rows.Count > 0)
  511. {
  512. for (int i = 0; i < dt.Columns.Count; i++)
  513. {
  514. if (_htCasJobInfo.Contains(dt.Columns[i].ColumnName))
  515. _htCasJobInfo.Remove(dt.Columns[i].ColumnName);
  516. _htCasJobInfo.Add(dt.Columns[i].ColumnName, dt.Rows[0][i].ToString());
  517. }
  518. SetData(_htCasJobInfo); //显示作业信息
  519. }
  520. else
  521. _htCasJobInfo.Clear();
  522. }
  523. }
  524. catch { }
  525. }
  526. /// <summary>
  527. /// 初始化作业数据
  528. /// </summary>
  529. public void ResetData()
  530. {
  531. try
  532. {
  533. for (int i = 0; i < this.ultraDataSource1.Band.Columns.Count; i++)
  534. {
  535. if (this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.DateTime))
  536. this.ultraDataSource1.Rows[0][i] = null;
  537. else
  538. this.ultraDataSource1.Rows[0][i] = "";
  539. }
  540. }
  541. catch { }
  542. }
  543. /// <summary>
  544. /// 显示作业信息
  545. /// </summary>
  546. /// <param name="ar"></param>
  547. public void SetData(Hashtable ar)
  548. {
  549. if (ar == null || ar.Count == 0)
  550. return;
  551. int count = this.ultraDataSource1.Band.Columns.Count;
  552. string strKey = "";
  553. //班次
  554. ucPlan1.ultraDataSource1.Rows[0]["SHIFTCODE"] = ar["SHIFTCODE"].ToString().Substring(1, 1);
  555. //操作时间
  556. if (ar["OPTDATE"] != null)
  557. ucPlan1.ultraDataSource1.Rows[0]["OPTDATE"] = ar["OPTDATE"];
  558. //操作员
  559. if (ar["OPTPERSONNEL"] != null && !string.IsNullOrEmpty(ar["OPTPERSONNEL"].ToString()))
  560. ucPlan1.ultraDataSource1.Rows[0]["OPTPERSONNEL"] = ar["OPTPERSONNEL"];
  561. else
  562. ucPlan1.ultraDataSource1.Rows[0]["OPTPERSONNEL"] = "";
  563. bool Aflage = false,LAflage=false;
  564. DateTime strArrTime = DateTime.Now;
  565. DateTime strLeaveTime = DateTime.Now;
  566. for (int i = 0; i < count; i++)
  567. {
  568. try
  569. {
  570. strKey = this.ultraDataSource1.Band.Columns[i].Key;
  571. if (ar.Contains(strKey))
  572. {
  573. if (!string.IsNullOrEmpty(ar[strKey].ToString()))
  574. {
  575. if (strKey == "ARRIVETIME" && ar[strKey].ToString() != "")
  576. {
  577. Aflage = true;
  578. strArrTime = Convert.ToDateTime(ar[strKey]);
  579. }
  580. if (strKey == "LEAVETIME" && ar[strKey].ToString() != "")
  581. {
  582. LAflage = true;
  583. strLeaveTime = Convert.ToDateTime(ar[strKey]);
  584. }
  585. this.ultraDataSource1.Rows[0][i] = ar[strKey];
  586. }
  587. else if (this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.DateTime))
  588. {
  589. this.ultraDataSource1.Rows[0][i] = null;
  590. }
  591. else
  592. {
  593. if (strKey == "STAYTIME" && ar[strKey].ToString() == "")
  594. {
  595. if (Aflage && LAflage)
  596. {
  597. this.ultraDataSource1.Rows[0][i] = Convert.ToString(strArrTime - strLeaveTime);
  598. TimeSpan diff = strLeaveTime - strArrTime;
  599. this.ultraDataSource1.Rows[0][i] = Math.Round(diff.TotalMinutes);
  600. }
  601. }
  602. }
  603. }
  604. else
  605. {
  606. if (this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.DateTime))
  607. this.ultraDataSource1.Rows[0][i] = null;
  608. else
  609. this.ultraDataSource1.Rows[0][i] = "";
  610. }
  611. }
  612. catch { }
  613. }
  614. }
  615. /// <summary>
  616. /// 保存
  617. /// </summary>
  618. /// <param name="sender"></param>
  619. /// <param name="e"></param>
  620. private void Save()
  621. {
  622. if (ucPlan1.ultraDataSource1.Rows[0]["HEATNO"].ToString().Trim().Length == 0)
  623. {
  624. MessageBox.Show("请选择要更新的熔炼号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  625. return;
  626. }
  627. //进站时间判断
  628. if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["ARRIVETIME"].ToString()) && !string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["LEAVETIME"].ToString()))
  629. {
  630. if (Convert.ToDateTime(this.ultraDataSource1.Rows[0]["ARRIVETIME"]) < Convert.ToDateTime(this.ultraDataSource1.Rows[0]["LEAVETIME"]))
  631. ultraDataSource1.Rows[0]["STAYTIME"] = CStaticMethod.caculateTime(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["ARRIVETIME"]), Convert.ToDateTime(this.ultraDataSource1.Rows[0]["LEAVETIME"]));
  632. else
  633. {
  634. MessageBox.Show("进站时间不能大于出站时间!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  635. return;
  636. }
  637. }
  638. //吹氩时间判断
  639. if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["BLOWARSTARTTIME"].ToString()) && !string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["BLOWARENDTIME"].ToString()))
  640. {
  641. if (Convert.ToDateTime(this.ultraDataSource1.Rows[0]["BLOWARSTARTTIME"]) < Convert.ToDateTime(this.ultraDataSource1.Rows[0]["BLOWARENDTIME"]))
  642. ultraDataSource1.Rows[0]["BLOWARTIME"] = CStaticMethod.caculateTime(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["BLOWARSTARTTIME"]), Convert.ToDateTime(this.ultraDataSource1.Rows[0]["BLOWARENDTIME"]));
  643. else
  644. {
  645. MessageBox.Show("吹氩开始时间不能大于吹氩结束时间!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  646. return;
  647. }
  648. }
  649. //喂丝时间判断
  650. if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["FEEDSILKBEGINTIME"].ToString()) && !string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["FEEDSILKCLOSETIME"].ToString()))
  651. {
  652. if (Convert.ToDateTime(this.ultraDataSource1.Rows[0]["FEEDSILKBEGINTIME"]) < Convert.ToDateTime(this.ultraDataSource1.Rows[0]["FEEDSILKCLOSETIME"]))
  653. ultraDataSource1.Rows[0]["FEEDSILKTIME"] = CStaticMethod.caculateTime(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["FEEDSILKBEGINTIME"]), Convert.ToDateTime(this.ultraDataSource1.Rows[0]["FEEDSILKCLOSETIME"]));
  654. else
  655. {
  656. MessageBox.Show("喂丝开始时间不能大于喂丝结束时间!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  657. return;
  658. }
  659. }
  660. SaveData(); //保存数据
  661. RefreshData(); //刷新数据
  662. }
  663. /// <summary>
  664. /// 保存作业信息
  665. /// </summary>
  666. private void SaveData()
  667. {
  668. string strHeatNo = "";  //熔炼号
  669. string strStationCode = ""; //岗位编码
  670. string strDisposaltime = ""; //处理次数
  671. ArrayList alColumnName = new ArrayList(); //保存作业字段名
  672. ArrayList alValue = new ArrayList(); //保存作业字段值
  673. ArrayList alColumnType = new ArrayList(); //保存字段类型
  674. ArrayList alMaterielcode = new ArrayList(); //物料编码
  675. ArrayList alJMType = new ArrayList();   //加料类型
  676. ArrayList alJMWGT = new ArrayList();   //加料重量
  677. ArrayList alMaterielType = new ArrayList(); //物料类型
  678. strHeatNo = _htCasJobInfo["HEATNO"].ToString();
  679. strStationCode = CStaticMethod.analysProcess(DEVICE_POSITION.Substring(0, 3)) + _htCasJobInfo["STATIONCODE"].ToString();
  680. strDisposaltime = _htCasJobInfo["DISPOSALTIME"].ToString();
  681. if (_UpdateColumnName == null || _UpdateColumnName.Count == 0)
  682. {
  683. MessageBox.Show("当前没做任何修改不需要保存!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  684. return;
  685. }
  686. //作业数据
  687. for (int intCount = 0; intCount < ultraDataSource1.Band.Columns.Count; intCount++)
  688. {
  689. //判断是否修改过
  690. if (_UpdateColumnName.ContainsKey(ultraDataSource1.Band.Columns[intCount].Key.ToString()))
  691. {
  692. alColumnName.Add(ultraDataSource1.Band.Columns[intCount].Key.ToString());
  693. alValue.Add((ultraDataSource1.Rows[0][intCount].ToString().Trim().Length > 0) ? ultraDataSource1.Rows[0][intCount].ToString() : "Empty");
  694. alColumnType.Add(ultraDataSource1.Band.Columns[intCount].DataType.ToString());
  695. }
  696. }
  697. //班次
  698. string strShiftCode = "";
  699. if (_htCasJobInfo["SHIFTCODE"] != null && _htCasJobInfo["SHIFTCODE"].ToString().Length > 1)
  700. strShiftCode = _htCasJobInfo["SHIFTCODE"].ToString().Substring(0, 1) + ucPlan1.ultraGrid1.Rows[0].Cells["SHIFTCODE"].Value.ToString();
  701. //班次
  702. alColumnName.Add("SHIFTCODE");
  703. alValue.Add((strShiftCode.Length > 0) ? strShiftCode : "Empty");
  704. alColumnType.Add("System.String");
  705. //操作员
  706. alColumnName.Add("OPTPERSONNEL");
  707. string OPTPERSONNEL = "";
  708. if (ucPlan1.ultraDataSource1.Rows[0]["OPTPERSONNEL"].ToString() == "")
  709. {
  710. OPTPERSONNEL = this.UserInfo.GetUserName();
  711. }
  712. else
  713. {
  714. if (this._htCasJobInfo["OPTPERSONNEL"].ToString() == "")
  715. {
  716. OPTPERSONNEL = this.UserInfo.GetUserName();
  717. }
  718. else
  719. {
  720. if (ucPlan1.ultraDataSource1.Rows[0]["OPTPERSONNEL"].ToString() != this._htCasJobInfo["OPTPERSONNEL"].ToString())
  721. OPTPERSONNEL = ucPlan1.ultraDataSource1.Rows[0]["OPTPERSONNEL"].ToString();
  722. else
  723. OPTPERSONNEL = this._htCasJobInfo["OPTPERSONNEL"].ToString();
  724. }
  725. }
  726. alValue.Add(OPTPERSONNEL);
  727. alColumnType.Add("System.String");
  728. //辅料数据
  729. for (int intCount = 0; intCount < ucAdditives1.ulgridPrcMtr.DisplayLayout.Bands[0].Columns.Count; intCount++)
  730. {
  731. if (ucAdditives1.ulgridPrcMtr.DisplayLayout.Bands[0].Columns[intCount].Tag != null)
  732. {
  733. string strKey = ucAdditives1.ulgridPrcMtr.DisplayLayout.Bands[0].Columns[intCount].Key.ToString();
  734. //判断是否修改过
  735. if (_UpdateColumnName.ContainsKey(strKey) &&
  736. _UpdateColumnName.ContainsValue(ucAdditives1.ulgridPrcMtr.DisplayLayout.Bands[0].Columns[intCount].Header.Caption))
  737. {
  738. alMaterielcode.Add(ucAdditives1.ulgridPrcMtr.DisplayLayout.Bands[0].Columns[intCount].Tag.ToString());
  739. alJMWGT.Add((ucAdditives1.ulgridPrcMtr.Rows[0].Cells[strKey].Value.ToString().Trim().Length > 0) ? ucAdditives1.ulgridPrcMtr.Rows[0].Cells[strKey].Value.ToString() : "Empty");
  740. alJMType.Add("1");
  741. alMaterielType.Add("FL");
  742. }
  743. }
  744. }
  745. //合金数据
  746. for (int intCount = 0; intCount < ucAdditives1.ultgridAlloy.DisplayLayout.Bands[0].Columns.Count; intCount++)
  747. {
  748. if (ucAdditives1.ultgridAlloy.DisplayLayout.Bands[0].Columns[intCount].Tag != null)
  749. {
  750. string strKey = ucAdditives1.ultgridAlloy.DisplayLayout.Bands[0].Columns[intCount].Key.ToString();
  751. //判断是否修改过
  752. if (_UpdateColumnName.ContainsKey(strKey) &&
  753. _UpdateColumnName.ContainsValue(ucAdditives1.ultgridAlloy.DisplayLayout.Bands[0].Columns[intCount].Header.Caption))
  754. {
  755. alMaterielcode.Add(ucAdditives1.ultgridAlloy.DisplayLayout.Bands[0].Columns[intCount].Tag.ToString());
  756. alJMWGT.Add((ucAdditives1.ultgridAlloy.Rows[0].Cells[strKey].Value.ToString().Trim().Length > 0) ? ucAdditives1.ultgridAlloy.Rows[0].Cells[strKey].Value.ToString() : "Empty");
  757. alJMType.Add("1");
  758. alMaterielType.Add("HJ");
  759. }
  760. }
  761. }
  762. //喂丝数据
  763. for (int intCount = 0; intCount < ucAdditives1.ultgridWs.DisplayLayout.Bands[0].Columns.Count; intCount++)
  764. {
  765. if (ucAdditives1.ultgridWs.DisplayLayout.Bands[0].Columns[intCount].Tag != null)
  766. {
  767. string strKey = ucAdditives1.ultgridWs.DisplayLayout.Bands[0].Columns[intCount].Key.ToString();
  768. //判断是否修改过
  769. if (_UpdateColumnName.ContainsKey(strKey) &&
  770. _UpdateColumnName.ContainsValue(ucAdditives1.ultgridWs.DisplayLayout.Bands[0].Columns[intCount].Header.Caption))
  771. {
  772. alMaterielcode.Add(ucAdditives1.ultgridWs.DisplayLayout.Bands[0].Columns[intCount].Tag.ToString());
  773. alJMWGT.Add((ucAdditives1.ultgridWs.Rows[0].Cells[strKey].Value.ToString().Trim().Length > 0) ? ucAdditives1.ultgridWs.Rows[0].Cells[strKey].Value.ToString() : "Empty");
  774. alJMType.Add("1");
  775. alMaterielType.Add("WS");
  776. }
  777. }
  778. }
  779. //手投料
  780. for (int intCount = 0; intCount < ucAdditives1.ultgridManual.DisplayLayout.Bands[0].Columns.Count; intCount++)
  781. {
  782. if (ucAdditives1.ultgridManual.DisplayLayout.Bands[0].Columns[intCount].Tag != null && ucAdditives1.ultgridManual.DisplayLayout.Bands[0].Columns[intCount].Header.Caption != "")
  783. {
  784. string strKey = ucAdditives1.ultgridManual.DisplayLayout.Bands[0].Columns[intCount].Key.ToString();
  785. //判断是否修改过
  786. if (_UpdateColumnName.ContainsKey(strKey) &&
  787. _UpdateColumnName.ContainsValue(ucAdditives1.ultgridManual.DisplayLayout.Bands[0].Columns[intCount].Header.Caption))
  788. {
  789. alMaterielcode.Add(ucAdditives1.ultgridManual.DisplayLayout.Bands[0].Columns[intCount].Tag.ToString());
  790. alJMWGT.Add((ucAdditives1.ultgridManual.Rows[0].Cells[strKey].Value.ToString().Trim().Length > 0) ? ucAdditives1.ultgridManual.Rows[0].Cells[strKey].Value.ToString() : "Empty");
  791. alJMType.Add("2");
  792. alMaterielType.Add("ST"); //手投类型到后台再获取
  793. }
  794. }
  795. }
  796. string strSqlID = "SaveResData.Update";
  797. object[] sArgs = new object[10];
  798. sArgs[0] = strHeatNo; //熔炼号
  799. sArgs[1] = strStationCode; //岗位
  800. sArgs[2] = strDisposaltime;//处理次数
  801. sArgs[3] = alColumnName; //作业字段名
  802. sArgs[4] = alValue; //作业数据值
  803. sArgs[5] = alColumnType; //作业数据类型
  804. sArgs[6] = alMaterielcode; //物料编码
  805. sArgs[7] = alJMType; //加料类型(料仓,手投)
  806. sArgs[8] = alJMWGT; //加料重量
  807. sArgs[9] = alMaterielType; //物料类型
  808. string strError = "";
  809. DialogResult result = DialogResult.No;
  810. result = MessageBox.Show(this, "确实要保存信息吗?", "提示", MessageBoxButtons.YesNo,
  811. MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
  812. if (result == DialogResult.Yes)
  813. {
  814. Cursor oldCursor = this.Cursor;
  815. this.Cursor = Cursors.WaitCursor;//等待光标
  816. try
  817. {
  818. CommonClientToServer ccTs = new CommonClientToServer();
  819. ccTs.ob = ob;
  820. string strRCode = ccTs.ExecuteProcedureFunctions("Core.LgMes.Server.Common.ComDBProcedure",
  821. "ExecProcWithCollParam", strSqlID, sArgs, out strError);
  822. if (strError != "")
  823. {
  824. this.Cursor = oldCursor;
  825. MessageBox.Show("保存不成功!\n" + strError, "错误!", MessageBoxButtons.OK, MessageBoxIcon.Error);
  826. return;
  827. }
  828. else
  829. {
  830. this.Cursor = oldCursor;
  831. if (_UpdateColumnName != null && _UpdateColumnName.Count>0)
  832. {
  833. bool blReturn = StaticFunction.SaveUpdateLog(strHeatNo, strStationCode, strDisposaltime, _UpdateColumnName, _UpdateBefore, _UpdateAfter,this.ob);
  834. if (blReturn == true)
  835. {
  836. _UpdateColumnName.Clear();
  837. _UpdateBefore.Clear();
  838. _UpdateAfter.Clear();
  839. }
  840. }
  841. }
  842. }
  843. catch (System.Exception exp)
  844. {
  845. this.Cursor = oldCursor;
  846. MessageBox.Show("保存不成功!\n" + exp.ToString(), "错误!", MessageBoxButtons.OK, MessageBoxIcon.Error);
  847. }
  848. }
  849. }
  850. /// <summary>
  851. /// 刷新
  852. /// </summary>
  853. /// <param name="sender"></param>
  854. /// <param name="e"></param>
  855. private void button35_Click(object sender, EventArgs e)
  856. {
  857. DialogResult result = DialogResult.No;
  858. result = MessageBox.Show(this, "刷新将撤消界面上所做的修改,按'否'先保存数据?", "提示", MessageBoxButtons.YesNo,
  859. MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
  860. if (result == DialogResult.Yes)
  861. {
  862. RefreshData();
  863. }
  864. }
  865. private void RefreshData()
  866. {
  867. //初使化窗体
  868. if (udLH.ActiveRow != null)
  869. {
  870. //m_szJRCLH = udLH.ActiveRow.Cells["HEATPROCESSNO"].Value.ToString();//加热处理号
  871. //m_szLH = udLH.ActiveRow.Cells["HEATNO"].Value.ToString(); //熔炼号
  872. ResetData();
  873. //计划
  874. ucPlan1.ResetData();
  875. this.ucPlan1.GetPlanInfo(m_szLH);
  876. //吹氩作业信息
  877. GetCASData();
  878. if (_htCasJobInfo.Count == 0)
  879. return;
  880. //物料
  881. if (_htCasJobInfo != null && !string.IsNullOrEmpty(_htCasJobInfo["HEATNO"].ToString()))
  882. this.ucAdditives1.GetAdditiveData(_htCasJobInfo["HEATNO"].ToString(), "D" + _htCasJobInfo["STATIONCODE"].ToString(), _htCasJobInfo["DISPOSALTIME"].ToString());
  883. //化学成分
  884. ucResChemelEment1.ResetData();
  885. ucResChemelEment1.GetCraftEleInfo(_htCasJobInfo["HEATNO"].ToString(), "D0" + DEVICE_POS, "S","");
  886. //化学成分标准
  887. if (ucPlan1._htPlanInfo["V_HEAT_ID"] != null)
  888. ucResChemelEment1.GetStandardElement(_htCasJobInfo["HEATNO"].ToString());
  889. ////化学成分标准
  890. //if (_htCasJobInfo != null && _htCasJobInfo["PLANSTEEL"] != null)
  891. // ucResChemelEment1.GetStandardElement(_htCasJobInfo["PLANSTEEL"].ToString(), ucPlan1.ultraDataSource1.Rows[0]["CAST_ID"].ToString());
  892. ucResChemelEment1.FillCraftElement();
  893. //温度采样信息
  894. ucTempSampling1.GetSampleData(_htCasJobInfo["HEATNO"].ToString(), "D" + _htCasJobInfo["STATIONCODE"].ToString(), _htCasJobInfo["DISPOSALTIME"].ToString());
  895. ucTempSampling1.FillTemperatureData("TEMPERATURE");
  896. _UpdateColumnName.Clear();
  897. _UpdateBefore.Clear();
  898. _UpdateAfter.Clear();
  899. }
  900. }
  901. private void ubJJB_Click(object sender, EventArgs e)
  902. {
  903. foreach (Form mdiChild in this.MdiParent.MdiChildren)
  904. {
  905. if (mdiChild.Text == DEVICE_POS + "#吹氩站交接班管理")
  906. {
  907. mdiChild.Activate();
  908. return;
  909. }
  910. }
  911. frmCcmMgt frm = new frmCcmMgt(DEVICE_POSITION);
  912. frm.MdiParent = this.MdiParent;
  913. frm.Text = DEVICE_POS + "#吹氩站交接班管理";
  914. frm.Show();
  915. }
  916. private void btAddLH_Click(object sender, EventArgs e)
  917. {
  918. }
  919. /// <summary>
  920. /// 手动新增一个新熔炼号后,刷新熔炼号信息
  921. /// </summary>
  922. public void AfterAddNewLH(string v_JRCLH)
  923. {
  924. m_szJRCLH = v_JRCLH;
  925. RefreshStoveInfo(DateTime.Now.ToString("yyyy-MM-dd"), DateTime.Now.ToString("yyyy-MM-dd"), " where 1=1");
  926. SetColumnRGB();
  927. }
  928. /// <summary>
  929. /// 修改各岗位钢包信息
  930. /// </summary>
  931. /// <param name="strHeatNo">熔炼号</param>
  932. /// <param name="strPotNo">钢包包号</param>
  933. /// <param name="strPotdistinction">钢包等级</param>
  934. /// <param name="strPotage">钢包包龄</param>
  935. /// <param name="strPotwrapstate">钢包包况</param>
  936. private void UpdatePotInfo(string strHeatNo,string strPotNo,string strPotdistinction,string strPotage,string strPotwrapstate)
  937. {
  938. string[] ArrayCZXX = new string[5] { "", "", "", "", ""}; //保存信息
  939. ArrayCZXX[0] = strHeatNo;//熔炼号
  940. ArrayCZXX[1] = strPotNo;//钢包包号
  941. ArrayCZXX[2] = strPotdistinction;//钢包等级
  942. ArrayCZXX[3] = strPotage;//钢包包龄
  943. ArrayCZXX[4] = strPotwrapstate;//钢包包况
  944. string strError = "";
  945. //hengxing Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod("lgResMgt", "Core.LgMes.Server.LgResMgt.LfsCollect", "UpdatePot", new object[] { ArrayCZXX }, out strError);
  946. if (strError == "")
  947. MessageBox.Show("熔炼号:" + strHeatNo + " 的各岗位钢包信息修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  948. else
  949. MessageBox.Show("熔炼号:" + strHeatNo + " 的各岗位钢包信息修改失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  950. }
  951. private void ultraGrid4_ClickCellButton(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  952. {
  953. frmSetTime frm = new frmSetTime(e.Cell.Value);
  954. frm.Location = CStaticMethod.GetChildWindowLocation(frm.Size);
  955. frm.ShowDialog();
  956. if (frm._returnTime > new DateTime(2000, 1, 1, 0, 0, 0, 0))
  957. {
  958. DateTime dt = frm._returnTime;
  959. e.Cell.Value = dt;
  960. }
  961. }
  962. private void ultraGrid4_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  963. {
  964. if (ultraGrid4.ActiveCell.Text != "" && e.Cell.Value.GetType().ToString() != "System.DateTime"
  965. && e.Cell.Value.GetType().ToString() != "System.DBNull" && e.Cell.Column.Key != "MEMO" && e.Cell.Column.Key != "BLOWARMODE")
  966. {
  967. try
  968. {
  969. Convert.ToDecimal(ultraGrid4.ActiveCell.Text);
  970. }
  971. catch (Exception ex)
  972. {
  973. MessageBox.Show(ex.Message, "提示");
  974. ultraGrid4.ActiveCell.Value = "";
  975. }
  976. }
  977. }
  978. #region "记录实绩修改日志"
  979. /// <summary>
  980. /// 设置用户控件委托
  981. /// </summary>
  982. private void SetUserControlDelegate()
  983. {
  984. ///修改数据之前事情
  985. ucAdditives1.ulgridPrcMtr.AfterCellUpdate += new Infragistics.Win.UltraWinGrid.CellEventHandler(ulgridPrcMtr_AfterCellUpdate);
  986. ucAdditives1.ultgridAlloy.AfterCellUpdate += new Infragistics.Win.UltraWinGrid.CellEventHandler(ultgridAlloy_AfterCellUpdate);
  987. ucAdditives1.ultgridManual.AfterCellUpdate += new Infragistics.Win.UltraWinGrid.CellEventHandler(ultgridManual_AfterCellUpdate);
  988. ucAdditives1.ultgridWs.AfterCellUpdate += new Infragistics.Win.UltraWinGrid.CellEventHandler(ultgridWs_AfterCellUpdate);
  989. ucPlan1.ultraGrid1.AfterCellUpdate += new Infragistics.Win.UltraWinGrid.CellEventHandler(ultraGrid1_AfterCellUpdate);
  990. ///修改数据之后事情
  991. ucAdditives1.ulgridPrcMtr.BeforeCellUpdate += new Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventHandler(ulgridPrcMtr_BeforeCellUpdate);
  992. ucAdditives1.ultgridAlloy.BeforeCellUpdate += new Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventHandler(ultgridAlloy_BeforeCellUpdate);
  993. ucAdditives1.ultgridManual.BeforeCellUpdate += new Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventHandler(ultgridManual_BeforeCellUpdate);
  994. ucAdditives1.ultgridWs.BeforeCellUpdate += new Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventHandler(ultgridWs_BeforeCellUpdate);
  995. ucPlan1.ultraGrid1.BeforeCellUpdate += new Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventHandler(ultraGrid1_BeforeCellUpdate);
  996. }
  997. void ultgridWs_BeforeCellUpdate(object sender, Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventArgs e)
  998. {
  999. if (!string.IsNullOrEmpty(e.Cell.Column.Header.Caption.Trim()))
  1000. {
  1001. if (_UpdateBefore != null && _UpdateBefore.Contains(e.Cell.Column.Key))
  1002. {
  1003. _UpdateBefore.Remove(e.Cell.Column.Key);
  1004. _UpdateColumnName.Remove(e.Cell.Column.Key);
  1005. }
  1006. _UpdateBefore.Add(e.Cell.Column.Key, e.Cell.Value.ToString());
  1007. _UpdateColumnName.Add(e.Cell.Column.Key, e.Cell.Column.Header.Caption);
  1008. }
  1009. }
  1010. void ultgridWs_AfterCellUpdate(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  1011. {
  1012. if (!string.IsNullOrEmpty(e.Cell.Column.Header.Caption.Trim()))
  1013. {
  1014. if (_UpdateAfter.Contains(e.Cell.Column.Key))
  1015. {
  1016. _UpdateAfter.Remove(e.Cell.Column.Key);
  1017. //_UpdateColumnName.Remove(e.Cell.Column.Key);
  1018. }
  1019. _UpdateAfter.Add(e.Cell.Column.Key, e.Cell.Value.ToString());
  1020. }
  1021. }
  1022. void ultgridManual_BeforeCellUpdate(object sender, Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventArgs e)
  1023. {
  1024. if (!string.IsNullOrEmpty(e.Cell.Column.Header.Caption.Trim()))
  1025. {
  1026. if (_UpdateBefore != null && _UpdateBefore.Contains(e.Cell.Column.Key))
  1027. {
  1028. _UpdateBefore.Remove(e.Cell.Column.Key);
  1029. _UpdateColumnName.Remove(e.Cell.Column.Key);
  1030. }
  1031. _UpdateBefore.Add(e.Cell.Column.Key, e.Cell.Value.ToString());
  1032. _UpdateColumnName.Add(e.Cell.Column.Key, e.Cell.Column.Header.Caption);
  1033. }
  1034. }
  1035. void ultgridAlloy_BeforeCellUpdate(object sender, Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventArgs e)
  1036. {
  1037. if (!string.IsNullOrEmpty(e.Cell.Column.Header.Caption.Trim()))
  1038. {
  1039. if (_UpdateBefore != null && _UpdateBefore.Contains(e.Cell.Column.Key))
  1040. {
  1041. _UpdateBefore.Remove(e.Cell.Column.Key);
  1042. _UpdateColumnName.Remove(e.Cell.Column.Key);
  1043. }
  1044. _UpdateBefore.Add(e.Cell.Column.Key, e.Cell.Value.ToString());
  1045. _UpdateColumnName.Add(e.Cell.Column.Key, e.Cell.Column.Header.Caption);
  1046. }
  1047. }
  1048. void ulgridPrcMtr_BeforeCellUpdate(object sender, Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventArgs e)
  1049. {
  1050. if (!string.IsNullOrEmpty(e.Cell.Column.Header.Caption.Trim()))
  1051. {
  1052. if (_UpdateBefore != null && _UpdateBefore.Contains(e.Cell.Column.Key))
  1053. {
  1054. _UpdateBefore.Remove(e.Cell.Column.Key);
  1055. _UpdateColumnName.Remove(e.Cell.Column.Key);
  1056. }
  1057. _UpdateBefore.Add(e.Cell.Column.Key, e.Cell.Value.ToString());
  1058. _UpdateColumnName.Add(e.Cell.Column.Key, e.Cell.Column.Header.Caption);
  1059. }
  1060. }
  1061. void ultgridManual_AfterCellUpdate(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  1062. {
  1063. if (!string.IsNullOrEmpty(e.Cell.Column.Header.Caption.Trim()))
  1064. {
  1065. if (_UpdateAfter.Contains(e.Cell.Column.Key))
  1066. {
  1067. _UpdateAfter.Remove(e.Cell.Column.Key);
  1068. // _UpdateColumnName.Remove(e.Cell.Column.Key);
  1069. }
  1070. _UpdateAfter.Add(e.Cell.Column.Key, e.Cell.Value.ToString());
  1071. }
  1072. }
  1073. void ultgridAlloy_AfterCellUpdate(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  1074. {
  1075. if (!string.IsNullOrEmpty(e.Cell.Column.Header.Caption.Trim()))
  1076. {
  1077. if (_UpdateAfter.Contains(e.Cell.Column.Key))
  1078. {
  1079. _UpdateAfter.Remove(e.Cell.Column.Key);
  1080. // _UpdateColumnName.Remove(e.Cell.Column.Key);
  1081. }
  1082. _UpdateAfter.Add(e.Cell.Column.Key, e.Cell.Value.ToString());
  1083. }
  1084. }
  1085. void ulgridPrcMtr_AfterCellUpdate(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  1086. {
  1087. if (!string.IsNullOrEmpty(e.Cell.Column.Header.Caption.Trim()))
  1088. {
  1089. if (_UpdateAfter.Contains(e.Cell.Column.Key))
  1090. {
  1091. _UpdateAfter.Remove(e.Cell.Column.Key);
  1092. //_UpdateColumnName.Remove(e.Cell.Column.Key);
  1093. }
  1094. _UpdateAfter.Add(e.Cell.Column.Key, e.Cell.Value.ToString());
  1095. }
  1096. }
  1097. void ultraGrid1_BeforeCellUpdate(object sender, Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventArgs e)
  1098. {
  1099. if (!string.IsNullOrEmpty(e.Cell.Column.Header.Caption.Trim()))
  1100. {
  1101. if (_UpdateBefore != null && _UpdateBefore.Contains(e.Cell.Column.Key))
  1102. {
  1103. _UpdateBefore.Remove(e.Cell.Column.Key);
  1104. _UpdateColumnName.Remove(e.Cell.Column.Key);
  1105. }
  1106. _UpdateBefore.Add(e.Cell.Column.Key, e.Cell.Value.ToString());
  1107. _UpdateColumnName.Add(e.Cell.Column.Key, e.Cell.Column.Header.Caption);
  1108. }
  1109. }
  1110. void ultraGrid1_AfterCellUpdate(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  1111. {
  1112. if (!string.IsNullOrEmpty(e.Cell.Column.Header.Caption.Trim()))
  1113. {
  1114. if (_UpdateAfter.Contains(e.Cell.Column.Key))
  1115. {
  1116. _UpdateAfter.Remove(e.Cell.Column.Key);
  1117. //_UpdateColumnName.Remove(e.Cell.Column.Key);
  1118. }
  1119. _UpdateAfter.Add(e.Cell.Column.Key, e.Cell.Value.ToString());
  1120. }
  1121. }
  1122. private void ultraGrid4_AfterCellUpdate(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  1123. {
  1124. if (_UpdateAfter.Contains(e.Cell.Column.Key))
  1125. {
  1126. _UpdateAfter.Remove(e.Cell.Column.Key);
  1127. // _UpdateColumnName.Remove(e.Cell.Column.Key);
  1128. }
  1129. _UpdateAfter.Add(e.Cell.Column.Key, e.Cell.Value.ToString());
  1130. }
  1131. private void ultraGrid4_BeforeCellUpdate(object sender, Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventArgs e)
  1132. {
  1133. if (_UpdateBefore != null && _UpdateBefore.Contains(e.Cell.Column.Key))
  1134. {
  1135. _UpdateBefore.Remove(e.Cell.Column.Key);
  1136. _UpdateColumnName.Remove(e.Cell.Column.Key);
  1137. }
  1138. _UpdateBefore.Add(e.Cell.Column.Key, e.Cell.Value.ToString());
  1139. _UpdateColumnName.Add(e.Cell.Column.Key, e.Cell.Column.Header.Caption);
  1140. }
  1141. #endregion
  1142. private void button34_Click(object sender, EventArgs e)
  1143. {
  1144. }
  1145. }
  1146. }