diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index a0a110f5..6e423735 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -282,9 +282,9 @@ namespace Myshipping.Application .WhereIF(!string.IsNullOrWhiteSpace(input.VOYNO), u => u.VOYNO.Contains(input.VOYNO)) .WhereIF(!string.IsNullOrWhiteSpace(input.VOYNOINNER), u => u.VOYNOINNER.Contains(input.VOYNOINNER)) .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.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.ECLOSINGDATE != null, u => u.CLOSINGDATE <= input.ECLOSINGDATE) .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.ECLOSEVGMDATE != null, u => u.CLOSEVGMDATE <= input.ECLOSEVGMDATE) .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.PORTLOAD), u => u.PORTLOAD.Contains(input.PORTLOAD)) .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.ISSUETYPE), u => u.ISSUETYPE == input.ISSUETYPE) .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.ISSUEPLACEID), u => u.ISSUEPLACEID == input.ISSUEPLACEID) .WhereIF(!string.IsNullOrWhiteSpace(input.BLFRT), u => u.BLFRT == input.BLFRT) diff --git a/Myshipping.Application/Service/BookingVesselInfo/BookingVesselInfoService.cs b/Myshipping.Application/Service/BookingVesselInfo/BookingVesselInfoService.cs index 49d3dd4f..cb676bbb 100644 --- a/Myshipping.Application/Service/BookingVesselInfo/BookingVesselInfoService.cs +++ b/Myshipping.Application/Service/BookingVesselInfo/BookingVesselInfoService.cs @@ -27,7 +27,7 @@ namespace Myshipping.Application private readonly IBookingOrderService _bookingorderservice; private readonly SqlSugarRepository _order; private readonly ILogger _logger; - public BookingVesselInfoService(SqlSugarRepository rep, ILogger logger, SqlSugarRepository order,ISysCacheService sysCacheService,IBookingOrderService bookingorderservice) + public BookingVesselInfoService(SqlSugarRepository rep, ILogger logger, SqlSugarRepository order, ISysCacheService sysCacheService, IBookingOrderService bookingorderservice) { _sysCacheService = sysCacheService; _rep = rep; @@ -106,6 +106,7 @@ namespace Myshipping.Application [HttpPost("/BookingVesselInfo/AddOrUpdate")] public async Task 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(); - await _rep.InsertAsync(entity); + + old = entity; } else { + old = _rep.FirstOrDefault(x => x.Id == dto.Id); var entity = dto.Adapt(); - 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) diff --git a/Myshipping.Application/Service/DataSync/DataSyncService.cs b/Myshipping.Application/Service/DataSync/DataSyncService.cs index 394b60df..69801f2a 100644 --- a/Myshipping.Application/Service/DataSync/DataSyncService.cs +++ b/Myshipping.Application/Service/DataSync/DataSyncService.cs @@ -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(); foreach (var item in model) { - var CreatedUserId = userlist.Where(x => x.Name == item.CreatedUserName).Select(x => x.Id).FirstOrDefault(); - if (string.IsNullOrWhiteSpace(item.BSNO)) { throw Oops.Bah("BSNO未录入"); } - var m = mlist.Where(x => x.BSNO == item.BSNO).FirstOrDefault(); var entity = item.Adapt(); entity.Vessel = item.Vessel.ToUpper().Trim(); @@ -457,7 +454,6 @@ namespace Myshipping.Application } if (string.IsNullOrEmpty(item.Voyno)) { - entity.Voyno = entity.VoynoInside; } if (m == null) @@ -468,7 +464,8 @@ namespace Myshipping.Application await _vesselinfo.InsertAsync(entity); } - else { + else + { entity.Id = e.Id; if (e.ETA != null) diff --git a/Myshipping.Core/Service/DjyVesselInfo/DjyVesselInfoService.cs b/Myshipping.Core/Service/DjyVesselInfo/DjyVesselInfoService.cs index 094785b3..d6c27fd3 100644 --- a/Myshipping.Core/Service/DjyVesselInfo/DjyVesselInfoService.cs +++ b/Myshipping.Core/Service/DjyVesselInfo/DjyVesselInfoService.cs @@ -23,11 +23,11 @@ namespace Myshipping.Core.Service private readonly SqlSugarRepository _rep; private readonly ISysCacheService _sysCacheService; - public DjyVesselInfoService(SqlSugarRepository rep,ISysCacheService sysCacheService) + public DjyVesselInfoService(SqlSugarRepository rep, ISysCacheService sysCacheService) { _sysCacheService = sysCacheService; _rep = rep; - + } /// /// 获取列表 @@ -37,7 +37,7 @@ namespace Myshipping.Core.Service public async Task 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(Vessel), x => x.Vessel.Contains(Vessel)) .WhereIF(!string.IsNullOrWhiteSpace(VoynoInside), x => x.VoynoInside.Contains(VoynoInside)) @@ -108,15 +108,14 @@ namespace Myshipping.Core.Service { var entity = dto.Adapt(); - 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) { await _rep.InsertAsync(entity); } - else { - - + else + { entity.Id = e.Id; if (e.ETA != null) { @@ -124,7 +123,6 @@ namespace Myshipping.Core.Service } await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); } - } else {