|
|
|
@ -27,6 +27,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
@ -53,6 +54,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
SqlSugarRepository<MappingVessel> mappingVesselRep,
|
|
|
|
|
SqlSugarRepository<MappingCtn> mappingCtnRep,
|
|
|
|
|
SqlSugarRepository<MappingFrt> mappingFrtRep,
|
|
|
|
|
SqlSugarRepository<MappingYard> mappingYardRep,
|
|
|
|
|
ISysCacheService sysCacheService)
|
|
|
|
|
{
|
|
|
|
|
_codeCarrierRep = codeCarrierRep;
|
|
|
|
@ -69,6 +71,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
_mappingVesselRep = mappingVesselRep;
|
|
|
|
|
_mappingCtnRep = mappingCtnRep;
|
|
|
|
|
_mappingFrtRep = mappingFrtRep;
|
|
|
|
|
_mappingYardRep = mappingYardRep;
|
|
|
|
|
_sysCacheService = sysCacheService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -96,6 +99,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
public async Task AddCarrier([FromBody] CodeCarrier dto)
|
|
|
|
|
{
|
|
|
|
|
var entity = dto.Adapt<CodeCarrier>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
await _codeCarrierRep.InsertAsync(entity);
|
|
|
|
|
await GetAllCarrier();
|
|
|
|
|
}
|
|
|
|
@ -125,6 +129,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
var entity = dto.Adapt<MappingCarrier>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
await _mappingCarrierRep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -167,6 +172,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
public async Task AddVessel([FromBody] CodeVessel dto)
|
|
|
|
|
{
|
|
|
|
|
var entity = dto.Adapt<CodeVessel>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
await _codeVesselRep.InsertAsync(entity);
|
|
|
|
|
await GetAllVessel();
|
|
|
|
|
}
|
|
|
|
@ -200,6 +206,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
var entity = dto.Adapt<MappingVessel>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
await _mappingVesselRep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -235,6 +242,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
public async Task AddForwarder([FromBody] CodeForwarder dto)
|
|
|
|
|
{
|
|
|
|
|
var entity = dto.Adapt<CodeForwarder>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
await _codeForwarderRep.InsertAsync(entity);
|
|
|
|
|
await GetAllForwarder();
|
|
|
|
|
}
|
|
|
|
@ -262,9 +270,53 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
public async Task AddYard([FromBody] CodeYard dto)
|
|
|
|
|
{
|
|
|
|
|
var entity = dto.Adapt<CodeYard>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
await _codeYardRep.InsertAsync(entity);
|
|
|
|
|
await GetAllYard();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取场站映射
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpGet("/commondb/mappingyardlist")]
|
|
|
|
|
public async Task<dynamic> MappingYardList([FromQuery] MappingQueryDto input)
|
|
|
|
|
{
|
|
|
|
|
//数量太多,不允许查询全部
|
|
|
|
|
if (string.IsNullOrEmpty(input.Module) || input.Module.Length < 1)
|
|
|
|
|
{
|
|
|
|
|
return new List<MappingYard>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<MappingYard> list = await _sysCacheService.GetAllMappingYard();
|
|
|
|
|
|
|
|
|
|
var queryList = list.WhereIF(!string.IsNullOrEmpty(input.Module), x => x.Module == input.Module)
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(input.MapName), x => x.Name.Contains(input.MapName, System.StringComparison.CurrentCultureIgnoreCase));
|
|
|
|
|
|
|
|
|
|
return queryList.ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增编辑场站映射信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/commondb/addorupdateyard")]
|
|
|
|
|
public async Task AddOrUpdateMappingYard([FromBody] MappingYard dto)
|
|
|
|
|
{
|
|
|
|
|
var entity = dto.Adapt<MappingYard>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
await _mappingYardRep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
await _mappingYardRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
await GetAllMappingYard();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -288,6 +340,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
public async Task AddPortload([FromBody] CodePortLoad dto)
|
|
|
|
|
{
|
|
|
|
|
var entity = dto.Adapt<CodePortLoad>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
await _codePortLoadrRep.InsertAsync(entity);
|
|
|
|
|
await GetAllPortload();
|
|
|
|
|
}
|
|
|
|
@ -321,6 +374,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
public async Task AddPort([FromBody] CodePort dto)
|
|
|
|
|
{
|
|
|
|
|
var entity = dto.Adapt<CodePort>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
await _codePortRep.InsertAsync(entity);
|
|
|
|
|
await GetAllPort();
|
|
|
|
|
}
|
|
|
|
@ -348,6 +402,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
public async Task AddPackage([FromBody] CodePackage dto)
|
|
|
|
|
{
|
|
|
|
|
var entity = dto.Adapt<CodePackage>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
await _codePackageRep.InsertAsync(entity);
|
|
|
|
|
await GetAllPackage();
|
|
|
|
|
}
|
|
|
|
@ -375,6 +430,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
public async Task AddService([FromBody] CodeService dto)
|
|
|
|
|
{
|
|
|
|
|
var entity = dto.Adapt<CodeService>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
await _codeServiceRep.InsertAsync(entity);
|
|
|
|
|
await GetAllService();
|
|
|
|
|
}
|
|
|
|
@ -404,6 +460,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
public async Task AddCtn([FromBody] CodeCtn dto)
|
|
|
|
|
{
|
|
|
|
|
var entity = dto.Adapt<CodeCtn>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
await _codeCtnRep.InsertAsync(entity);
|
|
|
|
|
await GetAllCtn();
|
|
|
|
|
}
|
|
|
|
@ -435,6 +492,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
var entity = dto.Adapt<MappingCtn>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
await _mappingCtnRep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -470,6 +528,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
public async Task AddFrt([FromBody] CodeFrt dto)
|
|
|
|
|
{
|
|
|
|
|
var entity = dto.Adapt<CodeFrt>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
await _codeFrtRep.InsertAsync(entity);
|
|
|
|
|
await GetAllFrt();
|
|
|
|
|
}
|
|
|
|
@ -500,6 +559,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
var entity = dto.Adapt<MappingFrt>();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(dto.GID))
|
|
|
|
|
{
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
await _mappingFrtRep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -550,7 +610,15 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
return list;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<MappingYard>> GetAllMappingYard()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _mappingYardRep.ToListAsync();
|
|
|
|
|
await _sysCacheService.SetAllMappingYard(list);
|
|
|
|
|
return list;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
[NonAction]
|
|
|
|
|
public async Task<List<CodeForwarder>> GetAllForwarder()
|
|
|
|
|
{
|
|
|
|
|