using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using CoreFS.CA06; using Core.Mes.Client.Comm.Control; using System.Text.RegularExpressions; using Core.Mes.Client.Comm.Server; using Infragistics.Win.UltraWinGrid; using Core.Mes.Client.Comm.Tool; using System.Collections; using Infragistics.Win; namespace Core.StlMes.Client.YdmBase { public partial class frmLocationDefine : FrmBase { public frmLocationDefine() { InitializeComponent(); this.IsLoadUserView = true; } bool isvalid = false; //包含无效 string isdummy = "0"; //是否虚拟 默认不虚拟 string islock = "1"; //是否封锁 默认释放 ArrayList parms = new ArrayList(); private ArrayList listLoca = new ArrayList(); //勾选的奇数位的料位编码 private ArrayList listRack = new ArrayList(); //供选择的料架 private ArrayList listSelected = new ArrayList(); //已经选择的料架 private ArrayList returnlist; //传回来的料位码-料架码 public ArrayList Returnlist { get { return returnlist; } set { returnlist = value; } } /// /// 重写基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": DoQuery(); break; case "Add": DoAdd(); break; case "Update": DoUpdate(); break; case "Delete": DoDeleteOrResume(true); break; case "Resume": DoDeleteOrResume(false); break; case "Refresh": DoRefresh(); break; case "Export": ExportGridData(); break; case "Rack": DoRack(); break; case "Close": this.Close(); break; } } /// /// 初始化 /// /// /// private void frmLocationDefine_Load(object sender, EventArgs e) { InitComBo(); //InitGrid2(); //QueryTree(); //getDepartMent(); cbm_Dw.Enabled = false; YdmBaseClass.InitSection(cbm_Dw, this.ValidDataPurviewIds, this.ob); } //加载作业单位 private void getDepartMent() { //DataTable dt = new DataTable(); //string flag = "0"; //string userName = this.UserInfo.GetUserName(); //string departMent = ClsBaseInfo.GetDepartBySectionId(UserInfo.GetDeptid(), this.ob); //if (userName.Equals("admin")) //{ // dt = ServerHelper.GetData("com.steering.pss.ydm.base.YdmBaseQuery.departQuery", new object[] { departMent, flag }, this.ob); // if (dt.Rows.Count > 0) // { // cbm_Dw.DataSource = dt; // cbm_Dw.DisplayMember = "DEPARTNAME"; // cbm_Dw.ValueMember = "DEPARTID"; // this.cbm_Dw.SelectedIndex = -1; // } //} //else //{ // flag = "1"; // dt = ServerHelper.GetData("com.steering.pss.ydm.base.YdmBaseQuery.departQuery", new object[] { departMent, flag }, this.ob); // if (dt.Rows.Count > 0) // { // cbm_Dw.DataSource = dt; // cbm_Dw.DisplayMember = "DEPARTNAME"; // cbm_Dw.ValueMember = "DEPARTID"; // this.cbm_Dw.SelectedIndex = 0; // } //} } //刷新Tree public void QueryTree() { //this.cmbManage.Nodes.Clear(); DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.base.YdmBaseQuery.departQuery", null, this.ob); //树控件递归绑定方法。 //YdmBaseClass.MakeTree(dt, "PID", null, "DEPARTID", "DEPARTNAME", cmbManage.Nodes, -1); } /// /// 初始化下拉框 /// private void InitComBo() { YdmBaseClass.InitComboEditor(cmbLocationType, "com.steering.pss.ydm.base.YdmBaseQuery.getLocationType", "BASECODE", this.ob,false); YdmBaseClass.InitComboEditor(cmbLocationAttr, "com.steering.pss.ydm.base.YdmBaseQuery.getLocationAttribute", "BASECODE", this.ob, false); } /// /// 初始化左边GRID的仓库数据 /// private void InitGrid2() { DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.base.CoreLocationDefine.getStorage", null, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true); YdmBaseClass.SetGridActivateOnly(ultraGrid2); } /// /// 刷新 /// private void DoRefresh() { // InitGrid2(); InitComBo(); //QueryTree(); } /// /// 导出 /// private void ExportGridData() { GridHelper.ulGridToExcel(ultraGrid1, this.Text); } /// /// 获取编辑区的数据 /// private void GetEditData() { ultraGrid2.UpdateData(); UltraGridRow ugr = ultraGrid2.ActiveRow; if (ugr == null) { MessageBox.Show("请选择对应的库号行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } parms = new ArrayList(); if (cmbLocationType.SelectedItem == null) { MessageBox.Show("请选择料位类型", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string locatype=""; switch (cmbLocationType.Text.Trim()) { case "垛位": locatype = "D"; break; case "料架": locatype = "J"; break; } if (cmbLocationAttr.SelectedItem == null) { MessageBox.Show("请选择料位属性", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtArea.Text.Trim() == "") { MessageBox.Show("请输入区号", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtRow.Text.Trim() == "") { MessageBox.Show("请输入行号", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtColStart.Text.Trim() == "") { MessageBox.Show("请输入列号", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtColEnd.Text.Trim() != "") { if (Convert.ToInt16(txtColEnd.Value.ToString()) < Convert.ToInt16(txtColStart.Value.ToString())) { MessageBox.Show("列号结束位置不能小于起始位置", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } if (txtXCoordinates.Text.Trim() == "") { MessageBox.Show("请输入X坐标", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (!StringUtil.Is_Below_zero(txtXCoordinates.Value.ToString())) { MessageBox.Show("X坐标,请输入数字", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtYCoordinates.Text.Trim() == "") { MessageBox.Show("请输入Y坐标", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (!StringUtil.Is_Below_zero(txtYCoordinates.Value.ToString())) { MessageBox.Show("Y坐标,请输入数字", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (locatype == "D") { if (txtLocationWidth.Text.Trim() == "") { MessageBox.Show("请输入料位宽度", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (!StringUtil.Is_Below_zero(txtLocationWidth.Value.ToString())) { MessageBox.Show("料位宽度,请输入数字", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtLocationHeght.Text.Trim() == "") { MessageBox.Show("请输入料位高度", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (!StringUtil.Is_Below_zero(txtLocationHeght.Value.ToString())) { MessageBox.Show("料位高度,请输入数字", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtLocationLen.Text.Trim() == "") { MessageBox.Show("请输入料位长度", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (!StringUtil.Is_Below_zero(txtLocationLen.Value.ToString())) { MessageBox.Show("料位长度,请输入数字", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } parms.Add(txtStorNo.Text.Trim()); parms.Add(locatype); parms.Add(txtArea.Text.Trim()); parms.Add(txtRow.Text.Trim()); parms.Add(txtColStart.Text.Trim()); //初始列号 parms.Add(txtColEnd.Text.Trim()); //结束列号 parms.Add(txtLocationLen.Text.Trim()); //长 parms.Add(txtLocationWidth.Text.Trim()); //宽 parms.Add(txtLocationHeght.Text.Trim()); //高 parms.Add(txtXCoordinates.Text.Trim()); parms.Add(txtYCoordinates.Text.Trim()); parms.Add(islock); parms.Add(cmbLocationAttr.Value.ToString()); parms.Add(cmbLocationAttr.Text.Trim()); parms.Add(isdummy); parms.Add(ugr.Cells["MANAGEMENT_NO"].Value.ToString()); parms.Add(ugr.Cells["MANAGEMENT_NAME"].Value.ToString()); parms.Add(ugr.Cells["DEPARTMENT_CODE"].Value.ToString()); parms.Add(ugr.Cells["DEPARTMENT_DESC"].Value.ToString()); parms.Add(this.UserInfo.GetUserName()); parms.Add(txtMemo.Text.Trim()); //备注 parms.Add(txtLocationName.Text.Trim());//料位名称 parms.Add(txtRackType.Value.ToString3()); parms.Add(txtRackQuality.Value.ToString3()); } /// /// 查询 /// private void DoQuery() { if (!CheckQuery()) return; string LocationNo = "";//库位编码 string RackNo = "";//料位号 string storageno = ""; //if (chkStorageNo.Checked) //{ // storageno = txtStorageNo.Text.Trim(); //} //else //{ // storageno = ugr.Cells["STORAGE_NO"].Value.ToString(); //} //if (chkLocationNo.Checked) // LocationNo = txtLocationNo.Text.Trim(); //if (chkRackNo.Checked) // RackNo = txtRackNo.Text.Trim(); string management=""; string departMent = ""; //if (ultraCheckEditor2.Checked) //{ // management = cbm_Dw.SelectedValue.ToString(); //} if (this.ultrlSection.Checked) { if (cbm_Dw.Text.ToString() == "") { MessageBox.Show("请选择作业科室!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { departMent = cbm_Dw.Value.ToString(); } } string[] arr = YdmBaseClass.BaseSection(this.ValidDataPurviewIds, this.ob); DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.base.CoreLocationDefine.getStorage", new object[] { departMent, arr }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true); YdmBaseClass.SetGridActivateOnly(ultraGrid2); } /// /// 查询时验证 /// /// private bool CheckQuery() { if (chkStorageNo.Checked && string.IsNullOrEmpty(txtStorageNo.Text.Trim())) { MessageBox.Show("请输入库号编码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (chkLocationNo.Checked && string.IsNullOrEmpty(txtLocationNo.Text.Trim())) { MessageBox.Show("请输入库位编码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (chkRackNo.Checked && string.IsNullOrEmpty(txtRackNo.Text.Trim())) { MessageBox.Show("请输入料架号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } //if (ultraCheckEditor2.Checked && string.IsNullOrEmpty(cmbManage.Text.Trim())) //{ // MessageBox.Show("请选择作业单位!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); // return false; //} return true; } /// /// 增加、修改时数据验证 /// /// private bool updateAddCheck() { if(txtArea.Text.Trim() == "") { MessageBox.Show("区号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (txtRow.Text.Trim() == "") { MessageBox.Show("行号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (!StringUtil.IsInt32(txtColStart.Text.Trim())) { MessageBox.Show("开始列号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (!StringUtil.IsInt32(txtColEnd.Text.Trim())) { MessageBox.Show("结束列号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (!StringUtil.IsInt32(txtXCoordinates.Text.Trim())) { MessageBox.Show("X坐标不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (!StringUtil.IsInt32(txtYCoordinates.Text.Trim())) { MessageBox.Show("Y坐标不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (!StringUtil.IsInt32(txtLocationWidth.Text.Trim())) { MessageBox.Show("料位宽度不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (!StringUtil.IsInt32(txtLocationHeght.Text.Trim())) { MessageBox.Show("料位高度不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (!StringUtil.IsInt32(txtLocationLen.Text.Trim())) { MessageBox.Show("料位长度不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } return true; } /// /// 新增 /// private void DoAdd() { string type = ""; if (!updateAddCheck()) return; if(this.cmbLocationType.Text.ToString() == "垛位") { type = "D"; } else if(this.cmbLocationType.Text.ToString() == "料架") { type = "J"; } string row = this.txtRow.Text.Trim();//行号 string storeNo = this.txtStorNo.Text.Trim();//库号 string areNo = this.txtArea.Text.Trim();//区号 DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.base.CoreLocationDefine.getDorJ", new object[] { row, storeNo,areNo }, this.ob); if (dt.Rows.Count > 0) { if (!dt.Rows[0]["LOCATION_TYPE"].ToString().Equals(type)) { MessageBox.Show("一排中不允许既维护垛位又维护料架!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } GetEditData(); if (parms.Count <=0) { return; } int count = 0; try { count = ServerHelper.SetData("com.steering.pss.ydm.base.CoreLocationDefine.doAdd", new Object[] { parms }, this.ob); }catch(Exception ) { return; } if (count > 0) { MessageBox.Show("数据新增成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); //DoQuery(); queryUltraGrid1(); } } /// /// 更新数据 /// private void DoUpdate() { string locano = ""; string type = ""; if (!updateAddCheck()) return; UltraGridRow ugr = ultraGrid1.ActiveRow; if (ugr == null) { MessageBox.Show("请选择需要修改的记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (ugr.Cells["VALIDFLAG"].Value.ToString() == "无效") { MessageBox.Show("无效数据,无法修改!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.cmbLocationType.Text.ToString() == "垛位") { type = "D"; } else if (this.cmbLocationType.Text.ToString() == "料架") { type = "J"; } string row = this.txtRow.Text.Trim(); string storeNo = this.txtStorNo.Text.Trim();//库号 string areNo = this.txtArea.Text.Trim();//区号 DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.base.CoreLocationDefine.getDorJ", new object[] { row, storeNo, areNo }, this.ob); if (dt.Rows.Count > 0) { if (!dt.Rows[0]["LOCATION_TYPE"].ToString().Equals(type)) { MessageBox.Show("一排中不允许既维护垛位又维护料架!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } GetEditData(); if (parms.Count > 0) { locano = ugr.Cells["LOCATION_NO"].Value.ToString(); parms.Add(locano); } //if (txtArea.Text.Trim() != this.ultraGrid1.ActiveRow.Cells["AREA_NO"].Text.Trim()) //{ // MessageBox.Show("区号不允许修改!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; //} //if (txtRow.Text.Trim() != this.ultraGrid1.ActiveRow.Cells["ROW_NO"].Text.Trim()) //{ // MessageBox.Show("行号不允许修改!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; //} //if (txtColStart.Text.Trim() != this.ultraGrid1.ActiveRow.Cells["COL_NO"].Text.Trim()) //{ // MessageBox.Show("列号不允许修改!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; //} int count = 0; if (MessageBox.Show("是否确认修改该行数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } try { count = ServerHelper.SetData("com.steering.pss.ydm.base.CoreLocationDefine.doUpdate", new Object[] { parms }, this.ob); }catch(Exception) { return; } if (count > 0) { MessageBox.Show("数据修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); queryUltraGrid1(); foreach(UltraGridRow ulgr in ultraGrid1.Rows){ if (ulgr.Cells["LOCATION_NO"].Value.ToString().Equals(locano)) { ulgr.Activate(); } } } } /// /// UltraGrid激活某行 /// /// UltraGrid /// 列名 /// 对应的值 public static void UltraGridLocation(UltraGrid ug, String[] keys, String[] values) { if (ug.Rows.Count == 0) { return; } if (keys.Length == 0 || values.Length == 0 || values.Length != keys.Length) { return; } foreach (UltraGridRow ugr in ug.Rows) { Boolean flag = true; for (int i = 0; i < keys.Length; i++) { if (!ugr.Cells[keys[i]].ToString().Equals(values[i])) { flag = false; } } if (flag == true) { ugr.Activate(); return; } } } /// /// 作废或恢复 /// /// true 作废 false 恢复 private void DoDeleteOrResume(bool flag) { UltraGridRow ugr = ultraGrid1.ActiveRow; if (ugr == null) { MessageBox.Show("请选择你要操作的记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (flag == false && ugr.Cells["VALIDFLAG"].Value.ToString().ToUpper() == "有效") { MessageBox.Show("有效数据,无法恢复!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (flag == true && ugr.Cells["VALIDFLAG"].Value.ToString().ToUpper() != "有效") { MessageBox.Show("无效数据,无法删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (flag == true && ugr.Cells["RACK_NO"].Text.ToString() != "") { MessageBox.Show("此料位维护了料架信息,无法删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.base.CoreLocationDefine.getButessCount", new object[] { ugr.Cells["LOCATION_NO"].Text.ToString().Trim() }, this.ob); if (int.Parse(dt.Rows[0][0].ToString()) > 0) { MessageBox.Show("此料位已存放实物,无法删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } if (MessageBox.Show("是否确认" + (flag ? "删除" : "恢复") + "该行数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } string rackno = ugr.Cells["LOCATION_NO"].Value.ToString(); string name = this.UserInfo.GetUserName(); int count = ServerHelper.SetData("com.steering.pss.ydm.base.CoreLocationDefine.doDelete", new Object[] { rackno, name, flag }, this.ob); if (count > 0) { MessageBox.Show("数据" + (flag ? "删除" : "恢复") + "成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); //DoQuery(); queryUltraGrid1(); } } /// /// 料架维护 /// private void DoRack() { listLoca = new ArrayList(); listRack= new ArrayList(); listSelected= new ArrayList(); returnlist = new ArrayList(); ArrayList locarack = new ArrayList(); //料位-料架 ArrayList rackupdate = new ArrayList(); //需要更新的料架 ArrayList newrackno = new ArrayList(); //更新后的料架编号 foreach (UltraGridRow row in ultraGrid1.Rows) { if (row.Selected || row.Activated) { string locationno = row.Cells["LOCATION_NO"].Value.ToString(); int _locationNo = int.Parse(locationno.Substring(locationno.Length -1,1)); if (_locationNo % 2 != 0) { //int col = Convert.ToInt16(locationno.Substring(locationno.Length - 2, 2)); //col % 2 == 1&& if (row.Cells["LOCATION_TYPE"].Value.ToString() == "J" && row.Cells["VALIDFLAG"].Value.ToString() == "有效") // 垛位不能维护料架 { listLoca.Add(locationno); listSelected.Add(row.Cells["RACK_NO"].Value.ToString()); } } } } if (listLoca.Count > 0) { DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.base.CoreLocationDefine.getRack", null, this.ob); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { listRack.Add(dt.Rows[i][0]); } } else { MessageBox.Show("没有可供选择的料架", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } FrmRackSelect frs = new FrmRackSelect(); frs.Localist = listLoca; frs.Racklist = listRack; frs.Selectlist = listSelected; frs.ShowDialog(); if (frs.flag == false) return; //窗口的关闭不是确定引起的 不进行信息更新。 this.Returnlist = frs.ReturnData; if (returnlist.Count > 0) { for (int i = 0; i < returnlist.Count; i++) { ArrayList list = new ArrayList(); string msg = returnlist[i].ToString(); char[] ch = { ',' }; string[] str = msg.Split(ch, StringSplitOptions.RemoveEmptyEntries); if (str.Length >0) { string locationno = str[0]; string rackno=""; if(str.Length==2) rackno = str[1]; DataRow[] dr = dt.Select("RACK_NO='"+rackno+"'", ""); if (dr.Length > 0) { string basewidth = dr[0]["BASE_WIDTH"].ToString(); string baseheight = dr[0]["BASE_HEIGHT"].ToString(); string racklen = dr[0]["RACK_LEN"].ToString(); list.Add(rackno); list.Add(Convert.ToDouble(racklen) / 1000); list.Add(Convert.ToDouble(basewidth) / 1000); list.Add(Convert.ToDouble(baseheight) / 1000); list.Add(locationno); newrackno.Add(rackno); locarack.Add(list); } else { list.Add(rackno); list.Add(""); list.Add(""); list.Add(""); list.Add(locationno); newrackno.Add(rackno); locarack.Add(list); } } } } //以前的料架编码和选择以后的料架编码作比较,被取消了的就该把其状态更新为未使用。 for (int i = 0; i < listSelected.Count; i++) { if (!newrackno.Contains(listSelected[i].ToString())) rackupdate.Add(listSelected[i].ToString()); } int count = ServerHelper.SetData("com.steering.pss.ydm.base.CoreLocationDefine.setRack", new Object[] { locarack,rackupdate }, this.ob); if (count > 0) { MessageBox.Show("料架维护成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); queryUltraGrid1(); } } else { MessageBox.Show("垛位与料位偶数位不能维护料架!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e) { if (chkLocationNo.Checked) { txtLocationNo.ReadOnly = false; } else { txtLocationNo.ReadOnly = true; } } private void ultraCheckEditor3_CheckedChanged(object sender, EventArgs e) { if (chkRackNo.Checked) { txtRackNo.ReadOnly = false; } else { txtRackNo.ReadOnly = true; } } private void ultraCheckEditor6_CheckedChanged(object sender, EventArgs e) { if (chkStorageNo.Checked) { txtStorageNo.ReadOnly = false; } else { txtStorageNo.ReadOnly = true; } } private void ultraCheckEditor7_CheckedChanged(object sender, EventArgs e) { if (chkValid.Checked) { isvalid = true; } else { isvalid = false; } } /// /// 文本框输入事件 /// /// /// private void ultraTextEditor5_KeyPress(object sender, KeyPressEventArgs e) { string reg = "^[1-9A-Z]$"; //只能输入1-9 A-Z和退格键 string word = e.KeyChar.ToString(); if (Regex.IsMatch(word, reg)||e.KeyChar=='\b') e.Handled = false; else e.Handled = true; } /// /// 查询ultraGrid1 /// private void queryUltraGrid1() { UltraGridRow ugr = ultraGrid2.ActiveRow; if (ugr == null) return; txtStorNo.Value = ugr.Cells["STORAGE_NO"].Value.ToString(); string dummy = ugr.Cells["DUMMY_FLAG"].Value.ToString(); if (dummy == "1") //库是虚拟的 料位也必须是虚拟的 { chkVitual.Checked = true; chkVitual.Enabled = false; } else //库不是虚拟的 料位可以虚拟 也可不虚拟 { chkVitual.Checked = false; chkVitual.Enabled = true; } string storageno = ugr.Cells["STORAGE_NO"].Value.ToString(); ;//库号编码 DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.base.CoreLocationDefine.doQuery", new Object[] { isvalid, storageno }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true); YdmBaseClass.SetGridActivateOnly(ultraGrid1); YdmBaseClass.SetGridRowColor(ultraGrid1); YdmBaseClass.SetColAutoSizeExceptMemo(ultraGrid1); } /// /// 行激活事件 /// /// /// private void ultraGrid2_AfterRowActivate(object sender, EventArgs e) { queryUltraGrid1(); } //private void ultraTextEditor6_KeyPress(object sender, KeyPressEventArgs e) //{ // if (!(Char.IsNumber(e.KeyChar)) && e.KeyChar != (char)13 && e.KeyChar != (char)8) // { // e.Handled = true; // } //} private void ultraTextEditor9_KeyPress(object sender, KeyPressEventArgs e) { if (!(Char.IsNumber(e.KeyChar)) && e.KeyChar != (char)13 && e.KeyChar != (char)8) { e.Handled = true; } } private void ultraTextEditor8_KeyPress(object sender, KeyPressEventArgs e) { if (!(Char.IsNumber(e.KeyChar)) && e.KeyChar != (char)13 && e.KeyChar != (char)8) { e.Handled = true; } } private void ultraCheckEditor5_CheckedChanged(object sender, EventArgs e) { if (chkVitual.Checked) isdummy = "1"; else isdummy = "0"; } private void ultraCheckEditor4_CheckedChanged(object sender, EventArgs e) { if (chkLock.Checked) islock = "0"; else islock = "1"; } private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { ultraGrid1.UpdateData(); UltraGridRow ugr = ultraGrid1.ActiveRow; if (ugr == null) return; switch (ugr.Cells["LOCATION_TYPE"].Value.ToString()) { case "D": cmbLocationType.Text = "垛位"; break; case "J": cmbLocationType.Text = "料架"; break; } txtLocaNo.Text = ugr.Cells["LOCATION_NO"].Value.ToString(); cmbLocationAttr.Text = ugr.Cells["LOCATION_ATTR_NAME"].Value.ToString(); txtArea.Value = ugr.Cells["AREA_NO"].Value.ToString(); txtRow.Value = ugr.Cells["ROW_NO"].Value.ToString(); txtColStart.Value = ugr.Cells["COL_NO"].Value.ToString(); txtColEnd.Value = ugr.Cells["COL_NO"].Value.ToString(); txtMemo.Value = ugr.Cells["MEMO"].Value.ToString(); txtXCoordinates.Value = ugr.Cells["X_COORDINATE"].Value.ToString(); txtYCoordinates.Value = ugr.Cells["Y_COORDINATE"].Value.ToString(); txtLocationWidth.Value = ugr.Cells["LOCATION_WIDTH"].Value.ToString(); txtLocationHeght.Value = ugr.Cells["LOCATION_HEIGHT"].Value.ToString(); txtLocationLen.Value = ugr.Cells["LOCATION_LEN"].Value.ToString(); chkLock.Checked = Convert.ToBoolean(ugr.Cells["LOCATION_STATE"].Value); chkVitual.Checked = Convert.ToBoolean(ugr.Cells["DUMMY_FLAG"].Value); txtLocationName.Text = ugr.Cells["LOCATION_NAME"].Text.ToString(); txtRackType.Value = ugr.Cells["RACK_TYPE"].Value.ToString(); txtRackQuality.Value = ugr.Cells["RACK_QUALITY"].Value.ToString(); } private void frmLocationDefine_Shown(object sender, EventArgs e) { //toolMenu.Toolbars[0].Tools["Resume"].InstanceProps.Visible = DefaultableBoolean.False; } private void ultrlSection_CheckedChanged(object sender, EventArgs e) { cbm_Dw.Enabled = this.ultrlSection.Checked; } } }