SVN-Revision: r980
This commit is contained in:
wyf
2025-09-10 06:39:01 +00:00
parent 4a172dec34
commit 58d4289f6f
+152 -1
View File
@@ -163,7 +163,139 @@ namespace Lskj.Business.Impl
return msg.Value + "";
}
/// <summary>
/// 说明:返回审批结果(Return 值用于逻辑判断;@msg 用于提示展示)
/// 创建人:龚宇超
/// 创建日期:2017-12-11
/// 修改日期:2025-09-10(新增重载:返回 SP Return 值;@msg 通过 out
/// </summary>
public static string Audit(
out string nextSelectStepCode,
out string nextSelectStepOper,
out string msgText, // 新增:@msg 输出
DynamicModel sysModel,
string stepCode,
string billDocumentId,
string message, // 兼容保留
string storedName,
string accractFlag,
string remindSelect,
string remarkText = "",
string remindOpers = "",
string confirmOpers = "",
bool ret = false,
int returnd = 0,
int selectConfirmFlag = 0,
bool IsStepOver = false)
{
bool newAudit = true;
int i = 8;
string[] newParameter = new string[] { "@nextSelectStepCode", "@nextSelectStepOper", "@selectConfirmFlag" };
if (!isParamComplete(storedName, newParameter)) newAudit = false;
// 输出参数
SqlParameter pMsg = ERPInfo.Instance.ChangeParameterType
? new SqlParameter("@msg", SqlDbType.NVarChar, 6000)
: new SqlParameter("@msg", SqlDbType.VarChar, 3000);
pMsg.Direction = ParameterDirection.Output;
SqlParameter pNextSelectStepCode = new SqlParameter("@nextSelectStepCode", SqlDbType.VarChar, 3000);
pNextSelectStepCode.Direction = ParameterDirection.Output;
SqlParameter pNextSelectStepOper = new SqlParameter("@nextSelectStepOper", SqlDbType.VarChar, 3000);
pNextSelectStepOper.Direction = ParameterDirection.Output;
// Return 值参数
SqlParameter pReturn = new SqlParameter("@RETURN_VALUE", SqlDbType.Int)
{
Direction = ParameterDirection.ReturnValue
};
// 入参
List<SqlParameter> list = new List<SqlParameter>
{
new SqlParameter("@typeCode", SqlDbType.VarChar, 10),
new SqlParameter("@stepCode", SqlDbType.Int, 4),
new SqlParameter("@billDocumentId", SqlDbType.VarChar, 200),
new SqlParameter("@operatorId", SqlDbType.Int, 4),
ERPInfo.Instance.ChangeParameterType
? new SqlParameter("@operatorName", SqlDbType.NVarChar, 40)
: new SqlParameter("@operatorName", SqlDbType.VarChar, 20),
new SqlParameter("@auditAdvice", SqlDbType.VarChar, 500),
new SqlParameter("@Direction", SqlDbType.Char, 1),
pMsg
};
if (newAudit)
{
list.Add(new SqlParameter("@selectConfirmFlag", SqlDbType.Int, 4));
list.Add(pNextSelectStepCode);
list.Add(pNextSelectStepOper);
}
if (remindSelect == "1")
{
list.Add(new SqlParameter("@hint_opers", SqlDbType.VarChar, 8000));
list.Add(new SqlParameter("@comfirm_opers", SqlDbType.VarChar, 8000));
}
if (ret)
{
list.Add(new SqlParameter("@backStepCode", SqlDbType.Int, 4));
}
// 追加 Return 参数
list.Add(pReturn);
SqlParameter[] param = list.ToArray();
// 赋值
param[0].Value = sysModel.ModuleCode;
param[1].Value = string.IsNullOrEmpty(stepCode) ? 0 : Convert.ToInt32(stepCode);
param[2].Value = billDocumentId;
param[3].Value = sysModel.UserId;
param[4].Value = sysModel.UserName;
param[5].Value = (accractFlag == "F")
? remarkText
: (IsStepOver ? $"由[{sysModel.UserName}]强制退回,意见:{remarkText}" : remarkText);
param[6].Value = accractFlag;
param[7].Value = ""; // @msg 初始
if (newAudit)
{
param[8].Value = selectConfirmFlag;
param[9].Value = ""; // @nextSelectStepCode 初始
param[10].Value = ""; // @nextSelectStepOper 初始
i += 3;
}
if (remindSelect == "1")
{
param[i].Value = remindOpers;
param[i + 1].Value = confirmOpers;
i += 2;
}
if (ret)
{
param[i].Value = returnd;
}
// 执行
SqlHelper.ExecuteDataSet(CommandType.StoredProcedure, storedName, "bill", param);
// 输出赋值
nextSelectStepCode = pNextSelectStepCode.Value + "";
nextSelectStepOper = pNextSelectStepOper.Value + "";
msgText = pMsg.Value + "";
// 返回存储过程 Return 值(以字符串返回,便于 "1".Equals(...) 判断)
string retCode = (pReturn.Value == null || pReturn.Value == DBNull.Value)
? "0"
: Convert.ToInt32(pReturn.Value).ToString();
return retCode;
}
/// <summary>
@@ -1000,4 +1132,23 @@ namespace Lskj.Business.Impl
/// <para>创建人:</para>
/// <para>创建日期:2023-05-12</para>
/// <para>修改人:</para>
/// <para
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="typeCode">模块编号.</param>
/// <returns>DataRow.</returns>
public static DataRow GetAgencyAuthority(string typeCode)
{
DataTable dtTable = new DataTable();
if (SqlHelper.ExecuteDataTable("select object_id('p_systemPrivilegeAgentTab')").Rows.Count > 0 && int.Parse(SqlHelper.ExecuteScalar("select count(*) from sysobjects where id = object_id('p_systemPrivilegeAgentTab')") + "") > 0)
{
string sqlValue = string.Format("select sourceuser from p_systemPrivilegeAgentTab where modid='{0}' and targetuser='{1}' and starttime<=getdate() and endtime>=getdate() and ban=1", typeCode, ERPInfo.Instance.UserName);
dtTable = SqlHelper.ExecuteDataTable(sqlValue);
}
return dtTable.Rows.Count > 0 ? dtTable.Rows[0] : null;
}
}
}