UIM010110.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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 Infragistics.Win.UltraWinGrid;
  11. namespace Core.LZMes.Client.UIM
  12. {
  13. public partial class UIM010110 : FrmBase
  14. {
  15. private string COIL_NO = "";
  16. public UIM010110()
  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 "Exit":
  31. this.Close();
  32. break;
  33. }
  34. }
  35. /// <summary>
  36. /// 查询钢卷信息
  37. /// </summary>
  38. private void DoQuery()
  39. {
  40. try
  41. {
  42. string coilNo = "R" + this.textBox1.Text.Trim() /*+ "-" */+ this.textBox2.Text.Trim() + "A" + this.textBox3.Text.Trim();
  43. this.dataSet1.Tables[0].Clear();
  44. COIL_NO = coilNo;
  45. CoreClientParam ccp = new CoreClientParam();
  46. ccp.ServerName = "UIM.UIM010110";
  47. ccp.MethodName = "queryCoilInfo";
  48. ccp.ServerParams = new object[] { coilNo };
  49. ccp.SourceDataTable = this.dataSet1.Tables[0];
  50. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  51. }
  52. catch (Exception EX)
  53. {
  54. MessageBox.Show(EX.ToString());
  55. }
  56. }
  57. /// <summary>
  58. /// 盘入盘出操作
  59. /// </summary>
  60. private void DoSave()
  61. {
  62. try
  63. {
  64. if (this.dataTable1.Rows.Count < 1)
  65. {
  66. MessageBox.Show("钢卷信息不能为空,请先查询出钢卷信息再进行盘入盘出操作!");
  67. return;
  68. }
  69. Infragistics.Win.UltraWinGrid.RowsCollection rs = null;
  70. rs = this.ultraGrid1.Rows;
  71. string wdlivno = "";
  72. foreach (UltraGridRow ugr in rs)
  73. {
  74. wdlivno = rs[0].Cells["wdlivno"].Text.ToString(); //获取提货单号
  75. }
  76. string curLoadLoc = this.textBox4.Text.Trim();
  77. int type = 0;
  78. if (checkBox2.Checked)
  79. {
  80. type = 1;
  81. }
  82. else if (checkBox3.Checked || checkBox4.Checked)
  83. {
  84. type = 2;//外卖或者废钢
  85. }
  86. else if(!checkBox1.Checked)
  87. {
  88. MessageBox.Show("请选择盘入盘出类型!");
  89. return;
  90. }
  91. else if ("".Equals(curLoadLoc))
  92. {
  93. MessageBox.Show("盘入操作需要垛位信息,请输入相应的垛位信息!");
  94. return;
  95. }
  96. if ("".Equals(wdlivno) && (checkBox3.Checked || checkBox4.Checked))
  97. {
  98. MessageBox.Show("外卖或者废钢提货单号不能为空!");
  99. return;
  100. }
  101. string coilInReg = this.UserInfo.GetUserID();
  102. string userOrder = this.UserInfo.GetUserOrder();
  103. string userGroup = this.UserInfo.GetUserGroup();
  104. string userTime = this.ultraDateTimeEditor1.Value != null ? this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMddHHmmss") : "";
  105. CoreClientParam ccp = new CoreClientParam();
  106. ccp.ServerName = "UIM.UIM010110";
  107. ccp.MethodName = "save";
  108. ccp.ServerParams = new object[] { type, COIL_NO, curLoadLoc, coilInReg, userOrder, userGroup, userTime, wdlivno };
  109. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  110. this.DoQuery();
  111. }
  112. catch (Exception EX)
  113. {
  114. MessageBox.Show(EX.ToString());
  115. }
  116. }
  117. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  118. {
  119. if (this.checkBox1.Checked)
  120. {
  121. this.checkBox3.Checked = false;
  122. this.checkBox2.Checked = false;
  123. this.checkBox4.Checked = false;
  124. }
  125. }
  126. private void checkBox2_CheckedChanged(object sender, EventArgs e)
  127. {
  128. if (this.checkBox2.Checked)
  129. {
  130. this.checkBox1.Checked = false;
  131. this.checkBox3.Checked = false;
  132. this.checkBox4.Checked = false;
  133. }
  134. }
  135. private void textBox4_MouseEnter(object sender, EventArgs e)
  136. {
  137. this.toolTip1.Show("盘入操作需要垛位信息,请输入相应的垛位信息", this.textBox4);
  138. }
  139. private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
  140. {
  141. if (e.KeyChar == (char)Keys.Enter)
  142. {
  143. textBox2.Focus();
  144. }
  145. if ((int)e.KeyChar == 3)
  146. {
  147. Clipboard.SetDataObject("R" + textBox1.Text.Trim() + "-" + textBox2.Text.Trim() + "A" + textBox3.Text.Trim(), true);
  148. }
  149. if ((int)e.KeyChar == 22)
  150. {
  151. // GetDataObject检索当前剪贴板上的数据
  152. IDataObject iData = Clipboard.GetDataObject();
  153. // 将数据与指定的格式进行匹配,返回bool
  154. if (iData.GetDataPresent(DataFormats.Text))
  155. {
  156. // GetData检索数据并指定一个格式
  157. string text = (string)iData.GetData(DataFormats.Text);
  158. if (text.Length >= 13)
  159. {
  160. textBox1.Text = text.Substring(1, 1);
  161. textBox2.Text = text.Substring(3, 6);
  162. textBox3.Text = text.Substring(10, 3);
  163. }
  164. }
  165. }
  166. e.Handled = (e.KeyChar == 3 || e.KeyChar == 22);
  167. }
  168. private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
  169. {
  170. if (e.KeyChar == (char)Keys.Enter)
  171. {
  172. textBox3.Focus();
  173. }
  174. }
  175. private void textBox3_KeyPress(object sender, KeyPressEventArgs e)
  176. {
  177. if (e.KeyChar == (char)Keys.Enter)
  178. {
  179. this.DoQuery();
  180. }
  181. }
  182. private void checkBox3_CheckedChanged(object sender, EventArgs e)
  183. {
  184. this.checkBox1.Checked = false;
  185. this.checkBox2.Checked = false;
  186. this.checkBox4.Checked = false;
  187. }
  188. private void checkBox4_CheckedChanged(object sender, EventArgs e)
  189. {
  190. this.checkBox1.Checked = false;
  191. this.checkBox2.Checked = false;
  192. this.checkBox3.Checked = false;
  193. }
  194. }
  195. }