11a28c7ab088619a26f18594608a6287fe61fb34.svn-base 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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. namespace Core.LZMes.Client.UIM
  11. {
  12. /*中间库废次品数据查询*/
  13. public partial class UIM010320 : FrmBase
  14. {
  15. public UIM010320()
  16. {
  17. InitializeComponent();
  18. }
  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 "Out":
  28. this.doOut();
  29. break;
  30. case "Export":
  31. this.doExport();
  32. break;
  33. case "Exit":
  34. this.doClose();
  35. break;
  36. }
  37. }
  38. //查询废次品信息
  39. private void doQuery() {
  40. try
  41. {
  42. this.dataSet1.Tables[0].Clear();
  43. string coilNo = this.ultraTextEditor1.Text;
  44. string fromTime = this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd");
  45. string toTime = this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd");
  46. CoreClientParam ccp = new CoreClientParam();
  47. ccp.ServerName = "UIM.UIM010320";
  48. ccp.MethodName = "query";
  49. ccp.ServerParams = new object[] { coilNo, fromTime, toTime };
  50. ccp.SourceDataTable = this.dataSet1.Tables[0];
  51. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  52. }
  53. catch (Exception e)
  54. {
  55. MessageBox.Show(e.ToString());
  56. }
  57. }
  58. //导出废品信息
  59. private void doExport()
  60. {
  61. try
  62. {
  63. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  64. {
  65. this.ultraGrid1.DisplayLayout.Bands[0].Columns["CHK"].Hidden = true;
  66. string fileName = this.saveFileDialog1.FileName;
  67. ultraGridExcelExporter1.Export(ultraGrid1, fileName);
  68. System.Diagnostics.Process.Start(fileName);
  69. this.ultraGrid1.DisplayLayout.Bands[0].Columns["CHK"].Hidden = false;
  70. }
  71. }
  72. catch (Exception EX)
  73. {
  74. MessageBox.Show(EX.ToString());
  75. }
  76. }
  77. //退出功能
  78. private void doClose() {
  79. try {
  80. DialogResult dr = MessageBox.Show("确定退出系统吗?", "提示", MessageBoxButtons.OKCancel);
  81. if (dr == DialogResult.OK)
  82. {
  83. this.Dispose();
  84. }
  85. else
  86. {
  87. return;
  88. }
  89. }catch(Exception e){
  90. MessageBox.Show(e.ToString());
  91. }
  92. }
  93. //复选框点击处理
  94. private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  95. {
  96. if (e.Cell.Column.Key == "CHK")
  97. {
  98. if (!Convert.ToBoolean(e.Cell.Value))
  99. {
  100. for (int i = 0; i < ultraGrid1.Rows.Count; i++)
  101. {
  102. ultraGrid1.Rows[i].Cells["CHK"].Value = false;
  103. }
  104. e.Cell.Value = true;
  105. }
  106. else
  107. {
  108. e.Cell.Value = false;
  109. }
  110. }
  111. }
  112. //出库功能
  113. public void doOut() {
  114. try {
  115. bool flag = false;
  116. for (int i = 0; i < ultraGrid1.Rows.Count; i++)
  117. {
  118. if (Convert.ToBoolean(ultraGrid1.Rows[i].Cells["CHK"].Value))
  119. {
  120. flag = true;
  121. break;
  122. }
  123. }
  124. if (!flag)
  125. {
  126. MessageBox.Show("请选择需要出库的钢卷!");
  127. return;
  128. }
  129. string coilNo = this.ultraGrid1.ActiveRow.Cells["OLD_SAMPL_NO"].Text;
  130. string regID = this.UserInfo.GetUserID();//出库人
  131. string trnfShift = this.UserInfo.GetUserOrder();//出库班次
  132. string trnfGroup = this.UserInfo.GetUserGroup();//出库班组
  133. string trnfDtime = this.ultraDateTimeEditor3.Value != null ? this.ultraDateTimeEditor3.DateTime.ToString("yyyyMMddHHmmss") : "";//出库时间
  134. CoreClientParam ccp = new CoreClientParam();
  135. ccp.ServerName = "UIM.UIM010320";
  136. ccp.MethodName = "out";
  137. ccp.ServerParams = new object[] { coilNo, regID, trnfShift, trnfGroup, trnfDtime};
  138. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  139. if (0 == ccp.ReturnCode)
  140. {
  141. MessageBox.Show("出库成功!");
  142. }
  143. doQuery();
  144. }
  145. catch (Exception e) {
  146. MessageBox.Show(e.ToString());
  147. }
  148. }
  149. }
  150. }