You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2146 lines
80 KiB
2146 lines
80 KiB
using BBWY.Client.APIServices;
|
|
using BBWY.Client.Models;
|
|
using BBWY.Common.Models;
|
|
using BBWY.Controls;
|
|
using GalaSoft.MvvmLight.Command;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Input;
|
|
using System.Linq;
|
|
using System.Windows;
|
|
|
|
using BBWY.Client.Models.APIModel;
|
|
using BBWY.Client.Models.PackTask;
|
|
using BBWY.Client.Views.SealBox;
|
|
using BBWY.Client.Views.FallWare;
|
|
using BBWY.Client.Models.FallWare;
|
|
using WebSocketSharp;
|
|
using System.Threading;
|
|
using BBWY.Client.Helpers;
|
|
using BBWY.Client.Views.TaskOverTime;
|
|
using BBWY.Client.Views.StorePickSelf;
|
|
using System.Diagnostics.Eventing.Reader;
|
|
using BBWY.Client.Models.SealBox;
|
|
using Newtonsoft.Json;
|
|
using System.Diagnostics;
|
|
using BBWY.Client.Extensions;
|
|
|
|
namespace BBWY.Client.ViewModels.PackTask
|
|
{
|
|
|
|
public partial class WareHouseListViewModel : BaseVM, IDenpendency//注入服务
|
|
{
|
|
//public RelayCommand<string> SelectCmd => new RelayCommand<string>(str => Growl.Info(str));
|
|
#region 属性绑定
|
|
|
|
private ObservableCollection<string> selectTitleList = new ObservableCollection<string> {
|
|
"SKU名称","标题"
|
|
};
|
|
|
|
public ObservableCollection<string> SelectTitleList { get => selectTitleList; set { Set(ref selectTitleList, value); } }
|
|
|
|
|
|
|
|
private ObservableCollection<string> selectExpressList = new ObservableCollection<string> {
|
|
"物流单号","物流公司名称"
|
|
};
|
|
|
|
public ObservableCollection<string> SelectExpressList { get => selectExpressList; set { Set(ref selectExpressList, value); } }
|
|
|
|
|
|
private ObservableCollection<string> selectSkuList = new ObservableCollection<string> {
|
|
"SKU","SPU"
|
|
};
|
|
|
|
public ObservableCollection<string> SelectSkuList { get => selectSkuList; set { Set(ref selectSkuList, value); } }
|
|
|
|
private ObservableCollection<string> selectIdList = new ObservableCollection<string> {
|
|
"任务ID","拳探订单号"
|
|
};
|
|
public ObservableCollection<string> SelectIdList { get => selectIdList; set { Set(ref selectIdList, value); } }
|
|
|
|
private ObservableCollection<string> selectShopList = new ObservableCollection<string> {
|
|
"店铺","部门"
|
|
};
|
|
public ObservableCollection<string> SelectShopList { get => selectShopList; set { Set(ref selectShopList, value); } }
|
|
|
|
|
|
/// <summary>
|
|
/// 查询名称
|
|
/// </summary>
|
|
private string selectTitle = "SKU名称";
|
|
public string SelectTitle
|
|
{
|
|
get => selectTitle;
|
|
|
|
|
|
set
|
|
{
|
|
Set(ref selectTitle, value);
|
|
|
|
OnSelectTitleChanged(SelectTitle);
|
|
}
|
|
}
|
|
|
|
private void OnSelectTitleChanged(string SelectTitle)
|
|
{
|
|
if (SelectTitle == "SKU名称")
|
|
{
|
|
SearchSpuTitle = null;
|
|
}
|
|
if (SelectTitle == "标题")
|
|
{
|
|
SearchSkuTitle = null;
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询店铺
|
|
/// </summary>
|
|
private string selectShop = "店铺";
|
|
public string SelectShop
|
|
{
|
|
get => selectShop;
|
|
|
|
|
|
set
|
|
{
|
|
Set(ref selectShop, value);
|
|
|
|
OnSelectShopChanged(selectShop);
|
|
}
|
|
}
|
|
|
|
private void OnSelectShopChanged(string selectShop)
|
|
{
|
|
if (selectShop == "店铺")
|
|
{
|
|
SearchDepartment = null;
|
|
}
|
|
if (selectShop == "部门")
|
|
{
|
|
SearchShopName = null;
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询物流
|
|
/// </summary>
|
|
private string selectExpress;
|
|
public string SelectExpress
|
|
{
|
|
get => selectExpress;
|
|
|
|
|
|
set
|
|
{
|
|
Set(ref selectExpress, value);
|
|
|
|
OnSelectExpressChanged(SelectExpress);
|
|
}
|
|
}
|
|
|
|
private void OnSelectExpressChanged(string SelectExpress)
|
|
{
|
|
if (SelectExpress == "物流单号")
|
|
{
|
|
SearchExpressName = null;
|
|
}
|
|
if (SelectExpress == "物流公司名称")
|
|
{
|
|
SearchWayBillNo = null;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 查询物流
|
|
/// </summary>
|
|
private string selectTaskId = "任务ID";
|
|
public string SelectTaskId
|
|
{
|
|
get => selectTaskId;
|
|
|
|
|
|
set
|
|
{
|
|
Set(ref selectTaskId, value);
|
|
|
|
OnSelectTaskIdChanged(SelectTaskId);
|
|
}
|
|
}
|
|
|
|
private void OnSelectTaskIdChanged(string SelectTaskId)
|
|
{
|
|
if (SelectTaskId == "任务ID")
|
|
{
|
|
SearchOrderSn = null;
|
|
}
|
|
if (SelectTaskId == "拳探订单号")
|
|
{
|
|
SearchTaskId = null;
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// 查询sku
|
|
/// </summary>
|
|
private string selectSku;
|
|
public string SelectSku
|
|
{
|
|
get => selectSku;
|
|
set
|
|
{
|
|
Set(ref selectSku, value);
|
|
OnSelectSkuChanged(SelectSku);
|
|
}
|
|
}
|
|
private void OnSelectSkuChanged(string SelectSku)
|
|
{
|
|
if (SelectSku == "SKU")
|
|
{
|
|
SearchSpuId = null;
|
|
}
|
|
if (SelectSku == "SPU")
|
|
{
|
|
SearchSkuId = null;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 查询时间段
|
|
/// </summary>
|
|
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); } }
|
|
|
|
|
|
|
|
public IList<OverTimeTaskResponse> OverTimeTaskResponses { get; set; }
|
|
|
|
private ObservableCollection<OverTimeTaskResponse> overTimeTaskList;
|
|
/// <summary>
|
|
/// 超时任务列表
|
|
/// </summary>
|
|
public ObservableCollection<OverTimeTaskResponse> OverTimeTaskList { get => overTimeTaskList; set { Set(ref overTimeTaskList, value); } }
|
|
|
|
private ObservableCollection<OverTimeTaskType> overTimeTaskTypeList = new ObservableCollection<OverTimeTaskType> {
|
|
OverTimeTaskType.全部, OverTimeTaskType.待验收, OverTimeTaskType.待排单, OverTimeTaskType.待打包, OverTimeTaskType.待封箱, OverTimeTaskType.待落仓, OverTimeTaskType.待转运
|
|
};
|
|
/// <summary>
|
|
///超时任务类型
|
|
/// </summary>
|
|
public ObservableCollection<OverTimeTaskType> OverTimeTaskTypeList { get => overTimeTaskTypeList; set { Set(ref overTimeTaskTypeList, value); } }
|
|
|
|
private ObservableCollection<OverTimeTaskState> overTimeTaskStateList = new ObservableCollection<OverTimeTaskState> {
|
|
Models.OverTimeTaskState.未完成 , Models.OverTimeTaskState.已完成, OverTimeTaskState.全部
|
|
};
|
|
/// <summary>
|
|
///超时任务类型
|
|
/// </summary>
|
|
public ObservableCollection<OverTimeTaskState> OverTimeTaskStateList { get => overTimeTaskStateList; set { Set(ref overTimeTaskStateList, value); } }
|
|
|
|
|
|
|
|
private OverTimeTaskType overTimeTaskType = OverTimeTaskType.全部;
|
|
/// <summary>
|
|
/// 任务类型(超时)
|
|
/// </summary>
|
|
public OverTimeTaskType OverTimeTaskType { get => overTimeTaskType; set { Set(ref overTimeTaskType, value); } }
|
|
|
|
private OverTimeTaskState overTimeTaskState = OverTimeTaskState.全部;
|
|
/// <summary>
|
|
/// 任务类型(超时)
|
|
/// </summary>
|
|
public OverTimeTaskState OverTimeTaskState { get => overTimeTaskState; set { Set(ref overTimeTaskState, value); } }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 string searchWayBillNo;
|
|
public string SearchWayBillNo
|
|
{
|
|
get => searchWayBillNo; set
|
|
{
|
|
Set(ref searchWayBillNo, value);
|
|
}
|
|
}
|
|
private string searchExpressName;
|
|
public string SearchExpressName
|
|
{
|
|
get => searchExpressName; set
|
|
{
|
|
Set(ref searchExpressName, value);
|
|
}
|
|
}
|
|
|
|
public string fallWareWaitConfigureCount;
|
|
public string FallWareWaitConfigureCount { get => fallWareWaitConfigureCount; set { Set(ref fallWareWaitConfigureCount, value); } }
|
|
|
|
public string fallWareConfiguredCount;
|
|
public string FallWareConfiguredCount { get => fallWareConfiguredCount; set { Set(ref fallWareConfiguredCount, value); } }
|
|
|
|
private ObservableCollection<WareWaitCompleted> waitCompletedList;
|
|
/// <summary>
|
|
/// 待完结列表
|
|
/// </summary>
|
|
public ObservableCollection<WareWaitCompleted> WaitCompletedList { get => waitCompletedList; set { Set(ref waitCompletedList, value); } }
|
|
|
|
public List<WareWaitCompleted> WaitCompleteds { get; set; }
|
|
|
|
|
|
private ObservableCollection<WareWaitTransport> waitTransportList;
|
|
/// <summary>
|
|
/// 待转运列表
|
|
/// </summary>
|
|
public ObservableCollection<WareWaitTransport> WaitTransportList { get => waitTransportList; set { Set(ref waitTransportList, value); } }
|
|
|
|
public List<WareWaitTransport> WareWaitTransports { get; set; }
|
|
|
|
|
|
|
|
private ObservableCollection<WaitFallWareModel> waitFallWareList;
|
|
/// <summary>
|
|
/// 待落仓列表
|
|
/// </summary>
|
|
public ObservableCollection<WaitFallWareModel> WaitFallWareList { get => waitFallWareList; set { Set(ref waitFallWareList, value); } }
|
|
|
|
public IList<WaitFallWareModelResponse> WaitFallWareLists { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
private ObservableCollection<WareNoSealBoxModel> wareNoSealBoxModels;
|
|
/// <summary>
|
|
/// 分箱列表(未配置)
|
|
/// </summary>
|
|
public ObservableCollection<WareNoSealBoxModel> WareNoSealBoxModels { get => wareNoSealBoxModels; set { Set(ref wareNoSealBoxModels, value); } }
|
|
|
|
/// <summary>
|
|
/// 分箱列表
|
|
/// </summary>
|
|
public List<WareNoSealBoxData> WaitSealBoxModelList { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ObservableCollection<SealBoxModel> waitSealBoxModels;
|
|
/// <summary>
|
|
/// 分箱列表(已配置)
|
|
/// </summary>
|
|
public ObservableCollection<SealBoxModel> WaitSealBoxModels { get => waitSealBoxModels; set { Set(ref waitSealBoxModels, value); } }
|
|
/// <summary>
|
|
/// 分箱列表(已配置)
|
|
/// </summary>
|
|
public List<WareSealBoxData> SealBoxModelList { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
private ObservableCollection<PackTaskModel> packTaskList;
|
|
/// <summary>
|
|
/// 打包任务列表
|
|
/// </summary>
|
|
public ObservableCollection<PackTaskModel> PackTaskList { get => packTaskList; set { Set(ref packTaskList, value); } }
|
|
|
|
|
|
|
|
private ObservableCollection<StoreGetSelfData> storeGetSelfDataList;
|
|
/// <summary>
|
|
/// 商家自取记录任务列表
|
|
/// </summary>
|
|
public ObservableCollection<StoreGetSelfData> StoreGetSelfDataList { get => storeGetSelfDataList; set { Set(ref storeGetSelfDataList, value); } }
|
|
|
|
private string searchShopName;
|
|
public string SearchShopName
|
|
{
|
|
get => searchShopName; set
|
|
{
|
|
Set(ref searchShopName, value);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询任务id
|
|
/// </summary>
|
|
private string searchTaskId;
|
|
public string SearchTaskId
|
|
{
|
|
get => searchTaskId; set
|
|
{
|
|
Set(ref searchTaskId, value);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询任务id
|
|
/// </summary>
|
|
private string searchSealBoxId;
|
|
public string SearchSealBoxId
|
|
{
|
|
get => searchSealBoxId; set
|
|
{
|
|
Set(ref searchSealBoxId, value);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询Sku
|
|
/// </summary>
|
|
private string searchSkuId;
|
|
public string SearchSkuId { get => searchSkuId; set { Set(ref searchSkuId, value); } }
|
|
|
|
/// <summary>
|
|
/// 查询Spu
|
|
/// </summary>
|
|
private string searchSpuId;
|
|
public string SearchSpuId { get => searchSpuId; set { Set(ref searchSpuId, value); } }
|
|
|
|
/// <summary>
|
|
/// 查询拳探订单号
|
|
/// </summary>
|
|
private string searchOrderSn;
|
|
public string SearchOrderSn { get => searchOrderSn; set { Set(ref searchOrderSn, value); } }
|
|
|
|
|
|
|
|
private TaskState? taskState;
|
|
/// <summary>
|
|
/// 任务状态
|
|
/// </summary>
|
|
public TaskState? TaskState
|
|
{
|
|
get => taskState; set
|
|
{
|
|
Set(ref taskState, value);
|
|
}
|
|
}
|
|
|
|
private int pageIndex = 1;
|
|
private int pageSize = 10;
|
|
private int orderCount;//总数量
|
|
|
|
private Visibility tipVisitity;
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public Visibility TipVisitity { get => tipVisitity; set { Set(ref tipVisitity, value); } }
|
|
|
|
/// <summary>
|
|
/// 未到货数量
|
|
/// </summary>
|
|
public string NoArrivedCount { get => noArrivedCount; set { Set(ref noArrivedCount, value); } }
|
|
private string noArrivedCount;
|
|
private string someArrivedCount;
|
|
/// <summary>
|
|
/// 部分到货数量
|
|
/// </summary>
|
|
public string SomeArrivedCount { get => someArrivedCount; set { Set(ref someArrivedCount, value); } }
|
|
private string worryCount;
|
|
/// <summary>
|
|
/// 加急数
|
|
/// </summary>
|
|
public string WorryCount { get => worryCount; set { Set(ref worryCount, value); } }
|
|
|
|
|
|
private string arrivedCount;
|
|
/// <summary>
|
|
/// 已到货数量
|
|
/// </summary>
|
|
public string ArrivedCount { get => arrivedCount; set { Set(ref arrivedCount, value); } }
|
|
|
|
|
|
|
|
|
|
|
|
private string waitScheduleCount;
|
|
/// <summary>
|
|
/// 待排单任务数
|
|
/// </summary>
|
|
public string WaitScheduleCount { get => waitScheduleCount; set { Set(ref waitScheduleCount, value); } }
|
|
|
|
private string waitPackCount;
|
|
/// <summary>
|
|
/// 待打包任务数
|
|
/// </summary>
|
|
public string WaitPackCount { get => waitPackCount; set { Set(ref waitPackCount, value); } }
|
|
private string waitSealBoxCount;
|
|
/// <summary>
|
|
/// 带封箱任务数
|
|
/// </summary>
|
|
public string WaitSealBoxCount { get => waitSealBoxCount; set { Set(ref waitSealBoxCount, value); } }
|
|
|
|
|
|
|
|
private string waitFallWareCount;
|
|
/// <summary>
|
|
/// 待落仓任务数
|
|
/// </summary>
|
|
public string WaitFallWareCount { get => waitFallWareCount; set { Set(ref waitFallWareCount, value); } }
|
|
|
|
private string waitOutbound;
|
|
/// <summary>
|
|
/// 待出库任务数
|
|
/// </summary>
|
|
public string WaitOutbound { get => waitOutbound; set { Set(ref waitOutbound, value); } }
|
|
|
|
|
|
private string waitCompleted;
|
|
/// <summary>
|
|
/// 待完成任务数
|
|
/// </summary>
|
|
public string WaitCompleted { get => waitCompleted; set { Set(ref waitCompleted, value); } }
|
|
|
|
|
|
private string waitTransportCount;
|
|
/// <summary>
|
|
/// 待转运
|
|
/// </summary>
|
|
public string WaitTransportCount { get => waitTransportCount; set { Set(ref waitTransportCount, 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); } }
|
|
|
|
|
|
|
|
public string searchDepartment;
|
|
public string SearchDepartment
|
|
{
|
|
get => searchDepartment; set
|
|
{
|
|
Set(ref searchDepartment, value);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public string searchSpuTitle;
|
|
public string SearchSpuTitle
|
|
{
|
|
get => searchSpuTitle; set
|
|
{
|
|
Set(ref searchSpuTitle, value);
|
|
|
|
}
|
|
}
|
|
|
|
public string searchSkuTitle;
|
|
public string SearchSkuTitle
|
|
{
|
|
get => searchSkuTitle; set
|
|
{
|
|
Set(ref searchSkuTitle, value);
|
|
|
|
}
|
|
}
|
|
|
|
private SealBoxConfigureType sealBoxConfigureType;
|
|
/// <summary>
|
|
/// 封箱配置状态
|
|
/// </summary>
|
|
public SealBoxConfigureType SealBoxConfigureType { get => sealBoxConfigureType; set { Set(ref sealBoxConfigureType, value); } }
|
|
|
|
|
|
private WareType selectWareType;
|
|
|
|
public WareType SelectWareType { get => selectWareType; set { Set(ref selectWareType, value); } }
|
|
#endregion
|
|
|
|
private readonly PackTaskService packTaskService;
|
|
private readonly SealBoxService sealBoxService;
|
|
public GlobalContext globalContext;
|
|
public WareHouseListViewModel(PackTaskService packTaskService, GlobalContext globalContext, SealBoxService sealBoxService)
|
|
{
|
|
|
|
|
|
|
|
this.globalContext = globalContext;
|
|
this.sealBoxService = sealBoxService;
|
|
this.packTaskService = packTaskService;
|
|
|
|
//Messenger.Default.Send(globalContext, "AcceptGlobalContext");
|
|
PackTaskList = new ObservableCollection<PackTaskModel>();//初始化数据
|
|
|
|
SetTaskStateCommand = new RelayCommand<TaskState?>(SetTaskState);
|
|
|
|
SearchTaskCommand = new RelayCommand(() =>
|
|
{
|
|
SearchTaskList(); //手动点击查询订单
|
|
});
|
|
TaskPageIndexChangedCommand = new RelayCommand<PageArgs>(p =>
|
|
{
|
|
LoadIndex(p.PageIndex);
|
|
});
|
|
|
|
OpenSkuDetailCommand = new RelayCommand<object>(OpenSkuDetail);
|
|
|
|
StartTime = DateTime.Now.Date;
|
|
EndTime = DateTime.Now.Date;
|
|
IsLoading = false;
|
|
TaskState = null;
|
|
//加载数据
|
|
SelectWareType = WareType.云仓;
|
|
SetTaskState(null);
|
|
|
|
UpdateTaskStateCommand = new RelayCommand<object>(UpdateTaskState);
|
|
|
|
CompeteSealBoxCommand = new RelayCommand<object>(CompeteSealBox);
|
|
|
|
SetSealBoxCommand = new RelayCommand<object>(SetSealBox);
|
|
CompeteFallWareCommand = new RelayCommand<object>(CompeteFallWare);
|
|
SealBoxConfigureType = SealBoxConfigureType.待配置;
|
|
PositionState = PositionState.待落仓;
|
|
SetSealBoxConfigureTypeCommand = new RelayCommand<SealBoxConfigureType>(s =>
|
|
{
|
|
|
|
SealBoxConfigureType = s;
|
|
PositionState = s == SealBoxConfigureType.已配置 ? PositionState.已配置待落仓 : PositionState.待落仓;
|
|
SearchTaskList();
|
|
});
|
|
|
|
|
|
|
|
LookBoxConfigureCommand = new RelayCommand<object>(LookBoxConfigure);
|
|
|
|
PrintBoxConfigureCommand = new RelayCommand<object>(PrintBoxConfigure);
|
|
|
|
DeletedTaskCommand = new RelayCommand<object>(DeletedTask);
|
|
|
|
StoreGetBySelfCommand = new RelayCommand<long>(StoreGetBySelf);
|
|
|
|
CompletedPackTaskCommand = new RelayCommand<object>(CompletedPackTask);
|
|
|
|
SetWareTypeCommand = new RelayCommand<WareType>(s =>
|
|
{
|
|
|
|
SelectWareType = s;
|
|
SearchTaskList();
|
|
});
|
|
|
|
CompeteWaitTransportCommand = new RelayCommand<object>(CompeteWaitTransport);
|
|
|
|
CompeteWaitCompletedCommand = new RelayCommand<object>(CompeteWaitCompleted);
|
|
PrintSealBoxDetailsCommand = new RelayCommand<object>(PrintSealBoxDetails);
|
|
|
|
PrintLSOrderConfigureCommand = new RelayCommand<object>(PrintLSOrderConfigure);
|
|
|
|
LookLSOrderConfigureCommand = new RelayCommand<object>(LookLSOrderConfigure);
|
|
SubmitOverTimeMarkMsgCommand = new RelayCommand<object>(SubmitOverTimeMarkMsg);
|
|
|
|
SendToSetSkuConfigureCommand = new RelayCommand<PackTaskModel>(SendToSetSkuConfigure);
|
|
SelectSku = "SKU";
|
|
SelectExpress = "物流单号";
|
|
LoadSkuDataCommand = new RelayCommand<WareNoSealBoxModel>(LoadSkuData);
|
|
|
|
LoadSealBoxSkuDataCommand = new RelayCommand<SealBoxModel>(LoadSealBoxSkuData);
|
|
|
|
LoadFallWareSkuDataCommand = new RelayCommand<WaitFallWareModel>(LoadFallWareSkuData);
|
|
|
|
|
|
LoadTransportSkuDataCommand = new RelayCommand<WareWaitTransport>(LoadTransportSkuData);
|
|
|
|
LoadCompletedSkuDataCommand = new RelayCommand<WareWaitCompleted>(LoadCompletedSkuData);
|
|
}
|
|
|
|
private void LoadCompletedSkuData(WareWaitCompleted model)
|
|
{
|
|
if (model.WaitTransportSkus == null || model.WaitTransportSkus.Count <= 0)
|
|
{
|
|
var skuDatas = WaitCompleteds.SingleOrDefault(w => w.SealBoxId == model.SealBoxId);
|
|
WaitCompletedList.SingleOrDefault(w => w.SealBoxId == model.SealBoxId).WaitTransportSkus = skuDatas.WaitTransportSkus;
|
|
}
|
|
else
|
|
{
|
|
WaitCompletedList.SingleOrDefault(w => w.SealBoxId == model.SealBoxId).WaitTransportSkus = null;
|
|
}
|
|
}
|
|
|
|
private void LoadTransportSkuData(WareWaitTransport model)
|
|
{
|
|
if (model.WaitTransportSkus == null || model.WaitTransportSkus.Count <= 0)
|
|
{
|
|
var skuDatas = WareWaitTransports.SingleOrDefault(w => w.SealBoxId == model.SealBoxId);
|
|
WaitTransportList.SingleOrDefault(w => w.SealBoxId == model.SealBoxId).WaitTransportSkus = skuDatas.WaitTransportSkus;
|
|
}
|
|
else
|
|
{
|
|
WaitTransportList.SingleOrDefault(w => w.SealBoxId == model.SealBoxId).WaitTransportSkus = null;
|
|
}
|
|
}
|
|
|
|
|
|
private void LoadFallWareSkuData(WaitFallWareModel model)
|
|
{
|
|
if (model.SealBoxSkus == null || model.SealBoxSkus.Count <= 0)
|
|
{
|
|
var skuDatas = WaitFallWareLists.SingleOrDefault(w => w.SealBoxId == model.SealBoxId);
|
|
WaitFallWareList.SingleOrDefault(w => w.SealBoxId == model.SealBoxId).SealBoxSkus = skuDatas.SealBoxSkus;
|
|
}
|
|
else
|
|
{
|
|
WaitFallWareList.SingleOrDefault(w => w.SealBoxId == model.SealBoxId).SealBoxSkus = null;
|
|
}
|
|
}
|
|
|
|
private void LoadSealBoxSkuData(SealBoxModel model)
|
|
{
|
|
if (model.SealBoxSkus == null || model.SealBoxSkus.Count <= 0)
|
|
{
|
|
var skuDatas = SealBoxModelList.SingleOrDefault(w => w.SealBoxId == model.SealBoxId);
|
|
WaitSealBoxModels.SingleOrDefault(w => w.SealBoxId == model.SealBoxId).SealBoxSkus = skuDatas.SealBoxSkus;
|
|
}
|
|
else
|
|
{
|
|
WaitSealBoxModels.SingleOrDefault(w => w.SealBoxId == model.SealBoxId).SealBoxSkus = null;
|
|
}
|
|
}
|
|
|
|
|
|
private void LoadSkuData(WareNoSealBoxModel model)
|
|
{
|
|
|
|
if (model.SealBoxSkus == null || model.SealBoxSkus.Count <= 0)
|
|
{
|
|
var skuDatas = WaitSealBoxModelList.SingleOrDefault(w => w.ShopId == model.ShopId);
|
|
WareNoSealBoxModels.SingleOrDefault(w => w.ShopId == model.ShopId).SealBoxSkus = skuDatas.SealBoxSkus;
|
|
}
|
|
else
|
|
{
|
|
WareNoSealBoxModels.SingleOrDefault(w => w.ShopId == model.ShopId).SealBoxSkus = new List<WareNoSealBoxSku>();
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
private void SendToSetSkuConfigure(PackTaskModel model)
|
|
{
|
|
if (model.SendToSetSkuConfigureTime != null)
|
|
{
|
|
System.Windows.MessageBox.Show($"已提醒配置,提醒时间:{model.SendToSetSkuConfigureTime},请耐心等待");
|
|
return;
|
|
}
|
|
|
|
|
|
var res = packTaskService.SendToSetSkuConfigure(model.TaskId);
|
|
if (!res.Success)
|
|
{
|
|
System.Windows.MessageBox.Show(res.Msg);
|
|
}
|
|
if (res.Success)
|
|
{
|
|
SearchTaskList();
|
|
}
|
|
}
|
|
|
|
private void SubmitOverTimeMarkMsg(object param)
|
|
{
|
|
|
|
var paramList = (object[])param;
|
|
var id = (long)paramList[0];
|
|
var markMsg = paramList[1]?.ToString();
|
|
|
|
|
|
OverTimeTaskType overTimeTaskType = OverTimeTaskType.待验收;
|
|
switch (TaskState.Value)
|
|
{
|
|
case Models.TaskState.待验收:
|
|
overTimeTaskType = Models.OverTimeTaskType.待验收;
|
|
break;
|
|
case Models.TaskState.待排单:
|
|
overTimeTaskType = Models.OverTimeTaskType.待排单;
|
|
break;
|
|
case Models.TaskState.待包装:
|
|
overTimeTaskType = Models.OverTimeTaskType.待打包;
|
|
break;
|
|
case Models.TaskState.待封箱:
|
|
overTimeTaskType = Models.OverTimeTaskType.待封箱;
|
|
break;
|
|
case Models.TaskState.待落仓:
|
|
overTimeTaskType = Models.OverTimeTaskType.待落仓;
|
|
break;
|
|
case Models.TaskState.待转运:
|
|
overTimeTaskType = Models.OverTimeTaskType.待转运;
|
|
break;
|
|
}
|
|
|
|
SubmitOverTimeMarkMsgWindow submitOverTimeMarkMsgWindow = new SubmitOverTimeMarkMsgWindow(overTimeTaskType, id, markMsg, packTaskService, ReflashTask);
|
|
submitOverTimeMarkMsgWindow.ShowDialog();
|
|
}
|
|
|
|
private void LookLSOrderConfigure(object obj)
|
|
{
|
|
var model = obj as WaitFallWareModel;
|
|
|
|
if (model.WareType != WareType.京仓)
|
|
{
|
|
System.Windows.MessageBox.Show($"{model.WareType}没有揽收单,只有京仓才有揽收单.");
|
|
return;
|
|
}
|
|
|
|
if (model.BoxConfigureData == null || model.BoxConfigureData.PrewOrder.IsNullOrEmpty())
|
|
{
|
|
System.Windows.MessageBox.Show($"预约单号为空,无法查看");
|
|
return;
|
|
}
|
|
|
|
var lsdTaskMsgRes = sealBoxService.GetWareLSAcceptOrder();
|
|
if (!lsdTaskMsgRes.Success)
|
|
{
|
|
System.Windows.MessageBox.Show($"获取任务信息失败,原因:{lsdTaskMsgRes.Msg}");
|
|
return;
|
|
|
|
}
|
|
var lsdTaskMsg = lsdTaskMsgRes.Data;
|
|
|
|
var LSOrderPurchaseListRes = sealBoxService.GetWareLSOrderPurchaseList(model.BoxConfigureData.PrewOrder);
|
|
if (!LSOrderPurchaseListRes.Success)
|
|
{
|
|
System.Windows.MessageBox.Show($"获取货物信息失败,原因:{LSOrderPurchaseListRes.Msg}");
|
|
return;
|
|
|
|
}
|
|
|
|
var data = LSOrderPurchaseListRes.Data;
|
|
|
|
|
|
List<GetWareLSOrderPurchase> lookData = null;
|
|
if (data.GetWareLSOrderPurchases.Count > 10)
|
|
{
|
|
lookData = data.GetWareLSOrderPurchases.ToList().GetRange(0, 10);
|
|
}
|
|
else
|
|
{
|
|
lookData = data.GetWareLSOrderPurchases.ToList();
|
|
}
|
|
|
|
var totalPageIndex = data.GetWareLSOrderPurchases.Count() % 10 == 0 ? data.GetWareLSOrderPurchases.Count() / 10 : data.GetWareLSOrderPurchases.Count() / 10 + 1;
|
|
|
|
WareLSAcceptOrderWindow wareLSAcceptOrderWindow = new WareLSAcceptOrderWindow(lsdTaskMsg, lookData, 1, totalPageIndex, model.BoxConfigureData.PrewOrder);
|
|
wareLSAcceptOrderWindow.ShowDialog();
|
|
}
|
|
|
|
private void PrintLSOrderConfigure(object obj)
|
|
{
|
|
var model = obj as WaitFallWareModel;
|
|
|
|
if (model.WareType != WareType.京仓)
|
|
{
|
|
System.Windows.MessageBox.Show($"{model.WareType}没有揽收单,只有京仓才有揽收单.");
|
|
return;
|
|
}
|
|
|
|
if (model.BoxConfigureData == null || model.BoxConfigureData.PrewOrder.IsNullOrEmpty())
|
|
{
|
|
System.Windows.MessageBox.Show($"预约单号为空,无法查看");
|
|
return;
|
|
}
|
|
|
|
var lsdTaskMsgRes = sealBoxService.GetWareLSAcceptOrder();
|
|
if (!lsdTaskMsgRes.Success)
|
|
{
|
|
System.Windows.MessageBox.Show($"获取任务信息失败,原因:{lsdTaskMsgRes.Msg}");
|
|
return;
|
|
|
|
}
|
|
var lsdTaskMsg = lsdTaskMsgRes.Data;
|
|
|
|
var LSOrderPurchaseListRes = sealBoxService.GetWareLSOrderPurchaseList(model.BoxConfigureData.PrewOrder);
|
|
if (!LSOrderPurchaseListRes.Success)
|
|
{
|
|
System.Windows.MessageBox.Show($"获取货物信息失败,原因:{LSOrderPurchaseListRes.Msg}");
|
|
return;
|
|
|
|
}
|
|
|
|
var data = LSOrderPurchaseListRes.Data;
|
|
|
|
PrintLSOrderWindow printLS = new PrintLSOrderWindow(data.GetWareLSOrderPurchases.ToList(), model.BoxConfigureData.PrewOrder, lsdTaskMsg);
|
|
printLS.ShowDialog();
|
|
}
|
|
|
|
private void PrintSealBoxDetails(object obj)
|
|
{
|
|
var model = (SealBoxModel)obj;
|
|
|
|
SealBoxPrintDetailsWindow printDetailsWindow = new SealBoxPrintDetailsWindow(model);
|
|
printDetailsWindow.ShowDialog();
|
|
}
|
|
|
|
private void CompeteWaitCompleted(object obj)
|
|
{
|
|
var model = (WareWaitCompleted)obj;
|
|
|
|
|
|
if (System.Windows.MessageBox.Show("是否完成任务?", "提示",
|
|
MessageBoxButton.YesNo,
|
|
MessageBoxImage.Warning) != MessageBoxResult.Yes)
|
|
return;
|
|
var res = sealBoxService.WareCompetedWaitCompleted(model.SealBoxId);
|
|
if (res == null)
|
|
{
|
|
return;
|
|
}
|
|
if (!res.Success)
|
|
{
|
|
System.Windows.MessageBox.Show(res.Msg);
|
|
return;
|
|
}
|
|
Task.Factory.StartNew(() => SearchTaskList());
|
|
}
|
|
|
|
private void CompeteWaitTransport(object obj)
|
|
{
|
|
var model = (WareWaitTransport)obj;
|
|
|
|
|
|
if (System.Windows.MessageBox.Show("是否完成转运?", "提示",
|
|
MessageBoxButton.YesNo,
|
|
MessageBoxImage.Warning) != MessageBoxResult.Yes)
|
|
return;
|
|
var res = sealBoxService.WareCompeteTransport(model.SealBoxId);
|
|
if (res == null)
|
|
{
|
|
return;
|
|
}
|
|
if (!res.Success)
|
|
{
|
|
System.Windows.MessageBox.Show(res.Msg);
|
|
return;
|
|
}
|
|
Task.Factory.StartNew(() => SearchTaskList());
|
|
}
|
|
|
|
private void CompletedPackTask(object obj)
|
|
{
|
|
var model = (PackTaskModel)obj;
|
|
|
|
if (model == null || model.FeesItemResponse == null || model.FeesItemResponse.AllFees == 0)
|
|
{
|
|
System.Windows.MessageBox.Show("请先设置打包费用!");
|
|
return;
|
|
}
|
|
if (System.Windows.MessageBox.Show("是否完成打包?", "提示",
|
|
MessageBoxButton.YesNo,
|
|
MessageBoxImage.Warning) != MessageBoxResult.Yes)
|
|
return;
|
|
var res = packTaskService.CompletedPackTask(model.TaskId);
|
|
if (res == null)
|
|
{
|
|
return;
|
|
}
|
|
if (!res.Success)
|
|
{
|
|
System.Windows.MessageBox.Show(res.Msg);
|
|
return;
|
|
}
|
|
|
|
|
|
Task.Factory.StartNew(() => SearchTaskList());
|
|
}
|
|
|
|
private void StoreGetBySelf(long taskId)
|
|
{
|
|
|
|
//MessageBoxResult result = System.Windows.MessageBox.Show($"确定商家自取,任务id:{taskId}?", "提示",
|
|
// MessageBoxButton.YesNo,
|
|
// MessageBoxImage.Warning);
|
|
//if (result != MessageBoxResult.Yes) return;
|
|
|
|
var data = packTaskService.GetStoreGetSelfData(taskId);
|
|
if (!data.Success)
|
|
{
|
|
MessageBox.Show(data?.Msg);
|
|
return;
|
|
}
|
|
|
|
StorePickProductWindow sorePickProductWindow = new StorePickProductWindow(data.Data, (count, UserName) =>
|
|
{
|
|
|
|
var res = packTaskService.StoreGetBySelfV2(taskId, count, UserName);
|
|
if (res == null)
|
|
{
|
|
return false;
|
|
}
|
|
if (!res.Success)
|
|
{
|
|
System.Windows.MessageBox.Show(res.Msg, "错误信息");
|
|
return false;
|
|
}
|
|
|
|
|
|
Task.Factory.StartNew(() => SearchTaskList());
|
|
|
|
return true;
|
|
});
|
|
sorePickProductWindow.ShowDialog();
|
|
|
|
|
|
|
|
}
|
|
|
|
private void DeletedTask(object obj)
|
|
{
|
|
var packTaskmodel = (PackTaskModel)obj;
|
|
MessageBoxResult result = System.Windows.MessageBox.Show($"确定取消任务{packTaskmodel.TaskId}?", "提示",
|
|
MessageBoxButton.YesNo,
|
|
MessageBoxImage.Warning);
|
|
if (result != MessageBoxResult.Yes) return;
|
|
packTaskService.DeletedTask(packTaskmodel.TaskId);
|
|
Task.Factory.StartNew(() => SearchTaskList());
|
|
}
|
|
|
|
/// <summary>
|
|
/// todo: 打印数据
|
|
/// </summary>
|
|
/// <param name="obj"></param>
|
|
private void PrintBoxConfigure(object obj)
|
|
{
|
|
var fallware = obj as WaitFallWareModel;
|
|
|
|
JDWareBoxModel model = new JDWareBoxModel
|
|
{
|
|
ShopName = fallware.ShopName,
|
|
WareName = fallware.WareName,
|
|
SealBoxId = fallware.SealBoxId,
|
|
ProductCount = fallware.ProductCount,
|
|
BoxCount = fallware.SealBoxCount,
|
|
PrewOrder = fallware.BoxConfigureData.PrewOrder,
|
|
ProductTitle = fallware.BoxConfigureData.ProductTitle,
|
|
PurchaseOrder = fallware.BoxConfigureData.PurchaseOrder,
|
|
WaybillNo = fallware.BoxConfigureData.WaybillNo,
|
|
ProviderName = fallware.BoxConfigureData.ProviderName
|
|
};
|
|
|
|
PrintBoxWindow printBox = new PrintBoxWindow(model, fallware.WareType, sealBoxService);
|
|
printBox.ShowDialog();
|
|
//加载模板数据
|
|
|
|
//打印
|
|
}
|
|
|
|
private void LookBoxConfigure(object obj)
|
|
{
|
|
var fallware = obj as WaitFallWareModel;//WaitFallWareModel
|
|
if (fallware == null)
|
|
{
|
|
MessageBox.Show($"数据异常, {JsonConvert.SerializeObject(obj)}");
|
|
return;
|
|
}
|
|
|
|
|
|
JDWareBoxModel model = new JDWareBoxModel
|
|
{
|
|
ShopName = fallware.ShopName,
|
|
WareName = fallware.WareName,
|
|
SealBoxId = fallware.SealBoxId,
|
|
ProductCount = fallware.ProductCount,
|
|
BoxCount = fallware.SealBoxCount,
|
|
PrewOrder = fallware.BoxConfigureData.PrewOrder,
|
|
ProductTitle = fallware.BoxConfigureData.ProductTitle,
|
|
PurchaseOrder = fallware.BoxConfigureData.PurchaseOrder,
|
|
WaybillNo = fallware.BoxConfigureData.WaybillNo,
|
|
ProviderName = fallware.BoxConfigureData.ProviderName
|
|
};
|
|
if (fallware.WareType == WareType.京仓)
|
|
{
|
|
SetJDWareBoxWindow window = new SetJDWareBoxWindow(model);
|
|
window.ShowDialog();
|
|
//var w = new SetJDWareBoxWindow2(model, sealBoxService, fallware.WareType, ReflashTask, false);
|
|
//w.ShowDialog();
|
|
}
|
|
if (fallware.WareType == WareType.云仓 || fallware.WareType == WareType.聚水潭)
|
|
{
|
|
SetCloudWareBoxWindow window = new SetCloudWareBoxWindow(model, fallware.WareType);
|
|
window.ShowDialog();
|
|
}
|
|
|
|
}
|
|
|
|
public PositionState PositionState { get; set; }
|
|
|
|
/// <summary>
|
|
/// 完成落仓
|
|
/// </summary>
|
|
/// <param name="obj"></param>
|
|
private void CompeteFallWare(object obj)
|
|
{
|
|
|
|
if (System.Windows.MessageBox.Show("是否完成落仓?", "提示",
|
|
MessageBoxButton.YesNo,
|
|
MessageBoxImage.Warning) != MessageBoxResult.Yes)
|
|
return;
|
|
|
|
var model = obj as WaitFallWareModel;
|
|
var res = sealBoxService.WareCompeteFallWare(model.SealBoxId);
|
|
if (res != null && res.Success)
|
|
{
|
|
ReflashTask(); return;
|
|
}
|
|
if (res == null)
|
|
{
|
|
System.Windows.MessageBox.Show("网络异常");
|
|
return;
|
|
}
|
|
System.Windows.MessageBox.Show(res.Msg);
|
|
}
|
|
|
|
private void SetSealBox(object obj)
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
#region 事件绑定
|
|
|
|
|
|
/// <summary>
|
|
/// 推送sku配置状态
|
|
/// </summary>
|
|
public ICommand SendToSetSkuConfigureCommand { get; set; }
|
|
/// <summary>
|
|
/// 提交超时原因
|
|
/// </summary>
|
|
public ICommand SubmitOverTimeMarkMsgCommand { get; set; }
|
|
/// <summary>
|
|
/// 查看揽收单
|
|
/// </summary>
|
|
public ICommand LookLSOrderConfigureCommand { get; set; }
|
|
/// <summary>
|
|
/// 打印揽收单
|
|
/// </summary>
|
|
public ICommand PrintLSOrderConfigureCommand { get; set; }
|
|
/// <summary>
|
|
/// 打印封箱明细
|
|
/// </summary>
|
|
public ICommand PrintSealBoxDetailsCommand { get; set; }
|
|
/// <summary>
|
|
/// 待完结 完成事件
|
|
/// </summary>
|
|
public ICommand CompeteWaitCompletedCommand { get; set; }
|
|
|
|
/// <summary>
|
|
/// 待转运 完成事件
|
|
/// </summary>
|
|
public ICommand CompeteWaitTransportCommand { get; set; }
|
|
|
|
/// <summary>
|
|
/// 设置仓库类型
|
|
/// </summary>
|
|
public ICommand SetWareTypeCommand { get; set; }
|
|
|
|
/// <summary>
|
|
/// 查看箱唛配置
|
|
/// </summary>
|
|
public ICommand LookBoxConfigureCommand { get; set; }
|
|
/// <summary>
|
|
/// 待配置 /已配置
|
|
/// </summary>
|
|
public ICommand SetSealBoxConfigureTypeCommand { get; set; }
|
|
public ICommand CompeteFallWareCommand { get; set; }
|
|
public ICommand CompeteSealBoxCommand { get; set; }
|
|
|
|
public ICommand CompletedPackTaskCommand { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// 打开图片链接
|
|
/// </summary>
|
|
public ICommand OpenSkuDetailCommand { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// 筛选数据
|
|
/// </summary>
|
|
public ICommand SetTaskStateCommand { get; set; }
|
|
|
|
/// <summary>
|
|
/// 修改任务状态
|
|
/// </summary>
|
|
public ICommand UpdateTaskStateCommand { get; set; }
|
|
/// <summary>
|
|
/// 搜索数据
|
|
/// </summary>
|
|
public ICommand SearchTaskCommand { get; set; }
|
|
|
|
/// <summary>
|
|
/// 创建任务
|
|
/// </summary>
|
|
public ICommand CreateTaskCommand { get; set; }
|
|
|
|
/// <summary>
|
|
/// 页面改变事件
|
|
/// </summary>
|
|
public ICommand TaskPageIndexChangedCommand { get; set; }
|
|
|
|
/// <summary>
|
|
/// 设置分箱数量
|
|
/// </summary>
|
|
public ICommand SetSealBoxCommand { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// 打印封箱数据
|
|
/// </summary>
|
|
public ICommand PrintBoxConfigureCommand { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// 删除任务
|
|
/// </summary>
|
|
public ICommand DeletedTaskCommand { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// 商家自取
|
|
/// </summary>
|
|
public ICommand StoreGetBySelfCommand { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// 加载事件(待封箱)
|
|
/// </summary>
|
|
public ICommand LoadSkuDataCommand { get; set; }
|
|
|
|
/// <summary>
|
|
/// 加载事件(封箱已配置)
|
|
/// </summary>
|
|
public ICommand LoadSealBoxSkuDataCommand { get; set; }
|
|
|
|
/// <summary>
|
|
/// 落仓
|
|
/// </summary>
|
|
public ICommand LoadFallWareSkuDataCommand { get; set; }
|
|
|
|
/// <summary>
|
|
/// 转运
|
|
/// </summary>
|
|
public ICommand LoadTransportSkuDataCommand { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 待完结
|
|
/// </summary>
|
|
public ICommand LoadCompletedSkuDataCommand { get; set; }
|
|
/// <summary>
|
|
/// 完成封箱
|
|
/// </summary>
|
|
/// <param name="obj"></param>
|
|
private void CompeteSealBox(object obj)
|
|
{
|
|
|
|
var model = (SealBoxModel)obj;
|
|
if (model.SealBoxSkus.Any(s => s.TaskState == Models.TaskState.待验收 || s.TaskState == Models.TaskState.待包装))
|
|
{
|
|
System.Windows.MessageBox.Show("无法封箱,存在未打包完成的任务");
|
|
return;
|
|
}
|
|
|
|
SetSealBoxWindow setSealBoxWindow = new SetSealBoxWindow(new Action<int>((boxCount) => {
|
|
|
|
|
|
|
|
model.SealBoxCount = boxCount;
|
|
|
|
if (model.SealBoxCount == null || model.SealBoxCount.Value <= 0)
|
|
{
|
|
System.Windows.MessageBox.Show("请先设置封箱数量");
|
|
return;
|
|
}
|
|
var res = sealBoxService.WareCompeteSealBox(model.SealBoxId, model.SealBoxCount);
|
|
if (res == null)
|
|
{
|
|
System.Windows.MessageBox.Show("网络异常", "");
|
|
return;
|
|
}
|
|
|
|
|
|
|
|
if (!res.Success || !res.Data)
|
|
{
|
|
System.Windows.MessageBox.Show(res.Msg);
|
|
return;
|
|
}
|
|
SearchTaskList();
|
|
}));
|
|
setSealBoxWindow.ShowDialog();
|
|
|
|
|
|
}
|
|
|
|
private void UpdateTaskState(object obj)
|
|
{
|
|
var model = (PackTaskModel)obj;
|
|
long taskId = model.TaskId;
|
|
var packTaskState = model.TaskState;
|
|
|
|
ApiResponse<object> res = null;
|
|
|
|
|
|
switch (packTaskState)
|
|
{
|
|
case Models.TaskState.未到货:
|
|
case Models.TaskState.部分到货:
|
|
|
|
|
|
if (!model.OrderId.IsNullOrEmpty())
|
|
{
|
|
if (model.ExpressOrderList == null || model.ExpressOrderList.Count <= 0)
|
|
{
|
|
System.Windows.MessageBox.Show("该任务采购单未进行发货,请联系业务进行发货后在确认收货", "提示");
|
|
return;
|
|
}
|
|
}
|
|
if (System.Windows.MessageBox.Show("是否确认收货?", "提示",
|
|
MessageBoxButton.YesNo,
|
|
MessageBoxImage.Warning) != MessageBoxResult.Yes)
|
|
return;
|
|
|
|
if (!model.OrderId.IsNullOrEmpty())
|
|
{
|
|
var manualSigns = packTaskService.BatchManualSign(model.ExpressOrderList.Select(e => e.WaybillNo).ToArray());
|
|
if (manualSigns == null || !manualSigns.Success)
|
|
{
|
|
if (!manualSigns.Success)
|
|
{
|
|
System.Windows.MessageBox.Show($"B端确认收货失败,{manualSigns.Msg}");
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
res = packTaskService.SetPackTaskState(taskId, Models.TaskState.待验收);
|
|
break;
|
|
case Models.TaskState.待验收:
|
|
break;
|
|
case Models.TaskState.待包装:
|
|
|
|
var packModel = PackTaskList.SingleOrDefault(p => p.TaskId == taskId);
|
|
if (packModel == null || packModel.FeesItemResponse == null || packModel.FeesItemResponse.DiscountAllFees == 0)
|
|
{
|
|
System.Windows.MessageBox.Show("请先设置打包费用0!");
|
|
return;
|
|
}
|
|
if (System.Windows.MessageBox.Show("是否完成打包?", "提示",
|
|
MessageBoxButton.YesNo,
|
|
MessageBoxImage.Warning) != MessageBoxResult.Yes)
|
|
return;
|
|
res = packTaskService.SetPackTaskState(taskId, Models.TaskState.待封箱);
|
|
break;
|
|
case Models.TaskState.待封箱:
|
|
break;
|
|
case Models.TaskState.待出库:
|
|
break;
|
|
case Models.TaskState.已完成:
|
|
break;
|
|
case Models.TaskState.已取消:
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
if (res != null && res.Success)
|
|
{
|
|
SearchTaskList();
|
|
}
|
|
|
|
|
|
}
|
|
|
|
public void SetTaskState(TaskState? taskState)
|
|
{
|
|
|
|
if (!(TaskState == Models.TaskState.未到货 && TaskState == Models.TaskState.待验收))
|
|
{
|
|
SearchSkuTitle = "";
|
|
SearchSpuTitle = "";
|
|
}
|
|
|
|
|
|
|
|
|
|
TaskState = taskState;
|
|
if (PageIndex == 1)
|
|
SearchTaskList();
|
|
else
|
|
PageIndex = 1;
|
|
}
|
|
private bool IsStartThread = false;
|
|
private Thread qualityOverTimeThread = null;
|
|
private Thread packOverTimeThread = null;
|
|
private Thread scheduleOverTimeThread = null;
|
|
private Thread sealboxOverTimeThread = null;
|
|
private Thread fallwareOverTimeThread = null;
|
|
private Thread waitTransportOverTimeThread = null;
|
|
|
|
/// <summary>
|
|
/// 搜索任务列表
|
|
/// </summary>
|
|
public void SearchTaskList()
|
|
{
|
|
if (IsLoading)
|
|
return;
|
|
IsLoading = true;
|
|
PageSize = 10;
|
|
IsStartThread = false;
|
|
long? taskId = null;
|
|
long? sealBoxId = null;
|
|
try
|
|
{
|
|
if (SearchTaskId != null && !string.IsNullOrEmpty(SearchTaskId.Trim()))
|
|
taskId = Convert.ToInt64(SearchTaskId);
|
|
|
|
var istrue = long.TryParse(SearchSealBoxId, out long sealboxid);
|
|
if (istrue)
|
|
{
|
|
sealBoxId = sealboxid;
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
taskId = null;
|
|
|
|
}
|
|
Task.Factory.StartNew(() =>
|
|
{
|
|
|
|
|
|
Stopwatch stopwatch = new Stopwatch();
|
|
stopwatch.Start();
|
|
if (TaskState == Models.TaskState.待出库)
|
|
{
|
|
PageSize = 20;
|
|
WaitCompletedList = new ObservableCollection<WareWaitCompleted>();
|
|
var datas = sealBoxService.GetWareWaitCompletedList(null, SearchShopName, taskId, SearchSkuId, sealBoxId, PageIndex, PageSize);
|
|
if (datas != null && datas.Data != null && datas.Success)
|
|
{
|
|
var dataModel = datas.Data;
|
|
OrderCount = dataModel.TotalCount;
|
|
WaitCompleteds = dataModel.WareWaitCompleteds;
|
|
foreach (var item in dataModel.WareWaitCompleteds)
|
|
{
|
|
var skuItem = item.Copy();
|
|
skuItem.WaitTransportSkus = null;//默认不加载
|
|
App.Current.Dispatcher.BeginInvoke(new Action(() =>
|
|
{
|
|
WaitCompletedList.Add(skuItem);
|
|
}));
|
|
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (datas != null) System.Windows.MessageBox.Show(datas.Msg);
|
|
}
|
|
|
|
}
|
|
else if (TaskState == Models.TaskState.已超时)
|
|
{
|
|
PageSize = 20;
|
|
OverTimeTaskList = new ObservableCollection<OverTimeTaskResponse>();
|
|
var datas = packTaskService.SearchOverTimeTaskList(null, StartTime, EndTime, OverTimeTaskState, OverTimeTaskType, PageIndex, PageSize);
|
|
if (datas != null && datas.Data != null && datas.Success)
|
|
{
|
|
var dataModel = datas.Data;
|
|
OrderCount = dataModel.TotalCount;
|
|
foreach (var item in dataModel.OverTimeTaskResponses)
|
|
{
|
|
App.Current.Dispatcher.BeginInvoke(new Action(() =>
|
|
{
|
|
OverTimeTaskList.Add(item);
|
|
}));
|
|
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (datas != null) System.Windows.MessageBox.Show(datas.Msg);
|
|
}
|
|
|
|
|
|
}
|
|
else if (TaskState == Models.TaskState.待转运)
|
|
{
|
|
PageSize = 20;
|
|
|
|
WaitTransportList = new ObservableCollection<WareWaitTransport>();
|
|
var datas = sealBoxService.GetWareWaitTransportList(SelectWareType, PageSize, PageIndex);
|
|
if (datas != null && datas.Data != null && datas.Success)
|
|
{
|
|
var dataModel = datas.Data;
|
|
OrderCount = dataModel.TotalCount;
|
|
WareWaitTransports = dataModel.WareWaitTransports;
|
|
foreach (var item in dataModel.WareWaitTransports)
|
|
{
|
|
|
|
var skuItem = item.Copy();
|
|
skuItem.WaitTransportSkus = null;//默认不加载
|
|
App.Current.Dispatcher.Invoke(new Action(() =>
|
|
{
|
|
WaitTransportList.Add(skuItem);
|
|
}));
|
|
|
|
}
|
|
|
|
var sealboxTasks = WaitTransportList.Where(p => p.TransportOverTime != null).ToList();
|
|
if (sealboxTasks.Count() > 0 && TaskState == Models.TaskState.待转运)
|
|
{
|
|
|
|
|
|
waitTransportOverTimeThread = new Thread(() =>
|
|
{
|
|
IsStartThread = true;
|
|
while (IsStartThread)
|
|
{
|
|
App.Current.Dispatcher.BeginInvoke(new Action(() =>
|
|
{
|
|
foreach (var item in sealboxTasks)
|
|
{
|
|
var datetime = item.TransportOverTime.Value.Subtract(DateTime.Now);
|
|
if (datetime.TotalMilliseconds > 0)
|
|
{
|
|
item.IsWaitTransportOverTime = false;
|
|
item.WaitTransportRemainTime = OverTimeHelper.GetTimeString(datetime);
|
|
}
|
|
else
|
|
{
|
|
item.IsWaitTransportOverTime = true;
|
|
item.WaitTransportRemainTime = OverTimeHelper.GetTimeString(datetime);
|
|
}
|
|
|
|
}
|
|
}));
|
|
Thread.Sleep(1000);
|
|
}
|
|
|
|
});
|
|
//任务倒计时数据
|
|
waitTransportOverTimeThread.IsBackground = true;
|
|
waitTransportOverTimeThread.Start();
|
|
|
|
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (datas != null) System.Windows.MessageBox.Show(datas.Msg);
|
|
}
|
|
|
|
|
|
Task.Factory.StartNew(() =>
|
|
{
|
|
IsLoadWaitTransportCount();
|
|
});
|
|
}
|
|
else if (TaskState == Models.TaskState.待落仓)
|
|
{
|
|
PageSize = 20;
|
|
|
|
WaitFallWareList = new ObservableCollection<WaitFallWareModel>();
|
|
var datas = sealBoxService.SearchWareFallWareConfigureList(PositionState, SearchShopName, taskId, SearchSkuId, sealBoxId, PageIndex, PageSize);
|
|
if (datas != null && datas.Data != null && datas.Success)
|
|
{
|
|
var dataModel = datas.Data;
|
|
OrderCount = dataModel.TotalCount;
|
|
WaitFallWareLists = dataModel.WaitFallWareList;
|
|
foreach (var item in dataModel.WaitFallWareList)
|
|
{
|
|
App.Current.Dispatcher.Invoke(new Action(() =>
|
|
{
|
|
WaitFallWareList.Add(new WaitFallWareModel
|
|
{
|
|
AcceptUserNames = string.Join("|", item.AcceptUserNames),
|
|
DepartmentName = item.DepartmentName,
|
|
SealBoxSkus = null,
|
|
ShopId = item.ShopId,
|
|
ShopName = item.ShopName,
|
|
WareId = item.WareId,
|
|
WareName = item.WareName,
|
|
SealBoxCount = item.SealBoxCount,
|
|
SealBoxId = item.SealBoxId,
|
|
BoxConfigureData = item.BoxConfigureData,
|
|
ProductCount = item.ProductCount,
|
|
WareType = item.WareType,
|
|
SetPurchaseOrderOverTime = item.SetPurchaseOrderOverTime
|
|
|
|
});
|
|
}));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (datas != null) System.Windows.MessageBox.Show(datas.Msg);
|
|
}
|
|
|
|
|
|
Task.Factory.StartNew(() =>
|
|
{
|
|
IsLoadFallWareCount();
|
|
});
|
|
}
|
|
else if (TaskState == Models.TaskState.待封箱)
|
|
{
|
|
|
|
PageSize = 20;
|
|
if (SealBoxConfigureType == SealBoxConfigureType.已配置)
|
|
{
|
|
WaitSealBoxModels = new ObservableCollection<SealBoxModel>();
|
|
|
|
var datas = sealBoxService.GetWareSealBoxList(SearchShopName, taskId, SearchSkuId, sealBoxId, PageIndex, PageSize);
|
|
if (datas != null && datas.Data != null && datas.Success)
|
|
{
|
|
var dataModel = datas.Data;
|
|
OrderCount = dataModel.TotalCount;
|
|
|
|
SealBoxModelList = dataModel.WaitSealBoxModels;
|
|
foreach (var item in dataModel.WaitSealBoxModels)
|
|
{
|
|
|
|
App.Current.Dispatcher.Invoke(new Action(() =>
|
|
{
|
|
WaitSealBoxModels.Add(new SealBoxModel
|
|
{
|
|
AcceptUserName = string.Join("|", item.AcceptUserNames),
|
|
DepartmentName = item.DepartmentName,
|
|
SealBoxSkus = null,
|
|
ShopId = item.ShopId,
|
|
ShopName = item.ShopName,
|
|
WareId = item.WareId,
|
|
WareName = item.WareName,
|
|
SealBoxId = item.SealBoxId,
|
|
SealBoxPackOverTime = item.SealBoxPackOverTime,
|
|
SealBoxPackOverTimeMarkMsg = item.SealBoxPackOverTimeMarkMsg
|
|
});
|
|
}));
|
|
|
|
}
|
|
|
|
var sealboxTasks = WaitSealBoxModels.Where(p => p.SealBoxPackOverTime != null).ToList();
|
|
if (sealboxTasks.Count() > 0 && TaskState == Models.TaskState.待封箱)
|
|
{
|
|
|
|
|
|
sealboxOverTimeThread = new Thread(() =>
|
|
{
|
|
IsStartThread = true;
|
|
while (IsStartThread)
|
|
{
|
|
App.Current.Dispatcher.BeginInvoke(new Action(() =>
|
|
{
|
|
foreach (var item in sealboxTasks)
|
|
{
|
|
var datetime = item.SealBoxPackOverTime.Value.Subtract(DateTime.Now);
|
|
if (datetime.TotalMilliseconds > 0)
|
|
{
|
|
item.IsSealBoxOverTime = false;
|
|
item.SealBoxRemainTime = OverTimeHelper.GetTimeString(datetime);
|
|
}
|
|
else
|
|
{
|
|
item.IsSealBoxOverTime = true;
|
|
item.SealBoxRemainTime = OverTimeHelper.GetTimeString(datetime);
|
|
}
|
|
|
|
}
|
|
}));
|
|
Thread.Sleep(1000);
|
|
}
|
|
|
|
});
|
|
//任务倒计时数据
|
|
sealboxOverTimeThread.IsBackground = true;
|
|
sealboxOverTimeThread.Start();
|
|
|
|
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (datas != null) System.Windows.MessageBox.Show(datas.Msg);
|
|
}
|
|
}
|
|
if (SealBoxConfigureType == SealBoxConfigureType.待配置)
|
|
{
|
|
|
|
WareNoSealBoxModels = new ObservableCollection<WareNoSealBoxModel>();
|
|
var datas = sealBoxService.GetWareSealBoxWaitConfigureList(SearchShopName, taskId, SearchSkuId, PageIndex, PageSize);
|
|
if (datas != null && datas.Data != null && datas.Success)
|
|
{
|
|
var dataModel = datas.Data;
|
|
OrderCount = dataModel.TotalCount;
|
|
WaitSealBoxModelList = dataModel.WaitSealBoxModels;
|
|
|
|
foreach (var item in WaitSealBoxModelList)
|
|
{
|
|
App.Current.Dispatcher.Invoke(new Action(() =>
|
|
{
|
|
WareNoSealBoxModels.Add(new WareNoSealBoxModel
|
|
{
|
|
AcceptUserName = string.Join("|", item.AcceptUserNames),
|
|
DepartmentName = item.DepartmentName,
|
|
SealBoxSkus = new List<WareNoSealBoxSku>(),
|
|
// SealBoxSkus = item.SealBoxSkus,
|
|
ShopId = item.ShopId,
|
|
ShopName = item.ShopName,
|
|
|
|
});
|
|
}));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (datas != null) System.Windows.MessageBox.Show(datas.Msg);
|
|
}
|
|
}
|
|
|
|
Task.Factory.StartNew(() =>
|
|
{
|
|
IsLoadSealBoxCount();
|
|
});
|
|
|
|
}
|
|
else if (taskState == Models.TaskState.商家自取)
|
|
{
|
|
StoreGetSelfDataList = new ObservableCollection<StoreGetSelfData>();
|
|
var datas = packTaskService.SearchStoreGetSelfList(SearchTaskId, SearchOrderSn, SearchSpuId, SearchSkuId, SearchDepartment, SearchShopName, PageIndex, PageSize, null);
|
|
if (datas != null && datas.Data != null && datas.Success)
|
|
{
|
|
var dataModel = datas.Data;
|
|
OrderCount = dataModel.TotalCount;
|
|
foreach (var item in dataModel.StoreGetSelfResponseList)
|
|
{
|
|
App.Current.Dispatcher.Invoke(new Action(() =>
|
|
{
|
|
StoreGetSelfDataList.Add(item);
|
|
}));
|
|
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show(datas?.Msg);
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
PackTaskList = new ObservableCollection<PackTaskModel>();//初始化数据
|
|
var datas = packTaskService.SearchTaskList(SearchWayBillNo, SearchExpressName, SearchDepartment, SearchSkuId, SearchTaskId, SearchSpuId, SearchOrderSn, this.TaskState, SearchShopName,
|
|
PageIndex, PageSize, SearchSkuTitle, SearchSpuTitle);
|
|
stopwatch.Stop();
|
|
App.Current.Dispatcher.BeginInvoke(new Action(() =>
|
|
{
|
|
Debug.WriteLine($"查询接口耗时:{stopwatch.ElapsedMilliseconds}毫秒");
|
|
}));
|
|
stopwatch.Restart();
|
|
if (datas != null && datas.Data != null && datas.Success)
|
|
{
|
|
var dataModel = datas.Data;
|
|
OrderCount = dataModel.TotalCount;
|
|
foreach (var item in dataModel.Items)
|
|
{
|
|
var data = new PackTaskModel()
|
|
{
|
|
AcceptName = item.UserName,
|
|
BasicPack = (BasicPack)item.BasicPack,
|
|
DepartmentName = item.DepartmentName,
|
|
CertificatePosition = (CertificatePosition)item.CertificatePosition,
|
|
|
|
GoodsNumber = item.GoodsNumber,
|
|
Increment1 = item.Increment1,
|
|
ItemList = new List<SkuMessage>() { new SkuMessage
|
|
{ BrandName = item.BrandName,
|
|
GoodsNo = item.ProductItemNum, Logo= item.Logo,
|
|
SkuName = item.SkuName,
|
|
SkuId = item.SkuId
|
|
} },
|
|
PackType = (PackType)item.PackType,
|
|
TaskState = item.TaskState,
|
|
PositionType = item.PositionType,
|
|
SkuCount = item.SkuCount,
|
|
SkuTitle = item.SkuGoodsTitle,
|
|
TaskId = item.TaskId,
|
|
EndTime = item.CreateTime,
|
|
OrderId = item.OrderId,
|
|
SkuId = item.SkuId,
|
|
SkuName = item.SkuName,
|
|
FloorDragNumber = item.FloorDragNumber,
|
|
QualityCompletionOverTime = item.QualityCompletionOverTime,
|
|
PackCompletionOverTime = item.PackCompletionOverTime,
|
|
ShopName = item.ShopName,
|
|
QualityOverTimeMarkMsg = item.QualityOverTimeMarkMsg,
|
|
PackOverTimeMarkMsg = item.PackOverTimeMarkMsg,
|
|
ShowMarkMessage = item.ShowMarkMessage,
|
|
SkuPurchaseSchemeId = item.SkuPurchaseSchemeId,
|
|
ScheduleOverTimeMarkMsg = item.ScheduleOverTimeMarkMsg,
|
|
ScheduleOverTime = item.ScheduleOverTime,
|
|
PackProcessType = item.PackProcessType,
|
|
ShopId = item.ShopId,
|
|
SendToSetSkuConfigureTime = item.SendToSetSkuConfigureTime,
|
|
|
|
};
|
|
if (item.BarCodeDTO != null && item.BarCodeDTO.Id > 0)
|
|
{
|
|
|
|
data.BarCodeModel = item.BarCodeDTO;
|
|
if (data.BarCodeModel.LabelModel == BarcodeLabelModel.无型号模板)
|
|
data.BarCodeModel.LabelModel = BarcodeLabelModel.精简模板;
|
|
|
|
}
|
|
if (item.Cers != null)
|
|
{
|
|
data.CertificateModel = item.Cers;
|
|
|
|
}
|
|
data.ReflashTask = ReflashTask;
|
|
|
|
if (item.FeesItemResponse != null)
|
|
{
|
|
data.FeesItemResponse = item.FeesItemResponse;
|
|
data.FeesMoney = item.FeesItemResponse.AllFees;
|
|
|
|
data.FeesItemResponse.DiscountAllFees = item.FeesItemResponse.AllFees *
|
|
item.FeesItemResponse.disCount;
|
|
data.IsShowFees = data.FeesMoney > 0 ? true : false;
|
|
|
|
}
|
|
else
|
|
{
|
|
data.IsShowFees = false;
|
|
}
|
|
|
|
if (item.PackUserName != null && item.PackUserName.Count() > 0)
|
|
{
|
|
data.PackUser = string.Join("\r\n", item.PackUserName);
|
|
}
|
|
|
|
App.Current.Dispatcher.Invoke(new Action(() =>
|
|
{
|
|
PackTaskList.Add(data);
|
|
}));
|
|
|
|
|
|
}
|
|
if (TaskState == Models.TaskState.待验收)
|
|
{
|
|
qualityOverTimeThread = new Thread(() =>
|
|
{
|
|
var packtasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待验收 && p.QualityCompletionOverTime != null).ToList();
|
|
if (packtasks.Count() > 0)
|
|
{
|
|
IsStartThread = true;
|
|
while (IsStartThread)
|
|
{
|
|
App.Current.Dispatcher.BeginInvoke(new Action(() =>
|
|
{
|
|
foreach (var item in packtasks)
|
|
{
|
|
TimeSpan datetime;
|
|
if (item.SendToSetSkuConfigureTime != null)
|
|
datetime = item.QualityCompletionOverTime.Value.Subtract(item.SendToSetSkuConfigureTime.Value);
|
|
else
|
|
datetime = item.QualityCompletionOverTime.Value.Subtract(DateTime.Now);
|
|
item.QualityRemainTime = OverTimeHelper.GetTimeString(datetime);
|
|
if (datetime.TotalMilliseconds > 0)
|
|
{
|
|
item.IsQualityOverTime = false;
|
|
|
|
}
|
|
else
|
|
{
|
|
item.IsQualityOverTime = true;
|
|
}
|
|
|
|
}
|
|
}));
|
|
Thread.Sleep(1000);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
//任务倒计时数据
|
|
qualityOverTimeThread.IsBackground = true;
|
|
qualityOverTimeThread.Start();
|
|
//任务状态为待验收
|
|
|
|
}
|
|
if (TaskState == Models.TaskState.待包装)
|
|
{
|
|
var packCompletedTasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待包装 && p.PackCompletionOverTime != null).ToList();
|
|
if (packCompletedTasks.Count() > 0)
|
|
{
|
|
|
|
packOverTimeThread = new Thread(() =>
|
|
{
|
|
IsStartThread = true;
|
|
while (IsStartThread)
|
|
{
|
|
App.Current.Dispatcher.BeginInvoke(new Action(() =>
|
|
{
|
|
foreach (var item in packCompletedTasks)
|
|
{
|
|
var datetime = item.PackCompletionOverTime.Value.Subtract(DateTime.Now);
|
|
if (datetime.TotalMilliseconds > 0)
|
|
{
|
|
item.IsPackOverTime = false;
|
|
item.PackRemainTime = OverTimeHelper.GetTimeString(datetime);
|
|
}
|
|
else
|
|
{
|
|
item.IsPackOverTime = true;
|
|
item.PackRemainTime = OverTimeHelper.GetTimeString(datetime);
|
|
}
|
|
|
|
}
|
|
}));
|
|
Thread.Sleep(1000);
|
|
}
|
|
|
|
});
|
|
//任务倒计时数据
|
|
packOverTimeThread.IsBackground = true;
|
|
packOverTimeThread.Start();
|
|
|
|
|
|
}
|
|
}
|
|
if (TaskState == Models.TaskState.待排单)
|
|
{
|
|
var packCompletedTasks = PackTaskList.Where(p => p.TaskState == Models.TaskState.待排单 && p.ScheduleOverTime != null).ToList();
|
|
if (packCompletedTasks.Count() > 0)
|
|
{
|
|
scheduleOverTimeThread = new Thread(() =>
|
|
{
|
|
IsStartThread = true;
|
|
while (IsStartThread)
|
|
{
|
|
App.Current.Dispatcher.BeginInvoke(new Action(() =>
|
|
{
|
|
foreach (var item in packCompletedTasks)
|
|
{
|
|
var datetime = item.ScheduleOverTime.Value.Subtract(DateTime.Now);
|
|
if (datetime.TotalMilliseconds > 0)
|
|
{
|
|
item.IsScheduleOverTime = false;
|
|
item.ScheduleRemainTime = OverTimeHelper.GetTimeString(datetime);
|
|
}
|
|
else
|
|
{
|
|
item.IsScheduleOverTime = true;
|
|
item.ScheduleRemainTime = OverTimeHelper.GetTimeString(datetime);
|
|
}
|
|
|
|
}
|
|
}));
|
|
Thread.Sleep(1000);
|
|
}
|
|
|
|
});
|
|
//任务倒计时数据
|
|
scheduleOverTimeThread.IsBackground = true;
|
|
scheduleOverTimeThread.Start();
|
|
|
|
|
|
}
|
|
}
|
|
//任务状态为待打包
|
|
|
|
|
|
|
|
Task.Factory.StartNew(() => {
|
|
foreach (var item in PackTaskList)
|
|
{
|
|
if (!item.OrderId.IsNullOrEmpty() && !item.SkuId.IsNullOrEmpty())
|
|
{
|
|
var expressData = packTaskService.GetPurchaseExpressOrderList(item.OrderId, item.SkuId);
|
|
if (expressData != null && expressData.Success && expressData.Data != null)
|
|
{
|
|
|
|
App.Current.Dispatcher.BeginInvoke(new Action(() =>
|
|
{
|
|
expressData.Data.ForEach(e =>
|
|
{
|
|
e.ExpressState = ExpressOrderHelper.GetExpressStateName(e.ExpressState);
|
|
|
|
|
|
});
|
|
item.ExpressOrderList = expressData.Data;
|
|
}));
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
}
|
|
else
|
|
{
|
|
}
|
|
|
|
}
|
|
|
|
|
|
Task.Factory.StartNew(() =>
|
|
{
|
|
IsLoadCount();
|
|
});
|
|
|
|
IsLoading = false;
|
|
stopwatch.Stop();
|
|
App.Current.Dispatcher.BeginInvoke(new Action(() =>
|
|
{
|
|
Debug.WriteLine($"查询耗时:{stopwatch.ElapsedMilliseconds}毫秒");
|
|
}));
|
|
|
|
|
|
});
|
|
}
|
|
|
|
|
|
|
|
|
|
private void IsLoadWaitTransportCount()
|
|
{
|
|
var res = sealBoxService.GetWareTransportCounts();
|
|
if (res != null && res.Success && res.Data != null)
|
|
{
|
|
App.Current.Dispatcher.Invoke(new Action(() =>
|
|
{
|
|
WaitTransportCloudWareCount = res.Data.WaitTransportCloudWareCount;
|
|
WaitTransportJuShuiTanCount = res.Data.WaitTransportJuShuiTanCount;
|
|
WaitTransportStoreWareCount = res.Data.WaitTransportStoreWareCount;
|
|
WaitTransportJDWareCount = res.Data.WaitTransportJDWareCount;
|
|
}));
|
|
}
|
|
|
|
}
|
|
|
|
private void IsLoadSealBoxCount()
|
|
{
|
|
var res = sealBoxService.GetWareSealBoxConfigureCounts();
|
|
if (res != null && res.Success && res.Data != null)
|
|
{
|
|
App.Current.Dispatcher.Invoke(new Action(() =>
|
|
{
|
|
FallWareWaitConfigureCount = res.Data.SealBoxWaitConfigureCount.ToString();
|
|
FallWareConfiguredCount = res.Data.SealBoxConfiguredCount.ToString();
|
|
}));
|
|
|
|
}
|
|
}
|
|
|
|
private void IsLoadFallWareCount()
|
|
{
|
|
var res = sealBoxService.GetFallWareConfigureCounts(null);
|
|
if (res != null && res.Success && res.Data != null)
|
|
{
|
|
App.Current.Dispatcher.Invoke(new Action(() =>
|
|
{
|
|
FallWareWaitConfigureCount = res.Data.FallWareWaitConfigureCount.ToString();
|
|
FallWareConfiguredCount = res.Data.FallWareConfiguredCount.ToString();
|
|
}));
|
|
|
|
}
|
|
}
|
|
private void IsLoadCount()
|
|
{
|
|
var packTaskResult = packTaskService.GetTaskAllCount();
|
|
if (packTaskResult != null && packTaskResult.Success && packTaskResult.Data != null)
|
|
{
|
|
App.Current.Dispatcher.Invoke(new Action(() =>
|
|
{
|
|
ArrivedCount = packTaskResult.Data.ArrivedCount.ToString();
|
|
NoArrivedCount = packTaskResult.Data.NoArrivedCount.ToString();
|
|
SomeArrivedCount = packTaskResult.Data.SomeArrivedCount.ToString();
|
|
WorryCount = packTaskResult.Data.WorryCount.ToString();
|
|
WaitOutbound = packTaskResult.Data.WaitOutbound?.ToString();
|
|
WaitPackCount = packTaskResult.Data.WaitPackCount?.ToString();
|
|
WaitSealBoxCount = packTaskResult.Data.WaitSealBox?.ToString();
|
|
WaitFallWareCount = packTaskResult.Data.WaitFallWareCount?.ToString();
|
|
WaitCompleted = packTaskResult.Data.WaitCompleted?.ToString();
|
|
WaitTransportCount = packTaskResult.Data.WaitTransportCount?.ToString();
|
|
WaitScheduleCount = packTaskResult.Data.WaitScheduleCount?.ToString();
|
|
}));
|
|
}
|
|
}
|
|
private void LoadIndex(int pageIndex)
|
|
{
|
|
PageIndex = pageIndex;//
|
|
SearchTaskList();
|
|
}
|
|
public void ReflashTask()//刷新界面
|
|
{
|
|
SearchTaskList();
|
|
}
|
|
|
|
|
|
private void OpenSkuDetail(object param)
|
|
{
|
|
var paramList = (object[])param;
|
|
var skuId = paramList.Last().ToString();
|
|
var url = $"https://item.jd.com/{skuId}.html";
|
|
try
|
|
{
|
|
System.Diagnostics.Process.Start("explorer.exe", url);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Clipboard.SetText(url);
|
|
System.Windows.MessageBox.Show($"{ex.Message}\r\n调用浏览器失败,网页链接已复制到剪切板,请手动打开浏览器访问", "提示");
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|
|
|