|
|
|
@ -71,11 +71,15 @@ namespace Myshipping.Application
|
|
|
|
|
private readonly SqlSugarRepository<CodeForwarder> _codeForwarder;
|
|
|
|
|
private readonly SqlSugarRepository<BookingFile> _bookingfile;
|
|
|
|
|
private readonly SqlSugarRepository<DjyWebsiteAccountConfig> _accountconfig;
|
|
|
|
|
private readonly SqlSugarRepository<BookingStatusLog> _repStatuslog;
|
|
|
|
|
private readonly SqlSugarRepository<BookingStatusLogDetail> _statuslogdetail;
|
|
|
|
|
private readonly SqlSugarRepository<BookingStatus> _repBookingStatus;
|
|
|
|
|
private readonly IBookingOrderService _bookingorderservice;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public DataSyncService(ILogger<DataSyncService> logger, ISysCacheService cache, SqlSugarRepository<BookingOrder> rep, SqlSugarRepository<BookingCtn> repCtn,
|
|
|
|
|
SqlSugarRepository<SysUser> repUser, SqlSugarRepository<SysTenant> repTenant, SqlSugarRepository<DjyCustomer> djycustomer,
|
|
|
|
|
SqlSugarRepository<BookingStatusLog> statuslog, SqlSugarRepository<BookingStatusLogDetail> statuslogdetail, SqlSugarRepository<BookingStatus> repBookingStatus,
|
|
|
|
|
SqlSugarRepository<DjyCustomerContact> djycustomercontact, SqlSugarRepository<DjyVesselInfo> vesselinfo, SqlSugarRepository<BookingCtnDetail> ctndetailrep
|
|
|
|
|
, SqlSugarRepository<BookingEDIExt> bookingEDIExt, SqlSugarRepository<BookingLog> bookinglog, SqlSugarRepository<BookingLogDetail> bookinglogdetail,
|
|
|
|
|
SqlSugarRepository<BookingGoodsStatus> goodsStatus, SqlSugarRepository<BookingGoodsStatusConfig> goodsStatusConfig, SqlSugarRepository<DjyTenantLine> repline,
|
|
|
|
@ -109,6 +113,9 @@ namespace Myshipping.Application
|
|
|
|
|
this._accountconfig = accountconfig;
|
|
|
|
|
this._bookingfile = bookingfile;
|
|
|
|
|
this._bookingorderservice = bookingorderservice;
|
|
|
|
|
this._repStatuslog = statuslog;
|
|
|
|
|
this._statuslogdetail = statuslogdetail;
|
|
|
|
|
this._repBookingStatus = repBookingStatus;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -465,14 +472,6 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
entity.ETA = m.ETA;
|
|
|
|
|
}
|
|
|
|
|
//if (m.ATD != null)
|
|
|
|
|
//{
|
|
|
|
|
// entity.ATD = m.ATD;
|
|
|
|
|
//}
|
|
|
|
|
//if (m.YgtETD != null)
|
|
|
|
|
//{
|
|
|
|
|
// entity.YgtETD = m.YgtETD;
|
|
|
|
|
//}
|
|
|
|
|
await _vesselinfo.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
////根据船公司船名航次更新船期信息
|
|
|
|
@ -486,19 +485,12 @@ namespace Myshipping.Application
|
|
|
|
|
_logger.LogInformation($"同步船期_查询到{UserManager.TENANT_NAME}需要更新{order.Count()}条订舱数据");
|
|
|
|
|
foreach (var it in order)
|
|
|
|
|
{
|
|
|
|
|
var old = it;
|
|
|
|
|
//更新订舱船期
|
|
|
|
|
if (it.ETD != item.ETD && item.ETD != null)
|
|
|
|
|
{
|
|
|
|
|
it.ETD = item.ETD;
|
|
|
|
|
|
|
|
|
|
//if (it.ATD != item.ATD && item.ATD != null)
|
|
|
|
|
//{
|
|
|
|
|
// it.ATD = item.ATD;
|
|
|
|
|
//}
|
|
|
|
|
//if (it.YgtETD != item.YgtETD && item.YgtETD != null)
|
|
|
|
|
//{
|
|
|
|
|
// it.YgtETD = item.YgtETD;
|
|
|
|
|
//}
|
|
|
|
|
await _rep.AsUpdateable(it).IgnoreColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.ParentId,
|
|
|
|
@ -518,58 +510,17 @@ namespace Myshipping.Application
|
|
|
|
|
it.LstShipOrderCompareRltName,
|
|
|
|
|
it.LstShipOrderCompareMode
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
//记录日志
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////添加booking日志
|
|
|
|
|
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
|
|
|
|
|
{
|
|
|
|
|
Type = "Edit",
|
|
|
|
|
BookingId = it.Id,
|
|
|
|
|
TenantId = Convert.ToInt64(UserManager.TENANT_ID),
|
|
|
|
|
CreatedTime = DateTime.Now,
|
|
|
|
|
CreatedUserId = CreatedUserId,
|
|
|
|
|
CreatedUserName = item.CreatedUserName
|
|
|
|
|
});
|
|
|
|
|
if (it.ETD != item.ETD)
|
|
|
|
|
{
|
|
|
|
|
await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
|
|
|
|
|
{
|
|
|
|
|
PId = bid,
|
|
|
|
|
Field = "ETD",
|
|
|
|
|
OldValue = it.ETD != null ? it.ETD.ToSqlValue() : null,
|
|
|
|
|
NewValue = item.ETD != null ? item.ETD.ToSqlValue() : null,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//if (it.ATD != item.ATD)
|
|
|
|
|
//{
|
|
|
|
|
// await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
|
|
|
|
|
// {
|
|
|
|
|
// PId = bid,
|
|
|
|
|
// Field = "ATD",
|
|
|
|
|
// OldValue = it.ATD != null ? it.ATD.ToSqlValue() : null,
|
|
|
|
|
// NewValue = item.ATD != null ? item.ATD.ToSqlValue() : null,
|
|
|
|
|
// });
|
|
|
|
|
//}
|
|
|
|
|
//if (it.YgtETD != item.YgtETD)
|
|
|
|
|
//{
|
|
|
|
|
// await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
|
|
|
|
|
// {
|
|
|
|
|
// PId = bid,
|
|
|
|
|
// Field = "ETD",
|
|
|
|
|
// OldValue = it.YgtETD != null ? it.YgtETD.ToSqlValue() : null,
|
|
|
|
|
// NewValue = item.YgtETD != null ? item.YgtETD.ToSqlValue() : null,
|
|
|
|
|
// });
|
|
|
|
|
//}
|
|
|
|
|
await _bookingorderservice.SaveLog(it, old);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var ids = order.Where(x => x.ParentId == 0).Select(x => x.Id).ToArray();
|
|
|
|
|
if (ids.Count()>0) {
|
|
|
|
|
if (ids.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
await _bookingorderservice.SendBookingOrder(ids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1696,99 +1647,33 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
foreach (var it in order)
|
|
|
|
|
{
|
|
|
|
|
var old = it;
|
|
|
|
|
bool flag = false;
|
|
|
|
|
if (it.StartETA != item.ETA)
|
|
|
|
|
{
|
|
|
|
|
flag = true;
|
|
|
|
|
////添加booking日志
|
|
|
|
|
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
|
|
|
|
|
{
|
|
|
|
|
Type = "Edit",
|
|
|
|
|
BookingId = it.Id,
|
|
|
|
|
TenantId = Convert.ToInt64(UserManager.TENANT_ID),
|
|
|
|
|
CreatedTime = DateTime.Now,
|
|
|
|
|
CreatedUserId = UserManager.UserId,
|
|
|
|
|
CreatedUserName = UserManager.Name
|
|
|
|
|
});
|
|
|
|
|
await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
|
|
|
|
|
{
|
|
|
|
|
PId = bid,
|
|
|
|
|
Field = "预抵日期",
|
|
|
|
|
OldValue = it.StartETA == null ? "" : it.StartETA.ToString(),
|
|
|
|
|
NewValue = item.ETA == null ? "" : item.ETA.ToString(),
|
|
|
|
|
});
|
|
|
|
|
it.StartETA = item.ETA;
|
|
|
|
|
}
|
|
|
|
|
if (it.YgtETD != item.ETD)
|
|
|
|
|
{
|
|
|
|
|
flag = true;
|
|
|
|
|
////添加booking日志
|
|
|
|
|
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
|
|
|
|
|
{
|
|
|
|
|
Type = "Edit",
|
|
|
|
|
BookingId = it.Id,
|
|
|
|
|
TenantId = Convert.ToInt64(UserManager.TENANT_ID),
|
|
|
|
|
CreatedTime = DateTime.Now,
|
|
|
|
|
CreatedUserId = UserManager.UserId,
|
|
|
|
|
CreatedUserName = UserManager.Name
|
|
|
|
|
});
|
|
|
|
|
await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
|
|
|
|
|
{
|
|
|
|
|
PId = bid,
|
|
|
|
|
Field = "ETD",
|
|
|
|
|
OldValue = it.YgtETD == null ? "" : it.YgtETD.ToString(),
|
|
|
|
|
NewValue = item.ETD == null ? "" : item.ETD.ToString(),
|
|
|
|
|
});
|
|
|
|
|
it.YgtETD = item.ETD;
|
|
|
|
|
}
|
|
|
|
|
if (it.ATD != item.ATD && it.ATD == null)
|
|
|
|
|
{
|
|
|
|
|
flag = true;
|
|
|
|
|
////添加booking日志
|
|
|
|
|
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
|
|
|
|
|
{
|
|
|
|
|
Type = "Edit",
|
|
|
|
|
BookingId = it.Id,
|
|
|
|
|
TenantId = Convert.ToInt64(UserManager.TENANT_ID),
|
|
|
|
|
CreatedTime = DateTime.Now,
|
|
|
|
|
CreatedUserId = UserManager.UserId,
|
|
|
|
|
CreatedUserName = UserManager.Name
|
|
|
|
|
});
|
|
|
|
|
await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
|
|
|
|
|
{
|
|
|
|
|
PId = bid,
|
|
|
|
|
Field = "实际开船日期",
|
|
|
|
|
OldValue = it.ATD == null ? "" : it.ATD.ToString(),
|
|
|
|
|
NewValue = item.ATD == null ? "" : item.ATD.ToString(),
|
|
|
|
|
});
|
|
|
|
|
it.ATD = item.ATD;
|
|
|
|
|
}
|
|
|
|
|
if (it.StartATA != item.ATA)
|
|
|
|
|
{
|
|
|
|
|
flag = true;
|
|
|
|
|
////添加booking日志
|
|
|
|
|
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
|
|
|
|
|
{
|
|
|
|
|
Type = "Edit",
|
|
|
|
|
BookingId = it.Id,
|
|
|
|
|
TenantId = Convert.ToInt64(UserManager.TENANT_ID),
|
|
|
|
|
CreatedTime = DateTime.Now,
|
|
|
|
|
CreatedUserId = UserManager.UserId,
|
|
|
|
|
CreatedUserName = UserManager.Name
|
|
|
|
|
});
|
|
|
|
|
await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
|
|
|
|
|
{
|
|
|
|
|
PId = bid,
|
|
|
|
|
Field = "实际抵港",
|
|
|
|
|
OldValue = it.StartATA == null ? "" : it.StartATA.ToString(),
|
|
|
|
|
NewValue = item.ATA == null ? "" : item.ATA.ToString(),
|
|
|
|
|
});
|
|
|
|
|
it.StartATA = item.ATA;
|
|
|
|
|
}
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
issend = true;
|
|
|
|
|
await _rep.AsUpdateable(it).IgnoreColumns().ExecuteCommandAsync();
|
|
|
|
|
await _bookingorderservice.SaveLog(it, old);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1831,140 +1716,45 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
foreach (var it in order)
|
|
|
|
|
{
|
|
|
|
|
var old = it;
|
|
|
|
|
bool flag = false;
|
|
|
|
|
|
|
|
|
|
if (it.ETA != item.ETA)
|
|
|
|
|
{
|
|
|
|
|
flag = true;
|
|
|
|
|
////添加booking日志
|
|
|
|
|
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
|
|
|
|
|
{
|
|
|
|
|
Type = "Edit",
|
|
|
|
|
BookingId = it.Id,
|
|
|
|
|
TenantId = Convert.ToInt64(UserManager.TENANT_ID),
|
|
|
|
|
CreatedTime = DateTime.Now,
|
|
|
|
|
CreatedUserId = UserManager.UserId,
|
|
|
|
|
CreatedUserName = UserManager.Name
|
|
|
|
|
});
|
|
|
|
|
await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
|
|
|
|
|
{
|
|
|
|
|
PId = bid,
|
|
|
|
|
Field = "预计到港日期(目的港)",
|
|
|
|
|
OldValue = it.ETA == null ? "" : it.ETA.ToString(),
|
|
|
|
|
NewValue = item.ETA == null ? "" : item.ETA.ToString(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it.ETA = item.ETA;
|
|
|
|
|
}
|
|
|
|
|
if (it.MiddleETA != item.MiddleETA)
|
|
|
|
|
{
|
|
|
|
|
flag = true;
|
|
|
|
|
////添加booking日志
|
|
|
|
|
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
|
|
|
|
|
{
|
|
|
|
|
Type = "Edit",
|
|
|
|
|
BookingId = it.Id,
|
|
|
|
|
TenantId = Convert.ToInt64(UserManager.TENANT_ID),
|
|
|
|
|
CreatedTime = DateTime.Now,
|
|
|
|
|
CreatedUserId = UserManager.UserId,
|
|
|
|
|
CreatedUserName = UserManager.Name
|
|
|
|
|
});
|
|
|
|
|
await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
|
|
|
|
|
{
|
|
|
|
|
PId = bid,
|
|
|
|
|
Field = "中转预抵",
|
|
|
|
|
OldValue = it.MiddleETA == null ? "" : it.MiddleETA.ToString(),
|
|
|
|
|
NewValue = item.MiddleETA == null ? "" : item.MiddleETA.ToString(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it.MiddleETA = item.MiddleETA;
|
|
|
|
|
}
|
|
|
|
|
if (it.MiddleETD != item.MiddleETD)
|
|
|
|
|
{
|
|
|
|
|
flag = true;
|
|
|
|
|
////添加booking日志
|
|
|
|
|
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
|
|
|
|
|
{
|
|
|
|
|
Type = "Edit",
|
|
|
|
|
BookingId = it.Id,
|
|
|
|
|
TenantId = Convert.ToInt64(UserManager.TENANT_ID),
|
|
|
|
|
CreatedTime = DateTime.Now,
|
|
|
|
|
CreatedUserId = UserManager.UserId,
|
|
|
|
|
CreatedUserName = UserManager.Name
|
|
|
|
|
});
|
|
|
|
|
await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
|
|
|
|
|
{
|
|
|
|
|
PId = bid,
|
|
|
|
|
Field = "中转预计离港",
|
|
|
|
|
OldValue = it.MiddleETD == null ? "" : it.MiddleETD.ToString(),
|
|
|
|
|
NewValue = item.MiddleETD == null ? "" : item.MiddleETD.ToString(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it.MiddleETD = item.MiddleETD;
|
|
|
|
|
}
|
|
|
|
|
if (item.MiddleATA != it.MiddleATA)
|
|
|
|
|
{
|
|
|
|
|
flag = true;
|
|
|
|
|
////添加booking日志
|
|
|
|
|
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
|
|
|
|
|
{
|
|
|
|
|
Type = "Edit",
|
|
|
|
|
BookingId = it.Id,
|
|
|
|
|
TenantId = Convert.ToInt64(UserManager.TENANT_ID),
|
|
|
|
|
CreatedTime = DateTime.Now,
|
|
|
|
|
CreatedUserId = UserManager.UserId,
|
|
|
|
|
CreatedUserName = UserManager.Name
|
|
|
|
|
});
|
|
|
|
|
await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
|
|
|
|
|
{
|
|
|
|
|
PId = bid,
|
|
|
|
|
Field = "中转实际到港",
|
|
|
|
|
OldValue = it.MiddleATA == null ? "" : it.MiddleATA.ToString(),
|
|
|
|
|
NewValue = item.MiddleATA == null ? "" : item.MiddleATA.ToString(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it.MiddleATA = item.MiddleATA;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (item.MiddleATD != it.MiddleATD)
|
|
|
|
|
{
|
|
|
|
|
flag = true;
|
|
|
|
|
////添加booking日志
|
|
|
|
|
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
|
|
|
|
|
{
|
|
|
|
|
Type = "Edit",
|
|
|
|
|
BookingId = it.Id,
|
|
|
|
|
TenantId = Convert.ToInt64(UserManager.TENANT_ID),
|
|
|
|
|
CreatedTime = DateTime.Now,
|
|
|
|
|
CreatedUserId = UserManager.UserId,
|
|
|
|
|
CreatedUserName = UserManager.Name
|
|
|
|
|
});
|
|
|
|
|
await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
|
|
|
|
|
{
|
|
|
|
|
PId = bid,
|
|
|
|
|
Field = "中转实际离港",
|
|
|
|
|
OldValue = it.MiddleATD == null ? "" : it.MiddleATD.ToString(),
|
|
|
|
|
NewValue = item.MiddleATD == null ? "" : item.MiddleATD.ToString(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it.MiddleATD = item.MiddleATD;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (item.ATA != it.ATA)
|
|
|
|
|
{
|
|
|
|
|
flag = true;
|
|
|
|
|
////添加booking日志
|
|
|
|
|
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
|
|
|
|
|
{
|
|
|
|
|
Type = "Edit",
|
|
|
|
|
BookingId = it.Id,
|
|
|
|
|
TenantId = Convert.ToInt64(UserManager.TENANT_ID),
|
|
|
|
|
CreatedTime = DateTime.Now,
|
|
|
|
|
CreatedUserId = UserManager.UserId,
|
|
|
|
|
CreatedUserName = UserManager.Name
|
|
|
|
|
});
|
|
|
|
|
await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
|
|
|
|
|
{
|
|
|
|
|
PId = bid,
|
|
|
|
|
Field = "实际到港(目的港)",
|
|
|
|
|
OldValue = it.ATA == null ? "" : it.ATA.ToString(),
|
|
|
|
|
NewValue = item.ATA == null ? "" : item.ATA.ToString(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it.ATA = item.ATA;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1972,6 +1762,7 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
issend = true;
|
|
|
|
|
await _rep.AsUpdateable(it).IgnoreColumns().ExecuteCommandAsync();
|
|
|
|
|
await _bookingorderservice.SaveLog(it, old);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (issend)
|
|
|
|
@ -2246,6 +2037,200 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 插入货运动态
|
|
|
|
|
/// </summary>
|
|
|
|
|
[SqlSugarUnitOfWork]
|
|
|
|
|
[HttpPost("/DataSync/AddBookingStatusLog"), ApiUser(ApiCode = "AddBookingStatusLog")]
|
|
|
|
|
public async Task AddBookingStatusLog(List<BookingStatusLogDto> all)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var old = await _repStatuslog.AsQueryable().Filter(null, true).Where(x => x.BookingId == all[0].BookingId && x.Category == "yunzong" && x.IsDeleted == false).ToListAsync();
|
|
|
|
|
await _repStatuslog.DeleteAsync(x => x.BookingId == all[0].BookingId && x.Category == "yunzong");
|
|
|
|
|
foreach (var ot in old)
|
|
|
|
|
{
|
|
|
|
|
await _statuslogdetail.DeleteAsync(x => x.PId == ot.Id);
|
|
|
|
|
}
|
|
|
|
|
var dicdatalist = _cache.GetAllDictData().Result;
|
|
|
|
|
foreach (var item in all)
|
|
|
|
|
{
|
|
|
|
|
#region 日志
|
|
|
|
|
//新增数据
|
|
|
|
|
var bookingStatusLog = new BookingStatusLog();
|
|
|
|
|
bookingStatusLog.BookingId = item.BookingId;
|
|
|
|
|
bookingStatusLog.Category = "yunzong";
|
|
|
|
|
bookingStatusLog.CreatedTime = DateTime.Now;
|
|
|
|
|
bookingStatusLog.Status = item.Status;
|
|
|
|
|
bookingStatusLog.OpTime = item.OpTime;
|
|
|
|
|
bookingStatusLog.MBLNO = item.MBLNO;
|
|
|
|
|
await _repStatuslog.InsertAsync(bookingStatusLog);
|
|
|
|
|
var list = await _repBookingStatus.AsQueryable().Filter(null, true).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();
|
|
|
|
|
|
|
|
|
|
if (item.detail != null && item.detail.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var dt in item.detail)
|
|
|
|
|
{
|
|
|
|
|
var BookingStatusLogDetail = new BookingStatusLogDetail();
|
|
|
|
|
BookingStatusLogDetail.PId = bookingStatusLog.Id;
|
|
|
|
|
BookingStatusLogDetail.Status = dt.Status;
|
|
|
|
|
BookingStatusLogDetail.CNTRNO = dt.CNTRNO;
|
|
|
|
|
BookingStatusLogDetail.OPTime = dt.OPTime;
|
|
|
|
|
await _statuslogdetail.InsertAsync(BookingStatusLogDetail);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#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);
|
|
|
|
|
await _bookingorderservice.SetGoodsStatus("BG", item.BookingId);
|
|
|
|
|
await _bookingorderservice.SendBookingOrder(new long[] { item.BookingId });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
await _bookingorderservice.SetGoodsStatus("ZZFX", item.BookingId);
|
|
|
|
|
await _bookingorderservice.SendBookingOrder(new long[] { item.BookingId });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
await _bookingorderservice.SetGoodsStatus("MTFX", item.BookingId);
|
|
|
|
|
await _bookingorderservice.SendBookingOrder(new long[] { item.BookingId });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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.detail.Max(x => x.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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#region 入港时间
|
|
|
|
|
if (item.Status == "入港")
|
|
|
|
|
{
|
|
|
|
|
await _bookingorderservice.SetGoodsStatus("YRG", item.BookingId);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ATD
|
|
|
|
|
if (item.Status == "ATD")
|
|
|
|
|
{
|
|
|
|
|
var o = _rep.AsQueryable().Filter(null, true).Where(x => x.Id == item.BookingId && x.IsDeleted == false).First();
|
|
|
|
|
var oldorder = o;
|
|
|
|
|
var oldatd = o == null ? null : o.ATD;
|
|
|
|
|
if (oldatd != item.OpTime && item.OpTime != null)
|
|
|
|
|
{
|
|
|
|
|
o.ATD = item.OpTime;
|
|
|
|
|
await _rep.UpdateAsync(o);
|
|
|
|
|
|
|
|
|
|
await _bookingorderservice.SendBookingOrder(new long[] { o.Id });
|
|
|
|
|
await _bookingorderservice.SaveLog(o,oldorder);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(o.VESSEL) && !string.IsNullOrEmpty(o.VOYNO) && !string.IsNullOrEmpty(o.CARRIERID))
|
|
|
|
|
{
|
|
|
|
|
var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.VOYNO == o.VOYNO && x.VESSEL == o.VESSEL && x.CARRIERID == o.CARRIERID && x.TenantId == o.TenantId && x.IsDeleted == false && x.Id != item.BookingId).ToListAsync();
|
|
|
|
|
|
|
|
|
|
foreach (var it in order)
|
|
|
|
|
{
|
|
|
|
|
var _oldorder= it;
|
|
|
|
|
var _oldatd = it.ATD;
|
|
|
|
|
if (_oldatd != item.OpTime)
|
|
|
|
|
{
|
|
|
|
|
it.ATD = item.OpTime;
|
|
|
|
|
await _rep.UpdateAsync(it);
|
|
|
|
|
|
|
|
|
|
await _bookingorderservice.SendBookingOrder(new long[] { it.Id });
|
|
|
|
|
await _bookingorderservice.SaveLog(it, _oldorder);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
_logger.LogError(ex.Message);
|
|
|
|
|
_logger.LogError(ex.StackTrace);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
@ -2258,7 +2243,6 @@ namespace Myshipping.Application
|
|
|
|
|
[HttpGet("/DataSync/GetSyncVesselDate"), ApiUser(ApiCode = "GetSyncVesselDate")]
|
|
|
|
|
public async Task<dynamic> GetSyncVesselDate()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _vesselinfo.AsQueryable().Filter(null, true).Where(x => x.Sign == false && x.ATD == null && x.TenantId == UserManager.TENANT_ID && (x.Voyno != null && x.Voyno != "")).Select(x => new
|
|
|
|
|
{
|
|
|
|
|
Vessel = x.Vessel,
|
|
|
|
@ -2330,67 +2314,7 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.Id == input.Id).FirstAsync();
|
|
|
|
|
if (order.MBLNO != input.MBLNO)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
|
|
|
|
|
{
|
|
|
|
|
Type = "Edit",
|
|
|
|
|
BookingId = order.Id,
|
|
|
|
|
TenantId = Convert.ToInt64(UserManager.TENANT_ID),
|
|
|
|
|
CreatedTime = DateTime.Now,
|
|
|
|
|
CreatedUserId = order.CreatedUserId,
|
|
|
|
|
CreatedUserName = order.CreatedUserName
|
|
|
|
|
});
|
|
|
|
|
await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
|
|
|
|
|
{
|
|
|
|
|
PId = bid,
|
|
|
|
|
Field = "MBLNO",
|
|
|
|
|
OldValue = order.MBLNO,
|
|
|
|
|
NewValue = input.MBLNO,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (order.TMBLNO != input.TMBLNO)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
|
|
|
|
|
{
|
|
|
|
|
Type = "Edit",
|
|
|
|
|
BookingId = order.Id,
|
|
|
|
|
TenantId = Convert.ToInt64(UserManager.TENANT_ID),
|
|
|
|
|
CreatedTime = DateTime.Now,
|
|
|
|
|
CreatedUserId = order.CreatedUserId,
|
|
|
|
|
CreatedUserName = order.CreatedUserName
|
|
|
|
|
});
|
|
|
|
|
await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
|
|
|
|
|
{
|
|
|
|
|
PId = bid,
|
|
|
|
|
Field = "TMBLNO",
|
|
|
|
|
OldValue = order.TMBLNO,
|
|
|
|
|
NewValue = input.TMBLNO,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (order.BOOKINGNO != input.BOOKINGNO)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
|
|
|
|
|
{
|
|
|
|
|
Type = "Edit",
|
|
|
|
|
BookingId = order.Id,
|
|
|
|
|
TenantId = Convert.ToInt64(UserManager.TENANT_ID),
|
|
|
|
|
CreatedTime = DateTime.Now,
|
|
|
|
|
CreatedUserId = order.CreatedUserId,
|
|
|
|
|
CreatedUserName = order.CreatedUserName
|
|
|
|
|
});
|
|
|
|
|
await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
|
|
|
|
|
{
|
|
|
|
|
PId = bid,
|
|
|
|
|
Field = "BOOKINGNO",
|
|
|
|
|
OldValue = order.BOOKINGNO,
|
|
|
|
|
NewValue = input.BOOKINGNO,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
var old = order;
|
|
|
|
|
order.MBLNO = input.MBLNO;
|
|
|
|
|
order.TMBLNO = input.TMBLNO;
|
|
|
|
|
order.BOOKINGNO = input.BOOKINGNO;
|
|
|
|
@ -2407,11 +2331,9 @@ namespace Myshipping.Application
|
|
|
|
|
it.TenantName,
|
|
|
|
|
it.IsDeleted,
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
await _bookingorderservice.SaveLog(order, old);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取接口Key 个人或公司
|
|
|
|
|
/// </summary>
|
|
|
|
@ -2509,13 +2431,6 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|