optimize
wet 2 years ago
parent 8703a50296
commit 61fb0f9578

@ -5163,17 +5163,17 @@ namespace Myshipping.Application
public async Task<dynamic> GetAllSelectData()
{
////报关行
var BGH = _djycustomer.Where(x => x.PropString == "customs_broker").Take(10).ToList();
var BGH = _djycustomer.Where(x => x.PropString.Contains("customs_broker")).Take(10).ToList();
//车队
var CD = _djycustomer.Where(x => x.PropString == "fleet").Take(10).ToList();
var CD = _djycustomer.Where(x => x.PropString.Contains("fleet")).Take(10).ToList();
//国外代理
var GWDL = _djycustomer.Where(x => x.PropString == "out_agent").Take(10).ToList();
var GWDL = _djycustomer.Where(x => x.PropString.Contains("out_agent")).Take(10).ToList();
//仓库
var CK = _djycustomer.Where(x => x.PropString == "warehouse").Take(10).ToList();
var CK = _djycustomer.Where(x => x.PropString.Contains("warehouse") ).Take(10).ToList();
var Portload = _cache.GetAllCodePortLoad().Result.Take(10).ToList();

@ -414,6 +414,9 @@ namespace Myshipping.Application
var userlist = await _repUser.AsQueryable().Filter(null, true).ToListAsync();
var list = await _repRight.AsQueryable().InnerJoin<BookingPrintTemplate>((d, t) => d.PrintTemplateId == t.Id && t.TenantId == UserManager.TENANT_ID).
WhereIF(userId != 0, d => d.SysUserId == userId).
WhereIF(!string.IsNullOrWhiteSpace(displayName), (d, t) => t.DisplayName.Contains(displayName)).
WhereIF(!string.IsNullOrWhiteSpace(cateCode), (d, t) => t.CateCode == cateCode).
WhereIF(!string.IsNullOrWhiteSpace(type), (d, t) => t.Type == type).
Select((d, t) => new BookingPrinttemplateDto
{
Id = d.Id,
@ -431,8 +434,7 @@ namespace Myshipping.Application
UserName = "",
}).ToListAsync();
list = list.WhereIF(!string.IsNullOrWhiteSpace(cateCode), x => x.CateCode == cateCode).WhereIF(!string.IsNullOrWhiteSpace(displayName), x => x.DisplayName.ToUpper().Contains(displayName.ToUpper())).
WhereIF(!string.IsNullOrWhiteSpace(type), x => x.Type == type).ToList();
foreach (var item in list)
{
var username = userlist.Where(x => x.Id == item.SysUserId).Select(x => x.Name).FirstOrDefault();

@ -40,7 +40,7 @@ namespace Myshipping.Application
[ApiDescriptionSettings("Application", Name = "DataSync", Order = 1), AllowAnonymous]
public class DataSyncService : IDynamicApiController, ITransient
{
private readonly ILogger<BookingOrderService> _logger;
private readonly ILogger<DataSyncService> _logger;
private readonly ISysCacheService _cache;
private readonly SqlSugarRepository<BookingOrder> _rep;
private readonly SqlSugarRepository<BookingCtn> _repCtn;
@ -57,7 +57,7 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<BookingGoodsStatus> _goodsStatus;
private readonly SqlSugarRepository<BookingGoodsStatusConfig> _goodsStatusConfig;
public DataSyncService(ILogger<BookingOrderService> logger, ISysCacheService cache, SqlSugarRepository<BookingOrder> rep, SqlSugarRepository<BookingCtn> repCtn,
public DataSyncService(ILogger<DataSyncService> logger, ISysCacheService cache, SqlSugarRepository<BookingOrder> rep, SqlSugarRepository<BookingCtn> repCtn,
SqlSugarRepository<SysUser> repUser, SqlSugarRepository<SysTenant> repTenant, SqlSugarRepository<DjyCustomer> djycustomer,
SqlSugarRepository<DjyCustomerContact> djycustomercontact, SqlSugarRepository<DjyVesselInfo> vesselinfo, SqlSugarRepository<BookingCtnDetail> ctndetailrep
, SqlSugarRepository<BookingEDIExt> bookingEDIExt, SqlSugarRepository<BookingLog> bookinglog, SqlSugarRepository<BookingLogDetail> bookinglogdetail,
@ -131,6 +131,7 @@ namespace Myshipping.Application
/// <param name="model"></param>
/// <returns></returns>
[HttpPost("/DataSync/SyncVesselDate"), ApiUser(ApiCode = "SyncVesselDate")]
[SqlSugarUnitOfWork]
public async Task<long> SyncVesselDate(DjyVesselInfoDto model)
{
@ -161,6 +162,78 @@ namespace Myshipping.Application
entity.Id = m.Id;
await _vesselinfo.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
////根据船公司船名航次更新船期信息
if (!string.IsNullOrEmpty(model.CARRIER) && !string.IsNullOrEmpty(model.Vessel) && (!string.IsNullOrEmpty(model.Voyno) || !string.IsNullOrWhiteSpace(model.VoynoInside)))
{
var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID && x.CARRIERID == model.CARRIERID && x.VESSEL == model.Vessel)
.WhereIF(!string.IsNullOrEmpty(model.Voyno), x => x.VOYNO == model.Voyno)
.WhereIF(!string.IsNullOrEmpty(model.VoynoInside), x => x.VOYNOINNER == model.VoynoInside).ToListAsync();
_logger.LogInformation($"同步船期_查询到{UserManager.TENANT_NAME}需要更新{order.Count()}条订舱数据");
foreach (var item in order)
{
//更新订舱船期
if (item.ETD != model.ETD)
{
item.ETD = model.ETD;
}
if (item.ATD != model.ATD)
{
item.ATD = model.ATD;
}
await _rep.AsUpdateable(item).IgnoreColumns(it => new
{
it.ParentId,
it.TenantId,
it.CreatedTime,
it.CreatedUserId,
it.CreatedUserName,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName,
it.TenantName,
it.IsDeleted,
it.BOOKINGNO
}).ExecuteCommandAsync();
//记录日志
////添加booking日志
var bid = await _bookinglog.InsertReturnSnowflakeIdAsync(new BookingLog
{
Type = "Edit",
BookingId = item.Id,
TenantId = Convert.ToInt64(UserManager.TENANT_ID),
CreatedTime = DateTime.Now,
CreatedUserId = UserManager.UserId,
CreatedUserName = UserManager.Name
});
if (item.ETD != model.ETD)
{
await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
{
PId = bid,
Field = "ETD",
OldValue = item.ETD != null ? item.ETD.ToSqlValue() : null,
NewValue = model.ETD != null ? model.ETD.ToSqlValue() : null,
});
}
if (item.ATD != model.ATD)
{
await _bookinglogdetail.InsertReturnSnowflakeIdAsync(new BookingLogDetail
{
PId = bid,
Field = "ATD",
OldValue = item.ATD != null ? item.ATD.ToSqlValue() : null,
NewValue = model.ATD != null ? model.ATD.ToSqlValue() : null,
});
}
}
}
return entity.Id;
}
@ -1805,6 +1878,7 @@ namespace Myshipping.Application
public async Task<string> Test()
{
return $"当前用户:{UserManager.UserId} {UserManager.Name} ,当前租户:{UserManager.TENANT_ID} {UserManager.TENANT_NAME},管理员类型:{(UserManager.IsSuperAdmin ? "" : (UserManager.IsTenantAdmin ? "" : ""))}";
}
#endregion
}

Loading…
Cancel
Save