change-设置型号查询优化

collectionStore
liuwf 11 months ago
parent 3c0c86d53a
commit 1a8ddc6626

@ -87,7 +87,18 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
} }
public void Load() public void Load()
{ {
var infos = baseMaterialInfoService.getAllInfos(); try
{
List<BaseMaterialInfo> infos = null;
if (spaceCodes.Contains("XK"))
{
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(); MaterialDataGrid.Clear();
Application.Current.Dispatcher.Invoke(() => Application.Current.Dispatcher.Invoke(() =>
{ {
@ -97,6 +108,11 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
} }
}); });
} }
catch (Exception ex)
{
logHelper.Error(ex.Message.ToString());
}
}
private ObservableCollection<BaseMaterialInfo> materialDataGrid; private ObservableCollection<BaseMaterialInfo> materialDataGrid;
@ -303,9 +319,20 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
/// </summary> /// </summary>
private async void searchData() private async void searchData()
{ {
try
{
List<BaseMaterialInfo> infos = null;
if (!string.IsNullOrEmpty(searchText)) if (!string.IsNullOrEmpty(searchText))
{ {
var infos = baseMaterialInfoService.getAllInfos().Where(x => x.MaterialName.Contains(searchText) || x.MaterialCode.Contains(searchText)); if (spaceCodes.Contains("XK"))
{
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(); MaterialDataGrid.Clear();
Application.Current.Dispatcher.Invoke(() => Application.Current.Dispatcher.Invoke(() =>
{ {
@ -316,5 +343,10 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
}); });
} }
} }
catch (Exception ex)
{
logHelper.Error(ex.Message.ToString());
}
}
} }
} }

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

@ -15,6 +15,24 @@ namespace HighWayIot.Repository.service.Impl
private LogHelper logHelper = LogHelper.Instance; private LogHelper logHelper = LogHelper.Instance;
public List<BaseMaterialInfo> getAllInfos() 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 try
{ {
@ -28,5 +46,6 @@ namespace HighWayIot.Repository.service.Impl
} }
} }
} }
} }

Loading…
Cancel
Save