improvements, fixes
This commit is contained in:
parent
22307c2318
commit
3b0b9ccd10
|
|
@ -50,6 +50,26 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Controllers
|
|||
return await measurementService.ProcessAndSaveFullShippingJson(fullShippingJson, customerId);
|
||||
}
|
||||
|
||||
[SignalR(SignalRTags.GetGenericAttributeDtosByEntityIdAndKeyGroup)]
|
||||
public async Task<List<GenericAttributeDto>> GetGenericAttributeDtosByEntityIdAndKeyGroup(int productId, string keyGroup, int storeId)
|
||||
{
|
||||
return await ctx.GetGenericAttributeDtosByEntityIdAndKeyGroup(productId, keyGroup, storeId);
|
||||
}
|
||||
|
||||
[SignalR(SignalRTags.AddGenericAttributeDto)]
|
||||
public async Task<GenericAttributeDto> AddGenericAttributeDto(GenericAttributeDto genericAttributeDto)
|
||||
{
|
||||
await ctx.GenericAttributeDtos.InsertAsync(genericAttributeDto);
|
||||
return await ctx.GenericAttributeDtos.GetByIdAsync(genericAttributeDto.Id);
|
||||
}
|
||||
|
||||
[SignalR(SignalRTags.UpdateGenericAttributeDto)]
|
||||
public async Task<GenericAttributeDto> UpdateGenericAttributeDto(GenericAttributeDto genericAttributeDto)
|
||||
{
|
||||
await ctx.GenericAttributeDtos.UpdateAsync(genericAttributeDto);
|
||||
return await ctx.GenericAttributeDtos.GetByIdAsync(genericAttributeDto.Id);
|
||||
}
|
||||
|
||||
[SignalR(SignalRTags.GetMeasuringModels)]
|
||||
public Task<List<MeasuringModel>> GetMeasuringModels()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ public class FruitBankDbContext : MgDbContextBase,
|
|||
public IRepository<CustomerAddressMapping> CustomerAddressMappings { get; set; }
|
||||
|
||||
public IRepository<GenericAttribute> GenericAttributes { get; set; }
|
||||
public IRepository<GenericAttributeDto> GenericAttributeDtos { get; set; }
|
||||
public IRepository<StockQuantityHistory> StockQuantityHistories { get; set; }
|
||||
public IRepository<StockQuantityHistoryExt> StockQuantityHistoriesExt { get; set; }
|
||||
|
||||
|
|
@ -86,6 +87,7 @@ public class FruitBankDbContext : MgDbContextBase,
|
|||
IRepository<CustomerAddressMapping> customerAddressMappingRepository,
|
||||
IRepository<CustomerRole> customerRoleRepository,
|
||||
IRepository<GenericAttribute> genericAttributes,
|
||||
IRepository<GenericAttributeDto> genericAttributeDtos,
|
||||
IRepository<StockQuantityHistory> stockQuantityHistories,
|
||||
IRepository<StockQuantityHistoryExt> stockQuantityHistoriesExt,
|
||||
IEventPublisher eventPublisher,
|
||||
|
|
@ -119,6 +121,7 @@ public class FruitBankDbContext : MgDbContextBase,
|
|||
CustomerAddressMappings = customerAddressMappingRepository;
|
||||
|
||||
GenericAttributes = genericAttributes;
|
||||
GenericAttributeDtos = genericAttributeDtos;
|
||||
|
||||
StockQuantityHistories = stockQuantityHistories;
|
||||
StockQuantityHistoriesExt = stockQuantityHistoriesExt;
|
||||
|
|
@ -676,7 +679,17 @@ public class FruitBankDbContext : MgDbContextBase,
|
|||
productDto.StockQuantity += quantityToChange;
|
||||
|
||||
if (weightToChange == 0) return;
|
||||
productDto.GenericAttributes = await GenericAttributes.Table.Where(x => x.EntityId == productDto.Id && x.KeyGroup == nameof(Product) && x.StoreId == _storeContext.GetCurrentStore().Id).ToListAsync();
|
||||
productDto.GenericAttributes = await GetGenericAttributeDtosByEntityIdAndKeyGroup(productDto.Id, nameof(Product), (await _storeContext.GetCurrentStoreAsync()).Id);
|
||||
}
|
||||
|
||||
public async Task<List<GenericAttributeDto>> GetGenericAttributeDtosByEntityIdAndKeyGroup(int entityId, string keyGroup, int? storeId = null) //TODO: StoreId!!! - J.
|
||||
{
|
||||
storeId ??= (await _storeContext.GetCurrentStoreAsync()).Id;
|
||||
|
||||
var result = await GenericAttributeDtos.Table
|
||||
.Where(x => x.KeyGroup == keyGroup && x.EntityId == entityId && x.StoreId == storeId.Value).ToListAsync();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task UpdateStockQuantityAndWeightAsync(Product product, int quantityToChange, string message, double weightToChange = 0)
|
||||
|
|
|
|||
|
|
@ -120,11 +120,12 @@ public class PluginNopStartup : INopStartup
|
|||
services.AddSignalR(hubOptions =>
|
||||
{
|
||||
hubOptions.EnableDetailedErrors = true;
|
||||
hubOptions.MaximumReceiveMessageSize = null; // 256 * 1024;
|
||||
hubOptions.MaximumReceiveMessageSize = 30_000_000; // 256 * 1024; unlimited: null;
|
||||
hubOptions.KeepAliveInterval = TimeSpan.FromSeconds(FruitBankConstClient.SignalRKeepAliveIntervalSecond);
|
||||
hubOptions.ClientTimeoutInterval = TimeSpan.FromSeconds(FruitBankConstClient.SignarlRTimeoutIntervalSecond);
|
||||
|
||||
//hubOptions.MaximumParallelInvocationsPerClient = 1; //default: 1;
|
||||
//hubOptions.StatefulReconnectBufferSize = 1_000_000; //default: 100,000 bytes;
|
||||
hubOptions.StatefulReconnectBufferSize = 30_000_000; //30MB; //default: 100,000 bytes;
|
||||
//hubOptions.HandshakeTimeout = TimeSpan.FromSeconds(15); //default timeout is 15 seconds
|
||||
});
|
||||
}
|
||||
|
|
@ -143,10 +144,14 @@ public class PluginNopStartup : INopStartup
|
|||
endpoints.MapHub<DevAdminSignalRHub>(fruitBankHubEndPoint, options =>
|
||||
{
|
||||
options.Transports = HttpTransportType.WebSockets;// | HttpTransportType.LongPolling;
|
||||
options.WebSockets.CloseTimeout = new TimeSpan(0, 0, 10); //default: 5 sec.
|
||||
options.WebSockets.CloseTimeout = TimeSpan.FromSeconds(10); //default: 5 sec.
|
||||
//options.LongPolling.PollTimeout = new TimeSpan(0, 0, 90); //default: 90 sec.
|
||||
|
||||
options.TransportSendTimeout = new TimeSpan(60); //default: 10 sec.
|
||||
options.AllowStatefulReconnects = true;
|
||||
options.TransportMaxBufferSize = 30_000_000; // Increasing this value allows the server to receive larger messages. default: 65KB; unlimited: 0;
|
||||
options.ApplicationMaxBufferSize = 30_000_000; //Increasing this value allows the server to send larger messages. default: 65KB; unlimited: 0;
|
||||
|
||||
options.TransportSendTimeout = TimeSpan.FromSeconds(60); //default: 10 sec.
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -156,7 +161,10 @@ public class PluginNopStartup : INopStartup
|
|||
{
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapHub<LoggerSignalRHub>(loggrHubEndPoint);
|
||||
endpoints.MapHub<LoggerSignalRHub>(loggrHubEndPoint, options =>
|
||||
{
|
||||
options.AllowStatefulReconnects = false;
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using FruitBank.Common.Entities;
|
|||
using Mango.Nop.Core.Dtos;
|
||||
using Mango.Nop.Core.Entities;
|
||||
using Nop.Core.Domain.Catalog;
|
||||
using Nop.Core.Domain.Common;
|
||||
using Nop.Core.Domain.Orders;
|
||||
using Nop.Data.Mapping;
|
||||
|
||||
|
|
@ -16,6 +17,8 @@ public partial class NameCompatibility : INameCompatibility
|
|||
/// </summary>
|
||||
public Dictionary<Type, string> TableNames => new Dictionary<Type, string>
|
||||
{
|
||||
{ typeof(GenericAttributeDto), nameof(GenericAttribute)},
|
||||
|
||||
{ typeof(Files), FruitBankConstClient.FilesDbTableName},
|
||||
{ typeof(Pallet), FruitBankConstClient.PalletDbTableName},
|
||||
{ typeof(Partner), FruitBankConstClient.PartnerDbTableName },
|
||||
|
|
|
|||
Loading…
Reference in New Issue