frmComBaseAskRStation.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. using com.steering.pss.sale.order.model;
  2. using Core.Mes.Client.Comm.Tool;
  3. using Core.StlMes.Client.SaleOrder;
  4. using CoreFS.CA06;
  5. using Infragistics.Win.UltraWinGrid;
  6. using System;
  7. using System.Collections;
  8. using System.Collections.Generic;
  9. using System.Data;
  10. using System.Linq;
  11. using System.Windows.Forms;
  12. namespace Core.StlMes.Client.Qcm
  13. {
  14. public partial class frmComBaseAskRStation : FrmBase
  15. {
  16. private string askItemNo = "";
  17. public frmComBaseAskRStation()
  18. {
  19. InitializeComponent();
  20. EntityHelper.ShowGridCaption<ComBaseStationEntity>(ultraGridStation.DisplayLayout.Bands[0]);
  21. EntityHelper.ShowGridCaption<SlmBaseAddAskEntity>(ultraGrid1AddAsk.DisplayLayout.Bands[0]);
  22. setColumnNoEdit();
  23. }
  24. /// <summary>
  25. /// 重写基类toolBar方法
  26. /// </summary>
  27. /// <param name="sender"></param>
  28. /// <param name="ToolbarKey"></param>
  29. public override void ToolBar_Click(object sender, string ToolbarKey)
  30. {
  31. switch (ToolbarKey)
  32. {
  33. case "Query":
  34. Query();
  35. break;
  36. case "Save":
  37. Save();
  38. break;
  39. case "Close":
  40. this.Close();
  41. break;
  42. }
  43. }
  44. private void Query()
  45. {
  46. List<SlmBaseAddAskEntity> listSource = EntityHelper.GetData<SlmBaseAddAskEntity>(
  47. "com.steering.pss.qcm.CoreComBaseAskRStation.getAddAsk", new object[] { }, this.ob);
  48. slmBaseAddAskEntityBindingSource.DataSource = listSource;
  49. foreach (UltraGridRow ugrAdd in ultraGrid1AddAsk.Rows)
  50. {
  51. if (ugrAdd.Cells["AskItemNo"].Value.ToString().Equals(askItemNo))
  52. {
  53. ugrAdd.Activate();
  54. }
  55. }
  56. askItemNo = "";
  57. }
  58. private void Save()
  59. {
  60. ultraGrid1AddAsk.UpdateData();
  61. ultraGridStation.UpdateData();
  62. UltraGridRow ugr = ultraGrid1AddAsk.ActiveRow;
  63. SlmBaseAddAskEntity addAskEntity = (SlmBaseAddAskEntity)ugr.ListObject;
  64. if (ugr == null)
  65. {
  66. MessageUtil.ShowWarning("请选择附加要求分项!");
  67. return;
  68. }
  69. IQueryable<UltraGridRow> checkedRows = ultraGridStation.Rows.AsQueryable().Where(" CHC = 'True'");
  70. ArrayList list = new ArrayList();
  71. foreach (UltraGridRow ugrCheck in checkedRows)
  72. {
  73. ComBaseStationEntity baseStationEntity = (ComBaseStationEntity)ugrCheck.ListObject;
  74. ComBaseAskRStationEntity askRelationEntity = new ComBaseAskRStationEntity();
  75. askRelationEntity.AskItemNo = addAskEntity.AskItemNo;
  76. askRelationEntity.AskItemDesc = addAskEntity.AskItemDesc;
  77. askRelationEntity.ProcessCdoe = baseStationEntity.ProcessCode;
  78. askRelationEntity.ProcessDesc = baseStationEntity.ProcessDesc;
  79. askRelationEntity.ProcessDescC = baseStationEntity.ProcessDescC;
  80. askRelationEntity.ProcessCdoeC = baseStationEntity.ProcessCodeC;
  81. askRelationEntity.StationCode = baseStationEntity.StationCode;
  82. askRelationEntity.StationDesc = baseStationEntity.StationDesc;
  83. askRelationEntity.CreateName = UserInfo.GetUserName();
  84. list.Add(askRelationEntity);
  85. }
  86. if (MessageUtil.ShowYesNoAndQuestion("是否保存?") == DialogResult.No)
  87. {
  88. return;
  89. }
  90. CoreClientParam ccp = new CoreClientParam();
  91. ccp.ServerName = "com.steering.pss.qcm.CoreComBaseAskRStation";
  92. ccp.MethodName = "saveAddAskRelation";
  93. ccp.ServerParams = new object[] { list, addAskEntity.AskItemNo };
  94. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  95. if (ccp.ReturnCode != -1)
  96. {
  97. MessageUtil.ShowTips("保存成功!");
  98. Query();
  99. }
  100. askItemNo = addAskEntity.AskItemNo.ToString();
  101. }
  102. private void ultraGrid1AddAsk_AfterRowActivate(object sender, EventArgs e)
  103. {
  104. UltraGridRow ugr = ultraGrid1AddAsk.ActiveRow;
  105. if (ugr != null)
  106. {
  107. String itemNo = ugr.Cells["AskItemNo"].Value.ToString();
  108. List<ComBaseStationEntity> listSource = EntityHelper.GetData<ComBaseStationEntity>(
  109. "com.steering.pss.qcm.CoreComBaseAskRStation.getAddAskRelation", new object[] { itemNo }, this.ob);
  110. comBaseStationEntityBindingSource.DataSource = listSource;
  111. if (ultraGridStation.Rows.Count > 0)
  112. {
  113. ultraGridStation.Rows[0].Activate();
  114. }
  115. }
  116. }
  117. private void setColumnNoEdit()
  118. {
  119. foreach (UltraGridColumn ugc in ultraGridStation.DisplayLayout.Bands[0].Columns)
  120. {
  121. if (!ugc.Key.Equals("Chc"))
  122. {
  123. ugc.CellActivation = Activation.ActivateOnly;
  124. }
  125. }
  126. }
  127. private void frmComBaseAskRStation_Load(object sender, EventArgs e)
  128. {
  129. Query();
  130. }
  131. }
  132. }