| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- 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 = "";
- /// <summary>
- /// 弹窗构造函数
- /// </summary>
- /// <param name="args">输入参数</param>
- 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; }
- }
- }
- }
|