张同海 7 months ago
commit 3e93d27519

@ -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";

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\DS.Module.Core\DS.Module.Core.csproj" />
<ProjectReference Include="..\DS.Module.Nuget\DS.Module.Nuget.csproj" />
</ItemGroup>
</Project>

@ -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
{
/// <summary>
/// 注入Excel服务
/// </summary>
public static class ExcelModuleInstall
{
/// <summary>
///
/// </summary>
/// <param name="services"></param>
/// <exception cref="ArgumentNullException"></exception>
public static void AddExcelModuleInstall(this IServiceCollection services)
{
if (services == null) throw new ArgumentNullException(nameof(services));
services.AddScoped<IExcelService, ExcelService>();
}
}
}

@ -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;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="serviceProvider"></param>
public ExcelService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
}
public DataResult<string> 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<Dictionary<string, object>>();
for (int i = 0; i < data.Count; i++)
{
var temp = data[i];
var info = new Dictionary<string, object>();
for (int n = 0; n < req.ColumnSets.Count; n++)
{
var columnSet = req.ColumnSets[n];
var key = columnSet.DataIndex;
// var info = new Dictionary<string, object>
//{
// { columnSet.Title, temp[key] },
//};
info.Add(columnSet.Title, temp[key]);
}
values.Add(info);
}
MiniExcel.SaveAs(path, values);
return DataResult<string>.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();
}
}
}

@ -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
{
/// <summary>
/// 根据用户列导出Excel数据
/// </summary>
/// <param name="req">请求数据</param>
/// <returns></returns>
public DataResult<string> ExportExcelByColumn(ExportByColumnReq req);
}
}

@ -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
{
/// <summary>
/// 按自定义列导出Excel
/// </summary>
public class ExportByColumnReq
{
/// <summary>
/// 用户自定义列设置
/// </summary>
public List<UserColumnSet> ColumnSets { get; set; }
/// <summary>
/// Json数据
/// </summary>
public string JsonDataStr { get; set; }
}
}

@ -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
{
/// <summary>
/// 用户自定义列设置
/// </summary>
public class UserColumnSet
{
/// <summary>
/// 列头显示文字
/// </summary>
public string Title { get; set; }
/// <summary>
/// 列头显示文字- 英文
/// </summary>
public string EnTitle { get; set; }
/// <summary>
/// 数据索引
/// </summary>
public string DataIndex { get; set; }
/// <summary>
/// 是否可见
/// </summary>
public bool Visible { get; set; }
}
}

@ -22,6 +22,7 @@
<PackageReference Include="Microsoft.AspNet.SignalR" Version="2.4.3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.OpenApi" Version="1.6.12" />
<PackageReference Include="MiniExcel" Version="1.31.3" />
<PackageReference Include="NETCore.MailKit" Version="2.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />

@ -26,6 +26,10 @@ public class CodeFormCopyReq
/// </summary>
public string Content { get; set; }
/// <summary>
/// 是否公共标识
/// </summary>
public bool IsPublic { get; set; } = false;
/// <summary>
/// 模板名称
/// </summary>
public string TemplateName { get; set; }

@ -25,15 +25,14 @@ public class CodeFormSetReq
/// 模板名称
/// </summary>
public string TemplateName { get; set; }
///// <summary>
///// 中文视图名
///// </summary>
//public string ColumnView { get; set; }
/// <summary>
/// 中文视图名
/// 表单序号
/// </summary>
public string ColumnView { get; set; }
/// <summary>
/// 是否公共标识
/// </summary>
public bool IsPublic { get; set; } = false;
public int FormNo { get; set; } = 0;
/// <summary>
/// 表单设置
/// </summary>

@ -7,12 +7,11 @@ namespace DS.WMS.Core.Code.Dtos;
/// 租户表单设置返回实体
/// </summary>
public class CodeFormSetRes
{
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
public long Id { get; set; }
/// <summary>
/// 权限Id
/// </summary>
@ -21,12 +20,20 @@ public class CodeFormSetRes
/// 权限模块名称
/// </summary>
public string PermissionName { get; set; }
///// <summary>
///// 中文视图名
///// </summary>
//public string ColumnView { get; set; }
/// <summary>
/// 中文视图名
/// 表单序号
/// </summary>
public string ColumnView { get; set; }
public int FormNo { get; set; } = 0;
/// <summary>
/// 字段设置
/// 表单默认设置
/// </summary>
public string DefaultContent { get; set; }
/// <summary>
/// 表单设置
/// </summary>
public string Content { get; set; }
/// <summary>

@ -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
{
/// <summary>
/// 列表字段设置请求
/// </summary>
public class ColumnSetReq
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 权限Id
/// </summary>
public long? PermissionId { get; set; }
/// <summary>
/// 列表序号
/// </summary>
public int ColumnNo { get; set; } = 0;
/// <summary>
/// 权限模块名称
/// </summary>
public string PermissionName { get; set; }
/// <summary>
/// 模板名称
/// </summary>
public string TemplateName { get; set; }
/// <summary>
/// 列表设置
/// </summary>
public string Content { get; set; }
/// <summary>
/// 排序
/// </summary>
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 状态 0 启用 1 禁用
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; } = "";
}
/// <summary>
/// 验证
/// </summary>
public class ColumnSetReqValidator : AbstractValidator<ColumnSetReq>
{
/// <summary>
/// 构造函数
/// </summary>
public ColumnSetReqValidator()
{
this.RuleFor(o => o.PermissionId)
.NotEmpty().WithName("权限模块Id");
this.RuleFor(o => o.TemplateName)
.NotEmpty().WithName("模板名称");
this.RuleFor(o => o.Content)
.NotEmpty().WithName("列表设置");
}
}
}

@ -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
{
/// <summary>
/// 列表字段设置返回
/// </summary>
public class ColumnSetRes
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 权限Id
/// </summary>
public long? PermissionId { get; set; }
/// <summary>
/// 列表序号
/// </summary>
public int ColumnNo { get; set; } = 0;
/// <summary>
/// 权限模块名称
/// </summary>
public string PermissionName { get; set; }
/// <summary>
/// 模板名称
/// </summary>
public string TemplateName { get; set; }
/// <summary>
/// 列表默认设置
/// </summary>
public string DefaultContent { get; set; }
/// <summary>
/// 列表设置
/// </summary>
public string Content { get; set; }
/// <summary>
/// 排序
/// </summary>
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 状态 0 启用 1 禁用
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; } = "";
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
}
}

@ -0,0 +1,57 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using SqlSugar;
namespace DS.WMS.Core.Code.Entity;
/// <summary>
/// 租户列表字段设置
/// </summary>
[SqlSugar.SugarTable("op_code_column_set", "租户列表字段设置")]
public class CodeColumnSet : BaseOrgModel<long>
{
/// <summary>
/// 权限Id
/// </summary>
[SugarColumn(ColumnDescription = "权限Id", IsNullable = false)]
public long? PermissionId { get; set; }
/// <summary>
/// 列表序号
/// </summary>
[SugarColumn(ColumnDescription = "列表序号", IsNullable = false, DefaultValue = "0")]
public int ColumnNo { get; set; } = 0;
/// <summary>
/// 权限模块名称
/// </summary>
[SugarColumn(ColumnDescription = "权限模块名称", IsNullable = false, Length = 50)]
public string PermissionName { get; set; }
/// <summary>
/// 模板名称
/// </summary>
[SugarColumn(ColumnDescription = "模板名称", IsNullable = false, Length = 50)]
public string TemplateName { get; set; }
/// <summary>
/// 列表字段默认设置
/// </summary>
[SugarColumn(ColumnDescription = "列表字段默认设置", IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string DefaultContent { get; set; }
/// <summary>
/// 列表字段设置
/// </summary>
[SugarColumn(ColumnDescription = "列表字段设置", IsNullable = true, ColumnDataType=StaticConfig.CodeFirst_BigString)]
public string Content { get; set; }
/// <summary>
/// 排序号
/// </summary>
[SugarColumn(ColumnDescription = "排序号", IsNullable = true, DefaultValue = "100")]
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 状态
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "状态")]
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
}

@ -20,18 +20,27 @@ public class CodeFormSet : BaseOrgModel<long>
/// </summary>
[SugarColumn(ColumnDescription = "权限模块名称", IsNullable = false,Length = 50)]
public string PermissionName { get; set; }
/// <summary>
/// 中文视图名
/// 表单序号
/// </summary>
[SugarColumn(ColumnDescription = "中文视图名", IsNullable = false, Length = 100)]
public string ColumnView { get; set; }
[SugarColumn(ColumnDescription = "表单序号", IsNullable = false, DefaultValue = "0")]
public int FormNo { get; set; } = 0;
///// <summary>
///// 中文视图名
///// </summary>
//[SugarColumn(ColumnDescription = "中文视图名", IsNullable = false, Length = 100)]
//public string ColumnView { get; set; }
/// <summary>
/// 模板名称
/// </summary>
[SugarColumn(ColumnDescription = "模板名称", IsNullable = false, Length = 50)]
public string TemplateName { get; set; }
/// <summary>
/// 表单默认设置
/// </summary>
[SugarColumn(ColumnDescription = "表单默认设置", IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string DefaultContent { get; set; }
/// <summary>
/// 表单设置
/// </summary>
[SugarColumn(ColumnDescription = "表单设置", IsNullable = true, ColumnDataType=StaticConfig.CodeFirst_BigString)]

@ -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;
/// <summary>
///
/// </summary>
public interface IColumnSetService
{
/// <summary>
/// 列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
DataResult<List<ColumnSetRes>> GetListByPage(PageRequest request);
/// <summary>
/// 编辑
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
DataResult EditColumnSet(ColumnSetReq model);
/// <summary>
/// 获取详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
DataResult<ColumnSetRes> GetColumnSetInfo(string id);
/// <summary>
/// 按模块获取列表设置详情
/// </summary>
/// <param name="permissionId">权限模块id</param>
/// <param name="columnNo">列表序号</param>
/// <returns></returns>
DataResult<ColumnSetRes> GetColumnSetInfoByModule(string permissionId,int columnNo = 0);
}

@ -31,6 +31,14 @@ public interface IFormSetService
/// <returns></returns>
DataResult<CodeFormSetRes> GetFormSetInfo(string id);
/// <summary>
/// 根据权限模块和表单序号获取详情
/// </summary>
/// <param name="permissionId">权限模块id</param>
/// <param name="formNo">表单序号</param>
/// <returns></returns>
public DataResult<CodeFormSetRes> GetFormSetInfoByModule(string permissionId, int formNo = 0);
}

@ -14,6 +14,9 @@ using SqlSugar;
namespace DS.WMS.Core.Code.Method;
/// <summary>
///
/// </summary>
public class CodeFormSetService : IFormSetService
{
private readonly IServiceProvider _serviceProvider;
@ -60,13 +63,13 @@ public class CodeFormSetService : IFormSetService
if (req.Id == 0)
{
if (tenantDb.Queryable<CodeFormSet>()
.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<CodeFormSet>();
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<CodeFormSet>()
.Where(x => x.Id == long.Parse(id))
.Where(x => x.Id == long.Parse(id) && x.Status == StatusEnum.Enable)
.Select<CodeFormSetRes>()
.First();
return DataResult<CodeFormSetRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 根据权限模块和表单序号获取详情
/// </summary>
/// <param name="permissionId"></param>
/// <param name="formNo"></param>
/// <returns></returns>
public DataResult<CodeFormSetRes> GetFormSetInfoByModule(string permissionId, int formNo = 0)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<CodeFormSet>()
.Where(x => x.PermissionId == long.Parse(permissionId) && x.FormNo == formNo && x.Status == StatusEnum.Enable)
.Select<CodeFormSetRes>()
.First();
return DataResult<CodeFormSetRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
}
}

@ -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
{
/// <summary>
///
/// </summary>
public class ColumnSetService : IColumnSetService
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
private readonly IUser user;
private readonly ISaasDbService saasService;
/// <summary>
///
/// </summary>
/// <param name="serviceProvider"></param>
public ColumnSetService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
user = _serviceProvider.GetRequiredService<IUser>();
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
}
/// <summary>
/// 编辑
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public DataResult EditColumnSet(ColumnSetReq req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
//var orgId = user.GetOrgId();
if (req.Id == 0)
{
if (tenantDb.Queryable<CodeColumnSet>()
.Where(x => x.ColumnNo == req.ColumnNo && x.PermissionId == req.PermissionId).Any())
{
return DataResult.Failed("列表字段设置已存在!", MultiLanguageConst.ColumnSetExist);
}
var data = req.Adapt<CodeColumnSet>();
data.DefaultContent = req.Content;
var entity = tenantDb.Insertable(data).ExecuteReturnEntity();
return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess);
}
else
{
var info = tenantDb.Queryable<CodeColumnSet>().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);
}
}
/// <summary>
/// 详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public DataResult<ColumnSetRes> GetColumnSetInfo(string id)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<CodeColumnSet>()
.Where(x => x.Id == long.Parse(id) && x.Status == StatusEnum.Enable)
.Select<ColumnSetRes>()
.First();
return DataResult<ColumnSetRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
///
/// </summary>
/// <param name="permissionId"></param>
/// <param name="columnNo"></param>
/// <returns></returns>
public DataResult<ColumnSetRes> GetColumnSetInfoByModule(string permissionId, int columnNo = 0)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = tenantDb.Queryable<CodeColumnSet>()
.Where(x => x.PermissionId == long.Parse(permissionId) && x.ColumnNo == columnNo && x.Status == StatusEnum.Enable)
.Select<ColumnSetRes>()
.First();
return DataResult<ColumnSetRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public DataResult<List<ColumnSetRes>> GetListByPage(PageRequest request)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
//序列化查询条件
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var data = tenantDb.Queryable<CodeColumnSet>()
.Where(whereList)
.Select<ColumnSetRes>().ToQueryPage(request.PageCondition);
return data;
}
}
}

@ -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;
/// <summary>
/// 列表字段设置 模块
/// </summary>
public class ColumnSetController : ApiController
{
private readonly IColumnSetService _invokeService;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="invokeService"></param>
public ColumnSetController(IColumnSetService invokeService)
{
_invokeService = invokeService;
}
/// <summary>
/// 列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
[Route("GetColumnSetList")]
public DataResult<List<ColumnSetRes>> GetColumnSetList([FromBody] PageRequest request)
{
var res = _invokeService.GetListByPage(request);
return res;
}
/// <summary>
/// 编辑
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("EditColumnSet")]
public DataResult EditColumnSet([FromBody] ColumnSetReq req)
{
var res = _invokeService.EditColumnSet(req);
return res;
}
/// <summary>
/// 详情
/// </summary>
/// <param name="id">Id</param>
/// <returns></returns>
[HttpGet]
[Route("GetColumnSetInfo")]
public DataResult<ColumnSetRes> GetColumnSetInfo([FromQuery] string id)
{
var res = _invokeService.GetColumnSetInfo(id);
return res;
}
/// <summary>
/// 按模块获取列表设置详情
/// </summary>
/// <param name="permissionId">权限模块id</param>
/// <param name="columnNo">列表序号</param>
/// <returns></returns>
[HttpGet]
[Route("GetColumnSetInfoByModule")]
public DataResult<ColumnSetRes> GetColumnSetInfoByModule([FromQuery] string permissionId, int columnNo = 0)
{
var res = _invokeService.GetColumnSetInfoByModule(permissionId, columnNo);
return res;
}
}

@ -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
{
/// <summary>
/// Excel服务 模块
/// </summary>
public class ExcelController : ApiController
{
private readonly IExcelService _invokeService;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="invokeService"></param>
public ExcelController(IExcelService invokeService)
{
_invokeService = invokeService;
}
/// <summary>
/// 根据用户列导出Excel数据
/// </summary>
/// <param name="req">请求数据</param>
/// <returns></returns>
[HttpPost]
[Route("ExportExcelByColumn")]
public DataResult<string> ExportExcelByColumn([FromBody] ExportByColumnReq req)
{
return _invokeService.ExportExcelByColumn(req);
}
}
}

@ -61,6 +61,18 @@ public class FormSetController : ApiController
var res = _invokeService.GetFormSetInfo(id);
return res;
}
/// <summary>
/// 按模块获取表单设置详情
/// </summary>
/// <param name="permissionId">权限模块id</param>
/// <param name="formNo">表单序号</param>
/// <returns></returns>
[HttpGet]
[Route("GetFormSetInfoByModule")]
public DataResult<CodeFormSetRes> GetFormSetInfoByModule([FromQuery] string permissionId, int formNo = 0)
{
var res = _invokeService.GetFormSetInfoByModule(permissionId, formNo);
return res;
}
}

@ -30,6 +30,7 @@
<ItemGroup>
<ProjectReference Include="..\DS.Module.AutofacModule\DS.Module.AutofacModule.csproj" />
<ProjectReference Include="..\DS.Module.ExcelModule\DS.Module.ExcelModule.csproj" />
<ProjectReference Include="..\DS.Module.Jwt\DS.Module.Jwt.csproj" />
<ProjectReference Include="..\DS.Module.Middleware\DS.Module.Middleware.csproj" />
<ProjectReference Include="..\DS.Module.MultiLanguage\DS.Module.MultiLanguage.csproj" />
@ -38,4 +39,8 @@
<ProjectReference Include="..\DS.WMS.Core\DS.WMS.Core.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\export\" />
</ItemGroup>
</Project>

@ -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.

@ -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();

@ -27,6 +27,7 @@
<ItemGroup>
<ProjectReference Include="..\DS.Module.AutofacModule\DS.Module.AutofacModule.csproj" />
<ProjectReference Include="..\DS.Module.Core\DS.Module.Core.csproj" />
<ProjectReference Include="..\DS.Module.ExcelModule\DS.Module.ExcelModule.csproj" />
<ProjectReference Include="..\DS.Module.PrintModule\DS.Module.PrintModule.csproj" />
<ProjectReference Include="..\DS.WMS.Core\DS.WMS.Core.csproj" />
</ItemGroup>

@ -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<ISqlSugarClient>();
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
//_ExcelService = _serviceProvider.GetRequiredService<IExcelService>();
}
/// <summary>
/// 获取Json打印信息
/// </summary>
[Fact]
public void GetExportExcleInfo()
{
List<UserColumnSet> set = new List<UserColumnSet>();
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<Dictionary<string, object>>();
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<string, object>
{
{ columnSet.Title, temp[key] },
};
values.Add(info);
}
}
Console.WriteLine(values);
Assert.True(true);
}
}

@ -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}

Loading…
Cancel
Save