FrmOrderAuthentication.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  1. using com.steering.pss.sale.order.model;
  2. using Core.Mes.Client.Comm.Control;
  3. using Core.Mes.Client.Comm.Server;
  4. using Core.Mes.Client.Comm.Tool;
  5. using Core.StlMes.Client.SaleOrder.Dialog;
  6. using CoreFS.CA06;
  7. using Infragistics.Win.UltraWinGrid;
  8. using System;
  9. using System.Collections;
  10. using System.Collections.Generic;
  11. using System.ComponentModel;
  12. using System.Data;
  13. using System.Drawing;
  14. using System.Linq;
  15. using System.Text;
  16. using System.Windows.Forms;
  17. namespace Core.StlMes.Client.SaleOrder.OrderForm
  18. {
  19. public partial class FrmOrderAuthentication : FrmBase
  20. {
  21. public FrmOrderAuthentication()
  22. {
  23. InitializeComponent();
  24. this.IsLoadUserView = true;
  25. }
  26. /// <summary>
  27. /// 可以编辑的列
  28. /// </summary>
  29. List<string> editList = new List<string>();
  30. private void FrmOrderAuthentication_Load(object sender, EventArgs e)
  31. {
  32. EntityHelper.ShowGridCaption<SlmOrderAuthenticationEntity>(gdOrderInfo.DisplayLayout.Bands[0]);
  33. editList.AddRange(new string[] { "CUSTMSIGNDATE", "CUSTMDELVRYDATE", "SCHAPPROVENO",
  34. "ORDAPPROVENO", "MEMO", "CUSTMORDERNO" });
  35. dtpEnd.Value = DateTime.Now;
  36. dtpStart.Value = DateTime.Now.AddMonths(-2);
  37. }
  38. public override void ToolBar_Click(object sender, string ToolbarKey)
  39. {
  40. switch (ToolbarKey)
  41. {
  42. case "Query":
  43. QueryAuthedOrd();
  44. break;
  45. case "ReturnTime":
  46. ReturnTime();
  47. break;
  48. case "Save":
  49. SaveWriteData();
  50. break;
  51. case "GetData":
  52. getOrdData();
  53. break;
  54. case "Update":
  55. UpdateDataBase();
  56. break;
  57. case "Close":
  58. this.Close();
  59. break;
  60. case "Export":
  61. GridHelper.ulGridToExcel(gdOrderInfo, "认证合同");
  62. break;
  63. case "Print":
  64. gdOrderInfo.UpdateData();
  65. UltraGridRow row = gdOrderInfo.ActiveRow;
  66. if (row == null) return;
  67. string strOrderLinePk = row.Cells["ORDLNPK"].Value.ToString();
  68. string url ="";
  69. url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepSalesStockOutOrder.cpt&__bypagesize__=false&ORD_LN_PK=" + strOrderLinePk + "";
  70. FrmRepExcel fre = new FrmRepExcel(this.ob, url);
  71. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  72. fre.Text = "天津钢管集团股份有限公司产品出库单";
  73. fre.ShowDialog();
  74. break;
  75. }
  76. }
  77. /// <summary>
  78. /// 获取合同数据至合同认证表
  79. /// </summary>
  80. private void getOrdData()
  81. {
  82. WaitingForm2 wf = new WaitingForm2();
  83. wf.Msg = "数据处理中,请稍等。。。";
  84. wf.Show();
  85. wf.Update();
  86. try
  87. {
  88. CoreClientParam ccp = new CoreClientParam();
  89. ccp.IfShowErrMsg = false;
  90. ccp.ServerName = "com.steering.pss.sale.order.CoreOrderAuthentication";
  91. ccp.MethodName = "getOrdData";
  92. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  93. if (ccp != null)
  94. {
  95. if (ccp.ReturnCode == -1)
  96. {
  97. MessageUtil.ShowWarning(ccp.ReturnInfo);
  98. wf.Close();
  99. return;
  100. }
  101. wf.Close();
  102. QueryAuthedOrd();
  103. }
  104. }
  105. finally
  106. {
  107. wf.ShowToUser = false;
  108. wf.Close();
  109. }
  110. }
  111. /// <summary>
  112. /// 查询数据
  113. /// </summary>
  114. private void QueryAuthedOrd()
  115. {
  116. WaitingForm2 wf = new WaitingForm2();
  117. wf.Msg = "数据查询中,请稍等。。。";
  118. wf.Show();
  119. wf.Update();
  120. try
  121. {
  122. string ordNo = "";
  123. string strArea = "";
  124. string timeStart = "";
  125. string timeEnd = "";
  126. if (chkOrderNo.Checked)
  127. ordNo = txtOrderNo.Text.Trim();
  128. if (chkArea.Checked)
  129. strArea = this.txtArea.Text.Trim();
  130. if (chkTime.Checked)
  131. {
  132. if (dtpEnd.Value < dtpStart.Value)
  133. {
  134. MessageUtil.ShowWarning("开始时间不能大于结束时间!");
  135. return;
  136. }
  137. timeStart = dtpStart.Value.ToString("yyyy-MM-dd") + " 00:00:01";
  138. timeEnd = dtpEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59";
  139. }
  140. List<SlmOrderAuthenticationEntity> list = EntityHelper.GetData<SlmOrderAuthenticationEntity>(
  141. "com.steering.pss.sale.order.CoreOrderAuthentication.queryAuthedOrd", new object[] { ordNo, strArea, timeStart, timeEnd, timeType.Value.ToString() }, this.ob);
  142. slmOrderAuthenticationBS1.DataSource = list;
  143. wf.Close();
  144. foreach (UltraGridRow urg in gdOrderInfo.Rows)
  145. {
  146. if (urg.Cells["OrderFile"].Text.Equals("有合同文本"))
  147. {
  148. urg.Cells["OrderFile"].Appearance.ForeColor = Color.Red;
  149. }
  150. if (urg.Cells["UserorderFile"].Text.Equals("有合同文本"))
  151. {
  152. urg.Cells["UserorderFile"].Appearance.ForeColor = Color.Red;
  153. }
  154. }
  155. }
  156. finally
  157. {
  158. wf.ShowToUser = false;
  159. wf.Close();
  160. }
  161. }
  162. /// <summary>
  163. /// 后台更新数据 (将多个数据表的数据搬到 SLM_ORDER_AUTHENTICATION 表中 )
  164. /// </summary>
  165. private void UpdateDataBase()
  166. {
  167. gdOrderInfo.UpdateData();
  168. UltraGridRow[] row = gdOrderInfo.Rows.AsQueryable().Where(a => a.Cells["CHK"].Value.ToString().ToUpper() == "TRUE").ToArray();
  169. if (row.Length <= 0)
  170. {
  171. MessageUtil.ShowWarning("请选择需要更新的合同号!");
  172. return;
  173. }
  174. List<string> ordArr = new List<string>();
  175. for (int i = 0; i < row.Length; i++)
  176. {
  177. if (!ordArr.Contains(row[i].Cells["OrderNo"].Value.ToString())
  178. && !string.IsNullOrEmpty(row[i].Cells["OrderNo"].Value.ToString())
  179. && !row[i].IsFilteredOut)
  180. {
  181. ordArr.Add(row[i].Cells["OrderNo"].Value.ToString());
  182. }
  183. }
  184. string[] strResult = ordArr.ToArray();
  185. if (strResult.Length > 10000)
  186. {
  187. MessageUtil.ShowWarning("鉴于系统数据量过大,合同号的个数不能超过300个!");
  188. return;
  189. }
  190. WaitingForm2 wf = new WaitingForm2();
  191. wf.Msg = "正在更新数据中,请稍等。。。";
  192. wf.Show();
  193. wf.Update();
  194. try
  195. {
  196. CoreClientParam ccp = new CoreClientParam();
  197. ccp.IfShowErrMsg = false;
  198. ccp.ServerName = "com.steering.pss.sale.order.CoreOrderAuthentication";
  199. ccp.MethodName = "updateData";
  200. ccp.ServerParams = new object[] { strResult };
  201. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  202. if (ccp != null)
  203. {
  204. if (ccp.ReturnCode == -1)
  205. {
  206. MessageUtil.ShowWarning(ccp.ReturnInfo);
  207. wf.Close();
  208. return;
  209. }
  210. wf.Close();
  211. QueryAuthedOrd();
  212. }
  213. }
  214. finally
  215. {
  216. wf.ShowToUser = false;
  217. wf.Close();
  218. }
  219. }
  220. private void gdOrderInfo_AfterRowActivate(object sender, EventArgs e)
  221. {
  222. UltraGridRow uRow = gdOrderInfo.ActiveRow;
  223. if (uRow != null)
  224. {
  225. if (uRow.Cells["CHK"].Value.ToString().ToUpper() == "TRUE")
  226. {
  227. for (int i = 0; i < editList.Count; i++)
  228. {
  229. uRow.Cells[editList[i]].Activation = Activation.AllowEdit;
  230. }
  231. }
  232. else
  233. {
  234. for (int i = 0; i < editList.Count; i++)
  235. {
  236. uRow.Cells[editList[i]].Activation = Activation.ActivateOnly;
  237. }
  238. }
  239. }
  240. }
  241. private void gdOrderInfo_CellChange(object sender, CellEventArgs e)
  242. {
  243. if (!e.Cell.Column.Key.ToUpper().Equals("CUSTMSIGNDATE") &&
  244. !e.Cell.Column.Key.ToUpper().Equals("CUSTMDELVRYDATE"))
  245. gdOrderInfo.UpdateData();
  246. if (e.Cell.Column.Key.Equals("CHK"))
  247. {
  248. if (e.Cell.Value.ToString().ToUpper() == "TRUE")
  249. {
  250. for (int i = 0; i < editList.Count; i++)
  251. {
  252. e.Cell.Row.Cells[editList[i]].Activation = Activation.AllowEdit;
  253. }
  254. }
  255. else
  256. {
  257. for (int i = 0; i < editList.Count; i++)
  258. {
  259. e.Cell.Row.Cells[editList[i]].Activation = Activation.ActivateOnly;
  260. }
  261. }
  262. }
  263. }
  264. private void gdOrderInfo_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  265. {
  266. foreach (UltraGridRow uRow in gdOrderInfo.Selected.Rows)
  267. {
  268. if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
  269. {
  270. uRow.Cells["CHK"].Value = true;
  271. }
  272. }
  273. }
  274. private void ReturnTime()
  275. {
  276. gdOrderInfo.UpdateData();
  277. UltraGridRow[] row = gdOrderInfo.Rows.AsQueryable().Where(a => a.Cells["CHK"].Value.ToString().ToUpper() == "TRUE").ToArray();
  278. if (row.Length <= 0)
  279. {
  280. MessageUtil.ShowWarning("请选择您要确认合同返回的合同!");
  281. return;
  282. }
  283. List<string> ordArr = new List<string>();
  284. for (int i = 0; i < row.Length; i++)
  285. {
  286. if (!row[i].IsFilteredOut)
  287. {
  288. ordArr.Add(row[i].Cells["ORDLNPK"].Value.ToString());
  289. }
  290. }
  291. string[] parm = ordArr.ToArray();
  292. //int flag = 0;
  293. //foreach (var uRow in row)
  294. //{
  295. // if (uRow.Cells["ISRETURN"].Value.ToString() == "已返回")
  296. // flag += 1;
  297. //}
  298. //string str = "";
  299. //if (flag > 0)
  300. //{
  301. // str = "存在已经确认返回的合同,是否覆盖其返回时间?";
  302. //}
  303. //else
  304. //{
  305. // str = "是否确认合同返回?";
  306. //}
  307. if (MessageUtil.ShowYesNoAndQuestion("是否确认合同返回?") == DialogResult.No) return;
  308. CoreClientParam ccp = new CoreClientParam();
  309. ccp.IfShowErrMsg = false;
  310. ccp.ServerName = "com.steering.pss.sale.order.CoreOrderAuthentication";
  311. ccp.MethodName = "returnTime";
  312. ccp.ServerParams = new object[] { parm, UserInfo.GetUserName() };
  313. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  314. if (ccp != null)
  315. {
  316. if (ccp.ReturnCode == -1)
  317. {
  318. MessageUtil.ShowWarning(ccp.ReturnInfo);
  319. return;
  320. }
  321. MessageUtil.ShowTips("确认合同返回成功!");
  322. QueryAuthedOrd();
  323. }
  324. }
  325. /// <summary>
  326. /// 保存数据
  327. /// </summary>
  328. private void SaveWriteData()
  329. {
  330. gdOrderInfo.UpdateData();
  331. UltraGridRow[] row = gdOrderInfo.Rows.AsQueryable().Where(a => a.Cells["CHK"].Value.ToString().ToUpper() == "TRUE").ToArray();
  332. if (row.Length <= 0)
  333. {
  334. MessageUtil.ShowWarning("请选择需要保存的数据!");
  335. return;
  336. }
  337. ArrayList parm = new ArrayList();
  338. foreach (var uRow in row)
  339. {
  340. SlmOrderAuthenticationEntity soa = (SlmOrderAuthenticationEntity)uRow.ListObject;
  341. if (soa.CustmSignDate != "")
  342. {
  343. if (StringUtil.IsNotDateTime(soa.CustmSignDate))
  344. {
  345. MessageUtil.ShowWarning("请输入客户合同签订日期!");
  346. return;
  347. }
  348. soa.CustmSignDate = Convert.ToDateTime(soa.CustmSignDate).ToString("yyyy-MM-dd");
  349. }
  350. if (soa.CustmDelvryDate != "")
  351. {
  352. if (StringUtil.IsNotDateTime(soa.CustmDelvryDate))
  353. {
  354. MessageUtil.ShowWarning("请输入客户合同交货日期!");
  355. return;
  356. }
  357. soa.CustmDelvryDate = Convert.ToDateTime(soa.CustmDelvryDate).ToString("yyyy-MM-dd");
  358. }
  359. /*if (soa.SchApproveNo == "")
  360. {
  361. MessageUtil.ShowWarning("请输入排产审批单号!");
  362. return;
  363. }
  364. if (soa.OrdApproveNo == "")
  365. {
  366. MessageUtil.ShowWarning("请输入合同审批单号!");
  367. return;
  368. }*/
  369. parm.Add(soa);
  370. }
  371. if (MessageUtil.ShowYesNoAndQuestion("是否保存数据?") == DialogResult.No) return;
  372. CoreClientParam ccp = new CoreClientParam();
  373. ccp.IfShowErrMsg = false;
  374. ccp.ServerName = "com.steering.pss.sale.order.CoreOrderAuthentication";
  375. ccp.MethodName = "saveWrite";
  376. ccp.ServerParams = new object[] { parm };
  377. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  378. if (ccp != null)
  379. {
  380. if (ccp.ReturnCode == -1)
  381. {
  382. MessageUtil.ShowWarning(ccp.ReturnInfo);
  383. return;
  384. }
  385. MessageUtil.ShowTips("保存成功!");
  386. QueryAuthedOrd();
  387. }
  388. }
  389. private void gdOrderInfo_CellDataError(object sender, CellDataErrorEventArgs e)
  390. {
  391. e.RaiseErrorEvent = false;
  392. e.StayInEditMode = true;
  393. }
  394. private void chkOrderNo_CheckedChanged(object sender, EventArgs e)
  395. {
  396. if (chkOrderNo.Checked)
  397. {
  398. txtOrderNo.ReadOnly = false;
  399. }
  400. else
  401. {
  402. txtOrderNo.ReadOnly = true;
  403. }
  404. }
  405. private void txtOrderNo_KeyPress(object sender, KeyPressEventArgs e)
  406. {
  407. if (e.KeyChar == 13)
  408. this.QueryAuthedOrd();
  409. }
  410. private void chkTime_CheckedChanged(object sender, EventArgs e)
  411. {
  412. if (!chkTime.Checked)
  413. {
  414. dtpStart.Enabled = false;
  415. dtpEnd.Enabled = false;
  416. }
  417. else
  418. {
  419. dtpStart.Enabled = true;
  420. dtpEnd.Enabled = true;
  421. }
  422. }
  423. private void txtOrderNo_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  424. {
  425. if (e.Button.Key.Equals("select"))
  426. {
  427. FrmOrdNoSelect fos = new FrmOrdNoSelect(this.ob);
  428. fos.ShowDialog();
  429. if (fos.DialogResult != DialogResult.OK)
  430. return;
  431. txtOrderNo.Tag = fos.OrdArr;
  432. }
  433. }
  434. private void OrdFile_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  435. {
  436. if (e.Button.Key.Equals("upload")) // 上传
  437. {
  438. UltraGridRow row = gdOrderInfo.ActiveRow;
  439. if (row == null)
  440. return;
  441. string ordPk = row.Cells["ORDPK"].Value.ToString();
  442. string reStr = FlileUpload("ORDFILE/" + ordPk);
  443. if (reStr == "F")
  444. {
  445. MessageUtil.ShowWarning("上传失败,尝试重新上传!");
  446. return;
  447. }
  448. else if (reStr == "N")
  449. {
  450. return;
  451. }
  452. //将合同所在的文件名称存入数据库
  453. if (updateOrderLineOrdFile(ordPk, "ORDFILE/" + ordPk))
  454. {
  455. MessageUtil.ShowTips("上传成功!");
  456. updateGridOrdFile(ordPk, "1");
  457. }
  458. }
  459. else if (e.Button.Key.Equals("view")) //预览
  460. {
  461. UltraGridRow row = gdOrderInfo.ActiveRow;
  462. if (row == null)
  463. return;
  464. string ordPk = row.Cells["ORDPK"].Value.ToString();
  465. string filePath = "ORDFILE/" + ordPk;
  466. dlgOrderAskDown down = new dlgOrderAskDown(this.ob, filePath);
  467. down.ShowDialog();
  468. if (down.CtrlFileDown1.List.Count == 0)
  469. {
  470. updateOrderLineOrdFile(ordPk, "");
  471. updateGridOrdFile(ordPk, "2");
  472. }
  473. }
  474. }
  475. /// <summary>
  476. /// 更新界面合同文本字段
  477. /// </summary>
  478. /// <param name="ordPk"></param>
  479. /// <param name="flag"></param>
  480. private void updateGridOrdFile(string ordPk, string flag)
  481. {
  482. UltraGridRow[] row = gdOrderInfo.Rows.AsQueryable().Where(a => a.Cells["ORDPK"].Value.ToString() == ordPk).ToArray();
  483. if (flag == "1")
  484. {
  485. for (int i = 0; i < row.Length; i++)
  486. {
  487. row[i].Cells["ORDERFILE"].Value = "有合同文本";
  488. }
  489. }
  490. else if (flag == "2")
  491. {
  492. for (int i = 0; i < row.Length; i++)
  493. {
  494. row[i].Cells["ORDERFILE"].Value = "无合同文本";
  495. }
  496. }
  497. }
  498. /// <summary>
  499. /// 更新界面合同文本字段
  500. /// </summary>
  501. /// <param name="ordPk"></param>
  502. /// <param name="flag"></param>
  503. private void updateGridUserOrdFile(string ordPk, string flag)
  504. {
  505. UltraGridRow[] row = gdOrderInfo.Rows.AsQueryable().Where(a => a.Cells["ORDPK"].Value.ToString() == ordPk).ToArray();
  506. if (flag == "1")
  507. {
  508. for (int i = 0; i < row.Length; i++)
  509. {
  510. row[i].Cells["USERORDERFILE"].Value = "有合同文本";
  511. }
  512. }
  513. else if (flag == "2")
  514. {
  515. for (int i = 0; i < row.Length; i++)
  516. {
  517. row[i].Cells["USERORDERFILE"].Value = "无合同文本";
  518. }
  519. }
  520. }
  521. /// <summary>
  522. /// 更新系统合同文本字段
  523. /// </summary>
  524. /// <param name="ordPk"></param>
  525. /// <param name="ordFile"></param>
  526. /// <returns>true 上传成功 false 上传失败</returns>
  527. private bool updateOrderLineOrdFile(string ordPk, string ordFile)
  528. {
  529. int count = ServerHelper.SetData("com.steering.pss.sale.order.CoreOrderAuthentication.updateOrdFile", new object[] { ordPk, ordFile }, this.ob);
  530. if (count > 0)
  531. {
  532. return true;
  533. }
  534. else
  535. {
  536. return false;
  537. }
  538. }
  539. /// <summary>
  540. /// 更新系统合同文本字段
  541. /// </summary>
  542. /// <param name="ordPk"></param>
  543. /// <param name="ordFile"></param>
  544. /// <returns>true 上传成功 false 上传失败</returns>
  545. private bool updateOrderLineUserOrdFile(string ordPk, string ordFile)
  546. {
  547. int count = ServerHelper.SetData("com.steering.pss.sale.order.CoreOrderAuthentication.updateUserOrdFile", new object[] { ordPk, ordFile }, this.ob);
  548. if (count > 0)
  549. {
  550. return true;
  551. }
  552. else
  553. {
  554. return false;
  555. }
  556. }
  557. /// <summary>
  558. /// 上传文件 返回文件名称列表
  559. /// </summary>
  560. /// <param name="sFileName"></param>
  561. /// <returns></returns>
  562. public static string FlileUpload(string sFileName)
  563. {
  564. List<FileBean> list = new List<FileBean>();
  565. FileBean bean = new FileBean();
  566. OpenFileDialog file = new OpenFileDialog();
  567. file.Multiselect = false; // file.Multiselect = true 改为 file.Multiselect = false
  568. DialogResult drStat;
  569. drStat = file.ShowDialog();
  570. string fileList = "";
  571. if (drStat == DialogResult.OK)
  572. {
  573. foreach (string fileName in file.FileNames)
  574. {
  575. bean = new FileBean();
  576. string filena = System.IO.Path.GetFileName(fileName);
  577. bean.setFileName(filena);
  578. bean.setPathName(sFileName);
  579. bean.setFile(FileHelper.FileToArray(fileName));
  580. list.Add(bean);
  581. fileList = filena;
  582. }
  583. bool isSuccess = false;
  584. isSuccess = Core.Mes.Client.Comm.Server.FileHelper.Upload(list);
  585. if (isSuccess)
  586. {
  587. return fileList;
  588. }
  589. else
  590. {
  591. return "F";
  592. }
  593. }
  594. else
  595. return "N"; //未选择文件
  596. }
  597. private void chkArea_CheckedChanged(object sender, EventArgs e)
  598. {
  599. txtArea.ReadOnly = !this.chkArea.Checked;
  600. }
  601. private void UserordFile_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  602. {
  603. if (e.Button.Key.Equals("upload")) // 上传
  604. {
  605. UltraGridRow row = gdOrderInfo.ActiveRow;
  606. if (row == null)
  607. return;
  608. string ordPk = row.Cells["ORDPK"].Value.ToString();
  609. string reStr = FlileUpload("USERORDFILE/" + ordPk);
  610. if (reStr == "F")
  611. {
  612. MessageUtil.ShowWarning("上传失败,尝试重新上传!");
  613. return;
  614. }
  615. else if (reStr == "N")
  616. {
  617. return;
  618. }
  619. //将合同所在的文件名称存入数据库
  620. if (updateOrderLineUserOrdFile(ordPk, "USERORDFILE/" + ordPk))
  621. {
  622. MessageUtil.ShowTips("上传成功!");
  623. updateGridUserOrdFile(ordPk, "1");
  624. }
  625. }
  626. else if (e.Button.Key.Equals("view")) //预览
  627. {
  628. UltraGridRow row = gdOrderInfo.ActiveRow;
  629. if (row == null)
  630. return;
  631. string ordPk = row.Cells["ORDPK"].Value.ToString();
  632. string filePath = "USERORDFILE/" + ordPk;
  633. dlgOrderAskDown down = new dlgOrderAskDown(this.ob, filePath);
  634. down.ShowDialog();
  635. if (down.CtrlFileDown1.List.Count == 0)
  636. {
  637. updateOrderLineUserOrdFile(ordPk, "");
  638. updateGridUserOrdFile(ordPk, "2");
  639. }
  640. }
  641. }
  642. }
  643. }