UIB030110LT_1.cs 38 KB

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