using BBWY.Client.APIServices;
using BBWY.Client.Models.APIModel.Response.PackTask;
using BBWY.Client.Models;
using BBWY.Client.Views.PackTask;
using BBWY.Common.Models;
using BBWY.Controls;
using GalaSoft.MvvmLight.Command;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using System.Linq;
using System.Windows.Controls;
using System.ComponentModel;
using HandyControl.Controls;
using System.Windows;
using System.Collections;
using NPOI.SS.Formula.Functions;
namespace BBWY.Client.ViewModels.PackTask
{
public partial class WareHouseListViewModel : BaseVM, IDenpendency//注入服务
{
#region 属性绑定
///
/// 查询时间段
///
private DateTime startTime;
public DateTime StartTime { get => startTime; set { Set(ref startTime, value); } }
private DateTime endTime;
public DateTime EndTime { get => endTime; set { Set(ref endTime, value); } }
///
/// 查询任务id
///
private string searchTaskId;
public string SearchTaskId
{
get => searchTaskId; set
{
Set(ref searchTaskId, value);
}
}
///
/// 查询Sku
///
private string searchSkuId;
public string SearchSkuId { get => searchSkuId; set { Set(ref searchSkuId, value); } }
public TaskState? taskState;
///
/// 任务状态
///
public TaskState? TaskState
{
get => taskState; private set
{
Set(ref taskState, value);
}
}
private int pageIndex = 1;
private int pageSize = 10;
private int orderCount;//总数量
private Visibility tipVisitity;
///
///
///
public Visibility TipVisitity { get => tipVisitity; set { Set(ref tipVisitity, value); } }
///
/// 未到货数量
///
public int NoArrivedCount { get => noArrivedCount; set { Set(ref noArrivedCount, value); } }
private int noArrivedCount;
private int someArrivedCount;
///
/// 部分到货数量
///
public int SomeArrivedCount { get => someArrivedCount; set { Set(ref someArrivedCount, value); } }
private int worryCount;
///
/// 加急数
///
public int WorryCount { get => worryCount; set { Set(ref worryCount, value); } }
private int arrivedCount;
///
/// 已到货数量
///
public int ArrivedCount { get => arrivedCount; set { Set(ref arrivedCount, value); } }
//private int totalCount;
/////
///// 全部数量
/////
//public int TotalCount { get => totalCount; set { Set(ref totalCount, value); } }
public int PageIndex { get => pageIndex; set { Set(ref pageIndex, value); } }
public int PageSize { get => pageSize; set { Set(ref pageSize, value); } }
public int OrderCount { get => orderCount; set { Set(ref orderCount, value); } }
private bool isLoading;
public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } }
private int? IsWorry { get; set; }
public int? taskStatus { get; set; }
private ObservableCollection packTaskList;
///
/// 动态数据表
///
public ObservableCollection PackTaskList { get => packTaskList; set { Set(ref packTaskList, value); } }
//private ObservableCollection feesItems;
/////
///// 动态数据表
/////
//public ObservableCollection FeesItems { get => feesItems; set { Set(ref feesItems, value); } }
public string searchDepartment;
public string SearchDepartment
{
get => searchDepartment; set
{
Set(ref searchDepartment, value);
}
}
#endregion
private readonly ProductService productService;
private readonly ConsumableService consumableService;
private readonly WorkProcessService workProcessService;
private readonly PackTaskService packTaskService;
private readonly IncreateServiceService increateServiceService;
public WareHouseListViewModel(PackTaskService packTaskService, ConsumableService consumableService, WorkProcessService workProcessService, IncreateServiceService increateServiceService, ProductService productService)
{
this.packTaskService = packTaskService;
this.consumableService = consumableService;
PackTaskList = new ObservableCollection();//初始化数据
SetTaskStateCommand = new RelayCommand(SetTaskState);
SearchTaskCommand = new RelayCommand(() =>
{
PageIndex = 1;
Task.Factory.StartNew(() => SearchTaskList()); //手动点击查询订单
});
TaskPageIndexChangedCommand = new RelayCommand(p =>
{
LoadIndex(p.PageIndex);
});
OpenSkuDetailCommand = new RelayCommand