|
|
|
@ -27,7 +27,7 @@ namespace Myshipping.Application
|
|
|
|
|
private readonly IBookingOrderService _bookingorderservice;
|
|
|
|
|
private readonly SqlSugarRepository<BookingOrder> _order;
|
|
|
|
|
private readonly ILogger<BookingVesselInfoService> _logger;
|
|
|
|
|
public BookingVesselInfoService(SqlSugarRepository<DjyVesselInfo> rep, ILogger<BookingVesselInfoService> logger, SqlSugarRepository<BookingOrder> order,ISysCacheService sysCacheService,IBookingOrderService bookingorderservice)
|
|
|
|
|
public BookingVesselInfoService(SqlSugarRepository<DjyVesselInfo> rep, ILogger<BookingVesselInfoService> logger, SqlSugarRepository<BookingOrder> order, ISysCacheService sysCacheService, IBookingOrderService bookingorderservice)
|
|
|
|
|
{
|
|
|
|
|
_sysCacheService = sysCacheService;
|
|
|
|
|
_rep = rep;
|
|
|
|
@ -106,6 +106,7 @@ namespace Myshipping.Application
|
|
|
|
|
[HttpPost("/BookingVesselInfo/AddOrUpdate")]
|
|
|
|
|
public async Task<long> AddOrUpdate(DjyVesselInfoDto dto)
|
|
|
|
|
{
|
|
|
|
|
DjyVesselInfo old = new DjyVesselInfo();
|
|
|
|
|
if (dto == null)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("请传入数据!");
|
|
|
|
@ -113,20 +114,26 @@ namespace Myshipping.Application
|
|
|
|
|
if (dto.Id == 0)
|
|
|
|
|
{
|
|
|
|
|
var entity = dto.Adapt<DjyVesselInfo>();
|
|
|
|
|
|
|
|
|
|
await _rep.InsertAsync(entity);
|
|
|
|
|
|
|
|
|
|
old = entity;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
old = _rep.FirstOrDefault(x => x.Id == dto.Id);
|
|
|
|
|
var entity = dto.Adapt<DjyVesselInfo>();
|
|
|
|
|
|
|
|
|
|
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((dto.ETA != null || dto.ETD != null || dto.ATD != null) && !string.IsNullOrEmpty(dto.Vessel) && !string.IsNullOrEmpty(dto.Voyno)&&!string.IsNullOrEmpty(dto.CARRIERID))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((dto.ETA != null || dto.ETD != null || dto.ATD != null) && !string.IsNullOrEmpty(old.Vessel) && !string.IsNullOrEmpty(old.Voyno) && !string.IsNullOrEmpty(old.CARRIERID))
|
|
|
|
|
{
|
|
|
|
|
var order=await _order.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false && x.VESSEL == dto.Vessel && x.VOYNO == dto.Voyno
|
|
|
|
|
&&x.CARRIERID==dto.CARRIERID).ToListAsync();
|
|
|
|
|
var order = await _order.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false && x.VESSEL == old.Vessel && x.VOYNO == old.Voyno
|
|
|
|
|
&& x.CARRIERID == old.CARRIERID).ToListAsync();
|
|
|
|
|
bool issend = false;
|
|
|
|
|
if (order != null)
|
|
|
|
|
{
|
|
|
|
@ -139,24 +146,52 @@ namespace Myshipping.Application
|
|
|
|
|
flag = true;
|
|
|
|
|
it.StartETA = dto.ETA;
|
|
|
|
|
}
|
|
|
|
|
if (it.VESSEL != dto.Vessel)
|
|
|
|
|
{
|
|
|
|
|
flag = true;
|
|
|
|
|
it.VESSEL = dto.Vessel;
|
|
|
|
|
}
|
|
|
|
|
if (it.VOYNO != dto.Voyno)
|
|
|
|
|
{
|
|
|
|
|
flag = true;
|
|
|
|
|
it.VOYNO = dto.Voyno;
|
|
|
|
|
}
|
|
|
|
|
if (it.VOYNOINNER != dto.VoynoInside)
|
|
|
|
|
{
|
|
|
|
|
flag = true;
|
|
|
|
|
it.VOYNOINNER = dto.VoynoInside;
|
|
|
|
|
}
|
|
|
|
|
if (it.CARRIERID != dto.CARRIERID)
|
|
|
|
|
{
|
|
|
|
|
flag = true;
|
|
|
|
|
it.CARRIERID = dto.CARRIERID;
|
|
|
|
|
}
|
|
|
|
|
if (it.CARRIER != dto.CARRIER)
|
|
|
|
|
{
|
|
|
|
|
flag = true;
|
|
|
|
|
it.CARRIER = dto.CARRIER;
|
|
|
|
|
}
|
|
|
|
|
if (it.YgtETD != dto.YgtETD)
|
|
|
|
|
{
|
|
|
|
|
flag = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it.YgtETD = dto.YgtETD;
|
|
|
|
|
}
|
|
|
|
|
if (it.ATD != dto.ATD&&dto.ATD!=null)
|
|
|
|
|
if (it.ETD != dto.ETD)
|
|
|
|
|
{
|
|
|
|
|
flag = true;
|
|
|
|
|
|
|
|
|
|
it.ETD = dto.ETD;
|
|
|
|
|
}
|
|
|
|
|
if (it.ATD != dto.ATD && dto.ATD != null)
|
|
|
|
|
{
|
|
|
|
|
flag = true;
|
|
|
|
|
|
|
|
|
|
it.ATD = dto.ATD;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
issend = true;
|
|
|
|
|
await _order.AsUpdateable(it).IgnoreColumns().ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (issend)
|
|
|
|
|