You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
2.1 KiB
C#

using System.Reflection;
using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.Module.PrintModule;
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 SqlSugar;
using SqlSugar.IOC;
using Xunit;
namespace Ds.WMS.Test;
public class PrintTest
{
private readonly IServiceProvider _serviceProvider;
private readonly SqlSugarScope db;
private readonly ISaasDbService saasService;
private readonly IPrintService _printService;
public PrintTest(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
db = (SqlSugarScope)_serviceProvider.GetRequiredService<ISqlSugarClient>();
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
_printService = _serviceProvider.GetRequiredService<IPrintService>();
}
/// <summary>
/// 获取打印模块列表
/// </summary>
[Fact]
public void GetOpenPrintModuleList()
{
var data = _printService.GetOpenPrintModuleList();
Assert.True(data.Succeeded);
}
/// <summary>
/// 获取打印模板列表
/// </summary>
[Fact]
public void GetOpenPrintTemplateList()
{
var data = _printService.GetOpenPrintTemplateList("1777229219986804736");
Assert.True(data.Succeeded);
}
/// <summary>
/// 获取Json打印信息
/// </summary>
[Fact]
public void GetOpenJsonPrintInfo()
{
var req = new OpenJsonPrintReq()
{
TemplateId = 1777232318486941696,
JsonDataStr = "{\"GID\":\"52fc4ecf-5c88-49a8-aa1f-08da84ccc2d3\",\"BILLTYPE\":false,\"TRUCKNO\":\"鲁A789\",\"BoxWeigth\":10540,\"BoxCode\":\"A124\",\"BoxCode2\":null,\"ISTwoBox\":false,\"CORPID\":null,\"CreateDate\":\"2023-12-22T09:55:43.0332931+08:00\",\"CreateID\":null,\"Creator\":null,\"TURNOVERDATE\":\"2023-12-22T09:55:43.0333166+08:00\",\"Modifier\":null,\"ModifyDate\":null,\"ModifyID\":null,\"REMARK\":null}"
};
var data = _printService.GetOpenJsonPrintInfo(req);
Assert.True(data.Succeeded);
}
}