//刷新 private void butref_Click(object sender, EventArgs e) { try { if (rdo2.Checked && chkdjsj.Checked == false) { MessageBox.Show("查询的时间过长!"); return; } string ssql = " "; int bshbz = rdo2.Checked ? 1 : 0; ssql += string.Format(" and a.bshbz ={0} ", bshbz); int deptid = Convert.ToInt32(Convertor.IsNull(cmbck.SelectedValue, "0"));//库房id ssql += string.Format(" and a.deptid ={0}", deptid); if (chkdjsj.Checked) { string t1 = dtp1.Value.ToShortDateString() + " 00:00:01"; string t2 = dtp2.Value.ToShortDateString() + " 23:59:59"; ssql += string.Format(" and a.djrq>='{0}' and a.djrq<='{1}' ", t1, t2); } ssql += string.Format(" and bscbz <>1 and a.ywlx='{0}'", Convertor.IsNull(cmbYwlx.SelectedValue, "")); //制剂 加工 DataTable dt = YK_ZJJG_JH.GetJhDataTable(ssql, " order by a.shrq,a.djrq ", db); dataGridView1.DataSource = dt; } catch (Exception err) { MessageBox.Show(err.Message); } }
//取消审核 private void btnUnSh_Click(object sender, EventArgs e) { try { int rowIndex = dataGridView1.CurrentCell.RowIndex; if (rowIndex < 0) { return; } Guid jhid = new Guid(dataGridView1.Rows[rowIndex].Cells["cid"].Value.ToString()); List <YK_ZJJG_JH> listJh = YK_ZJJG_JH.GetJhList(string.Format(" and a.id= '{0}' and a.bshbz=1", jhid), "", db); if (listJh.Count <= 0) { MessageBox.Show("找不到该计划或该计划未审核,请刷新后重试!"); return; } YK_ZJJG_JH jh = listJh[0]; DialogResult result = MessageBox.Show("确定取消审核?", "取消审核", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (result == DialogResult.Cancel) { return; } db.BeginTransaction(); YK_ZJJG_Class.UnShScJh(jh, db, InstanceForm._menuTag.Jgbm); db.CommitTransaction(); MessageBox.Show("取消审核成功!"); butref_Click(0, e); } catch (Exception err) { db.RollbackTransaction(); MessageBox.Show("取消审核失败!" + err.Message); } }