Initial_commit_SecMPS_v2

This commit is contained in:
2026-05-15 23:22:48 +08:00
commit 23ea4fe05f
13830 changed files with 298675 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VolPro.Core.Print
{
/// <summary>
/// 自定义字段某些字段不在当前表可以预先自定义字段在PrintCustom类QueryResult字自定义返回这些字段的值
/// </summary>
public class CustomField
{
/// <summary>
/// 列显示名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 字段
/// </summary>
public string Field { get; set; }
}
}

View File

@@ -0,0 +1,436 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using VolPro.Core.DBManager;
using VolPro.Core.DbSqlSugar;
using VolPro.Core.Extensions;
using VolPro.Core.Infrastructure;
using VolPro.Core.ManageUser;
using VolPro.Core.WorkFlow;
using VolPro.Entity.DomainModels;
namespace VolPro.Core.Print
{
public class PrintContainer
{
public static List<PrintOptions> _print = new List<PrintOptions>();
private static PrintContainer _instance;
public static PrintContainer Instance
{
get
{
if (_instance != null)
{
return _instance;
}
_instance = new PrintContainer();
return _instance;
}
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="name">打印分类的名称</param>
/// <param name="printFields">可以打印的字段</param>
/// <param name=""></param>
/// <returns></returns>
public PrintContainer Use<T>(string name, [NotNull] Expression<Func<T, object>> printFields, List<CustomField> customFields = null)
{
if (_print.Any(x => x.TableType == typeof(T)))
{
return Instance;
}
Type type = typeof(T);
_print.Add(new PrintOptions()
{
TableType = type,
Name = name ?? type.GetEntityTableCnName(),
TableName = type.Name,
Fields = printFields.GetExpressionProperty(),
CustomFields = customFields
});
return Instance;
}
public PrintContainer Use<T, Detail>(
string name,
[NotNull] Expression<Func<T, object>> printFields,
List<CustomField> customFields,
string detailName,
[NotNull] Expression<Func<Detail, object>> detailPrintFields,
List<CustomField> detailCustomFields = null) where Detail : class
{
return Use(name, printFields, customFields, detail: new PrintDetailOptions<Detail>()
{
Name = detailName,
PrintFields = detailPrintFields,
CustomFields = detailCustomFields
});
}
/// <summary>
///
/// </summary>
/// <typeparam name="T">打印的主表</typeparam>
/// <typeparam name="Detail">打印的明细表</typeparam>
/// <param name="name">打印分类的名称</param>
/// <param name="printFields">可以打印的字段</param>
/// <param name="detailName">打印的明细表名称</param>
/// <param name="printFields">可以打印的明细表字段</param>
/// <param name=""></param>
/// <returns></returns>
public PrintContainer Use<T, Detail>(string name,
[NotNull] Expression<Func<T, object>> printFields,
string detailName,
[NotNull] Expression<Func<Detail, object>> detailPrintFields
) where Detail : class
{
return Instance.Use(name, printFields, null, detailName, detailPrintFields);
}
public PrintContainer Use<T, Detail>(string name,
[NotNull] Expression<Func<T, object>> printFields,
List<CustomField> customFields,
[NotNull] PrintDetailOptions<Detail> detail
) where Detail : class
{
return Instance.Use<T, Detail, Detail>(name, printFields, customFields, detail, null);
}
public PrintContainer Use<T, Detail1, Detail2>(string name,
[NotNull] Expression<Func<T, object>> printFields,
List<CustomField> customFields,
[NotNull] PrintDetailOptions<Detail1> detail1,
PrintDetailOptions<Detail2> detail2
) where Detail1 : class where Detail2 : class
{
return Instance.Use<T, Detail1, Detail2, Detail2>(name, printFields, customFields, detail1, detail2, null);
}
public PrintContainer Use<T, Detail1, Detail2, Detail3>(string name,
[NotNull] Expression<Func<T, object>> printFields,
List<CustomField> customFields,
[NotNull] PrintDetailOptions<Detail1> detail1,
PrintDetailOptions<Detail2> detail2,
PrintDetailOptions<Detail3> detail3
) where Detail1 : class where Detail2 : class where Detail3 : class
{
if (_print.Any(x => x.TableType == typeof(T)))
{
return Instance;
}
Type type = typeof(T);
var PrintDetails = new List<PrintDetail>();
if (detail1 != null)
{
PrintDetails.Add(GetPrintDetail(detail1));
}
if (detail2 != null)
{
PrintDetails.Add(GetPrintDetail(detail2));
}
if (detail3 != null)
{
PrintDetails.Add(GetPrintDetail(detail3));
}
_print.Add(new PrintOptions()
{
TableType = type,
Name = name ?? type.GetEntityTableCnName(),
TableName = type.Name,
Fields = printFields.GetExpressionProperty(),
CustomFields = customFields,
PrintDetails = PrintDetails
});
return Instance;
}
private PrintDetail GetPrintDetail<T>(PrintDetailOptions<T> detail) where T : class
{
return new PrintDetail()
{
DetailTableType = typeof(T),
DetailName = detail.Name ?? typeof(T).GetEntityTableCnName(),
DetailTableName = typeof(T).Name,
DetailFields = detail.PrintFields.GetExpressionProperty(),
CustomgFields = detail.CustomFields
};
}
/// <summary>
/// 获取下拉框数据源
/// </summary>
/// <returns></returns>
public static object GetSelect()
{
//只显示有权限的表
var permissions = UserContext.Current.Permissions;
return _print
.Where(x => permissions.Any(c => c.TableName == x.TableName.ToLower()))
.Select(s => new { key = s.TableName, value = s.Name }).ToList();
}
/// <summary>
/// 获取下拉框数据源
/// </summary>
/// <returns></returns>
public static object GetOptions(string table)
{
//只显示有权限的表
var permissions = UserContext.Current.Permissions;
var query = _print
.Where(x => permissions.Any(c => c.TableName == x.TableName.ToLower()));
if (!string.IsNullOrEmpty(table))
{
query = query.Where(x => x.TableName == table);
}
// .GroupBy(c=>new { c.TableName})
var data = query.Select(s => new
{
s.TableName,
s.Name,
Fields = s.Fields.Select(x => x).ToList(),//.Union((s.CustomFields?.Select(s=>s.Field)??new List<string>()).ToList()).ToList(),
details = (s.PrintDetails ?? new List<PrintDetail>())
//.Select(c=>c.DetailFields)
//s.DetailName,
//s.DetailTableName,
//DetailFields = (s.DetailFields ?? new string[] { }).Select(x => x).ToList().Union((s.DetailCustomgFields?.Select(s => s.Field) ?? new List<string>()).ToList()).ToList(),
}).ToList();
var tables = data.Select(s => s.TableName).ToList();
//明细表配置
var detailTableNames = data.SelectMany(x => x.details.Select(c => c.DetailTableName)).Where(x => x != null);
tables.AddRange(detailTableNames);
var tableOptions = DBServerProvider.DbContext.Set<Sys_TableColumn>().Where(x => tables.Contains(x.TableName))
.OrderByDescending(x => x.OrderNo)
.Select(s => new { s.TableName, name = s.ColumnCnName, width = s.ColumnWidth, field = s.ColumnName, s.EditType, s.DropNo, TableType = s.IsImage })
.ToList();
var options = data.Select(s => new
{
s.TableName,
s.Name,
Fields = tableOptions.Where(c => c.TableName == s.TableName && s.Fields.Contains(c.field)).ToList(),
//明细表
TemplateDetails = s.details.Select(c => new
{
c.DetailName,
c.DetailTableName,
DetailFields = tableOptions.Where(x => x.TableName == c.DetailTableName && c.DetailFields.Contains(x.field))
.Select(s => new { s.field, s.name, TableType = s.TableType ?? -1 }).ToList()
.Union((c.CustomgFields ?? new List<CustomField>()).Select(s => new { field = s.Field, name = s.Name, TableType = -1 }))
})
}).ToList();
return options;
}
public static async Task<object> GetPrintDataAsync(PrintQuery query)
{
var ops = _print.Where(x => x.TableName == query.Table).FirstOrDefault();
//if ((query.Detail || query.BatchMainAndDetail) && ops.DetailTableType == null)
//{
// throw new Exception($"startup里面必须配置[{ops.TableName}]的明细表");
//}
query.TemplateName = await DBServerProvider.DbContext.Set<Sys_PrintOptions>()
.Where(x => x.PrintOptionsId == query.TemplateId)
.Select(ops => ops.CustomName).FirstOrDefaultAsync();
var list = typeof(PrintContainer).GetMethod("GetDataAsync")
.MakeGenericMethod(new Type[] { ops.TableType })
.Invoke(null, new object[] { query.Ids, query.Table, ops.Fields.Select(x => x).ToList(), ops.PrintDetails, query, ops }) as Task<object>;
return await list;
}
/// <summary>
/// 获取明细表配置
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="ids"></param>
/// <param name="table"></param>
/// <param name="fields"></param>
/// <param name="printDetails"></param>
/// <param name="parms"></param>
/// <param name="ops"></param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
public static async Task<object> GetDataAsync<T>(object[] ids, string table, List<string> fields, List<PrintDetail> printDetails, PrintQuery parms, PrintOptions ops)
where T : class,new() //where Detail : class
{
if (ids == null || ids.Length == 0)
{
return new List<Dictionary<string, object>>();
}
string key = typeof(T).GetKeyName();
if (parms.Detail || (printDetails?.Count > 0))
{
fields.Add(key);
}
//else if (parms.BatchMainAndDetail || parms.BatchMain)
//{
//}
//else
//{
// //不是批量打印的,默认只查第一条
// ids = new object[] { ids[0] };
//}
PrintFilter filter = new PrintCustom();
var express = key.CreateExpression<T>(ids, Enums.LinqExpressionType.In);
var dbContext = DBServerProvider.GetEntityDbContext<T>();
var queryable = dbContext.Set<T>().Where(express);
queryable = filter.Query(queryable, parms);
var entities = await queryable.ToListAsync();
//主表数据
List<Dictionary<string, object>> list = await ConvertListAsync(entities, ids, table, fields, parms);
if (printDetails == null)
{
printDetails = new List<PrintDetail>();
}
foreach (var mainData in list)
{
//获取明细表
foreach (var detail in printDetails)
{
var pro = detail.DetailTableType.GetProperty(key);
if (pro == null)
{
throw new Exception($"明细表必须包括主表字段[{key}]");
}
//var detailExpress = key.CreateExpression<Detail>(ids, Enums.LinqExpressionType.In);
//var detailQueryable = DBServerProvider.GetEFDbContext<Detail>().Set<Detail>().Where(detailExpress);
//detailQueryable = filter.QueryDetail(detailQueryable, parms);
//var detailEntities = await detailQueryable.ToListAsync();
fields = detail.DetailFields.ToList();
fields.Add(key);
//var detailList = await ConvertListAsync(detailEntities, ids, detail.DetailTableName, fields, parms);
var obj = typeof(PrintContainer).GetMethod("GetDetailDataAsync")
.MakeGenericMethod(new Type[] { detail.DetailTableType })
.Invoke(null, new object[] { key, ids, fields, parms });
var detailList = await (obj as Task<List<Dictionary<string, object>>>);
string keyValue = mainData[key].ToString();
List<Dictionary<string, object>> detailDic = new List<Dictionary<string, object>>(); ;
foreach (var detailItem in detailList)
{
if (detailItem[key].ToString() == keyValue)
{
detailDic.Add(detailItem);
}
}
mainData[detail.DetailTableName] = detailDic;
}
}
list = filter.QueryResult<T>(list, parms, dbContext);
return list;
}
public static async Task<List<Dictionary<string, object>>> GetDetailDataAsync<Detail>(string key, object[] ids, List<string> fields, PrintQuery parms)
where Detail : class, new()
{
PrintFilter filter = new PrintCustom();
var detailExpress = key.CreateExpression<Detail>(ids, Enums.LinqExpressionType.In);
var detailQueryable = DBServerProvider.GetEntityDbContext<Detail>().Set<Detail>(true).Where(detailExpress);
detailQueryable = filter.QueryDetail(detailQueryable, parms);
var detailEntities = await detailQueryable.ToListAsync();
var data = await ConvertListAsync(detailEntities, ids, typeof(Detail).Name, fields, parms);
return data;
}
private static async Task<List<Dictionary<string, object>>> ConvertListAsync<T>(List<T> entities, object[] ids, string table, List<string> fields, PrintQuery query)
{
var columns = await DBServerProvider.DbContext.Set<Sys_TableColumn>().Where(c => c.TableName == table).ToListAsync();
var tableOptions = columns.Where(c => fields.Contains(c.ColumnName)).
Select(s => new { s.ColumnName, s.ColumnCnName, s.DropNo, s.ColumnType, isDate = s.IsImage == 4 || s.EditType == "date" });
List<Sys_Dictionary> dictionaries = new List<Sys_Dictionary>();
var dicNos = tableOptions.Select(s => s.DropNo).ToList();
if (dicNos.Count > 0)
{
dictionaries = DictionaryManager.GetDictionaries(dicNos, true).ToList();
}
List<Dictionary<string, object>> list = new List<Dictionary<string, object>>();
var properties = typeof(T).GetProperties();
foreach (var data in entities)
{
Dictionary<string, object> item = new Dictionary<string, object>();
foreach (var field in fields)
{
var property = properties.Where(c => c.Name == field).FirstOrDefault();
var option = tableOptions.Where(c => c.ColumnName == field).FirstOrDefault();
string value = null;
if (option.ColumnType == "decimal")
{
var deciVal = property.GetValue(data);
if (deciVal != null)
{
value = ((decimal)deciVal).ToString("G29");
}
}
else
{
value = property.GetValue(data)?.ToString();
}
string name = option?.ColumnCnName;
if (string.IsNullOrEmpty(name))
{
name = property.GetDisplayName();
}
if (option == null || string.IsNullOrEmpty(value))
{
item[property.Name] = value = value ?? "";
continue;
}
if (option.isDate)
{
value = value.GetDateTime().Value.ToString("yyyy-MM-dd");
}
else if (!string.IsNullOrEmpty(option.DropNo))
{
string val = dictionaries.Where(c => c.DicNo == option.DropNo).FirstOrDefault()
?.Sys_DictionaryList
//这里多选的暂时没处理
?.Where(c => c.DicValue == value)?.Select(s => s.DicName)
.FirstOrDefault();
if (!string.IsNullOrEmpty(val))
{
value = val;
}
}
item[property.Name] = value;
}
list.Add(item);
}
return list;
}
}
}

View File

@@ -0,0 +1,265 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Hosting;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using Quartz.Impl.AdoJobStore.Common;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VolPro.Core.DBManager;
using VolPro.Core.DbSqlSugar;
using VolPro.Core.EFDbContext;
using VolPro.Core.Extensions;
using VolPro.Entity.DomainModels;
namespace VolPro.Core.Print
{
public class PrintCustom : PrintFilter
{
public PrintCustom() { }
/// <summary>
/// 主表查询
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="query"></param>
/// <param name="parms"></param>
/// <returns></returns>
public override ISugarQueryable<T> Query<T>(ISugarQueryable<T> query, PrintQuery parms) where T : class
{
//判断是哪张主表自定义过滤条件
if (typeof(T).Name == typeof(Demo_Order).Name)
{
var orderQuery = ((ISugarQueryable<Demo_Order>)query);
return orderQuery
//这里where可以写自定义条件
.Where(x => true) as ISugarQueryable<T>;
}
return query;
}
/// <summary>
/// 明细表查询
/// </summary>
/// <typeparam name="Detail"></typeparam>
/// <param name="query"></param>
/// <param name="parms"></param>
/// <returns></returns>
public override ISugarQueryable<Detail> QueryDetail<Detail>(ISugarQueryable<Detail> query, PrintQuery parms) where Detail : class
{
//判断是哪张明细表自定义过滤条件
if (typeof(Detail).Name == typeof(Demo_OrderList).Name)
{
var orderQuery = ((ISugarQueryable<Demo_OrderList>)query);
return orderQuery
//这里where可以写自定义条件
.Where(x => true) as ISugarQueryable<Detail>;
}
return query;
}
/// <summary>
/// 对返回的结果自定义处理
/// </summary>
/// <typeparam name="T"></typeparam>
/// <typeparam name="Detail"></typeparam>
/// <param name="result"></param>
/// <param name="parms"></param>
/// <returns></returns>
public override List<Dictionary<string, object>> QueryResult<T>(
List<Dictionary<string, object>> result,
PrintQuery parms,
BaseDbContext dbContext)
{
if (result.Count == 0) return result;
//判断表,自定义返回数据
if (typeof(T).Name == typeof(Demo_Order).Name)
{
//判断是哪个打印模板,然后自定义返回数据
if (parms.TemplateName == "订单管理主从明细表打印")
{
//返回DemoOrder表自定义配置
SetDemoOrderValue(result, parms, dbContext);
}
}
//告警统计数据
if (typeof(T).Name == typeof(Warehouse_Alert).Name)
{
//日报打印模板处理
if (parms.TemplateName == "统计日报")
{
//返回Alert表自定义配置
SetAlertValue(result, parms, dbContext);
}
}
return result;
}
/// <summary>
/// 返回Alert表自定义配置
/// </summary>
/// <param name="result"></param>
/// <param name="parms"></param>
/// <param name="dbContext"></param>
private void SetAlertValue(
List<Dictionary<string, object>> result,
PrintQuery parms,
BaseDbContext dbContext)
{
//给明细表设置合计
//var data = dbContext.Set<Warehouse_Alert>()
//设置自定义返回的字段(模板设计页面需要定义:单价合计、数量合计两个字段)
//result[0]["单价合计"] = data?.单价合计 ?? 0;
//result[0]["数量合计"] = data?.数量合计 ?? 0;
//result[0]这里还可以自定义其他字段设置值与模板设计页面定义的字段一致即可
var dic = new Dictionary<string, object>();
dic.Add("单位名称", "1#仓库");
dic.Add("上报日期", DateTime.Now.ToString("D"));
dic.Add("截止时间", DateTime.Now.ToString("T"));
//parms.Ids是勾选的主表主键id
var options = parms.Options.DeserializeObject<Dictionary<string, string[]>>();
List<Guid?> ids = parms.Ids.Select(s => s.GetGuid()).ToList();
if (options["month"] == null)
{
//自定义查询返回表格数据
var data = dbContext.Set<Warehouse_Alert>().Where(x => ids.Contains(x.AlertId))
.Select(s => new
{
= s.CreateDate,
= s.Area,
= s.Message,
= s.Result,
= s.ChargePerson,
= s.CheckResult,
= s.CheckPerson,
= s.CheckTime
}).ToList();
dic.Add("告警记录", data);
}
else
{
//按月份查询返回表格数据
var dateStart = DateTime.Parse(options["month"][0], null, DateTimeStyles.RoundtripKind).ToLocalTime();
var dateEnd = DateTime.Parse(options["month"][1], null, DateTimeStyles.RoundtripKind).ToLocalTime();
var data = dbContext.Set<Warehouse_Alert>()
.Where(x => x.CreateDate>=dateStart && x.CreateDate<=dateEnd)
.Select(s => new
{
= s.CreateDate,
= s.Area,
= s.Message,
= s.Result,
= s.ChargePerson,
= s.CheckResult,
= s.CheckPerson,
= s.CheckTime
}).ToList();
dic.Add("告警记录", data);
}
//返回库房管理系统的数据
var warehouseManageTable = dbContext.Set<Warehouse_SubSystemReport>()
.Where(x => x.Type == "库房管理系统")//这里写条件
.Select(s => new
{
= s.Status,//[名称]与[编号]是打印板自定义表格的里面输入的字段名
= s.Title,
= s.Situation,
= s.ReferenceValue,
= s.Result
}).ToList();
var dicTable1 = new Dictionary<string, object>();
dic.Add("库房管理系统", warehouseManageTable);
//返回钥匙管控系统的数据
var keyManageTable = dbContext.Set<Warehouse_SubSystemReport>()
.Where(x => x.Type == "钥匙管控系统")//这里写条件
.Select(s => new
{
= s.Status,//[名称]与[编号]是打印板自定义表格的里面输入的字段名
= s.Title,
= s.Situation,
= s.ReferenceValue,
= s.Result
}).ToList();
var dicTable2 = new Dictionary<string, object>();
dic.Add("钥匙管控系统", keyManageTable);
//返回门禁系统的数据
var doorManageTable = dbContext.Set<Warehouse_SubSystemReport>()
.Where(x => x.Type == "门禁系统")//这里写条件
.Select(s => new
{
= s.Status,//[名称]与[编号]是打印板自定义表格的里面输入的字段名
= s.Title,
= s.Situation,
= s.ReferenceValue,
= s.Result
}).ToList();
var dicTable3 = new Dictionary<string, object>();
dic.Add("门禁系统", doorManageTable);
//返回视频监控系统的数据
var cameraManageTable = dbContext.Set<Warehouse_SubSystemReport>()
.Where(x => x.Type == "视频监控系统")//这里写条件
.Select(s => new
{
= s.Status,//[名称]与[编号]是打印板自定义表格的里面输入的字段名
= s.Title,
= s.Situation,
= s.ReferenceValue,
= s.Result
}).ToList();
var dicTable4 = new Dictionary<string, object>();
dic.Add("视频监控系统", cameraManageTable);
result.Clear();
result.Add(dic);
}
/// <summary>
/// 返回DemoOrder表自定义配置
/// </summary>
/// <param name="result"></param>
/// <param name="parms"></param>
/// <param name="dbContext"></param>
private void SetDemoOrderValue(
List<Dictionary<string, object>> result,
PrintQuery parms,
BaseDbContext dbContext)
{
//给明细表设置合计
var data = dbContext.Set<Demo_OrderList>()
//根据主表id查询返回明细表合计
.Where(x => x.Order_Id == parms.Ids[0].GetGuid())
.Select(s => new
{
= SqlFunc.AggregateSum(s.Price),
= SqlFunc.AggregateSum(s.Qty),
}).FirstOrDefault();
//设置自定义返回的字段(模板设计页面需要定义:单价合计、数量合计两个字段)
result[0]["单价合计"] = data?. ?? 0;
result[0]["数量合计"] = data?. ?? 0;
//result[0]这里还可以自定义其他字段设置值与模板设计页面定义的字段一致即可
////例如:再返回一些自定义的表格数据
//var otherTable = dbContext.Set<Demo_Product>()
// .Where(x => true)//这里写条件
// .Select(s => new
// {
// 名称 = s.ProductName,//[名称]与[编号]是打印板自定义表格的里面输入的字段名
// 编号 = s.ProductCode
// }).ToList();
//result[0]["字段名"] = otherTable;
}
}
}

View File

@@ -0,0 +1,59 @@
using Microsoft.EntityFrameworkCore;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VolPro.Core.EFDbContext;
using VolPro.Entity.DomainModels;
namespace VolPro.Core.Print
{
public class PrintFilter
{
public PrintFilter()
{
}
/// <summary>
/// 主表查询
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="query"></param>
/// <param name="parms"></param>
/// <returns></returns>
public virtual ISugarQueryable<T> Query<T>(ISugarQueryable<T> query, PrintQuery parms) where T : class
{
return query;
}
/// <summary>
/// 明细表查询
/// </summary>
/// <typeparam name="Detail"></typeparam>
/// <param name="query"></param>
/// <param name="parms"></param>
/// <returns></returns>
public virtual ISugarQueryable<Detail> QueryDetail<Detail>(ISugarQueryable<Detail> query, PrintQuery parms) where Detail : class
{
return query;
}
/// <summary>
/// 查询结果
/// </summary>
/// <typeparam name="T"></typeparam>
/// <typeparam name="Detail"></typeparam>
/// <param name="result"></param>
/// <param name="parms"></param>
/// <returns></returns>
public virtual List<Dictionary<string, object>> QueryResult<T>(
List<Dictionary<string, object>> result,
PrintQuery parms,
BaseDbContext dbContext)
{
return result;
}
}
}

View File

@@ -0,0 +1,61 @@
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace VolPro.Core.Print
{
public class PrintOptions
{
public Type TableType { get; set; }
public string Name { get; set; }
public string TableName { get; set; }
public string[] Fields { get; set; }
public List<CustomField> CustomFields { get; set; }
//public Type DetailTableType { get; set; }
//public string DetailName { get; set; }
//public string DetailTableName { get; set; }
//public string[] DetailFields { get; set; }
//public List<CustomField> DetailCustomgFields { get; set; }
public List<PrintDetail> PrintDetails { get; set; }
}
public class PrintDetail
{
public Type DetailTableType { get; set; }
public string DetailName { get; set; }
public string DetailTableName { get; set; }
public string[] DetailFields { get; set; }
public List<CustomField> CustomgFields { get; set; }
}
public class PrintFields
{
public string Field { get; set; }
public string Name { get; set; }
}
public class PrintDetailOptions<TPrint> where TPrint : class
{
public string Name { get; set; }
public Expression<Func<TPrint, object>> PrintFields { get; set; }
public List<CustomField> CustomFields { get; set; }
}
}

View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VolPro.Core.Print
{
public class PrintQuery
{
public object[] Ids { get; set; }
public Guid TemplateId { get; set; }
/// <summary>
/// 打印模板名称
/// </summary>
public string TemplateName { get; set; }
public string Table { get; set; }
/// <summary>
/// 是否批量打印主表与明细表数据
/// </summary>
public bool BatchMainAndDetail { get; set; }
/// <summary>
/// 是否批量打印主表数据
/// </summary>
public bool BatchMain { get; set; }
/// <summary>
/// 是否打印明细表数据
/// </summary>
public bool Detail { get; set; }
/// <summary>
/// 自定义参数
/// </summary>
public string Options { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VolPro.Core.Print
{
public class PrintResult
{
}
}