using BPA.Helper; using BPASmartClient.MorkS.Model; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; namespace BPASmartClient.MorkS.ViewModel { internal class GoodsEditViewModel : NotifyBase { private string _orderNum { get; set; } public string OrderNum { get { return _orderNum; } set { _orderNum = value; OnPropertyChanged(); } } private string _goodsName = "板面"; public string GoodsName { get { return _goodsName; } set { _goodsName = value; OnPropertyChanged(); } } public ObservableCollection bowlLocs { get; set; } = new ObservableCollection() { false, false }; public ObservableCollection noodlesLocs { get; set; } = new ObservableCollection() { false, false, false, false, false }; public BPARelayCommand ConfirmCommand { get; set; } public GoodsEditViewModel() { ConfirmCommand = new BPARelayCommand(() => { GoodsModel goods = new GoodsModel(); goods.OrderNum = Guid.NewGuid().ToString("D"); goods.GoodsName = GoodsName; var bLoc = bowlLocs.ToList().FindIndex(p => p == true); var noLoc = noodlesLocs.ToList().FindIndex(p => p == true); if (bLoc != -1 && noLoc != -1) { goods.BowlLoc = bLoc + 10; goods.NoodlesLoc = noLoc + 1; } else { MessageBox.Show("请选择面位置或碗类型", "提示", MessageBoxButton.OK, MessageBoxImage.Information); return; } ActionManage.GetInstance.Send(goods, "orderEdit"); ActionManage.GetInstance.Send("CloseEditWindow"); }); } } }