|
|
|
|
using Furion.DependencyInjection;
|
|
|
|
|
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;
|
|
|
|
|
using Myshipping.Core.Service.CommonDB.Dto;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using Myshipping.Core.Entity.CommonDB;
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using System.Reflection.Metadata.Ecma335;
|
|
|
|
|
|
|
|
|
|
namespace Myshipping.Core.Service;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 公共库
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ApiDescriptionSettings(Name = "CommonDB", Order = 1000)]
|
|
|
|
|
public class CommonDBService : ICommonDBService, IDynamicApiController, ITransient
|
|
|
|
|
{
|
|
|
|
|
#region
|
|
|
|
|
private readonly SqlSugarRepository<CodeCarrier> _codeCarrierRep;
|
|
|
|
|
private readonly SqlSugarRepository<MappingCarrier> _mappingCarrierRep;
|
|
|
|
|
private readonly SqlSugarRepository<CodeVessel> _codeVesselRep;
|
|
|
|
|
private readonly SqlSugarRepository<MappingVessel> _mappingVesselRep;
|
|
|
|
|
private readonly SqlSugarRepository<CodeForwarder> _codeForwarderRep;
|
|
|
|
|
private readonly SqlSugarRepository<CodeYard> _codeYardRep;
|
|
|
|
|
private readonly SqlSugarRepository<MappingYard> _mappingYardRep;
|
|
|
|
|
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;
|
|
|
|
|
private readonly SqlSugarRepository<MappingCtn> _mappingCtnRep;
|
|
|
|
|
private readonly SqlSugarRepository<CodeFrt> _codeFrtRep;
|
|
|
|
|
private readonly SqlSugarRepository<MappingFrt> _mappingFrtRep;
|
|
|
|
|
private readonly SqlSugarRepository<MappingPortLoad> _mappingPortLoadRep;
|
|
|
|
|
private readonly SqlSugarRepository<MappingPort> _mappingPortRep;
|
|
|
|
|
private readonly SqlSugarRepository<MappingPackage> _mappingPackageRep;
|
|
|
|
|
private readonly SqlSugarRepository<MappingService> _mappingServiceRep;
|
|
|
|
|
private readonly ISysCacheService _sysCacheService;
|
|
|
|
|
private readonly SqlSugarRepository<CodeIssueType> _codeIssueTypeRep;
|
|
|
|
|
private readonly SqlSugarRepository<MappingIssueType> _mappingIssueTypeRep;
|
|
|
|
|
private readonly SqlSugarRepository<CommonModule> _commonModuleRep;
|
|
|
|
|
private readonly ILogger<CommonDBService> _logger;
|
|
|
|
|
private readonly SqlSugarRepository<CodeLane> _codeLaneRep;
|
|
|
|
|
private readonly SqlSugarRepository<RelaPortCarrierLane> _relaPortCarrierLaneRep;
|
|
|
|
|
private readonly SqlSugarRepository<CodeCountry> _codeCountryRep;
|
|
|
|
|
private readonly SqlSugarRepository<MappingForwarder> _mappingForwarder;
|
|
|
|
|
private readonly SqlSugarRepository<CodeCity> _codeCityRep;
|
|
|
|
|
private readonly SqlSugarRepository<CodeProvince> _codeProvinceRep;
|
|
|
|
|
private readonly SqlSugarRepository<RelaPortLoadForwarder> _relaPortLoadForwarderRep;
|
|
|
|
|
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,
|
|
|
|
|
SqlSugarRepository<MappingCarrier> mappingCarrierRep,
|
|
|
|
|
SqlSugarRepository<MappingVessel> mappingVesselRep,
|
|
|
|
|
SqlSugarRepository<MappingCtn> mappingCtnRep,
|
|
|
|
|
SqlSugarRepository<MappingFrt> mappingFrtRep,
|
|
|
|
|
SqlSugarRepository<MappingYard> mappingYardRep,
|
|
|
|
|
SqlSugarRepository<MappingPortLoad> mappingPortLoadRep,
|
|
|
|
|
SqlSugarRepository<MappingPort> mappingPortRep,
|
|
|
|
|
SqlSugarRepository<MappingPackage> mappingPackageRep,
|
|
|
|
|
SqlSugarRepository<MappingService> mappingServiceRep,
|
|
|
|
|
SqlSugarRepository<CodeIssueType> codeIssueTypeRep,
|
|
|
|
|
SqlSugarRepository<CommonModule> commonModuleRep,
|
|
|
|
|
ILogger<CommonDBService> logger,
|
|
|
|
|
ISysCacheService sysCacheService,
|
|
|
|
|
SqlSugarRepository<CodeLane> codeLaneRep,
|
|
|
|
|
SqlSugarRepository<RelaPortCarrierLane> relaPortCarrierLaneRep,
|
|
|
|
|
SqlSugarRepository<MappingIssueType> mappingIssueTypeRep,
|
|
|
|
|
SqlSugarRepository<CodeCountry> codeCountryRep,
|
|
|
|
|
SqlSugarRepository<MappingForwarder> mappingForwarder,
|
|
|
|
|
SqlSugarRepository<CodeCity> codeCityRep,
|
|
|
|
|
SqlSugarRepository<CodeProvince> codeProvinceRep,
|
|
|
|
|
SqlSugarRepository<RelaPortLoadForwarder> relaPortLoadForwarderRep
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
_codeCarrierRep = codeCarrierRep;
|
|
|
|
|
_codeVesselRep = codeVesselRep;
|
|
|
|
|
_codeForwarderRep = codeForwarderRep;
|
|
|
|
|
_codeYardRep = codeYardRep;
|
|
|
|
|
_codePortLoadrRep = codePortLoadrRep;
|
|
|
|
|
_codePortRep = codePortRep;
|
|
|
|
|
_codePackageRep = codePackageRep;
|
|
|
|
|
_codeServiceRep = codeServiceRep;
|
|
|
|
|
_codeCtnRep = codeCtnRep;
|
|
|
|
|
_codeFrtRep = codeFrtRep;
|
|
|
|
|
_mappingCarrierRep = mappingCarrierRep;
|
|
|
|
|
_mappingVesselRep = mappingVesselRep;
|
|
|
|
|
_mappingCtnRep = mappingCtnRep;
|
|
|
|
|
_mappingFrtRep = mappingFrtRep;
|
|
|
|
|
_mappingYardRep = mappingYardRep;
|
|
|
|
|
_sysCacheService = sysCacheService;
|
|
|
|
|
_mappingPortLoadRep = mappingPortLoadRep;
|
|
|
|
|
_mappingPortRep = mappingPortRep;
|
|
|
|
|
_mappingPackageRep = mappingPackageRep;
|
|
|
|
|
_mappingServiceRep = mappingServiceRep;
|
|
|
|
|
_codeIssueTypeRep = codeIssueTypeRep;
|
|
|
|
|
_commonModuleRep = commonModuleRep;
|
|
|
|
|
_logger = logger;
|
|
|
|
|
_codeLaneRep = codeLaneRep;
|
|
|
|
|
_relaPortCarrierLaneRep = relaPortCarrierLaneRep;
|
|
|
|
|
_codeCountryRep = codeCountryRep;
|
|
|
|
|
_mappingIssueTypeRep = mappingIssueTypeRep;
|
|
|
|
|
_mappingForwarder = mappingForwarder;
|
|
|
|
|
_codeCityRep = codeCityRep;
|
|
|
|
|
_codeProvinceRep = codeProvinceRep;
|
|
|
|
|
_relaPortLoadForwarderRep = relaPortLoadForwarderRep;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 船公司
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取船公司列表信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/carrierlist")]
|
|
|
|
|
public async Task<dynamic> CarrierList([FromQuery] NameQueryDto input)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeCarrier();
|
|
|
|
|
var queryList = list.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));
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增船公司信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/commondb/addcarrier")]
|
|
|
|
|
public async Task AddCarrier([FromBody] CodeCarrierDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeCarrier();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code && x.GID != dto.GID).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<CodeCarrier>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeCarrierRep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
entity.CreateTime = list.Where(x => x.GID == dto.GID).Select(x => x.CreateTime).FirstOrDefault();
|
|
|
|
|
entity.CreateUser = list.Where(x => x.GID == dto.GID).Select(x => x.CreateUser).FirstOrDefault();
|
|
|
|
|
entity.ModifyTime = DateTime.Now;
|
|
|
|
|
entity.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeCarrierRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await GetAllCarrier();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取船公司映射列表信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/mappingcarrierlist")]
|
|
|
|
|
public async Task<dynamic> MappingCarrierList([FromQuery] MappingQueryDto input)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingCarrier();
|
|
|
|
|
//数量太多,不允许查询全部
|
|
|
|
|
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("请传入模块查询");
|
|
|
|
|
}
|
|
|
|
|
var queryList = list.Where(x => x.Module == input.Module)
|
|
|
|
|
.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));
|
|
|
|
|
if (queryList.Count() > 20)
|
|
|
|
|
{
|
|
|
|
|
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增编辑船公司映射信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/commondb/addorupdatemappingcarrier")]
|
|
|
|
|
public async Task AddOrUpdateMappingCarrier([FromBody] MappingCarrierDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingCarrier();
|
|
|
|
|
var count = list.Where(x => x.Module == dto.Module && x.Code == dto.Code && x.GID != dto.GID).Count();
|
|
|
|
|
var entity = dto.Adapt<MappingCarrier>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _mappingCarrierRep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
entity.CreateTime = list.Where(x => x.GID == dto.GID).Select(x => x.CreateTime).FirstOrDefault();
|
|
|
|
|
entity.CreateUser = list.Where(x => x.GID == dto.GID).Select(x => x.CreateUser).FirstOrDefault();
|
|
|
|
|
entity.ModifyTime = DateTime.Now;
|
|
|
|
|
entity.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
await _mappingCarrierRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
await GetAllMappingCarrier();
|
|
|
|
|
|
|
|
|
|
if (count > 0) //提醒有相同配置项
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("操作成功,但需注意存在多个相同模块和船司代码的映射配置");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 船名
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取船名列表信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/vessellist")]
|
|
|
|
|
public async Task<dynamic> VesselList([FromQuery] NameQueryDto input)
|
|
|
|
|
{
|
|
|
|
|
List<CodeVessel> list = await _sysCacheService.GetAllCodeVessel();
|
|
|
|
|
//数量太多,不允许查询全部
|
|
|
|
|
if (string.IsNullOrEmpty(input.KeyWord))
|
|
|
|
|
{
|
|
|
|
|
return list.Take(10);
|
|
|
|
|
}
|
|
|
|
|
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Name.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
|
|
|
|
|
if (queryList.Count() > 20)
|
|
|
|
|
{
|
|
|
|
|
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).Take(10).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增船名信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/commondb/addvessel")]
|
|
|
|
|
public async Task AddVessel([FromBody] CodeVesselDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeVessel();
|
|
|
|
|
var count = list.Where(x => x.Name.Trim() == dto.Name.Trim() && x.GID != dto.GID).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<CodeVessel>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeVesselRep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
entity.CreateTime = list.Where(x => x.GID == dto.GID).Select(x => x.CreateTime).FirstOrDefault();
|
|
|
|
|
entity.CreateUser = list.Where(x => x.GID == dto.GID).Select(x => x.CreateUser).FirstOrDefault();
|
|
|
|
|
entity.ModifyTime = DateTime.Now;
|
|
|
|
|
entity.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeVesselRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
await GetAllVessel();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 同步船名信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/commondb/syncvessel")]
|
|
|
|
|
public async Task<string> SyncVessel([FromBody] CodeVesselDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeVessel();
|
|
|
|
|
var count = list.Where(x => x.Name.Trim() == dto.Name.Trim()).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
return "已存在记录";
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<CodeVessel>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeVesselRep.InsertAsync(entity);
|
|
|
|
|
|
|
|
|
|
await GetAllVessel();
|
|
|
|
|
|
|
|
|
|
return string.Empty;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取船名映射
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/mappingvessellist")]
|
|
|
|
|
public async Task<dynamic> MappingVesselList([FromQuery] MappingQueryDto input)
|
|
|
|
|
{
|
|
|
|
|
//数量太多,不允许查询全部
|
|
|
|
|
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("请传入模块查询");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<MappingVessel> list = await _sysCacheService.GetAllMappingVessel();
|
|
|
|
|
|
|
|
|
|
var queryList = list.Where(x => x.Module == input.Module)
|
|
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|
|
|
|
|
|| x.Name.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|
|
|
|
|
|| x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|
|
|
|
|
|| x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|
|
|
|
|
|| x.YardCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
|
|
|
|
|
|
|
|
|
|
if (queryList.Count() > 20)
|
|
|
|
|
{
|
|
|
|
|
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增编辑船名映射信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/commondb/addorupdatevessel")]
|
|
|
|
|
public async Task AddOrUpdateMappingVessel([FromBody] MappingVesselDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingVessel();
|
|
|
|
|
var count = list.Where(x => x.Name == dto.Name.Trim()
|
|
|
|
|
&& x.Module == dto.Module
|
|
|
|
|
&& x.YardCode == dto.YardCode
|
|
|
|
|
&& x.GID != dto.GID).Count();
|
|
|
|
|
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var entity = dto.Adapt<MappingVessel>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _mappingVesselRep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
entity.CreateTime = list.Where(x => x.GID == dto.GID).Select(x => x.CreateTime).FirstOrDefault();
|
|
|
|
|
entity.CreateUser = list.Where(x => x.GID == dto.GID).Select(x => x.CreateUser).FirstOrDefault();
|
|
|
|
|
entity.ModifyTime = DateTime.Now;
|
|
|
|
|
entity.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
await _mappingVesselRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
await GetAllMappingVessel();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 船代
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取船代列表信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/forwarderlist")]
|
|
|
|
|
public async Task<dynamic> ForwarderList([FromQuery] ForwarderListInputDto input)
|
|
|
|
|
{
|
|
|
|
|
List<CodeForwarder> list = await _sysCacheService.GetAllCodeForwarder();
|
|
|
|
|
|
|
|
|
|
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Name.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
|
|
|
|
|
|
|
|
|
|
// 如果装货港代码不为空,则根据装货港代码查询装货港与船代的映射关系
|
|
|
|
|
if (!string.IsNullOrEmpty(input.PortLoadCode))
|
|
|
|
|
{
|
|
|
|
|
List<string> forwarderCodeList = await _relaPortLoadForwarderRep.AsQueryable()
|
|
|
|
|
.Where(x => x.PortLoadCode == input.PortLoadCode)
|
|
|
|
|
.Select(x => x.ForwarderCode)
|
|
|
|
|
.ToListAsync();
|
|
|
|
|
queryList = queryList.Where(x => forwarderCodeList.Contains(x.Code)).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (queryList.Count() > 20)
|
|
|
|
|
{
|
|
|
|
|
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增船代信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/commondb/addforwarder")]
|
|
|
|
|
public async Task AddForwarder([FromBody] CodeForwarderDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeForwarder();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code && x.GID != dto.GID).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<CodeForwarder>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeForwarderRep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
entity.CreateTime = list.Where(x => x.GID == dto.GID).Select(x => x.CreateTime).FirstOrDefault();
|
|
|
|
|
entity.CreateUser = list.Where(x => x.GID == dto.GID).Select(x => x.CreateUser).FirstOrDefault();
|
|
|
|
|
entity.ModifyTime = DateTime.Now;
|
|
|
|
|
entity.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeForwarderRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await GetAllForwarder();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取船代映射
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/mappingforwarderlist")]
|
|
|
|
|
public async Task<dynamic> MappingForwarderList([FromQuery] MappingQueryDto input)
|
|
|
|
|
{
|
|
|
|
|
//数量太多,不允许查询全部
|
|
|
|
|
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("请传入模块查询");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<MappingForwarder> list = await _sysCacheService.GetAllMappingForwarder();
|
|
|
|
|
|
|
|
|
|
var queryList = list.Where(x => x.Module == input.Module)
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|
|
|
|
|
|| x.MapCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
|
|
|
|
|
if (queryList.Count() > 20)
|
|
|
|
|
{
|
|
|
|
|
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增编辑船代映射信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/commondb/addorupdateforwarderlist")]
|
|
|
|
|
public async Task AddOrUpdateMappingForwarder([FromBody] MappingForwarderDto dto)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingForwarder();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module && x.GID != dto.GID).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<MappingForwarder>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _mappingForwarder.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
entity.CreateTime = list.Where(x => x.GID == dto.GID).Select(x => x.CreateTime).FirstOrDefault();
|
|
|
|
|
entity.CreateUser = list.Where(x => x.GID == dto.GID).Select(x => x.CreateUser).FirstOrDefault();
|
|
|
|
|
entity.ModifyTime = DateTime.Now;
|
|
|
|
|
entity.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
await _mappingForwarder.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
await GetAllMappingForwarder();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 场站
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取场站列表信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/yardlist")]
|
|
|
|
|
public async Task<dynamic> YardList([FromQuery] NameQueryDto input)
|
|
|
|
|
{
|
|
|
|
|
List<CodeYard> list = await _sysCacheService.GetAllCodeYard();
|
|
|
|
|
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Name.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase) || x.ShowCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase));
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增场站信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/commondb/addyard")]
|
|
|
|
|
public async Task AddYard([FromBody] CodeYardDto dto)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeYard();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code && x.GID != dto.GID).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<CodeYard>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeYardRep.InsertAsync(entity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
entity.CreateTime = list.Where(x => x.GID == dto.GID).Select(x => x.CreateTime).FirstOrDefault();
|
|
|
|
|
entity.CreateUser = list.Where(x => x.GID == dto.GID).Select(x => x.CreateUser).FirstOrDefault();
|
|
|
|
|
entity.ModifyTime = DateTime.Now;
|
|
|
|
|
entity.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeYardRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await GetAllYard();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取场站映射
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/mappingyardlist")]
|
|
|
|
|
public async Task<dynamic> MappingYardList([FromQuery] MappingQueryDto input)
|
|
|
|
|
{
|
|
|
|
|
//数量太多,不允许查询全部
|
|
|
|
|
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("请传入模块查询");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<MappingYard> list = await _sysCacheService.GetAllMappingYard();
|
|
|
|
|
|
|
|
|
|
var queryList = list.Where(x => x.Module == input.Module)
|
|
|
|
|
.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))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.CarrierCode), x => x.CarrierCode == input.CarrierCode);
|
|
|
|
|
if (queryList.Count() > 20)
|
|
|
|
|
{
|
|
|
|
|
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增编辑场站映射信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/commondb/addorupdatemappingyard")]
|
|
|
|
|
public async Task AddOrUpdateMappingYard([FromBody] MappingYardDto dto)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingYard();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module && x.CarrierCode == dto.CarrierCode && x.GID != dto.GID).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<MappingYard>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _mappingYardRep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
entity.CreateTime = list.Where(x => x.GID == dto.GID).Select(x => x.CreateTime).FirstOrDefault();
|
|
|
|
|
entity.CreateUser = list.Where(x => x.GID == dto.GID).Select(x => x.CreateUser).FirstOrDefault();
|
|
|
|
|
entity.ModifyTime = DateTime.Now;
|
|
|
|
|
entity.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
await _mappingYardRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
await GetAllMappingYard();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 起始港
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取起始港信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/portloadlist")]
|
|
|
|
|
public async Task<dynamic> PortloadList([FromQuery] NameQueryDto input)
|
|
|
|
|
{
|
|
|
|
|
List<CodePortLoad> list = await _sysCacheService.GetAllCodePortLoad();
|
|
|
|
|
_logger.LogInformation("起始港1:" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss.fff"));
|
|
|
|
|
var queryList = list.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));
|
|
|
|
|
_logger.LogInformation("起始港2:" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss.fff"));
|
|
|
|
|
if (queryList.Count() > 20)
|
|
|
|
|
{
|
|
|
|
|
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增起始港信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/commondb/addportload")]
|
|
|
|
|
public async Task AddPortload([FromBody] CodePortLoadDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodePortLoad();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code && x.GID != dto.GID).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<CodePortLoad>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _codePortLoadrRep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
entity.CreateTime = list.Where(x => x.GID == dto.GID).Select(x => x.CreateTime).FirstOrDefault();
|
|
|
|
|
entity.CreateUser = list.Where(x => x.GID == dto.GID).Select(x => x.CreateUser).FirstOrDefault();
|
|
|
|
|
entity.ModifyTime = DateTime.Now;
|
|
|
|
|
entity.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
await _codePortLoadrRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await GetAllPortload();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取起始港映射
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/mappingportloadlist")]
|
|
|
|
|
public async Task<dynamic> PortloadList([FromQuery] MappingQueryDto input)
|
|
|
|
|
{
|
|
|
|
|
//数量太多,不允许查询全部
|
|
|
|
|
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("参数过多,请传入模块查询");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<MappingPortLoad> list = await _sysCacheService.GetAllMappingPortLoad();
|
|
|
|
|
|
|
|
|
|
var queryList = list.Where(x => x.Module == input.Module)
|
|
|
|
|
.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))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.CarrierCode), x => x.CarrierCode == input.CarrierCode);
|
|
|
|
|
if (queryList.Count() > 20)
|
|
|
|
|
{
|
|
|
|
|
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增编辑起始港映射信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/commondb/addorupdatemappingportload")]
|
|
|
|
|
public async Task AddOrUpdatePortload([FromBody] MappingPortLoadDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingPortLoad();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module && x.CarrierCode == dto.CarrierCode && x.GID != dto.GID).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
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.CreateTime = list.Where(x => x.GID == dto.GID).Select(x => x.CreateTime).FirstOrDefault();
|
|
|
|
|
entity.CreateUser = list.Where(x => x.GID == dto.GID).Select(x => x.CreateUser).FirstOrDefault();
|
|
|
|
|
entity.ModifyTime = DateTime.Now;
|
|
|
|
|
entity.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
await _mappingPortLoadRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
await GetAllMappingPortLoad();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 目的港
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取目的港信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/portlist")]
|
|
|
|
|
public async Task<dynamic> PortList([FromQuery] NameQueryDto input)
|
|
|
|
|
{
|
|
|
|
|
List<CodePort> list = await _sysCacheService.GetAllCodePort();
|
|
|
|
|
var listLineRela = await _sysCacheService.GetAllRelaPortCarrierLane();
|
|
|
|
|
var listLine = await _sysCacheService.GetAllCodeLane();
|
|
|
|
|
List<CodePort> result = null;
|
|
|
|
|
if (string.IsNullOrWhiteSpace(input.KeyWord))
|
|
|
|
|
{
|
|
|
|
|
result = list.Take(10).ToList();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("目的港1:" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss.fff"));
|
|
|
|
|
var queryList = list.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));
|
|
|
|
|
_logger.LogInformation("目的港2:" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss.fff"));
|
|
|
|
|
if (queryList.Count() > 20)
|
|
|
|
|
{
|
|
|
|
|
result = queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
result = queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.ForEach(x =>
|
|
|
|
|
{
|
|
|
|
|
var query = from line in listLine
|
|
|
|
|
join lineRel in listLineRela on line.Code equals lineRel.LaneCode
|
|
|
|
|
where lineRel.PortCode == x.Code
|
|
|
|
|
select new { line, lineRel };
|
|
|
|
|
x.LineName = query.Select(x => new
|
|
|
|
|
{
|
|
|
|
|
x.line.CnName,
|
|
|
|
|
x.lineRel.CarrierCode
|
|
|
|
|
}).ToList();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增目的港信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/commondb/addport")]
|
|
|
|
|
public async Task AddPort([FromBody] CodePortDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodePort();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code && x.GID != dto.GID).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<CodePort>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _codePortRep.InsertAsync(entity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
entity.CreateTime = list.Where(x => x.GID == dto.GID).Select(x => x.CreateTime).FirstOrDefault();
|
|
|
|
|
entity.CreateUser = list.Where(x => x.GID == dto.GID).Select(x => x.CreateUser).FirstOrDefault();
|
|
|
|
|
entity.ModifyTime = DateTime.Now;
|
|
|
|
|
entity.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
await _codePortRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await GetAllPort();
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取目的港映射
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/mappingportlist")]
|
|
|
|
|
public async Task<dynamic> PortList([FromQuery] MappingQueryDto input)
|
|
|
|
|
{
|
|
|
|
|
//数量太多,不允许查询全部
|
|
|
|
|
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("参数过多,请传入模块查询");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<MappingPort> list = await _sysCacheService.GetAllMappingPort();
|
|
|
|
|
|
|
|
|
|
var queryList = list.Where(x => x.Module == input.Module)
|
|
|
|
|
.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))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.CarrierCode), x => x.CarrierCode == input.CarrierCode);
|
|
|
|
|
if (queryList.Count() > 20)
|
|
|
|
|
{
|
|
|
|
|
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增编辑目的港映射信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/commondb/addorupdatemappingport")]
|
|
|
|
|
public async Task AddOrUpdatePort([FromBody] MappingPortDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingPort();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module && x.CarrierCode == dto.CarrierCode && x.GID != dto.GID).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
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.CreateTime = list.Where(x => x.GID == dto.GID).Select(x => x.CreateTime).FirstOrDefault();
|
|
|
|
|
entity.CreateUser = list.Where(x => x.GID == dto.GID).Select(x => x.CreateUser).FirstOrDefault();
|
|
|
|
|
entity.ModifyTime = DateTime.Now;
|
|
|
|
|
entity.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
await _mappingPortRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
await GetAllMappingPort();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 包装
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取包装信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/package")]
|
|
|
|
|
public async Task<dynamic> PackageList([FromQuery] NameQueryDto input)
|
|
|
|
|
{
|
|
|
|
|
List<CodePackage> list = await _sysCacheService.GetAllCodePackage();
|
|
|
|
|
|
|
|
|
|
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.KeyWord),
|
|
|
|
|
x => (!string.IsNullOrWhiteSpace(x.Name) && x.Name.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
|| (!string.IsNullOrWhiteSpace(x.Code) && x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
|| (!string.IsNullOrWhiteSpace(x.EdiCode) && x.EdiCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)));
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增包装信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/commondb/addpackage")]
|
|
|
|
|
public async Task AddPackage([FromBody] CodePackageDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodePackage();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code && x.GID != dto.GID).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<CodePackage>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _codePackageRep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
entity.CreateTime = list.Where(x => x.GID == dto.GID).Select(x => x.CreateTime).FirstOrDefault();
|
|
|
|
|
entity.CreateUser = list.Where(x => x.GID == dto.GID).Select(x => x.CreateUser).FirstOrDefault();
|
|
|
|
|
entity.ModifyTime = DateTime.Now;
|
|
|
|
|
entity.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
await _codePackageRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
await GetAllPackage();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取包装映射
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/mappingpackage")]
|
|
|
|
|
public async Task<dynamic> MappingPackageList([FromQuery] MappingQueryDto input)
|
|
|
|
|
{
|
|
|
|
|
//数量太多,不允许查询全部
|
|
|
|
|
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("请传入模块查询");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<MappingPackage> list = await _sysCacheService.GetAllMappingPackage();
|
|
|
|
|
|
|
|
|
|
var queryList = list.Where(x => x.Module == input.Module)
|
|
|
|
|
.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))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.CarrierCode), x => x.CarrierCode == input.CarrierCode);
|
|
|
|
|
|
|
|
|
|
if (queryList.Count() > 20)
|
|
|
|
|
{
|
|
|
|
|
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增编辑包装映射信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/commondb/addorupdatemappingpackage")]
|
|
|
|
|
public async Task AddOrUpdateMappingPackage([FromBody] MappingPackageDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingPackage();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module && x.CarrierCode == dto.CarrierCode && x.GID != dto.GID).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
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.CreateTime = list.Where(x => x.GID == dto.GID).Select(x => x.CreateTime).FirstOrDefault();
|
|
|
|
|
entity.CreateUser = list.Where(x => x.GID == dto.GID).Select(x => x.CreateUser).FirstOrDefault();
|
|
|
|
|
entity.ModifyTime = DateTime.Now;
|
|
|
|
|
entity.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
await _mappingPackageRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
await GetAllMappingPackage();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 运输条款
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取运输条款信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/service")]
|
|
|
|
|
public async Task<dynamic> ServiceList([FromQuery] NameQueryDto input)
|
|
|
|
|
{
|
|
|
|
|
List<CodeService> list = await _sysCacheService.GetAllCodeService();
|
|
|
|
|
|
|
|
|
|
var queryList = list.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));
|
|
|
|
|
if (queryList.Count() > 20)
|
|
|
|
|
{
|
|
|
|
|
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增运输条款
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/commondb/addservice")]
|
|
|
|
|
public async Task AddService([FromBody] CodeServiceDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeService();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code && x.GID != dto.GID).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<CodeService>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeServiceRep.InsertAsync(entity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
entity.CreateTime = list.Where(x => x.GID == dto.GID).Select(x => x.CreateTime).FirstOrDefault();
|
|
|
|
|
entity.CreateUser = list.Where(x => x.GID == dto.GID).Select(x => x.CreateUser).FirstOrDefault();
|
|
|
|
|
entity.ModifyTime = DateTime.Now;
|
|
|
|
|
entity.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeServiceRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await GetAllService();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取运输条款映射
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/mappingservice")]
|
|
|
|
|
public async Task<dynamic> MappingServiceList([FromQuery] MappingQueryDto input)
|
|
|
|
|
{
|
|
|
|
|
//数量太多,不允许查询全部
|
|
|
|
|
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("参数过多,请传入模块查询");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<MappingService> list = await _sysCacheService.GetAllMappingService();
|
|
|
|
|
|
|
|
|
|
var queryList = list.Where(x => x.Module == input.Module)
|
|
|
|
|
.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))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.CarrierCode), x => x.CarrierCode == input.CarrierCode);
|
|
|
|
|
|
|
|
|
|
if (queryList.Count() > 20)
|
|
|
|
|
{
|
|
|
|
|
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增编辑运输条款映射信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/commondb/addorupdatemappingservice")]
|
|
|
|
|
public async Task AddOrUpdateMappingService([FromBody] MappingServiceDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingService();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module && x.CarrierCode == dto.CarrierCode && x.GID != dto.GID).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
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.CreateTime = list.Where(x => x.GID == dto.GID).Select(x => x.CreateTime).FirstOrDefault();
|
|
|
|
|
entity.CreateUser = list.Where(x => x.GID == dto.GID).Select(x => x.CreateUser).FirstOrDefault();
|
|
|
|
|
entity.ModifyTime = DateTime.Now;
|
|
|
|
|
entity.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
await _mappingServiceRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
await GetAllMappingService();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 箱型
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取箱型信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/ctn")]
|
|
|
|
|
public async Task<dynamic> CtnList([FromQuery] NameQueryDto input)
|
|
|
|
|
{
|
|
|
|
|
List<CodeCtn> list = await _sysCacheService.GetAllCodeCtn();
|
|
|
|
|
|
|
|
|
|
var queryList = list.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)).OrderByDescending(x => x.CreateTime);
|
|
|
|
|
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增箱型
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/commondb/addctn")]
|
|
|
|
|
public async Task AddCtn([FromBody] CodeCtnDto dto)
|
|
|
|
|
{
|
|
|
|
|
var entity = dto.Adapt<CodeCtn>();
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(entity.GID))
|
|
|
|
|
{
|
|
|
|
|
var model = _codeCtnRep.AsQueryable().InSingle(entity.GID);
|
|
|
|
|
|
|
|
|
|
if (model != null)
|
|
|
|
|
{
|
|
|
|
|
var checkModel = _codeCtnRep.AsQueryable().First(t => t.Code == entity.Code && t.GID != entity.GID);
|
|
|
|
|
|
|
|
|
|
if (checkModel != null)
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
|
|
|
|
|
await _codeCtnRep.AsUpdateable(entity).IgnoreColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.Code,
|
|
|
|
|
it.CreateTime,
|
|
|
|
|
it.CreateUser,
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
await GetAllCtn();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var model = _codeCtnRep.AsQueryable().First(t => t.Code == entity.Code);
|
|
|
|
|
if (model != null)
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
|
|
|
|
|
await _codeCtnRep.InsertAsync(entity);
|
|
|
|
|
|
|
|
|
|
await GetAllCtn();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取箱型映射列表信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/mappingctnlist")]
|
|
|
|
|
public async Task<dynamic> MappingCtnList([FromQuery] MappingQueryDto input)
|
|
|
|
|
{
|
|
|
|
|
//数量太多,不允许查询全部
|
|
|
|
|
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("参数过多,请传入模块查询");
|
|
|
|
|
}
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingCtn();
|
|
|
|
|
|
|
|
|
|
var queryList = list.Where(x => x.Module == input.Module)
|
|
|
|
|
.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))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.CarrierCode), x => x.CarrierCode == input.CarrierCode);
|
|
|
|
|
if (queryList.Count() > 20)
|
|
|
|
|
{
|
|
|
|
|
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增编辑箱型映射信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/commondb/addmappingctn")]
|
|
|
|
|
public async Task AddOrUpdateMappingCtn([FromBody] MappingCtnDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingCtn();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module && x.CarrierCode == dto.CarrierCode && x.GID != dto.GID).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<MappingCtn>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _mappingCtnRep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
entity.CreateTime = list.Where(x => x.GID == dto.GID).Select(x => x.CreateTime).FirstOrDefault();
|
|
|
|
|
entity.CreateUser = list.Where(x => x.GID == dto.GID).Select(x => x.CreateUser).FirstOrDefault();
|
|
|
|
|
entity.ModifyTime = DateTime.Now;
|
|
|
|
|
entity.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
List<CodeFrt> list = await _sysCacheService.GetAllCodeFrt();
|
|
|
|
|
|
|
|
|
|
var queryList = list.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));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (queryList.Count() > 20)
|
|
|
|
|
{
|
|
|
|
|
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增付费方式
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/commondb/addfrt")]
|
|
|
|
|
public async Task AddFrt([FromBody] CodeFrtDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeFrt();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code && x.GID != dto.GID).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<CodeFrt>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeFrtRep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
entity.CreateTime = list.Where(x => x.GID == dto.GID).Select(x => x.CreateTime).FirstOrDefault();
|
|
|
|
|
entity.CreateUser = list.Where(x => x.GID == dto.GID).Select(x => x.CreateUser).FirstOrDefault();
|
|
|
|
|
entity.ModifyTime = DateTime.Now;
|
|
|
|
|
entity.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeFrtRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await GetAllFrt();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取付费映射列表信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/mappingfrtlist")]
|
|
|
|
|
public async Task<dynamic> MappingFrtList([FromQuery] MappingQueryDto input)
|
|
|
|
|
{ //数量太多,不允许查询全部
|
|
|
|
|
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("参数过多,请传入模块查询");
|
|
|
|
|
}
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingFrt();
|
|
|
|
|
|
|
|
|
|
var queryList = list.Where(x => x.Module == input.Module)
|
|
|
|
|
.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))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.CarrierCode), x => x.CarrierCode == input.CarrierCode);
|
|
|
|
|
if (queryList.Count() > 20)
|
|
|
|
|
{
|
|
|
|
|
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增编辑付费映射信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/commondb/addmappingfrt")]
|
|
|
|
|
public async Task AddOrUpdateMappingFrt([FromBody] MappingFrtDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingFrt();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module && x.CarrierCode == dto.CarrierCode && x.GID != dto.GID).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<MappingFrt>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _mappingFrtRep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
entity.CreateTime = list.Where(x => x.GID == dto.GID).Select(x => x.CreateTime).FirstOrDefault();
|
|
|
|
|
entity.CreateUser = list.Where(x => x.GID == dto.GID).Select(x => x.CreateUser).FirstOrDefault();
|
|
|
|
|
entity.ModifyTime = DateTime.Now;
|
|
|
|
|
entity.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
await _mappingFrtRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
await GetAllMappingFrt();
|
|
|
|
|
}
|
|
|
|
|
#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.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.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增签单方式
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/commondb/addcodeissuetype")]
|
|
|
|
|
public async Task AddCodeIssueType([FromBody] CodeIssueTypeDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeIssueType();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code && x.GID != dto.GID).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<CodeIssueType>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeIssueTypeRep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
entity.CreateTime = list.Where(x => x.GID == dto.GID).Select(x => x.CreateTime).FirstOrDefault();
|
|
|
|
|
entity.CreateUser = list.Where(x => x.GID == dto.GID).Select(x => x.CreateUser).FirstOrDefault();
|
|
|
|
|
entity.ModifyTime = DateTime.Now;
|
|
|
|
|
entity.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeIssueTypeRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await GetAllCodeIssueType();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取签单方式映射列表信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/mappingIssueTypelist")]
|
|
|
|
|
public async Task<dynamic> MappingIssueTypeList([FromQuery] MappingQueryDto input)
|
|
|
|
|
{ //数量太多,不允许查询全部
|
|
|
|
|
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("参数过多,请传入模块查询");
|
|
|
|
|
}
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingIssueType();
|
|
|
|
|
|
|
|
|
|
var queryList = list.Where(x => x.Module == input.Module)
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.KeyWord), x => x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)
|
|
|
|
|
|| x.MapName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.CarrierCode), x => x.CarrierCode == input.CarrierCode);
|
|
|
|
|
if (queryList.Count() > 20)
|
|
|
|
|
{
|
|
|
|
|
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增编辑签单方式映射信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/commondb/addmappingIssueType")]
|
|
|
|
|
public async Task AddOrUpdateMappingIssueType([FromBody] MappingIssueTypeDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingIssueType();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code && x.Module == dto.Module && x.GID != dto.GID).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<MappingIssueType>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _mappingIssueTypeRep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
entity.CreateTime = list.Where(x => x.GID == dto.GID).Select(x => x.CreateTime).FirstOrDefault();
|
|
|
|
|
entity.CreateUser = list.Where(x => x.GID == dto.GID).Select(x => x.CreateUser).FirstOrDefault();
|
|
|
|
|
entity.ModifyTime = DateTime.Now;
|
|
|
|
|
entity.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
await _mappingIssueTypeRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
await GetAllMappingIssueType();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 获取省市
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取城市信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/CodeCityList")]
|
|
|
|
|
public async Task<dynamic> CodeCityList(string Provincecode, string name)
|
|
|
|
|
{
|
|
|
|
|
List<CodeCity> list = await _sysCacheService.GetAllCodeCity();
|
|
|
|
|
|
|
|
|
|
var queryList = list.WhereIF(!string.IsNullOrEmpty(Provincecode), x => x.ProvinceCode == Provincecode).WhereIF(!string.IsNullOrEmpty(name), x => x.CNName.Contains(name)).ToList();
|
|
|
|
|
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取省份信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/CodeProvinceList")]
|
|
|
|
|
public async Task<dynamic> CodeProvinceList(string name)
|
|
|
|
|
{
|
|
|
|
|
List<CodeProvince> list = await _sysCacheService.GetAllCodeProvince();
|
|
|
|
|
|
|
|
|
|
var queryList = list.Where(x => x.Country == "CN").WhereIF(!string.IsNullOrEmpty(name), x => x.CNName.Contains(name)).ToList();
|
|
|
|
|
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
#region 模块列表
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取模块信息
|
|
|
|
|
/// </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
|
|
|
|
|
|
|
|
|
|
#region 保存航线信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存航线信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="dto">航线</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/commondb/savecodelane")]
|
|
|
|
|
public async Task SaveCodeLane(CodeLaneDto dto)
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
基础数据只接受新增代码,不能更新代码
|
|
|
|
|
*/
|
|
|
|
|
var entity = dto.Adapt<CodeLane>();
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(entity.GID))
|
|
|
|
|
{
|
|
|
|
|
var model = _codeLaneRep.AsQueryable().InSingle(entity.GID);
|
|
|
|
|
|
|
|
|
|
if (model != null)
|
|
|
|
|
{
|
|
|
|
|
var checkModel = _codeLaneRep.AsQueryable().First(t => t.Code == entity.Code && t.GID != entity.GID);
|
|
|
|
|
|
|
|
|
|
if (checkModel != null)
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
|
|
|
|
|
await _codeLaneRep.AsUpdateable(entity).IgnoreColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.Code,
|
|
|
|
|
it.CreateTime,
|
|
|
|
|
it.CreateUser,
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
await GetAllLane();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var model = _codeLaneRep.AsQueryable().First(t => t.Code == entity.Code);
|
|
|
|
|
|
|
|
|
|
if (model != null)
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
|
|
|
|
|
await _codeLaneRep.InsertAsync(entity);
|
|
|
|
|
|
|
|
|
|
await GetAllLane();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 查询航线信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 查询航线信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input">查询条件</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<dynamic> CodeLaneList([FromQuery] NameQueryDto input)
|
|
|
|
|
{
|
|
|
|
|
List<CodeLane> list = await _sysCacheService.GetAllCodeLane();
|
|
|
|
|
|
|
|
|
|
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.KeyWord),
|
|
|
|
|
x => (!string.IsNullOrWhiteSpace(x.Code) && x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
|| (!string.IsNullOrWhiteSpace(x.EnName) && x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
|| (!string.IsNullOrWhiteSpace(x.CnName) && x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
|| (!string.IsNullOrWhiteSpace(x.LaneType) && x.LaneType.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return queryList.ToList();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 保存航线与港口的的关系表
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存航线与港口的的关系表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="dto">航线与港口的的关系表</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task SaveRelaPortCarrierLaneDto(RelaPortCarrierLaneDto dto)
|
|
|
|
|
{
|
|
|
|
|
var entity = dto.Adapt<RelaPortCarrierLane>();
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(entity.GID))
|
|
|
|
|
{
|
|
|
|
|
var model = _relaPortCarrierLaneRep.AsQueryable().InSingle(entity.GID);
|
|
|
|
|
|
|
|
|
|
if (model != null)
|
|
|
|
|
{
|
|
|
|
|
entity.ModifyTime = DateTime.Now;
|
|
|
|
|
entity.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
|
|
|
|
|
await _relaPortCarrierLaneRep.AsUpdateable(entity).IgnoreColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.CreateTime,
|
|
|
|
|
it.CreateUser,
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
await GetAllRelaPortCarrierLane();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var model = _relaPortCarrierLaneRep.AsQueryable().Where(t => t.LaneCode == entity.LaneCode
|
|
|
|
|
&& t.Module == entity.Module
|
|
|
|
|
&& t.CarrierCode == entity.CarrierCode
|
|
|
|
|
&& t.PortCode == entity.PortCode).First();
|
|
|
|
|
|
|
|
|
|
if (model != null)
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
|
|
|
|
|
await _relaPortCarrierLaneRep.InsertAsync(entity);
|
|
|
|
|
|
|
|
|
|
await GetAllRelaPortCarrierLane();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 查询航线与港口的的关系表
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 查询航线与港口的的关系表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input">查询条件</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<dynamic> RelaPortCarrierLaneDtoList([FromQuery] RelaPortCarrierLaneQueryDto input)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _sysCacheService.GetAllRelaPortCarrierLane();
|
|
|
|
|
//数量太多,不允许查询全部
|
|
|
|
|
//if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
|
|
|
|
|
//{
|
|
|
|
|
// throw Oops.Bah("参数过多,请传入模块查询");
|
|
|
|
|
//}
|
|
|
|
|
var queryList = list
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.Module), x => !string.IsNullOrWhiteSpace(x.Module) && x.Module.Equals(input.LaneCode, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.LaneCode), x => !string.IsNullOrWhiteSpace(x.LaneCode) && x.LaneCode.Contains(input.LaneCode, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.CarrierCode), x => !string.IsNullOrWhiteSpace(x.CarrierCode) && x.CarrierCode.Contains(input.CarrierCode, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.PortCode), x => !string.IsNullOrWhiteSpace(x.PortCode) && x.PortCode.Contains(input.PortCode, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.Module), x => !string.IsNullOrWhiteSpace(x.Module) && x.Module.Contains(input.Module, System.StringComparison.CurrentCultureIgnoreCase));
|
|
|
|
|
return queryList.ToList();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 保存起运港和船代的关系表
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存起运港和船代的关系表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="dto">起运港和船代的关系表</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/commondb/SaveRelaPortLoadForwarder")]
|
|
|
|
|
public async Task SaveRelaPortLoadForwarder(RelaPortLoadForwarderDto dto)
|
|
|
|
|
{
|
|
|
|
|
var entity = dto.Adapt<RelaPortLoadForwarder>();
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(entity.GID))
|
|
|
|
|
{
|
|
|
|
|
var model = _relaPortLoadForwarderRep.AsQueryable().InSingle(entity.GID);
|
|
|
|
|
|
|
|
|
|
if (model != null)
|
|
|
|
|
{
|
|
|
|
|
entity.ModifyTime = DateTime.Now;
|
|
|
|
|
entity.ModifyUser = UserManager.DjyUserId;
|
|
|
|
|
|
|
|
|
|
await _relaPortLoadForwarderRep.AsUpdateable(entity).IgnoreColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.CreateTime,
|
|
|
|
|
it.CreateUser,
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
await GetAllRelaPortLoadForwarder();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var model = _relaPortLoadForwarderRep.AsQueryable().Where(t => t.PortLoadCode == entity.PortLoadCode
|
|
|
|
|
&& t.Module == entity.Module
|
|
|
|
|
&& t.ForwarderCode == entity.ForwarderCode).First();
|
|
|
|
|
|
|
|
|
|
if (model != null)
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
|
|
|
|
|
await _relaPortLoadForwarderRep.InsertAsync(entity);
|
|
|
|
|
|
|
|
|
|
await GetAllRelaPortLoadForwarder();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 查询航线与港口的的关系表
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 查询起运港和船代的关系表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input">查询条件</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/commondb/RelaPortLoadForwarderList")]
|
|
|
|
|
public async Task<dynamic> RelaPortLoadForwarderList(RelaPortLoadForwarderQueryDto input)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllRelaPortLoadForwarder();
|
|
|
|
|
var queryList = list
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.Module), x => x.Module.Equals(input.Module, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.PortLoadCode), x => x.PortLoadCode.Contains(input.PortLoadCode, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.ForwarderCode), x => x.ForwarderCode.Contains(input.ForwarderCode, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
.ToList()
|
|
|
|
|
.Adapt<List<RelaPortLoadForwarderQueryOutput>>();
|
|
|
|
|
|
|
|
|
|
var portloadList = await _sysCacheService.GetAllCodePortLoad();
|
|
|
|
|
var forwarderList = await _sysCacheService.GetAllCodeForwarder();
|
|
|
|
|
foreach (var item in queryList)
|
|
|
|
|
{
|
|
|
|
|
item.Forwarder = forwarderList.FirstOrDefault(x => x.Code == item.ForwarderCode)?.Name;
|
|
|
|
|
item.PortLoad = portloadList.FirstOrDefault(x => x.Code == item.PortLoadCode)?.EnName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return queryList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 分页查询航线与港口对应关系表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/commondb/RelaPortLoadForwarderPage")]
|
|
|
|
|
public async Task<SqlSugarPagedList<RelaPortLoadForwarderPageOutput>> RelaPortLoadForwarderPage(RelaPortLoadForwarderPageDto input)
|
|
|
|
|
{
|
|
|
|
|
var entities = await _relaPortLoadForwarderRep.AsQueryable()
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.Module), x => x.Module.Equals(input.Module, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.PortLoadCode), x => x.PortLoadCode.Contains(input.PortLoadCode, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.ForwarderCode), x => x.ForwarderCode.Contains(input.ForwarderCode, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
.LeftJoin<CodePortLoad>((rela, pl) => rela.PortLoadCode == pl.Code)
|
|
|
|
|
.LeftJoin<CodeForwarder>((rela, pl, fwd) => rela.ForwarderCode == fwd.Code)
|
|
|
|
|
.Select((rela, pl, fwd) => new RelaPortLoadForwarderPageOutput
|
|
|
|
|
{
|
|
|
|
|
ForwarderCode = rela.ForwarderCode,
|
|
|
|
|
Forwarder = fwd.Name,
|
|
|
|
|
PortLoad = pl.EnName,
|
|
|
|
|
PortLoadCode = rela.PortLoadCode,
|
|
|
|
|
Module = rela.Module,
|
|
|
|
|
GID = rela.GID,
|
|
|
|
|
CreateTime = rela.CreateTime,
|
|
|
|
|
CreateUser = rela.CreateUser,
|
|
|
|
|
Remark = rela.Remark,
|
|
|
|
|
})
|
|
|
|
|
.ToPagedListAsync(input.PageNo, input.PageSize);
|
|
|
|
|
|
|
|
|
|
return entities;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 保存国家
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存国家
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="dto">国家</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/commondb/savecodecountry")]
|
|
|
|
|
public async Task SaveCodeCountry(CodeCountryDto dto)
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
基础数据只接受新增代码,不能更新代码
|
|
|
|
|
*/
|
|
|
|
|
var entity = dto.Adapt<CodeCountry>();
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(entity.GID))
|
|
|
|
|
{
|
|
|
|
|
var model = _codeCountryRep.AsQueryable().InSingle(entity.GID);
|
|
|
|
|
|
|
|
|
|
if (model != null)
|
|
|
|
|
{
|
|
|
|
|
var checkModel = _codeCountryRep.AsQueryable().Where(t => t.Code == entity.Code && t.GID != entity.GID).First();
|
|
|
|
|
|
|
|
|
|
if (checkModel != null)
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
|
|
|
|
|
await _codeCountryRep.AsUpdateable(entity).IgnoreColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.Code,
|
|
|
|
|
it.CreateTime,
|
|
|
|
|
it.CreateUser,
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
await GetAllCountry();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var model = _codeCountryRep.AsQueryable().Where(t => t.Code == entity.Code).First();
|
|
|
|
|
|
|
|
|
|
if (model != null)
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
|
|
|
|
|
await _codeCountryRep.InsertAsync(entity);
|
|
|
|
|
|
|
|
|
|
await GetAllCountry();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 查询国家
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 查询国家
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input">查询条件</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("/commondb/CodeCountryList")]
|
|
|
|
|
public async Task<dynamic> CodeCountryList([FromQuery] NameQueryDto input)
|
|
|
|
|
{
|
|
|
|
|
List<CodeCountry> list = await _sysCacheService.GetAllCodeCountry();
|
|
|
|
|
|
|
|
|
|
var queryList = list
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Code.ToUpper() == input.Name.ToUpper())
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.KeyWord),
|
|
|
|
|
x => (!string.IsNullOrWhiteSpace(x.Code) && x.Code.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
|| (!string.IsNullOrWhiteSpace(x.EnName) && x.EnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
|| (!string.IsNullOrWhiteSpace(x.CnName) && x.CnName.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
|| (!string.IsNullOrWhiteSpace(x.Capital) && x.Capital.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
|| (!string.IsNullOrWhiteSpace(x.Continent) && x.Continent.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return queryList.ToList();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 实现接口,获取公共数据并缓存
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllCarrier(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_CARRIER))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeCarrierRep.AsQueryable().OrderBy(x => x.CnName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeCarrier(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeCarrierRep.AsQueryable().OrderBy(x => x.CnName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeCarrier(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllMappingCarrier(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CARRIER))
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingCarrierRep.AsQueryable().OrderBy(x => x.MapName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingCarrier(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingCarrierRep.AsQueryable().OrderBy(x => x.MapName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingCarrier(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllVessel(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_VESSEL))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeVesselRep.AsQueryable().OrderBy(x => x.Name).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeVessel(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeVesselRep.AsQueryable().OrderBy(x => x.Name).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeVessel(list);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllMappingVessel(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_VESSEL))
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingVesselRep.AsQueryable().OrderBy(x => x.MapName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingVessel(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingVesselRep.AsQueryable().OrderBy(x => x.MapName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingVessel(list);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllMappingYard(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_YARD))
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingYardRep.AsQueryable().OrderBy(x => x.MapName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingYard(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingYardRep.AsQueryable().OrderBy(x => x.MapName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingYard(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllForwarder(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_FORWARDER))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeForwarderRep.AsQueryable().OrderBy(x => x.Name).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeForwarder(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _codeForwarderRep.AsQueryable().OrderBy(x => x.Name).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeForwarder(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllYard(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_YARD))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeYardRep.AsQueryable().OrderBy(x => x.Name).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeYard(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _codeYardRep.AsQueryable().OrderBy(x => x.Name).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeYard(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllPortload(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_PORTLOAD))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codePortLoadrRep.AsQueryable().OrderBy(x => x.CnName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodePortLoad(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _codePortLoadrRep.AsQueryable().OrderBy(x => x.CnName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodePortLoad(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllPort(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_PORT))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codePortRep.AsQueryable().OrderBy(x => x.CnName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodePort(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _codePortRep.AsQueryable().OrderBy(x => x.CnName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodePort(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllPackage(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_PACKAGE))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codePackageRep.AsQueryable().OrderBy(x => x.Name).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodePackage(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _codePackageRep.AsQueryable().OrderBy(x => x.Name).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodePackage(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllService(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_SERVICE))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeServiceRep.AsQueryable().OrderBy(x => x.Name).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeService(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeServiceRep.AsQueryable().OrderBy(x => x.Name).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeService(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllCtn(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_CTN))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeCtnRep.AsQueryable().OrderBy(x => x.Sort).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeCtn(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeCtnRep.AsQueryable().OrderBy(x => x.Sort).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeCtn(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取航线信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="flag"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllLane(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_LANE))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeLaneRep.AsQueryable().OrderBy(x => x.CnName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeLane(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeLaneRep.AsQueryable().OrderBy(x => x.CnName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeLane(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllRelaPortCarrierLane(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_LANE_PORT))
|
|
|
|
|
{
|
|
|
|
|
var list = await _relaPortCarrierLaneRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllRelaPortCarrierLane(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _relaPortCarrierLaneRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllRelaPortCarrierLane(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllRelaPortLoadForwarder(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_RELA_PORTLOAD_FORWARDER))
|
|
|
|
|
{
|
|
|
|
|
var list = await _relaPortLoadForwarderRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllRelaPortLoadForwarder(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _relaPortLoadForwarderRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllRelaPortLoadForwarder(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取国家
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="flag"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllCountry(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_COUNTRY))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeCountryRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeCountry(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeCountryRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeCountry(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllMappingCtn(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CTN))
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingCtnRep.AsQueryable().OrderBy(x => x.MapName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingCtn(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingCtnRep.AsQueryable().OrderBy(x => x.MapName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingCtn(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllFrt(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_FRT))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeFrtRep.AsQueryable().OrderBy(x => x.CnName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeFrt(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeFrtRep.AsQueryable().OrderBy(x => x.CnName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeFrt(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllMappingFrt(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_FRT))
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingFrtRep.AsQueryable().OrderBy(x => x.MapName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingFrt(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingFrtRep.AsQueryable().OrderBy(x => x.MapName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingFrt(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllMappingPortLoad(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_PORTLOAD))
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingPortLoadRep.AsQueryable().OrderBy(x => x.MapName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingPortLoad(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingPortLoadRep.AsQueryable().OrderBy(x => x.MapName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingPortLoad(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllMappingPort(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_PORT))
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingPortRep.AsQueryable().OrderBy(x => x.MapName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingPort(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingPortRep.AsQueryable().OrderBy(x => x.MapName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingPort(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllMappingPackage(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_PACKAGE))
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingPackageRep.AsQueryable().OrderBy(x => x.MapName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingPackage(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingPackageRep.AsQueryable().OrderBy(x => x.MapName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingPackage(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllMappingService(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_SERVICE))
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingServiceRep.AsQueryable().OrderBy(x => x.MapName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingService(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingServiceRep.AsQueryable().OrderBy(x => x.MapName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingService(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllCodeIssueType(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CODEISSUETYPE))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeIssueTypeRep.AsQueryable().OrderBy(x => x.CnName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeIssueType(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeIssueTypeRep.AsQueryable().OrderBy(x => x.CnName).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeIssueType(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllMappingIssueType(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_ISSUETYPE))
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingIssueTypeRep.AsQueryable().OrderBy(x => x.Sort).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingIssueType(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingIssueTypeRep.AsQueryable().OrderBy(x => x.Sort).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingIssueType(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllMappingForwarder(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_FORWARDER))
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingForwarder.AsQueryable().OrderBy(x => x.MapCode).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingForwarder(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _mappingForwarder.AsQueryable().OrderBy(x => x.MapCode).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingForwarder(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取城市信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="flag"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllCity(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_CITY))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeCityRep.AsQueryable().OrderBy(x => x.Sort).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeCity(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeCityRep.AsQueryable().OrderBy(x => x.Sort).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeCity(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取省份信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="flag"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task GetAllProvince(bool flag = false)
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
if (!_sysCacheService.Exists(CommonConst.CACHE_KEY_COMMON_DB_PROVINCE))
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeProvinceRep.AsQueryable().OrderBy(x => x.Sort).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeProvince(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var list = await _codeProvinceRep.AsQueryable().OrderBy(x => x.Sort).ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllCodeProvince(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 对外公开
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 公开数据:获取起运港映射代码
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/OpenGetMappingPortload"), AllowAnonymous, ApiUser(ApiCode = "CommonDbOpenData")]
|
|
|
|
|
public async Task<dynamic> OpenGetMappingPortload([FromQuery] OpenGetMappingPortLoadDto input)
|
|
|
|
|
{
|
|
|
|
|
List<MappingPortLoad> list = await _sysCacheService.GetAllMappingPortLoad();
|
|
|
|
|
|
|
|
|
|
var map = list.FirstOrDefault(x => x.Module == input.Module && x.Code == input.Code && x.CarrierCode == input.CarrierCode);
|
|
|
|
|
if (map != null)
|
|
|
|
|
{
|
|
|
|
|
return new { map.MapCode, map.MapName };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 公开数据:获取目的港映射代码
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/OpenGetMappingPort"), AllowAnonymous, ApiUser(ApiCode = "CommonDbOpenData")]
|
|
|
|
|
public async Task<dynamic> OpenGetMappingPort([FromQuery] OpenGetMappingPortLoadDto input)
|
|
|
|
|
{
|
|
|
|
|
List<MappingPort> list = await _sysCacheService.GetAllMappingPort();
|
|
|
|
|
|
|
|
|
|
var map = list.FirstOrDefault(x => x.Module == input.Module && x.Code == input.Code && x.CarrierCode == input.CarrierCode);
|
|
|
|
|
if (map != null)
|
|
|
|
|
{
|
|
|
|
|
return new { map.MapCode, map.MapName };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 公开数据:获取箱型映射代码
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/OpenGetMappingCtn"), AllowAnonymous, ApiUser(ApiCode = "CommonDbOpenData")]
|
|
|
|
|
public async Task<dynamic> OpenGetMappingCtn([FromQuery] OpenGetMappingCtnDto input)
|
|
|
|
|
{
|
|
|
|
|
List<MappingCtn> list = await _sysCacheService.GetAllMappingCtn();
|
|
|
|
|
|
|
|
|
|
var map = list.FirstOrDefault(x => x.Module == input.Module && x.Code == input.Code && x.CarrierCode == input.CarrierCode);
|
|
|
|
|
if (map != null)
|
|
|
|
|
{
|
|
|
|
|
return new { map.MapCode, map.MapName };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|