FrmPurBasePrice.cs 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  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 com.hnshituo.pur.vo;
  10. using Infragistics.Win.UltraWinEditors;
  11. using CoreFS.CA06;using Pur.Entity;
  12. using Core.Mes.Client.Comm.Control;
  13. using Pur.require_plan;
  14. using System.Text.RegularExpressions;
  15. using Pur.Entity;
  16. using Pur.PublicTools;
  17. namespace Pur.Balance
  18. {
  19. public partial class FrmPurBasePrice : FrmPmsBase
  20. {
  21. public FrmPurBasePrice()
  22. {
  23. InitializeComponent();
  24. }
  25. private void FrmPurBasePrice_Load(object sender, EventArgs e)
  26. {
  27. clearEdtArea();
  28. QureyBasePriceM();
  29. DataTable dt = PublicServer.GetData("com.hnshituo.pur.balance.service.impl.FrmBalanceBillManage.QueryAtrr",
  30. null, ob);
  31. if (dt == null || dt.Rows.Count == 0)
  32. {
  33. dataTable2.Rows.Clear();
  34. return;
  35. }
  36. //DataRow dr = dt.NewRow();
  37. //dr[0] = "";
  38. //dt.Rows.InsertAt(dr, 0);
  39. edtGradeLevel.DataSource = dt;
  40. edtGradeLevel.DisplayMember = "ATTR_NAME";
  41. edtGradeLevel.ValueMember = "ATTR_CODE";
  42. }
  43. #region toolbar工具栏
  44. //toolbar工具栏加载
  45. public override void ToolBar_Click(object sender, string ToolBarKey)
  46. {
  47. switch (ToolBarKey)
  48. {
  49. case "Query"://查询基价标准主表数据
  50. QureyBasePriceM();
  51. //GetQueryPhysicWH();
  52. break;
  53. case "Add"://增加基价标准主表
  54. AddBasePriceM();
  55. break;
  56. case "Update"://修改基价标准主表
  57. EditBasePriceM();
  58. break;
  59. case "Delete"://删除基价标准主表
  60. DeleteBasePriceM();
  61. break;
  62. case "AddBasePriceC": //新增基价标准明细表
  63. AddBasePriceC();
  64. break;
  65. case "UpdateBasePriceC"://修改基价标准明细表
  66. EditBasePriceC();
  67. break;
  68. case "DeleteBasePriceC"://删除基价标准明细表
  69. DeleteBasePriceC();
  70. break;
  71. case "Close"://关闭窗口
  72. this.Close();
  73. break;
  74. }
  75. }
  76. #endregion
  77. #region 数据库操作
  78. /// <summary>
  79. /// 删除一条明细
  80. /// </summary>
  81. private void DeleteBasePriceC()
  82. {
  83. try
  84. {
  85. //判断是否获取到焦点
  86. if (ultraGrid2.ActiveRow != null)
  87. {
  88. string oldstrid = ultraGrid2.ActiveRow.Cells["id"].Value.ToString().Trim();
  89. string oldstrstandid = ultraGrid2.ActiveRow.Cells["standId"].Value.ToString().Trim();
  90. //提示是否需要修改
  91. if (MessageBox.Show("将修改明细表ID为[" + oldstrid + "]的信息?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
  92. {
  93. //构建实体类
  94. BalanceBasepriceC pc = new BalanceBasepriceC();
  95. pc.Validflag = "1";
  96. pc.Id = oldstrid;
  97. pc.DeleteName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  98. pc.DeleteTime = DateTime.Now;
  99. pc.DeleteUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
  100. //调用服务接口
  101. CoreResult re = this.execute<CoreResult>("com.hnshituo.pur.balance.service.BalanceBasepriceCService", "doDeteleBasePriceC", new object[] { pc });
  102. if (re.Resultcode == 0)
  103. {
  104. //DataTable tempData = (DataTable)re.Resultdata;
  105. //GridHelper.CopyDataToDatatable(ref re.Resultdata, ref dataTable1, true);
  106. MessageBox.Show("删除成功", "提示");
  107. QureyBasePriceM();
  108. BalanceClassCommon.doActiveSelRow(ultraGrid1, "id", oldstrstandid);
  109. }
  110. else
  111. {
  112. MessageBox.Show("操作失败:" + re.Resultmsg, "提示");
  113. return;
  114. }
  115. }
  116. }
  117. else
  118. {
  119. MessageBox.Show("操作失败:请选择需修改的基价标准行", "提示");
  120. return;
  121. }
  122. }
  123. catch (Exception ex)
  124. {
  125. MessageBox.Show("操作失败:" + ex.Message, "提示");
  126. }
  127. }
  128. private void EditBasePriceC()
  129. {
  130. try
  131. {
  132. //判断是否获取到焦点
  133. if (ultraGrid2.ActiveRow != null)
  134. {
  135. string oldstrid = ultraGrid2.ActiveRow.Cells["id"].Value.ToString().Trim();
  136. string oldstrstandid = ultraGrid2.ActiveRow.Cells["standId"].Value.ToString().Trim();
  137. //获取编辑框信息
  138. string strid = edtIdC.Text.ToString().Trim();
  139. string strgradelevel = edtGradeLevel.Text== null ? "" : edtGradeLevel.Text.ToString().Trim();
  140. string strgradevalue = edtGradeLevel.Value == null ? "" : edtGradeLevel.Value.ToString().Trim();
  141. string strpriceval = edtPriceValue.Text.ToString().Trim();
  142. string strremark = edtRemarkC.Text.ToString().Trim();
  143. string oldversionno = edtVersionNo.Text.ToString().Trim();
  144. //获取版本号后五位:
  145. int oldversionno1 = Convert.ToInt32(oldversionno.Remove(0, oldversionno.Length - 4));
  146. int newversionno = oldversionno1 + 1;
  147. // string strversionno = oldversionno.Substring(0, strversionno.Length - 5) + newversionno.ToString();
  148. //校验编辑框信息
  149. if (string.IsNullOrEmpty(strid))
  150. {
  151. MessageBox.Show("操作失败:ID不能为空", "提示");
  152. edtIdC.Focus();
  153. return;
  154. }
  155. if (string.IsNullOrEmpty(strgradelevel) || string.IsNullOrEmpty(strgradevalue))
  156. {
  157. MessageBox.Show("操作失败:请选择品位级别", "提示");
  158. edtGradeLevel.Focus();
  159. return;
  160. }
  161. if (string.IsNullOrEmpty(strpriceval) )
  162. {
  163. MessageBox.Show("操作失败:计价值不能为空", "提示");
  164. edtPriceValue.Focus();
  165. return;
  166. }
  167. if (!Isdecimal(strpriceval))
  168. {
  169. MessageBox.Show("操作失败:计价值需为有效数字", "提示");
  170. edtPriceValue.Focus();
  171. return;
  172. }
  173. if (newversionno>9999)
  174. {
  175. MessageBox.Show("操作失败:该ID的版本号已用完,请联系管理员", "提示");
  176. return;
  177. }
  178. if (string.IsNullOrEmpty(oldversionno))
  179. {
  180. MessageBox.Show("操作失败:获取的版本号出错", "提示");
  181. return;
  182. }
  183. //提示是否需要修改
  184. if (MessageBox.Show("将修改明细表ID为[" + strid + "]的信息?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
  185. {
  186. //构建实体类
  187. BalanceBasepriceC pc= new BalanceBasepriceC();
  188. pc.Id = strid;
  189. pc.VersionNo = oldversionno;
  190. pc.GradeLevel = strgradelevel;
  191. pc.GradeValue = strgradevalue;
  192. pc.Remark = strremark;
  193. pc.Validflag = "1";
  194. pc.PriceVal = strpriceval;
  195. pc.UpdateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  196. pc.UpdateTime = DateTime.Now;
  197. pc.UpdateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
  198. //调用服务接口
  199. CoreResult re = this.execute<CoreResult>("com.hnshituo.pur.balance.service.BalanceBasepriceCService", "doUpdateBasePriceC", new object[] { pc });
  200. if (re.Resultcode == 0)
  201. {
  202. //DataTable tempData = (DataTable)re.Resultdata;
  203. //GridHelper.CopyDataToDatatable(ref re.Resultdata, ref dataTable1, true);
  204. MessageBox.Show("修改成功", "提示");
  205. QureyBasePriceM();
  206. BalanceClassCommon.doActiveSelRow(ultraGrid1, "id", oldstrid);
  207. BalanceClassCommon.doActiveSelRow(ultraGrid2, "id", strid);
  208. }
  209. else
  210. {
  211. MessageBox.Show("操作失败:" + re.Resultmsg, "提示");
  212. return;
  213. }
  214. }
  215. }
  216. else
  217. {
  218. MessageBox.Show("操作失败:请选择需修改的基价标准明细行", "提示");
  219. return;
  220. }
  221. }
  222. catch (Exception ex)
  223. {
  224. MessageBox.Show("操作失败:" + ex.Message, "提示");
  225. }
  226. }
  227. private void AddBasePriceC()
  228. {
  229. try
  230. {
  231. //判断是否获取到焦点
  232. if (ultraGrid1.ActiveRow != null)
  233. {
  234. string strstandid = ultraGrid1.ActiveRow.Cells["id"].Value.ToString().Trim();
  235. //获取编辑框信息
  236. string strgradelevel = edtGradeLevel.Text == null ? "" : edtGradeLevel.Text.ToString().Trim();
  237. string strgradevalue = edtGradeLevel.Value == null ? "" : edtGradeLevel.Value.ToString().Trim();
  238. string strpriceval = edtPriceValue.Text.ToString().Trim();
  239. string strremark = edtRemark.Text.ToString().Trim();
  240. string versionno = strstandid+"0001";
  241. //校验编辑框信息
  242. if (string.IsNullOrEmpty(strstandid))
  243. {
  244. MessageBox.Show("操作失败:请选择需要新增明细的基价标准行", "提示");
  245. EdtstandId.Focus();
  246. return;
  247. }
  248. if (string.IsNullOrEmpty(strgradelevel) || string.IsNullOrEmpty(strgradevalue))
  249. {
  250. MessageBox.Show("操作失败:请选择品位级别", "提示");
  251. edtGradeLevel.Focus();
  252. return;
  253. }
  254. if (string.IsNullOrEmpty(strpriceval))
  255. {
  256. MessageBox.Show("操作失败:计价值不能为空", "提示");
  257. edtPriceValue.Focus();
  258. return;
  259. }
  260. if (!Isdecimal(strpriceval))
  261. {
  262. MessageBox.Show("操作失败:计价值需为有效数字", "提示");
  263. edtPriceValue.Focus();
  264. return;
  265. }
  266. if (string.IsNullOrEmpty(versionno))
  267. {
  268. MessageBox.Show("操作失败:生成的版本号出错", "提示");
  269. edtVersionNo.Focus();
  270. return;
  271. }
  272. //提示是否需要修改
  273. if (MessageBox.Show("将为ID[" + strstandid + "]的基价标准新增一条明细信息?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
  274. {
  275. //构建实体类
  276. BalanceBasepriceC pc = new BalanceBasepriceC();
  277. pc.VersionNo = versionno;
  278. pc.StandId = strstandid;
  279. pc.GradeLevel = strgradelevel;
  280. pc.GradeValue = strgradevalue;
  281. pc.Remark = strremark;
  282. pc.Validflag = "1";
  283. pc.PriceVal = strpriceval;
  284. pc.CreateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  285. pc.CreateTime = DateTime.Now;
  286. pc.CreateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
  287. //调用服务接口
  288. CoreResult re = this.execute<CoreResult>("com.hnshituo.pur.balance.service.BalanceBasepriceCService", "doAddBasePriceC", new object[] { pc });
  289. if (re.Resultcode == 0)
  290. {
  291. //DataTable tempData = (DataTable)re.Resultdata;
  292. //GridHelper.CopyDataToDatatable(ref re.Resultdata, ref dataTable1, true);
  293. MessageBox.Show("新增成功", "提示");
  294. QureyBasePriceM();
  295. BalanceClassCommon.doActiveSelRow(ultraGrid1, "id", strstandid);
  296. BalanceClassCommon.doActiveSelRow(ultraGrid2, "versionNo", versionno);
  297. }
  298. else
  299. {
  300. MessageBox.Show("操作失败:" + re.Resultmsg, "提示");
  301. return;
  302. }
  303. }
  304. }
  305. else
  306. {
  307. MessageBox.Show("操作失败:请选择需新增的基价标准行", "提示");
  308. return;
  309. }
  310. }
  311. catch (Exception ex)
  312. {
  313. MessageBox.Show("操作失败:" + ex.Message, "提示");
  314. }
  315. }
  316. /// <summary>
  317. /// 删除一条基价标准主表行信息
  318. /// </summary>
  319. private void DeleteBasePriceM()
  320. {
  321. try
  322. {
  323. //判断是否获取到焦点
  324. if (ultraGrid1.ActiveRow != null)
  325. {
  326. string oldstrname = ultraGrid1.ActiveRow.Cells["name"].Value.ToString().Trim();
  327. string oldstrid = ultraGrid1.ActiveRow.Cells["id"].Value.ToString().Trim();
  328. string oldstritemcode = ultraGrid1.ActiveRow.Cells["itemCode"].Value.ToString().Trim();
  329. //提示是否需要修改
  330. if (MessageBox.Show("将删除名称为[" + oldstrname + "]的基价标准信息?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
  331. {
  332. //构建实体类
  333. BalanceBasepriceM pm = new BalanceBasepriceM();
  334. pm.Validflag = "0";
  335. pm.Id = oldstrid;
  336. pm.ItemCode = oldstritemcode;
  337. pm.DeleteName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  338. pm.DeleteTime = DateTime.Now;
  339. pm.DeleteUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
  340. //调用服务接口
  341. CoreResult re = this.execute<CoreResult>("com.hnshituo.pur.balance.service.BalanceBasepriceMService", "doUpdateBasePriceM", new object[] { pm });
  342. if (re.Resultcode == 0)
  343. {
  344. //DataTable tempData = (DataTable)re.Resultdata;
  345. //GridHelper.CopyDataToDatatable(ref re.Resultdata, ref dataTable1, true);
  346. MessageBox.Show("删除成功", "提示");
  347. QureyBasePriceM();
  348. }
  349. else
  350. {
  351. MessageBox.Show("操作失败:" + re.Resultmsg, "提示");
  352. return;
  353. }
  354. }
  355. }
  356. else
  357. {
  358. MessageBox.Show("操作失败:请选择需修改的基价标准行", "提示");
  359. return;
  360. }
  361. }
  362. catch (Exception ex)
  363. {
  364. MessageBox.Show("操作失败:" + ex.Message, "提示");
  365. }
  366. }
  367. /// <summary>
  368. /// 编辑基价标准行信息
  369. /// </summary>
  370. private void EditBasePriceM()
  371. {
  372. try
  373. {
  374. //判断是否获取到焦点
  375. if (ultraGrid1.ActiveRow != null)
  376. {
  377. string oldstrid = ultraGrid1.ActiveRow.Cells["id"].Value.ToString().Trim();
  378. string oldstrname = ultraGrid1.ActiveRow.Cells["name"].Value.ToString().Trim();
  379. //获取编辑框信息
  380. string strname = edtName.Text.ToString().Trim();
  381. string stritemCode = edtItemCode.Text.ToString().Trim();
  382. String stritemAttrId = edtItemAttrId.Text.ToString().Trim();
  383. string strremark = edtRemark.Text.ToString().Trim();
  384. //校验编辑框信息
  385. if (string.IsNullOrEmpty(strname))
  386. {
  387. MessageBox.Show("操作失败:名称不能为空", "提示");
  388. edtName.Focus();
  389. return;
  390. }
  391. if (string.IsNullOrEmpty(stritemCode))
  392. {
  393. MessageBox.Show("操作失败:请选择物料", "提示");
  394. edtItemCode.Focus();
  395. return;
  396. }
  397. //提示是否需要修改
  398. if (MessageBox.Show("将修改ID为[" + oldstrid + "]的基价标准信息?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
  399. {
  400. //构建实体类
  401. BalanceBasepriceM pm = new BalanceBasepriceM();
  402. pm.Id = oldstrid;
  403. pm.Name = strname;
  404. pm.ItemCode = stritemCode;
  405. pm.ItemAttrId = stritemAttrId;
  406. pm.Remark = strremark;
  407. pm.Validflag = "1";
  408. pm.UpdateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  409. pm.UpdateTime = DateTime.Now;
  410. pm.UpdateUserid= CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
  411. //调用服务接口
  412. CoreResult re = this.execute<CoreResult>("com.hnshituo.pur.balance.service.BalanceBasepriceMService", "doUpdateBasePriceM", new object[] { pm });
  413. if (re.Resultcode == 0)
  414. {
  415. //DataTable tempData = (DataTable)re.Resultdata;
  416. //GridHelper.CopyDataToDatatable(ref re.Resultdata, ref dataTable1, true);
  417. MessageBox.Show("修改成功", "提示");
  418. QureyBasePriceM();
  419. BalanceClassCommon.doActiveSelRow(ultraGrid1, "id", oldstrid);
  420. }
  421. else
  422. {
  423. MessageBox.Show("操作失败:" + re.Resultmsg, "提示");
  424. return;
  425. }
  426. }
  427. }
  428. else
  429. {
  430. MessageBox.Show("操作失败:请选择需修改的基价标准行", "提示");
  431. return;
  432. }
  433. }
  434. catch (Exception ex)
  435. {
  436. MessageBox.Show("操作失败:" + ex.Message, "提示");
  437. }
  438. }
  439. /// <summary>
  440. /// 新增一条基价标准主表行信息
  441. /// </summary>
  442. private void AddBasePriceM()
  443. {
  444. try
  445. {
  446. //获取编辑框信息
  447. string strname = edtName.Text.ToString().Trim();
  448. string stritemCode = edtItemCode.Text.ToString().Trim();
  449. String stritemAttrId = edtItemAttrId.Text.ToString().Trim();
  450. string strremark = edtRemark.Text.ToString().Trim();
  451. //校验编辑框信息
  452. if (string.IsNullOrEmpty(strname))
  453. {
  454. MessageBox.Show("操作失败:名称不能为空", "提示");
  455. edtName.Focus();
  456. return;
  457. }
  458. if (string.IsNullOrEmpty(stritemCode))
  459. {
  460. MessageBox.Show("操作失败:请选择物料", "提示");
  461. edtItemCode.Focus();
  462. return;
  463. }
  464. //构建实体类
  465. BalanceBasepriceM pm = new BalanceBasepriceM();
  466. pm.Name = strname;
  467. pm.ItemName = strname;
  468. pm.ItemCode = stritemCode;
  469. pm.ItemAttrId = stritemAttrId;
  470. pm.Remark = strremark;
  471. pm.Validflag = "1";
  472. pm.CreateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  473. pm.CreateTime = DateTime.Now;
  474. pm.CreateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
  475. pm.DepartId = this.UserInfo.GetDeptid();
  476. pm.EffectiveTime = DateTime.Now;
  477. //调用服务接口
  478. CoreResult re = this.execute<CoreResult>("com.hnshituo.pur.balance.service.BalanceBasepriceMService", "doAddBasePriceM", new object[] { pm });
  479. if (re.Resultcode== 0)
  480. {
  481. //DataTable tempData = (DataTable)re.Resultdata;
  482. //GridHelper.CopyDataToDatatable(ref re.Resultdata, ref dataTable1, true);
  483. MessageBox.Show("新增成功", "提示");
  484. QureyBasePriceM();
  485. BalanceClassCommon.doActiveSelRow(ultraGrid1, "name", strname);
  486. }
  487. else
  488. {
  489. MessageBox.Show("操作失败:" + re.Resultmsg, "提示");
  490. return;
  491. }
  492. }
  493. catch (Exception ex)
  494. {
  495. MessageBox.Show("操作失败:" + ex.Message, "提示");
  496. }
  497. }
  498. /// <summary>
  499. /// 查询主表数据
  500. /// </summary>
  501. private void QureyBasePriceM()
  502. {
  503. try
  504. {
  505. //获取查询框数据
  506. string strid = QId.Text.ToString().Trim();
  507. string strname = Qname.Text.ToString().Trim();
  508. //构建查询实体类
  509. BalanceBasepriceM pm = new BalanceBasepriceM();
  510. pm.Id = strid;
  511. pm.ItemName = strname;
  512. //调用服务器查询API进行查询
  513. DataTable re = this.execute<DataTable>("com.hnshituo.pur.balance.service.BalanceBasepriceMService", "doQureyBasePriceM", new object[] { pm });
  514. GridHelper.CopyDataToDatatable(ref re, ref dataTable1, true);
  515. }
  516. catch (Exception ex)
  517. {
  518. MessageBox.Show("操作失败:"+ex.Message, "提示");
  519. }
  520. }
  521. #endregion
  522. #region 页面点击事件
  523. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  524. {
  525. try
  526. {
  527. //加载数据到编辑区
  528. string strid = ultraGrid1.ActiveRow.Cells["id"].Value.ToString().Trim();
  529. string strname = ultraGrid1.ActiveRow.Cells["name"].Value.ToString().Trim();
  530. string stritemCode = ultraGrid1.ActiveRow.Cells["itemCode"].Value.ToString().Trim();
  531. string stritemName = ultraGrid1.ActiveRow.Cells["itemName"].Value.ToString().Trim();
  532. string strremark = ultraGrid1.ActiveRow.Cells["remark"].Value.ToString().Trim();
  533. string stritemAttr = ultraGrid1.ActiveRow.Cells["itemAttr"].Value.ToString().Trim();
  534. string stritemAttrId = ultraGrid1.ActiveRow.Cells["itemAttrId"].Value.ToString().Trim();
  535. edtId.Text = strid;
  536. edtName.Text = strname;
  537. edtItemCode.Text = stritemCode;
  538. edtItemName.Text = stritemName;
  539. edtRemark.Text = strremark;
  540. edtItemAttr.Text = stritemAttr;
  541. edtItemAttrId.Text = stritemAttrId;
  542. //点击主表加载从表
  543. if (string.IsNullOrEmpty(strid))
  544. {
  545. MessageBox.Show("操作失败:获取的ID为空", "提示");
  546. }
  547. //构建实体类
  548. BalanceBasepriceC pc = new BalanceBasepriceC();
  549. pc.StandId = strid;
  550. pc.Validflag = "1";
  551. //调用服务器查询API进行查询
  552. DataTable re = this.execute<DataTable>("com.hnshituo.pur.balance.service.BalanceBasepriceCService", "doQureyBasePriceC", new object[] { pc });
  553. GridHelper.CopyDataToDatatable(ref re, ref dataTable2, true);
  554. }
  555. catch (Exception ex)
  556. {
  557. MessageBox.Show("操作失败:" + ex.Message, "提示");
  558. }
  559. }
  560. private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
  561. {
  562. try
  563. {
  564. //加载数据到编辑区
  565. string strid = ultraGrid2.ActiveRow.Cells["id"].Value.ToString().Trim();
  566. string strversionno = ultraGrid2.ActiveRow.Cells["versionNo"].Value.ToString().Trim();
  567. string strgradeLevel = ultraGrid2.ActiveRow.Cells["gradeLevel"].Value.ToString().Trim();
  568. string strpriceVal = ultraGrid2.ActiveRow.Cells["priceVal"].Value.ToString().Trim();
  569. string strremark = ultraGrid2.ActiveRow.Cells["remark"].Value.ToString().Trim();
  570. string strstandId = ultraGrid2.ActiveRow.Cells["standId"].Value.ToString().Trim();
  571. edtIdC.Text = strid;
  572. edtRemarkC.Text = strremark;
  573. edtVersionNo.Text = strversionno;
  574. edtGradeLevel.Text = strgradeLevel;
  575. edtPriceValue.Text = strpriceVal;
  576. EdtstandId.Text = strstandId;
  577. }
  578. catch (Exception ex)
  579. {
  580. MessageBox.Show("操作失败:" + ex.Message, "提示");
  581. }
  582. }
  583. private void clearEdtArea()
  584. {
  585. foreach (Control ctr in ultraTabControl1.Controls)
  586. {
  587. if (ctr is Label)
  588. { continue; }
  589. if (ctr is UltraCheckEditor)
  590. {
  591. UltraCheckEditor ultcmb = (UltraCheckEditor)ctr;
  592. // ultChkSuppUon.Checked = false;
  593. }
  594. ctr.Text = null;
  595. }
  596. }
  597. private void edtItemName_EditorButtonClick(object sender, EditorButtonEventArgs e)
  598. {
  599. FrmPurPlanMat matfrm = new FrmPurPlanMat(this.ob);
  600. matfrm.ShowDialog();
  601. string strmatcode = matfrm.getItemCode();
  602. string strmatname = matfrm.getItemName();
  603. string stritemAttr = matfrm.ItemAttr;
  604. string stritemAttrId = matfrm.ItemAttrId;
  605. edtItemCode.Text = strmatcode;
  606. edtItemName.Text = strmatname;
  607. edtItemAttr.Text = stritemAttr;
  608. edtItemAttrId.Text = stritemAttrId;
  609. }
  610. private void ultraGrid1_AfterCellActivate(object sender, EventArgs e)
  611. {
  612. ultraTabControl1.SelectedTab = ultraTabControl1.Tabs[0];
  613. }
  614. private void ultraGrid2_AfterCellActivate(object sender, EventArgs e)
  615. {
  616. ultraTabControl1.SelectedTab = ultraTabControl1.Tabs[1];
  617. }
  618. #endregion
  619. #region 正则表达式
  620. public bool Isdecimal(string str)
  621. {
  622. decimal y;
  623. return decimal.TryParse(str,out y);
  624. }
  625. public bool IsInts(string str)
  626. {
  627. int y ;
  628. return int.TryParse(str, out y);
  629. }
  630. #endregion
  631. }
  632. }