QCM0309.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  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 Infragistics.Win.UltraWinGrid;
  12. using System.Diagnostics;
  13. using Infragistics.Win.UltraWinEditors;
  14. using Infragistics.Win;
  15. namespace Core.LZMes.Client.QCM
  16. {
  17. public partial class QCM0309 : FrmBase
  18. {
  19. private string judge_type = "";//用于区分1检测中心和2轧钢厂
  20. public QCM0309()
  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 "Exit":
  32. this.Close();
  33. break;
  34. case "Unlock":
  35. this.cancel_fb();
  36. break;
  37. case "Export":
  38. this.DoExport();
  39. break;
  40. case "CancelFy":
  41. CancelFy();
  42. break;
  43. }
  44. }
  45. private void CancelFy()
  46. {
  47. }
  48. private void DoQuery()
  49. {
  50. if (this.ultraTabControl1.Tabs[0].Selected) //待判信息
  51. {
  52. DoQueryMe();
  53. }
  54. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  55. {
  56. DoQueryRe();
  57. }
  58. }
  59. private void DoQueryMe()
  60. {
  61. try
  62. {
  63. this.dataSet1.Clear();
  64. string starttime = "";
  65. string endtime = "";
  66. string ebatchno = "";
  67. string sbatchno = BatchNo.Text.Trim();
  68. if (BatchNo.Text.ToString() == "")
  69. {
  70. starttime = this.dateTimePicker1.Value.ToString("yyyyMMdd");
  71. endtime = this.dateTimePicker2.Value.AddDays(1).ToString("yyyyMMdd");
  72. }
  73. if (BatchNo1.Text.ToString() == "")
  74. {
  75. ebatchno = this.BatchNo.Text.Trim();
  76. }
  77. else
  78. {
  79. ebatchno = BatchNo1.Text.Trim();
  80. }
  81. CoreClientParam ccp = new CoreClientParam();
  82. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  83. ccp.MethodName = "doQueryMaterialDetailsRZFB";
  84. ccp.ServerParams = new object[] { starttime, endtime, sbatchno, ebatchno };
  85. ccp.SourceDataTable = this.dataSet1.Tables[0];
  86. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  87. /*CoreClientParam ccp = new CoreClientParam();
  88. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  89. ccp.MethodName = "doQueryMaterialDetailsRZFB";
  90. ccp.ServerParams = new object[] { starttime, endtime, sbatchno, ebatchno };
  91. ccp.SourceDataTable = this.dataSet1.Tables[0];
  92. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);*/
  93. }
  94. catch (Exception ex)
  95. {
  96. System.Diagnostics.Debug.WriteLine(ex.ToString());
  97. MessageBox.Show("系统出错,请联系管理人员", "警告");
  98. }
  99. }
  100. private void DoQueryRe()
  101. {
  102. try
  103. {
  104. this.dataSet2.Clear();
  105. string starttime = "";
  106. string endtime = "";
  107. string ebatchno = "";
  108. string sbatchno = BatchNo.Text.Trim();
  109. if (BatchNo.Text.ToString() == "")
  110. {
  111. starttime = this.dateTimePicker1.Value.ToString("yyyyMMdd");
  112. endtime = this.dateTimePicker2.Value.AddDays(1).ToString("yyyyMMdd");
  113. }
  114. if (BatchNo1.Text.ToString() == "")
  115. {
  116. ebatchno = this.BatchNo.Text.Trim();
  117. }
  118. else
  119. {
  120. ebatchno = BatchNo1.Text.Trim();
  121. }
  122. CoreClientParam ccp = new CoreClientParam();
  123. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  124. ccp.MethodName = "doQueryMaterialDetailsRZFBJL";
  125. ccp.ServerParams = new object[] { starttime, endtime, sbatchno, ebatchno };
  126. ccp.SourceDataTable = this.dataSet2.Tables[0];
  127. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  128. }
  129. catch (Exception ex)
  130. {
  131. System.Diagnostics.Debug.WriteLine(ex.ToString());
  132. MessageBox.Show("系统出错,请联系管理人员", "警告");
  133. }
  134. }
  135. private void cancel_fb()
  136. {
  137. try
  138. {
  139. List<UltraGridRow> lists = new List<UltraGridRow>();
  140. foreach (UltraGridRow ugr in ultraGrid9.Rows)
  141. {
  142. if (ugr.Cells["CHECK"].Text.ToString() == "True")
  143. {
  144. if (ugr.Cells["DLIV_DIRNO"].Value.ToString() != "")
  145. {
  146. MessageBox.Show(ugr.Cells["MATERIAL_NO"].Value.ToString() + "卷已有货运指示号,不可进行解除封闭操作!");
  147. return;
  148. }
  149. CoreClientParam ccp = new CoreClientParam();
  150. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  151. ccp.MethodName = "coiljudge_status_call_commit";
  152. ccp.ServerParams = new object[] { "RZ1"
  153. , ugr.Cells["MATERIAL_NO"].Value.ToString()
  154. , ""
  155. , ""
  156. , ""
  157. , ""
  158. , ""
  159. , "N"
  160. ,"",""};
  161. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  162. if (ccp.ReturnCode == -1)
  163. {
  164. return;
  165. }
  166. string remark = "取消封闭";
  167. CoreClientParam ccp1 = new CoreClientParam();
  168. ccp1.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  169. ccp1.MethodName = "RZ_Record1";
  170. ccp1.ServerParams = new object[] { ugr.Cells["MATERIAL_NO"].Value.ToString(), this.UserInfo.GetUserName().ToString(), remark,"" };
  171. ccp1 = this.ExecuteNonQuery(ccp1, CoreInvokeType.Internal);
  172. if (ccp1.ReturnCode == -1)
  173. {
  174. return;
  175. }
  176. lists.Add(ugr);
  177. }
  178. }
  179. for (int i = 0; i < lists.Count; i++)
  180. {
  181. lists[i].Delete(false);
  182. }
  183. //DoQuery();
  184. MessageBox.Show("解除封闭成功!");
  185. }
  186. catch (Exception ex)
  187. {
  188. System.Diagnostics.Debug.WriteLine(ex.ToString());
  189. MessageBox.Show("系统出错,请联系管理人员", "警告");
  190. }
  191. }
  192. private void label1_Click(object sender, EventArgs e)
  193. {
  194. }
  195. private void panel4_Paint(object sender, PaintEventArgs e)
  196. {
  197. }
  198. private void panel2_Paint(object sender, PaintEventArgs e)
  199. {
  200. }
  201. private void DoQueryC()
  202. {
  203. }
  204. private void ultraGrid9_DoubleClickCell(object sender, DoubleClickCellEventArgs e)
  205. {
  206. }
  207. private void button1_Click(object sender, EventArgs e)
  208. {
  209. }
  210. public static bool SetUltraComboEditor(ref UltraComboEditor cbEdt, ref ValueList vlist, bool bNull)
  211. {
  212. if (cbEdt == null || vlist == null)
  213. return false;
  214. cbEdt.Items.Clear();
  215. if (bNull)
  216. cbEdt.Items.Add(null, "");
  217. for (int i = 0; i < vlist.ValueListItems.Count; i++)
  218. {
  219. try
  220. {
  221. cbEdt.Items.Add(vlist.ValueListItems[i].DataValue, vlist.ValueListItems[i].DisplayText);
  222. }
  223. catch { }
  224. }
  225. return true;
  226. }
  227. public static ValueList GeneralValuelist(ref DataTable table, string strKey, string strText)
  228. {
  229. if (table == null || !table.Columns.Contains(strKey) || !table.Columns.Contains(strText))
  230. return null;
  231. ArrayList alist = new ArrayList();
  232. ValueList vlist = new ValueList();
  233. for (int i = 0; i < table.Rows.Count; i++)
  234. {
  235. try
  236. {
  237. if (!alist.Contains(table.Rows[i][strKey]))
  238. {
  239. alist.Add(table.Rows[i][strKey]);
  240. vlist.ValueListItems.Add(table.Rows[i][strKey], Convert.ToString(table.Rows[i][strText]));
  241. }
  242. }
  243. catch { }
  244. }
  245. return vlist;
  246. }
  247. private void QCM0309_Load(object sender, EventArgs e)
  248. {
  249. }
  250. private void ultraGrid2_DoubleClickCell(object sender, DoubleClickCellEventArgs e)
  251. {
  252. }
  253. private void ultraTabControl1_Click(object sender, EventArgs e)
  254. {
  255. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  256. {
  257. this.label9.Text = "操作封闭时间";
  258. }
  259. if (this.ultraTabControl1.Tabs[0].Selected) //判定记录
  260. {
  261. this.label9.Text = "封锁时间";
  262. }
  263. }
  264. private void DoExport()
  265. {
  266. if (this.ultraTabControl1.Tabs[0].Selected) //待判信息
  267. {
  268. try
  269. {
  270. if (this.ultraGrid9.Rows.Count == 0)
  271. {
  272. MessageBox.Show("没有可以导出的数据", "提示");
  273. return;
  274. }
  275. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  276. {
  277. string fName = this.saveFileDialog1.FileName;
  278. this.ultraGridExcelExporter1.Export(this.ultraGrid9, fName);
  279. Process.Start(fName);
  280. }
  281. }
  282. catch (Exception ex)
  283. {
  284. System.Diagnostics.Debug.WriteLine(ex.ToString());
  285. }
  286. }
  287. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  288. {
  289. try
  290. {
  291. if (this.ultraGrid2.Rows.Count == 0)
  292. {
  293. MessageBox.Show("没有可以导出的数据", "提示");
  294. return;
  295. }
  296. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  297. {
  298. string fName = this.saveFileDialog1.FileName;
  299. this.ultraGridExcelExporter1.Export(this.ultraGrid2, fName);
  300. Process.Start(fName);
  301. }
  302. }
  303. catch (Exception ex)
  304. {
  305. System.Diagnostics.Debug.WriteLine(ex.ToString());
  306. }
  307. }
  308. }
  309. private void label11_Click(object sender, EventArgs e)
  310. {
  311. }
  312. private void checkBox2_CheckedChanged(object sender, EventArgs e)
  313. {
  314. foreach (UltraGridRow ugr in this.ultraGrid9.Rows.Where(p => p.IsFilteredOut == false).ToList())
  315. {
  316. if (checkBox2.Checked)
  317. {
  318. ugr.Cells["CHECK"].Value = "True";
  319. }
  320. else
  321. {
  322. ugr.Cells["CHECK"].Value = "False";
  323. }
  324. }
  325. }
  326. }
  327. }