diff --git a/Myshipping.Application/Service/DataSync/DataSyncService.cs b/Myshipping.Application/Service/DataSync/DataSyncService.cs index 02b851a3..6bdcdf64 100644 --- a/Myshipping.Application/Service/DataSync/DataSyncService.cs +++ b/Myshipping.Application/Service/DataSync/DataSyncService.cs @@ -1845,14 +1845,22 @@ namespace Myshipping.Application //} //变更船期 - await _vesselinfo.UpdateAsync(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false && x.Vessel == item.Vessel && x.Voyno == item.Voyno && x.PortLoadingId == item.PortLoadId, - x => new DjyVesselInfo - { - ETA = item.ETA, - YgtETD = item.ETD, - ATD = item.ATD, - UpdatedTime = DateTime.Now - }); + //await _vesselinfo.UpdateAsync(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false && x.Vessel == item.Vessel && x.Voyno == item.Voyno && x.PortLoadingId == item.PortLoadId, + // x => new DjyVesselInfo + // { + // ETA = item.ETA, + // YgtETD = item.ETD, + // ATD = item.ATD, + // UpdatedTime = DateTime.Now + // }); + + await _vesselinfo.AsUpdateable() + .SetColumnsIF(item.ETA != null, x => x.ETA == item.ETA) + .SetColumnsIF(item.ETD != null, x => x.YgtETD == item.ETD) + .SetColumnsIF(item.ATD != null, x => x.ATD == item.ATD) + .SetColumns(x => x.UpdatedTime == DateTime.Now) + .Where(x => x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false && x.Vessel == item.Vessel && x.Voyno == item.Voyno && x.PortLoadingId == item.PortLoadId) + .ExecuteCommandAsync(); //没有港口的按青岛港处理 if (string.IsNullOrEmpty(item.PortLoadId)) @@ -1906,25 +1914,25 @@ namespace Myshipping.Application Lazy> update = new(() => _rep.Context.Updateable()); Lazy newOrder = new(() => order.Adapt()); - if (order.StartETA != item.ETA) + if (order.StartETA != item.ETA && item.ETA != null) { isupdate = true; newOrder.Value.StartETA = item.ETA; update.Value.SetColumns(b => b.StartETA == item.ETA); } - if (order.YgtETD != item.ETD) + if (order.YgtETD != item.ETD && item.ETD != null) { isupdate = true; newOrder.Value.YgtETD = item.ETD; update.Value.SetColumns(b => b.YgtETD == item.ETD); } - if (order.ATD != item.ATD && order.ATD == null) + if (order.ATD != item.ATD && item.ATD != null) { isupdate = true; newOrder.Value.ATD = item.ATD; update.Value.SetColumns(b => b.ATD == item.ATD); } - if (order.StartATA != item.ATA) + if (order.StartATA != item.ATA && item.ATA != null) { isupdate = true; newOrder.Value.StartATA = item.ATA; diff --git a/Myshipping.Core/Filter/RequestActionFilter.cs b/Myshipping.Core/Filter/RequestActionFilter.cs index 8a364ad9..f504fad1 100644 --- a/Myshipping.Core/Filter/RequestActionFilter.cs +++ b/Myshipping.Core/Filter/RequestActionFilter.cs @@ -35,6 +35,8 @@ public class RequestActionFilter : IAsyncActionFilter var httpContext = context.HttpContext; var httpRequest = httpContext.Request; + string param = context.ActionArguments.Count < 1 ? "" : context.ActionArguments.ToJsonString(); + var sw = new Stopwatch(); sw.Start(); var actionContext = await next(); @@ -117,7 +119,7 @@ public class RequestActionFilter : IAsyncActionFilter ClassName = context.Controller.ToString(), MethodName = actionDescriptor?.ActionName, ReqMethod = httpRequest.Method, - Param = context.ActionArguments.Count < 1 ? "" : context.ActionArguments.ToJsonString(), + Param = param, Result = actionContext.Result?.GetType() == typeof(JsonResult) ? actionContext.Result.ToJsonString() : "", ElapsedTime = sw.ElapsedMilliseconds, OpTime = DateTime.Now, diff --git a/Myshipping.Core/SqlSugar/SqlSugarRepository.cs b/Myshipping.Core/SqlSugar/SqlSugarRepository.cs index 6c2b8536..bdce6a27 100644 --- a/Myshipping.Core/SqlSugar/SqlSugarRepository.cs +++ b/Myshipping.Core/SqlSugar/SqlSugarRepository.cs @@ -432,6 +432,10 @@ where TEntity : class, new() { return EntityContext.Updateable(entities.ToArray()).IgnoreColumns(UpdateIgnoreColumns); } + public virtual IUpdateable AsUpdateable() + { + return EntityContext.Updateable().IgnoreColumns(UpdateIgnoreColumns); + } #endregion #region 删除