|
|
|
|
using DS.WMS.PrintApi.Model;
|
|
|
|
|
using DS.WMS.PrintApi.Service;
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.PrintApi.Controllers
|
|
|
|
|
{
|
|
|
|
|
[Route("printApi/[controller]")]
|
|
|
|
|
[ApiController]
|
|
|
|
|
public class OpenPrintController : Controller
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
private readonly IOpenPrintService _invokeService;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 构造函数
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="invokeService"></param>
|
|
|
|
|
public OpenPrintController(IOpenPrintService invokeService)
|
|
|
|
|
{
|
|
|
|
|
_invokeService = invokeService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据模板Id获取Json打印信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="req"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
[Route("GetOpenJsonPrintInfoAsync")]
|
|
|
|
|
public async Task<PrintDataResult> GetOpenJsonPrintInfo([FromBody] OpenJsonPrintReq req)
|
|
|
|
|
{
|
|
|
|
|
var res = await _invokeService.GetOpenJsonPrintInfo(req);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据模板Code获取Json打印信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="req"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
[Route("GetOpenJsonPrintInfoByTemplateCode")]
|
|
|
|
|
public async Task<PrintDataResult> GetOpenJsonPrintInfoByTemplateCode([FromBody] OpenJsonPrintByCodeReq req)
|
|
|
|
|
{
|
|
|
|
|
var res = await _invokeService.GetOpenJsonPrintInfoByTemplateCode(req);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// sql数据源打印
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="req"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
[Route("GetOpenSqlPrintInfo")]
|
|
|
|
|
public async Task<PrintDataResult> GetOpenSqlPrintInfo([FromBody] OpenSqlPrintReq req)
|
|
|
|
|
{
|
|
|
|
|
var res = await _invokeService.GetOpenSqlPrintInfo(req);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 下载sql打印源文件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="req"></param>
|
|
|
|
|
/// <returns>返回打印frx文件</returns>
|
|
|
|
|
[HttpPost]
|
|
|
|
|
[Route("DownloadSqlPrintFile")]
|
|
|
|
|
[ProducesResponseType(typeof(FileResult), StatusCodes.Status200OK)]
|
|
|
|
|
public async Task<IActionResult> DownloadSqlPrintFile([FromBody] OpenSqlPrintReq req)
|
|
|
|
|
{
|
|
|
|
|
return await _invokeService.DownloadSqlPrintFile(req);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|