Exemplo n.º 1
0
        /// <summary>
        /// 申请单出库后更新其审核状态
        /// </summary>
        /// <param name="sqdh"></param>
        /// <param name="ckdh"></param>
        /// <param name="deptid"></param>
        /// <param name="employeeid"></param>
        /// <param name="sdate"></param>
        /// <param name="cmd"></param>
        public static void Shdj(long sqdh, long ckdh, long deptid, long employeeid, string sdate, RelationalDatabase _DataBase, long jgbm)
        {
            Guid      djid = Guid.Empty;
            string    ssql = "select * from yf_rksq where djh=" + sqdh + " and deptid=" + deptid + "  and shbz=0 ";
            DataTable tb   = _DataBase.GetDataTable(ssql);

            if (tb.Rows.Count > 0)
            {
                djid = new Guid(tb.Rows[0]["id"].ToString());
            }


            //回填审核标志
            DataTable tbyjks = Yp.SelectYjks(deptid, _DataBase);

            if (tbyjks.Rows.Count > 0)
            {
                if (Convert.ToInt32(tbyjks.Rows[0]["QYBZ"]) == 1)
                {
                    if (Convert.ToInt32(tbyjks.Rows[0]["szjgbm"]) != jgbm)
                    {
                        string _err_text = "";
                        Guid   log_djid  = Guid.Empty;
                        ts_HospData_Share.ts_update_log ts = new ts_HospData_Share.ts_update_log();
                        string bz = TrasenFrame.Forms.FrmMdiMain.CurrentDept.DeptName + " 审核申领单 ";
                        ts.Save_log(ts_HospData_Share.czlx.yp_药房申请领药单, bz, "YF_RKSQ", "ID", djid.ToString(), jgbm, Convert.ToInt32(tbyjks.Rows[0]["szjgbm"]), 0, "", out log_djid, _DataBase);
                    }
                }
            }
            ssql = "update YF_RKSQ set shbz=1,shr=" + employeeid + ",shrq='" + sdate + "',ckdh=" + ckdh + " where djh=" + sqdh + " and deptid=" + deptid + "  and shbz=0";
            _DataBase.DoCommand(ssql);
        }
Exemplo n.º 2
0
        private static void AddcmbYjks(System.Windows.Forms.ComboBox cmb, string kslx)
        {
            string ssql = "";

            if (Yp.SelectYjks(InstanceForm.BCurrentDept.DeptId, InstanceForm.BDatabase).Rows.Count == 0)
            {
                ssql = " select '全部' KSMC,0 DEPTID union select KSMC,DEPTID from yp_yjks a where  qybz=1 and a.kslx='" + kslx.Trim() + "' ";
            }
            else
            {
                ssql = "select KSMC,DEPTID from yp_yjks a where deptid=" + InstanceForm.BCurrentDept.DeptId + " ";
            }
            DataTable tb = InstanceForm.BDatabase.GetDataTable(ssql);

            cmb.DataSource    = tb;
            cmb.ValueMember   = "DEPTID";
            cmb.DisplayMember = "KSMC";
        }
Exemplo n.º 3
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            DataTable tb   = (DataTable)this.myDataGrid1.DataSource;
            int       nrow = Convert.ToInt32(this.myDataGrid1.CurrentCell.RowNumber);

            if (nrow > tb.Rows.Count - 1)
            {
                return;
            }
            if (MessageBox.Show("您确定要删除第" + Convert.ToString((nrow + 1)) + "行这个单据吗 ?", "询问窗", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
            {
                return;
            }

            this.button1.Enabled = false;

            string    err_text = "";
            int       wldw     = 0;
            string    ssql     = "select * from yf_rksq where id='" + tb.Rows[nrow]["id"].ToString() + "'";
            DataTable tbdj     = InstanceForm.BDatabase.GetDataTable(ssql);

            if (tbdj.Rows.Count > 0)
            {
                wldw = Convert.ToInt32(tbdj.Rows[0]["wldw"]);
            }


            //删除目标服务器的申领单
            DataTable tbyjks = Yp.SelectYjks(wldw, InstanceForm.BDatabase);

            TrasenClasses.DatabaseAccess.RelationalDatabase mbdb = null;
            if (Convert.ToInt32(tbyjks.Rows[0]["szjgbm"]) != InstanceForm._menuTag.Jgbm)
            {
                mbdb = TrasenFrame.Classes.WorkStaticFun.GetJgbmDb(Convert.ToInt32(tbyjks.Rows[0]["szjgbm"]));
                ssql = "select * from yf_rksq where id='" + tb.Rows[nrow]["id"].ToString() + "' and shbz=1";
                DataTable mbtb = mbdb.GetDataTable(ssql);
                if (mbtb.Rows.Count > 0)
                {
                    MessageBox.Show("", "该单据已审核,不能删除", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.button1.Enabled = true;
                    return;
                }
            }



            try
            {
                InstanceForm.BDatabase.BeginTransaction();


                YF_RKSQ_RKSQMX.DeleteDj(new Guid(tb.Rows[nrow]["id"].ToString()), InstanceForm.BDatabase);

                if (tbyjks.Rows.Count > 0)
                {
                    if (Convert.ToInt32(tbyjks.Rows[0]["QYBZ"]) == 1 && Convert.ToInt32(tbyjks.Rows[0]["deptid"]) != Convert.ToInt32(InstanceForm.BCurrentDept.DeptId))
                    {
                        if (Convert.ToInt32(tbyjks.Rows[0]["szjgbm"]) != InstanceForm._menuTag.Jgbm && mbdb != null)
                        {
                            //Guid log_djid = Guid.Empty;
                            //ts_HospData_Share.ts_update_log ts = new ts_HospData_Share.ts_update_log();
                            //bool shbz = ts_HospData_Share.yp_lysq.GetShzt(new Guid(tb.Rows[nrow]["id"].ToString()), Convert.ToInt32(tbyjks.Rows[0]["szjgbm"]), out err_text);
                            //if (shbz == true) throw new Exception(err_text);
                            //string bz = InstanceForm.BCurrentDept.DeptName.Trim() + " 删除申领单 ";
                            //ts.Save_log(ts_HospData_Share.czlx.yp_药房申请领药单, bz, "YF_RKSQ", "ID", tb.Rows[nrow]["id"].ToString(), InstanceForm._menuTag.Jgbm, Convert.ToInt32(tbyjks.Rows[0]["szjgbm"]), 0, "", out log_djid, InstanceForm.BDatabase);
                            YF_RKSQ_RKSQMX.DeleteDj(new Guid(tb.Rows[nrow]["id"].ToString()), mbdb);
                        }
                    }
                }



                string    str_old   = InstanceForm.BCurrentUser.Name + "删除" + InstanceForm.BCurrentDept.DeptName + "药品申请单.单据主键:" + tb.Rows[nrow]["id"].ToString();
                SystemLog systemLog = new SystemLog(-1, InstanceForm.BCurrentDept.DeptId, InstanceForm.BCurrentUser.EmployeeId, "删除单据", str_old, DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase), 0, "主机名:" + System.Environment.MachineName, 8);
                systemLog.Save();
                systemLog = null;

                //提交事务
                InstanceForm.BDatabase.CommitTransaction();

                this.button1.Enabled = true;
                MessageBox.Show("删除成功");
                this.butref_Click(sender, e);
            }
            catch (System.Exception err)
            {
                InstanceForm.BDatabase.RollbackTransaction();
                this.button1.Enabled = true;
                MessageBox.Show(err.Message);
            }
        }