UIK050010.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  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. namespace Core.LZMes.Client.UIK
  12. {
  13. public partial class UIK050010 : FrmBase
  14. {
  15. public UIK050010()
  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 "Insert":
  27. this.DoInsert();
  28. break;
  29. case"Update":
  30. this.DoUpdate();
  31. break;
  32. }
  33. }
  34. private void UIK050010_Load(object sender, EventArgs e)
  35. {
  36. }
  37. private void DoQuery()
  38. {
  39. try
  40. {
  41. string zgNum = "";
  42. string zgAr = "";
  43. string beginTime = "";
  44. string endTime = "";
  45. bool flag = false;
  46. CoreClientParam ccp = new CoreClientParam();
  47. CoreClientParam ccp2 = new CoreClientParam();
  48. //if (this.zgNumber.Text == "" && this.zgArea.Text == "" && this.ultraCheckEditor1.Checked == false)
  49. //{
  50. // MessageBox.Show("请选择查询条件!");
  51. //}
  52. //else
  53. //{
  54. if (this.ultraCheckEditor1.Checked)
  55. {
  56. this.dataSet1.Tables[0].Clear();
  57. this.dataSet2.Tables[0].Clear();
  58. this.zgArea.Clear();
  59. this.zgNumber.Clear();
  60. this.ultraCheckEditor1.Checked = false;
  61. ccp.ServerName = "UIK.UIK05.UIK050010";
  62. ccp.MethodName = "DoQueryShang";
  63. ccp.ServerParams = new object[] { zgNum, zgAr, flag ,beginTime,endTime};
  64. ccp.SourceDataTable = this.dataSet1.Tables[0];
  65. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  66. DataRowCollection drc1 = this.dataSet1.Tables[0].Rows;
  67. ccp2.ServerName = "UIK.UIK05.UIK050010";
  68. ccp2.MethodName = "DoQueryXia";
  69. ccp2.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime };
  70. ccp2.SourceDataTable = this.dataSet2.Tables[0];
  71. this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal);
  72. DataRowCollection drc2 = this.dataSet2.Tables[0].Rows;
  73. if (drc1.Count <= 0)
  74. {
  75. MessageBox.Show("暂无记录!");
  76. }
  77. return;
  78. }
  79. else
  80. {
  81. flag = true;
  82. if (this.zgArea.Text == "" || this.zgNumber.Text == "")
  83. {
  84. if (this.zgNumber.Text == "")
  85. {
  86. this.dataSet1.Tables[0].Clear();
  87. this.dataSet2.Tables[0].Clear();
  88. zgAr = this.zgArea.Text;
  89. beginTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd000000") : "";
  90. endTime = ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd999999") : "";
  91. this.zgArea.Clear();
  92. this.zgNumber.Clear();
  93. this.ultraCheckEditor1.Checked = false;
  94. ccp.ServerName = "UIK.UIK05.UIK050010";
  95. ccp.MethodName = "DoQueryShang";
  96. ccp.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime };
  97. ccp.SourceDataTable = this.dataSet1.Tables[0];
  98. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  99. DataRowCollection drc1 = this.dataSet1.Tables[0].Rows;
  100. ccp2.ServerName = "UIK.UIK05.UIK050010";
  101. ccp2.MethodName = "DoQueryXia";
  102. ccp2.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime };
  103. ccp2.SourceDataTable = this.dataSet2.Tables[0];
  104. this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal);
  105. DataRowCollection drc2 = this.dataSet2.Tables[0].Rows;
  106. if (drc1.Count <= 0)
  107. {
  108. MessageBox.Show("该区域的记录不存在!");
  109. }
  110. return;
  111. }
  112. if (this.zgArea.Text == "")
  113. {
  114. this.dataSet1.Tables[0].Clear();
  115. this.dataSet2.Tables[0].Clear();
  116. zgNum = this.zgNumber.Text;
  117. beginTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd000000") : "";
  118. endTime = ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd999999") : "";
  119. this.zgArea.Clear();
  120. this.zgNumber.Clear();
  121. this.ultraCheckEditor1.Checked = false;
  122. ccp.ServerName = "UIK.UIK05.UIK050010";
  123. ccp.MethodName = "DoQueryShang";
  124. ccp.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime };
  125. ccp.SourceDataTable = this.dataSet1.Tables[0];
  126. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  127. DataRowCollection drc1 = this.dataSet1.Tables[0].Rows;
  128. ccp2.ServerName = "UIK.UIK05.UIK050010";
  129. ccp2.MethodName = "DoQueryXia";
  130. ccp2.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime };
  131. ccp2.SourceDataTable = this.dataSet2.Tables[0];
  132. this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal);
  133. DataRowCollection drc2 = this.dataSet2.Tables[0].Rows;
  134. if (drc1.Count <= 0)
  135. {
  136. MessageBox.Show("该换辊计划号记录不存在,请查证后查询!");
  137. }
  138. return;
  139. }
  140. }
  141. if (this.zgArea.Text == "" && this.zgNumber.Text == "")
  142. {
  143. beginTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd000000") : "";
  144. endTime = ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd999999") : "";
  145. this.zgArea.Clear();
  146. this.zgNumber.Clear();
  147. this.ultraCheckEditor1.Checked = false;
  148. ccp.ServerName = "UIK.UIK05.UIK050010";
  149. ccp.MethodName = "DoQueryShang";
  150. ccp.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime };
  151. ccp.SourceDataTable = this.dataSet1.Tables[0];
  152. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  153. DataRowCollection drc1 = this.dataSet1.Tables[0].Rows;
  154. ccp2.ServerName = "UIK.UIK05.UIK050010";
  155. ccp2.MethodName = "DoQueryXia";
  156. ccp2.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime };
  157. ccp2.SourceDataTable = this.dataSet2.Tables[0];
  158. this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal);
  159. DataRowCollection drc2 = this.dataSet1.Tables[0].Rows;
  160. if (drc1.Count <= 0)
  161. {
  162. MessageBox.Show("记录不存在,请查证后查询!");
  163. }
  164. return;
  165. }
  166. else
  167. {
  168. this.dataSet1.Tables[0].Clear();
  169. this.dataSet2.Tables[0].Clear();
  170. zgNum = this.zgNumber.Text;
  171. zgAr = this.zgArea.Text;
  172. beginTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd000000") : "";
  173. endTime = ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd999999") : "";
  174. this.zgArea.Clear();
  175. this.zgNumber.Clear();
  176. this.ultraCheckEditor1.Checked = false;
  177. ccp.ServerName = "UIK.UIK05.UIK050010";
  178. ccp.MethodName = "DoQueryShang";
  179. ccp.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime };
  180. ccp.SourceDataTable = this.dataSet1.Tables[0];
  181. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  182. DataRowCollection drc1 = this.dataSet1.Tables[0].Rows;
  183. ccp2.ServerName = "UIK.UIK05.UIK050010";
  184. ccp2.MethodName = "DoQueryXia";
  185. ccp2.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime };
  186. ccp2.SourceDataTable = this.dataSet2.Tables[0];
  187. this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal);
  188. DataRowCollection drc2 = this.dataSet2.Tables[0].Rows;
  189. if (drc1.Count <= 0)
  190. {
  191. MessageBox.Show("记录不存在,请查证后查询!");
  192. }
  193. return;
  194. }
  195. }
  196. }
  197. // }
  198. catch (Exception Ex)
  199. {
  200. MessageBox.Show(Ex.ToString());
  201. }
  202. }
  203. private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e)
  204. {
  205. try
  206. {
  207. if (this.ultraCheckEditor1.Checked)
  208. {
  209. this.zgNumber.Enabled = false;
  210. this.zgArea.Enabled = false;
  211. }
  212. if (!this.ultraCheckEditor1.Checked)
  213. {
  214. this.zgNumber.Enabled = true;
  215. this.zgArea.Enabled = true;
  216. }
  217. }
  218. catch (Exception Ex)
  219. {
  220. MessageBox.Show(Ex.ToString());
  221. }
  222. }
  223. private void DoInsert()
  224. {
  225. try
  226. {
  227. if (this.ultraTextSand_id.Text == "" || this.ultraTextReg_id.Text == "")
  228. {
  229. MessageBox.Show("机架号和操作人必填!");
  230. }
  231. else
  232. {
  233. string sand_Id = this.ultraTextSand_id.Text;
  234. string roll_Type = this.ultraComboRollType.Text;
  235. string roll_Area = this.ultraComboArea.Text;
  236. string roll_Id_up = this.ultraTextRoll_id_up.Text;
  237. string roll_Id_lo = this.ultraTextRoll_id_lo.Text;
  238. string reg_Id = this.ultraTextReg_id.Text;
  239. string reg_Dtime = System.DateTime.Now.ToString();
  240. string updia = this.ultraTextUpdia.Text;
  241. string lodia = this.ultraTextLodia.Text;
  242. string xiatu = this.ultraTextXiaTu.Text;
  243. string shangtu = this.ultraTextShangTu.Text;
  244. string sshap = this.ultraTextSshap.Text;
  245. string xshap = this.ultraTextXshap.Text;
  246. string scai = this.ultraComboScai.Text;
  247. string xcai = this.ultraComboXcai.Text;
  248. if (scai == "光辊") { scai = "1"; }
  249. if (scai == "毛辊") { scai = "2"; }
  250. if (xcai == "光辊") { xcai = "1"; }
  251. if (xcai == "毛辊") { xcai = "2"; }
  252. System.DateTime dtt = System.DateTime.Now;
  253. string spec_No = (string.Format("{0:yyyyMMddHHmmss}", dtt)).Substring(8, 6);
  254. string number = reg_Dtime;
  255. DataTable dt = new DataTable();
  256. CoreClientParam ccp2 = new CoreClientParam();
  257. ccp2.ServerName = "UIK.UIK05.UIK050010";
  258. ccp2.MethodName = "DoSelect";
  259. ccp2.ServerParams = new object[] { reg_Dtime };
  260. ccp2.SourceDataTable = dt;
  261. this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal);
  262. if (dt.Rows.Count > 0)
  263. {
  264. MessageBox.Show("换辊计划已存在,请查证后填写!");
  265. this.ultraTextSand_id.Clear();
  266. this.ultraComboArea.Clear();
  267. this.ultraComboRollType.Clear();
  268. this.ultraTextRoll_id_up.Clear();
  269. this.ultraTextRoll_id_lo.Clear();
  270. this.ultraTextReg_id.Clear();
  271. this.ultraTextUpdia.Clear();
  272. this.ultraTextLodia.Clear();
  273. this.ultraTextXiaTu.Clear();
  274. this.ultraTextShangTu.Clear();
  275. this.ultraTextSshap.Clear();
  276. this.ultraTextXshap.Clear();
  277. this.ultraComboScai.Clear();
  278. this.ultraComboXcai.Clear();
  279. }
  280. else
  281. {
  282. CoreClientParam ccp = new CoreClientParam();
  283. ccp.ServerName = "UIK.UIK05.UIK050010";
  284. ccp.MethodName = "PlanAdd";
  285. ccp.ServerParams = new object[] { sand_Id, roll_Type, roll_Area, spec_No, roll_Id_up, roll_Id_lo, reg_Id, reg_Dtime, updia, lodia, shangtu, xiatu, sshap, xshap, scai, xcai };
  286. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  287. //if (0 != ccp.ReturnCode) return;
  288. if (0 != ccp.ReturnCode)
  289. {
  290. MessageBox.Show("添加失败");
  291. }
  292. else
  293. {
  294. MessageBox.Show("添加成功");
  295. this.ultraTextSand_id.Clear();
  296. this.ultraComboArea.Clear();
  297. this.ultraComboRollType.Clear();
  298. this.ultraTextRoll_id_up.Clear();
  299. this.ultraTextRoll_id_lo.Clear();
  300. this.ultraTextReg_id.Clear();
  301. this.ultraTextUpdia.Clear();
  302. this.ultraTextLodia.Clear();
  303. this.ultraTextXiaTu.Clear();
  304. this.ultraTextShangTu.Clear();
  305. this.ultraTextSshap.Clear();
  306. this.ultraTextXshap.Clear();
  307. this.ultraComboScai.Clear();
  308. this.ultraComboXcai.Clear();
  309. }
  310. }
  311. }
  312. }
  313. catch (Exception Ex)
  314. {
  315. MessageBox.Show(Ex.ToString());
  316. }
  317. }
  318. private void DoUpdate()
  319. {
  320. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  321. if (ugr.Cells["SELECT_ITEM"].Text.ToString() == "True")
  322. {
  323. if (ugr.Cells["MEG_FLAG"].Value.ToString() == "是")
  324. {
  325. MessageBox.Show("该计划已下发!");
  326. ugr.Cells["SELECT_ITEM"].Value = false;
  327. }
  328. else
  329. {
  330. string reg_Dtime,number, roll_type, roll_id_up, roll_id_lo, up_shape, lo_shape, area, stand_id, up_diameter, lo_diameter, lo_crown, up_crown, up_pro, lo_pro;
  331. //long spec_no, area, stand_id, up_diameter, lo_diameter, lo_crown, up_crown, up_pro, lo_pro;
  332. //DateTime r_dt;
  333. string uid = "Core.LZMes.Client.UIK.UIK050010";
  334. reg_Dtime = ugr.Cells["REG_DTIME"].Value.ToString();
  335. DataTable dt = new DataTable();
  336. CoreClientParam ccp = new CoreClientParam();
  337. ccp.ServerName = "UIK.UIK05.UIK050010";
  338. ccp.MethodName = "DoSelect";
  339. ccp.ServerParams = new object[] { reg_Dtime };
  340. ccp.SourceDataTable = dt;
  341. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  342. foreach (DataRow dr in dt.Rows)
  343. {
  344. number = dr["SPEC_NO"].ToString();
  345. area = dr["ROLL_AREA"].ToString();
  346. stand_id = dr["STAND_ID"].ToString();
  347. roll_type = dr["ROLL_TYPE"].ToString();
  348. roll_id_up = dr["ROLL_ID_UP"].ToString();
  349. roll_id_lo = dr["ROLL_ID_LO"].ToString();
  350. up_diameter = dr["ROLL_DIAMETER_UP"].ToString();
  351. lo_diameter = dr["ROLL_DIAMETER_LO"].ToString();
  352. lo_crown = dr["ROLL_CROWN_LO"].ToString();
  353. up_crown = dr["ROLL_CROWN_UP"].ToString();
  354. up_shape = dr["ROLL_SHAPE_UP"].ToString();
  355. lo_shape = dr["ROLL_SHAPE_LO"].ToString();
  356. up_pro = dr["ROLL_PROPERTY_CLASS"].ToString();
  357. lo_pro = dr["ROLL_PROPERTY_CLASS_LO"].ToString();//1为光辊,2为毛辊
  358. CoreClientParam ccp2 = new CoreClientParam();
  359. ccp2.ServerName = "UIK.UIK05.UIK050010";
  360. ccp2.MethodName = "DoSend";
  361. ccp2.ServerParams = new object[] { number, reg_Dtime, area, stand_id, roll_type, roll_id_up, roll_id_lo, up_diameter, lo_diameter, lo_crown, up_crown, up_shape, lo_shape, up_pro, lo_pro, uid };
  362. ccp2 = this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal);
  363. if (0 != ccp2.ReturnCode)
  364. {
  365. MessageBox.Show("下发失败!");
  366. }
  367. else
  368. {
  369. MessageBox.Show("下发成功!");
  370. CoreClientParam ccp3 = new CoreClientParam();
  371. ccp3.ServerName = "UIK.UIK05.UIK050010";
  372. ccp3.MethodName = "DoUpdate";
  373. ccp3.ServerParams = new object[] { reg_Dtime };
  374. ccp3 = this.ExecuteNonQuery(ccp3, CoreInvokeType.Internal);
  375. if (0 != ccp3.ReturnCode)
  376. {
  377. MessageBox.Show("下发计划修改失败!");
  378. }
  379. else
  380. {
  381. MessageBox.Show("下发计划已修改成功!");
  382. }
  383. }
  384. }
  385. }
  386. }
  387. else
  388. {
  389. MessageBox.Show("请选择下发行!");
  390. }
  391. }
  392. //private void A()
  393. //{
  394. // Infragistics.Win.UltraWinGrid.UltraGridRow ugr=this.ultraGrid1.ActiveRow;
  395. // foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.ultraGrid1.Rows)
  396. // {
  397. // if (row.Cells["SELECTITEM"].Value.ToString() == "true")
  398. // {
  399. // }
  400. // }
  401. //}
  402. //在cellchangde事件中去控制 只选中一行 不能选择多行
  403. }
  404. }