Browse Source

修改库存映射

集成Redis
郑勃旭 2 years ago
parent
commit
0833eacd58
  1. 7
      be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/StoreHttpApiHostModule.cs
  2. 10
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Inventories/BalanceController.cs
  3. 1
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemPacks/ItemPackAutoMapperProfile.cs
  4. 43
      be/Modules/Shared/src/Win_in.Sfs.Shared.Domain/Filters/FilterExtensions.cs

7
be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/StoreHttpApiHostModule.cs

@ -1,4 +1,5 @@
using System.IO; using System.IO;
using System.Text.Json.Serialization;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
@ -83,6 +84,12 @@ public class StoreHttpApiHostModule : ModuleBase<StoreHttpApiHostModule>
{ {
base.ConfigureServices(context); base.ConfigureServices(context);
ConfigureVirtualFileSystem(); ConfigureVirtualFileSystem();
//将枚举返回时都变为字符串
//context.Services.AddControllers().AddJsonOptions(options =>
//{
// options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());
//});
//ConfigureSwaggerServices(context, context.Services.GetConfiguration()); //ConfigureSwaggerServices(context, context.Services.GetConfiguration());
} }

10
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Inventories/BalanceController.cs

@ -280,11 +280,11 @@ public class BalanceController : AbpController
} }
} }
if (listInput.inventoryStatuses != null && listInput.inventoryStatuses.Any()) //if (listInput.inventoryStatuses != null && listInput.inventoryStatuses.Any())
{ //{
input.Condition.Filters.Add( // input.Condition.Filters.Add(
new Filter("Status", JsonSerializer.Serialize(listInput.inventoryStatuses), "In")); // new Filter("Status", JsonSerializer.Serialize(listInput.inventoryStatuses), "In"));
} //}
var balanceDTOs = await _balanceAppService.GetPagedListByFilterAsync(input, false).ConfigureAwait(false); var balanceDTOs = await _balanceAppService.GetPagedListByFilterAsync(input, false).ConfigureAwait(false);

1
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemPacks/ItemPackAutoMapperProfile.cs

@ -22,6 +22,7 @@ public partial class BasedataApplicationAutoMapperProfile : Profile
CreateMap<ItemPackEditInput, ItemPack>() CreateMap<ItemPackEditInput, ItemPack>()
.IgnoreAuditedObjectProperties() .IgnoreAuditedObjectProperties()
.Ignore(x => x.TenantId) .Ignore(x => x.TenantId)
.Ignore(x=>x.Id)
.Ignore(x => x.ExtraProperties) .Ignore(x => x.ExtraProperties)
.Ignore(x => x.ConcurrencyStamp) .Ignore(x => x.ConcurrencyStamp)
; ;

43
be/Modules/Shared/src/Win_in.Sfs.Shared.Domain/Filters/FilterExtensions.cs

@ -206,27 +206,28 @@ public static class FilterExtensions
var parameterExpression = Expression.Parameter(typeof(T), "p"); var parameterExpression = Expression.Parameter(typeof(T), "p");
Type lstType = typeof(List<>).MakeGenericType(propertyType); Type lstType = typeof(List<>).MakeGenericType(propertyType);
if (propertyType.IsEnum) //转换枚举
{ //if (propertyType.IsEnum)
var valueArrayStrings = JsonSerializer.Deserialize<List<string>>(filter.Value); //{
List<object> newValues = new List<object>(); // var valueArrayStrings = JsonSerializer.Deserialize<List<string>>(filter.Value);
// List<object> newValues = new List<object>();
var enumValues = propertyType.GetEnumValues();
// var enumValues = propertyType.GetEnumValues();
foreach (var valueArray in valueArrayStrings)
{ // foreach (var valueArray in valueArrayStrings)
foreach (var enumValue in enumValues) // {
{ // foreach (var enumValue in enumValues)
if (enumValue.ToString() == valueArray) // {
{ // if (enumValue.ToString() == valueArray)
newValues.Add(enumValue); // {
break; // newValues.Add(enumValue);
} // break;
} // }
} // }
var newValue = JsonSerializer.Serialize(newValues); // }
filter.Value = newValue; // var newValue = JsonSerializer.Serialize(newValues);
} // filter.Value = newValue;
//}
object propertyValue = JsonSerializer.Deserialize(filter.Value, lstType); object propertyValue = JsonSerializer.Deserialize(filter.Value, lstType);
if (propertyValue != null) if (propertyValue != null)

Loading…
Cancel
Save