//add by chr //获取系统所有仓库信息 public static PageData GetSystemStorehouseList(int iPageSize, int iCurPage, string sOrgId, string sName) { //构建查询条件 Parameter parameter = new Parameter(); parameter.SqlString = "SELECT [PT_ORG].[Id],[PT_ORG2].[FatherId] AS [OrgId],[PT_ORG].[LevelId],[PT_ORG].[OrgName], [PT_ORG3].[OrgName] AS [FOrgName] ,CONVERT(BIT,[PT_ORG].[StateId]) AS [StateId] " + "FROM [PT_ORG] " + "LEFT JOIN [PT_ORG] AS [PT_ORG2] ON [PT_ORG2].Id = [PT_ORG].[FatherId] " + "LEFT JOIN [PT_ORG] AS [PT_ORG3] ON [PT_ORG3].Id = [PT_ORG2].[FatherId] " + "WHERE [PT_ORG].[FatherId] IN " + "(SELECT [Id] FROM [PT_ORG] WHERE [OrgName]='仓库')"; if (sOrgId.Trim() != "") { parameter.SqlString += " AND [PT_ORG3].[Id] = " + sOrgId + " "; } if (sName.Trim() != "") { parameter.SqlString += " AND [PT_ORG].[OrgName] LIKE '%" + sName + "%' "; } return(CommonToolsBLL.GetPageListByParams(iPageSize, iCurPage, parameter)); }
//add by chr //根据餐厅组织机构Id获取餐厅的所有仓库信息 public static PageData GetRestaurantStorehouseListByOrgId(int iOrgId, int iPageSize, int iCurPage, string sName) { //构建查询条件 Parameter parameter = new Parameter(); parameter.SqlString = "SELECT [PT_ORG].[Id],[PT_ORG].[FatherId],[PT_ORG].[LevelId],[PT_ORG].[OrgName],CONVERT(BIT,[PT_ORG].[StateId]) AS [StateId] " + "FROM [PT_ORG] " + "WHERE [PT_ORG].[FatherId] IN " + "(SELECT [Id] FROM [PT_ORG] WHERE [FatherId]=@OrgId AND [OrgName]='仓库')"; if (sName.Trim() != "") { parameter.SqlString += " AND [PT_ORG].[OrgName] LIKE '%" + sName + "%' "; } SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@OrgId", SqlDbType.Int, 50) { Value = iOrgId } }; parameter.Parameters = parameters; return(CommonToolsBLL.GetPageListByParams(iPageSize, iCurPage, parameter)); }