UIM010202.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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. public partial class UIM010202 : FrmBase
  13. {
  14. public UIM010202()
  15. {
  16. InitializeComponent();
  17. }
  18. public override void ToolBar_Click(object sender, string ToolbarKey)
  19. {
  20. switch (ToolbarKey)
  21. {
  22. case "Query":
  23. this.DoQuery();
  24. break;
  25. case "Save":
  26. this.DoSave();
  27. break;
  28. }
  29. }
  30. /// <summary>
  31. /// 查询待入库钢卷
  32. /// </summary>
  33. private void DoQuery()
  34. {
  35. try
  36. {
  37. this.dataSet2.Tables[0].Clear();
  38. // string procuctedTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") : "";
  39. // string toprocuctedTime = ultraDateTimeEditor3.Value != null ? ultraDateTimeEditor3.DateTime.ToString("yyyyMMdd") : "";
  40. string coilNo = textBox9.Text.Trim();
  41. CoreClientParam ccp = new CoreClientParam();
  42. ccp.ServerName = "UIM.UIM010202";
  43. ccp.MethodName = "queryCoilsInTblStock";
  44. ccp.ServerParams = new object[] { coilNo };
  45. ccp.SourceDataTable = this.dataSet2.Tables[0];
  46. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  47. textBox1.Text = "";
  48. }
  49. catch (Exception EX)
  50. {
  51. MessageBox.Show(EX.ToString());
  52. }
  53. }
  54. private void DoQueryBuffer()
  55. {
  56. try
  57. {
  58. this.dataSet1.Tables[0].Clear();
  59. // string procuctedTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") : "";
  60. // string toprocuctedTime = ultraDateTimeEditor3.Value != null ? ultraDateTimeEditor3.DateTime.ToString("yyyyMMdd") : "";
  61. string coilNo = textBox9.Text.Trim();
  62. CoreClientParam ccp = new CoreClientParam();
  63. ccp.ServerName = "UIM.UIM010202";
  64. ccp.MethodName = "queryCoilsInTblbuffer";
  65. ccp.ServerParams = new object[] {};
  66. ccp.SourceDataTable = this.dataSet1.Tables[0];
  67. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  68. //统计钢卷数量,钢卷总重量
  69. int coilCount = (int)dataSet1.Tables[0].Compute("count(COIL_NO)", "");
  70. double coilWgtSum = 0;
  71. foreach (DataRow dr in dataSet1.Tables[0].Rows)
  72. {
  73. double tmpWgt = 0;
  74. try
  75. {
  76. tmpWgt = double.Parse(dr["WEIGHT"].ToString());
  77. }
  78. catch (Exception e)
  79. {
  80. }
  81. coilWgtSum += tmpWgt;
  82. }
  83. this.textBox3.Text = coilCount.ToString();
  84. this.textBox2.Text = (coilWgtSum / 1000).ToString();
  85. textBox1.Text = "";
  86. }
  87. catch (Exception EX)
  88. {
  89. MessageBox.Show(EX.ToString());
  90. }
  91. }
  92. private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  93. {
  94. if (e.Cell.Column.Key == "CHK")
  95. {
  96. if (!Convert.ToBoolean(e.Cell.Value))
  97. {
  98. for (int i = 0; i < ultraGrid1.Rows.Count; i++)
  99. {
  100. ultraGrid1.Rows[i].Cells["CHK"].Value = false;
  101. }
  102. e.Cell.Value = true;
  103. textBox1.Text = e.Cell.Row.Cells["COIL_NO"].Value.ToString();
  104. yardControl1.Layer = "A";
  105. yardControl1.Stock = "2";
  106. yardControl1.Focus();
  107. }
  108. else
  109. {
  110. e.Cell.Value = false;
  111. textBox1.Text = "";
  112. }
  113. }
  114. }
  115. /// <summary>
  116. /// 成品库钢卷入库
  117. /// </summary>
  118. private void DoSave()
  119. {
  120. bool flag = false;
  121. for (int i = 0; i < ultraGrid1.Rows.Count; i++)
  122. {
  123. if(Convert.ToBoolean(ultraGrid1.Rows[i].Cells["CHK"].Value))
  124. {
  125. flag = true;
  126. break;
  127. }
  128. }
  129. if(!flag)
  130. {
  131. MessageBox.Show("请选择需要入库的钢卷!");
  132. return;
  133. }
  134. string yardAddr = yardControl1.GetYardFlagZJ();//垛位
  135. if (string.IsNullOrEmpty(yardAddr))
  136. {
  137. MessageBox.Show("请选择需要入库的垛位!");
  138. yardControl1.Focus();
  139. return;
  140. }
  141. string entryShift = UserInfo.GetUserOrder();//入库班次
  142. string entryGroup = UserInfo.GetUserGroup();//入库班组
  143. string entryDtime = this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMddHHmmss");//入库时间
  144. string reg_id = UserInfo.GetUserID();//操作人
  145. CoreClientParam ccp = new CoreClientParam();
  146. ccp.ServerName = "UIM.UIM010202";
  147. ccp.MethodName = "saveCoilYard";
  148. ccp.ServerParams = new object[] { textBox1.Text.Trim(), yardAddr, entryShift, entryGroup, entryDtime, reg_id };
  149. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  150. if (0 == ccp.ReturnCode)
  151. {
  152. MessageBox.Show("入库成功!");
  153. }
  154. DoQuery();
  155. }
  156. private void button1_Click(object sender, EventArgs e)
  157. {
  158. string coilno;
  159. Infragistics.Win.UltraWinGrid.RowsCollection rs = this.ultraGrid2.Rows;
  160. if (rs.Count < 1) {
  161. MessageBox.Show("请先查询出数据!");
  162. return;
  163. }
  164. coilno = rs[0].Cells["COIL_NO"].Value.ToString();
  165. string outShift = UserInfo.GetUserOrder();//出库班次
  166. string outGroup = UserInfo.GetUserGroup();//出库班组
  167. string outDtime = this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMddHHmmss");//出库时间
  168. string reg_id = UserInfo.GetUserID();//操作人
  169. CoreClientParam ccp = new CoreClientParam();
  170. ccp.ServerName = "UIM.UIM010202";
  171. ccp.MethodName = "saveCoilHc";
  172. ccp.ServerParams = new object[] { coilno, outShift, outGroup, outDtime, reg_id };
  173. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  174. }
  175. private void button2_Click(object sender, EventArgs e)
  176. {
  177. DoQueryBuffer();
  178. }
  179. private void button3_Click(object sender, EventArgs e)
  180. {
  181. DoSave();
  182. }
  183. }
  184. }