打印服务及相关单元测试
parent
16950d3a59
commit
3342953e2c
@ -0,0 +1,65 @@
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
@ -1,42 +1,51 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"JwtSettings": {
|
||||
"Issuer": "vol.core.owner",
|
||||
"Audience": "vol.core",
|
||||
"User": "C5ABA9E202D94C43A3CA66002BF77FAF",
|
||||
"SecretKey": "sdfsdfsrty45634kkhllghtdgdfss345t678fs"
|
||||
},
|
||||
"Cors": {
|
||||
"PolicyName": "WMSCore.API",
|
||||
"Url": "http://localhost:8000,http://localhost:5999,http://localhost:8088,http://localhost:5173,http://0.0.0.0:5999,http://0.0.0.0:9995,http://localhost:9995,http://60.209.125.238:9995,http://localhost:3000,https://localhost:3100,http://47.104.255.182:3100,http://47.104.255.182:3110,https://localhost:3110,http://localhost:8080,http://localhost:8081,http://localhost:8082,http://localhost:8083,http://localhost:8084"
|
||||
},
|
||||
"DBInfo": {
|
||||
"DefaultDbConnId": "1288018625843826688",
|
||||
"DefaultDbType": 0,
|
||||
"DefaultDbString": "server=60.209.125.238;port=32006;uid=root;pwd=Djy@Mysql.test;database=shippingweb8_dev",
|
||||
"DBS": [
|
||||
{
|
||||
"ConnId": "1595354960864874496",
|
||||
"DBType": 1,
|
||||
"Enabled": false,
|
||||
"HitRate": 40,
|
||||
"Connection": "Data Source=47.105.193.36,11435;Initial Catalog=SHIPPINGWEB_JNHJ;Integrated Security=False;Connect Timeout=500;User ID=sa;Password=Ds20040201",
|
||||
"ProviderName": "System.Data.SqlClient"
|
||||
}
|
||||
]
|
||||
},
|
||||
"SwaggerDoc": {
|
||||
"ContactName": "WmsAdminAPI",
|
||||
"ContactEmail": "Wms API.Core@xxx.com",
|
||||
"ContactUrl": "https://www.xxx.com",
|
||||
"Version": "1.0",
|
||||
"Title": "Wms Admin API",
|
||||
"Description": "Wms Admin API"
|
||||
},
|
||||
"PrintService": {
|
||||
"IP": "60.209.125.238",
|
||||
"Port": "3009",
|
||||
"AccessKey": "1777229107311022080",
|
||||
"AccessSecret": "d816e6fe938f24e2f205db129d31286a",
|
||||
"GetModuleListUrl": "/printApi/OpenPrint/GetPrintModuleList",
|
||||
"GetTemplateListUrl": "/printApi/OpenPrint/GetPrintTemplateList",
|
||||
"GetJsonPrintInfoUrl": "/printApi/OpenPrint/GetOpenJsonPrintInfo"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"JwtSettings": {
|
||||
"Issuer": "vol.core.owner",
|
||||
"Audience": "vol.core",
|
||||
"User": "C5ABA9E202D94C43A3CA66002BF77FAF",
|
||||
"SecretKey": "sdfsdfsrty45634kkhllghtdgdfss345t678fs"
|
||||
},
|
||||
"Cors": {
|
||||
"PolicyName": "WMSCore.API",
|
||||
"Url": "http://localhost:8000,http://localhost:5999,http://localhost:8088,http://localhost:5173,http://0.0.0.0:5999,http://0.0.0.0:9995,http://localhost:9995,http://60.209.125.238:9995,http://localhost:3000,https://localhost:3100,http://47.104.255.182:3100,http://47.104.255.182:3110,https://localhost:3110,http://localhost:8080,http://localhost:8081,http://localhost:8082,http://localhost:8083,http://localhost:8084"
|
||||
},
|
||||
"DBInfo": {
|
||||
"DefaultDbConnId": "1288018625843826688",
|
||||
"DefaultDbType": 0,
|
||||
"DefaultDbString": "server=60.209.125.238;port=32006;uid=root;pwd=Djy@Mysql.test;database=shippingweb8_dev",
|
||||
"DBS": [
|
||||
{
|
||||
"ConnId": "1595354960864874496",
|
||||
"DBType": 1,
|
||||
"Enabled": false,
|
||||
"HitRate": 40,
|
||||
"Connection": "Data Source=47.105.193.36,11435;Initial Catalog=SHIPPINGWEB_JNHJ;Integrated Security=False;Connect Timeout=500;User ID=sa;Password=Ds20040201",
|
||||
"ProviderName": "System.Data.SqlClient"
|
||||
}
|
||||
]
|
||||
},
|
||||
"SwaggerDoc": {
|
||||
"ContactName": "WmsAdminAPI",
|
||||
"ContactEmail": "Wms API.Core@xxx.com",
|
||||
"ContactUrl": "https://www.xxx.com",
|
||||
"Version": "1.0",
|
||||
"Title": "Wms Admin API",
|
||||
"Description": "Wms Admin API"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue