a42f2e7819bdb5d8b89ef3eeeea29aff6c3098e2.svn-base 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  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 Common;
  11. namespace Core.LZMes.Client.UIF
  12. {
  13. public partial class UIF041050 : CoreFS.CA06.FrmBase
  14. {
  15. public UIF041050()
  16. {
  17. InitializeComponent();
  18. }
  19. #region "ToolBar Event"
  20. public override void ToolBar_Click(object sender, string ToolbarKey)
  21. {
  22. try
  23. {
  24. switch (ToolbarKey)
  25. {
  26. case "Query":
  27. Query_GrpInfo();
  28. break;
  29. case "Add":
  30. Add_GrpInfo();
  31. break;
  32. case "Edit":
  33. Edit_GrpInfo();
  34. break;
  35. case "Delete":
  36. Del_GrpInfo();
  37. break;
  38. case "Exit":
  39. this.Close();
  40. break;
  41. }
  42. }
  43. catch (System.Exception ex)
  44. {
  45. System.Diagnostics.Debug.WriteLine(ex.ToString());
  46. }
  47. }
  48. private void Query_GrpInfo()
  49. {
  50. try
  51. {
  52. CoreClientParam ccp = new CoreClientParam();
  53. ccp.ServerName = "UIF.UIF04.UIF041050";
  54. ccp.MethodName = "Query_GrpLen_Info";
  55. ccp.ServerParams = new object[] { this.cmb_GrpType.Value.ToString() };
  56. CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  57. if (obj.ReturnInfo.Length == 0)
  58. {
  59. this.dataSet1.Tables["TBF02_ROLL_GRP"].Clear();
  60. System.Data.DataTable tab0 = FixDBManager.ConvertToDataTable(obj.ReturnObject as System.Collections.ArrayList, this.dataSet1.Tables["TBF02_ROLL_GRP"]);
  61. tab0.TableName = "TBF02_ROLL_GRP";
  62. this.dataSet1.Tables["TBF02_ROLL_GRP"].Merge(tab0);
  63. this.dataSet1.AcceptChanges();
  64. if (this.cmb_GrpType.Value.ToString() == "厚度")
  65. {
  66. this.ugrd_GrpLen.DisplayLayout.Bands[0].Columns["GRP_CD"].Header.Caption = "厚度组";
  67. }
  68. else
  69. {
  70. this.ugrd_GrpLen.DisplayLayout.Bands[0].Columns["GRP_CD"].Header.Caption = "厚度组";
  71. }
  72. }
  73. }
  74. catch (System.Exception ex)
  75. {
  76. System.Diagnostics.Debug.WriteLine(ex.ToString());
  77. }
  78. }
  79. private void Add_GrpInfo()
  80. {
  81. try
  82. {
  83. if (!CheckValue())
  84. return;
  85. string sql = "";
  86. if (this.cmb_GrpType.Value.ToString() == "厚度")
  87. {
  88. sql = "INSERT INTO TBF02_ROLL_THK(PLT,STL_GRP_CD,THK_GRP_CD,MINI,MAXI,REG_DTIME,REG_ID,MOD_DTIME,MOD_ID,C_STL_GRP_CD) "
  89. + "VALUES('C','NULL',"
  90. + "'" + this.cmb_GrpName.Text.Trim() + "',"
  91. + FixDBManager.CheckNullStr(FixDBManager.CheckNullDecimal(this.txt_LMini.Text)) + ","
  92. + FixDBManager.CheckNullStr(this.txt_LMaxi.Text) + ","
  93. + "TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS'),"
  94. + "'" + CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName() + "',"
  95. + "NULL,"
  96. + "NULL,"
  97. + "'NULL'"
  98. + ")";
  99. }
  100. else
  101. {
  102. sql = "INSERT INTO TBF02_ROLL_WTH(PLT,STL_GRP_CD,WTH_GRP_CD,MINI,MAXI,REG_DTIME,REG_ID,MOD_DTIME,MOD_ID,C_STL_GRP_CD) "
  103. + "VALUES('C','NULL',"
  104. + "'" + this.cmb_GrpName.Text.Trim() + "',"
  105. + FixDBManager.CheckNullStr(FixDBManager.CheckNullDecimal(this.txt_LMini.Text)) + ","
  106. + FixDBManager.CheckNullStr(this.txt_LMaxi.Text) + ","
  107. + "TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS'),"
  108. + "'" + CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName() + "',"
  109. + "NULL,"
  110. + "NULL,"
  111. + "'NULL'"
  112. + ")";
  113. }
  114. CoreClientParam ccp = new CoreClientParam();
  115. ccp.ServerName = "UIF.UIF04.UIF041050";
  116. ccp.MethodName = "Commit_GrpLen_Info";
  117. ccp.ServerParams = new object[] { sql };
  118. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  119. if(ccp.ReturnInfo.Length == 0)
  120. Query_GrpInfo();
  121. }
  122. catch (System.Exception ex)
  123. {
  124. System.Diagnostics.Debug.WriteLine(ex.ToString());
  125. }
  126. }
  127. private void Edit_GrpInfo()
  128. {
  129. try
  130. {
  131. if (this.ugrd_GrpLen.ActiveRow == null)
  132. {
  133. MessageBox.Show("请选择您要修改的记录行");
  134. return;
  135. }
  136. if (!CheckValue())
  137. return;
  138. string sql = "";
  139. if (this.cmb_GrpType.Value.ToString() == "厚度")
  140. {
  141. sql = "UPDATE TBF02_ROLL_THK SET THK_GRP_CD='" + this.cmb_GrpName.Text.Trim() + "',"
  142. + "MINI=" + FixDBManager.CheckNullStr(FixDBManager.CheckNullDecimal(this.txt_LMini.Text)) + ","
  143. + "MAXI=" + FixDBManager.CheckNullStr(this.txt_LMaxi.Text) + ","
  144. + "MOD_DTIME=TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS'),"
  145. + "MOD_ID='" + CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName() + "' "
  146. + "WHERE PLT='C' AND THK_GRP_CD='" + FixDBManager.CheckNullStr(this.ugrd_GrpLen.ActiveRow.Cells["GRP_CD"].Value) + "'";
  147. }
  148. else
  149. {
  150. sql = "UPDATE TBF02_ROLL_WTH SET WTH_GRP_CD='" + this.cmb_GrpName.Text.Trim() + "',"
  151. + "MINI=" + FixDBManager.CheckNullStr(FixDBManager.CheckNullDecimal(this.txt_LMini.Text)) + ","
  152. + "MAXI=" + FixDBManager.CheckNullStr(this.txt_LMaxi.Text) + ","
  153. + "MOD_DTIME=TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS'),"
  154. + "MOD_ID='" + CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName() + "' "
  155. + "WHERE PLT='C' AND WTH_GRP_CD='" + FixDBManager.CheckNullStr(this.ugrd_GrpLen.ActiveRow.Cells["GRP_CD"].Value) + "'";
  156. }
  157. CoreClientParam ccp = new CoreClientParam();
  158. ccp.ServerName = "UIF.UIF04.UIF041050";
  159. ccp.MethodName = "Commit_GrpLen_Info";
  160. ccp.ServerParams = new object[] { sql };
  161. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  162. if(ccp.ReturnInfo.Length == 0)
  163. Query_GrpInfo();
  164. }
  165. catch (System.Exception ex)
  166. {
  167. System.Diagnostics.Debug.WriteLine(ex.ToString());
  168. }
  169. }
  170. private void Del_GrpInfo()
  171. {
  172. try
  173. {
  174. if (this.ugrd_GrpLen.ActiveRow == null)
  175. {
  176. MessageBox.Show("请选择您要删除的记录行");
  177. return;
  178. }
  179. string sql = "";
  180. if (this.cmb_GrpType.Value.ToString() == "厚度")
  181. {
  182. sql = "DELETE FROM TBF02_ROLL_THK WHERE PLT='C' AND THK_GRP_CD='" + FixDBManager.CheckNullStr(this.ugrd_GrpLen.ActiveRow.Cells["GRP_CD"].Value) + "'";
  183. }
  184. else
  185. {
  186. sql = "DELETE FROM TBF02_ROLL_WTH WHERE PLT='C' AND WTH_GRP_CD='" + FixDBManager.CheckNullStr(this.ugrd_GrpLen.ActiveRow.Cells["GRP_CD"].Value) + "'";
  187. }
  188. CoreClientParam ccp = new CoreClientParam();
  189. ccp.ServerName = "UIF.UIF04.UIF041030";
  190. ccp.MethodName = "Delete_Group_Info";
  191. ccp.ServerParams = new object[] { sql };
  192. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  193. if(ccp.ReturnInfo.Length ==0)
  194. Query_GrpInfo();
  195. }
  196. catch (System.Exception ex)
  197. {
  198. System.Diagnostics.Debug.WriteLine(ex.ToString());
  199. }
  200. }
  201. private bool CheckValue()
  202. {
  203. if (this.cmb_GrpName.Text.Trim().Length == 0)
  204. {
  205. MessageBox.Show("请您确认组名");
  206. return false;
  207. }
  208. if (this.txt_LMaxi.Text.Trim().Length == 0)
  209. {
  210. MessageBox.Show("请您确认轧制单元编制长度的上限值");
  211. return false;
  212. }
  213. return true;
  214. }
  215. #endregion
  216. #region "ComboBox Event"
  217. private void cmb_GrpType_ValueChanged(object sender, EventArgs e)
  218. {
  219. try
  220. {
  221. this.dataSet1.Tables["TBF02_ROLL_GRP"].Clear();
  222. this.dataSet1.AcceptChanges();
  223. if (this.cmb_GrpType.Value.ToString() == "厚度")
  224. {
  225. this.ugrd_GrpLen.DisplayLayout.Bands[0].Columns["GRP_CD"].Header.Caption = "厚度组";
  226. FixDBManager.Init_ComboControl(this.cmb_GrpName, "TBF02_ROLL_THK_GRP", "GRP_CD", "GRP_CD", ref this.dataSet1);
  227. this.txt_Mini.Mask = "9.999";
  228. this.txt_Maxi.Mask = "9.999";
  229. }
  230. else
  231. {
  232. this.ugrd_GrpLen.DisplayLayout.Bands[0].Columns["GRP_CD"].Header.Caption = "宽度组";
  233. FixDBManager.Init_ComboControl(this.cmb_GrpName, "TBF02_ROLL_WTH_GRP", "GRP_CD", "GRP_CD", ref this.dataSet1);
  234. this.txt_Maxi.Mask = "9999";
  235. this.txt_Mini.Mask = "9999";
  236. }
  237. }
  238. catch (System.Exception ex)
  239. {
  240. System.Diagnostics.Debug.WriteLine(ex.ToString());
  241. }
  242. }
  243. private void cmb_GrpName_ValueChanged(object sender, EventArgs e)
  244. {
  245. try
  246. {
  247. if (this.cmb_GrpName.Value != null)
  248. {
  249. this.txt_Mini.Text = FixDBManager.CheckNullStr(this.cmb_GrpName.SelectedRow.Cells["MINI"].Value);
  250. this.txt_Maxi.Text = FixDBManager.CheckNullStr(this.cmb_GrpName.SelectedRow.Cells["MAXI"].Value);
  251. }
  252. }
  253. catch (System.Exception ex)
  254. {
  255. System.Diagnostics.Debug.WriteLine(ex.ToString());
  256. }
  257. }
  258. #endregion
  259. #region "Grid Event"
  260. private void ugrd_GrdLen_AfterRowActivate(object sender, EventArgs e)
  261. {
  262. try
  263. {
  264. if (this.ugrd_GrpLen.ActiveRow == null)
  265. return;
  266. this.cmb_GrpName.Value = this.ugrd_GrpLen.ActiveRow.Cells["GRP_CD"].Value.ToString();
  267. this.txt_Mini.Text = FixDBManager.CheckNullStr(this.ugrd_GrpLen.ActiveRow.Cells["MINI"].Value);
  268. this.txt_Maxi.Text = FixDBManager.CheckNullStr(this.ugrd_GrpLen.ActiveRow.Cells["MAXI"].Value);
  269. this.txt_LMini.Text = FixDBManager.CheckNullStr(this.ugrd_GrpLen.ActiveRow.Cells["LMINI"].Value);
  270. this.txt_LMaxi.Text = FixDBManager.CheckNullStr(this.ugrd_GrpLen.ActiveRow.Cells["LMAXI"].Value);
  271. }
  272. catch (System.Exception ex)
  273. {
  274. System.Diagnostics.Debug.WriteLine(ex.ToString());
  275. }
  276. }
  277. #endregion
  278. #region "Init"
  279. private void UIF041050_Load(object sender, EventArgs e)
  280. {
  281. try
  282. {
  283. GetBindData();
  284. this.cmb_GrpType.DisplayLayout.Bands[0].Columns[0].Band.ColHeadersVisible = false;
  285. this.cmb_GrpType.DisplayLayout.Bands[0].Columns[0].Width = this.cmb_GrpType.Width;
  286. this.cmb_GrpType.Value = "厚度";
  287. }
  288. catch (System.Exception ex)
  289. {
  290. System.Diagnostics.Debug.WriteLine(ex.ToString());
  291. }
  292. }
  293. private void GetBindData()
  294. {
  295. try
  296. {
  297. CoreClientParam ccp = new CoreClientParam();
  298. ccp.ServerName = "UIF.UIF04.UIF041050";
  299. ccp.MethodName = "Query_GRP_DATA";
  300. //ccp.ServerParams = new object[] { "PL/TCM" };
  301. CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  302. if (obj.ReturnInfo.Length == 0)
  303. {
  304. System.Collections.ArrayList rtnobj = obj.ReturnObject as System.Collections.ArrayList;
  305. if (rtnobj[0] != null)
  306. {
  307. this.dataSet1.Tables["TBF02_ROLL_THK_GRP"].Clear();
  308. System.Data.DataTable tab0 = FixDBManager.ConvertToDataTable(rtnobj[0] as System.Collections.ArrayList, this.dataSet1.Tables["TBF02_ROLL_THK_GRP"]);
  309. tab0.TableName = "TBF02_ROLL_THK_GRP";
  310. this.dataSet1.Tables["TBF02_ROLL_THK_GRP"].Merge(tab0);
  311. }
  312. if (rtnobj[1] != null)
  313. {
  314. this.dataSet1.Tables["TBF02_ROLL_WTH_GRP"].Clear();
  315. System.Data.DataTable tab1 = FixDBManager.ConvertToDataTable(rtnobj[1] as System.Collections.ArrayList, this.dataSet1.Tables["TBF02_ROLL_WTH_GRP"]);
  316. tab1.TableName = "TBF02_ROLL_WTH_GRP";
  317. this.dataSet1.Tables["TBF02_ROLL_WTH_GRP"].Merge(tab1);
  318. }
  319. this.dataSet1.AcceptChanges();
  320. }
  321. }
  322. catch (System.Exception ex)
  323. {
  324. System.Diagnostics.Debug.WriteLine(ex.ToString());
  325. }
  326. }
  327. #endregion
  328. }
  329. }