| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- 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 FrmToolRepairPositionInfo : Form
- {
- private DataTable _dt;
- public DataTable dt { set { _dt = value; } get { return _dt; } }
- public FrmToolRepairPositionInfo()
- {
- InitializeComponent();
- }
- private void DataProcess(string strType)
- {
- string strSQL;
- string strMsgSucess;
- string strMsgFail;
- if (strType == "N")
- {
- strSQL = "INSERT INTO DEV_Item_In_Tool_Pos (OrderID,ItemTypeID, ToolType, ToolPos,Memo) VALUES((" +
- "Select nvl(Max(OrderID),0)+1 from DEV_Item_In_Tool_Pos" +"),'" +
- this.cboParaID.Text.Replace("'", "''") + "','" +
- this.cboToolName.Text.Replace("'", "''") + "','" +
- this.cboToolID.Text.Replace("'", "''") + "','" +
- this.txtMemo.Text.Replace("'", "''") + "')"
- ;
- strMsgSucess = "新增数据成功!";
- strMsgFail = "新增数据失败!";
- }
- else if (strType == "U")
- {
- strSQL = "UPDATE DEV_Item_In_Tool_Pos SET ItemTypeID='" + this.cboParaID.Text.Replace("'", "''") +
- "',ToolType='" + this.cboToolName.Text.Replace("'", "''") +
- "',ToolPos='" + this.cboToolID.Text.Replace("'", "''") +
- "',Memo='" + this.txtMemo.Text.Replace("'", "''") +
- "' WHERE OrderID='" + this.ulgrid.ActiveRow.Cells["序号"].Value.ToString() + "'";
- strMsgSucess = "修改数据成功!";
- strMsgFail = "修改数据失败!";
- }
- else
- {
- strSQL = "DELETE FROM DEV_Item_In_Tool_Pos WHERE OrderID='" + this.ulgrid.ActiveRow.Cells["序号"].Value.ToString() + "'";
- strMsgSucess = "删除数据成功!";
- strMsgFail = "删除数据失败!";
- }
- //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);
- if ((int)ob > 0)
- {
- this.QueryData();
- MessageBox.Show(strMsgSucess, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else
- {
- MessageBox.Show(strMsgFail, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
- {
- switch (e.Tool.Key)
- {
- case "Close":
- this.Close();
- break;
- case "New":
- if ( (this.cboToolName.Text.Trim() == "") || (this.cboToolID.Text.Trim() == ""))
- { break; }
- this.DataProcess("N");
- break;
- case "Update":
- if ((this.cboToolName.Text.Trim() == "") || (this.cboToolID.Text.Trim() == ""))
- { break; }
- if (this.ulgrid.ActiveRow != null)
- {
- this.DataProcess("U");
- }
- else
- {
- MessageBox.Show("请选择需要修改的行!", "提示");
- }
- break;
- case "Del":
- if (this.ulgrid.ActiveRow != null)
- {
- this.DataProcess("D");
- cboParaID.Text = "";
- cboToolID.Text = "";
- txtMemo.Text = "";
- }
- else
- {
- MessageBox.Show("请选择要删除的行!","提示");
- }
- break;
- default:
- break;
- }
- }
- private void QueryData()
- {
- string strSQL = " SELECT OrderID as 序号 ,ItemTypeID AS 材料类型编号,ToolType AS 适用工具类型, ToolPos AS 适用工具位置,Memo as 备注" +
- " FROM DEV_Item_In_Tool_Pos WHERE 1=1 ";
- if (this.chkToolName.Checked)
- {
- strSQL = strSQL + " AND tooltype='" + this.cboToolType.Text.ToString() + "' ";
- }
- strSQL = strSQL + " ORDER BY OrderID desc ";
- //Core.Mes.IBaseInterface.CallingMessage par = new Core.Mes.IBaseInterface.CallingMessage();
- //par.ServerName = "LgDeviceManager";
- //par.MethodName = "ReturnTable";
- //par.ClassName = "Core.LgMes.Server.LgDeviceManager.LadleManager";
- //par.AssemblyName = "Core.LgMes.Server.LgDeviceManager";
- //par.args = new object[] { strSQL };
- //string err = "";
- object ob = null;// Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out err);
- System.Data.DataSet ds = (DataSet)ob;
- this.ulgrid.DataSource = ds;
- this.ulgrid.DataBind();
- //Core.LgMes.Client.LgDeviceManager.FrmCLRepairDetail fcc = new Core.LgMes.Client.LgDeviceManager.FrmCLRepairDetail();
- //fcc.SetColumnWidth(ds, ulgrid, this.label1);
- }
- private void FrmToolRepairPositionInfo_Load(object sender, EventArgs e)
- {
- this.cboToolType.DataSource = this._dt;
- this.cboToolType.DisplayMember = "基础名称";
- cboToolName.DataSource = this._dt;
- cboToolName.DisplayMember = "基础名称";
- this.QueryData();
- }
- private void cboToolType_SelectedIndexChanged(object sender, EventArgs e)
- {
- //if (int.TryParse(this.cboToolType.SelectedItem.ToString(),out n))
-
- if (this.chkToolName.Checked)
- {
- this.QueryData();
- }
-
- }
- private void chkToolName_CheckedChanged(object sender, EventArgs e)
- {
- if (chkToolName.Checked)
- {
- cboToolType.Enabled = true;
- }
- else
- {
- cboToolType.Enabled = false;
- }
- this.QueryData();
- }
- private void ulgrid_Click(object sender, EventArgs e)
- {
- if (this.ulgrid.ActiveRow != null)
- {
- cboParaID.Text = ulgrid.ActiveRow.Cells["材料类型编号"].Value.ToString();
- cboToolName.Text = ulgrid.ActiveRow.Cells["适用工具类型"].Value.ToString();
- cboToolID.Text = ulgrid.ActiveRow.Cells["适用工具位置"].Value.ToString();
- txtMemo.Text = ulgrid.ActiveRow.Cells["备注"].Value.ToString();
- }
- else
- {
- cboParaID.Text = "";
- cboToolName.Text = "";
- cboToolID.Text = "";
- txtMemo.Text = "";
- }
- }
- }
- }
|