添加报警窗口
出库流程调试、优化
This commit is contained in:
@ -37,6 +37,16 @@ namespace 货架标准上位机.ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
private bool goToStockTakingView;
|
||||
public bool GoToStockTakingView
|
||||
{
|
||||
get { return goToStockTakingView; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref goToStockTakingView, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region 专用_MainWindow2
|
||||
//隐藏式选项卡的高度
|
||||
|
@ -290,7 +290,7 @@ namespace 货架标准上位机.ViewModel
|
||||
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
PageNumber = CurrentPage,
|
||||
PageNumber = 1,
|
||||
PageSize = 10000,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<MatInventoryDetailModel>>(LocalFile.Config.ApiIpHost + "matInventoryDetail/getMatInventoryDetail", body, "POST");
|
||||
|
@ -266,6 +266,7 @@ namespace 货架标准上位机.ViewModels
|
||||
if (DataGridItemSource == null)
|
||||
{
|
||||
Growl.Warning("未勾选数据!");
|
||||
return;
|
||||
}
|
||||
//判断是否勾选数据
|
||||
var selectedOutOrder = DataGridItemSource.Where(t => t.IsSelected)
|
||||
@ -273,6 +274,7 @@ namespace 货架标准上位机.ViewModels
|
||||
if (selectedOutOrder == null)
|
||||
{
|
||||
Growl.Warning("未勾选数据!");
|
||||
return;
|
||||
}
|
||||
|
||||
#region 调用接口开始出库
|
||||
@ -288,6 +290,9 @@ namespace 货架标准上位机.ViewModels
|
||||
{
|
||||
//成功后直接跳转
|
||||
MainWindow1.viewModel.GoToOutVentoryView = true;
|
||||
//刷新出库单列表
|
||||
OutVentoryView.viewModel.RefreshOutOrderList(selectedOutOrder.OrderNumber);
|
||||
|
||||
Growl.Success("已跳转到物料出库页面!");
|
||||
}
|
||||
else if (Result != null)
|
||||
|
@ -31,27 +31,6 @@ namespace 货架标准上位机.ViewModel
|
||||
{
|
||||
public OutInventoryViewModel()
|
||||
{
|
||||
//线程 更新当前选择的订单的状态
|
||||
//Task.Run(() =>
|
||||
//{
|
||||
// while (true)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// Thread.Sleep(1000);
|
||||
// //if (LocalStatic.IsRefreshOrderDetail)
|
||||
// //{
|
||||
// // LocalStatic.IsRefreshOrderDetail = false;
|
||||
// // SelectedPickBillNumberChanged();
|
||||
// //}
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// //Logs.Write("更新订单状态异常!!");
|
||||
// }
|
||||
// }
|
||||
//});
|
||||
|
||||
RefreshOutOrderList();
|
||||
}
|
||||
|
||||
@ -242,7 +221,7 @@ namespace 货架标准上位机.ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
public void RefreshOutOrderList()
|
||||
public void RefreshOutOrderList(string OrderNumber = "")
|
||||
{
|
||||
#region 调用接口获取发料单
|
||||
try
|
||||
@ -255,6 +234,10 @@ namespace 货架标准上位机.ViewModel
|
||||
if (Result != null && Result.Code == 200)
|
||||
{
|
||||
OutOrderList = new ObservableCollection<OutOrderModel>(Result.Data.Lists);
|
||||
if (!string.IsNullOrEmpty(OrderNumber))
|
||||
{
|
||||
SelectedOutOrder = OutOrderList.Where(t => t.OrderNumber == OrderNumber).FirstOrDefault();
|
||||
}
|
||||
}
|
||||
else if (Result != null && !string.IsNullOrEmpty(Result.Message))
|
||||
{
|
||||
|
384
货架标准上位机/ViewModels/StocktakingDocumentViewModel.cs
Normal file
384
货架标准上位机/ViewModels/StocktakingDocumentViewModel.cs
Normal file
@ -0,0 +1,384 @@
|
||||
using HandyControl.Controls;
|
||||
using Ping9719.WpfEx.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.MatBaseInfo;
|
||||
using WCS.Model.ApiModel.OutStore;
|
||||
using WCS.Model.ApiModel.Stocktaking;
|
||||
using 货架标准上位机.Api;
|
||||
|
||||
namespace 货架标准上位机.ViewModels
|
||||
{
|
||||
public class StocktakingDocumentViewModel : BindableBase
|
||||
{
|
||||
public StocktakingDocumentViewModel()
|
||||
{
|
||||
BtnSearch();
|
||||
}
|
||||
|
||||
#region Properties界面绑定的实体
|
||||
private ObservableCollection<StockTakingOrderModel> dataGridItemSource;
|
||||
public ObservableCollection<StockTakingOrderModel> DataGridItemSource
|
||||
{
|
||||
get { return dataGridItemSource; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref dataGridItemSource, value);
|
||||
}
|
||||
}
|
||||
|
||||
public StockTakingOrderModel selectedataGridItem;
|
||||
public StockTakingOrderModel SelectedataGridItem
|
||||
{
|
||||
get { return selectedataGridItem; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref selectedataGridItem, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string orderNumber;
|
||||
public string OrderNumber
|
||||
{
|
||||
get { return orderNumber; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref orderNumber, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string orderType;
|
||||
public string OrderType
|
||||
{
|
||||
get { return orderType; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref orderType, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string orderSource;
|
||||
public string OrderSource
|
||||
{
|
||||
get { return orderSource; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref orderSource, value);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Command
|
||||
public ICommand BtnSearchCommand { get => new DelegateCommand(BtnSearchReset); }
|
||||
public void BtnSearchReset()
|
||||
{
|
||||
BtnSearch(true);
|
||||
}
|
||||
public void BtnSearch(bool IsPageReset = true)
|
||||
{
|
||||
if (CurrentPage == 0 || IsPageReset)
|
||||
{
|
||||
CurrentPage = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
#region 调用接口获取数据
|
||||
try
|
||||
{
|
||||
var body = new GetStockTakingOrdersRequest()
|
||||
{
|
||||
StocktakingOrderNumber = OrderNumber,
|
||||
StocktakingOrderType = OrderType,
|
||||
StocktakingOrderSource = OrderSource,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
PageNumber = CurrentPage,
|
||||
PageSize = 10,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<StockTakingOrderModel>>(LocalFile.Config.ApiIpHost + "stockTaking/getStockTakingOrders", body, "POST");
|
||||
if (Result != null && Result.Data != null && Result.Data.Lists != null)
|
||||
{
|
||||
DataGridItemSource = new ObservableCollection<StockTakingOrderModel>(Result.Data.Lists);
|
||||
MaxPage = Result.Data.MaxPage;
|
||||
TotalCount = Result.Data.TotalCount;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Error("加载数据失败:" + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public ICommand BtnResetCommand { get => new DelegateCommand(BtnReset); }
|
||||
public void BtnReset()
|
||||
{
|
||||
OrderNumber = string.Empty;
|
||||
OrderType = string.Empty;
|
||||
OrderSource = string.Empty;
|
||||
}
|
||||
|
||||
//public ICommand BtnDeleteCommand { get => new DelegateCommand(BtnDelete); }
|
||||
//public void BtnDelete()
|
||||
//{
|
||||
|
||||
//}
|
||||
|
||||
public ICommand BtnOrderDetailCommand { get => new DelegateCommand(BtnOrderDetail); }
|
||||
public void BtnOrderDetail()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (DataGridItemSource == null)
|
||||
{
|
||||
Growl.Warning("未勾选数据!");
|
||||
}
|
||||
|
||||
//判断是否勾选数据
|
||||
var selectedOutOrder = DataGridItemSource.Where(t => t.IsSelected)
|
||||
.FirstOrDefault();
|
||||
if (selectedOutOrder == null)
|
||||
{
|
||||
Growl.Warning("未勾选数据!");
|
||||
}
|
||||
|
||||
#region 调用接口获取数据
|
||||
|
||||
var body = new GetOutOrderDetailRequest()
|
||||
{
|
||||
OrderId = selectedOutOrder.Id,
|
||||
OrderNumber = selectedOutOrder.StocktakingOrderNumber,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<List<OutOrderDetailModel>>>(LocalFile.Config.ApiIpHost + "outStore/getOutOrderDetail", body, "POST");
|
||||
if (Result != null && Result.Code == 200)
|
||||
{
|
||||
if (Result.Data.Count > 0)
|
||||
{
|
||||
//打开窗体
|
||||
var window = new OutInventoryDocumentDetailView(Result.Data);
|
||||
window.Owner = Application.Current.MainWindow;
|
||||
window.ShowDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Warning("该单据没有单据明细!");
|
||||
}
|
||||
}
|
||||
else if (Result != null)
|
||||
{
|
||||
Growl.Warning(Result.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Warning("调用接口失败!");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Error("出现异常:" + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ICommand BtnOrderMatDetailCommand { get => new DelegateCommand(BtnOrderMatDetail); }
|
||||
public void BtnOrderMatDetail()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (DataGridItemSource == null)
|
||||
{
|
||||
Growl.Warning("未勾选数据!");
|
||||
}
|
||||
|
||||
//判断是否勾选数据
|
||||
var selectedOutOrder = DataGridItemSource.Where(t => t.IsSelected)
|
||||
.FirstOrDefault();
|
||||
if (selectedOutOrder == null)
|
||||
{
|
||||
Growl.Warning("未勾选数据!");
|
||||
}
|
||||
#region 调用接口获取数据
|
||||
var body = new GetOutOrderDetailRequest()
|
||||
{
|
||||
OrderId = selectedOutOrder.Id,
|
||||
OrderNumber = selectedOutOrder.StocktakingOrderNumber,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<List<OutOrderMatDetailModel>>>(LocalFile.Config.ApiIpHost + "outStore/getOutOrderMatDetail", body, "POST");
|
||||
if (Result != null && Result.Code == 200)
|
||||
{
|
||||
if (Result.Data.Count > 0)
|
||||
{
|
||||
//打开窗体
|
||||
var window = new OutInventoryDocumentMatDetailView(Result.Data);
|
||||
window.Owner = Application.Current.MainWindow;
|
||||
window.ShowDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Warning("该单据没有发料明细!");
|
||||
}
|
||||
}
|
||||
else if (Result != null)
|
||||
{
|
||||
Growl.Warning(Result.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Warning("调用接口失败!");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Error("出现异常:" + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//开始入库 如果成功就直接跳转出库界面
|
||||
public ICommand BtnStartCommand { get => new DelegateCommand(BtnStart); }
|
||||
public void BtnStart()
|
||||
{
|
||||
WarningManager.AddWarning(new WCS.Model.WebSocketModel.WebSocketMessageModel());
|
||||
//try
|
||||
//{
|
||||
// if (DataGridItemSource == null)
|
||||
// {
|
||||
// Growl.Warning("未勾选数据!");
|
||||
// return;
|
||||
// }
|
||||
// //判断是否勾选数据
|
||||
// var selectedOutOrder = DataGridItemSource.Where(t => t.IsSelected)
|
||||
// .FirstOrDefault();
|
||||
// if (selectedOutOrder == null)
|
||||
// {
|
||||
// Growl.Warning("未勾选数据!");
|
||||
// return;
|
||||
// }
|
||||
|
||||
// #region 调用接口开始盘点
|
||||
// var body = new GetOutOrderDetailRequest()
|
||||
// {
|
||||
// OrderId = selectedOutOrder.Id,
|
||||
// OrderNumber = selectedOutOrder.StocktakingOrderNumber,
|
||||
// UserName = LocalStatic.CurrentUser,
|
||||
// DeviceType = LocalFile.Config.DeviceType,
|
||||
// };
|
||||
// var Result = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "outStore/goInOutstore", body, "POST");
|
||||
// if (Result != null && Result.Code == 200)
|
||||
// {
|
||||
// //成功后直接跳转
|
||||
// MainWindow1.viewModel.GoToOutVentoryView = true;
|
||||
// Growl.Success("已跳转到物料出库页面!");
|
||||
// }
|
||||
// else if (Result != null)
|
||||
// {
|
||||
// Growl.Warning(Result.Message);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Growl.Warning("调用接口失败!");
|
||||
// }
|
||||
// #endregion
|
||||
//}
|
||||
//catch (Exception ex)
|
||||
//{
|
||||
// Growl.Error("出现异常:" + ex.Message);
|
||||
//}
|
||||
//finally
|
||||
//{
|
||||
//}
|
||||
}
|
||||
|
||||
public ICommand BtnPauseCommand { get => new DelegateCommand(BtnPause); }
|
||||
public void BtnPause()
|
||||
{
|
||||
WarningManager.RemoveWarning(Guid.NewGuid());
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region PageOperation 分页操作
|
||||
private int currentPage;
|
||||
public int CurrentPage
|
||||
{
|
||||
get { return currentPage; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref currentPage, value);
|
||||
BtnSearch(false);
|
||||
}
|
||||
}
|
||||
|
||||
private int maxPage;
|
||||
public int MaxPage
|
||||
{
|
||||
get { return maxPage; }
|
||||
set { SetProperty(ref maxPage, value); }
|
||||
}
|
||||
|
||||
//总数量
|
||||
private int totalCount;
|
||||
public int TotalCount
|
||||
{
|
||||
get { return totalCount; }
|
||||
set { SetProperty(ref totalCount, value); }
|
||||
}
|
||||
|
||||
public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); }
|
||||
public void BtnFirstPage()
|
||||
{
|
||||
CurrentPage = 1;
|
||||
}
|
||||
|
||||
public ICommand BtnPrePageCommand { get => new DelegateCommand(BtnPrePage); }
|
||||
public void BtnPrePage()
|
||||
{
|
||||
if (CurrentPage > 1)
|
||||
{
|
||||
CurrentPage--;
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand BtnNextPageCommand { get => new DelegateCommand(BtnNextPage); }
|
||||
public void BtnNextPage()
|
||||
{
|
||||
if (CurrentPage < MaxPage)
|
||||
{
|
||||
CurrentPage++;
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand BtnLastPageCommand { get => new DelegateCommand(BtnLastPage); }
|
||||
public void BtnLastPage()
|
||||
{
|
||||
if (CurrentPage != MaxPage)
|
||||
{
|
||||
CurrentPage = MaxPage;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user