FrmTaskRecordManage.cs 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980
  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 Core.Mes.Client.Comm.Control;
  11. using Core.Mes.Client.Comm.Server;
  12. using Core.Mes.Client.Comm.Tool;
  13. using Infragistics.Win.UltraWinGrid;
  14. using Pur.configure;
  15. using Pur.Entity;
  16. using Pur.Entity.configureEntity;
  17. using Pur.Entity.pur_orderEntiy;
  18. using Pur.Entity.pur_planEntity;
  19. namespace Pur.pur_plan
  20. {
  21. public partial class FrmTaskRecordManage : FrmPmsBase
  22. {
  23. public FrmTaskRecordManage()
  24. {
  25. InitializeComponent();
  26. }
  27. private void FrmTaskRecordManage_Load(object sender, EventArgs e)
  28. {
  29. if (this.CustomInfo == "2")//评单人员
  30. {
  31. //this.ToolBarItemEnable(this, "doChange", false);
  32. //this.ToolBarItemEnable(this, "doDelete", false);
  33. ultraExpandableGroupBox3.Visible = false;
  34. }
  35. if (this.CustomInfo == "1")//公开采购管理员
  36. {
  37. //this.ToolBarItemEnable(this, "doQuery", true);
  38. //this.ToolBarItemEnable(this, "doChange", true);
  39. //this.ToolBarItemEnable(this, "doDelete", true);
  40. this.ToolBarItemEnable(this, "doRecord", true);
  41. this.ToolBarItemEnable(this, "cancelRecord", true);
  42. //this.ToolBarItemEnable(this, "doExit", true);
  43. //this.ToolBarItemEnable(this, "doPrint", true);
  44. //this.ToolBarItemEnable(this, "doCreate", true);
  45. //this.ToolBarItemEnable(this, "cancelCreate", true);
  46. jy_negDate.ReadOnly = false;
  47. jy_procRecord.ReadOnly = false;
  48. //ultraExpandableGroupBox3.Visible = false;
  49. ultraExpandableGroupBox3.Expanded = true;
  50. }
  51. //初始化查询区域
  52. txt_createTimeStart.Value = DateTime.Now.AddMonths(-1);
  53. txt_createTimeEnd.Value = DateTime.Now.AddDays(1);
  54. ck_ctime.Checked = false;
  55. ck_isAll.Checked = false;
  56. txt_createTimeStart.Enabled = false;
  57. txt_createTimeEnd.Enabled = false;
  58. GridHelper.SetExcludeColumnsActive(ultraGrid1.DisplayLayout.Bands[0], new string[] { });
  59. GridHelper.SetExcludeColumnsActive(ultraGrid2.DisplayLayout.Bands[0], new string[] { });
  60. GridHelper.SetExcludeColumnsActive(ultraGrid3.DisplayLayout.Bands[0], new string[] { });
  61. GridHelper.SetExcludeColumnsActive(ultraGrid3.DisplayLayout.Bands[1], new string[] { });
  62. }
  63. public override void ToolBar_Click(object sender, string ToolbarKey)
  64. {
  65. switch (ToolbarKey)
  66. {
  67. case "doQuery": // 查询
  68. doQuery();
  69. break;
  70. case "doChange": // 修改
  71. doChange();
  72. break;
  73. case "doDelete": // 删除
  74. doDelete();
  75. break;
  76. case "doRecord": // 评单
  77. doRecord();
  78. break;
  79. case "cancelRecord": // 撤销评单
  80. cancelRecord();
  81. break;
  82. case "doExit": // 退出
  83. this.Close();
  84. break;
  85. case "doPrint": // 打印
  86. doPrint();
  87. break;
  88. case "doCreate": // 纪要确认
  89. doCreate();
  90. break;
  91. case "doAddRecord": // 纪要生成
  92. doAddRecord();
  93. break;
  94. case "cancelCreate": // 取消纪要生成
  95. cancelCreate();
  96. break;
  97. }
  98. }
  99. //查询
  100. private void doQuery()
  101. {
  102. try
  103. {
  104. this.Cursor = Cursors.WaitCursor;
  105. ClearTab1();
  106. ClearTab2();
  107. dataSet1.Clear();
  108. dataSet2.Clear();
  109. dataSet3.Clear();
  110. PurTaskMEntity entity = new PurTaskMEntity();
  111. if (txt_taskId.Text.Trim() != "")
  112. {
  113. entity.TaskId = txt_taskId.Text.Trim();
  114. }
  115. if (ck_isAll.Checked==false)
  116. {
  117. entity.Status = "1";//查询评审中和生成采购纪要
  118. }
  119. if (txt_taskName.Text.Trim()!="")
  120. {
  121. entity.TaskName = txt_taskName.Text.Trim();
  122. }
  123. entity.Validflag = "1";
  124. if (ck_ctime.Checked)
  125. {
  126. if (txt_createTimeStart.Text != "")
  127. {
  128. entity.CreateTime = Convert.ToDateTime(txt_createTimeStart.Value);
  129. }
  130. if (txt_createTimeEnd.Text != "")
  131. {
  132. entity.UpdateTime = Convert.ToDateTime(txt_createTimeEnd.Value);
  133. }
  134. }
  135. if (this.CustomInfo == "2")//评单人员
  136. {
  137. entity.DeleteName = "2";
  138. entity.CreateUserid = UserInfo.GetUserID();
  139. }
  140. if (this.CustomInfo == "1")//公开采购管理员
  141. {
  142. entity.DeleteName = "1";
  143. }
  144. //PurTaskRecordEntity record = new PurTaskRecordEntity();
  145. //record.TaskId = txt_taskId.Text.ToString().Trim();
  146. //record.Id = txt_taskName.Text.ToString().Trim();
  147. //if (ck_ctime.Checked)
  148. //{
  149. // if (txt_createTimeStart.Text != "")
  150. // {
  151. // record.CreateTime = Convert.ToDateTime(txt_createTimeStart.Value);
  152. // }
  153. // if (txt_createTimeEnd.Text != "")
  154. // {
  155. // record.UpdateTime = Convert.ToDateTime(txt_createTimeEnd.Value);
  156. // }
  157. //}
  158. //record.CreateUserid = UserInfo.GetUserID();
  159. //if (this.CustomInfo == "2")//评单人员
  160. //{
  161. // record.DeleteName = "2";
  162. //}
  163. //if (this.CustomInfo == "1")//公开采购管理员
  164. //{
  165. // record.DeleteName = "1";
  166. //}
  167. DataTable taskList = this.execute<DataTable>("com.hnshituo.pur.purplan.service.TaskMService", "getTaskList", new object[] { entity });
  168. GridHelper.CopyDataToDatatable(taskList, dataTable1, true);
  169. }
  170. catch (Exception ex)
  171. {
  172. MessageUtil.ShowTips("初始化加载数据失败:"+ex.Message);
  173. }
  174. finally
  175. {
  176. this.Cursor = Cursors.Default;
  177. }
  178. }
  179. //新增纪要
  180. private void doAddRecord()
  181. {
  182. try
  183. {
  184. if (ultraGrid1.ActiveRow == null)
  185. {
  186. MessageUtil.ShowTips("请选择待评审任务单!");
  187. }
  188. string strTaskid = ultraGrid1.ActiveRow.GetCellValue("Taskid").ToString().Trim();
  189. if (String.IsNullOrEmpty(strTaskid))
  190. {
  191. MessageUtil.ShowTips("选择的评审任务单单号为空!");
  192. }
  193. if (testStatus(strTaskid, 0) == false)
  194. {
  195. return;
  196. }
  197. PurTaskRecordEntity TkR = new PurTaskRecordEntity();
  198. TkR.Validflag = "1";
  199. TkR.Status = "2";
  200. TkR.CreateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  201. TkR.CreateTime = DateTime.Now;
  202. TkR.CreateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
  203. TkR.BuyerUserid = UserInfo.GetUserID();
  204. TkR.BuyerUsername = UserInfo.GetUserName();
  205. TkR.MngOrgId = UserInfo.GetDeptid();
  206. TkR.MngOrgName = UserInfo.GetDepartment();
  207. if (jy_negDate.Text == "")
  208. {
  209. MessageUtil.ShowTips("谈判日期不能为空!");
  210. jy_negDate.Focus();
  211. return;
  212. }
  213. TkR.NegDate = Convert.ToDateTime(jy_negDate.Value);
  214. TkR.TaskId = jy_taskId.Text.Trim();
  215. TkR.TaskName = jy_taskName.Text.Trim();
  216. if (String.IsNullOrEmpty(jy_procRecord.Text.Trim()))
  217. {
  218. MessageUtil.ShowTips("纪要过程不能为空!");
  219. jy_procRecord.Focus();
  220. return;
  221. }
  222. TkR.ProcRecord = jy_procRecord.Text.Trim();
  223. if (MessageUtil.ShowYesNoAndQuestion("确定为该任务单生成采购纪要?") != DialogResult.Yes)
  224. {
  225. return;
  226. }
  227. CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.purplan.service.TaskRecordService", "doInsert_Record", new object[] { TkR });
  228. if (crt.Resultcode != 0)
  229. {
  230. MessageUtil.ShowTips("新增采购纪要失败!" + crt.Resultmsg);
  231. return;
  232. }
  233. else
  234. {
  235. MessageUtil.ShowTips("操作成功:生成采购纪要:" + crt.Resultmsg);
  236. doQuery();
  237. require_plan.comm.doActiveSelRow(ultraGrid1, "taskId", TkR.TaskId);
  238. }
  239. }
  240. catch (Exception ex)
  241. {
  242. MessageUtil.ShowTips("操作失败!" + ex.Message);
  243. }
  244. }
  245. //修改纪要
  246. private void doChange()
  247. {
  248. try
  249. {
  250. if (ultraGrid1.ActiveRow == null)
  251. {
  252. MessageUtil.ShowTips("请选择评审单!");
  253. }
  254. string strTaskId = ultraGrid1.ActiveRow.GetCellValue("TaskId").ToString().Trim();
  255. if (String.IsNullOrEmpty(strTaskId))
  256. {
  257. MessageUtil.ShowTips("选择的任务单单号为空!");
  258. }
  259. if (testStatus(strTaskId, 2) == false)
  260. {
  261. return;
  262. }
  263. PurTaskRecordEntity record = new PurTaskRecordEntity();
  264. record.Id = jy_RecordId.Text.Trim();
  265. if(jy_negDate.Text=="")
  266. {
  267. MessageUtil.ShowTips("谈判日期不能为空!");
  268. jy_negDate.Focus();
  269. }
  270. record.NegDate = Convert.ToDateTime(jy_negDate.Value);
  271. if (String.IsNullOrEmpty(jy_procRecord.Text))
  272. {
  273. MessageUtil.ShowTips("纪要内容不能为空!");
  274. jy_procRecord.Focus();
  275. }
  276. record.ProcRecord = jy_procRecord.Text.ToString().Trim();
  277. record.UpdateName = UserInfo.GetUserName();
  278. record.UpdateTime = DateTime.Now;
  279. record.UpdateUserid = UserInfo.GetUserID();
  280. if (MessageUtil.ShowYesNoAndQuestion("确定修改纪要:" + record.Id + "?") != DialogResult.Yes)
  281. {
  282. return;
  283. }
  284. CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.purplan.service.TaskRecordService", "doUpdate", new object[] { record });
  285. if (crt.Resultcode == 0)
  286. {
  287. MessageUtil.ShowTips("操作成功!");
  288. doQuery();
  289. require_plan.comm.doActiveSelRow(ultraGrid1, "taskId", strTaskId);
  290. }
  291. else
  292. {
  293. MessageUtil.ShowTips("操作失败!" + crt.Resultmsg);
  294. }
  295. }
  296. catch (Exception ex)
  297. {
  298. MessageUtil.ShowTips("操作失败!" + ex.Message);
  299. }
  300. }
  301. //纪要生效
  302. private void doCreate()
  303. {
  304. try
  305. {
  306. if (ultraGrid1.ActiveRow == null)
  307. {
  308. MessageUtil.ShowTips("请选择任务单!");
  309. }
  310. string strTaskId = ultraGrid1.ActiveRow.GetCellValue("TaskId").ToString().Trim();
  311. if (String.IsNullOrEmpty(strTaskId))
  312. {
  313. MessageUtil.ShowTips("选择的任务单单号为空!");
  314. }
  315. if (testStatus(strTaskId, 2) == false)
  316. {
  317. return;
  318. }
  319. PurTaskRecordEntity record = new PurTaskRecordEntity();
  320. record.Id = jy_RecordId.Text.Trim();
  321. record.Status = "3";
  322. if (MessageUtil.ShowYesNoAndQuestion("确定生效该采购纪要?") != DialogResult.Yes)
  323. {
  324. return;
  325. }
  326. CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.purplan.service.TaskRecordService", "doEffect_Record", new object[] { record });
  327. if (crt.Resultcode == 0)
  328. {
  329. MessageUtil.ShowTips("操作成功!");
  330. doQuery();
  331. require_plan.comm.doActiveSelRow(ultraGrid1, "taskId", strTaskId);
  332. }
  333. else
  334. {
  335. MessageUtil.ShowTips("操作失败!" + crt.Resultmsg);
  336. }
  337. }
  338. catch (Exception ex)
  339. {
  340. MessageUtil.ShowTips("操作失败!" + ex.Message);
  341. }
  342. }
  343. //纪要撤回
  344. private void cancelCreate()
  345. {
  346. try
  347. {
  348. if (ultraGrid1.ActiveRow == null)
  349. {
  350. MessageUtil.ShowTips("请选择评审单!");
  351. }
  352. string strTaskId = ultraGrid1.ActiveRow.GetCellValue("TaskId").ToString().Trim();
  353. if (String.IsNullOrEmpty(strTaskId))
  354. {
  355. MessageUtil.ShowTips("选择的任务单单号为空!");
  356. }
  357. if (testStatus(strTaskId, 4) == false)
  358. {
  359. return;
  360. }
  361. PurTaskRecordEntity record = new PurTaskRecordEntity();
  362. record.Id = jy_RecordId.Text.Trim();
  363. record.Status = "2";
  364. if (MessageUtil.ShowYesNoAndQuestion("确定撤销该采购纪要?") != DialogResult.Yes)
  365. {
  366. return;
  367. }
  368. CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.purplan.service.TaskRecordService", "doEffect_Record", new object[] { record});
  369. if (crt.Resultcode == 0)
  370. {
  371. MessageUtil.ShowTips("撤销采购纪要成功!");
  372. doQuery();
  373. require_plan.comm.doActiveSelRow(ultraGrid1, "taskId", strTaskId);
  374. }
  375. else
  376. {
  377. MessageUtil.ShowTips("操作失败!" + crt.Resultmsg);
  378. }
  379. }
  380. catch (Exception ex)
  381. {
  382. MessageUtil.ShowTips("操作失败!" + ex.Message);
  383. }
  384. }
  385. //删除纪要
  386. private void doDelete()
  387. {
  388. try
  389. {
  390. if (ultraGrid1.ActiveRow == null)
  391. {
  392. MessageUtil.ShowTips("请选择任务单!");
  393. }
  394. string strTaskId = ultraGrid1.ActiveRow.GetCellValue("TaskId").ToString().Trim();
  395. if (String.IsNullOrEmpty(strTaskId))
  396. {
  397. MessageUtil.ShowTips("选择的任务单单号为空!");
  398. }
  399. if (testStatus(strTaskId, 3) == false)
  400. {
  401. return;
  402. }
  403. PurTaskRecordEntity record = new PurTaskRecordEntity();
  404. record.Id = jy_RecordId.Text.Trim();
  405. record.Status = "9";
  406. record.Validflag = "0";
  407. record.DeleteName = UserInfo.GetUserName();
  408. record.DeleteTime = DateTime.Now;
  409. record.DeleteUserid = UserInfo.GetUserID();
  410. if (MessageUtil.ShowYesNoAndQuestion("确定删作废纪要:" + record.Id + "?") != DialogResult.Yes)
  411. {
  412. return;
  413. }
  414. CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.purplan.service.TaskRecordService", "doDelete_Record", new object[] { record });
  415. if (crt.Resultcode == 0)
  416. {
  417. MessageUtil.ShowTips("操作成功!");
  418. doQuery();
  419. require_plan.comm.doActiveSelRow(ultraGrid1, "taskId", strTaskId);
  420. }
  421. else
  422. {
  423. MessageUtil.ShowTips("操作失败!" + crt.Resultmsg);
  424. }
  425. }
  426. catch (Exception ex)
  427. {
  428. MessageUtil.ShowTips("操作失败!" + ex.Message);
  429. }
  430. }
  431. //评单
  432. private void doRecord()
  433. {
  434. try
  435. {
  436. if (ultraGrid1.ActiveRow == null)
  437. {
  438. MessageUtil.ShowTips("请选择评审单!");
  439. }
  440. string strTaskId = ultraGrid1.ActiveRow.GetCellValue("TaskId").ToString().Trim();
  441. if (String.IsNullOrEmpty(strTaskId))
  442. {
  443. MessageUtil.ShowTips("选择的评审单单号为空!");
  444. }
  445. if (testStatus(strTaskId, 1) == false)
  446. {
  447. return;
  448. }
  449. TaskEva taskEva = new TaskEva();
  450. taskEva.TaskRecordId = strTaskId;
  451. taskEva.Validflag = "1";
  452. taskEva.CreateName = UserInfo.GetUserName();
  453. taskEva.CreateTime = DateTime.Now;
  454. taskEva.CreateUserId = UserInfo.GetUserID();
  455. if (radioButton1.Checked)
  456. {
  457. taskEva.EvaResult = "1";//审批通过
  458. }
  459. else if (radioButton2.Checked)
  460. {
  461. taskEva.EvaResult = "0";//审批不通过
  462. }
  463. taskEva.IsLatest = "1";
  464. taskEva.EvaMsg = txt_msg.Text.ToString().Trim();
  465. if (MessageUtil.ShowYesNoAndQuestion("确定提价评单?") != DialogResult.Yes)
  466. {
  467. return;
  468. }
  469. CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.purplan.service.TaskEvaService", "doInsert_Eva", new object[] { taskEva });
  470. if (crt.Resultcode == 0)
  471. {
  472. MessageUtil.ShowTips("评单成功! 新增评单:" + crt.Resultmsg);
  473. ClearTab2();
  474. doQueryTaskEva(strTaskId);
  475. require_plan.comm.doActiveSelRow(ultraGrid2, "EVAID", crt.Resultmsg);
  476. }
  477. else
  478. {
  479. MessageUtil.ShowTips("操作失败:" + crt.Resultmsg);
  480. }
  481. }
  482. catch (Exception ex)
  483. {
  484. MessageUtil.ShowTips("操作失败:" + ex.Message);
  485. }
  486. }
  487. //撤销评单
  488. private void cancelRecord()
  489. {
  490. try
  491. {
  492. if (ultraGrid1.ActiveRow == null)
  493. {
  494. MessageUtil.ShowTips("请选择任务单!");
  495. }
  496. string strTaskId = ultraGrid1.ActiveRow.GetCellValue("TaskId").ToString().Trim();
  497. if (String.IsNullOrEmpty(strTaskId))
  498. {
  499. MessageUtil.ShowTips("选择的任务单单号为空!");
  500. }
  501. if (ultraGrid2.ActiveRow == null)
  502. {
  503. MessageUtil.ShowTips("请选择任务单评审意见!");
  504. }
  505. string strTaskEvaId = ultraGrid2.ActiveRow.GetCellValue("evaid").ToString().Trim();
  506. if (String.IsNullOrEmpty(strTaskEvaId))
  507. {
  508. MessageUtil.ShowTips("选择的评审意见主键为空!");
  509. }
  510. if (testStatusEva(strTaskEvaId, 1) == false)
  511. {
  512. return;
  513. }
  514. TaskEva taskEva = new TaskEva();
  515. taskEva.EvaId = strTaskEvaId;
  516. taskEva.Validflag = "0";
  517. taskEva.DeleteName = UserInfo.GetUserName();
  518. taskEva.DeleteTime = DateTime.Now;
  519. taskEva.DeleteUserId = UserInfo.GetUserID();
  520. if (MessageUtil.ShowYesNoAndQuestion("确定撤销该评单:" + strTaskEvaId + "?") != DialogResult.Yes)
  521. {
  522. return;
  523. }
  524. CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.purplan.service.TaskEvaService", "doUpdate", new object[] { taskEva });
  525. if (crt.Resultcode == 0)
  526. {
  527. MessageUtil.ShowTips("撤销成功");
  528. ClearTab2();
  529. doQueryTaskEva(strTaskId);
  530. }
  531. else
  532. {
  533. MessageUtil.ShowTips("操作失败:" + crt.Resultmsg);
  534. }
  535. }
  536. catch (Exception ex)
  537. {
  538. MessageUtil.ShowTips("操作失败:" + ex.Message);
  539. }
  540. }
  541. //打印
  542. private void doPrint()
  543. {
  544. try
  545. {
  546. this.Cursor = Cursors.WaitCursor;
  547. String strRecordId = jy_RecordId.Text.Trim();
  548. if (String.IsNullOrEmpty(strRecordId))
  549. {
  550. MessageUtil.ShowWarning("纪要号空!");
  551. jy_RecordId.Focus();
  552. return;
  553. }
  554. if (ultraGrid1.ActiveRow == null)
  555. {
  556. MessageUtil.ShowTips("请选择任务单!");
  557. }
  558. string strTaskId = ultraGrid1.ActiveRow.GetCellValue("TaskId").ToString().Trim();
  559. if (String.IsNullOrEmpty(strTaskId))
  560. {
  561. MessageUtil.ShowTips("选择的任务单单号为空!");
  562. }
  563. if (testStatus(strTaskId, 5) == false)
  564. {
  565. return;
  566. }
  567. //string ordLnPk = ugr.Cells["ORD_LN_PK"].Value.ToString();
  568. //string saleOrg = ugr.Cells["SALE_ORG"].Value.ToString();
  569. //string ordPk = ugr.Cells["ORD_PK"].Value.ToString();
  570. string strurl = "";
  571. DataTable dt = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { "1223" }, this.ob);
  572. DataRow[] drArr = dt.Select("validflag='1'");
  573. if (drArr.Length != 1)
  574. {
  575. MessageUtil.ShowTips("基础数据维护错误:报表系统需维护有效的Ip且只能维护一个有效ip!");
  576. return;
  577. }
  578. String TipsEnv = drArr[0]["baseName"].ToString();
  579. String strUrlPort = "http://172.54.10.42:8080";//报表系统IP
  580. String[] str = strUrlPort.Split(':');
  581. String strUrl = str[0] + ":" + str[1];
  582. if (ob.MainUrl.StartsWith(strUrl))
  583. {
  584. //测试环境
  585. if (TipsEnv == "2")
  586. {
  587. strurl = strUrlPort + "/webroot/decision/view/report?viewlet=RepTaskRecordDev.cpt&__bypagesize__=false" + "&cmbTaskRecordId=" + strRecordId;
  588. }
  589. else
  590. {
  591. strurl = strUrlPort + "/webroot/decision/view/report?viewlet=RepTaskRecord.cpt&__bypagesize__=false" + "&cmbTaskRecordId=" + strRecordId;
  592. }
  593. }
  594. else
  595. {
  596. //测试环境
  597. if (TipsEnv == "2")
  598. {
  599. strurl = strUrlPort + "/webroot/decision/view/report?viewlet=RepTaskRecordDev.cpt&__bypagesize__=false" + "&cmbTaskRecordId=" + strRecordId;
  600. }
  601. else
  602. {
  603. strurl = strUrlPort + "/webroot/decision/view/report?viewlet=RepTaskRecord.cpt&__bypagesize__=false" + "&cmbTaskRecordId=" + strRecordId;
  604. }
  605. }
  606. //if (ob.MainUrl.StartsWith("http://127.0.0.1"))
  607. //{
  608. // strurl = "http://localhost:8075/webroot/decision/view/report?viewlet=RepTaskRecord.cpt&__bypagesize__=false" + "&cmbTaskRecordId=" + strTaskRecordId;
  609. //}
  610. //else
  611. //{
  612. // strurl = "http://localhost:8075/webroot/decision/view/report?viewlet=RepTaskRecord.cpt&__bypagesize__=false" + "&cmbTaskRecordId=" + strTaskRecordId;
  613. //}
  614. FrmRepExcel fBug = new FrmRepExcel(ob, strurl);
  615. fBug.AutoSize = true;
  616. fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  617. fBug.WindowState = FormWindowState.Maximized;
  618. fBug.Text = "TPCO采购纪要查询";
  619. fBug.Show();
  620. }
  621. finally
  622. {
  623. this.Cursor = Cursors.Default;
  624. }
  625. }
  626. //点击纪要号查询明细和评审意见
  627. private void ultraGrid1_ClickCell(object sender, Infragistics.Win.UltraWinGrid.ClickCellEventArgs e)
  628. {
  629. }
  630. //获取纪要号查询明细和评审意见
  631. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  632. {
  633. dataSet2.Clear();
  634. dataSet3.Clear();
  635. UltraGridRow Row = ultraGrid1.ActiveRow;
  636. if (Row != null)
  637. {
  638. if (Row.Cells["TaskId"].Value != null)
  639. {
  640. //加载采购纪要数据
  641. string strTaskId = Row.Cells["TaskId"].Value.ToString().Trim();
  642. doQueryTaskRecord(strTaskId);
  643. //加载采购纪要评单记录表
  644. doQueryTaskEva(strTaskId);
  645. //加载中标记录
  646. doQueryTaskBidRecord(strTaskId);
  647. }
  648. }
  649. }
  650. //加载中标明细
  651. private void doQueryTaskBidRecord(string strTaskId)
  652. {
  653. DataTable dt = this.execute<DataTable>("com.hnshituo.pur.purplan.service.TaskOfferMService", "getSuppResM", new object[] { strTaskId });
  654. GridHelper.CopyDataToDatatable(dt, dataTable4, true);
  655. PurTaskOfferCEntity TkoC = new PurTaskOfferCEntity();
  656. TkoC.TaskId = strTaskId;
  657. TkoC.Validflag = "1";
  658. TkoC.IsBid = "1";
  659. DataTable dt1 = this.execute<DataTable>("com.hnshituo.pur.purplan.service.TaskOfferCService", "findTaskOfferC", new object[] { TkoC });
  660. GridHelper.CopyDataToDatatable(dt1, dataTable3, true);
  661. }
  662. //加载评单明细
  663. private void doQueryTaskRecord(string strTaskId)
  664. {
  665. ClearTab1();
  666. PurTaskRecordEntity taskR = new PurTaskRecordEntity();
  667. taskR.TaskId = strTaskId;
  668. taskR.Validflag = "1";
  669. List<PurTaskRecordEntity> taskRecordList = this.execute<List<PurTaskRecordEntity>>("com.hnshituo.pur.purplan.service.TaskRecordService", "getTaskRecord", new object[] { taskR});
  670. if (taskRecordList != null )
  671. {
  672. if (taskRecordList.Count > 0)
  673. {
  674. jy_buyerUsername.Text = taskRecordList[0].BuyerUsername;
  675. jy_mngOrgName.Text = taskRecordList[0].MngOrgName;
  676. jy_negDate.Value = taskRecordList[0].NegDate;
  677. jy_procRecord.Text = taskRecordList[0].ProcRecord;
  678. jy_taskId.Text = taskRecordList[0].TaskId;
  679. jy_taskName.Text = taskRecordList[0].TaskName;
  680. jy_RecordId.Text = taskRecordList[0].Id;
  681. jy_status.Text = taskRecordList[0].Status;
  682. }
  683. else
  684. {
  685. jy_buyerUsername.Text = UserInfo.GetUserName();
  686. jy_mngOrgName.Text = UserInfo.GetDepartment();
  687. jy_negDate.Value = DateTime.Now;
  688. jy_procRecord.Text = "";
  689. jy_taskId.Text = strTaskId;
  690. jy_taskName.Text = ultraGrid1.ActiveRow.GetCellValue("taskName").ToString().Trim();
  691. jy_RecordId.Clear();
  692. jy_status.Clear();
  693. }
  694. }
  695. else
  696. {
  697. jy_buyerUsername.Text = UserInfo.GetUserName();
  698. jy_mngOrgName.Text = UserInfo.GetDepartment();
  699. jy_negDate.Value = DateTime.Now;
  700. jy_procRecord.Text = "";
  701. jy_taskId.Text = strTaskId;
  702. jy_taskName.Text = ultraGrid1.ActiveRow.GetCellValue("taskName").ToString().Trim();
  703. jy_RecordId.Clear();
  704. jy_status.Clear();
  705. }
  706. }
  707. //加载评单意见表
  708. private void doQueryTaskEva(string strTaskId)
  709. {
  710. dataSet2.Clear();
  711. DataTable dt6 = this.execute<DataTable>("com.hnshituo.pur.purplan.service.TaskEvaService", "doQueryEva", new object[] { strTaskId });
  712. GridHelper.CopyDataToDatatable(dt6, dataTable2, true);
  713. }
  714. //清空评审明细区
  715. private void ClearTab1()
  716. {
  717. ConfigureClassCommon.clearOldData(ultraPanel1);
  718. jy_procRecord.Clear();
  719. }
  720. //清空评审意见区
  721. private void ClearTab2()
  722. {
  723. txt_msg.Clear();
  724. }
  725. //纪要权限判断
  726. private bool testStatus(string strTaskId, int p)
  727. {
  728. PurTaskMEntity PurTaskM = this.execute<PurTaskMEntity>("com.hnshituo.pur.purplan.service.TaskMService", "findById", new object[] { strTaskId });
  729. if (PurTaskM == null)
  730. {
  731. MessageUtil.ShowTips("未发现任务单号:" + strTaskId + "信息记录,可能已被作废!或请刷新界面重新操作!");
  732. return false;
  733. }
  734. if (PurTaskM.Validflag == "0")
  735. {
  736. MessageUtil.ShowTips("任务单号:" + strTaskId + "信息记录可能已被作废!或请刷新界面重新操作!");
  737. return false;
  738. }
  739. //新增纪要判断
  740. else if (p == 0)
  741. {
  742. if (PurTaskM.Status != "7")
  743. {
  744. MessageUtil.ShowTips("任务单号:" + strTaskId + "信息还未初拟中标或已经生成采购纪要,无法进行纪要新增操作!或请刷新界面重新操作!");
  745. return false;
  746. }
  747. //判断是否所有人都有评审记录
  748. CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.purplan.service.TaskEvaService", "checkIsAllreview", new object[] { strTaskId });
  749. if (crt.Resultcode != 0)
  750. {
  751. MessageUtil.ShowTips("新增失败:"+crt.Resultmsg);
  752. return false;
  753. }
  754. }
  755. //评单权限判断
  756. else if (p == 1)
  757. {
  758. if (PurTaskM.Status != "7")
  759. {
  760. MessageUtil.ShowTips("任务单号:" + strTaskId + "信息还未初拟中标或已经生成采购纪要,无法进行纪要生成和评单操作!或请刷新界面重新操作!");
  761. return false;
  762. }
  763. }
  764. //采购纪要生效权限判断和改权限判断
  765. else if (p == 2)
  766. {
  767. String strRecordId = jy_RecordId.Text.Trim();
  768. PurTaskRecordEntity taskRecord = this.execute<PurTaskRecordEntity>("com.hnshituo.pur.purplan.service.TaskRecordService", "findById", new object[] { strRecordId });
  769. if (taskRecord == null)
  770. {
  771. MessageUtil.ShowTips("未发现纪要:" + strRecordId + "信息记录,可能已被作废!或请刷新界面重新操作!");
  772. return false;
  773. }
  774. if (taskRecord.Validflag == "0")
  775. {
  776. MessageUtil.ShowTips("纪要:" + strRecordId + "信息记录可能已被作废!或请刷新界面重新操作!");
  777. return false;
  778. }
  779. if (taskRecord.BuyerUserid!=UserInfo.GetUserID())
  780. {
  781. MessageUtil.ShowTips("非纪要:" + strRecordId + "创建本人操作,无权限!");
  782. return false;
  783. }
  784. if (taskRecord.Status != "2")
  785. {
  786. MessageUtil.ShowTips("非纪要:" + strRecordId + "信息不在“评审中”状态!或请刷新界面重新操作!");
  787. return false;
  788. }
  789. }
  790. //删权限判断
  791. else if (p == 3)
  792. {
  793. String strRecordId = jy_RecordId.Text.Trim();
  794. PurTaskRecordEntity taskRecord = this.execute<PurTaskRecordEntity>("com.hnshituo.pur.purplan.service.TaskRecordService", "findById", new object[] { strRecordId });
  795. if (taskRecord == null)
  796. {
  797. MessageUtil.ShowTips("未发现纪要:" + strRecordId + "信息记录,可能已被作废!或请刷新界面重新操作!");
  798. return false;
  799. }
  800. if (taskRecord.Validflag == "0")
  801. {
  802. MessageUtil.ShowTips("纪要:" + strRecordId + "信息记录可能已被作废!或请刷新界面重新操作!");
  803. return false;
  804. }
  805. if (taskRecord.BuyerUserid != UserInfo.GetUserID())
  806. {
  807. MessageUtil.ShowTips("非纪要:" + strRecordId + "创建本人操作,无权限!");
  808. return false;
  809. }
  810. if (taskRecord.Status != "2" && taskRecord.Status != "3")
  811. {
  812. MessageUtil.ShowTips("纪要:" + strRecordId + "信息不在“评审中”或者“已生效”状态,无法进行删除操作!或请刷新界面重新操作!");
  813. return false;
  814. }
  815. //判断合同状态
  816. OrderM Odm = new OrderM();
  817. Odm.TaskRecordId = strRecordId;
  818. Odm.Validflag = "1";
  819. List<OrderM> list = this.execute<List<OrderM>>("com.hnshituo.pur.order.service.OrderMService", "find", new object[] { Odm, 0, 0 });
  820. foreach (OrderM tempOdm in list)
  821. {
  822. if (tempOdm.Status != "1" && tempOdm.Status != "4")
  823. {
  824. MessageUtil.ShowTips("纪要:" + strRecordId + "相关的合同:" + tempOdm.OrderId + "已审批或者已审批完,无法进行作废操作!或请刷新界面重新操作!");
  825. return false;
  826. }
  827. }
  828. }
  829. //撤销权限判断
  830. else if (p == 4)
  831. {
  832. String strRecordId = jy_RecordId.Text.Trim();
  833. PurTaskRecordEntity taskRecord = this.execute<PurTaskRecordEntity>("com.hnshituo.pur.purplan.service.TaskRecordService", "findById", new object[] { strRecordId });
  834. if (taskRecord == null)
  835. {
  836. MessageUtil.ShowTips("未发现纪要:" + strRecordId + "信息记录,可能已被作废!或请刷新界面重新操作!");
  837. return false;
  838. }
  839. if (taskRecord.Validflag == "0")
  840. {
  841. MessageUtil.ShowTips("纪要:" + strRecordId + "信息记录可能已被作废!或请刷新界面重新操作!");
  842. return false;
  843. }
  844. if (taskRecord.BuyerUserid != UserInfo.GetUserID())
  845. {
  846. MessageUtil.ShowTips("非纪要:" + strRecordId + "创建本人操作,无权限!");
  847. return false;
  848. }
  849. if (taskRecord.Status != "3")
  850. {
  851. MessageUtil.ShowTips("纪要:" + strRecordId + "信息不在“已生效”状态,无法进行撤回操作!或请刷新界面重新操作!");
  852. return false;
  853. }
  854. //判断合同状态
  855. OrderM Odm = new OrderM();
  856. Odm.TaskRecordId = strRecordId;
  857. Odm.Validflag = "1";
  858. List<OrderM> list = this.execute<List<OrderM>>("com.hnshituo.pur.order.service.OrderMService", "find", new object[] { Odm, 0, 0 });
  859. foreach (OrderM tempOdm in list)
  860. {
  861. if (tempOdm.Status != "1" && tempOdm.Status != "4")
  862. {
  863. MessageUtil.ShowTips("纪要:" + strRecordId + "相关的合同:" + tempOdm.OrderId + "已审批或者已审批完,无法进行撤回操作!或请刷新界面重新操作!");
  864. return false;
  865. }
  866. }
  867. }
  868. //打印操作
  869. else if (p == 5)
  870. {
  871. String strRecordId = jy_RecordId.Text.Trim();
  872. PurTaskRecordEntity taskRecord = this.execute<PurTaskRecordEntity>("com.hnshituo.pur.purplan.service.TaskRecordService", "findById", new object[] { strRecordId });
  873. if (taskRecord == null)
  874. {
  875. MessageUtil.ShowTips("未发现纪要:" + strRecordId + "信息记录,可能已被作废!或请刷新界面重新操作!");
  876. return false;
  877. }
  878. if (taskRecord.Validflag == "0")
  879. {
  880. MessageUtil.ShowTips("纪要:" + strRecordId + "信息记录可能已被作废!或请刷新界面重新操作!");
  881. return false;
  882. }
  883. }
  884. else
  885. {
  886. MessageUtil.ShowTips("未知参数!");
  887. return false;
  888. }
  889. return true;
  890. }
  891. //评审意见权限判断
  892. private bool testStatusEva(string strTaskEvaId, int p)
  893. {
  894. TaskEva taskEva = this.execute<TaskEva>("com.hnshituo.pur.purplan.service.TaskEvaService", "findById", new object[] { strTaskEvaId });
  895. if (taskEva == null)
  896. {
  897. MessageUtil.ShowTips("未发现评审意见:" + strTaskEvaId + "信息记录,可能已被作废!或请刷新界面重新操作!");
  898. return false;
  899. }
  900. if (taskEva.Validflag == "0")
  901. {
  902. MessageUtil.ShowTips("评审意见:" + strTaskEvaId + "信息记录可能已被作废!或请刷新界面重新操作!");
  903. return false;
  904. }
  905. if (taskEva.CreateUserId != UserInfo.GetUserID())
  906. {
  907. MessageUtil.ShowTips("非本人提交的评审意见,暂无权限进行删改操作!或请刷新界面重新操作!");
  908. return false;
  909. }
  910. //撤销评单权限判断
  911. if (p == 1)
  912. {
  913. string strTaskId = taskEva.TaskRecordId;
  914. PurTaskMEntity PurTaskM = this.execute<PurTaskMEntity>("com.hnshituo.pur.purplan.service.TaskMService", "findById", new object[] { strTaskId });
  915. if (PurTaskM == null)
  916. {
  917. MessageUtil.ShowTips("未发现任务单号:" + strTaskId + "信息记录,可能已被作废!或请刷新界面重新操作!");
  918. return false;
  919. }
  920. if (PurTaskM.Validflag == "0")
  921. {
  922. MessageUtil.ShowTips("未发现任务单号:" + strTaskId + "信息记录可能已被作废!或请刷新界面重新操作!");
  923. return false;
  924. }
  925. if (PurTaskM.Status != "7")
  926. {
  927. MessageUtil.ShowTips("任务单号:" + strTaskId + "信息记录已生成采购纪要,暂无法撤销评单意见!或请刷新界面重新操作!");
  928. return false;
  929. }
  930. }
  931. else
  932. {
  933. MessageUtil.ShowTips("未知参数!");
  934. return false;
  935. }
  936. return true;
  937. }
  938. private void ck_ctime_CheckedChanged(object sender, EventArgs e)
  939. {
  940. txt_createTimeEnd.Enabled = ck_ctime.Checked;
  941. txt_createTimeStart.Enabled = ck_ctime.Checked;
  942. }
  943. private void btn_SubmitLun_Click(object sender, EventArgs e)
  944. {
  945. doRecord();
  946. }
  947. }
  948. }