UIF061100.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. using CoreFS.CA06;
  11. using Common;
  12. namespace Core.LZMes.Client.UIF
  13. {
  14. public partial class UIF061100 : CoreFS.CA06.FrmBase
  15. {
  16. public UIF061100()
  17. {
  18. InitializeComponent();
  19. }
  20. #region "Init"
  21. private void UIF061100_Load(object sender, EventArgs e)
  22. {
  23. ultraComboEditor1.SelectedIndex = 0;
  24. try
  25. {
  26. Get_BaseData();
  27. InitGrid();
  28. }
  29. catch (System.Exception ex)
  30. {
  31. System.Diagnostics.Debug.WriteLine(ex.ToString());
  32. }
  33. }
  34. private void Get_BaseData()
  35. {
  36. try
  37. {
  38. CoreClientParam ccp = new CoreClientParam();
  39. ccp.ServerName = "UIF.UIF05.UIF051020";
  40. ccp.MethodName = "Query_BaseData";
  41. CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  42. if (obj.ReturnInfo.Length == 0)
  43. {
  44. System.Collections.ArrayList rtnobj = obj.ReturnObject as System.Collections.ArrayList;
  45. if (rtnobj[0] != null)
  46. {
  47. this.dataSet1.Tables["TAB_PM"].Clear();
  48. System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(rtnobj[0] as System.Collections.ArrayList, this.dataSet1.Tables["TAB_PM"]);
  49. tab0.TableName = "TAB_PM";
  50. this.dataSet1.Tables["TAB_PM"].Merge(tab0);
  51. }
  52. if (rtnobj[1] != null)
  53. {
  54. this.dataSet1.Tables["TAB_YY"].Clear();
  55. System.Data.DataTable tab1 = Common.FixDBManager.ConvertToDataTable(rtnobj[1] as System.Collections.ArrayList, this.dataSet1.Tables["TAB_YY"]);
  56. tab1.TableName = "TAB_YY";
  57. this.dataSet1.Tables["TAB_YY"].Merge(tab1);
  58. //this.dataSet1.Tables["TAB_YY2"] = this.dataSet1.Tables["TAB_YY"].Copy();
  59. }
  60. }
  61. }
  62. catch (System.Exception ex)
  63. {
  64. System.Diagnostics.Debug.WriteLine(ex.ToString());
  65. }
  66. }
  67. private void InitGrid()
  68. {
  69. try
  70. {
  71. Common.FixDBManager.SetGridCheckBox("FLAG", "TAB_CCOILLIST", 25, this.ugrd_CoilList);
  72. string ColumnName = "";
  73. for (int i = 0; i < this.ugrd_CoilList.DisplayLayout.Bands[0].Columns.Count; i++)
  74. {
  75. ColumnName = this.ugrd_CoilList.DisplayLayout.Bands[0].Columns[i].Key;
  76. if (ColumnName == "FLAG")
  77. {
  78. Common.FixDBManager.SetCellActivation(ColumnName, "TAB_CCOILLIST", this.ugrd_CoilList, "ALLOWEDIT");
  79. }
  80. else
  81. {
  82. Common.FixDBManager.SetCellActivation(ColumnName, "TAB_CCOILLIST", this.ugrd_CoilList, "ACTIVATEONLY");
  83. }
  84. }
  85. }
  86. catch (System.Exception ex)
  87. {
  88. System.Diagnostics.Debug.WriteLine(ex.ToString());
  89. }
  90. }
  91. #endregion
  92. #region "ToolBar Event"
  93. public override void ToolBar_Click(object sender, string ToolbarKey)
  94. {
  95. try
  96. {
  97. switch (ToolbarKey.ToString())
  98. {
  99. case "CQuery":
  100. CQuery();
  101. break;
  102. case "DQuery":
  103. DQuery();
  104. break;
  105. case "Declare":
  106. Declare();
  107. break;
  108. case "Delete":
  109. Delete();
  110. break;
  111. }
  112. }
  113. catch (System.Exception ex)
  114. {
  115. System.Diagnostics.Debug.WriteLine(ex.ToString());
  116. }
  117. }
  118. public void CQuery()
  119. {
  120. try
  121. {
  122. string condition = GetCondition("1");
  123. CoreClientParam ccp = new CoreClientParam();
  124. ccp.ServerName = "UIF.UIF06.UIF061100";
  125. ccp.MethodName = "Get_CCoilData";
  126. ccp.ServerParams = new object[] { condition };
  127. CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  128. if (obj.ReturnInfo.Length == 0)
  129. {
  130. this.dataSet1.Tables["TAB_CCOILLIST"].Clear();
  131. System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(obj.ReturnObject as System.Collections.ArrayList, this.dataSet1.Tables["TAB_CCOILLIST"]);
  132. tab0.TableName = "TAB_CCOILLIST";
  133. this.dataSet1.Tables["TAB_CCOILLIST"].Merge(tab0);
  134. this.dataSet1.AcceptChanges();
  135. }
  136. }
  137. catch (System.Exception ex)
  138. {
  139. System.Diagnostics.Debug.WriteLine(ex.ToString());
  140. }
  141. }
  142. public void DQuery()
  143. {
  144. try
  145. {
  146. string condition = GetCondition("0");
  147. CoreClientParam ccp = new CoreClientParam();
  148. ccp.ServerName = "UIF.UIF06.UIF061100";
  149. ccp.MethodName = "Get_DCLData";
  150. ccp.ServerParams = new object[] { condition };
  151. CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  152. if (obj.ReturnInfo.Length == 0)
  153. {
  154. this.dataSet1.Tables["L_TBF03_CAL_DECLARE"].Clear();
  155. System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(obj.ReturnObject as System.Collections.ArrayList, this.dataSet1.Tables["L_TBF03_CAL_DECLARE"]);
  156. tab0.TableName = "L_TBF03_CAL_DECLARE";
  157. this.dataSet1.Tables["L_TBF03_CAL_DECLARE"].Merge(tab0);
  158. this.dataSet1.AcceptChanges();
  159. }
  160. }
  161. catch (System.Exception ex)
  162. {
  163. System.Diagnostics.Debug.WriteLine(ex.ToString());
  164. }
  165. }
  166. public void Declare()
  167. {
  168. try
  169. {
  170. this.ugrd_CoilList.UpdateData();
  171. System.Data.DataRow[] rows = this.dataSet1.Tables["TAB_CCOILLIST"].Select("FLAG='TRUE'");
  172. if (rows.Length == 0)
  173. {
  174. MessageBox.Show("您还未选择冷卷卷,请选择");
  175. return;
  176. }
  177. string CoilNOS = "";
  178. string ex = "";
  179. for (int i = 0; i < this.ugrd_CoilList.Rows.Count; i++)
  180. {
  181. if (Common.FixDBManager.CheckNullStr(ugrd_CoilList.Rows[i].Cells["FLAG"].Value).ToUpper() == "TRUE")
  182. {
  183. CoilNOS = CoilNOS + ugrd_CoilList.Rows[i].Cells["COIL_NO"].Value.ToString() + ";";
  184. }
  185. }
  186. CoilNOS = CoilNOS.Substring(0, CoilNOS.Length - 1);
  187. string dclRs = Cmb_DLCReason.Text.Trim();
  188. string dclMemo = txt_DCLMemo.Text.Trim();
  189. string dclType = ultraComboEditor1.Value.ToString();
  190. Hashtable paramHsmp = new Hashtable();
  191. paramHsmp.Add("i1", CoilNOS);
  192. paramHsmp.Add("i2", rows.Length.ToString());
  193. paramHsmp.Add("i3", UserInfo.GetUserID());
  194. paramHsmp.Add("i4", UserInfo.GetUserOrder());
  195. paramHsmp.Add("i5", UserInfo.GetUserGroup());
  196. paramHsmp.Add("i6", dclRs);
  197. paramHsmp.Add("i7", dclMemo);
  198. paramHsmp.Add("i8", dclType);
  199. paramHsmp.Add("o9", ex);
  200. CoreClientParam ccp = new CoreClientParam();
  201. ccp.ServerName = "UIB.COM.ComDBProcedure";
  202. ccp.MethodName = "doXmlProcedure";
  203. ccp.ServerParams = new Object[] { "UIF061100.Add", paramHsmp };
  204. CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  205. System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
  206. if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
  207. {
  208. MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
  209. }
  210. else
  211. {
  212. //Get_CALPlan_Info();
  213. //Get_CALPlan_List();
  214. for (int i = rows.Length - 1; i >= 0; i--)
  215. {
  216. this.dataSet1.Tables["TAB_CCOILLIST"].Rows.Remove(rows[i]);
  217. }
  218. this.dataSet1.Tables["TAB_CCOILLIST"].AcceptChanges();
  219. }
  220. }
  221. catch (System.Exception ex)
  222. {
  223. System.Diagnostics.Debug.WriteLine(ex.ToString());
  224. }
  225. }
  226. public void Delete()
  227. { }
  228. private string GetCondition(string type)
  229. {
  230. string condition = "";
  231. try
  232. {
  233. string[] height = txt_Height.Text.Split('~');
  234. string min_height = height[0].Replace(" ", "");
  235. min_height = min_height == "." ? "0" : min_height;
  236. string max_height = height[1].Replace(" ", "");
  237. max_height = max_height == "." ? "99" : max_height;
  238. string[] width = txt_Width.Text.Split('~');
  239. string min_width = width[0].Replace(" ", "").Length == 0 ? "0" : width[0];
  240. string max_width = width[1].Replace(" ", "").Length == 0 ? "3000" : width[1];
  241. if (type == "1")
  242. {
  243. if (txt_CCoilNO.Text.Trim().Length > 0)
  244. condition = " AND A.OLD_SAMPL_NO LIKE '" + txt_CCoilNO.Text.Trim() + "%' ";
  245. if (Cmb_STL.Text.Trim().Length > 0)
  246. condition += " AND A.SPEC_STL_GRD LIKE '" + Cmb_STL.Text.Trim() + "%' ";
  247. condition += " AND A.COIL_THK BETWEEN " + min_height + " AND " + max_height;
  248. condition += " AND A.COIL_WTH BETWEEN " + min_width + " AND " + max_width;
  249. }
  250. else
  251. {
  252. if (txt_CCoilNO.Text.Trim().Length > 0)
  253. condition = " AND A.COIL_NO LIKE '" + txt_CCoilNO.Text.Trim() + "%' ";
  254. if (Cmb_STL.Text.Trim().Length > 0)
  255. condition += " AND F.SPEC_STL_GRD LIKE '" + Cmb_STL.Text.Trim() + "%' ";
  256. condition += " AND F.COIL_THK BETWEEN " + min_height + " AND " + max_height;
  257. condition += " AND F.COIL_WTH BETWEEN " + min_width + " AND " + max_width;
  258. if (Common.FixDBManager.CheckNullStr(Cmb_QDCLReason.Value).Length > 0)
  259. condition += " AND F.DCL_REASON='" + Common.FixDBManager.CheckNullStr(Cmb_QDCLReason.Value) + "'";
  260. }
  261. }
  262. catch (System.Exception ex)
  263. {
  264. System.Diagnostics.Debug.WriteLine(ex.ToString());
  265. }
  266. return condition;
  267. }
  268. #endregion
  269. }
  270. }