You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
BookingHeChuan/Myshipping.Core/Service/CommonDB/CommonDBService.cs

1418 lines
53 KiB
C#

2 years ago
using Furion.DependencyInjection;
2 years ago
using Furion.DynamicApiController;
using Furion.FriendlyException;
using Myshipping.Core.Entity;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using System.Linq;
using System.Threading.Tasks;
using System.Collections.Generic;
using System;
2 years ago
using Myshipping.Core.Service.CommonDB.Dto;
2 years ago
using Microsoft.Extensions.Logging;
2 years ago
using Myshipping.Core.Entity.CommonDB;
2 years ago
namespace Myshipping.Core.Service;
/// <summary>
/// 公共库
/// </summary>
[ApiDescriptionSettings(Name = "CommonDB", Order = 1000)]
public class CommonDBService : ICommonDBService, IDynamicApiController, ITransient
{
2 years ago
#region
2 years ago
private readonly SqlSugarRepository<CodeCarrier> _codeCarrierRep;
2 years ago
private readonly SqlSugarRepository<MappingCarrier> _mappingCarrierRep;
2 years ago
private readonly SqlSugarRepository<CodeVessel> _codeVesselRep;
2 years ago
private readonly SqlSugarRepository<MappingVessel> _mappingVesselRep;
2 years ago
private readonly SqlSugarRepository<CodeForwarder> _codeForwarderRep;
private readonly SqlSugarRepository<CodeYard> _codeYardRep;
2 years ago
private readonly SqlSugarRepository<MappingYard> _mappingYardRep;
2 years ago
private readonly SqlSugarRepository<CodePortLoad> _codePortLoadrRep;
private readonly SqlSugarRepository<CodePort> _codePortRep;
private readonly SqlSugarRepository<CodePackage> _codePackageRep;
private readonly SqlSugarRepository<CodeService> _codeServiceRep;
private readonly SqlSugarRepository<CodeCtn> _codeCtnRep;
2 years ago
private readonly SqlSugarRepository<MappingCtn> _mappingCtnRep;
private readonly SqlSugarRepository<CodeFrt> _codeFrtRep;
2 years ago
private readonly SqlSugarRepository<MappingFrt> _mappingFrtRep;
2 years ago
private readonly SqlSugarRepository<MappingPortLoad> _mappingPortLoadRep;
private readonly SqlSugarRepository<MappingPort> _mappingPortRep;
private readonly SqlSugarRepository<MappingPackage> _mappingPackageRep;
private readonly SqlSugarRepository<MappingService> _mappingServiceRep;
2 years ago
private readonly ISysCacheService _sysCacheService;
2 years ago
private readonly SqlSugarRepository<CodeIssueType> _codeIssueTypeRep;
2 years ago
private readonly SqlSugarRepository<CommonModule> _commonModuleRep;
2 years ago
private readonly ILogger<CommonDBService> _logger;
2 years ago
public CommonDBService(SqlSugarRepository<CodeCarrier> codeCarrierRep,
SqlSugarRepository<CodeVessel> codeVesselRep,
SqlSugarRepository<CodeForwarder> codeForwarderRep,
SqlSugarRepository<CodeYard> codeYardRep,
SqlSugarRepository<CodePortLoad> codePortLoadrRep,
SqlSugarRepository<CodePort> codePortRep,
SqlSugarRepository<CodePackage> codePackageRep,
SqlSugarRepository<CodeService> codeServiceRep,
SqlSugarRepository<CodeCtn> codeCtnRep,
SqlSugarRepository<CodeFrt> codeFrtRep,
2 years ago
SqlSugarRepository<MappingCarrier> mappingCarrierRep,
2 years ago
SqlSugarRepository<MappingVessel> mappingVesselRep,
SqlSugarRepository<MappingCtn> mappingCtnRep,
SqlSugarRepository<MappingFrt> mappingFrtRep,
2 years ago
SqlSugarRepository<MappingYard> mappingYardRep,
2 years ago
SqlSugarRepository<MappingPortLoad> mappingPortLoadRep,
SqlSugarRepository<MappingPort> mappingPortRep,
SqlSugarRepository<MappingPackage> mappingPackageRep,
SqlSugarRepository<MappingService> mappingServiceRep,
2 years ago
SqlSugarRepository<CodeIssueType> codeIssueTypeRep,
2 years ago
SqlSugarRepository<CommonModule> commonModuleRep,
2 years ago
ILogger<CommonDBService> logger,
2 years ago
ISysCacheService sysCacheService)
2 years ago
{
_codeCarrierRep = codeCarrierRep;
_codeVesselRep = codeVesselRep;
_codeForwarderRep = codeForwarderRep;
_codeYardRep = codeYardRep;
_codePortLoadrRep = codePortLoadrRep;
_codePortRep = codePortRep;
_codePackageRep = codePackageRep;
_codeServiceRep = codeServiceRep;
_codeCtnRep = codeCtnRep;
_codeFrtRep = codeFrtRep;
2 years ago
_mappingCarrierRep = mappingCarrierRep;
2 years ago
_mappingVesselRep = mappingVesselRep;
_mappingCtnRep = mappingCtnRep;
_mappingFrtRep = mappingFrtRep;
2 years ago
_mappingYardRep = mappingYardRep;
2 years ago
_sysCacheService = sysCacheService;
2 years ago
_mappingPortLoadRep = mappingPortLoadRep;
_mappingPortRep = mappingPortRep;
_mappingPackageRep = mappingPackageRep;
_mappingServiceRep = mappingServiceRep;
2 years ago
_codeIssueTypeRep = codeIssueTypeRep;
2 years ago
_commonModuleRep = commonModuleRep;
2 years ago
_logger = logger;
2 years ago
2 years ago
}
2 years ago
#endregion
2 years ago
#region 船公司
2 years ago
/// <summary>
/// 获取船公司列表信息
/// </summary>
[HttpGet("/commondb/carrierlist")]
public async Task<dynamic> CarrierList([FromQuery] CodeCnEnQueryDto input)
{
2 years ago
var list = await _sysCacheService.GetAllCodeCarrier();
2 years ago
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.CnName), x => x.CnName.Contains(input.CnName, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.EnName), x => x.EnName.Contains(input.EnName, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
2 years ago
return queryList.ToList();
}
/// <summary>
/// 新增船公司信息
/// </summary>
[HttpPost("/commondb/addcarrier")]
2 years ago
public async Task AddCarrier([FromBody] CodeCarrierDto dto)
2 years ago
{
2 years ago
var list = await _sysCacheService.GetAllCodeCarrier();
var count = list.Where(x => x.Code == dto.Code).Count();
if (count > 0)
{
throw Oops.Bah(ErrorCode.D1006);
}
2 years ago
var entity = dto.Adapt<CodeCarrier>();
2 years ago
entity.GID = Guid.NewGuid().ToString();
2 years ago
entity.CreateTime = DateTime.Now;
entity.CreateUser = UserManager.DjyUserId;
2 years ago
await _codeCarrierRep.InsertAsync(entity);
await GetAllCarrier();
2 years ago
2 years ago
}
/// <summary>
/// 获取船公司映射列表信息
/// </summary>
[HttpGet("/commondb/mappingcarrierlist")]
public async Task<dynamic> MappingCarrierList([FromQuery] MappingQueryDto input)
{
2 years ago
var list = await _sysCacheService.GetAllMappingCarrier();
2 years ago
//数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
{
throw Oops.Bah("参数过多,请传入模块查询");
}
var queryList = list.Where(x => x.Module == input.Module)
2 years ago
.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code, System.StringComparison.CurrentCultureIgnoreCase))
2 years ago
.WhereIF(!string.IsNullOrEmpty(input.MapCode), x => x.MapCode.Contains(input.MapCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
2 years ago
return queryList.ToList();
}
2 years ago
/// <summary>
/// 新增编辑船公司映射信息
/// </summary>
2 years ago
[HttpPost("/commondb/addorupdatemappingcarrier")]
2 years ago
public async Task AddOrUpdateMappingCarrier([FromBody] MappingCarrierDto dto)
2 years ago
{
2 years ago
var list = await _sysCacheService.GetAllMappingCarrier();
2 years ago
var count = list.Where(x => x.Module == dto.Module && x.Code == dto.Code && x.GID != dto.GID).Count();
2 years ago
if (count>0) {
throw Oops.Bah(ErrorCode.D1006);
}
2 years ago
var entity = dto.Adapt<MappingCarrier>();
if (string.IsNullOrWhiteSpace(dto.GID))
{
2 years ago
entity.GID = Guid.NewGuid().ToString();
2 years ago
entity.CreateTime = DateTime.Now;
2 years ago
entity.CreateUser = UserManager.DjyUserId;
2 years ago
await _mappingCarrierRep.InsertAsync(entity);
}
else
{
2 years ago
entity.ModifyTime = DateTime.Now;
entity.ModifyUser = UserManager.DjyUserId;
2 years ago
await _mappingCarrierRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
await GetAllMappingCarrier();
}
#endregion
#region 船名
2 years ago
/// <summary>
/// 获取船名列表信息
/// </summary>
[HttpGet("/commondb/vessellist")]
public async Task<dynamic> VesselList([FromQuery] NameQueryDto input)
{
2 years ago
//数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Name) || input.Name.Length < 2)
{
2 years ago
throw Oops.Bah("参数过多,请传入船名查询");
2 years ago
}
2 years ago
List<CodeVessel> list = await _sysCacheService.GetAllCodeVessel();
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Name.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.EdiCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
2 years ago
return queryList.ToList();
}
2 years ago
/// <summary>
/// 新增船名信息
/// </summary>
[HttpPost("/commondb/addvessel")]
2 years ago
public async Task AddVessel([FromBody] CodeVesselDto dto)
2 years ago
{
2 years ago
var list = await _sysCacheService.GetAllCodeVessel();
var count = list.Where(x => x.Name.Trim() == dto.Name.Trim()).Count();
if (count > 0)
{
throw Oops.Bah(ErrorCode.D1006);
}
2 years ago
var entity = dto.Adapt<CodeVessel>();
2 years ago
entity.GID = Guid.NewGuid().ToString();
2 years ago
entity.CreateTime = DateTime.Now;
entity.CreateUser = UserManager.DjyUserId;
2 years ago
await _codeVesselRep.InsertAsync(entity);
2 years ago
await GetAllVessel();
2 years ago
}
2 years ago
/// <summary>
/// 获取船名映射
/// </summary>
[HttpGet("/commondb/mappingvessellist")]
public async Task<dynamic> MappingVesselList([FromQuery] MappingQueryDto input)
{
//数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
{
2 years ago
throw Oops.Bah("参数过多,请传入模块查询");
2 years ago
}
List<MappingVessel> list = await _sysCacheService.GetAllMappingVessel();
2 years ago
var queryList = list.Where(x => x.Module == input.Module)
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.Name.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
2 years ago
return queryList.ToList();
}
2 years ago
2 years ago
/// <summary>
/// 新增编辑船名映射信息
/// </summary>
[HttpPost("/commondb/addorupdatevessel")]
2 years ago
public async Task AddOrUpdateMappingVessel([FromBody] MappingVesselDto dto)
2 years ago
{
2 years ago
var list = await _sysCacheService.GetAllMappingVessel();
2 years ago
var count = list.Where(x => x.Name.Trim() == dto.Name.Trim()&&x.Module==dto.Module && x.GID != dto.GID).Count();
2 years ago
if (count > 0)
{
throw Oops.Bah(ErrorCode.D1006);
}
2 years ago
var entity = dto.Adapt<MappingVessel>();
if (string.IsNullOrWhiteSpace(dto.GID))
{
2 years ago
entity.GID = Guid.NewGuid().ToString();
2 years ago
entity.CreateTime = DateTime.Now;
entity.CreateUser = UserManager.DjyUserId;
2 years ago
await _mappingVesselRep.InsertAsync(entity);
}
else
{
2 years ago
entity.ModifyTime = DateTime.Now;
entity.ModifyUser = UserManager.DjyUserId;
2 years ago
await _mappingVesselRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
2 years ago
2 years ago
}
await GetAllMappingVessel();
}
2 years ago
#endregion
2 years ago
#region 船代
2 years ago
/// <summary>
/// 获取船代列表信息
/// </summary>
[HttpGet("/commondb/forwarderlist")]
public async Task<dynamic> ForwarderList([FromQuery] NameQueryDto input)
{
2 years ago
List<CodeForwarder> list = await _sysCacheService.GetAllCodeForwarder();
2 years ago
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Name.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
2 years ago
return queryList.ToList();
}
2 years ago
/// <summary>
/// 新增船代信息
/// </summary>
[HttpPost("/commondb/addforwarder")]
2 years ago
public async Task AddForwarder([FromBody] CodeForwarderDto dto)
2 years ago
{
2 years ago
var list = await _sysCacheService.GetAllCodeForwarder();
var count = list.Where(x => x.Code == dto.Code).Count();
if (count > 0)
{
throw Oops.Bah(ErrorCode.D1006);
}
2 years ago
var entity = dto.Adapt<CodeForwarder>();
2 years ago
entity.GID = Guid.NewGuid().ToString();
2 years ago
entity.CreateTime = DateTime.Now;
entity.CreateUser = UserManager.DjyUserId;
2 years ago
await _codeForwarderRep.InsertAsync(entity);
await GetAllForwarder();
}
#endregion
#region 场站
2 years ago
/// <summary>
/// 获取场站列表信息
/// </summary>
[HttpGet("/commondb/yardlist")]
public async Task<dynamic> YardList([FromQuery] NameQueryDto input)
{
2 years ago
List<CodeYard> list = await _sysCacheService.GetAllCodeYard();
2 years ago
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Name.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
2 years ago
return queryList.ToList();
}
2 years ago
/// <summary>
/// 新增场站信息
/// </summary>
[HttpPost("/commondb/addyard")]
2 years ago
public async Task AddYard([FromBody] CodeYardDto dto)
2 years ago
{
2 years ago
var list = await _sysCacheService.GetAllCodeYard();
var count = list.Where(x => x.Code == dto.Code).Count();
if (count > 0)
{
throw Oops.Bah(ErrorCode.D1006);
}
2 years ago
var entity = dto.Adapt<CodeYard>();
2 years ago
entity.GID = Guid.NewGuid().ToString();
2 years ago
entity.CreateTime = DateTime.Now;
entity.CreateUser = UserManager.DjyUserId;
2 years ago
await _codeYardRep.InsertAsync(entity);
await GetAllYard();
}
2 years ago
/// <summary>
/// 获取场站映射
/// </summary>
[HttpGet("/commondb/mappingyardlist")]
public async Task<dynamic> MappingYardList([FromQuery] MappingQueryDto input)
{
//数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
{
2 years ago
throw Oops.Bah("参数过多,请传入模块查询");
2 years ago
}
List<MappingYard> list = await _sysCacheService.GetAllMappingYard();
2 years ago
var queryList = list.Where(x => x.Module == input.Module)
.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapCode), x => x.MapCode.Contains(input.MapCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
2 years ago
return queryList.ToList();
}
/// <summary>
/// 新增编辑场站映射信息
/// </summary>
2 years ago
[HttpPost("/commondb/addorupdatemappingyard")]
2 years ago
public async Task AddOrUpdateMappingYard([FromBody] MappingYardDto dto)
2 years ago
{
2 years ago
var list = await _sysCacheService.GetAllMappingYard();
2 years ago
var count = list.Where(x => x.Code == dto.Code&&x.Module==dto.Module && x.GID != dto.GID).Count();
2 years ago
if (count > 0)
{
throw Oops.Bah(ErrorCode.D1006);
}
2 years ago
var entity = dto.Adapt<MappingYard>();
if (string.IsNullOrWhiteSpace(dto.GID))
{
entity.GID = Guid.NewGuid().ToString();
2 years ago
entity.CreateTime = DateTime.Now;
entity.CreateUser = UserManager.DjyUserId;
2 years ago
await _mappingYardRep.InsertAsync(entity);
}
else
{
2 years ago
entity.ModifyTime = DateTime.Now;
entity.ModifyUser = UserManager.DjyUserId;
2 years ago
await _mappingYardRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
await GetAllMappingYard();
}
2 years ago
#endregion
2 years ago
2 years ago
#region 起始港
2 years ago
/// <summary>
/// 获取起始港信息
/// </summary>
[HttpGet("/commondb/portloadlist")]
public async Task<dynamic> PortloadList([FromQuery] NameQueryDto input)
{
2 years ago
List<CodePortLoad> list = await _sysCacheService.GetAllCodePortLoad();
2 years ago
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.CnName.Contains(input.Name) || x.EnName.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.EdiCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
2 years ago
return queryList.ToList();
}
2 years ago
/// <summary>
/// 新增起始港信息
/// </summary>
[HttpPost("/commondb/addportload")]
2 years ago
public async Task AddPortload([FromBody] CodePortLoadDto dto)
2 years ago
{
2 years ago
var list = await _sysCacheService.GetAllCodePortLoad();
var count = list.Where(x => x.Code == dto.Code ).Count();
if (count > 0)
{
throw Oops.Bah(ErrorCode.D1006);
}
2 years ago
var entity = dto.Adapt<CodePortLoad>();
2 years ago
entity.GID = Guid.NewGuid().ToString();
2 years ago
entity.CreateTime = DateTime.Now;
entity.CreateUser = UserManager.DjyUserId;
2 years ago
await _codePortLoadrRep.InsertAsync(entity);
await GetAllPortload();
}
2 years ago
/// <summary>
/// 获取起始港映射
/// </summary>
[HttpGet("/commondb/mappingportloadlist")]
public async Task<dynamic> PortloadList([FromQuery] MappingQueryDto input)
{
//数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
{
2 years ago
throw Oops.Bah("参数过多,请传入模块查询");
2 years ago
}
List<MappingPortLoad> list = await _sysCacheService.GetAllMappingPortLoad();
2 years ago
var queryList = list.Where(x => x.Module == input.Module)
.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapCode), x => x.MapCode.Contains(input.MapCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
2 years ago
return queryList.ToList();
}
/// <summary>
/// 新增编辑起始港映射信息
/// </summary>
[HttpPost("/commondb/addorupdatemappingportload")]
public async Task AddOrUpdatePortload([FromBody] MappingPortLoadDto dto)
{
2 years ago
var list = await _sysCacheService.GetAllMappingPortLoad();
2 years ago
var count = list.Where(x => x.Code == dto.Code&&x.Module==dto.Module && x.GID != dto.GID).Count();
2 years ago
if (count > 0)
{
throw Oops.Bah(ErrorCode.D1006);
}
2 years ago
var entity = dto.Adapt<MappingPortLoad>();
if (string.IsNullOrWhiteSpace(dto.GID))
{
entity.GID = Guid.NewGuid().ToString();
entity.CreateTime = DateTime.Now;
entity.CreateUser = UserManager.DjyUserId;
await _mappingPortLoadRep.InsertAsync(entity);
}
else
{
entity.ModifyTime = DateTime.Now;
entity.ModifyUser = UserManager.DjyUserId;
await _mappingPortLoadRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
await GetAllMappingPortLoad();
}
2 years ago
#endregion
2 years ago
2 years ago
#region 目的港
2 years ago
/// <summary>
/// 获取目的港信息
/// </summary>
[HttpGet("/commondb/portlist")]
public async Task<dynamic> PortList([FromQuery] NameQueryDto input)
{
2 years ago
List<CodePort> list = await _sysCacheService.GetAllCodePort();
2 years ago
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.CnName.Contains(input.Name) || x.EnName.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.EdiCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
2 years ago
return queryList.ToList();
}
2 years ago
/// <summary>
/// 新增目的港信息
/// </summary>
[HttpPost("/commondb/addport")]
2 years ago
public async Task AddPort([FromBody] CodePortDto dto)
2 years ago
{
2 years ago
var list = await _sysCacheService.GetAllCodePort();
var count = list.Where(x => x.Code == dto.Code ).Count();
if (count > 0)
{
throw Oops.Bah(ErrorCode.D1006);
}
2 years ago
var entity = dto.Adapt<CodePort>();
2 years ago
entity.GID = Guid.NewGuid().ToString();
2 years ago
entity.CreateTime = DateTime.Now;
entity.CreateUser = UserManager.DjyUserId;
2 years ago
await _codePortRep.InsertAsync(entity);
await GetAllPort();
}
2 years ago
/// <summary>
/// 获取目的港映射
/// </summary>
[HttpGet("/commondb/mappingportlist")]
public async Task<dynamic> PortList([FromQuery] MappingQueryDto input)
{
//数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
{
2 years ago
throw Oops.Bah("参数过多,请传入模块查询");
2 years ago
}
List<MappingPort> list = await _sysCacheService.GetAllMappingPort();
2 years ago
var queryList = list.Where(x => x.Module == input.Module)
.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapCode), x => x.MapCode.Contains(input.MapCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
2 years ago
2 years ago
return queryList.ToList();
}
/// <summary>
/// 新增编辑目的港映射信息
/// </summary>
[HttpPost("/commondb/addorupdatemappingport")]
public async Task AddOrUpdatePort([FromBody] MappingPortDto dto)
{
2 years ago
var list = await _sysCacheService.GetAllMappingPort();
2 years ago
var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module && x.GID != dto.GID).Count();
2 years ago
if (count > 0)
{
throw Oops.Bah(ErrorCode.D1006);
}
2 years ago
var entity = dto.Adapt<MappingPort>();
if (string.IsNullOrWhiteSpace(dto.GID))
{
entity.GID = Guid.NewGuid().ToString();
entity.CreateTime = DateTime.Now;
entity.CreateUser = UserManager.DjyUserId;
await _mappingPortRep.InsertAsync(entity);
}
else
{
entity.ModifyTime = DateTime.Now;
entity.ModifyUser = UserManager.DjyUserId;
await _mappingPortRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
await GetAllMappingPort();
}
2 years ago
#endregion
#region 包装
2 years ago
/// <summary>
/// 获取包装信息
/// </summary>
[HttpGet("/commondb/package")]
public async Task<dynamic> PackageList([FromQuery] NameQueryDto input)
{
2 years ago
List<CodePackage> list = await _sysCacheService.GetAllCodePackage();
2 years ago
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Name.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.EdiCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
2 years ago
return queryList.ToList();
}
2 years ago
/// <summary>
/// 新增包装信息
/// </summary>
[HttpPost("/commondb/addpackage")]
2 years ago
public async Task AddPackage([FromBody] CodePackageDto dto)
2 years ago
{
2 years ago
var list = await _sysCacheService.GetAllCodePackage();
var count = list.Where(x => x.Code == dto.Code ).Count();
if (count > 0)
{
throw Oops.Bah(ErrorCode.D1006);
}
2 years ago
var entity = dto.Adapt<CodePackage>();
2 years ago
entity.GID = Guid.NewGuid().ToString();
2 years ago
await _codePackageRep.InsertAsync(entity);
await GetAllPackage();
}
2 years ago
/// <summary>
/// 获取包装映射
/// </summary>
[HttpGet("/commondb/mappingpackage")]
public async Task<dynamic> MappingPackageList([FromQuery] MappingQueryDto input)
{
//数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
{
2 years ago
throw Oops.Bah("参数过多,请传入模块查询");
2 years ago
}
List<MappingPackage> list = await _sysCacheService.GetAllMappingPackage();
2 years ago
var queryList = list.Where(x => x.Module == input.Module)
.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapCode), x => x.MapCode.Contains(input.MapCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
2 years ago
return queryList.ToList();
}
/// <summary>
/// 新增编辑包装映射信息
/// </summary>
[HttpPost("/commondb/addorupdatemappingpackage")]
public async Task AddOrUpdateMappingPackage([FromBody] MappingPackageDto dto)
{
2 years ago
var list = await _sysCacheService.GetAllMappingPackage();
2 years ago
var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module && x.GID != dto.GID).Count();
2 years ago
if (count > 0)
{
throw Oops.Bah(ErrorCode.D1006);
}
2 years ago
var entity = dto.Adapt<MappingPackage>();
if (string.IsNullOrWhiteSpace(dto.GID))
{
entity.GID = Guid.NewGuid().ToString();
entity.CreateTime = DateTime.Now;
entity.CreateUser = UserManager.DjyUserId;
await _mappingPackageRep.InsertAsync(entity);
}
else
{
entity.ModifyTime = DateTime.Now;
entity.ModifyUser = UserManager.DjyUserId;
await _mappingPackageRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
await GetAllMappingPackage();
}
2 years ago
#endregion
2 years ago
2 years ago
#region 运输条款
2 years ago
/// <summary>
/// 获取运输条款信息
/// </summary>
[HttpGet("/commondb/service")]
public async Task<dynamic> ServiceList([FromQuery] NameQueryDto input)
{
2 years ago
List<CodeService> list = await _sysCacheService.GetAllCodeService();
2 years ago
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Name.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.EdiCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
2 years ago
return queryList.ToList();
}
2 years ago
/// <summary>
/// 新增运输条款
/// </summary>
[HttpPost("/commondb/addservice")]
2 years ago
public async Task AddService([FromBody] CodeServiceDto dto)
2 years ago
{
2 years ago
var list = await _sysCacheService.GetAllCodeService();
var count = list.Where(x => x.Code == dto.Code ).Count();
if (count > 0)
{
throw Oops.Bah(ErrorCode.D1006);
}
2 years ago
var entity = dto.Adapt<CodeService>();
2 years ago
entity.GID = Guid.NewGuid().ToString();
2 years ago
entity.CreateTime = DateTime.Now;
entity.CreateUser = UserManager.DjyUserId;
2 years ago
await _codeServiceRep.InsertAsync(entity);
await GetAllService();
}
2 years ago
/// <summary>
/// 获取运输条款映射
/// </summary>
[HttpGet("/commondb/mappingservice")]
public async Task<dynamic> MappingServiceList([FromQuery] MappingQueryDto input)
{
//数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
{
2 years ago
throw Oops.Bah("参数过多,请传入模块查询");
2 years ago
}
List<MappingService> list = await _sysCacheService.GetAllMappingService();
2 years ago
var queryList = list.Where(x => x.Module == input.Module)
.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapCode), x => x.MapCode.Contains(input.MapCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
2 years ago
return queryList.ToList();
}
/// <summary>
/// 新增编辑运输条款映射信息
/// </summary>
[HttpPost("/commondb/addorupdatemappingservice")]
public async Task AddOrUpdateMappingService([FromBody] MappingServiceDto dto)
{
2 years ago
var list = await _sysCacheService.GetAllMappingService();
2 years ago
var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module && x.GID != dto.GID).Count();
2 years ago
if (count > 0)
{
throw Oops.Bah(ErrorCode.D1006);
}
2 years ago
var entity = dto.Adapt<MappingService>();
if (string.IsNullOrWhiteSpace(dto.GID))
{
entity.GID = Guid.NewGuid().ToString();
entity.CreateTime = DateTime.Now;
entity.CreateUser = UserManager.DjyUserId;
await _mappingServiceRep.InsertAsync(entity);
}
else
{
entity.ModifyTime = DateTime.Now;
entity.ModifyUser = UserManager.DjyUserId;
await _mappingServiceRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
await GetAllMappingService();
}
2 years ago
#endregion
#region 箱型
2 years ago
/// <summary>
/// 获取箱型信息
/// </summary>
[HttpGet("/commondb/ctn")]
public async Task<dynamic> CtnList([FromQuery] NameQueryDto input)
{
2 years ago
List<CodeCtn> list = await _sysCacheService.GetAllCodeCtn();
2 years ago
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Name.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.EdiCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
2 years ago
return queryList.ToList();
}
2 years ago
/// <summary>
/// 新增箱型
/// </summary>
[HttpPost("/commondb/addctn")]
2 years ago
public async Task AddCtn([FromBody] CodeCtnDto dto)
2 years ago
{
2 years ago
var list = await _sysCacheService.GetAllCodeCtn();
var count = list.Where(x => x.Code == dto.Code ).Count();
if (count > 0)
{
throw Oops.Bah(ErrorCode.D1006);
}
2 years ago
var entity = dto.Adapt<CodeCtn>();
2 years ago
entity.CreateTime = DateTime.Now;
entity.CreateUser = UserManager.DjyUserId;
2 years ago
entity.GID = Guid.NewGuid().ToString();
2 years ago
await _codeCtnRep.InsertAsync(entity);
await GetAllCtn();
}
/// <summary>
/// 获取箱型映射列表信息
/// </summary>
[HttpGet("/commondb/mappingctnlist")]
public async Task<dynamic> MappingCtnList([FromQuery] MappingQueryDto input)
{
2 years ago
//数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
{
throw Oops.Bah("参数过多,请传入模块查询");
}
2 years ago
var list = await _sysCacheService.GetAllMappingCtn();
2 years ago
var queryList = list.Where(x => x.Module == input.Module)
2 years ago
.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code, System.StringComparison.CurrentCultureIgnoreCase))
2 years ago
.WhereIF(!string.IsNullOrEmpty(input.MapCode), x => x.MapCode.Contains(input.MapCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
2 years ago
2 years ago
return queryList.ToList();
}
/// <summary>
/// 新增编辑箱型映射信息
/// </summary>
[HttpPost("/commondb/addmappingctn")]
2 years ago
public async Task AddOrUpdateMappingCtn([FromBody] MappingCtnDto dto)
2 years ago
{
2 years ago
var list = await _sysCacheService.GetAllMappingCtn();
2 years ago
var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module && x.GID != dto.GID).Count();
2 years ago
if (count > 0)
{
throw Oops.Bah(ErrorCode.D1006);
}
2 years ago
var entity = dto.Adapt<MappingCtn>();
if (string.IsNullOrWhiteSpace(dto.GID))
{
2 years ago
entity.GID = Guid.NewGuid().ToString();
2 years ago
entity.CreateTime = DateTime.Now;
entity.CreateUser = UserManager.DjyUserId;
2 years ago
await _mappingCtnRep.InsertAsync(entity);
}
else
{
2 years ago
entity.ModifyTime = DateTime.Now;
entity.ModifyUser = UserManager.DjyUserId;
2 years ago
await _mappingCtnRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
await GetAllMappingCtn();
}
#endregion
#region 付费方式
/// <summary>
/// 付费方式
/// </summary>
[HttpGet("/commondb/frt")]
public async Task<dynamic> FrtList([FromQuery] NameQueryDto input)
{
2 years ago
List<CodeFrt> list = await _sysCacheService.GetAllCodeFrt();
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.CnName.Contains(input.Name) || x.EnName.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
return queryList.ToList();
}
2 years ago
/// <summary>
/// 新增付费方式
/// </summary>
[HttpPost("/commondb/addfrt")]
2 years ago
public async Task AddFrt([FromBody] CodeFrtDto dto)
2 years ago
{
2 years ago
var list = await _sysCacheService.GetAllCodeFrt();
var count = list.Where(x => x.Code == dto.Code ).Count();
if (count > 0)
{
throw Oops.Bah(ErrorCode.D1006);
}
2 years ago
var entity = dto.Adapt<CodeFrt>();
2 years ago
entity.GID = Guid.NewGuid().ToString();
2 years ago
entity.CreateTime = DateTime.Now;
entity.CreateUser = UserManager.DjyUserId;
2 years ago
await _codeFrtRep.InsertAsync(entity);
await GetAllFrt();
}
2 years ago
2 years ago
/// <summary>
/// 获取付费映射列表信息
/// </summary>
[HttpGet("/commondb/mappingfrtlist")]
public async Task<dynamic> MappingFrtList([FromQuery] MappingQueryDto input)
2 years ago
{ //数量太多,不允许查询全部
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
{
throw Oops.Bah("参数过多,请传入模块查询");
}
2 years ago
var list = await _sysCacheService.GetAllMappingFrt();
2 years ago
2 years ago
var queryList = list.Where(x => x.Module == input.Module)
2 years ago
.WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code, System.StringComparison.CurrentCultureIgnoreCase))
2 years ago
.WhereIF(!string.IsNullOrEmpty(input.MapCode), x => x.MapCode.Contains(input.MapCode, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.MapName.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
2 years ago
return queryList.ToList();
}
/// <summary>
/// 新增编辑付费映射信息
/// </summary>
[HttpPost("/commondb/addmappingfrt")]
2 years ago
public async Task AddOrUpdateMappingFrt([FromBody] MappingFrtDto dto)
2 years ago
{
2 years ago
var list = await _sysCacheService.GetAllMappingFrt();
2 years ago
var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module&&x.GID!=dto.GID).Count();
2 years ago
if (count > 0)
{
throw Oops.Bah(ErrorCode.D1006);
}
2 years ago
var entity = dto.Adapt<MappingFrt>();
if (string.IsNullOrWhiteSpace(dto.GID))
{
2 years ago
entity.GID = Guid.NewGuid().ToString();
2 years ago
entity.CreateTime = DateTime.Now;
entity.CreateUser = UserManager.DjyUserId;
2 years ago
await _mappingFrtRep.InsertAsync(entity);
}
else
{
2 years ago
entity.ModifyTime = DateTime.Now;
entity.ModifyUser = UserManager.DjyUserId;
2 years ago
await _mappingFrtRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
await GetAllMappingFrt();
}
2 years ago
#endregion
#region 签单方式
/// <summary>
/// 获取签单方式信息
/// </summary>
[HttpGet("/commondb/codeissuetypelist")]
public async Task<dynamic> CodeIssueTypeList([FromQuery] NameQueryDto input)
{
List<CodeIssueType> list = await _sysCacheService.GetAllCodeIssueType();
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.CnName.Contains(input.Name, System.StringComparison.CurrentCultureIgnoreCase))
.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|| x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
2 years ago
return queryList.ToList();
}
/// <summary>
/// 新增签单方式
/// </summary>
[HttpPost("/commondb/addcodeissuetype")]
public async Task AddCodeIssueType([FromBody] CodeIssueTypeDto dto)
{
2 years ago
var list = await _sysCacheService.GetAllCodeIssueType();
var count = list.Where(x => x.Code == dto.Code ).Count();
if (count > 0)
{
throw Oops.Bah(ErrorCode.D1006);
}
2 years ago
var entity = dto.Adapt<CodeIssueType>();
entity.GID = Guid.NewGuid().ToString();
entity.CreateTime = DateTime.Now;
entity.CreateUser = UserManager.DjyUserId;
await _codeIssueTypeRep.InsertAsync(entity);
await GetAllCodeIssueType();
}
#endregion
2 years ago
#region 模块列表
2 years ago
2 years ago
/// <summary>
2 years ago
/// 获取模块信息
2 years ago
/// </summary>
[HttpGet("/commondb/modules")]
public async Task<dynamic> ModuleList([FromQuery] NameQueryDto input)
{
return await _commonModuleRep.AsQueryable().OrderBy(x => x.Sort).Select(x => new { x.Code, x.Name, x.Sort }).ToListAsync();
}
#endregion
2 years ago
2 years ago
2 years ago
#region 实现接口,获取公共数据并缓存
[NonAction]
2 years ago
public async Task GetAllCarrier(bool flag = false)
2 years ago
{
2 years ago
if (flag)
{
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_CARRIER))
{
var list = await _codeCarrierRep.ToListAsync();
await _sysCacheService.SetAllCodeCarrier(list);
}
}
else
{
var list = await _codeCarrierRep.ToListAsync();
await _sysCacheService.SetAllCodeCarrier(list);
}
2 years ago
}
2 years ago
2 years ago
[NonAction]
2 years ago
public async Task GetAllMappingCarrier(bool flag = false)
2 years ago
{
2 years ago
if (flag)
{
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CARRIER))
{
var list = await _mappingCarrierRep.ToListAsync();
await _sysCacheService.SetAllMappingCarrier(list);
}
}
else
{
var list = await _mappingCarrierRep.ToListAsync();
await _sysCacheService.SetAllMappingCarrier(list);
}
2 years ago
2 years ago
2 years ago
}
2 years ago
[NonAction]
2 years ago
public async Task GetAllVessel(bool flag = false)
2 years ago
{
2 years ago
if (flag)
{
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_VESSEL))
{
var list = await _codeVesselRep.ToListAsync();
await _sysCacheService.SetAllCodeVessel(list);
}
}
else
2 years ago
{
var list = await _codeVesselRep.ToListAsync();
await _sysCacheService.SetAllCodeVessel(list);
2 years ago
2 years ago
}
2 years ago
2 years ago
}
[NonAction]
2 years ago
public async Task GetAllMappingVessel(bool flag = false)
2 years ago
{
2 years ago
if (flag)
{
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_VESSEL))
{
var list = await _mappingVesselRep.ToListAsync();
await _sysCacheService.SetAllMappingVessel(list);
}
}
else
{
var list = await _mappingVesselRep.ToListAsync();
await _sysCacheService.SetAllMappingVessel(list);
2 years ago
}
2 years ago
2 years ago
}
2 years ago
[NonAction]
2 years ago
public async Task GetAllMappingYard(bool flag = false)
2 years ago
{
2 years ago
if (flag)
{
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_YARD))
{
var list = await _mappingYardRep.ToListAsync();
await _sysCacheService.SetAllMappingYard(list);
}
}
else
{
var list = await _mappingYardRep.ToListAsync();
await _sysCacheService.SetAllMappingYard(list);
}
2 years ago
2 years ago
2 years ago
}
[NonAction]
2 years ago
public async Task GetAllForwarder(bool flag = false)
2 years ago
{
2 years ago
if (flag)
{
2 years ago
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_FORWARDER))
{
var list = await _codeForwarderRep.ToListAsync();
await _sysCacheService.SetAllCodeForwarder(list);
}
}
else
{
var list = await _codeForwarderRep.ToListAsync();
await _sysCacheService.SetAllCodeForwarder(list);
}
2 years ago
2 years ago
}
[NonAction]
2 years ago
public async Task GetAllYard(bool flag = false)
2 years ago
{
2 years ago
if (flag)
{
2 years ago
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_YARD))
{
var list = await _codeYardRep.ToListAsync();
await _sysCacheService.SetAllCodeYard(list);
}
}
else
{
var list = await _codeYardRep.ToListAsync();
await _sysCacheService.SetAllCodeYard(list);
}
2 years ago
}
[NonAction]
2 years ago
public async Task GetAllPortload(bool flag = false)
2 years ago
{
2 years ago
if (flag)
{
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_PORTLOAD))
{
var list = await _codePortLoadrRep.ToListAsync();
await _sysCacheService.SetAllCodePortLoad(list);
}
}
else
{
var list = await _codePortLoadrRep.ToListAsync();
await _sysCacheService.SetAllCodePortLoad(list);
}
2 years ago
2 years ago
2 years ago
}
[NonAction]
2 years ago
public async Task GetAllPort(bool flag = false)
2 years ago
{
2 years ago
if (flag)
{
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_PORT))
{
var list = await _codePortRep.ToListAsync();
await _sysCacheService.SetAllCodePort(list);
}
}
else
{
var list = await _codePortRep.ToListAsync();
await _sysCacheService.SetAllCodePort(list);
}
2 years ago
2 years ago
2 years ago
}
[NonAction]
2 years ago
public async Task GetAllPackage(bool flag = false)
2 years ago
{
2 years ago
if (flag)
{
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_PACKAGE))
{
var list = await _codePackageRep.ToListAsync();
await _sysCacheService.SetAllCodePackage(list);
}
}
else
{
var list = await _codePackageRep.ToListAsync();
await _sysCacheService.SetAllCodePackage(list);
}
2 years ago
2 years ago
2 years ago
}
[NonAction]
2 years ago
public async Task GetAllService(bool flag = false)
2 years ago
{
2 years ago
if (flag)
{
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_SERVICE))
{
var list = await _codeServiceRep.ToListAsync();
await _sysCacheService.SetAllCodeService(list);
}
}
else
{
var list = await _codeServiceRep.ToListAsync();
await _sysCacheService.SetAllCodeService(list);
}
2 years ago
2 years ago
2 years ago
}
2 years ago
[NonAction]
2 years ago
public async Task GetAllCtn(bool flag = false)
2 years ago
{
2 years ago
if (flag)
{
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_CTN))
{
var list = await _codeCtnRep.ToListAsync();
await _sysCacheService.SetAllCodeCtn(list);
}
}
else
{
var list = await _codeCtnRep.ToListAsync();
await _sysCacheService.SetAllCodeCtn(list);
}
2 years ago
2 years ago
2 years ago
}
2 years ago
[NonAction]
2 years ago
public async Task GetAllMappingCtn(bool flag = false)
2 years ago
{
2 years ago
if (flag)
{
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CTN))
{
var list = await _mappingCtnRep.ToListAsync();
await _sysCacheService.SetAllMappingCtn(list);
}
}
else
{
var list = await _mappingCtnRep.ToListAsync();
await _sysCacheService.SetAllMappingCtn(list);
}
2 years ago
2 years ago
2 years ago
}
[NonAction]
2 years ago
public async Task GetAllFrt(bool flag = false)
{
2 years ago
if (flag)
{
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_FRT))
{
var list = await _codeFrtRep.ToListAsync();
await _sysCacheService.SetAllCodeFrt(list);
}
}
else
{
var list = await _codeFrtRep.ToListAsync();
await _sysCacheService.SetAllCodeFrt(list);
}
2 years ago
2 years ago
}
2 years ago
[NonAction]
2 years ago
public async Task GetAllMappingFrt(bool flag = false)
2 years ago
{
2 years ago
if (flag)
{
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_FRT))
{
var list = await _mappingFrtRep.ToListAsync();
await _sysCacheService.SetAllMappingFrt(list);
}
}
else
{
var list = await _mappingFrtRep.ToListAsync();
await _sysCacheService.SetAllMappingFrt(list);
}
2 years ago
2 years ago
2 years ago
}
2 years ago
[NonAction]
2 years ago
public async Task GetAllMappingPortLoad(bool flag = false)
2 years ago
{
2 years ago
if (flag)
{
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_PORTLOAD))
{
var list = await _mappingPortLoadRep.ToListAsync();
await _sysCacheService.SetAllMappingPortLoad(list);
}
}
else
{
var list = await _mappingPortLoadRep.ToListAsync();
await _sysCacheService.SetAllMappingPortLoad(list);
}
2 years ago
2 years ago
2 years ago
}
[NonAction]
2 years ago
public async Task GetAllMappingPort(bool flag = false)
2 years ago
{
2 years ago
if (flag)
{
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_PORT))
{
var list = await _mappingPortRep.ToListAsync();
await _sysCacheService.SetAllMappingPort(list);
}
}
else
{
var list = await _mappingPortRep.ToListAsync();
await _sysCacheService.SetAllMappingPort(list);
}
2 years ago
2 years ago
2 years ago
}
[NonAction]
2 years ago
public async Task GetAllMappingPackage(bool flag = false)
2 years ago
{
2 years ago
if (flag)
{
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_PACKAGE))
{
var list = await _mappingPackageRep.ToListAsync();
await _sysCacheService.SetAllMappingPackage(list);
}
}
else
{
var list = await _mappingPackageRep.ToListAsync();
await _sysCacheService.SetAllMappingPackage(list);
}
2 years ago
2 years ago
2 years ago
}
[NonAction]
2 years ago
public async Task GetAllMappingService(bool flag = false)
2 years ago
{
2 years ago
if (flag)
{
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_SERVICE))
{
var list = await _mappingServiceRep.ToListAsync();
await _sysCacheService.SetAllMappingService(list);
}
}
else
{
var list = await _mappingServiceRep.ToListAsync();
await _sysCacheService.SetAllMappingService(list);
}
2 years ago
2 years ago
2 years ago
}
2 years ago
[NonAction]
2 years ago
public async Task GetAllCodeIssueType(bool flag = false)
2 years ago
{
2 years ago
if (flag)
{
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CODEISSUETYPE))
{
var list = await _codeIssueTypeRep.ToListAsync();
await _sysCacheService.SetAllCodeIssueType(list);
}
}
else
{
var list = await _codeIssueTypeRep.ToListAsync();
await _sysCacheService.SetAllCodeIssueType(list);
}
2 years ago
2 years ago
}
2 years ago
2 years ago
#endregion
2 years ago
}