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 listTreeView; private CtrlTreeView ctrlTreeView; public FrmProductionLineInfo() { InitializeComponent(); IsLoadUserView = true; } public void PopupLoad(OpeBase ob) { this.ob = ob; this.OnLoad(EventArgs.Empty); } /// /// 重写基类方法 /// /// /// 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, "生产产线"); } /// /// load事件 /// /// /// private void FrmProductionLineInfo_Load(object sender, EventArgs e) { LoadBaseInfo(); } /// /// 界面数据初始化 /// private void LoadBaseInfo() { BindCmbDepart(); cmbDepart.SelectedIndex = 0; //绑定工序描述数据源 BindCmbProcess(); cmbProcess.SelectedIndex = 0; //listTreeView = EntityHelper.GetData( // "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"; } /// /// 绑定工序描述数据源 /// 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"; } /// /// 绑定管理部门描述数据源 /// 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"; } /// /// 查询 /// 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"] }); } /// /// 获取Table中最大编号,自增1返回。 /// /// /// 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; } /// /// 获取生产产线代码最大值 /// /// 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; } /// /// 验证描述是否重复。 /// /// /// 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; } } /// /// 新增 /// 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); } } } /// /// 用于验证修改时,描述是否已存在 /// private static string VName = ""; /// /// 修改 /// 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); } } } /// /// 作废或恢复 /// /// true作废 false恢复 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); } } } /// /// 验证非空字段 /// /// 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; } /// /// GRID ROW激活时信息带至编辑区 /// /// /// 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() + "'"; } } }