From cef6c4d44c24f2bdbcc64a4032b278cd91f09c79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ZR20090193-=E9=99=88=E6=95=AC=E5=8B=87?= Date: Fri, 12 Apr 2024 16:38:56 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A8=E5=8D=95=E8=AE=BE=E7=BD=AE=E5=8F=8A?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=AD=97=E6=AE=B5=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Constants/MultiLanguageConst.cs | 2 + .../DS.Module.ExcelModule.csproj | 14 +++ .../ExcelModuleInstall.cs | 27 +++++ .../DS.Module.ExcelModule/ExcelService.cs | 82 +++++++++++++ .../DS.Module.ExcelModule/IExcelService.cs | 21 ++++ .../Model/ExportByColumnReq.cs | 25 ++++ .../Model/UserColumnSet.cs | 35 ++++++ .../DS.Module.Nuget/DS.Module.Nuget.csproj | 1 + .../DS.WMS.Core/Code/Dtos/CodeFormCopyReq.cs | 4 + .../DS.WMS.Core/Code/Dtos/CodeFormSetReq.cs | 13 +- .../DS.WMS.Core/Code/Dtos/CodeFormSetRes.cs | 19 ++- .../DS.WMS.Core/Code/Dtos/ColumnSetReq.cs | 76 ++++++++++++ .../DS.WMS.Core/Code/Dtos/ColumnSetRes.cs | 65 ++++++++++ .../DS.WMS.Core/Code/Entity/CodeColumnSet.cs | 57 +++++++++ .../DS.WMS.Core/Code/Entity/CodeFormSet.cs | 17 ++- .../Code/Interface/IColumnSetService.cs | 42 +++++++ .../Code/Interface/IFormSetService.cs | 10 +- .../Code/Method/CodeFormSetService.cs | 30 ++++- .../Code/Method/ColumnSetService.cs | 112 ++++++++++++++++++ .../Controllers/ColumnSetController.cs | 78 ++++++++++++ .../Controllers/ExcelController.cs | 38 ++++++ .../Controllers/FormSetController.cs | 14 ++- .../DS.WMS.MainApi/DS.WMS.MainApi.csproj | 5 + .../DS.WMS.MainApi/Logs/internal-nlog.txt | 56 +++++++++ ds-wms-service/DS.WMS.MainApi/Program.cs | 3 +- .../b83d38dd-ba06-4fda-96d8-378628745343.xlsx | Bin 0 -> 4174 bytes ds-wms-service/DS.WMS.Test/DS.WMS.Test.csproj | 1 + ds-wms-service/DS.WMS.Test/ExcelTest.cs | 70 +++++++++++ ds-wms-service/ds-wms-service.sln | 16 +-- 29 files changed, 900 insertions(+), 33 deletions(-) create mode 100644 ds-wms-service/DS.Module.ExcelModule/DS.Module.ExcelModule.csproj create mode 100644 ds-wms-service/DS.Module.ExcelModule/ExcelModuleInstall.cs create mode 100644 ds-wms-service/DS.Module.ExcelModule/ExcelService.cs create mode 100644 ds-wms-service/DS.Module.ExcelModule/IExcelService.cs create mode 100644 ds-wms-service/DS.Module.ExcelModule/Model/ExportByColumnReq.cs create mode 100644 ds-wms-service/DS.Module.ExcelModule/Model/UserColumnSet.cs create mode 100644 ds-wms-service/DS.WMS.Core/Code/Dtos/ColumnSetReq.cs create mode 100644 ds-wms-service/DS.WMS.Core/Code/Dtos/ColumnSetRes.cs create mode 100644 ds-wms-service/DS.WMS.Core/Code/Entity/CodeColumnSet.cs create mode 100644 ds-wms-service/DS.WMS.Core/Code/Interface/IColumnSetService.cs create mode 100644 ds-wms-service/DS.WMS.Core/Code/Method/ColumnSetService.cs create mode 100644 ds-wms-service/DS.WMS.MainApi/Controllers/ColumnSetController.cs create mode 100644 ds-wms-service/DS.WMS.MainApi/Controllers/ExcelController.cs create mode 100644 ds-wms-service/DS.WMS.MainApi/wwwroot/export/b83d38dd-ba06-4fda-96d8-378628745343.xlsx create mode 100644 ds-wms-service/DS.WMS.Test/ExcelTest.cs diff --git a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs index d5b1fd21..869fd269 100644 --- a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs +++ b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs @@ -275,6 +275,8 @@ public static class MultiLanguageConst [Description("表单设置已存在")] public const string FormSetExist = "Form_Set_Exist"; + [Description("列表字段设置已存在")] + public const string ColumnSetExist = "Column_Set_Exist"; [Description("表单复制字段设置已存在")] public const string FormCopyExist = "Form_Copy_Exist"; diff --git a/ds-wms-service/DS.Module.ExcelModule/DS.Module.ExcelModule.csproj b/ds-wms-service/DS.Module.ExcelModule/DS.Module.ExcelModule.csproj new file mode 100644 index 00000000..b3971ede --- /dev/null +++ b/ds-wms-service/DS.Module.ExcelModule/DS.Module.ExcelModule.csproj @@ -0,0 +1,14 @@ + + + + net8.0 + enable + enable + + + + + + + + diff --git a/ds-wms-service/DS.Module.ExcelModule/ExcelModuleInstall.cs b/ds-wms-service/DS.Module.ExcelModule/ExcelModuleInstall.cs new file mode 100644 index 00000000..32c825b7 --- /dev/null +++ b/ds-wms-service/DS.Module.ExcelModule/ExcelModuleInstall.cs @@ -0,0 +1,27 @@ +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.Module.ExcelModule +{ + /// + /// 注入Excel服务 + /// + public static class ExcelModuleInstall + { + /// + /// + /// + /// + /// + public static void AddExcelModuleInstall(this IServiceCollection services) + { + if (services == null) throw new ArgumentNullException(nameof(services)); + + services.AddScoped(); + } + } +} diff --git a/ds-wms-service/DS.Module.ExcelModule/ExcelService.cs b/ds-wms-service/DS.Module.ExcelModule/ExcelService.cs new file mode 100644 index 00000000..901e2131 --- /dev/null +++ b/ds-wms-service/DS.Module.ExcelModule/ExcelService.cs @@ -0,0 +1,82 @@ +using DS.Module.Core; +using DS.Module.ExcelModule.Model; +using LanguageExt.ClassInstances; +using LanguageExt; +using Microsoft.AspNet.SignalR.Hubs; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.DependencyInjection; +using MiniExcelLibs; +using Newtonsoft.Json.Linq; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.Module.ExcelModule +{ + public class ExcelService : IExcelService + { + private readonly IServiceProvider _serviceProvider; + private readonly ISqlSugarClient db; + + /// + /// 构造函数 + /// + /// + public ExcelService(IServiceProvider serviceProvider) + { + _serviceProvider = serviceProvider; + db = _serviceProvider.GetRequiredService(); + + } + public DataResult ExportExcelByColumn(ExportByColumnReq req) + { + var filename = Guid.NewGuid() + ".xlsx"; + //var path = Path.Combine(_environment.WebRootPath, "export/" + filename); + var path = Path.Combine("", "wwwroot/export/" + filename); + var data = JArray.Parse(req.JsonDataStr); + + var values = new List>(); + + for (int i = 0; i < data.Count; i++) + { + var temp = data[i]; + var info = new Dictionary(); + for (int n = 0; n < req.ColumnSets.Count; n++) + { + var columnSet = req.ColumnSets[n]; + var key = columnSet.DataIndex; + // var info = new Dictionary + //{ + // { columnSet.Title, temp[key] }, + //}; + info.Add(columnSet.Title, temp[key]); + } + values.Add(info); + } + MiniExcel.SaveAs(path, values); + return DataResult.Success(path); + //var memoryStream = new MemoryStream(); + //memoryStream.SaveAs(values); + //memoryStream.Seek(0, SeekOrigin.Begin); + //return new FileStreamResult(memoryStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") + //{ + // FileDownloadName = filename + //}; + //using (var memoryStream = new MemoryStream()) + //{ + // memoryStream.SaveAs(values); + // memoryStream.Seek(0, SeekOrigin.Begin); + // return new FileStreamResult(memoryStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") + // { + // FileDownloadName = filename + // }; + //} + //MiniExcel.SaveAs(path, values); + + //throw new NotImplementedException(); + } + } +} diff --git a/ds-wms-service/DS.Module.ExcelModule/IExcelService.cs b/ds-wms-service/DS.Module.ExcelModule/IExcelService.cs new file mode 100644 index 00000000..a0bf8f7a --- /dev/null +++ b/ds-wms-service/DS.Module.ExcelModule/IExcelService.cs @@ -0,0 +1,21 @@ +using DS.Module.Core; +using DS.Module.ExcelModule.Model; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.Module.ExcelModule +{ + public interface IExcelService + { + /// + /// 根据用户列导出Excel数据 + /// + /// 请求数据 + /// + public DataResult ExportExcelByColumn(ExportByColumnReq req); + } +} diff --git a/ds-wms-service/DS.Module.ExcelModule/Model/ExportByColumnReq.cs b/ds-wms-service/DS.Module.ExcelModule/Model/ExportByColumnReq.cs new file mode 100644 index 00000000..ce38e5b1 --- /dev/null +++ b/ds-wms-service/DS.Module.ExcelModule/Model/ExportByColumnReq.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.Module.ExcelModule.Model +{ + /// + /// 按自定义列导出Excel + /// + public class ExportByColumnReq + { + /// + /// 用户自定义列设置 + /// + public List ColumnSets { get; set; } + + + /// + /// Json数据 + /// + public string JsonDataStr { get; set; } + } +} diff --git a/ds-wms-service/DS.Module.ExcelModule/Model/UserColumnSet.cs b/ds-wms-service/DS.Module.ExcelModule/Model/UserColumnSet.cs new file mode 100644 index 00000000..3c38f24b --- /dev/null +++ b/ds-wms-service/DS.Module.ExcelModule/Model/UserColumnSet.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.Module.ExcelModule.Model +{ + /// + /// 用户自定义列设置 + /// + public class UserColumnSet + { + /// + /// 列头显示文字 + /// + public string Title { get; set; } + + /// + /// 列头显示文字- 英文 + /// + public string EnTitle { get; set; } + + /// + /// 数据索引 + /// + public string DataIndex { get; set; } + /// + /// 是否可见 + /// + + public bool Visible { get; set; } + + } +} diff --git a/ds-wms-service/DS.Module.Nuget/DS.Module.Nuget.csproj b/ds-wms-service/DS.Module.Nuget/DS.Module.Nuget.csproj index 6c205832..806eee11 100644 --- a/ds-wms-service/DS.Module.Nuget/DS.Module.Nuget.csproj +++ b/ds-wms-service/DS.Module.Nuget/DS.Module.Nuget.csproj @@ -22,6 +22,7 @@ + diff --git a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeFormCopyReq.cs b/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeFormCopyReq.cs index e0e3f907..4c3d462c 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeFormCopyReq.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeFormCopyReq.cs @@ -26,6 +26,10 @@ public class CodeFormCopyReq /// public string Content { get; set; } /// + /// 是否公共标识 + /// + public bool IsPublic { get; set; } = false; + /// /// 模板名称 /// public string TemplateName { get; set; } diff --git a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeFormSetReq.cs b/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeFormSetReq.cs index 3312229a..1cf09190 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeFormSetReq.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeFormSetReq.cs @@ -25,15 +25,14 @@ public class CodeFormSetReq /// 模板名称 /// public string TemplateName { get; set; } + ///// + ///// 中文视图名 + ///// + //public string ColumnView { get; set; } /// - /// 中文视图名 + /// 表单序号 /// - public string ColumnView { get; set; } - /// - /// 是否公共标识 - /// - public bool IsPublic { get; set; } = false; - + public int FormNo { get; set; } = 0; /// /// 表单设置 /// diff --git a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeFormSetRes.cs b/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeFormSetRes.cs index 769f9932..e4cc974c 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeFormSetRes.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeFormSetRes.cs @@ -7,12 +7,11 @@ namespace DS.WMS.Core.Code.Dtos; /// 租户表单设置返回实体 /// public class CodeFormSetRes -{ - +{ /// /// 主键Id /// - public long Id { get; set; } + public long Id { get; set; } /// /// 权限Id /// @@ -21,12 +20,20 @@ public class CodeFormSetRes /// 权限模块名称 /// public string PermissionName { get; set; } + ///// + ///// 中文视图名 + ///// + //public string ColumnView { get; set; } /// - /// 中文视图名 + /// 表单序号 /// - public string ColumnView { get; set; } + public int FormNo { get; set; } = 0; /// - /// 字段设置 + /// 表单默认设置 + /// + public string DefaultContent { get; set; } + /// + /// 表单设置 /// public string Content { get; set; } /// diff --git a/ds-wms-service/DS.WMS.Core/Code/Dtos/ColumnSetReq.cs b/ds-wms-service/DS.WMS.Core/Code/Dtos/ColumnSetReq.cs new file mode 100644 index 00000000..be7927fc --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Code/Dtos/ColumnSetReq.cs @@ -0,0 +1,76 @@ +using DS.Module.Core; +using FluentValidation; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.Code.Dtos +{ + /// + /// 列表字段设置请求 + /// + public class ColumnSetReq + { + /// + /// 主键Id + /// + public long Id { get; set; } + + /// + /// 权限Id + /// + public long? PermissionId { get; set; } + /// + /// 列表序号 + /// + public int ColumnNo { get; set; } = 0; + /// + /// 权限模块名称 + /// + public string PermissionName { get; set; } + /// + /// 模板名称 + /// + public string TemplateName { get; set; } + + /// + /// 列表设置 + /// + public string Content { get; set; } + + + /// + /// 排序 + /// + public int? OrderNo { get; set; } = 100; + /// + /// 状态 0 启用 1 禁用 + /// + public StatusEnum? Status { get; set; } = StatusEnum.Enable; + /// + /// 备注 + /// + public string Note { get; set; } = ""; + } + /// + /// 验证 + /// + public class ColumnSetReqValidator : AbstractValidator + { + /// + /// 构造函数 + /// + public ColumnSetReqValidator() + { + this.RuleFor(o => o.PermissionId) + .NotEmpty().WithName("权限模块Id"); + this.RuleFor(o => o.TemplateName) + .NotEmpty().WithName("模板名称"); + this.RuleFor(o => o.Content) + .NotEmpty().WithName("列表设置"); + } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Code/Dtos/ColumnSetRes.cs b/ds-wms-service/DS.WMS.Core/Code/Dtos/ColumnSetRes.cs new file mode 100644 index 00000000..554b7bfe --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Code/Dtos/ColumnSetRes.cs @@ -0,0 +1,65 @@ +using DS.Module.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.Code.Dtos +{ + /// + /// 列表字段设置返回 + /// + public class ColumnSetRes + { + /// + /// 主键Id + /// + public long Id { get; set; } + + /// + /// 权限Id + /// + public long? PermissionId { get; set; } + /// + /// 列表序号 + /// + public int ColumnNo { get; set; } = 0; + /// + /// 权限模块名称 + /// + public string PermissionName { get; set; } + /// + /// 模板名称 + /// + public string TemplateName { get; set; } + + /// + /// 列表默认设置 + /// + public string DefaultContent { get; set; } + + /// + /// 列表设置 + /// + public string Content { get; set; } + + + /// + /// 排序 + /// + public int? OrderNo { get; set; } = 100; + /// + /// 状态 0 启用 1 禁用 + /// + public StatusEnum? Status { get; set; } = StatusEnum.Enable; + /// + /// 备注 + /// + public string Note { get; set; } = ""; + /// + /// 创建时间 + /// + public DateTime CreateTime { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Code/Entity/CodeColumnSet.cs b/ds-wms-service/DS.WMS.Core/Code/Entity/CodeColumnSet.cs new file mode 100644 index 00000000..4b32f209 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Code/Entity/CodeColumnSet.cs @@ -0,0 +1,57 @@ +using DS.Module.Core; +using DS.Module.Core.Data; +using SqlSugar; + +namespace DS.WMS.Core.Code.Entity; + +/// +/// 租户列表字段设置 +/// +[SqlSugar.SugarTable("op_code_column_set", "租户列表字段设置")] +public class CodeColumnSet : BaseOrgModel +{ + /// + /// 权限Id + /// + [SugarColumn(ColumnDescription = "权限Id", IsNullable = false)] + public long? PermissionId { get; set; } + /// + /// 列表序号 + /// + [SugarColumn(ColumnDescription = "列表序号", IsNullable = false, DefaultValue = "0")] + public int ColumnNo { get; set; } = 0; + /// + /// 权限模块名称 + /// + [SugarColumn(ColumnDescription = "权限模块名称", IsNullable = false, Length = 50)] + public string PermissionName { get; set; } + + /// + /// 模板名称 + /// + [SugarColumn(ColumnDescription = "模板名称", IsNullable = false, Length = 50)] + public string TemplateName { get; set; } + + /// + /// 列表字段默认设置 + /// + [SugarColumn(ColumnDescription = "列表字段默认设置", IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)] + public string DefaultContent { get; set; } + /// + /// 列表字段设置 + /// + [SugarColumn(ColumnDescription = "列表字段设置", IsNullable = true, ColumnDataType=StaticConfig.CodeFirst_BigString)] + public string Content { get; set; } + + + /// + /// 排序号 + /// + [SugarColumn(ColumnDescription = "排序号", IsNullable = true, DefaultValue = "100")] + public int? OrderNo { get; set; } = 100; + /// + /// 状态 + /// + [SqlSugar.SugarColumn(ColumnDescription = "状态")] + public StatusEnum? Status { get; set; } = StatusEnum.Enable; +} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Code/Entity/CodeFormSet.cs b/ds-wms-service/DS.WMS.Core/Code/Entity/CodeFormSet.cs index 574f0c87..8ba6e709 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Entity/CodeFormSet.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Entity/CodeFormSet.cs @@ -20,18 +20,27 @@ public class CodeFormSet : BaseOrgModel /// [SugarColumn(ColumnDescription = "权限模块名称", IsNullable = false,Length = 50)] public string PermissionName { get; set; } - /// - /// 中文视图名 + /// 表单序号 /// - [SugarColumn(ColumnDescription = "中文视图名", IsNullable = false, Length = 100)] - public string ColumnView { get; set; } + [SugarColumn(ColumnDescription = "表单序号", IsNullable = false, DefaultValue = "0")] + public int FormNo { get; set; } = 0; + ///// + ///// 中文视图名 + ///// + //[SugarColumn(ColumnDescription = "中文视图名", IsNullable = false, Length = 100)] + //public string ColumnView { get; set; } /// /// 模板名称 /// [SugarColumn(ColumnDescription = "模板名称", IsNullable = false, Length = 50)] public string TemplateName { get; set; } /// + /// 表单默认设置 + /// + [SugarColumn(ColumnDescription = "表单默认设置", IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)] + public string DefaultContent { get; set; } + /// /// 表单设置 /// [SugarColumn(ColumnDescription = "表单设置", IsNullable = true, ColumnDataType=StaticConfig.CodeFirst_BigString)] diff --git a/ds-wms-service/DS.WMS.Core/Code/Interface/IColumnSetService.cs b/ds-wms-service/DS.WMS.Core/Code/Interface/IColumnSetService.cs new file mode 100644 index 00000000..1bde25c1 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Code/Interface/IColumnSetService.cs @@ -0,0 +1,42 @@ +using DS.Module.Core; +using DS.WMS.Core.Code.Dtos; +using DS.WMS.Core.System.Dtos; + +namespace DS.WMS.Core.Code.Interface; + +/// +/// +/// +public interface IColumnSetService +{ + /// + /// 列表 + /// + /// + /// + DataResult> GetListByPage(PageRequest request); + + + /// + /// 编辑 + /// + /// + /// + DataResult EditColumnSet(ColumnSetReq model); + + /// + /// 获取详情 + /// + /// + /// + DataResult GetColumnSetInfo(string id); + + /// + /// 按模块获取列表设置详情 + /// + /// 权限模块id + /// 列表序号 + /// + DataResult GetColumnSetInfoByModule(string permissionId,int columnNo = 0); + +} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Code/Interface/IFormSetService.cs b/ds-wms-service/DS.WMS.Core/Code/Interface/IFormSetService.cs index ea981d4a..93c2e713 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Interface/IFormSetService.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Interface/IFormSetService.cs @@ -31,6 +31,14 @@ public interface IFormSetService /// DataResult GetFormSetInfo(string id); + /// + /// 根据权限模块和表单序号获取详情 + /// + /// 权限模块id + /// 表单序号 + /// + + public DataResult GetFormSetInfoByModule(string permissionId, int formNo = 0); + - } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Code/Method/CodeFormSetService.cs b/ds-wms-service/DS.WMS.Core/Code/Method/CodeFormSetService.cs index 5ba92dbc..e6287fe5 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Method/CodeFormSetService.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Method/CodeFormSetService.cs @@ -14,6 +14,9 @@ using SqlSugar; namespace DS.WMS.Core.Code.Method; +/// +/// +/// public class CodeFormSetService : IFormSetService { private readonly IServiceProvider _serviceProvider; @@ -60,13 +63,13 @@ public class CodeFormSetService : IFormSetService if (req.Id == 0) { if (tenantDb.Queryable() - .Where(x => x.OrgId == user.GetOrgId() && x.PermissionId == req.PermissionId).Any()) + .Where(x => x.OrgId == user.GetOrgId() && x.PermissionId == req.PermissionId && x.FormNo == req.FormNo).Any()) { return DataResult.Failed("表单设置已存在!", MultiLanguageConst.FormSetExist); } var data = req.Adapt(); - + data.DefaultContent = req.Content; var entity = tenantDb.Insertable(data).ExecuteReturnEntity(); return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess); @@ -77,7 +80,7 @@ public class CodeFormSetService : IFormSetService info = req.Adapt(info); - tenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).EnableDiffLogEvent().ExecuteCommand(); + tenantDb.Updateable(info).IgnoreColumns("DefaultContent").IgnoreColumns(ignoreAllNullColumns: true).EnableDiffLogEvent().ExecuteCommand(); return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess); } } @@ -91,10 +94,27 @@ public class CodeFormSetService : IFormSetService { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); var data = tenantDb.Queryable() - .Where(x => x.Id == long.Parse(id)) + .Where(x => x.Id == long.Parse(id) && x.Status == StatusEnum.Enable) + .Select() + .First(); + return DataResult.Success(data, MultiLanguageConst.DataQuerySuccess); + } + + /// + /// 根据权限模块和表单序号获取详情 + /// + /// + /// + /// + + public DataResult GetFormSetInfoByModule(string permissionId, int formNo = 0) + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + var data = tenantDb.Queryable() + .Where(x => x.PermissionId == long.Parse(permissionId) && x.FormNo == formNo && x.Status == StatusEnum.Enable) .Select() .First(); return DataResult.Success(data, MultiLanguageConst.DataQuerySuccess); } - + } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Code/Method/ColumnSetService.cs b/ds-wms-service/DS.WMS.Core/Code/Method/ColumnSetService.cs new file mode 100644 index 00000000..899d2200 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Code/Method/ColumnSetService.cs @@ -0,0 +1,112 @@ +using DS.Module.Core; +using DS.Module.Core.Extensions; +using DS.Module.SqlSugar; +using DS.Module.UserModule; +using DS.WMS.Core.Code.Dtos; +using DS.WMS.Core.Code.Entity; +using DS.WMS.Core.Code.Interface; +using Mapster; +using Microsoft.Extensions.DependencyInjection; +using SqlSugar; +namespace DS.WMS.Core.Code.Method +{ + /// + /// + /// + public class ColumnSetService : IColumnSetService + { + private readonly IServiceProvider _serviceProvider; + private readonly ISqlSugarClient db; + private readonly IUser user; + private readonly ISaasDbService saasService; + /// + /// + /// + /// + public ColumnSetService(IServiceProvider serviceProvider) + { + _serviceProvider = serviceProvider; + db = _serviceProvider.GetRequiredService(); + user = _serviceProvider.GetRequiredService(); + saasService = _serviceProvider.GetRequiredService(); + } + /// + /// 编辑 + /// + /// + /// + public DataResult EditColumnSet(ColumnSetReq req) + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + //var orgId = user.GetOrgId(); + if (req.Id == 0) + { + if (tenantDb.Queryable() + .Where(x => x.ColumnNo == req.ColumnNo && x.PermissionId == req.PermissionId).Any()) + { + return DataResult.Failed("列表字段设置已存在!", MultiLanguageConst.ColumnSetExist); + } + + var data = req.Adapt(); + data.DefaultContent = req.Content; + + var entity = tenantDb.Insertable(data).ExecuteReturnEntity(); + + return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess); + } + else + { + var info = tenantDb.Queryable().Where(x => x.Id == req.Id).First(); + + info = req.Adapt(info); + + tenantDb.Updateable(info).IgnoreColumns("DefaultContent").IgnoreColumns(ignoreAllNullColumns: true).EnableDiffLogEvent().ExecuteCommand(); + return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess); + } + } + /// + /// 详情 + /// + /// + /// + public DataResult GetColumnSetInfo(string id) + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + var data = tenantDb.Queryable() + .Where(x => x.Id == long.Parse(id) && x.Status == StatusEnum.Enable) + .Select() + .First(); + return DataResult.Success(data, MultiLanguageConst.DataQuerySuccess); + } + /// + /// + /// + /// + /// + /// + public DataResult GetColumnSetInfoByModule(string permissionId, int columnNo = 0) + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + var data = tenantDb.Queryable() + .Where(x => x.PermissionId == long.Parse(permissionId) && x.ColumnNo == columnNo && x.Status == StatusEnum.Enable) + .Select() + .First(); + return DataResult.Success(data, MultiLanguageConst.DataQuerySuccess); + } + /// + /// 列表 + /// + /// + /// + public DataResult> GetListByPage(PageRequest request) + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + //序列化查询条件 + var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); + var data = tenantDb.Queryable() + .Where(whereList) + .Select().ToQueryPage(request.PageCondition); + return data; + } + } +} diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/ColumnSetController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/ColumnSetController.cs new file mode 100644 index 00000000..859ce73b --- /dev/null +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/ColumnSetController.cs @@ -0,0 +1,78 @@ +using DS.Module.Core; +using DS.WMS.Core.Code.Dtos; +using DS.WMS.Core.Code.Interface; +using DS.WMS.Core.System.Dtos; +using DS.WMS.Core.System.Interface; +using Microsoft.AspNetCore.Mvc; + +namespace DS.WMS.MainApi.Controllers; + +/// +/// 列表字段设置 模块 +/// +public class ColumnSetController : ApiController +{ + private readonly IColumnSetService _invokeService; + + /// + /// 构造函数 + /// + /// + public ColumnSetController(IColumnSetService invokeService) + { + _invokeService = invokeService; + } + + /// + /// 列表 + /// + /// + /// + [HttpPost] + [Route("GetColumnSetList")] + public DataResult> GetColumnSetList([FromBody] PageRequest request) + { + var res = _invokeService.GetListByPage(request); + return res; + } + + /// + /// 编辑 + /// + /// + /// + [HttpPost] + [Route("EditColumnSet")] + public DataResult EditColumnSet([FromBody] ColumnSetReq req) + { + var res = _invokeService.EditColumnSet(req); + return res; + } + + /// + /// 详情 + /// + /// Id + /// + [HttpGet] + [Route("GetColumnSetInfo")] + public DataResult GetColumnSetInfo([FromQuery] string id) + { + var res = _invokeService.GetColumnSetInfo(id); + return res; + } + /// + /// 按模块获取列表设置详情 + /// + /// 权限模块id + /// 列表序号 + /// + [HttpGet] + [Route("GetColumnSetInfoByModule")] + public DataResult GetColumnSetInfoByModule([FromQuery] string permissionId, int columnNo = 0) + { + var res = _invokeService.GetColumnSetInfoByModule(permissionId, columnNo); + return res; + } + +} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/ExcelController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/ExcelController.cs new file mode 100644 index 00000000..e89fd00a --- /dev/null +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/ExcelController.cs @@ -0,0 +1,38 @@ +using DS.Module.Core; +using DS.Module.ExcelModule; +using DS.Module.ExcelModule.Model; +using DS.WMS.Core.Code.Interface; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; + +namespace DS.WMS.MainApi.Controllers +{ + /// + /// Excel服务 模块 + /// + public class ExcelController : ApiController + { + private readonly IExcelService _invokeService; + + /// + /// 构造函数 + /// + /// + public ExcelController(IExcelService invokeService) + { + _invokeService = invokeService; + } + + /// + /// 根据用户列导出Excel数据 + /// + /// 请求数据 + /// + [HttpPost] + [Route("ExportExcelByColumn")] + public DataResult ExportExcelByColumn([FromBody] ExportByColumnReq req) + { + return _invokeService.ExportExcelByColumn(req); + } + } +} diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/FormSetController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/FormSetController.cs index ae8c521a..059e61ae 100644 --- a/ds-wms-service/DS.WMS.MainApi/Controllers/FormSetController.cs +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/FormSetController.cs @@ -61,6 +61,18 @@ public class FormSetController : ApiController var res = _invokeService.GetFormSetInfo(id); return res; } + /// + /// 按模块获取表单设置详情 + /// + /// 权限模块id + /// 表单序号 + /// + [HttpGet] + [Route("GetFormSetInfoByModule")] + public DataResult GetFormSetInfoByModule([FromQuery] string permissionId, int formNo = 0) + { + var res = _invokeService.GetFormSetInfoByModule(permissionId, formNo); + return res; + } - } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.MainApi/DS.WMS.MainApi.csproj b/ds-wms-service/DS.WMS.MainApi/DS.WMS.MainApi.csproj index 4459e722..56c0d7a0 100644 --- a/ds-wms-service/DS.WMS.MainApi/DS.WMS.MainApi.csproj +++ b/ds-wms-service/DS.WMS.MainApi/DS.WMS.MainApi.csproj @@ -30,6 +30,7 @@ + @@ -38,4 +39,8 @@ + + + + diff --git a/ds-wms-service/DS.WMS.MainApi/Logs/internal-nlog.txt b/ds-wms-service/DS.WMS.MainApi/Logs/internal-nlog.txt index b18ea192..f24ca8e5 100644 --- a/ds-wms-service/DS.WMS.MainApi/Logs/internal-nlog.txt +++ b/ds-wms-service/DS.WMS.MainApi/Logs/internal-nlog.txt @@ -1132,3 +1132,59 @@ 2024-04-08 17:44:13.6177 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config 2024-04-08 17:44:13.6281 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile 2024-04-08 17:44:13.6504 Info Configuration initialized. +2024-04-11 14:26:33.5328 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-04-11 14:26:33.5589 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-04-11 14:26:33.5589 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-04-11 14:26:33.5861 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-04-11 14:26:33.5993 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config +2024-04-11 14:26:33.6058 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-04-11 14:26:33.6058 Info Configuration initialized. +2024-04-11 17:35:17.4896 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-04-11 17:35:17.5158 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-04-11 17:35:17.5158 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-04-11 17:35:17.5395 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-04-11 17:35:17.5513 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config +2024-04-11 17:35:17.5513 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-04-11 17:35:17.5673 Info Configuration initialized. +2024-04-12 15:12:59.6633 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-04-12 15:12:59.6949 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-04-12 15:12:59.7054 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-04-12 15:12:59.7414 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-04-12 15:12:59.7735 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config +2024-04-12 15:12:59.7847 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-04-12 15:12:59.8149 Info Configuration initialized. +2024-04-12 15:31:48.7130 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-04-12 15:31:48.7653 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-04-12 15:31:48.7768 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-04-12 15:31:48.8098 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-04-12 15:31:48.8364 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config +2024-04-12 15:31:48.8459 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-04-12 15:31:48.8646 Info Configuration initialized. +2024-04-12 15:53:18.3766 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-04-12 15:53:18.4282 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-04-12 15:53:18.4485 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-04-12 15:53:18.4940 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-04-12 15:53:18.5243 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config +2024-04-12 15:53:18.5426 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-04-12 15:53:18.5739 Info Configuration initialized. +2024-04-12 16:01:47.4413 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-04-12 16:01:47.4813 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-04-12 16:01:47.4950 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-04-12 16:01:47.5266 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-04-12 16:01:47.5482 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config +2024-04-12 16:01:47.5482 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-04-12 16:01:47.5841 Info Configuration initialized. +2024-04-12 16:17:59.7553 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-04-12 16:17:59.8108 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-04-12 16:17:59.8214 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-04-12 16:17:59.8484 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-04-12 16:17:59.8753 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config +2024-04-12 16:17:59.8898 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-04-12 16:17:59.9141 Info Configuration initialized. +2024-04-12 16:21:31.4610 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-04-12 16:21:31.5101 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-04-12 16:21:31.5288 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-04-12 16:21:31.5843 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-04-12 16:21:31.6323 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config +2024-04-12 16:21:31.6622 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-04-12 16:21:31.7061 Info Configuration initialized. diff --git a/ds-wms-service/DS.WMS.MainApi/Program.cs b/ds-wms-service/DS.WMS.MainApi/Program.cs index bd4f573c..30032043 100644 --- a/ds-wms-service/DS.WMS.MainApi/Program.cs +++ b/ds-wms-service/DS.WMS.MainApi/Program.cs @@ -4,6 +4,7 @@ using DS.Module.AutofacModule; using DS.Module.Core; using DS.Module.Core.Extensions; using DS.Module.Core.ServiceExtensions; +using DS.Module.ExcelModule; using DS.Module.Jwt; using DS.Module.Middleware; using DS.Module.MultiLanguage; @@ -39,7 +40,7 @@ builder.Services.AddSwaggerInstall(); builder.Services.AddJwtInstall(); builder.Services.AddSaasDbInstall();//分库服务 builder.Services.AddMultiLanguageInstall();//多语言服务 - +builder.Services.AddExcelModuleInstall();//Excel服务 // builder.Services.AddEndpointsApiExplorer(); // builder.Services.AddSwaggerGen(); diff --git a/ds-wms-service/DS.WMS.MainApi/wwwroot/export/b83d38dd-ba06-4fda-96d8-378628745343.xlsx b/ds-wms-service/DS.WMS.MainApi/wwwroot/export/b83d38dd-ba06-4fda-96d8-378628745343.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..336355c0ad3e3be0d4ed62bdc9aa35e71c15e227 GIT binary patch literal 4174 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 + diff --git a/ds-wms-service/DS.WMS.Test/ExcelTest.cs b/ds-wms-service/DS.WMS.Test/ExcelTest.cs new file mode 100644 index 00000000..454bb148 --- /dev/null +++ b/ds-wms-service/DS.WMS.Test/ExcelTest.cs @@ -0,0 +1,70 @@ +using System.Reflection; +using DS.Module.Core; +using DS.Module.Core.Extensions; +using DS.Module.ExcelModule.Model; +using DS.Module.SqlSugar; +using DS.WMS.Core.Code.Interface; +using DS.WMS.Core.System.Entity; +using DS.WMS.Core.System.Interface; +using Microsoft.Extensions.DependencyInjection; +using Newtonsoft.Json.Linq; +using SqlSugar; +using SqlSugar.IOC; +using Xunit; + +namespace Ds.WMS.Test; + +public class ExcelTest +{ + private readonly IServiceProvider _serviceProvider; + private readonly SqlSugarScope db; + private readonly ISaasDbService saasService; + //private readonly IExcelService _ExcelService; + public ExcelTest(IServiceProvider serviceProvider) + { + _serviceProvider = serviceProvider; + db = (SqlSugarScope)_serviceProvider.GetRequiredService(); + saasService = _serviceProvider.GetRequiredService(); + //_ExcelService = _serviceProvider.GetRequiredService(); + } + + + /// + /// ȡJsonӡϢ + /// + [Fact] + public void GetExportExcleInfo() + { + List set = new List(); + set.Add(new UserColumnSet + { + DataIndex = "stlCode", + Title = "㷽ʽ", + }); + set.Add(new UserColumnSet + { + DataIndex = "stlName", + Title = "㷽ʽ", + }); + string JsonDataStr = "[{\"id\":\"1767428411736854528\",\"stlCode\":\"1\",\"stlName\":\"֧Ʊ\",\"enName\":\"Check\",\"financeSoftCode\":\"01\",\"status\":0,\"note\":\"\",\"createTime\":\"2024-03-12 13:52:25\"},{\"id\":\"1767428557304369152\",\"stlCode\":\"2\",\"stlName\":\"\",\"enName\":\"Remittance\",\"financeSoftCode\":\"02\",\"status\":0,\"note\":\"\",\"createTime\":\"2024-03-12 13:53:00\"}]"; + var values = new List>(); + var data = JArray.Parse(JsonDataStr); + for (int i = 0; i < data.Count; i++) + { + var temp = data[i]; + for (int n = 0; n < set.Count; n++) + { + var columnSet = set[n]; + var key = columnSet.DataIndex; + var info = new Dictionary + { + { columnSet.Title, temp[key] }, + }; + values.Add(info); + } + } + Console.WriteLine(values); + Assert.True(true); + } + +} \ No newline at end of file diff --git a/ds-wms-service/ds-wms-service.sln b/ds-wms-service/ds-wms-service.sln index 89c929e5..7d8b7b74 100644 --- a/ds-wms-service/ds-wms-service.sln +++ b/ds-wms-service/ds-wms-service.sln @@ -35,8 +35,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ds.Module.DynamicApi", "Ds. EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ds.Module.SignalR", "Ds.Module.SignalR\Ds.Module.SignalR.csproj", "{AF52EFD8-D42B-4420-B65B-BDC02C841BBD}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DS.TestResult", "DS.TestResult\DS.TestResult.csproj", "{47A9FC9F-0A3F-4A14-B60E-1B70C414DBEA}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ds.Module.ResultFilter", "Ds.Module.ResultFilter\Ds.Module.ResultFilter.csproj", "{C1FD8E3A-980C-4227-B3D7-824C1529697C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DS.Module.Nuget", "DS.Module.Nuget\DS.Module.Nuget.csproj", "{B2CA3885-C3D5-4A67-AA1C-18EF0B80F3B6}" @@ -69,7 +67,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DS.Module.Log", "DS.Module. EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DS.Module.Middleware", "DS.Module.Middleware\DS.Module.Middleware.csproj", "{B0351554-748F-4DF8-8C22-152646937EFE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DS.Module.PrintModule", "DS.Module.PrintModule\DS.Module.PrintModule.csproj", "{F7ACC016-4181-4B26-9550-FB18A2053503}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DS.Module.PrintModule", "DS.Module.PrintModule\DS.Module.PrintModule.csproj", "{F7ACC016-4181-4B26-9550-FB18A2053503}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DS.Module.ExcelModule", "DS.Module.ExcelModule\DS.Module.ExcelModule.csproj", "{B4F32D53-749E-4019-BB41-DE64FC803C86}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -129,10 +129,6 @@ Global {AF52EFD8-D42B-4420-B65B-BDC02C841BBD}.Debug|Any CPU.Build.0 = Debug|Any CPU {AF52EFD8-D42B-4420-B65B-BDC02C841BBD}.Release|Any CPU.ActiveCfg = Release|Any CPU {AF52EFD8-D42B-4420-B65B-BDC02C841BBD}.Release|Any CPU.Build.0 = Release|Any CPU - {47A9FC9F-0A3F-4A14-B60E-1B70C414DBEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {47A9FC9F-0A3F-4A14-B60E-1B70C414DBEA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {47A9FC9F-0A3F-4A14-B60E-1B70C414DBEA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {47A9FC9F-0A3F-4A14-B60E-1B70C414DBEA}.Release|Any CPU.Build.0 = Release|Any CPU {C1FD8E3A-980C-4227-B3D7-824C1529697C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C1FD8E3A-980C-4227-B3D7-824C1529697C}.Debug|Any CPU.Build.0 = Debug|Any CPU {C1FD8E3A-980C-4227-B3D7-824C1529697C}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -197,6 +193,10 @@ Global {F7ACC016-4181-4B26-9550-FB18A2053503}.Debug|Any CPU.Build.0 = Debug|Any CPU {F7ACC016-4181-4B26-9550-FB18A2053503}.Release|Any CPU.ActiveCfg = Release|Any CPU {F7ACC016-4181-4B26-9550-FB18A2053503}.Release|Any CPU.Build.0 = Release|Any CPU + {B4F32D53-749E-4019-BB41-DE64FC803C86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B4F32D53-749E-4019-BB41-DE64FC803C86}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B4F32D53-749E-4019-BB41-DE64FC803C86}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B4F32D53-749E-4019-BB41-DE64FC803C86}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -215,7 +215,6 @@ Global {47195E8A-8E39-4575-AC53-8901710CB6CC} = {65D75DB2-12D5-4D1F-893D-9750905CE5E4} {BC74BBAF-8959-4872-924A-D45B743ABDF2} = {518DB9B5-80A8-4B2C-8570-52BD406458DE} {AF52EFD8-D42B-4420-B65B-BDC02C841BBD} = {518DB9B5-80A8-4B2C-8570-52BD406458DE} - {47A9FC9F-0A3F-4A14-B60E-1B70C414DBEA} = {EB351D25-8071-4AE1-B981-EA52B5C2C06E} {C1FD8E3A-980C-4227-B3D7-824C1529697C} = {518DB9B5-80A8-4B2C-8570-52BD406458DE} {B2CA3885-C3D5-4A67-AA1C-18EF0B80F3B6} = {518DB9B5-80A8-4B2C-8570-52BD406458DE} {5E1D485F-6569-4311-9D60-755D0BFB4CF7} = {518DB9B5-80A8-4B2C-8570-52BD406458DE} @@ -232,6 +231,7 @@ Global {739899DE-D41F-4083-94E1-EDA349344ECC} = {518DB9B5-80A8-4B2C-8570-52BD406458DE} {B0351554-748F-4DF8-8C22-152646937EFE} = {518DB9B5-80A8-4B2C-8570-52BD406458DE} {F7ACC016-4181-4B26-9550-FB18A2053503} = {518DB9B5-80A8-4B2C-8570-52BD406458DE} + {B4F32D53-749E-4019-BB41-DE64FC803C86} = {518DB9B5-80A8-4B2C-8570-52BD406458DE} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {66115F23-94B4-43C0-838E-33B5CF77F788}