|
|
|
@ -124,16 +124,27 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
public async Task AddCarrier([FromBody] CodeCarrierDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeCarrier();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code).Count();
|
|
|
|
|
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>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeCarrierRep.InsertAsync(entity);
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -177,6 +188,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
}
|
|
|
|
|
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();
|
|
|
|
@ -212,16 +225,27 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
public async Task AddVessel([FromBody] CodeVesselDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeVessel();
|
|
|
|
|
var count = list.Where(x => x.Name.Trim() == dto.Name.Trim()).Count();
|
|
|
|
|
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>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeVesselRep.InsertAsync(entity);
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -272,6 +296,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
}
|
|
|
|
|
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();
|
|
|
|
@ -303,16 +329,29 @@ 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).Count();
|
|
|
|
|
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>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeForwarderRep.InsertAsync(entity);
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
@ -339,16 +378,30 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeYard();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code).Count();
|
|
|
|
|
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>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeYardRep.InsertAsync(entity);
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -396,6 +449,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
}
|
|
|
|
|
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();
|
|
|
|
@ -430,16 +485,29 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
public async Task AddPortload([FromBody] CodePortLoadDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodePortLoad();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code ).Count();
|
|
|
|
|
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>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _codePortLoadrRep.InsertAsync(entity);
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -487,6 +555,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
}
|
|
|
|
|
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();
|
|
|
|
@ -525,16 +595,29 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
public async Task AddPort([FromBody] CodePortDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodePort();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code ).Count();
|
|
|
|
|
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>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _codePortRep.InsertAsync(entity);
|
|
|
|
|
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>
|
|
|
|
@ -581,6 +664,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
}
|
|
|
|
|
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();
|
|
|
|
@ -611,14 +696,27 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
public async Task AddPackage([FromBody] CodePackageDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodePackage();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code ).Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
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>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
await _codePackageRep.InsertAsync(entity);
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -667,6 +765,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
}
|
|
|
|
|
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();
|
|
|
|
@ -698,16 +798,29 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
public async Task AddService([FromBody] CodeServiceDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeService();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code ).Count();
|
|
|
|
|
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>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeServiceRep.InsertAsync(entity);
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -755,6 +868,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
}
|
|
|
|
|
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();
|
|
|
|
@ -813,7 +928,6 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var model = _codeCtnRep.AsQueryable().First(t => t.Code == entity.Code);
|
|
|
|
|
|
|
|
|
|
if (model != null)
|
|
|
|
|
throw Oops.Bah(ErrorCode.D1006);
|
|
|
|
|
|
|
|
|
@ -871,6 +985,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
}
|
|
|
|
|
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();
|
|
|
|
@ -906,16 +1022,28 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
public async Task AddFrt([FromBody] CodeFrtDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeFrt();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code ).Count();
|
|
|
|
|
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>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeFrtRep.InsertAsync(entity);
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -959,6 +1087,8 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
}
|
|
|
|
|
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();
|
|
|
|
@ -990,16 +1120,27 @@ public class CommonDBService : ICommonDBService, IDynamicApiController, ITransie
|
|
|
|
|
public async Task AddCodeIssueType([FromBody] CodeIssueTypeDto dto)
|
|
|
|
|
{
|
|
|
|
|
var list = await _sysCacheService.GetAllCodeIssueType();
|
|
|
|
|
var count = list.Where(x => x.Code == dto.Code ).Count();
|
|
|
|
|
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>();
|
|
|
|
|
entity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
entity.CreateTime = DateTime.Now;
|
|
|
|
|
entity.CreateUser = UserManager.DjyUserId;
|
|
|
|
|
await _codeIssueTypeRep.InsertAsync(entity);
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|