frmCraftSplineUnit.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Server;
  3. using Core.Mes.Client.Comm.Tool;
  4. using CoreFS.CA06;
  5. using Infragistics.Win.UltraWinGrid;
  6. using System;
  7. using System.Collections;
  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. namespace Core.StlMes.Client.SaleOrder.ReviewForm
  16. {
  17. public partial class frmCraftSplineUnit : FrmBase
  18. {
  19. UltraGrid grid1 = null;
  20. public frmCraftSplineUnit()
  21. {
  22. InitializeComponent();
  23. //UltraGrid grid = (UltraGrid)c_UltraGrid1;
  24. ////this.Controls.Remove(c_UltraGrid1);
  25. //grid1 = new UltraGrid();
  26. //this.Controls.Add(grid1);
  27. ////this.panel1.Controls.Add(grid);
  28. }
  29. public override void ToolBar_Click(object sender, string ToolbarKey)
  30. {
  31. base.ToolBar_Click(sender, ToolbarKey);
  32. switch (ToolbarKey)
  33. {
  34. case "Query":
  35. Query();
  36. break;
  37. case "Save":
  38. Save();
  39. break;
  40. case "Close":
  41. this.Close();
  42. break;
  43. }
  44. }
  45. private void Query()
  46. {
  47. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CraftSplineUnit.query", null, ob);
  48. GridHelper.CopyDataToDatatable(dt, dataTable1, true);
  49. }
  50. private void Save()
  51. {
  52. ArrayList list = new ArrayList();
  53. var rows = ultraGrid1.Rows.Where(a => a.GetValue("CHK") == "True");
  54. if (rows.Count() == 0)
  55. {
  56. MessageUtil.ShowWarning("请选择一条记录保存!");
  57. return;
  58. }
  59. foreach(var row in rows)
  60. {
  61. list.Add(row.GetValue("UNIT_CODE"));
  62. }
  63. if (MessageUtil.ShowYesNoAndQuestion("是否确认保存") == System.Windows.Forms.DialogResult.No)
  64. {
  65. return;
  66. }
  67. ServerHelper.SetData("com.steering.pss.sale.order.CraftSplineUnit.save", new object[]{list}, ob);
  68. MessageUtil.ShowTips("保存成功!");
  69. }
  70. private void frmCraftSplineUnit_Load(object sender, EventArgs e)
  71. {
  72. //c_UltraGrid1.DisplayLayout.CopyFrom(ultraGrid1.DisplayLayout, PropertyCategories.All);
  73. try
  74. {
  75. this.Cursor = Cursors.WaitCursor;
  76. Query();
  77. }
  78. finally
  79. {
  80. this.Cursor = Cursors.Default;
  81. }
  82. }
  83. private void frmCraftSplineUnit_Shown(object sender, EventArgs e)
  84. {
  85. }
  86. private void ultraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e)
  87. {
  88. }
  89. private void ultraGrid1_CellChange(object sender, CellEventArgs e)
  90. {
  91. ultraGrid1.UpdateData();
  92. if (e.Cell.Column.Key == "CHK")
  93. {
  94. UltraGridRow chkRow = e.Cell.Row;
  95. foreach (UltraGridRow row in ultraGrid1.Rows)
  96. {
  97. if (row.Cells["CHK"].Value.ToString() == "True" && row != chkRow)
  98. {
  99. row.Cells["CHK"].Value = "False";
  100. row.Update();
  101. }
  102. }
  103. }
  104. }
  105. }
  106. }