using Admin.Core.Common; using Admin.Core.IService; using Aucma.Core.BoxFoam.Models; using Aucma.Core.BoxFoam.Views.UserPage; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using Microsoft.Extensions.DependencyInjection; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Aucma.Core.BoxFoam.ViewModels { public partial class AfterFoamingPageModelView : ObservableObject { private readonly IBaseSpaceDetailServices? _baseSpaceDetailServices; private readonly IBaseSpaceInfoServices? _baseSpaceInfoServices; public AfterFoamingPageModelView() { _baseSpaceDetailServices = App.ServiceProvider.GetService(); _baseSpaceInfoServices = App.ServiceProvider.GetService(); this.LoadSpaceStoreMedthAsync(); } #region 加载泡后库货道信息 /// /// 加载泡后库货道信息 /// private async void LoadSpaceStoreMedthAsync() { string storeCode = Appsettings.app("StoreInfo", "AfterStoreCode");//泡前库code var baseSpaceInfolist = await _baseSpaceInfoServices.QueryAsync(d => d.StoreCode.Equals(storeCode));//仓库 foreach (var item in baseSpaceInfolist) { SpaceInfoModel model = new SpaceInfoModel(); model.spaceCode = item.SpaceCode; model.spaceStock = item.SpaceStock; model.onTheWay = item.OnRouteAmount; model.totalAmount = item.SpaceStock + item.OnRouteAmount; model.materialType = item.MaterialType; model.unusualFlag = item.UnusualFlag == 2 ? "Red" : "White"; if (item.SpaceStatus == 2) { model.setEnable = "False"; model.inStoreFlag = "Red";//item.inStoreFlag == 2 ? "Red" : "White"; model.isFlag = "Red"; } else { model.isFlag = item.IsFlag.ToString(); //禁用状态 } model.onlyOne = 1; model.spaceType = item.SpaceType; Shapes.Add(model); } } #endregion #region 初始化 private ObservableCollection _shapes = new ObservableCollection(); public ObservableCollection Shapes { get => _shapes; set => SetProperty(ref _shapes, value); } #endregion #region 明细 [RelayCommand] private void SpaceDetail(string spaceCode) { string storeCode = Appsettings.app("StoreInfo", "AfterStoreCode");//泡前库code SpaceDetailPageView page = new SpaceDetailPageView(storeCode, spaceCode); page.ShowDialog(); } #endregion } }