using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows; namespace Aucma.Core.BoxFoaming.ViewModels { public partial class RealTimeInventoryPageViewModel : ObservableObject { public RealTimeInventoryPageViewModel() { LoadMedth(); Thread thread = new Thread(() => { }); thread.Start(); } private void LoadMedth() { for (int i = 6; i >= 1; i--) { Shapes.Add(new SpaceDto() { spaceCode = i + "#", spaceStock = i, onTheWay = i, totalAmount = i + i, materialType = "", inStoreFlag = 1, outStoreFlag = 2, unusualFlag = 2, isFlag = 1, onlyOne = 1, spaceType = 1 }); } } #region 初始化 private ObservableCollection _space = new ObservableCollection(); public ObservableCollection Shapes { get { return _space; } set { _space = value; OnPropertyChanged();//属性通知 } } #endregion [RelayCommand] private void Update(object obj) { string info = obj as string; MessageBox.Show("编号:" + info); } } /// /// 货道信息 /// public class SpaceDto { /// /// 货道编号 /// public string spaceCode { get; set; } /// /// 在库数量 /// public int spaceStock { get; set; } /// /// 货道类型 /// public int spaceType { get; set; } /// /// 在途数量 /// public int onTheWay { get; set; } /// /// 合计数量 /// public int totalAmount { get; set; } /// /// 物料型号 /// public string materialType { get; set; } /// /// 入库状态 /// public int inStoreFlag { get; set; } /// /// 出库状态 /// public int outStoreFlag { get; set; } /// /// 异常状态 /// public int unusualFlag { get; set; } /// /// 禁用状态 /// public int isFlag { get; set; } /// /// 出一个 /// public int onlyOne { get; set; } } }