From c90fe9b61e7c89959d6940f72dd24cebee4f0485 Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Fri, 17 May 2024 09:32:07 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=88=B9=E6=9C=9F?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E5=A6=82=E6=9E=9C=E8=88=B9=E6=9C=9F=E7=9A=84?= =?UTF-8?q?=E5=90=AF=E8=BF=90=E6=B8=AFId=E4=B8=8D=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=EF=BC=8C=E5=88=99=E6=89=B9=E9=87=8F=E6=9B=B4=E6=96=B0=E6=97=B6?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9D=A1=E4=BB=B6=EF=BC=9A=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?=E5=90=AF=E8=BF=90=E6=B8=AFId=E6=9F=A5=E8=AE=A2=E8=88=B1?= =?UTF-8?q?=EF=BC=9B=E6=89=B9=E9=87=8F=E6=9B=B4=E6=96=B0=E8=AE=A2=E8=88=B1?= =?UTF-8?q?=E6=97=B6=E6=B7=BB=E5=8A=A0=E4=BF=AE=E6=94=B9=E6=88=AA=E6=B8=AF?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=88=AA=E5=8D=95=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookingVesselInfoService.cs | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/Myshipping.Application/Service/BookingVesselInfo/BookingVesselInfoService.cs b/Myshipping.Application/Service/BookingVesselInfo/BookingVesselInfoService.cs index 4f4593a7..17e9797c 100644 --- a/Myshipping.Application/Service/BookingVesselInfo/BookingVesselInfoService.cs +++ b/Myshipping.Application/Service/BookingVesselInfo/BookingVesselInfoService.cs @@ -29,8 +29,8 @@ namespace Myshipping.Application private readonly SqlSugarRepository _order; private readonly ILogger _logger; private readonly IHubContext _chatHubContext; - public BookingVesselInfoService(SqlSugarRepository rep, ILogger logger, SqlSugarRepository order, - ISysCacheService sysCacheService, + public BookingVesselInfoService(SqlSugarRepository rep, ILogger logger, SqlSugarRepository order, + ISysCacheService sysCacheService, IBookingOrderService bookingorderservice, IHubContext chatHubContext) { @@ -153,10 +153,20 @@ namespace Myshipping.Application } - if ((dto.ETA != null || dto.ETD != null || dto.ATD != null) && !string.IsNullOrEmpty(old.Vessel) && !string.IsNullOrEmpty(old.Voyno) && !string.IsNullOrEmpty(old.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 == old.Vessel && x.VOYNO == old.Voyno - && x.CARRIERID == old.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) + .WhereIF(!string.IsNullOrEmpty(old.PortLoadingId), x => x.PORTLOADID == old.PortLoadingId) + .ToListAsync(); bool issend = false; if (order != null) { @@ -213,6 +223,17 @@ namespace Myshipping.Application it.ATD = dto.ATD; } + if (dto.ClosingDate != null && dto.ClosingDate != it.CLOSINGDATE) + { + flag = true; + it.CLOSINGDATE = dto.ClosingDate; + } + if (dto.CloseDocTime != null && dto.CloseDocTime != it.CLOSEDOCDATE) + { + flag = true; + it.CLOSEDOCDATE = dto.CloseDocTime; + } + if (flag) { issend = true; From c5b325c4968cc06c29a14a40a9513712f6004dd4 Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Fri, 17 May 2024 11:32:40 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=88=B1=E4=BD=8D=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Myshipping.Application/Entity/BookingLabel.cs | 23 +++++ .../BookingLabel/BookingLabelService.cs | 97 +++++++++++++++++++ .../BookingLabel/Dto/BookingLabelBaseDto.cs | 20 ++++ .../BookingLabel/IBookingLabelService.cs | 12 +++ .../Service/Fee/FeeCodeService.cs | 6 +- .../Service/Fee/FeeCurrencyService.cs | 4 +- Myshipping.Core/Const/CommonConst.cs | 8 ++ Myshipping.Core/Myshipping.Core.xml | 5 + 8 files changed, 170 insertions(+), 5 deletions(-) create mode 100644 Myshipping.Application/Entity/BookingLabel.cs create mode 100644 Myshipping.Application/Service/BookingLabel/BookingLabelService.cs create mode 100644 Myshipping.Application/Service/BookingLabel/Dto/BookingLabelBaseDto.cs create mode 100644 Myshipping.Application/Service/BookingLabel/IBookingLabelService.cs diff --git a/Myshipping.Application/Entity/BookingLabel.cs b/Myshipping.Application/Entity/BookingLabel.cs new file mode 100644 index 00000000..b93ea890 --- /dev/null +++ b/Myshipping.Application/Entity/BookingLabel.cs @@ -0,0 +1,23 @@ +using Myshipping.Core.Entity; +using SqlSugar; +using System.ComponentModel; +namespace Myshipping.Application.Entity +{ + /// + /// + /// + [SugarTable("booking_label")] + [Description("订舱标签表")] + public class BookingLabel : DBEntityTenant + { + /// + /// 标签名称 + /// + public string Name { get; set; } + + /// + /// 标签使用范围 1-舱位管理台账 + /// + public int Scope { get; set; } + } +} \ No newline at end of file diff --git a/Myshipping.Application/Service/BookingLabel/BookingLabelService.cs b/Myshipping.Application/Service/BookingLabel/BookingLabelService.cs new file mode 100644 index 00000000..22e49869 --- /dev/null +++ b/Myshipping.Application/Service/BookingLabel/BookingLabelService.cs @@ -0,0 +1,97 @@ +using Furion.DependencyInjection; +using Furion.DynamicApiController; +using Mapster; +using Microsoft.AspNetCore.Mvc; +using Myshipping.Application.Entity; +using Myshipping.Application.Service.BookingLabel.Dto; +using Myshipping.Core; +using Myshipping.Core.Service; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + /// + /// 订舱标签服务 + /// + public class BookingLabelService : IBookingLabelService, IDynamicApiController, ITransient + { + private readonly SqlSugarRepository _rep; + + private readonly ISysCacheService _cache; + public BookingLabelService(SqlSugarRepository rep, + ISysCacheService cache) + { + _rep = rep; + _cache = cache; + } + + /// + /// 获取全部或指定范围类型的标签列表 + /// + /// 标签使用范围 空-全部 1-舱位管理台账 + [HttpGet("/BookingLabel/List")] + public async Task> List(int? scope) + { + List cacheList = await _cache.GetAsync>(CommonConst.CACHE_KEY_BOOKING_LABEL + ":" + UserManager.TENANT_ID); + if (cacheList?.Any() != true) + { + cacheList = await Cache(); + } + + var result = scope == null + ? cacheList + : cacheList.Where(x => x.Scope == scope).ToList(); + return result; + } + + /// + /// 新增或修改标签信息 + /// + [HttpPost("/BookingLabel/Save")] + public async Task Save(BookingLabelBaseDto input) + { + var model = input.Adapt(); + if (input.Id is null or 0) + { + await _rep.InsertAsync(model); + await Cache(); + return model.Id; + } + else + { + var oldModel = await _rep.FirstOrDefaultAsync(x => x.Id == input.Id); + if (oldModel != null) + { + input.Adapt(oldModel); + await _rep.UpdateAsync(oldModel); + await Cache(); + } + return (long)input.Id; + } + } + /// + /// 删除标签信息 + /// + [HttpPost("/BookingLabel/Delete")] + public async Task Delete([FromBody] long[] ids) + { + if (ids != null && ids.Length > 0) + { + await _rep.DeleteAsync(x => ids.Contains(x.Id)); + await Cache(); + } + } + [NonAction] + private async Task> Cache() + { + var list = await _rep.AsQueryable().ToListAsync(); + var cacheList = list.Adapt>(); + + await _cache.SetTimeoutAsync(CommonConst.CACHE_KEY_BOOKING_LABEL + ":" + UserManager.TENANT_ID, cacheList, TimeSpan.FromDays(3)); + return cacheList; + } + } +} diff --git a/Myshipping.Application/Service/BookingLabel/Dto/BookingLabelBaseDto.cs b/Myshipping.Application/Service/BookingLabel/Dto/BookingLabelBaseDto.cs new file mode 100644 index 00000000..7648a202 --- /dev/null +++ b/Myshipping.Application/Service/BookingLabel/Dto/BookingLabelBaseDto.cs @@ -0,0 +1,20 @@ +namespace Myshipping.Application.Service.BookingLabel.Dto +{ + public class BookingLabelBaseDto + { + public long? Id { get; set; } + /// + /// 标签名称 + /// + public string Name { get; set; } + + /// + /// 标签使用范围 1-舱位 + /// + public int Scope { get; set; } + } + //public class BookingLabelCacheDto : BookingLabelBaseDto + //{ + // public long TenantId { get; set; } + //} +} diff --git a/Myshipping.Application/Service/BookingLabel/IBookingLabelService.cs b/Myshipping.Application/Service/BookingLabel/IBookingLabelService.cs new file mode 100644 index 00000000..ee4d5789 --- /dev/null +++ b/Myshipping.Application/Service/BookingLabel/IBookingLabelService.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application +{ + public class IBookingLabelService + { + } +} diff --git a/Myshipping.Application/Service/Fee/FeeCodeService.cs b/Myshipping.Application/Service/Fee/FeeCodeService.cs index 492069e1..78b50658 100644 --- a/Myshipping.Application/Service/Fee/FeeCodeService.cs +++ b/Myshipping.Application/Service/Fee/FeeCodeService.cs @@ -141,7 +141,7 @@ namespace Myshipping.Application [HttpGet("/FeeCode/List")] public async Task> List() { - var result = await _cache.GetAsync>(CommonConst.CACHE_KEY_FEE_CODE + "_" + UserManager.TENANT_ID); + var result = await _cache.GetAsync>(CommonConst.CACHE_KEY_FEE_CODE + ":" + UserManager.TENANT_ID); if (result?.Any() != true) { result = await CacheFeeCode(); @@ -165,7 +165,7 @@ namespace Myshipping.Application foreach (var item in groupFeeCodeCache) { var item2 = item.Adapt>(); - await _cache.SetTimeoutAsync(CommonConst.CACHE_KEY_FEE_CODE + "_" + item.Key, item2, new TimeSpan(6, 0, 0)); + await _cache.SetTimeoutAsync(CommonConst.CACHE_KEY_FEE_CODE + ":" + item.Key, item2, new TimeSpan(6, 0, 0)); } var result = groupFeeCodeCache.FirstOrDefault(x => x.Key == UserManager.TENANT_ID)?.Adapt>(); @@ -176,7 +176,7 @@ namespace Myshipping.Application // 否则只缓存当前租户的费用代码 var tenantFeeCode = await _repCode.AsQueryable().Filter(null, true).Where(x => !x.IsDeleted && x.TenantId == UserManager.TENANT_ID).ToListAsync(); - await _cache.SetTimeoutAsync(CommonConst.CACHE_KEY_FEE_CODE + "_" + UserManager.TENANT_ID, tenantFeeCode, new TimeSpan(6, 0, 0)); + await _cache.SetTimeoutAsync(CommonConst.CACHE_KEY_FEE_CODE + ":" + UserManager.TENANT_ID, tenantFeeCode, new TimeSpan(6, 0, 0)); var result = tenantFeeCode.Adapt>(); return result; diff --git a/Myshipping.Application/Service/Fee/FeeCurrencyService.cs b/Myshipping.Application/Service/Fee/FeeCurrencyService.cs index 6cc322f0..2822f15e 100644 --- a/Myshipping.Application/Service/Fee/FeeCurrencyService.cs +++ b/Myshipping.Application/Service/Fee/FeeCurrencyService.cs @@ -155,7 +155,7 @@ namespace Myshipping.Application foreach (var item in groupFeeCurrency) { var item2 = item.Adapt>(); - await _cache.SetTimeoutAsync(CommonConst.CACHE_KEY_FEE_CURRENCY + "_" + item.Key, item2, new TimeSpan(6, 0, 0)); + await _cache.SetTimeoutAsync(CommonConst.CACHE_KEY_FEE_CURRENCY + ":" + item.Key, item2, new TimeSpan(6, 0, 0)); } var result = groupFeeCurrency.FirstOrDefault(x => x.Key == UserManager.TENANT_ID)?.Adapt>(); @@ -166,7 +166,7 @@ namespace Myshipping.Application // 否则只缓存当前租户的费用币别 var tenantFeeCurrency = await _repCode.AsQueryable().Filter(null, true).Where(x => !x.IsDeleted && x.TenantId == UserManager.TENANT_ID).ToListAsync(); - await _cache.SetTimeoutAsync(CommonConst.CACHE_KEY_FEE_CURRENCY + "_" + UserManager.TENANT_ID, tenantFeeCurrency, new TimeSpan(6, 0, 0)); + await _cache.SetTimeoutAsync(CommonConst.CACHE_KEY_FEE_CURRENCY + ":" + UserManager.TENANT_ID, tenantFeeCurrency, new TimeSpan(6, 0, 0)); var result = tenantFeeCurrency.Adapt>(); return result; diff --git a/Myshipping.Core/Const/CommonConst.cs b/Myshipping.Core/Const/CommonConst.cs index 124126a8..c97f7a8a 100644 --- a/Myshipping.Core/Const/CommonConst.cs +++ b/Myshipping.Core/Const/CommonConst.cs @@ -253,6 +253,14 @@ public class CommonConst public const string CACHE_KEY_FEE_CURRENCY = "FeeCurrencyList"; #endregion + #region 标签 + /// + /// 标签缓存键 + /// + public const string CACHE_KEY_BOOKING_LABEL = "BookingLabelList"; + #endregion + + #region 系统运行方式 /// /// 和川(会执行一些和川特有的逻辑) diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index 87d016ef..80c08aed 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -817,6 +817,11 @@ 币别缓存键 + + + 标签缓存键 + + 和川(会执行一些和川特有的逻辑) From 2a865d1432dd81373ef124eb62e967760c0f496d Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Fri, 17 May 2024 13:27:09 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9BC=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TaskManagePlat/TaskManageBCService.cs | 3 ++- .../TaskManageRollingNominationService.cs | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageBCService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageBCService.cs index e09404ba..601054cb 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageBCService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageBCService.cs @@ -2632,6 +2632,7 @@ namespace Myshipping.Application if (bcOrder.BOOKING_ORDER_ID != null && bcOrder.BOOKING_ORDER_ID.HasValue && bcOrder.BOOKING_ORDER_ID.Value > 0) { + /* SaveBookingOrderInput bkModel = new SaveBookingOrderInput { MBLNO = bcOrder.MBL_NO.ToUpper().Trim(), @@ -2689,7 +2690,7 @@ namespace Myshipping.Application else { _logger.LogInformation($"taskPKId={taskPKId} 更新订舱详情失败没有对应舱位ID"); - } + }*/ } else { diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageRollingNominationService.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageRollingNominationService.cs index 2ea5f233..b83ab3b8 100644 --- a/Myshipping.Application/Service/TaskManagePlat/TaskManageRollingNominationService.cs +++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageRollingNominationService.cs @@ -1120,6 +1120,23 @@ namespace Myshipping.Application if (fromEntity.Count > 0) model.From = fromEntity.Select(p => p.Adapt()).ToList(); + + model.LoadDetailList = list.Select(a => a.Adapt()).ToList(); + + if (model.From != null && model.From.Count > 0) + { + var firstLoadDetail = model.LoadDetailList.FirstOrDefault(); + + if (model.From.Any(t => string.IsNullOrWhiteSpace(t.Port))) + { + model.From = model.From.Where(a => a.Terminal.Contains(firstLoadDetail.LoadPortName?.Trim())).ToList(); + } + else + { + model.From = model.From.Where(a => a.Port.Equals(firstLoadDetail.LoadPortName?.Trim(),StringComparison.OrdinalIgnoreCase)).ToList(); + } + } + var toEntity = shipList.Where(a => Regex.IsMatch(a.SHIP_TYPE, "To(\\s+[0-9]+)?" , RegexOptions.IgnoreCase)).ToList(); @@ -1180,8 +1197,6 @@ namespace Myshipping.Application List> tuples = new List>(); - model.LoadDetailList = list.Select(a => a.Adapt()).ToList(); - model.FromToList = new List(); if (model.LoadDetailList.Count > 0)