usertest
ZR20090193-陈敬勇 6 months ago
parent 65e7d69fce
commit 3701d20f5a

@ -55,32 +55,72 @@ namespace DS.WMS.MainApi.Controllers
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
[Route("GetOpenJsonPrintInfo")] [Route("GetOpenJsonPrintInfo")]
public IActionResult GetOpenJsonPrintInfo([FromBody] OpenJsonPrintReq req) public DataResult<PrintStreamRes> GetOpenJsonPrintInfo([FromBody] OpenJsonPrintReq req)
{ {
var res =_invokeService.GetOpenJsonPrintStream(req); var res =_invokeService.GetOpenJsonPrintStream(req);
return res;
//if (res.Succeeded)
//{
// var printData = res.Data.PrintData;
// HttpContext.Response.Headers.Add("Content-Length", printData.Length.ToString());
// HttpContext.Response.Headers.Add("Content-Type", "charset=UTF-8");
// Byte[] info = Convert.FromBase64String(printData);
// if (res.Data.PrintType =="1")
// {
// return File(info, "application/octet-stream;charset=UTF-8", Guid.NewGuid() + ".pdf");
// }
// else if (res.Data.PrintType == "2")
// {
// return File(info, "application/octet-stream;charset=UTF-8", Guid.NewGuid() + ".xlsx");
// }
// else
// {
// return File(info, "application/octet-stream;charset=UTF-8", Guid.NewGuid() + ".doc");
// }
//}
//else
//{
// throw new Exception(res.Message);
//}
}
/// <summary>
/// 获取Json打印信息Stream
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("GetOpenJsonPrintStream")]
public IActionResult GetOpenJsonPrintStream([FromBody] OpenJsonPrintReq req)
{
var res = _invokeService.GetOpenJsonPrintStream(req);
if (res.Succeeded) if (res.Succeeded)
{ {
var printData = res.Data.PrintData; var printData = res.Data.PrintData;
HttpContext.Response.Headers.Add("Content-Length", printData.Length.ToString()); //HttpContext.Response.Headers.Add("Content-Length", printData.Length.ToString());
HttpContext.Response.Headers.Add("Content-Type", "charset=UTF-8"); HttpContext.Response.Headers.Add("Content-Type", "charset=UTF-8");
if (res.Data.PrintType =="1") Byte[] info = Convert.FromBase64String(printData);
if (res.Data.PrintType == "1")
{ {
return File(printData, "application/octet-stream;charset=UTF-8", Path.GetFileName(Guid.NewGuid() + ".pdf")); return File(info, "application/octet-stream;charset=UTF-8", "test.pdf");
} }
else if (res.Data.PrintType == "2") else if (res.Data.PrintType == "2")
{ {
return File(printData, "application/octet-stream;charset=UTF-8", Path.GetFileName(Guid.NewGuid() + ".xlsx")); return File(info, "application/octet-stream;charset=UTF-8", Guid.NewGuid() + ".xlsx");
} }
else else
{ {
return File(printData, "application/octet-stream;charset=UTF-8", Path.GetFileName(Guid.NewGuid() + ".doc")); return File(info, "application/octet-stream;charset=UTF-8", Guid.NewGuid() + ".doc");
} }
} }
else else
{ {
throw new Exception(res.Message); throw new Exception(res.Message);
} }
} }
} }

@ -1314,3 +1314,45 @@
2024-05-21 17:57:10.4988 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-05-21 17:57:10.4988 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-05-21 17:57:10.5145 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile 2024-05-21 17:57:10.5145 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-21 17:57:10.5426 Info Configuration initialized. 2024-05-21 17:57:10.5426 Info Configuration initialized.
2024-05-22 17:18:26.7695 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-22 17:18:26.8107 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-22 17:18:26.8214 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-22 17:18:26.8568 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-05-22 17:18:26.8894 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-05-22 17:18:26.9021 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-22 17:18:26.9344 Info Configuration initialized.
2024-05-22 17:24:55.5305 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-22 17:24:55.6221 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-22 17:24:55.6804 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-22 17:24:55.7547 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-05-22 17:24:55.7929 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-05-22 17:24:55.8267 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-22 17:24:55.8684 Info Configuration initialized.
2024-05-22 17:28:27.6189 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-22 17:28:27.6402 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-22 17:28:27.6484 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-22 17:28:27.6701 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-05-22 17:28:27.6840 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-05-22 17:28:27.6840 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-22 17:28:27.7057 Info Configuration initialized.
2024-05-22 17:32:05.9318 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-22 17:32:05.9751 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-22 17:32:05.9884 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-22 17:32:06.0232 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-05-22 17:32:06.0496 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-05-22 17:32:06.0647 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-22 17:32:06.0837 Info Configuration initialized.
2024-05-22 17:51:34.0865 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-22 17:51:34.1300 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-22 17:51:34.1454 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-22 17:51:34.1826 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-05-22 17:51:34.2076 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-05-22 17:51:34.2076 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-22 17:51:34.2424 Info Configuration initialized.
2024-05-22 18:00:17.1499 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-05-22 18:00:17.1777 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-05-22 18:00:17.1923 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-05-22 18:00:17.2195 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-05-22 18:00:17.2391 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-05-22 18:00:17.2391 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-05-22 18:00:17.2682 Info Configuration initialized.

@ -56,6 +56,6 @@
"AccessSecret": "d816e6fe938f24e2f205db129d31286a", "AccessSecret": "d816e6fe938f24e2f205db129d31286a",
"GetModuleListUrl": "/printApi/OpenPrint/GetPrintModuleList", "GetModuleListUrl": "/printApi/OpenPrint/GetPrintModuleList",
"GetTemplateListUrl": "/printApi/OpenPrint/GetPrintTemplateList", "GetTemplateListUrl": "/printApi/OpenPrint/GetPrintTemplateList",
"GetJsonPrintInfoUrl": "/printApi/OpenPrint/GetOpenJsonPrintInfo" "GetJsonPrintInfoUrl": "/printApi/OpenPrint/GetOpenJsonPrintStream"
} }
} }
Loading…
Cancel
Save