|
|
@ -53,6 +53,7 @@ using System.Xml.Linq;
|
|
|
|
using Myshipping.Application.Helper;
|
|
|
|
using Myshipping.Application.Helper;
|
|
|
|
using System.Net;
|
|
|
|
using System.Net;
|
|
|
|
using Furion.DistributedIDGenerator;
|
|
|
|
using Furion.DistributedIDGenerator;
|
|
|
|
|
|
|
|
using System.Linq.Expressions;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Myshipping.Application
|
|
|
|
namespace Myshipping.Application
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -69,7 +70,7 @@ namespace Myshipping.Application
|
|
|
|
private readonly SqlSugarRepository<BookingLogDetail> _bookinglogdetail;
|
|
|
|
private readonly SqlSugarRepository<BookingLogDetail> _bookinglogdetail;
|
|
|
|
private readonly SqlSugarRepository<BookingRemark> _bookingremark;
|
|
|
|
private readonly SqlSugarRepository<BookingRemark> _bookingremark;
|
|
|
|
private readonly SqlSugarRepository<BookingFile> _bookingfile;
|
|
|
|
private readonly SqlSugarRepository<BookingFile> _bookingfile;
|
|
|
|
private readonly SqlSugarRepository<SysDictData> _dicdata;
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<BookingPrintTemplate> _repPrint;
|
|
|
|
private readonly SqlSugarRepository<BookingPrintTemplate> _repPrint;
|
|
|
|
private readonly ILogger<BookingOrderService> _logger;
|
|
|
|
private readonly ILogger<BookingOrderService> _logger;
|
|
|
|
private readonly ISysCacheService _cache;
|
|
|
|
private readonly ISysCacheService _cache;
|
|
|
@ -112,7 +113,7 @@ namespace Myshipping.Application
|
|
|
|
this._bookingremark = bookingremark;
|
|
|
|
this._bookingremark = bookingremark;
|
|
|
|
this._bookingfile = bookingfile;
|
|
|
|
this._bookingfile = bookingfile;
|
|
|
|
this._repPrint = repPrint;
|
|
|
|
this._repPrint = repPrint;
|
|
|
|
this._dicdata = dicdata;
|
|
|
|
|
|
|
|
this._cache = cache;
|
|
|
|
this._cache = cache;
|
|
|
|
this._webAccountConfig = webAccountConfig;
|
|
|
|
this._webAccountConfig = webAccountConfig;
|
|
|
|
this._repStatuslog = statuslog;
|
|
|
|
this._repStatuslog = statuslog;
|
|
|
@ -141,6 +142,7 @@ namespace Myshipping.Application
|
|
|
|
public async Task<dynamic> Page([FromQuery] BookingOrderInput input)
|
|
|
|
public async Task<dynamic> Page([FromQuery] BookingOrderInput input)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
List<long> userlist = await DataFilterExtensions.GetDataScopeIdList();
|
|
|
|
List<long> userlist = await DataFilterExtensions.GetDataScopeIdList();
|
|
|
|
|
|
|
|
|
|
|
|
var entities = await _rep.AsQueryable().Where(x => x.ParentId == 0)
|
|
|
|
var entities = await _rep.AsQueryable().Where(x => x.ParentId == 0)
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.BSNO), u => u.BSNO.Contains(input.BSNO))
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.BSNO), u => u.BSNO.Contains(input.BSNO))
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.BSSTATUS), u => u.BSSTATUS == input.BSSTATUS)
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.BSSTATUS), u => u.BSSTATUS == input.BSSTATUS)
|
|
|
@ -288,11 +290,21 @@ namespace Myshipping.Application
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.LANENAME), u => u.LANENAME.Contains(input.LANENAME))
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.LANENAME), u => u.LANENAME.Contains(input.LANENAME))
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.FREIGHTPAYER), u => u.FREIGHTPAYER.Contains(input.FREIGHTPAYER))
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.FREIGHTPAYER), u => u.FREIGHTPAYER.Contains(input.FREIGHTPAYER))
|
|
|
|
.Where(u => userlist.Contains((long)u.CreatedUserId))
|
|
|
|
.Where(u => userlist.Contains((long)u.CreatedUserId))
|
|
|
|
|
|
|
|
.OrderBy(PageInputOrder.OrderBuilder(input.SortField,input.descSort))
|
|
|
|
.ToPagedListAsync(input.PageNo, input.PageSize);
|
|
|
|
.ToPagedListAsync(input.PageNo, input.PageSize);
|
|
|
|
return entities.XnPagedResult();
|
|
|
|
var list = entities.Adapt<SqlSugarPagedList<PageBookingOrder>>();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in list.Items)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var sta = await _repBookingStatus.AsQueryable().Where(x => x.BookingId == item.Id).ToListAsync();
|
|
|
|
|
|
|
|
if (sta != null) { item.bookstatus = sta; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[HttpPost("/BookingOrder/AddOrUpdate")]
|
|
|
|
[HttpPost("/BookingOrder/AddOrUpdate")]
|
|
|
|
public async Task<long> AddOrUpdate(BookingOrderDto Dto)
|
|
|
|
public async Task<long> AddOrUpdate(BookingOrderDto Dto)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -844,7 +856,7 @@ namespace Myshipping.Application
|
|
|
|
[NonAction]
|
|
|
|
[NonAction]
|
|
|
|
public async Task SendTrace(string BusinessId, string YARDID, string YARD, string MBLNO)
|
|
|
|
public async Task SendTrace(string BusinessId, string YARDID, string YARD, string MBLNO)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_logger.LogInformation("提单号:" + MBLNO + " 调用运踪接口");
|
|
|
|
_logger.LogInformation("调用运踪接口提单号:" + MBLNO + " 调用运踪接口");
|
|
|
|
var key = _webAccountConfig.GetAccountConfig("seae_billtraceurl", UserManager.UserId).Result;
|
|
|
|
var key = _webAccountConfig.GetAccountConfig("seae_billtraceurl", UserManager.UserId).Result;
|
|
|
|
if (key == null)
|
|
|
|
if (key == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -870,8 +882,9 @@ namespace Myshipping.Application
|
|
|
|
billdto.url = url.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "response_seae_billtraceurl").Value;
|
|
|
|
billdto.url = url.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "response_seae_billtraceurl").Value;
|
|
|
|
billdto.Gid = UserManager.DjyUserId;
|
|
|
|
billdto.Gid = UserManager.DjyUserId;
|
|
|
|
var json = billdto.ToJsonString();
|
|
|
|
var json = billdto.ToJsonString();
|
|
|
|
|
|
|
|
_logger.LogInformation("调用运踪接口发送josn:" + json);
|
|
|
|
var html = await url.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "request_seae_billtraceurl").Value.SetHttpMethod(HttpMethod.Post).SetQueries(new { msg = json }).SetRetryPolicy(3, 5000).SendAsAsync<RespCommon>();
|
|
|
|
var html = await url.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "request_seae_billtraceurl").Value.SetHttpMethod(HttpMethod.Post).SetQueries(new { msg = json }).SetRetryPolicy(3, 5000).SendAsAsync<RespCommon>();
|
|
|
|
_logger.LogInformation("提单号:" + MBLNO + " 调用运踪接口返回" + html.ToJsonString());
|
|
|
|
_logger.LogInformation("调用运踪接口提单号:" + MBLNO + " 调用运踪接口返回" + html.ToJsonString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -882,16 +895,17 @@ namespace Myshipping.Application
|
|
|
|
[HttpPost("/BookingOrder/AddBookingStatusLog")]
|
|
|
|
[HttpPost("/BookingOrder/AddBookingStatusLog")]
|
|
|
|
public async Task AddBookingStatusLog(List<BookingStatusLogDto> all)
|
|
|
|
public async Task AddBookingStatusLog(List<BookingStatusLogDto> all)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
//清空原有数据
|
|
|
|
|
|
|
|
var old = await _repStatuslog.AsQueryable().Where(x => x.BookingId == all[0].BookingId && x.Category == "ship").ToListAsync();
|
|
|
|
|
|
|
|
await _repStatuslog.DeleteAsync(x => x.BookingId == all[0].BookingId && x.Category == "ship");
|
|
|
|
|
|
|
|
foreach (var ot in old)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await _statuslogdetail.DeleteAsync(x => x.PId == ot.Id);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var dicdatalist = _cache.GetAllDictData().Result;
|
|
|
|
foreach (var item in all)
|
|
|
|
foreach (var item in all)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//清空原有数据
|
|
|
|
|
|
|
|
var old = await _repStatuslog.AsQueryable().Where(x => x.BookingId == item.BookingId && x.Category == "ship").ToListAsync();
|
|
|
|
|
|
|
|
await _repStatuslog.DeleteAsync(x => x.BookingId == item.BookingId && x.Category == "ship");
|
|
|
|
|
|
|
|
foreach (var ot in old)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await _statuslogdetail.DeleteAsync(x => x.PId == ot.Id);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//新增数据
|
|
|
|
//新增数据
|
|
|
|
var bookingStatusLog = new BookingStatusLog();
|
|
|
|
var bookingStatusLog = new BookingStatusLog();
|
|
|
|
bookingStatusLog.BookingId = item.BookingId;
|
|
|
|
bookingStatusLog.BookingId = item.BookingId;
|
|
|
@ -901,7 +915,99 @@ namespace Myshipping.Application
|
|
|
|
bookingStatusLog.OpTime = item.OpTime;
|
|
|
|
bookingStatusLog.OpTime = item.OpTime;
|
|
|
|
bookingStatusLog.MBLNO = item.MBLNO;
|
|
|
|
bookingStatusLog.MBLNO = item.MBLNO;
|
|
|
|
await _repStatuslog.InsertAsync(bookingStatusLog);
|
|
|
|
await _repStatuslog.InsertAsync(bookingStatusLog);
|
|
|
|
//var list=_repBookingStatus.AsQueryable().InnerJoin<List<SysDictData>>((d,t)=>d.StaCode==t.C)
|
|
|
|
var list = await _repBookingStatus.AsQueryable().InnerJoin<SysDictData>((d, t) => d.StaCode == t.Code && d.StaCate == "book_sta_cate_billtrace" && d.BookingId == item.BookingId).Select((d, t) => new
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
BookingId = d.BookingId,
|
|
|
|
|
|
|
|
StaCode = d.StaCode,
|
|
|
|
|
|
|
|
StaName = d.StaName,
|
|
|
|
|
|
|
|
StaTime = d.StaTime,
|
|
|
|
|
|
|
|
Code = t.Code,
|
|
|
|
|
|
|
|
Value = t.Value
|
|
|
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 订舱状态
|
|
|
|
|
|
|
|
if (item.Status == "舱单")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (list.Where(x => x.Code == "sta_cangdan").FirstOrDefault() == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
BookingStatus bookingStatus = new BookingStatus();
|
|
|
|
|
|
|
|
bookingStatus.BookingId = item.BookingId;
|
|
|
|
|
|
|
|
bookingStatus.StaCode = "sta_cangdan";
|
|
|
|
|
|
|
|
bookingStatus.StaName = dicdatalist.Where(x => x.Code == "sta_cangdan").Select(x => x.Value).FirstOrDefault();
|
|
|
|
|
|
|
|
bookingStatus.StaTime = item.OpTime;
|
|
|
|
|
|
|
|
bookingStatus.StaCate = "book_sta_cate_billtrace";
|
|
|
|
|
|
|
|
await _repBookingStatus.InsertAsync(bookingStatus);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (item.Status == "报关")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (list.Where(x => x.Code == "sta_haifang").FirstOrDefault() == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
BookingStatus bookingStatus = new BookingStatus();
|
|
|
|
|
|
|
|
bookingStatus.BookingId = item.BookingId;
|
|
|
|
|
|
|
|
bookingStatus.StaCode = "sta_haifang";
|
|
|
|
|
|
|
|
bookingStatus.StaName = dicdatalist.Where(x => x.Code == "sta_haifang").Select(x => x.Value).FirstOrDefault();
|
|
|
|
|
|
|
|
bookingStatus.StaTime = item.OpTime;
|
|
|
|
|
|
|
|
bookingStatus.StaCate = "book_sta_cate_billtrace";
|
|
|
|
|
|
|
|
await _repBookingStatus.InsertAsync(bookingStatus);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (item.Status == "装载")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (list.Where(x => x.Code == "sta_zhuangzai").FirstOrDefault() == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
BookingStatus bookingStatus = new BookingStatus();
|
|
|
|
|
|
|
|
bookingStatus.BookingId = item.BookingId;
|
|
|
|
|
|
|
|
bookingStatus.StaCode = "sta_zhuangzai";
|
|
|
|
|
|
|
|
bookingStatus.StaName = dicdatalist.Where(x => x.Code == "sta_zhuangzai").Select(x => x.Value).FirstOrDefault();
|
|
|
|
|
|
|
|
bookingStatus.StaTime = item.OpTime;
|
|
|
|
|
|
|
|
bookingStatus.StaCate = "book_sta_cate_billtrace";
|
|
|
|
|
|
|
|
await _repBookingStatus.InsertAsync(bookingStatus);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (item.Status == "码放")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (list.Where(x => x.Code == "sta_mafang").FirstOrDefault() == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
BookingStatus bookingStatus = new BookingStatus();
|
|
|
|
|
|
|
|
bookingStatus.BookingId = item.BookingId;
|
|
|
|
|
|
|
|
bookingStatus.StaCode = "sta_mafang";
|
|
|
|
|
|
|
|
bookingStatus.StaName = dicdatalist.Where(x => x.Code == "sta_mafang").Select(x => x.Value).FirstOrDefault();
|
|
|
|
|
|
|
|
bookingStatus.StaTime = item.OpTime;
|
|
|
|
|
|
|
|
bookingStatus.StaCate = "book_sta_cate_billtrace";
|
|
|
|
|
|
|
|
await _repBookingStatus.InsertAsync(bookingStatus);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (item.Status == "装船")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (list.Where(x => x.Code == "sta_zhuangchuan").FirstOrDefault() == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
BookingStatus bookingStatus = new BookingStatus();
|
|
|
|
|
|
|
|
bookingStatus.BookingId = item.BookingId;
|
|
|
|
|
|
|
|
bookingStatus.StaCode = "sta_zhuangchuan";
|
|
|
|
|
|
|
|
bookingStatus.StaName = dicdatalist.Where(x => x.Code == "sta_zhuangchuan").Select(x => x.Value).FirstOrDefault();
|
|
|
|
|
|
|
|
bookingStatus.StaTime = item.OpTime;
|
|
|
|
|
|
|
|
bookingStatus.StaCate = "book_sta_cate_billtrace";
|
|
|
|
|
|
|
|
await _repBookingStatus.InsertAsync(bookingStatus);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (item.Status == "ATD")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (list.Where(x => x.Code == "sta_atd").FirstOrDefault() == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
BookingStatus bookingStatus = new BookingStatus();
|
|
|
|
|
|
|
|
bookingStatus.BookingId = item.BookingId;
|
|
|
|
|
|
|
|
bookingStatus.StaCode = "sta_atd";
|
|
|
|
|
|
|
|
bookingStatus.StaName = dicdatalist.Where(x => x.Code == "sta_atd").Select(x => x.Value).FirstOrDefault();
|
|
|
|
|
|
|
|
bookingStatus.StaTime = item.OpTime;
|
|
|
|
|
|
|
|
bookingStatus.StaCate = "book_sta_cate_billtrace";
|
|
|
|
|
|
|
|
await _repBookingStatus.InsertAsync(bookingStatus);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (item.detail != null && item.detail.Count > 0)
|
|
|
|
if (item.detail != null && item.detail.Count > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
foreach (var dt in item.detail)
|
|
|
|
foreach (var dt in item.detail)
|
|
|
@ -912,16 +1018,8 @@ namespace Myshipping.Application
|
|
|
|
BookingStatusLogDetail.CNTRNO = dt.CNTRNO;
|
|
|
|
BookingStatusLogDetail.CNTRNO = dt.CNTRNO;
|
|
|
|
BookingStatusLogDetail.OPTime = dt.OPTime;
|
|
|
|
BookingStatusLogDetail.OPTime = dt.OPTime;
|
|
|
|
await _statuslogdetail.InsertAsync(BookingStatusLogDetail);
|
|
|
|
await _statuslogdetail.InsertAsync(BookingStatusLogDetail);
|
|
|
|
if (dt.Status == "舱单")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1011,6 +1109,23 @@ namespace Myshipping.Application
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 删除放舱
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="Id"></param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
[SqlSugarUnitOfWork]
|
|
|
|
|
|
|
|
[HttpPost("/BookingLetteryard/LetterYardDelete")]
|
|
|
|
|
|
|
|
public async Task LetterYardDelete(long Id)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await _repLetterYard.DeleteAsync(x => x.BookingId == Id);
|
|
|
|
|
|
|
|
_logger.LogInformation(Id + "放舱删除成功!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 放舱发送
|
|
|
|
/// 放舱发送
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
@ -1280,8 +1395,17 @@ namespace Myshipping.Application
|
|
|
|
{
|
|
|
|
{
|
|
|
|
throw Oops.Bah("类型参数不正确");
|
|
|
|
throw Oops.Bah("类型参数不正确");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var mblno= await _rep.AsQueryable().Where(x=>x.Id==bookingId).Select(x=>x.MBLNO).FirstAsync();
|
|
|
|
|
|
|
|
string fileName = string.Empty;
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(mblno))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
fileName = HttpUtility.UrlEncode($"{bookingId}_{DateTime.Now.Ticks}.{fileType}", Encoding.GetEncoding("UTF-8"));////名称
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
|
|
|
|
var fileName = HttpUtility.UrlEncode($"{bookingId}_{DateTime.Now.Ticks}.{fileType}", Encoding.GetEncoding("UTF-8"));////名称
|
|
|
|
fileName = HttpUtility.UrlEncode($"{mblno}_{DateTime.Now.Ticks}.{fileType}", Encoding.GetEncoding("UTF-8"));////名称
|
|
|
|
|
|
|
|
}
|
|
|
|
//var result = new FileContentResult(bs, "application/octet-stream") { FileDownloadName = fileName };
|
|
|
|
//var result = new FileContentResult(bs, "application/octet-stream") { FileDownloadName = fileName };
|
|
|
|
var opt = App.GetOptions<TempFileOptions>().Path;
|
|
|
|
var opt = App.GetOptions<TempFileOptions>().Path;
|
|
|
|
var serverpath = Path.Combine(App.WebHostEnvironment.WebRootPath, opt);//服务器路径
|
|
|
|
var serverpath = Path.Combine(App.WebHostEnvironment.WebRootPath, opt);//服务器路径
|
|
|
@ -2061,6 +2185,12 @@ namespace Myshipping.Application
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
[HttpPost("/BookingOrder/SendBookingOrClosingEDI")]
|
|
|
|
[HttpPost("/BookingOrder/SendBookingOrClosingEDI")]
|
|
|
|
public async Task<string> SendBookingOrClosingEDI(BookingOrClosingEDIOrderDto model)
|
|
|
|
public async Task<string> SendBookingOrClosingEDI(BookingOrClosingEDIOrderDto model)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return await InnerBookingOrClosingEDI(model);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<string> InnerBookingOrClosingEDI(BookingOrClosingEDIOrderDto model)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string batchNo = IDGen.NextID().ToString();
|
|
|
|
string batchNo = IDGen.NextID().ToString();
|
|
|
|
|
|
|
|
|
|
|
@ -2122,8 +2252,6 @@ namespace Myshipping.Application
|
|
|
|
throw Oops.Bah($"CARRIERID={order.CARRIERID} 发送SO(SI)的船公司EDI代码未找到");
|
|
|
|
throw Oops.Bah($"CARRIERID={order.CARRIERID} 发送SO(SI)的船公司EDI代码未找到");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ediModel = new EDIBaseModel();
|
|
|
|
var ediModel = new EDIBaseModel();
|
|
|
|
|
|
|
|
|
|
|
|
var ftpSet = _cache.GetAllEdiSetting().GetAwaiter().GetResult()
|
|
|
|
var ftpSet = _cache.GetAllEdiSetting().GetAwaiter().GetResult()
|
|
|
@ -2144,10 +2272,28 @@ namespace Myshipping.Application
|
|
|
|
//读取文件配置
|
|
|
|
//读取文件配置
|
|
|
|
var fileCfg = App.GetOptions<BookingAttachOptions>();
|
|
|
|
var fileCfg = App.GetOptions<BookingAttachOptions>();
|
|
|
|
|
|
|
|
|
|
|
|
string filePath = $"{Path.Combine(!string.IsNullOrWhiteSpace(fileCfg.basePath) ? fileCfg.basePath : App.WebHostEnvironment.WebRootPath, fileCfg.relativePath)}\\edifiles\\{order.BOOKINGNO}";
|
|
|
|
string filePath = String.Empty;
|
|
|
|
|
|
|
|
string relativePath = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!model.send)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var opt = App.GetOptions<TempFileOptions>().Path;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
filePath = $"{Path.Combine(App.WebHostEnvironment.WebRootPath, opt)}\\{order.BOOKINGNO}";//服务器路径
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
relativePath = $"{fileCfg.relativePath}\\edifiles\\{order.BOOKINGNO}";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
filePath = $"{(!string.IsNullOrWhiteSpace(fileCfg.basePath) ? fileCfg.basePath : App.WebHostEnvironment.WebRootPath)}\\{relativePath}";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
|
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
relativePath = relativePath.Replace("\\", "/");
|
|
|
|
filePath = filePath.Replace("\\", "/");
|
|
|
|
filePath = filePath.Replace("\\", "/");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} 生成文件保存路径完成 路由={filePath} 服务器系统={system}", batchNo, filePath, RuntimeInformation.OSDescription);
|
|
|
|
_logger.LogInformation("批次={no} 生成文件保存路径完成 路由={filePath} 服务器系统={system}", batchNo, filePath, RuntimeInformation.OSDescription);
|
|
|
|
//预先创建目录
|
|
|
|
//预先创建目录
|
|
|
@ -2286,6 +2432,20 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
|
|
if (model.send)
|
|
|
|
if (model.send)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
string currFilePath = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
currFilePath = System.Text.RegularExpressions.Regex.Match(result.extra.ToString(), relativePath.Replace("/", "\\/") + ".*").Value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
currFilePath = System.Text.RegularExpressions.Regex.Match(result.extra.ToString(), relativePath.Replace("\\", "\\\\") + ".*").Value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//这里先写入附件表
|
|
|
|
|
|
|
|
await SaveEDIFile(model.Id, currFilePath, new System.IO.FileInfo(currFilePath).Name);
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} 直接发送FTP 文件访问地址={filepath}", batchNo, result.extra.ToString());
|
|
|
|
_logger.LogInformation("批次={no} 直接发送FTP 文件访问地址={filepath}", batchNo, result.extra.ToString());
|
|
|
|
|
|
|
|
|
|
|
|
DateTime bDate = DateTime.Now;
|
|
|
|
DateTime bDate = DateTime.Now;
|
|
|
@ -2308,6 +2468,57 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
|
|
return result.extra.ToString();
|
|
|
|
return result.extra.ToString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
|
|
|
private async Task SaveEDIFile(long boookId,string FilePath,string fileName,string fileTypeCode= "edi", string fileTypeName= "EDI文件")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
直接将附件信息写入附件表
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
//EDI文件
|
|
|
|
|
|
|
|
var bookFile = new BookingFile
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Id = YitIdHelper.NextId(),
|
|
|
|
|
|
|
|
FileName = fileName,
|
|
|
|
|
|
|
|
FilePath = FilePath,
|
|
|
|
|
|
|
|
TypeCode = fileTypeCode,
|
|
|
|
|
|
|
|
TypeName = fileTypeName,
|
|
|
|
|
|
|
|
BookingId = boookId,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _bookingfile.InsertAsync(bookFile);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#region 下载订舱、截单EDI
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 下载订舱、截单EDI
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="id">订单主键</param>
|
|
|
|
|
|
|
|
/// <param name="orderNo">订单号</param>
|
|
|
|
|
|
|
|
/// <param name="useForwarderCode">是否使用货代代码</param>
|
|
|
|
|
|
|
|
/// <param name="forwarderName">货代代码</param>
|
|
|
|
|
|
|
|
/// <param name="fileRole">文件功能 (9原始,1 更新,5 退舱 )</param>
|
|
|
|
|
|
|
|
/// <param name="sendType">发送类型 B-订舱 E-截单</param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
[HttpGet("/BookingOrder/DownloadBookingOrClosingEDI")]
|
|
|
|
|
|
|
|
public IActionResult DownloadBookingOrClosingEDI([FromQuery] long id, [FromQuery] string orderNo, [FromQuery] bool useForwarderCode,
|
|
|
|
|
|
|
|
[FromQuery] string forwarderName, [FromQuery] string fileRole, [FromQuery] string sendType)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var model = new BookingOrClosingEDIOrderDto {
|
|
|
|
|
|
|
|
Id = id,
|
|
|
|
|
|
|
|
orderNo = orderNo,
|
|
|
|
|
|
|
|
useForwarderCode = useForwarderCode,
|
|
|
|
|
|
|
|
forwarderName = forwarderName,
|
|
|
|
|
|
|
|
fileRole = fileRole,
|
|
|
|
|
|
|
|
send = false,
|
|
|
|
|
|
|
|
sendType = sendType
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
var filePath = InnerBookingOrClosingEDI(model).GetAwaiter().GetResult();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fileInfo = new FileInfo(filePath);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var result = new FileStreamResult(new FileStream(filePath, FileMode.Open), "application/octet-stream") { FileDownloadName = fileInfo.Name };
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 上传FTP
|
|
|
|
#region 上传FTP
|
|
|
@ -2424,12 +2635,6 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
|
|
result.succ = currRlt.succ;
|
|
|
|
result.succ = currRlt.succ;
|
|
|
|
result.extra = currRlt.succ ? currRlt.extra.ToString() : "";
|
|
|
|
result.extra = currRlt.succ ? currRlt.extra.ToString() : "";
|
|
|
|
|
|
|
|
|
|
|
|
//鐩存帴鍙戦€佹姤鏂囧埌FTP鏈嶅姟鍣?
|
|
|
|
|
|
|
|
if (model.send)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (ediRouteEnum == EDIRouteEnum.WY)
|
|
|
|
else if (ediRouteEnum == EDIRouteEnum.WY)
|
|
|
|
{
|
|
|
|
{
|
|
|
|