货运动态

booking_auth_dev
wet 2 years ago
parent 827bba193e
commit ca6ac450ca

@ -23,10 +23,7 @@ namespace Myshipping.Application.Entity
/// 箱号
/// </summary>
public string CNTRNO { get; set; }
/// <summary>
/// 提单号
/// </summary>
public string MBLNO { get; set; }
/// <summary>
/// 状态时间
/// </summary>

@ -1194,11 +1194,6 @@
箱号
</summary>
</member>
<member name="P:Myshipping.Application.Entity.BookingStatusLogDetail.MBLNO">
<summary>
提单号
</summary>
</member>
<member name="P:Myshipping.Application.Entity.BookingStatusLogDetail.OPTime">
<summary>
状态时间
@ -2045,14 +2040,20 @@
<param name="Id"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Application.BookingOrderService.SendTrace(System.String,System.String,System.String)">
<member name="M:Myshipping.Application.BookingOrderService.SendTrace(System.String,System.String,System.String,System.String)">
<summary>
调用运踪接口
</summary>
<param name="YARDID"></param>
<param name="YARD"></param>
<param name="MBLNO"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Application.BookingOrderService.GetBookingStatusLog(System.Int64)">
<summary>
获取货运动态
</summary>
</member>
<member name="M:Myshipping.Application.BookingOrderService.AddBookingStatusLog(Myshipping.Application.Service.BookingOrder.Dto.BookingStatusLogAll)">
<summary>
插入货运动态
</summary>
</member>
<member name="P:Myshipping.Application.Service.BookingOrder.Dto.BookingLogDto.Type">
<summary>
@ -2094,6 +2095,56 @@
备注
</summary>
</member>
<member name="P:Myshipping.Application.Service.BookingOrder.Dto.BookingStatusLogDto.BookingId">
<summary>
业务id
</summary>
</member>
<member name="P:Myshipping.Application.Service.BookingOrder.Dto.BookingStatusLogDto.Status">
<summary>
状态
</summary>
</member>
<member name="P:Myshipping.Application.Service.BookingOrder.Dto.BookingStatusLogDto.OpTiem">
<summary>
状态时间
</summary>
</member>
<member name="P:Myshipping.Application.Service.BookingOrder.Dto.BookingStatusLogDto.Gategory">
<summary>
类别
</summary>
</member>
<member name="P:Myshipping.Application.Service.BookingOrder.Dto.BookingStatusLogDto.Type">
<summary>
状态分类
</summary>
</member>
<member name="P:Myshipping.Application.Service.BookingOrder.Dto.BookingStatusLogDto.MBLNO">
<summary>
提单号
</summary>
</member>
<member name="P:Myshipping.Application.Service.BookingOrder.Dto.BookingStatusLogDetailDto.PId">
<summary>
主单id
</summary>
</member>
<member name="P:Myshipping.Application.Service.BookingOrder.Dto.BookingStatusLogDetailDto.Status">
<summary>
状态
</summary>
</member>
<member name="P:Myshipping.Application.Service.BookingOrder.Dto.BookingStatusLogDetailDto.CNTRNO">
<summary>
箱号
</summary>
</member>
<member name="P:Myshipping.Application.Service.BookingOrder.Dto.BookingStatusLogDetailDto.OPTime">
<summary>
状态时间
</summary>
</member>
<member name="T:Myshipping.Application.BookingOrderDto">
<summary>
订舱主表输出参数

@ -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);
}
}
}
}
}
}

@ -0,0 +1,67 @@
using Myshipping.Application.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application.Service.BookingOrder.Dto
{
public class BookingStatusLogDto
{
public long Id { get; set; }
/// <summary>
/// 业务id
/// </summary>
public long BookingId { get; set; }
/// <summary>
/// 状态
/// </summary>
public string Status { get; set; }
/// <summary>
/// 状态时间
/// </summary>
public DateTime? OpTiem { get; set; }
/// <summary>
/// 类别
/// </summary>
public string Gategory { get; set; }
/// <summary>
/// 状态分类
/// </summary>
public string Type { get; set; }
/// <summary>
/// 提单号
/// </summary>
public string MBLNO { get; set; }
public List<BookingStatusLogDetailDto> detail { get; set; }
}
public class BookingStatusLogDetailDto
{
/// <summary>
/// 主单id
/// </summary>
public long? PId { get; set; }
/// <summary>
/// 状态
/// </summary>
public string Status { get; set; }
/// <summary>
/// 箱号
/// </summary>
public string CNTRNO { get; set; }
/// <summary>
/// 状态时间
/// </summary>
public DateTime? OPTime { get; set; }
}
}

@ -4,6 +4,7 @@ using System.Threading.Tasks;
using Myshipping.Application.Entity;
using Myshipping.Application.Service.BookingOrder.Dto;
using Microsoft.AspNetCore.Http;
using System.Collections.Generic;
namespace Myshipping.Application
{
@ -27,6 +28,12 @@ namespace Myshipping.Application
Task<BookingFile> GetFile(long Id);
Task SendTrace(string YARDID, string YARD, string MBLNO);
Task SendTrace(string BusinessId,string YARDID, string YARD, string MBLNO);
Task<List<BookingStatusLogDto>> GetBookingStatusLog(long Id);
Task AddBookingStatusLog(List<BookingStatusLogDto> all);
}
}
Loading…
Cancel
Save