|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Text;
|
|
|
|
|
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.Sys.Entity;
|
|
|
|
|
using DS.WMS.Core.Sys.Interface;
|
|
|
|
|
using Masuit.Tools.Strings;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
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>
|
|
|
|
|
/// <20><>ȡ<EFBFBD><C8A1>ӡģ<D3A1><C4A3><EFBFBD>б<EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Fact]
|
|
|
|
|
public void GetOpenPrintModuleList()
|
|
|
|
|
{
|
|
|
|
|
var data = _printService.GetOpenPrintModuleList();
|
|
|
|
|
Assert.True(data.Succeeded);
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><>ȡ<EFBFBD><C8A1>ӡģ<D3A1><C4A3><EFBFBD>б<EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Fact]
|
|
|
|
|
public void GetOpenPrintTemplateList()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var data = _printService.GetOpenPrintTemplateList("1777229219986804736");
|
|
|
|
|
Assert.True(data.Succeeded);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><>ȡJson<6F><6E>ӡ<EFBFBD><D3A1>Ϣ
|
|
|
|
|
/// </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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// base64 ת<>ļ<EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Fact]
|
|
|
|
|
public void ConvertPrint()
|
|
|
|
|
{
|
|
|
|
|
var str = "JVBERi0xLjUNCiXi48/TDQoyIDAgb2JqDQo8PA0KL0ZpbHRlciAvRmxhdGVEZWNvZGUNCi9MZW5ndGggMzQzDQo+Pg0Kc3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0973tZfeSL+3bHvjj7+T573+Ie/e/nj7/yrn3+88nju8exftR4X3fxXucd+8Nizj5147J8f+/vH/uaxv3riO4990fMee+SJbz/2vsd+9om7H5t49C8e/cKji9/56+984ztffbTxaOI7/+nb//ztp7/999/58W8//J1bvn3ft982/bnpz0w/Mv3J6YemPzz9m9O/Nv3B6fdPv2/6p6b2fuWTnvfVV371mqnsV97reV95t6Q3ffkdX/mlL3/rS09/6W++9N0vfeJLH//SR7/0wPivjZ/82KznffnBO7935xcGnxz83B1fuTF7wx/e8Ks3XH3D7us/f/3nrv/s9Z+6/o+u/8Pr/4vnJfYn9iWuTVyTuDpxVSDPfUn3e/3Zv9j/DG868z8pmlF0lf9F+/x5KnvEUf9BZy+/8dKgWe0//6bTd2+V9PZV6y69qB5/TT3/R1GaXwu+Hnwj+AvvpuCbwV96h7zDwbeCbwePBt8JHgseD57wbvZuCf4q+G7w18HfBH/r3Rr81+DJ4KngvwX/Pfh/g78Lvhf8ffAPwdPBPwb/FPxz8C/B/wj+Nfh+cCJ4Jng2+EHwXPA/g5PBqbgn0h6LB/G4d1s8EU/GU/F0PBPPxnPxvLfoLcUL8WK8JPqgEq96t3tHvDviNe9O7654Pd6IN+Mtb9l7bbwdH4gPeq+LD3l3e0fjw97r4yPx0fia+JT3bu/HgzVBJxj3ngu6fdsXX2usX3xdMOHH
|
|
|
|
|
|
|
|
|
|
using (FileStream fs = new FileStream("D://text.pdf", FileMode.Create))
|
|
|
|
|
{
|
|
|
|
|
Byte[] info = Convert.FromBase64String(str);
|
|
|
|
|
fs.Write(info, 0, info.Length);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Assert.True(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|