void miDrugInfo_Click() { Guid saleOrderDetailID = Guid.Empty; Guid InvID = _salesOrderList[this.dgvMain.CurrentRow.Index].DrugInventoryRecordID; DrugInventoryRecord diir = this.PharmacyDatabaseService.GetDrugInventoryRecord(out message, InvID); Guid druginfoID = diir.DrugInfoId; if (diir.Id != Guid.Empty) { Form_HistoryPurchase frm = new Form_HistoryPurchase(druginfoID, 3); frm.ShowDialog(); this.dgvMain.Focus(); } }
//快捷键 protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (this.dataGridView1.CurrentCell != null && keyData.ToString() == "Return") { if (this.dataGridView1.CurrentCell.RowIndex == this.dataGridView1.Rows.Count - 1 && this.dataGridView1.CurrentCell.ColumnIndex == 5) { this.dataGridView1.EndEdit(); return(true); } if (this.dataGridView1.CurrentCell.ColumnIndex == 4) { System.Windows.Forms.SendKeys.Send("{tab}"); } if (this.dataGridView1.CurrentCell.ColumnIndex == 5 && this.dataGridView1.CurrentCell.RowIndex < this.dataGridView1.Rows.Count - 1) { dataGridView1.CurrentCell = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex + 1].Cells[4]; } return(true); } if (keyData == Keys.F5) { if (this.dataGridView1.SelectedCells.Count > 0) { Guid druginfoID = Guid.Parse(this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[this.clmDrugId.Name].FormattedValue.ToString()); if (druginfoID != Guid.Empty) { Form_HistoryPurchase frm = new Form_HistoryPurchase(druginfoID, 1); frm.ShowDialog(); this.dataGridView1.Focus(); } } return(true); } if (keyData == (Keys.Alt | Keys.D)) { Bcms.GetDrugInfo(); } if (keyData == (Keys.Alt | Keys.F)) { Bcms.GetSupplyUnit(); } if (keyData == (Keys.Alt | Keys.S)) { this.btnGeneratePurchaseRecords_Click(this, null); return(true); } if (keyData == (Keys.Alt | Keys.X)) { var ids = from i in bList select i.Id; var pi = this.PharmacyDatabaseService.GetLastInInventoryDetail(ids.ToArray()); this.dataGridView1.Focus(); foreach (DataGridViewRow dr in this.dataGridView1.Rows) { DrugInfo di = dr.DataBoundItem as DrugInfo; var p = pi.Where(r => r.DrugInfoId == di.Id).FirstOrDefault(); dr.Cells["clmPurchasePrice"].Value = p == null?0m: p.PurchasePrice; } } return(base.ProcessCmdKey(ref msg, keyData)); }