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.
112 lines
3.9 KiB
C#
112 lines
3.9 KiB
C#
using Admin.Core.Common;
|
|
using Admin.Core.IService;
|
|
using Admin.Core.Model;
|
|
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? _spaceDetailService;
|
|
private readonly IBaseSpaceInfoServices? _baseSpaceInfoServices;
|
|
public AfterFoamingPageModelView()
|
|
{
|
|
_spaceDetailService = App.ServiceProvider.GetService<IBaseSpaceDetailServices>();
|
|
_baseSpaceInfoServices = App.ServiceProvider.GetService<IBaseSpaceInfoServices>();
|
|
this.LoadSpaceStoreMedthAsync();
|
|
}
|
|
|
|
#region 加载泡后库货道信息
|
|
/// <summary>
|
|
/// 加载泡后库货道信息
|
|
/// </summary>
|
|
private void LoadSpaceStoreMedthAsync()
|
|
{
|
|
string storeCode = Appsettings.app("StoreInfo", "AfterStoreCode");//泡前库code
|
|
|
|
var baseSpaceInfolist = _baseSpaceInfoServices.QueryAsync(d => d.StoreCode.Equals(storeCode)).Result;//仓库
|
|
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 info)
|
|
{
|
|
string storeCode = Appsettings.app("StoreInfo", "AfterStoreCode");//泡前库code
|
|
List<BaseSpaceDetail> list = _spaceDetailService.GetSpaceDetailsBySpaceCode(storeCode, info).Result;
|
|
|
|
RefreshSpaceDetails(list);
|
|
}
|
|
/// <summary>
|
|
/// 刷新货道明细列表
|
|
/// </summary>
|
|
/// <param name="spaceDetails"></param>
|
|
private void RefreshSpaceDetails(List<BaseSpaceDetail> spaceDetails)
|
|
{
|
|
SpaceDetailDataGrid = new ObservableCollection<BaseSpaceDetail>();
|
|
if (spaceDetails != null)
|
|
{
|
|
spaceDetails.ForEach(
|
|
arg =>
|
|
{
|
|
SpaceDetailDataGrid.Add(arg);
|
|
});
|
|
}
|
|
}
|
|
private ObservableCollection<BaseSpaceDetail> spaceDetailDataGrid;
|
|
|
|
public ObservableCollection<BaseSpaceDetail> SpaceDetailDataGrid
|
|
{
|
|
get => spaceDetailDataGrid;
|
|
set => SetProperty(ref spaceDetailDataGrid, value);
|
|
}
|
|
#endregion
|
|
}
|
|
}
|