打印模板修改 添加模板编码及接口

usertest
cjy 4 months ago
parent 5a7aa688d6
commit ee4e65033b

@ -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,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.Module.OcrModule
{
public interface IOcrService
{
//public Task<DataResult<string>>
}
}

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.Module.OcrModule
{
public class OcrService: IOcrService
{
}
}

@ -51,5 +51,11 @@ namespace DS.WMS.Core.Sys.Dtos
/// </summary>
[Description("创建人名称")]
public string CreateUserName { get; set; }
/// <summary>
/// 模板数量
/// </summary>
public int TemplateCount { get; set; }
}
}

@ -23,6 +23,11 @@ namespace DS.WMS.Core.Sys.Dtos
/// </summary>
public long ModuleId { get; set; }
/// <summary>
///打印模板唯一编码
/// </summary>
[Description("打印模板唯一编码")]
public string TemplateCode { get; set; }
/// <summary>
///打印模板名称
/// </summary>
[Description("打印模板名称")]
@ -97,6 +102,8 @@ namespace DS.WMS.Core.Sys.Dtos
{
this.RuleFor(o => o.TemplateName)
.NotEmpty().WithName("打印模板名称");
this.RuleFor(o => o.TemplateCode)
.NotEmpty().WithName("打印模板唯一编码");
this.RuleFor(o => o.PrintType)
.NotEmpty().WithName("打印类型");
}

@ -23,6 +23,11 @@ namespace DS.WMS.Core.Sys.Dtos
/// </summary>
public long ModuleId { get; set; }
/// <summary>
///打印模板唯一编码
/// </summary>
[Description("打印模板唯一编码")]
public string TemplateCode { get; set; }
/// <summary>
///打印模板名称
/// </summary>
[Description("打印模板名称")]

@ -15,6 +15,12 @@ public class SysPrintTemplate : BaseTenantModel<long>
[SqlSugar.SugarColumn(ColumnDescription = "打印模块Id", IsNullable = false, DefaultValue = "0")]
public long ModuleId { get; set; }
/// <summary>
///打印模板唯一编码
/// </summary>
[Description("打印模板唯一编码")]
[SqlSugar.SugarColumn(ColumnDescription = "打印模板唯一编码", IsNullable = false, Length = 50)]
public string TemplateCode { get; set; }
/// <summary>
///打印模板名称
/// </summary>
[Description("打印模板名称")]

@ -60,5 +60,18 @@ namespace DS.WMS.Core.Sys.Interface
/// <param name="req"></param>
/// <returns></returns>
public DataResult BatchDelPrintModule(IdModel req);
/// <summary>
/// 打印模块列表
/// </summary>
/// <returns></returns>
public Task<DataResult<List<SysPrintModuleRes>>> GetOpenPrintModuleList();
/// <summary>
/// 打印模板列表
/// </summary>
/// <returns></returns>
public Task<DataResult<List<SysPrintTemplateRes>>> GetOpenPrintTemplateList(string id);
}
}

@ -10,6 +10,8 @@ using DS.Module.Core.Extensions;
using DS.Module.Core.Data;
using DS.Module.SqlSugar;
using DS.WMS.Core.Code.Entity;
using Org.BouncyCastle.Ocsp;
using System.Collections.Generic;
namespace DS.WMS.Core.Sys.Method
{
@ -98,6 +100,11 @@ namespace DS.WMS.Core.Sys.Method
{
if (req.Id == 0)
{
var isExist = db.Queryable<SysPrintTemplate>().Where(x => x.TemplateCode == req.TemplateCode).First();
if (isExist != null)
{
return DataResult.Failed("打印模板唯一编码已存在!");
}
var data = req.Adapt<SysPrintTemplate>();
var entity = db.Insertable(data).ExecuteReturnEntity();
@ -136,5 +143,25 @@ namespace DS.WMS.Core.Sys.Method
}
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
}
public async Task<DataResult<List<SysPrintModuleRes>>> GetOpenPrintModuleList()
{
var data = await db.Queryable<SysPrintModule>().Where(x=>x.Disable == false)
.Select<SysPrintModuleRes>()
.Mapper(async it =>
{
it.TemplateCount = await db.Queryable<SysPrintTemplate>().Where(x => x.ModuleId == it.Id && x.Disable == false).CountAsync();
} )
.ToListAsync();
return await Task.FromResult(DataResult<List<SysPrintModuleRes>>.Success(data));
}
public async Task<DataResult<List<SysPrintTemplateRes>>> GetOpenPrintTemplateList(string id)
{
var data = await db.Queryable<SysPrintTemplate>().Where(x => x.Disable == false && x.ModuleId == long.Parse(id))
.Select<SysPrintTemplateRes>()
.ToListAsync();
return await Task.FromResult(DataResult<List<SysPrintTemplateRes>>.Success(data));
}
}
}

@ -5,6 +5,8 @@ using DS.Module.ExcelModule;
using DS.Module.ExcelModule.Model;
using DS.Module.PrintModule;
using DS.WMS.Core.Code.Interface;
using DS.WMS.Core.Sys.Dtos;
using DS.WMS.Core.Sys.Interface;
using LanguageExt.Common;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
@ -17,78 +19,78 @@ namespace DS.WMS.MainApi.Controllers
/// </summary>
public class PrintController : ApiController
{
private readonly IPrintService _invokeService;
private readonly ISysPrintTemplateService _invokeService;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="invokeService"></param>
public PrintController(IPrintService invokeService)
public PrintController(ISysPrintTemplateService invokeService)
{
_invokeService = invokeService;
}
/// <summary>
/// 获取打印模块列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetOpenPrintModuleList")]
[Obsolete]
public DataResult GetOpenPrintModuleList()
{
return _invokeService.GetOpenPrintModuleList();
}
///// <summary>
///// 获取打印模块列表
///// </summary>
///// <returns></returns>
//[HttpGet]
//[Route("GetOpenPrintModuleList")]
//[Obsolete]
//public DataResult GetOpenPrintModuleList()
//{
// return _invokeService.GetOpenPrintModuleList();
//}
/// <summary>
/// 获取打印模板列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetOpenPrintTemplateList")]
[Obsolete]
public DataResult GetOpenPrintTemplateList([FromQuery] string id)
{
return _invokeService.GetOpenPrintTemplateList(id);
}
///// <summary>
///// 获取打印模板列表
///// </summary>
///// <returns></returns>
//[HttpGet]
//[Route("GetOpenPrintTemplateList")]
//[Obsolete]
//public DataResult GetOpenPrintTemplateList([FromQuery] string id)
//{
// return _invokeService.GetOpenPrintTemplateList(id);
//}
/// <summary>
/// 获取打印模板列表-异步
/// </summary>
/// <returns></returns>
[HttpGet]
[Obsolete]
[Route("GetOpenPrintTemplateListAsync")]
public async Task<DataResult> GetOpenPrintTemplateListAsync([FromQuery] string id)
{
return await _invokeService.GetOpenPrintTemplateListAsync(id);
}
/// <summary>
/// 获取Json打印信息
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Obsolete]
[Route("GetOpenJsonPrintInfo")]
public DataResult GetOpenJsonPrintInfo([FromBody] OpenJsonPrintReq req)
{
var res =_invokeService.GetOpenJsonPrintInfo(req);
return res;
}
/// <summary>
/// 获取Json打印信息-异步
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Obsolete]
[Route("GetOpenJsonPrintInfoAsync")]
public async Task<DataResult> GetOpenJsonPrintInfoAsync([FromBody] OpenJsonPrintReq req)
{
var res = await _invokeService.GetOpenJsonPrintInfoAsync(req);
return res;
}
///// <summary>
///// 获取打印模板列表-异步
///// </summary>
///// <returns></returns>
//[HttpGet]
//[Obsolete]
//[Route("GetOpenPrintTemplateListAsync")]
//public async Task<DataResult> GetOpenPrintTemplateListAsync([FromQuery] string id)
//{
// return await _invokeService.GetOpenPrintTemplateListAsync(id);
//}
///// <summary>
///// 获取Json打印信息
///// </summary>
///// <param name="req"></param>
///// <returns></returns>
//[HttpPost]
//[Obsolete]
//[Route("GetOpenJsonPrintInfo")]
//public DataResult GetOpenJsonPrintInfo([FromBody] OpenJsonPrintReq req)
//{
// var res =_invokeService.GetOpenJsonPrintInfo(req);
// return res;
//}
///// <summary>
///// 获取Json打印信息-异步
///// </summary>
///// <param name="req"></param>
///// <returns></returns>
//[HttpPost]
//[Obsolete]
//[Route("GetOpenJsonPrintInfoAsync")]
//public async Task<DataResult> GetOpenJsonPrintInfoAsync([FromBody] OpenJsonPrintReq req)
//{
// var res = await _invokeService.GetOpenJsonPrintInfoAsync(req);
// return res;
//}
///// <summary>
///// 获取Json打印信息Stream
///// </summary>
@ -128,7 +130,28 @@ namespace DS.WMS.MainApi.Controllers
// }
//}
/// <summary>
/// 获取打印模块列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetOpenPrintModuleList")]
public async Task<DataResult<List<SysPrintModuleRes>>> GetOpenPrintModuleList()
{
return await _invokeService.GetOpenPrintModuleList();
}
/// <summary>
/// 获取打印模板列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetOpenPrintTemplateList")]
public async Task<DataResult<List<SysPrintTemplateRes>>> GetOpenPrintTemplateList([FromQuery]string id)
{
return await _invokeService.GetOpenPrintTemplateList(id);
}
/// <summary>
/// 获取Json本地打印信息
/// </summary>

@ -63,7 +63,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DS.WMS.TaskApi", "DS.WMS.Ta
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DS.Module.EmailModule", "DS.Module.EmailModule\DS.Module.EmailModule.csproj", "{4B51DCC1-62A5-49C5-978B-798E6B48F3C0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DS.WMS.PrintApi", "DS.WMS.PrintApi\DS.WMS.PrintApi.csproj", "{274B1D18-A15A-4917-A567-6FDCD090D5B0}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DS.WMS.PrintApi", "DS.WMS.PrintApi\DS.WMS.PrintApi.csproj", "{274B1D18-A15A-4917-A567-6FDCD090D5B0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DS.Module.OcrModule", "DS.Module.OcrModule\DS.Module.OcrModule.csproj", "{3EB9CA1E-5910-42A5-A64D-0CB435F6A64A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -183,6 +185,10 @@ Global
{274B1D18-A15A-4917-A567-6FDCD090D5B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{274B1D18-A15A-4917-A567-6FDCD090D5B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{274B1D18-A15A-4917-A567-6FDCD090D5B0}.Release|Any CPU.Build.0 = Release|Any CPU
{3EB9CA1E-5910-42A5-A64D-0CB435F6A64A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3EB9CA1E-5910-42A5-A64D-0CB435F6A64A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3EB9CA1E-5910-42A5-A64D-0CB435F6A64A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3EB9CA1E-5910-42A5-A64D-0CB435F6A64A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -216,6 +222,7 @@ Global
{8DAE16A3-E249-4C86-BEEC-DA8429FD837C} = {65D75DB2-12D5-4D1F-893D-9750905CE5E4}
{4B51DCC1-62A5-49C5-978B-798E6B48F3C0} = {518DB9B5-80A8-4B2C-8570-52BD406458DE}
{274B1D18-A15A-4917-A567-6FDCD090D5B0} = {65D75DB2-12D5-4D1F-893D-9750905CE5E4}
{3EB9CA1E-5910-42A5-A64D-0CB435F6A64A} = {518DB9B5-80A8-4B2C-8570-52BD406458DE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {66115F23-94B4-43C0-838E-33B5CF77F788}

Loading…
Cancel
Save