UIM010330.cs 5.3 KB

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