frmCutInfoAssit.cs 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784
  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 System.Collections;
  9. using System.IO;
  10. using System.Diagnostics;
  11. using Infragistics.Win.UltraWinGrid;
  12. using CoreFS.CA06;
  13. namespace Core.StlMes.Client.LgResMgt
  14. {
  15. public partial class frmCutInfoAssit : FrmBase
  16. {
  17. private bool ok_flag = false;
  18. private string WorkShopNo = "";
  19. public frmCutInfoAssit()
  20. {
  21. InitializeComponent();
  22. }
  23. private void frmCutInfoAssit_Load(object sender, EventArgs e)
  24. {
  25. //WorkShopNo = this.CustomInfo;
  26. //this.ultraDateTimeEditor1.Value = DateTime.Today.ToString("yyyy-MM-dd") + " 00:00";
  27. //this.ultraDateTimeEditor2.Value = DateTime.Today.ToString("yyyy-MM-dd") + " 23:59"; ;
  28. }
  29. // 查询
  30. /// <summary>
  31. /// 查询
  32. /// </summary>
  33. private void proc_Query()
  34. {
  35. //this.dataSet1.Tables[0].Clear();
  36. //try
  37. //{
  38. // string strWhere = " where workshopno='"+WorkShopNo+"'";
  39. // string strFrom = ultraDateTimeEditor1.DateTime.ToString("yyyy-MM-dd");
  40. // string strTo = ultraDateTimeEditor2.DateTime.ToString("yyyy-MM-dd");
  41. // strWhere += " and to_char(OPTDATE, 'yyyy-MM-dd') between '" + strFrom + "' and '" + strTo + "'";
  42. // string str = ultraTextEditor2.Text.Trim();
  43. // if (checkBox2.Checked)
  44. // {
  45. // if (str.Length > 0)
  46. // {
  47. // strWhere += " and HEATNO = '" + str + "'";
  48. // }
  49. // else
  50. // {
  51. // MessageBox.Show("炉号条件不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  52. // ultraTextEditor2.Focus();
  53. // return;
  54. // }
  55. // }
  56. // if (checkBox1.Checked)
  57. // {
  58. // if (isUp.SelectedIndex >= 0)
  59. // {
  60. // strWhere += " and UPSTATUS = '" + isUp.Value.ToString() + "'";
  61. // }
  62. // else
  63. // {
  64. // MessageBox.Show("上传状态不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  65. // isUp.Focus();
  66. // return;
  67. // }
  68. // }
  69. // string strErr = "";
  70. // ArrayList arry = new ArrayList();
  71. // ArrayList sqlList = new ArrayList();
  72. // arry.Add("IncisionAssist.Query");//此ID为XML文件ID
  73. // sqlList.Add(strWhere);
  74. // CoreClientParam ccp= new CoreClientParam();
  75. // DataTable dt = new DataTable();
  76. // ccp.ServerName = "Core.LgMes.Server.Common.ComDBQuery";
  77. // ccp.MethodName = "doQuery";
  78. // ccp.ServerParams = new object[] { arry, sqlList };
  79. // ccp.SourceDataTable = dt;
  80. // this.ExecuteSortResultByQueryToDataTable(ccp, CoreInvokeType.Internal);
  81. // strErr = ccp.ReturnInfo;
  82. // if (strErr != "" || dt.Rows.Count==0 ) return;
  83. // DataSet ds = new DataSet();
  84. // ds.Tables.Add(dt);
  85. // if (ds != null && ds.Tables.Count > 0)
  86. // {
  87. // this.dataTable1.Rows.Clear();
  88. // DataRow dr;
  89. // string column_name = "";
  90. // for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
  91. // {
  92. // dr = this.dataTable1.NewRow();
  93. // for (int j = 0; j < dataTable1.Columns.Count; j++)
  94. // {
  95. // column_name = dataTable1.Columns[j].ColumnName;
  96. // dr[column_name] = ds.Tables[0].Rows[i][column_name].ToString();
  97. // }
  98. // this.dataTable1.Rows.Add(dr);
  99. // }
  100. // ultraGrid1.UpdateData();
  101. // //PublicMethod.RefreshAndAutoSize(ultraGrid1);
  102. // Hashtable htOperate = new Hashtable();
  103. // htOperate.Add("已上传", Color.LightGreen);
  104. // Core.StlMes.Client.LgDeviceManager.LadleCommonClass.SetGridBackColor(ultraGrid1, htOperate, "UPSTATUS", true);
  105. // }
  106. // if (ultraGrid1.Rows.Count > 0)
  107. // {
  108. // string isUpload = "";
  109. // for (int i = 0; i < ultraGrid1.Rows.Count; i++)
  110. // {
  111. // isUpload = ultraGrid1.Rows[i].Cells["UPSTATUS"].Value.ToString();
  112. // if (isUpload == "已上传")
  113. // {
  114. // ultraGrid1.Rows[i].Cells["FLAG"].Activation = Activation.NoEdit;
  115. // }
  116. // }
  117. // }
  118. //}
  119. //catch { }
  120. }
  121. // 新增
  122. /// <summary>
  123. /// 新增
  124. /// </summary>
  125. private void proc_Add()
  126. {
  127. //try
  128. //{
  129. // if (txtHeatNo.Text.Length != 8)
  130. // {
  131. // MessageBox.Show("炉号不正确!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  132. // txtHeatNo.Focus();
  133. // return;
  134. // }
  135. // string heatno = txtHeatNo.Text.Trim();
  136. // string strErr = "";
  137. // ArrayList arry = new ArrayList();
  138. // arry.Add("IncisionAssistInfo.Query"); // 位于 QueryLgIntegration.xml 中
  139. // arry.Add(heatno);
  140. // if (WorkShopNo == "1")
  141. // {
  142. // arry.Add("0");
  143. // arry.Add("1");
  144. // arry.Add("2");
  145. // }
  146. // else
  147. // {
  148. // arry.Add("3");
  149. // arry.Add("4");
  150. // arry.Add("5");
  151. // }
  152. // CommonClientToServer ccs = new CommonClientToServer();
  153. // ccs.ob = this.ob;
  154. // DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  155. // if (ds.Tables[0].Rows.Count == 0)
  156. // {
  157. // MessageBox.Show("炉号【" + heatno + "】不存在切割信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  158. // return;
  159. // }
  160. // if (cboCutType.SelectedIndex < 0)
  161. // {
  162. // MessageBox.Show("切割类别不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  163. // cboCutType.Focus();
  164. // return;
  165. // }
  166. // if (ultraFlux.SelectedIndex < 0)
  167. // {
  168. // MessageBox.Show("流号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  169. // ultraFlux.Focus();
  170. // return;
  171. // }
  172. // if (txtLength.Text.Length == 0)
  173. // {
  174. // MessageBox.Show("长度不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  175. // txtLength.Focus();
  176. // return;
  177. // }
  178. // if (txtWeight.Text.Length == 0)
  179. // {
  180. // MessageBox.Show("重量不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  181. // txtWeight.Focus();
  182. // return;
  183. // }
  184. // if (txtThickness.Text.Length == 0)
  185. // {
  186. // MessageBox.Show("厚度不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  187. // txtThickness.Focus();
  188. // return;
  189. // }
  190. // if (txtWidth.Text.Length == 0)
  191. // {
  192. // MessageBox.Show("宽度不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  193. // txtWidth.Focus();
  194. // return;
  195. // }
  196. // strErr = "";
  197. // string strSqlID = "IncisionAssist.Add";
  198. // object[] sArgs = new object[13];
  199. // sArgs[0] = txtHeatNo.Text.Trim(); //炉号
  200. // sArgs[1] = cboCutType.Text.Trim(); //切割类别
  201. // sArgs[2] = txtLength.Text.Trim(); //长度
  202. // sArgs[3] = txtWeight.Text.Trim(); //重量
  203. // sArgs[4] = txtThickness.Text.Trim(); //厚度
  204. // sArgs[5] = txtWidth.Text.Trim(); //宽度
  205. // sArgs[6] = (cutTime.Text.ToString() == "" ? DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") :
  206. // (Convert.ToDateTime(cutTime.Text.Trim())).ToString("yyyy-MM-dd HH:mm:ss")); //切割时间
  207. // sArgs[7] = this.UserInfo.GetUserName();
  208. // sArgs[8] = txtPro.Text.Trim();
  209. // sArgs[9] = textBox2.Text.Trim();
  210. // sArgs[10] = txtThweight.Text.Trim() == "" ? "0" : txtThweight.Text.Trim();
  211. // sArgs[11] = WorkShopNo;
  212. // sArgs[12] = ultraFlux.Value.ToString();
  213. // try
  214. // {
  215. // CommonClientToServer ccTs = new CommonClientToServer();
  216. // ccTs.ob = ob;
  217. // string strRCode = ccTs.ExecuteProcedureFunctions("Core.LgMes.Server.Common.ComDBProcedure",
  218. // "ExecProcWithCollParam", strSqlID, sArgs, out strErr);
  219. // if (strErr != "")
  220. // {
  221. // MessageBox.Show("新增失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  222. // return;
  223. // }
  224. // else
  225. // {
  226. // this.proc_Query();
  227. // ok_flag = true;
  228. // MessageBox.Show("新增成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  229. // }
  230. // }
  231. // catch { }
  232. //}
  233. //catch { }
  234. }
  235. // 修改
  236. /// <summary>
  237. /// 修改
  238. /// </summary>
  239. private void proc_Edit()
  240. {
  241. //try
  242. //{
  243. // string heatno = txtHeatNo.Text.Trim();
  244. // string strErr = "";
  245. // ArrayList arry = new ArrayList();
  246. // arry.Add("IncisionAssistInfo.Query"); // 位于 QueryLgIntegration.xml 中
  247. // arry.Add(heatno);
  248. // if (WorkShopNo == "1")
  249. // {
  250. // arry.Add("0");
  251. // arry.Add("1");
  252. // arry.Add("2");
  253. // }
  254. // else
  255. // {
  256. // arry.Add("3");
  257. // arry.Add("4");
  258. // arry.Add("5");
  259. // }
  260. // CommonClientToServer ccs = new CommonClientToServer();
  261. // ccs.ob = this.ob;
  262. // DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  263. // if (ds.Tables[0].Rows.Count == 0)
  264. // {
  265. // MessageBox.Show("炉号【" + heatno + "】不存在切割信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  266. // return;
  267. // }
  268. // if (txtHeatNo.Text.Length != 8)
  269. // {
  270. // MessageBox.Show("炉号不正确!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  271. // txtHeatNo.Focus();
  272. // return;
  273. // }
  274. // if (cboCutType.SelectedIndex < 0)
  275. // {
  276. // MessageBox.Show("切割类别不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  277. // cboCutType.Focus();
  278. // return;
  279. // }
  280. // if (ultraFlux.SelectedIndex < 0)
  281. // {
  282. // MessageBox.Show("流号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  283. // ultraFlux.Focus();
  284. // return;
  285. // }
  286. // if (txtLength.Text.Length == 0)
  287. // {
  288. // MessageBox.Show("长度不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  289. // txtLength.Focus();
  290. // return;
  291. // }
  292. // if (txtWeight.Text.Length == 0)
  293. // {
  294. // MessageBox.Show("重量不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  295. // txtWeight.Focus();
  296. // return;
  297. // }
  298. // if (txtThickness.Text.Length == 0)
  299. // {
  300. // MessageBox.Show("厚度不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  301. // txtThickness.Focus();
  302. // return;
  303. // }
  304. // if (txtWidth.Text.Length == 0)
  305. // {
  306. // MessageBox.Show("宽度不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  307. // txtWidth.Focus();
  308. // return;
  309. // }
  310. // strErr = "";
  311. // string strSqlID = "IncisionAssist.Update";
  312. // object[] sArgs = new object[14];
  313. // sArgs[0] = txtHeatNo.Text.Trim(); //炉号
  314. // sArgs[1] = cboCutType.Text.Trim(); //切割类别
  315. // sArgs[2] = txtLength.Text.Trim(); //长度
  316. // sArgs[3] = txtWeight.Text.Trim(); //重量
  317. // sArgs[4] = txtThickness.Text.Trim(); //厚度
  318. // sArgs[5] = txtWidth.Text.Trim(); //宽度
  319. // sArgs[6] = (cutTime.Text.ToString() == "" ? DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") :
  320. // (Convert.ToDateTime(cutTime.Text.Trim())).ToString("yyyy-MM-dd HH:mm:ss")); //切割时间
  321. // sArgs[7] = this.UserInfo.GetUserName();
  322. // sArgs[8] = txtPro.Text.Trim();
  323. // sArgs[9] = WorkShopNo; //体系号
  324. // sArgs[10] = ultraGrid1.ActiveRow.Cells["ID"].Value.ToString(); //ID
  325. // sArgs[11] = textBox2.Text.Trim();
  326. // sArgs[12] = txtThweight.Text.Trim() == "" ? "0" : txtThweight.Text.Trim();
  327. // sArgs[13] = ultraFlux.Value.ToString();
  328. // try
  329. // {
  330. // CommonClientToServer ccTs = new CommonClientToServer();
  331. // ccTs.ob = ob;
  332. // string strRCode = ccTs.ExecuteProcedureFunctions("Core.LgMes.Server.Common.ComDBProcedure",
  333. // "ExecProcWithCollParam", strSqlID, sArgs, out strErr);
  334. // if (strErr != "")
  335. // {
  336. // MessageBox.Show("修改失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  337. // return;
  338. // }
  339. // else
  340. // {
  341. // this.proc_Query();
  342. // ok_flag = true;
  343. // MessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  344. // }
  345. // }
  346. // catch { }
  347. //}
  348. //catch { }
  349. }
  350. // 删除
  351. /// <summary>
  352. /// 删除
  353. /// </summary>
  354. private void proc_Delete()
  355. {
  356. //try
  357. //{
  358. // if (ultraGrid1.Rows.Count == 0)
  359. // {
  360. // MessageBox.Show("没有可删除的信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  361. // return;
  362. // }
  363. // if (ultraGrid1.ActiveRow == null)
  364. // {
  365. // MessageBox.Show("请选择要删除的信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  366. // return;
  367. // }
  368. // if (ultraGrid1.ActiveRow.Cells["UPSTATUS"].Value.ToString().Trim() == "已上传")
  369. // {
  370. // MessageBox.Show("选中的信息已上传,不能删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  371. // return;
  372. // }
  373. // DialogResult dr = MessageBox.Show("是否确认删除信息?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
  374. // if (dr == DialogResult.No) return;
  375. // string ID = ultraGrid1.ActiveRow.Cells["ID"].Value.ToString().Trim();
  376. // string strErr = "";
  377. // string strSqlID = "IncisionAssist.Delete";
  378. // object[] sArgs = new object[1];
  379. // sArgs[0] = ID; //ID
  380. // try
  381. // {
  382. // CommonClientToServer ccTs = new CommonClientToServer();
  383. // ccTs.ob = ob;
  384. // string strRCode = ccTs.ExecuteProcedureFunctions("Core.LgMes.Server.Common.ComDBProcedure",
  385. // "ExecProcWithCollParam", strSqlID, sArgs, out strErr);
  386. // if (strErr != "")
  387. // {
  388. // MessageBox.Show("删除失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  389. // return;
  390. // }
  391. // else
  392. // {
  393. // this.proc_Query();
  394. // MessageBox.Show("删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  395. // }
  396. // }
  397. // catch { }
  398. //}
  399. //catch { }
  400. }
  401. // 设置编辑区域是否可编辑
  402. /// <summary>
  403. /// 设置编辑区域是否可编辑
  404. /// </summary>
  405. /// <param name="t_Enable"></param>
  406. private void setToolEnable(bool t_Enable)
  407. {
  408. //try
  409. //{
  410. // txtHeatNo.ReadOnly = t_Enable;
  411. // txtLength.ReadOnly = t_Enable;
  412. // txtWeight.ReadOnly = t_Enable;
  413. // cboCutType.ReadOnly = t_Enable;
  414. // ultraFlux.ReadOnly = t_Enable;
  415. //}
  416. //catch { }
  417. }
  418. // 清空编辑区域
  419. /// <summary>
  420. /// 清空编辑区域
  421. /// </summary>
  422. private void clearWidget()
  423. {
  424. //txtPro.Text = "";
  425. //txtWidth.Text = "";
  426. //txtThickness.Text = "";
  427. //txtLength.Text = "";
  428. //txtWeight.Text = "";
  429. //txtHeatNo.Text = "";
  430. //txtThweight.Text = "";
  431. //cboCutType.SelectedIndex = -1;
  432. //ultraFlux.SelectedIndex = -1;
  433. }
  434. public override void ToolBar_Click(object sender, string ToolbarKey)
  435. {
  436. //base.ToolBar_Click(sender, ToolbarKey);
  437. //switch (ToolbarKey)
  438. //{
  439. // case "Query":
  440. // this.proc_Query();
  441. // break;
  442. // case "Add":
  443. // this.proc_Add();
  444. // break;
  445. // case "Update":
  446. // this.proc_Edit();
  447. // break;
  448. // case "Delete":
  449. // this.proc_Delete();
  450. // break;
  451. // case "Export":
  452. // try
  453. // {
  454. // //Core.Mes.Client.Common.Globals.ulGridToExcel(ultraGrid1, Text);
  455. // }
  456. // catch (Exception ex)
  457. // {
  458. // MessageBox.Show(ex.Message);
  459. // }
  460. // break;
  461. // case "Upload":
  462. // this.proc_Query();
  463. // break;
  464. // case "Exit":
  465. // this.Close();
  466. // break;
  467. // default:
  468. // break;
  469. // }
  470. }
  471. private void checkBox2_CheckedChanged(object sender, EventArgs e)
  472. {
  473. //ultraTextEditor2.Enabled = checkBox2.Checked;
  474. }
  475. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  476. {
  477. //isUp.Enabled = checkBox1.Checked;
  478. }
  479. private void txtHeatNo_TextChanged(object sender, EventArgs e)
  480. {
  481. //try
  482. //{
  483. // string heatno = txtHeatNo.Text.Trim();
  484. // string strErr = "";
  485. // ArrayList arry = new ArrayList();
  486. // arry.Add("IncisionAssistInfo.Query"); // 位于 QueryLgIntegration.xml 中
  487. // arry.Add(heatno);
  488. // if (WorkShopNo == "1")
  489. // {
  490. // arry.Add("0");
  491. // arry.Add("1");
  492. // arry.Add("2");
  493. // }
  494. // else
  495. // {
  496. // arry.Add("3");
  497. // arry.Add("4");
  498. // arry.Add("5");
  499. // }
  500. // CommonClientToServer ccs = new CommonClientToServer();
  501. // ccs.ob = this.ob;
  502. // DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  503. // if (strErr == "" && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
  504. // {
  505. // txtThickness.Text = ds.Tables[0].Rows[0]["THICKNESS"].ToString();
  506. // txtWidth.Text = ds.Tables[0].Rows[0]["WIDTH"].ToString();
  507. // cutTime.Value = ds.Tables[0].Rows[0]["CUTTIME"].ToString();
  508. // txtPro.Text = ds.Tables[0].Rows[0]["SAPPRODORDERNO"].ToString();
  509. // }
  510. // else
  511. // {
  512. // txtPro.Text = "";
  513. // txtWidth.Text = "";
  514. // txtThickness.Text = "";
  515. // }
  516. //}
  517. //catch { }
  518. }
  519. private void WidthInput_KeyPress(object sender, KeyPressEventArgs e)
  520. {
  521. //if (!(Char.IsNumber(e.KeyChar) || e.KeyChar == '\b' || e.KeyChar == '.'))
  522. //{
  523. // e.Handled = true;
  524. //}
  525. //char[] arrary = ((TextBox)sender).Text.ToCharArray();
  526. //if (e.KeyChar == '.')
  527. //{
  528. // if (arrary.Length == 0)
  529. // {
  530. // ((TextBox)sender).Text = "0.";
  531. // ((TextBox)sender).SelectionStart = ((TextBox)sender).Text.Trim().Length;
  532. // e.Handled = true;
  533. // }
  534. // else
  535. // {
  536. // for (int i = 0; i < arrary.Length; i++)
  537. // {
  538. // if (arrary[i] == '.')
  539. // e.Handled = true;
  540. // }
  541. // }
  542. //}
  543. //if (arrary.Length == 1)
  544. //{
  545. // if (e.KeyChar == '0')
  546. // {
  547. // if (arrary[0] == '0')
  548. // e.Handled = true;
  549. // }
  550. // if (arrary[0] == '0' && e.KeyChar != '.' && e.KeyChar != '\b' && e.KeyChar != '0')
  551. // {
  552. // ((TextBox)sender).Text = "0." + e.KeyChar.ToString();
  553. // ((TextBox)sender).SelectionStart = ((TextBox)sender).Text.Trim().Length;
  554. // e.Handled = true;
  555. // }
  556. //}
  557. }
  558. private void LengthInput_KeyPress(object sender, KeyPressEventArgs e)
  559. {
  560. //if (!(Char.IsNumber(e.KeyChar) || e.KeyChar == '\b' ))
  561. //{
  562. // e.Handled = true;
  563. //}
  564. //char[] arrary = ((TextBox)sender).Text.ToCharArray();
  565. //if (arrary.Length == 0)
  566. //{
  567. // if (e.KeyChar == '0')
  568. // {
  569. // e.Handled = true;
  570. // }
  571. //}
  572. }
  573. private void HeatNoInput_KeyPress(object sender, KeyPressEventArgs e)
  574. {
  575. //if (!(Char.IsNumber(e.KeyChar) || e.KeyChar == '\b'))
  576. //{
  577. // e.Handled = true;
  578. //}
  579. }
  580. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  581. {
  582. try
  583. {
  584. //SetDetailToolBarEnable(false, "");
  585. //setToolEnable(true);
  586. //txtID.Text = ultraGrid1.ActiveRow.Cells["ID"].Value.ToString();
  587. //txtHeatNo.Text = ultraGrid1.ActiveRow.Cells["HEATNO"].Value.ToString();
  588. //cboCutType.Text = ultraGrid1.ActiveRow.Cells["CATEGORY"].Value.ToString();
  589. //txtLength.Text = ultraGrid1.ActiveRow.Cells["LENGTH"].Value.ToString();
  590. //txtWeight.Text = ultraGrid1.ActiveRow.Cells["WEIGHT"].Value.ToString();
  591. //txtThickness.Text = ultraGrid1.ActiveRow.Cells["THICKNESS"].Value.ToString();
  592. //txtWidth.Text = ultraGrid1.ActiveRow.Cells["WIDTH"].Value.ToString();
  593. //cutTime.Value = ultraGrid1.ActiveRow.Cells["CUTTIME"].Value.ToString();
  594. //txtPro.Text = ultraGrid1.ActiveRow.Cells["PRODORDERNO"].Value.ToString();
  595. //ultraFlux.Text = ultraGrid1.ActiveRow.Cells["FLUXCODE"].Value.ToString();
  596. }
  597. catch { }
  598. }
  599. // 点击修改或删除时显示确认和取消按钮
  600. /// <summary>
  601. /// 点击修改或删除时显示确认和取消按钮
  602. /// </summary>
  603. /// <param name="bEnable"></param>
  604. private void SetDetailToolBarEnable(bool bEnable, string flag)
  605. {
  606. //int count = this.uTbMTool.Tools.Count;
  607. //for (int i = 0; i < count; i++)
  608. //{
  609. // this.uTbMTool.Tools[i].SharedProps.Enabled = !bEnable;
  610. //}
  611. //this.uTbMTool.Tools["ok"].SharedProps.Enabled = bEnable;
  612. //this.uTbMTool.Tools["cancel"].SharedProps.Enabled = bEnable;
  613. //this.uTbMTool.Tools["ok"].SharedProps.Visible = bEnable;
  614. //this.uTbMTool.Tools["cancel"].SharedProps.Visible = bEnable;
  615. }
  616. private void ultraToolbarsManager_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  617. {
  618. //switch (e.Tool.Key)
  619. //{
  620. // case "add":
  621. // //SetDetailToolBarEnable(true, "add");
  622. // //setToolEnable(false);
  623. // //this.uTbMTool.Tools["ok"].Tag = "add";
  624. // //clearWidget();
  625. // //cutTime.Value = DateTime.Now;
  626. // //ok_flag = false;
  627. // break;
  628. // case "edit":
  629. // if (ultraGrid1.Rows.Count == 0)
  630. // {
  631. // MessageBox.Show("没有可修改的信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  632. // return;
  633. // }
  634. // if (ultraGrid1.ActiveRow == null)
  635. // {
  636. // MessageBox.Show("请选择要修改的信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  637. // return;
  638. // }
  639. // if (ultraGrid1.ActiveRow.Cells["UPSTATUS"].Value.ToString().Trim() == "已上传")
  640. // {
  641. // MessageBox.Show("选中的信息已上传,不能修改!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  642. // return;
  643. // }
  644. // SetDetailToolBarEnable(true, "edit");
  645. // setToolEnable(false);
  646. // this.uTbMTool.Tools["ok"].Tag = "edit";
  647. // ok_flag = false;
  648. // break;
  649. // case "del":
  650. // proc_Delete();
  651. // break;
  652. // case "ok":
  653. // string flag = this.uTbMTool.Tools["ok"].Tag.ToString();
  654. // if (flag == "edit")
  655. // {
  656. // proc_Edit();
  657. // }
  658. // if (flag == "add")
  659. // {
  660. // proc_Add();
  661. // }
  662. // if (ok_flag)
  663. // {
  664. // SetDetailToolBarEnable(false, "");
  665. // setToolEnable(true);
  666. // }
  667. // break;
  668. // case "cancel":
  669. // SetDetailToolBarEnable(false, "");
  670. // setToolEnable(true);
  671. // ultraGrid1_AfterRowActivate(null, null);
  672. // break;
  673. // case "left":
  674. // if (ultraGrid1.Rows.Count == 0) return;
  675. // //将位置移动到前一条记录
  676. // try
  677. // {
  678. // if (ultraGrid1.ActiveRow == null)
  679. // {
  680. // ultraGrid1.Rows[0].Activate();
  681. // }
  682. // else
  683. // {
  684. // int nIndex = ultraGrid1.ActiveRow.Index;
  685. // nIndex = nIndex - 1;
  686. // if (nIndex < 0) nIndex = ultraGrid1.Rows.Count - 1;
  687. // ultraGrid1.Rows[nIndex].Activate();
  688. // }
  689. // }
  690. // catch { }
  691. // break;
  692. // case "right":
  693. // if (ultraGrid1.Rows.Count == 0) return;
  694. // //将位置移动到后一条记录
  695. // try
  696. // {
  697. // if (ultraGrid1.ActiveRow == null)
  698. // {
  699. // ultraGrid1.Rows[0].Activate();
  700. // }
  701. // else
  702. // {
  703. // int nIndex = ultraGrid1.ActiveRow.Index;
  704. // nIndex = nIndex + 1;
  705. // if (nIndex >= ultraGrid1.Rows.Count) nIndex = 0;
  706. // ultraGrid1.Rows[nIndex].Activate();
  707. // }
  708. // }
  709. // catch { }
  710. // break;
  711. //}
  712. }
  713. private void txtLength_TextChanged(object sender, EventArgs e)
  714. {
  715. //try
  716. //{
  717. // if (txtLength.Text.Length == 0 || txtThickness.Text.Length == 0 || txtWidth.Text.Length == 0)
  718. // {
  719. // return;
  720. // }
  721. // double n_len = Convert.ToDouble(txtLength.Text.Trim()); //长度
  722. // double n_thi = Convert.ToDouble(txtThickness.Text.Trim()); //厚度
  723. // double n_wid = Convert.ToDouble(txtWidth.Text.Trim()); //宽度
  724. // double n_wei = 0; //理论重量
  725. // n_wei = (n_thi / 1000 * n_wid / 1000 * 7.85) * n_len / 1000;
  726. // txtThweight.Text = Math.Round(n_wei,3).ToString();
  727. //}
  728. //catch { }
  729. }
  730. }
  731. }