private void 回退ToolStripMenuItem_Click(object sender, EventArgs e) { HomemadeBillStatus status = (HomemadeBillStatus)Enum.Parse(typeof(HomemadeBillStatus), dataGridView1.SelectedRows[0].Cells["单据状态"].Value.ToString()); if (dataGridView1.SelectedRows.Count == 0 || status == HomemadeBillStatus.已入库) { MessageDialog.ShowPromptMessage("请选择没有入库的记录后再进行此操作!"); return; } else if (dataGridView1.SelectedRows.Count > 1) { MessageDialog.ShowPromptMessage("系统不支持多条记录同时回退,请逐条操作!"); return; } string billID = dataGridView1.SelectedRows[0].Cells["入库单号"].Value.ToString(); bool validInfo = false; if (status == HomemadeBillStatus.等待质检 || status == HomemadeBillStatus.回退_质检信息有误) { if (!BasicInfo.ListRoles.Contains(CE_RoleEnum.自制件检验组长.ToString())) { MessageDialog.ShowPromptMessage("您无权回退单据的当前步骤"); return; } validInfo = true; } else if (status == HomemadeBillStatus.等待入库) { if (!BasicInfo.ListRoles.Contains( m_msgPromulgator.GetRoleStringForStorage(cmbStorage.Text).ToString())) { MessageDialog.ShowPromptMessage("您无权回退单据的当前步骤"); return; } validInfo = true; } else if (status.ToString().Contains("回退")) { MessageDialog.ShowPromptMessage("当前记录已经处于回退状态,不能重复回退"); return; } if (validInfo) { string reason = InputBox.ShowDialog("请输入回退原因", "原因:", ""); if (reason == null || reason == "") { MessageDialog.ShowPromptMessage("请输入回退原因"); return; } if (!m_billServer.RebackBill(billID, reason, out m_findBill, out m_err)) { MessageDialog.ShowErrorMessage(m_err); return; } RebackFlowMessage(reason); RefreshDataGridView(m_findBill); MessageDialog.ShowPromptMessage("成功回退!"); } }