6cba958796e5af62d38a966dc0d54c00ab5d29f3.svn-base 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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 UIM010360 : FrmBase
  13. {
  14. public UIM010360()
  15. {
  16. InitializeComponent();
  17. }
  18. //工具栏事件处理
  19. public override void ToolBar_Click(object sender, string ToolbarKey)
  20. {
  21. switch (ToolbarKey)
  22. {
  23. case "Query":
  24. this.DoQuery();
  25. break;
  26. case "Save":
  27. this.DoSave();
  28. break;
  29. }
  30. }
  31. /// <summary>
  32. /// 查询待入库钢卷
  33. /// </summary>
  34. private void DoQuery()
  35. {
  36. try
  37. {
  38. this.dataSet1.Tables[0].Clear();
  39. string procuctedTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") : "";
  40. string coilNo = this.ultraTextEditor1.Text.Trim();
  41. CoreClientParam ccp = new CoreClientParam();
  42. ccp.ServerName = "UIM.UIM010360";
  43. ccp.MethodName = "query";
  44. ccp.ServerParams = new object[] { procuctedTime, coilNo };
  45. ccp.SourceDataTable = this.dataSet1.Tables[0];
  46. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  47. }
  48. catch (Exception EX)
  49. {
  50. MessageBox.Show(EX.ToString());
  51. }
  52. }
  53. //选框点击事件处理
  54. private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  55. {
  56. if (e.Cell.Column.Key == "CHK")
  57. {
  58. if (!Convert.ToBoolean(e.Cell.Value))
  59. {
  60. for (int i = 0; i < ultraGrid1.Rows.Count; i++)
  61. {
  62. ultraGrid1.Rows[i].Cells["CHK"].Value = false;
  63. }
  64. e.Cell.Value = true;
  65. this.ultraTextEditor2.Text = e.Cell.Row.Cells["OLD_SAMPL_NO"].Value.ToString();
  66. //yardControl1.Layer = "A";
  67. //yardControl1.Stock = "2";
  68. //yardControl1.Focus();
  69. }
  70. else
  71. {
  72. e.Cell.Value = false;
  73. this.ultraTextEditor2.Text = "";
  74. }
  75. }
  76. }
  77. //废次品入库处理
  78. private void DoSave()
  79. {
  80. bool flag = false;
  81. for (int i = 0; i < ultraGrid1.Rows.Count; i++)
  82. {
  83. if (Convert.ToBoolean(ultraGrid1.Rows[i].Cells["CHK"].Value))
  84. {
  85. flag = true;
  86. break;
  87. }
  88. }
  89. if (!flag)
  90. {
  91. MessageBox.Show("请选择需要入库的钢卷!");
  92. return;
  93. }
  94. string yardAddr =this.ultraTextEditor3.Text.Trim();//垛位
  95. try
  96. {
  97. string stock = yardAddr.Substring(0, 1);
  98. yardAddr = yardAddr.Substring(2);
  99. string row = yardAddr.Substring(0, yardAddr.IndexOf('-') - 1);
  100. if (row.Length < 2)
  101. {
  102. row = "0" + row;
  103. }
  104. string fl = yardAddr.Substring(yardAddr.IndexOf('-') - 1, 1);
  105. string col = yardAddr.Substring(yardAddr.IndexOf('-') + 1);
  106. if (col.Length < 2)
  107. {
  108. col = "0" + col;
  109. }
  110. yardAddr = stock + "-" + row + fl + "-" + col;
  111. }
  112. catch (Exception ex)
  113. {
  114. MessageBox.Show("垛位输入错误,请重新输入!");
  115. ultraTextEditor3.Focus();
  116. return;
  117. }
  118. string entryShift = UserInfo.GetUserOrder();//入库班次
  119. string entryGroup = UserInfo.GetUserGroup();//入库班组
  120. string entryDtime = this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMddHHmmss");//入库时间
  121. string reg_id = UserInfo.GetUserID();//操作人
  122. CoreClientParam ccp2 = new CoreClientParam();
  123. ccp2.ServerName = "UIM.UIM010360";
  124. ccp2.MethodName = "saveCoilYard";
  125. ccp2.ServerParams = new object[] { this.ultraTextEditor2.Text, yardAddr, entryShift, entryGroup, entryDtime, reg_id };
  126. ccp2 = this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal);
  127. if (0 == ccp2.ReturnCode)
  128. {
  129. MessageBox.Show("入库成功!");
  130. }
  131. DoQuery();
  132. }
  133. }
  134. }