FrmOrderPrdcrBack.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 CoreFS.CA06;
  10. using Core.Mes.Client.Comm.Control;
  11. using Infragistics.Win.UltraWinGrid;
  12. using Core.Mes.Client.Comm.Tool;
  13. namespace Core.StlMes.Client.SaleOrder.ReviewForm
  14. {
  15. public partial class FrmOrderPrdcrBack : FrmBase
  16. {
  17. public FrmOrderPrdcrBack()
  18. {
  19. InitializeComponent();
  20. }
  21. private DataTable dt = new DataTable();
  22. public DataTable Dt
  23. {
  24. get { return dt; }
  25. set { dt = value; }
  26. }
  27. private void FrmOrderPrdcrBack_Load(object sender, EventArgs e)
  28. {
  29. GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
  30. }
  31. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  32. {
  33. switch (e.Tool.Key)
  34. {
  35. case "Confirm":
  36. Confirm();
  37. break;
  38. case "Close":
  39. ExitForm();
  40. break;
  41. }
  42. }
  43. private void Confirm()
  44. {
  45. ultraGrid1.UpdateData();
  46. if (HasFailRsn())
  47. {
  48. MessageUtil.ShowWarning("请将回退原因维护完整!");
  49. return;
  50. }
  51. this.Dt = dataTable1;
  52. this.DialogResult = DialogResult.OK;
  53. }
  54. private void ExitForm()
  55. {
  56. this.Close();
  57. }
  58. /// <summary>
  59. /// 是否存在失败原因 True 存在 False 未填入
  60. /// </summary>
  61. /// <returns></returns>
  62. private bool HasFailRsn()
  63. {
  64. ultraGrid1.UpdateData();
  65. foreach (UltraGridRow row in ultraGrid1.Rows)
  66. {
  67. if (row.Cells["FAIL_RSN"].Value.ToString() == "")
  68. {
  69. return true;
  70. }
  71. }
  72. return false;
  73. }
  74. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  75. {
  76. UltraGridRow ugr = ultraGrid1.ActiveRow;
  77. if (ugr == null)
  78. return;
  79. for (int i = 0; i < ugr.Cells.Count; i++)
  80. {
  81. if (!ugr.Cells[i].Column.Key.Equals("FAIL_RSN"))
  82. ugr.Cells[i].Activation = Activation.ActivateOnly;
  83. }
  84. }
  85. }
  86. }