|
|
|
@ -84,7 +84,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
SqlSugarRepository<CodeProvince> codeProvinceRep,
|
|
|
|
|
SqlSugarRepository<RelaPortLoadForwarder> relaPortLoadForwarderRep
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
_codeCarrierRep = codeCarrierRep;
|
|
|
|
|
_codeVesselRep = codeVesselRep;
|
|
|
|
|
_codeForwarderRep = codeForwarderRep;
|
|
|
|
@ -1374,7 +1374,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
/// 获取城市信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/CodeCityList")]
|
|
|
|
|
public async Task<dynamic> CodeCityList(string Provincecode,string name)
|
|
|
|
|
public async Task<dynamic> CodeCityList(string Provincecode, string name)
|
|
|
|
|
{
|
|
|
|
|
List<CodeCity> list = await _sysCacheService.GetAllCodeCity();
|
|
|
|
|
|
|
|
|
@ -1391,7 +1391,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
{
|
|
|
|
|
List<CodeProvince> list = await _sysCacheService.GetAllCodeProvince();
|
|
|
|
|
|
|
|
|
|
var queryList = list.Where( x => x.Country == "CN").WhereIF(!string.IsNullOrEmpty(name), x => x.CNName.Contains(name)).ToList();
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
@ -1560,6 +1560,116 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
}
|
|
|
|
|
#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,
|
|
|
|
|
GID = rela.GID,
|
|
|
|
|
CreateTime = rela.CreateTime,
|
|
|
|
|
CreateUser = rela.CreateUser,
|
|
|
|
|
Remark = rela.Remark,
|
|
|
|
|
})
|
|
|
|
|
.ToPagedListAsync(input.PageNo, input.PageSize);
|
|
|
|
|
|
|
|
|
|
return entities;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 保存国家
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存国家
|
|
|
|
|