|
|
@ -1,5 +1,7 @@
|
|
|
|
using DS.Module.Core;
|
|
|
|
using Amazon.Runtime.Internal.Util;
|
|
|
|
|
|
|
|
using DS.Module.Core;
|
|
|
|
using DS.Module.Core.Data;
|
|
|
|
using DS.Module.Core.Data;
|
|
|
|
|
|
|
|
using DS.Module.Core.Helpers;
|
|
|
|
using DS.WMS.Core.Info.Dtos;
|
|
|
|
using DS.WMS.Core.Info.Dtos;
|
|
|
|
using DS.WMS.Core.Info.Interface;
|
|
|
|
using DS.WMS.Core.Info.Interface;
|
|
|
|
using DS.WMS.Core.Op.Dtos;
|
|
|
|
using DS.WMS.Core.Op.Dtos;
|
|
|
@ -8,6 +10,8 @@ using DS.WMS.Core.Op.Interface;
|
|
|
|
using DS.WMS.Core.Sys.Dtos;
|
|
|
|
using DS.WMS.Core.Sys.Dtos;
|
|
|
|
using DS.WMS.Core.Sys.Interface;
|
|
|
|
using DS.WMS.Core.Sys.Interface;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
|
|
using NPOI.XWPF.UserModel;
|
|
|
|
using Org.BouncyCastle.Ocsp;
|
|
|
|
using Org.BouncyCastle.Ocsp;
|
|
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.OpApi.Controllers;
|
|
|
|
namespace DS.WMS.OpApi.Controllers;
|
|
|
@ -18,14 +22,15 @@ namespace DS.WMS.OpApi.Controllers;
|
|
|
|
public class SeaExportController : ApiController
|
|
|
|
public class SeaExportController : ApiController
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private readonly ISeaExportService _invokeService;
|
|
|
|
private readonly ISeaExportService _invokeService;
|
|
|
|
|
|
|
|
private readonly ISeaExportCommonService _commonService;
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 构造函数
|
|
|
|
/// 构造函数
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="invokeService"></param>
|
|
|
|
/// <param name="invokeService"></param>
|
|
|
|
public SeaExportController(ISeaExportService invokeService)
|
|
|
|
public SeaExportController(ISeaExportService invokeService, ISeaExportCommonService commonService)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_invokeService = invokeService;
|
|
|
|
_invokeService = invokeService;
|
|
|
|
|
|
|
|
_commonService = commonService;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -274,4 +279,84 @@ public class SeaExportController : ApiController
|
|
|
|
return res;
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 上传OCR附件
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="file">文件信息</param>
|
|
|
|
|
|
|
|
/// <param name="req">业务附件请求实体 TypeCode = "other",TypeName = "其他"</param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
|
|
[Route("UploadOcrFile")]
|
|
|
|
|
|
|
|
public async Task<DataResult<string>> UploadOcrFile(IFormFile file, [FromForm] OpFileReq req)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var res = _invokeService.UploadOcrFile(file, req);
|
|
|
|
|
|
|
|
return await res;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 获取文字
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="fileName">文件名称</param>
|
|
|
|
|
|
|
|
/// <param name="scale">缩放比例</param>
|
|
|
|
|
|
|
|
/// <param name="x">x坐标</param>
|
|
|
|
|
|
|
|
/// <param name="y">y坐标</param>
|
|
|
|
|
|
|
|
/// <param name="w">宽度</param>
|
|
|
|
|
|
|
|
/// <param name="h">高度</param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
[HttpGet("GetOcrText")]
|
|
|
|
|
|
|
|
public async Task<DataResult<string>> GetOcrText([FromQuery] string fileName, float scale, int x, int y, int w, int h)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var config = await _commonService.GetConfigData("ocr_api_url");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!config.Succeeded)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return await Task.FromResult(DataResult<string>.Failed("OCR接口地址未配置!"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var url = config.Data;
|
|
|
|
|
|
|
|
if (!url.EndsWith("/"))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
url += "/";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var postUrl = $"{url}pdf/getRegionText?fileName={fileName}&scale={scale}&x={x}&y={y}&w={w}&h={h}";
|
|
|
|
|
|
|
|
//var str = await $"{url}pdf/getRegionText?fileName={fileName}&scale={scale}&x={x}&y={y}&w={w}&h={h}"
|
|
|
|
|
|
|
|
//.PostAsStringAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var str = RequestHelper.Post("",url);
|
|
|
|
|
|
|
|
return await Task.FromResult(DataResult<string>.Success(str)); ;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 获取图片
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="fileName">文件名称</param>
|
|
|
|
|
|
|
|
/// <param name="scale">缩放比例,默认为1.5</param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
|
|
|
[Route("GetOcrImg")]
|
|
|
|
|
|
|
|
[ProducesResponseType(typeof(FileResult), StatusCodes.Status200OK)]
|
|
|
|
|
|
|
|
public async Task<IActionResult> GetOcrImg([FromQuery] string fileName, float scale = 1.5f)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var config = await _commonService.GetConfigData("ocr_api_url");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (!config.Succeeded)
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// return await Task.FromResult(DataResult<string>.Failed("OCR接口地址未配置!"));
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
var url = config.Data;
|
|
|
|
|
|
|
|
if (!url.EndsWith("/"))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
url += "/";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var postUrl = $"{url}pdf/getCanvasImage?fileName={fileName}&scale={scale}";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] byteArr = System.IO.File.ReadAllBytes(postUrl);
|
|
|
|
|
|
|
|
string mimeType = "application/octet-stream";
|
|
|
|
|
|
|
|
return new FileContentResult(byteArr, mimeType)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
FileDownloadName = fileName
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|