| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- namespace Core.LgMes.Client.LgDeviceManager
- {
- public partial class frmIlUse : frmModelFormStyle
- {
- private DataSet dsUse;
- public frmIlUse()
- {
- InitializeComponent();
- dsUse = new DataSet();
- }
- private void frmIlUse_Load(object sender, EventArgs e)
- {
- this.InitCmbx(true,true);
- }
- private void PutDataToScreen(int i)
- {
- this.txtCurAge.Text = dsUse.Tables[0].Rows[i]["age"].ToString();
- this.txtInstance.Text = dsUse.Tables[0].Rows[i]["instance"].ToString();
- this.txtIronInstance.Text = dsUse.Tables[0].Rows[i]["waterinstance"].ToString();
- this.txtPositionID.Text = dsUse.Tables[0].Rows[i]["positionid"].ToString();
- this.txtRionQdy.Text = dsUse.Tables[0].Rows[i]["btl"].ToString();
- this.txtUseDetailMemo.Text = dsUse.Tables[0].Rows[i]["memo"].ToString();
- this.cboNowPosition.Text = dsUse.Tables[0].Rows[i]["nowposition"].ToString();
- this.cboIsNew.Text = dsUse.Tables[0].Rows[i]["isnewe"].ToString();
- //this.cboCyc.Text = dsUse.Tables[0].Rows[i]["age"].ToString();
- //this.cboStatus.Text = dsUse.Tables[0].Rows[i]["nowstatus"].ToString();
- this.dtpUseEndTime.Text = dsUse.Tables[0].Rows[i]["endtime"].ToString();
- this.dtpUseStartTime.Text = dsUse.Tables[0].Rows[i]["begintime"].ToString();
- }
- /// <summary>
- /// 初始化
- /// </summary>
- /// <param name="bl">判断是否是初始化</param>
- /// <param name="blOp">判断是什么操作(修改不刷新)</param>
- private void InitCmbx(bool bl,bool blOp)
- {
- if (bl)
- {
- FrmIronLadleManage frm = (FrmIronLadleManage)this.Tag;
- this.cboCyc.Items.Clear();
- this.txtLadleUseNum.Text = frm.ugrdTBinfo.ActiveRow.Cells["铁包编号"].Value.ToString();
- //ladleid, cycid, class, nowposition, positionid, nowstatus,
- //waterinstance, age, begintime, endtime, skatefactory, stufffactory, ironqdy, btl, instance, isnewe, memo
- }
- string strSQL = "SELECT * FROM DEV_TB_Use_Detail WHERE ladleid='" + this.txtLadleUseNum.Text.Replace("'", "''") + "' ORDER BY cycid desc ";
- //Core.Mes.IBaseInterface.CallingMessage par = new Core.Mes.IBaseInterface.CallingMessage();
- //par.AssemblyName = "Core.LgMes.Server.LgDeviceManager";
- //par.ClassName = "Core.LgMes.Server.LgDeviceManager.LadleManager";
- //par.args = new object[] { strSQL };
- //par.MethodName = "ReturnTable";
- //par.ServerName = "LgDeviceManager";
- //string StrOut = "";
- object ob = null;// Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out StrOut);
- if (dsUse != null)
- {
- dsUse.Dispose();
- }
-
- //增加,删除执行
- if (blOp == true)
- {
- dsUse = (DataSet)ob;
- this.cboCyc.DataSource = dsUse.Tables[0];
- this.cboCyc.DisplayMember = "cycid";
- }
- if (bl)
- {
- //par.args = new object[] { "8005", "" };
- //par.MethodName = "GetComboBoxData";
- ////par.ServerName = "LgDeviceManager";
- ////string StrOut = "";
- System.Data.DataSet ds = new DataSet();
- ob = null;// Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out StrOut);
- ds = (DataSet)ob;
- this.cboNowPosition.Items.Clear();
- this.cboNowPosition.DataSource = ds.Tables[0];
- this.cboNowPosition.DisplayMember = "基础名称";
- //cboStatus
- //par.args = new object[] { "8004", "" };
- //par.MethodName = "GetComboBoxData";
- ////par.ServerName = "LgDeviceManager";
- ////string StrOut = "";
- ////System.Data.DataSet ds = new DataSet();
- ob = null;// Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out StrOut);
- ds = (DataSet)ob;
- //this.cboStatus.Items.Clear();
- //this.cboStatus.DataSource = ds.Tables[0];
- //this.cboStatus.DisplayMember = "基础名称";
- ///装载数据到屏幕
- ///
- if (dsUse.Tables[0].Rows.Count > 0)
- {
- this.PutDataToScreen(0);
- }
- }
- }
- private void cboCyc_SelectedIndexChanged(object sender, EventArgs e)
- {
- this.PutDataToScreen(this.cboCyc.SelectedIndex);
- }
- private void brnDel_Click(object sender, EventArgs e)
- {
- if (MessageBox.Show("真的删除该记录么?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
- {
- string strSQL = "DELETE FROM DEV_TB_Use_Detail WHERE LadleID='" + this.txtLadleUseNum.Text.Replace("'", "''")
- + "' AND CycID=" + this.cboCyc.Text ;
- //Core.Mes.IBaseInterface.CallingMessage par = new Core.Mes.IBaseInterface.CallingMessage();
- //par.AssemblyName = "Core.LgMes.Server.LgDeviceManager";
- //par.ClassName = "Core.LgMes.Server.LgDeviceManager.LadleManager";
- //par.args = new object[] { strSQL };
- //par.MethodName = "ExecuteSQL";
- //par.ServerName = "LgDeviceManager";
- //string StrOut = "";
- object ob = null;// Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out StrOut);
- int i = (int)ob;
- if (i > 0)
- {
- MessageBox.Show("删除数据成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.InitCmbx(false,true);
- FrmIronLadleManage frm = (FrmIronLadleManage)this.Tag;
- //frm.SetDetailData();
- }
- else
- {
- MessageBox.Show("删除数据失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- }
- private void btnAdd_Click(object sender, EventArgs e)
- {
- if (this.dtpUseStartTime.Value > dtpUseEndTime.Value)
- {
- MessageBox.Show("起始时间大于结束时间!\n请重新选择时间!", "提示");
- return;
- }
- string strSQL = "INSERT INTO DEV_TB_Use_Detail(ladleid, cycid,nowposition, positionid," +
- " waterinstance, age, begintime, endtime,btl," +
- "instance, isnewe, memo) VALUES('" +
- this.txtLadleUseNum.Text.Replace("'", "''") + "',(SELECT nvl(MAX(cycid),0)+1 FROM DEV_TB_Use_Detail WHERE ladleid='"
- + this.txtLadleUseNum.Text.Replace("'", "''") + "'),'" + this.cboNowPosition.Text + "','" + this.txtPositionID.Text + "','" +
- this.txtIronInstance.Text + "','" +
- this.txtCurAge.Text + "',to_date('" +
- this.dtpUseStartTime.Value.ToString() + "','yyyy-MM-dd HH24:Mi:ss'),to_date('" +
- this.dtpUseEndTime.Value.ToString() + "','yyyy-MM-dd HH24:Mi:ss'),'" +
- this.txtRionQdy.Text + "','" + this.txtInstance.Text + "','" +
- this.cboIsNew.Text + "','" + this.txtUseDetailMemo.Text + "')";
- ;//WHERE LadleID='" + this.txtLadleUseNum.Text.Replace("'", "''")
- //+ "' AND CycID=" + this.cboCyc.Text;
- //Core.Mes.IBaseInterface.CallingMessage par = new Core.Mes.IBaseInterface.CallingMessage();
- //par.AssemblyName = "Core.LgMes.Server.LgDeviceManager";
- //par.ClassName = "Core.LgMes.Server.LgDeviceManager.LadleManager";
- //par.args = new object[] { strSQL };
- //par.MethodName = "ExecuteSQL";
- //par.ServerName = "LgDeviceManager";
- //string StrOut = "";
- object ob = null;// Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out StrOut);
- int i = (int)ob;
- if (i > 0)
- {
- MessageBox.Show("添加数据成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- //dsUse.Tables[0].Rows.Add(new object[] { });
-
- //this.dsUse.Tables[0].Rows.Add(dr);
- this.InitCmbx(false,true );
- FrmIronLadleManage frm= (FrmIronLadleManage) this.Tag;
- //frm.SetDetailData();
- }
- else
- {
- MessageBox.Show("添加数据失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- private void btnUpdate_Click(object sender, EventArgs e)
- {
- if (this.dtpUseStartTime.Value > dtpUseEndTime.Value)
- {
- MessageBox.Show("起始时间大于结束时间!\n请重新选择时间!", "提示");
- return;
- }
- string strSQL = "UPDATE DEV_TB_Use_Detail SET nowposition='" + this.cboNowPosition.Text.Replace("'","''") +
- "',positionid='" + this.txtPositionID.Text.Replace("'","''") +
- "',waterinstance='" + this.txtIronInstance.Text.Replace("'", "''") +
- "',age='" + this.txtCurAge.Text.Replace("'", "''") +
- "',begintime=To_date('" + this.dtpUseStartTime.Value.ToString() +
- "','yyyy-MM-dd HH24:Mi:ss')" +
- ",endtime=To_date('" + this.dtpUseEndTime.Value.ToString() +
- "','yyyy-MM-dd HH24:Mi:ss')" +
- ",btl='" + this.txtRionQdy.Text.Replace("'", "''") +
- "',instance='" + this.txtInstance.Text.Replace("'", "''") +
- "',isnewe='" + this.cboIsNew.Text.Replace("'", "''") +
- "',memo='" + this.txtUseDetailMemo.Text.Replace("'", "''") +
- "' WHERE LadleID='" + this.txtLadleUseNum.Text.Replace("'", "''")+
- "' AND CycID=" + this.cboCyc.Text;
- //Core.Mes.IBaseInterface.CallingMessage par = new Core.Mes.IBaseInterface.CallingMessage();
- //par.AssemblyName = "Core.LgMes.Server.LgDeviceManager";
- //par.ClassName = "Core.LgMes.Server.LgDeviceManager.LadleManager";
- //par.args = new object[] { strSQL };
- //par.MethodName = "ExecuteSQL";
- //par.ServerName = "LgDeviceManager";
- //string StrOut = "";
- object ob = null;// Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out StrOut);
- int i = (int)ob;
- if (i > 0)
- {
- MessageBox.Show("修改数据成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.InitCmbx(false,false);
- FrmIronLadleManage frm = (FrmIronLadleManage)this.Tag;
- //frm.SetDetailData();
- }
- else
- {
- MessageBox.Show("修改数据失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- private void btnclose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- private void txtCurAge_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (!(Char.IsNumber(e.KeyChar) || e.KeyChar == '.' || e.KeyChar == '\b'))
- {
- e.Handled = true;
- }
- }
- }
- }
|