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.Core.BoxFoam/ViewModels/AfterFoamingPageModelView.cs

86 lines
3.1 KiB
C#

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<IBaseSpaceDetailServices>();
_baseSpaceInfoServices = App.ServiceProvider.GetService<IBaseSpaceInfoServices>();
this.LoadSpaceStoreMedthAsync(); }
#region 加载泡后库货道信息
/// <summary>
/// 加载泡后库货道信息
/// </summary>
private async void LoadSpaceStoreMedthAsync()
{
string storeCode = Appsettings.app("StoreInfo", "AfterStoreCode");//泡前库code
var baseSpaceInfolist = await _baseSpaceInfoServices.QueryAsync(d => d.StoreCode.Equals(storeCode));//仓库
if (baseSpaceInfolist == null) return;
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<SpaceInfoModel> _shapes = new ObservableCollection<SpaceInfoModel>();
public ObservableCollection<SpaceInfoModel> 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
}
}