UIK080020.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  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.UltraWinEditors;
  11. namespace Core.LZMes.Client.UIK
  12. {
  13. public partial class UIK080020 : FrmBase
  14. {
  15. public UIK080020()
  16. {
  17. InitializeComponent();
  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 "Out": //出库
  27. this.doOut();
  28. break;
  29. case "Back": //回退
  30. this.doBack();
  31. break;
  32. case "Update": //修改
  33. this.DoUpdate();
  34. break;
  35. case "Exit": //退出
  36. this.doExit();
  37. break;
  38. }
  39. }
  40. private void doQuery() //废钢卷查询
  41. {
  42. try
  43. {
  44. this.dataSet1.Tables[0].Clear();
  45. string startTime = null == this.ultraDateTimeEditor1.Value ? "" : this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMddhh24miss");//入库开始时间
  46. string endTime = null == this.ultraDateTimeEditor2.Value ? "" : this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMddhh24miss");//入库结束时间
  47. string coilNo = this.textBox1.Text;//钢卷号
  48. string specStlGrd = this.textBox2.Text;//牌号
  49. string coilWthMin = this.textBox3.Text;//宽度最小值
  50. string coilWthMax = this.textBox4.Text;//宽度最大值
  51. string coilThkMin = this.textBox5.Text;//厚度最小值
  52. string coilThkMax = this.textBox6.Text;//厚度最大值
  53. string curLoadLoc = this.textBox7.Text;//垛位
  54. string ordNo = this.textBox8.Text;//订单号
  55. string ordSeq = "";// this.textBox12.Text;//合同号
  56. string ordFl = -1 == this.ultraComboEditor1.SelectedIndex ? "" : this.ultraComboEditor1.Value.ToString();//订单区分
  57. string devlmtDate = null == this.ultraDateTimeEditor3.Value ? "" : this.ultraDateTimeEditor3.DateTime.ToString("yyyyMMddhh24miss");//交货期
  58. string progCd = -1 == this.ultraComboEditor2.SelectedIndex ? "" : this.ultraComboEditor2.Value.ToString();//进程状态
  59. string smpSendTime = null == this.ultraDateTimeEditor4.Value ? "" : this.ultraDateTimeEditor4.DateTime.ToString("yyyyMMddhh24miss");//送样时间
  60. string prodnmCd = -1 == this.ultraComboEditor3.SelectedIndex ? "" : this.ultraComboEditor3.Value.ToString();//产品类型
  61. string[] queryParams = new string[] { startTime, endTime, specStlGrd, coilWthMin, coilWthMax,
  62. coilThkMin, coilThkMax, curLoadLoc, coilNo, ordNo, ordSeq, ordFl, devlmtDate, progCd, smpSendTime,
  63. prodnmCd};
  64. List<string[]> list = new List<String[]>();
  65. list.Add(queryParams);
  66. CoreClientParam ccp = new CoreClientParam();
  67. ccp.ServerName = "UIK.UIK08.UIK080020";
  68. ccp.MethodName = "doQuery";
  69. ccp.ServerParams = new object[] { list };
  70. ccp.SourceDataTable = this.dataSet1.Tables[0];
  71. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  72. DataRowCollection drc1 = this.dataSet1.Tables[0].Rows;
  73. if (drc1.Count <= 0)
  74. {
  75. MessageBox.Show("无查询记录!");
  76. return;
  77. }
  78. //统计钢卷数量,钢卷总重量
  79. /* int coilCount = (int)dataSet1.Tables[0].Compute("count(OLD_SAMPL_NO)", "");
  80. double coilWgtSum = 0;
  81. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in ultraGrid2.Rows)
  82. {
  83. double actWgt = 0;
  84. try
  85. {
  86. Color color = Color.SandyBrown;
  87. string status = ugr.Cells["checkBox"].Value.ToString().Trim();
  88. if ("合格".Equals(status))
  89. {
  90. color = Color.White;
  91. }
  92. else if ("不合格".Equals(status))
  93. {
  94. color = Color.FromArgb(255, 128, 128);
  95. }
  96. ugr.Appearance.BackColor = color;
  97. actWgt = double.Parse(ugr.Cells["checkBox"].Value.ToString().Trim());
  98. }
  99. catch (Exception e)
  100. {
  101. }
  102. coilWgtSum += actWgt;
  103. }
  104. this.textBox10.Text = coilCount.ToString();
  105. this.textBox9.Text = (coilWgtSum / 1000).ToString();*/
  106. DataRowCollection drs = this.dataSet1.Tables[0].Rows;
  107. int coilCount = 0;
  108. double wgtCount = 0;
  109. int drsSize = drs.Count;
  110. coilCount = drsSize;
  111. for (int i = 0; i < drsSize; i++)
  112. {
  113. wgtCount += double.Parse(drs[i]["ACT_WGT"].ToString());
  114. }
  115. this.textBox10.Text = coilCount.ToString();
  116. this.textBox9.Text = (wgtCount/1000).ToString();
  117. }
  118. catch (Exception EX)
  119. {
  120. MessageBox.Show(EX.ToString());
  121. }
  122. }
  123. private void UIK080020_Load(object sender, EventArgs e)
  124. {
  125. this.ultraDateTimeEditor1.Value = "";
  126. this.ultraDateTimeEditor2.Value = "";
  127. this.ultraDateTimeEditor3.Value = "";
  128. this.ultraDateTimeEditor4.Value = "";
  129. // this.checkBox.Checked = false;
  130. }
  131. private void doOut() //废钢卷出库
  132. {
  133. try
  134. {
  135. this.ultraGrid2.UpdateData();
  136. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid2.ActiveRow;
  137. bool flag = false;
  138. for (int i = 0; i < ultraGrid2.Rows.Count; i++)
  139. {
  140. if (ultraGrid2.Rows[i].Cells["checkBox"].Value.ToString().ToUpper() == "TRUE")
  141. {
  142. flag = true;
  143. break;
  144. }
  145. }
  146. if (!flag)
  147. {
  148. MessageBox.Show("请选择需要出库的废钢卷!");
  149. }
  150. else
  151. {
  152. DataRow[] selectedRows = this.dataSet1.Tables[0].Select("checkBox ='True'");
  153. CoreClientParam ccp = new CoreClientParam();
  154. for (int i = 0; i < selectedRows.Length; i++)
  155. {
  156. string oldsamplno = selectedRows[i]["OLD_SAMPL_NO"].ToString(); //取所选行的钢卷号
  157. string curloadloc = selectedRows[i]["CUR_LOAD_LOC"].ToString(); //取所选行的垛位号
  158. string regID = this.UserInfo.GetUserID();//出库人
  159. string trnfShift = this.UserInfo.GetUserOrder();//出库班次
  160. string trnfGroup = this.UserInfo.GetUserGroup();//出库班组
  161. ccp.ServerName = "UIK.UIK08.UIK080020";
  162. ccp.MethodName = "doOut";
  163. ccp.ServerParams = new object[] { oldsamplno,curloadloc, regID, trnfShift, trnfGroup };
  164. ccp.SourceDataTable = this.dataSet1.Tables[0];
  165. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  166. /* DataRow dr = this.dataSet1.Tables[0].NewRow();
  167. this.dataSet1.Tables[0].Rows.Add(dr);
  168. this.dataSet1.Tables[0].AcceptChanges();*/
  169. }
  170. if (0 != ccp.ReturnCode)
  171. {
  172. MessageBox.Show("出库操作失败!");
  173. }
  174. else
  175. {
  176. MessageBox.Show("出库操作成功!");
  177. }
  178. }
  179. }
  180. catch (Exception EX)
  181. {
  182. MessageBox.Show(EX.ToString());
  183. }
  184. this.doQuery();
  185. }
  186. private void doBack() //废钢卷回退
  187. {
  188. try
  189. {
  190. this.ultraGrid2.UpdateData();
  191. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid2.ActiveRow;
  192. CoreClientParam ccp = new CoreClientParam();
  193. bool flag = false;
  194. for (int i = 0; i < ultraGrid2.Rows.Count; i++)
  195. {
  196. if (ultraGrid2.Rows[i].Cells["checkBox"].Value.ToString().ToUpper() == "TRUE")
  197. {
  198. flag = true;
  199. break;
  200. }
  201. }
  202. if (!flag)
  203. {
  204. MessageBox.Show("请选择需要回退的废钢卷!");
  205. }
  206. else
  207. {
  208. DataRow[] selectedRows = this.dataSet1.Tables[0].Select("checkBox ='True'");
  209. string oldsamplno = "", curloadloc = "", regID, trnfShift, trnfGroup;
  210. for (int i = 0; i < selectedRows.Length; i++)
  211. {
  212. oldsamplno = selectedRows[i]["OLD_SAMPL_NO"].ToString(); //取所选行的钢卷号
  213. curloadloc = selectedRows[i]["BEF_LOAD_LOC"].ToString(); //取所选行的垛位号
  214. regID = this.UserInfo.GetUserID();//操作人
  215. trnfShift = this.UserInfo.GetUserOrder();//操作班次
  216. trnfGroup = this.UserInfo.GetUserGroup();//操作班组
  217. ccp.ServerName = "UIK.UIK08.UIK080020";
  218. ccp.MethodName = "doBack";
  219. ccp.ServerParams = new object[] { oldsamplno, curloadloc, regID, trnfShift, trnfGroup };
  220. ccp.SourceDataTable = this.dataSet1.Tables[0];
  221. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  222. // if (ccp.ReturnCode == -1)
  223. if (0 != ccp.ReturnCode)
  224. {
  225. MessageBox.Show("回退失败!");
  226. return;
  227. }
  228. else
  229. {
  230. MessageBox.Show("回退成功!");
  231. }
  232. /* DataRow dr = this.dataSet1.Tables[0].NewRow();
  233. dr.ItemArray = new object[] { oldsamplno, curloadloc, regID, trnfShift, trnfGroup };
  234. this.dataSet1.Tables[0].Rows.Add(dr);
  235. this.dataSet1.Tables[0].AcceptChanges();*/
  236. }
  237. }
  238. }
  239. catch (Exception EX)
  240. {
  241. MessageBox.Show(EX.ToString());
  242. }
  243. this.doQuery();
  244. }
  245. private void DoUpdate() //修改废钢卷状态信息
  246. {
  247. try
  248. {
  249. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid2.ActiveRow;
  250. CoreClientParam ccp2 = new CoreClientParam();
  251. string oldsamplno, curloadloc, coilstat;
  252. if (ugr.Cells["checkBox"].Text.ToString() == "True")
  253. {
  254. oldsamplno = ugr.Cells["OLD_SAMPL_NO"].Text.ToString();
  255. curloadloc = ugr.Cells["CUR_LOAD_LOC"].Text.ToString();
  256. coilstat = ugr.Cells["COIL_STAT"].Text.ToString();
  257. ccp2.ServerName = "UIK.UIK08.UIK080020";
  258. ccp2.MethodName = "DoUpdate";
  259. ccp2.ServerParams = new object[] { oldsamplno, curloadloc, coilstat };
  260. ccp2 = this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal);
  261. this.ultraGrid2.Update();
  262. if (MessageBox.Show("您确认要修改?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
  263. {
  264. if (0 != ccp2.ReturnCode)
  265. {
  266. MessageBox.Show("修改失败!");
  267. }
  268. else
  269. {
  270. MessageBox.Show("修改成功!");
  271. }
  272. }
  273. }
  274. else
  275. {
  276. MessageBox.Show("请选择修改行!");
  277. }
  278. }
  279. catch (Exception Ex)
  280. {
  281. MessageBox.Show(Ex.ToString());
  282. }
  283. this.doQuery();
  284. }
  285. public void doExit()
  286. {
  287. DialogResult dr = MessageBox.Show("确定退出系统吗?", "提示", MessageBoxButtons.OKCancel);
  288. if (dr == DialogResult.OK)
  289. {
  290. this.Dispose();
  291. }
  292. else
  293. {
  294. return;
  295. }
  296. }
  297. }
  298. }