d6c0203b958e5d3341655b6019b063ca07dbb13a.svn-base 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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 UIM010120 : FrmBase
  13. {
  14. public UIM010120()
  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.dataSet1.Tables[0].Clear();
  38. this.dataSet1.Tables[1].Clear();
  39. string procuctedTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") : "";
  40. string toprocuctedTime = ultraDateTimeEditor3.Value != null ? ultraDateTimeEditor3.DateTime.ToString("yyyyMMdd") : "";
  41. string coilNo = textBox9.Text.Trim();
  42. CoreClientParam ccp = new CoreClientParam();
  43. ccp.ServerName = "UIM.UIM010120";
  44. ccp.MethodName = "queryCoilsInStock";
  45. ccp.ServerParams = new object[] { procuctedTime, toprocuctedTime,coilNo, "1" };
  46. ccp.SourceDataTable = this.dataSet1.Tables[0];
  47. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  48. CoreClientParam ccp2 = new CoreClientParam();
  49. ccp2.ServerName = "UIM.UIM010120";
  50. ccp2.MethodName = "queryCoilStatus2";
  51. //ccp2.ServerParams = new object[] { procuctedTime, toprocuctedTime, coilNo, "1" };
  52. ccp2.SourceDataTable = this.dataSet1.Tables[1];
  53. this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal);
  54. textBox1.Text = "";
  55. }
  56. catch (Exception EX)
  57. {
  58. MessageBox.Show(EX.ToString());
  59. }
  60. }
  61. private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  62. {
  63. if (e.Cell.Column.Key == "CHK")
  64. {
  65. if (!Convert.ToBoolean(e.Cell.Value))
  66. {
  67. for (int i = 0; i < ultraGrid1.Rows.Count; i++)
  68. {
  69. ultraGrid1.Rows[i].Cells["CHK"].Value = false;
  70. }
  71. e.Cell.Value = true;
  72. textBox1.Text = e.Cell.Row.Cells["COIL_NO"].Value.ToString();
  73. yardControl1.Layer = "A";
  74. yardControl1.Stock = "2";
  75. yardControl1.Focus();
  76. }
  77. else
  78. {
  79. e.Cell.Value = false;
  80. textBox1.Text = "";
  81. }
  82. }
  83. }
  84. /// <summary>
  85. /// 成品库钢卷入库
  86. /// </summary>
  87. private void DoSave()
  88. {
  89. bool flag = false;
  90. bool flag1 = false;
  91. for (int i = 0; i < ultraGrid1.Rows.Count; i++)
  92. {
  93. if (Convert.ToBoolean(ultraGrid1.Rows[i].Cells["CHK"].Value))
  94. {
  95. flag = true;
  96. break;
  97. }
  98. }
  99. for (int i = 0; i < ultraGrid2.Rows.Count; i++)
  100. {
  101. if (Convert.ToBoolean(ultraGrid2.Rows[i].Cells["CHK"].Value))
  102. {
  103. flag1 = true;
  104. break;
  105. }
  106. }
  107. if(!flag&&!flag1)
  108. {
  109. MessageBox.Show("请选择需要入库的钢卷!");
  110. return;
  111. }
  112. string yardAddr = yardControl1.GetYardFlagZJ();//垛位
  113. if (string.IsNullOrEmpty(yardAddr))
  114. {
  115. MessageBox.Show("请选择需要入库的垛位!");
  116. yardControl1.Focus();
  117. return;
  118. }
  119. string entryShift = UserInfo.GetUserOrder();//入库班次
  120. string entryGroup = UserInfo.GetUserGroup();//入库班组
  121. string entryDtime = this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMddHHmmss");//入库时间
  122. string reg_id = UserInfo.GetUserID();//操作人
  123. CoreClientParam ccp = new CoreClientParam();
  124. ccp.ServerName = "UIM.UIM010120";
  125. ccp.MethodName = "saveCoilYardN";
  126. ccp.ServerParams = new object[] { textBox1.Text.Trim(), yardAddr, entryShift, entryGroup, entryDtime, reg_id };
  127. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  128. if (0 == ccp.ReturnCode)
  129. {
  130. MessageBox.Show("入库成功!");
  131. }
  132. DoQuery();
  133. }
  134. private void ultraGrid2_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  135. {
  136. if (e.Cell.Column.Key == "CHK")
  137. {
  138. if (!Convert.ToBoolean(e.Cell.Value))
  139. {
  140. for (int i = 0; i < ultraGrid1.Rows.Count; i++)
  141. {
  142. ultraGrid1.Rows[i].Cells["CHK"].Value = false;
  143. }
  144. e.Cell.Value = true;
  145. textBox1.Text = e.Cell.Row.Cells["OLD_SAMPL_NO"].Value.ToString();
  146. yardControl1.Layer = "A";
  147. yardControl1.Stock = "2";
  148. yardControl1.Focus();
  149. }
  150. else
  151. {
  152. e.Cell.Value = false;
  153. textBox1.Text = "";
  154. }
  155. }
  156. }
  157. private void button1_Click(object sender, EventArgs e)
  158. {
  159. this.DoSave();
  160. }
  161. }
  162. }