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.
134 lines
3.6 KiB
C#
134 lines
3.6 KiB
C#
using Aucma.Scada.Business;
|
|
using GalaSoft.MvvmLight;
|
|
using GalaSoft.MvvmLight.Command;
|
|
using HighWayIot.Repository.domain;
|
|
using HighWayIot.Repository.service;
|
|
using HighWayIot.Repository.service.Impl;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Aucma.Scada.UI.viewModel.TaskInfo
|
|
{
|
|
public class TaskInfoViewModel : ViewModelBase
|
|
{
|
|
private TaskInfoBusiness taskInfoBusiness = TaskInfoBusiness.Instance;
|
|
|
|
public TaskInfoViewModel()
|
|
{
|
|
TaskCommand = new RelayCommand<object>(obj => Task(obj));
|
|
|
|
this.InStoreTask();
|
|
}
|
|
|
|
#region 参数定义
|
|
/// <summary>
|
|
/// 任务列表DataGrid
|
|
/// </summary>
|
|
private ObservableCollection<RealTaskInfo> taskInfoDataGrid;
|
|
|
|
public ObservableCollection<RealTaskInfo> TaskInfoDataGrid
|
|
{
|
|
get { return taskInfoDataGrid; }
|
|
set { taskInfoDataGrid = value; RaisePropertyChanged(() => TaskInfoDataGrid); }
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 记录列表DataGrid
|
|
/// </summary>
|
|
private ObservableCollection<RealTaskInfo> recordInfoDataGrid;
|
|
|
|
public ObservableCollection<RealTaskInfo> RecordInfoDataGrid
|
|
{
|
|
get { return recordInfoDataGrid; }
|
|
set { recordInfoDataGrid = value; RaisePropertyChanged(() => RecordInfoDataGrid); }
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 事件定义
|
|
/// <summary>
|
|
/// 出入库任务按钮事件
|
|
/// </summary>
|
|
public RelayCommand<object> TaskCommand { get; set; }
|
|
|
|
#endregion
|
|
|
|
private void Task(object obj)
|
|
{
|
|
string info = obj as string;
|
|
switch (info)
|
|
{
|
|
case "inStore":
|
|
InStoreTask();
|
|
break;
|
|
case "outStore":
|
|
OutStoreTask();
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 入库任务
|
|
/// </summary>
|
|
/// <param name="obj"></param>
|
|
private void InStoreTask()
|
|
{
|
|
var models = taskInfoBusiness.GetTaskInfos(1);
|
|
|
|
TaskInfoDataGrid = new ObservableCollection<RealTaskInfo>();
|
|
RecordInfoDataGrid = new ObservableCollection<RealTaskInfo>();
|
|
if (models != null)
|
|
{
|
|
models.ForEach(
|
|
arg =>
|
|
{
|
|
|
|
if(arg.taskStatus == 3)
|
|
{
|
|
RecordInfoDataGrid.Add(arg);
|
|
}
|
|
else
|
|
{
|
|
TaskInfoDataGrid.Add(arg);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 出库任务
|
|
/// </summary>
|
|
/// <param name="obj"></param>
|
|
private void OutStoreTask()
|
|
{
|
|
var models = taskInfoBusiness.GetTaskInfos(2);
|
|
|
|
TaskInfoDataGrid = new ObservableCollection<RealTaskInfo>();
|
|
RecordInfoDataGrid = new ObservableCollection<RealTaskInfo>();
|
|
if (models != null)
|
|
{
|
|
models.ForEach(
|
|
arg =>
|
|
{
|
|
|
|
if (arg.taskStatus == 3)
|
|
{
|
|
RecordInfoDataGrid.Add(arg);
|
|
}
|
|
else
|
|
{
|
|
TaskInfoDataGrid.Add(arg);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|