using Microsoft.VisualBasic; using RGD.DataService; using RGD.DBUtility; using System; using System.Data; using System.Windows.Forms; namespace RGD.WCS { public partial class FrmHandCommand : Form { private static FrmHandCommand _formInstance; public static FrmHandCommand FormInstance { get { if (_formInstance != null) { _formInstance.Dispose(); _formInstance = null; } if (_formInstance == null) { _formInstance = new FrmHandCommand(); } return _formInstance; } set { _formInstance = value; } } private CCommonFunction ccf = new CCommonFunction(); #region ====变量定义 private UCellPanel cellPanel = null; #endregion ====变量定义 public FrmHandCommand() { InitializeComponent(); _formInstance = this; } private void FrmHandCommand_Load(object sender, EventArgs e) { this.comboBox1.SelectedIndex = 0; if (cellPanel == null) { cellPanel = new UCellPanel(this, txtCellCode, null, null, string.Empty); cellPanel.TaskType = "100"; cellPanel.GoodsName = ""; cellPanel.Dock = DockStyle.Fill; cellPanel.AllowWareHouseChanged = false; plCell.Controls.Add(cellPanel); } //20090910 and F_DBW1Address is not null DataView dv = DbHelperSQL.Query("SELECT T_Base_Device.F_DeviceIndex, T_Base_Device.F_DeviceKindIndex," + " T_Base_Device.F_DeviceName, T_Base_Device_Kind.F_GoodsMoveKindIndex FROM T_Base_Device,T_Base_Device_Kind " + " where T_Base_Device.F_DeviceKindIndex = T_Base_Device_Kind.F_DeviceKindIndex and F_DBW1Address is not null and " + " (T_Base_Device_Kind.F_GoodsMoveKindIndex = 1 OR T_Base_Device_Kind.F_GoodsMoveKindIndex = 2)").Tables[0].DefaultView; if (dv.Count > 0) { this.cbDeviceName.DisplayMember = "F_DeviceName"; this.cbDeviceName.ValueMember = "F_DeviceIndex"; this.cbDeviceName.DataSource = dv; this.cbDeviceName.Text = ""; this.cbDeviceName.SelectedValue = 0; } txtCellCode.Text = ""; } private void cbDeviceName_SelectedIndexChanged(object sender, EventArgs e) { DataView dv; this.cbDeviceCommand.DataSource = null; DataSet ds = DbHelperSQL.Query("SELECT T_Base_Device.F_DeviceKindIndex, F_DeviceCommandName,F_DeviceCommandIndex FROM " + "T_Base_Device , T_Base_Device_Command WHERE T_Base_Device.F_DeviceKindIndex" + "= T_Base_Device_Command.F_DeviceKindIndex and F_DeviceIndex=" + Convert.ToInt32(cbDeviceName.SelectedValue) + " and F_DeviceCommandIndex <> -1"); if (ds.Tables[0].DefaultView.Count > 0) { this.cbDeviceCommand.DisplayMember = "F_DeviceCommandName"; this.cbDeviceCommand.ValueMember = "F_DeviceCommandIndex"; this.cbDeviceCommand.DataSource = ds.Tables[0].DefaultView; this.cbDeviceCommand.Text = ""; this.cbDeviceCommand.SelectedValue = 0; switch (BaseDeviceService.GetDeviceKindIdx(Convert.ToInt32(cbDeviceName.SelectedValue))) { case 1://堆垛机 dv = DbHelperSQL.Query("SELECT F_DeviceIndex, F_DeviceName FROM T_Base_Lane_Gate,T_Base_LaneInfo,T_Base_Device where F_LaneIndex = F_LaneDeviceIndex and T_Base_LaneInfo.F_StackIndex=" + Convert.ToInt32(cbDeviceName.SelectedValue) + " and T_Base_Lane_Gate.F_LaneGateDeviceIndex=T_Base_Device.F_DeviceIndex").Tables[0].DefaultView; if (dv.Count > 0) { cbEndPosition.DataSource = null; cbEndPosition.DisplayMember = "F_DeviceName"; cbEndPosition.ValueMember = "F_DeviceIndex"; cbEndPosition.DataSource = dv; txtCellCode.Enabled = true; plCell.Enabled = true; cellPanel.StackDevice = this.cbDeviceName.SelectedValue.ToString(); } break; case 2://输送机 // dv = DbHelperSQL.Query("SELECT F_DeviceIndex, F_DeviceName FROM T_Base_Device WHERE F_DeviceKindIndex =2 OR F_DeviceKindIndex =3").Tables[0].DefaultView; if (dv.Count > 0) { cbEndPosition.DataSource = null; cbEndPosition.DisplayMember = "F_DeviceName"; cbEndPosition.ValueMember = "F_DeviceIndex"; cbEndPosition.DataSource = dv; txtCellCode.Enabled = false; plCell.Enabled = false; } break; case 4://RGV dv = DbHelperSQL.Query("SELECT F_RGVGateDeviceIndex,F_DeviceName FROM T_Base_Device,T_Base_RGV_Gate WHERE F_DeviceIndex=F_RGVGateDeviceIndex and F_ChannelsIndex =" + Convert.ToInt32(cbDeviceName.SelectedValue)).Tables[0].DefaultView; if (dv.Count > 0) { cbEndPosition.DataSource = null; cbEndPosition.DisplayMember = "F_DeviceName"; cbEndPosition.ValueMember = "F_RGVGateDeviceIndex"; cbEndPosition.DataSource = dv; txtCellCode.Enabled = false; plCell.Enabled = false; } break; } this.cbEndPosition.Text = ""; txtCellCode.Text = ""; } } private void cbEndPosition_SelectedIndexChanged(object sender, EventArgs e) { if ((Information.IsNumeric(this.cbEndPosition.SelectedValue) == true)) { DataView dv = DbHelperSQL.Query("SELECT F_ZXY FROM T_Base_Lane_Gate where F_LaneGateDeviceIndex=" + this.cbEndPosition.SelectedValue + "").Tables[0].DefaultView; if (dv.Count > 0) { txtCellCode.Text = dv[0][0].ToString(); } else { txtCellCode.Text = ""; } } } private void button1_Click(object sender, EventArgs e) { if (MessageBox.Show("您确认要增加手工任务吗?", "操作提示:", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) { return; } //向调度任务表插入手工任务,管理类型4, //管理索引(如果调度任务表没有手工任务, //在T_Base_Manage_Task_Index_Hand_Task表去找个基数然后加一) try { #region 选择验证 if (cbDeviceName.SelectedValue == null) { MessageBox.Show("请选择设备!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.cbDeviceName.Focus(); return; } if (this.cbDeviceName.Text.Trim() == "") { MessageBox.Show("请选择设备!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.cbDeviceName.Focus(); return; } if (this.cbDeviceCommand.Text.Trim() == "") { MessageBox.Show("请选择设备命令!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.cbDeviceCommand.Focus(); return; } #endregion 选择验证 if ((cbDeviceCommand.Text == "复位") || (cbDeviceCommand.Text == "回原点")) { } else { #region if (this.txtCellCode.Enabled == true) { DataView dv0; if (this.cbEndPosition.Text == "立库货位") { dv0 = DbHelperSQL.Query("SELECT FCELLCODE FROM ST_CELL WHERE (FCELLSTATUS<> '-1' and FCELLCODE ='" + txtCellCode.Text + "')").Tables[0].DefaultView; if (dv0.Count <= 0) { MessageBox.Show("请输入或选择合适的货位编码!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.txtCellCode.Focus(); return; } } else { dv0 = DbHelperSQL.Query("SELECT F_LaneGateDeviceIndex FROM T_Base_Lane_Gate where F_LaneGateDeviceIndex=" + cbEndPosition.SelectedValue + " and F_ZXY='" + txtCellCode.Text + "'").Tables[0].DefaultView; if (dv0.Count <= 0) { MessageBox.Show("请输入或选择合适的货位编码!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.txtCellCode.Focus(); return; } } } #endregion } int routeIDsub = GetRouteIDsub(Convert.ToInt32(cbDeviceName.SelectedValue)); if (routeIDsub == -1) { MessageBox.Show("您选择的设备错误!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string Sql; DataView dv = DbHelperSQL.Query("SELECT F_ManageTASKKINDINDEX, F_DeviceIndex FROM T_Monitor_Task where F_ManageTASKKINDINDEX=4 and F_DeviceIndex=" + this.cbDeviceName.SelectedValue + "").Tables[0].DefaultView; if (dv.Count > 0) { //MessageBox.Show("在调度队列中已经存在这个设备的手工命令!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); //return; } DataSet dss = DbHelperSQL.Query("SELECT T_Base_Device.F_DeviceKindIndex, F_DeviceCommandName,F_DeviceCommandIndex FROM " + "T_Base_Device , T_Base_Device_Command WHERE T_Base_Device.F_DeviceKindIndex" + "= T_Base_Device_Command.F_DeviceKindIndex and F_DeviceIndex=" + Convert.ToInt32(cbDeviceName.SelectedValue) + " and F_DeviceCommandIndex=" + Convert.ToInt32(this.cbDeviceCommand.SelectedValue) + " and F_DeviceCommandIndex <> -1"); if (dss.Tables[0].DefaultView.Count <= 0) { MessageBox.Show("请选择设备和对应的有效命令!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string dtime = DateTime.Now.ToString("u"); dtime = dtime.Substring(0, dtime.Length - 1); string qcell = string.Empty, scell = string.Empty; int hidx = 0; int hmindx = 0; int rehidx = 0; //20101028 int z = 0, x = 0, y = 0, z1 = 0, x1 = 0, y1 = 0; //2 将取,3 将送,4 取货,5 送货 int devicekind = BaseDeviceService.GetDeviceKindIdx(Convert.ToInt32(cbDeviceName.SelectedValue)); if (devicekind == 1) { Model.MDevice device = BaseDeviceService.GetDeviceInfo(Convert.ToInt32(cbDeviceName.SelectedValue)); ; //if(device.) //{ //} } switch (devicekind) { case 1://堆垛机 char[] cc = new char[1] { '-' }; string[] sp = this.txtCellCode.Text.Split(cc); switch (this.cbDeviceCommand.SelectedValue.ToString()) { case "2": z = Convert.ToInt32(sp[0]); x = Convert.ToInt32(sp[1]); y = Convert.ToInt32(sp[2]); qcell = txtCellCode.Text;//20101028 break; case "4": z = Convert.ToInt32(sp[0]); x = Convert.ToInt32(sp[1]); y = Convert.ToInt32(sp[2]); qcell = txtCellCode.Text;//20101028 break; case "3": z1 = Convert.ToInt32(sp[0]); x1 = Convert.ToInt32(sp[1]); y1 = Convert.ToInt32(sp[2]); scell = txtCellCode.Text;//20101028 break; case "5": z1 = Convert.ToInt32(sp[0]); x1 = Convert.ToInt32(sp[1]); y1 = Convert.ToInt32(sp[2]); scell = txtCellCode.Text;//20101028 break; } break; case 2://输送机 if (cbEndPosition.Text.Trim().Length == 0) { MessageBox.Show("请选择目标位置!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.cbEndPosition.Focus(); return; } else if (12049 == Convert.ToInt32(cbEndPosition.SelectedValue) || 12054 == Convert.ToInt32(cbEndPosition.SelectedValue)) { if (cbBoxFloor.Text.Trim().Length <= 0) { MessageBox.Show("请选择表箱层数!", "误操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } x1 = Convert.ToInt32(cbBoxFloor.Text); } else if (32080 == Convert.ToInt32(cbDeviceName.SelectedValue) && cbDeviceCommand.SelectedValue.ToString() == "7") { if (cbUnpack.Text.Trim().Length <= 0) { MessageBox.Show("请选择拆盘数量!", "误操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } x1 = Convert.ToInt32(cbUnpack.Text); } if (cbDeviceCommand.SelectedValue.ToString() != "6") { cbEndPosition.Text = "0"; z = Convert.ToInt32(cbDeviceName.SelectedValue); z1 = Convert.ToInt32(cbEndPosition.Text); } else { z = Convert.ToInt32(cbDeviceName.SelectedValue); z1 = Convert.ToInt32(cbEndPosition.SelectedValue); } z = Convert.ToInt32(cbDeviceName.SelectedValue); z1 = Convert.ToInt32(cbEndPosition.SelectedValue); break; case 4://RGV if (cbEndPosition.SelectedValue == null) { MessageBox.Show("请选择目标位置!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.cbEndPosition.Focus(); return; } z = Convert.ToInt32(cbEndPosition.SelectedValue); break; } string useawayfork = "-"; int xx = 0; int xx1 = 0; string useawayfork1 = "-";//20101220 if (this.comboBox1.Text == "近货叉") { useawayfork = "0"; xx = x + 1; xx1 = x1 + 1; useawayfork1 = "1";//20101220 } else { xx = x - 1; xx1 = x1 - 1; useawayfork = "1"; useawayfork1 = "0";//20101220 } //if (this.checkBox1.Checked == true) //{ // useawayfork = "-"; //} if (this.checkBox1.Checked == true) { if ((BaseDeviceService.GetDeviceKindIdx(Convert.ToInt32(cbDeviceName.SelectedValue)) == 2) && (new CommonService().GetIfCorrelDoubleFork(Convert.ToInt32(cbDeviceName.SelectedValue)) == "1") && ((cbDeviceCommand.Text == "送出")))//20101220出库站台送出任务关联 { rehidx = GetManageHandIdx(); hmindx = ccf.GetMonitorIndex(hidx, 4); Sql = "insert into T_Monitor_Task(F_RouteID,F_ManageTaskIndex,F_ManageTaskKindIndex,F_MonitorIndex," + "F_DeviceIndex,F_DeviceCommandIndex,F_NumParam1,F_NumParam2,F_NumParam3,F_NumParam4,F_NumParam5,F_NumParam6,F_UseAwayFork,f_createtime) " + "values(" + routeIDsub + "," + rehidx + ",4," + hmindx + "," + Convert.ToInt32(cbDeviceName.SelectedValue) + "," + Convert.ToInt32(cbDeviceCommand.SelectedValue) + "," + z + "," + x + "," + y + "," + z1 + "," + x1 + "," + y1 + ",'" + useawayfork1 + "','" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + "')"; DbHelperSQL.ExecuteSql(Sql); DbHelperSQL.ExecuteSql("insert into T_Manage_Task(FID,F_ManageTaskKindIndex,F_RELATIVECONTORLID,FIntoStepOK,FSTARTDEVICE,FREMARK,FSTARTCELL,FENDDEVICE,FENDCELL,FBEGTIME) values(" + rehidx + ",4,-1,1," + Convert.ToInt32(cbDeviceName.SelectedValue) + ",'" + cbDeviceCommand.SelectedValue + "','" + z.ToString() + "-" + x.ToString() + "-" + y.ToString() + "'," + Convert.ToInt32(cbDeviceName.SelectedValue) + ",'" + z1.ToString() + "-" + x1.ToString() + "-" + y1.ToString() + "','" + dtime + "')"); RecordMaxHandTaskFID(rehidx); } if ((BaseDeviceService.GetDeviceKindIdx(Convert.ToInt32(cbDeviceName.SelectedValue)) == 1) && (((cbDeviceCommand.Text == "取货") || ((cbDeviceCommand.Text == "送货"))))) { rehidx = GetManageHandIdx(); hmindx = ccf.GetMonitorIndex(hidx, 4); if (cbDeviceCommand.Text == "取货") {//z-x-y if (x == 1) { xx = 1; } else { dv = DbHelperSQL.Query("SELECT FID FROM ST_CELL WHERE (F_Z = " + z + ") AND (F_X = " + xx + ") AND (F_Y = " + y + ")").Tables[0].DefaultView; if (dv.Count == 0) { return; } } qcell = z.ToString() + "-" + xx.ToString() + "-" + y.ToString();//20101028 DbHelperSQL.ExecuteSql("insert into T_Monitor_Task(F_RouteID,F_ManageTaskIndex,F_ManageTaskKindIndex,F_MonitorIndex," + "F_DeviceIndex,F_DeviceCommandIndex,F_NumParam1,F_NumParam2,F_NumParam3,F_NumParam4,F_NumParam5,F_NumParam6,F_UseAwayFork,F_createtime) " + "values(" + routeIDsub + "," + rehidx + ",4," + hmindx + "," + Convert.ToInt32(cbDeviceName.SelectedValue) + "," + Convert.ToInt32(cbDeviceCommand.SelectedValue) + "," + z + "," + xx + "," + y + ",0,0,0,'" + useawayfork1 + "','" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + "')");//20101220 } if (cbDeviceCommand.Text == "送货") {//z1-x1-y1 if (x1 == 1) { xx1 = 1; } else { dv = DbHelperSQL.Query("SELECT FID FROM ST_CELL WHERE (F_Z = " + z1 + ") AND (F_X = " + xx1 + ") AND (F_Y = " + y1 + ")").Tables[0].DefaultView; if (dv.Count == 0) { return; } } scell = z1.ToString() + "-" + xx1.ToString() + "-" + y1.ToString();//20101028 DbHelperSQL.ExecuteSql("insert into T_Monitor_Task(F_RouteID,F_ManageTaskIndex,F_ManageTaskKindIndex,F_MonitorIndex," + "F_DeviceIndex,F_DeviceCommandIndex,F_NumParam1,F_NumParam2,F_NumParam3,F_NumParam4,F_NumParam5,F_NumParam6,F_UseAwayFork,F_createtime) " + "values(" + routeIDsub + "," + rehidx + ",4," + hmindx + "," + Convert.ToInt32(cbDeviceName.SelectedValue) + "," + Convert.ToInt32(cbDeviceCommand.SelectedValue) + ",0,0,0," + z1 + "," + xx1 + "," + y1 + ",'" + useawayfork1 + "','" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + "')");//20101220 } DbHelperSQL.ExecuteSql("insert into T_Manage_Task(FID,F_ManageTaskKindIndex,F_RELATIVECONTORLID,FIntoStepOK,FSTARTDEVICE,FREMARK,FSTARTCELL,FENDDEVICE,FENDCELL,FBEGTIME) values(" + rehidx + ",4,-1,1," + Convert.ToInt32(cbDeviceName.SelectedValue) + ",'" + cbDeviceCommand.SelectedValue + "','" + qcell + "'," + Convert.ToInt32(cbDeviceName.SelectedValue) + ",'" + scell + "','" + dtime + "')"); RecordMaxHandTaskFID(rehidx); //20101028 } } //20101028 hidx = GetManageHandIdx(); hmindx = ccf.GetMonitorIndex(hidx, 4); int commond = Convert.ToInt32(cbDeviceCommand.SelectedValue); if (z1 == 12030 && commond == 6) { commond = 7; } Sql = "insert into T_Monitor_Task(F_RouteID,F_ManageTaskIndex,F_ManageTaskKindIndex,F_MonitorIndex," + "F_DeviceIndex,F_DeviceCommandIndex,F_NumParam1,F_NumParam2,F_NumParam3,F_NumParam4,F_NumParam5,F_NumParam6,F_UseAwayFork,F_createtime) " + "values(" + routeIDsub + "," + hidx + ",4," + hmindx + "," + Convert.ToInt32(cbDeviceName.SelectedValue) + "," + commond + "," + z + "," + x + "," + y + "," + z1 + "," + x1 + "," + y1 + ",'" + useawayfork + "','" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + "')"; DbHelperSQL.ExecuteSql(Sql); DbHelperSQL.ExecuteSql("insert into T_Manage_Task(FID,F_ManageTaskKindIndex,F_RELATIVECONTORLID,FIntoStepOK,FSTARTDEVICE,FREMARK,FSTARTCELL,FENDDEVICE,FENDCELL,FBEGTIME) values(" + hidx + ",4,-1,1," + Convert.ToInt32(cbDeviceName.SelectedValue) + ",'" + cbDeviceCommand.SelectedValue + "','" + z.ToString() + "-" + x.ToString() + "-" + y.ToString() + "'," + Convert.ToInt32(cbDeviceName.SelectedValue) + ",'" + z1.ToString() + "-" + x1.ToString() + "-" + y1.ToString() + "','" + dtime + "')"); if (rehidx > 0) { DbHelperSQL.ExecuteSql("update T_Manage_Task set F_RELATIVECONTORLID=" + rehidx + " where F_ManageTaskKindIndex=4 and FID=" + hidx); DbHelperSQL.ExecuteSql("update T_Manage_Task set F_RELATIVECONTORLID=" + hidx + " where F_ManageTaskKindIndex=4 and FID=" + rehidx); } RecordMaxHandTaskFID(hidx); } catch (Exception ex) { throw ex; } } private int GetManageHandIdx() { DataSet ds = DbHelperSQL.Query("SELECT F_ManageTaskKindIndex, max(FID) as mFID FROM T_Manage_Task Where F_ManageTaskKindIndex=4 group by F_ManageTaskKindIndex"); if (ds.Tables[0].DefaultView.Count > 0) { return (Convert.ToInt32(ds.Tables[0].DefaultView[0]["mFID"]) + 1); } else { DataSet dss = DbHelperSQL.Query("SELECT F_ManageTaskIndex FROM T_Base_Manage_Task_Index_Hand_Task"); if (dss.Tables[0].DefaultView.Count > 0) { if ((Convert.ToInt32(dss.Tables[0].DefaultView[0]["F_ManageTaskIndex"]) + 1) >= 29998) { return 20001; } else { return (Convert.ToInt32(dss.Tables[0].DefaultView[0]["F_ManageTaskIndex"]) + 1); } } else { return 20001; } } } private int GetRouteIDsub(int device) { DataView dv = DbHelperSQL.Query("SELECT F_RouteIDSub, F_DeviceIndex, F_RouteID FROM T_Base_Route_Device where F_DeviceIndex=" + device + "").Tables[0].DefaultView; if (dv.Count > 0) { return Convert.ToInt32(dv[0]["F_RouteIDSub"]); } else { return -1; } } private void RecordMaxHandTaskFID(int fid) { DataSet ds = DbHelperSQL.Query("select F_ManageTaskIndex from T_Base_Manage_Task_Index_Hand_Task"); DataView dv = ds.Tables[0].DefaultView; if (dv.Count > 0) { if (fid == 29998) { DbHelperSQL.ExecuteSql("UPDATE T_Base_Manage_Task_Index_Hand_Task SET F_ManageTaskIndex =20001"); return; } if (fid > Convert.ToInt32(dv[0]["F_ManageTaskIndex"])) { DbHelperSQL.ExecuteSql("UPDATE T_Base_Manage_Task_Index_Hand_Task SET F_ManageTaskIndex =" + fid); return; } } else { DbHelperSQL.ExecuteSql("INSERT INTO T_Base_Manage_Task_Index_Hand_Task (F_ManageTaskIndex)VALUES (" + fid + ")"); return; } } private void txtCellCode_TextChanged(object sender, EventArgs e) { if (this.cbDeviceName.SelectedValue == null) return; if (BaseDeviceService.GetDeviceKindIdx(Convert.ToInt32(this.cbDeviceName.SelectedValue)) != 1) return; DataView dv0 = DbHelperSQL.Query("SELECT F_LaneGateDeviceIndex FROM T_Base_Lane_Gate WHERE F_ZXY='" + txtCellCode.Text + "' and F_LaneIndex=" + new CommonService().GetLaneWay(Convert.ToInt32(cbDeviceName.SelectedValue)) + "").Tables[0].DefaultView; if (dv0.Count > 0) { this.cbEndPosition.SelectedValue = dv0[0][0]; } else { dv0 = DbHelperSQL.Query("SELECT FCELLCODE FROM ST_CELL WHERE (FCELLCODE ='" + txtCellCode.Text + "')").Tables[0].DefaultView; if (dv0.Count > 0) { this.cbEndPosition.SelectedValue = 0; this.cbEndPosition.Text = "立库货位"; } } } } }