feat: 更新业务、控件及单据功能

This commit is contained in:
cyf
2026-08-10 09:59:46 +08:00
parent c07220bbf0
commit 000a69ce15
29 changed files with 919 additions and 359 deletions
+23 -19
View File
@@ -677,33 +677,37 @@ namespace Lskj.Business.Impl
conditions = "and isnull(mxflag,0)=0";
}
string cond = !string.IsNullOrEmpty(sourceCond) ? string.Format(" and id in ({0})", sourceCond.Trim(',')) : string.Empty;
string sqlValue = string.Format(@"WITH UserRoles AS (
SELECT r.roleName
FROM p_systemRoleOperSetTab AS ro
JOIN p_systemRoleSetTab AS r ON r.id = ro.roleId
WHERE ro.operatorname = '{0}'
)
select * from p_systembillsource where typeCode=@typeCode" + cond +
@" and isnull(isVisible,0)=0 and (isnull(viewOper,'')='' or CHARINDEX(',' + '{0}' + ',', ',' + viewOper + ',')>0 OR EXISTS (
SELECT 1 FROM UserRoles AS ur WHERE CHARINDEX('{{&' + ur.roleName + '&}}', viewOper) > 0)) order by orderid", ERPInfo.Instance.UserName);
string sqlDetail = string.Format(@"WITH UserRoles AS (
SELECT r.roleName
FROM p_systemRoleOperSetTab AS ro
JOIN p_systemRoleSetTab AS r ON r.id = ro.roleId
WHERE ro.operatorname = '{1}'
)
SELECT id,sourceId,fieldName,sysName,userName,orderid,isVisible,sourceKey,privilegeView,DataFormat,isSum,ifmerge,{2}
string sqlValue = @"select * from p_systembillsource
where typeCode=@typeCode" + cond + @"
and isnull(isVisible,0)=0
order by orderid";
DataTable sourceTable = SqlHelper.ExecuteDataTable(sqlValue,
new SqlParameter[] { new SqlParameter("@typeCode", menuCode) });
sourceTable = BaseModuleImpl.FilterRowsByOperatorPrivilege(sourceTable, "viewOper");
htTable["master"] = sourceTable;
string sqlDetail = string.Format(@"SELECT id,sourceId,fieldName,sysName,userName,orderid,isVisible,sourceKey,privilegeView,DataFormat,isSum,ifmerge,{2}
isnull(CASE WHEN isVisible=1 OR (ISNULL(b.userList,'')='' AND ISNULL(a.PrivilegeView,'')<>'') THEN 0 ELSE width END,0) width
FROM p_systembillsourcedetail a
LEFT JOIN (
SELECT userList,privTypeId from p_systemPrivilege b where modId = '{0}'
AND CHARINDEX(',' + '{1}' + ',', ',' + userList + ',') > 0
) b on CHARINDEX(',' + CAST(b.privTypeId AS VARCHAR(5)) + ',',',' + PrivilegeView + ',') > 0
where sourceId in (select id from p_systembillsource where typeCode=@typeCode" + cond + @" and isnull(isVisible,0)=0 and (isnull(viewOper,'')='' or CHARINDEX(',' + '{1}' + ',', ',' + viewOper + ',')>0) OR EXISTS (
SELECT 1 FROM UserRoles AS ur WHERE CHARINDEX('{{&' + ur.roleName + '&}}', viewOper) > 0)) {3} ", menuCode, ERPInfo.Instance.UserName, otherfield, conditions);
htTable["master"] = SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@typeCode", menuCode) });
where sourceId in (select id from p_systembillsource where typeCode=@typeCode" + cond + @" and isnull(isVisible,0)=0) {3} ", menuCode, ERPInfo.Instance.UserName, otherfield, conditions);
DataTable detailTable= SqlHelper.ExecuteDataTable(sqlDetail, new SqlParameter[] { new SqlParameter("@typeCode", menuCode) });
HashSet<string> sourceIds = new HashSet<string>(
sourceTable.Rows.Cast<DataRow>().Select(row => row["id"] + ""));
if (detailTable != null && detailTable.Rows.Count > 0)
{
DataTable allowedDetailTable = detailTable.Clone();
foreach (DataRow row in detailTable.Rows)
{
if (sourceIds.Contains(row["sourceId"] + "")) allowedDetailTable.ImportRow(row);
}
detailTable = allowedDetailTable;
}
// order by sourceId,orderid 数据库不排序,在表格中排序(解决慢查询)
if (detailTable != null && detailTable.Rows.Count > 0)
{