| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using Infragistics.Win.Misc;
- using CoreFS.CA06;
- using Core.Mes.Client.Common;
- namespace Core.LgMes.Client.LadleManager
- {
- public partial class FrmOLHeadStock : frmStyleBase
- {
-
- public FrmOLHeadStock()
- {
- InitializeComponent();
- }
- private void btnclose_Click(object sender, EventArgs e)
- {
- this.Close();
-
- }
- private void btnensure_Click(object sender, EventArgs e)
- {
- if (CheckIsNumberByASCII(textBox1.Text) && CheckIsNumberByASCII(textBox2.Text) && CheckIsNumberByASCII(textBox3.Text) && CheckIsNumberByASCII(textBox4.Text) && CheckIsNumberByASCII(textBox5.Text) && CheckIsNumberByASCII(textBox6.Text) && CheckIsNumberByASCII(textBox7.Text))
- {
- if (textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "")
- {
- if (MessageBox.Show("是否要将为填写的数据默认为 0 ?", "信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
- {
- TextBox[] tb = new TextBox[] { textBox2, textBox3, textBox4, textBox5 };
- for (int i = 0; i < 4; i++)
- {
- if (tb[i].Text == "")
- {
- tb[i].Text = "0";
- }
- }
- YQPT_V_Update();
- YQPT_G_Update();
- YQ_B_Update();
- MessageBox.Show("更新成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else
- {
- MessageBox.Show("请继续输入数据。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- else
- {
- YQPT_V_Update();
- YQPT_G_Update();
- YQ_B_Update();
- MessageBox.Show("更新成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- else
- {
- MessageBox.Show("输入数据格式错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- //提钒氧枪喷头记录更新
- private bool CheckIsNumberByASCII(string sSrc)
- {
- bool bRet = true;
- ASCIIEncoding AE = new ASCIIEncoding();
- byte[] bArray = AE.GetBytes(sSrc);
- for (int i = 0; i < bArray.Length; i++)
- {
- if (bArray[i] < 47 || bArray[i] > 57)
- {
- bRet = false;
- break;
- }
- }
- return bRet;
- }
- private void YQPT_V_Update()
- {
- string UseName_V = "提钒";
- string ToolName_V = "氧枪喷头";
- string month_V = System.DateTime.Now.ToString("yyyy-MM-dd").Substring(5, 2);
- int StockNumber_V = Convert.ToInt32(textBox1.Text);
- int ToStockNumber_V = Convert.ToInt32(textBox2.Text);
- int ExpendNumber_V = Convert.ToInt32(textBox3.Text);
- string Sql = Sql = "update gj1_bak_yq_inv set StockNumber=" + StockNumber_V + ",ToStockNumber=" + ToStockNumber_V + ",ExpendNumber=" + ExpendNumber_V +
- ",ExpendTemp=ExpendTemp+" + ExpendNumber_V + ",MonthExpend=ExpendTemp+" + ExpendNumber_V +
- " where ToolName='" + ToolName_V + "' and UseType='" + UseName_V + "' and Month = '" + month_V+"'";
- }
- //炼钢氧枪喷头记录更新
- private void YQPT_G_Update()
- {
- string UseName_G = "炼钢";
- string ToolName_G = "氧枪喷头";
- string month_G = System.DateTime.Now.ToString("yyyy-MM-dd").Substring(5, 2);
- int StockNumber_G = Convert.ToInt32(textBox6.Text);
- int ToStockNumber_G = Convert.ToInt32(textBox5.Text);
- int ExpendNumber_G = Convert.ToInt32(textBox4.Text);
- string Sql = Sql = "update gj1_bak_yq_inv set StockNumber=" + StockNumber_G + ",ToStockNumber=" + ToStockNumber_G + ",ExpendNumber=" + ExpendNumber_G +
- ",ExpendTemp=ExpendTemp+" + ExpendNumber_G + ",MonthExpend=ExpendTemp+" + ExpendNumber_G +
- " where ToolName='" + ToolName_G + "' and UseType='" + UseName_G + "' and Month = '" + month_G + "'";
- }
- //备用氧枪记录更新
- private void YQ_B_Update()
- {
- string UseName_B = "备用";
- string ToolName_B = "氧枪";
- string month_B = System.DateTime.Now.ToString("yyyy-MM-dd").Substring(5, 2);
- int StockNumber_B = Convert.ToInt32(textBox7.Text);
-
- string Sql = Sql = "update gj1_bak_yq_inv set StockNumber=" + StockNumber_B + ",ToStockNumber=0,ExpendNumber=0"+
- ",ExpendTemp=0,MonthExpend=0" +
- " where ToolName='" + ToolName_B + "' and UseType='" + UseName_B + "' and Month = '" + month_B + "'";
- }
- //返回喷头月累计量
- private string MonthExpendAdd(string paraToolName, string paraUseName,string paramonth)
- {
- string sql = "select MonthExpend from gj1_bak_yq_inv where ToolName='" + paraToolName + "' and UseType='" + paraUseName + "' and month='" + paramonth + "'";
- //string err = "";
- //CallingMessage par = new CallingMessage();
- //par.ServerName = "炼钢工器具";
- //par.AssemblyName = "Core.LgMes.Server.LadleManager";
- //par.ClassName = "Core.LgMes.Server.LadleManager.YQMethod";
- //par.MethodName = "YQ_Return";
- //par.args = new object[] { sql };
- DataSet ds = null;// (DataSet) ClientCommon._RemotingHelp.ExecuteMethod(par, out err);
- return ds.Tables[0].Rows[0][0].ToString() ;
- }
- }
- }
|