using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using CoreFS.CA06; using Core.Mes.Client.Common; using System.Collections; namespace Core.LgMes.Client.LgDeviceManager { public partial class FrmZEROBaseInfo : Core.Mes.Client.Common.frmStyleBase { bool bOK = false; //是否响应段位号选择改变事件 public string strNo = "", strCCM = "",strVBNo=""; public FrmZEROBaseInfo(OpeBase oba) { InitializeComponent(); ob = oba; } private void txtAge_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; } } private void FrmCLBaseInfoBP_Load(object sender, EventArgs e) { if (strCCM.Length > 0) { cmbCCM.Text = strCCM; //cmbVBType.Text = strVBNo; this.cbbCCM_SelectedIndexChanged(this, null); if (strNo.Length > 0) { cmbID.Text = strNo; bOK = true; this.cbbID_SelectedIndexChanged(this, null); } } else bOK = true; } private void proc_GetID(string strCCM) { try { if (strCCM.Length == 0) return; string strErr = ""; ArrayList arry = new ArrayList(); arry.Add("ZOCRYSTALLIZERID.select"); arry.Add(strCCM); 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_GetID(strCCM); return; } cmbID.DataSource = ds.Tables[0]; cmbID.DisplayMember = "CRYSTALLIZERID"; if (ds.Tables[0].Rows.Count == 0) proc_ResetControl(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void proc_ResetControl() { try { cmbID.Text = ""; txtCS.Clear(); txtTgl.Clear(); txtCS1.Clear(); txtCS2.Clear(); txtCS3.Clear(); txtCS4.Clear(); cmbID5.SelectedIndex = -1; txtCS5.Clear(); cmbID6.SelectedIndex = -1; txtCS6.Clear(); txtStatus.Clear(); txtPos.Clear(); udtePTime.DateTime = DateTime.Now; udteBuyTime.DateTime = DateTime.Now; txtMemo.Clear(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } /// /// 段位基本信息增加 /// private void proc_Add() { try { string strCcm = cmbCCM.Text.Trim(); string strID = cmbID.Text.Trim(); string strType = "零段"; if (strCcm.Length == 0) { MessageBox.Show("请选择铸机号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbCCM.Focus(); return; } if (strID.Length == 0) { MessageBox.Show("请输入编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbID.Focus(); return; } string strErr = ""; ArrayList arry = new ArrayList(); arry.Add("FrmZOBaseInfoBP"); arry.Add(strCcm); arry.Add(strID); CommonClientToServer ccs = new CommonClientToServer(); ccs.ob = this.ob; DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr); int iCnt = Convert.ToInt32(ds.Tables[0].Rows[0][0]); if (iCnt > 0) { MessageBox.Show("[" + strCCM + "]已存在" + strType + "[" + strID + "],不能重复录入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); cmbID.Focus(); return; } string strReturn = ""; strErr = ""; arry.Clear(); #region//修改段位铜板水箱信息 CommonClientToServer cctos = new CommonClientToServer(); #endregion strErr = ""; arry.Clear(); strReturn = ""; arry.Add("FrmZOBaseInfoBP.ADD"); arry.Add(strID); arry.Add("3"); arry.Add(txtCS.Text.Trim() == "" ? "0" : txtCS.Text.Trim()); arry.Add(txtTgl.Text.Trim() == "" ? "0" : txtTgl.Text.Trim()); arry.Add(udtePTime.DateTime.ToString("yyyy-MM-dd")); arry.Add(udteBuyTime.DateTime.ToString("yyyy-MM-dd")); arry.Add(txtMemo.Text.Trim()); arry.Add(strCcm); arry.Add(""); arry.Add(""); arry.Add(""); arry.Add(""); arry.Add(""); arry.Add(""); arry.Add(txtOutAge.Text.Trim()); arry.Add(txtInnerAge.Text.Trim()); arry.Add(txtLeftAge.Text.Trim()); arry.Add(txtRightAge.Text.Trim()); //添加铜板对应使用炉数 arry.Add(txtCS1.Text.Trim()); arry.Add(txtCS2.Text.Trim()); arry.Add(txtCS3.Text.Trim()); arry.Add(txtCS4.Text.Trim()); strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr); if (!(strErr == null || strErr == "")) { MessageBox.Show("新增[" + strCcm + "]" + strType + "[" + strID + "]失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } FrmZEROManage frm = (FrmZEROManage)this.Tag; frm.proc_GetBaseInfo(strCcm, strID); proc_GetID(strCcm); MessageBox.Show("新增[" + strCcm + "]" + strType + "[" + strID + "]成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } catch (Exception ex) { MessageBox.Show(ex.Message); } } /// /// 段位基本信息修改 /// private void proc_Edit() { try { if (cmbID.Items.Count == 0) return; string strCcm = cmbCCM.Text.Trim(); string strID = cmbID.Text.Trim(); string strType = "零段为"; if (strID.Length == 0) { MessageBox.Show("请选择需要修改的段位编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbID.Focus(); return; } #region #endregion if (MessageBox.Show("确定要修改[" + strCcm + "]" + strType + "[" + strID + "]信息吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) return; string strErr = ""; string strReturn = ""; ArrayList arry = new ArrayList(); arry.Add("FrmZOBaseInfoBP_Edit.select"); arry.Add(strCcm); 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)) { MessageBox.Show("[" + strCcm + "]" + strType + "[" + strID + "]信息修改失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string str1 = "", str2 = "", str3 = "", str4 = ""; string str5 = "", str6 = "", str7 = ""; if (ds.Tables[0].Rows.Count > 0) { str1 = Convert.ToString(ds.Tables[0].Rows[0]["NOWSTATUS"]); str2 = Convert.ToString(ds.Tables[0].Rows[0]["OUTERCOPPER"]); str3 = Convert.ToString(ds.Tables[0].Rows[0]["INNERCOPPER"]); str4 = Convert.ToString(ds.Tables[0].Rows[0]["LEFTCOPPER"]); str5 = Convert.ToString(ds.Tables[0].Rows[0]["RIGHTCOPPER"]); str6 = Convert.ToString(ds.Tables[0].Rows[0]["OUTERWATER"]); str7 = Convert.ToString(ds.Tables[0].Rows[0]["INNERWATER"]); } strErr = ""; #region//修改段位铜板水箱信息 CommonClientToServer cctos = new CommonClientToServer(); cctos.ob = this.ob; #endregion//修改段位铜板水箱信息 //根据流号获取段位编号和周期编号 ArrayList arryCry = new ArrayList(); arryCry.Add("FrmZOCryByCcmsId.Query"); arryCry.Add(txtPos.Text.Trim()); DataSet dsCry = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arryCry, out strErr); strErr = ""; arry.Clear(); cctos.ob = this.ob; arry.Add("FrmZOBaseInfoBP.Edit"); arry.Add("3"); arry.Add(strCcm); arry.Add(txtCS.Text.Trim() == "" ? "0" : txtCS.Text.Trim()); arry.Add(txtTgl.Text.Trim() == "" ? "0" : txtTgl.Text.Trim()); arry.Add(txtOutAge.Text.Trim() == "" ? "0" : txtOutAge.Text.Trim()); arry.Add(txtInnerAge.Text.Trim() == "" ? "0" : txtInnerAge.Text.Trim()); arry.Add(txtLeftAge.Text.Trim() == "" ? "0" : txtLeftAge.Text.Trim()); arry.Add(txtRightAge.Text.Trim() == "" ? "0" : txtRightAge.Text.Trim()); arry.Add(txtCS1.Text.Trim() == "" ? "0" : txtCS1.Text.Trim()); arry.Add(txtCS2.Text.Trim() == "" ? "0" : txtCS2.Text.Trim()); arry.Add(txtCS3.Text.Trim() == "" ? "0" : txtCS3.Text.Trim()); arry.Add(txtCS4.Text.Trim() == "" ? "0" : txtCS4.Text.Trim()); arry.Add(""); arry.Add(""); arry.Add(""); arry.Add(""); arry.Add(""); arry.Add(""); arry.Add(udtePTime.DateTime.ToString("yyyy-MM-dd")); arry.Add(udteBuyTime.DateTime.ToString("yyyy-MM-dd")); arry.Add(txtMemo.Text.Trim()); arry.Add(strCCM); arry.Add(strID); strReturn = cctos.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr); //修改段位使用信息 ArrayList arryU = new ArrayList(); arryU.Add("FrmZO_User_Detail.Edit"); arryU.Add(txtCS1.Text.Trim() == "" ? "0" : txtCS1.Text.Trim()); arryU.Add(txtCS2.Text.Trim() == "" ? "0" : txtCS2.Text.Trim()); arryU.Add(txtCS3.Text.Trim() == "" ? "0" : txtCS3.Text.Trim()); arryU.Add(txtCS4.Text.Trim() == "" ? "0" : txtCS4.Text.Trim()); arryU.Add(txtOutAge.Text.Trim() == "" ? "0" : txtOutAge.Text.Trim()); arryU.Add(txtInnerAge.Text.Trim() == "" ? "0" : txtInnerAge.Text.Trim()); arryU.Add(txtLeftAge.Text.Trim() == "" ? "0" : txtLeftAge.Text.Trim()); arryU.Add(txtRightAge.Text.Trim() == "" ? "0" : txtRightAge.Text.Trim()); arryU.Add("3"); arryU.Add(dsCry.Tables[0].Rows.Count>0 ? dsCry.Tables[0].Rows[0]["CRYSTALLIZERID"].ToString():""); arryU.Add(dsCry.Tables[0].Rows.Count > 0 ? dsCry.Tables[0].Rows[0]["CYCID"].ToString() : ""); strReturn = cctos.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arryU, out strErr); if (!(strErr == null || strErr == "")) { MessageBox.Show("[" + strCcm + "]" + strType + "[" + strID + "]信息修改失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } FrmZEROManage frm = (FrmZEROManage)this.Tag; frm.proc_GetBaseInfo(strCcm, strID); proc_GetID(strCcm); MessageBox.Show("[" + strCcm + "]" + strType + "[" + strID + "]信息修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } catch (Exception ex) { MessageBox.Show(ex.Message); } } /// /// 段位基础信息删除 /// private void proc_Del() { try { if (cmbID.Items.Count == 0) return; string strCcm = cmbCCM.Text.Trim(); string strID = cmbID.Text.Trim(); string strType = "3"; if (strID.Length == 0) { MessageBox.Show("请选择需要删除的" + strType + "编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbID.Focus(); return; } if (MessageBox.Show("确定要删除[" + strCcm + "]" + strType + "[" + strID + "]的信息吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) return; string strErr = ""; ArrayList arry = new ArrayList(); arry.Add("FrmZOBaseInfoBP_Del_Select"); arry.Add(strCcm); 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 + "[" + strID + "]信息删除失败!\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 + "[" + strID + "]信息,无法删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); cmbID.Focus(); return; } iCnt = 0; ds = null; strErr = ""; arry.Clear(); ccs.ob = this.ob; arry.Add("FrmZOBaseInfoBP_Del_Select_1"); arry.Add(strCcm); 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 + "[" + strID + "]信息删除失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } iCnt = Convert.ToInt32(ds.Tables[0].Rows[0][0]); if (iCnt > 0) { MessageBox.Show("[" + strCcm + "]" + strType + "[" + strID + "]存在使用记录,不能删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); cmbID.Focus(); return; } iCnt = 0; ds = null; strErr = ""; arry.Clear(); ccs.ob = this.ob; arry.Add("FrmZOBaseInfoBP_Del_Select_2"); arry.Add(strCcm); 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 + "[" + strID + "]信息删除失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } iCnt = Convert.ToInt32(ds.Tables[0].Rows[0][0]); if (iCnt > 0) { MessageBox.Show("[" + strCcm + "]" + strType + "[" + strID + "]存在维修记录,不能删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); cmbID.Focus(); return; } strErr = ""; arry.Clear(); arry.Add("FrmZOBaseInfoBP_Del.Delect"); arry.Add(strCcm); arry.Add(strID); string strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr); if (!(strErr == null || strErr == "")) { MessageBox.Show("[" + strCcm + "]" + strType + "[" + strID + "]信息删除失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } FrmVBManage frm = (FrmVBManage)this.Tag; frm.proc_GetBaseInfo(strCcm, ""); proc_GetID(strCcm); MessageBox.Show("[" + strCcm + "]" + strType + "[" + strID + "]信息删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } catch (Exception ex) { MessageBox.Show(ex.Message); } } private TextBox proc_GetTextBox(string strComboBoxName) { switch (strComboBoxName) { case "cbbID1": { return txtCS1; } case "cbbID2": { return txtCS2; } case "cbbID3": { return txtCS3; } case "cbbID4": { return txtCS4; } case "cbbID5": { return txtCS5; } case "cbbID6": { return txtCS6; } } return null; } private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { switch (e.ClickedItem.Name) { case "ADD": { this.proc_Add(); break; } case "EDIT": { this.proc_Edit(); break; } case "DEL": { this.proc_Del(); break; } case "CLOSE": { this.Close(); break; } default: break; } } /// <铸机号属性更改时> /// 铸机号属性更改时 /// /// /// private void cbbCCM_SelectedIndexChanged(object sender, EventArgs e) { if (cmbCCM.Text.Length > 0) { proc_GetID(cmbCCM.Text); } } /// <段位属性更改时> /// 段位属性更改时 /// /// /// private void cbbID_SelectedIndexChanged(object sender, EventArgs e) { try { if (!bOK) return; string strCCM = cmbCCM.Text.Trim(); string strID = cmbID.Text.Trim(); string strType = "3"; if (strID.Length == 0) return; string strErr = ""; ArrayList arry = new ArrayList(); arry.Add("ZOcbbID.Select"); arry.Add(strID); arry.Add(strCCM); 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("" + strType + "[" + strID + "]信息查询失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (ds.Tables[0].Rows.Count == 0) return; //cmbVBType.Text = Convert.ToString(ds.Tables[0].Rows[0]["TYPE"]); txtCS.Text = Convert.ToString(ds.Tables[0].Rows[0]["CUPRUMCANALTIME"]); txtTgl.Text = Convert.ToString(ds.Tables[0].Rows[0]["AGE"]); txtStatus.Text = Convert.ToString(ds.Tables[0].Rows[0]["NOWSTATUS"]); txtPos.Text = Convert.ToString(ds.Tables[0].Rows[0]["CCM_S_ID"]); udtePTime.DateTime = Convert.ToDateTime(ds.Tables[0].Rows[0]["CREATIVEDATE"]); udteBuyTime.DateTime = Convert.ToDateTime(ds.Tables[0].Rows[0]["BUYDATE"]); txtMemo.Text = Convert.ToString(ds.Tables[0].Rows[0]["MEMO"]); txtOutAge.Text = Convert.ToString(ds.Tables[0].Rows[0]["OUTAGE"]); txtInnerAge.Text = Convert.ToString(ds.Tables[0].Rows[0]["INNERAGE"]); txtLeftAge.Text = Convert.ToString(ds.Tables[0].Rows[0]["LEFTAGE"]); txtRightAge.Text = Convert.ToString(ds.Tables[0].Rows[0]["RIGHTAGE"]); txtCS1.Text = Convert.ToString(ds.Tables[0].Rows[0]["OUTTIMES"]); txtCS2.Text = Convert.ToString(ds.Tables[0].Rows[0]["INNERTIMES"]); txtCS3.Text = Convert.ToString(ds.Tables[0].Rows[0]["LEFTTIMES"]); txtCS4.Text = Convert.ToString(ds.Tables[0].Rows[0]["RIGHTTIMES"]); } catch { } } } }