You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

586 lines
18 KiB
C#

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;
2 months ago
using DS.WMS.Core.Op.Dtos.Cargoo;
using DS.WMS.Core.Op.Dtos.VGM;
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 DS.WMS.Core.Utils;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using NPOI.XWPF.UserModel;
using Org.BouncyCastle.Ocsp;
4 months ago
using SharpCompress.Common;
using System.IO;
using System.Net;
namespace DS.WMS.OpApi.Controllers;
/// <summary>
/// 海运出口信息-模块
/// </summary>
public class SeaExportController : ApiController
{
private readonly ISeaExportService _invokeService;
private readonly ISeaExportCommonService _commonService;
2 months ago
private readonly ICargooService _cargooService;
4 weeks ago
private readonly IDJYChargeFeeService _chargeFeeService;
2 months ago
/// <summary>
/// 构造函数
/// </summary>
/// <param name="invokeService"></param>
4 weeks ago
public SeaExportController(ISeaExportService invokeService, ISeaExportCommonService commonService, ICargooService cargooService,
IDJYChargeFeeService chargeFeeService)
{
_invokeService = invokeService;
_commonService = commonService;
2 months ago
_cargooService = cargooService;
4 weeks ago
_chargeFeeService = chargeFeeService;
}
/// <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="id">主单id</param>
/// <returns></returns>
[HttpGet]
[Route("GetSeaExportLogList")]
public async Task<DataResult<List<OpBusinessLogRes>>> GetSeaExportLogList([FromQuery] string id)
{
var res = await _invokeService.GetSeaExportLogList(id);
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="req"></param>
/// <returns></returns>
[HttpPost]
[Route("GetSeaExportCopyInfo")]
public async Task<DataResult<SeaExportCopyRes>> GetSeaExportCopyInfo([FromBody] SeaExportCopyReq req)
{
var res = await _invokeService.GetSeaExportCopyInfo(req);
return res;
}
/// <summary>
/// 详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("GetSeaExportInfo")]
public async Task<DataResult<SeaExportRes>> GetSeaExportInfo([FromQuery] string id)
{
var res = await _invokeService.GetSeaExportInfo(id);
return res;
}
/// <summary>
/// 批量编辑
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("SeaExportBatchEdit")]
public async Task<DataResult> SeaExportBatchEdit([FromBody] SeaExportBatchEditReq req)
{
var res = await _invokeService.SeaExportBatchEdit(req);
return res;
}
/// <summary>
/// 业务单据删除
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("SeaExportDel")]
2 months ago
public async Task<DataResult> SeaExportDel([FromQuery] string id)
{
2 months ago
var res = await _invokeService.SeaExportDel(id);
return res;
}
/// <summary>
/// 业务单据批量删除
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("SeaExportBatchDel")]
public async Task<DataResult> SeaExportBatchDel([FromBody] IdModel req)
{
var res = await _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>
/// 获取订舱记录在指定网站的HTML数据
/// </summary>
/// <param name="id">业务Id</param>
/// <param name="webCode">网站编码值为YARD或HLW_CD或YGTYARD获取订舱记录所属场站的网页数据HLW_CD获取互联网+的网页数据YGT获取云港通的网页数据</param>
/// <returns></returns>
[HttpGet]
[Route("GetWebData")]
public async Task<DataResult<string>> GetWebData([FromQuery] string id, string webCode)
{
return await _invokeService.GetWebData(id, webCode);
}
/// <summary>
/// 发起运踪订阅或者更新提单号
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("SendOrUpdateTrace")]
public async Task<DataResult<string>> SendOrUpdateTrace([FromBody] List<BillTraceSendReq> 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);
}
7 months ago
/// <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;
4 months ago
//byte[] byteArr = System.IO.File.ReadAllBytes(res.Data.FilePath);
//string mimeType = "application/octet-stream";
//return new FileContentResult(byteArr, mimeType)
//{
// FileDownloadName = fileName
//};
return new FileStreamResult(new FileStream(path, FileMode.Open), "application/octet-stream") { 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);
}
/// <summary>
/// 订单及货运动态
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
[Route("GetBookingStatusLogList")]
public async Task<DataResult<List<BookingStatusLogRes>>> GetBookingStatusLogList([FromBody] PageRequest request)
{
var res = await _invokeService.GetBookingStatusLogList(request);
return res;
}
/// <summary>
/// 发送托书
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("SendShippingOrderEmail")]
public async Task<DataResult<string>> SendShippingOrderEmail([FromBody] SendShippingOrderReq req)
{
var res = await _invokeService.SendShippingOrderEmail(req);
return res;
}
4 months ago
/// <summary>
/// 打印托书
/// </summary>
/// <param name="id">业务Id</param>
/// <returns></returns>
[HttpGet]
[Route("PrintShippingOrderPDF")]
[Obsolete]
4 months ago
public async Task<DataResult> PrintShippingOrderPDF([FromQuery] string id)
{
var res = await _invokeService.PrintShippingOrderPDF(id);
return res;
}
/// <summary>
/// 刷新运踪(互联网和云港通)
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("RefreshYGT")]
public async Task<DataResult<string>> RefreshYGT([FromBody] IdModel req)
{
return await _invokeService.RefreshYGT(req.Ids);
}
/// <summary>
/// 刷新运踪(场站)
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("RefreshYard")]
public async Task<DataResult<string>> RefreshYard([FromBody] IdModel req)
{
return await _invokeService.RefreshYard(req.Ids);
}
/// <summary>
/// 刷新运踪
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("RefreshYunZong")]
public async Task<DataResult<string>> RefreshYunZong([FromBody] IdModel req)
{
return await _invokeService.RefreshYunZong(req.Ids);
}
/// <summary>
/// 打印保函
/// </summary>
/// <param name="id">业务Id</param>
/// <returns></returns>
[HttpGet]
[Route("PrintShippingOrderLetterPDF")]
public async Task<DataResult> PrintShippingOrderLetterPDF([FromQuery] string id)
{
var res = await _invokeService.PrintShippingOrderLetterPDF(id);
return res;
}
#region 获取VGM发送通道选项
/// <summary>
/// 获取VGM发送通道选项
/// </summary>
/// <param name="id">订单主键</param>
/// <returns>返回回执</returns>
[HttpGet]
[Route("GetVgmSendChannel")]
public async Task<DataResult<CheckVGMShowDto>> GetVgmSendChannel(string id)
{
return await _invokeService.GetVgmSendChannel(id);
}
#endregion
2 months ago
/// <summary>
/// 发送Cargoo
/// </summary>
/// <param name="id">业务Id</param>
/// <returns></returns>
[HttpGet]
[Route("SendCargoo")]
public async Task<DataResult<CargooShipmentResultDto>> SendCargoo([FromQuery] long id)
{
var res = await _cargooService.SendCargoo(new Core.Op.Dtos.Cargoo.CargooShipmentReqDto {
bookingId = id,
cargooStatusEnum = CargooStatusEnum.Confirmed,
});
return res;
}
4 weeks ago
/// <summary>
/// 手工补扣费用
/// </summary>
/// <param name="model">请求详情</param>
/// <returns></returns>
[HttpPost]
[Route("ManualDJYChargeFee")]
public async Task<DataResult<DJYChargeFeeResultDto>> SendCargoo([FromBody] DJYChargeFeeRequestDto model)
{
return await _chargeFeeService.ChargeFee(model);
}
}