using BBWY.Client.APIServices;
using BBWY.Client.Helpers;
using BBWY.Client.Models;
using BBWY.Client.Views.Order;
using BBWY.Common.Models;
using BBWY.Controls;
using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.Messaging;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Input;
using System.Windows;
using BBWY.Common.Extensions;
using System.Threading.Tasks;
using BBWY.Client.Views.PackTask;
using HandyControl.Tools.Extension;
using Newtonsoft.Json;
using BBWY.Client.Models.APIModel.Response.PackTask;
using BBWY.Client.Models.PackTask;
using WebSocketSharp;
namespace BBWY.Client.ViewModels.PackTask
{
///
///
///
public partial class TaskListViewModel : 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;
public int PageIndex { get => pageIndex; set { Set(ref pageIndex, value); } }
public int PageSize { get => pageSize; set { Set(ref pageSize, value); } }
private int orderCount;//总数量
public int OrderCount { get => orderCount; set { Set(ref orderCount, value); } }
///
/// 未到货数量
///
public string NoArrivedCount { get => noArrivedCount; set { Set(ref noArrivedCount, value); } }
private string noArrivedCount;
private string someArrivedCount;
///
/// 部分到货数量
///
public string SomeArrivedCount { get => someArrivedCount; set { Set(ref someArrivedCount, value); } }
private string arrivedCount;
///
/// 已到货数量
///
public string ArrivedCount { get => arrivedCount; set { Set(ref arrivedCount, value); } }
private bool isLoading;
public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } }
private string waitPackCount;
///
/// 待打包任务数
///
public string WaitPackCount { get => waitPackCount; set { Set(ref waitPackCount, value); } }
private string waitSealBoxCount;
///
/// 带封箱任务数
///
public string WaitSealBoxCount { get => waitSealBoxCount; set { Set(ref waitSealBoxCount, value); } }
private string waitFallWareCount;
///
/// 待落仓任务数
///
public string WaitFallWareCount { get => waitFallWareCount; set { Set(ref waitFallWareCount, value); } }
private string waitOutbound;
///
/// 待出库任务数
///
public string WaitOutbound { get => waitOutbound; set { Set(ref waitOutbound, value); } }
private string waitCompleted;
///
/// 待完成任务数
///
public string WaitCompleted { get => waitCompleted; set { Set(ref waitCompleted, value); } }
private readonly PackTaskService packTaskService;
WorkProcessService workProcessService;
public int? taskStatus { get; set; }
private ObservableCollection packTaskList;
///
/// 动态数据表
///
public ObservableCollection PackTaskList { get => packTaskList; set { Set(ref packTaskList, value); } }
#endregion
public TaskListViewModel(PackTaskService packTaskService, GlobalContext globalContext, ProductService productService, ConsumableService consumableService, WorkProcessService workProcessService, IncreateServiceService increateServiceService)
{
this.globalContext = globalContext;
this.productService = productService;
this.consumableService = consumableService;
this.workProcessService = workProcessService;
this.increateServiceService = increateServiceService;
this.packTaskService = packTaskService;
PackTaskList = new ObservableCollection();//初始化数据
SetTaskStateCommand = new RelayCommand(SetTaskState);
CreateTaskCommand = new RelayCommand(CreateTask);
SearchTaskCommand = new RelayCommand(() =>
{
PageIndex = 1;
Task.Factory.StartNew(() => SearchTaskList()); //手动点击查询订单
});
TaskPageIndexChangedCommand = new RelayCommand(p =>
{
LoadIndex(p.PageIndex);
});
OpenSkuDetailCommand = new RelayCommand