1
cwjbxqmz
2024-01-25 c5834dece5ebef10e2e56a4f654a8d3f6061cf6c
DBUtility/»ù´¡×ÊÁÏ/ClsGy_Base_Ctl.cs
@@ -254,7 +254,190 @@
            {
                throw (e);
            }
        }
        }
        /// <summary>
        /// å®¡æ ¸
        /// </summary>
        /// <param name="HItemID">内码</param>
        /// <param name="HMaker">操作人</param>
        /// <returns></returns>
        public bool CheckByHItemID(Int64 HItemID, string HMaker, ref string sReturn)
        {
            try
            {
                DataSet DS = oCn.RunProcReturn("select * from " + MvarItemKey + " where HItemID='" + HItemID + "'", MvarItemKey, ref DBUtility.ClsPub.sExeReturnInfo);
                if (DS.Tables[0].Rows.Count == 0)
                {
                    sReturn = "未查询到任何数据,请刷新数据后重新选择!";
                    return false;
                }
                else
                {
                    if (DS.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                    {
                        sReturn = "单据已审核,不允许重复审核!";
                        return false;
                    }
                    //审核
                    oCn.BeginTran();
                    oCn.RunProc("Update " + MvarItemKey + " set HCheckEmp = '" + HMaker + "',HCheckTime=getdate() where HItemID=" + HItemID, ref Pub_Class.ClsPub.sExeReturnInfo);
                    //写入日志
                    DBUtility.ClsPub.Add_Log("", MvarReportTitle+ "审核,代码:" + DS.Tables[0].Rows[0]["HNumber"].ToString() + ",名称:" + DS.Tables[0].Rows[0]["HName"].ToString(), HMaker);
                    sReturn = "";
                    oCn.Commit();
                    return true;
                }
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        /// <summary>
        /// åå®¡æ ¸
        /// </summary>
        /// <param name="HItemID">内码</param>
        /// <param name="HMaker">操作人</param>
        /// <returns></returns>
        public bool AbandonCheckByHItemID(Int64 HItemID, string HMaker, ref string sReturn)
        {
            try
            {
                DataSet DS = oCn.RunProcReturn("select * from " + MvarItemKey + " where HItemID='" + HItemID + "'", MvarItemKey, ref DBUtility.ClsPub.sExeReturnInfo);
                if (DS.Tables[0].Rows.Count == 0)
                {
                    sReturn = "未查询到任何数据,请刷新数据后重新选择!";
                    return false;
                }
                else
                {
                    if (DS.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
                    {
                        sReturn = "单据未审核,不允许反审核!";
                        return false;
                    }
                    //反审核
                    oCn.BeginTran();
                    oCn.RunProc("Update " + MvarItemKey + " set HCheckEmp = '',HCheckTime=null where HItemID=" + HItemID, ref Pub_Class.ClsPub.sExeReturnInfo);
                    //写入日志
                    DBUtility.ClsPub.Add_Log("", MvarReportTitle + "反审核,代码:" + DS.Tables[0].Rows[0]["HNumber"].ToString() + ",名称:" + DS.Tables[0].Rows[0]["HName"].ToString(), HMaker);
                    sReturn = "";
                    oCn.Commit();
                    return true;
                }
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        /// <summary>
        /// ç¦ç”¨
        /// </summary>
        /// <param name="HItemID">内码</param>
        /// <param name="HMaker">操作人</param>
        /// <returns></returns>
        public bool StopByHItemID(Int64 HItemID, string HMaker, ref string sReturn)
        {
            try
            {
                DataSet DS = oCn.RunProcReturn("select * from " + MvarItemKey + " where HItemID='" + HItemID + "'", MvarItemKey, ref DBUtility.ClsPub.sExeReturnInfo);
                if (DS.Tables[0].Rows.Count == 0)
                {
                    sReturn = "未查询到任何数据,请刷新数据后重新选择!";
                    return false;
                }
                else
                {
                    if (DS.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
                    {
                        sReturn = "单据已禁用,不允许重复禁用!";
                        return false;
                    }
                    DataSet DsHavChildCodes = oCn.RunProcReturn("select HItemID from " + MvarItemKey + " where HStopflag=0 and HParentID='" + HItemID + "'", MvarItemKey, ref Pub_Class.ClsPub.sExeReturnInfo);
                    if (DsHavChildCodes.Tables[0].Rows.Count > 0)
                    {
                        sReturn = "所选单据存在未禁用的子项目,不允许禁用!";
                        return false;
                    }
                    //禁用
                    oCn.BeginTran();
                    oCn.RunProc("Update " + MvarItemKey + " set HStopflag=1,HStopEmp = '" + HMaker + "',HStopTime=getdate() where HItemID=" + HItemID, ref Pub_Class.ClsPub.sExeReturnInfo);
                    //写入日志
                    DBUtility.ClsPub.Add_Log("", MvarReportTitle + "禁用,代码:" + DS.Tables[0].Rows[0]["HNumber"].ToString() + ",名称:" + DS.Tables[0].Rows[0]["HName"].ToString(), HMaker);
                    sReturn = "";
                    oCn.Commit();
                    return true;
                }
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        /// <summary>
        /// åç¦ç”¨
        /// </summary>
        /// <param name="HItemID">内码</param>
        /// <param name="HMaker">操作人</param>
        /// <returns></returns>
        public bool AbandonStopByHItemID(Int64 HItemID, string HMaker, ref string sReturn)
        {
            try
            {
                DataSet DS = oCn.RunProcReturn("select * from " + MvarItemKey + " where HItemID='" + HItemID + "'", MvarItemKey, ref DBUtility.ClsPub.sExeReturnInfo);
                if (DS.Tables[0].Rows.Count == 0)
                {
                    sReturn = "未查询到任何数据,请刷新数据后重新选择!";
                    return false;
                }
                else
                {
                    if (DS.Tables[0].Rows[0]["HStopEmp"].ToString() == "")
                    {
                        sReturn = "单据未禁用,不允许反禁用!";
                        return false;
                    }
                    DataSet DsHavChildCodes = oCn.RunProcReturn("select HItemID from " + MvarItemKey + " where HStopflag=1 and HItemID='" + DS.Tables[0].Rows[0]["HParentID"].ToString() + "'", MvarItemKey, ref Pub_Class.ClsPub.sExeReturnInfo);
                    if (DsHavChildCodes.Tables[0].Rows.Count > 0)
                    {
                        sReturn = "所选单据上级项目已禁用,不允许反禁用!";
                        return false;
                    }
                    //禁用
                    oCn.BeginTran();
                    oCn.RunProc("Update " + MvarItemKey + " set HStopflag=0,HStopEmp = '',HStopTime=null where HItemID=" + HItemID, ref Pub_Class.ClsPub.sExeReturnInfo);
                    //写入日志
                    DBUtility.ClsPub.Add_Log("", MvarReportTitle + "反禁用,代码:" + DS.Tables[0].Rows[0]["HNumber"].ToString() + ",名称:" + DS.Tables[0].Rows[0]["HName"].ToString(), HMaker);
                    sReturn = "";
                    oCn.Commit();
                    return true;
                }
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        #endregion
    }
}