FrmFGPriceMainTain.cs 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301
  1. using com.hnshituo.pur.vo;
  2. using Core.Mes.Client.Comm.Control;
  3. using Core.Mes.Client.Comm.Tool;
  4. using Infragistics.Win.UltraWinGrid;
  5. using Pur.Entity;
  6. using Pur.Entity.configureEntity;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.ComponentModel;
  10. using System.Data;
  11. using System.Drawing;
  12. using System.Linq;
  13. using System.Text;
  14. using System.Windows.Forms;
  15. using Pur.ck;
  16. using CoreFS.CA06;
  17. using Pur.Pop_upWindow;
  18. using System.Collections;
  19. using Core.Mes.Client.Comm.Server;
  20. using Infragistics.Win.UltraWinEditors;
  21. namespace Pur.Balance
  22. {
  23. public partial class FrmFGPriceMainTain : FrmPmsBase
  24. {
  25. String fileName = "";//附件上传
  26. public string strPriceId="";
  27. public string strPriceName = "";
  28. public string tips = "0";
  29. public String strViewType = "";
  30. public FrmFGPriceMainTain()
  31. {
  32. InitializeComponent();
  33. }
  34. public FrmFGPriceMainTain(OpeBase OB)
  35. {
  36. InitializeComponent();
  37. this.ob = OB;
  38. ultraExpandableGroupBox1.Visible = true;
  39. }
  40. private void FrmFGPriceMainTain_Load(object sender, EventArgs e)
  41. {
  42. strViewType="";
  43. if(!String.IsNullOrEmpty(this.CustomInfo))
  44. {
  45. strViewType = this.CustomInfo;//1:提报界面,2,审核界面 其它:弹出框界面
  46. }
  47. if (strViewType == "2")
  48. {
  49. txt_status.Value = "1";
  50. GridHelper.SetExcludeColumnsActive(ultraGrid1.DisplayLayout.Bands[0], new string[] { });
  51. GridHelper.SetExcludeColumnsActive(ultraGrid3.DisplayLayout.Bands[0], new string[] { "EVAMSG" });
  52. GridHelper.HidenColumns(ultraGrid3.DisplayLayout.Bands[0], new string[] { "EVARESULT" });
  53. GridHelper.SetExcludeColumnsActive(ultraGrid2.DisplayLayout.Bands[0], new string[] { "priceVal", "priceVal1" });
  54. //ultraExpandableGroupBox1.Visible = false;
  55. }
  56. else if (strViewType == "1")
  57. {
  58. txt_status.SelectedIndex=0;
  59. GridHelper.SetExcludeColumnsActive(ultraGrid1.DisplayLayout.Bands[0], new string[] { });
  60. GridHelper.SetExcludeColumnsActive(ultraGrid3.DisplayLayout.Bands[0], new string[] { });
  61. GridHelper.SetExcludeColumnsActive(ultraGrid2.DisplayLayout.Bands[0], new string[] { "priceVal", "priceVal1" });
  62. }
  63. else
  64. {
  65. txt_remark.Enabled = false;
  66. txt_status.Value = "2";
  67. GridHelper.SetExcludeColumnsActive(ultraGrid1.DisplayLayout.Bands[0], new string[] { });
  68. GridHelper.SetExcludeColumnsActive(ultraGrid3.DisplayLayout.Bands[0], new string[] { });
  69. GridHelper.SetExcludeColumnsActive(ultraGrid2.DisplayLayout.Bands[0], new string[] { });
  70. }
  71. GridHelper.SetExcludeColumnsActive(ultraGrid4.DisplayLayout.Bands[0], new string[] { "CERTPATH" });
  72. ultraExpandableGroupBox1.Expanded = false;
  73. ultraExpandableGroupBox2.Expanded = false;
  74. ultraExpandableGroupBox3.Expanded = false;
  75. ultraExpandableGroupBox5.Expanded = false;
  76. ultraExpandableGroupBox4.Expanded = true;
  77. txt_createTimeBegin.Value = DateTime.Now.AddMonths(-2);
  78. txt_createTimeEnd.Value = DateTime.Now.AddDays(2);
  79. txt_createTimeBegin.Enabled = true;
  80. txt_createTimeEnd.Enabled = true;
  81. ck_createT.Checked = true;
  82. ex_fujian.Expanded = false;
  83. ex_yijian.Expanded = false;
  84. QureyBasePriceM("");//查询
  85. }
  86. #region 维护界面toolbar
  87. /// <summary>
  88. /// 维护界面toolbar
  89. /// </summary>
  90. /// <param name="sender"></param>
  91. /// <param name="ToolbarKey"></param>
  92. public override void ToolBar_Click(object sender, string ToolbarKey)
  93. {
  94. switch (ToolbarKey)
  95. {
  96. case "doQuery":
  97. QureyBasePriceM("");
  98. break;
  99. case "doAdd":
  100. AddBasePriceM();
  101. break;
  102. case "doEffect":
  103. doEffect();//提报
  104. break;
  105. case "doSure":
  106. doSure();//审核
  107. break;
  108. case "Save":
  109. saveFrmFGPriceMainTain();
  110. break;
  111. case "doDelete":
  112. DeleteBasePriceM();
  113. break;
  114. case "doExcel":
  115. doExcel();
  116. break;
  117. case "Close":
  118. this.Close();
  119. break;
  120. }
  121. }
  122. /// <summary>
  123. /// 审核
  124. /// </summary>
  125. private void doSure()
  126. {
  127. if (ultraGrid1.ActiveRow == null)
  128. {
  129. MessageUtil.ShowTips("请选择待审核的价格政策");
  130. return;
  131. }
  132. string oldstrname = ultraGrid1.ActiveRow.Cells["name"].Value.ToString().Trim();
  133. string oldstrid = ultraGrid1.ActiveRow.Cells["id"].Value.ToString().Trim();
  134. string oldstritemcode = ultraGrid1.ActiveRow.Cells["itemCode"].Value.ToString().Trim();
  135. if (testPriceMStatus(oldstrid, 4) == false)
  136. {
  137. return;
  138. }
  139. ArrayList List1 = new ArrayList();//评标人意见
  140. ultraGrid3.UpdateData();
  141. int num = 0;
  142. foreach (UltraGridRow row in ultraGrid3.Rows)
  143. {
  144. if (UserInfo.GetUserName() == row.Cells["EVAUSERNAME"].Text.ToString())
  145. {
  146. BalanceEvaUsers taskEva = new BalanceEvaUsers();
  147. taskEva.StandId = oldstrid;
  148. taskEva.Validflag = "1";
  149. taskEva.EvaMsg = row.GetCellValue("EvaMsg").ToString().Trim();
  150. taskEva.EvaResult = "1";//默认同意
  151. taskEva.EvaId = row.GetCellValue("EvaId").ToString().Trim();
  152. taskEva.UpdateUserId = UserInfo.GetUserID();
  153. taskEva.UpdateName = UserInfo.GetUserName();
  154. taskEva.UpdateTime = DateTime.Now;
  155. if (taskEva.EvaId == "")
  156. {
  157. MessageUtil.ShowTips("评审意见表第" + row.Index + "行的编号为空!");
  158. row.Activate();
  159. return;
  160. }
  161. List1.Add(taskEva);
  162. }
  163. num += 1;
  164. }
  165. if (List1.Count <= 0)
  166. {
  167. MessageUtil.ShowTips("无评审人员");
  168. return;
  169. }
  170. if (MessageUtil.ShowYesNoAndQuestion("确定审核通过价格政策:" + oldstrname + "?") != DialogResult.Yes)
  171. {
  172. return;
  173. }
  174. CoreResult re = this.execute<CoreResult>("com.hnshituo.pur.balance.service.BalanceBasepriceMService", "doSurePriceM", new object[] { List1,num});
  175. if (re.Resultcode == 0)
  176. {
  177. MessageUtil.ShowTips("操作成功");
  178. QureyBasePriceM(oldstrid);
  179. CkClassCommon.doActiveSelRow(ultraGrid1, "id", oldstrid);
  180. }
  181. else
  182. {
  183. MessageUtil.ShowTips("操作失败:" + re.Resultmsg);
  184. }
  185. }
  186. /// <summary>
  187. /// 导出价格政策
  188. /// </summary>
  189. private void doExcel()
  190. {
  191. try
  192. {
  193. this.Cursor = Cursors.Default;
  194. if (ultraGrid1.ActiveRow == null)
  195. {
  196. MessageUtil.ShowTips("请选择需导出明细的价格政策!");
  197. return;
  198. }
  199. //获取导出的采购计划行表
  200. ArrayList alUltraGrid = new ArrayList();
  201. alUltraGrid.Add(ultraGrid2);
  202. alUltraGrid.Add(ultraGrid3);
  203. alUltraGrid.Add(ultraGrid1);
  204. ArrayList alSheeft = new ArrayList();
  205. alSheeft.Add("价格政策明细");
  206. alSheeft.Add("价格政策评审明细");
  207. alSheeft.Add("价格政策清单");
  208. if (ultraGrid2.Rows.Count > 0)
  209. {
  210. GridHelper.ulGridToExcel(alUltraGrid, alSheeft, "价格政策[" + ultraGrid1.ActiveRow.GetCellValue("name") + "]明细表");//导出excel
  211. }
  212. else
  213. {
  214. MessageUtil.ShowTips("价格政策:" + ultraGrid1.ActiveRow.GetCellValue("name") + "无可导出明细!");
  215. }
  216. }
  217. catch (Exception e)
  218. {
  219. MessageUtil.ShowTips("导出失败" + e.Message);
  220. }
  221. finally
  222. {
  223. this.Cursor = Cursors.Default;
  224. }
  225. }
  226. /// <summary>
  227. /// 查询
  228. /// </summary>
  229. private void QureyBasePriceM(String strId)
  230. {
  231. try
  232. {
  233. this.Cursor = Cursors.WaitCursor;
  234. basepriceC.Clear();
  235. basepriceM.Clear();
  236. clearTab();
  237. BalanceBasepriceM pm = new BalanceBasepriceM();
  238. pm.Name = Qname.Text.Trim();
  239. pm.ItemName = QitemName.Text.Trim();
  240. if (txt_status.SelectedIndex != -1)
  241. {
  242. pm.Flag = txt_status.Value.ToString().Trim();
  243. }
  244. if (strViewType != "2")//提报界面
  245. {
  246. pm.DepartId = UserInfo.GetDeptid();
  247. }
  248. if (ck_createT.Checked == true)
  249. {
  250. if (txt_createTimeBegin.Text != "")
  251. {
  252. pm.CreateTime = Convert.ToDateTime(txt_createTimeBegin.Value);
  253. }
  254. if (txt_createTimeEnd.Text != "")
  255. {
  256. pm.DeleteTime = Convert.ToDateTime(txt_createTimeEnd.Value);
  257. }
  258. }
  259. DataTable re = this.execute<DataTable>("com.hnshituo.pur.balance.service.BalanceBasepriceMService", "doQureyBasePriceM", new object[] { pm });
  260. GridHelper.CopyDataToDatatable(re, dataTable1, true);
  261. GridHelper.RefreshAndAutoSize(ultraGrid1);
  262. if (String.IsNullOrEmpty(strId))
  263. {
  264. PublicTools.publicPms.doActiveSelRow(ultraGrid1, "id", strId);
  265. }
  266. }
  267. finally
  268. {
  269. this.Cursor = Cursors.Default;
  270. }
  271. }
  272. /// <summary>
  273. /// 生效
  274. /// </summary>
  275. private void doEffect()
  276. {
  277. if (ultraGrid1.ActiveRow == null)
  278. {
  279. MessageUtil.ShowTips("请选择待提报的价格政策");
  280. return;
  281. }
  282. string oldstrname = ultraGrid1.ActiveRow.Cells["name"].Value.ToString().Trim();
  283. string oldstrid = ultraGrid1.ActiveRow.Cells["id"].Value.ToString().Trim();
  284. string oldstritemcode = ultraGrid1.ActiveRow.Cells["itemCode"].Value.ToString().Trim();
  285. if (testPriceMStatus(oldstrid, 1) == false)
  286. {
  287. return;
  288. }
  289. if (MessageUtil.ShowYesNoAndQuestion("确定提报价格政策:" + oldstrname + "?") != DialogResult.Yes)
  290. {
  291. return;
  292. }
  293. CoreResult re = this.execute<CoreResult>("com.hnshituo.pur.balance.service.BalanceBasepriceMService", "doEffectPriceM", new object[] { oldstrid });
  294. if (re.Resultcode == 0)
  295. {
  296. MessageUtil.ShowTips("操作成功");
  297. QureyBasePriceM(oldstrid);
  298. CkClassCommon.doActiveSelRow(ultraGrid1, "id", oldstrid);
  299. }
  300. else
  301. {
  302. MessageUtil.ShowTips("操作失败:" + re.Resultmsg);
  303. }
  304. }
  305. /// <summary>
  306. /// 删除
  307. /// </summary>
  308. private void DeleteBasePriceM()
  309. {
  310. if (ultraGrid1.ActiveRow == null)
  311. {
  312. MessageUtil.ShowTips("请选择待删除的价格政策");
  313. return;
  314. }
  315. string oldstrname = ultraGrid1.ActiveRow.Cells["name"].Value.ToString().Trim();
  316. string oldstrid = ultraGrid1.ActiveRow.Cells["id"].Value.ToString().Trim();
  317. string oldstritemcode = ultraGrid1.ActiveRow.Cells["itemCode"].Value.ToString().Trim();
  318. //构建实体类
  319. BalanceBasepriceM pm = new BalanceBasepriceM();
  320. pm.Validflag = "0";
  321. pm.Id = oldstrid;
  322. pm.ItemCode = oldstritemcode;
  323. pm.DeleteName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  324. pm.DeleteTime = DateTime.Now;
  325. pm.DeleteUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
  326. if (testPriceMStatus(oldstrid, 2) == false)
  327. {
  328. return;
  329. }
  330. //调用服务接口
  331. if (MessageUtil.ShowYesNoAndQuestion("确定删除价格政策:" + oldstrname) != DialogResult.Yes)
  332. {
  333. return;
  334. }
  335. CoreResult re = this.execute<CoreResult>("com.hnshituo.pur.balance.service.BalanceBasepriceMService", "doUpdateBasePriceM", new object[] { pm });
  336. if (re.Resultcode == 0)
  337. {
  338. MessageBox.Show("删除成功", "提示");
  339. QureyBasePriceM("");
  340. }
  341. else
  342. {
  343. MessageBox.Show("操作失败:" + re.Resultmsg, "提示");
  344. return;
  345. }
  346. }
  347. /// <summary>
  348. /// 保存价格政策
  349. /// </summary>
  350. private void saveFrmFGPriceMainTain()
  351. {
  352. try
  353. {
  354. if (ultraGrid1.ActiveRow == null)
  355. {
  356. MessageUtil.ShowTips("请选择价格政策进行操作");
  357. return;
  358. }
  359. List<BalanceBasepriceC> list = new List<BalanceBasepriceC>();
  360. string oldstrname = ultraGrid1.ActiveRow.Cells["name"].Value.ToString().Trim();
  361. string oldstrid = ultraGrid1.ActiveRow.Cells["id"].Value.ToString().Trim();
  362. string oldstritemcode = ultraGrid1.ActiveRow.Cells["itemCode"].Value.ToString().Trim();
  363. if (testPriceMStatus(oldstrid, 2) == false)
  364. {
  365. return;
  366. }
  367. ultraGrid2.UpdateData();
  368. foreach (UltraGridRow row in ultraGrid2.Rows)
  369. {
  370. if (String.IsNullOrEmpty(row.GetCellValue("priceVal").ToString()))
  371. {
  372. MessageUtil.ShowTips("料型:" + row.GetCellValue("gradeLevel") + "价格1不能为空");
  373. row.Activated = true;
  374. return;
  375. }
  376. BalanceBasepriceC pc = new BalanceBasepriceC();
  377. pc.GradeLevel = row.GetCellValue("gradeLevel").ToString().Trim();
  378. pc.GradeValue = row.GetCellValue("gradeValue").ToString().Trim();
  379. pc.StandId = oldstrid;
  380. pc.Validflag = "1";
  381. if (String.IsNullOrEmpty(row.GetCellValue("id").ToString()))
  382. {
  383. pc.CreateUserid = UserInfo.GetUserID();
  384. pc.CreateName = UserInfo.GetUserName();
  385. pc.CreateTime = DateTime.Now;
  386. }
  387. else
  388. {
  389. pc.Id = row.GetCellValue("id").ToString().Trim();
  390. if (String.IsNullOrEmpty(pc.Id))
  391. {
  392. MessageUtil.ShowTips("未获取到料型:" + row.GetCellValue("gradeLevel") + "编码");
  393. }
  394. pc.UpdateUserid = UserInfo.GetUserID();
  395. pc.UpdateName = UserInfo.GetUserName();
  396. pc.UpdateTime = DateTime.Now;
  397. }
  398. pc.PriceVal = row.GetCellValue("priceVal").ToString().Trim();
  399. if (!String.IsNullOrEmpty(row.GetCellValue("priceVal1").ToString().Trim()))
  400. {
  401. pc.PriceVal1 = row.GetCellValue("priceVal1").ToString().Trim();
  402. }
  403. else
  404. {
  405. pc.PriceVal1 = "0";
  406. }
  407. list.Add(pc);
  408. }
  409. if (list.Count <= 0)
  410. {
  411. MessageUtil.ShowTips("未可修改或者新增项");
  412. return;
  413. }
  414. if (MessageUtil.ShowYesNoAndQuestion("确定保存?") != DialogResult.Yes)
  415. {
  416. return;
  417. }
  418. CoreResult re = this.execute<CoreResult>("com.hnshituo.pur.balance.service.BalanceBasepriceCService", "doUpdateBasePriceC_batch", new object[] { list });
  419. if (re.Resultcode == 0)
  420. {
  421. MessageUtil.ShowTips("操作成功");
  422. }
  423. else
  424. {
  425. MessageUtil.ShowTips("操作失败:" + re.Resultmsg);
  426. }
  427. }
  428. catch (Exception ex)
  429. {
  430. MessageUtil.ShowTips("操作失败:" + ex.Message);
  431. }
  432. }
  433. /// <summary>
  434. /// 添加
  435. /// </summary>
  436. private void AddBasePriceM()
  437. {
  438. BalanceBasepriceM pm = new BalanceBasepriceM();
  439. if (String.IsNullOrEmpty(edtName.Text.Trim()))
  440. {
  441. MessageUtil.ShowTips("价格政策名称不能为空");
  442. edtName.Focus();
  443. return;
  444. }
  445. if (String.IsNullOrEmpty(txt_effectTime.Text.Trim()))
  446. {
  447. MessageUtil.ShowTips("请输入政策的生效时间");
  448. txt_effectTime.Focus();
  449. return;
  450. }
  451. if (String.IsNullOrEmpty(txt_VersionNo.Text.Trim()))
  452. {
  453. MessageUtil.ShowTips("版本号不能为空");
  454. txt_VersionNo.Focus();
  455. return;
  456. }
  457. if (String.IsNullOrEmpty(txt_itemName.Text.Trim()))
  458. {
  459. MessageUtil.ShowTips("适用物料不能为空");
  460. txt_itemName.Focus();
  461. return;
  462. }
  463. if (String.IsNullOrEmpty(txt_itemCode.Text.Trim()))
  464. {
  465. MessageUtil.ShowTips("适用物料不能为空");
  466. txt_itemName.Focus();
  467. return;
  468. }
  469. //DateTime time = DateTime.Parse(Convert.ToDateTime(txt_effectTime.Value).ToString("yyyy/MM/dd"));
  470. //pm.EffectiveTime = Convert.ToDateTime(time);
  471. if (String.IsNullOrEmpty(txt_remark.Text.Trim()))
  472. {
  473. MessageUtil.ShowTips("请填写申请部门意见");
  474. txt_remark.Focus();
  475. return;
  476. }
  477. pm.EffectiveTime = DateTime.Parse(Convert.ToDateTime(txt_effectTime.Value).ToString("yyyy/MM/dd"));
  478. pm.Remark = txt_remark.Text.Trim();
  479. pm.Name = edtName.Text.Trim();
  480. pm.VersionNo = txt_VersionNo.Text.Trim();
  481. pm.ItemName = txt_itemName.Text.Trim();
  482. pm.ItemCode = txt_itemCode.Text.Trim();
  483. pm.DepartId = UserInfo.GetDeptid();
  484. pm.DepartName = UserInfo.GetDepartment();
  485. if (testPriceM(pm, 1) == false)
  486. {
  487. return;
  488. }
  489. if (MessageUtil.ShowYesNoAndQuestion("确定新增?") != DialogResult.Yes)
  490. {
  491. return;
  492. }
  493. pm.Flag = "0";
  494. pm.Validflag = "1";
  495. pm.CreateName = UserInfo.GetUserName();
  496. pm.CreateTime = System.DateTime.Now;
  497. pm.CreateUserid = UserInfo.GetUserID();
  498. CoreResult re = this.execute<CoreResult>("com.hnshituo.pur.balance.service.BalanceBasepriceMService", "doAddBasePriceM", new object[] { pm });
  499. if (re.Resultcode == 0)
  500. {
  501. MessageBox.Show("新增成功", "提示");
  502. QureyBasePriceM(re.Resultmsg);
  503. }
  504. else
  505. {
  506. MessageBox.Show("操作失败:" + re.Resultmsg, "提示");
  507. return;
  508. }
  509. }
  510. #endregion
  511. #region 弹出框toolbar
  512. /// <summary>
  513. /// 弹出框toolbar
  514. /// </summary>
  515. /// <param name="sender"></param>
  516. /// <param name="e"></param>
  517. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  518. {
  519. switch (e.Tool.Key)
  520. {
  521. case "doQuery": // ButtonTool
  522. QureyBasePriceM("");
  523. break;
  524. case "doSelect": // ButtonTool
  525. doSelect();
  526. break;
  527. case "doExit": // ButtonTool
  528. this.Close();
  529. break;
  530. }
  531. }
  532. /// <summary>
  533. /// 选择价格政策
  534. /// </summary>
  535. private void doSelect()
  536. {
  537. if (ultraGrid1.ActiveRow == null)
  538. {
  539. MessageUtil.ShowTips("请选择价格政策");
  540. return;
  541. }
  542. strPriceName = ultraGrid1.ActiveRow.Cells["name"].Value.ToString().Trim();
  543. strPriceId = ultraGrid1.ActiveRow.Cells["id"].Value.ToString().Trim();
  544. if (testPriceMStatus(strPriceId, 3) == false)
  545. {
  546. return;
  547. }
  548. tips = "1";
  549. this.Close();
  550. }
  551. #endregion
  552. #region 界面事件
  553. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  554. {
  555. if (ultraGrid1.ActiveRow == null)
  556. {
  557. return;
  558. }
  559. String strId = ultraGrid1.ActiveRow.Cells["id"].Value.ToString();
  560. String strItemCode = ultraGrid1.ActiveRow.Cells["itemCode"].Value.ToString();
  561. if (String.IsNullOrEmpty(strId))
  562. {
  563. return;
  564. }
  565. if (String.IsNullOrEmpty(strItemCode))
  566. {
  567. MessageUtil.ShowTips("该价格政策物料编号不能为空,请维护");
  568. return;
  569. }
  570. BalanceBasepriceM pp = this.execute<BalanceBasepriceM>("com.hnshituo.pur.balance.service.BalanceBasepriceMService", "findById", new object[] { strId });
  571. //判断当前激活行是否为空
  572. txt_VersionNo.Text = pp.VersionNo;
  573. edtName.Text = pp.Name;
  574. txt_remark.Text = pp.Remark == null ? null : pp.Remark.Replace("\n", "\r\n");
  575. txt_itemCode.Text = pp.ItemCode;
  576. txt_itemName.Text = pp.ItemName;
  577. doQueryEva(strId);
  578. doQueryBasePriceC(strId, strItemCode);
  579. getOrderAppend(strId, "");
  580. }
  581. /// <summary>
  582. /// 物料选择
  583. /// </summary>
  584. /// <param name="sender"></param>
  585. /// <param name="e"></param>
  586. private void txt_itemName_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  587. {
  588. frmPopMatSelect frm = new frmPopMatSelect(this.ob,"1");
  589. frm.ShowDialog();
  590. if (frm.tips == "1")
  591. {
  592. txt_itemCode.Text = frm.selectedItemCode;
  593. txt_itemName.Text = frm.SelectedItemName;
  594. }
  595. }
  596. #endregion
  597. #region 公共函数
  598. /// <summary>
  599. /// 校验重复性
  600. /// </summary>
  601. /// <param name="pm"></param>
  602. /// <param name="p"></param>
  603. /// <returns></returns>
  604. private bool testPriceM(BalanceBasepriceM pm, int p)
  605. {
  606. BalanceBasepriceM pp = new BalanceBasepriceM();
  607. pp.Name = pm.Name;
  608. pp.Validflag = "1";
  609. DataTable dt = this.execute<DataTable>("com.hnshituo.pur.balance.service.BalanceBasepriceMService", "find", new object[] { pp, 0, 0 });
  610. if (dt != null && dt.Rows.Count > 0)
  611. {
  612. MessageUtil.ShowTips("已存在同名价格政策");
  613. return false;
  614. }
  615. pp.Name = null;
  616. pp.DeleteName = "1";
  617. pp.EffectiveTime = pm.EffectiveTime;
  618. pp.ItemCode = pm.ItemCode;
  619. DataTable re = this.execute<DataTable>("com.hnshituo.pur.balance.service.BalanceBasepriceMService", "doQureyBasePriceM", new object[] { pp });
  620. if (re != null && re.Rows.Count > 0)
  621. {
  622. MessageUtil.ShowTips("当前物料:" + pm .ItemName+ "所维护的价格政策生效时间需大于已维护价格政策");
  623. return false;
  624. }
  625. return true;
  626. }
  627. /// <summary>
  628. /// 校验政策状态
  629. /// </summary>
  630. /// <param name="pm"></param>
  631. /// <param name="p"></param>
  632. /// <returns></returns>
  633. private bool testPriceMStatus(String Id, int p)
  634. {
  635. if(String.IsNullOrEmpty(Id))
  636. {
  637. MessageUtil.ShowTips("价格政策头编号为空");
  638. return false;
  639. }
  640. BalanceBasepriceM pm= this.execute<BalanceBasepriceM>("com.hnshituo.pur.balance.service.BalanceBasepriceMService", "findById", new object[] {Id});
  641. if(pm==null)
  642. {
  643. MessageUtil.ShowTips("未发现价格政策:"+Id+"信息记录,或请刷新界面重试");
  644. return false;
  645. }
  646. if (pm.Validflag != "1")
  647. {
  648. MessageUtil.ShowTips("价格政策:" + Id + "信息记录,或请刷新界面重试");
  649. return false;
  650. }
  651. //提报
  652. if (p == 1)
  653. {
  654. if (pm.Flag != "0")
  655. {
  656. MessageUtil.ShowTips("价格政策:" + Id + "已提报,或请刷新界面重试");
  657. return false;
  658. }
  659. BalanceBasepriceC bc = new BalanceBasepriceC();
  660. bc.StandId = Id;
  661. bc.Validflag = "1";
  662. int count1 = this.execute<int>("com.hnshituo.pur.balance.service.BalanceBasepriceCService", "count", new object[] { bc});
  663. if (count1 <= 0)
  664. {
  665. MessageUtil.ShowTips("请维护价格政策行信息");
  666. return false;
  667. }
  668. BalanceEvaUsers ec = new BalanceEvaUsers();
  669. ec.StandId = Id;
  670. ec.Validflag = "1";
  671. int count2 = this.execute<int>("com.hnshituo.pur.balance.service.BalanceEvaUsersService", "count", new object[] { bc });
  672. if (count2 <= 0)
  673. {
  674. MessageUtil.ShowTips("请维护评审人员信息");
  675. return false;
  676. }
  677. }
  678. //删除
  679. else if (p == 2)
  680. {
  681. if (pm.Flag != "0")
  682. {
  683. MessageUtil.ShowTips("价格政策:" + Id + "已提报,无法删改,或请刷新界面重试");
  684. return false;
  685. }
  686. }
  687. //选择
  688. else if (p == 3)
  689. {
  690. if (pm.Flag != "2")
  691. {
  692. MessageUtil.ShowTips("价格政策:" + Id + "未评审通过,无法适用,或请刷新界面重试");
  693. return false;
  694. }
  695. }
  696. //审核
  697. else if (p == 4)
  698. {
  699. if (pm.Flag != "1")
  700. {
  701. MessageUtil.ShowTips("价格政策:" + Id + "未提报或者已审核,或请刷新界面重试");
  702. return false;
  703. }
  704. }
  705. //删除人员
  706. else if (p == 5)
  707. {
  708. if (pm.Flag == "2")
  709. {
  710. MessageUtil.ShowTips("价格政策:" + Id + "已审核,或请刷新界面重试");
  711. return false;
  712. }
  713. }
  714. //修改
  715. else if (p == 6)
  716. {
  717. if (pm.Flag == "2")
  718. {
  719. MessageUtil.ShowTips("价格政策:" + Id + "已审核,或请刷新界面重试");
  720. return false;
  721. }
  722. }
  723. else
  724. {
  725. MessageUtil.ShowTips("未知参数:"+p);
  726. return false;
  727. }
  728. return true;
  729. }
  730. /// <summary>
  731. /// 清空编辑区
  732. /// </summary>
  733. private void clearTab()
  734. {
  735. edtName.Clear();
  736. txt_effectTime.Value = DateTime.Now;
  737. txt_VersionNo.Clear();
  738. txt_remark.Clear();
  739. txt_itemCode.Text = "-";
  740. txt_itemName.Clear();
  741. }
  742. /// <summary>
  743. /// 给控件赋值
  744. /// </summary>
  745. /// <param name="sender"></param>
  746. private void getControlBoxValue()
  747. {
  748. if (ultraGrid1.ActiveRow == null)
  749. {
  750. return;
  751. }
  752. String strId = ultraGrid1.ActiveRow.Cells["id"].Value.ToString();
  753. if (String.IsNullOrEmpty(strId))
  754. {
  755. return;
  756. }
  757. BalanceBasepriceM pp = this.execute<BalanceBasepriceM>("com.hnshituo.pur.balance.service.BalanceBasepriceMService", "findById", new object[] { strId });
  758. //判断当前激活行是否为空
  759. txt_VersionNo.Text = pp.VersionNo;
  760. edtName.Text = pp.Name;
  761. txt_remark.Text = pp.Remark;
  762. txt_itemCode.Text = pp.ItemCode;
  763. txt_itemName.Text = pp.ItemName;
  764. }
  765. /// <summary>
  766. /// 查询行
  767. /// </summary>
  768. /// <param name="strId"></param>
  769. /// <param name="strItemCode"></param>
  770. private void doQueryBasePriceC(String strId, String strItemCode)
  771. {
  772. dataTable2.Clear();
  773. BalanceBasepriceC pc = new BalanceBasepriceC();
  774. pc.StandId = strId;
  775. pc.Validflag = "1";
  776. DataTable re = this.execute<DataTable>("com.hnshituo.pur.balance.service.BalanceBasepriceCService", "doQureyBasePriceC", new object[] { pc });
  777. if (re.Rows.Count > 0)
  778. {
  779. GridHelper.CopyDataToDatatable(re, dataTable2, true);
  780. }
  781. else
  782. {
  783. DataTable dt = new DataTable();
  784. dt.Columns.Add("GRADELEVEL");
  785. dt.Columns.Add("GRADEVALUE");
  786. PurClassMatAttrEntity attrs = new PurClassMatAttrEntity();
  787. attrs.ItemCode = strItemCode;
  788. DataTable dtAttrs = this.execute<DataTable>("com.hnshituo.pur.configure.service.ClassMatAttrService", "find", new object[] { attrs, 0, 0 });
  789. if (dtAttrs == null || dtAttrs.Rows.Count <= 0)
  790. {
  791. MessageUtil.ShowTips("请维护在料型维护界面维护该物料的可用属性");
  792. return;
  793. }
  794. else
  795. {
  796. foreach (DataRow row in dtAttrs.Rows)
  797. {
  798. dt.Rows.Add(row["attrName"], row["attrCode"]);
  799. }
  800. }
  801. GridHelper.CopyDataToDatatable(dt, dataTable2, true);
  802. }
  803. }
  804. /// <summary>
  805. /// 查询评审人员
  806. /// </summary>
  807. /// <param name="strId"></param>
  808. private void doQueryEva(string strId)
  809. {
  810. dataTable4.Clear();
  811. BalanceEvaUsers pc = new BalanceEvaUsers();
  812. pc.StandId = strId;
  813. pc.Validflag = "1";
  814. DataTable re = this.execute<DataTable>("com.hnshituo.pur.balance.service.BalanceEvaUsersService", "doQureyEva", new object[] { pc });
  815. GridHelper.CopyDataToDatatable(re, dataTable4, true);
  816. GridHelper.RefreshAndAutoSize(ultraGrid3);
  817. }
  818. #endregion
  819. #region 评审人员处理
  820. /// <summary>
  821. /// 新增评审人员
  822. /// </summary>
  823. /// <param name="sender"></param>
  824. /// <param name="e"></param>
  825. private void btn_add_group_Click(object sender, EventArgs e)
  826. {
  827. if (ultraGrid1.ActiveRow == null)
  828. {
  829. MessageUtil.ShowTips("请选择价格政策");
  830. return;
  831. }
  832. string oldstrid = ultraGrid1.ActiveRow.Cells["id"].Value.ToString().Trim();
  833. if (testPriceMStatus(oldstrid, 5) == false)
  834. {
  835. return;
  836. }
  837. frmPopSelEvaGroup frm = new frmPopSelEvaGroup(this.ob);
  838. frm.ShowDialog();
  839. if (frm.dtEvaGroup != null)
  840. {
  841. ArrayList list = new ArrayList();
  842. DataTable dt = frm.dtEvaGroup;
  843. //移除目标表中没有的列
  844. foreach(DataRow row in dt.Rows)
  845. {
  846. BalanceEvaUsers user = new BalanceEvaUsers();
  847. user.StandId = oldstrid;
  848. user.EvaRoleId = row["EVAROLEID"].ToString().Trim();
  849. user.EvaRoleName = row["EVAROLENAME"].ToString().Trim();
  850. user.EvaUserId = row["EVAUSERNAME"].ToString().Trim();
  851. user.EvaUserName = row["EVAUSERNAME"].ToString().Trim();
  852. user.CreateName = UserInfo.GetUserName();
  853. user.CreateUserId = UserInfo.GetUserID();
  854. user.CreateTime = DateTime.Now;
  855. user.Validflag = "1";
  856. user.EvaOrgName = row["EVAORGNAME"].ToString().Trim();
  857. user.EvaOrgId = row["EVAORGID"].ToString().Trim();
  858. list.Add(user);
  859. }
  860. if (list.Count <= 0)
  861. {
  862. return;
  863. }
  864. CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.balance.service.BalanceEvaUsersService", "doInsert_Eva", new object[] { list });
  865. if (crt.Resultcode != 0)
  866. {
  867. MessageUtil.ShowTips("添加失败:" + crt.Resultmsg);
  868. return;
  869. }
  870. else
  871. {
  872. MessageUtil.ShowTips("成功添加");
  873. doQueryEva(oldstrid);
  874. }
  875. }
  876. GridHelper.RefreshAndAutoSize(ultraGrid3);
  877. }
  878. /// <summary>
  879. /// 删除评审人员
  880. /// </summary>
  881. /// <param name="sender"></param>
  882. /// <param name="e"></param>
  883. private void btn_delete_man_Click(object sender, EventArgs e)
  884. {
  885. if (ultraGrid1.ActiveRow == null)
  886. {
  887. MessageUtil.ShowTips("请选择价格政策");
  888. return;
  889. }
  890. string oldstrid = ultraGrid1.ActiveRow.Cells["id"].Value.ToString().Trim();
  891. if (testPriceMStatus(oldstrid, 5) == false)
  892. {
  893. return;
  894. }
  895. if (ultraGrid3.ActiveRow == null)
  896. {
  897. MessageUtil.ShowTips("无可删除项");
  898. }
  899. String EvaId = ultraGrid3.ActiveRow.GetCellValue("EvaId").ToString().Trim();
  900. String EvaUserName = ultraGrid3.ActiveRow.GetCellValue("EVAUSERNAME").ToString().Trim();
  901. if (String.IsNullOrEmpty(EvaId))
  902. {
  903. MessageUtil.ShowTips("评审人意见编号为空");
  904. }
  905. BalanceEvaUsers taskEva = new BalanceEvaUsers();
  906. taskEva.StandId = oldstrid;
  907. taskEva.EvaId = EvaId;
  908. taskEva.Validflag = "0";
  909. taskEva.DeleteName = UserInfo.GetUserName();
  910. taskEva.DeleteUserId = UserInfo.GetUserID();
  911. taskEva.DeleteTime = DateTime.Now;
  912. if (MessageUtil.ShowYesNoAndQuestion("确定移除价格政策:" + oldstrid + " 的评审人员:" + EvaUserName + " ?") != DialogResult.Yes)
  913. {
  914. return;
  915. }
  916. CoreResult re = this.execute<CoreResult>("com.hnshituo.pur.balance.service.BalanceEvaUsersService", "doUpdate", new object[] { taskEva });
  917. if (re.Resultcode != 0)
  918. {
  919. MessageUtil.ShowTips("删除失败:" + re.Resultmsg);
  920. return;
  921. }
  922. else
  923. {
  924. MessageUtil.ShowTips("操作成功");
  925. doQueryEva(oldstrid);
  926. return;
  927. }
  928. }
  929. #endregion
  930. #region 附件处理
  931. /// <summary>
  932. /// 选择附件
  933. /// </summary>
  934. /// <param name="sender"></param>
  935. /// <param name="e"></param>
  936. private void txt_certPath_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  937. {
  938. try
  939. {
  940. if (e.Button.Key.ToLower().Equals("insert"))
  941. {
  942. OpenFileDialog file = new OpenFileDialog();
  943. file.Multiselect = false;
  944. DialogResult drStat;
  945. drStat = file.ShowDialog();
  946. if (drStat == DialogResult.OK)
  947. {
  948. fileName = file.FileName;
  949. string filena = System.IO.Path.GetFileName(fileName);
  950. txt_certPath.Text = filena;
  951. }
  952. }
  953. }
  954. catch (Exception ex)
  955. {
  956. MessageUtil.ShowTips("操作失败:" + ex);
  957. }
  958. }
  959. /// <summary>
  960. /// 查看附件
  961. /// </summary>
  962. /// <param name="sender"></param>
  963. /// <param name="e"></param>
  964. private void craftImg_EditorButtonClick(object sender, EditorButtonEventArgs e)
  965. {
  966. try
  967. {
  968. UltraGridRow row = ultraGrid4.ActiveRow;
  969. string filePathOld = row.GetValue("certPathOld");
  970. if (e.Button.Key.ToLower().Equals("select"))
  971. {
  972. FrmPopFileShow down = new FrmPopFileShow(this.ob, filePathOld);
  973. down.DeleteButton.Visible = false;
  974. down.ShowDialog();
  975. }
  976. }
  977. catch (Exception ex)
  978. {
  979. MessageUtil.ShowTips("操作失败:" + ex);
  980. }
  981. }
  982. /// <summary>
  983. /// 新增附件
  984. /// </summary>
  985. /// <param name="sender"></param>
  986. /// <param name="e"></param>
  987. private void btn_submitAppend_Click(object sender, EventArgs e)
  988. {
  989. if (ultraGrid1.ActiveRow == null)
  990. {
  991. MessageUtil.ShowTips("未选择任务单");
  992. return;
  993. }
  994. string strId = ultraGrid1.ActiveRow.GetValue("id");
  995. if (String.IsNullOrEmpty(strId))
  996. {
  997. MessageUtil.ShowTips("价格政策号为空");
  998. return;
  999. }
  1000. String filena = txt_certPath.Text.ToString().Trim();
  1001. if (String.IsNullOrEmpty(filena) || String.IsNullOrEmpty(fileName))
  1002. {
  1003. MessageUtil.ShowTips("请选择待上传文件");
  1004. return;
  1005. }
  1006. OrderAppend sat = new OrderAppend();
  1007. sat.OrderId = strId;
  1008. String filePathNew = "Pms/CERT/" + strId + "/";
  1009. sat.CertPath = filena;
  1010. sat.CertPathOld = filePathNew + filena;
  1011. sat.CreateUserid = UserInfo.GetUserID();
  1012. sat.CreateName = UserInfo.GetUserName();
  1013. sat.CreateTime = DateTime.Now;
  1014. sat.Validflag = "1";
  1015. sat.CertDesc = txt_CERTDESC.Text.Trim();
  1016. if (GetCraftFileCraftNoCnt(filena, strId) > 0)
  1017. {
  1018. MessageUtil.ShowTips("合同已存在该附件文件:" + filena);
  1019. return;
  1020. }
  1021. List<FileBean> list = new List<FileBean>();
  1022. FileBean bean = new FileBean();
  1023. bean = new FileBean();
  1024. bean.setFileName(filena);
  1025. bean.setPathName(filePathNew);
  1026. bean.setFile(FileHelper.FileToArray(fileName));
  1027. list.Add(bean);
  1028. bool isSuccess = Core.Mes.Client.Comm.Server.FileHelper.Upload(list);
  1029. if (isSuccess)
  1030. {
  1031. //开始写数据库
  1032. CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.order.service.OrderAppendService", "insert_append", new object[] { sat });
  1033. if (crt.Resultcode != 0)
  1034. {
  1035. MessageUtil.ShowTips("上传失败:" + crt.Resultmsg);
  1036. }
  1037. else
  1038. {
  1039. MessageUtil.ShowTips("上传成功");
  1040. ClearTab5();
  1041. }
  1042. }
  1043. else
  1044. {
  1045. MessageBox.Show("上传失败");
  1046. }
  1047. //刷新界面并激活当前行
  1048. Relocate(sat);
  1049. }
  1050. private void ClearTab5()
  1051. {
  1052. txt_certPath.Clear();
  1053. txt_CERTDESC.Clear();
  1054. fileName = "";
  1055. }
  1056. private void Relocate(OrderAppend sat)
  1057. {
  1058. getOrderAppend(sat.OrderId, sat.CertPath);
  1059. }
  1060. // 加载附件
  1061. private void getOrderAppend(string strOrderId, string p)
  1062. {
  1063. fujian.Clear();
  1064. OrderAppend append = new OrderAppend();
  1065. append.OrderId = strOrderId;
  1066. append.Validflag = "1";
  1067. DataTable dt = this.execute<DataTable>("com.hnshituo.pur.order.service.OrderAppendService", "find", new object[] { append, 0, 0 });
  1068. GridHelper.CopyDataToDatatable(dt, dataTable6, true);
  1069. GridHelper.RefreshAndAutoSize(ultraGrid4);
  1070. if (!String.IsNullOrEmpty(p))
  1071. {
  1072. PublicTools.publicPms.doActiveSelRow(ultraGrid4, "CERTPATH", p);
  1073. }
  1074. }
  1075. /// <summary>
  1076. /// 判断是否之前已提交相同的文件
  1077. /// </summary>
  1078. /// <param name="craftNo"></param>
  1079. /// <returns></returns>
  1080. private int GetCraftFileCraftNoCnt(string CERT_PATH, string orderId)
  1081. {
  1082. OrderAppend sat = new OrderAppend();
  1083. sat.CertPath = CERT_PATH;
  1084. sat.OrderId = orderId;
  1085. sat.Validflag = "1";
  1086. int dt = this.execute<int>("com.hnshituo.pur.order.service.OrderAppendService", "count", new object[] { sat });
  1087. return dt;
  1088. }
  1089. /// <summary>
  1090. /// 删除附件
  1091. /// </summary>
  1092. /// <param name="sender"></param>
  1093. /// <param name="e"></param>
  1094. private void btn_deleteAppend_Click(object sender, EventArgs e)
  1095. {
  1096. UltraGridRow uge = ultraGrid1.ActiveRow;
  1097. if (uge == null)
  1098. {
  1099. MessageUtil.ShowTips("请选择价格政策头!");
  1100. return;
  1101. }
  1102. String strId = uge.Cells["id"].Value.ToString().Trim();
  1103. if (String.IsNullOrEmpty(strId))
  1104. {
  1105. MessageUtil.ShowTips("该价格政策头编号为空!");
  1106. return;
  1107. }
  1108. UltraGridRow rowAppend = ultraGrid4.ActiveRow;
  1109. if (rowAppend == null)
  1110. {
  1111. MessageUtil.ShowTips("请选择需删除的附件!");
  1112. return;
  1113. }
  1114. String strAppendID = rowAppend.Cells["ID"].Value.ToString().Trim();
  1115. String strcertPath = rowAppend.Cells["CERTPATH"].Value.ToString().Trim();
  1116. String strCertPathOld = rowAppend.Cells["CERTPATHOLD"].Value.ToString().Trim();
  1117. if (String.IsNullOrEmpty(strAppendID))
  1118. {
  1119. MessageUtil.ShowTips("该价格政策附件编号为空!");
  1120. return;
  1121. }
  1122. if (String.IsNullOrEmpty(strCertPathOld))
  1123. {
  1124. MessageUtil.ShowTips("未获取到任务单附件地址信息!");
  1125. return;
  1126. }
  1127. //验证任务单头是否可以增删改
  1128. if (testOrderAppendStatus(strAppendID, 1) == false)
  1129. {
  1130. return;
  1131. }
  1132. OrderAppend append = new OrderAppend();
  1133. append.Id = strAppendID;
  1134. append.Validflag = "0";
  1135. append.DeleteName = UserInfo.GetUserName();
  1136. append.DeleteTime = DateTime.Now;
  1137. append.DeleteUserid = UserInfo.GetUserID();
  1138. if (MessageUtil.ShowYesNoAndQuestion("确定删除附件:" + strcertPath + "?") != DialogResult.Yes)
  1139. {
  1140. return;
  1141. }
  1142. CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.order.service.OrderAppendService", "delete_append", new object[] { append });
  1143. if (crt.Resultcode != 0)
  1144. {
  1145. MessageUtil.ShowTips("删除失败!" + crt.Resultmsg);
  1146. return;
  1147. }
  1148. else
  1149. {
  1150. bool isSuccess = Core.Mes.Client.Comm.Server.FileHelper.Delete(strCertPathOld);
  1151. if (isSuccess)
  1152. {
  1153. MessageUtil.ShowTips("删除成功");
  1154. }
  1155. else
  1156. {
  1157. MessageBox.Show("删除成功");
  1158. }
  1159. }
  1160. getOrderAppend(strId, "");
  1161. }
  1162. /// <summary>
  1163. /// 验证价格政策输入数据的有效性
  1164. /// </summary>
  1165. /// <returns></returns>
  1166. private bool testOrderAppendStatus(String strId, int p)// 验证合同附件
  1167. {
  1168. OrderAppend append = this.execute<OrderAppend>("com.hnshituo.pur.order.service.OrderAppendService", "findById", new object[] { strId });
  1169. if (append == null)
  1170. {
  1171. MessageUtil.ShowTips("未发现价格政策附件:" + strId + "信息记录,可能已作废");
  1172. return false;
  1173. }
  1174. if (append.Validflag != "1")
  1175. {
  1176. MessageUtil.ShowTips("价格政策附件:" + strId + "信息记录可能已作废");
  1177. return false;
  1178. }
  1179. if (append.CreateUserid != UserInfo.GetUserID())
  1180. {
  1181. MessageUtil.ShowTips("非本人上传价格政策附件无权限进行增删改");
  1182. return false;
  1183. }
  1184. if (p == 1)
  1185. {
  1186. }
  1187. else
  1188. {
  1189. MessageUtil.ShowTips("未知参数:" + p + "");
  1190. return false;
  1191. }
  1192. return true;
  1193. }
  1194. #endregion
  1195. private void btn_remark_edit_Click(object sender, EventArgs e)
  1196. {
  1197. UltraGridRow uge = ultraGrid1.ActiveRow;
  1198. if (uge == null)
  1199. {
  1200. MessageUtil.ShowTips("请选择价格政策头!");
  1201. return;
  1202. }
  1203. String strId = uge.Cells["id"].Value.ToString().Trim();
  1204. if (String.IsNullOrEmpty(strId))
  1205. {
  1206. MessageUtil.ShowTips("该价格政策头编号为空!");
  1207. return;
  1208. }
  1209. BalanceBasepriceM pm = new BalanceBasepriceM();
  1210. if (String.IsNullOrEmpty(txt_remark.Text.Trim()))
  1211. {
  1212. MessageUtil.ShowTips("请填写申请部门意见");
  1213. txt_remark.Focus();
  1214. return;
  1215. }
  1216. pm.Remark = txt_remark.Text.Trim();
  1217. pm.Id = strId;
  1218. if(testPriceMStatus(strId,6)==false)
  1219. {
  1220. return;
  1221. }
  1222. if (MessageUtil.ShowYesNoAndQuestion("确定修改?") != DialogResult.Yes)
  1223. {
  1224. return;
  1225. }
  1226. pm.UpdateName = UserInfo.GetUserName();
  1227. pm.UpdateTime = System.DateTime.Now;
  1228. pm.UpdateUserid = UserInfo.GetUserID();
  1229. CoreResult re = this.execute<CoreResult>("com.hnshituo.pur.balance.service.BalanceBasepriceMService", "doUpdate", new object[] { pm });
  1230. if (re.Resultcode == 0)
  1231. {
  1232. MessageBox.Show("修改成功", "提示");
  1233. QureyBasePriceM(strId);
  1234. }
  1235. else
  1236. {
  1237. MessageBox.Show("操作失败:" + re.Resultmsg, "提示");
  1238. return;
  1239. }
  1240. }
  1241. private void ultraGrid2_CellChange(object sender, CellEventArgs e)
  1242. {
  1243. if (e.Cell.Column.Key == "priceVal")
  1244. {
  1245. if (ultraGrid1.ActiveRow == null)
  1246. {
  1247. return;
  1248. }
  1249. String strItemCode = ultraGrid1.ActiveRow.Cells["itemCode"].Value.ToString().Trim();
  1250. if (String.IsNullOrEmpty(strItemCode))
  1251. {
  1252. MessageUtil.ShowTips("该价格政策物料编号不能为空,请维护");
  1253. return;
  1254. }
  1255. if (strItemCode == "Y01010001")
  1256. {
  1257. ultraGrid2.UpdateData();
  1258. double price1 = 0;
  1259. double.TryParse(e.Cell.Row.Cells["priceVal"].Value.ToString(), out price1);
  1260. e.Cell.Row.Cells["priceVal1"].Value = price1 + 20;
  1261. }
  1262. }
  1263. }
  1264. private void ck_createT_CheckedChanged(object sender, EventArgs e)
  1265. {
  1266. txt_createTimeBegin.Enabled = ck_createT.Checked;
  1267. txt_createTimeEnd.Enabled = ck_createT.Checked;
  1268. }
  1269. }
  1270. }