UIF052030.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  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.UIF
  12. {
  13. public partial class UIF052030 : FrmBase
  14. {
  15. public UIF052030()
  16. {
  17. InitializeComponent();
  18. }
  19. #region "ToolBar Event"
  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 "Query2":
  28. this.DoQuery2();
  29. break;
  30. case "Save":
  31. this.Save();
  32. break;
  33. case "Delete":
  34. Delete();
  35. break;
  36. case "Send":
  37. Send();
  38. break;
  39. case "UnSend":
  40. UnSend();
  41. break;
  42. case "Exit":
  43. this.dataSet1.Dispose();
  44. this.dataSet2.Dispose();
  45. this.dataSet1 = null;
  46. this.dataSet2 = null;
  47. this.Close();
  48. break;
  49. }
  50. }
  51. /// <summary>
  52. /// 查询轧辊单元计划信息
  53. /// </summary>
  54. private void DoQuery()
  55. {
  56. try
  57. {
  58. this.dataSet1.Tables[0].Clear();
  59. CoreClientParam ccp = new CoreClientParam();
  60. ccp.ServerName = "UIF.UIF05.UIF052030";
  61. ccp.MethodName = "QueryCalPlan";
  62. ccp.ServerParams = new object[] { };
  63. ccp.SourceDataTable = this.dataSet1.Tables[0];
  64. CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  65. if (obj.ReturnInfo.Length == 0)
  66. {
  67. System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(obj.ReturnObject as System.Collections.ArrayList, this.dataSet1.Tables["L_TBF03_SPEC_ROLL"]);
  68. tab0.TableName = "L_TBF03_SPEC_ROLL";
  69. this.dataSet1.Tables["L_TBF03_SPEC_ROLL"].Merge(tab0);
  70. this.dataSet1.AcceptChanges();
  71. };
  72. }
  73. catch (Exception EX)
  74. {
  75. MessageBox.Show(EX.ToString());
  76. }
  77. }
  78. /// <summary>
  79. /// 查询轧辊单元计划信息
  80. /// </summary>
  81. private void DoQuery2()
  82. {
  83. try
  84. {
  85. this.dataSet1.Tables[0].Clear();
  86. DataTable dt = new DataTable();
  87. CoreClientParam ccp = new CoreClientParam();
  88. ccp.ServerName = "UIB.COM.ComDBQuery";
  89. ccp.MethodName = "doSimpleQuery";
  90. ArrayList paramArray = new ArrayList();
  91. paramArray.Add("UIF052030.Query_CALPlan_List_02");
  92. ccp.ServerParams = new object[] { paramArray };
  93. ccp.SourceDataTable = this.dataSet1.Tables[0];
  94. //this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  95. CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  96. /*
  97. CoreClientParam ccp = new CoreClientParam();
  98. ccp.ServerName = "UIF.UIF05.UIF052030";
  99. ccp.MethodName = "UIF052030.Query_CALPlan_List_02";
  100. ccp.ServerParams = new object[] { };
  101. ccp.SourceDataTable = this.dataSet1.Tables[0];
  102. CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  103. */
  104. if (obj.ReturnInfo.Length == 0)
  105. {
  106. System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(obj.ReturnObject as System.Collections.ArrayList, this.dataSet1.Tables["L_TBF03_SPEC_ROLL"]);
  107. tab0.TableName = "L_TBF03_SPEC_ROLL";
  108. this.dataSet1.Tables["L_TBF03_SPEC_ROLL"].Merge(tab0);
  109. this.dataSet1.AcceptChanges();
  110. };
  111. }
  112. catch (Exception EX)
  113. {
  114. MessageBox.Show(EX.ToString());
  115. }
  116. }
  117. /// <summary>
  118. /// 保存轧辊单元计划的顺序调整
  119. /// </summary>
  120. private void Save()
  121. {
  122. try
  123. {
  124. string rollNO = Convert.ToString(Common.FixDBManager.CheckNullStr(this.textTarget.Text));
  125. string pos = Convert.ToString(Common.FixDBManager.CheckNullStr(this.comboPosition.Value));
  126. string type = Convert.ToString(Common.FixDBManager.CheckNullStr(this.optionBF.Value));
  127. if (rollNO == "" || pos == "" || type == "")
  128. {
  129. MessageBox.Show(" 条件不能为空! ");
  130. }
  131. string ex = "";
  132. Hashtable paramHsmp = new Hashtable();
  133. paramHsmp.Add("i1", rollNO);
  134. paramHsmp.Add("i2", pos);
  135. paramHsmp.Add("i3", type);
  136. paramHsmp.Add("o4", ex);
  137. CoreClientParam ccp = new CoreClientParam();
  138. ccp.ServerName = "UIB.COM.ComDBProcedure";
  139. ccp.MethodName = "doXmlProcedure";
  140. ccp.ServerParams = new Object[] { "UIF052030.Adj_RollUnit", paramHsmp };
  141. CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  142. System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
  143. if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
  144. {
  145. MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
  146. }
  147. else
  148. {
  149. //DoQuery();
  150. }
  151. }
  152. catch (Exception EX)
  153. {
  154. MessageBox.Show(EX.ToString());
  155. }
  156. }
  157. /// <summary>
  158. /// 删除轧辊单元计划
  159. /// </summary>
  160. private void Delete()
  161. {
  162. try
  163. {
  164. this.ugrd_CalInfo.UpdateData();
  165. System.Data.DataRow[] rows = this.dataSet1.Tables[0].Select("CHK='TRUE'");
  166. if (rows.Length == 0)
  167. {
  168. MessageBox.Show("请选择你要下发的计划", Common.FixDBManager.MsgCaption);
  169. return;
  170. }
  171. string RollNO = rows[0]["CAL_NO"].ToString();
  172. System.Windows.Forms.DialogResult rt = MessageBox.Show("是否确认删除所选轧制单元计划?", Common.FixDBManager.MsgCaption, MessageBoxButtons.YesNo);
  173. if (rt == DialogResult.No)
  174. {
  175. return;
  176. }
  177. string Ex = "";
  178. Hashtable paramHsmp = new Hashtable();
  179. paramHsmp.Add("i1", RollNO);
  180. paramHsmp.Add("i2", CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName());
  181. paramHsmp.Add("o3", Ex);
  182. CoreClientParam ccp = new CoreClientParam();
  183. ccp.ServerName = "UIB.COM.ComDBProcedure";
  184. ccp.MethodName = "doXmlProcedure";
  185. ccp.ServerParams = new Object[] { "UIF052030.Del_CalUnit", paramHsmp };
  186. CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  187. System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
  188. if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
  189. {
  190. MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
  191. }
  192. else
  193. {
  194. //DoQuery();
  195. }
  196. }
  197. catch (System.Exception ex)
  198. {
  199. System.Diagnostics.Debug.WriteLine(ex.ToString());
  200. }
  201. }
  202. /// <summary>
  203. /// 轧辊单元计划指令下发(二级)
  204. /// 支持≤2调计划指令下发
  205. /// </summary>
  206. private void Send()
  207. {
  208. try
  209. {
  210. this.ugrd_CalInfo.UpdateData();
  211. System.Data.DataRow[] rows = this.dataSet1.Tables[0].Select("CHK='TRUE'");
  212. if (rows.Length == 0)
  213. {
  214. MessageBox.Show("请选择你要下发的计划", Common.FixDBManager.MsgCaption);
  215. return;
  216. }
  217. string RollNO = rows[0]["CAL_NO"].ToString();
  218. string ex = "";
  219. #region "校验下发可行性"
  220. Hashtable paramHsmp = new Hashtable();
  221. paramHsmp.Add("i1", RollNO);
  222. paramHsmp.Add("o2", ex);
  223. CoreClientParam ccp = new CoreClientParam();
  224. ccp.ServerName = "UIB.COM.ComDBProcedure";
  225. ccp.MethodName = "doXmlProcedure";
  226. ccp.ServerParams = new Object[] { "UIF052030.Sed_RollUnit", paramHsmp };
  227. CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  228. System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
  229. if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
  230. {
  231. MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
  232. return;
  233. }
  234. #endregion
  235. //#region "执行下发"
  236. //paramHsmp = new Hashtable();
  237. //paramHsmp.Add("i1", RollNO);
  238. //paramHsmp.Add("o2", ex);
  239. //ccp = new CoreClientParam();
  240. //ccp.ServerName = "com.core.sip.xinyu.service.CalSendTelegramService";
  241. //ccp.MethodName = "sendPlanByPlanNo";
  242. //ccp.ServerParams = new Object[] { RollNO };
  243. //obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  244. //if (Common.FixDBManager.CheckNullInt(obj.ReturnObject)<=0)
  245. //{
  246. // MessageBox.Show("下发失败", Common.FixDBManager.MsgCaption);
  247. //}
  248. //else
  249. //{
  250. //DoQuery();
  251. //}
  252. //#endregion
  253. }
  254. catch (System.Exception ex)
  255. {
  256. System.Diagnostics.Debug.WriteLine(ex.ToString());
  257. }
  258. }
  259. /// <summary>
  260. /// 对已下发(二级)的轧辊单元计划进行撤销
  261. /// </summary>
  262. private void UnSend()
  263. {
  264. try
  265. {
  266. this.ugrd_CalInfo.UpdateData();
  267. System.Data.DataRow[] rows = this.dataSet1.Tables[0].Select("CHK='TRUE'");
  268. if (rows.Length == 0)
  269. {
  270. MessageBox.Show("请选择你要下发的计划", Common.FixDBManager.MsgCaption);
  271. return;
  272. }
  273. string RollNO = rows[0]["CAL_NO"].ToString();
  274. string ex = "";
  275. #region "校验下发可行性"
  276. Hashtable paramHsmp = new Hashtable();
  277. paramHsmp.Add("i1", RollNO);
  278. paramHsmp.Add("i2", UserInfo.GetUserID());
  279. paramHsmp.Add("o3", ex);
  280. CoreClientParam ccp = new CoreClientParam();
  281. ccp.ServerName = "UIB.COM.ComDBProcedure";
  282. ccp.MethodName = "doXmlProcedure";
  283. ccp.ServerParams = new Object[] { "UIF052030.Usd_RollUnit", paramHsmp };
  284. CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  285. System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
  286. if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
  287. {
  288. MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
  289. return;
  290. }
  291. #endregion
  292. //#region "执行下发"
  293. //paramHsmp = new Hashtable();
  294. //paramHsmp.Add("i1", RollNO);
  295. //paramHsmp.Add("o2", ex);
  296. //ccp = new CoreClientParam();
  297. //ccp.ServerName = "com.core.sip.xinyu.service.CalSendTelegramService";
  298. //ccp.MethodName = "canclePlanByPlanNo";
  299. //ccp.ServerParams = new Object[] { RollNO };
  300. //obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  301. //if (Common.FixDBManager.CheckNullInt(obj.ReturnObject) <= 0)
  302. //{
  303. // MessageBox.Show("下发失败", Common.FixDBManager.MsgCaption);
  304. //}
  305. //else
  306. //{
  307. //DoQuery();
  308. //}
  309. //#endregion
  310. }
  311. catch (System.Exception ex)
  312. {
  313. System.Diagnostics.Debug.WriteLine(ex.ToString());
  314. }
  315. }
  316. #endregion
  317. #region "Init"
  318. private void UIF052030_Load(object sender, EventArgs e)
  319. {
  320. try
  321. {
  322. GetInitData();
  323. Init_Grid();
  324. Common.FixDBManager.Init_ComboControl(this.comboPosition, "SCM_BASE_INFO", "NAME_", "ID_", ref dataSet2);
  325. }
  326. catch (System.Exception ex)
  327. {
  328. System.Diagnostics.Debug.WriteLine(ex.ToString());
  329. }
  330. }
  331. private void GetInitData()
  332. {
  333. try
  334. {
  335. this.dataSet2.Tables[0].Clear();
  336. CoreClientParam ccp = new CoreClientParam();
  337. ccp.ServerName = "UIF.UIF05.UIF052030";
  338. ccp.MethodName = "queryInitdata";
  339. ccp.ServerParams = new object[] { };
  340. ccp.SourceDataTable = this.dataSet2.Tables[0];
  341. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  342. dataSet2.Tables[0].TableName = "SCM_BASE_INFO";
  343. }
  344. catch (System.Exception ex)
  345. {
  346. System.Diagnostics.Debug.WriteLine(ex.ToString());
  347. }
  348. }
  349. private void Init_Grid()
  350. {
  351. try
  352. {
  353. Common.FixDBManager.SetGridCheckBox("CHK", "L_TBF03_SPEC_ROLL", 0, this.ugrd_CalInfo);
  354. foreach (Infragistics.Win.UltraWinGrid.UltraGridColumn col in this.ugrd_CalInfo.DisplayLayout.Bands[0].Columns)
  355. {
  356. if (col.Key == "CHK")
  357. {
  358. Common.FixDBManager.SetCellActivation(col.Key, "L_TBF03_SPEC_ROLL", this.ugrd_CalInfo, "ALLOWEDIT");
  359. }
  360. else
  361. {
  362. Common.FixDBManager.SetCellActivation(col.Key, "L_TBF03_SPEC_ROLL", this.ugrd_CalInfo, "ALLOWEDIT");
  363. }
  364. }
  365. }
  366. catch (System.Exception ex)
  367. {
  368. System.Diagnostics.Debug.WriteLine(ex.ToString());
  369. }
  370. }
  371. #endregion
  372. #region "Grid Event"
  373. private void ugrd_CalInfo_AfterRowActivate(object sender, EventArgs e)
  374. {
  375. try
  376. {
  377. this.textTarget.Text = Convert.ToString(this.ugrd_CalInfo.ActiveRow.Cells["CAL_NO"].Value);
  378. }
  379. catch (System.Exception ex)
  380. {
  381. System.Diagnostics.Debug.WriteLine(ex.ToString());
  382. }
  383. }
  384. private void ugrd_CalInfo_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  385. {
  386. try
  387. {
  388. this.ugrd_CalInfo.UpdateData();
  389. if (e.Cell.Column.Key == "CHK")
  390. {
  391. if (e.Cell.Value.ToString().ToUpper() == "TRUE")
  392. {
  393. string RollNO = e.Cell.Row.Cells["CAL_NO"].Value.ToString();
  394. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.ugrd_CalInfo.Rows)
  395. {
  396. if (row.Cells["CAL_NO"].Value.ToString() != RollNO)
  397. {
  398. row.Cells["CHK"].Value = "FALSE";
  399. }
  400. }
  401. this.ugrd_CalInfo.UpdateData();
  402. }
  403. }
  404. }
  405. catch (System.Exception ex)
  406. {
  407. System.Diagnostics.Debug.WriteLine(ex.ToString());
  408. }
  409. }
  410. #endregion
  411. }
  412. }