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.
146 lines
4.1 KiB
C#
146 lines
4.1 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.ComponentModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Input;
|
|
|
|
namespace Aucma.Scada.UI.viewModel.AssemblyPlan
|
|
{
|
|
public class PlanInfoEditViewModel : ViewModelBase
|
|
{
|
|
private AssemblyPlanBusiness assemblyPlanBusiness = AssemblyPlanBusiness.Instance;
|
|
|
|
public PlanInfoEditViewModel()
|
|
{
|
|
PlanInfoTransmitCommand = new RelayCommand(PlanInfoTransmit);
|
|
MouseClickCommand = new RelayCommand<object>(MouseClick);
|
|
CloseWindowCommand = new RelayCommand<object>(t => CloseWindow(t));
|
|
Query();
|
|
}
|
|
|
|
#region 参数定义
|
|
/// <summary>
|
|
/// 生产计划编号
|
|
/// </summary>
|
|
private string _ProductPlanCode = string.Empty;
|
|
public string ProductPlanCode
|
|
{
|
|
get { return _ProductPlanCode; }
|
|
set { _ProductPlanCode = value; RaisePropertyChanged(nameof(ProductPlanCode)); }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 物料编号
|
|
/// </summary>
|
|
private string _MaterialCode = string.Empty;
|
|
public string MaterialCode
|
|
{
|
|
get { return _MaterialCode; }
|
|
set { _MaterialCode = value; RaisePropertyChanged(nameof(MaterialCode)); }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 物料编号
|
|
/// </summary>
|
|
private int _TransmitAmount = 0;
|
|
public int TransmitAmount
|
|
{
|
|
get { return _TransmitAmount; }
|
|
set { _TransmitAmount = value; RaisePropertyChanged(nameof(TransmitAmount)); }
|
|
}
|
|
|
|
private ProductPlanInfo selectedDataItem;
|
|
public ProductPlanInfo SelectedDataItem
|
|
{
|
|
get { return selectedDataItem; }
|
|
set
|
|
{
|
|
selectedDataItem = value;
|
|
RaisePropertyChanged(nameof(SelectedDataItem));
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 计划列表DataGrid
|
|
/// </summary>
|
|
private ObservableCollection<ProductPlanInfo> planInfoDataGrid;
|
|
|
|
public ObservableCollection<ProductPlanInfo> PlanInfoDataGrid
|
|
{
|
|
get { return planInfoDataGrid; }
|
|
set { planInfoDataGrid = value; RaisePropertyChanged(() => PlanInfoDataGrid); }
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 事件定义
|
|
|
|
/// <summary>
|
|
/// 生产计划下达
|
|
/// </summary>
|
|
public RelayCommand PlanInfoTransmitCommand { get; set; }
|
|
|
|
public RelayCommand<object> MouseClickCommand { get; set; }
|
|
|
|
public RelayCommand<object> CloseWindowCommand { get; set; }
|
|
#endregion
|
|
|
|
|
|
/// <summary>
|
|
/// 箱壳入库任务列表查询
|
|
/// </summary>
|
|
public void Query()
|
|
{
|
|
|
|
var models = assemblyPlanBusiness.GetProductPlanInfosByProductLineCode();
|
|
|
|
PlanInfoDataGrid = new ObservableCollection<ProductPlanInfo>();
|
|
if (models != null)
|
|
{
|
|
models.ForEach(
|
|
arg =>
|
|
{
|
|
PlanInfoDataGrid.Add(arg);
|
|
});
|
|
}
|
|
}
|
|
|
|
private void PlanInfoTransmit()
|
|
{
|
|
bool result = assemblyPlanBusiness.PlanTransmitByProductPlan(_ProductPlanCode, _TransmitAmount);
|
|
if (result)
|
|
{
|
|
MessageBox.Show("执行计划维护成功");
|
|
}
|
|
}
|
|
|
|
public void MouseClick(object obj)
|
|
{
|
|
TransmitAmount = 0;
|
|
var info = SelectedDataItem as ProductPlanInfo;
|
|
ProductPlanCode = info.planCode;
|
|
MaterialCode = info.materialName;
|
|
}
|
|
|
|
private void CloseWindow(object parameter)
|
|
{
|
|
var window = parameter as Window;
|
|
if (window != null)
|
|
{
|
|
window.Close();
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|