1576 lines
71 KiB
C#
1576 lines
71 KiB
C#
/******************************
|
|
* 说明:基础档案相关接口
|
|
* 创建人:龚宇超
|
|
* 创建日期:2017-11-08
|
|
* 修改人:
|
|
* 修改日期:
|
|
* 修改备注:
|
|
* 版本:1.0.0.0
|
|
******************************/
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using Lskj.Model;
|
|
using Lskj.Core;
|
|
|
|
namespace Lskj.Business.Impl
|
|
{
|
|
/// <summary>
|
|
/// 基础档案相关接口
|
|
/// </summary>
|
|
public class BaseModuleImpl : BaseImpl
|
|
{
|
|
/// <summary>
|
|
/// <para>说明:是否包含流转步骤</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-08 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="menuCode">基础档案模块编号</param>
|
|
/// <returns><c>true</c> if [has step flow] [the specified menu code]; otherwise, <c>false</c>.</returns>
|
|
/// <exception cref="System.NotImplementedException"></exception>
|
|
public static bool HasStepFlow(string menuCode)
|
|
{
|
|
string sqlValue = "select 1 from p_systemdlltabflow where typeCode=@typeCode";
|
|
return SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@typeCode", menuCode) }).Rows.Count > 0;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:批量保存基础档案</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-08 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="models">The models.</param>
|
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
|
public static bool SaveBaseGridData(List<BaseSaveModel> models, string storedProcedureValue = "0")
|
|
{
|
|
int resultCount = 0;
|
|
string apiMsg = "";
|
|
for (int i = 0; i < models.Count; i++)
|
|
{
|
|
int result = SaveBasePanelData(models[i], storedProcedureValue);
|
|
resultCount += result;
|
|
}
|
|
return resultCount == models.Count;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:批量保存基础档案并返回apiResult</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-08 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="models">The models.</param>
|
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
|
public static bool SaveBaseGridData(List<BaseSaveModel> models, out string apiReturnMsg, string storedProcedureValue = "0")
|
|
{
|
|
int resultCount = 0;
|
|
string apiMsg = "";
|
|
for (int i = 0; i < models.Count; i++)
|
|
{
|
|
ApiHelper apiHelper = null;
|
|
Interface.Api.ActionType actionType = Interface.Api.ActionType.Add;
|
|
switch (models[i].BaseSaveType)
|
|
{
|
|
case SaveType.Add:
|
|
int addresult = SaveBasePanelData(models[i], storedProcedureValue);
|
|
resultCount += addresult;
|
|
if (addresult > 0 && ApiHelper.IsExecEventApi(Interface.Api.OperateEvent.AfterModuleDataChange, models[i].MenuCode, 0))
|
|
{
|
|
apiHelper = new ApiHelper(models[i].MenuCode, models[i].FieldValue, models[i].KeyField, models[i].TableName, 0, models[i].row);
|
|
actionType = Interface.Api.ActionType.Add;
|
|
apiHelper.OnEvent(Interface.Api.OperateEvent.AfterModuleDataChange, actionType);
|
|
apiMsg = apiMsg + apiHelper.apiResutMsg;
|
|
}
|
|
break;
|
|
case SaveType.Update:
|
|
int updateresult = SaveBasePanelData(models[i], storedProcedureValue);
|
|
resultCount += updateresult;
|
|
if (updateresult > 0 && ApiHelper.IsExecEventApi(Interface.Api.OperateEvent.AfterModuleDataChange, models[i].MenuCode, 0))
|
|
{
|
|
apiHelper = new ApiHelper(models[i].MenuCode, models[i].FieldValue, models[i].KeyField, models[i].TableName, 0, models[i].row);
|
|
actionType = Interface.Api.ActionType.Update;
|
|
apiHelper.OnEvent(Interface.Api.OperateEvent.AfterModuleDataChange, actionType);
|
|
apiMsg = apiMsg + apiHelper.apiResutMsg;
|
|
}
|
|
break;
|
|
case SaveType.Delete:
|
|
if (ApiHelper.IsExecEventApi(Interface.Api.OperateEvent.AfterModuleDataDelete, models[i].MenuCode, 0))
|
|
{
|
|
apiHelper = new ApiHelper(models[i].MenuCode, models[i].FieldValue, models[i].KeyField, models[i].TableName, 0, models[i].row);
|
|
actionType = Interface.Api.ActionType.Delete;
|
|
//请求删除数据时先等待返回结果后再进行删除
|
|
apiHelper.OnEvent(Interface.Api.OperateEvent.AfterModuleDataDelete, actionType, false);
|
|
}
|
|
int deleteresult = SaveBasePanelData(models[i], storedProcedureValue);
|
|
resultCount += deleteresult;
|
|
if (deleteresult > 0 && apiHelper != null)
|
|
{
|
|
apiHelper.OnEvent();
|
|
apiMsg = apiMsg + apiHelper.apiResutMsg;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
apiReturnMsg = apiMsg;
|
|
return resultCount == models.Count;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:批量保存基础档案</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-08 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="models">The models.</param>
|
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
|
public static bool SaveBaseGridData(List<BaseSaveModel> models, out string retuenMsg, out string apiResutMsg)
|
|
{
|
|
int resultCount = 0; retuenMsg = "0";
|
|
string apiMsg = "";
|
|
for (int i = 0; i < models.Count; i++)
|
|
{
|
|
int succeeCount = SaveBasePanelData(models[i], out retuenMsg);
|
|
#region 接口推送
|
|
if (succeeCount > 0 && ApiHelper.IsExecEventApi(Interface.Api.OperateEvent.AfterModuleDataChange, models[i].MenuCode, 0) && (models[i].BaseSaveType == SaveType.Add || models[i].BaseSaveType == SaveType.Update))
|
|
{
|
|
ApiHelper apiHelper = new ApiHelper(models[i].MenuCode, models[i].FieldValue, models[i].KeyField, models[i].TableName, 0, models[i].row);
|
|
try
|
|
{
|
|
Interface.Api.ActionType actionType = Interface.Api.ActionType.Add;
|
|
switch (models[i].BaseSaveType)
|
|
{
|
|
case SaveType.Add:
|
|
actionType = Interface.Api.ActionType.Add;
|
|
apiHelper.OnEvent(Interface.Api.OperateEvent.AfterModuleDataChange, actionType);
|
|
break;
|
|
case SaveType.Update:
|
|
actionType = Interface.Api.ActionType.Update;
|
|
apiHelper.OnEvent(Interface.Api.OperateEvent.AfterModuleDataChange, actionType);
|
|
break;
|
|
}
|
|
apiMsg += apiHelper.apiResutMsg;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
apiMsg += string.Format("数据{0}推送失败,原因:{1}\r\n", apiHelper.idValue, ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
resultCount += succeeCount;
|
|
}
|
|
apiResutMsg = apiMsg;
|
|
return resultCount == models.Count;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:删除方案</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-16 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="moduleId">菜单ID</param>
|
|
/// <param name="projectName">Name of the project.</param>
|
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
|
public static bool DeleteProject(string moduleId, string projectName)
|
|
{
|
|
string sqlValue = "delete P_SystemReportProjectTab where ModuleId=@ModuleId and OperatorId=@Userid and ProjectName=@ProjectName";
|
|
return SqlHelper.ExecuteNonQuery(CommandType.Text, sqlValue, new SqlParameter[]
|
|
{
|
|
new SqlParameter("@ModuleId", moduleId),
|
|
new SqlParameter("@Userid",ERPInfo.Instance.UserId),
|
|
new SqlParameter("@ProjectName",projectName)
|
|
}) > 0;
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:打印完成成功后数据业务处理</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-07-05 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns>System.Int32.</returns>
|
|
public static int SavePrintRecord(string tableName, string prefix, string primaryKey, string primaryValue, string modeCode)
|
|
{
|
|
if (primaryValue.Contains(","))
|
|
{
|
|
HashSet<string> hashSet = new HashSet<string>(primaryValue.Split(','));//去重,避免多选时同一条数据记录多次
|
|
foreach (string value in hashSet)
|
|
{
|
|
try
|
|
{
|
|
string sqlValue = string.Format(@"update {0} set {1}printCount=isnull({1}printCount,0)+1,
|
|
{1}printLastTime=getdate(),{1}printLastOper='{4}'
|
|
where {2}='{3}'", tableName, prefix, primaryKey, value, ERPInfo.Instance.UserId);
|
|
int i = SqlHelper.ExecuteNonQuery(sqlValue);
|
|
if (i < 0) return -1;
|
|
string sqlValue2 = string.Format(@"insert into p_systemPrintDetails (typeCode,sourcecode,OperatorId,operatedate,OperType)
|
|
values ('{0}','{1}','{2}','{3}','{4}')", modeCode, value, ERPInfo.Instance.UserId, DateTime.Now, 3);
|
|
SqlHelper.ExecuteNonQuery(sqlValue2);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return -1;
|
|
}
|
|
|
|
}
|
|
return 1;
|
|
}
|
|
else
|
|
{
|
|
|
|
string sqlValue = string.Format(@"update {0} set {1}printCount=isnull({1}printCount,0)+1,
|
|
{1}printLastTime=getdate(),{1}printLastOper='{4}'
|
|
where {2}='{3}'", tableName, prefix, primaryKey, primaryValue, ERPInfo.Instance.UserId);
|
|
int i = SqlHelper.ExecuteNonQuery(sqlValue);
|
|
if (i < 0) return -1;
|
|
string sqlValue2 = string.Format(@"insert into p_systemPrintDetails (typeCode,sourcecode,OperatorId,operatedate,OperType)
|
|
values ('{0}','{1}','{2}','{3}','{4}')", modeCode, primaryValue, ERPInfo.Instance.UserId, DateTime.Now, 3);
|
|
return SqlHelper.ExecuteNonQuery(sqlValue2);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:保存方案</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-15 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="projectName">Name of the project.</param>
|
|
/// <param name="projectValue">The project value.</param>
|
|
/// <param name="menuCode">The menu code.</param>
|
|
/// <returns>0.失败 1.成功 2.方案名称重复</returns>
|
|
public static int SaveProject(string projectName, string projectValue, string menuCode)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(projectName) ||
|
|
string.IsNullOrWhiteSpace(projectValue) ||
|
|
string.IsNullOrWhiteSpace(menuCode))
|
|
return 0;
|
|
|
|
string sqlValue = "select 1 from P_SystemReportProjectTab where ProjectName=@ProjectName and operatorId=@UserId";
|
|
int result = SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@ProjectName", projectName), new SqlParameter("@UserId", ERPInfo.Instance.UserId) }).Rows.Count;
|
|
|
|
if (result > 0) return 2;
|
|
|
|
sqlValue = string.Format(@"insert into P_SystemReportProjectTab(OperatorId,OperateDate,ProjectName,ProjectMode,SearchValue,ModuleId)
|
|
values('{0}',getdate(),'{1}',1,'{2}','{3}')", ERPInfo.Instance.UserId, projectName, projectValue, menuCode);
|
|
return SqlHelper.ExecuteNonQuery(sqlValue);
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:保存图片到数据库中(为了兼容之前版本,后面舍弃.此方式不可取.)</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-25 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="tableName">表明</param>
|
|
/// <param name="fieldName">字段名称</param>
|
|
/// <param name="primaryKey">主键字段.</param>
|
|
/// <param name="primaryValue">主键值.</param>
|
|
/// <param name="buffer">图片字节.</param>
|
|
/// <returns>返回成功1失败0</returns>
|
|
/// <exception cref="System.NotImplementedException"></exception>
|
|
[Obsolete]
|
|
public static int SaveImage(string tableName, string fieldName, string primaryKey, string primaryValue, byte[] buffer)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(tableName) ||
|
|
string.IsNullOrWhiteSpace(fieldName) ||
|
|
string.IsNullOrWhiteSpace(primaryKey) ||
|
|
string.IsNullOrWhiteSpace(primaryValue))
|
|
{
|
|
throw new Exception("parameter is failure.");
|
|
}
|
|
|
|
if (buffer != null && buffer.Length > 0)
|
|
{
|
|
string sqlValue = string.Format("update {0} set {1}=@buffer where {2}='{3}'", tableName, fieldName, primaryKey, primaryValue);
|
|
SqlParameter bufferParam = new SqlParameter("@buffer", SqlDbType.Image);
|
|
bufferParam.Value = buffer;
|
|
return SqlHelper.ExecuteNonQuery(CommandType.Text, sqlValue, new SqlParameter[] { bufferParam });
|
|
}
|
|
else
|
|
{
|
|
string sqlValue = string.Format("update {0} set {1}=NULL where {2}='{3}'", tableName, fieldName, primaryKey, primaryValue);
|
|
return SqlHelper.ExecuteNonQuery(sqlValue);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:批量保存基础档案</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-10 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="tableName">Name of the table.</param>
|
|
/// <param name="parmaryKey">The parmary key.</param>
|
|
/// <param name="records">主键值,多个值用逗号分割</param>
|
|
/// <returns>System.Int32.</returns>
|
|
/// <exception cref="System.NotImplementedException"></exception>
|
|
public static int DeleteBaseGridData(string tableName, string parmaryKey, string records)
|
|
{
|
|
string sqlValue = string.Format("delete from {0} where {1} in ({2})", tableName, parmaryKey, records.Trim(','));
|
|
return SqlHelper.ExecuteNonQuery(sqlValue);
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:保存基础档案</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-08 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="model">The model.</param>
|
|
/// <returns>System.Int32.</returns>
|
|
public static int SaveBasePanelData(BaseSaveModel model, string storedProcedureValue = "0")
|
|
{
|
|
SqlParameter pMsg = ERPInfo.Instance.ChangeParameterType ? new SqlParameter("@msg", SqlDbType.NVarChar, 4000) : new SqlParameter("@msg", SqlDbType.VarChar, 2000);
|
|
pMsg.Direction = ParameterDirection.Output;
|
|
SqlParameter returnValue = new SqlParameter("@return", SqlDbType.Int, 4);
|
|
returnValue.Direction = ParameterDirection.ReturnValue;
|
|
//增加基础档案保存确认,兼容老版本
|
|
SqlParameter[] param1 =
|
|
{
|
|
ERPInfo.Instance.ChangeParameterType ? new SqlParameter("@baseSql",SqlDbType.NVarChar):new SqlParameter("@baseSql",SqlDbType.NText),
|
|
new SqlParameter("@saveType",SqlDbType.Int),
|
|
new SqlParameter("@modid",SqlDbType.VarChar,20),
|
|
new SqlParameter("@tablename",SqlDbType.VarChar,50),
|
|
new SqlParameter("@keyfield",SqlDbType.VarChar,50),
|
|
new SqlParameter("@keyvalue",SqlDbType.VarChar,50),
|
|
new SqlParameter("@Operatorid",SqlDbType.Int),
|
|
ERPInfo.Instance.ChangeParameterType ?new SqlParameter("@operatorName",SqlDbType.NVarChar,100):new SqlParameter("@operatorName",SqlDbType.VarChar,50),
|
|
pMsg,
|
|
returnValue
|
|
};
|
|
|
|
SqlParameter[] param2 =
|
|
{
|
|
ERPInfo.Instance.ChangeParameterType ? new SqlParameter("@baseSql",SqlDbType.NVarChar):new SqlParameter("@baseSql",SqlDbType.NText),
|
|
new SqlParameter("@saveType",SqlDbType.Int),
|
|
new SqlParameter("@modid",SqlDbType.VarChar,20),
|
|
new SqlParameter("@tablename",SqlDbType.VarChar,50),
|
|
new SqlParameter("@keyfield",SqlDbType.VarChar,50),
|
|
new SqlParameter("@keyvalue",SqlDbType.VarChar,50),
|
|
new SqlParameter("@Operatorid",SqlDbType.Int),
|
|
ERPInfo.Instance.ChangeParameterType ?new SqlParameter("@operatorName",SqlDbType.NVarChar,100):new SqlParameter("@operatorName",SqlDbType.VarChar,50),
|
|
pMsg,
|
|
new SqlParameter("@comfirmFlag",SqlDbType.Int),
|
|
returnValue
|
|
};
|
|
|
|
if (storedProcedureValue.Equals("1")) model.ComfirmFlag = 1;
|
|
|
|
SqlParameter[] param = null;
|
|
if (model.ComfirmFlag == 0)
|
|
param = param1;
|
|
else
|
|
param = param2;
|
|
param[0].Value = model.BaseSql;
|
|
param[1].Value = (int)model.BaseSaveType;
|
|
param[2].Value = model.MenuCode;
|
|
param[3].Value = model.TableName;
|
|
param[4].Value = model.KeyField;
|
|
param[5].Value = model.FieldValue;
|
|
param[6].Value = ERPInfo.Instance.UserId;
|
|
param[7].Value = ERPInfo.Instance.UserName;
|
|
if (param.Count() > 10)
|
|
param[9].Value = model.ComfirmFlag;
|
|
|
|
|
|
//SqlParameter[] newParam = new SqlParameter[param.Length + 1];
|
|
|
|
//if (storedProcedureValue.Equals("1"))
|
|
//{
|
|
// bool sureToSave = true;
|
|
// string[] newParameter = new string[] { "@comfirmFlag"};
|
|
// if (isParamComplete(model.NewVer == 0 ? "P_BaseSave" : "p_BaseSave70", newParameter))
|
|
// {
|
|
// for (int i = 0; i < param.Length; i++)
|
|
// {
|
|
// newParam[i] = param[i];
|
|
// }
|
|
// SqlParameter sqlParameter = new SqlParameter("@comfirmFlag", SqlDbType.Int);
|
|
// sqlParameter.Value = "1";
|
|
// newParam[param.Length] = sqlParameter;
|
|
// }
|
|
//}
|
|
|
|
DataSet ds = SqlHelper.ExecuteDataSet(CommandType.StoredProcedure, model.NewVer == 0 ? "P_BaseSave" : "p_BaseSave70", "baseSave", param);
|
|
string rMsg = pMsg.Value.ToString();
|
|
int result = Convert.ToInt32(returnValue.Value + "");
|
|
|
|
if (result==-1)
|
|
{
|
|
if (SqlHelper.ConnectionType == ConnectionType.SqlServer)
|
|
{
|
|
SqlStoredProcedurepPrompt.GenerateBaseSaveProcedureScript(model, storedProcedureValue);
|
|
}
|
|
if (SqlHelper.ConnectionType == ConnectionType.DmServer)
|
|
{
|
|
SqlStoredProcedurepPrompt.GenerateBillSaveScript_DM(SqlHelper.LastFailureSql);
|
|
}
|
|
}
|
|
|
|
model.Success = result == 1;
|
|
model.FaultMsg = rMsg;
|
|
return result;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:保存基础档案</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-08 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="model">The model.</param>
|
|
/// <returns>System.Int32.</returns>
|
|
public static int SaveBasePanelData(BaseSaveModel model, out string retuenMsg)
|
|
{
|
|
SqlParameter pMsg = ERPInfo.Instance.ChangeParameterType ? new SqlParameter("@msg", SqlDbType.NVarChar, 4000) : new SqlParameter("@msg", SqlDbType.VarChar, 2000);
|
|
pMsg.Direction = ParameterDirection.Output;
|
|
SqlParameter returnValue = new SqlParameter("@return", SqlDbType.Int, 4);
|
|
returnValue.Direction = ParameterDirection.ReturnValue;
|
|
//增加基础档案保存确认,兼容老版本
|
|
SqlParameter[] param1 =
|
|
{
|
|
ERPInfo.Instance.ChangeParameterType ? new SqlParameter("@baseSql",SqlDbType.NVarChar):new SqlParameter("@baseSql",SqlDbType.NText),
|
|
new SqlParameter("@saveType",SqlDbType.Int),
|
|
new SqlParameter("@modid",SqlDbType.VarChar,20),
|
|
new SqlParameter("@tablename",SqlDbType.VarChar,50),
|
|
new SqlParameter("@keyfield",SqlDbType.VarChar,50),
|
|
new SqlParameter("@keyvalue",SqlDbType.VarChar,50),
|
|
new SqlParameter("@Operatorid",SqlDbType.Int),
|
|
ERPInfo.Instance.ChangeParameterType ?new SqlParameter("@operatorName",SqlDbType.NVarChar,100):new SqlParameter("@operatorName",SqlDbType.VarChar,50),
|
|
pMsg,
|
|
returnValue
|
|
};
|
|
|
|
SqlParameter[] param2 =
|
|
{
|
|
ERPInfo.Instance.ChangeParameterType ? new SqlParameter("@baseSql",SqlDbType.NVarChar):new SqlParameter("@baseSql",SqlDbType.NText),
|
|
new SqlParameter("@saveType",SqlDbType.Int),
|
|
new SqlParameter("@modid",SqlDbType.VarChar,20),
|
|
new SqlParameter("@tablename",SqlDbType.VarChar,50),
|
|
new SqlParameter("@keyfield",SqlDbType.VarChar,50),
|
|
new SqlParameter("@keyvalue",SqlDbType.VarChar,50),
|
|
new SqlParameter("@Operatorid",SqlDbType.Int),
|
|
ERPInfo.Instance.ChangeParameterType ?new SqlParameter("@operatorName",SqlDbType.NVarChar,100):new SqlParameter("@operatorName",SqlDbType.VarChar,50),
|
|
pMsg,
|
|
new SqlParameter("@comfirmFlag",SqlDbType.Int),
|
|
returnValue
|
|
};
|
|
|
|
SqlParameter[] param = null;
|
|
if (model.ComfirmFlag == 0)
|
|
param = param1;
|
|
else
|
|
param = param2;
|
|
param[0].Value = model.BaseSql;
|
|
param[1].Value = (int)model.BaseSaveType;
|
|
param[2].Value = model.MenuCode;
|
|
param[3].Value = model.TableName;
|
|
param[4].Value = model.KeyField;
|
|
param[5].Value = model.FieldValue;
|
|
param[6].Value = ERPInfo.Instance.UserId;
|
|
param[7].Value = ERPInfo.Instance.UserName;
|
|
if (param.Count() > 10)
|
|
param[9].Value = model.ComfirmFlag;
|
|
DataSet ds = SqlHelper.ExecuteDataSet(CommandType.StoredProcedure, model.NewVer == 0 ? "P_BaseSave" : "p_BaseSave70", "baseSave", param);
|
|
string rMsg = pMsg.Value.ToString();
|
|
|
|
int result = Convert.ToInt32(returnValue.Value + "");
|
|
|
|
if (result == -1)
|
|
{
|
|
if (SqlHelper.ConnectionType == ConnectionType.SqlServer)
|
|
{
|
|
SqlStoredProcedurepPrompt.GenerateSaveBasePanelScript(model);
|
|
}
|
|
if (SqlHelper.ConnectionType == ConnectionType.DmServer)
|
|
{
|
|
SqlStoredProcedurepPrompt.GenerateBillSaveScript_DM(SqlHelper.LastFailureSql);
|
|
}
|
|
}
|
|
|
|
retuenMsg = result + "";
|
|
model.Success = result == 1;
|
|
model.FaultMsg = rMsg;
|
|
return result;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:基础档案提交</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-03-19 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="menuCode">The menu code.</param>
|
|
/// <param name="parmaryKey">The parmary key.</param>
|
|
/// <param name="comfirmType">Type of the comfirm.</param>
|
|
/// <returns>System.Int32.</returns>
|
|
/// <exception cref="System.NotImplementedException"></exception>
|
|
public static int ApplyBaseData(string menuCode, string parmaryKey, int comfirmType, out string tipMsg)
|
|
{
|
|
SqlParameter pMsg = ERPInfo.Instance.ChangeParameterType ? new SqlParameter("@msg", SqlDbType.NVarChar, 4000) : new SqlParameter("@msg", SqlDbType.VarChar, 2000);
|
|
pMsg.Direction = ParameterDirection.InputOutput;
|
|
SqlParameter returnValue = new SqlParameter("@return", SqlDbType.Int, 4);
|
|
returnValue.Direction = ParameterDirection.ReturnValue;
|
|
SqlParameter[] param =
|
|
{
|
|
new SqlParameter("@typeCode",SqlDbType.VarChar,20),
|
|
new SqlParameter("@billDocumentId",SqlDbType.VarChar,40),
|
|
new SqlParameter("@Operatorid",SqlDbType.Int),
|
|
ERPInfo.Instance.ChangeParameterType ?new SqlParameter("@operatorName",SqlDbType.NVarChar,40):new SqlParameter("@operatorName",SqlDbType.VarChar,20),
|
|
new SqlParameter("@comfirmType",SqlDbType.Int),
|
|
pMsg,
|
|
returnValue
|
|
};
|
|
|
|
param[0].Value = menuCode;
|
|
param[1].Value = parmaryKey;
|
|
param[2].Value = ERPInfo.Instance.UserId;
|
|
param[3].Value = ERPInfo.Instance.UserName;
|
|
param[4].Value = 1;
|
|
param[5].Value = "";
|
|
DataSet ds = SqlHelper.ExecuteDataSet(CommandType.StoredProcedure, "p_baseApply", "baseApply", param);
|
|
tipMsg = pMsg.Value + "";
|
|
|
|
|
|
if (Convert.ToInt32(returnValue.Value.ToString()) == -1)
|
|
{
|
|
if (SqlHelper.ConnectionType == ConnectionType.SqlServer)
|
|
{
|
|
SqlStoredProcedurepPrompt.GenerateBaseApplyScript(menuCode, parmaryKey, comfirmType);
|
|
}
|
|
if (SqlHelper.ConnectionType == ConnectionType.DmServer)
|
|
{
|
|
SqlStoredProcedurepPrompt.GenerateBillSaveScript_DM(SqlHelper.LastFailureSql);
|
|
}
|
|
}
|
|
|
|
return Convert.ToInt32(returnValue.Value.ToString());
|
|
}
|
|
/// <summary>
|
|
/// 调用存储过程 p_UpdateRemarkByModule —— 按模块编号修改备注
|
|
/// </summary>
|
|
/// <param name="modid">模块编号(如 “1000101”)</param>
|
|
/// <param name="keyvalue">主键值</param>
|
|
/// <param name="remark">备注内容</param>
|
|
/// <param name="tipMsg">OUTPUT:返回信息</param>
|
|
/// <returns>0=成功;1=未识别模块;9=异常</returns>
|
|
public static int UpdateRemarkByModule(string modid,
|
|
string keyvalue,
|
|
string remark,
|
|
out string tipMsg)
|
|
{
|
|
/* ========== 1. 组织参数 ========== */
|
|
|
|
// 输出消息(NVarChar / VarChar 二选一)
|
|
SqlParameter pMsg = ERPInfo.Instance.ChangeParameterType
|
|
? new SqlParameter("@outmsg", SqlDbType.NVarChar, 4000)
|
|
: new SqlParameter("@outmsg", SqlDbType.VarChar, 4000);
|
|
pMsg.Direction = ParameterDirection.InputOutput;
|
|
|
|
// RETURN
|
|
SqlParameter returnValue = new SqlParameter("@return", SqlDbType.Int)
|
|
{
|
|
Direction = ParameterDirection.ReturnValue
|
|
};
|
|
|
|
SqlParameter[] param =
|
|
{
|
|
new SqlParameter("@modid", SqlDbType.VarChar, 50),
|
|
new SqlParameter("@keyvalue", SqlDbType.VarChar, 100),
|
|
ERPInfo.Instance.ChangeParameterType
|
|
? new SqlParameter("@remark", SqlDbType.NVarChar, 4000)
|
|
: new SqlParameter("@remark", SqlDbType.VarChar, 4000),
|
|
pMsg,
|
|
returnValue
|
|
};
|
|
|
|
param[0].Value = modid;
|
|
param[1].Value = keyvalue;
|
|
param[2].Value = remark ?? string.Empty;
|
|
param[3].Value = string.Empty; // 初始 @outmsg
|
|
|
|
/* ========== 2. 执行存储过程 ========== */
|
|
|
|
SqlHelper.ExecuteNonQuery(
|
|
CommandType.StoredProcedure,
|
|
"p_UpdateRemarkByModule",
|
|
param);
|
|
|
|
/* ========== 3. 返回处理 ========== */
|
|
|
|
tipMsg = pMsg.Value?.ToString() ?? string.Empty;
|
|
return Convert.ToInt32(returnValue.Value);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <para>说明:更新表记录</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-14 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="tableName">表名称</param>
|
|
/// <param name="fieldName">修改的字段</param>
|
|
/// <param name="fieldValue">字段值</param>
|
|
/// <param name="condKey">条件字段</param>
|
|
/// <param name="condValue">条件值</param>
|
|
/// <returns>System.Int32.</returns>
|
|
/// <exception cref="System.NotImplementedException"></exception>
|
|
public static int UpdateRecord(string tableName, string fieldName, string fieldValue, string condKey, string condValue)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(tableName) ||
|
|
string.IsNullOrWhiteSpace(fieldName) ||
|
|
string.IsNullOrWhiteSpace(condKey))
|
|
return 0;
|
|
string sqlValue = string.Format("update {0} set {1}='{2}' where {3}='{4}'", tableName, fieldName, fieldValue, condKey, condValue);
|
|
|
|
return SqlHelper.ExecuteNonQuery(sqlValue);
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:更新表记录,返回受影响行数(无视触发器)</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-14 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="tableName">表名称</param>
|
|
/// <param name="fieldName">修改的字段</param>
|
|
/// <param name="fieldValue">字段值</param>
|
|
/// <param name="condKey">条件字段</param>
|
|
/// <param name="condValue">条件值</param>
|
|
/// <returns>System.Int32.</returns>
|
|
/// <exception cref="System.NotImplementedException"></exception>
|
|
public static int newUpdateRecord(string tableName, string fieldName, string fieldValue, string condKey, string condValue)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(tableName) ||
|
|
string.IsNullOrWhiteSpace(fieldName) ||
|
|
string.IsNullOrWhiteSpace(condKey))
|
|
return 0;
|
|
string sqlValue = string.Format("update {0} set {1}='{2}' where {3}='{4}' select @@ROWCOUNT", tableName, fieldName, fieldValue, condKey, condValue); ;
|
|
DataTable dt = SqlHelper.ExecuteDataTable(sqlValue);
|
|
int numberOfAffectedRows = dt != null && dt.Rows.Count > 0 ? int.Parse(dt.Rows[0][0] + "") : 0;
|
|
return numberOfAffectedRows;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <para>说明:获取左侧书、表格配置字段</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-08 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="menuCode">The menu code.</param>
|
|
/// <returns>System.String.</returns>
|
|
/// <exception cref="System.NotImplementedException"></exception>
|
|
public static string GetBaseLeftField(string menuCode)
|
|
{
|
|
DataRow leftRow = GetBaseLeftTreeField(menuCode);
|
|
return leftRow == null ? string.Empty : leftRow["fieldname"] + "";
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取基础档案左侧树节点编号</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-10-23 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="node">The value.</param>
|
|
/// <param name="tab">The tab.</param>
|
|
/// <returns>System.String.</returns>
|
|
/// <exception cref="System.NotImplementedException"></exception>
|
|
public static string GetBillSeq(string value, string tab)
|
|
{
|
|
string seqNo = string.Empty;
|
|
|
|
SqlParameter param = new SqlParameter("@return_id", SqlDbType.VarChar);
|
|
param.Direction = ParameterDirection.InputOutput;
|
|
|
|
SqlParameter[] parameters ={
|
|
new SqlParameter("@billSeq",SqlDbType.VarChar),
|
|
param
|
|
};
|
|
parameters[0].Value = tab;
|
|
param.Value = value;
|
|
|
|
DataSet ds = SqlHelper.ExecuteDataSet(CommandType.StoredProcedure, "P_create_billdocumentPr", "base", parameters);
|
|
if (ds != null && ds.Tables.Count > 0)
|
|
{
|
|
DataTable dt = ds.Tables[0];
|
|
seqNo = dt.Rows[0][0] + "";
|
|
}
|
|
|
|
return seqNo;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取附件服务器下载地址</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-02-27 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="fileName">Name of the file.</param>
|
|
/// <returns>System.String.</returns>
|
|
/// <exception cref="System.NotImplementedException"></exception>
|
|
public static string GetFileServerPath(string fileName)
|
|
{
|
|
string sqlValue = string.Format("select top 1 dbo.fun_fm_getAbsolutePath(fileId) filePath from P_fm_FileTab where sName like '%{0}%' order by fileId desc", fileName);
|
|
return GetResult(sqlValue) + "";
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取附件服务器地址</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-03-22 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="fileId">The file identifier.</param>
|
|
/// <returns>System.String.</returns>
|
|
public static string GetFileServerPath(int fileId)
|
|
{
|
|
string sqlValue = string.Format("select dbo.fun_fm_getAbsolutePath({0})", fileId);
|
|
return GetResult(sqlValue) + "";
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取表格左侧树字段</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-10-25 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="menuCode">The menu code.</param>
|
|
/// <returns>DataTable.</returns>
|
|
/// <exception cref="System.NotImplementedException"></exception>
|
|
public static DataRow GetBaseLeftTreeField(string menuCode)
|
|
{
|
|
string sqlValue = "select * from P_systemwordbooktab where tab=@tab and fieldsqlTag=3";
|
|
DataTable dtTable = SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@tab", menuCode) });
|
|
|
|
return (dtTable.Rows.Count > 0) ? dtTable.Rows[0] : null;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取添加修改界面控件大小</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-03 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="formKey">The form Key.</param>
|
|
/// <returns>DataRow.</returns>
|
|
public static DataRow GetControlParentSize(string formKey)
|
|
{
|
|
string sqlValue = "select parentHeight height,parentWidth width from p_systemControlParent where formKey=@formKey";
|
|
DataTable dtTable = SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@formKey", formKey) });
|
|
return dtTable.Rows.Count > 0 ? dtTable.Rows[0] : null;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取主信息分组数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-12-21</para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="formKey">键值.</param>
|
|
/// <returns>DataTable.</returns>
|
|
public static DataTable GetAddGroupData(string formKey)
|
|
{
|
|
string field = string.Empty;
|
|
if (HasExistsColumn("p_systemaddgroup", "pageOrder"))
|
|
{
|
|
field = "ORDER BY pageOrder,controlTop asc";
|
|
}
|
|
string sqlValue = @"select * from p_systemaddgroup where formkey=@formkey and controlType=333" + field;
|
|
return SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@formkey", formKey) });
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:获取分割线信息</para>
|
|
/// <para>创建人:曹屹峰</para>
|
|
/// <para>创建日期:2022-2-10</para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="formKey">键值.</param>
|
|
/// <returns>DataTable.</returns>
|
|
public static DataTable GetDividerData(string formKey)
|
|
{
|
|
string field = string.Empty;
|
|
if (HasExistsColumn("p_systemaddgroup", "pageOrder"))
|
|
{
|
|
field = "ORDER BY pageOrder,controlTop asc";
|
|
}
|
|
string sqlValue = @"select * from p_systemaddgroup where formkey=@formkey and controlType=334" + field;
|
|
return SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@formkey", formKey) });
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:获取主信息分页数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-12-21</para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="formKey">键值.</param>
|
|
/// <returns>DataTable.</returns>
|
|
public static DataTable GetAddPageData(string formKey)
|
|
{
|
|
string sqlValue = @"select * from p_systemaddgroup where formkey=@formkey and controlType=332";
|
|
return SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@formkey", formKey) });
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取基础表格显示列数据源</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-03-05</para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="formKey">The form Key.</param>
|
|
/// <returns>DataRow.</returns>
|
|
public static DataTable GetBaseGridField(string menuCode)
|
|
{
|
|
string sqlValue = "select username1 as username ,* from P_systemwordbooktab where tab=@tab and vislble=0";
|
|
return SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@tab", menuCode) });
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:加载固定查询条件</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-09-05 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns>DataTable.</returns>
|
|
public static DataTable GetFixedQueryFields(string menuCode)
|
|
{
|
|
string sqlValue = "select fieldName,username1 fieldText from P_systemwordbooktab where tab=@tab and ifSearch =0 and isnull(username1,'')<>''";
|
|
|
|
return SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@tab", menuCode) });
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:加载自定义配置字段</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-09-13 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="formKey">The form key.</param>
|
|
/// <returns>DataTable.</returns>
|
|
public static DataTable GetCustomQueryFields(string formKey)
|
|
{
|
|
string field = string.Empty;
|
|
|
|
DataTable dataTable = GetTableColumns("p_systembillsourcecond");
|
|
|
|
if (dataTable.Columns.Contains("FontSize"))
|
|
{
|
|
field = ",FontSize";
|
|
}
|
|
if (dataTable.Columns.Contains("FontColor"))
|
|
{
|
|
field += ",FontColor";
|
|
}
|
|
if (dataTable.Columns.Contains("refreshSource"))
|
|
{
|
|
field += ",refreshSource";
|
|
}
|
|
if (dataTable.Columns.Contains("clickAfterEmpty"))
|
|
{
|
|
field += ",clickAfterEmpty";
|
|
}
|
|
if (dataTable.Columns.Contains("RefreshButton"))
|
|
{
|
|
field += ",RefreshButton";
|
|
}
|
|
if (dataTable.Columns.Contains("AddOrderByCond"))
|
|
{
|
|
field += ",AddOrderByCond";
|
|
}
|
|
if (dataTable.Columns.Contains("montage"))
|
|
{
|
|
field += ",montage";
|
|
}
|
|
if (dataTable.Columns.Contains("nullable"))
|
|
{
|
|
field += ",nullable";
|
|
}
|
|
else
|
|
{
|
|
field += ",0 nullable";
|
|
}
|
|
if (dataTable.Columns.Contains("LookUpFieldsWidth"))
|
|
{
|
|
field += ",LookUpFieldsWidth";
|
|
}
|
|
if (dataTable.Columns.Contains("ScanAfterEmpty"))
|
|
{
|
|
field += ",ScanAfterEmpty";
|
|
}
|
|
if (dataTable.Columns.Contains("ImportReturnValue"))
|
|
{
|
|
field += ",ImportReturnValue";
|
|
}
|
|
if (dataTable.Columns.Contains("ImportCurrentValue"))
|
|
{
|
|
field += ",ImportCurrentValue";
|
|
}
|
|
if (dataTable.Columns.Contains("UnionFields"))
|
|
{
|
|
field += ",UnionFields";
|
|
}
|
|
if (dataTable.Columns.Contains("UnionValue"))
|
|
{
|
|
field += ",UnionValue";
|
|
}
|
|
if (dataTable.Columns.Contains("RememberValue"))
|
|
{
|
|
field += ",RememberValue";
|
|
}
|
|
|
|
string sqlValue = string.Format(@"select id,controlLeft,controlTop,controlWidth,controlHeight,controlType as fieldTypeId,controlName as fieldName,controlLabel as userName,'' DataFormat,
|
|
defaultValue,sourceSql as lookupSql,keyField as lookupKeyField,resultField as lookupResult,edited,checkCond,InputHintText{0}
|
|
from p_systembillsourcecond
|
|
where formKey=@formKey", field);
|
|
|
|
return SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@formKey", formKey) });
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:获取高级查询条件模版</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-09-12 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="menuCode">The module id.</param>
|
|
/// <returns>DataRow.</returns>
|
|
/// <exception cref="System.NotImplementedException"></exception>
|
|
public static DataTable GetSchemesList(int moduleId)
|
|
{
|
|
try
|
|
{
|
|
string sqlValue = "select * from P_SystemReportProjectTab where ProjectMode=1 and operatorId=@userid and ModuleId=@moduleId";
|
|
return SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@userid", ERPInfo.Instance.UserId), new SqlParameter("@moduleId", moduleId) });
|
|
}
|
|
catch (Exception)
|
|
{
|
|
|
|
}
|
|
return new DataTable();
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取基础档案表格列</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-09-13 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="menuCode">The menu code.</param>
|
|
/// <returns>DataTable.</returns>
|
|
/// <exception cref="System.NotImplementedException"></exception>
|
|
public static DataTable GetBaseGridColumns(string menuCode)
|
|
{
|
|
SqlParameter[] param =
|
|
{
|
|
new SqlParameter("@modid",SqlDbType.VarChar,20),
|
|
ERPInfo.Instance.ChangeParameterType ?new SqlParameter("@operatorname",SqlDbType.NVarChar,40):new SqlParameter("@operatorname",SqlDbType.VarChar,20)
|
|
};
|
|
param[0].Value = menuCode;
|
|
param[1].Value = ERPInfo.Instance.UserName;
|
|
|
|
DataTable table = SqlHelper.ExecuteDataSet(CommandType.StoredProcedure, "p_getBaseModuleField", "temp", param).Tables[0];
|
|
|
|
if (!table.Columns.Contains("username"))//表格中的列不包含指定列名
|
|
{
|
|
table.Columns["username1"].ColumnName = "username";
|
|
}
|
|
if (!table.Columns.Contains("nullable"))
|
|
{
|
|
table.Columns["tagid"].ColumnName = "nullable";
|
|
}
|
|
|
|
if (!table.Columns.Contains("resultfields") && HasExistsColumn("p_systemwordbooktab", "resultfields"))
|
|
{
|
|
table.Columns.Add("resultfields", typeof(string));
|
|
DataTable resultFieldsTable = SqlHelper.ExecuteDataTable(
|
|
"select id,isnull(resultfields,'') resultfields from p_systemwordbooktab where tab=@modid",
|
|
new SqlParameter[] { new SqlParameter("@modid", menuCode) });
|
|
|
|
Dictionary<string, string> resultFieldsById = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
|
foreach (DataRow row in resultFieldsTable.Rows)
|
|
{
|
|
resultFieldsById[row["id"] + ""] = row["resultfields"] + "";
|
|
}
|
|
foreach (DataRow row in table.Rows)
|
|
{
|
|
string resultFields;
|
|
if (table.Columns.Contains("id") && resultFieldsById.TryGetValue(row["id"] + "", out resultFields))
|
|
{
|
|
row["resultfields"] = resultFields;
|
|
}
|
|
}
|
|
}
|
|
|
|
return table;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取基础档案表格所有列</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-03-07 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="menuCode">The menu code.</param>
|
|
/// <returns>DataTable.</returns>
|
|
public static DataTable GetBaseGridAllColumns(string menuCode)
|
|
{
|
|
string sqlValue = "select fieldname from P_systemwordbooktab where tab=@tab and fieldSqlTag=99";
|
|
|
|
return SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@tab", menuCode) });
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取左侧表格数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-10-26 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="menuCode">The menu code.</param>
|
|
/// <returns>DataTable.</returns>
|
|
public static DataTable GetBaseLeftGridField(string menuCode)
|
|
{
|
|
string field = string.Empty;
|
|
if (HasExistsColumn("p_systemwordbookgrid", "SelectionConditions"))
|
|
{
|
|
field = ",SelectionConditions";
|
|
}
|
|
string sqlValue = string.Format("select id,fieldname,username [sysname],username,case when visible=1 then 0 else width end width,visible,'' dataFormat {0} from p_systemwordbookgrid where fieldid=(select id from P_systemwordbooktab where tab=@tab and fieldsqlTag=3) order by orderid", field);
|
|
return SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@tab", menuCode) });
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:获取右键菜单数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-10-27 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="key">The key.</param>
|
|
/// <param name="type">the type</param>
|
|
/// <returns>DataTable.</returns>
|
|
/// <exception cref="System.NotImplementedException"></exception>
|
|
public static DataTable GetBaseGridRightMenus(string key, ModuleType type = ModuleType.BaseModule)
|
|
{
|
|
string where = string.Empty;
|
|
switch (type)
|
|
{
|
|
case ModuleType.MrpClickBtn:
|
|
if (BaseImpl.HasExistsColumn("P_systempopupmenu", "isMrpClickBtn", "int"))
|
|
{
|
|
where = " and isnull(isMrpClickBtn,0)=1 and visible1=0 ";
|
|
}
|
|
break;
|
|
case ModuleType.BillDetail:
|
|
where = " and isnull(menutype,0)=1 and visible1=0 ";
|
|
break;
|
|
case ModuleType.BillAuditDetail:
|
|
where = " and isnull(menutype,0)=0 and visible2=0 ";
|
|
break;
|
|
case ModuleType.BaseAudit:
|
|
where = " and isnull(menutype,0)=1 and isnull(visible1,0)=0 ";
|
|
break;
|
|
case ModuleType.BaseModuleAdd:
|
|
where = " and isnull(menutype,0)=1";
|
|
break;
|
|
case ModuleType.MESTOOL:
|
|
where = " and isnull(ShowToolBar,0)=1";
|
|
break;
|
|
case ModuleType.MESGRIDRIGHT:
|
|
where = " and isnull(ShowToolBar,0)=0";
|
|
break;
|
|
default:
|
|
where = " and isnull(menutype,0)=0";
|
|
break;
|
|
}
|
|
string sqlValue = string.Format(@"SELECT pm.*
|
|
FROM P_systempopupmenu AS pm WITH (NOLOCK)
|
|
WHERE ISNULL(pm.visible, 0) = 0
|
|
AND pm.tab = @tab {0}
|
|
ORDER BY pm.orderid;", where);
|
|
DataTable rightMenuTable = SqlHelper.ExecuteDataTable(sqlValue,
|
|
new SqlParameter[] { new SqlParameter("@tab", key) });
|
|
|
|
return FilterRowsByOperatorPrivilege(rightMenuTable, "privilegeOper");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据人员或角色权限过滤配置数据,只有存在角色配置时才读取角色表。
|
|
/// </summary>
|
|
internal static DataTable FilterRowsByOperatorPrivilege(DataTable sourceTable, string privilegeField)
|
|
{
|
|
if (sourceTable == null || !sourceTable.Columns.Contains(privilegeField))
|
|
{
|
|
return sourceTable;
|
|
}
|
|
|
|
string operatorName = ERPInfo.Instance.UserName;
|
|
string operatorToken = "," + operatorName + ",";
|
|
List<DataRow> rolePermissionRows = new List<DataRow>();
|
|
HashSet<DataRow> allowedRows = new HashSet<DataRow>();
|
|
foreach (DataRow row in sourceTable.Rows)
|
|
{
|
|
string privilegeOper = row[privilegeField] + "";
|
|
if (string.IsNullOrWhiteSpace(privilegeOper) ||
|
|
("," + privilegeOper + ",").IndexOf(operatorToken, StringComparison.OrdinalIgnoreCase) >= 0)
|
|
{
|
|
allowedRows.Add(row);
|
|
continue;
|
|
}
|
|
|
|
// 只配置人员且当前人员不匹配时,无需读取角色表。
|
|
if (privilegeOper.IndexOf("{&", StringComparison.Ordinal) >= 0 &&
|
|
privilegeOper.IndexOf("&}", StringComparison.Ordinal) >= 0)
|
|
{
|
|
rolePermissionRows.Add(row);
|
|
}
|
|
}
|
|
|
|
if (rolePermissionRows.Count == 0)
|
|
{
|
|
DataTable resultTable = sourceTable.Clone();
|
|
foreach (DataRow row in sourceTable.Rows)
|
|
{
|
|
if (allowedRows.Contains(row)) resultTable.ImportRow(row);
|
|
}
|
|
return resultTable;
|
|
}
|
|
|
|
string roleSql = @"SELECT r.roleName
|
|
FROM p_systemRoleOperSetTab AS ro
|
|
JOIN p_systemRoleSetTab AS r ON r.id = ro.roleId
|
|
WHERE ro.operatorname = @operatorname";
|
|
DataTable roleTable = SqlHelper.ExecuteDataTable(roleSql,
|
|
new SqlParameter[] { new SqlParameter("@operatorname", operatorName) });
|
|
string[] roleTokens = roleTable.Rows.Cast<DataRow>()
|
|
.Select(row => row["roleName"] + "")
|
|
.Where(roleName => !string.IsNullOrWhiteSpace(roleName))
|
|
.Select(roleName => "{&" + roleName + "&}")
|
|
.ToArray();
|
|
|
|
foreach (DataRow row in rolePermissionRows)
|
|
{
|
|
string privilegeOper = row[privilegeField] + "";
|
|
if (roleTokens.Any(token => privilegeOper.IndexOf(token, StringComparison.OrdinalIgnoreCase) >= 0))
|
|
{
|
|
allowedRows.Add(row);
|
|
}
|
|
}
|
|
|
|
DataTable resultTableWithRoles = sourceTable.Clone();
|
|
foreach (DataRow row in sourceTable.Rows)
|
|
{
|
|
if (allowedRows.Contains(row)) resultTableWithRoles.ImportRow(row);
|
|
}
|
|
return resultTableWithRoles;
|
|
}
|
|
/// <summary>
|
|
/// 获取单个右键菜单
|
|
/// </summary>
|
|
/// <param name="key"></param>
|
|
/// <param name="type"></param>
|
|
/// <returns></returns>
|
|
public static DataRow GetBaseGridRightMenuById(string id)
|
|
{
|
|
string sqlValue = $"select * from P_systempopupmenu where id = '{id}'";
|
|
return BaseImpl.GetDataRowResult(sqlValue);
|
|
}
|
|
public static bool IsGridViewRightMenuBtnEdit(string key, ModuleType type = ModuleType.BaseModule)
|
|
{
|
|
DataTable rightMentTab = GetBaseGridRightMenus(key, type);
|
|
bool result = false;
|
|
if (rightMentTab != null)
|
|
{
|
|
foreach (DataRow item in rightMentTab.Rows)
|
|
{
|
|
if (item.Table.Columns.Contains("IcoName") && !string.IsNullOrEmpty(item["IcoName"] + ""))
|
|
{
|
|
result = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
public static bool IsGridViewRightMenuBtnEdit(DataTable rightMentTab)
|
|
{
|
|
bool result = false;
|
|
if (rightMentTab != null)
|
|
{
|
|
foreach (DataRow item in rightMentTab.Rows)
|
|
{
|
|
if ((item.Table.Columns.Contains("IcoName") && !string.IsNullOrEmpty(item["IcoName"] + ""))||(item.Table.Columns.Contains("showtoolbar") && !string.IsNullOrEmpty(item["showtoolbar"] + "")))
|
|
{
|
|
result = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:获取单条右键菜单</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期: </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="rightID">The right identifier.</param>
|
|
/// <returns>DataRow.</returns>
|
|
public static DataRow GetBaseGridRightMenuByID(string rightID)
|
|
{
|
|
string sqlValue = string.Format("select * from P_systempopupmenu where ID='{0}'", rightID);
|
|
return GetDataRowResult(sqlValue);
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-10-27 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="key">The key.</param>
|
|
/// <returns>DataTable.</returns>
|
|
/// <exception cref="System.NotImplementedException"></exception>
|
|
public static DataTable GetBaseGridRowColors(string key)
|
|
{
|
|
string sqlValue = "select * from p_systemwordbookcolor where tab=@tab and isnull(useflag,0)=0 order by orderid";
|
|
return SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@tab", key) });
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取控件位置</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-03 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
///
|
|
/// <param name="formkey">The formkey.</param>
|
|
/// <param name="menuCode">The menuCode.</param>
|
|
/// <returns>DataTable.</returns>
|
|
/// <exception cref="System.NotImplementedException"></exception>
|
|
public static DataTable GetControlLocation(string formKey, string menuCode)
|
|
{
|
|
SqlParameter[] p =
|
|
{
|
|
new SqlParameter("@formkey",SqlDbType.VarChar,200),
|
|
new SqlParameter("@modid",SqlDbType.VarChar,50),
|
|
ERPInfo.Instance.ChangeParameterType ?new SqlParameter("@operatorName",SqlDbType.NVarChar,100):new SqlParameter("@operatorName",SqlDbType.VarChar,50)
|
|
};
|
|
p[0].Value = formKey;
|
|
p[1].Value = menuCode;
|
|
p[2].Value = ERPInfo.Instance.UserName;
|
|
|
|
DataTable table = SqlHelper.ExecuteDataSet(
|
|
CommandType.StoredProcedure,
|
|
"p_getControlLocation",
|
|
"temp",
|
|
p).Tables[0];
|
|
AppendExtendedReturnResultFields(table, menuCode);
|
|
return table;
|
|
}
|
|
|
|
/// <summary>
|
|
/// p_getControlLocation 的旧版本不返回 resultfields。
|
|
/// 仅当窗体包含 173/174 扩展返回控件时按模块补取,普通窗体不增加查询。
|
|
/// </summary>
|
|
private static void AppendExtendedReturnResultFields(DataTable table, string menuCode)
|
|
{
|
|
if (table == null || table.Rows.Count == 0 ||
|
|
!table.Columns.Contains("id") || !table.Columns.Contains("fieldTypeId"))
|
|
{
|
|
return;
|
|
}
|
|
|
|
List<DataRow> extendedRows = new List<DataRow>();
|
|
bool allConfigured = table.Columns.Contains("resultfields");
|
|
foreach (DataRow row in table.Rows)
|
|
{
|
|
int fieldType;
|
|
if (!int.TryParse(row["fieldTypeId"] + "", out fieldType) ||
|
|
(fieldType != 173 && fieldType != 174))
|
|
{
|
|
continue;
|
|
}
|
|
|
|
extendedRows.Add(row);
|
|
if (!table.Columns.Contains("resultfields") ||
|
|
string.IsNullOrWhiteSpace(row["resultfields"] + ""))
|
|
{
|
|
allConfigured = false;
|
|
}
|
|
}
|
|
|
|
if (extendedRows.Count == 0 || allConfigured) return;
|
|
if (!HasExistsColumn("p_systemwordbooktab", "resultfields")) return;
|
|
|
|
if (!table.Columns.Contains("resultfields"))
|
|
{
|
|
table.Columns.Add("resultfields", typeof(string));
|
|
}
|
|
|
|
DataTable resultFieldsTable = SqlHelper.ExecuteDataTable(
|
|
"select id,isnull(resultfields,'') resultfields " +
|
|
"from p_systemwordbooktab where tab=@modid",
|
|
new SqlParameter[] { new SqlParameter("@modid", menuCode) });
|
|
Dictionary<string, string> resultFieldsById =
|
|
new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
|
foreach (DataRow row in resultFieldsTable.Rows)
|
|
{
|
|
resultFieldsById[row["id"] + ""] = row["resultfields"] + "";
|
|
}
|
|
|
|
foreach (DataRow row in extendedRows)
|
|
{
|
|
string resultFields;
|
|
if (resultFieldsById.TryGetValue(row["id"] + "", out resultFields))
|
|
{
|
|
row["resultfields"] = resultFields;
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取添加界面多标签</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-10 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="menuCode">The menu code.</param>
|
|
/// <returns>DataTable.</returns>
|
|
/// <exception cref="System.NotImplementedException"></exception>
|
|
public static DataTable GetBaseAddTabDetail(string menuCode)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(menuCode))
|
|
return new DataTable();
|
|
|
|
string cond = HasExistsColumn("p_systemdlltabdetail", "addvisible") ? " and isnull(addvisible,0)=1 " : " and isnull(isVisible,0)=0 ";
|
|
cond += HasExistsColumn("p_systemdlltabdetail", "privilegeOper") ? string.Format(" and ( isnull(privilegeOper,'')='' or CHARINDEX(',{0},',','+privilegeOper+',')>0 )", ERPInfo.Instance.UserName) : "";
|
|
|
|
string sqlValue = "select * from p_systemDlltabDetail where tab=@tab " + cond + " order by orderId";
|
|
return SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@tab", menuCode) });
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取基础档案底部标签数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-21 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="menuCode">The menu code.</param>
|
|
/// <returns>DataTable.</returns>
|
|
/// <exception cref="System.NotImplementedException"></exception>
|
|
public static DataTable GetBaseDetailPages(string menuCode)
|
|
{
|
|
try
|
|
{
|
|
string sqlValue = @"SELECT pm.*
|
|
FROM p_systemDlltabDetail AS pm WITH (NOLOCK)
|
|
WHERE ISNULL(pm.isvisible, 0) = 0
|
|
AND pm.tab = @tab
|
|
ORDER BY pm.orderid;";
|
|
DataTable detailPageTable = SqlHelper.ExecuteDataTable(sqlValue,
|
|
new SqlParameter[] { new SqlParameter("@tab", menuCode) });
|
|
return FilterRowsByOperatorPrivilege(detailPageTable, "privilegeOper");
|
|
}
|
|
catch (Exception)
|
|
{
|
|
string sqlValue = "select * from p_systemDlltabDetail where tab=@tab and ISNULL(isVisible,0)=0 order by orderid";
|
|
return SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@tab", menuCode) });
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取图表配置数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-29 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="formKey">The form key.</param>
|
|
/// <returns>DataTable.</returns>
|
|
/// <exception cref="System.NotImplementedException"></exception>
|
|
public static DataTable GetChartParams(string formKey)
|
|
{
|
|
string sqlValue = "select * from p_systemdlltabchart where tabkey=@formKey and isVisible=0";
|
|
|
|
return SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@formKey", formKey) });
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取基础档案附加信息</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-11-12 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="menuCode">The menu code.</param>
|
|
/// <returns>DataTable.</returns>
|
|
public static DataTable GetBaseAttach(string menuCode)
|
|
{
|
|
string sqlValue = string.Format(@"select * from p_SystemdllTabAttach where tab='{0}' and ISNULL(isVisible,0)=0 order by orderid", menuCode);
|
|
return GetDataTableResult(sqlValue);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取基础档案附加信息,用formKey查询
|
|
/// </summary>
|
|
/// <param name="tabKey"></param>
|
|
/// <returns></returns>
|
|
public static DataTable GetBaseAttachKey(string tabKey)
|
|
{
|
|
string sqlValue = string.Format(@"select * from p_SystemdllTabAttach where tabKey='{0}' and ISNULL(isVisible,0)=0 order by orderid", tabKey);
|
|
return GetDataTableResult(sqlValue);
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <para>说明:判断存储过程参数方法</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2020-11-18</para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="confirmId">确认权限Id</param>
|
|
/// <param name="operatorId">用户Id</param>
|
|
/// <param name="comfirmAdvice">确认意见.</param>
|
|
/// <returns>System.Int32.</returns>
|
|
public static bool isParamComplete(string storedName, string[] Param)
|
|
{
|
|
string whereConfig = string.Empty;
|
|
for (int i = 0; i < Param.Length; i++)
|
|
{
|
|
whereConfig += string.Format(" LOWER(PARAMETER_NAME)=LOWER('{0}') or", Param[i]);
|
|
}
|
|
string sql = string.Format("SELECT PARAMETER_NAME AS [参数名称] FROM INFORMATION_SCHEMA.PARAMETERS WHERE SPECIFIC_NAME='{1}' and ({0})", whereConfig.Substring(0, whereConfig.Length - 2), storedName);
|
|
return SqlHelper.ExecuteDataTable(sql).Rows.Count == Param.Length;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 创建只读列
|
|
/// </summary>
|
|
/// <param name="key"></param>
|
|
/// <returns></returns>
|
|
public static DataTable getDetail_Details(string key)
|
|
{
|
|
string sql = string.Format("select * from p_systembillsourcedetail where sourceid=0 and sourcekey='{0}' and mxflag=1 and isnull(isVisible,0)=0 order by orderid", key);
|
|
return GetDataTableResult(sql);
|
|
}
|
|
|
|
|
|
//保存条件表
|
|
public static DataTable GetClientCond(string MenuCode)
|
|
{
|
|
if (BaseImpl.HasExistsTable("P_SystemClientCondTab"))
|
|
{
|
|
string sqlValue = string.Format(@"select * from P_SystemClientCondTab where tab='{0}' and disableflag=0 order by orderid ", MenuCode);
|
|
return GetDataTableResult(sqlValue);
|
|
}
|
|
return new DataTable();
|
|
}
|
|
|
|
}
|
|
}
|