UIB010330.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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.Diagnostics;
  11. using System.Collections;
  12. using Infragistics.Win.UltraWinGrid;
  13. namespace Core.LZMes.Client.UIB
  14. {
  15. public partial class UIB010330 : FrmBase
  16. {
  17. public UIB010330()
  18. {
  19. InitializeComponent();
  20. }
  21. public override void ToolBar_Click(object sender, string ToolbarKey)
  22. {
  23. switch (ToolbarKey)
  24. {
  25. case "Query":
  26. this.DoQuery();
  27. break;
  28. case "Save":
  29. this.DoSave();
  30. break;
  31. case "Delete":
  32. this.DoDelete();
  33. break;
  34. }
  35. }
  36. //初始化下拉框数据
  37. public void init()
  38. {
  39. DataTable dt = new DataTable();
  40. ArrayList al = new ArrayList();
  41. al.Add("UIB010330_01.INITSELECT");
  42. CoreClientParam ccp = new CoreClientParam();
  43. ccp.ServerName = "UIB.COM.ComDBQuery";
  44. ccp.MethodName = "doSimpleQuery";
  45. ccp.ServerParams = new object[] { al };
  46. ccp.SourceDataTable = dt;
  47. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  48. Init_ComboControl(this.SPECSTLGRD_comboBox, ref dt);
  49. dt = new DataTable();
  50. al = new ArrayList();
  51. al.Add("UIB010330_02.INITSELECT");
  52. ccp = new CoreClientParam();
  53. ccp.ServerName = "UIB.COM.ComDBQuery";
  54. ccp.MethodName = "doSimpleQuery";
  55. ccp.ServerParams = new object[] { al };
  56. ccp.SourceDataTable = dt;
  57. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  58. Init_ComboControl(this.SPECABBSYM_comboBox, ref dt);
  59. dt = new DataTable();
  60. al = new ArrayList();
  61. al.Add("UIB010330_04.INITSELECT");
  62. ccp = new CoreClientParam();
  63. ccp.ServerName = "UIB.COM.ComDBQuery";
  64. ccp.MethodName = "doSimpleQuery";
  65. ccp.ServerParams = new object[] { al };
  66. ccp.SourceDataTable = dt;
  67. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  68. Init_ComboControl(this.ultraComboEditor1, ref dt);
  69. dt = new DataTable();
  70. al = new ArrayList();
  71. al.Add("UIB010330_03.INITSELECT");
  72. ccp = new CoreClientParam();
  73. ccp.ServerName = "UIB.COM.ComDBQuery";
  74. ccp.MethodName = "doSimpleQuery";
  75. ccp.ServerParams = new object[] { al };
  76. ccp.SourceDataTable = dt;
  77. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  78. Init_ComboControl(this.ultraComboEditor2, ref dt);
  79. }
  80. public static void Init_ComboControl(System.Windows.Forms.Control ComboControl, ref System.Data.DataTable dt)
  81. {
  82. System.Data.DataView dtview = new System.Data.DataView(dt);
  83. ((Infragistics.Win.UltraWinEditors.UltraComboEditor)ComboControl).DataSource = dtview;
  84. ((Infragistics.Win.UltraWinEditors.UltraComboEditor)ComboControl).DisplayMember = "SM_CFNM";
  85. ((Infragistics.Win.UltraWinEditors.UltraComboEditor)ComboControl).ValueMember = "SM_CD";
  86. }
  87. public void DoQuery()
  88. {
  89. try
  90. {
  91. this.dataSet1.Tables[0].Clear();
  92. ArrayList al = new ArrayList();
  93. al.Add("UIB010330_02.SELECT");
  94. if (this.SPECABBSYM_comboBox.Value == null)
  95. {
  96. al.Add("");
  97. al.Add("");
  98. }
  99. else
  100. {
  101. al.Add(this.SPECABBSYM_comboBox.Value.ToString());
  102. al.Add(this.SPECABBSYM_comboBox.Value.ToString());
  103. }
  104. if (this.SPECSTLGRD_comboBox.Value == null)
  105. {
  106. al.Add("");
  107. al.Add("");
  108. }
  109. else
  110. {
  111. al.Add(this.SPECSTLGRD_comboBox.Value.ToString());
  112. al.Add(this.SPECSTLGRD_comboBox.Value.ToString());
  113. }
  114. CoreClientParam ccp = new CoreClientParam();
  115. ccp.ServerName = "UIB.COM.ComDBQuery";
  116. ccp.MethodName = "doSimpleQuery";
  117. ccp.ServerParams = new object[] { al };
  118. ccp.SourceDataTable = this.dataSet1.Tables[0];
  119. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  120. }
  121. catch (Exception ex)
  122. {
  123. MessageBox.Show(ex.ToString());
  124. }
  125. }
  126. public void DoSave()
  127. {
  128. try
  129. {
  130. if (MessageBox.Show("确定保存?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  131. return;
  132. if (this.ultraGrid1.ActiveRow == null) return;
  133. string p_cd = this.ultraGrid1.ActiveRow.Cells["PRDNM_CD"].Text.ToString();
  134. string sp_abbsym = this.ultraGrid1.ActiveRow.Cells["SPEC_ABBSYM"].Text.ToString();
  135. string sp_stlgrd = this.ultraGrid1.ActiveRow.Cells["SPEC_STL_GRD"].Text.ToString();
  136. CoreClientParam ccp = null;
  137. ArrayList al = new ArrayList();
  138. ArrayList list = null;
  139. foreach (UltraGridRow ugr in this.ultraGrid3.Rows)
  140. {
  141. list = new ArrayList();
  142. if (ugr.Cells["PROD_VAL"].Text.ToString() != "")
  143. {
  144. ccp = new CoreClientParam();
  145. ArrayList als = new ArrayList();
  146. //判断是否存在该项目值
  147. als.Add("UIB010330_11.SELECT");
  148. als.Add(p_cd);
  149. als.Add(sp_abbsym);
  150. als.Add(sp_stlgrd);
  151. als.Add(ugr.Cells["PROD_CD"].Text.ToString());
  152. ccp.ServerName = "UIB.COM.ComDBQuery";
  153. ccp.MethodName = "doSimpleQuery";
  154. ccp.ServerParams = new object[] { als };
  155. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  156. int num = 0;
  157. if (null != ccp.SourceDataTable)
  158. num = ccp.SourceDataTable.Rows.Count;
  159. if (num <= 0) //不存在则为插入
  160. {
  161. list.Add("UIB010330_01.INSERT");
  162. list.Add(p_cd);
  163. list.Add(sp_abbsym);
  164. list.Add(sp_stlgrd);
  165. list.Add(ugr.Cells["PROD_CD"].Text.ToString());
  166. list.Add(ugr.Cells["PROD_TYPE"].Text.ToString());
  167. list.Add(ugr.Cells["DCS_SYM"].Text.ToString());
  168. list.Add(ugr.Cells["PROD_VAL"].Text.ToString());
  169. list.Add(ugr.Cells["MEMO"].Text.ToString());
  170. list.Add(this.UserInfo.GetUserName());
  171. }
  172. else //否则则为修改
  173. {
  174. list.Add("UIB010330_02.UPDATE");
  175. list.Add(ugr.Cells["PROD_VAL"].Text.ToString());
  176. list.Add(ugr.Cells["MEMO"].Text.ToString());
  177. list.Add(this.UserInfo.GetUserName());
  178. list.Add(p_cd);
  179. list.Add(sp_abbsym);
  180. list.Add(sp_stlgrd);
  181. list.Add(ugr.Cells["PROD_CD"].Text.ToString());
  182. }
  183. }
  184. else //若值为空则删除对应项目
  185. {
  186. list.Add("UIB010330_02.DELETE");
  187. list.Add(p_cd);
  188. list.Add(sp_abbsym);
  189. list.Add(sp_stlgrd);
  190. list.Add(ugr.Cells["PROD_CD"].Text.ToString());
  191. }
  192. al.Add(list);
  193. }
  194. if (al.Count == 0) return;
  195. ccp = new CoreClientParam();
  196. ccp.ServerName = "UIB.COM.ComDBSave";
  197. ccp.MethodName = "doXmlSave";
  198. ccp.ServerParams = new object[] { al };
  199. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  200. this.DoQuery();
  201. }
  202. catch (Exception ex)
  203. {
  204. MessageBox.Show(ex.ToString());
  205. }
  206. }
  207. public void DoDelete()
  208. {
  209. try
  210. {
  211. if (MessageBox.Show("确定删除?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  212. return;
  213. if (this.ultraGrid1.ActiveRow == null) return;
  214. ArrayList al = new ArrayList();
  215. al.Add("UIB010330_01.DELETE");
  216. al.Add(this.ultraGrid1.ActiveRow.Cells["PRDNM_CD"].Text.ToString());
  217. al.Add(this.ultraGrid1.ActiveRow.Cells["SPEC_ABBSYM"].Text.ToString());
  218. al.Add(this.ultraGrid1.ActiveRow.Cells["SPEC_STL_GRD"].Text.ToString());
  219. CoreClientParam ccp = new CoreClientParam();
  220. ccp.ServerName = "UIB.COM.ComDBSave";
  221. ccp.MethodName = "doXmlSave";
  222. ccp.ServerParams = new object[] { al };
  223. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  224. this.DoQuery();
  225. }
  226. catch (Exception ex)
  227. {
  228. MessageBox.Show(ex.ToString());
  229. }
  230. }
  231. private void UIB010330_Load(object sender, EventArgs e)
  232. {
  233. init();
  234. }
  235. //点击某行查询右边规范标准信息
  236. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  237. {
  238. if (this.ultraGrid1.ActiveRow == null) return;
  239. //if (this.ultraGrid1.ActiveRow.Selected == false) return;
  240. this.dataSet2.Tables[0].Clear();
  241. CoreClientParam ccp = new CoreClientParam();
  242. ArrayList al = new ArrayList();
  243. al.Add("UIB010330_12.SELECT");
  244. al.Add(this.ultraGrid1.ActiveRow.Cells["PRDNM_CD"].Text.ToString());
  245. al.Add(this.ultraGrid1.ActiveRow.Cells["SPEC_ABBSYM"].Text.ToString());
  246. al.Add(this.ultraGrid1.ActiveRow.Cells["SPEC_STL_GRD"].Text.ToString());
  247. ccp.ServerName = "UIB.COM.ComDBQuery";
  248. ccp.MethodName = "doSimpleQuery";
  249. ccp.ServerParams = new object[] { al };
  250. ccp.SourceDataTable = this.dataSet2.Tables[0];
  251. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  252. }
  253. //private void ultraGrid1_AfterRowUpdate(object sender, RowEventArgs e)
  254. //{
  255. //}
  256. //private void ultraGrid1_CellChange(object sender, CellEventArgs e)
  257. //{
  258. // if (MessageBox.Show("数据有改动需要保存吗?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  259. // return;
  260. //}
  261. }
  262. }