|
|
|
@ -137,9 +137,10 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeCarrierRep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
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.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();
|
|
|
|
@ -179,7 +180,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingCarrier();
|
|
|
|
|
var count = list.Where(x => x.Module == dto.Module && x.Code == dto.Code && x.GID != dto.GID).Count();
|
|
|
|
|
if (count>0) {
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
|
var entity = dto.Adapt<MappingCarrier>();
|
|
|
|
@ -223,7 +225,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
{
|
|
|
|
|
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
return queryList.OrderBy(x=>x.Sort).Take(10).ToList();
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).Take(10).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -291,7 +293,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingVessel();
|
|
|
|
|
var count = list.Where(x => x.Name == dto.Name.Trim()&&x.Module==dto.Module && x.GID != dto.GID).Count();
|
|
|
|
|
var count = list.Where(x => x.Name == dto.Name.Trim() && x.Module == dto.Module && x.GID != dto.GID).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
@ -344,7 +346,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
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();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code && x.GID != dto.GID).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
@ -357,7 +359,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeForwarderRep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
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();
|
|
|
|
@ -406,7 +409,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
await _codeYardRep.InsertAsync(entity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
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;
|
|
|
|
@ -450,7 +454,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _sysCacheService.GetAllMappingYard();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code&&x.Module==dto.Module && x.GID != dto.GID).Count();
|
|
|
|
|
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);
|
|
|
|
@ -487,13 +491,13 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
public async Task<dynamic> PortloadList([FromQuery] NameQueryDto input)
|
|
|
|
|
{
|
|
|
|
|
List<CodePortLoad> list = await _sysCacheService.GetAllCodePortLoad();
|
|
|
|
|
_logger.LogInformation("起始港1:"+DateTime.Now.ToString());
|
|
|
|
|
_logger.LogInformation("起始港1:" + DateTime.Now.ToString());
|
|
|
|
|
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());
|
|
|
|
|
_logger.LogInformation("起始港2:" + DateTime.Now.ToString());
|
|
|
|
|
if (queryList.Count() > 20)
|
|
|
|
|
{
|
|
|
|
|
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
|
|
|
|
@ -520,7 +524,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _codePortLoadrRep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
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();
|
|
|
|
@ -565,7 +570,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
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();
|
|
|
|
|
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);
|
|
|
|
@ -601,17 +606,42 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
public async Task<dynamic> PortList([FromQuery] NameQueryDto input)
|
|
|
|
|
{
|
|
|
|
|
List<CodePort> list = await _sysCacheService.GetAllCodePort();
|
|
|
|
|
if (string.IsNullOrWhiteSpace(input.KeyWord)) {
|
|
|
|
|
|
|
|
|
|
return list.Take(10);
|
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
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));
|
|
|
|
|
if (queryList.Count()>20) {
|
|
|
|
|
return queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
|
|
|
|
|
if (queryList.Count() > 20)
|
|
|
|
|
{
|
|
|
|
|
result = queryList.Take(input.Limit).OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -636,7 +666,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
await _codePortRep.InsertAsync(entity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
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;
|
|
|
|
@ -679,7 +710,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
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();
|
|
|
|
|
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);
|
|
|
|
@ -716,7 +747,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
|
|
|
|
|
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));
|
|
|
|
|
return queryList.OrderBy(x=>x.Sort).ToList();
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增包装信息
|
|
|
|
@ -726,7 +757,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodePackage();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code && x.GID != dto.GID).Count();
|
|
|
|
|
if (count > 0 )
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
}
|
|
|
|
@ -782,7 +813,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
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();
|
|
|
|
|
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);
|
|
|
|
@ -846,7 +877,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
await _codeServiceRep.InsertAsync(entity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
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();
|
|
|
|
@ -890,7 +922,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
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();
|
|
|
|
|
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);
|
|
|
|
@ -926,7 +958,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
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);
|
|
|
|
|
|| x.EdiCode.Contains(input.KeyWord, System.StringComparison.CurrentCultureIgnoreCase)).OrderByDescending(x => x.CreateTime);
|
|
|
|
|
|
|
|
|
|
return queryList.OrderBy(x => x.Sort).ToList();
|
|
|
|
|
}
|
|
|
|
@ -1009,7 +1041,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
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();
|
|
|
|
|
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);
|
|
|
|
@ -1077,7 +1109,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeFrtRep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
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();
|
|
|
|
@ -1118,7 +1151,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
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();
|
|
|
|
|
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);
|
|
|
|
@ -1178,7 +1211,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeIssueTypeRep.InsertAsync(entity);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
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;
|
|
|
|
@ -1217,7 +1251,7 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
*/
|
|
|
|
|
var entity = dto.Adapt<CodeLane>();
|
|
|
|
|
|
|
|
|
|
if(!string.IsNullOrWhiteSpace(entity.GID))
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(entity.GID))
|
|
|
|
|
{
|
|
|
|
|
var model = _codeLaneRep.AsQueryable().InSingle(entity.GID);
|
|
|
|
|
|
|
|
|
@ -1240,9 +1274,9 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var model = _codeLaneRep.AsQueryable().First(t=>t.Code == entity.Code);
|
|
|
|
|
var model = _codeLaneRep.AsQueryable().First(t => t.Code == entity.Code);
|
|
|
|
|
|
|
|
|
|
if(model != null)
|
|
|
|
|
if (model != null)
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|