UIF041040.cs 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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 UIF041040 : CoreFS.CA06.FrmBase
  14. {
  15. public UIF041040()
  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();
  28. break;
  29. case "Add":
  30. Commit_RollLen("Add");
  31. break;
  32. case "Edit":
  33. Commit_RollLen("Edit");
  34. break;
  35. case "Delete":
  36. Commit_RollLen("Delete");
  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()
  49. {
  50. try
  51. {
  52. CoreClientParam ccp = new CoreClientParam();
  53. ccp.ServerName = "UIF.UIF04.UIF041040";
  54. ccp.MethodName = "Query_Roll_Len";
  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_STD"].Clear();
  60. System.Data.DataTable tab0 = FixDBManager.ConvertToDataTable(obj.ReturnObject as System.Collections.ArrayList, this.dataSet1.Tables["TBF02_ROLL_STD"]);
  61. tab0.TableName = "TBF02_ROLL_STD";
  62. this.dataSet1.Tables["TBF02_ROLL_STD"].Merge(tab0);
  63. this.dataSet1.AcceptChanges();
  64. }
  65. }
  66. catch (System.Exception ex)
  67. {
  68. System.Diagnostics.Debug.WriteLine(ex.ToString());
  69. }
  70. }
  71. private void Commit_RollLen(string Type_)
  72. {
  73. try
  74. {
  75. string sql = "";
  76. switch (Type_)
  77. {
  78. case "Add":
  79. if (!CheckValue())
  80. return;
  81. sql = "INSERT INTO TBF02_ROLL_STD(PLT,MINI,MAXI,REG_DTIME,REG_ID) VALUES("
  82. + "'" + this.cmb_PLTName.Value.ToString() + "',"
  83. + Common.FixDBManager.CheckNullStr(this.txt_Mini.Text) + ","
  84. + Common.FixDBManager.CheckNullStr(this.txt_Maxi.Text) + ","
  85. + "TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS'),"
  86. + "'" + CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName() + "'"
  87. +")";
  88. break;
  89. case "Edit":
  90. if (this.ugrd_RollLen.ActiveRow == null)
  91. {
  92. MessageBox.Show("请选择您要修改的记录行");
  93. return;
  94. }
  95. if (!CheckValue())
  96. return;
  97. sql = "UPDATE TBF02_ROLL_STD SET PLT='" + this.cmb_PLTName.Value.ToString() + "',"
  98. + "MINI=" + Common.FixDBManager.CheckNullStr(this.txt_Mini.Text) + ","
  99. + "MAXI=" + Common.FixDBManager.CheckNullStr(this.txt_Maxi.Text) + ","
  100. + "MOD_DTIME=TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS'),"
  101. + "MOD_ID='" + CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName() + "' "
  102. + "WHERE PLT='" + Common.FixDBManager.CheckNullStr(this.ugrd_RollLen.ActiveRow.Cells["PLT"].Value) + "'";
  103. break;
  104. case "Delete":
  105. if (this.ugrd_RollLen.ActiveRow == null)
  106. {
  107. MessageBox.Show("请选择您要删除的记录行");
  108. return;
  109. }
  110. sql = "DELETE FROM TBF02_ROLL_STD WHERE PLT='" + Common.FixDBManager.CheckNullStr(this.ugrd_RollLen.ActiveRow.Cells["PLT"].Value) + "'";
  111. break;
  112. }
  113. CoreClientParam ccp = new CoreClientParam();
  114. ccp.ServerName = "UIF.UIF04.UIF041040";
  115. ccp.MethodName = "Commit_Roll_Len";
  116. ccp.ServerParams = new object[] { sql };
  117. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  118. if (ccp.ReturnInfo.Length == 0)
  119. Query();
  120. }
  121. catch (System.Exception ex)
  122. {
  123. System.Diagnostics.Debug.WriteLine(ex.ToString());
  124. }
  125. }
  126. private bool CheckValue()
  127. {
  128. if (this.cmb_PLTName.Text.Trim().Length == 0)
  129. {
  130. MessageBox.Show("请您确认生产单位");
  131. return false;
  132. }
  133. return true;
  134. }
  135. #endregion
  136. #region "Init"
  137. private void UIF041040_Load(object sender, EventArgs e)
  138. {
  139. try
  140. {
  141. GetBindData();
  142. Common.FixDBManager.Init_ComboControl(this.cmb_PLTName, "TBZ00_COMMCD", "SM_CFNM", "SM_CD", ref this.dataSet1);
  143. Common.FixDBManager.SetGridDropDownList("PLT", "TBF02_ROLL_STD", 114, this.ugrd_RollLen, this.dataSet1.Tables["TBZ00_COMMCD"], "SM_CD", "SM_CFNM");
  144. }
  145. catch (System.Exception ex)
  146. {
  147. System.Diagnostics.Debug.WriteLine(ex.ToString());
  148. }
  149. }
  150. private void GetBindData()
  151. {
  152. try
  153. {
  154. CoreClientParam ccp = new CoreClientParam();
  155. ccp.ServerName = "UIF.UIF04.UIF041040";
  156. ccp.MethodName = "Query_InitData";
  157. //ccp.ServerParams = new object[] { "PL/TCM" };
  158. CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  159. if (obj.ReturnInfo.Length == 0)
  160. {
  161. this.dataSet1.Tables["TBZ00_COMMCD"].Clear();
  162. System.Data.DataTable tab0 = FixDBManager.ConvertToDataTable(obj.ReturnObject as System.Collections.ArrayList, this.dataSet1.Tables["TBZ00_COMMCD"]);
  163. tab0.TableName = "TBZ00_COMMCD";
  164. this.dataSet1.Tables["TBZ00_COMMCD"].Merge(tab0);
  165. this.dataSet1.AcceptChanges();
  166. }
  167. }
  168. catch (System.Exception ex)
  169. {
  170. System.Diagnostics.Debug.WriteLine(ex.ToString());
  171. }
  172. }
  173. #endregion
  174. #region "Grid Event"
  175. private void ugrd_RollLen_AfterRowActivate(object sender, EventArgs e)
  176. {
  177. try
  178. {
  179. this.cmb_PLTName.Value = Common.FixDBManager.CheckNullStr(this.ugrd_RollLen.ActiveRow.Cells["PLT"].Value);
  180. this.txt_Mini.Text = Common.FixDBManager.CheckNullStr(this.ugrd_RollLen.ActiveRow.Cells["MINI"].Value);
  181. this.txt_Maxi.Text = Common.FixDBManager.CheckNullStr(this.ugrd_RollLen.ActiveRow.Cells["MAXI"].Value);
  182. }
  183. catch (System.Exception ex)
  184. {
  185. System.Diagnostics.Debug.WriteLine(ex.ToString());
  186. }
  187. }
  188. #endregion
  189. }
  190. }