change-设置型号查询优化

collectionStore
liuwf 11 months ago
parent 3c0c86d53a
commit 1a8ddc6626

@ -87,15 +87,31 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
}
public void Load()
{
var infos = baseMaterialInfoService.getAllInfos();
MaterialDataGrid.Clear();
Application.Current.Dispatcher.Invoke(() =>
try
{
foreach (BaseMaterialInfo info in infos)
List<BaseMaterialInfo> infos = null;
if (spaceCodes.Contains("XK"))
{
MaterialDataGrid.Add(info);
infos = baseMaterialInfoService.getShellAndLiner().Where(x => x.MaterialSubclass == "400").ToList();
}
});
else
{
infos = baseMaterialInfoService.getShellAndLiner().Where(x => x.MaterialSubclass == "500").ToList();
}
if (infos == null) return;
MaterialDataGrid.Clear();
Application.Current.Dispatcher.Invoke(() =>
{
foreach (BaseMaterialInfo info in infos)
{
MaterialDataGrid.Add(info);
}
});
}
catch (Exception ex)
{
logHelper.Error(ex.Message.ToString());
}
}
private ObservableCollection<BaseMaterialInfo> materialDataGrid;
@ -303,17 +319,33 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
/// </summary>
private async void searchData()
{
if (!string.IsNullOrEmpty(searchText))
try
{
var infos = baseMaterialInfoService.getAllInfos().Where(x => x.MaterialName.Contains(searchText) || x.MaterialCode.Contains(searchText));
MaterialDataGrid.Clear();
Application.Current.Dispatcher.Invoke(() =>
List<BaseMaterialInfo> infos = null;
if (!string.IsNullOrEmpty(searchText))
{
foreach (BaseMaterialInfo info in infos)
if (spaceCodes.Contains("XK"))
{
MaterialDataGrid.Add(info);
infos = baseMaterialInfoService.getShellAndLiner().Where(x => x.MaterialSubclass == "400" && (x.MaterialName.Contains(searchText) || x.MaterialCode.Contains(searchText))).ToList();
}
});
else
{
infos = baseMaterialInfoService.getShellAndLiner().Where(x => x.MaterialSubclass == "500" && (x.MaterialName.Contains(searchText) || x.MaterialCode.Contains(searchText))).ToList();
}
if (infos == null) return;
MaterialDataGrid.Clear();
Application.Current.Dispatcher.Invoke(() =>
{
foreach (BaseMaterialInfo info in infos)
{
MaterialDataGrid.Add(info);
}
});
}
}
catch (Exception ex)
{
logHelper.Error(ex.Message.ToString());
}
}
}

@ -12,8 +12,14 @@ namespace HighWayIot.Repository.service
public interface IBaseMaterialInfoService
{
/// <summary>
/// 箱壳内胆条码绑定
/// 获取所有物料型号
/// </summary>
List<BaseMaterialInfo> getAllInfos();
/// <summary>
/// 获取箱壳和内胆部件
/// </summary>
/// <returns></returns>
List<BaseMaterialInfo> getShellAndLiner();
}
}

@ -15,6 +15,24 @@ namespace HighWayIot.Repository.service.Impl
private LogHelper logHelper = LogHelper.Instance;
public List<BaseMaterialInfo> getAllInfos()
{
try
{
var info = _baseMaterialInfo.GetList(x => x.MaterialSubclass == "200");
return info;
}
catch (Exception ex)
{
logHelper.Error("获取集合异常", ex);
return null;
}
}
/// <summary>
/// 获取箱壳和内胆部件
/// </summary>
/// <returns></returns>
public List<BaseMaterialInfo> getShellAndLiner()
{
try
{
@ -28,5 +46,6 @@ namespace HighWayIot.Repository.service.Impl
}
}
}
}

Loading…
Cancel
Save