MesureDataPerWt.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Globalization;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. using Core.Mes.Client.Comm.Tool;
  11. using Core.StlMes.Client.Mcp.Control.Entity;
  12. using CoreFS.CA06;
  13. namespace Core.StlMes.Client.Mcp.Mch.MchResult
  14. {
  15. public partial class MesureDataPerWt : FrmBase
  16. {
  17. private PlnZyJgxCEntity _jgxPlan = null;
  18. public MesureDataPerWt(OpeBase _ob,PlnZyJgxCEntity _plnZyJgxCEntity)
  19. {
  20. InitializeComponent();
  21. _jgxPlan = _plnZyJgxCEntity;
  22. this.ob = _ob;
  23. uteW_TextChanged(null, null);
  24. }
  25. private void ubtOK_Click(object sender, EventArgs e)
  26. {
  27. double PerWt = 0;
  28. double em = 0;
  29. if (rb1.Checked)
  30. {
  31. if (string.IsNullOrWhiteSpace(uteW.Text))
  32. {
  33. MessageBox.Show("请输入公式");
  34. return;
  35. }
  36. try
  37. {
  38. var dt = new DataTable();
  39. PerWt =
  40. Math.Round(
  41. double.Parse(
  42. dt.Compute(
  43. uteW.Text.Replace("外径", _jgxPlan.Outdiameter.ToString3())
  44. .Replace("壁厚", _jgxPlan.Wallthick.ToString3()), null).ToString()),
  45. (int) utnX.Value);
  46. }
  47. catch (Exception)
  48. {
  49. MessageBox.Show("公式异常");
  50. return;
  51. }
  52. }
  53. else if (rb2.Checked)
  54. {
  55. try
  56. {
  57. PerWt = double.Parse(uneValue.Value.ToString());
  58. }
  59. catch (Exception)
  60. {
  61. MessageBox.Show("请输入正确的数字");
  62. return;
  63. }
  64. }
  65. else
  66. {
  67. MessageBox.Show("请选择单重种类!");
  68. return;
  69. }
  70. try
  71. {
  72. em = double.Parse(une3.Value.ToString3());
  73. }
  74. catch (Exception)
  75. {
  76. MessageBox.Show("请输入正确的数字");
  77. return;
  78. }
  79. var ccp = new CoreClientParam();
  80. ccp.ServerName = "com.steering.mes.mcp.Mch.FrmMeasureResult";
  81. ccp.MethodName = "Turn";
  82. ccp.ServerParams = new object[]
  83. {
  84. PerWt,
  85. em,
  86. _jgxPlan.JudgeStoveNo,
  87. _jgxPlan.BatchNo,
  88. _jgxPlan.PlineCode
  89. };
  90. ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  91. if (ccp.ReturnCode != -1)
  92. {
  93. if (ccp.ReturnInfo.Equals("操作成功"))
  94. {
  95. this.DialogResult = DialogResult.OK;
  96. }
  97. else
  98. {
  99. MessageUtil.ShowTips(ccp.ReturnInfo);
  100. }
  101. }
  102. }
  103. private void rb1_CheckedChanged(object sender, EventArgs e)
  104. {
  105. uteW.ReadOnly = !rb1.Checked;
  106. utnX.ReadOnly = !rb1.Checked;
  107. lblShow.Visible = rb1.Checked;
  108. uneValue.ReadOnly = !rb2.Checked;
  109. }
  110. private void uteW_TextChanged(object sender, EventArgs e)
  111. {
  112. try
  113. {
  114. var dt = new DataTable();
  115. lblShow.Text = "当前公式计算出的单重:" +
  116. Math.Round(
  117. double.Parse(
  118. dt.Compute(
  119. uteW.Text.Replace("外径", _jgxPlan.Outdiameter.ToString3())
  120. .Replace("壁厚", _jgxPlan.Wallthick.ToString3()), null).ToString()),
  121. (int)utnX.Value);
  122. }
  123. catch (Exception)
  124. {
  125. }
  126. }
  127. }
  128. }