private void txtorderNo_KeyDown(object sender, KeyEventArgs e) { try { Cursor.Current = Cursors.WaitCursor; if (e.KeyCode != Keys.Enter) { return; } DataSet ds = WebAPIUtil.GetAPIByJsonToGeneric <DataSet>(string.Format("api/scan/GetList/{0}/{1}", txtorderNo.Text, QSCommonValue.operModule)); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { txtorderNo.Focus(); txtorderNo.SelectAll(); AppUtil.ShowError("未能找到单据信息,请确认单号是否正确!"); return; } if (Convert.ToInt32(ds.Tables[0].Rows[0]["F_Status"]) > 1) { txtorderNo.Focus(); txtorderNo.SelectAll(); AppUtil.ShowError("单据已经完成!"); return; } if (QSCommonValue.operModule == "PD") { if (Convert.ToInt32(ds.Tables[0].Rows[0]["F_Status"]) > 0) { txtorderNo.Focus(); txtorderNo.SelectAll(); AppUtil.ShowError("单据已经完成!"); return; } } else { if (Convert.ToInt32(ds.Tables[0].Rows[0]["F_Status"]) == 0) { txtorderNo.Focus(); txtorderNo.SelectAll(); AppUtil.ShowError("单据尚未审核!"); return; } } QSCommonValue.ListHead = ds.Tables[0]; QSCommonValue.Body = ds.Tables[1]; dgHead.DataSource = QSCommonValue.Body; } catch (Exception ex) { logger.ErrorException("FrmHead窗体txtorderNo_KeyDown事件:" + ex.Message, ex); AppUtil.ShowError("操作失败!原因:" + ex.Message); } finally { Cursor.Current = Cursors.Default; } }