f7a4d08fe5e7e2645643e55d7ae513948a0cdefc.svn-base 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;
  10. using Infragistics.Win.UltraWinGrid;
  11. using System.Collections;
  12. using System.Diagnostics;
  13. namespace Core.LZMes.Client.UIB
  14. {
  15. public partial class UIB030110LT : FrmBase
  16. {
  17. public UIB030110LT()
  18. {
  19. InitializeComponent();
  20. }
  21. // public DataSet ds = new DataSet();
  22. private string SLSelected = null;
  23. int jx = 1;
  24. public override void ToolBar_Click(object sender, string ToolbarKey)
  25. {
  26. switch (ToolbarKey)
  27. {
  28. case "Query":
  29. this.DoQuery();
  30. break;
  31. case "Save":
  32. this.DoSave();
  33. break;
  34. //case "FanXiu":
  35. // this.FanXiu();
  36. //break;
  37. case "Export":
  38. this.DoExport();
  39. break;
  40. }
  41. }
  42. private void DoQuery()
  43. {
  44. try
  45. {
  46. ArrayList al = new ArrayList();
  47. SLSelected = "连退";
  48. if (!this.checkBox1.Checked && this.textBox3.Text == "")
  49. {
  50. MessageBox.Show("请选择查询条件!", "提示");
  51. return;
  52. }
  53. //SQL
  54. al.Add("UIB030110_01_LIAN.SELECT");
  55. //查询条件
  56. if (this.checkBox1.Checked)
  57. {
  58. al.Add(this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") + "000000");//日期
  59. al.Add(this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") + "999999");//日期
  60. }
  61. else
  62. {
  63. al.Add("");
  64. al.Add("");
  65. }
  66. al.Add(this.textBox3.Text.Trim());//钢卷号
  67. this.dataSet1.Tables[0].Clear();
  68. CoreClientParam ccp = new CoreClientParam();
  69. ccp.ServerName = "UIB.COM.ComDBQuery";
  70. ccp.MethodName = "doSimpleQuery";
  71. ccp.ServerParams = new object[] { al };
  72. ccp.SourceDataTable = this.dataSet1.Tables[0];
  73. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  74. //foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  75. //{
  76. // if (ugr.Cells["SMP_DIR_PIC_YN"].Text == "Y"
  77. // && ugr.Cells["SMP_PICK_YN"].Text == "")
  78. // {
  79. // ugr.Appearance.ForeColor = Color.Red;//字体显示红色
  80. // //ugr.Delete();
  81. // //ugr.Hidden = true;
  82. // }
  83. // //判断人工录入宽度判定值与机器测量宽度实际值之差,若≥10则显示红色
  84. // string COILWTH = ugr.Cells["COIL_WTH"].Text;
  85. // string DCSWTH = ugr.Cells["DCS_WTH"].Text;
  86. // if (COILWTH != null && COILWTH != "" && DCSWTH != null && DCSWTH != "" && DCSWTH != "0")
  87. // {
  88. // double chazhi = double.Parse(DCSWTH) - double.Parse(COILWTH);
  89. // if (System.Math.Abs(chazhi) >= 10)
  90. // {
  91. // ugr.Cells["COIL_WTH"].Appearance.BackColor = Color.Red;
  92. // ugr.Cells["DCS_WTH"].Appearance.BackColor = Color.Red;
  93. // }
  94. // else
  95. // {
  96. // ugr.Cells["COIL_WTH"].Appearance.BackColor = Color.White;
  97. // ugr.Cells["DCS_WTH"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  98. // }
  99. // }
  100. // else
  101. // {
  102. // ugr.Cells["COIL_WTH"].Appearance.BackColor = Color.White;
  103. // ugr.Cells["DCS_WTH"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  104. // }
  105. // //判断人工录入厚度判定值与机器测量厚度实际值之差,若≥0.01则显示红色
  106. // string COILTHK = ugr.Cells["COIL_THK"].Text;
  107. // string DCSTHK = ugr.Cells["DCS_THK"].Text;
  108. // if (COILTHK != null && COILTHK != "" && DCSTHK != null && DCSTHK != "" && DCSTHK != "0")
  109. // {
  110. // double chazhi = double.Parse(DCSTHK) - double.Parse(COILTHK);
  111. // if (System.Math.Abs(chazhi) >= 0.01)
  112. // {
  113. // ugr.Cells["COIL_THK"].Appearance.BackColor = Color.Red;
  114. // ugr.Cells["DCS_THK"].Appearance.BackColor = Color.Red;
  115. // }
  116. // else
  117. // {
  118. // ugr.Cells["COIL_THK"].Appearance.BackColor = Color.White;
  119. // ugr.Cells["DCS_THK"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  120. // }
  121. // }
  122. // else
  123. // {
  124. // ugr.Cells["COIL_THK"].Appearance.BackColor = Color.White;
  125. // ugr.Cells["DCS_THK"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  126. // }
  127. //}
  128. }
  129. catch (Exception ex)
  130. {
  131. MessageBox.Show(ex.ToString());
  132. }
  133. }
  134. private void DoSave()
  135. {
  136. try
  137. {
  138. //this.ultraGrid1.UpdateData();//选择以后,这里必须要updatedata。
  139. ArrayList list = new ArrayList();
  140. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  141. {
  142. if (Convert.ToBoolean(ugr.Cells["CHK"].Value))
  143. {
  144. if (ugr.Cells["SMPPICK_TP"].Text == "Y")
  145. {
  146. // smpList = new ArrayList();
  147. //取样操作
  148. jx = 1;
  149. CoreClientParam ccp = new CoreClientParam();
  150. Hashtable ht = new Hashtable();
  151. ht.Add("i" + jx, SLSelected); jx++;//产线
  152. ht.Add("i" + jx, ugr.Cells["COIL_NO"].Text); jx++;//钢卷号
  153. ht.Add("i" + jx, ugr.Cells["SMP_NO"].Text); jx++;//试样号
  154. ht.Add("i" + jx, ugr.Cells["SMP_CUT_LOC"].Text); jx++;//位置
  155. ht.Add("i" + jx, ""); jx++;//去向
  156. ht.Add("i" + jx, ugr.Cells["SMP_NO"].Text); jx++;//外观等级
  157. ht.Add("i" + jx, ugr.Cells["SMP_NO"].Text); jx++;//录入厚度
  158. ht.Add("i" + jx, ugr.Cells["SMP_NO"].Text); jx++;//录入宽度
  159. ht.Add("i" + jx, ugr.Cells["SMP_NO"].Text); jx++;//温度
  160. ht.Add("i" + jx, ugr.Cells["SMP_NO"].Text); jx++;//粗糙度
  161. ht.Add("i" + jx, ugr.Cells["SMP_PICK_YN"].Text); jx++;//是否取样
  162. ht.Add("i" + jx, ""); jx++;//外观缺陷1
  163. ht.Add("i" + jx, ""); jx++;
  164. ht.Add("i" + jx, ""); jx++;
  165. ht.Add("i" + jx, ""); jx++;
  166. ht.Add("i" + jx, ""); jx++;
  167. ht.Add("i" + jx, ""); jx++;
  168. ht.Add("i" + jx, ""); jx++;
  169. ht.Add("i" + jx, ""); jx++;
  170. ht.Add("i" + jx, ""); jx++;//外观缺陷5
  171. ht.Add("i" + jx, ""); jx++;
  172. ht.Add("i" + jx, this.UserInfo.GetUserName().ToString()); jx++;//操作人
  173. ht.Add("i" + jx, "取样登记"); jx++;//操作标志
  174. ht.Add("o" + jx, ""); jx = 1;
  175. ccp.ServerName = "UIB.COM.ComDBProcedure";
  176. ccp.MethodName = "doXmlProcedure";
  177. ccp.ServerParams = new object[] { "UIB030110_01.CALL", ht };
  178. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  179. ugr.Cells["SMPPICK_TP"].Value = "";
  180. ArrayList all = ccp.ReturnObject as ArrayList;
  181. if (all[0].ToString() != "YY")//确认是否存在问题
  182. {
  183. MessageBox.Show(all[0].ToString(), "提示");
  184. }
  185. }
  186. if (ugr.Cells["CRK_TP"].Text == "Y")//外观缺陷
  187. {
  188. jx = 1;
  189. CoreClientParam ccp = new CoreClientParam();
  190. Hashtable ht = new Hashtable();
  191. ht.Add("i" + jx, SLSelected); jx++;//产线
  192. ht.Add("i" + jx, ugr.Cells["COIL_NO"].Text); jx++;//钢卷号
  193. ht.Add("i" + jx, ugr.Cells["SMP_NO"].Text); jx++;//试样号
  194. ht.Add("i" + jx, ugr.Cells["SMP_CUT_LOC"].Text); jx++;//位置
  195. ht.Add("i" + jx, ""); jx++;//去向
  196. ht.Add("i" + jx, ugr.Cells["EXTSHAPE_QUALITY"].Text); jx++;//外观等级
  197. ht.Add("i" + jx, ugr.Cells["SMP_NO"].Text); jx++;//录入厚度
  198. ht.Add("i" + jx, ugr.Cells["SMP_NO"].Text); jx++;//录入宽度
  199. ht.Add("i" + jx, ugr.Cells["SMP_NO"].Text); jx++;//温度
  200. ht.Add("i" + jx, ugr.Cells["SMP_NO"].Text); jx++;//粗糙度
  201. ht.Add("i" + jx, ugr.Cells["SMP_PICK_YN"].Text); jx++;//是否取样
  202. ht.Add("i" + jx, ugr.Cells["CRK_CD1"].Value.ToString()); jx++;//外观缺陷1
  203. ht.Add("i" + jx, ugr.Cells["CRK_CD1_TYPE"].Text); jx++;
  204. ht.Add("i" + jx, ugr.Cells["CRK_CD2"].Value.ToString()); jx++;
  205. ht.Add("i" + jx, ugr.Cells["CRK_CD2_TYPE"].Text); jx++;
  206. ht.Add("i" + jx, ugr.Cells["CRK_CD3"].Value.ToString()); jx++;
  207. ht.Add("i" + jx, ugr.Cells["CRK_CD3_TYPE"].Text); jx++;
  208. ht.Add("i" + jx, ugr.Cells["CRK_CD4"].Value.ToString()); jx++;
  209. ht.Add("i" + jx, ugr.Cells["CRK_CD4_TYPE"].Text); jx++;
  210. ht.Add("i" + jx, ugr.Cells["CRK_CD5"].Value.ToString()); jx++;//外观缺陷5
  211. ht.Add("i" + jx, ugr.Cells["CRK_CD5_TYPE"].Text); jx++;
  212. ht.Add("i" + jx, this.UserInfo.GetUserName().ToString()); jx++;//操作人
  213. ht.Add("i" + jx, "外观缺陷录入"); jx++;//操作标志
  214. ht.Add("o" + jx, ""); jx = 1;
  215. ccp.ServerName = "UIB.COM.ComDBProcedure";
  216. ccp.MethodName = "doXmlProcedure";
  217. ccp.ServerParams = new object[] { "UIB030110_01.CALL", ht };
  218. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  219. ugr.Cells["CRK_TP"].Value = "";
  220. ArrayList all = ccp.ReturnObject as ArrayList;
  221. if (all[0].ToString() != "YY")//确认是否存在问题
  222. {
  223. MessageBox.Show(all[0].ToString(), "提示");
  224. }
  225. }
  226. if (ugr.Cells["EXSHAPE_TP"].Text == "Y")//外观等级
  227. {
  228. jx = 1;
  229. CoreClientParam ccp = new CoreClientParam();
  230. Hashtable ht = new Hashtable();
  231. ht.Add("i" + jx, SLSelected); jx++;//产线
  232. ht.Add("i" + jx, ugr.Cells["COIL_NO"].Text); jx++;//钢卷号
  233. ht.Add("i" + jx, ugr.Cells["SMP_NO"].Text); jx++;//试样号
  234. ht.Add("i" + jx, ugr.Cells["SMP_CUT_LOC"].Text); jx++;//位置
  235. ht.Add("i" + jx, ugr.Cells["COIL_RT"].Text); jx++;//去向
  236. ht.Add("i" + jx, ugr.Cells["EXTSHAPE_QUALITY"].Text); jx++;//外观等级
  237. ht.Add("i" + jx, ugr.Cells["SMP_NO"].Text); jx++;//录入厚度
  238. ht.Add("i" + jx, ugr.Cells["SMP_NO"].Text); jx++;//录入宽度
  239. ht.Add("i" + jx, ugr.Cells["SMP_NO"].Text); jx++;//温度
  240. ht.Add("i" + jx, ugr.Cells["SMP_NO"].Text); jx++;//粗糙度
  241. ht.Add("i" + jx, ugr.Cells["SMP_PICK_YN"].Text); jx++;//是否取样
  242. ht.Add("i" + jx, ugr.Cells["CRK_CD1"].Value.ToString()); jx++;//外观缺陷1
  243. ht.Add("i" + jx, ugr.Cells["CRK_CD1_TYPE"].Text); jx++;
  244. ht.Add("i" + jx, ugr.Cells["CRK_CD2"].Value.ToString()); jx++;
  245. ht.Add("i" + jx, ugr.Cells["CRK_CD2_TYPE"].Text); jx++;
  246. ht.Add("i" + jx, ugr.Cells["CRK_CD3"].Value.ToString()); jx++;
  247. ht.Add("i" + jx, ugr.Cells["CRK_CD3_TYPE"].Text); jx++;
  248. ht.Add("i" + jx, ugr.Cells["CRK_CD4"].Value.ToString()); jx++;
  249. ht.Add("i" + jx, ugr.Cells["CRK_CD4_TYPE"].Text); jx++;
  250. ht.Add("i" + jx, ugr.Cells["CRK_CD5"].Value.ToString()); jx++;//外观缺陷5
  251. ht.Add("i" + jx, ugr.Cells["CRK_CD5_TYPE"].Text); jx++;
  252. ht.Add("i" + jx, this.UserInfo.GetUserName().ToString()); jx++;//操作人
  253. ht.Add("i" + jx, "外观等级录入"); jx++;//操作标志
  254. ht.Add("o" + jx, ""); jx = 1;
  255. ccp.ServerName = "UIB.COM.ComDBProcedure";
  256. ccp.MethodName = "doXmlProcedure";
  257. ccp.ServerParams = new object[] { "UIB030110_01.CALL", ht };
  258. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  259. ugr.Cells["EXSHAPE_TP"].Value = "";
  260. ArrayList all = ccp.ReturnObject as ArrayList;
  261. if (all[0].ToString() != "YY")//确认是否存在问题
  262. {
  263. MessageBox.Show(all[0].ToString(), "提示");
  264. }
  265. }
  266. }
  267. }
  268. this.ultraGrid1.UpdateData();
  269. this.DoQuery();
  270. }
  271. catch (Exception ex)
  272. {
  273. System.Diagnostics.Debug.WriteLine(ex.ToString());
  274. }
  275. }
  276. //导出
  277. public void DoExport()
  278. {
  279. try
  280. {
  281. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  282. {
  283. string fName = this.saveFileDialog1.FileName;
  284. this.ultraGridExcelExporter1.Export(this.ultraGrid1, fName);
  285. Process.Start(fName);
  286. }
  287. }
  288. catch (Exception ex)
  289. {
  290. System.Diagnostics.Debug.WriteLine(ex.ToString());
  291. }
  292. }
  293. //页面初始化时加载钢卷缺陷
  294. public void initCoilDefect()
  295. {
  296. try
  297. {
  298. //缺陷
  299. ArrayList alt = new ArrayList();
  300. alt.Add("UIB030110_02.SELECT");
  301. this.ultraCombo1Dataset.Tables[0].Clear();
  302. CoreClientParam ccp = new CoreClientParam();
  303. ccp.ServerName = "UIB.COM.ComDBQuery";
  304. ccp.MethodName = "doSimpleQuery";
  305. ccp.ServerParams = new object[] { alt };
  306. ccp.SourceDataTable = this.ultraCombo1Dataset.Tables[0];
  307. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  308. //进程
  309. alt = new ArrayList();
  310. alt.Add("UIB030110_01.INIT_SELECT");
  311. this.ultraCombo1Dataset.Tables[1].Clear();
  312. ccp = new CoreClientParam();
  313. ccp.ServerName = "UIB.COM.ComDBQuery";
  314. ccp.MethodName = "doSimpleQuery";
  315. ccp.ServerParams = new object[] { alt };
  316. ccp.SourceDataTable = this.ultraCombo1Dataset.Tables[0];
  317. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  318. }
  319. catch (Exception ex)
  320. {
  321. System.Diagnostics.Debug.WriteLine(ex.ToString());
  322. }
  323. }
  324. private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  325. {
  326. try
  327. {
  328. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  329. {
  330. if (ugr.Cells["SMP_DIR_PIC_YN"].Text.Equals("Y") && ugr.Cells["CHK"].Text.ToLower() == "true") //无取样指示则不允许进行取样操作
  331. {
  332. ugr.Cells["SMP_PICK_YN"].Value = this.comboBox1.SelectedItem.ToString();//执行取样操作,或者去除取样标记
  333. ugr.Cells["SMPPICK_TP"].Value = "Y";
  334. }
  335. }
  336. this.ultraGrid1.UpdateData();
  337. }
  338. catch (Exception ex)
  339. {
  340. System.Diagnostics.Debug.WriteLine(ex.ToString());
  341. }
  342. }
  343. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  344. {
  345. //取样后,重新去掉取样标记,便于下次取样操作
  346. this.comboBox1.SelectedIndex = 0;
  347. }
  348. private void UIB020310_Load(object sender, EventArgs e)
  349. {
  350. try
  351. {
  352. this.comboBox1.SelectedIndex = 0;
  353. this.comboBox2.SelectedIndex = 0;
  354. // this.comboBox3.SelectedIndex = 0;
  355. this.ultraDateTimeEditor1.Enabled = this.checkBox1.Checked;
  356. this.ultraDateTimeEditor2.Enabled = this.checkBox1.Checked;
  357. initCoilDefect();
  358. }
  359. catch (Exception ex)
  360. {
  361. MessageBox.Show("初始化异常");
  362. }
  363. }
  364. private void label5_Click(object sender, EventArgs e)
  365. {
  366. }
  367. private void ultraGrid1_CellChange(object sender, CellEventArgs e)
  368. {
  369. }
  370. private void button1_Click(object sender, EventArgs e)
  371. {
  372. try
  373. {
  374. CUIB030110 CWindow = new CUIB030110();
  375. CWindow.ob = this.ob;
  376. //CWindow.frmdoquery += new CUIB030110.ddd(CWindow_frmdoquery);//委托
  377. if (CWindow.ShowDialog() == DialogResult.OK)
  378. {
  379. int arrayCount = CWindow.al.Count;
  380. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  381. {
  382. if (ugr.Cells["CHK"].Text.ToLower() == "true")
  383. { //有选中项时,先进行清空。因为有初始选N个,第二次选M个。不清除,当M<N是,会残留N-M个。
  384. ugr.Cells["CRK_CD1"].Value = "";
  385. ugr.Cells["CRK_CD1_TYPE"].Value = "";
  386. ugr.Cells["CRK_CD2"].Value = "";
  387. ugr.Cells["CRK_CD2_TYPE"].Value = "";
  388. ugr.Cells["CRK_CD3"].Value = "";
  389. ugr.Cells["CRK_CD3_TYPE"].Value = "";
  390. ugr.Cells["CRK_CD4"].Value = "";
  391. ugr.Cells["CRK_CD4_TYPE"].Value = "";
  392. ugr.Cells["CRK_CD5"].Value = "";
  393. ugr.Cells["CRK_CD5_TYPE"].Value = "";
  394. for (int i = 0; i < arrayCount; i++)
  395. {
  396. // MessageBox.Show(CWindow.al[i].ToString() +"---------"+ CWindow.al[i].ToString().Substring(2));
  397. ugr.Cells["CRK_CD" + Convert.ToString((i + 1))].Value = CWindow.al.GetByIndex(i).ToString().Substring(0, 2);
  398. ugr.Cells["CRK_CD" + Convert.ToString((i + 1)) + "_TYPE"].Value = CWindow.al.GetByIndex(i).ToString().Substring(2);
  399. }
  400. ugr.Cells["CRK_TP"].Value = "Y";
  401. }
  402. }
  403. }
  404. CWindow.Dispose();
  405. this.ultraGrid1.UpdateData();
  406. }
  407. catch (Exception ex)
  408. {
  409. System.Diagnostics.Debug.WriteLine(ex.ToString());
  410. }
  411. }
  412. //委托,暂未使用
  413. void CWindow_frmdoquery()
  414. {
  415. try
  416. {
  417. }
  418. catch (Exception ex)
  419. {
  420. MessageBox.Show(ex.ToString());
  421. }
  422. }
  423. private void ultraCombo1_InitializeLayout(object sender, InitializeLayoutEventArgs e)
  424. {
  425. }
  426. private void button2_Click(object sender, EventArgs e)
  427. {
  428. try
  429. {
  430. CUIB030110SP childCib02 = new CUIB030110SP();
  431. childCib02.ob = this.ob;
  432. if (childCib02.ShowDialog() == DialogResult.OK)
  433. {
  434. }
  435. childCib02.Close();
  436. }
  437. catch (Exception ex)
  438. {
  439. System.Diagnostics.Debug.WriteLine(ex.ToString());
  440. }
  441. }
  442. //回车保存返修温度、粗糙度、判定厚度、判定宽度
  443. private void ultraGrid1_KeyDown_1(object sender, KeyEventArgs e)
  444. {
  445. try
  446. {
  447. //if (SLSelected == "酸轧")
  448. // return;
  449. if (e.KeyCode != Keys.Enter)
  450. return; //只对回车事件操作
  451. if (this.ultraGrid1.ActiveCell.Column.Key != "DCS_THK"//只对判定厚度、返修温度、判定宽度操作
  452. && this.ultraGrid1.ActiveCell.Column.Key != "DCS_WTH"
  453. && this.ultraGrid1.ActiveCell.Column.Key != "CAL_TYPE_TEMP"
  454. && this.ultraGrid1.ActiveCell.Column.Key != "CU_CAO_DU"
  455. && this.ultraGrid1.ActiveCell.Column.Key != "YUAN_COIL_THK"
  456. && this.ultraGrid1.ActiveCell.Column.Key != "YUAN_COIL_WTH"
  457. )
  458. return;
  459. if (this.ultraGrid1.ActiveCell.DataChanged == false) return;//无数据变更时不做修改操作
  460. jx = 1;
  461. CoreClientParam ccp = new CoreClientParam();
  462. Hashtable ht = new Hashtable();
  463. ht.Add("i" + jx, SLSelected); jx++;//产线
  464. ht.Add("i" + jx, this.ultraGrid1.ActiveRow.Cells["COIL_NO"].Text); jx++;//钢卷号
  465. ht.Add("i" + jx, ""); jx++;//试样号
  466. ht.Add("i" + jx, ""); jx++;//位置
  467. ht.Add("i" + jx, ""); jx++;//去向
  468. ht.Add("i" + jx, ""); jx++;//外观等级
  469. ht.Add("i" + jx, this.ultraGrid1.ActiveRow.Cells["DCS_THK"].Text); jx++;//录入厚度
  470. ht.Add("i" + jx, this.ultraGrid1.ActiveRow.Cells["DCS_WTH"].Text); jx++;//录入宽度
  471. ht.Add("i" + jx, this.ultraGrid1.ActiveRow.Cells["CAL_TYPE_TEMP"].Text); jx++;//温度
  472. ht.Add("i" + jx, this.ultraGrid1.ActiveRow.Cells["CU_CAO_DU"].Text); jx++;//粗糙度
  473. ht.Add("i" + jx, ""); jx++;//是否取样
  474. ht.Add("i" + jx, ""); jx++;//外观缺陷1
  475. ht.Add("i" + jx, ""); jx++;
  476. ht.Add("i" + jx, ""); jx++;
  477. ht.Add("i" + jx, ""); jx++;
  478. ht.Add("i" + jx, ""); jx++;
  479. ht.Add("i" + jx, ""); jx++;
  480. ht.Add("i" + jx, ""); jx++;
  481. ht.Add("i" + jx, ""); jx++;
  482. ht.Add("i" + jx, ""); jx++;//外观缺陷5
  483. ht.Add("i" + jx, ""); jx++;
  484. ht.Add("i" + jx, this.UserInfo.GetUserName().ToString()); jx++;//操作人
  485. ht.Add("i" + jx, "判定规格录入"); jx++;//操作标志
  486. ht.Add("o" + jx, ""); jx = 1;
  487. ccp.ServerName = "UIB.COM.ComDBProcedure";
  488. ccp.MethodName = "doXmlProcedure";
  489. ccp.ServerParams = new object[] { "UIB030110_01.CALL", ht };
  490. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  491. ArrayList all = ccp.ReturnObject as ArrayList;
  492. if (all[0].ToString() != "YY")//确认是否存在问题
  493. {
  494. MessageBox.Show(all[0].ToString(), "提示");
  495. }
  496. int currentColIndex = this.ultraGrid1.ActiveCell.Column.Index;//换行前获取当前列的列序号
  497. //取消录入判定宽度值覆盖原来的机器测量宽度实绩值
  498. //this.ultraGrid1.ActiveRow.Cells["COIL_WTH"].Value = this.ultraGrid1.ActiveRow.Cells["DCS_WTH"].Text;////////
  499. //判断人工录入判定值与机器测量实际值之差,若≥10则显示红色
  500. string COILWTH = this.ultraGrid1.ActiveRow.Cells["COIL_WTH"].Text;
  501. string DCSWTH = this.ultraGrid1.ActiveRow.Cells["DCS_WTH"].Text;
  502. if (COILWTH != null && COILWTH != "" && DCSWTH != null && DCSWTH != "")
  503. {
  504. double chazhi = double.Parse(DCSWTH) - double.Parse(COILWTH);
  505. if (System.Math.Abs(chazhi) >= 10)
  506. {
  507. this.ultraGrid1.ActiveRow.Cells["COIL_WTH"].Appearance.BackColor = Color.Red;
  508. this.ultraGrid1.ActiveRow.Cells["DCS_WTH"].Appearance.BackColor = Color.Red;
  509. }
  510. else
  511. {
  512. this.ultraGrid1.ActiveRow.Cells["COIL_WTH"].Appearance.BackColor = Color.White;
  513. this.ultraGrid1.ActiveRow.Cells["DCS_WTH"].Appearance.BackColor = Color.FromArgb(255, 255, 128); //黄色
  514. }
  515. }
  516. else
  517. {
  518. this.ultraGrid1.ActiveRow.Cells["COIL_WTH"].Appearance.BackColor = Color.White;
  519. this.ultraGrid1.ActiveRow.Cells["DCS_WTH"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  520. }
  521. //判断人工录入厚度判定值与机器测量厚度实际值之差,若≥0.01则显示红色
  522. string COILTHK = this.ultraGrid1.ActiveRow.Cells["COIL_THK"].Text;
  523. string DCSTHK = this.ultraGrid1.ActiveRow.Cells["DCS_THK"].Text;
  524. if (COILTHK != null && COILTHK != "" && DCSTHK != null && DCSTHK != "")
  525. {
  526. double chazhi = double.Parse(DCSTHK) - double.Parse(COILTHK);
  527. if (System.Math.Abs(chazhi) >= 0.01)
  528. {
  529. this.ultraGrid1.ActiveRow.Cells["COIL_THK"].Appearance.BackColor = Color.Red;
  530. this.ultraGrid1.ActiveRow.Cells["DCS_THK"].Appearance.BackColor = Color.Red;
  531. }
  532. else
  533. {
  534. this.ultraGrid1.ActiveRow.Cells["COIL_THK"].Appearance.BackColor = Color.White;
  535. this.ultraGrid1.ActiveRow.Cells["DCS_THK"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  536. }
  537. }
  538. else
  539. {
  540. this.ultraGrid1.ActiveRow.Cells["COIL_THK"].Appearance.BackColor = Color.White;
  541. this.ultraGrid1.ActiveRow.Cells["DCS_THK"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  542. }
  543. //换行并使其可编辑
  544. this.ultraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.NextRow);
  545. this.ultraGrid1.ActiveRow.Cells[currentColIndex].Activate();
  546. this.ultraGrid1.PerformAction(UltraGridAction.EnterEditMode);
  547. }
  548. catch (Exception ex)
  549. {
  550. MessageBox.Show(ex.ToString());
  551. System.Diagnostics.Debug.WriteLine(ex.ToString());
  552. }
  553. }
  554. private void ultraGrid1_MouseDown(object sender, MouseEventArgs e)
  555. {
  556. try
  557. {
  558. if (this.ultraGrid1.ActiveCell.Column.Key == "ORD_NO")//链接到品质设计结果查询
  559. {
  560. UIB010301 frm = new UIB010301();
  561. frm.ob = this.ob;
  562. frm.OrderNO = this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text;
  563. frm.OrderSEQ = this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text;
  564. frm.ShowDialog();
  565. this.ultraGrid1.ActiveRow.Cells["SPEC_ABBSYM"].Activate();//换焦点
  566. }
  567. else if (this.ultraGrid1.ActiveCell.Column.Key == "COIL_NO")
  568. {
  569. this.dataSet2.Tables[0].Clear();
  570. if (this.ultraGrid1.ActiveRow.Cells["SMP_NO"].Text != "")
  571. {
  572. ArrayList al = new ArrayList();
  573. al.Add("UIB030110_03.SELECT");
  574. al.Add(this.ultraGrid1.ActiveRow.Cells["SMP_NO"].Text);
  575. al.Add(this.ultraGrid1.ActiveRow.Cells["SMP_CUT_LOC"].Text);
  576. this.dataSet2.Tables[0].Clear();
  577. CoreClientParam ccp = new CoreClientParam();
  578. ccp.ServerName = "UIB.COM.ComDBQuery";
  579. ccp.MethodName = "doSimpleQuery";
  580. ccp.ServerParams = new object[] { al };
  581. ccp.SourceDataTable = this.dataSet2.Tables[0];
  582. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  583. }
  584. //this.ultraGrid1.ActiveRow.Cells["SPEC_ABBSYM"].Activate();//换焦点
  585. }
  586. }
  587. catch (Exception ex)
  588. {
  589. System.Diagnostics.Debug.WriteLine(ex.ToString());
  590. }
  591. }
  592. private void checkBox1_Click(object sender, EventArgs e)
  593. {
  594. this.ultraDateTimeEditor1.Enabled = this.checkBox1.Checked;
  595. this.ultraDateTimeEditor2.Enabled = this.checkBox1.Checked;
  596. }
  597. private void ultraComboEditor1_SelectionChanged_1(object sender, EventArgs e)
  598. {
  599. try
  600. {
  601. if (this.ultraGrid1.ActiveRow == null) return;
  602. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  603. {
  604. if (ugr.Cells["CHK"].Text.ToLower() == "true")
  605. {
  606. ugr.Cells["EXSHAPE_TP"].Value = "Y";//表做了外观判定
  607. ugr.Cells["EXTSHAPE_QUALITY"].Value = ultraComboEditor1.Value.ToString();
  608. }
  609. }
  610. this.ultraGrid1.UpdateData();
  611. }
  612. catch (Exception ex)
  613. {
  614. System.Diagnostics.Debug.WriteLine(ex.ToString());
  615. }
  616. }
  617. private void ultraGrid1_Click(object sender, EventArgs e)
  618. {
  619. }
  620. //返修或降级处理
  621. private void comboBox4_SelectedIndexChanged(object sender, EventArgs e)
  622. {
  623. try
  624. {
  625. string MES = "";
  626. if (this.comboBox4.Text == "返修" || this.comboBox4.Text == "过渡")
  627. {
  628. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  629. {
  630. if (Convert.ToBoolean(ugr.Cells["CHK"].Value))
  631. {
  632. MES += string.Format(ugr.Cells["COIL_NO"].Value.ToString()+":");
  633. if (ugr.Cells["COIL_THK"].Value.ToString() == "0")
  634. MES += string.Format("厚度为0");
  635. if (ugr.Cells["COIL_WTH"].Value.ToString() == "0")
  636. MES += string.Format("宽度为0");
  637. if (ugr.Cells["WGT_DEC_RST"].Value.ToString() == "")
  638. MES += string.Format("重量未判");
  639. if (ugr.Cells["EXTSHAPE_DEC_GRD"].Value.ToString() == "")
  640. MES += string.Format("外观未判");
  641. if (ugr.Cells["COIL_THK"].Value.ToString() != "0" && ugr.Cells["COIL_WTH"].Value.ToString() != "0"
  642. && ugr.Cells["WGT_DEC_RST"].Value.ToString() != "" && ugr.Cells["EXTSHAPE_DEC_GRD"].Value.ToString() != "")
  643. MES += string.Format("可以判过渡/返修");
  644. MES += string.Format("\r\n");
  645. }
  646. }
  647. if (MessageBox.Show(MES, "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  648. return;
  649. }
  650. if (MessageBox.Show("确定执行该操作?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  651. return;
  652. if (SLSelected == "酸轧")//连退才有返修操作
  653. {
  654. if (this.comboBox4.Text == "封闭" || this.comboBox4.Text == "取消封闭"
  655. || this.comboBox4.Text == "返修" || this.comboBox4.Text == "取消返修"
  656. || this.comboBox4.Text == "过渡" || this.comboBox4.Text == "取消过渡")
  657. {
  658. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  659. {
  660. if (Convert.ToBoolean(ugr.Cells["CHK"].Value))
  661. {
  662. if (this.comboBox4.Text == "封闭")
  663. {
  664. object prog_cd = ugr.Cells["CUR_PROG_CD"].Value;
  665. if (prog_cd != null && (prog_cd.ToString() == "运送待机" || prog_cd.ToString() == "运送完成" || prog_cd.ToString() == "DFB"
  666. || prog_cd.ToString() == "DFF" || prog_cd.ToString() == "SFB" || prog_cd.ToString() == "SFF"))
  667. {
  668. MessageBox.Show("运送待机或运送完成的钢卷不能做封闭操作!", "提示");
  669. return;
  670. }
  671. }
  672. ugr.Cells["FB_YN"].Value = this.comboBox4.Text;
  673. CoreClientParam ccp = new CoreClientParam();
  674. Hashtable ht = new Hashtable();
  675. ht.Add("i1", ugr.Cells["COIL_NO"].Text);
  676. ht.Add("i2", this.comboBox4.Text);
  677. ht.Add("i3", this.UserInfo.GetUserName().ToString());
  678. ht.Add("o4", "");
  679. ccp.ServerName = "UIB.COM.ComDBProcedure";
  680. ccp.MethodName = "doXmlProcedure";
  681. ccp.ServerParams = new object[] { "UIB030110_01_SUAN.CALL", ht };
  682. CoreClientParam rccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  683. ArrayList all = rccp.ReturnObject as ArrayList;
  684. if (all[0].ToString() != "YY")//确认是否存在问题
  685. {
  686. MessageBox.Show(all[0].ToString(), "提示");
  687. }
  688. }
  689. }
  690. }
  691. return;
  692. }
  693. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  694. {
  695. if (Convert.ToBoolean(ugr.Cells["CHK"].Value))
  696. {
  697. if (this.comboBox4.Text == "封闭")
  698. {
  699. object prog_cd = ugr.Cells["CUR_PROG_CD"].Value;
  700. if (prog_cd != null && (prog_cd.ToString() == "运送待机" || prog_cd.ToString() == "运送完成" || prog_cd.ToString() == "DFB"
  701. || prog_cd.ToString() == "DFF" || prog_cd.ToString() == "SFB" || prog_cd.ToString() == "SFF"))
  702. {
  703. MessageBox.Show("运送待机或运送完成的钢卷不能做封闭操作!", "提示");
  704. return;
  705. }
  706. }
  707. if (this.comboBox4.Text == "" || this.comboBox4.Text == "返修")
  708. {
  709. ugr.Cells["FAN_XIU"].Value = this.comboBox4.Text;
  710. }
  711. else
  712. {
  713. ugr.Cells["RCAL_CNT"].Value = this.comboBox4.Text;
  714. }
  715. CoreClientParam ccp = new CoreClientParam();
  716. Hashtable ht = new Hashtable();
  717. ht.Add("i1", ugr.Cells["COIL_NO"].Text);
  718. ht.Add("i2", this.comboBox4.Text);
  719. ht.Add("i3", this.UserInfo.GetUserName().ToString());
  720. ht.Add("o4", "");
  721. ccp.ServerName = "UIB.COM.ComDBProcedure";
  722. ccp.MethodName = "doXmlProcedure";
  723. ccp.ServerParams = new object[] { "UIB030110_01_LIAN.CALL", ht };
  724. CoreClientParam rccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  725. ArrayList all = rccp.ReturnObject as ArrayList;
  726. if (all[0].ToString() != "YY")//确认是否存在问题
  727. {
  728. MessageBox.Show(all[0].ToString(), "提示");
  729. }
  730. }
  731. }
  732. this.DoQuery();
  733. }
  734. catch (Exception ex)
  735. {
  736. MessageBox.Show("系统发生错误", "提示");
  737. }
  738. }
  739. private void comboBox5_SelectedIndexChanged(object sender, EventArgs e)
  740. {
  741. try
  742. {
  743. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  744. {
  745. if (ugr.Cells["CHK"].Text.ToLower() == "true") //无取样指示则不允许进行取样操作
  746. {
  747. ugr.Cells["COIL_RT"].Value = this.comboBox5.SelectedItem.ToString();//执行取样操作,或者去除取样标记
  748. ugr.Cells["EXSHAPE_TP"].Value = "Y";//与外观判定的更新放在一起
  749. }
  750. }
  751. this.ultraGrid1.UpdateData();
  752. }
  753. catch (Exception ex)
  754. {
  755. System.Diagnostics.Debug.WriteLine(ex.ToString());
  756. }
  757. }
  758. private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
  759. {
  760. UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands[0];
  761. if (comboBox2.SelectedItem.ToString() == "全部"){
  762. band.ColumnFilters["FB_YN"].ClearFilterConditions();
  763. band.ColumnFilters["EXTSHAPE_DEC_GRD"].ClearFilterConditions();
  764. band.ColumnFilters["SMP_DIR_PIC_YN"].ClearFilterConditions();
  765. band.ColumnFilters["SMP_PICK_YN"].ClearFilterConditions();
  766. }
  767. else if (comboBox2.SelectedItem.ToString() == "封闭卷")
  768. {
  769. band.ColumnFilters["FB_YN"].ClearFilterConditions();
  770. band.ColumnFilters["EXTSHAPE_DEC_GRD"].ClearFilterConditions();
  771. band.ColumnFilters["SMP_DIR_PIC_YN"].ClearFilterConditions();
  772. band.ColumnFilters["SMP_PICK_YN"].ClearFilterConditions();
  773. band.ColumnFilters["FB_YN"].FilterConditions.Add(FilterComparisionOperator.Equals, "Y");
  774. }
  775. else if (comboBox2.SelectedItem.ToString() == "待判卷")
  776. {
  777. band.ColumnFilters["FB_YN"].ClearFilterConditions();
  778. band.ColumnFilters["EXTSHAPE_DEC_GRD"].ClearFilterConditions();
  779. band.ColumnFilters["SMP_DIR_PIC_YN"].ClearFilterConditions();
  780. band.ColumnFilters["SMP_PICK_YN"].ClearFilterConditions();
  781. band.ColumnFilters["EXTSHAPE_DEC_GRD"].FilterConditions.Add(FilterComparisionOperator.NotEquals,1);
  782. band.ColumnFilters["EXTSHAPE_DEC_GRD"].FilterConditions.Add(FilterComparisionOperator.NotEquals, 2);
  783. }
  784. else if (comboBox2.SelectedItem.ToString() == "未取样卷")
  785. {
  786. band.ColumnFilters["FB_YN"].ClearFilterConditions();
  787. band.ColumnFilters["EXTSHAPE_DEC_GRD"].ClearFilterConditions();
  788. band.ColumnFilters["SMP_DIR_PIC_YN"].ClearFilterConditions();
  789. band.ColumnFilters["SMP_PICK_YN"].ClearFilterConditions();
  790. band.ColumnFilters["SMP_DIR_PIC_YN"].FilterConditions.Add(FilterComparisionOperator.Equals, "Y");
  791. band.ColumnFilters["SMP_PICK_YN"].FilterConditions.Add(FilterComparisionOperator.NotEquals, "Y");
  792. }
  793. }
  794. //private void ultraGrid1_KeyUp(object sender, KeyEventArgs e)
  795. //{
  796. // int currentColIndex = this.ultraGrid1.ActiveCell.Column.Index;
  797. // switch (e.KeyCode)
  798. // {
  799. // case Keys.Up:
  800. // this.ultraGrid1.PerformAction(UltraGridAction.ExitEditMode);
  801. // this.ultraGrid1.PerformAction(UltraGridAction.AboveRow);
  802. // this.ultraGrid1.ActiveRow.Cells[currentColIndex].Activate();
  803. // e.Handled = true;
  804. // this.ultraGrid1.PerformAction(UltraGridAction.EnterEditMode);
  805. // break;
  806. // case Keys.Down:
  807. // this.ultraGrid1.PerformAction(UltraGridAction.ExitEditMode);
  808. // this.ultraGrid1.PerformAction(UltraGridAction.NextRow);
  809. // this.ultraGrid1.ActiveRow.Cells[currentColIndex].Activate();
  810. // e.Handled = true;
  811. // this.ultraGrid1.PerformAction(UltraGridAction.EnterEditMode);
  812. // break;
  813. // case Keys.Right:
  814. // this.ultraGrid1.PerformAction(UltraGridAction.ExitEditMode);
  815. // this.ultraGrid1.PerformAction(UltraGridAction.NextCell);
  816. // e.Handled = true;
  817. // this.ultraGrid1.PerformAction(UltraGridAction.EnterEditMode);
  818. // break;
  819. // case Keys.Left:
  820. // this.ultraGrid1.PerformAction(UltraGridAction.ExitEditMode);
  821. // this.ultraGrid1.PerformAction(UltraGridAction.PrevCell);
  822. // e.Handled = true;
  823. // this.ultraGrid1.PerformAction(UltraGridAction.EnterEditMode);
  824. // break;
  825. // }
  826. //}
  827. }
  828. }