|
|
|
@ -50,9 +50,11 @@ namespace Myshipping.Application
|
|
|
|
|
private readonly SqlSugarRepository<BookingOrderSeaeEdiCtn> _seaeedictn;
|
|
|
|
|
private readonly ISysCacheService _cache;
|
|
|
|
|
private readonly SqlSugarRepository<BookingStatusLog> _repStatuslog;
|
|
|
|
|
private readonly SqlSugarRepository<BookingOrderSeaeEdiTemplate> _repTemplate;
|
|
|
|
|
private readonly IDjyWebsiteAccountConfigService _webAccountConfig;
|
|
|
|
|
public BookingOrderSeaeEdiService(ILogger<BookingOrderSeaeEdiService> logger, SqlSugarRepository<BookingOrderSeaeEdi> seaeedi,
|
|
|
|
|
SqlSugarRepository<BookingOrderSeaeEdiCtn> seaeedictn, ISysCacheService cache, SqlSugarRepository<BookingStatusLog> repStatuslog,
|
|
|
|
|
SqlSugarRepository<BookingOrderSeaeEdiTemplate> repTemplate,
|
|
|
|
|
IDjyWebsiteAccountConfigService webAccountConfig)
|
|
|
|
|
{
|
|
|
|
|
this._logger = logger;
|
|
|
|
@ -61,7 +63,7 @@ namespace Myshipping.Application
|
|
|
|
|
this._cache = cache;
|
|
|
|
|
this._repStatuslog = repStatuslog;
|
|
|
|
|
this._webAccountConfig = webAccountConfig;
|
|
|
|
|
|
|
|
|
|
this._repTemplate = repTemplate;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取数据
|
|
|
|
@ -113,6 +115,12 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
entity.CARRIER = _cache.GetAllCodeCarrier().Result.Where(x => x.Code == entity.CARRIERID).Select(x => x.EdiCode).FirstOrDefault();
|
|
|
|
|
}
|
|
|
|
|
if (entity.CARGOID!="D") {
|
|
|
|
|
|
|
|
|
|
entity.DCLASS = string.Empty;
|
|
|
|
|
entity.DUNNO = string.Empty;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _seaeedi.InsertAsync(entity);
|
|
|
|
|
if (input.EdiCtn != null)
|
|
|
|
@ -145,6 +153,12 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
entity.CARRIER = _cache.GetAllCodeCarrier().Result.Where(x => x.Code == entity.CARRIERID).Select(x => x.EdiCode).FirstOrDefault();
|
|
|
|
|
}
|
|
|
|
|
if (entity.CARGOID != "D")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
entity.DCLASS = string.Empty;
|
|
|
|
|
entity.DUNNO = string.Empty;
|
|
|
|
|
}
|
|
|
|
|
await _seaeedi.AsUpdateable(entity).IgnoreColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.MBLNO,
|
|
|
|
@ -368,5 +382,103 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 模板
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取模板数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet("/BookingOrderSeaeEdi/GetBookingOrderSeaeEdiTemplateList")]
|
|
|
|
|
public async Task<List<BookingOrderSeaeEdiTemplateDto>> GetBookingOrderSeaeEdiTemplateList(string type, string templatename = null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var entities = await _repTemplate.AsQueryable().Where(x => x.Type == type).
|
|
|
|
|
WhereIF(!string.IsNullOrEmpty(templatename), x => x.TemplateName.Contains(templatename)).
|
|
|
|
|
ToListAsync();
|
|
|
|
|
var list = entities.Adapt<List<BookingOrderSeaeEdiTemplateDto>>();
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/BookingOrderSeaeEdi/SaveBookingOrderSeaeEdiTemplate")]
|
|
|
|
|
public async Task SaveBookingOrderSeaeEdiTemplate(BookingOrderSeaeEdiTemplateDto input)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (input == null)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("请传入正常数据!");
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(input.TemplateNAME))
|
|
|
|
|
{
|
|
|
|
|
var et = await _repTemplate.Where(x => x.TemplateName == input.TemplateNAME && x.Id != input.Id).FirstAsync();
|
|
|
|
|
if (et != null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
throw Oops.Bah("当前模板名称已存在,请勿重复录入!");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var entity = input.Adapt<BookingOrderSeaeEdiTemplate>();
|
|
|
|
|
|
|
|
|
|
if (input.Id == 0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _repTemplate.InsertAsync(entity);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
await _repTemplate.AsUpdateable(entity).IgnoreColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.TenantId,
|
|
|
|
|
it.CreatedTime,
|
|
|
|
|
it.CreatedUserId,
|
|
|
|
|
it.CreatedUserName,
|
|
|
|
|
it.IsDeleted
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除舱单
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="Ids"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[SqlSugarUnitOfWork]
|
|
|
|
|
|
|
|
|
|
[HttpPost("/BookingOrderSeaeEdi/DeleteBookingOrderSeaeEdiTemplate")]
|
|
|
|
|
public async Task DeleteBookingOrderSeaeEdiTemplate(string Ids)
|
|
|
|
|
{
|
|
|
|
|
var arr = Ids.Split(",");
|
|
|
|
|
if (arr.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var ar in arr)
|
|
|
|
|
{
|
|
|
|
|
long Id = Convert.ToInt64(ar);
|
|
|
|
|
await _repTemplate.UpdateAsync(x => x.Id == Id, x => new BookingOrderSeaeEdiTemplate { IsDeleted = true });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|