起运港和船代关系

master
wanghaomei 7 months ago
parent c0b1b837cc
commit 1e404692da

@ -9138,6 +9138,27 @@
<param name="input">查询条件</param>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.CommonDBService.SaveRelaPortLoadForwarder(Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderDto)">
<summary>
保存起运港和船代的关系表
</summary>
<param name="dto">起运港和船代的关系表</param>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.CommonDBService.RelaPortLoadForwarderList(Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderQueryDto)">
<summary>
查询起运港和船代的关系表
</summary>
<param name="input">查询条件</param>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.CommonDBService.RelaPortLoadForwarderPage(Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderPageDto)">
<summary>
分页查询航线与港口对应关系表
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.CommonDBService.SaveCodeCountry(Myshipping.Core.Service.CommonDB.Dto.CodeCountryDto)">
<summary>
保存国家
@ -10101,6 +10122,161 @@
模块(公用时为空字符串)
</summary>
</member>
<member name="T:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderDto">
<summary>
起运港和船代的关系表
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderDto.GID">
<summary>
主键
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderDto.PortLoadCode">
<summary>
起运港代码
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderDto.ForwarderCode">
<summary>
船代代码
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderDto.Module">
<summary>
模块(公用时为空字符串)
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderDto.Remark">
<summary>
备注
</summary>
</member>
<member name="T:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderQueryDto">
<summary>
查询起运港和船代的关系表
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderQueryDto.PortLoadCode">
<summary>
起运港代码
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderQueryDto.ForwarderCode">
<summary>
船代代码
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderQueryDto.Module">
<summary>
模块(公用时为空字符串)
</summary>
</member>
<member name="T:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderPageDto">
<summary>
分页查询起运港和船代的关系表
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderPageDto.PortLoadCode">
<summary>
起运港代码
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderPageDto.ForwarderCode">
<summary>
船代代码
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderPageDto.Module">
<summary>
模块(公用时为空字符串)
</summary>
</member>
<member name="T:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderQueryOutput">
<summary>
输出起运港和船代的关系表
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderQueryOutput.PortLoadCode">
<summary>
起运港代码
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderQueryOutput.PortLoad">
<summary>
起运港名称
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderQueryOutput.ForwarderCode">
<summary>
船代代码
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderQueryOutput.Forwarder">
<summary>
船代名称
</summary>
</member>
<member name="T:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderPageOutput">
<summary>
输出起运港和船代的关系表
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderPageOutput.GID">
<summary>
主键
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderPageOutput.PortLoadCode">
<summary>
起运港代码
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderPageOutput.PortLoad">
<summary>
起运港名称
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderPageOutput.ForwarderCode">
<summary>
船代代码
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderPageOutput.Forwarder">
<summary>
船代名称
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderPageOutput.Remark">
<summary>
备注
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderPageOutput.CreateTime">
<summary>
创建时间
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderPageOutput.ModifyTime">
<summary>
修改时间
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderPageOutput.CreateUser">
<summary>
创建人
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderPageOutput.ModifyUser">
<summary>
修改人
</summary>
</member>
<member name="P:Myshipping.Core.Service.CommonDB.Dto.RelaPortLoadForwarderPageOutput.Sort">
<summary>
排序
</summary>
</member>
<member name="P:Myshipping.Core.Service.NameQueryDto.KeyWord">
<summary>
关键字

@ -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>
/// 保存国家

@ -0,0 +1,172 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Core.Service.CommonDB.Dto
{
/// <summary>
/// 起运港和船代的关系表
/// </summary>
public class RelaPortLoadForwarderDto
{
/// <summary>
/// 主键
/// </summary>
public string GID { get; set; }
/// <summary>
/// 起运港代码
/// </summary>
public string PortLoadCode { get; set; }
/// <summary>
/// 船代代码
/// </summary>
public string ForwarderCode { get; set; }
/// <summary>
/// 模块(公用时为空字符串)
/// </summary>
public string Module { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
}
/// <summary>
/// 查询起运港和船代的关系表
/// </summary>
public class RelaPortLoadForwarderQueryDto
{
/// <summary>
/// 起运港代码
/// </summary>
public string PortLoadCode { get; set; }
/// <summary>
/// 船代代码
/// </summary>
public string ForwarderCode { get; set; }
/// <summary>
/// 模块(公用时为空字符串)
/// </summary>
public string Module { get; set; }
}
/// <summary>
/// 分页查询起运港和船代的关系表
/// </summary>
public class RelaPortLoadForwarderPageDto : PageInputBase
{
/// <summary>
/// 起运港代码
/// </summary>
public string PortLoadCode { get; set; }
/// <summary>
/// 船代代码
/// </summary>
public string ForwarderCode { get; set; }
/// <summary>
/// 模块(公用时为空字符串)
/// </summary>
public string Module { get; set; }
}
/// <summary>
/// 输出起运港和船代的关系表
/// </summary>
public class RelaPortLoadForwarderQueryOutput
{
/// <summary>
/// 起运港代码
/// </summary>
public string PortLoadCode { get; set; }
/// <summary>
/// 起运港名称
/// </summary>
public string PortLoad { get; set; }
/// <summary>
/// 船代代码
/// </summary>
public string ForwarderCode { get; set; }
/// <summary>
/// 船代名称
/// </summary>
public string Forwarder { get; set; }
}
/// <summary>
/// 输出起运港和船代的关系表
/// </summary>
public class RelaPortLoadForwarderPageOutput
{
/// <summary>
/// 主键
/// </summary>
public string GID { get; set; }
/// <summary>
/// 起运港代码
/// </summary>
public string PortLoadCode { get; set; }
/// <summary>
/// 起运港名称
/// </summary>
public string PortLoad { get; set; }
/// <summary>
/// 船代代码
/// </summary>
public string ForwarderCode { get; set; }
/// <summary>
/// 船代名称
/// </summary>
public string Forwarder { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public DateTime? ModifyTime { get; set; }
/// <summary>
/// 创建人
/// </summary>
public string CreateUser { get; set; }
/// <summary>
/// 修改人
/// </summary>
public string ModifyUser { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
}
}
Loading…
Cancel
Save