FrmPopGetBalance.cs 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  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;using Pur.Entity;using Pur.Entity;
  10. using Pur.Balance;
  11. using System.Collections;
  12. using Infragistics.Win.UltraWinGrid;
  13. using com.hnshituo.pur.vo;
  14. using Core.Mes.Client.Comm.Control;
  15. namespace Pur.Pop_upWindow
  16. {
  17. public partial class FrmPopGetBalance : FrmPmsBase
  18. {
  19. public string balclass;
  20. private string strM1;
  21. private string strM2;
  22. private string strC1;
  23. private string strC2;
  24. private UltraGrid ugM;
  25. private DataTable dtM;
  26. private UltraGrid ugC;
  27. private DataTable dtC;
  28. /** 主键 */
  29. private string balanceId;
  30. public string BalanceId
  31. {
  32. get { return balanceId; }
  33. set { balanceId = value; }
  34. }
  35. private string balanceName;
  36. /** 名称*/
  37. public string BalanceName
  38. {
  39. get { return balanceName; }
  40. set { balanceName = value; }
  41. }
  42. public FrmPopGetBalance()
  43. {
  44. InitializeComponent();
  45. }
  46. public FrmPopGetBalance(OpeBase ob,String bal)
  47. {
  48. this.balclass = bal;
  49. this.ob = ob;
  50. InitializeComponent();
  51. }
  52. private void FrmPopGetBalance_Load(object sender, EventArgs e)
  53. {
  54. preInit(balclass);
  55. queryM(strM1, strM2, ugM, dtM,balclass);
  56. }
  57. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  58. {
  59. switch (e.Tool.Key)
  60. {
  61. case "querybal": // ButtonTool
  62. queryM(strM1, strM2,ugM,dtM,balclass);
  63. break;
  64. case "submitbal": // ButtonTool
  65. submitt();
  66. break;
  67. case "closebal": // ButtonTool
  68. this.Close();
  69. break;
  70. }
  71. }
  72. #region toolbar事件
  73. private void queryM(String strM1, String srtM2,UltraGrid ugM,DataTable dtM,String balclass)
  74. {
  75. try
  76. {
  77. //获取查询条件
  78. String strid = Qid.Text.ToString().Trim();
  79. String strName = Qname.Text.ToString().Trim();
  80. //构建实体类
  81. if (balclass == "1")
  82. {
  83. BalanceBasepriceM bc = new BalanceBasepriceM();
  84. bc.Id = strid;
  85. bc.Name = strName;
  86. DataTable dt = this.execute<DataTable>(strM1, srtM2, new object[] { bc });
  87. GridHelper.CopyDataToDatatable(ref dt, ref dtM, true);
  88. }
  89. else if (balclass == "2")
  90. {
  91. BalanceCicpriceM bc = new BalanceCicpriceM();
  92. bc.Id = strid;
  93. bc.Name = strName;
  94. DataTable dt = this.execute<DataTable>(strM1, srtM2, new object[] { bc });
  95. GridHelper.CopyDataToDatatable(ref dt, ref dtM, true);
  96. }
  97. else
  98. {
  99. }
  100. }
  101. catch (Exception ex)
  102. {
  103. MessageBox.Show("操作失败:"+ex.Message,"提示");
  104. return;
  105. }
  106. }
  107. private void submitbal(object sender, DoubleClickRowEventArgs e)
  108. {
  109. balanceId = e.Row.Cells["id"].Value.ToString().Trim();
  110. balanceName = e.Row.Cells["name"].Value.ToString().Trim();
  111. this.Close();
  112. }
  113. private void ugM_RowClick(object sender, EventArgs e)
  114. {
  115. String balId = ugM.ActiveRow.Cells["id"].Value.ToString().Trim();
  116. //构建实体类
  117. if (balclass == "1")
  118. {
  119. BalanceBasepriceC bc = new BalanceBasepriceC();
  120. bc.StandId = balId;
  121. bc.Validflag = "1";
  122. DataTable dt = this.execute<DataTable>(strC1, strC2, new object[] { bc });
  123. GridHelper.CopyDataToDatatable(ref dt, ref dtC, true);
  124. }
  125. else if (balclass == "2")
  126. {
  127. BalanceCicpriceC bc = new BalanceCicpriceC();
  128. bc.StandId = balId;
  129. bc.Validflag = "1";
  130. DataTable dt = this.execute<DataTable>(strC1, strC2, new object[] { bc });
  131. GridHelper.CopyDataToDatatable(ref dt, ref dtC, true);
  132. }
  133. else
  134. {
  135. }
  136. }
  137. private void submitt()
  138. {
  139. try
  140. {
  141. if (ugM.ActiveRow != null)
  142. {
  143. balanceId = ugM.ActiveRow.Cells["id"].Value.ToString().Trim();
  144. balanceName = ugM.ActiveRow.Cells["name"].Value.ToString().Trim();
  145. this.Close();
  146. }
  147. else
  148. {
  149. MessageBox.Show("", "提示");
  150. }
  151. }
  152. catch (Exception ex)
  153. {
  154. MessageBox.Show("操作失败:" + ex.Message, "提示");
  155. return;
  156. }
  157. }
  158. #endregion
  159. #region 弹出框初始化
  160. private void preInit(String balclass)
  161. {
  162. //加载控件数据
  163. ArrayList aryTmp = new ArrayList();
  164. aryTmp.Add(new ValueListItem("1", "基准计价"));
  165. aryTmp.Add(new ValueListItem("2", "成分计价"));
  166. aryTmp.Add(new ValueListItem("3", "批量计价"));
  167. aryTmp.Add(new ValueListItem("9", "其它计价"));
  168. BalanceClassCommon.FilComboboxbyList(Qbalclass, aryTmp);
  169. //默认选择的类型
  170. Qbalclass.Value = balclass;
  171. //禁用控件
  172. Qbalclass.Enabled = false;
  173. //隐藏Tab控件
  174. ultraTabControl1.Tabs[0].Visible = false;
  175. ultraTabControl1.Tabs[1].Visible = false;
  176. ultraTabControl1.Tabs[2].Visible = false;
  177. ultraTabControl1.Tabs[3].Visible = false;
  178. ultraTabControl2.Tabs[0].Visible = false;
  179. ultraTabControl2.Tabs[1].Visible = false;
  180. ultraTabControl2.Tabs[2].Visible = false;
  181. ultraTabControl2.Tabs[3].Visible = false;
  182. //清空路由数据
  183. strM1="";
  184. strM2="";
  185. strC1="";
  186. strC2 = "";
  187. //清空页面数据
  188. //dtM.Clear();
  189. //dtC.Clear();
  190. //ugM.Update();
  191. //ugC.Update();
  192. //显示Tab控件
  193. if (balclass == "1")
  194. {
  195. ultraTabControl1.Tabs[0].Visible = true;
  196. ultraTabControl2.Tabs[0].Visible = true;
  197. strM1 = "com.hnshituo.pur.balance.service.BalanceBasepriceMService";
  198. strM2 = "doQureyBasePriceM";
  199. strC1 = "com.hnshituo.pur.balance.service.BalanceBasepriceCService";
  200. strC2 = "doQureyBasePriceC";
  201. ugM = ultraGrid1;
  202. ugC = ultraGrid5;
  203. dtM = dataTable1;
  204. dtC = dataTable2;
  205. }
  206. else if(balclass=="2")
  207. {
  208. ultraTabControl1.Tabs[1].Visible = true;
  209. ultraTabControl2.Tabs[1].Visible = true;
  210. strM1 = "com.hnshituo.pur.balance.service.BalanceCicpriceMService";
  211. strM2 = "doQureyCicpPriceM";
  212. strC1 = "com.hnshituo.pur.balance.service.BalanceCicpriceCService";
  213. strC2 = "doQureyCicpPriceC";
  214. ugM = ultraGrid2;
  215. ugC = ultraGrid6;
  216. dtM = dataTable3;
  217. dtC = dataTable4;
  218. }
  219. else if(balclass=="3")
  220. {
  221. MessageBox.Show("功能未开放,暂无数据", "提示");
  222. return;
  223. }
  224. else if (balclass == "9")
  225. {
  226. MessageBox.Show("功能未开放,暂无数据", "提示");
  227. return;
  228. }
  229. else
  230. {
  231. MessageBox.Show("未知计价标准参数:"+balclass,"提示");
  232. return;
  233. }
  234. ultraExpandableGroupBox1.Expanded = false;
  235. //添加事件
  236. ugM.DoubleClickRow += new DoubleClickRowEventHandler(submitbal);
  237. ugM.AfterRowActivate += new EventHandler(ugM_RowClick);
  238. }
  239. #endregion
  240. }
  241. }