FrmOLHeadStock.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using Infragistics.Win.Misc;
  9. using CoreFS.CA06;
  10. using Core.Mes.Client.Common;
  11. namespace Core.LgMes.Client.LadleManager
  12. {
  13. public partial class FrmOLHeadStock : frmStyleBase
  14. {
  15. public FrmOLHeadStock()
  16. {
  17. InitializeComponent();
  18. }
  19. private void btnclose_Click(object sender, EventArgs e)
  20. {
  21. this.Close();
  22. }
  23. private void btnensure_Click(object sender, EventArgs e)
  24. {
  25. if (CheckIsNumberByASCII(textBox1.Text) && CheckIsNumberByASCII(textBox2.Text) && CheckIsNumberByASCII(textBox3.Text) && CheckIsNumberByASCII(textBox4.Text) && CheckIsNumberByASCII(textBox5.Text) && CheckIsNumberByASCII(textBox6.Text) && CheckIsNumberByASCII(textBox7.Text))
  26. {
  27. if (textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "")
  28. {
  29. if (MessageBox.Show("是否要将为填写的数据默认为 0 ?", "信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
  30. {
  31. TextBox[] tb = new TextBox[] { textBox2, textBox3, textBox4, textBox5 };
  32. for (int i = 0; i < 4; i++)
  33. {
  34. if (tb[i].Text == "")
  35. {
  36. tb[i].Text = "0";
  37. }
  38. }
  39. YQPT_V_Update();
  40. YQPT_G_Update();
  41. YQ_B_Update();
  42. MessageBox.Show("更新成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  43. }
  44. else
  45. {
  46. MessageBox.Show("请继续输入数据。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  47. }
  48. }
  49. else
  50. {
  51. YQPT_V_Update();
  52. YQPT_G_Update();
  53. YQ_B_Update();
  54. MessageBox.Show("更新成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  55. }
  56. }
  57. else
  58. {
  59. MessageBox.Show("输入数据格式错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  60. }
  61. }
  62. //提钒氧枪喷头记录更新
  63. private bool CheckIsNumberByASCII(string sSrc)
  64. {
  65. bool bRet = true;
  66. ASCIIEncoding AE = new ASCIIEncoding();
  67. byte[] bArray = AE.GetBytes(sSrc);
  68. for (int i = 0; i < bArray.Length; i++)
  69. {
  70. if (bArray[i] < 47 || bArray[i] > 57)
  71. {
  72. bRet = false;
  73. break;
  74. }
  75. }
  76. return bRet;
  77. }
  78. private void YQPT_V_Update()
  79. {
  80. string UseName_V = "提钒";
  81. string ToolName_V = "氧枪喷头";
  82. string month_V = System.DateTime.Now.ToString("yyyy-MM-dd").Substring(5, 2);
  83. int StockNumber_V = Convert.ToInt32(textBox1.Text);
  84. int ToStockNumber_V = Convert.ToInt32(textBox2.Text);
  85. int ExpendNumber_V = Convert.ToInt32(textBox3.Text);
  86. string Sql = Sql = "update gj1_bak_yq_inv set StockNumber=" + StockNumber_V + ",ToStockNumber=" + ToStockNumber_V + ",ExpendNumber=" + ExpendNumber_V +
  87. ",ExpendTemp=ExpendTemp+" + ExpendNumber_V + ",MonthExpend=ExpendTemp+" + ExpendNumber_V +
  88. " where ToolName='" + ToolName_V + "' and UseType='" + UseName_V + "' and Month = '" + month_V+"'";
  89. }
  90. //炼钢氧枪喷头记录更新
  91. private void YQPT_G_Update()
  92. {
  93. string UseName_G = "炼钢";
  94. string ToolName_G = "氧枪喷头";
  95. string month_G = System.DateTime.Now.ToString("yyyy-MM-dd").Substring(5, 2);
  96. int StockNumber_G = Convert.ToInt32(textBox6.Text);
  97. int ToStockNumber_G = Convert.ToInt32(textBox5.Text);
  98. int ExpendNumber_G = Convert.ToInt32(textBox4.Text);
  99. string Sql = Sql = "update gj1_bak_yq_inv set StockNumber=" + StockNumber_G + ",ToStockNumber=" + ToStockNumber_G + ",ExpendNumber=" + ExpendNumber_G +
  100. ",ExpendTemp=ExpendTemp+" + ExpendNumber_G + ",MonthExpend=ExpendTemp+" + ExpendNumber_G +
  101. " where ToolName='" + ToolName_G + "' and UseType='" + UseName_G + "' and Month = '" + month_G + "'";
  102. }
  103. //备用氧枪记录更新
  104. private void YQ_B_Update()
  105. {
  106. string UseName_B = "备用";
  107. string ToolName_B = "氧枪";
  108. string month_B = System.DateTime.Now.ToString("yyyy-MM-dd").Substring(5, 2);
  109. int StockNumber_B = Convert.ToInt32(textBox7.Text);
  110. string Sql = Sql = "update gj1_bak_yq_inv set StockNumber=" + StockNumber_B + ",ToStockNumber=0,ExpendNumber=0"+
  111. ",ExpendTemp=0,MonthExpend=0" +
  112. " where ToolName='" + ToolName_B + "' and UseType='" + UseName_B + "' and Month = '" + month_B + "'";
  113. }
  114. //返回喷头月累计量
  115. private string MonthExpendAdd(string paraToolName, string paraUseName,string paramonth)
  116. {
  117. string sql = "select MonthExpend from gj1_bak_yq_inv where ToolName='" + paraToolName + "' and UseType='" + paraUseName + "' and month='" + paramonth + "'";
  118. //string err = "";
  119. //CallingMessage par = new CallingMessage();
  120. //par.ServerName = "炼钢工器具";
  121. //par.AssemblyName = "Core.LgMes.Server.LadleManager";
  122. //par.ClassName = "Core.LgMes.Server.LadleManager.YQMethod";
  123. //par.MethodName = "YQ_Return";
  124. //par.args = new object[] { sql };
  125. DataSet ds = null;// (DataSet) ClientCommon._RemotingHelp.ExecuteMethod(par, out err);
  126. return ds.Tables[0].Rows[0][0].ToString() ;
  127. }
  128. }
  129. }