4bf2706d6367edea80baf8ac925ad7205e8b7b7d.svn-base 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  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.UIF07
  13. {
  14. public partial class UIF071010 : FrmBase
  15. {
  16. public UIF071010()
  17. {
  18. InitializeComponent();
  19. }
  20. private void Get_PKGPlan_Info()
  21. {
  22. try
  23. {
  24. CoreClientParam ccp = new CoreClientParam();
  25. ccp.ServerName = "UIF.UIF07.UIF071010";
  26. ccp.MethodName = "queryPkgData";
  27. CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  28. if (obj.ReturnInfo.Length == 0)
  29. {
  30. this.dataSet1.Tables["TAB_CALINFO"].Clear();
  31. System.Data.DataTable tab0 = FixDBManager.ConvertToDataTable(obj.ReturnObject as System.Collections.ArrayList, this.dataSet1.Tables["TAB_CALINFO"]);
  32. tab0.TableName = "TAB_CALINFO";
  33. this.dataSet1.Tables["TAB_CALINFO"].Merge(tab0);
  34. this.dataSet1.AcceptChanges();
  35. }
  36. }
  37. catch (System.Exception ex)
  38. {
  39. System.Diagnostics.Debug.WriteLine(ex.ToString());
  40. }
  41. }
  42. private void Get_PKGPlan_List()
  43. {
  44. try
  45. {
  46. CoreClientParam ccp = new CoreClientParam();
  47. ccp.ServerName = "UIF.UIF07.UIF071010";
  48. ccp.MethodName = "queryPkgList";
  49. CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  50. if (obj.ReturnInfo.Length == 0)
  51. {
  52. this.dataSet1.Tables["TAB_CALLIST"].Clear();
  53. System.Data.DataTable tab0 = FixDBManager.ConvertToDataTable(obj.ReturnObject as System.Collections.ArrayList, this.dataSet1.Tables["TAB_CALLIST"]);
  54. tab0.TableName = "TAB_CALLIST";
  55. this.dataSet1.Tables["TAB_CALLIST"].Merge(tab0);
  56. this.dataSet1.AcceptChanges();
  57. }
  58. }
  59. catch (System.Exception ex)
  60. {
  61. System.Diagnostics.Debug.WriteLine(ex.ToString());
  62. }
  63. }
  64. #region "ToolBar Event"
  65. public override void ToolBar_Click(object sender, string ToolbarKey)
  66. {
  67. try
  68. {
  69. switch (ToolbarKey)
  70. {
  71. case "Query":
  72. this.dataSet1.Tables["TAB_CCOILLIST"].Clear();
  73. Query("");
  74. break;
  75. case "Add":
  76. Add();
  77. break;
  78. case "Delete":
  79. Delete();
  80. break;
  81. case "Save":
  82. Save();
  83. break;
  84. case "Exit":
  85. this.dataSet1.Dispose();
  86. this.dataSet1 = null;
  87. this.Close();
  88. break;
  89. }
  90. }
  91. catch (System.Exception ex)
  92. {
  93. System.Diagnostics.Debug.WriteLine(ex.ToString());
  94. }
  95. }
  96. private void Query(string where)
  97. {
  98. try
  99. {
  100. string Condition = GetCondition(where);
  101. CoreClientParam ccp = new CoreClientParam();
  102. ccp.ServerName = "UIF.UIF07.UIF071010";
  103. ccp.MethodName = "queryCalCoil";
  104. ccp.ServerParams = new object[] { Condition };
  105. CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  106. if (obj.ReturnInfo.Length == 0)
  107. {
  108. System.Data.DataTable tab0 = FixDBManager.ConvertToDataTable(obj.ReturnObject as System.Collections.ArrayList, this.dataSet1.Tables["TAB_CCOILLIST"]);
  109. tab0.TableName = "TAB_CCOILLIST";
  110. this.dataSet1.Tables["TAB_CCOILLIST"].Merge(tab0);
  111. this.dataSet1.AcceptChanges();
  112. }
  113. }
  114. catch (System.Exception ex)
  115. {
  116. System.Diagnostics.Debug.WriteLine(ex.ToString());
  117. }
  118. }
  119. private void Add()
  120. {
  121. try
  122. {
  123. this.ugrd_CoilList.UpdateData();
  124. System.Data.DataRow[] rows = this.dataSet1.Tables["TAB_CCOILLIST"].Select("FLAG='TRUE'");
  125. if (rows.Length == 0)
  126. {
  127. MessageBox.Show("您还未选择钢卷,请选择");
  128. return;
  129. }
  130. string CoilNOS = "";
  131. string ex = "";
  132. for (int i = 0; i < this.ugrd_CoilList.Rows.Count; i++)
  133. {
  134. if (Common.FixDBManager.CheckNullStr(ugrd_CoilList.Rows[i].Cells["FLAG"].Value).ToUpper() == "TRUE")
  135. {
  136. CoilNOS = CoilNOS + ugrd_CoilList.Rows[i].Cells["COIL_NO"].Value.ToString() + ";";
  137. }
  138. }
  139. CoilNOS = CoilNOS.Substring(0, CoilNOS.Length - 1);
  140. string paras = ";;";
  141. string paran = "3";
  142. Hashtable paramHsmp = new Hashtable();
  143. paramHsmp.Add("i1", CoilNOS);
  144. paramHsmp.Add("i2", rows.Length.ToString());
  145. paramHsmp.Add("i3", paras);
  146. paramHsmp.Add("i4", paran);
  147. paramHsmp.Add("o5", ex);
  148. CoreClientParam ccp = new CoreClientParam();
  149. ccp.ServerName = "UIB.COM.ComDBProcedure";
  150. ccp.MethodName = "doXmlProcedure";
  151. ccp.ServerParams = new Object[] { "UIF071010.Add_PkgPlan", paramHsmp };
  152. CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  153. System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
  154. if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
  155. {
  156. MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
  157. }
  158. else
  159. {
  160. Get_PKGPlan_Info();
  161. Get_PKGPlan_List();
  162. for (int i = rows.Length - 1; i >= 0; i--)
  163. {
  164. this.dataSet1.Tables["TAB_CCOILLIST"].Rows.Remove(rows[i]);
  165. }
  166. this.dataSet1.Tables["TAB_CCOILLIST"].AcceptChanges();
  167. }
  168. }
  169. catch (System.Exception ex)
  170. {
  171. System.Diagnostics.Debug.WriteLine(ex.ToString());
  172. }
  173. }
  174. private void Delete()
  175. {
  176. try
  177. {
  178. if (this.ugrd_CalList.Selected.Rows.Count == 0)
  179. {
  180. MessageBox.Show("请选择您要移除的记录");
  181. return;
  182. }
  183. string pgkNO = this.ugrd_CalList.Rows[0].Cells["PKG_NO"].Value.ToString();
  184. string CoilNOS = "";
  185. string Condition = "";
  186. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.ugrd_CalList.Selected.Rows)
  187. {
  188. CoilNOS = CoilNOS + Common.FixDBManager.CheckNullStr(row.Cells["COIL_NO"].Value) + ";";
  189. Condition = Condition + "'" + Common.FixDBManager.CheckNullStr(row.Cells["COIL_NO"].Value) + "',";
  190. }
  191. CoilNOS = CoilNOS.Substring(0, CoilNOS.Length - 1);
  192. Condition = Condition.Substring(0, Condition.Length - 1);
  193. Condition = " AND A.OLD_SAMPL_NO IN(" + Condition + ") ";
  194. Hashtable paramHsmp = new Hashtable();
  195. paramHsmp.Add("i1", pgkNO);
  196. paramHsmp.Add("i2", CoilNOS);
  197. paramHsmp.Add("i3", this.ugrd_CalList.Selected.Rows.Count.ToString());
  198. CoreClientParam ccp = new CoreClientParam();
  199. ccp.ServerName = "UIB.COM.ComDBProcedure";
  200. ccp.MethodName = "doXmlProcedure";
  201. ccp.ServerParams = new Object[] { "UIF071010.Del_PkgPlan", paramHsmp };
  202. CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  203. System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
  204. if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
  205. {
  206. MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
  207. }
  208. else
  209. {
  210. Get_PKGPlan_Info();
  211. Get_PKGPlan_List();
  212. Query(Condition);
  213. }
  214. }
  215. catch (System.Exception ex)
  216. {
  217. System.Diagnostics.Debug.WriteLine(ex.ToString());
  218. }
  219. }
  220. private void Save()
  221. {
  222. try
  223. {
  224. string chk_flag = "00000";
  225. string pgkNO = this.ugrd_CalList.Rows[0].Cells["PKG_NO"].Value.ToString();
  226. //if (this.CHK_CHEM.Checked)
  227. // chk_flag = "1";
  228. //else
  229. // chk_flag = "0";
  230. //if (this.CHK_PHY.Checked)
  231. // chk_flag = chk_flag + "1";
  232. //else
  233. // chk_flag = chk_flag + "0";
  234. //chk_flag=chk_flag + "000";
  235. string ex = "";
  236. string chk_ex = "";
  237. Hashtable paramHsmp = new Hashtable();
  238. paramHsmp.Add("i1", pgkNO);
  239. paramHsmp.Add("i2", CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName());
  240. paramHsmp.Add("i3", chk_flag);
  241. paramHsmp.Add("o4", chk_ex);
  242. paramHsmp.Add("o5", ex);
  243. CoreClientParam ccp = new CoreClientParam();
  244. ccp.ServerName = "UIB.COM.ComDBProcedure";
  245. ccp.MethodName = "doXmlProcedure";
  246. ccp.ServerParams = new Object[] { "UIF071010.Affirm_PkgPlan", paramHsmp };
  247. CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  248. System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList;
  249. if (err != null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0]) != "1")
  250. {
  251. MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
  252. if (err.Count > 1 && Common.FixDBManager.CheckNullStr(err[1]) != "1")
  253. {
  254. MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption);
  255. }
  256. }
  257. else
  258. {
  259. Get_PKGPlan_Info();
  260. Get_PKGPlan_List();
  261. }
  262. }
  263. catch (System.Exception ex)
  264. {
  265. System.Diagnostics.Debug.WriteLine(ex.ToString());
  266. }
  267. }
  268. #endregion
  269. private string GetCondition(string InitCondition)
  270. {
  271. return "";
  272. //try
  273. //{
  274. // if (InitCondition.Length > 0)
  275. // return InitCondition;
  276. // string Condition = "";
  277. // string tmp = "";
  278. // if (FixDBManager.CheckNullStr(this.Cmb_BM.Text).Length > 0)
  279. // {
  280. // foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.Cmb_BM.CheckedRows)
  281. // {
  282. // tmp += "'" + row.Cells["SM_CD"].Value.ToString() + "',";
  283. // }
  284. // tmp = tmp.Substring(0, tmp.Length - 1);
  285. // Condition += " AND B.C_EXTSHAPE_REQ IN(" + tmp + ") ";
  286. // }
  287. // if (FixDBManager.CheckNullStr(this.Cmb_PM.Text).Length > 0)
  288. // {
  289. // tmp = "";
  290. // foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.Cmb_PM.CheckedRows)
  291. // {
  292. // tmp += "'" + row.Cells["SM_CD"].Value.ToString() + "',";
  293. // }
  294. // tmp = tmp.Substring(0, tmp.Length - 1);
  295. // Condition += " AND B.PRODNM_CD IN(" + tmp + ") ";
  296. // }
  297. // string[] height = txt_Height.Text.Split('~');
  298. // string min_height = height[0].Replace(" ", "");
  299. // min_height = min_height == "." ? "0" : min_height;
  300. // string max_height = height[1].Replace(" ", "");
  301. // max_height = max_height == "." ? "99" : max_height;
  302. // Condition += " AND B.C_ORD_THK BETWEEN " + min_height + " AND " + max_height;
  303. // string[] width = txt_Width.Text.Split('~');
  304. // string min_width = width[0].Replace(" ", "").Length == 0 ? "0" : width[0];
  305. // string max_width = width[1].Replace(" ", "").Length == 0 ? "1500" : width[1];
  306. // Condition += " AND B.C_ORD_WTH BETWEEN " + min_width + " AND " + max_width;
  307. // string[] senddate = mtx_SendDate.Text.Split('~');
  308. // string min_senddate = senddate[0].Replace(" ", "") == "--" ? "2010-01-01" : senddate[0];
  309. // string max_senddate = senddate[1].Replace(" ", "") == "--" ? "2099-01-01" : senddate[1];
  310. // Condition += " AND B.DEL_TO_DATE BETWEEN TO_CHAR(TO_DATE('" + min_senddate + "','YYYY-MM-DD'),'YYYYMMDD') "
  311. // + " AND TO_CHAR(TO_DATE('" + max_senddate + "','YYYY-MM-DD'),'YYYYMMDD') ";
  312. // return Condition;
  313. //}
  314. //catch (System.Exception ex)
  315. //{
  316. // System.Diagnostics.Debug.WriteLine(ex.ToString());
  317. // return "";
  318. //}
  319. }
  320. private void UIF071010_Load(object sender, EventArgs e)
  321. {
  322. try
  323. {
  324. Get_PKGPlan_Info();
  325. Get_PKGPlan_List();
  326. Common.FixDBManager.SetGridCheckBox("FLAG", "TAB_CCOILLIST", 25, this.ugrd_CoilList);
  327. string ColumnName = "";
  328. for (int i = 0; i < this.ugrd_CoilList.DisplayLayout.Bands[0].Columns.Count; i++)
  329. {
  330. ColumnName = this.ugrd_CoilList.DisplayLayout.Bands[0].Columns[i].Key;
  331. if (ColumnName == "FLAG")
  332. {
  333. Common.FixDBManager.SetCellActivation(ColumnName, "TAB_CCOILLIST", this.ugrd_CoilList, "ALLOWEDIT");
  334. }
  335. else
  336. {
  337. Common.FixDBManager.SetCellActivation(ColumnName, "TAB_CCOILLIST", this.ugrd_CoilList, "ACTIVATEONLY");
  338. }
  339. }
  340. this.ugrd_CalList.DisplayLayout.Override.SupportDataErrorInfo = Infragistics.Win.UltraWinGrid.SupportDataErrorInfo.RowsAndCells;
  341. }
  342. catch (System.Exception ex)
  343. {
  344. System.Diagnostics.Debug.WriteLine(ex.ToString());
  345. }
  346. }
  347. /// <summary>
  348. /// 修改钢卷计划包装等级
  349. /// </summary>
  350. /// <param name="sender"></param>
  351. /// <param name="e"></param>
  352. private void button1_Click(object sender, EventArgs e)
  353. {
  354. string coilNo = textBox3.Text.Trim();
  355. if (coilNo != null && coilNo != "")
  356. {
  357. string pkgLevel = ultraComboEditor2.Value != null ? ultraComboEditor2.Value.ToString() : "1";
  358. string pgkNO = this.ugrd_CalList.Rows[0].Cells["PKG_NO"].Value.ToString();
  359. CoreClientParam ccp = new CoreClientParam();
  360. ccp.ServerName = "UIF.UIF07.UIF071010";
  361. ccp.MethodName = "updatePkgLevel";
  362. ccp.ServerParams = new Object[] { coilNo,pgkNO,pkgLevel };
  363. ccp.SourceDataTable = this.dataSet1.Tables[0];
  364. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  365. Get_PKGPlan_List();
  366. }
  367. else
  368. {
  369. MessageBox.Show("请选择需要修改包装等级的钢卷!");
  370. }
  371. }
  372. private void ugrd_CalList_AfterRowActivate(object sender, EventArgs e)
  373. {
  374. textBox3.Text = ugrd_CalList.ActiveRow.Cells["COIL_NO"].Value.ToString();
  375. ultraComboEditor2.Text = ugrd_CalList.ActiveRow.Cells["PACK_METHOD"].Value.ToString();
  376. }
  377. }
  378. }