|
|
|
|
using Aucma.Scada.Business;
|
|
|
|
|
using GalaSoft.MvvmLight;
|
|
|
|
|
using GalaSoft.MvvmLight.Command;
|
|
|
|
|
using HighWayIot.Config;
|
|
|
|
|
using HighWayIot.Repository.domain;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
|
|
|
|
|
namespace Aucma.Scada.UI.viewModel.InventoryInfo
|
|
|
|
|
{
|
|
|
|
|
public class ShellInventoryViewModel : ViewModelBase
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public ObservableCollection<BaseSpaceInfo> Shapes { get; set; } = new ObservableCollection<BaseSpaceInfo>();
|
|
|
|
|
|
|
|
|
|
private InventoryInfoBusiness inventoryInfoBusiness = InventoryInfoBusiness.Instance;
|
|
|
|
|
|
|
|
|
|
private AppConfig appConfig = AppConfig.Instance;
|
|
|
|
|
|
|
|
|
|
public ShellInventoryViewModel()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
UpdateInStoreFlagCommand = new RelayCommand<object>(obj => UpdateInStoreFlag(obj));
|
|
|
|
|
|
|
|
|
|
UpdateOutStoreFlagCommand = new RelayCommand<object>(obj => UpdateOutStoreFlag(obj));
|
|
|
|
|
|
|
|
|
|
UpdateUnusualFlagCommand = new RelayCommand<object>(obj => UpdateUnusualFlag(obj));
|
|
|
|
|
|
|
|
|
|
UpdateSpaceStatusCommand = new RelayCommand<object>(obj => UpdateSpaceStatus(obj));
|
|
|
|
|
|
|
|
|
|
Query();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 事件定义
|
|
|
|
|
public RelayCommand<object> UpdateInStoreFlagCommand { get; set; }
|
|
|
|
|
|
|
|
|
|
public RelayCommand<object> UpdateOutStoreFlagCommand { get; set; }
|
|
|
|
|
|
|
|
|
|
public RelayCommand<object> UpdateUnusualFlagCommand { get; set; }
|
|
|
|
|
|
|
|
|
|
public RelayCommand<object> UpdateSpaceStatusCommand { get; set; }
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
private void Query()
|
|
|
|
|
{
|
|
|
|
|
var info = inventoryInfoBusiness.GetSpaceInfos(appConfig.shellStoreCode);
|
|
|
|
|
if (info != null)
|
|
|
|
|
{
|
|
|
|
|
//new LinerInventory();
|
|
|
|
|
Shapes = new ObservableCollection<BaseSpaceInfo>();
|
|
|
|
|
info.ForEach(x =>
|
|
|
|
|
{
|
|
|
|
|
Shapes.Add(x);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 货道入库标识设置
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="obj"></param>
|
|
|
|
|
private void UpdateInStoreFlag(object obj)
|
|
|
|
|
{
|
|
|
|
|
string info = obj as string;
|
|
|
|
|
bool result = inventoryInfoBusiness.UpdateInStoreFlag(appConfig.shellStoreCode, info);
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
|
|
|
|
Query();
|
|
|
|
|
MessageBox.Show("货道入库状态修改成功");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("货道入库状态修改失败");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 货道出库标识设置
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="obj"></param>
|
|
|
|
|
private void UpdateOutStoreFlag(object obj)
|
|
|
|
|
{
|
|
|
|
|
string info = obj as string;
|
|
|
|
|
bool result = inventoryInfoBusiness.UpdateOutStoreFlag(appConfig.shellStoreCode, info);
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
|
|
|
|
Query();
|
|
|
|
|
MessageBox.Show("货道出库状态修改成功");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("货道出库状态修改失败");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 货道异常标识设置
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="obj"></param>
|
|
|
|
|
private void UpdateUnusualFlag(object obj)
|
|
|
|
|
{
|
|
|
|
|
string info = obj as string;
|
|
|
|
|
bool result = inventoryInfoBusiness.UpdateUnusualFlag(appConfig.shellStoreCode, info);
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
|
|
|
|
Query();
|
|
|
|
|
MessageBox.Show("货道异常标识修改成功");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("货道异常标识修改失败");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 修改货道状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="obj"></param>
|
|
|
|
|
private void UpdateSpaceStatus(object obj)
|
|
|
|
|
{
|
|
|
|
|
string info = obj as string;
|
|
|
|
|
bool result = inventoryInfoBusiness.UpdateUnusualFlag(appConfig.shellStoreCode, info);
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
|
|
|
|
Query();
|
|
|
|
|
MessageBox.Show("货道状态修改成功");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("货道状态修改失败");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|