| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Qcm.model;
- using CoreFS.CA06;
- using Infragistics.Win.Misc;
- using Infragistics.Win.UltraWinEditors;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Data;
- using System.Drawing;
- using System.Text.RegularExpressions;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.Qcm
- {
- public partial class FrmProductionLineInfo : FrmBase
- {
- private UltraPopupControlContainer popup = new UltraPopupControlContainer();
- private List<TreeViewEntity> listTreeView;
- private CtrlTreeView ctrlTreeView;
- public FrmProductionLineInfo()
- {
- InitializeComponent();
- IsLoadUserView = true;
- }
- public void PopupLoad(OpeBase ob)
- {
- this.ob = ob;
- this.OnLoad(EventArgs.Empty);
- }
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "doQuery":
- doQuery();
- break;
- case "doAdd":
- doAdd();
- break;
- case "doModify":
- doModify();
- break;
- case "doDelete":
- this.doDeleteOrResume(true);
- break;
- case "doResume":
- this.doDeleteOrResume(false);
- break;
- case "Refresh":
- LoadBaseInfo();
- break;
- case "Export":
- Export();
- break;
- case "Close":
- ((Form)ultraGrid1.TopLevelControl).Close();
- break;
- }
- }
- private void Export()
- {
- GridHelper.ulGridToExcel(ultraGrid1, "生产产线");
- }
- /// <summary>
- /// load事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void FrmProductionLineInfo_Load(object sender, EventArgs e)
- {
- LoadBaseInfo();
- }
- /// <summary>
- /// 界面数据初始化
- /// </summary>
- private void LoadBaseInfo()
- {
- BindCmbDepart();
- cmbDepart.SelectedIndex = 0;
- //绑定工序描述数据源
- BindCmbProcess();
- cmbProcess.SelectedIndex = 0;
- //listTreeView = EntityHelper.GetData<TreeViewEntity>(
- // "com.steering.pss.qcm.ProductionLineInfo.queryDepartment", new object[]{}, ob);
- //ctrlTreeView = new CtrlTreeView(listTreeView);
- //ctrlTreeView.CtrlTreeViewDoubleClick += CtrlTreeView_CtrlTreeViewDoubleClick;
- //ctrlTreeView.Width = 350;
- //popup.PopupControl = ctrlTreeView;
- ClsBaseInfo.FillDepartment(cmbDepart, ob, false);
- ClsBaseInfo.FillSection(cmbUnit, ob, false);
- DataTable dtGroupPay = ClsBaseInfo.GetComBaseInfo("408002", ob);
- ultraComboEditor1.DataSource = dtGroupPay;
- ultraComboEditor1.DisplayMember = "BASENAME";
- ultraComboEditor1.ValueMember = "BASECODE";
- ClsBaseInfo.FillComBaseInfo(ultraComboEditor3, "4105", ob, true);
- ClsBaseInfo.FillComBaseInfo(ultraComboEditor4, "4106", ob, true);
- ((DataTable)ultraComboEditor4.DataSource).DefaultView.Sort = "BASECODE";
- //ultraComboEditor5
- DataTable dtStorage = ServerHelper.GetData("com.steering.pss.qcm.ProductionLineInfo.getStorageInfo",
- null, ob );
- ultraComboEditor5.DisplayMember = "STORAGE_NAME";
- ultraComboEditor5.ValueMember = "STORAGE_NO";
- ultraComboEditor5.DataSource = dtStorage;
- ClsBaseInfo.SetComboItemHeight(ultraComboEditor5);
- ultraComboEditor6.DisplayMember = "STORAGE_NAME";
- ultraComboEditor6.ValueMember = "STORAGE_NO";
- ultraComboEditor6.DataSource = dtStorage;
- ClsBaseInfo.SetComboItemHeight(ultraComboEditor6);
- //加载所属制造商
- string basecode = "1205";
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreBaseInfoNew.doQuery", new Object[] { basecode }, this.ob);
- manufacturers.DataSource = dt;
- manufacturers.DisplayMember = "BASENAME";
- manufacturers.ValueMember = "BASECODE";
- //加载核算中心
- DataTable dtAccounting = ServerHelper.GetData("com.steering.pss.qcm.ProductionLineInfo.getAccountingBaseInfo", new object[] { }, ob);
- accounting_center_txt.DataSource = dtAccounting;
- accounting_center_txt.DisplayMember = "BASENAME";
- accounting_center_txt.ValueMember = "BASECODE";
- }
- /// <summary>
- /// 绑定工序描述数据源
- /// </summary>
- private void BindCmbProcess()
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.ProductionLineInfo.GetProcess", null, this.ob);
- cmbProcess.DataSource = dt;
- cmbProcess.DisplayMember = "PROCESS_DESC";
- cmbProcess.ValueMember = "PROCESS_CODE";
- }
- /// <summary>
- /// 绑定管理部门描述数据源
- /// </summary>
- private void BindCmbDepart()
- {
- //DEPARTID, T.DEPARTNAME
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.ProductionLineInfo.queryDepartment", null, this.ob);
- cmbDepart.DataSource = dt;
- cmbDepart.DisplayMember = "NAME";
- cmbDepart.ValueMember = "CODE";
- }
- /// <summary>
- /// 查询
- /// </summary>
- private void doQuery()
- {
- bool validFlag = chkValid.Checked;
- string plineName = txtPLineName.Text.Trim();
- //string departmentDesc = cmbDepartment.Text.Trim();
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.ProductionLineInfo.getLineList", new Object[] { validFlag, plineName }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
- //不同颜色区分是否有效数据
- Infragistics.Win.UltraWinGrid.UltraGridRow row = null;
- for (int i = 0; i < ultraGrid1.Rows.Count; i++)
- {
- row = ultraGrid1.Rows[i];
- if (!row.Cells["VALIDFLAG"].Value.ToString().Equals("1"))
- {
- row.Appearance.ForeColor = Color.Red;
- }
- else
- {
- row.Appearance.ForeColor = Color.Black;
- }
- }
- //列自适应
- GridHelper.RefreshAndAutoSizeExceptRows(ultraGrid1, new UltraGridColumn[] {
- ultraGrid1.DisplayLayout.Bands[0].Columns["MEMO"]
- });
- }
- /// <summary>
- /// 获取Table中最大编号,自增1返回。
- /// </summary>
- /// <param name="code"></param>
- /// <returns></returns>
- private string AutoCode(DataTable dt)
- {
- int maxCode = 0;
- //substring去除S001中的S,得到001。
- string maxCodeString = dt.Rows[0][0].ToString().Substring(1);
- //是否为数字
- if (StringUtil.IsNumber(maxCodeString))
- {
- maxCode = Convert.ToInt32(maxCodeString);
- }
- else
- {
- MessageBox.Show("传入编号格式有误,请查看代码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- //比较得出最大id。
- for (int i = 1; i < dt.Rows.Count; i++)
- {
- string maxCodeString_Two = dt.Rows[i][0].ToString().Substring(1);
- int maxCode_Two = 0;
- if (StringUtil.IsNumber(maxCodeString_Two))
- {
- maxCode_Two = Convert.ToInt32(maxCodeString_Two);
- if (maxCode_Two > maxCode)
- {
- maxCode = maxCode_Two;
- }
- }
- }
- //新增行
- maxCode += 1;
- string codeTop = "";
- if (maxCode < 10)
- {
- codeTop = "00";
- }
- else if (maxCode < 100)
- {
- codeTop = "0";
- }
- //获取头文字D。
- string d = dt.Rows[0][0].ToString().Substring(0, 1);
- //头文字+0+最大数字
- string newCode = d + codeTop + maxCode;
- return newCode;
- }
- /// <summary>
- /// 获取生产产线代码最大值
- /// </summary>
- /// <returns></returns>
- private string GetMaxCode()
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.ProductionLineInfo.GetMaxCode", null, this.ob);
- string maxCode = "";
- if (dt.Rows.Count > 0)
- {
- if (!"".Equals(dt.Rows[0][0].ToString()))
- {
- maxCode = dt.Rows[0][0].ToString();
- }
- else
- {
- maxCode = "C000";
- }
- }
- return maxCode;
- }
- /// <summary>
- /// 验证描述是否重复。
- /// </summary>
- /// <param name="name"></param>
- /// <returns></returns>
- private bool isRepeatName(string name)
- {
- DataTable dt = new DataTable();
- dt = ServerHelper.GetData("com.steering.pss.qcm.ProductionLineInfo.GetName", new Object[] { name }, this.ob);
- if (dt.Rows.Count > 0)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- /// <summary>
- /// 新增
- /// </summary>
- private void doAdd()
- {
- if (ValidInput())
- {
- try
- {
- string plineName = txtName.Text.Trim();
- //验证描述不允许重复。
- if (isRepeatName(plineName))
- {
- MessageBox.Show("产线描述\"" + plineName + "\"已存在,请重新输入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- //自动生成编号
- //string plineCode = AutoCode(this.dataTable1);
- ArrayList parm = new ArrayList();
- //自动生成编号
- string plineCode = StringUtil.SequenceIncrease(GetMaxCode());
- string departCode = cmbDepart.Value.ToString2();
- string departDesc = cmbDepart.Text;
- string unitCode = cmbUnit.Value.ToString2();
- string unitDesc = cmbUnit.Text;
- string processCode = cmbProcess.Value.ToString();
- string processDesc = cmbProcess.Text;
- string memo = txtMemo.Text.Trim();
- parm.Add(plineCode);
- parm.Add(plineName);
- parm.Add(departCode);
- parm.Add(departDesc);
- parm.Add(unitCode);
- parm.Add(unitDesc);
- parm.Add(processCode);
- parm.Add(processDesc);
- parm.Add(memo);
- parm.Add(UserInfo.GetUserName());
- parm.Add(ultraTextEditor2.Text.Trim());
- parm.Add(ultraTextEditor1.Text.Trim());
- parm.Add(ultraTextEditor4.Text.Trim());
- parm.Add(ultraTextEditor3.Text.Trim());
- parm.Add(ultraTextEditor6.Text.Trim());
- parm.Add(ultraTextEditor5.Text.Trim());
- parm.Add(ultraTextEditor7.Text.Trim());
- parm.Add(ultraComboEditor2.Value.ToString2());
- parm.Add(ultraComboEditor1.Value.ToString2());
- string toleranceZone = "";
- if (ultraNumericEditor1.Value != null)
- {
- toleranceZone = ultraNumericEditor1.Value.ToString();
- }
- parm.Add(toleranceZone);
- parm.Add(ultraNumericEditor2.Value.ToString2());
- parm.Add(ultraNumericEditor3.Value.ToString2());
- parm.Add(ultraNumericEditor4.Value.ToString2());
- parm.Add(ultraTextEditor8.Text.Trim());
- parm.Add(ultraTextEditor9.Text.Trim().ToUpper());
- parm.Add(ultraComboEditor3.Value.ToString2());
- parm.Add(ultraComboEditor4.Value.ToString2());
- parm.Add(ultraComboEditor5.Value.ToString2());
- parm.Add(ultraComboEditor6.Value.ToString2());
- parm.Add(ultraTextEditor10.Text.Trim());
- parm.Add(manufacturers.Value.ToString2());
- parm.Add(manufacturers.Text.Trim());
- parm.Add(accounting_center_txt.Value.ToString2());
- int count = ServerHelper.SetData("com.steering.pss.qcm.ProductionLineInfo.addLineInfo",
- new Object[] { parm }, this.ob);
- if (count > 0)
- {
- MessageUtil.ShowTips("新增成功!");
- doQuery();
- //高亮显示新增的数据
- Infragistics.Win.UltraWinGrid.UltraGridRow row = null;
- for (int i = 0; i < ultraGrid1.Rows.Count; i++)
- {
- row = ultraGrid1.Rows[i];
- if (row.Cells["PLINE_CODE"].Value.ToString().Equals(plineCode))
- {
- row.Activate();
- break;
- }
- }
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- }
- /// <summary>
- /// 用于验证修改时,描述是否已存在
- /// </summary>
- private static string VName = "";
- /// <summary>
- /// 修改
- /// </summary>
- private void doModify()
- {
- if (ultraGrid1.ActiveRow == null)
- {
- MessageBox.Show("请选择需要修改的数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- string validflagStr = ultraGrid1.ActiveRow.Cells["VALIDFLAG"].Value.ToString();
- //无效数据不允许修改
- if ("0".Equals(validflagStr))
- {
- MessageBox.Show("无效数据不支持修改操作。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (ValidInput())
- {
- try
- {
- //验证描述不允许重复。
- string name = txtName.Text.Trim();
- if (!VName.Equals(name))
- {
- if (isRepeatName(name))
- {
- MessageBox.Show("产线描述\"" + name + "\"已存在,请重新输入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- }
- //确认修改吗?
- if (MessageBox.Show("是否确认修改选中的数据!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
- ArrayList parm = new ArrayList();
- string PlineCode = ultraGrid1.ActiveRow.Cells["PLINE_CODE"].Value.ToString(); ;
- parm.Add(name);
- parm.Add(cmbDepart.Value.ToString2());
- parm.Add(cmbDepart.Text);
- parm.Add(cmbUnit.Value.ToString2());
- parm.Add(cmbUnit.Text);
- parm.Add(cmbProcess.Value.ToString());
- parm.Add(cmbProcess.Text);
- parm.Add(txtMemo.Text.Trim());
- parm.Add(this.UserInfo.GetUserName());
- parm.Add(ultraTextEditor2.Text.Trim());
- parm.Add(ultraTextEditor1.Text.Trim());
- parm.Add(ultraTextEditor4.Text.Trim());
- parm.Add(ultraTextEditor3.Text.Trim());
- parm.Add(ultraTextEditor6.Text.Trim());
- parm.Add(ultraTextEditor5.Text.Trim());
- parm.Add(ultraTextEditor7.Text.Trim());
- parm.Add(ultraComboEditor2.Value.ToString2());
- parm.Add(ultraComboEditor1.Value.ToString2());
- string toleranceZone = "";
- if (ultraNumericEditor1.Value != null)
- {
- toleranceZone = ultraNumericEditor1.Value.ToString();
- }
- parm.Add(toleranceZone);
- parm.Add(ultraNumericEditor2.Value.ToString2());
- parm.Add(ultraNumericEditor3.Value.ToString2());
- parm.Add(ultraNumericEditor4.Value.ToString2());
- parm.Add(ultraTextEditor8.Text.Trim());
- parm.Add(ultraTextEditor9.Text.Trim().ToUpper());
- parm.Add(ultraComboEditor3.Value.ToString2());
- parm.Add(ultraComboEditor4.Value.ToString2());
- parm.Add(ultraComboEditor5.Value.ToString2());
- parm.Add(ultraComboEditor6.Value.ToString2());
- parm.Add(ultraTextEditor10.Text.Trim());
- parm.Add(manufacturers.Value.ToString2());
- parm.Add(manufacturers.Text.Trim());
- parm.Add(accounting_center_txt.Value.ToString2());
- parm.Add(PlineCode);
- //利用JSONFormat.Format(plObj)方法,把自己定义的类,转换成Object[]传送到服务端。用ArrayList是一样的。
- int count = ServerHelper.SetData("com.steering.pss.qcm.ProductionLineInfo.updateLineInfo", new Object[] { parm }, this.ob);
- if (count > 0)
- {
- MessageUtil.ShowTips("修改成功!");
- doQuery();
- //高亮显示修改的数据
- Infragistics.Win.UltraWinGrid.UltraGridRow row = null;
- for (int i = 0; i < ultraGrid1.Rows.Count; i++)
- {
- row = ultraGrid1.Rows[i];
- if (row.Cells["PLINE_CODE"].Value.ToString().Equals(PlineCode))
- {
- row.Activate();
- break;
- }
- }
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- }
- /// <summary>
- /// 作废或恢复
- /// </summary>
- /// <param name="isDelete">true作废 false恢复</param>
- private void doDeleteOrResume(bool isDelete)
- {
- if (ultraGrid1.ActiveRow == null)
- {
- MessageBox.Show("请选择需要" + (isDelete ? "作废" : "恢复") + "的数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- string validflagStr = ultraGrid1.ActiveRow.Cells["VALIDFLAG"].Value.ToString();
- //无效数据不允许作废
- if ("0".Equals(validflagStr))
- {
- if (isDelete)
- {
- MessageBox.Show("无效数据不支持作废操作。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- }
- else
- {
- //有效数据不允许恢复
- if (!isDelete)
- {
- MessageBox.Show("有效数据不支持恢复操作。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- }
- UltraGridRow row = ultraGrid1.ActiveRow;
- ArrayList param = new ArrayList();
- string pline_code = row.Cells["PLINE_CODE"].Value.ToString();
- param.Add(pline_code);
- if (param.Count > 0 && MessageBox.Show("是否确认" + (isDelete ? "作废" : "恢复") + "选中的数据!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
- {
- try
- {
- int count = ServerHelper.SetData("com.steering.pss.qcm.ProductionLineInfo.deleteLineInfo", new Object[] { param, UserInfo.GetUserName(), isDelete }, this.ob);
- if (count > 0)
- {
- doQuery();
- Infragistics.Win.UltraWinGrid.UltraGridRow rowD = null;
- for (int i = 0; i < ultraGrid1.Rows.Count; i++)
- {
- rowD = ultraGrid1.Rows[i];
- if (rowD.Cells["PLINE_CODE"].Value.ToString().Equals(pline_code))
- {
- rowD.Activate();
- break;
- }
- }
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- }
- /// <summary>
- /// 验证非空字段
- /// </summary>
- /// <returns></returns>
- private bool ValidInput()
- {
- if (string.IsNullOrEmpty(txtName.Text.Trim()))
- {
- MessageBox.Show("请输入产线描述!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- //if (cmbDepart.SelectedRow == null)
- //{
- // MessageBox.Show("请选择管理部门!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- // return false;
- //}
- string lengthmax = ultraTextEditor1.Text.Trim(); //上限
- string lengthmin = ultraTextEditor2.Text.Trim(); //下限
- if (lengthmin == "")
- {
- MessageBox.Show("请输入成品长度下限值!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- else
- {
- if (!StringUtil.IsNumber(lengthmin))
- {
- MessageBox.Show("成品长度下限值:请输入数值!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- }
- if (lengthmax == "")
- {
- MessageBox.Show("请输入成品长度上限值!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- else
- {
- if (!StringUtil.IsNumber(lengthmax))
- {
- MessageBox.Show("成品长度上限值:请输入数值!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- }
- if (Convert.ToDouble(lengthmax) < Convert.ToDouble(lengthmin))
- {
- MessageBox.Show("成品长度上限不能小于成品长度下限", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- if (cmbProcess.Text.Equals("轧管"))
- {
- string ringlengthmin = ultraTextEditor4.Text.Trim(); //环型下限
- string ringlengthmax = ultraTextEditor3.Text.Trim(); //环形上限
- string cubelengthmin = ultraTextEditor6.Text.Trim(); //脱机下限
- string cubelengthmax = ultraTextEditor5.Text.Trim(); //脱机上限
- if (ringlengthmin == "")
- {
- MessageBox.Show("请输入环形炉长度下限值!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraTextEditor4.Focus();
- return false;
- }
- else
- {
- if (!StringUtil.IsNumber(ringlengthmin))
- {
- MessageBox.Show("环形炉长度下限值:请输入数字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraTextEditor4.Focus();
- return false;
- }
- }
- if (ringlengthmax == "")
- {
- MessageBox.Show("请输入环形炉长度上限值!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraTextEditor3.Focus();
- return false;
- }
- else
- {
- if (!StringUtil.IsNumber(ringlengthmax))
- {
- MessageBox.Show("环形炉长度上限值:请输入数字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraTextEditor3.Focus();
- return false;
- }
- }
- if (Convert.ToDouble(ringlengthmax) < Convert.ToDouble(ringlengthmin))
- {
- MessageBox.Show("环形炉长度上限不能小于环形炉长度下限", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- if (cubelengthmin == "")
- {
- MessageBox.Show("请输入脱机管长度下限值!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraTextEditor6.Focus();
- return false;
- }
- else
- {
- if (!StringUtil.IsNumber(cubelengthmin))
- {
- MessageBox.Show("脱机管长度下限值:请输入数字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraTextEditor6.Focus();
- return false;
- }
- }
- if (cubelengthmax == "")
- {
- MessageBox.Show("请输入脱机管长度上限值!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraTextEditor5.Focus();
- return false;
- }
- else
- {
- if (!StringUtil.IsNumber(cubelengthmax))
- {
- MessageBox.Show("脱机管长度上限值:请输入数字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- ultraTextEditor5.Focus();
- return false;
- }
- }
- if (Convert.ToDouble(cubelengthmax) < Convert.ToDouble(cubelengthmin))
- {
- MessageBox.Show("脱机管长度上限不能小于脱机管长度下限", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- if (ultraTextEditor7.Text.Trim() == "")
- {
- MessageBox.Show("请输入冷床长度!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- else
- {
- if (!StringUtil.IsNumber(ultraTextEditor7.Text.Trim()))
- {
- MessageBox.Show("冷床长度:请输入数字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- }
- }
- if (ultraTextEditor8.Text.Trim() != "" && ultraTextEditor8.Text.Length != 2)
- {
- MessageBox.Show("检验委托号缩写必须为两个字符!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- //if (ultraTextEditor9.Text.Trim() == "")
- //{
- // MessageBox.Show("请输入产线标识符!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- // return false;
- //}
- if (ultraTextEditor9.Text.Trim() != "" && !Regex.IsMatch(ultraTextEditor9.Text.Trim(), @"^[a-zA-Z]*$"))
- {
- MessageBox.Show("产线标识符只能输入字母!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- return true;
- }
- /// <summary>
- /// GRID ROW激活时信息带至编辑区
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- Infragistics.Win.UltraWinGrid.UltraGridRow row = ultraGrid1.ActiveRow;
- if (row != null)
- {
- txtName.Text = row.Cells["PLINE_NAME"].Value.ToString();
- VName = txtName.Text.Trim();
- cmbDepart.Value = row.Cells["DEPARTMENT_CODE_P"].Value.ToString();
- cmbUnit.Value = row.Cells["DEPARTMENT_CODE"].Value.ToString();
- cmbProcess.Value = row.Cells["PROCESS_CODE"].Value.ToString();
- accounting_center_txt.Value = row.Cells["ACCOUNTING_CENTER"].Value.ToString();
- txtMemo.Text = row.Cells["MEMO"].Value.ToString();
- ultraTextEditor2.Text = row.Cells["LENGTH_MIN"].Value.ToString();
- ultraTextEditor1.Text = row.Cells["LENGTH_MAX"].Value.ToString();
- ultraTextEditor4.Text = row.Cells["LENGTH_MIN_RING"].Value.ToString();
- ultraTextEditor3.Text = row.Cells["LENGTH_MAX_RING"].Value.ToString();
- ultraTextEditor6.Text = row.Cells["LENGTH_MIN_TUBE"].Value.ToString();
- ultraTextEditor5.Text = row.Cells["LENGTH_MAX_TUBE"].Value.ToString();
- ultraTextEditor7.Text = row.Cells["LENGTH_COLDBED"].Value.ToString();
- ultraComboEditor2.Text = row.Cells["GROUP_PLAN"].Value.ToString();
- ultraComboEditor1.Text = row.Cells["GROUP_PAY"].Value.ToString();
- ultraNumericEditor2.Value = row.GetValue("BURNOUT_RATE");
- ultraNumericEditor3.Value = row.GetValue("IN_MATERIAL_LEN_MIN");
- ultraNumericEditor4.Value = row.GetValue("IN_MATERIAL_LEN_MAX");
- ultraTextEditor8.Text = row.GetValue("CHECK_NO_SHORT");
- ultraTextEditor9.Text = row.GetValue("SPLINE_DESC");
- ultraComboEditor3.Value = row.GetValue("FACTORY_CODE");
- ultraComboEditor4.Value = row.GetValue("CHECK_STATION");
- ultraComboEditor5.Value = row.GetValue("IN_REPOSITORY");
- ultraComboEditor6.Value = row.GetValue("OUT_REPOSITORY");
- ultraTextEditor10.Text = row.GetValue("VELOCITY_FLOW");
- double toleanceZone = 0;
- if (row.Cells["TOLERANCE_ZONE"].Value != null && !row.Cells["TOLERANCE_ZONE"].Value.ToString().Equals(""))
- {
- toleanceZone = double.Parse(row.Cells["TOLERANCE_ZONE"].Value.ToString());
- }
- ultraNumericEditor1.Value = toleanceZone;
- manufacturers.Value = row.GetValue("SUPPLY_UNIT_CODE");
- }
- }
- private void SetDControl(bool enable)
- {
- foreach (System.Windows.Forms.Control control in ultraGroupBox1.Controls)
- {
- if (control is UltraTextEditor || control is UltraNumericEditor)
- {
- control.Enabled = enable;
- }
- }
- }
- private void cmbProcess_ValueChanged(object sender, EventArgs e)
- {
- if (cmbProcess.Value.ToString() == "D")
- {
- SetDControl(true);
- }
- else if (cmbProcess.Value.ToString() == "E" || cmbProcess.Value.ToString() == "F")
- {
- SetDControl(false);
- ultraNumericEditor2.Enabled = true;
- }
- else
- {
- SetDControl(false);
- }
- if (cmbProcess.Value.ToString() == "F")
- {
- DataTable dtGroupPlan = ClsBaseInfo.GetComBaseInfo("2005", ob);
- ultraComboEditor2.DataSource = dtGroupPlan;
- ultraComboEditor2.DisplayMember = "BASENAME";
- ultraComboEditor2.ValueMember = "BASECODE";
- ultraComboEditor2.Enabled = true;
- }
- else if (cmbProcess.Value.ToString() == "G")
- {
- DataTable dtGroupPlan = ClsBaseInfo.GetComBaseInfo("2004", ob);
- ultraComboEditor2.DataSource = dtGroupPlan;
- ultraComboEditor2.DisplayMember = "BASENAME";
- ultraComboEditor2.ValueMember = "BASECODE";
- ultraComboEditor2.Enabled = true;
- }
- else
- {
- ultraComboEditor2.DataSource = null;
- ultraComboEditor2.Enabled = false;
- }
- }
- private void cmbDepart_AfterDropDown(object sender, EventArgs e)
- {
- //int x = ultraExpandableGroupBox1.PointToScreen(cmbDepart.Location).X + 2;
- //int y = ultraExpandableGroupBox1.PointToScreen(cmbDepart.Location).Y - popup.PopupControl.Height + 20;
- //string code = cmbDepart.Value.ToString2();
- //popup.Show(new Point(x, y));
- //ctrlTreeView.Focus();
- //ctrlTreeView.SetTreeViewNodeSelected(code);
- }
- private void CtrlTreeView_CtrlTreeViewDoubleClick(object sender, EventArgs e)
- {
- cmbDepart.Value = ctrlTreeView.NodeCode;
- popup.Close();
- }
- private void cmbDepart_ValueChanged(object sender, EventArgs e)
- {
- cmbUnit.Value = null;
- DataTable dt = (DataTable)cmbUnit.DataSource;
- if (dt != null) dt.DefaultView.RowFilter = "PID = '" + cmbDepart.Value.ToString2() + "'";
- }
- }
- }
|