wanghaomei 6 months ago
commit 8b8521e28a

@ -0,0 +1,23 @@
using Myshipping.Core.Entity;
using SqlSugar;
using System.ComponentModel;
namespace Myshipping.Application.Entity
{
/// <summary>
///
/// </summary>
[SugarTable("booking_label")]
[Description("订舱标签表")]
public class BookingLabel : DBEntityTenant
{
/// <summary>
/// 标签名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 标签使用范围 1-舱位管理台账
/// </summary>
public int Scope { get; set; }
}
}

@ -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
{
/// <summary>
/// 订舱标签服务
/// </summary>
public class BookingLabelService : IBookingLabelService, IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<BookingLabel> _rep;
private readonly ISysCacheService _cache;
public BookingLabelService(SqlSugarRepository<BookingLabel> rep,
ISysCacheService cache)
{
_rep = rep;
_cache = cache;
}
/// <summary>
/// 获取全部或指定范围类型的标签列表
/// </summary>
/// <param name="scope">标签使用范围 空-全部 1-舱位管理台账</param>
[HttpGet("/BookingLabel/List")]
public async Task<List<BookingLabelBaseDto>> List(int? scope)
{
List<BookingLabelBaseDto> cacheList = await _cache.GetAsync<List<BookingLabelBaseDto>>(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;
}
/// <summary>
/// 新增或修改标签信息
/// </summary>
[HttpPost("/BookingLabel/Save")]
public async Task<long> Save(BookingLabelBaseDto input)
{
var model = input.Adapt<BookingLabel>();
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;
}
}
/// <summary>
/// 删除标签信息
/// </summary>
[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<List<BookingLabelBaseDto>> Cache()
{
var list = await _rep.AsQueryable().ToListAsync();
var cacheList = list.Adapt<List<BookingLabelBaseDto>>();
await _cache.SetTimeoutAsync(CommonConst.CACHE_KEY_BOOKING_LABEL + ":" + UserManager.TENANT_ID, cacheList, TimeSpan.FromDays(3));
return cacheList;
}
}
}

@ -0,0 +1,20 @@
namespace Myshipping.Application.Service.BookingLabel.Dto
{
public class BookingLabelBaseDto
{
public long? Id { get; set; }
/// <summary>
/// 标签名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 标签使用范围 1-舱位
/// </summary>
public int Scope { get; set; }
}
//public class BookingLabelCacheDto : BookingLabelBaseDto
//{
// public long TenantId { get; set; }
//}
}

@ -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
{
}
}

@ -29,8 +29,8 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<BookingOrder> _order;
private readonly ILogger<BookingVesselInfoService> _logger;
private readonly IHubContext<ChatHub, IChatClient> _chatHubContext;
public BookingVesselInfoService(SqlSugarRepository<DjyVesselInfo> rep, ILogger<BookingVesselInfoService> logger, SqlSugarRepository<BookingOrder> order,
ISysCacheService sysCacheService,
public BookingVesselInfoService(SqlSugarRepository<DjyVesselInfo> rep, ILogger<BookingVesselInfoService> logger, SqlSugarRepository<BookingOrder> order,
ISysCacheService sysCacheService,
IBookingOrderService bookingorderservice,
IHubContext<ChatHub, IChatClient> 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;

@ -141,7 +141,7 @@ namespace Myshipping.Application
[HttpGet("/FeeCode/List")]
public async Task<List<FeeCodeDto>> List()
{
var result = await _cache.GetAsync<List<FeeCodeDto>>(CommonConst.CACHE_KEY_FEE_CODE + "_" + UserManager.TENANT_ID);
var result = await _cache.GetAsync<List<FeeCodeDto>>(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<List<FeeCodeDto>>();
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<List<FeeCodeDto>>();
@ -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<List<FeeCodeDto>>();
return result;

@ -155,7 +155,7 @@ namespace Myshipping.Application
foreach (var item in groupFeeCurrency)
{
var item2 = item.Adapt<List<FeeCurrencyDto>>();
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<List<FeeCurrencyDto>>();
@ -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<List<FeeCurrencyDto>>();
return result;

@ -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
{

@ -1120,6 +1120,23 @@ namespace Myshipping.Application
if (fromEntity.Count > 0)
model.From = fromEntity.Select(p => p.Adapt<TaskRollingNominationShipDto>()).ToList();
model.LoadDetailList = list.Select(a => a.Adapt<TaskRollingNominationShipDetailShowDto>()).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<Tuple<string, int>> tuples = new List<Tuple<string, int>>();
model.LoadDetailList = list.Select(a => a.Adapt<TaskRollingNominationShipDetailShowDto>()).ToList();
model.FromToList = new List<TaskRollingNominationShipFromToDto>();
if (model.LoadDetailList.Count > 0)

@ -253,6 +253,14 @@ public class CommonConst
public const string CACHE_KEY_FEE_CURRENCY = "FeeCurrencyList";
#endregion
#region 标签
/// <summary>
/// 标签缓存键
/// </summary>
public const string CACHE_KEY_BOOKING_LABEL = "BookingLabelList";
#endregion
#region 系统运行方式
/// <summary>
/// 和川(会执行一些和川特有的逻辑)

@ -817,6 +817,11 @@
币别缓存键
</summary>
</member>
<member name="F:Myshipping.Core.CommonConst.CACHE_KEY_BOOKING_LABEL">
<summary>
标签缓存键
</summary>
</member>
<member name="F:Myshipping.Core.CommonConst.RUN_TYPE_HECHUAN">
<summary>
和川(会执行一些和川特有的逻辑)

Loading…
Cancel
Save