FrmPriceBasePrice_Exp.cs 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880
  1. using com.steering.pss.sale.price.entity;
  2. using Core.Mes.Client.Comm.Server;
  3. using Core.Mes.Client.Comm.Tool;
  4. using CoreFS.CA06;
  5. using Infragistics.Win.UltraWinEditors;
  6. using Infragistics.Win.UltraWinGrid;
  7. using System;
  8. using System.Collections;
  9. using System.Collections.Generic;
  10. using System.ComponentModel;
  11. using System.Data;
  12. using System.Drawing;
  13. using System.Linq;
  14. using System.Text;
  15. using System.Windows.Forms;
  16. using Core.Mes.Client.Comm.Format;
  17. using Core.Mes.Client.Comm.Control;
  18. namespace Core.StlMes.Client.SalePrice.BaseForm
  19. {
  20. public partial class FrmPriceBasePrice_Exp : FrmBase
  21. {
  22. int MaxIniX = 50;///合并表头时初始化的最大起始坐标X轴
  23. int MaxSpyX = 20;///合并表头时初始化的最大跨越段数
  24. int XZhouCount;
  25. int YZhouCount;
  26. int Y1Count;
  27. int Y2Count;
  28. int BaseFieldCount = 3;
  29. DataTable dt = new DataTable();
  30. DataTable dt_Exp = new DataTable();
  31. public FrmPriceBasePrice_Exp()
  32. {
  33. InitializeComponent();
  34. }
  35. private void FrmPriceBasePrice_Exp_Load(object sender, EventArgs e)
  36. {
  37. InitForm();
  38. InitComBoBox1();
  39. ucFrame.Rows[0].Selected=true;
  40. }
  41. public override void ToolBar_Click(object sender, string ToolbarKey)
  42. {
  43. switch (ToolbarKey)
  44. {
  45. case "Query":
  46. QueryData();
  47. break;
  48. case "Save":
  49. SaveFormData();
  50. break;
  51. case "Delete":
  52. DeleteOrResume(true);
  53. break;
  54. case "Resume":
  55. DeleteOrResume(false);
  56. break;
  57. case "Close":
  58. this.Close();
  59. break;
  60. }
  61. }
  62. private void SaveFormData()
  63. {
  64. ugFramePrice_Exp.UpdateData();
  65. UltraGridRow[] row = ugFramePrice_Exp.Rows.AsQueryable().Where(a => a.Cells["CHK"].Value.ToString().ToUpper() == "TRUE").ToArray();
  66. if (row.Length <= 0 )
  67. {
  68. MessageUtil.ShowWarning("请选择需要保存的数据!");
  69. return;
  70. }
  71. ArrayList parm = CheckFormData(row);
  72. if (MessageUtil.ShowYesNoAndQuestion("是否确认保存数据!") == DialogResult.No) return;
  73. int i = ServerHelper.SetData("com.steering.pss.sale.price.server.CorePriceFramePriceExp.save",
  74. new object[] { parm }, this.ob);
  75. if (i > 0)
  76. {
  77. MessageUtil.ShowTips("数据保存成功!");
  78. QueryData();
  79. }
  80. else
  81. {
  82. MessageUtil.ShowTips("数据保存失败!");
  83. QueryData();
  84. }
  85. }
  86. private void DeleteOrResume(bool flag)
  87. {
  88. ugFramePrice_Exp.UpdateData();
  89. UltraGridRow[] row = ugFramePrice_Exp.Rows.AsQueryable().Where(a => a.Cells["CHK"].Value.ToString().ToUpper() == "TRUE").ToArray();
  90. if (row.Length <= 0)
  91. {
  92. MessageUtil.ShowWarning("请选择需要" + (flag ? "删除" : "恢复") + "的数据!");
  93. return;
  94. }
  95. ArrayList parm = new ArrayList();
  96. if (flag)
  97. {
  98. foreach (var uRow in row)
  99. {
  100. SlmPriceBasepriceExpEntity spf = new SlmPriceBasepriceExpEntity(); ;
  101. spf.PriceExpId = uRow.Cells["PRICE_EXP_ID"].Text.ToString();
  102. if (spf.Validflag == "无效")
  103. {
  104. MessageUtil.ShowWarning("您勾选的数据中存在已删除的数据,不必重复删除!");
  105. return;
  106. }
  107. spf.CreateName = UserInfo.GetUserName();
  108. spf.UpdateName = UserInfo.GetUserName();
  109. parm.Add(JSONFormat.Format(spf));
  110. }
  111. }
  112. else
  113. {
  114. foreach (var uRow in row)
  115. {
  116. SlmPriceBasepriceExpEntity spf = new SlmPriceBasepriceExpEntity(); ;
  117. spf.PriceExpId = uRow.Cells["PRICE_EXP_ID"].Text.ToString();
  118. if (spf.Validflag == "有效")
  119. {
  120. MessageUtil.ShowWarning("您勾选的数据中存在有效的数据,不必进行恢复!");
  121. return;
  122. }
  123. spf.CreateName = UserInfo.GetUserName();
  124. spf.UpdateName = UserInfo.GetUserName();
  125. parm.Add(JSONFormat.Format(spf));
  126. }
  127. }
  128. if (MessageUtil.ShowYesNoAndQuestion("是否" + (flag ? "删除" : "恢复") + "所选的数据!") == DialogResult.No) return;
  129. int i = ServerHelper.SetData("com.steering.pss.sale.price.server.CorePriceFramePriceExp.deleteOrResume", new object[] { parm, flag }, this.ob);
  130. if (i >= 0)
  131. {
  132. MessageUtil.ShowTips("数据" + (flag ? "删除" : "恢复") + "成功!");
  133. QueryData();
  134. }
  135. else
  136. {
  137. MessageUtil.ShowTips("数据" + (flag ? "删除" : "恢复") + "失败!");
  138. QueryData();
  139. }
  140. }
  141. private ArrayList CheckFormData(UltraGridRow[] row)
  142. {
  143. ArrayList parm = new ArrayList();
  144. List<string> list = new List<string>();
  145. foreach (var uRow in row)
  146. {
  147. ArrayList FactorValue = new ArrayList();
  148. SlmPriceBasepriceExpEntity spf = new SlmPriceBasepriceExpEntity(); ;
  149. FactorValue.Add(uRow.Cells["PRICE_EXP_ID"].Text.ToString());
  150. FactorValue.Add(uRow.Cells["PRICE_EXP_NAME"].Text.ToString());
  151. FactorValue.Add(uRow.Cells["Frame_ID"].Text.ToString());
  152. FactorValue.Add(uRow.Cells["PRICE_HEAD_ID"].Text.ToString());
  153. for (int i = 0; i < XZhouCount*2+1; i++)
  154. {
  155. FactorValue.Add(uRow.Cells[5 + i].Value.ToString());
  156. }
  157. for (int i = 0; i < 8 - XZhouCount; i++)
  158. {
  159. FactorValue.Add("");
  160. FactorValue.Add("0");
  161. }
  162. spf.PriceExpId = FactorValue[0].ToString();
  163. spf.PriceExpName = FactorValue[1].ToString();
  164. spf.FrameId = FactorValue[2].ToString();
  165. spf.PriceHeadId = FactorValue[3].ToString();
  166. spf.Factor1Id = FactorValue[5].ToString();
  167. spf.Factor1Price = FactorValue[6] != "" ? Convert.ToDecimal(FactorValue[6]) : 0;
  168. spf.Factor2Id = FactorValue[7].ToString();
  169. spf.Factor2Price = FactorValue[8] != "" ? Convert.ToDecimal(FactorValue[8]) : 0;
  170. spf.Factor3Id = FactorValue[9].ToString();
  171. spf.Factor3Price = FactorValue[10]!=""? Convert.ToDecimal(FactorValue[10]) : 0 ;
  172. spf.Factor4Id = FactorValue[11].ToString();
  173. spf.Factor4Price = FactorValue[12] != "" ? Convert.ToDecimal(FactorValue[12]) : 0;
  174. spf.Factor5Id = FactorValue[13].ToString();
  175. spf.Factor5Price = FactorValue[14] != "" ? Convert.ToDecimal(FactorValue[14]) : 0;
  176. spf.Factor6Id = FactorValue[15].ToString();
  177. spf.Factor6Price = FactorValue[16] != "" ? Convert.ToDecimal(FactorValue[16]) : 0;
  178. spf.Factor7Id = FactorValue[17].ToString();
  179. spf.Factor7Price = FactorValue[18] != "" ? Convert.ToDecimal(FactorValue[18]) : 0;
  180. spf.Factor8Id = FactorValue[19].ToString();
  181. spf.Factor8Price = FactorValue[20] != "" ? Convert.ToDecimal(FactorValue[20]) : 0;
  182. spf.CreateName = UserInfo.GetUserName();
  183. spf.UpdateName = UserInfo.GetUserName();
  184. spf.Validflag = uRow.Cells["VALIDFLAG"].Text.ToString();
  185. if (spf.Validflag == "无效" && spf.CreateName != "")
  186. {
  187. MessageUtil.ShowWarning("【" + spf.PriceExpId + "】的因素已经无效,不能修改!");
  188. return null;
  189. }
  190. parm.Add(JSONFormat.Format(spf));
  191. }
  192. return parm;
  193. }
  194. private void InitForm()
  195. {
  196. string isValid = "1";
  197. List<SlmPriceBaseframeSetEntity> list = EntityHelper.GetData<SlmPriceBaseframeSetEntity>(
  198. "com.steering.pss.sale.price.server.CorePriceBaseFrame.query", new object[] { isValid }, this.ob);
  199. slmPriceBaseframeSetEntityBindingSource.DataSource = list;
  200. }
  201. private void QueryData()
  202. {
  203. // List<SlmPriceBasepriceEntity> list = EntityHelper.GetData<SlmPriceBasepriceEntity>(
  204. // "com.steering.pss.sale.price.server.CorePriceFramePrice.query", null, this.ob);
  205. DataTable dt_query = ServerHelper.GetData("com.steering.pss.sale.price.server.CorePriceFramePrice.query", null, this.ob);
  206. dt.Rows.Clear();
  207. ugFramePrice.DataSource = dt;
  208. ugFramePrice.DataBind();
  209. for (int i = 0; i < dt_query.Rows.Count; i++)
  210. {
  211. DataRow dr = dt.NewRow();
  212. dt.Rows.Add(dr);
  213. dt.Rows[i]["validflag"] = dt_query.Rows[i]["validflag"].ToString();
  214. dt.Rows[i]["create_name"] = dt_query.Rows[i]["create_name"].ToString();
  215. dt.Rows[i]["create_time"] = dt_query.Rows[i]["create_time"].ToString();
  216. if (dt.Columns.Contains("因素一") == true)
  217. {
  218. dt.Rows[i]["因素一"] = dt_query.Rows[i]["X_1_ID_VALUE"].ToString();
  219. }
  220. if (dt.Columns.Contains("因素二") == true)
  221. {
  222. dt.Rows[i]["因素二"] = dt_query.Rows[i]["X_2_ID_VALUE"].ToString();
  223. }
  224. if (dt.Columns.Contains("因素三") == true)
  225. {
  226. dt.Rows[i]["因素三"] = dt_query.Rows[i]["X_3_ID_VALUE"].ToString();
  227. }
  228. if (dt.Columns.Contains("因素四") == true)
  229. {
  230. dt.Rows[i]["因素四"] = dt_query.Rows[i]["X_4_ID_VALUE"].ToString();
  231. }
  232. if (dt.Columns.Contains("因素五") == true)
  233. {
  234. dt.Rows[i]["因素五"] = dt_query.Rows[i]["X_5_ID_VALUE"].ToString();
  235. }
  236. if (dt.Columns.Contains("因素六") == true)
  237. {
  238. dt.Rows[i]["因素六"] = dt_query.Rows[i]["X_6_ID_VALUE"].ToString();
  239. }
  240. if (dt.Columns.Contains("因素七") == true)
  241. {
  242. dt.Rows[i]["因素七"] = dt_query.Rows[i]["X_7_ID_VALUE"].ToString();
  243. }
  244. if (dt.Columns.Contains("因素八") == true)
  245. {
  246. dt.Rows[i]["因素八"] = dt_query.Rows[i]["X_8_ID_VALUE"].ToString();
  247. }
  248. for (int n = 0; n < dt_query.Columns.Count; n++)
  249. {
  250. if (dt.Columns.Contains(dt_query.Columns[n].ColumnName.Replace("'", "")))
  251. {
  252. string ColName = dt_query.Columns[n].ColumnName;
  253. dt.Rows[i][ColName.Replace("'", "")] = dt_query.Rows[i][ColName].ToString();
  254. }
  255. }
  256. }
  257. ugFramePrice.DataSource = dt;
  258. }
  259. private void QueryDataExp(string price_head_id,string isValid)
  260. {
  261. DataTable dt_query = ServerHelper.GetData("com.steering.pss.sale.price.server.CorePriceFramePriceExp.queryById", new object[] { price_head_id, isValid }, this.ob);
  262. dt_Exp.Rows.Clear();
  263. ugFramePrice_Exp.DataSource = dt_Exp;
  264. ugFramePrice_Exp.DataBind();
  265. for (int i = 0; i < dt_query.Rows.Count; i++)
  266. {
  267. DataRow dr = dt_Exp.NewRow();
  268. dt_Exp.Rows.Add(dr);
  269. dt_Exp.Rows[i]["validflag"] = dt_query.Rows[i]["validflag"].ToString();
  270. dt_Exp.Rows[i]["create_name"] = dt_query.Rows[i]["create_name"].ToString();
  271. dt_Exp.Rows[i]["create_time"] = dt_query.Rows[i]["create_time"].ToString();
  272. if (dt_Exp.Columns.Contains("因素一") == true && dt_query.Rows[i]["Factor1_ID"].ToString()!="")
  273. {
  274. dt_Exp.Rows[i]["因素一"] = dt_query.Rows[i]["Factor1_ID"].ToString();
  275. dt_Exp.Rows[i]["因素一加价"] = dt_query.Rows[i]["Factor1_Price"].ToString();
  276. }
  277. if (dt_Exp.Columns.Contains("因素二") == true && dt_query.Rows[i]["Factor2_ID"].ToString() != "")
  278. {
  279. dt_Exp.Rows[i]["因素二"] = dt_query.Rows[i]["Factor2_ID"].ToString();
  280. dt_Exp.Rows[i]["因素二加价"] = dt_query.Rows[i]["Factor2_Price"].ToString();
  281. }
  282. if (dt_Exp.Columns.Contains("因素三") == true && dt_query.Rows[i]["Factor3_ID"].ToString() != "")
  283. {
  284. dt_Exp.Rows[i]["因素三"] = dt_query.Rows[i]["Factor3_ID"].ToString();
  285. dt_Exp.Rows[i]["因素三加价"] = dt_query.Rows[i]["Factor3_Price"].ToString();
  286. }
  287. if (dt_Exp.Columns.Contains("因素四") == true && dt_query.Rows[i]["Factor4_ID"].ToString() != "")
  288. {
  289. dt_Exp.Rows[i]["因素四"] = dt_query.Rows[i]["Factor4_ID"].ToString();
  290. dt_Exp.Rows[i]["因素四加价"] = dt_query.Rows[i]["Factor4_Price"].ToString();
  291. }
  292. if (dt_Exp.Columns.Contains("因素五") == true && dt_query.Rows[i]["Factor5_ID"].ToString() != "")
  293. {
  294. dt_Exp.Rows[i]["因素五"] = dt_query.Rows[i]["Factor5_ID"].ToString();
  295. dt_Exp.Rows[i]["因素五加价"] = dt_query.Rows[i]["Factor5_Price"].ToString();
  296. }
  297. if (dt_Exp.Columns.Contains("因素六") == true && dt_query.Rows[i]["Factor6_ID"].ToString() != "")
  298. {
  299. dt_Exp.Rows[i]["因素六"] = dt_query.Rows[i]["Factor6_ID"].ToString();
  300. dt_Exp.Rows[i]["因素六加价"] = dt_query.Rows[i]["Factor6_Price"].ToString();
  301. }
  302. if (dt_Exp.Columns.Contains("因素七") == true && dt_query.Rows[i]["Factor7_ID"].ToString() != "")
  303. {
  304. dt_Exp.Rows[i]["因素七"] = dt_query.Rows[i]["Factor7_ID"].ToString();
  305. dt_Exp.Rows[i]["因素七加价"] = dt_query.Rows[i]["Factor7_Price"].ToString();
  306. }
  307. if (dt.Columns.Contains("因素八") == true && dt_query.Rows[i]["Factor8_ID"].ToString() != "")
  308. {
  309. dt_Exp.Rows[i]["因素八"] = dt_query.Rows[i]["Factor8_ID"].ToString();
  310. dt_Exp.Rows[i]["因素八加价"] = dt_query.Rows[i]["Factor8_Price"].ToString();
  311. }
  312. for (int n = 0; n < dt_query.Columns.Count; n++)
  313. {
  314. if (dt_Exp.Columns.Contains(dt_query.Columns[n].ColumnName.Replace("'", "")))
  315. {
  316. string ColName = dt_query.Columns[n].ColumnName;
  317. dt_Exp.Rows[i][ColName.Replace("'", "")] = dt_query.Rows[i][ColName].ToString();
  318. }
  319. }
  320. }
  321. ugFramePrice_Exp.DataSource = dt_Exp;
  322. }
  323. private void InitComBoBox1()
  324. {
  325. UltraComboEditor uce1 = new UltraComboEditor();
  326. SalePriceClass.InitComboEditorWithParm(uce1, "com.steering.pss.sale.price.server.CorePriceBaseFrame.queryFacName", "FACTOR_ID", "FACTOR_NAME", this.ob, true, null);
  327. ucFrame.DisplayLayout.Bands[0].Columns["X1FACTORID"].EditorComponent = uce1;
  328. ucFrame.DisplayLayout.Bands[0].Columns["X1FACTORID"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  329. this.Controls.Add(uce1);
  330. uce1.Visible = false;
  331. UltraComboEditor uce2 = new UltraComboEditor();
  332. SalePriceClass.InitComboEditorWithParm(uce2, "com.steering.pss.sale.price.server.CorePriceBaseFrame.queryFacName", "FACTOR_ID", "FACTOR_NAME", this.ob, true, null);
  333. ucFrame.DisplayLayout.Bands[0].Columns["X2FACTORID"].EditorComponent = uce2;
  334. ucFrame.DisplayLayout.Bands[0].Columns["X2FACTORID"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  335. this.Controls.Add(uce2);
  336. uce2.Visible = false;
  337. UltraComboEditor uce3 = new UltraComboEditor();
  338. SalePriceClass.InitComboEditorWithParm(uce3, "com.steering.pss.sale.price.server.CorePriceBaseFrame.queryFacName", "FACTOR_ID", "FACTOR_NAME", this.ob, true, null);
  339. ucFrame.DisplayLayout.Bands[0].Columns["X3FACTORID"].EditorComponent = uce3;
  340. ucFrame.DisplayLayout.Bands[0].Columns["X3FACTORID"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  341. this.Controls.Add(uce3);
  342. uce3.Visible = false;
  343. UltraComboEditor uce4 = new UltraComboEditor();
  344. SalePriceClass.InitComboEditorWithParm(uce4, "com.steering.pss.sale.price.server.CorePriceBaseFrame.queryFacName", "FACTOR_ID", "FACTOR_NAME", this.ob, true, null);
  345. ucFrame.DisplayLayout.Bands[0].Columns["X4FACTORID"].EditorComponent = uce4;
  346. ucFrame.DisplayLayout.Bands[0].Columns["X4FACTORID"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  347. this.Controls.Add(uce4);
  348. uce4.Visible = false;
  349. UltraComboEditor uce5 = new UltraComboEditor();
  350. SalePriceClass.InitComboEditorWithParm(uce5, "com.steering.pss.sale.price.server.CorePriceBaseFrame.queryFacName", "FACTOR_ID", "FACTOR_NAME", this.ob, true, null);
  351. ucFrame.DisplayLayout.Bands[0].Columns["X5FACTORID"].EditorComponent = uce5;
  352. ucFrame.DisplayLayout.Bands[0].Columns["X5FACTORID"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  353. this.Controls.Add(uce5);
  354. uce5.Visible = false;
  355. UltraComboEditor uce6 = new UltraComboEditor();
  356. SalePriceClass.InitComboEditorWithParm(uce6, "com.steering.pss.sale.price.server.CorePriceBaseFrame.queryFacName", "FACTOR_ID", "FACTOR_NAME", this.ob, true, null);
  357. ucFrame.DisplayLayout.Bands[0].Columns["X6FACTORID"].EditorComponent = uce6;
  358. ucFrame.DisplayLayout.Bands[0].Columns["X6FACTORID"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  359. this.Controls.Add(uce6);
  360. uce6.Visible = false;
  361. UltraComboEditor uce7 = new UltraComboEditor();
  362. SalePriceClass.InitComboEditorWithParm(uce7, "com.steering.pss.sale.price.server.CorePriceBaseFrame.queryFacName", "FACTOR_ID", "FACTOR_NAME", this.ob, true, null);
  363. ucFrame.DisplayLayout.Bands[0].Columns["X7FACTORID"].EditorComponent = uce7;
  364. ucFrame.DisplayLayout.Bands[0].Columns["X7FACTORID"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  365. this.Controls.Add(uce7);
  366. uce7.Visible = false;
  367. UltraComboEditor uce8 = new UltraComboEditor();
  368. SalePriceClass.InitComboEditorWithParm(uce8, "com.steering.pss.sale.price.server.CorePriceBaseFrame.queryFacName", "FACTOR_ID", "FACTOR_NAME", this.ob, true, null);
  369. ucFrame.DisplayLayout.Bands[0].Columns["X8FACTORID"].EditorComponent = uce8;
  370. ucFrame.DisplayLayout.Bands[0].Columns["X8FACTORID"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  371. this.Controls.Add(uce8);
  372. uce8.Visible = false;
  373. //UltraComboEditor uce9 = new UltraComboEditor();
  374. //SalePriceClass.InitComboEditorWithParm(uce9, "com.steering.pss.sale.price.server.CorePriceBaseFrame.queryRangeName", "CLASS_D_ID", "CLASS_D_NAME", this.ob, true, null);
  375. //ultraCombo1.DisplayLayout.Bands[0].Columns["Y1FACTORID"].EditorComponent = uce9;
  376. //ultraCombo1.DisplayLayout.Bands[0].Columns["Y1FACTORID"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  377. //this.Controls.Add(uce9);
  378. //uce9.Visible = false;
  379. //UltraComboEditor uce10 = new UltraComboEditor();
  380. //SalePriceClass.InitComboEditorWithParm(uce10, "com.steering.pss.sale.price.server.CorePriceBaseFrame.queryRangeName", "CLASS_D_ID", "CLASS_D_NAME", this.ob, true, null);
  381. //ultraCombo1.DisplayLayout.Bands[0].Columns["Y2FACTORID"].EditorComponent = uce10;
  382. //ultraCombo1.DisplayLayout.Bands[0].Columns["Y2FACTORID"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  383. //this.Controls.Add(uce10);
  384. //uce10.Visible = false;
  385. }
  386. private void ultraCombo1_ValueChanged(object sender, EventArgs e)
  387. {
  388. dt.Columns.Clear();
  389. dt.Rows.Clear();
  390. dt_Exp.Columns.Clear();
  391. dt_Exp.Rows.Clear();
  392. bindBaseField(dt); ///绑定基础字段
  393. LoadXField(dt); ///加载 X轴因素的字段
  394. // LoadYfield(dt); ///加载 Y轴因素的字段
  395. bindBaseField1(dt);
  396. LoadFactorInfo(); ///获取X轴下拉列表
  397. ///
  398. bindBaseField_Exp(dt_Exp);
  399. LoadXField_Exp(dt_Exp);
  400. bindBaseField1_Exp(dt_Exp);
  401. LoadFactorInfo_Exp();
  402. }
  403. private void bindBaseField(DataTable dt)
  404. {
  405. this.ugFramePrice.DisplayLayout.Bands[0].RowLayoutStyle = RowLayoutStyle.GroupLayout;
  406. // dt.Columns.Add("CHK", typeof(Boolean));
  407. dt.Columns.Add("PRICE_HEAD_ID", typeof(string));
  408. // dt.Columns.Add("PRICE_VER_ID", typeof(string));
  409. dt.Columns.Add("PRICE_VER_M", typeof(string));
  410. dt.Columns.Add("PRICE_VER_SQE", typeof(string));
  411. dt.Columns.Add("FRAME_ID", typeof(string));
  412. ugFramePrice.DataSource = dt;
  413. ugFramePrice.DataBind();
  414. ModifyColumnName("PRICE_HEAD_ID", "基价套头ID", this.ugFramePrice, true);
  415. // ModifyColumnName("PRICE_VER_ID", "基价版本ID",this.ugFramePrice,true);
  416. ModifyColumnName("PRICE_VER_M", "基价版本描述", this.ugFramePrice, true);
  417. // ModifyColumnName("PRICE_VER_SQE", "基价序号");
  418. ModifyColumnName("FRAME_ID", "基价框架", this.ugFramePrice, false);
  419. // dt.Columns.Add("PRICE_VER_ID", typeof(string));
  420. //ugFramePrice.DataSource = dt;
  421. //ugFramePrice.DataBind();
  422. }
  423. private void bindBaseField_Exp(DataTable dt_Exp)
  424. {
  425. this.ugFramePrice_Exp.DisplayLayout.Bands[0].RowLayoutStyle = RowLayoutStyle.GroupLayout;
  426. dt_Exp.Columns.Add("CHK", typeof(Boolean));
  427. dt_Exp.Columns.Add("PRICE_EXP_ID", typeof(string));
  428. dt_Exp.Columns.Add("PRICE_EXP_NAME", typeof(string));
  429. dt_Exp.Columns.Add("Frame_ID", typeof(string));
  430. dt_Exp.Columns.Add("PRICE_HEAD_ID", typeof(string));
  431. dt_Exp.Columns.Add("Total_Add", typeof(string));
  432. ugFramePrice_Exp.DataSource = dt_Exp;
  433. ugFramePrice_Exp.DataBind();
  434. ModifyColumnName("PRICE_EXP_ID", "基价扩展ID", this.ugFramePrice_Exp,true);
  435. ModifyColumnName("PRICE_EXP_NAME", "基价扩展名称", this.ugFramePrice_Exp,false);
  436. ModifyColumnName("Frame_ID", "框架ID", this.ugFramePrice_Exp,false);
  437. ModifyColumnName("PRICE_HEAD_ID", "基价套头ID", this.ugFramePrice_Exp,false);
  438. ModifyColumnName("Total_Add", "总加价", this.ugFramePrice_Exp, true);
  439. }
  440. /// <summary>
  441. /// 绑定X轴字段
  442. /// </summary>
  443. /// <param name="dt"></param>
  444. private void LoadXField(DataTable dt)
  445. {
  446. string facId = "";
  447. string facName = "";
  448. string isValid = "1";
  449. int m = 0;
  450. for (int i = 1; i < ucFrame.ActiveRow.Cells.Count - 7; i++)
  451. {
  452. if (ucFrame.ActiveRow.Cells[i].Value.ToString() != null && ucFrame.ActiveRow.Cells[i].Value.ToString() != "")
  453. {
  454. // dt.Columns.Add(ultraCombo1.ActiveRow.Cells[i].Text.ToString(), typeof(string));
  455. dt.Columns.Add(ucFrame.DisplayLayout.Bands[0].Columns[i].Header.Caption.ToString(), typeof(string));
  456. m += 1;
  457. }
  458. }
  459. ugFramePrice.DataSource = dt;
  460. ugFramePrice.DataBind();
  461. for (int i = 1; i < ucFrame.ActiveRow.Cells.Count - 7; i++)
  462. {
  463. if (ucFrame.ActiveRow.Cells[i].Value.ToString() != null && ucFrame.ActiveRow.Cells[i].Value.ToString() != "")
  464. {
  465. ModifyColumnName(ucFrame.DisplayLayout.Bands[0].Columns[i].Header.Caption.ToString(), ucFrame.ActiveRow.Cells[i].Text.ToString(), this.ugFramePrice,true);
  466. }
  467. }
  468. XZhouCount = m;
  469. }
  470. private void LoadXField_Exp(DataTable dt_Exp)
  471. {
  472. string facId = "";
  473. string facName = "";
  474. string isValid = "1";
  475. int m = 0;
  476. for (int i = 1; i < ucFrame.ActiveRow.Cells.Count - 7; i++)
  477. {
  478. if (ucFrame.ActiveRow.Cells[i].Value.ToString() != null && ucFrame.ActiveRow.Cells[i].Value.ToString() != "")
  479. {
  480. // dt.Columns.Add(ultraCombo1.ActiveRow.Cells[i].Text.ToString(), typeof(string));
  481. dt_Exp.Columns.Add(ucFrame.DisplayLayout.Bands[0].Columns[i].Header.Caption.ToString(), typeof(string));
  482. dt_Exp.Columns.Add(ucFrame.DisplayLayout.Bands[0].Columns[i].Header.Caption.ToString() + "加价", typeof(decimal));
  483. m += 2;
  484. }
  485. }
  486. ugFramePrice_Exp.DataSource = dt_Exp;
  487. ugFramePrice_Exp.DataBind();
  488. for (int i = 1; i < ucFrame.ActiveRow.Cells.Count - 7; i++)
  489. {
  490. if (ucFrame.ActiveRow.Cells[i].Value.ToString() != null && ucFrame.ActiveRow.Cells[i].Value.ToString() != "")
  491. {
  492. ModifyColumnName(ucFrame.DisplayLayout.Bands[0].Columns[i].Header.Caption.ToString(), ucFrame.ActiveRow.Cells[i].Text.ToString(), this.ugFramePrice_Exp,true);
  493. ModifyColumnName(ucFrame.DisplayLayout.Bands[0].Columns[i].Header.Caption.ToString() + "加价", ucFrame.ActiveRow.Cells[i].Text.ToString() + "加价", this.ugFramePrice_Exp,true);
  494. }
  495. }
  496. // XZhouCount = m;
  497. }
  498. private void bindBaseField1(DataTable dt)
  499. {
  500. dt.Columns.Add("validflag", typeof(string));
  501. dt.Columns.Add("create_name", typeof(string));
  502. dt.Columns.Add("create_time", typeof(string));
  503. dt.Columns.Add("update_name", typeof(string));
  504. dt.Columns.Add("update_time", typeof(string));
  505. ugFramePrice.DataSource = dt;
  506. ugFramePrice.DataBind();
  507. ModifyColumnName("validflag", "有效标志", this.ugFramePrice,true);
  508. ModifyColumnName("create_name", "创建人", this.ugFramePrice,true);
  509. ModifyColumnName("create_time", "创建时间", this.ugFramePrice,true);
  510. ModifyColumnName("update_name", "修改人", this.ugFramePrice,true);
  511. ModifyColumnName("update_time", "修改时间", this.ugFramePrice,true);
  512. }
  513. private void bindBaseField1_Exp(DataTable dt_Exp)
  514. {
  515. dt_Exp.Columns.Add("validflag", typeof(string));
  516. dt_Exp.Columns.Add("create_name", typeof(string));
  517. dt_Exp.Columns.Add("create_time", typeof(string));
  518. dt_Exp.Columns.Add("update_name", typeof(string));
  519. dt_Exp.Columns.Add("update_time", typeof(string));
  520. ugFramePrice_Exp.DataSource = dt_Exp;
  521. ugFramePrice_Exp.DataBind();
  522. ModifyColumnName("validflag", "有效标志", this.ugFramePrice_Exp,true);
  523. ModifyColumnName("create_name", "创建人", this.ugFramePrice_Exp,true);
  524. ModifyColumnName("create_time", "创建时间", this.ugFramePrice_Exp,true);
  525. ModifyColumnName("update_name", "修改人", this.ugFramePrice_Exp,true);
  526. ModifyColumnName("update_time", "修改时间", this.ugFramePrice_Exp,true);
  527. }
  528. /// <summary>
  529. /// 加载Grid下啦列表
  530. /// </summary>
  531. private void LoadFactorInfo()
  532. {
  533. for (int i = 0; i < ugFramePrice.DisplayLayout.Bands[0].Columns.Count; i++)
  534. {
  535. string FactorName = ugFramePrice.DisplayLayout.Bands[0].Columns[i].Header.Caption.ToString();
  536. DataTable FactorInfo = ServerHelper.GetData("com.steering.pss.sale.price.server.CorePriceFramePrice.GetFactorInfo", new object[] { FactorName }, this.ob);
  537. if (FactorInfo != null && FactorInfo.Rows.Count > 0 && FactorInfo.Rows[0]["Table_Name"].ToString() != "")
  538. {
  539. UltraComboEditor uce1 = new UltraComboEditor();
  540. string sql_getFactorBind = "";
  541. string TableName = FactorInfo.Rows[0]["TABLE_NAME"].ToString();
  542. string DataValue = FactorInfo.Rows[0]["COLUMN_KEY"].ToString();
  543. string DataDesc = FactorInfo.Rows[0]["COLUMN_NAME"].ToString();
  544. string sql_getSQL = FactorInfo.Rows[0]["VAL_SQL"].ToString();
  545. DataTable dtFactor = ServerHelper.GetData("com.steering.pss.sale.price.server.CorePriceFramePrice.FactorBind", new object[] { TableName, DataValue, DataDesc, sql_getSQL }, this.ob);
  546. if (dtFactor != null && dtFactor.Rows.Count > 0)
  547. {
  548. Object[] obj = new Object[] { "", "" };
  549. DataRow dr = dtFactor.NewRow();
  550. dr.ItemArray = obj;
  551. dtFactor.Rows.InsertAt(dr, 0);
  552. uce1.DataSource = dtFactor;
  553. uce1.DataMember = "";
  554. uce1.ValueMember = DataValue;
  555. uce1.DisplayMember = DataDesc;
  556. ClsBaseInfo.SetComboItemHeight(uce1);
  557. }
  558. ugFramePrice.DisplayLayout.Bands[0].Columns[i].EditorComponent = uce1;
  559. ugFramePrice.DisplayLayout.Bands[0].Columns[i].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  560. this.Controls.Add(uce1);
  561. uce1.Visible = false;
  562. }
  563. }
  564. }
  565. private void LoadFactorInfo_Exp()
  566. {
  567. for (int i = 0; i < ugFramePrice_Exp.DisplayLayout.Bands[0].Columns.Count; i++)
  568. {
  569. string FactorName = ugFramePrice_Exp.DisplayLayout.Bands[0].Columns[i].Header.Caption.ToString();
  570. DataTable FactorInfo = ServerHelper.GetData("com.steering.pss.sale.price.server.CorePriceFramePrice.GetFactorInfo", new object[] { FactorName }, this.ob);
  571. if (FactorInfo != null && FactorInfo.Rows.Count > 0 && FactorInfo.Rows[0]["Table_Name"].ToString() != "")
  572. {
  573. UltraComboEditor uce1 = new UltraComboEditor();
  574. string sql_getFactorBind = "";
  575. string TableName = FactorInfo.Rows[0]["TABLE_NAME"].ToString();
  576. string DataValue = FactorInfo.Rows[0]["COLUMN_KEY"].ToString();
  577. string DataDesc = FactorInfo.Rows[0]["COLUMN_NAME"].ToString();
  578. string sql_getSQL = FactorInfo.Rows[0]["VAL_SQL"].ToString();
  579. DataTable dtFactor = ServerHelper.GetData("com.steering.pss.sale.price.server.CorePriceFramePrice.FactorBind", new object[] { TableName, DataValue, DataDesc, sql_getSQL }, this.ob);
  580. if (dtFactor != null && dtFactor.Rows.Count > 0)
  581. {
  582. Object[] obj = new Object[] { "", "" };
  583. DataRow dr = dtFactor.NewRow();
  584. dr.ItemArray = obj;
  585. dtFactor.Rows.InsertAt(dr, 0);
  586. uce1.DataSource = dtFactor;
  587. uce1.DataMember = "";
  588. uce1.ValueMember = DataValue;
  589. uce1.DisplayMember = DataDesc;
  590. ClsBaseInfo.SetComboItemHeight(uce1);
  591. }
  592. ugFramePrice_Exp.DisplayLayout.Bands[0].Columns[i].EditorComponent = uce1;
  593. ugFramePrice_Exp.DisplayLayout.Bands[0].Columns[i].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  594. this.Controls.Add(uce1);
  595. uce1.Visible = false;
  596. }
  597. }
  598. }
  599. /// <summary>
  600. /// 合并表头函数
  601. /// </summary>
  602. /// <param name="columnName">列名</param>
  603. /// <param name="caption">表头名</param>
  604. /// <param name="x">表头横轴起始点</param>
  605. /// <param name="y">表头纵轴起始点</param>
  606. /// <param name="spanX">横向跨度</param>
  607. /// <param name="spanY">纵向跨度</param>
  608. private void modifyColumn(string columnName, string caption, int x, int y, int spanX, int spanY)
  609. {
  610. // this.ugFramePrice.DisplayLayout.Bands[0].Columns.Add(columnName);
  611. UltraGridColumn GridColumn = this.ugFramePrice.DisplayLayout.Bands[0].Columns[columnName];
  612. GridColumn.Header.Caption = caption;
  613. GridColumn.Header.Appearance.TextVAlign = Infragistics.Win.VAlign.Middle;
  614. GridColumn.Header.Appearance.TextHAlign = Infragistics.Win.HAlign.Center;
  615. GridColumn.RowLayoutColumnInfo.OriginX = x;
  616. GridColumn.RowLayoutColumnInfo.OriginY = y;
  617. GridColumn.RowLayoutColumnInfo.SpanX = spanX;
  618. GridColumn.RowLayoutColumnInfo.SpanY = spanY;
  619. //GridColumn.CellActivation = Activation.Disabled;
  620. GridColumn.RowLayoutColumnInfo.AllowCellSizing = RowLayoutSizing.None;
  621. GridColumn.SortIndicator = SortIndicator.Disabled;
  622. }
  623. /// <summary>
  624. /// 根据Column的 KEY来更改列显示标题
  625. /// </summary>
  626. /// <param name="BR_ID"></param>
  627. /// <param name="colName"></param>
  628. private void ModifyColumnName(string BR_ID, string colName,UltraGrid ug,Boolean bl)
  629. {
  630. // this.ugFramePrice.DisplayLayout.Bands[0].Columns.Add(BR_ID);
  631. UltraGridColumn GridColumn = ug.DisplayLayout.Bands[0].Columns[BR_ID];
  632. GridColumn.Header.Caption = colName;
  633. GridColumn.Hidden = !bl;
  634. }
  635. private void ugFramePrice_Exp_InitializeLayout(object sender, InitializeLayoutEventArgs e)
  636. {
  637. e.Layout.Bands[0].Columns["CHK"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.CheckBox;
  638. e.Layout.Bands[0].Columns["CHK"].Header.Caption = "选择";
  639. e.Layout.Bands[0].Columns["CHK"].DefaultCellValue = false;
  640. }
  641. private void ugFramePrice_Exp_AfterRowInsert(object sender, RowEventArgs e)
  642. {
  643. e.Row.Cells["PRICE_HEAD_ID"].Value = ugFramePrice.ActiveRow.Cells["PRICE_HEAD_ID"].Value.ToString();
  644. string maxId = ugFramePrice_Exp.Rows.AsQueryable().Max(a => a.Cells["PRICE_EXP_ID"].Value.ToString());
  645. if (maxId == "")
  646. {
  647. e.Row.Cells["PRICE_EXP_ID"].Value = "E000001";
  648. }
  649. else
  650. {
  651. string str = "E" + (Convert.ToInt32(maxId.Substring(1, 6)) + 1).ToString().PadLeft(6, '0');
  652. e.Row.Cells["PRICE_EXP_ID"].Value = str;
  653. }
  654. }
  655. private void ugFramePrice_Exp_InitializeRow(object sender, InitializeRowEventArgs e)
  656. {
  657. // e.Row.Cells["Total_Add"].Value = e.Row.Cells["因素一加价"].Value.ToString() + e.Row.Cells["因素二加价"].Value.ToString() + e.Row.Cells["因素三加价"].Value.ToString() + e.Row.Cells["因素四加价"].Value.ToString() + e.Row.Cells["因素五加价"].Value.ToString() + e.Row.Cells["因素六加价"].Value.ToString() + e.Row.Cells["因素七加价"].Value.ToString() + e.Row.Cells["因素八加价"].Value.ToString();
  658. if (e.Row != null)
  659. {
  660. Decimal total_Add = 0;
  661. UltraGridBand ugb = this.ugFramePrice_Exp.DisplayLayout.Bands[0];
  662. if (e.Row.Cells.Exists("因素一加价") == true)
  663. {
  664. total_Add += Convert.ToDecimal(e.Row.Cells["因素一加价"].Value.ToString3());
  665. }
  666. if (e.Row.Cells.Exists("因素二加价") == true)
  667. {
  668. total_Add += Convert.ToDecimal(e.Row.Cells["因素二加价"].Value.ToString3());
  669. }
  670. if (e.Row.Cells.Exists("因素三加价") == true)
  671. {
  672. total_Add += Convert.ToDecimal(e.Row.Cells["因素三加价"].Value.ToString3());
  673. }
  674. if (e.Row.Cells.Exists("因素四加价") == true)
  675. {
  676. total_Add += Convert.ToDecimal(e.Row.Cells["因素四加价"].Value.ToString3());
  677. }
  678. if (e.Row.Cells.Exists("因素五加价") == true)
  679. {
  680. total_Add += Convert.ToDecimal(e.Row.Cells["因素五加价"].Value.ToString3());
  681. }
  682. if (e.Row.Cells.Exists("因素六加价") == true)
  683. {
  684. total_Add += Convert.ToDecimal(e.Row.Cells["因素六加价"].Value.ToString3());
  685. }
  686. if (e.Row.Cells.Exists("因素七加价") == true)
  687. {
  688. total_Add += Convert.ToDecimal(e.Row.Cells["因素七加价"].Value.ToString3());
  689. }
  690. if (e.Row.Cells.Exists("因素八加价") == true)
  691. {
  692. total_Add += Convert.ToDecimal(e.Row.Cells["因素八加价"].Value.ToString3());
  693. }
  694. e.Row.Cells["Total_Add"].Value = total_Add;
  695. }
  696. }
  697. private void ugFramePrice_AfterRowActivate(object sender, EventArgs e)
  698. {
  699. if (ugFramePrice.ActiveRow.Cells["price_head_id"].Value.ToString() != "")
  700. {
  701. string price_head_id = ugFramePrice.ActiveRow.Cells["price_head_id"].Value.ToString();
  702. string isValid= "1";
  703. QueryDataExp(price_head_id, isValid);
  704. }
  705. }
  706. }
  707. }