UIB030220.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  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 System.Collections;
  10. using CoreFS.CA06;
  11. using Infragistics.Win.UltraWinGrid;
  12. namespace Core.LZMes.Client.UIB
  13. {
  14. public partial class UIB030220 : FrmBase
  15. {
  16. public UIB030220()
  17. {
  18. InitializeComponent();
  19. }
  20. public override void ToolBar_Click(object sender, string ToolbarKey)
  21. {
  22. switch (ToolbarKey)
  23. {
  24. case "Query":
  25. this.DoQuery();
  26. break;
  27. case "Save":
  28. this.DoSave();
  29. break;
  30. case "Export":
  31. this.DoExport();
  32. break;
  33. }
  34. }
  35. string strLine = null;
  36. public void DoQuery()
  37. {
  38. ArrayList al = new ArrayList();
  39. //if(this.ultraTabControl1.Name)
  40. //MessageBox.Show(this.ultraTabControl1.Tabs.c);
  41. DataTable dt = null;
  42. if (this.ultraTabControl1.Tabs[0].Selected)//判定结果查询
  43. {
  44. if (this.comboBox1.Text == "热轧")
  45. {
  46. al.Add("UIB030220_HOST_01.SELECT");
  47. return; //未用到直接返回20151128
  48. }
  49. else if (this.comboBox1.Text == "酸轧")
  50. {
  51. al.Add("UIB030220_SUAN_01.SELECT");
  52. }
  53. else if(this.comboBox1.Text == "连退")
  54. {
  55. al.Add("UIB030220_LIAN_01.SELECT");
  56. }
  57. this.dataSet1.Tables["coil"].Clear();
  58. dt = this.dataSet1.Tables["coil"];
  59. }
  60. else if (this.ultraTabControl1.Tabs[1].Selected)//判定历史记录查询
  61. {
  62. if (this.comboBox1.Text == "酸轧")
  63. {
  64. al.Add("UIB030220_SUAN_HISDCS.SELECT");//判定历史记录
  65. }
  66. else if (this.comboBox1.Text == "连退")
  67. {
  68. al.Add("UIB030220_LIAN_HISDCS.SELECT");
  69. }
  70. this.dataSet1.Tables["HIS"].Clear();
  71. dt = this.dataSet1.Tables["HIS"];
  72. }
  73. else//带判钢卷查询
  74. {
  75. if (this.comboBox1.Text == "酸轧")
  76. {
  77. al.Add("UIB030220_SUAN_02.SELECT");//待判卷
  78. }
  79. else if (this.comboBox1.Text == "连退")
  80. {
  81. al.Add("UIB030220_LIAN_02.SELECT");//待判卷
  82. }
  83. this.dataSet1.Tables["DaiPan"].Clear();
  84. dt = this.dataSet1.Tables["DaiPan"];
  85. }
  86. if (this.ultraTabControl1.Tabs[0].Selected || this.ultraTabControl1.Tabs[1].Selected)
  87. {
  88. OperateConditionRecode.WriteCondition("UIB030220_STLGRD", this.specStlGrd.Text);
  89. OperateConditionRecode.WriteCondition("UIB030220_COILS", this.coilStat.Text);
  90. OperateConditionRecode.WriteCondition("UIB030220_COILE", this.coilEnd.Text);
  91. OperateConditionRecode.WriteCondition("UIB030220_ORD", this.ordText.Text);
  92. al.Add(this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMddHHmmss"));
  93. al.Add(this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd" + "999999"));
  94. al.Add(this.coilStat.Text.Trim());
  95. al.Add(this.coilEnd.Text.Trim() == "" ? this.coilStat.Text.Trim() : this.coilEnd.Text.Trim());
  96. al.Add(this.ordText.Text.Trim() == "" ? "1" : this.ordText.Text.Trim());
  97. al.Add(this.ordText.Text.Trim() == "" ? "1" : this.ordText.Text.Trim());
  98. al.Add(this.specStlGrd.Text.Trim());
  99. }
  100. //this.dataSet1.Tables["coil"].Clear();
  101. CoreClientParam ccp = new CoreClientParam();
  102. ccp.ServerName = "UIB.COM.ComDBQuery";
  103. ccp.MethodName = "doSimpleQuery";
  104. ccp.ServerParams = new object[] { al };
  105. ccp.SourceDataTable =dt ;//this.dataSet1.Tables["coil"];
  106. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  107. strLine = this.comboBox1.Text;
  108. if (this.ultraTabControl1.Tabs[0].Selected)
  109. {
  110. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  111. {
  112. if (ugr.Cells["TOT_DEC_GRD"].Text == "2")
  113. {
  114. ugr.Appearance.ForeColor = Color.Red;//字体显示红色
  115. }
  116. }
  117. }
  118. }
  119. public void DoExport()
  120. {
  121. try
  122. {
  123. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  124. {
  125. string fName = this.saveFileDialog1.FileName;
  126. if (this.ultraTabControl1.Tabs[0].Selected)
  127. {
  128. this.ultraGridExcelExporter1.Export(this.ultraGrid1, fName);
  129. }
  130. else if (this.ultraTabControl1.Tabs[1].Selected)
  131. {
  132. this.ultraGridExcelExporter1.Export(this.ultraGrid5, fName);
  133. }
  134. else
  135. {
  136. this.ultraGridExcelExporter1.Export(this.ultraGrid6, fName);
  137. }
  138. System.Diagnostics.Process.Start(fName);
  139. }
  140. }
  141. catch (Exception ex)
  142. {
  143. System.Diagnostics.Debug.WriteLine(ex.ToString());
  144. }
  145. }
  146. public void DoSave()//取消综合判定
  147. {
  148. try
  149. {
  150. if (!this.ultraTabControl1.Tabs[0].Selected)
  151. {
  152. return;
  153. }
  154. if (MessageBox.Show("确认取消判定?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  155. return;
  156. ArrayList al = new ArrayList();
  157. CoreClientParam ccp = new CoreClientParam();
  158. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  159. {
  160. if (Convert.ToBoolean(ugr.Cells["CHK"].Text))
  161. {
  162. Hashtable ht = new Hashtable();
  163. ht.Add("i1", ugr.Cells["COIL_NO"].Text);
  164. ht.Add("i2", this.UserInfo.GetUserID());
  165. ht.Add("o3", "");
  166. ccp.ServerName = "UIB.COM.ComDBProcedure";
  167. ccp.MethodName = "doXmlProcedure";
  168. if (strLine == "酸轧")
  169. {
  170. ccp.ServerParams = new object[] { "UIB030220_SUAN_01.CALL", ht };
  171. }
  172. else if (strLine == "连退")
  173. {
  174. ccp.ServerParams = new object[] { "UIB030220_LIAN_01.CALL", ht };
  175. }
  176. else
  177. {
  178. MessageBox.Show("错误操作!" , "警告");
  179. return;
  180. }
  181. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  182. }
  183. }
  184. this.DoQuery();
  185. }
  186. catch (Exception ex)
  187. {
  188. System.Diagnostics.Debug.WriteLine(ex.ToString());
  189. }
  190. }
  191. private void UIB030220_Load(object sender, EventArgs e)
  192. {
  193. this.comboBox1.SelectedIndex = 1;
  194. this.specStlGrd.Text=OperateConditionRecode.ReadCondition("UIB030220_STLGRD");
  195. this.coilStat.Text = OperateConditionRecode.ReadCondition("UIB030220_COILS");
  196. this.coilEnd.Text = OperateConditionRecode.ReadCondition("UIB030220_COILE");
  197. this.ordText.Text = OperateConditionRecode.ReadCondition("UIB030220_ORD");
  198. }
  199. private void button1_Click(object sender, EventArgs e)
  200. {
  201. UIB010301 frm = new UIB010301();
  202. frm.ob = this.ob;
  203. frm.OrderNO = "312009032101";
  204. frm.OrderSEQ = "002";
  205. frm.ShowDialog();
  206. }
  207. private void ultraGrid1_AfterCellActivate(object sender, EventArgs e)
  208. {
  209. try
  210. {
  211. if (this.ultraGrid1.ActiveCell.Column.Key == "ORD_NO")//链接到品质设计结果查询
  212. {
  213. UIB010301 frm = new UIB010301();
  214. frm.ob = this.ob;
  215. frm.OrderNO = this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text;
  216. frm.OrderSEQ = this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text;
  217. frm.ShowDialog();
  218. }
  219. else if (this.ultraGrid1.ActiveCell.Column.Key == "COIL_NO")//查询钢卷详细信息
  220. {
  221. ArrayList list = new ArrayList();
  222. //成分
  223. ArrayList al = new ArrayList();
  224. list.Add(al);
  225. al.Add("UIB030220_CHEM.SELECT");
  226. al.Add(this.ultraGrid1.ActiveRow.Cells["SLAB_NO"].Text);
  227. al.Add(this.ultraGrid1.ActiveRow.Cells["SLAB_NO"].Text);
  228. al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text);
  229. al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text);
  230. //材质
  231. al = new ArrayList();
  232. list.Add(al);
  233. al.Add("UIB030220_QLTY.SELECT");
  234. al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text);
  235. al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text);
  236. al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text);
  237. al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text);
  238. al.Add(this.ultraGrid1.ActiveRow.Cells["SMP_NO"].Text);
  239. al.Add(this.ultraGrid1.ActiveRow.Cells["SMP_CUT_LOC"].Text);
  240. //其它
  241. al = new ArrayList();
  242. list.Add(al);
  243. al.Add("UIB030220_OTHERS.SELECT");
  244. al.Add(this.ultraGrid1.ActiveRow.Cells["COIL_THK"].Text);//厚度
  245. al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text);
  246. al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text);
  247. al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text);
  248. al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text);
  249. al.Add(this.ultraGrid1.ActiveRow.Cells["COIL_WTH"].Text);//宽度
  250. al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text);
  251. al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text);
  252. al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text);
  253. al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text);
  254. al.Add(this.ultraGrid1.ActiveRow.Cells["COIL_INDIA"].Text);//内径
  255. al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text);
  256. al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text);
  257. al.Add(this.ultraGrid1.ActiveRow.Cells["ACT_WGT"].Text);//重量
  258. al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text);
  259. al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text);
  260. al.Add(this.ultraGrid1.ActiveRow.Cells["EXTSHAPE_QUALITY"].Text);//外观
  261. al.Add(this.ultraGrid1.ActiveRow.Cells["CR_DK1"].Text);//缺陷
  262. al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text);
  263. al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text);
  264. al.Add(this.ultraGrid1.ActiveRow.Cells["PACKAGE_LEVEL"].Text);//包装
  265. al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text);
  266. al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text);
  267. al.Add(this.ultraGrid1.ActiveRow.Cells["PROC_DEC_RST"].Text);//切边
  268. al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text);
  269. al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text);
  270. //this.dataSet1.Tables[1].Clear();
  271. CoreClientParam ccp = new CoreClientParam();
  272. ccp.ServerName = "UIB.COM.ComDBQuery";
  273. ccp.MethodName = "doContinuousQluery";
  274. ccp.ServerParams = new object[] { list };
  275. CoreClientParam ccpList = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  276. if (ccpList.ReturnInfo.Length == 0)
  277. {
  278. ArrayList aList = ccpList.ReturnObject as ArrayList;
  279. if (aList[0] != null)
  280. {
  281. this.dataSet1.Tables["ingr"].Clear();
  282. System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(aList[0] as System.Collections.ArrayList, this.dataSet1.Tables["ingr"]);
  283. tab0.TableName = "ingr";
  284. this.dataSet1.Tables["ingr"].Merge(tab0);
  285. }
  286. if (aList[1] != null)
  287. {
  288. this.dataSet1.Tables["qlty"].Clear();
  289. System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(aList[1] as System.Collections.ArrayList, this.dataSet1.Tables["qlty"]);
  290. tab0.TableName = "qlty";
  291. this.dataSet1.Tables["qlty"].Merge(tab0);
  292. }
  293. if (aList[2] != null)
  294. {
  295. this.dataSet1.Tables["other"].Clear();
  296. System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(aList[2] as System.Collections.ArrayList, this.dataSet1.Tables["other"]);
  297. tab0.TableName = "other";
  298. this.dataSet1.Tables["other"].Merge(tab0);
  299. }
  300. }
  301. }//end else if
  302. //成分判断
  303. foreach (UltraGridRow ugr in this.ultraGrid2.Rows)
  304. {
  305. double min = Convert.ToDouble(ugr.Cells["CHEM_MIN"].Text == "" ? "0" : ugr.Cells["CHEM_MIN"].Text);
  306. double max = Convert.ToDouble(ugr.Cells["CHEM_MAX"].Text == "" ? "9999" : ugr.Cells["CHEM_MAX"].Text);
  307. double value = Convert.ToDouble(ugr.Cells["CHEM_VAL"].Text == "" ? "-1" : ugr.Cells["CHEM_VAL"].Text);
  308. if (value < min || value > max)
  309. {
  310. ugr.Appearance.ForeColor = Color.Red;//字体显示红色
  311. }
  312. if (value == -1)//缺少实际值
  313. {
  314. ugr.Appearance.ForeColor = Color.Red;//字体显示红色
  315. }
  316. }
  317. //材质判断
  318. foreach (UltraGridRow ugr in this.ultraGrid3.Rows)
  319. {
  320. double min = Convert.ToDouble(ugr.Cells["QLTY_MIN"].Text == "" ? "0" : ugr.Cells["QLTY_MIN"].Text);
  321. double max = Convert.ToDouble(ugr.Cells["QLTY_MAX"].Text == "" ? "9999" : ugr.Cells["QLTY_MAX"].Text);
  322. double value = Convert.ToDouble(ugr.Cells["QLTY_VAL_WK"].Text == "" ? "-1" : ugr.Cells["QLTY_VAL_WK"].Text);
  323. if (value < min || value > max)
  324. {
  325. ugr.Appearance.ForeColor = Color.Red;//字体显示红色
  326. }
  327. if (value == -1)//缺少实际值
  328. {
  329. ugr.Appearance.ForeColor = Color.Red;//字体显示红色
  330. }
  331. }
  332. //其它判断
  333. foreach (UltraGridRow ugr in this.ultraGrid4.Rows)
  334. {
  335. string name = ugr.Cells["T_NAME"].Text.Trim();
  336. if ("外观" == name)
  337. {
  338. //不相等显示红色
  339. string waiguan = ugr.Cells["T_MIN"].Text;
  340. if (waiguan != null && waiguan != "" && !waiguan.Equals("0") && String.Compare(waiguan, ugr.Cells["T_VALUE"].Text) > 0)
  341. {
  342. ugr.Appearance.ForeColor = Color.Red;//字体显示红色
  343. }
  344. continue;
  345. }
  346. else if ("内径" == name)
  347. {
  348. //不相等显示红色
  349. string india = ugr.Cells["T_MIN"].Text;
  350. if (india != null && india != "" && !india.Equals("0") && !india.Equals(ugr.Cells["T_VALUE"].Text))
  351. {
  352. ugr.Appearance.ForeColor = Color.Red;//字体显示红色
  353. }
  354. continue;
  355. }
  356. else if ("包装" == name)
  357. {
  358. if ("不包装".Equals(ugr.Cells["T_MIN"].Text) && "XX".Equals(ugr.Cells["T_VALUE"].Text))
  359. { }
  360. else
  361. {
  362. //不相等显示红色
  363. if (!ugr.Cells["T_MIN"].Text.Equals(ugr.Cells["T_VALUE"].Text))
  364. {
  365. ugr.Appearance.ForeColor = Color.Red;//字体显示红色
  366. }
  367. }
  368. continue;
  369. }
  370. else if ("切边" == name)
  371. {
  372. if ("Y".Equals(ugr.Cells["T_MIN"].Text) && "2".Equals(ugr.Cells["T_VALUE"].Text))
  373. {
  374. ugr.Appearance.ForeColor = Color.Red;//字体显示红色
  375. }
  376. continue;
  377. }
  378. double min = Convert.ToDouble(ugr.Cells["T_MIN"].Text == "" ? "0" : ugr.Cells["T_MIN"].Text);
  379. double max = Convert.ToDouble(ugr.Cells["T_MAX"].Text == "" ? "99999" : ugr.Cells["T_MAX"].Text);
  380. double value = Convert.ToDouble(ugr.Cells["T_VALUE"].Text == "" ? "-1" : ugr.Cells["T_VALUE"].Text);
  381. if (value < min || value > max)
  382. {
  383. ugr.Appearance.ForeColor = Color.Red;//字体显示红色
  384. }
  385. if (value == -1)//缺少实际值
  386. {
  387. ugr.Appearance.ForeColor = Color.Red;//字体显示红色
  388. }
  389. }
  390. }
  391. catch (Exception ex)
  392. {
  393. System.Diagnostics.Debug.WriteLine(ex.ToString());
  394. }
  395. }
  396. }
  397. }