frmElementsCriterion.cs.svn-base 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767
  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 Infragistics.Win.UltraWinGrid;
  10. using System.Collections;
  11. using System.Diagnostics;
  12. using System.IO;
  13. using Core.Mes.Client.Common;
  14. namespace Core.LgMes.Client.LgIntegrationQuery
  15. {
  16. public partial class frmElementsCriterion : Core.Mes.Client.Common.frmStyleBase
  17. {
  18. UltraGridRow currentRow = null;
  19. public frmElementsCriterion()
  20. {
  21. InitializeComponent();
  22. }
  23. private void frmElementsCriterion_Load(object sender, EventArgs e)
  24. {
  25. Init();
  26. doQuery();
  27. activeUlGridRow(this.ultGridLeft, "");
  28. }
  29. /// <summary>
  30. /// 初始化
  31. /// </summary>
  32. private void Init()
  33. {
  34. try
  35. {
  36. string strErr = "";
  37. //获取钢种
  38. ArrayList arrySteel = new ArrayList();
  39. arrySteel.Add("GetSteelInfo.select");
  40. CommonClientToServer cctos = new CommonClientToServer();
  41. cctos.ob = this.ob;
  42. DataSet dsSteel = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery",
  43. "doSimpleQuery", arrySteel, out strErr);
  44. if (strErr == "" && dsSteel != null)
  45. {
  46. Core.Mes.Client.Common.Globals.FillUltraComboItems(ultcboSteel, dsSteel);
  47. Core.Mes.Client.Common.Globals.FillUltraComboItems(ultcboSteelSee, dsSteel);
  48. }
  49. }
  50. catch { }
  51. }
  52. /// <summary>
  53. /// 获取标准主表
  54. /// </summary>
  55. void doQuery()
  56. {
  57. try
  58. {
  59. string[] sArgs = new string[1];
  60. string txtSteel = "";
  61. string txtStdstyle = "";
  62. string GWName = "";
  63. string strErr = "",strHeaNo="";
  64. if (chkSteel.Checked && ultcboSteelSee.Text.Trim().Length > 0)
  65. {
  66. if (ultcboSteelSee.SelectedItem != null)
  67. txtSteel = this.ultcboSteelSee.Text;
  68. else
  69. {
  70. MessageBox.Show("请重新输入牌号!", "提示");
  71. ultcboSteelSee.Focus();
  72. return;
  73. }
  74. }
  75. if (chkGWName.Checked && ultcboGWName.Text.Trim().Length > 0)
  76. {
  77. if (ultcboGWName.SelectedItem != null)
  78. GWName = ultcboGWName.SelectedItem.DataValue.ToString();
  79. else
  80. {
  81. MessageBox.Show("请重新输入标准!", "提示");
  82. ultcboGWName.Focus();
  83. return;
  84. }
  85. }
  86. if (rboAll.Checked == false)
  87. {
  88. if (rdoInner.Checked)
  89. {
  90. txtStdstyle = "1";
  91. }
  92. else if (rdoFx.Checked)
  93. {
  94. txtStdstyle = "2";
  95. }
  96. }
  97. if(chkheano.Checked)
  98. {
  99. strHeaNo = this.txtheano.Text;
  100. }
  101. ArrayList arry = new ArrayList();
  102. arry.Add("getChemOrdMianData.select");
  103. arry.Add(txtSteel);
  104. arry.Add(txtSteel);
  105. arry.Add(txtStdstyle);
  106. arry.Add(txtStdstyle);
  107. CommonClientToServer cctos = new CommonClientToServer();
  108. cctos.ob = this.ob;
  109. DataSet ds = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery",
  110. "doSimpleQuery", arry, out strErr);
  111. if (strErr == "" && ds != null)
  112. {
  113. if (ds.Tables[0].Rows.Count != 0)
  114. {
  115. dataSet1.Tables[0].Clear();
  116. dataSet1.Tables[0].Merge(ds.Tables[0]);
  117. }
  118. else
  119. {
  120. dataSet1.Clear();
  121. }
  122. }
  123. else
  124. {
  125. MessageBox.Show("查询失败!!!", "提示");
  126. dataSet1.Clear();
  127. ultGridLeft.Rows.CollapseAll(true);
  128. }
  129. this.ultGridLeft.DisplayLayout.Bands[0].Columns["GYCODE"].Hidden = true;
  130. if (chkheano.Checked)
  131. {
  132. if (strHeaNo != "" && strHeaNo !=null)
  133. {
  134. this.ultGridLeft.DisplayLayout.Bands[0].Columns["GYCODE"].Hidden = false;
  135. }
  136. }
  137. }
  138. catch (Exception ex)
  139. {
  140. MessageBox.Show(ex.Message, "提示");
  141. }
  142. }
  143. private void chkSteel_CheckedChanged(object sender, EventArgs e)
  144. {
  145. ultcboSteelSee.Enabled = chkSteel.Checked;
  146. if (chkSteel.Checked)
  147. {
  148. this.chkheano.Enabled = false;
  149. this.txtheano.Enabled = false;
  150. this.ultcboSteelSee.Enabled = true;
  151. }
  152. else
  153. {
  154. this.chkheano.Enabled = true;
  155. this.txtheano.Enabled = false;
  156. this.ultcboSteelSee.Enabled = false;
  157. }
  158. }
  159. private void chkGWName_CheckedChanged(object sender, EventArgs e)
  160. {
  161. ultcboGWName.Enabled = chkGWName.Checked;
  162. }
  163. private void ultGridLeft_AfterRowActivate(object sender, EventArgs e)
  164. {
  165. UltraGridRow activeRow = ultGridLeft.ActiveRow;
  166. if (activeRow != null)
  167. {
  168. UltraGridRow parentRow = activeRow.ParentRow;
  169. UltraGridRow row = activeRow;
  170. UltraGridRow ulRow = null;
  171. if (parentRow != null)
  172. ulRow = parentRow;
  173. else
  174. ulRow = row;
  175. if (parentRow != null)
  176. row = parentRow;
  177. if (row != currentRow)
  178. {
  179. currentRow = row;
  180. ultGridRight.UpdateData();
  181. if (ultGridRight.DataSource != null && ultGridRight.DataSource is DataSet)
  182. {
  183. DataTable dt = ((DataSet)(ultGridRight.DataSource)).Tables[0];
  184. if (dt.GetChanges() != null)
  185. {
  186. if (MessageBox.Show("您已经作了修改,是否要保存本次编辑的结果?", "提示选择", MessageBoxButtons.YesNo, MessageBoxIcon.Question,
  187. MessageBoxDefaultButton.Button1) == DialogResult.Yes)
  188. {
  189. SaveItemChange();
  190. }
  191. else
  192. {
  193. dt.RejectChanges();
  194. }
  195. }
  196. }
  197. }
  198. //if (row.Cells["STDSTYLE"].Text == "放行") rdoFx.Checked = true;
  199. //if (row.Cells["STDSTYLE"].Text == "内控") rdoInnerEdit.Checked = true;
  200. //if (row.Cells["STDSTYLE"].Text == "放行") rdoFxEdit.Checked = true;
  201. this.ultcboSteel.Text = row.Cells["STEEL"].Text;
  202. ultcboGWNameEdit.Text = row.Cells["STATIONCODE"].Text;
  203. txtMemo.Text = row.Cells["MEMO"].Text;
  204. string[] sArgs = new string[2];
  205. //sArgs[0] = row.Cells["CIC"].Text;
  206. if (row.Cells["STATIONCODE"].Text.Trim().Length > 1)
  207. sArgs[1] = row.Cells["STATIONCODE"].Text.Substring(0, 1);
  208. string strErr = "";
  209. int stdstype = (row.Cells["STDSTYLE"].Text == "内控" ? 1 : 2);
  210. ArrayList arry = new ArrayList();
  211. arry.Add("getSubChem.select");
  212. arry.Add(row.Cells["STEEL"].Text);
  213. arry.Add(stdstype);
  214. CommonClientToServer cctos = new CommonClientToServer();
  215. cctos.ob = this.ob;
  216. DataSet ds = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery",
  217. "doSimpleQuery", arry, out strErr);
  218. if (strErr == "" && ds.Tables[0].Rows.Count >0)
  219. {
  220. ultGridRight.DataSource = ds;
  221. ultGridRight.DataBind();
  222. foreach (UltraGridRow colorRow in ultGridRight.Rows)
  223. {
  224. //if (colorRow.Cells["CIC"].Text != "" && colorRow.Cells["STDSIGN"].Text != "")
  225. //{
  226. // applyCellChange(colorRow.Cells["STDSIGN"]);
  227. // colorRow.Appearance.BackColor = Color.MistyRose;
  228. //}
  229. //else
  230. //{
  231. // colorRow.Appearance.BackColor = Color.White;
  232. //}
  233. }
  234. ultGridRight.UpdateData();
  235. ((DataSet)ultGridRight.DataSource).Tables[0].AcceptChanges();
  236. }
  237. }
  238. }
  239. /// <summary>
  240. /// 保存化学成分标准
  241. /// </summary>
  242. void SaveItemChange()
  243. {
  244. ultGridRight.UpdateData();
  245. if (ultGridRight.DataSource != null)
  246. {
  247. DataTable dtDown = ((DataSet)ultGridRight.DataSource).Tables[0];
  248. if (dtDown.GetChanges(DataRowState.Modified) != null)
  249. {
  250. DataTable dt = dtDown.GetChanges(DataRowState.Modified);
  251. UltraGridRow activeRow = ultGridLeft.ActiveRow;
  252. if (activeRow != null)
  253. {
  254. UltraGridRow parentRow = activeRow.ParentRow;
  255. UltraGridRow row = activeRow;
  256. ArrayList alItem = new ArrayList();
  257. ArrayList alSign = new ArrayList();
  258. ArrayList alMin = new ArrayList();
  259. ArrayList alMax = new ArrayList();
  260. ArrayList alFormula = new ArrayList();
  261. string strCIC = "";
  262. string strStationCode = "";
  263. foreach (DataRow drow in dt.Rows)
  264. {
  265. if (drow["STDSIGN"].ToString().Trim() != "")
  266. {
  267. string sign = drow["STDSIGN"].ToString().Trim();
  268. if (sign == "~")
  269. {
  270. if (drow["STDMIN"].ToString().Trim() == "")
  271. {
  272. MessageBox.Show("请输入正确的下限范围!");
  273. UltraGridRow currentRow = findDownRow(drow["ITEMCODE"].ToString());
  274. if (currentRow != null)
  275. {
  276. currentRow.Cells["STDMIN"].Activated = true;
  277. currentRow.Cells["STDMIN"].Selected = true;
  278. }
  279. return;
  280. }
  281. if (drow["STDMAX"].ToString().Trim() == "")
  282. {
  283. MessageBox.Show("请输入正确的上限范围!");
  284. UltraGridRow currentRow = findDownRow(drow["ITEMCODE"].ToString());
  285. if (currentRow != null)
  286. {
  287. currentRow.Cells["STDMAX"].Activated = true;
  288. currentRow.Cells["STDMAX"].Selected = true;
  289. }
  290. return;
  291. }
  292. if (decimal.Parse(drow["STDMIN"].ToString()) > decimal.Parse(drow["STDMAX"].ToString()))
  293. {
  294. MessageBox.Show("请输入正确的上下限范围!");
  295. UltraGridRow currentRow = findDownRow(drow["ITEMCODE"].ToString());
  296. if (currentRow != null)
  297. {
  298. currentRow.Cells["STDMIN"].Activated = true;
  299. currentRow.Cells["STDMIN"].Selected = true;
  300. }
  301. return;
  302. }
  303. }
  304. if (sign == ">" || sign == ">=" || sign == "=")
  305. {
  306. if (drow["STDMIN"].ToString().Trim() == "")
  307. {
  308. MessageBox.Show("请输入正确的下限范围!");
  309. UltraGridRow currentRow = findDownRow(drow["ITEMCODE"].ToString());
  310. if (currentRow != null)
  311. {
  312. currentRow.Cells["STDMIN"].Activated = true;
  313. currentRow.Cells["STDMIN"].Selected = true;
  314. }
  315. return;
  316. }
  317. }
  318. if (sign == "<" || sign == "<=")
  319. {
  320. if (drow["STDMAX"].ToString().Trim() == "")
  321. {
  322. MessageBox.Show("请输入正确的上限范围!");
  323. UltraGridRow currentRow = findDownRow(drow["ITEMCODE"].ToString());
  324. if (currentRow != null)
  325. {
  326. currentRow.Cells["STDMAX"].Activated = true;
  327. currentRow.Cells["STDMAX"].Selected = true;
  328. }
  329. return;
  330. }
  331. }
  332. }
  333. else
  334. {
  335. if (drow["STDMIN"].ToString().Trim() != "" || drow["STDMAX"].ToString().Trim() != "")
  336. {
  337. MessageBox.Show("请选择范围符号!");
  338. UltraGridRow currentRow = findDownRow(drow["ITEMCODE"].ToString());
  339. if (currentRow != null)
  340. {
  341. currentRow.Cells["STDSIGN"].Activated = true;
  342. currentRow.Cells["STDSIGN"].Selected = true;
  343. }
  344. return;
  345. }
  346. }
  347. alItem.Add(drow["UCCODE"].ToString());
  348. alSign.Add((drow["STDSIGN"].ToString().Trim().Length > 0) ? drow["STDSIGN"].ToString() : "Empty");
  349. alMin.Add((drow["STDMIN"].ToString().Trim().Length > 0) ? drow["STDMIN"].ToString() : "Empty");
  350. alMax.Add((drow["STDMAX"].ToString().Trim().Length > 0) ? drow["STDMAX"].ToString() : "Empty");
  351. alFormula.Add((drow["FORMULA"].ToString().Trim()));
  352. strCIC = drow["CIC"].ToString();
  353. strStationCode = drow["StationCode"].ToString();
  354. }
  355. if (string.IsNullOrEmpty(strStationCode) && ultcboGWNameEdit.Text.Trim().Length > 1)
  356. strStationCode = ultcboGWNameEdit.Text.Trim().Substring(0, 1);
  357. object[] sArgs = new object[8];
  358. sArgs[0] = strCIC;
  359. sArgs[1] = alItem;
  360. sArgs[2] = alSign;
  361. sArgs[3] = alMin;
  362. sArgs[4] = alMax;
  363. sArgs[5] = alFormula;
  364. sArgs[6] = this.UserInfo.GetUserName();
  365. sArgs[7] = strStationCode;
  366. string err = "";
  367. object obj = null;
  368. if ((int)obj > 0)
  369. {
  370. activeRow.Activated = false;
  371. activeRow.Selected = false;
  372. if (parentRow != null)
  373. row = parentRow;
  374. row.Selected = true;
  375. row.Activated = true;
  376. }
  377. else
  378. {
  379. MessageBox.Show(err);
  380. }
  381. }
  382. else
  383. {
  384. MessageBox.Show("请选择一行数据!");
  385. }
  386. }
  387. }
  388. }
  389. /// <summary>
  390. /// 根据所选符号控制样式
  391. /// </summary>
  392. /// <param name="cell"></param>
  393. void applyCellChange(UltraGridCell cell)
  394. {
  395. if (cell.Text == "~" || cell.Text.Trim() == "")
  396. {
  397. cell.Row.Cells["STDMIN"].Activation = Activation.AllowEdit;
  398. cell.Row.Cells["STDMIN"].Appearance.BackColor = cell.Row.Appearance.BackColor;
  399. cell.Row.Cells["STDMAX"].Activation = Activation.AllowEdit;
  400. cell.Row.Cells["STDMAX"].Appearance.BackColor = cell.Row.Appearance.BackColor;
  401. }
  402. if (cell.Text == ">" || cell.Text == ">=" || cell.Text == "=")
  403. {
  404. cell.Row.Cells["STDMIN"].Activation = Activation.AllowEdit;
  405. cell.Row.Cells["STDMIN"].Appearance.BackColor = cell.Row.Appearance.BackColor;
  406. cell.Row.Cells["STDMAX"].Value = DBNull.Value;
  407. cell.Row.Cells["STDMAX"].Activation = Activation.Disabled;
  408. cell.Row.Cells["STDMAX"].Appearance.BackColor = Color.Gray;
  409. }
  410. if (cell.Text == "<" || cell.Text == "<=")
  411. {
  412. cell.Row.Cells["STDMIN"].Value = DBNull.Value;
  413. cell.Row.Cells["STDMIN"].Activation = Activation.Disabled;
  414. cell.Row.Cells["STDMIN"].Appearance.BackColor = Color.Gray;
  415. cell.Row.Cells["STDMAX"].Activation = Activation.AllowEdit;
  416. cell.Row.Cells["STDMAX"].Appearance.BackColor = cell.Row.Appearance.BackColor;
  417. }
  418. }
  419. UltraGridRow findDownRow(string code)
  420. {
  421. UltraGridRow currentRow = null;
  422. foreach (UltraGridRow row in ultGridRight.Rows)
  423. {
  424. if (row.Cells["ITEMCODE"].Value.ToString() == code)
  425. currentRow = row;
  426. row.Selected = false;
  427. row.Activated = false;
  428. }
  429. if (currentRow != null)
  430. return currentRow;
  431. return null;
  432. }
  433. private void activeUlGridRow(UltraGrid ulGrid, string strCIC)
  434. {
  435. try
  436. {
  437. if (ulGrid.Rows.VisibleRowCount > 0)
  438. {
  439. this.ultraToolbarsManager1.Tools["bt_Edit"].SharedProps.Enabled = true;
  440. this.ultraToolbarsManager1.Tools["bt_delete"].SharedProps.Enabled = true;
  441. this.ultraToolbarsManager1.Tools["OutEXcel"].SharedProps.Enabled = true;
  442. this.ultraToolbarsManager1.Tools["bt_Updata"].SharedProps.Enabled = true;
  443. //for (int i = 0; i < ulGrid.Rows.Count; i++)
  444. //{
  445. // if (ulGrid.Rows[i].Cells["CIC"].Text == strCIC)
  446. // {
  447. // ulGrid.ActiveRow = ulGrid.Rows[i];
  448. // ulGrid.Rows[i].Selected = true;
  449. // return;
  450. // }
  451. //}
  452. }
  453. else
  454. {
  455. ultcboSteel.SelectedIndex = -1;
  456. txtMemo.Text = "";
  457. if (ultGridLeft.ActiveRow != null)
  458. {
  459. ultGridLeft.ActiveRow.Activated = false;
  460. ultGridLeft.ActiveRow.Selected = false;
  461. }
  462. if (ultGridRight.DataSource is DataSet)
  463. ((DataSet)(this.ultGridRight.DataSource)).Tables[0].Rows.Clear();
  464. this.ultraToolbarsManager1.Tools["bt_Edit"].SharedProps.Enabled = false;
  465. this.ultraToolbarsManager1.Tools["bt_delete"].SharedProps.Enabled = false;
  466. this.ultraToolbarsManager1.Tools["OutEXcel"].SharedProps.Enabled = false;
  467. this.ultraToolbarsManager1.Tools["bt_Updata"].SharedProps.Enabled = false;
  468. }
  469. }
  470. catch (Exception ex)
  471. {
  472. MessageBox.Show(ex.Message);
  473. }
  474. }
  475. private void ultGridRight_CellChange(object sender, CellEventArgs e)
  476. {
  477. if (e.Cell.Column.Key == "STDSIGN")
  478. {
  479. applyCellChange(e.Cell);
  480. }
  481. }
  482. public override void ToolBar_Click(object sender, string ToolbarKey)
  483. {
  484. switch (ToolbarKey)
  485. {
  486. case "Query":
  487. doQuery();
  488. activeUlGridRow(ultGridLeft, "");
  489. break;
  490. case "bt_ad":
  491. doAdd();
  492. break;
  493. case "bt_Edit":
  494. doEdit();
  495. break;
  496. case "bt_Delete":
  497. doDel();
  498. break;
  499. case "bt_Updata":
  500. doUpdate();
  501. break;
  502. case "OutEXcel":
  503. doExport();
  504. break;
  505. case "Exit":
  506. Close();
  507. break;
  508. default:
  509. break;
  510. }
  511. }
  512. /// <summary>
  513. /// 增加成分标准主表内容
  514. /// </summary>
  515. void doAdd()
  516. {
  517. if (this.ultcboSteel.Text == "")
  518. {
  519. MessageBox.Show("请选择牌号");
  520. ultcboSteel.Focus();
  521. return;
  522. }
  523. if (this.ultcboGWNameEdit.Text == "")
  524. {
  525. MessageBox.Show("请选择岗位");
  526. ultcboGWNameEdit.Focus();
  527. return;
  528. }
  529. if (this.rdoNationEdit.Checked == false && this.rdoInnerEdit.Checked == false)
  530. {
  531. MessageBox.Show("请选择标准类型[国标/内控]");
  532. return;
  533. }
  534. string err = "";
  535. string[] sArgs = new string[10];
  536. if (rdoNationEdit.Checked == true)
  537. sArgs[0] = "1";
  538. else
  539. sArgs[0] = "2";
  540. sArgs[1] = ultcboSteel.Text.ToString();//牌号
  541. sArgs[2] = "";
  542. sArgs[3] = "";
  543. sArgs[4] = "";
  544. sArgs[5] = "";//交货状态
  545. sArgs[6] = "1";
  546. sArgs[7] = txtMemo.Text;
  547. sArgs[8] = this.UserInfo.GetUserName();
  548. sArgs[9] = this.ultcboGWNameEdit.SelectedItem.DataValue.ToString();
  549. object obj = null;
  550. if ((int)obj > 0)
  551. {
  552. doQuery();
  553. activeUlGridRow(ultGridLeft, err);
  554. }
  555. else
  556. {
  557. MessageBox.Show(err);
  558. }
  559. }
  560. /// <summary>
  561. /// 修改成分标准主表内容
  562. /// </summary>
  563. void doEdit()
  564. {
  565. Infragistics.Win.UltraWinGrid.UltraGridRow row = this.ultGridLeft.ActiveRow;
  566. if (row != null && !row.IsFilteredOut)
  567. {
  568. if (row.ParentRow != null)
  569. row = row.ParentRow;
  570. if (this.ultcboSteel.Text == "")
  571. {
  572. MessageBox.Show("请选择牌号");
  573. ultcboSteel.Focus();
  574. return;
  575. }
  576. if (this.ultcboGWNameEdit.Text == "")
  577. {
  578. MessageBox.Show("请选择岗位");
  579. ultcboGWNameEdit.Focus();
  580. return;
  581. }
  582. string err = "";
  583. string[] sArgs = new string[11];
  584. //标准(1国标2内控)
  585. if (rdoNationEdit.Checked == true)
  586. sArgs[0] = "1";
  587. else
  588. sArgs[0] = "2";
  589. sArgs[1] = ultcboSteel.Text.ToString();//牌号
  590. sArgs[2] = "";
  591. sArgs[3] = "";
  592. sArgs[4] = "";
  593. sArgs[5] = "";//交货状态
  594. sArgs[6] = "1";
  595. sArgs[7] = txtMemo.Text;
  596. sArgs[8] = this.UserInfo.GetUserName();
  597. sArgs[9] = row.Cells[0].Value.ToString();
  598. sArgs[10] = this.ultcboGWNameEdit.SelectedItem.DataValue.ToString();
  599. object obj = null;
  600. if ((int)obj > 0)
  601. {
  602. doQuery();
  603. activeUlGridRow(ultGridLeft, err);
  604. }
  605. else
  606. {
  607. MessageBox.Show(err);
  608. }
  609. }
  610. else
  611. {
  612. MessageBox.Show("请选择一行数据!");
  613. }
  614. }
  615. /// <summary>
  616. /// 删除成分标准主表内容
  617. /// </summary>
  618. void doDel()
  619. {
  620. Infragistics.Win.UltraWinGrid.UltraGridRow row = this.ultGridLeft.ActiveRow;
  621. if (row != null && !row.IsFilteredOut)
  622. {
  623. if (row.ParentRow != null)
  624. row = row.ParentRow;
  625. if (MessageBox.Show("你确定要删除此行数据吗?", "删除提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
  626. {
  627. string err = "";
  628. string[] sArgs = new string[3];
  629. sArgs[0] = row.Cells[0].Text;
  630. sArgs[1] = this.UserInfo.GetUserName();
  631. if (row.Cells["STATIONCODE"].Text.Trim().Length > 1)
  632. sArgs[2] = row.Cells["STATIONCODE"].Text.Substring(0, 1);
  633. object obj = null;
  634. if ((int)obj > 0)
  635. {
  636. doQuery();
  637. }
  638. else
  639. {
  640. MessageBox.Show(err);
  641. }
  642. }
  643. }
  644. else
  645. {
  646. MessageBox.Show("请选择一行数据!");
  647. }
  648. }
  649. /// <summary>
  650. /// 保存成分标准值
  651. /// </summary>
  652. void doUpdate()
  653. {
  654. SaveItemChange();
  655. }
  656. /// <summary>
  657. /// 导出数据
  658. /// </summary>
  659. void doExport()
  660. {
  661. if (ultGridRight.Rows.Count < 1)
  662. {
  663. MessageBox.Show("当前没有数据");
  664. return;
  665. }
  666. try
  667. {
  668. string StrfileName = string.Format(System.Windows.Forms.Application.StartupPath + "\\{0}{1}.xls", "成分标准信息导出记录", DateTime.Now.ToString("yyyy年MM月dd日"));
  669. this.ultraGridExcelExporter1.Export(this.ultGridRight, StrfileName);
  670. ProcessStartInfo p = new ProcessStartInfo(StrfileName);
  671. p.WorkingDirectory = Path.GetDirectoryName(StrfileName);
  672. Process.Start(p);
  673. }
  674. catch (Exception ex)
  675. {
  676. MessageBox.Show(ex.Message);
  677. }
  678. }
  679. private void chkstand_CheckedChanged(object sender, EventArgs e)
  680. {
  681. txtstand.Enabled = chkstand.Checked;
  682. if (!chkstand.Checked)
  683. {
  684. txtstand.BackColor = Color.WhiteSmoke;//(224, 224, 224);
  685. }
  686. }
  687. private void chkGyCode_CheckedChanged(object sender, EventArgs e)
  688. {
  689. txtGyCode.Enabled = chkGyCode.Checked;
  690. }
  691. private void chkheano_CheckedChanged(object sender, EventArgs e)
  692. {
  693. txtheano.Enabled = chkheano.Checked;
  694. if (chkheano.Checked)
  695. {
  696. this.chkSteel.Enabled = false;
  697. this.ultcboSteelSee.Enabled = false;
  698. this.txtheano.Enabled = true;
  699. }
  700. else
  701. {
  702. txtheano.BackColor = Color.WhiteSmoke;
  703. this.chkSteel.Enabled = true;
  704. this.ultcboSteelSee.Enabled = false;
  705. this.ultcboSteelSee.Enabled = false;
  706. }
  707. }
  708. }
  709. }