d4db3f2e675aa0d80a0901a413c85f296dcdc9ab.svn-base 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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 System.Collections;
  11. using Infragistics.Win.UltraWinGrid;
  12. namespace Core.LZMes.Client.UIK
  13. {
  14. public partial class UIK050030 : FrmBase
  15. {
  16. public UIK050030()
  17. {
  18. InitializeComponent();
  19. }
  20. public override void ToolBar_Click(object sender, string ToolbarKey)
  21. {
  22. switch (ToolbarKey)
  23. {
  24. case "Query"://查询
  25. this.DoQuery();
  26. break;
  27. case "Insert"://添加换下轧辊实绩
  28. this.DoInsert();
  29. break;
  30. case "Update"://下发换下轧辊实绩
  31. this.DoUpdate();
  32. break;
  33. }
  34. }
  35. private void DoQuery()
  36. {
  37. try
  38. {
  39. string zgNum = "";
  40. string beginTime = "";
  41. string endTime = "";
  42. bool flag = false;
  43. CoreClientParam ccp = new CoreClientParam();
  44. CoreClientParam ccp2 = new CoreClientParam();
  45. DataTable dt = new DataTable();
  46. DataTable dt2 = new DataTable();
  47. //if (this.ultraTextzgNum.Text == "" && this.ultraCheckEditor1.Checked == false)
  48. //{
  49. // MessageBox.Show("请选择查询条件!");
  50. //}
  51. //else
  52. //{
  53. if (this.ultraCheckEditor1.Checked)
  54. {
  55. this.ultraTextzgNum.Clear();
  56. this.ultraCheckEditor1.Checked = false;
  57. ccp.ServerName = "UIK.UIK05.UIK050030";
  58. ccp.MethodName = "DoQueryShang";
  59. ccp.ServerParams = new object[] { zgNum, flag ,beginTime,endTime};
  60. ccp.SourceDataTable = dt;
  61. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  62. this.ultraGrid1.DataSource = dt;
  63. //ccp2.ServerName = "UIK.UIK05.UIK050030";
  64. //ccp2.MethodName = "DoQueryXia";
  65. //ccp2.ServerParams = new object[] { zgNum, flag,beginTime,endTime };
  66. //ccp2.SourceDataTable = dt2;
  67. //this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal);
  68. //this.ultraGrid2.DataSource = dt2;
  69. if (dt.Rows.Count <= 0)
  70. {
  71. MessageBox.Show("暂无记录!");
  72. }
  73. return;
  74. }
  75. else
  76. {
  77. flag = true;
  78. zgNum = this.ultraTextzgNum.Text;
  79. beginTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd000000") : "";
  80. endTime = ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd999999") : "";
  81. this.ultraTextzgNum.Clear();
  82. this.ultraCheckEditor1.Checked = false;
  83. ccp.ServerName = "UIK.UIK05.UIK050030";
  84. //ccp.MethodName = "DoQueryShang";
  85. if (zgNum != "")
  86. {
  87. ccp.MethodName = "DoQueryShang";
  88. }
  89. else
  90. {
  91. ccp.MethodName = "DoQueryShang1";
  92. }
  93. ccp.ServerParams = new object[] { zgNum, flag, beginTime, endTime };
  94. ccp.SourceDataTable = dt;
  95. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  96. this.ultraGrid1.DataSource = dt;
  97. if (dt.Rows.Count <= 0)
  98. {
  99. MessageBox.Show("该换辊计划号,请查证后查询!");
  100. }
  101. return;
  102. }
  103. }
  104. // }
  105. catch (Exception Ex)
  106. {
  107. MessageBox.Show(Ex.ToString());
  108. }
  109. }
  110. private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e)
  111. {
  112. try
  113. {
  114. if (this.ultraCheckEditor1.Checked)
  115. {
  116. this.ultraTextzgNum.Enabled = false;
  117. }
  118. if (!this.ultraCheckEditor1.Checked)
  119. {
  120. this.ultraTextzgNum.Enabled = true;
  121. }
  122. }
  123. catch (Exception Ex)
  124. {
  125. MessageBox.Show(Ex.ToString());
  126. }
  127. }
  128. private void DoInsert()
  129. {
  130. try
  131. {
  132. if (this.ultraTextStand_id.Text == "")
  133. {
  134. MessageBox.Show("机架号必须填写!");
  135. }
  136. else
  137. {
  138. // string spec_No = this.ultraTextSpec_no.Text;
  139. string sand_Id = this.ultraTextStand_id.Text; //机架编号
  140. string roll_Type = this.ultraComboType.Text;//轧辊类型
  141. string roll_Area = this.ultraComboArea.Text; //轧辊区域
  142. string roll_Id_up = this.ultraTextShangID.Text;//上编号
  143. string roll_Id_lo = this.ultraTextXiaBian.Text;//下编号
  144. //string reg_id = this.ultraTextReg_id.Text;
  145. string z_time = System.DateTime.Now.ToString();//时间
  146. //string z_time = DateTime.Now.ToString();
  147. string reason = this.ultraComboEditor1.SelectedIndex.ToString();//原因
  148. string s_chang = this.ultraTextEditor1.Text;//轧制长度
  149. string s_liang = this.ultraTextEditor2.Text;//轧制量
  150. string create_time = this.ultraCalendarDis_time.Text.ToString();
  151. System.DateTime dtt = System.DateTime.Now;
  152. string spec_No = (string.Format("{0:yyyyMMddHHmmss}", dtt)).Substring(8,6);
  153. string number = spec_No;
  154. DataTable dt = new DataTable();
  155. CoreClientParam ccp2 = new CoreClientParam();
  156. ccp2.ServerName = "UIK.UIK05.UIK050030";
  157. ccp2.MethodName = "DoSelect";
  158. ccp2.ServerParams = new object[] { create_time };
  159. ccp2.SourceDataTable = dt;
  160. this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal);
  161. if (dt.Rows.Count > 0)
  162. {
  163. MessageBox.Show("该换辊计划号已存在,请查证后填写!");
  164. this.ultraTextStand_id.Clear();
  165. this.ultraComboType.Clear();
  166. this.ultraComboArea.Clear();
  167. this.ultraTextShangID.Clear();
  168. this.ultraTextXiaBian.Clear();
  169. //this.ultraTextReg_id.Clear();
  170. this.ultraComboEditor1.Clear();
  171. this.ultraTextEditor2.Clear();
  172. this.ultraTextEditor1.Clear();
  173. }
  174. else
  175. {
  176. CoreClientParam ccp = new CoreClientParam();
  177. ccp.ServerName = "UIK.UIK05.UIK050030";
  178. ccp.MethodName = "PlanAdd";
  179. ccp.ServerParams = new object[] { spec_No, sand_Id, roll_Type, roll_Area, roll_Id_up, roll_Id_lo, z_time, reason, s_chang, s_liang,create_time };
  180. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  181. //if (0 != ccp.ReturnCode) return;
  182. if (0 != ccp.ReturnCode)
  183. {
  184. MessageBox.Show("添加失败");
  185. }
  186. else
  187. {
  188. MessageBox.Show("添加成功");
  189. this.ultraTextStand_id.Clear();
  190. this.ultraComboType.Clear();
  191. this.ultraComboArea.Clear();
  192. this.ultraTextShangID.Clear();
  193. this.ultraTextXiaBian.Clear();
  194. this.ultraComboEditor1.Clear();
  195. this.ultraTextEditor2.Clear();
  196. this.ultraTextEditor1.Clear();
  197. }
  198. }
  199. }
  200. }
  201. catch (Exception Ex)
  202. {
  203. MessageBox.Show(Ex.ToString());
  204. }
  205. }
  206. private void DoUpdate1()
  207. {
  208. try
  209. {
  210. //Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  211. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  212. {
  213. if (ugr.Cells["SELECT_ITME"].Text.ToString() == "True")
  214. {
  215. //foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  216. //{
  217. string number = ugr.Cells["SPEC_NO"].Value.ToString();
  218. string create_time = ugr.Cells["REG_DTIME"].Value.ToString();
  219. string reason = ugr.Cells["REASON_CODE"].Text.Trim().ToString();
  220. // string roll_weight=ugr
  221. CoreClientParam ccp2 = new CoreClientParam();
  222. ccp2.ServerName = "UIK.UIK05.UIK050030";
  223. ccp2.MethodName = "DoUpdate";
  224. //ccp2.ServerParams = new object[] { spec_No, sand_Id, roll_Type, roll_Area, roll_Id_up, roll_Id_lo, z_time, reason, banci, banbie, s_chang, s_liang, s_shi, x_chang, x_liang, x_shi, create_time, uid };
  225. ccp2.ServerParams = new object[] { reason,number, create_time };
  226. ccp2 = this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal);
  227. if (0 != ccp2.ReturnCode)
  228. {
  229. MessageBox.Show("保存失败!");
  230. }
  231. else
  232. {
  233. MessageBox.Show("保存成功!");
  234. }
  235. // }
  236. //}
  237. }
  238. else
  239. {
  240. continue;
  241. }
  242. }
  243. }
  244. catch (Exception Ex)
  245. {
  246. MessageBox.Show(Ex.ToString());
  247. }
  248. }
  249. private void UIK050030_Load(object sender, EventArgs e)
  250. {
  251. this.ultraCalendarDis_time1.Text = "";
  252. }
  253. private void ultraGrid1_DoubleClickRow(object sender, DoubleClickRowEventArgs e)
  254. {
  255. Infragistics.Win.UltraWinGrid.UltraGrid uGrid = (Infragistics.Win.UltraWinGrid.UltraGrid)sender;
  256. ultraTextStand_id.Text = uGrid.ActiveRow.Cells["STAND_ID"].Text;
  257. ultraComboType.Text = uGrid.ActiveRow.Cells["ROLL_TYPE"].Text;
  258. ultraTextShangID.Text = uGrid.ActiveRow.Cells["ROLLID_UP"].Text;
  259. ultraTextEditor2.Text = uGrid.ActiveRow.Cells["ROLLED_WEIGHT_UP"].Text;
  260. ultraComboEditor1.Text = uGrid.ActiveRow.Cells["REASON_CODE"].Text;
  261. ultraTextXiaBian.Text = uGrid.ActiveRow.Cells["ROLLID_LO"].Text;
  262. ultraTextEditor1.Text = uGrid.ActiveRow.Cells["ROLLED_LENGTH_UP"].Text;
  263. ultraTextReg_id.Text = uGrid.ActiveRow.Cells["SPEC_NO"].Text;
  264. ultraCalendarDis_time.Text = uGrid.ActiveRow.Cells["REG_DTIME"].Text;
  265. }
  266. private void DoUpdate()
  267. {
  268. try
  269. {
  270. string number = this.ultraTextReg_id.Text.Trim();
  271. string iddown = this.ultraTextXiaBian.Text.Trim();
  272. string idup = this.ultraTextShangID.Text.Trim();
  273. string reason = this.ultraComboEditor1.Text.Trim();
  274. string zhazhiliang = this.ultraTextEditor2.Text.Trim();
  275. string zhazhicd= this.ultraTextEditor1.Text.Trim();
  276. string timexg = this.ultraCalendarDis_time.Text.Trim();
  277. string namerg = this.UserInfo.GetUserName();
  278. CoreClientParam ccp2 = new CoreClientParam();
  279. ccp2.ServerName = "UIK.UIK05.UIK050030";
  280. ccp2.MethodName = "DoUpdate";
  281. //ccp2.ServerParams = new object[] { spec_No, sand_Id, roll_Type, roll_Area, roll_Id_up, roll_Id_lo, z_time, reason, banci, banbie, s_chang, s_liang, s_shi, x_chang, x_liang, x_shi, create_time, uid };
  282. ccp2.ServerParams = new object[] { reason, zhazhiliang, zhazhicd, timexg,number, iddown, idup,namerg };
  283. ccp2 = this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal);
  284. if (0 != ccp2.ReturnCode)
  285. {
  286. MessageBox.Show("保存失败!");
  287. }
  288. else
  289. {
  290. MessageBox.Show("保存成功!");
  291. }
  292. }
  293. catch (Exception Ex)
  294. {
  295. MessageBox.Show(Ex.ToString());
  296. }
  297. }
  298. }
  299. }