| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Qcm.model;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinEditors;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections;
- using System.Data;
- using System.Drawing;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.Qcm
- {
- public partial class FrmBaseSample : FrmBase
- {
- public FrmBaseSample()
- {
- InitializeComponent();
- this.IsLoadUserView = true;
- }
- public void PopupLoad(string customInfo, OpeBase ob)
- {
- this.CustomInfo = customInfo;
- this.ob = ob;
- this._ob = ob;
- this.OnLoad(EventArgs.Empty);
- }
- private OpeBase _ob;
- public OpeBase Ob
- {
- get { return _ob; }
- set { _ob = value; }
- }
- private string phycode = ""; //取样码
- public string Phycode
- {
- get { return phycode; }
- set { phycode = value; }
- }
- private string phydesc; //取样码描述
- public string Phydesc
- {
- get { return phydesc; }
- set { phydesc = value; }
- }
- private string stdcode; //标准码
- public string Stdcode
- {
- get { return stdcode; }
- set { stdcode = value; }
- }
- private string stddesc; //标准名称
- public string Stddesc
- {
- get { return stddesc; }
- set { stddesc = value; }
- }
- private FrmPhySample fhs;
- public FrmPhySample Fhs
- {
- get { return fhs; }
- set { fhs = value; }
- }
- ArrayList parms = new ArrayList(); //新增参数
- private void initJGDropDown(UltraComboEditor uce, string MethodId, string memberValue)
- {
- //初始化编辑区域下拉框
- DataTable dt = ServerHelper.GetData(MethodId, null, this._ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- uce.DataSource = dt;
- uce.ValueMember = memberValue;
- }
- }
- private void FrmBaseSample_Load(object sender, EventArgs e)
- {
- try
- {
- this.Cursor = Cursors.WaitCursor;
- if (_ob == null)
- {
- _ob = ob;
- }
- InitCombo();
- doQuery();
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- base.ToolBar_Click(sender, ToolbarKey);
- switch (ToolbarKey)
- {
- case "查询":
- doQuery();
- break;
- case "ButtonTool1":
- doSave();
- break;
- case "ButtonTool2":
- doRefresh();
- break;
- case "ButtonTool3":
- if (MessageBox.Show("确认关闭本窗口?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
- this.Close();
- break;
- case "ButtonTool4":
- DeleteOrResume(true);
- break;
- case "ButtonTool5":
- DeleteOrResume(false);
- break;
- }
- }
- private void InitCombo()
- {
- initJGDropDown(ultraComboEditor1, "com.steering.pss.qcm.CoreBaseSample.GetPhyLength", "BASECODE");
- ClsBaseInfo.FillComBaseInfo(ultraComboEditor2, "4086", _ob, false);
- initJGDropDown(ultraComboEditor3, "com.steering.pss.qcm.CoreBaseSample.GetPhyPosition", "BASECODE");
- ClsBaseInfo.FillComBaseInfo(ultraComboEditor5, "4081", _ob, false);
- QcmBaseQuery.NitializeStandardGX(ultraComboEditor4, true, _ob);
- ClsBaseInfo.FillComBaseInfo(ultraComboEditor9, "4099", _ob, false);
- //ultraGrid1.DisplayLayout.Bands[0].Columns["STD_CODE"].EditorComponent= ultraComboEditor4;
- //ultraGrid1.DisplayLayout.Bands[0].Columns["STD_CODE"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- }
- private void AutoColSize()
- {
- UltraGridColumn[] col = new UltraGridColumn[] { ultraGrid1.DisplayLayout.Bands[0].Columns["MEMO"] };
- GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid1, col);
- }
- public void doQuery()
- {
- try
- {
- this.Cursor = Cursors.WaitCursor;
- string validflag = ultraCheckEditor1.Checked ? "0" : "1";
- string phyMinName = labelTextBox1.Checked ? labelTextBox1.Text.Trim() : "";
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreBaseSample.Query",
- new Object[] { this.Phycode, phyMinName, validflag }, this._ob);
- GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
- foreach (UltraGridRow row in this.ultraGrid1.Rows)
- {
- ControlEdit(row);
- if (row.Cells["RATE"].Value.ToString() != "408602")
- {
- row.Cells["BATCH_CNT"].Value = "";
- row.Cells["BATCH_UNIT"].Value = "";
- row.Cells["BATCH_CNT"].Activation = Activation.ActivateOnly;
- row.Cells["BATCH_UNIT"].Activation = Activation.ActivateOnly;
- }
- else
- {
- row.Cells["BATCH_CNT"].Activation = Activation.AllowEdit;
- row.Cells["BATCH_UNIT"].Activation = Activation.AllowEdit;
- }
- if (!row.Cells["VALIDFLAG"].Value.ToString().Equals("有效"))
- {
- row.Appearance.ForeColor = Color.Red;
- }
- else
- {
- row.Appearance.ForeColor = Color.Black;
- }
- }
- ultraGrid1.UpdateData();
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- private void doSave()
- {
- if (GetGridData() == false) return;
- if (parms.Count <= 0)
- {
- MessageUtil.ShowWarning("请选择记录!");
- return;
- }
- if (MessageBox.Show("是否确认保存?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
- this.ob = this.Ob;
- CoreClientParam ccp = new CoreClientParam(); //CoreClientParam是平台用来向服务端传递存放所有相关参数信息的。
- ccp.ServerName = "com.steering.pss.qcm.CoreBaseSample"; //服务名指的是服务端的包名+类名
- ccp.MethodName = "doSave"; //方法名指的是服务名指定类里的方法
- ccp.ServerParams = new object[] { parms };//服务端方法的参数
- //ExecuteNonQuery主要用来执行添加、修改、删除、存储过程的操作。
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- return;
- MessageBox.Show("保存成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- doQuery();
- // this.Close();
- }
- private void doRefresh()
- {
- InitCombo();
- AutoColSize();
- }
- private void DeleteOrResume(bool flag)
- {
- this.ultraGrid1.UpdateData();
- int ischeck = 0;
- ArrayList parms = new ArrayList();
- foreach (UltraGridRow row in ultraGrid1.Rows)
- {
- if (row.Cells["CHK"].Value.ToString().ToUpper() == "TRUE")
- {
- ischeck += 1;
- if (row.Cells["VALIDFLAG"].Value.ToString() == "无效")
- {
- if (flag)
- {
- MessageBox.Show("无效数据,无法作废", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- row.Activate();
- return;
- }
- }
- if (row.Cells["VALIDFLAG"].Value.ToString() == "有效")
- {
- if (flag == false)
- {
- MessageBox.Show("有效数据,无法恢复", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- row.Activate();
- return;
- }
- }
- parms.Add(row.Cells["SIC"].Value.ToString());
- }
- }
- if (ischeck == 0)
- {
- MessageBox.Show("请选择你要" + (flag ? "作废" : "恢复") + "的记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (MessageBox.Show("确认要" + (flag ? "作废" : "恢复") + "选择的记录", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.No)
- return;
- this.ob = this.Ob;
- CoreClientParam ccp = new CoreClientParam(); //CoreClientParam是平台用来向服务端传递存放所有相关参数信息的。
- ccp.ServerName = "com.steering.pss.qcm.CoreBaseSample"; //服务名指的是服务端的包名+类名
- ccp.MethodName = "DeleteOrResume"; //方法名指的是服务名指定类里的方法
- ccp.ServerParams = new object[] { parms, flag, this.UserInfo.GetUserName() };//服务端方法的参数
- //ExecuteNonQuery主要用来执行添加、修改、删除、存储过程的操作。
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- return;
- MessageBox.Show("数据" + (flag ? "作废" : "恢复") + "成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- doQuery();
- }
- private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
- {
- if (e.Tool.Key == "查询")
- {
- doQuery();
- }
- if (e.Tool.Key == "ButtonTool1") //保存
- {
- doSave();
- }
- if (e.Tool.Key == "ButtonTool2") //刷新
- {
- doRefresh();
- }
- if (e.Tool.Key == "ButtonTool3") //关闭
- {
- if (MessageBox.Show("确认关闭本窗口?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
- this.Close();
- }
- if (e.Tool.Key == "ButtonTool4") //删除
- {
- DeleteOrResume(true);
- }
- if (e.Tool.Key == "ButtonTool5") //恢复
- {
- DeleteOrResume(false);
- }
- }
- private void ultraGrid1_AfterRowInsert(object sender, Infragistics.Win.UltraWinGrid.RowEventArgs e)
- {
- UltraGridRow ugr = this.ultraGrid1.ActiveRow;
- string sic = ""; //sic码
- string sicd = ""; //最终的sic码
- DataRow[] dr = dataTable1.Select("", "SIC DESC");
- if (dr.Length > 0)
- {
- sic = dr[0]["SIC"].ToString();
- }
- if (sic == "")
- {
- sicd = this.Phycode + string.Format("{0:000}", 1);
- }
- else
- {
- int index = int.Parse(sic.Substring(5, 3));
- index += 1;
- sicd = this.Phycode + string.Format("{0:000}", index);
- }
- ugr.Cells["PHY_CODE_MIN"].Value = this.Phycode;
- ugr.Cells["PHY_NAME_MIN"].Value = this.Phydesc;
- ugr.Cells["STD_CODE"].Value = "";
- ugr.Cells["SIC"].Value = sicd;
- ugr.Cells["SAMPLE_COUNT"].Value = LoadPhySmpCnt();
- if (!ugr.GetValue("PHY_NAME_MIN").StartsWith("SSC"))
- {
- ugr.Cells["SSC_CONDITION"].Value = "409901";
- }
- //e.Row.Cells["STEEL_SELECT"].Value = "选择";
- }
- private string LoadPhySmpCnt()
- {
- try
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreBaseSample.loadPhySmpCnt",
- new object[] { phycode }, Ob);
- return dt.Rows[0][0].ToString();
- }
- catch { }
- return "";
- }
- private void ultraGrid1_CellChange(object sender, CellEventArgs e)
- {
- ultraGrid1.UpdateData();
- ControlEdit(e.Cell.Row);
- if (e.Cell.Row.Cells["RATE"].Value.ToString() != "408602" && e.Cell.Row.Cells["RATE"].Value.ToString() != "408608")
- {
- e.Cell.Row.Cells["BATCH_CNT"].Value = "";
- e.Cell.Row.Cells["BATCH_UNIT"].Value = "";
- e.Cell.Row.Cells["BATCH_CNT"].Activation = Activation.ActivateOnly;
- e.Cell.Row.Cells["BATCH_UNIT"].Activation = Activation.ActivateOnly;
- }
- else
- {
- e.Cell.Row.Cells["BATCH_CNT"].Activation = Activation.AllowEdit;
- e.Cell.Row.Cells["BATCH_UNIT"].Activation = Activation.AllowEdit;
- }
- if (e.Cell.Row.GetText("RATE").Contains("生产批"))
- {
- e.Cell.Row.Cells["TOP_STOVE"].Activation = Activation.AllowEdit;
- e.Cell.Row.Cells["LOOP_VALUE"].Activation = Activation.AllowEdit;
- }
- else
- {
- e.Cell.Row.Cells["TOP_STOVE"].Value = "";
- e.Cell.Row.Cells["LOOP_VALUE"].Value = "";
- e.Cell.Row.Cells["TOP_STOVE"].Activation = Activation.ActivateOnly;
- e.Cell.Row.Cells["LOOP_VALUE"].Activation = Activation.ActivateOnly;
- }
- if (e.Cell.Column.Key == "ATTACH_PERCENT" || e.Cell.Column.Key == "ATTACH_COUNT")
- {
- e.Cell.Row.Cells["DESC_COUNT"].Value = "";
- }
- if (e.Cell.Column.Key == "DESC_COUNT")
- {
- e.Cell.Row.Cells["ATTACH_PERCENT"].Value = "";
- e.Cell.Row.Cells["ATTACH_COUNT"].Value = "";
- }
- e.Cell.Row.Update();
- }
- private void ultraGrid1_AfterCellUpdate(object sender, CellEventArgs e)
- {
- UltraGridRow ugr = this.ultraGrid1.ActiveRow;
- if (e.Cell.Column.Key.Equals("DESC_LENGTH"))
- {
- if (ugr.Cells["DESC_LENGTH"].Value.ToString() != "")
- {
- this.ultraComboEditor1.Text = ugr.Cells["DESC_LENGTH"].Text.ToString();
- ugr.Cells["LENGTH"].Value = this.ultraComboEditor1.Value.ToString();
- }
- }
- if (e.Cell.Column.Key.Equals("DESC_POSITION"))
- {
- if (ugr.Cells["DESC_POSITION"].Value.ToString() != "")
- {
- this.ultraComboEditor3.Text = ugr.Cells["DESC_POSITION"].Text.ToString();
- ugr.Cells["POSITION"].Value = this.ultraComboEditor3.Value.ToString();
- }
- }
- }
- private bool GetGridData()
- {
- this.ultraGrid1.UpdateData();
- parms.Clear();
- foreach (UltraGridRow row in ultraGrid1.Rows)
- {
- if (row.Cells["CHK"].Value.ToString().ToUpper() == "TRUE") //勾选
- {
- ArrayList listAdd = new ArrayList();
- ArrayList listUpdate = new ArrayList();
- if (row.Cells["RATE"].Value.ToString() == "")
- {
- MessageBox.Show("请选择取样频率", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- row.Cells["RATE"].Activate();
- return false;
- }
- if (row.Cells["RATE"].Value.ToString() == "408602" || row.Cells["RATE"].Value.ToString() == "408608")// 检验批和生产批(检验批)
- {
- if (row.Cells["BATCH_UNIT"].Text == "")
- {
- MessageUtil.ShowWarning("请选择分批单位!");
- row.Cells["BATCH_UNIT"].Activate();
- return false;
- }
- else if (row.Cells["BATCH_CNT"].Text == "")
- {
- MessageUtil.ShowWarning("请输入分批数量!");
- row.Cells["BATCH_CNT"].Activate();
- return false;
- }
- }
- if (row.Cells["POSITION"].Value.ToString() == "")
- {
- MessageBox.Show("请选择取样位置", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- row.Cells["POSITION"].Activate();
- return false;
- }
- if (row.Cells["DESC_COUNT"].Value.ToString() == "" && row.Cells["ATTACH_PERCENT"].Value.ToString() == "")
- {
- MessageBox.Show("请输入管头个数或百分比%", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- row.Cells["DESC_COUNT"].Activate();
- return false;
- }
- if (row.GetValue("SAMPLE_COUNT") == "")
- {
- MessageUtil.ShowWarning("请输入样条个数!");
- row.SetCellActive("SAMPLE_COUNT");
- return false;
- }
- if (row.GetValue("ATTACH_COUNT") != "" && row.GetValue("ATTACH_PERCENT") == "" )
- {
- MessageUtil.ShowWarning("min支不为空,请输入百分比%");
- row.SetCellActive("ATTACH_PERCENT");
- return false;
- }
- if (row.GetValue("ATTACH_PERCENT") != "" && row.GetValue("ATTACH_COUNT") == "")
- {
- MessageUtil.ShowWarning("百分比%不为空,请输入min支");
- row.SetCellActive("ATTACH_COUNT");
- return false;
- }
- if (row.GetText("RATE").Contains("生产批"))
- {
- if (row.GetValue("TOP_STOVE") == "")
- {
- MessageUtil.ShowWarning("请输入头几炉!");
- row.SetCellActive("TOP_STOVE");
- return false;
- }
- if (row.GetValue("LOOP_VALUE") == "")
- {
- MessageUtil.ShowWarning("请输入循环值!");
- row.SetCellActive("LOOP_VALUE");
- return false;
- }
- }
- if (row.GetValue("EXCLUDE_PHY_MIN").Split(';').Length > 3)
- {
- MessageUtil.ShowWarning("材料号排它最多只能选择3个试样组!");
- row.SetCellActive("EXCLUDE_PHY_MIN_NAME");
- return false;
- }
- if (row.GetValue("PHY_NAME_MIN").StartsWith("SSC") && row.GetValue("SSC_CONDITION") == "")
- {
- MessageUtil.ShowWarning("请选择SSC+!");
- row.SetCellActive("SSC_CONDITION");
- return false;
- }
- //if (row.GetValue("MIN_D") != "" && row.GetValue("MIN_D_SIGN") == "")
- //{
- // MessageUtil.ShowWarning("请选择适用外径下限符号!");
- // row.SetCellActive("MIN_D_SIGN");
- // return false;
- //}
- //if (row.GetValue("MIN_D") == "" && row.GetValue("MIN_D_SIGN") != "")
- //{
- // MessageUtil.ShowWarning("请输入使用外径下限值!");
- // row.SetCellActive("MIN_D");
- // return false;
- //}
- //if (row.GetValue("MAX_D") != "" && row.GetValue("MAX_D_SIGN") == "")
- //{
- // MessageUtil.ShowWarning("请选择适用外径上限符号!");
- // row.SetCellActive("MAX_D_SIGN");
- // return false;
- //}
- //if (row.GetValue("MAX_D") == "" && row.GetValue("MAX_D_SIGN") != "")
- //{
- // MessageUtil.ShowWarning("请输入适用外径上限值!");
- // row.SetCellActive("MAX_D");
- // return false;
- //}
- //if (row.GetValue("MIN_D_SIGN") != "=")
- //{
- // if (row.GetValue("MIN_H") != "" && row.GetValue("MIN_H_SIGN") == "")
- // {
- // MessageUtil.ShowWarning("请选择适用壁厚下限符号!");
- // row.SetCellActive("MIN_H_SIGN");
- // return false;
- // }
- // if (row.GetValue("MIN_H") == "" && row.GetValue("MIN_H_SIGN") != "")
- // {
- // MessageUtil.ShowWarning("请输入适用壁厚下限值!");
- // row.SetCellActive("MIN_H");
- // return false;
- // }
- // if (row.GetValue("MAX_H") != "" && row.GetValue("MAX_H_SIGN") == "")
- // {
- // MessageUtil.ShowWarning("请选择适用壁厚上限符号!");
- // row.SetCellActive("MAX_H_SIGN");
- // return false;
- // }
- // if (row.GetValue("MAX_H") == "" && row.GetValue("MAX_H_SIGN") != "")
- // {
- // MessageUtil.ShowWarning("请输入适用壁厚上限值!");
- // row.SetCellActive("MAX_H");
- // return false;
- // }
- //}
- //else
- //{
- // if (row.GetValue("MAX_D") != "")
- // {
- // MessageUtil.ShowWarning("适用外径下限符号为=,不能输入适用外径上限值!");
- // row.SetCellActive("MAX_D");
- // return false;
- // }
- // else if (row.GetValue("MAX_D_SIGN") != "")
- // {
- // MessageUtil.ShowWarning("适用外径下限符号为=,不能选择适用外径上限符号!");
- // row.SetCellActive("MAX_D_SIGN");
- // return false;
- // }
- // else if (row.GetValue("MIN_H") != "")
- // {
- // MessageUtil.ShowWarning("适用外径下限符号为=,不能输入适用壁厚下限值!");
- // row.SetCellActive("MIN_H");
- // return false;
- // }
- // else if (row.GetValue("MIN_H_SIGN") != "")
- // {
- // MessageUtil.ShowWarning("适用外径下限符号为=,不能选择适用壁厚下限符号!");
- // row.SetCellActive("MIN_H_SIGN");
- // return false;
- // }
- // else if (row.GetValue("MAX_H") != "")
- // {
- // MessageUtil.ShowWarning("适用外径下限符号为=,不能输入适用壁厚上限值!");
- // row.SetCellActive("MAX_H");
- // return false;
- // }
- // else if (row.GetValue("MAX_H_SIGN") != "")
- // {
- // MessageUtil.ShowWarning("适用外径下限符号为=,不能选择适用壁厚上限符号!");
- // row.SetCellActive("MAX_H_SIGN");
- // return false;
- // }
- //}
- //if (row.GetValue("MIN_D") != "" && row.GetValue("MAX_D") != "")
- //{
- // if (decimal.Parse(row.GetValue("MIN_D")) > decimal.Parse(row.GetValue("MAX_D")))
- // {
- // MessageUtil.ShowWarning("适用外径下限值不能大于上限值!");
- // row.SetCellActive("MIN_D");
- // return false;
- // }
- // else if (decimal.Parse(row.GetValue("MIN_D")) == decimal.Parse(row.GetValue("MAX_D")))
- // {
- // MessageUtil.ShowWarning("适用外径下限值和上限值相等时,下限符号只能选>=,上限符号只能选<=!");
- // row.SetCellActive("MIN_D_SIGN");
- // return false;
- // }
- //}
- //if (row.GetValue("MIN_H") != "" && row.GetValue("MAX_H") != "")
- //{
- // if (decimal.Parse(row.GetValue("MIN_H")) > decimal.Parse(row.GetValue("MAX_H")))
- // {
- // MessageUtil.ShowWarning("适用壁厚下限值不能大于上限值!");
- // row.SetCellActive("MIN_H");
- // return false;
- // }
- // else if (decimal.Parse(row.GetValue("MIN_H")) == decimal.Parse(row.GetValue("MAX_H")))
- // {
- // MessageUtil.ShowWarning("适用壁厚下限值和上限值相等时,下限符号只能选>=,上限符号只能选<=!");
- // row.SetCellActive("MIN_H_SIGN");
- // return false;
- // }
- //}
- if (row.GetValue("MIN_D_SIGN") != "" && row.GetValue("MIN_D") == "")
- {
- MessageUtil.ShowWarning("请输入外径下限值!");
- row.SetCellActive("MIN_D");
- return false;
- }
- else if (row.GetValue("MIN_D_SIGN") == "" && row.GetValue("MIN_D") != "")
- {
- MessageUtil.ShowWarning("请选择外径下限符号!");
- row.SetCellActive("MIN_D_SIGN");
- return false;
- }
- else if (row.GetValue("MAX_D_SIGN") != "" && row.GetValue("MAX_D") == "")
- {
- MessageUtil.ShowWarning("请输入外径上限值!");
- row.SetCellActive("MAX_D");
- return false;
- }
- else if (row.GetValue("MAX_D_SIGN") == "" && row.GetValue("MAX_D") != "")
- {
- MessageUtil.ShowWarning("请选择外径上限符号!");
- row.SetCellActive("MAX_D_SIGN");
- return false;
- }
- else if (row.GetValue("MIN_H_SIGN") != "" && row.GetValue("MIN_H") == "")
- {
- MessageUtil.ShowWarning("请输入壁厚下限值!");
- row.SetCellActive("MIN_H");
- return false;
- }
- else if (row.GetValue("MIN_H_SIGN") == "" && row.GetValue("MIN_H") != "")
- {
- MessageUtil.ShowWarning("请选择壁厚下限符号!");
- row.SetCellActive("MIN_H_SIGN");
- return false;
- }
- else if (row.GetValue("MAX_H_SIGN") != "" && row.GetValue("MAX_H") == "")
- {
- MessageUtil.ShowWarning("请输入壁厚上限值!");
- row.SetCellActive("MAX_H");
- return false;
- }
- else if (row.GetValue("MAX_H_SIGN") == "" && row.GetValue("MAX_H") != "")
- {
- MessageUtil.ShowWarning("请选择壁厚上限符号!");
- row.SetCellActive("MAX_H_SIGN");
- return false;
- }
- else if (row.GetValue("MIN_D_SIGN") == "=" && row.GetValue("MAX_D_SIGN") != "")
- {
- MessageUtil.ShowWarning("外径下限符号为等号时,不能存在外径上限符号和外径上限值!");
- row.SetCellActive("MAX_D_SIGN");
- return false;
- }
- else if (row.GetValue("MIN_H_SIGN") == "=" && row.GetValue("MAX_H_SIGN") != "")
- {
- MessageUtil.ShowWarning("壁厚下限符号为等号时,不能存在壁厚上限符号和壁厚上限值!");
- row.SetCellActive("MAX_H_SIGN");
- return false;
- }
- else if (row.GetValue("MIN_D") != "" && row.GetValue("MAX_D") != ""
- && decimal.Parse(row.GetValue("MIN_D")) >= decimal.Parse(row.GetValue("MAX_D")))
- {
- MessageUtil.ShowWarning("外径下限值不能大于等于外径上限值!");
- row.SetCellActive("MIN_D");
- return false;
- }
- else if (row.GetValue("MIN_H") != "" && row.GetValue("MAX_H") != ""
- && decimal.Parse(row.GetValue("MIN_H")) >= decimal.Parse(row.GetValue("MAX_H")))
- {
- MessageUtil.ShowWarning("壁厚下限值不能大于等于壁厚上限值!");
- row.SetCellActive("MIN_H");
- return false;
- }
- ComBaseSampleEntity baseSampleEntity = new ComBaseSampleEntity();
- baseSampleEntity.Sic = row.GetValue("SIC");
- baseSampleEntity.PhyCodeMin = row.GetValue("PHY_CODE_MIN");
- baseSampleEntity.PhyNameMin = row.GetValue("PHY_NAME_MIN");
- baseSampleEntity.StdCode = row.GetValue("STD_CODE");
- baseSampleEntity.StdName = row.GetValue("STD_NAME");
- baseSampleEntity.Length = row.GetValue("LENGTH");
- baseSampleEntity.DescLength = row.GetText("DESC_LENGTH");
- baseSampleEntity.Rate = row.GetValue("RATE");
- baseSampleEntity.DescRate = row.GetText("RATE");
- if (row.GetValue("DESC_COUNT") != "")
- {
- baseSampleEntity.DescCount = decimal.Parse(row.GetValue("DESC_COUNT"));
- }
- baseSampleEntity.Position = row.GetValue("POSITION");
- baseSampleEntity.DescPosition = row.GetText("POSITION");
- baseSampleEntity.CreateName = this.UserInfo.GetUserName();
- baseSampleEntity.Memo = row.GetValue("MEMO");
- baseSampleEntity.SampleCount = decimal.Parse(row.GetValue("SAMPLE_COUNT"));
- baseSampleEntity.SampleStyle = row.GetValue("SAMPLE_STYLE");
- if (row.GetValue("WIDTH") == "")
- {
- baseSampleEntity.Width = null;
- }
- else
- {
- baseSampleEntity.Width = decimal.Parse(row.GetValue("WIDTH"));
- }
- baseSampleEntity.MinD = row.GetValue("MIN_D");
- baseSampleEntity.MinDSign = row.GetValue("MIN_D_SIGN");
- baseSampleEntity.MaxD = row.GetValue("MAX_D");
- baseSampleEntity.MaxDSign = row.GetValue("MAX_D_SIGN");
- baseSampleEntity.MinH = row.GetValue("MIN_H");
- baseSampleEntity.MinHSign = row.GetValue("MIN_H_SIGN");
- baseSampleEntity.MaxH = row.GetValue("MAX_H");
- baseSampleEntity.MaxHSign = row.GetValue("MAX_H_SIGN");
- baseSampleEntity.SteelCode = row.GetValue("STEELCODE");
- baseSampleEntity.SteelName = row.GetValue("STEELNAME");
- baseSampleEntity.Produccode = row.GetValue("PRODUCCODE");
- baseSampleEntity.Producname = row.GetValue("PRODUCNAME");
- baseSampleEntity.Validflag = row.GetValue("VALIDFLAG");
- baseSampleEntity.BatchCnt = row.GetValue("BATCH_CNT");
- baseSampleEntity.BatchUnit = row.GetValue("BATCH_UNIT");
- baseSampleEntity.AttachPercent = row.GetValue("ATTACH_PERCENT");
- baseSampleEntity.AttachCount = row.GetValue("ATTACH_COUNT");
- baseSampleEntity.TopStove = row.GetValue("TOP_STOVE");
- baseSampleEntity.LoopValue = row.GetValue("LOOP_VALUE");
- baseSampleEntity.SscCondition = row.GetValue("SSC_CONDITION");
- baseSampleEntity.ExcludePhyMin = row.GetValue("EXCLUDE_PHY_MIN");
- parms.Add(JSONFormat.Format(baseSampleEntity));
- }
- }
- return true;
- }
- private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e)
- {
- }
- private void ControlEdit(UltraGridRow row)
- {
- ultraGrid1.UpdateData();
- if (row.Cells["CHK"].Value.ToString().ToUpper() == "TRUE")
- {
- for (int j = 0; j < row.Cells.Count; j++)
- {
- string key = row.Cells[j].Column.Key;
- if (key == "DESC_LENGTH" || key == "RATE" || key == "POSITION" ||
- key == "DESC_COUNT" || key == "CHK" || key == "SAMPLE_COUNT" || key == "STD_CODE"
- || key == "SAMPLE_STYLE" || key == "WIDTH" || key == "MIN_D" || key == "MAX_D"
- || key == "MIN_H" || key == "MAX_H" || key == "MIN_D_SIGN" || key == "MAX_D_SIGN"
- || key == "MIN_H_SIGN" || key == "MAX_H_SIGN" || key == "STEEL_SELECT" || key == "BATCH_CNT"
- || key == "BATCH_UNIT" || key == "MEMO" || key == "ATTACH_PERCENT" || key == "ATTACH_COUNT"
- || key == "TOP_STOVE" || key == "LOOP_VALUE" || key == "SSC_CONDITION")
- {
- row.Cells[j].Activation = Activation.AllowEdit;
- }
- else
- {
- row.Cells[j].Activation = Activation.ActivateOnly;
- }
- }
- }
- else
- {
- for (int j = 0; j < row.Cells.Count; j++)
- {
- string key = row.Cells[j].Column.Key;
- if (key != "CHK")
- {
- row.Cells[j].Activation = Activation.ActivateOnly;
- }
- }
- }
- }
- private void ultraTextEditor1_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- var actRow = ultraGrid1.ActiveRow;
- if (ultraGrid1.ActiveCell.Column.Key == "STD_NAME")
- {
- string stdCodes = actRow.GetValue("STD_CODE");
- string[] styles = new string[] { "G", "X", "N" };
- //if(this.CustomInfo == "2")
- //{
- // styles = new string[] { "N" };
- //}
- //else
- //{
- // styles = new string[] { "G", "X" };
- //}
- ComBaseStdChoice baseStdChoice = new ComBaseStdChoice(styles, stdCodes, _ob);
- if (baseStdChoice.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- actRow.SetValue("STD_CODE", baseStdChoice.ChoiceStdCodes);
- actRow.SetValue("STD_NAME", baseStdChoice.ChoiceStdNames);
- }
- }
- else if (ultraGrid1.ActiveCell.Column.Key == "STEELNAME")
- {
- FrmRepSteel frms = new FrmRepSteel();
- frms.Ob1 = this._ob;
- frms.Code = ultraGrid1.ActiveRow.GetValue("STEELCODE");
- if (frms.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- ultraGrid1.ActiveRow.SetValue("STEELCODE", frms.Code);
- ultraGrid1.ActiveRow.SetValue("STEELNAME", frms.Desc);
- }
- }
- else if (ultraGrid1.ActiveCell.Column.Key == "PRODUCNAME")
- {
- this.Cursor = Cursors.WaitCursor;
- PopupProductName popupProductName = new PopupProductName(actRow.GetValue("PRODUCCODE"), _ob);
- this.Cursor = Cursors.Default;
- if (popupProductName.ShowDialog() == DialogResult.OK)
- {
- actRow.SetValue("PRODUCCODE", popupProductName.ProductCodes);
- actRow.SetValue("PRODUCNAME", popupProductName.ProductNames);
- }
- }
- else if (ultraGrid1.ActiveCell.Column.Key == "EXCLUDE_PHY_MIN_NAME")
- {
- string phyMins = actRow.GetValue("EXCLUDE_PHY_MIN");
- string[] styles = new string[] { "G", "X", "N" };
- ComBasePhyMinChoice basePhyMinChoice = new ComBasePhyMinChoice(phyMins, _ob);
- if (basePhyMinChoice.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- actRow.SetValue("EXCLUDE_PHY_MIN", basePhyMinChoice.ChoicePhyMinCodes);
- actRow.SetValue("EXCLUDE_PHY_MIN_NAME", basePhyMinChoice.ChoicePhyMinNames);
- }
- }
- }
- }
- }
|