frmBatchesPip.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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 Core.Mes.Client.Comm.Tool;
  10. using CoreFS.CA06;
  11. using Core.StlMes.Client.YdmBase;
  12. namespace Core.StlMes.Client.YdmPipeManage
  13. {
  14. public partial class frmBatchesPip : Form
  15. {
  16. OpeBase _ob;
  17. public frmBatchesPip(OpeBase ob)
  18. {
  19. _ob = ob;
  20. InitializeComponent();
  21. }
  22. public frmBatchesPip(OpeBase ob,string type)
  23. {
  24. _ob = ob;
  25. Type = type;
  26. InitializeComponent();
  27. }
  28. // 类型 1.正尺 2.非正尺
  29. private string type = "1";
  30. public string Type
  31. {
  32. get { return type; }
  33. set { type = value; }
  34. }
  35. //判定支数
  36. private string allCount;
  37. public string AllCount
  38. {
  39. get { return allCount; }
  40. set { allCount = value; }
  41. }
  42. //判定重量
  43. private string allWgt;
  44. public string AllWgt
  45. {
  46. get { return allWgt; }
  47. set { allWgt = value; }
  48. }
  49. //合同上限重量
  50. private string sxWgt;
  51. public string SxWgt
  52. {
  53. get { return sxWgt; }
  54. set { sxWgt = value; }
  55. }
  56. //已缴库量
  57. private string pipWgt;
  58. public string PipWgt
  59. {
  60. get { return pipWgt; }
  61. set { pipWgt = value; }
  62. }
  63. public string finishedProduct;//成品类别
  64. public string buttonValue;
  65. public string count;
  66. public string outWgt;
  67. public string _allCount;
  68. public string _allWgt;
  69. public bool flag = false;
  70. private void frmBatchesPip_Load(object sender, EventArgs e)
  71. {
  72. txtPdCount.Text = AllCount;
  73. txtPdWgt.Text = AllWgt;
  74. txtSxWgt.Text = sxWgt;
  75. txtPipWgt.Text = pipWgt;
  76. int numBer = int.Parse(AllCount);
  77. double wgt = double.Parse(AllWgt);
  78. double nvlWgt = ((wgt * 1000) / numBer) / 1000;
  79. int m = 0;
  80. for (int i = 0; i < numBer+1; i++)
  81. {
  82. if (i * nvlWgt > double.Parse(sxWgt))
  83. {
  84. m = i -1;
  85. break;
  86. }
  87. }
  88. txtHtCount.Text = m.ToString();
  89. //txtHtWgt.Text = (m * nvlWgt).ToString();
  90. if ("2".Equals(Type))
  91. {
  92. textValue.Text = "缴库量大于合同行长短尺量差上限,是否缴库?";
  93. ultraButton3.Text = "按长短尺上限缴库";
  94. }
  95. initBase();
  96. }
  97. /// <summary>
  98. /// 加载成品类别
  99. /// </summary>
  100. private void initBase()
  101. {
  102. YdmBaseClass.InitComboEditor(cmbProduct, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getFinishedProduct", "BASECODE", this._ob, false);
  103. }
  104. private void ultraButton1_Click(object sender, EventArgs e)
  105. {
  106. this.buttonValue = "1";
  107. flag = true;
  108. this.Close();
  109. }
  110. private void ultraButton2_Click(object sender, EventArgs e)
  111. {
  112. buttonValue = "0";
  113. flag = true;
  114. this.Close();
  115. }
  116. private void ultraButton3_Click(object sender, EventArgs e)
  117. {
  118. buttonValue = "2";
  119. count = this.txtHtCount.Text.ToString().Trim();
  120. outWgt = this.txtHtWgt.Text.ToString().Trim();
  121. finishedProduct = this.cmbProduct.Value.ToString2();
  122. //if (finishedProduct == "")
  123. //{
  124. // MessageBox.Show("请选择成品区分!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  125. // return;
  126. //}
  127. if (count == "")
  128. {
  129. MessageBox.Show("分批缴库时请输入支数!","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning);
  130. return;
  131. }
  132. if (count != "")
  133. {
  134. this.Close();
  135. }
  136. flag = true;
  137. }
  138. private void txtHtCount_TextChanged(object sender, EventArgs e)
  139. {
  140. int numBer = int.Parse(AllCount);
  141. double wgt = double.Parse(AllWgt);
  142. double nvlWgt = ((wgt * 1000) / numBer) / 1000;
  143. count = this.txtHtCount.Text.ToString().Trim();
  144. //outWgt = this.txtHtWgt.Text.ToString().Trim();
  145. if (!StringUtil.IsInt(count))
  146. {
  147. MessageBox.Show("支数应输入整数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  148. return;
  149. }
  150. if (count != "")
  151. {
  152. this.txtHtWgt.Text = string.Format("{0:F}",(nvlWgt * int.Parse(count)));
  153. }
  154. }
  155. }
  156. }