jianghaiqing 1 year ago
commit e7f1c91962

@ -282,9 +282,9 @@ namespace Myshipping.Application
.WhereIF(!string.IsNullOrWhiteSpace(input.VOYNO), u => u.VOYNO.Contains(input.VOYNO)) .WhereIF(!string.IsNullOrWhiteSpace(input.VOYNO), u => u.VOYNO.Contains(input.VOYNO))
.WhereIF(!string.IsNullOrWhiteSpace(input.VOYNOINNER), u => u.VOYNOINNER.Contains(input.VOYNOINNER)) .WhereIF(!string.IsNullOrWhiteSpace(input.VOYNOINNER), u => u.VOYNOINNER.Contains(input.VOYNOINNER))
.WhereIF(input.BETD != null, u => u.ETD >= input.BETD) .WhereIF(input.BETD != null, u => u.ETD >= input.BETD)
.WhereIF(input.EETD != null, u => u.ETD <= input.EETD) .WhereIF(input.EETD != null, u => u.ETD < input.EETD.Value.AddDays(1))
.WhereIF(input.BATD != null, u => u.ATD >= input.BATD) .WhereIF(input.BATD != null, u => u.ATD >= input.BATD)
.WhereIF(input.EATD != null, u => u.ATD <= input.EATD) .WhereIF(input.EATD != null, u => u.ATD < input.EATD.Value.AddDays(1))
.WhereIF(input.BCLOSINGDATE != null, u => u.CLOSINGDATE >= input.BCLOSINGDATE) .WhereIF(input.BCLOSINGDATE != null, u => u.CLOSINGDATE >= input.BCLOSINGDATE)
.WhereIF(input.ECLOSINGDATE != null, u => u.CLOSINGDATE <= input.ECLOSINGDATE) .WhereIF(input.ECLOSINGDATE != null, u => u.CLOSINGDATE <= input.ECLOSINGDATE)
.WhereIF(input.BCLOSEDOCDATE != null, u => u.CLOSEDOCDATE >= input.BCLOSEDOCDATE) .WhereIF(input.BCLOSEDOCDATE != null, u => u.CLOSEDOCDATE >= input.BCLOSEDOCDATE)
@ -292,7 +292,7 @@ namespace Myshipping.Application
.WhereIF(input.BCLOSEVGMDATE != null, u => u.CLOSEVGMDATE >= input.BCLOSEVGMDATE) .WhereIF(input.BCLOSEVGMDATE != null, u => u.CLOSEVGMDATE >= input.BCLOSEVGMDATE)
.WhereIF(input.ECLOSEVGMDATE != null, u => u.CLOSEVGMDATE <= input.ECLOSEVGMDATE) .WhereIF(input.ECLOSEVGMDATE != null, u => u.CLOSEVGMDATE <= input.ECLOSEVGMDATE)
.WhereIF(input.BETA != null, u => u.ETA >= input.BETA) .WhereIF(input.BETA != null, u => u.ETA >= input.BETA)
.WhereIF(input.EETA != null, u => u.ETA <= input.EETA) .WhereIF(input.EETA != null, u => u.ETA < input.EETA.Value.AddDays(1))
.WhereIF(!string.IsNullOrWhiteSpace(input.PLACERECEIPT), u => u.PLACERECEIPT.Contains(input.PLACERECEIPT)) .WhereIF(!string.IsNullOrWhiteSpace(input.PLACERECEIPT), u => u.PLACERECEIPT.Contains(input.PLACERECEIPT))
.WhereIF(!string.IsNullOrWhiteSpace(input.PORTLOAD), u => u.PORTLOAD.Contains(input.PORTLOAD)) .WhereIF(!string.IsNullOrWhiteSpace(input.PORTLOAD), u => u.PORTLOAD.Contains(input.PORTLOAD))
.WhereIF(!string.IsNullOrWhiteSpace(input.PORTLOADID), u => u.PORTLOADID == input.PORTLOADID) .WhereIF(!string.IsNullOrWhiteSpace(input.PORTLOADID), u => u.PORTLOADID == input.PORTLOADID)
@ -306,7 +306,7 @@ namespace Myshipping.Application
.WhereIF(!string.IsNullOrWhiteSpace(input.COPYNOBILLL), u => u.COPYNOBILL == input.COPYNOBILLL) .WhereIF(!string.IsNullOrWhiteSpace(input.COPYNOBILLL), u => u.COPYNOBILL == input.COPYNOBILLL)
.WhereIF(!string.IsNullOrWhiteSpace(input.ISSUETYPE), u => u.ISSUETYPE == input.ISSUETYPE) .WhereIF(!string.IsNullOrWhiteSpace(input.ISSUETYPE), u => u.ISSUETYPE == input.ISSUETYPE)
.WhereIF(input.BISSUEDATE != null, u => u.ISSUEDATE >= input.BISSUEDATE) .WhereIF(input.BISSUEDATE != null, u => u.ISSUEDATE >= input.BISSUEDATE)
.WhereIF(input.EISSUEDATE != null, u => u.ISSUEDATE <= input.EISSUEDATE) .WhereIF(input.EISSUEDATE != null, u => u.ISSUEDATE < input.EISSUEDATE.Value.AddDays(1))
.WhereIF(!string.IsNullOrWhiteSpace(input.ISSUEPLACE), u => u.ISSUEPLACE.Contains(input.ISSUEPLACE)) .WhereIF(!string.IsNullOrWhiteSpace(input.ISSUEPLACE), u => u.ISSUEPLACE.Contains(input.ISSUEPLACE))
.WhereIF(!string.IsNullOrWhiteSpace(input.ISSUEPLACEID), u => u.ISSUEPLACEID == input.ISSUEPLACEID) .WhereIF(!string.IsNullOrWhiteSpace(input.ISSUEPLACEID), u => u.ISSUEPLACEID == input.ISSUEPLACEID)
.WhereIF(!string.IsNullOrWhiteSpace(input.BLFRT), u => u.BLFRT == input.BLFRT) .WhereIF(!string.IsNullOrWhiteSpace(input.BLFRT), u => u.BLFRT == input.BLFRT)

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

@ -422,14 +422,11 @@ namespace Myshipping.Application
var orderlist = _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToList(); var orderlist = _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToList();
foreach (var item in model) foreach (var item in model)
{ {
var CreatedUserId = userlist.Where(x => x.Name == item.CreatedUserName).Select(x => x.Id).FirstOrDefault(); var CreatedUserId = userlist.Where(x => x.Name == item.CreatedUserName).Select(x => x.Id).FirstOrDefault();
if (string.IsNullOrWhiteSpace(item.BSNO)) if (string.IsNullOrWhiteSpace(item.BSNO))
{ {
throw Oops.Bah("BSNO未录入"); throw Oops.Bah("BSNO未录入");
} }
var m = mlist.Where(x => x.BSNO == item.BSNO).FirstOrDefault(); var m = mlist.Where(x => x.BSNO == item.BSNO).FirstOrDefault();
var entity = item.Adapt<DjyVesselInfo>(); var entity = item.Adapt<DjyVesselInfo>();
entity.Vessel = item.Vessel.ToUpper().Trim(); entity.Vessel = item.Vessel.ToUpper().Trim();
@ -457,7 +454,6 @@ namespace Myshipping.Application
} }
if (string.IsNullOrEmpty(item.Voyno)) if (string.IsNullOrEmpty(item.Voyno))
{ {
entity.Voyno = entity.VoynoInside; entity.Voyno = entity.VoynoInside;
} }
if (m == null) if (m == null)
@ -468,7 +464,8 @@ namespace Myshipping.Application
await _vesselinfo.InsertAsync(entity); await _vesselinfo.InsertAsync(entity);
} }
else { else
{
entity.Id = e.Id; entity.Id = e.Id;
if (e.ETA != null) if (e.ETA != null)

@ -23,7 +23,7 @@ namespace Myshipping.Core.Service
private readonly SqlSugarRepository<DjyVesselInfo> _rep; private readonly SqlSugarRepository<DjyVesselInfo> _rep;
private readonly ISysCacheService _sysCacheService; private readonly ISysCacheService _sysCacheService;
public DjyVesselInfoService(SqlSugarRepository<DjyVesselInfo> rep,ISysCacheService sysCacheService) public DjyVesselInfoService(SqlSugarRepository<DjyVesselInfo> rep, ISysCacheService sysCacheService)
{ {
_sysCacheService = sysCacheService; _sysCacheService = sysCacheService;
_rep = rep; _rep = rep;
@ -37,7 +37,7 @@ namespace Myshipping.Core.Service
public async Task<dynamic> GetListPage([FromQuery] string CARRIER, string Vessel, string VoynoInside, string Voyno, DateTime? StartETD, DateTime? EndETD) public async Task<dynamic> GetListPage([FromQuery] string CARRIER, string Vessel, string VoynoInside, string Voyno, DateTime? StartETD, DateTime? EndETD)
{ {
return await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID&&x.IsDeleted==false) return await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false)
.WhereIF(!string.IsNullOrWhiteSpace(CARRIER), x => x.CARRIER.Contains(CARRIER)) .WhereIF(!string.IsNullOrWhiteSpace(CARRIER), x => x.CARRIER.Contains(CARRIER))
.WhereIF(!string.IsNullOrWhiteSpace(Vessel), x => x.Vessel.Contains(Vessel)) .WhereIF(!string.IsNullOrWhiteSpace(Vessel), x => x.Vessel.Contains(Vessel))
.WhereIF(!string.IsNullOrWhiteSpace(VoynoInside), x => x.VoynoInside.Contains(VoynoInside)) .WhereIF(!string.IsNullOrWhiteSpace(VoynoInside), x => x.VoynoInside.Contains(VoynoInside))
@ -108,15 +108,14 @@ namespace Myshipping.Core.Service
{ {
var entity = dto.Adapt<DjyVesselInfo>(); var entity = dto.Adapt<DjyVesselInfo>();
var e= _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false && x.CARRIERID == entity.CARRIERID && x.Vessel == entity.Vessel && x.Voyno == entity.Voyno && x.VoynoInside == entity.VoynoInside).First(); var e = _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false && x.CARRIERID == entity.CARRIERID && x.Vessel == entity.Vessel && x.Voyno == entity.Voyno && x.VoynoInside == entity.VoynoInside).First();
if (e == null) if (e == null)
{ {
await _rep.InsertAsync(entity); await _rep.InsertAsync(entity);
} }
else { else
{
entity.Id = e.Id; entity.Id = e.Id;
if (e.ETA != null) if (e.ETA != null)
{ {
@ -124,7 +123,6 @@ namespace Myshipping.Core.Service
} }
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
} }
} }
else else
{ {

Loading…
Cancel
Save