|
|
using Amazon.Runtime.Internal.Util;
|
|
|
using DS.Module.Core;
|
|
|
using DS.Module.Core.Data;
|
|
|
using DS.Module.Core.Helpers;
|
|
|
using DS.Module.DjyRulesEngine;
|
|
|
using DS.WMS.Core.Info.Dtos;
|
|
|
using DS.WMS.Core.Info.Interface;
|
|
|
using DS.WMS.Core.Op.Dtos;
|
|
|
using DS.WMS.Core.Op.EDI;
|
|
|
using DS.WMS.Core.Op.Interface;
|
|
|
using DS.WMS.Core.Sys.Dtos;
|
|
|
using DS.WMS.Core.Sys.Interface;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
using Newtonsoft.Json;
|
|
|
using NPOI.XWPF.UserModel;
|
|
|
using Org.BouncyCastle.Ocsp;
|
|
|
using System.Net;
|
|
|
|
|
|
namespace DS.WMS.OpApi.Controllers;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 海运出口信息-模块
|
|
|
/// </summary>
|
|
|
public class SeaExportController : ApiController
|
|
|
{
|
|
|
private readonly ISeaExportService _invokeService;
|
|
|
private readonly ISeaExportCommonService _commonService;
|
|
|
/// <summary>
|
|
|
/// 构造函数
|
|
|
/// </summary>
|
|
|
/// <param name="invokeService"></param>
|
|
|
public SeaExportController(ISeaExportService invokeService, ISeaExportCommonService commonService)
|
|
|
{
|
|
|
_invokeService = invokeService;
|
|
|
_commonService = commonService;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 列表
|
|
|
/// </summary>
|
|
|
/// <param name="request"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost]
|
|
|
[Route("GetSeaExportList")]
|
|
|
public async Task<DataResult<SeaExportListRes>> GetSeaExportList([FromBody] PageRequest request)
|
|
|
{
|
|
|
var res = await _invokeService.GetListByPage(request);
|
|
|
return res;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 海运出口分单列表
|
|
|
/// </summary>
|
|
|
/// <param name="request">传参ParentId等于主单id</param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost]
|
|
|
[Route("GetSeaExportPartList")]
|
|
|
public async Task<DataResult<List<SeaExportRes>>> GetSeaExportPartList([FromBody] PageRequest request)
|
|
|
{
|
|
|
var res = await _invokeService.GetSeaExportPartList(request);
|
|
|
return res;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 编辑
|
|
|
/// </summary>
|
|
|
/// <param name="req"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost]
|
|
|
[Route("EditSeaExport")]
|
|
|
public async Task<DataResult> EditSeaExport([FromBody] SeaExportReq req)
|
|
|
{
|
|
|
var res = await _invokeService.EditSeaExport(req);
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 详情
|
|
|
/// </summary>
|
|
|
/// <param name="id"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpGet]
|
|
|
[Route("GetSeaExportInfo")]
|
|
|
public DataResult<SeaExportRes> GetSeaExportInfo([FromQuery] string id)
|
|
|
{
|
|
|
var res = _invokeService.GetSeaExportInfo(id);
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 批量编辑
|
|
|
/// </summary>
|
|
|
/// <param name="req"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost]
|
|
|
[Route("SeaExportBatchEdit")]
|
|
|
public DataResult SeaExportBatchEdit([FromBody] SeaExportBatchEditReq req)
|
|
|
{
|
|
|
var res = _invokeService.SeaExportBatchEdit(req);
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 业务单据删除
|
|
|
/// </summary>
|
|
|
/// <param name="id"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpGet]
|
|
|
[Route("SeaExportDel")]
|
|
|
public DataResult SeaExportDel([FromQuery] string id)
|
|
|
{
|
|
|
var res = _invokeService.SeaExportDel(id);
|
|
|
return res;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 业务单据批量删除
|
|
|
/// </summary>
|
|
|
/// <param name="req"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost]
|
|
|
[Route("SeaExportBatchDel")]
|
|
|
public DataResult SeaExportBatchDel([FromBody] IdModel req)
|
|
|
{
|
|
|
var res = _invokeService.SeaExportBatchDel(req);
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 业务单据复制-单票
|
|
|
/// </summary>
|
|
|
/// <param name="id"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpGet]
|
|
|
[Route("SeaExportCopy")]
|
|
|
public DataResult SeaExportCopy([FromQuery] string id)
|
|
|
{
|
|
|
var res = _invokeService.SeaExportCopy(id);
|
|
|
return res;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 获取场站数据
|
|
|
/// </summary>
|
|
|
/// <param name="id">业务Id</param>
|
|
|
/// <param name="isWeb">是否网站数据 默认false</param>
|
|
|
/// <returns></returns>
|
|
|
[HttpGet]
|
|
|
[Route("GetYardData")]
|
|
|
public async Task<DataResult<string>> GetYardData([FromQuery] string id, bool isWeb = false)
|
|
|
{
|
|
|
return await _invokeService.GetYardData(id, isWeb);
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 发起运踪订阅或者更新提单号
|
|
|
/// </summary>
|
|
|
/// <param name="req"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost]
|
|
|
[Route("SendOrUpdateTrace")]
|
|
|
public async Task<DataResult<string>> SendOrUpdateTrace([FromBody]List<BillTraceReq> req)
|
|
|
{
|
|
|
return await _invokeService.SendOrUpdateTrace(req);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 运踪退订
|
|
|
/// </summary>
|
|
|
/// <param name="req"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost]
|
|
|
[Route("UnsubscribeBillTrace")]
|
|
|
public async Task<DataResult<string>> UnsubscribeBillTrace([FromBody]List<BillTraceUnsubscribeList> req)
|
|
|
{
|
|
|
return await _invokeService.UnsubscribeBillTrace(req);
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取VGM、VGM SI链接
|
|
|
/// </summary>
|
|
|
/// <param name="id">业务Id</param>
|
|
|
/// <returns></returns>
|
|
|
[HttpGet]
|
|
|
[Route("VgmLink")]
|
|
|
public async Task<DataResult<string[]>> VgmLink([FromQuery] string id)
|
|
|
{
|
|
|
return await _invokeService.VgmLink(id);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 发送VGM
|
|
|
/// </summary>
|
|
|
/// <param name="id">业务Id</param>
|
|
|
/// <returns></returns>
|
|
|
[HttpGet]
|
|
|
[Route("VgmSend")]
|
|
|
public async Task<DataResult<string>> VgmSend([FromQuery] string id)
|
|
|
{
|
|
|
return await _invokeService.VgmSend(id);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 批量获取vgm
|
|
|
/// </summary>
|
|
|
/// <param name="ids">业务id 逗号拼接</param>
|
|
|
/// <returns></returns>
|
|
|
[HttpGet]
|
|
|
[Route("GetVmgDataList")]
|
|
|
public async Task<DataResult<List<BatchVGM>>> GetVmgDataList([FromQuery] string ids)
|
|
|
{
|
|
|
return await _invokeService.GetVmgDataList(ids);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 批量保存vgm
|
|
|
/// </summary>
|
|
|
/// <param name="req"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost]
|
|
|
[Route("SaveBatchVgm")]
|
|
|
public async Task<DataResult<string>> SaveBatchVgm([FromBody] List<BatchVGMList> req)
|
|
|
{
|
|
|
return await _invokeService.SaveBatchVgm(req);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 获取提箱小票链接
|
|
|
/// </summary>
|
|
|
/// <param name="id">业务Id</param>
|
|
|
/// <returns></returns>
|
|
|
[HttpGet]
|
|
|
[Route("TxxpLink")]
|
|
|
public async Task<DataResult<string>> TxxpLink([FromQuery] string id)
|
|
|
{
|
|
|
return await _invokeService.TxxpLink(id);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 检查是否VOLTA并返回初始数据
|
|
|
/// </summary>
|
|
|
/// <param name="req"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost]
|
|
|
[Route("CheckAndInitVOLTAEdi")]
|
|
|
public DataResult<VOLTAEDIBaseModel> CheckAndInitVOLTAEdi([FromBody] BookingOrClosingEDIOrderReq req)
|
|
|
{
|
|
|
return _invokeService.CheckAndInitVOLTAEdi(req);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 发送订舱、截单EDI
|
|
|
/// </summary>
|
|
|
/// <param name="req">订舱、截单EDI请求</param>
|
|
|
/// <returns>返回回执</returns>
|
|
|
[HttpPost]
|
|
|
[Route("SendBookingOrClosingEDI")]
|
|
|
public async Task<DataResult<string>> SendBookingOrClosingEDI([FromBody] BookingOrClosingEDIOrderReq req)
|
|
|
{
|
|
|
return await _invokeService.SendBookingOrClosingEDI(req);
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 下载订舱、截单EDI
|
|
|
/// </summary>
|
|
|
/// <param name="req">订舱、截单EDI请求</param>
|
|
|
/// <returns>返回回执</returns>
|
|
|
[HttpPost]
|
|
|
[Route("DownloadBookingOrClosingEDI")]
|
|
|
[ProducesResponseType(typeof(FileResult), StatusCodes.Status200OK)]
|
|
|
public async Task<IActionResult> DownloadBookingOrClosingEDI([FromBody] BookingOrClosingEDIOrderReq req)
|
|
|
{
|
|
|
var res = await _invokeService.DownloadBookingOrClosingEDI(req);
|
|
|
|
|
|
if (!res.Succeeded)
|
|
|
{
|
|
|
//return (IActionResult)await Task.FromResult(DataResult.Failed(res.Message));
|
|
|
throw new Exception(res.Message);
|
|
|
}
|
|
|
var path = res.Data.FilePath;
|
|
|
var fileName = res.Data.FileName;
|
|
|
|
|
|
byte[] byteArr = System.IO.File.ReadAllBytes(res.Data.FilePath);
|
|
|
string mimeType = "application/octet-stream";
|
|
|
return new FileContentResult(byteArr, mimeType)
|
|
|
{
|
|
|
FileDownloadName = fileName
|
|
|
};
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 发送下货纸
|
|
|
/// </summary>
|
|
|
/// <param name="id">业务id</param>
|
|
|
/// <returns></returns>
|
|
|
[HttpGet]
|
|
|
[Route("SendXHZ")]
|
|
|
public async Task<DataResult> SendXHZ([FromQuery] string id)
|
|
|
{
|
|
|
return await _invokeService.SendXHZ(id);
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 船司电放提交
|
|
|
/// </summary>
|
|
|
/// <param name="req">订舱主键数组</param>
|
|
|
/// <returns>每单的处理提交结果</returns>
|
|
|
[HttpPost]
|
|
|
[Route("SubmitTelex")]
|
|
|
public async Task<DataResult<List<SubmitTelexResultDto>>> SubmitTelex([FromBody] IdModel req)
|
|
|
{
|
|
|
var res = await _invokeService.SubmitTelex(req);
|
|
|
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("", postUrl);
|
|
|
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}";
|
|
|
|
|
|
WebClient mywebclient = new WebClient();
|
|
|
byte[] byteArr = mywebclient.DownloadData(postUrl);
|
|
|
//byte[] byteArr = System.IO.File.ReadAllBytes(postUrl);
|
|
|
string mimeType = "application/octet-stream";
|
|
|
return new FileContentResult(byteArr, mimeType)
|
|
|
{
|
|
|
FileDownloadName = fileName
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 海运出口规则引擎校验
|
|
|
/// </summary>
|
|
|
/// <param name="id">业务id</param>
|
|
|
/// <returns></returns>
|
|
|
[HttpGet]
|
|
|
[Route("ExcuteRuleEngine")]
|
|
|
public async Task<DataResult<RuleEngineResult>> ExcuteRuleEngine([FromQuery] string id)
|
|
|
{
|
|
|
return await _invokeService.ExcuteRuleEngine(id);
|
|
|
}
|
|
|
} |