using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using CoreFS.CA06; using System; using System.Data; using System.Windows.Forms; namespace Core.StlMes.Client.Qcm { public delegate void PlineRSpecSucessHandler(object sender, PlineRSpecArgs e); public partial class PopupComMSCPlineRSpec : FrmBase { public event PlineRSpecSucessHandler PlineRSpecSucessEvent; private FrmComMSCPlineRSpec _frm; private string _process = ""; private string _dimater = ""; private string _height = ""; private string _specCode = ""; private string closeAction = ""; /// /// 弹窗构造函数 /// /// 输入参数 public PopupComMSCPlineRSpec(string[] args, string exceptionMsg, OpeBase ob) { InitializeComponent(); ExceptionHelper.RegistException(); string str = args[0]; string[] strs = str.Split(','); _process = strs[0].Trim(); _dimater = strs[1].Trim(); _height = strs[2].Trim(); _specCode = strs[3].Trim(); this.ob = ob; ultraStatusBar1.Panels["ExMsg"].Text = exceptionMsg; _frm = new FrmComMSCPlineRSpec(); _frm.PopupLoad("", ob); this.panel5.Controls.Add(_frm.UltraPanel1); this.panel5.Controls.Add(_frm.UltraExpandableGroupBox1); this.panel5.Controls.Add(_frm.UltraGrid1); _frm.UltraGrid1.BringToFront(); SetDefaltCondition(); _frm.ToolBar_Click(null, "Query"); } private void SetDefaltCondition() { _frm.MscPlines = GetMscPlines(); //_frm.SpecCode = _specCode; _frm.Dimater = _dimater; _frm.Height1 = _height; DataTable dt = (DataTable)_frm.UltraComProLine.DataSource; dt.DefaultView.RowFilter = "ID IN (" + _frm.MscPlines + ")"; //_frm.UltraComboEditor1.Value = _specCode; //_frm.UltraComboEditor1.ReadOnly = true; } private string GetMscPlines() { DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreComMSCPlineRSpec.getMscPlines", new object[] { _process }, ob); string mscPlines = _frm.MscPlines; foreach (DataRow dr in dt.Rows) { mscPlines += ", '" + dr["PLINE_CODE"].ToString() + "'"; } return mscPlines; } private void btnClose_Click(object sender, EventArgs e) { closeAction = "Ok"; if (PlineRSpecSucessEvent != null) { if (_frm.UltraGrid1.ActiveRow == null) { MessageUtil.ShowWarning("请维护一条生产产线适用规格!"); return; } PlineRSpecArgs e2 = new PlineRSpecArgs(); e2.Result = "1"; PlineRSpecSucessEvent(this, e2); } this.DialogResult = DialogResult.OK; } private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e) { switch (e.Tool.Key) { case "查询": _frm.ToolBar_Click(null, "Query"); break; case "新增": //if (CheckData() == false) return; _frm.ToolBar_Click(null, "Add"); break; case "修改": //if (CheckData() == false) return; _frm.ToolBar_Click(null, "Update"); break; case "作废": _frm.ToolBar_Click(null, "Delete"); break; case "恢复": _frm.ToolBar_Click(null, "Resume"); break; case "刷新": _frm.ToolBar_Click(null, "Refresh"); break; case "关闭": this.Close(); break; } } private bool CheckData() { double dimaterMin = double.Parse(_frm.UltraTextEditor1.Value.ToString() == "" ? "0" : _frm.UltraTextEditor1.Value.ToString()); double dimaterMax = double.Parse(_frm.UltraTextEditor2.Value.ToString() == "" ? "0" : _frm.UltraTextEditor2.Value.ToString()); double heightMin = double.Parse(_frm.UltraTextEditor3.Value.ToString() == "" ? "0" : _frm.UltraTextEditor3.Value.ToString()); double heightMax = double.Parse(_frm.UltraTextEditor4.Value.ToString() == "" ? "0" : _frm.UltraTextEditor4.Value.ToString()); if (_frm.UltraTextEditor1.Value != null && dimaterMin > double.Parse(_dimater == "" ? "0" : _dimater)) { MessageUtil.ShowWarning("外径最小值不能大于指定的外径[" + (_dimater == "" ? "0" : _dimater) + "]"); return false; } if (_frm.UltraTextEditor2.Value != null && dimaterMax < double.Parse(_dimater == "" ? "0" : _dimater)) { MessageUtil.ShowWarning("外径最大值不能小于指定的外径[" + (_dimater == "" ? "0" : _dimater) + "]"); return false; } if (_frm.UltraTextEditor3.Value != null && heightMin > double.Parse(_height == "" ? "0" : _height)) { MessageUtil.ShowWarning("壁厚最小值不能大于指定的壁厚[" + (_height == "" ? "0" : _height) + "]"); return false; } if (_frm.UltraTextEditor4.Value != null && heightMax < double.Parse(_height == "" ? "0" : _height)) { MessageUtil.ShowWarning("壁厚最大值不能小于指定的壁厚[" + (_height == "" ? "0" : _height) + "]"); return false; } return true; } private void PopupComMSCPlineRSpec_FormClosing(object sender, FormClosingEventArgs e) { if (PlineRSpecSucessEvent != null && closeAction == "") { PlineRSpecArgs e2 = new PlineRSpecArgs(); e2.Result = "0"; PlineRSpecSucessEvent(this, e2); } } private void btnCancel_Click(object sender, EventArgs e) { this.Close(); } } public class PlineRSpecArgs : EventArgs { private string _result = ""; public string Result { get { return _result; } set { _result = value; } } } }