diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 4c9b87b0..7f0a723a 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -5163,17 +5163,17 @@ namespace Myshipping.Application public async Task GetAllSelectData() { ////报关行 - var BGH = _djycustomer.Where(x => x.PropString == "customs_broker").Take(10).ToList(); + var BGH = _djycustomer.Where(x => x.PropString.Contains("customs_broker")).Take(10).ToList(); //车队 - var CD = _djycustomer.Where(x => x.PropString == "fleet").Take(10).ToList(); + var CD = _djycustomer.Where(x => x.PropString.Contains("fleet")).Take(10).ToList(); //国外代理 - var GWDL = _djycustomer.Where(x => x.PropString == "out_agent").Take(10).ToList(); + var GWDL = _djycustomer.Where(x => x.PropString.Contains("out_agent")).Take(10).ToList(); //仓库 - var CK = _djycustomer.Where(x => x.PropString == "warehouse").Take(10).ToList(); + var CK = _djycustomer.Where(x => x.PropString.Contains("warehouse") ).Take(10).ToList(); var Portload = _cache.GetAllCodePortLoad().Result.Take(10).ToList(); diff --git a/Myshipping.Application/Service/BookingPrintTemplate/BookingPrintTemplateService.cs b/Myshipping.Application/Service/BookingPrintTemplate/BookingPrintTemplateService.cs index 24f01333..bdbd14cb 100644 --- a/Myshipping.Application/Service/BookingPrintTemplate/BookingPrintTemplateService.cs +++ b/Myshipping.Application/Service/BookingPrintTemplate/BookingPrintTemplateService.cs @@ -414,6 +414,9 @@ namespace Myshipping.Application var userlist = await _repUser.AsQueryable().Filter(null, true).ToListAsync(); var list = await _repRight.AsQueryable().InnerJoin((d, t) => d.PrintTemplateId == t.Id && t.TenantId == UserManager.TENANT_ID). WhereIF(userId != 0, d => d.SysUserId == userId). + WhereIF(!string.IsNullOrWhiteSpace(displayName), (d, t) => t.DisplayName.Contains(displayName)). + WhereIF(!string.IsNullOrWhiteSpace(cateCode), (d, t) => t.CateCode == cateCode). + WhereIF(!string.IsNullOrWhiteSpace(type), (d, t) => t.Type == type). Select((d, t) => new BookingPrinttemplateDto { Id = d.Id, @@ -431,8 +434,7 @@ namespace Myshipping.Application UserName = "", }).ToListAsync(); - list = list.WhereIF(!string.IsNullOrWhiteSpace(cateCode), x => x.CateCode == cateCode).WhereIF(!string.IsNullOrWhiteSpace(displayName), x => x.DisplayName.ToUpper().Contains(displayName.ToUpper())). - WhereIF(!string.IsNullOrWhiteSpace(type), x => x.Type == type).ToList(); + foreach (var item in list) { var username = userlist.Where(x => x.Id == item.SysUserId).Select(x => x.Name).FirstOrDefault(); diff --git a/Myshipping.Application/Service/DataSync/DataSyncService.cs b/Myshipping.Application/Service/DataSync/DataSyncService.cs index 3c6b8d97..a3bcce27 100644 --- a/Myshipping.Application/Service/DataSync/DataSyncService.cs +++ b/Myshipping.Application/Service/DataSync/DataSyncService.cs @@ -40,7 +40,7 @@ namespace Myshipping.Application [ApiDescriptionSettings("Application", Name = "DataSync", Order = 1), AllowAnonymous] public class DataSyncService : IDynamicApiController, ITransient { - private readonly ILogger _logger; + private readonly ILogger _logger; private readonly ISysCacheService _cache; private readonly SqlSugarRepository _rep; private readonly SqlSugarRepository _repCtn; @@ -57,7 +57,7 @@ namespace Myshipping.Application private readonly SqlSugarRepository _goodsStatus; private readonly SqlSugarRepository _goodsStatusConfig; - public DataSyncService(ILogger logger, ISysCacheService cache, SqlSugarRepository rep, SqlSugarRepository repCtn, + public DataSyncService(ILogger logger, ISysCacheService cache, SqlSugarRepository rep, SqlSugarRepository repCtn, SqlSugarRepository repUser, SqlSugarRepository repTenant, SqlSugarRepository djycustomer, SqlSugarRepository djycustomercontact, SqlSugarRepository vesselinfo, SqlSugarRepository ctndetailrep , SqlSugarRepository bookingEDIExt, SqlSugarRepository bookinglog, SqlSugarRepository bookinglogdetail, @@ -131,6 +131,7 @@ namespace Myshipping.Application /// /// [HttpPost("/DataSync/SyncVesselDate"), ApiUser(ApiCode = "SyncVesselDate")] + [SqlSugarUnitOfWork] public async Task SyncVesselDate(DjyVesselInfoDto model) { @@ -161,6 +162,78 @@ namespace Myshipping.Application entity.Id = m.Id; await _vesselinfo.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); } + ////根据船公司船名航次更新船期信息 + if (!string.IsNullOrEmpty(model.CARRIER) && !string.IsNullOrEmpty(model.Vessel) && (!string.IsNullOrEmpty(model.Voyno) || !string.IsNullOrWhiteSpace(model.VoynoInside))) + { + + var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.CARRIERID == model.CARRIERID && x.VESSEL == model.Vessel) + .WhereIF(!string.IsNullOrEmpty(model.Voyno), x => x.VOYNO == model.Voyno) + .WhereIF(!string.IsNullOrEmpty(model.VoynoInside), x => x.VOYNOINNER == model.VoynoInside).ToListAsync(); + + _logger.LogInformation($"同步船期_查询到{UserManager.TENANT_NAME}需要更新{order.Count()}条订舱数据"); + foreach (var item in order) + { + //更新订舱船期 + if (item.ETD != model.ETD) + { + item.ETD = model.ETD; + } + if (item.ATD != model.ATD) + { + item.ATD = model.ATD; + } + await _rep.AsUpdateable(item).IgnoreColumns(it => new + { + it.ParentId, + it.TenantId, + it.CreatedTime, + it.CreatedUserId, + it.CreatedUserName, + it.UpdatedTime, + it.UpdatedUserId, + it.UpdatedUserName, + it.TenantName, + it.IsDeleted, + it.BOOKINGNO + }).ExecuteCommandAsync(); + //记录日志 + + + + ////添加booking日志 + var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog + { + Type = "Edit", + BookingId = item.Id, + TenantId = Convert.ToInt64(UserManager.TENANT_ID), + CreatedTime = DateTime.Now, + CreatedUserId = UserManager.UserId, + CreatedUserName = UserManager.Name + }); + if (item.ETD != model.ETD) + { + await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail + { + PId = bid, + Field = "ETD", + OldValue = item.ETD != null ? item.ETD.ToSqlValue() : null, + NewValue = model.ETD != null ? model.ETD.ToSqlValue() : null, + }); + } + if (item.ATD != model.ATD) + { + await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail + { + PId = bid, + Field = "ATD", + OldValue = item.ATD != null ? item.ATD.ToSqlValue() : null, + NewValue = model.ATD != null ? model.ATD.ToSqlValue() : null, + }); + } + + } + + } return entity.Id; } @@ -1805,6 +1878,7 @@ namespace Myshipping.Application public async Task Test() { return $"当前用户:{UserManager.UserId} {UserManager.Name} ,当前租户:{UserManager.TENANT_ID} {UserManager.TENANT_NAME},管理员类型:{(UserManager.IsSuperAdmin ? "超级管理员" : (UserManager.IsTenantAdmin ? "租户管理员" : "普通用户"))}"; + } #endregion }