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/InventoryInfo/ShellInventoryViewModel.cs

175 lines
4.7 KiB
C#

using Aucma.Scada.Business;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using HighWayIot.Config;
using System.Collections.Generic;
using System.Windows;
namespace Aucma.Scada.UI.viewModel.InventoryInfo
{
public class ShellInventoryViewModel : ViewModelBase
{
public List<SpaceDto> Shapes { get; set; } = new List<SpaceDto>();
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));
for (int i = 1; i <= 9; i++)
{
Shapes.Add(new SpaceDto()
{
spaceCode = "XK_00"+i,
spaceStock = i,
onTheWay = i,
totalAmount = i+i,
materialType = "",
inStoreFlag = 1,
outStoreFlag = 2,
unusualFlag = 2,
isFlag = 1,
onlyOne = 1,
spaceType = 1
});
}
}
#region 事件定义
public RelayCommand<object> UpdateInStoreFlagCommand { get; set; }
public RelayCommand<object> UpdateOutStoreFlagCommand { get; set; }
public RelayCommand<object> UpdateUnusualFlagCommand { get; set; }
#endregion
/// <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)
{
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)
{
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)
{
MessageBox.Show("货道异常标识修改成功");
}
else
{
MessageBox.Show("货道异常标识修改失败");
}
}
}
/// <summary>
/// 货道信息
/// </summary>
public class SpaceDto
{
/// <summary>
/// 货道编号
/// </summary>
public string spaceCode { get; set; }
/// <summary>
/// 在库数量
/// </summary>
public int spaceStock { get; set; }
/// <summary>
/// 货道类型
/// </summary>
public int spaceType { get; set; }
/// <summary>
/// 在途数量
/// </summary>
public int onTheWay { get; set; }
/// <summary>
/// 合计数量
/// </summary>
public int totalAmount { get; set; }
/// <summary>
/// 物料型号
/// </summary>
public string materialType { get; set; }
/// <summary>
/// 入库状态
/// </summary>
public int inStoreFlag { get; set; }
/// <summary>
/// 出库状态
/// </summary>
public int outStoreFlag { get; set; }
/// <summary>
/// 异常状态
/// </summary>
public int unusualFlag { get; set; }
/// <summary>
/// 禁用状态
/// </summary>
public int isFlag { get; set; }
/// <summary>
/// 出一个
/// </summary>
public int onlyOne { get; set; }
}
}