UIM010260.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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 UIM010260 : FrmBase
  14. {
  15. private string COIL_NO = "";
  16. public UIM010260()
  17. {
  18. InitializeComponent();
  19. this.dteTime.DateTime = DateTime.Now;
  20. }
  21. public override void ToolBar_Click(object sender, string ToolbarKey)
  22. {
  23. switch (ToolbarKey)
  24. {
  25. case "Query":
  26. this.DoQuery();
  27. break;
  28. case "Save":
  29. this.DoSave();
  30. break;
  31. case "Exit":
  32. this.Close();
  33. break;
  34. }
  35. }
  36. /// <summary>
  37. /// 查询钢卷信息
  38. /// </summary>
  39. private void DoQuery()
  40. {
  41. try
  42. {
  43. string coilNo = this.txtCoilNo.Text.Trim();
  44. this.dataSet1.Tables[0].Clear();
  45. COIL_NO = coilNo;
  46. CoreClientParam ccp = new CoreClientParam();
  47. ccp.ServerName = "UIM.UIM010260";
  48. ccp.MethodName = "queryCoilInfo";
  49. ccp.ServerParams = new object[] { coilNo };
  50. ccp.SourceDataTable = this.dataSet1.Tables[0];
  51. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  52. if (this.ultraGrid1.Rows.Count == 0)
  53. {
  54. this.txtCoilNoOUT.Text = "查无此卷";
  55. this.txtCoilNoStat.Text = "";
  56. }
  57. else
  58. {
  59. this.txtCoilNoOUT.Text = this.ultraGrid1.Rows[0].Cells["CUR_LOAD_LOC"].Text;
  60. this.txtCoilNoStat.Text = this.ultraGrid1.Rows[0].Cells["COIL_STAT"].Text;
  61. }
  62. }
  63. catch (Exception EX)
  64. {
  65. MessageBox.Show(EX.ToString());
  66. }
  67. }
  68. /// <summary>
  69. /// 盘入盘出操作
  70. /// </summary>
  71. private void DoSave()
  72. {
  73. if (this.txtCoilNo.Text != this.COIL_NO)
  74. {
  75. MessageBox.Show("输入钢卷号在上次查询后已经更改; \n请再次输入确定进行操作的钢卷号,并做查询后再进行操作。");
  76. return;
  77. }
  78. try
  79. {
  80. if (this.dataTable1.Rows.Count < 1)
  81. {
  82. MessageBox.Show("钢卷信息不能为空,请先查询出钢卷信息再进行盘入盘出操作!");
  83. return;
  84. }
  85. Infragistics.Win.UltraWinGrid.RowsCollection rs = null;
  86. rs = this.ultraGrid1.Rows;
  87. string wdlivno = "";
  88. foreach (UltraGridRow ugr in rs)
  89. {
  90. wdlivno = rs[0].Cells["wdlivno"].Text.ToString(); //获取提货单号
  91. }
  92. string curLoadLoc = this.yardCtl.GetYardFlag();
  93. int type = 0;
  94. if (checkBox2.Checked)
  95. {
  96. type = 1;
  97. }
  98. else if(checkBox3.Checked || checkBox4.Checked)
  99. {
  100. type = 2;//外卖或者废钢
  101. }
  102. else if(!checkBox1.Checked)
  103. {
  104. MessageBox.Show("请选择盘入盘出类型!");
  105. return;
  106. }
  107. else if ("".Equals(curLoadLoc) && checkBox1.Checked)
  108. {
  109. MessageBox.Show("盘入操作需要垛位信息,请输入相应的垛位信息!");
  110. return;
  111. }
  112. else if (this.dteTime.DateTime == null)
  113. {
  114. MessageBox.Show("请选择操作时间!");
  115. return;
  116. }
  117. else if ("".Equals(wdlivno) && (checkBox3.Checked || checkBox4.Checked))
  118. {
  119. MessageBox.Show("外卖或者废钢提货单号不能为空!");
  120. return;
  121. }
  122. curLoadLoc = this.yardAnalysisForQuerry(curLoadLoc);
  123. string regId = this.UserInfo.GetUserID();
  124. string regShift = this.UserInfo.GetUserOrder();
  125. string regGroup = this.UserInfo.GetUserGroup();
  126. string coilInDtime = this.dteTime.DateTime.ToString("yyyyMMddHHmmss");
  127. CoreClientParam ccp = new CoreClientParam();
  128. ccp.ServerName = "UIM.UIM010260";
  129. ccp.MethodName = "save";
  130. ccp.ServerParams = new object[] { type, COIL_NO, curLoadLoc, regId, regShift, regGroup, coilInDtime, wdlivno};
  131. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  132. this.DoQuery();
  133. }
  134. catch (Exception EX)
  135. {
  136. MessageBox.Show(EX.ToString());
  137. }
  138. }
  139. /// <summary>
  140. /// 把经过上面检测后的字符串补0 转为数据库通用字符串
  141. /// </summary>
  142. /// <param name="yardIN"></param>
  143. /// <returns></returns>
  144. private string yardAnalysisForQuerry(string yardIN)
  145. {
  146. try
  147. {
  148. string[] strs = yardIN.Split('-');
  149. if (strs[1].Length < 3)
  150. {
  151. for (int i = strs[1].Length; i < 3; i++)
  152. {
  153. strs[1] = "0" + strs[1];
  154. }
  155. }
  156. if (strs[2].Length < 3)
  157. {
  158. for (int i = strs[2].Length; i < 3; i++)
  159. {
  160. strs[2] = "0" + strs[2];
  161. }
  162. }
  163. return strs[0] + "-" + strs[1].ToUpper() + "-" + strs[2];
  164. }
  165. catch
  166. {
  167. return "";
  168. }
  169. }
  170. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  171. {
  172. if (this.checkBox1.Checked)
  173. {
  174. this.checkBox2.Checked = false;
  175. this.checkBox3.Checked = false;
  176. this.checkBox4.Checked = false;
  177. }
  178. }
  179. private void checkBox2_CheckedChanged(object sender, EventArgs e)
  180. {
  181. if (this.checkBox2.Checked)
  182. {
  183. this.checkBox1.Checked = false;
  184. this.checkBox3.Checked = false;
  185. this.checkBox4.Checked = false;
  186. }
  187. }
  188. private void checkBox3_CheckedChanged(object sender, EventArgs e)
  189. {
  190. if (this.checkBox3.Checked)
  191. {
  192. this.checkBox1.Checked = false;
  193. this.checkBox2.Checked = false;
  194. this.checkBox4.Checked = false;
  195. }
  196. }
  197. private void checkBox4_CheckedChanged(object sender, EventArgs e)
  198. {
  199. if (this.checkBox4.Checked)
  200. {
  201. this.checkBox1.Checked = false;
  202. this.checkBox2.Checked = false;
  203. this.checkBox3.Checked = false;
  204. }
  205. }
  206. }
  207. }