| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using System.Collections;
- using Core.Mes.Client.Common;
- using CoreFS.CA06;
- namespace Core.LgMes.Client.LgDeviceManager
- {
- public partial class FrmCLPluginInfo : Core.Mes.Client.Common.frmStyleBase//frmModelFormStyle
- {
- public FrmCLPluginInfo(OpeBase oba)
- {
- InitializeComponent();
- ob = oba;
- }
- private void FrmCLPluginInfo_Load(object sender, EventArgs e)
- {
- udteBuyTime.DateTime = DateTime.Today;
- proc_LoadPluginID();
- proc_Query("", "", "");
- }
- private void cbCCM_CheckedChanged(object sender, EventArgs e)
- {
- cmbCCM.Enabled = chkCCM.Checked;
- }
- private void cbType_CheckedChanged(object sender, EventArgs e)
- {
- cmbType.Enabled = chkType.Checked;
- }
- private void cbID_CheckedChanged(object sender, EventArgs e)
- {
- cmbID.Enabled = chkID.Checked;
- }
- private void cbbCCM_SelectedIndexChanged(object sender, EventArgs e)
- {
- proc_LoadPluginID();
- }
- private void cbbType_SelectedIndexChanged(object sender, EventArgs e)
- {
- proc_LoadPluginID();
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- try
- {
- if (ultraGrid1.Rows.Count == 0) return;
- if (ultraGrid1.ActiveRow == null) return;
- cmbZJH.Text = Convert.ToString(ultraGrid1.ActiveRow.Cells["铸机号"].Value);
- txtNO.Text = Convert.ToString(ultraGrid1.ActiveRow.Cells["编号"].Value);
- cmbLB.Text = Convert.ToString(ultraGrid1.ActiveRow.Cells["类别"].Value);
- txtCS.Text = Convert.ToString(ultraGrid1.ActiveRow.Cells["使用炉数"].Value);
- udteBuyTime.DateTime = Convert.ToDateTime(ultraGrid1.ActiveRow.Cells["购买日期"].Value);
- txtMemo.Text = Convert.ToString(ultraGrid1.ActiveRow.Cells["备注"].Value);
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- private void proc_ExecuteCommand_Return(object[] obj, out DataSet ds, out string strErr)
- {
- //CallingMessage par = new CallingMessage();
- //par.ServerName = "LgDeviceManager";
- //par.AssemblyName = "Core.LgMes.Server.LgDeviceManager";
- //par.ClassName = "Core.LgMes.Server.LgDeviceManager.jjqmanager";
- //par.MethodName = "ExecuteCommand_Return";
- //par.args = obj;
- strErr = "";
- ds =null;// ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr) as DataSet;
- }
- /// <summary>
- /// 删除 不用
- /// </summary>
- /// <param name="obj"></param>
- /// <param name="strErr"></param>
- private void proc_ExecuteCommand_NonReturn(object[] obj, out string strErr)
- {
- //CallingMessage par = new CallingMessage();
- //par.ServerName = "LgDeviceManager";
- //par.AssemblyName = "Core.LgMes.Server.LgDeviceManager";
- //par.ClassName = "Core.LgMes.Server.LgDeviceManager.jjqmanager";
- //par.MethodName = "ExecuteCommand_NonReturn";
- //par.args = obj;
- //ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr);
- strErr = "";
- }
- private void proc_ResetControl()
- {
- try
- {
- cmbZJH.SelectedIndex = -1;
- txtNO.Clear();
- cmbLB.SelectedIndex = -1;
- txtCS.Clear();
- txtMemo.Clear();
- }
- catch { }
- }
- /// <铜板水箱编号查询>
- /// 铜板水箱编号查询
- /// </summary>
- private void proc_LoadPluginID()
- {
- try
- {
- string srtCCM_ID = "";
- string srtTYPE = "";
- if (cmbCCM.SelectedIndex > -1)
- {
- srtCCM_ID = cmbCCM.Text.Trim();//铸机号
- }
- if (cmbType.SelectedIndex > -1)
- {
- srtTYPE = cmbType.SelectedIndex.ToString();//类型
- }
- string strErr = "";
- ArrayList arry = new ArrayList();
- arry.Add("proc_LoadPluginID.Select");
- arry.Add(srtCCM_ID);
- arry.Add(srtCCM_ID);
- arry.Add(srtTYPE);
- arry.Add(srtTYPE);
- CommonClientToServer ccs = new CommonClientToServer();
- ccs.ob = this.ob;
- DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
- if (strErr != "" || !(ds != null && ds.Tables.Count > 0))
- {
- MessageBox.Show("铜板水箱编号加载失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- if (MessageBox.Show("是否重新加载铜板水箱编号?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
- proc_LoadPluginID();
- return;
- }
- cmbID.ResetText();
- cmbID.DataSource = ds.Tables[0];
- cmbID.DisplayMember = "PLUGINNO";
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- /// <summary>
- /// 铜板水箱编号信息查询
- /// </summary>
- /// <param name="strCCM"></铸机号>
- /// <param name="strType"></类型>
- /// <param name="strID"></铜板水箱编号>
- private void proc_Query(string strCCM, string strType, string strID)
- {
- try
- {
- string strCCM_ID = "";
- string strTYPE = "";
- string strcbID = "";
- if (chkCCM.Checked && cmbCCM.SelectedIndex > -1)
- {
- strCCM_ID = cmbCCM.SelectedItem.ToString();
- }
- if (chkType.Checked && cmbType.SelectedIndex > -1)
- {
- strTYPE = cmbType.SelectedIndex.ToString();
- }
- if (chkID.Checked && cmbID.SelectedIndex > -1)
- {
- strcbID = cmbID.Text.Trim();
- }
- string strErr = "";
- ArrayList arry = new ArrayList();
- arry.Add("proc_Query.Select");
- arry.Add(strCCM_ID);
- arry.Add(strCCM_ID);
- arry.Add(strTYPE);
- arry.Add(strTYPE);
- arry.Add(strcbID);
- arry.Add(strcbID);
-
- CommonClientToServer ccs = new CommonClientToServer();
- ccs.ob = this.ob;
- DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
- if (strErr != "" || !(ds != null && ds.Tables.Count > 0))
- {
- MessageBox.Show("铜板水箱信息查询失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- ultraGrid1.DataSource = ds.Tables[0];
- if (ds.Tables[0].Rows.Count == 0)
- {
- proc_ResetControl();
- return;
- }
- if (strCCM.Length > 0) //定位记录
- {
- for (int i = 0; i < ultraGrid1.Rows.Count; i++)
- {
- if (Convert.ToString(ultraGrid1.Rows[i].Cells["铸机号"].Value) == strCCM)
- {
- if (strType.Length > 0)
- {
- if (Convert.ToString(ultraGrid1.Rows[i].Cells["类别"].Value) == strType)
- {
- if (strID.Length > 0)
- {
- if (Convert.ToString(ultraGrid1.Rows[i].Cells["编号"].Value) == strID)
- {
- ultraGrid1.ActiveRow = ultraGrid1.Rows[i];
- ultraGrid1.Rows[i].Selected = true;
- return;
- }
- }
- else
- {
- ultraGrid1.ActiveRow = ultraGrid1.Rows[i];
- ultraGrid1.Rows[i].Selected = true;
- return;
- }
- }
- }
- else
- {
- ultraGrid1.ActiveRow = ultraGrid1.Rows[i];
- ultraGrid1.Rows[i].Selected = true;
- return;
- }
- }
- }
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- /// <summary>
- /// 结晶器铜板水箱信息增加
- /// </summary>
- private void proc_Add()
- {
- try
- {
- if (cmbZJH.SelectedIndex < 0)
- {
- MessageBox.Show("请选择铸机号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- cmbZJH.Focus();
- return;
- }
- if (txtNO.Text.Trim().Length == 0)
- {
- MessageBox.Show("请录入编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- txtNO.Focus();
- return;
- }
- if (cmbLB.SelectedIndex < 0)
- {
- MessageBox.Show("请选择类别!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- cmbLB.Focus();
- return;
- }
- string strCCM = cmbZJH.Text.Trim();
- string strNO = txtNO.Text.Trim();
- string strType = cmbLB.SelectedIndex.ToString();
- string strUseTimes = (txtCS.Text.Trim().Length == 0 ? "0" : txtCS.Text.Trim());
- string strDate = udteBuyTime.DateTime.ToString("yyyy-MM-dd");
- string strMemo = txtMemo.Text.Trim();
- string strErr = "";
- ArrayList arry = new ArrayList();
- arry.Add("proc_Add.Select");
- arry.Add(strCCM);
- arry.Add(strType);
- arry.Add(strNO);
- CommonClientToServer ccs = new CommonClientToServer();
- ccs.ob = this.ob;
- DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
-
- if (strErr != "" || !(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
- {
- MessageBox.Show("新增[" + strCCM + "][" + cmbLB.Text.Trim() + "][" + strNO + "]失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- int iCnt = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
- if (iCnt > 0)
- {
- MessageBox.Show("[" + strCCM + "]已存在[" + cmbLB.Text.Trim() + "][" + strNO + "],不能重复录入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- txtNO.Focus();
- return;
- }
- strErr = "";
- arry.Clear();
- arry.Add("proc_Add.Add");
- arry.Add(strNO);
- arry.Add(strCCM);
- arry.Add(strType );
- arry.Add(strUseTimes);
- arry.Add(strDate);
- arry.Add(strMemo );
- string strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr);
- if (!(strErr == null || strErr == ""))
- {
- MessageBox.Show("新增[" + strCCM + "][" + cmbLB.Text.Trim() + "][" + strNO + "]失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- strType = cmbLB.Text.Trim();
- proc_Query(strCCM, strType, strNO);
- MessageBox.Show("新增[" + strCCM + "][" + strType + "][" + strNO + "]成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- /// <summary>
- /// 铜板水箱编号信息修改
- /// </summary>
- private void proc_Edit()
- {
- try
- {
- if (ultraGrid1.Rows.Count == 0)
- return;
- if (ultraGrid1.ActiveRow == null)
- {
- MessageBox.Show("请选择您要修改的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- if (cmbZJH.SelectedIndex < 0)
- {
- MessageBox.Show("请选择铸机号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- cmbZJH.Focus();
- return;
- }
- if (txtNO.Text.Trim().Length == 0)
- {
- MessageBox.Show("请录入编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- txtNO.Focus();
- return;
- }
- if (cmbLB.SelectedIndex < 0)
- {
- MessageBox.Show("请选择类别!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- cmbLB.Focus();
- return;
- }
- string strCCM = cmbZJH.Text.Trim();
- string strNO = txtNO.Text.Trim();
- string strType = cmbLB.SelectedIndex.ToString();
- string strUseTimes = (txtCS.Text.Trim().Length == 0 ? "0" : txtCS.Text.Trim());
- string strDate = udteBuyTime.DateTime.ToString("yyyy-MM-dd");
- string strMemo = txtMemo.Text.Trim();
- if (MessageBox.Show("确定要修改[" + strCCM + "][" + cmbLB.Text.Trim() + "][" + strNO + "]相关信息吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- return;
- string strErr = "";
- ArrayList arry = new ArrayList();
- arry.Add("proc_Edit.Select");
- arry.Add(strCCM);
- arry.Add(strType);
- arry.Add(strNO);
- CommonClientToServer ccs = new CommonClientToServer();
- ccs.ob = this.ob;
- DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
- if (strErr != "" || !(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
- {
- MessageBox.Show("[" + strCCM + "][" + cmbLB.Text.Trim() + "][" + strNO + "]信息修改失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- int iCnt = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
- if (iCnt == 0)
- {
- MessageBox.Show("[" + strCCM + "]不存在[" + cmbLB.Text.Trim() + "][" + strNO + "],无法修改!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- txtNO.Focus();
- return;
- }
- strErr = "";
- arry.Clear();
- arry.Add("proc_Edit.Edit");
- arry.Add(strUseTimes);//状态
- arry.Add(strDate);//购买时间
- arry.Add(strMemo);//备注
- arry.Add(strCCM);//铸机号
- arry.Add(strType);//类别
- arry.Add(strNO);//编号
- string strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr);
- if (!(strErr == null || strErr == ""))
- {
- MessageBox.Show("[" + strCCM + "][" + cmbLB.Text.Trim() + "][" + strNO + "]信息修改失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- strType = cmbLB.Text.Trim();
- proc_Query(strCCM, strType, strNO);
- MessageBox.Show("[" + strCCM + "][" + strType + "][" + strNO + "]信息修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- /// <summary>
- /// 铜板水箱编号信息删除
- /// </summary>
- private void proc_Del()
- {
- try
- {
- if (ultraGrid1.Rows.Count == 0)
- return;
- if (ultraGrid1.ActiveRow == null)
- {
- MessageBox.Show("请选择您要删除的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- string strID = Convert.ToString(ultraGrid1.ActiveRow.Cells["ID"].Value);
- string strNO = Convert.ToString(ultraGrid1.ActiveRow.Cells["编号"].Value);
- string strCCM = Convert.ToString(ultraGrid1.ActiveRow.Cells["铸机号"].Value);
- string strType = Convert.ToString(ultraGrid1.ActiveRow.Cells["类别"].Value);
- if (MessageBox.Show("确定要删除[" + strCCM + "][" + strType + "][" + strNO + "]信息吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- return;
- string strErr = "";
- ArrayList arry = new ArrayList();
- arry.Add("proc_Del.Select.Count");
- arry.Add(strID);
- CommonClientToServer ccs = new CommonClientToServer();
- ccs.ob = this.ob;
- DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
- if (strErr != "" || !(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
- {
- MessageBox.Show("[" + strCCM + "][" + strType + "][" + strNO + "]信息删除失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- int iCnt = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
- if (iCnt == 0)
- {
- MessageBox.Show("[" + strCCM + "]不存在[" + strType + "][" + strNO + "],无法删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- txtNO.Focus();
- return;
- }
- strErr = "";
- arry.Clear();
- ds.Clear();
- arry.Add("proc_D.Select");
- arry.Add(strID);
- arry.Add(strID);
- arry.Add(strID);
- arry.Add(strID);
- arry.Add(strID);
- arry.Add(strID);
- ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
- if (strErr != "" || !(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
- {
- MessageBox.Show("[" + strCCM + "][" + strType + "][" + strNO + "]信息删除失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- iCnt = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
- if (iCnt > 0)
- {
- MessageBox.Show("[" + strCCM + "][" + strType + "][" + strNO + "]存在使用记录,不能删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- txtNO.Focus();
- return;
- }
- strErr = "";
- arry.Clear();
- ds.Clear();
- arry.Add("proc_.Select");
- arry.Add(strID);
- arry.Add(strID);
- arry.Add(strID);
- arry.Add(strID);
- arry.Add(strID);
- arry.Add(strID);
- ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
- if (strErr != "" || !(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
- {
- MessageBox.Show("[" + strCCM + "][" + strType + "][" + strNO + "]信息删除失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- iCnt = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
- if (iCnt > 0)
- {
- MessageBox.Show("[" + strCCM + "][" + strType + "][" + strNO + "]存在使用记录,不能删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- txtNO.Focus();
- return;
- }
- strErr = "";
- arry.Clear();
- arry.Add("proc_Del.Delect");
- arry.Add(strID);
- string strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr);
- if (!(strErr == null || strErr == ""))
- {
- MessageBox.Show("[" + strCCM + "][" + strType + "][" + strNO + "]信息删除失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- proc_Query(strCCM, cmbLB.Text.Trim(), strNO);
- MessageBox.Show("[" + strCCM + "][" + strType + "][" + strNO + "]信息删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- /// <summary>
- /// 菜单
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
- {
- if (e.ClickedItem == null) return;
- switch (e.ClickedItem.Name)
- {
- case "QUERY":
- {
- proc_Query("", "", "");
- break;
- }
- case "ADD":
- {
- proc_Add();
- break;
- }
- case "EDIT":
- {
- proc_Edit();
- break;
- }
- case "DEL":
- {
- proc_Del();
- break;
- }
- case "CLOSE":
- {
- this.Close();
- break;
- }
- }
- }
- private void tbCS_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (!(Char.IsNumber(e.KeyChar) || e.KeyChar == '\b' || e.KeyChar == '.') || (((TextBox)(sender)).Text.Trim().Contains(".") && e.KeyChar == '.'))
- {
- e.Handled = true;
- }
- }
- }
- }
|