QCM030613.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  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 Infragistics.Win;
  9. using System.Windows.Forms;
  10. using CoreFS.CA06;
  11. using Infragistics.Win.UltraWinGrid;
  12. using System.Diagnostics;
  13. using System.Text.RegularExpressions;
  14. using Infragistics.Win.UltraWinEditors;
  15. using System.Collections;
  16. namespace Core.LZMes.Client.QCM
  17. {
  18. public partial class QCM030613 : FrmBase
  19. {
  20. public QCM030613()
  21. {
  22. InitializeComponent();
  23. }
  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 "Judge":
  32. this.Judge();
  33. break;
  34. case "Exit":
  35. this.Close();
  36. break;
  37. case "Export":
  38. this.DoExport();
  39. break;
  40. }
  41. }
  42. private void Judge()
  43. {
  44. try
  45. {
  46. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  47. if (ugr == null)
  48. return;
  49. string material_no = ugr.Cells["OLD_SAMPL_NO"].Value.ToString();
  50. string steel_name = ugr.Cells["SPEC_STL_GRD"].Value.ToString();
  51. string thick = ugr.Cells["COIL_THK"].Value.ToString();
  52. string width = ugr.Cells["COIL_WTH"].Value.ToString();
  53. string orderno = textBox3.Text.Trim().ToString();
  54. string gp_steel_name = txt_gp_tradeno.Text.Trim().ToString();
  55. string old_orderno = ugr.Cells["ORG_ORD_NO"].Value.ToString() + ugr.Cells["ORG_ORD_SEQ"].Value.ToString();
  56. string weight = ugr.Cells["ACT_WGT"].Value.ToString();
  57. string prod_line = ugr.Cells["PROD_LINE"].Value.ToString();
  58. string username = this.UserInfo.GetUserName();
  59. string gp_type = comboBox1.Text.ToString();
  60. if (gp_type.Equals(""))
  61. {
  62. MessageBox.Show("请选择改判类型!");
  63. return;
  64. }
  65. if (MessageBox.Show(this, "是否确认按【" + gp_type + "】改判!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
  66. {
  67. return;
  68. }
  69. CoreClientParam ccp = new CoreClientParam();
  70. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  71. ccp.MethodName = "CoilGp";
  72. ccp.ServerParams = new object[] { material_no,steel_name,thick,width,orderno,old_orderno,weight,prod_line, username,gp_steel_name,gp_type};
  73. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  74. if (ccp.ReturnCode == -1)
  75. {
  76. return;
  77. }
  78. MessageBox.Show("改判成功!");
  79. this.textBox3.Text="";
  80. this.txt_gp_tradeno.Text ="";
  81. }
  82. catch (Exception EX)
  83. {
  84. MessageBox.Show(EX.ToString());
  85. }
  86. }
  87. private void canceljudge()
  88. {
  89. //try
  90. //{
  91. // QCM030607 frm = new QCM030607();
  92. // if (frm.ShowDialog() == DialogResult.OK)
  93. // {
  94. // string remark = frm._memo;
  95. // if (remark == "")
  96. // {
  97. // MessageBox.Show("请录入备注信息!");
  98. // return;
  99. // }
  100. // if (this.ultraGrid18.Selected.Rows.Count == 0)
  101. // this.ultraGrid18.ActiveRow.Selected = true;
  102. // foreach (UltraGridRow ugr in this.ultraGrid18.Rows)
  103. // {
  104. // if (ugr.Cells["CHECK"].Text.ToString() == "True")
  105. // {
  106. // string MATERIAL_NO = ugr.Cells["MATERIAL_NO"].Value.ToString();
  107. // string utm_id = ugr.Cells["UTM_ID"].Value.ToString();
  108. // string username = this.UserInfo.GetUserName();
  109. // CoreClientParam ccp = new CoreClientParam();
  110. // ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  111. // ccp.MethodName = "cancelUltimateJudge";
  112. // ccp.ServerParams = new object[] { username, MATERIAL_NO, utm_id,remark };
  113. // ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  114. // if (ccp.ReturnCode == -1)
  115. // {
  116. // return;
  117. // }
  118. // }
  119. // }
  120. // MessageBox.Show("取消判定成功!");
  121. // }
  122. //}
  123. //catch (Exception EX)
  124. //{
  125. // MessageBox.Show(EX.ToString());
  126. //}
  127. //DoQuery();
  128. }
  129. private void DoQuery()
  130. {
  131. if (this.ultraTabControl1.Tabs[0].Selected) //待判信息
  132. {
  133. DoQueryMe();
  134. }
  135. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  136. {
  137. DoQueryRe();
  138. }
  139. }
  140. //查询待判信息
  141. private void DoQueryMe()
  142. {
  143. try
  144. {
  145. this.dataSet1.Clear();
  146. string coil_no = textBox4.Text.Trim();
  147. string prod_line = comboBox3.Text.ToString();
  148. CoreClientParam ccp = new CoreClientParam();
  149. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  150. ccp.MethodName = "GetGpCoilInfo";
  151. ccp.ServerParams = new object[] { coil_no,prod_line };
  152. ccp.SourceDataTable = this.dataSet1.Tables[0];
  153. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  154. }
  155. catch (Exception ex)
  156. {
  157. System.Diagnostics.Debug.WriteLine(ex.ToString());
  158. MessageBox.Show("系统出错,请联系管理人员", "警告");
  159. }
  160. }
  161. //查询判定记录
  162. private void DoQueryRe()
  163. {
  164. try
  165. {
  166. this.dataSet2.Clear();
  167. string starttime = this.dateTimePicker1.Value.ToString("yyyyMMdd");
  168. string endtime = this.dateTimePicker2.Value.ToString("yyyyMMdd");
  169. string prod_line = comboBox3.Text.ToString();
  170. string coil_no = textBox4.Text.Trim();
  171. CoreClientParam ccp = new CoreClientParam();
  172. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  173. ccp.MethodName = "GetGpHistory";
  174. ccp.ServerParams = new object[] { coil_no,starttime,endtime,prod_line };
  175. ccp.SourceDataTable = this.dataSet2.Tables[0];
  176. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  177. }
  178. catch (Exception ex)
  179. {
  180. System.Diagnostics.Debug.WriteLine(ex.ToString());
  181. MessageBox.Show("系统出错,请联系管理人员", "警告");
  182. }
  183. }
  184. private void QCM030601_Load(object sender, EventArgs e)
  185. {
  186. ValueList vsflv = new ValueList();
  187. CoreClientParam ccp = new CoreClientParam();
  188. this.ultraGrid1.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  189. this.ultraGrid18.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  190. this.label1.Visible = false;
  191. this.label2.Visible = false;
  192. this.dateTimePicker1.Visible = false;
  193. this.dateTimePicker2.Visible = false;
  194. //DoQuery();
  195. }
  196. public static bool SetUltraComboEditor(ref UltraComboEditor cbEdt, ref ValueList vlist, bool bNull)
  197. {
  198. if (cbEdt == null || vlist == null)
  199. return false;
  200. cbEdt.Items.Clear();
  201. if (bNull)
  202. cbEdt.Items.Add(null, "");
  203. for (int i = 0; i < vlist.ValueListItems.Count; i++)
  204. {
  205. try
  206. {
  207. cbEdt.Items.Add(vlist.ValueListItems[i].DataValue, vlist.ValueListItems[i].DisplayText);
  208. }
  209. catch { }
  210. }
  211. return true;
  212. }
  213. public static ValueList GeneralValuelist(ref DataTable table, string strKey, string strText)
  214. {
  215. if (table == null || !table.Columns.Contains(strKey) || !table.Columns.Contains(strText))
  216. return null;
  217. ArrayList alist = new ArrayList();
  218. ValueList vlist = new ValueList();
  219. for (int i = 0; i < table.Rows.Count; i++)
  220. {
  221. try
  222. {
  223. if (!alist.Contains(table.Rows[i][strKey]))
  224. {
  225. alist.Add(table.Rows[i][strKey]);
  226. vlist.ValueListItems.Add(table.Rows[i][strKey], Convert.ToString(table.Rows[i][strText]));
  227. }
  228. }
  229. catch { }
  230. }
  231. return vlist;
  232. }
  233. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  234. {
  235. SetFilterUIType(this.ultraGrid1, this.checkBox1.Checked);
  236. SetFilterUIType(this.ultraGrid1, this.checkBox1.Checked);
  237. SetFilterUIType(this.ultraGrid16, this.checkBox1.Checked);
  238. SetFilterUIType(this.ultraGrid7, this.checkBox1.Checked);
  239. SetFilterUIType(this.ultraGrid11, this.checkBox1.Checked);
  240. SetFilterUIType(this.ultraGrid12, this.checkBox1.Checked);
  241. SetFilterUIType(this.ultraGrid13, this.checkBox1.Checked);
  242. SetFilterUIType(this.ultraGrid14, this.checkBox1.Checked);
  243. SetFilterUIType(this.ultraGrid15, this.checkBox1.Checked);
  244. }
  245. private void SetFilterUIType(UltraGrid grid, bool checkType)
  246. {
  247. if (checkType)
  248. {
  249. grid.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  250. }
  251. else
  252. {
  253. grid.DisplayLayout.Bands[0].ColumnFilters.ClearAllFilters();
  254. grid.DisplayLayout.Override.FilterUIType = FilterUIType.Default;
  255. }
  256. }
  257. private void DoExport()
  258. {
  259. try
  260. {
  261. if (this.ultraTabControl1.Tabs[0].Selected) //判定记录
  262. {
  263. if (this.ultraGrid1.Rows.Count == 0)
  264. {
  265. MessageBox.Show("没有可以导出的数据", "提示");
  266. return;
  267. }
  268. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  269. {
  270. string fName = this.saveFileDialog1.FileName;
  271. this.ultraGridExcelExporter1.Export(this.ultraGrid1, fName);
  272. Process.Start(fName);
  273. }
  274. }
  275. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  276. {
  277. if (this.ultraGrid18.Rows.Count == 0)
  278. {
  279. MessageBox.Show("没有可以导出的数据", "提示");
  280. return;
  281. }
  282. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  283. {
  284. string fName = this.saveFileDialog1.FileName;
  285. this.ultraGridExcelExporter1.Export(this.ultraGrid18, fName);
  286. Process.Start(fName);
  287. }
  288. }
  289. }
  290. catch (Exception ex)
  291. {
  292. System.Diagnostics.Debug.WriteLine(ex.ToString());
  293. }
  294. }
  295. private void checkBox2_CheckedChanged(object sender, EventArgs e)
  296. {
  297. if (this.ultraTabControl1.Tabs[0].Selected) //待判信息
  298. {
  299. foreach (UltraGridRow ugr in this.ultraGrid1.Rows.Where(p => p.IsFilteredOut == false).ToList())
  300. {
  301. if (checkBox2.Checked)
  302. {
  303. ugr.Selected = true;
  304. }
  305. else
  306. {
  307. ugr.Selected = false;
  308. }
  309. }
  310. }
  311. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  312. {
  313. foreach (UltraGridRow ugr in this.ultraGrid18.Rows.Where(p => p.IsFilteredOut == false).ToList())
  314. {
  315. if (checkBox2.Checked)
  316. {
  317. ugr.Cells["CHECK"].Value = "True";
  318. }
  319. else
  320. {
  321. ugr.Cells["CHECK"].Value = "False";
  322. }
  323. }
  324. }
  325. }
  326. private void button1_Click(object sender, EventArgs e)
  327. {
  328. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  329. if (ugr == null)
  330. return;
  331. string material_no = ugr.Cells["OLD_SAMPL_NO"].Text.ToString();
  332. string steel_code = ugr.Cells["SPEC_STL_GRD"].Text.ToString();
  333. string thick = ugr.Cells["COIL_THK"].Text.ToString();
  334. string PSC = ugr.Cells["PSC"].Text.ToString();
  335. string WIDTH = ugr.Cells["COIL_WTH"].Text.ToString();
  336. string PRODLINE = ugr.Cells["PROD_LINE"].Text.ToString();
  337. QCM030709 dlg = new QCM030709();
  338. dlg.MATERIAL_NO = material_no;
  339. dlg.STD_CODE = "";
  340. dlg.STEELCODE = steel_code;
  341. dlg.DELIVERY_STATE_CODE = "";
  342. dlg.HEIGHT = thick;
  343. dlg.PSC = PSC;
  344. dlg.WIDTH = WIDTH;
  345. dlg.LENGTH = "";
  346. dlg.PROD_LINE = PRODLINE;
  347. dlg.ob = this.ob;
  348. dlg.ShowDialog();
  349. this.textBox3.Text = dlg.orderno;
  350. this.txt_gp_tradeno.Text = dlg.gp_tradeno;
  351. }
  352. private void ultraTabControl1_Click(object sender, EventArgs e)
  353. {
  354. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  355. {
  356. this.label1.Visible = true;
  357. this.label2.Visible = true;
  358. this.dateTimePicker1.Visible = true;
  359. this.dateTimePicker2.Visible = true;
  360. }
  361. if (this.ultraTabControl1.Tabs[0].Selected) //判定记录
  362. {
  363. this.label1.Visible = false;
  364. this.label2.Visible = false;
  365. this.dateTimePicker1.Visible = false;
  366. this.dateTimePicker2.Visible = false;
  367. }
  368. }
  369. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  370. {
  371. this.textBox3.Text = "";
  372. this.txt_gp_tradeno.Text = "";
  373. }
  374. }
  375. }