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.
Aucma.Scada/Aucma.Scada.UI/viewModel/AssemblyPlan/AssemblyPlanViewModel.cs

169 lines
4.7 KiB
C#

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;
using System.Windows;
namespace Aucma.Scada.UI.viewModel.AssemblyPlan
{
public class AssemblyPlanViewModel : ViewModelBase
{
private ISysUserInfoService sysUserInfoService = new SysUserInfoServiceImpl();
public AssemblyPlanViewModel()
{
MoveUpCommand = new RelayCommand<object>(obj => MoveUp(obj));
MoveDownCommand = new RelayCommand<object>(obj => MoveDown(obj));
DeletePlanCommand = new RelayCommand<object>(obj => DeletePlan(obj));
NextPassCommand = new RelayCommand<object>(obj => NextPass(obj));
stationName = "箱壳内胆组装";
orderCode = System.Guid.NewGuid().ToString();
planCode = System.Guid.NewGuid().ToString();
productModel = "SC232";
beginTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Query();
}
#region 参数定义
/// <summary>
/// 工位名称
/// </summary>
private string stationName = string.Empty;
public string StationName
{
get { return stationName; }
set { stationName = value; RaisePropertyChanged(nameof(StationName)); }
}
/// <summary>
/// 订单编号
/// </summary>
private string orderCode = string.Empty;
public string OrderCode
{
get { return orderCode; }
set { orderCode = value; RaisePropertyChanged(nameof(OrderCode)); }
}
/// <summary>
/// 计划编号
/// </summary>
private string planCode = string.Empty;
public string PlanCode
{
get { return planCode; }
set { planCode = value; RaisePropertyChanged(nameof(PlanCode)); }
}
/// <summary>
/// 产品型号
/// </summary>
private string productModel = string.Empty;
public string ProductModel
{
get { return productModel; }
set { productModel = value; RaisePropertyChanged(nameof(ProductModel)); }
}
/// <summary>
/// 开始时间
/// </summary>
private string beginTime = string.Empty;
public string BeginTime
{
get { return beginTime; }
set { beginTime = value; RaisePropertyChanged(nameof(BeginTime)); }
}
/// <summary>
/// 计划列表DataGrid
/// </summary>
private ObservableCollection<SysUserInfo> planInfoDataGrid;
public ObservableCollection<SysUserInfo> PlanInfoDataGrid
{
get { return planInfoDataGrid; }
set { planInfoDataGrid = value; RaisePropertyChanged(() => PlanInfoDataGrid); }
}
#endregion
#region 事件定义
/// <summary>
/// 上移事件
/// </summary>
public RelayCommand<object> MoveUpCommand { get; set; }
/// <summary>
/// 下移事件
/// </summary>
public RelayCommand<object> MoveDownCommand { get; set; }
/// <summary>
/// 删除计划
/// </summary>
public RelayCommand<object> DeletePlanCommand { get; set; }
/// <summary>
/// 下传事件
/// </summary>
public RelayCommand<object> NextPassCommand { get; set; }
#endregion
/// <summary>
/// 箱壳入库任务列表查询
/// </summary>
public void Query()
{
var models = sysUserInfoService.GetUserInfos();
PlanInfoDataGrid = new ObservableCollection<SysUserInfo>();
if (models != null)
{
models.ForEach(
arg =>
{
PlanInfoDataGrid.Add(arg);
});
}
}
public void MoveUp(object obj)
{
string info = obj as string;
MessageBox.Show("上移:" + info);
}
public void MoveDown(object obj)
{
string info = obj as string;
MessageBox.Show("下移:" + info);
}
public void DeletePlan(object obj)
{
string info = obj as string;
MessageBox.Show("删除:" + info);
}
public void NextPass(object obj)
{
string info = obj as string;
MessageBox.Show("下传:" + info);
}
}
}