FrmOrderJg.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. using com.steering.mes.mcp.entity;
  2. using Core.Mes.Client.Comm.Tool;
  3. using CoreFS.CA06;
  4. using Infragistics.Win.UltraWinGrid;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.ComponentModel;
  8. using System.Data;
  9. using System.Drawing;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Windows.Forms;
  13. namespace Core.StlMes.Client.Mcp.CollarLibrary
  14. {
  15. public partial class FrmOrderJg : FrmBase
  16. {
  17. private OpeBase _ob;
  18. private PlnOrderJgEntity baseEntity = null;
  19. private string orderNo = "";
  20. private string codeJg = "";
  21. private string dealOrde = "";
  22. private int num = 0;
  23. private string ordLnDyPk = "";
  24. private string codeJgBl="";
  25. private string gowhereName = "";
  26. public PlnOrderJgEntity BaseEntity
  27. {
  28. get { return baseEntity; }
  29. set { baseEntity = value; }
  30. }
  31. public FrmOrderJg(OpeBase ob)
  32. {
  33. _ob = ob;
  34. InitializeComponent();
  35. }
  36. public FrmOrderJg(OpeBase ob, string _orderNo, string _codeJg, string _dealOrde, int _num, string _ordLnDyPk, string _codeJgBl, string _gowhereName)
  37. {
  38. _ob = ob;
  39. orderNo = _orderNo;
  40. codeJg = _codeJg;
  41. dealOrde = _dealOrde;
  42. num = _num;
  43. ordLnDyPk = _ordLnDyPk;
  44. codeJgBl = _codeJgBl;
  45. gowhereName = _gowhereName;
  46. InitializeComponent();
  47. }
  48. private void FrmOrderJg_Load(object sender, EventArgs e)
  49. {
  50. EntityHelper.ShowGridCaption<PlnOrderJgEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  51. if (orderNo.Equals(""))
  52. {
  53. doQuery();
  54. }
  55. else
  56. {
  57. doQueryOrder();
  58. }
  59. }
  60. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  61. {
  62. switch (e.Tool.Key)
  63. {
  64. case "Add"://确认
  65. doAdd();
  66. break;
  67. case "Close":
  68. this.Close();
  69. break;
  70. default:
  71. break;
  72. }
  73. }
  74. private void doQuery()
  75. {
  76. List<PlnOrderJgEntity> listSource = EntityHelper.GetData<PlnOrderJgEntity>(
  77. "com.steering.mes.mcp.CollarLibrary.FrmDealOut.getQuery", null, _ob);
  78. plnOrderJgEntityBindingSource.DataSource = listSource;
  79. }
  80. private void doQueryOrder()
  81. {
  82. List<PlnOrderJgEntity> listSource = EntityHelper.GetData<PlnOrderJgEntity>(
  83. "com.steering.mes.mcp.CollarLibrary.FrmDealOut.getQueryOrder", new object[] { codeJg, dealOrde, ordLnDyPk, codeJgBl, gowhereName }, _ob);
  84. plnOrderJgEntityBindingSource.DataSource = listSource;
  85. foreach (UltraGridRow item in ultraGrid1.Rows)
  86. {
  87. item.Cells["Num"].Value=num;
  88. string ordersqe=item.Cells["OrderNo"].Text.Trim()+"/"+item.Cells["OrderSeq"].Text.Trim();
  89. if (ordersqe.Equals(orderNo))
  90. {
  91. item.Appearance.BackColor = Color.Wheat;
  92. item.Activate();
  93. }
  94. }
  95. }
  96. private void doAdd()
  97. {
  98. UltraGridRow ugrM = ultraGrid1.ActiveRow;
  99. if (ugrM == null) return;
  100. baseEntity = (PlnOrderJgEntity)ugrM.ListObject;
  101. this.Close();
  102. }
  103. private void ultraGrid1_CellChange(object sender, CellEventArgs e)
  104. {
  105. ultraGrid1.UpdateData();
  106. if (e.Cell.Column.Key.Equals("Num"))
  107. {
  108. if (e.Cell.Row.Cells["Num"].Value == null)
  109. {
  110. e.Cell.Row.Cells["Num"].Value = num;
  111. }
  112. else
  113. {
  114. string actCount = e.Cell.Row.Cells["Num"].Value.ToString();
  115. if (!StringUtil.IsDouble(actCount) || actCount == "0")
  116. {
  117. e.Cell.Row.Cells["Num"].Value = num;
  118. }
  119. else
  120. {
  121. if (num < int.Parse(actCount))
  122. {
  123. e.Cell.Row.Cells["Num"].Value = num;
  124. }
  125. }
  126. }
  127. }
  128. }
  129. }
  130. }