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;
using BBWY.Client.Models.APIModel;
using BBWY.Client.Views.SealBox;
using BBWY.Client.Models.SealBox;
using BBWY.Client.ViewModels.SealBox;
using BBWY.Client.Views.FallWare;
using BBWY.Client.Models.FallWare;
using BBWY.Client.Views.TaskOverTime;
using BBWY.Client.APIServices.QiKu;
namespace BBWY.Client.ViewModels.PackTask
{
///
///
///
public partial class TaskListViewModel : BaseVM, IDenpendency//注入服务
{
private QualityTaskExceptionState? qualityTaskExceptionState= Models.QualityTaskExceptionState.待验收;
///
/// 任务状态
///
public QualityTaskExceptionState? QualityTaskExceptionState
{
get => qualityTaskExceptionState; set
{
Set(ref qualityTaskExceptionState, value);
}
}
#region 属性绑定
private string waitTransportJDWareCount;
public string WaitTransportJDWareCount { get => waitTransportJDWareCount; set { Set(ref waitTransportJDWareCount, value); } }
private string waitTransportCloudWareCount;
public string WaitTransportCloudWareCount { get => waitTransportCloudWareCount; set { Set(ref waitTransportCloudWareCount, value); } }
private string waitTransportJuShuiTanCount;
public string WaitTransportJuShuiTanCount { get => waitTransportJuShuiTanCount; set { Set(ref waitTransportJuShuiTanCount, value); } }
private string waitTransportStoreWareCount;
public string WaitTransportStoreWareCount { get => waitTransportStoreWareCount; set { Set(ref waitTransportStoreWareCount, value); } }
private ObservableCollection waitCompletedList;
///
/// 待完结列表
///
public ObservableCollection WaitCompletedList { get => waitCompletedList; set { Set(ref waitCompletedList, value); } }
private string sealBoxWaitConfigureCount;
///
/// 封箱 待配置数
///
public string SealBoxWaitConfigureCount { get => sealBoxWaitConfigureCount; set { Set(ref sealBoxWaitConfigureCount, value); } }
private string sealBoxConfiguredCount;
///
///封箱 已配置数
///
public string SealBoxConfiguredCount { get => sealBoxConfiguredCount; set { Set(ref sealBoxConfiguredCount, value); } }
private SealBoxConfigureType sealBoxConfigureType;
///
/// 封箱配置状态
///
public SealBoxConfigureType SealBoxConfigureType { get => sealBoxConfigureType; set { Set(ref sealBoxConfigureType, value); } }
//private SealBoxConfigureType fallWareConfigureType;
/////
///// 落仓配置状态
/////
//public SealBoxConfigureType FallWareConfigureType { get => fallWareConfigureType; set { Set(ref fallWareConfigureType, value); } }
private ObservableCollection sealBoxWaitConfigureList;
///
/// 封箱待配置列表
///
public ObservableCollection SealBoxWaitConfigureList { get => sealBoxWaitConfigureList; set { Set(ref sealBoxWaitConfigureList, value); } }
private ObservableCollection sealBoxConfiguredList;
///
/// 封箱已配置列表
///
public ObservableCollection SealBoxConfiguredList { get => sealBoxConfiguredList; set { Set(ref sealBoxConfiguredList, value); } }
private ObservableCollection fallWareWaitConfigureList;
///
/// 落仓待配置列表
///
public ObservableCollection FallWareWaitConfigureList { get => fallWareWaitConfigureList; set { Set(ref fallWareWaitConfigureList, value); } }
private ObservableCollection fallWareConfiguredList;
///
/// 落仓已配置列表
///
public ObservableCollection FallWareConfiguredList { get => fallWareConfiguredList; set { Set(ref fallWareConfiguredList, value); } }
private ObservableCollection waitTransportList;
///
/// 待转运列表
///
public ObservableCollection WaitTransportList { get => waitTransportList; set { Set(ref waitTransportList, value); } }
public List WareWaitTransports { get; set; }
/////
///// 查询时间段
/////
//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); } }
///
/// 查询Spu
///
private string searchSpuId;
public string SearchSpuId { get => searchSpuId; set { Set(ref searchSpuId, value); } }
///
/// 查询拳探订单号
///
private string searchOrderSn;
public string SearchOrderSn { get => searchOrderSn; set { Set(ref searchOrderSn, value); } }
private TaskState? taskState;
///
/// 任务状态
///
public TaskState? TaskState
{
get => taskState; 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 waitScheduleCount;
///
/// 待排单任务数
///
public string WaitScheduleCount { get => waitScheduleCount; set { Set(ref waitScheduleCount, 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 waitTransportCount;
///
/// 待转运
///
public string WaitTransportCount { get => waitTransportCount; set { Set(ref waitTransportCount, value); } }
//private string waitCompleted;
/////
///// 待完成任务数
/////
//public string WaitCompleted { get => waitCompleted; set { Set(ref waitCompleted, value); } }
private WareType selectWareType;
public WareType SelectWareType { get => selectWareType; set { Set(ref selectWareType, value); } }
private SealBoxService sealBoxService;
private PackTaskService packTaskService;
private ObservableCollection packTaskList;
///
/// 动态数据表
///
public ObservableCollection PackTaskList { get => packTaskList; set { Set(ref packTaskList, value); } }
#endregion
private ObservableCollection storeGetSelfDataList;
///
/// 商家自取记录任务列表
///
public ObservableCollection StoreGetSelfDataList { get => storeGetSelfDataList; set { Set(ref storeGetSelfDataList, value); } }
QualityTaskService qualityTaskService;
private string packagingTaskExceptionCount;
///
/// 验收异常总数
///
public string PackagingTaskExceptionCount { get => packagingTaskExceptionCount; set { Set(ref packagingTaskExceptionCount, value); } }
private string packagingTaskCount;
///
/// 待包装总数
///
public string PackagingTaskCount { get => packagingTaskCount; set { Set(ref packagingTaskCount, value); } }
private string qualityExceptionCount;
///
/// 验收异常总数
///
public string QualityExceptionCount { get => qualityExceptionCount; set { Set(ref qualityExceptionCount, value); } }
private string qualityTaskCount;
///
/// 验收异常总数
///
public string QualityTaskCount { get => qualityTaskCount; set { Set(ref qualityTaskCount, value); } }
private PackagingTaskExceptionState? packagingTaskExceptionState;
///
/// 任务状态
///
public PackagingTaskExceptionState? PackagingTaskExceptionState
{
get => packagingTaskExceptionState; set
{
Set(ref packagingTaskExceptionState, value);
}
}
///
/// 设置仓库类型
///
public ICommand SetWareTypeCommand { get; set; }
///
/// 修改任务状态
///
public ICommand UpdateTaskStateCommand { get; set; }
public ICommand LoadSealBoxSkuDataCommand { get; set; }
///
/// 添加封箱商品
///
public ICommand AddSealBoxProductCommand { get; set; }
///
/// 提交过期时间数据
///
public ICommand SubmitOverTimeMarkMsgCommand { get; set; }
///
/// 设置落仓配置信息(上传材料)
///
public ICommand SetFallWareConfiguredCommand { get; set; }
///
/// 修改封箱数据
///
public ICommand UpdateSealBoxConfiguredCommand { get; set; }
///
/// 配置封箱策略
///
public ICommand ConfiguredSealBoxCommand { get; set; }
///
/// 待配置 /已配置
///
public ICommand SetSealBoxConfigureTypeCommand { get; set; }
///
/// 筛选数据
///
public ICommand SetTaskStateCommand { get; set; }
///
/// 搜索数据
///
public ICommand SearchTaskCommand { get; set; }
///
/// 创建任务
///
public ICommand CreateTaskCommand { get; set; }
///
/// 页面改变事件
///
public ICommand TaskPageIndexChangedCommand { get; set; }
///
/// 打开图片链接
///
public ICommand OpenSkuDetailCommand { get; set; }
///
/// 删除任务
///
public ICommand DeletedTaskCommand { get; set; }
public ICommand ShowMoreMessageCommand { get; set; }
public ICommand PackTaskMarkMessageCommand { get; set; }
public ICommand AppendMarkMessageCommand { get; set; }
public ICommand SetQualityTaskExceptionStateCommand { get; set; }
public ICommand SetPackagingTaskExceptionStateCommand { get; set; }
public TaskListViewModel(PackTaskService packTaskService, GlobalContext globalContext, SealBoxService sealBoxService, ProductService productService, MarkMessageService markMessageService, PackagingTaskService packagingTaskService, QualityTaskService qualityTaskService)
{
this.globalContext = globalContext;
this.markMessageService = markMessageService;
this.packTaskService = packTaskService;
PackTaskList = new ObservableCollection();//初始化数据
SetTaskStateCommand = new RelayCommand(SetTaskState);
SetSealBoxConfigureTypeCommand = new RelayCommand(s =>
{
SealBoxConfigureType = s;
Task.Factory.StartNew(() => SearchTaskList());
});
CreateTaskCommand = new RelayCommand(CreateTask);
SearchTaskCommand = new RelayCommand(() =>
{
PageIndex = 1;
SearchTaskList(); //手动点击查询订单
});
TaskPageIndexChangedCommand = new RelayCommand(p =>
{
LoadIndex(p.PageIndex);
});
OpenSkuDetailCommand = new RelayCommand