diff --git a/Myshipping.Application/Entity/BookingStatusLogDetail.cs b/Myshipping.Application/Entity/BookingStatusLogDetail.cs
index bc6cadfb..e5f3576b 100644
--- a/Myshipping.Application/Entity/BookingStatusLogDetail.cs
+++ b/Myshipping.Application/Entity/BookingStatusLogDetail.cs
@@ -23,10 +23,7 @@ namespace Myshipping.Application.Entity
/// 箱号
///
public string CNTRNO { get; set; }
- ///
- /// 提单号
- ///
- public string MBLNO { get; set; }
+
///
/// 状态时间
///
diff --git a/Myshipping.Application/Myshipping.Application.xml b/Myshipping.Application/Myshipping.Application.xml
index 8f2dfc3d..166a488d 100644
--- a/Myshipping.Application/Myshipping.Application.xml
+++ b/Myshipping.Application/Myshipping.Application.xml
@@ -1194,11 +1194,6 @@
箱号
-
-
- 提单号
-
-
状态时间
@@ -2045,14 +2040,20 @@
-
+
调用运踪接口
-
-
-
-
+
+
+
+ 获取货运动态
+
+
+
+
+ 插入货运动态
+
@@ -2094,6 +2095,56 @@
备注
+
+
+ 业务id
+
+
+
+
+ 状态
+
+
+
+
+ 状态时间
+
+
+
+
+ 类别
+
+
+
+
+ 状态分类
+
+
+
+
+ 提单号
+
+
+
+
+ 主单id
+
+
+
+
+ 状态
+
+
+
+
+ 箱号
+
+
+
+
+ 状态时间
+
+
订舱主表输出参数
diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
index 28a83efa..417fda49 100644
--- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
+++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
@@ -51,11 +51,13 @@ namespace Myshipping.Application
private readonly SqlSugarRepository _dicdata;
private readonly ILogger _logger;
private readonly ISysCacheService _cache;
-
+ private readonly SqlSugarRepository _statuslog;
+ private readonly SqlSugarRepository _statuslogdetail;
public BookingOrderService(SqlSugarRepository rep, SqlSugarRepository repCtn, SqlSugarRepository ctndetailrep,
SqlSugarRepository bookinglog, SqlSugarRepository bookinglogdetail, SqlSugarRepository bookingremark,
SqlSugarRepository bookingfile, SqlSugarRepository webconfig, SqlSugarRepository dicdata,
+ SqlSugarRepository statuslog, SqlSugarRepository statuslogdetail,
ILogger 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;
}
///
@@ -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
///
/// 调用运踪接口
///
- ///
- ///
- ///
- ///
- 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 = new List();
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();
+ 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();
_logger.LogInformation("提单号:" + MBLNO + " 调用运踪接口返回" + html.ToJsonString());
}
@@ -551,5 +553,64 @@ namespace Myshipping.Application
var rtn = XiahuozhiHelpler.Send(id, "9", out string msg);
return $"{rtn} {msg}";
}
+ ///
+ /// 获取货运动态
+ ///
+ public async Task> GetBookingStatusLog(long Id)
+ {
+
+ var statuslog = await _statuslog.AsQueryable().Where(x => x.BookingId == Id).ToListAsync();
+ var dto = statuslog.Adapt>();
+ foreach (var item in dto)
+ {
+ var detail = await _statuslogdetail.AsQueryable().Where(x => x.PId == item.Id).ToListAsync();
+ item.detail = detail.Adapt>();
+ }
+
+ return dto;
+ }
+ ///
+ /// 插入货运动态
+ ///
+ [AllowAnonymous]
+ [SqlSugarUnitOfWork]
+ public async Task AddBookingStatusLog(List 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);
+
+
+ }
+ }
+
+ }
+ }
}
}
diff --git a/Myshipping.Application/Service/BookingOrder/Dto/BookingStatusLogDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/BookingStatusLogDto.cs
new file mode 100644
index 00000000..9aea8a33
--- /dev/null
+++ b/Myshipping.Application/Service/BookingOrder/Dto/BookingStatusLogDto.cs
@@ -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; }
+
+ ///
+ /// 业务id
+ ///
+ public long BookingId { get; set; }
+ ///
+ /// 状态
+ ///
+ public string Status { get; set; }
+ ///
+ /// 状态时间
+ ///
+ public DateTime? OpTiem { get; set; }
+ ///
+ /// 类别
+ ///
+ public string Gategory { get; set; }
+ ///
+ /// 状态分类
+ ///
+ public string Type { get; set; }
+ ///
+ /// 提单号
+ ///
+ public string MBLNO { get; set; }
+
+ public List detail { get; set; }
+ }
+ public class BookingStatusLogDetailDto
+ {
+ ///
+ /// 主单id
+ ///
+ public long? PId { get; set; }
+
+
+ ///
+ /// 状态
+ ///
+ public string Status { get; set; }
+ ///
+ /// 箱号
+ ///
+ public string CNTRNO { get; set; }
+
+ ///
+ /// 状态时间
+ ///
+ public DateTime? OPTime { get; set; }
+ }
+
+
+
+
+}
diff --git a/Myshipping.Application/Service/BookingOrder/IBookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/IBookingOrderService.cs
index a157007b..0c7dd029 100644
--- a/Myshipping.Application/Service/BookingOrder/IBookingOrderService.cs
+++ b/Myshipping.Application/Service/BookingOrder/IBookingOrderService.cs
@@ -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 GetFile(long Id);
- Task SendTrace(string YARDID, string YARD, string MBLNO);
+ Task SendTrace(string BusinessId,string YARDID, string YARD, string MBLNO);
+
+
+ Task> GetBookingStatusLog(long Id);
+
+
+ Task AddBookingStatusLog(List all);
}
}
\ No newline at end of file