using Aucma.Scada.Business; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; using HighWayIot.Config; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; namespace Aucma.Scada.UI.viewModel.InventoryInfo { public class LinerInventoryViewModel :ViewModelBase { public List Shapes { get; set; } = new List(); private InventoryInfoBusiness inventoryInfoBusiness = InventoryInfoBusiness.Instance; private AppConfig appConfig = AppConfig.Instance; public LinerInventoryViewModel() { UpdateInStoreFlagCommand = new RelayCommand(obj => UpdateInStoreFlag(obj)); UpdateOutStoreFlagCommand = new RelayCommand(obj => UpdateOutStoreFlag(obj)); UpdateUnusualFlagCommand = new RelayCommand(obj => UpdateUnusualFlag(obj)); for (int i = 1; i <= 6; i++) { Shapes.Add(new SpaceDto() { spaceCode = "ND_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 UpdateInStoreFlagCommand { get; set; } public RelayCommand UpdateOutStoreFlagCommand { get; set; } public RelayCommand UpdateUnusualFlagCommand { get; set; } #endregion private void update(object obj) { string info = obj as string; MessageBox.Show("编号:" + info); } /// /// 货道入库标识设置 /// /// private void UpdateInStoreFlag(object obj) { string info = obj as string; bool result = inventoryInfoBusiness.UpdateInStoreFlag(appConfig.linerStoreCode, info); if (result) { MessageBox.Show("货道入库状态修改成功"); } else { MessageBox.Show("货道入库状态修改失败"); } } /// /// 货道出库标识设置 /// /// private void UpdateOutStoreFlag(object obj) { string info = obj as string; bool result = inventoryInfoBusiness.UpdateOutStoreFlag(appConfig.linerStoreCode, info); if (result) { MessageBox.Show("货道出库状态修改成功"); } else { MessageBox.Show("货道出库状态修改失败"); } } /// /// 货道异常标识设置 /// /// private void UpdateUnusualFlag(object obj) { string info = obj as string; bool result = inventoryInfoBusiness.UpdateUnusualFlag(appConfig.linerStoreCode, info); if (result) { MessageBox.Show("货道异常标识修改成功"); } else { MessageBox.Show("货道异常标识修改失败"); } } } }