FrmQcmJgWt.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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.Server;
  11. using Core.Mes.Client.Comm.Control;
  12. using Infragistics.Win.UltraWinGrid;
  13. using Infragistics.Win;
  14. using System.Collections;
  15. using Core.Mes.Client.Comm.Tool;
  16. using Core.Mes.Client.Comm.Format;
  17. using Core.StlMes.Client.Mcp.Entity;
  18. namespace Core.StlMes.Client.Mcp.Coupling
  19. {
  20. public partial class FrmQcmJgWt : FrmBase
  21. {
  22. private string _JugdeApplyCode = "";
  23. private string User = "";
  24. private DataTable _dtMatList = null;
  25. private OpeBase _ob = null;
  26. private ComMscJgEntity slmEntity = null;
  27. private string _woid;
  28. internal ComMscJgEntity SlmEntity
  29. {
  30. get { return slmEntity; }
  31. set { slmEntity = value; }
  32. }
  33. public FrmQcmJgWt(string jugdeApplyCode,string woid, OpeBase ob)
  34. {
  35. InitializeComponent();
  36. _JugdeApplyCode = jugdeApplyCode;
  37. _woid = woid;
  38. _ob = ob;
  39. InitCol();
  40. }
  41. /// <summary>
  42. /// 初始化控件
  43. /// </summary>
  44. private void InitCol()
  45. {
  46. QueryQcmAddAsk();
  47. }
  48. /// <summary>
  49. /// 查询接箍单个重
  50. /// </summary>
  51. /// <param name="JudgeStoveNo"></param>
  52. private void QueryQcmAddAsk()
  53. {
  54. List<ComMscJgEntity> listSource = null;
  55. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.FrmCouplingAppl.doQueryJgWt", new object[] { _JugdeApplyCode }, this._ob);
  56. if (dt.Rows.Count > 0 && dt != null)
  57. {
  58. listSource = EntityHelper.GetData<ComMscJgEntity>(
  59. "com.steering.mes.mcp.coup.FrmCouplingAppl.doQueryJgWt", new object[] { _JugdeApplyCode }, this._ob);
  60. qcmAddAskEntityBindingSource.DataSource = listSource;
  61. }
  62. }
  63. /// <summary>
  64. /// 确认
  65. /// </summary>
  66. /// <param name="sender"></param>
  67. /// <param name="e"></param>
  68. private void btnOK_Click(object sender, EventArgs e)
  69. {
  70. this.ultraGrid3.UpdateData();
  71. UltraGridRow ugrP = this.ultraGrid3.ActiveRow;
  72. if (ugrP == null)
  73. {
  74. MessageUtil.ShowTips("请选择相应合同信息!");
  75. return;
  76. }
  77. ArrayList arrayList = new ArrayList();
  78. for (int i = 0; i < ultraGrid3.Rows.Count; i++)
  79. {
  80. ComMscJgEntity ParmEntity = new ComMscJgEntity();
  81. ParmEntity = (ComMscJgEntity)this.ultraGrid3.Rows[i].ListObject;
  82. ParmEntity.CodeJg = _JugdeApplyCode;
  83. arrayList.Add(JSONFormat.Format(ParmEntity));
  84. }
  85. int count2 = ServerHelper.SetData("com.steering.mes.mcp.coup.FrmCouplingAppl.doUpdateJgWt", new object[] { arrayList,_woid }, this._ob);
  86. if (count2 > 0)
  87. {
  88. slmEntity = (ComMscJgEntity)ugrP.ListObject;
  89. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  90. }
  91. MessageUtil.ShowTips("确认成功!");
  92. this.Close();
  93. }
  94. /// <summary>
  95. /// 取消
  96. /// </summary>
  97. /// <param name="sender"></param>
  98. /// <param name="e"></param>
  99. private void btnCancel_Click(object sender, EventArgs e)
  100. {
  101. this.Close();
  102. }
  103. private void FrmQcmJgWt_Load(object sender, EventArgs e)
  104. {
  105. EntityHelper.ShowGridCaption<ComMscJgEntity>(ultraGrid3.DisplayLayout.Bands[0]);
  106. }
  107. private void ultraGrid3_CellChange(object sender, CellEventArgs e)
  108. {
  109. string minD = "";//接箍坯料外径
  110. string minH = "";//壁厚
  111. string weightJg = "";//接箍单重
  112. UltraGridRow urg = ultraGrid3.ActiveRow;
  113. if (urg == null)
  114. {
  115. return;
  116. }
  117. else
  118. {
  119. minD = urg.Cells["MinD"].Value.ToString();
  120. minH = urg.Cells["MinH"].Value.ToString();
  121. weightJg = urg.Cells["WeightJg"].Value.ToString();
  122. }
  123. ultraGrid3.UpdateData();
  124. if (e.Cell.Column.Key.Equals("WeightJg") && urg.Cells["WeightJg"].Text != "")
  125. {
  126. if(0.02466*(Convert.ToDouble(minD) - Convert.ToDouble(minH))*Convert.ToDouble(minH)*0.95<Convert.ToDouble(weightJg))
  127. {
  128. MessageUtil.ShowTips("输入重量不能大于接箍码重!");
  129. return;
  130. }
  131. }
  132. }
  133. }
  134. }