You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
251 lines
7.1 KiB
C#
251 lines
7.1 KiB
C#
using GalaSoft.MvvmLight;
|
|
using GalaSoft.MvvmLight.Command;
|
|
using HighWayIot.Log4net;
|
|
using HighWayIot.Repository.domain;
|
|
using HighWayIot.Repository.service;
|
|
using HighWayIot.Repository.service.Impl;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Aucma.Scada.UI.viewModel
|
|
{
|
|
public class InStoreInfoViewModel:ViewModelBase
|
|
{
|
|
private LogHelper logHelper = LogHelper.Instance;
|
|
private ObservableCollection<dynamic> listItems = new ObservableCollection<dynamic>();
|
|
private ISysUserInfoService sysUserInfoService = new SysUserInfoServiceImpl();
|
|
|
|
public InStoreInfoViewModel()
|
|
{
|
|
PrintMessageToListBox("日志信息打印");
|
|
|
|
Query();
|
|
|
|
materialTypeCombox = "所有";
|
|
}
|
|
|
|
#region 参数定义
|
|
/// <summary>
|
|
/// 箱壳物料条码
|
|
/// </summary>
|
|
private string shellMaterialCode = string.Empty;
|
|
public string ShellMaterialCode
|
|
{
|
|
get { return shellMaterialCode; }
|
|
set { shellMaterialCode = value; RaisePropertyChanged(nameof(ShellMaterialCode)); }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 箱壳物料名称
|
|
/// </summary>
|
|
private string shellMaterialName = string.Empty;
|
|
public string ShellMaterialName
|
|
{
|
|
get { return shellMaterialName; }
|
|
set { shellMaterialName = value; RaisePropertyChanged(nameof(ShellMaterialName)); }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 箱壳入库货道
|
|
/// </summary>
|
|
private string shellSpaceName = string.Empty;
|
|
public string ShellSpaceName
|
|
{
|
|
get { return shellSpaceName; }
|
|
set { shellSpaceName = value; RaisePropertyChanged(nameof(ShellSpaceName)); }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 内胆物料条码
|
|
/// </summary>
|
|
private string linerMaterialCode = string.Empty;
|
|
public string LinerMaterialCode
|
|
{
|
|
get { return linerMaterialCode; }
|
|
set { linerMaterialCode = value; RaisePropertyChanged(nameof(LinerMaterialCode)); }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 内胆物料名称
|
|
/// </summary>
|
|
private string linerMaterialName = string.Empty;
|
|
public string LinerMaterialName
|
|
{
|
|
get { return linerMaterialName; }
|
|
set { linerMaterialName = value; RaisePropertyChanged(nameof(LinerMaterialName)); }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 内胆入库货道
|
|
/// </summary>
|
|
private string linerSpaceName = string.Empty;
|
|
public string LinerSpaceName
|
|
{
|
|
get { return linerSpaceName; }
|
|
set { linerSpaceName = value; RaisePropertyChanged(nameof(LinerSpaceName)); }
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// LisBox数据模板
|
|
/// </summary>
|
|
private IEnumerable logInfoListBox;
|
|
public IEnumerable LogInfoListBox
|
|
{
|
|
get { return logInfoListBox; }
|
|
set { logInfoListBox = value; RaisePropertyChanged(() => LogInfoListBox); }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 箱壳入库任务DataGrid
|
|
/// </summary>
|
|
private ObservableCollection<SysUserInfo> shellInstoreTask;
|
|
|
|
public ObservableCollection<SysUserInfo> ShellInstoreTask
|
|
{
|
|
get { return shellInstoreTask; }
|
|
set { shellInstoreTask = value; RaisePropertyChanged(()=> ShellInstoreTask); }
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 内胆入库任务DataGrid
|
|
/// </summary>
|
|
private ObservableCollection<SysUserInfo> linerInstoreTask;
|
|
|
|
public ObservableCollection<SysUserInfo> LinerInstoreTask
|
|
{
|
|
get { return linerInstoreTask; }
|
|
set { linerInstoreTask = value; RaisePropertyChanged(() => LinerInstoreTask); }
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 任务列表搜索条件
|
|
/// </summary>
|
|
private String search = String.Empty;
|
|
|
|
public String Search
|
|
{
|
|
get { return search; }
|
|
set { search = value; RaisePropertyChanged(()=> Search); }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 下拉框
|
|
/// </summary>
|
|
public string materialTypeCombox;
|
|
public string MaterialTypeCombox
|
|
{
|
|
get { return materialTypeCombox; }
|
|
set
|
|
{
|
|
if (materialTypeCombox != value)
|
|
{
|
|
materialTypeCombox = value;
|
|
RaisePropertyChanged(() => MaterialTypeCombox);
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 事件定义
|
|
/// <summary>
|
|
/// 查询事件
|
|
/// </summary>
|
|
private RelayCommand _queryCommand;
|
|
|
|
public RelayCommand QueryCommand
|
|
{
|
|
get
|
|
{
|
|
if (_queryCommand == null)
|
|
_queryCommand = new RelayCommand(Query);
|
|
return _queryCommand;
|
|
}
|
|
set { _queryCommand = value; RaisePropertyChanged(nameof(QueryCommand)); }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 重置
|
|
/// </summary>
|
|
private RelayCommand _resetCommand;
|
|
|
|
public RelayCommand ResetCommand
|
|
{
|
|
get
|
|
{
|
|
if (_resetCommand == null)
|
|
_resetCommand = new RelayCommand(Reset);
|
|
return _resetCommand;
|
|
}
|
|
set { _resetCommand = value; RaisePropertyChanged(nameof(ResetCommand)); }
|
|
}
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// listBox绑定日志
|
|
/// </summary>
|
|
/// <param name="message"></param>
|
|
private void PrintMessageToListBox(string message)
|
|
{
|
|
|
|
try
|
|
{
|
|
listItems.Add($"{DateTime.Now.ToString("HH:mm:ss")}==>{message}");
|
|
|
|
LogInfoListBox = listItems.OrderByDescending(x => x);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
logHelper.Error("日志数据绑定异常", ex);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 箱壳入库任务列表查询
|
|
/// </summary>
|
|
public void Query()
|
|
{
|
|
|
|
var models = sysUserInfoService.GetUserInfos();
|
|
|
|
if (!string.IsNullOrEmpty(search))
|
|
{
|
|
models = models.Where(x => x.userName.Contains(Search)).ToList();
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(materialTypeCombox))
|
|
{
|
|
PrintMessageToListBox(materialTypeCombox);
|
|
}
|
|
|
|
ShellInstoreTask = new ObservableCollection<SysUserInfo>();
|
|
LinerInstoreTask = new ObservableCollection<SysUserInfo>();
|
|
if (models != null)
|
|
{
|
|
models.ForEach(
|
|
arg =>
|
|
{
|
|
ShellInstoreTask.Add(arg);
|
|
LinerInstoreTask.Add(arg);
|
|
});
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 重置
|
|
/// </summary>
|
|
public void Reset()
|
|
{
|
|
Search = String.Empty;
|
|
this.Query();
|
|
}
|
|
}
|
|
}
|