Пример #1
0
        private void txtCartonNo_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e != null && e.KeyChar == '\r' && rows == 0)
            {
                QueryGrid();
            }
            else if (e != null && e.KeyChar == '\r' && rows > 0)
            {
                if (string.IsNullOrEmpty(txtCartonNo.Text))
                {
                    MessageBox.Show("请先扫入箱号!");
                    return;
                }
                dataGrid1.CurrentCellChanged -= dataGrid1_CurrentCellChanged;
                for (int i = 0; i < rows; i++)
                {
                    dataGrid1[i, 0] = "";
                }


                string    cartonnoStr = txtCartonNo.Text.Replace("*", ",").ToUpper();
                DataTable dt          = MaterialOnShelvesService.Retrieve(cartonnoStr);

                foreach (DataRow dr in dt.Rows)
                {
                    string stno   = dr["STNO"].ToString();
                    string stline = dr["STLINE"].ToString();

                    for (int i = 0; i < rows; i++)
                    {
                        if (dataGrid1[i, 1].ToString() == stno && dataGrid1[i, 6].ToString() == stline)
                        {
                            dataGrid1[i, 0] = "√";
                        }
                    }
                }
                dataGrid1.CurrentCellChanged += dataGrid1_CurrentCellChanged;
                txtCartonNo.Text              = string.Empty;
            }
        }