|
|
|
@ -51,11 +51,13 @@ namespace Myshipping.Application
|
|
|
|
|
private readonly SqlSugarRepository<SysDictData> _dicdata;
|
|
|
|
|
private readonly ILogger<BookingOrderService> _logger;
|
|
|
|
|
private readonly ISysCacheService _cache;
|
|
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<BookingStatusLog> _statuslog;
|
|
|
|
|
private readonly SqlSugarRepository<BookingStatusLogDetail> _statuslogdetail;
|
|
|
|
|
|
|
|
|
|
public BookingOrderService(SqlSugarRepository<BookingOrder> rep, SqlSugarRepository<BookingCtn> repCtn, SqlSugarRepository<BookingCtnDetail> ctndetailrep,
|
|
|
|
|
SqlSugarRepository<BookingLog> bookinglog, SqlSugarRepository<BookingLogDetail> bookinglogdetail, SqlSugarRepository<BookingRemark> bookingremark,
|
|
|
|
|
SqlSugarRepository<BookingFile> bookingfile, SqlSugarRepository<DjyWebsiteAccountConfig> webconfig, SqlSugarRepository<SysDictData> dicdata,
|
|
|
|
|
SqlSugarRepository<BookingStatusLog> statuslog, SqlSugarRepository<BookingStatusLogDetail> statuslogdetail,
|
|
|
|
|
ILogger<BookingOrderService> logger, ISysCacheService cache)
|
|
|
|
|
{
|
|
|
|
|
this._logger = logger;
|
|
|
|
@ -69,6 +71,8 @@ namespace Myshipping.Application
|
|
|
|
|
this._webconfig = webconfig;
|
|
|
|
|
this._dicdata = dicdata;
|
|
|
|
|
this._cache = cache;
|
|
|
|
|
this._statuslog = statuslog;
|
|
|
|
|
this._statuslogdetail = statuslogdetail;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -256,7 +260,7 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(input.YARDID) && !string.IsNullOrWhiteSpace(input.YARD) && !string.IsNullOrWhiteSpace(input.MBLNO))
|
|
|
|
|
{
|
|
|
|
|
await SendTrace(input.YARDID, input.YARD, input.MBLNO);
|
|
|
|
|
await SendTrace(entity.Id.ToString(), entity.YARDID, entity.YARD, entity.MBLNO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -362,7 +366,7 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(input.YARDID) && !string.IsNullOrWhiteSpace(input.YARD) && !string.IsNullOrWhiteSpace(input.MBLNO))
|
|
|
|
|
{
|
|
|
|
|
await SendTrace(input.YARDID, input.YARD, input.MBLNO);
|
|
|
|
|
await SendTrace(entity.Id.ToString(), entity.YARDID, entity.YARD, entity.MBLNO);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -514,11 +518,7 @@ namespace Myshipping.Application
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 调用运踪接口
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="YARDID"></param>
|
|
|
|
|
/// <param name="YARD"></param>
|
|
|
|
|
/// <param name="MBLNO"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task SendTrace(string YARDID, string YARD, string MBLNO)
|
|
|
|
|
public async Task SendTrace(string BusinessId, string YARDID, string YARD, string MBLNO)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("提单号:" + MBLNO + " 调用运踪接口");
|
|
|
|
|
var key = _webconfig.FirstOrDefault(x => x.TenantId == Convert.ToInt64(UserManager.TENANT_ID) && x.TypeCode == "seae_billtraceurl");
|
|
|
|
@ -527,6 +527,7 @@ namespace Myshipping.Application
|
|
|
|
|
List<BillTraceList> billTraceList = new List<BillTraceList>();
|
|
|
|
|
billTraceList.Add(new BillTraceList
|
|
|
|
|
{
|
|
|
|
|
BusinessId = BusinessId,
|
|
|
|
|
MBLNO = MBLNO,
|
|
|
|
|
YARD = YARD,
|
|
|
|
|
YardCode = YARDID,
|
|
|
|
@ -537,9 +538,10 @@ namespace Myshipping.Application
|
|
|
|
|
billdto.Children = billTraceList;
|
|
|
|
|
billdto.Key = key.Account;
|
|
|
|
|
billdto.PWD = key.Password;
|
|
|
|
|
|
|
|
|
|
billdto.url = url.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "response_seae_billtraceurl").Value;
|
|
|
|
|
billdto.Gid = UserManager.DjyUserId;
|
|
|
|
|
var json = billdto.ToJsonString();
|
|
|
|
|
var html = await url.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "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());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -551,5 +553,64 @@ namespace Myshipping.Application
|
|
|
|
|
var rtn = XiahuozhiHelpler.Send(id, "9", out string msg);
|
|
|
|
|
return $"{rtn} {msg}";
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取货运动态
|
|
|
|
|
/// </summary>
|
|
|
|
|
public async Task<List<BookingStatusLogDto>> GetBookingStatusLog(long Id)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var statuslog = await _statuslog.AsQueryable().Where(x => x.BookingId == Id).ToListAsync();
|
|
|
|
|
var dto = statuslog.Adapt<List<BookingStatusLogDto>>();
|
|
|
|
|
foreach (var item in dto)
|
|
|
|
|
{
|
|
|
|
|
var detail = await _statuslogdetail.AsQueryable().Where(x => x.PId == item.Id).ToListAsync();
|
|
|
|
|
item.detail = detail.Adapt<List<BookingStatusLogDetailDto>>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return dto;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 插入货运动态
|
|
|
|
|
/// </summary>
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
[SqlSugarUnitOfWork]
|
|
|
|
|
public async Task AddBookingStatusLog(List<BookingStatusLogDto> all)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
foreach (var item in all)
|
|
|
|
|
{
|
|
|
|
|
//清空原有数据
|
|
|
|
|
var old = await _statuslog.AsQueryable().Where(x => x.BookingId == item.BookingId && x.Gategory == "ship").ToListAsync();
|
|
|
|
|
await _statuslog.DeleteAsync(x => x.BookingId == item.BookingId && x.Gategory == "ship");
|
|
|
|
|
foreach (var ot in old)
|
|
|
|
|
{
|
|
|
|
|
await _statuslogdetail.DeleteAsync(x => x.PId == ot.Id);
|
|
|
|
|
}
|
|
|
|
|
///新增数据
|
|
|
|
|
var bookingStatusLog = new BookingStatusLog();
|
|
|
|
|
bookingStatusLog.BookingId = item.BookingId;
|
|
|
|
|
bookingStatusLog.Gategory = "ship";
|
|
|
|
|
bookingStatusLog.CreatedTime = DateTime.Now;
|
|
|
|
|
bookingStatusLog.Status = item.Status;
|
|
|
|
|
bookingStatusLog.OpTiem = item.OpTiem;
|
|
|
|
|
bookingStatusLog.MBLNO = item.MBLNO;
|
|
|
|
|
var id = await _statuslog.InsertReturnSnowflakeIdAsync(bookingStatusLog);
|
|
|
|
|
if (item.detail != null && item.detail.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var dt in item.detail)
|
|
|
|
|
{
|
|
|
|
|
var BookingStatusLogDetail = new BookingStatusLogDetail();
|
|
|
|
|
BookingStatusLogDetail.PId = id;
|
|
|
|
|
BookingStatusLogDetail.Status = dt.Status;
|
|
|
|
|
BookingStatusLogDetail.CNTRNO = dt.CNTRNO;
|
|
|
|
|
BookingStatusLogDetail.OPTime = dt.OPTime;
|
|
|
|
|
await _statuslogdetail.InsertAsync(BookingStatusLogDetail);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|