/// <summary> /// 列表的回车事件,实现光标跳转 /// </summary> /// <param name="e"></param> private void DgvKeyPress(KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter) { //避免乱按回车键 造成报错 if (dgvRecordList.Grid.ActiveCell == null) { return; } if (StatCode == InvenMgrClassify.YP.GetHashCode().ToString()) { DrugInout drug = dgvRecordList.Grid.ActiveRow.ListObject as DrugInout; List<DrugInout> drugs = dgvRecordList.DataSource as List<DrugInout>; if (drug == null || drugs == null) { return; } //药品信息 if (dgvRecordList.Grid.ActiveCell.Column.Key == nameof(DrugInout.DgInfo)) { DemPublic.NextFocusNew(dgvRecordList, dgvRecordList.Grid.ActiveRow.Index, nameof(DrugInout.DioActualAmt), true, false); } //盘点数 else if (dgvRecordList.Grid.ActiveCell.Column.Key == nameof(DrugInout.DioActualAmt)) { if (drug.DgId == null) { return; } //如果是最后一行 if (dgvRecordList.Grid.ActiveRow.Index == drugs.Count - 1) { DemPublic.NextFocusNew(dgvRecordList, dgvRecordList.Grid.ActiveRow.Index, nameof(DrugOrdDtl.DgInfo), false, false); AddGridRow(); dgvRecordList.Grid.PerformAction(UltraGridAction.EnterEditModeAndDropdown, false, false); dgvRecordList.GridRefresh(); } //如果不是最后一行,跳转到下一行 else { DemPublic.NextFocusNew(dgvRecordList, dgvRecordList.Grid.ActiveRow.Index + 1, nameof(DrugOrdDtl.DgInfo), true, false); } } } else if (StatCode == InvenMgrClassify.WC.GetHashCode().ToString()) { EisaiInout drug = dgvRecordList.Grid.ActiveRow.ListObject as EisaiInout; List<EisaiInout> drugs = dgvRecordList.DataSource as List<EisaiInout>; if (drug == null || drugs == null) { return; } //药品信息 if (dgvRecordList.Grid.ActiveCell.Column.Key == nameof(EisaiInout.EgInfo)) { DemPublic.NextFocusNew(dgvRecordList, dgvRecordList.Grid.ActiveRow.Index, nameof(EisaiInout.EioActualAmt), true, false); } //实盘数 else if (dgvRecordList.Grid.ActiveCell.Column.Key == nameof(EisaiInout.EioActualAmt)) { if (drug.EisaiId == null) { return; } //如果是最后一行 if (dgvRecordList.Grid.ActiveRow.Index == drugs.Count - 1) { DemPublic.NextFocusNew(dgvRecordList, drugs.Count - 1, nameof(EisaiInout.EgInfo), false, false); AddGridRow(); dgvRecordList.Grid.PerformAction(UltraGridAction.EnterEditModeAndDropdown, false, false); dgvRecordList.GridRefresh(); } //如果不是最后一行,跳转到下一行 else { DemPublic.NextFocusNew(dgvRecordList, dgvRecordList.Grid.ActiveRow.Index + 1, nameof(EisaiInout.EgInfo), false, false); } } } else if (StatCode == InvenMgrClassify.HC.GetHashCode().ToString()) { MatInvchkDtl drug = dgvRecordList.Grid.ActiveRow.ListObject as MatInvchkDtl; List<MatInvchkDtl> drugs = dgvRecordList.DataSource as List<MatInvchkDtl>; if (drug == null || drugs == null) { return; } //药品信息 if (dgvRecordList.Grid.ActiveCell.Column.Key == nameof(MatInvchkDtl.DmcInfo)) { DemPublic.NextFocusNew(dgvRecordList, dgvRecordList.Grid.ActiveRow.Index, nameof(MatInvchkDtl.MicdActAmt), true, false); } //实盘数 else if (dgvRecordList.Grid.ActiveCell.Column.Key == nameof(MatInvchkDtl.MicdActAmt)) { if (drug.DmcId == null) { return; } //如果是最后一行 if (dgvRecordList.Grid.ActiveRow.Index == drugs.Count - 1) { DemPublic.NextFocusNew(dgvRecordList, drugs.Count - 1, nameof(MatInvchkDtl.DmcInfo), false, false); AddGridRow(); dgvRecordList.Grid.PerformAction(UltraGridAction.EnterEditModeAndDropdown, false, false); dgvRecordList.GridRefresh(); } //如果不是最后一行,跳转到下一行 else { DemPublic.NextFocusNew(dgvRecordList, dgvRecordList.Grid.ActiveRow.Index + 1, nameof(MatInvchkDtl.DmcInfo), false, false); } } } else { AppInvchkDtl drug = dgvRecordList.Grid.ActiveRow.ListObject as AppInvchkDtl; List<AppInvchkDtl> drugs = dgvRecordList.DataSource as List<AppInvchkDtl>; if (drug == null || drugs == null) { return; } //药品信息 if (dgvRecordList.Grid.ActiveCell.Column.Key == nameof(AppInvchkDtl.DacInfo)) { DemPublic.NextFocusNew(dgvRecordList, dgvRecordList.Grid.ActiveRow.Index, nameof(AppInvchkDtl.AicdActAmt), true, false); } //实盘数 else if (dgvRecordList.Grid.ActiveCell.Column.Key == nameof(AppInvchkDtl.AicdActAmt)) { if (drug.DacId == null) { return; } //如果是最后一行 if (dgvRecordList.Grid.ActiveRow.Index == drugs.Count - 1) { DemPublic.NextFocusNew(dgvRecordList, drugs.Count - 1, nameof(AppInvchkDtl.DacInfo), false, false); AddGridRow(); dgvRecordList.Grid.PerformAction(UltraGridAction.EnterEditModeAndDropdown, false, false); dgvRecordList.GridRefresh(); } //如果不是最后一行,跳转到下一行 else { DemPublic.NextFocusNew(dgvRecordList, dgvRecordList.Grid.ActiveRow.Index + 1, nameof(AppInvchkDtl.DacInfo), false, false); } } } } }