添加报警窗口
出库流程调试、优化
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
|
||||
}
|
||||
}
|
@ -50,10 +50,10 @@
|
||||
<Border Grid.Row="2" Margin="5,5,5,5" BorderThickness="1" Background="White" BorderBrush="DodgerBlue" CornerRadius="3">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2*"></ColumnDefinition>
|
||||
<!--<ColumnDefinition Width="2*"></ColumnDefinition>-->
|
||||
<ColumnDefinition Width="3*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<GroupBox Grid.Column="0" Background="White" Padding="0" Style="{StaticResource GroupBoxTab}" Margin="0,5,5,5" >
|
||||
<!--<GroupBox Grid.Column="0" Background="White" Padding="0" Style="{StaticResource GroupBoxTab}" Margin="0,5,5,5" >
|
||||
<GroupBox.Header>
|
||||
<Grid Width="{Binding ActualWidth,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type GroupBox}}}">
|
||||
<TextBlock Margin="5,0" HorizontalAlignment="Left" VerticalAlignment="Center">入库报警信息</TextBlock>
|
||||
@ -61,7 +61,7 @@
|
||||
</Grid>
|
||||
</GroupBox.Header>
|
||||
<pi:TextBoxLog Token="InstoreWarning" Style="{StaticResource TextBoxExtend.Multi}" Margin="-1" hc:InfoElement.Placeholder="没有日志信息" Foreground="CornflowerBlue"></pi:TextBoxLog>
|
||||
</GroupBox>
|
||||
</GroupBox>-->
|
||||
<GroupBox Grid.Column="1" Background="White" Padding="0" Style="{StaticResource GroupBoxTab}" Margin="0,5,5,5" >
|
||||
<GroupBox.Header>
|
||||
<Grid Width="{Binding ActualWidth,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type GroupBox}}}">
|
||||
|
@ -123,6 +123,18 @@
|
||||
</TabItem>
|
||||
|
||||
<TabItem Padding="10,10,40,10" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.查询},Converter={StaticResource AuthVisConverter}}">
|
||||
<TabItem.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="" FontSize="20" FontFamily="{StaticResource IconFont}"></TextBlock>
|
||||
<TextBlock Margin="10,0,0,0" FontSize="16">盘点单据</TextBlock>
|
||||
</StackPanel>
|
||||
</TabItem.Header>
|
||||
<hc:TransitioningContentControl TransitionMode="Fade">
|
||||
<View:StocktakingDocumentView/>
|
||||
</hc:TransitioningContentControl>
|
||||
</TabItem>
|
||||
|
||||
<TabItem IsSelected="{Binding GoToStockTakingView}" Padding="10,10,40,10" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.查询},Converter={StaticResource AuthVisConverter}}">
|
||||
<TabItem.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="" FontSize="20" FontFamily="{StaticResource IconFont}"></TextBlock>
|
||||
|
@ -14,7 +14,7 @@
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
<RowDefinition Height="7*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Grid.Row="0" Margin="5 5 5 0" Background="AliceBlue" CornerRadius="5" Padding="0">
|
||||
<Border Grid.Row="0" Margin="2" Background="AliceBlue" CornerRadius="5" Padding="0">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
@ -73,7 +73,7 @@
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Row="1" Margin="5" Background="AliceBlue" CornerRadius="5" Padding="0">
|
||||
<Border Grid.Row="1" Margin="2" Background="AliceBlue" CornerRadius="5" Padding="0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="0.8*"></RowDefinition>
|
||||
|
@ -88,7 +88,7 @@
|
||||
<RowDefinition Height="1*"></RowDefinition>
|
||||
<RowDefinition Height="12*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="发料单列表" FontWeight="DemiBold" FontSize="24" HorizontalAlignment="Center" VerticalAlignment="Center" TextAlignment="Center"></TextBlock>
|
||||
<TextBlock Text="发料单列表" MouseDown="TextBlock_MouseDown" FontWeight="DemiBold" FontSize="24" HorizontalAlignment="Center" VerticalAlignment="Center" TextAlignment="Center"></TextBlock>
|
||||
<Border CornerRadius="3" Margin="1" Grid.Row="1" Background="AliceBlue" BorderBrush="CadetBlue" BorderThickness="1.5">
|
||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Visible">
|
||||
<ListView FontSize="18" ItemsSource="{Binding OutOrderList}" SelectedItem="{Binding SelectedOutOrder,Mode=TwoWay}" PreviewMouseWheel="ListView_PreviewMouseWheel">
|
||||
|
@ -60,5 +60,10 @@ namespace 货架标准上位机
|
||||
parent.RaiseEvent(eventArg);
|
||||
}
|
||||
}
|
||||
|
||||
private void TextBlock_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
viewModel.RefreshOutOrderList(viewModel.SelectedOutOrderNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
175
货架标准上位机/Views/StocktakingDocumentView.xaml
Normal file
175
货架标准上位机/Views/StocktakingDocumentView.xaml
Normal file
@ -0,0 +1,175 @@
|
||||
<pi:UserControlBase
|
||||
xmlns:pi="https://github.com/ping9719/wpfex"
|
||||
x:Class="货架标准上位机.StocktakingDocumentView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="737" d:DesignWidth="1192">
|
||||
<Border Margin="0" Background="LightGray" CornerRadius="3" Padding="0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
<RowDefinition Height="7*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Grid.Row="0" Margin="5 5 5 0" Background="AliceBlue" CornerRadius="5" Padding="0">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="1.5*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="1.5*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="0.2*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition></RowDefinition>
|
||||
<RowDefinition></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Column="0"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Right"
|
||||
Text="盘点单据编号:" FontSize="18" ></TextBlock>
|
||||
<TextBox Grid.Column="1" Text="{Binding OrderNumber}"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Left"
|
||||
FontSize="18" MinWidth="120" ></TextBox>
|
||||
|
||||
<TextBlock Grid.Column="2"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Right"
|
||||
Text="盘点单据类型:" FontSize="18" ></TextBlock>
|
||||
<TextBox Grid.Column="3" Text="{Binding OrderType}"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Left"
|
||||
FontSize="18" MinWidth="120" ></TextBox>
|
||||
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Right"
|
||||
Text="盘点单据来源:" FontSize="18" ></TextBlock>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding OrderSource}"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Left"
|
||||
FontSize="18" MinWidth="120" ></TextBox>
|
||||
|
||||
|
||||
<!--<TextBlock Grid.Row="2" Grid.Column="2"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Right"
|
||||
Text="单据状态:" FontSize="18" ></TextBlock>
|
||||
<TextBox Grid.Row="1" Grid.Column="3" Text="{Binding OrderNumber}"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Left"
|
||||
FontSize="18" MinWidth="120" ></TextBox>-->
|
||||
|
||||
<Button Style="{StaticResource ButtonSuccess}"
|
||||
Command="{Binding BtnSearchCommand}"
|
||||
hc:BorderElement.CornerRadius="15"
|
||||
Grid.Column="6" MinHeight="40" FontSize="18" Content=" 搜索" FontFamily="{StaticResource IconFont}" Margin="0,0,0,-10" >
|
||||
</Button>
|
||||
<Button Style="{StaticResource ButtonWarning}"
|
||||
Command="{Binding BtnResetCommand}"
|
||||
hc:BorderElement.CornerRadius="15"
|
||||
Grid.Column="7" MinHeight="40" FontSize="18" Content=" 重置" FontFamily="{StaticResource IconFont}" Margin="0,0,0,-10" >
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Row="1" Margin="5" Background="AliceBlue" CornerRadius="5" Padding="0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="0.8*"></RowDefinition>
|
||||
<RowDefinition Height="8*"></RowDefinition>
|
||||
<RowDefinition Height="0.8*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal">
|
||||
<Button MinHeight="40" FontSize="18" Margin="5" Command="{Binding BtnOrderDetailCommand}"
|
||||
Content="单据明细" FontFamily="{StaticResource IconFont}" Background="#bccbb0" Foreground="White">
|
||||
</Button>
|
||||
|
||||
<Button MinHeight="40" FontSize="18" Margin="5" Command="{Binding BtnStartCommand}"
|
||||
Content="开始盘点" FontFamily="{StaticResource IconFont}" Background="CadetBlue" Foreground="White">
|
||||
</Button>
|
||||
<Button MinHeight="40" FontSize="18" Margin="5" Command="{Binding BtnPauseCommand}"
|
||||
Content="暂停盘点" FontFamily="{StaticResource IconFont}" Background="CadetBlue" Foreground="White">
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<DataGrid Grid.Row="1" SelectedCellsChanged="DataGrid_SelectedCellsChanged"
|
||||
SelectedItem="{Binding SelectedataGridItem}"
|
||||
ItemsSource="{Binding DataGridItemSource}"
|
||||
Name="dg"
|
||||
RowHeight="39"
|
||||
AutoGenerateColumns="False" FontSize="13">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn CanUserResize="False">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox Width="30" Height="30" IsHitTestVisible="False" IsChecked="{Binding IsSelected , UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="盘点单据编号" Binding="{Binding StocktakingOrderNumber}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="盘点单据来源" Binding="{Binding StocktakingOrderSource}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="盘点单据状态" Binding="{Binding StocktakingOrderStatus}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="创建时间" Binding="{Binding CreateTime}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="创建人" Binding="{Binding CreateUser}"></DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<Grid Grid.Row="2">
|
||||
<Border CornerRadius="3" Background="Transparent" VerticalAlignment="Center" >
|
||||
<Grid HorizontalAlignment="Stretch" Margin="0" VerticalAlignment="Top" Width="Auto" MinHeight="26">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="5*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="5*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="5*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="5">
|
||||
<TextBlock FontSize="14" Text="共"></TextBlock>
|
||||
<TextBlock FontSize="14" Text="{Binding TotalCount ,FallbackValue=0}"></TextBlock>
|
||||
<TextBlock FontSize="14" Text="条记录 "></TextBlock>
|
||||
<TextBlock FontSize="14" Text="第"></TextBlock>
|
||||
<TextBlock FontSize="14" Text="{Binding CurrentPage,FallbackValue=0}"></TextBlock>
|
||||
<TextBlock FontSize="14" Text="/"></TextBlock>
|
||||
<TextBlock FontSize="14" Text="{Binding MaxPage,FallbackValue=0}"></TextBlock>
|
||||
<TextBlock FontSize="14" Text="页"></TextBlock>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Column="1">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions >
|
||||
<RowDefinition Height="30"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="0" Name="btnFirst" Content="首页" Foreground="Black" FontSize="14"
|
||||
Command="{Binding BtnFirstPageCommand}"/>
|
||||
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="1" Name="btnPrev" Content="上一页" FontSize="14"
|
||||
Command="{Binding BtnPrePageCommand}"/>
|
||||
<TextBox BorderBrush="Transparent" Grid.Column="2" FontSize="14" MinWidth="50" HorizontalAlignment="Center" VerticalAlignment="Center" Cursor="IBeam" IsEnabled="False"
|
||||
Text ="{Binding CurrentPage}" TextAlignment="Center"/>
|
||||
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="3" Name="btnNext" Content="下一页" FontSize="14"
|
||||
Command="{Binding BtnNextPageCommand}"/>
|
||||
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="4" Name="btnLast" Content="末页" FontSize="14"
|
||||
Command="{Binding BtnLastPageCommand}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
</pi:UserControlBase>
|
66
货架标准上位机/Views/StocktakingDocumentView.xaml.cs
Normal file
66
货架标准上位机/Views/StocktakingDocumentView.xaml.cs
Normal file
@ -0,0 +1,66 @@
|
||||
using Ping9719.WpfEx;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using 货架标准上位机.ViewModels;
|
||||
using DataGrid = System.Windows.Controls.DataGrid;
|
||||
|
||||
namespace 货架标准上位机
|
||||
{
|
||||
/// <summary>
|
||||
/// InInventoryView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class StocktakingDocumentView : UserControlBase
|
||||
{
|
||||
public StocktakingDocumentViewModel viewModel = new StocktakingDocumentViewModel();
|
||||
public StocktakingDocumentView()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = viewModel;
|
||||
}
|
||||
|
||||
private void DataGrid_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (viewModel.SelectedataGridItem != null)
|
||||
{
|
||||
viewModel.SelectedataGridItem.IsSelected = !viewModel.SelectedataGridItem.IsSelected;
|
||||
this.dg.UnselectAllCells();//取消选中 避免手动点击check选项时反选失败 和重新点击该项时反选失败
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void DataGrid_ItemDataBound(object sender, DataGridItemEventArgs e)
|
||||
{
|
||||
if (e.Item.ItemType != ListItemType.Header && e.Item.ItemType != ListItemType.Pager)
|
||||
{
|
||||
if (e.Item.Cells[1].Text.Length > 20)
|
||||
{
|
||||
e.Item.Cells[1].Text = e.Item.Cells[1].Text.Substring(0, 20) + "...";
|
||||
}
|
||||
if (e.Item.Cells[2].Text.Length > 20)
|
||||
{
|
||||
e.Item.Cells[2].Text = e.Item.Cells[2].Text.Substring(0, 20) + "...";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
42
货架标准上位机/Views/Windows/WarningWindow.xaml
Normal file
42
货架标准上位机/Views/Windows/WarningWindow.xaml
Normal file
@ -0,0 +1,42 @@
|
||||
<hc:Window x:Class="货架标准上位机.WarningWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:货架标准上位机"
|
||||
mc:Ignorable="d"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
Height="300" Width="520" WindowStyle="None" BorderThickness="0" Background="{x:Null}" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Opacity="0.95">
|
||||
<hc:Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource ButtonDefault}">
|
||||
<Setter Property="Padding" Value="25,0"></Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</hc:Window.Resources>
|
||||
<Border BorderBrush="Gray" Background="WhiteSmoke" CornerRadius="5" BorderThickness="1">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"></RowDefinition>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
<RowDefinition Height="auto"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid VerticalAlignment="Top">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="auto"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid PreviewMouseLeftButtonDown="previewMouseLeftButtonDown" Background="Transparent">
|
||||
|
||||
</Grid>
|
||||
<TextBlock Margin="5,0" Text="报警" FontSize="15" Foreground="Red" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
||||
<!--<Button Grid.Column="1" Visibility="{Binding IsClose,Converter={StaticResource Boolean2VisibilityHiddenConverter}}" Style="{StaticResource ButtonIcon}" hc:IconElement.Geometry="{StaticResource CloseGeometry}" Click="closeClick"/>-->
|
||||
</Grid>
|
||||
<TextBlock Margin="5,0" Grid.Row="1" Text="{Binding Content, FallbackValue=我是内容}" Foreground="Red" FontSize="18" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
<hc:UniformSpacingPanel x:Name="spacingPanel" Grid.Row="2" Margin="5,0,5,10" Spacing="10" Width="auto" ChildWrapping="Wrap" HorizontalAlignment="Center">
|
||||
<Button Content="确认"/>
|
||||
<Button Content="忽略"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</hc:Window>
|
154
货架标准上位机/Views/Windows/WarningWindow.xaml.cs
Normal file
154
货架标准上位机/Views/Windows/WarningWindow.xaml.cs
Normal file
@ -0,0 +1,154 @@
|
||||
using 货架标准上位机.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Media;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using WCS.Model.WebSocketModel;
|
||||
using HandyControl.Controls;
|
||||
using WCS.Model;
|
||||
using 货架标准上位机.Api;
|
||||
using TouchSocket.Core;
|
||||
using Window = HandyControl.Controls.Window;
|
||||
|
||||
namespace 货架标准上位机
|
||||
{
|
||||
/// <summary>
|
||||
/// 提示框
|
||||
/// </summary>
|
||||
public partial class WarningWindow : HandyControl.Controls.Window
|
||||
{
|
||||
public WebSocketMessageModel warning { get; set; }
|
||||
public WarningWindow(WebSocketMessageModel _warning)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Topmost = true; // 设置窗口始终在最上方
|
||||
this.WindowStyle = WindowStyle.None; // 可选,移除窗口的标准边框
|
||||
warning = _warning;
|
||||
}
|
||||
|
||||
private void closeClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//this.Close();
|
||||
WarningManager.RemoveWarning(warning.Guid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示提示框
|
||||
/// </summary>
|
||||
/// <param name="content">内容</param>
|
||||
/// <param name="isVisCloseBut">界面右上角是否显示关闭按钮</param>
|
||||
/// <returns>点击的按钮文本</returns>
|
||||
public static WarningWindow Show(string content, WebSocketMessageModel _warning, bool isVisCloseBut = true, Window owner = null)
|
||||
{
|
||||
return Show(content, string.Empty, _warning, isVisCloseBut);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示提示框
|
||||
/// </summary>
|
||||
/// <param name="content">内容</param>
|
||||
/// <param name="title">标题</param>
|
||||
/// <param name="isVisCloseBut">界面右上角是否显示关闭按钮</param>
|
||||
/// <returns>点击的按钮文本</returns>
|
||||
public static WarningWindow Show(string content, string title, WebSocketMessageModel _warning, bool isVisCloseBut = true, Window owner = null)
|
||||
{
|
||||
return Show(content, title, new string[] { "确认", "忽略" }, _warning, isVisCloseBut);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示提示框
|
||||
/// </summary>
|
||||
/// <param name="content">内容</param>
|
||||
/// <param name="buttons">按钮内容</param>
|
||||
/// <param name="isVisCloseBut">界面右上角是否显示关闭按钮</param>
|
||||
/// <returns>点击的按钮文本</returns>
|
||||
public static WarningWindow Show(string content, IEnumerable<string> buttons, WebSocketMessageModel _warning, bool isVisCloseBut = true, Window owner = null)
|
||||
{
|
||||
return Show(content, string.Empty, buttons, _warning, isVisCloseBut);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示提示框
|
||||
/// </summary>
|
||||
/// <param name="content">内容</param>
|
||||
/// <param name="title">标题</param>
|
||||
/// <param name="buttons">按钮内容</param>
|
||||
/// <param name="isVisCloseBut">界面右上角是否显示关闭按钮</param>
|
||||
/// <returns>点击的按钮文本</returns>
|
||||
public static WarningWindow Show(string content, string title, IEnumerable<string> buttons, WebSocketMessageModel _warning, bool isVisCloseBut = true, Window owner = null)
|
||||
{
|
||||
WarningWindow WaningWindow;
|
||||
string clikename = string.Empty;
|
||||
WaningWindow = new WarningWindow(_warning);
|
||||
Application.Current.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
WaningWindow = new WarningWindow(_warning);
|
||||
WaningWindow.DataContext = new { Title = title, Content = content, IsClose = isVisCloseBut };
|
||||
WaningWindow.spacingPanel.Children.Clear();
|
||||
|
||||
foreach (var item in buttons)
|
||||
{
|
||||
Button button = new Button()
|
||||
{
|
||||
Content = item,
|
||||
};
|
||||
button.Click += (s, e) =>
|
||||
{
|
||||
clikename = ((Button)s).Content.ToString();
|
||||
Logs.Write($"用户{LocalStatic.CurrentUser}在处理异常报警{_warning.Guid}时点击了" + clikename);
|
||||
#region 调用接口处理异常/消除报警
|
||||
try
|
||||
{
|
||||
var body = new SolveWarningRequest()
|
||||
{
|
||||
Guid = _warning.Guid,
|
||||
SolveType = clikename == "确认" ? SolveTypeEnum.处理 : SolveTypeEnum.忽略,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<object>>(LocalFile.Config.ApiIpHost + "warning/solveWarning", body, "POST");
|
||||
if (Result != null && Result.Code == 200)
|
||||
{
|
||||
//消除异常或已不存在该异常
|
||||
WaningWindow.Close();
|
||||
}
|
||||
else if (Result != null && !string.IsNullOrEmpty(Result.Message))
|
||||
{
|
||||
Growl.Warning(Result.Message);
|
||||
}
|
||||
else if (Result == null)
|
||||
{
|
||||
Growl.Warning("调用后台接口失败!");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Warning(ex.Message);
|
||||
}
|
||||
#endregion
|
||||
};
|
||||
|
||||
WaningWindow.spacingPanel.Children.Add(button);
|
||||
}
|
||||
|
||||
WaningWindow.Owner = owner == null ? System.Windows.Application.Current.MainWindow : owner;
|
||||
WaningWindow.Show();
|
||||
}));
|
||||
return WaningWindow;
|
||||
}
|
||||
|
||||
private void previewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
DragMove();
|
||||
}
|
||||
}
|
||||
}
|
58
货架标准上位机/WarningManager.cs
Normal file
58
货架标准上位机/WarningManager.cs
Normal file
@ -0,0 +1,58 @@
|
||||
using HandyControl.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using WCS.Model.ApiModel.User;
|
||||
using WCS.Model.ApiModel;
|
||||
using WCS.Model;
|
||||
using WCS.Model.WebSocketModel;
|
||||
using 货架标准上位机.ViewModel;
|
||||
|
||||
namespace 货架标准上位机
|
||||
{
|
||||
public static class WarningManager
|
||||
{
|
||||
public static List<WarningWindow> warnings = new List<WarningWindow>();
|
||||
|
||||
public static object flag = new object();
|
||||
|
||||
public static void AddWarning(WebSocketMessageModel warningModel)
|
||||
{
|
||||
lock (flag)
|
||||
{
|
||||
warnings.Add(WarningWindow.Show(warningModel.WarningMessage, "报警信息", warningModel));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void RemoveWarning(Guid guid)
|
||||
{
|
||||
lock(flag)
|
||||
{
|
||||
try
|
||||
{
|
||||
var warning = warnings.Where(t => t.warning.Guid == guid).First();
|
||||
Application.Current.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
warning?.Close();
|
||||
warnings.Remove(warning);
|
||||
}));
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void InitWarning()
|
||||
{
|
||||
//TODO 调用接口获取当前IP前端已接收未进行处理的异常,避免因前端重启造成异常无法处理
|
||||
#region 调用接口
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +1,16 @@
|
||||
using HandyControl.Controls;
|
||||
using Newtonsoft.Json;
|
||||
using Ping9719.WpfEx;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using TouchSocket.Core;
|
||||
using TouchSocket.Http.WebSockets;
|
||||
using TouchSocket.Sockets;
|
||||
using WCS.Model.WebSocketModel;
|
||||
|
||||
namespace 货架标准上位机
|
||||
{
|
||||
@ -61,7 +64,52 @@ namespace 货架标准上位机
|
||||
//返回的报警信息 出入库盘点等日志信息
|
||||
else
|
||||
{
|
||||
TextBoxLog.AddLog(e.DataFrame.ToText(), "InstoreLog", DateTime.Now);
|
||||
try
|
||||
{
|
||||
var message = e.DataFrame.ToText();
|
||||
var warning = JsonConvert.DeserializeObject<WebSocketMessageModel>(message);
|
||||
if (warning != null)
|
||||
{
|
||||
//通知类的
|
||||
if (warning.IsWarning == false)
|
||||
{
|
||||
switch (warning.WarningType)
|
||||
{
|
||||
case WarningTypeEnum.通知刷新出库:
|
||||
OutVentoryView.viewModel.RefreshDataGridItemSource();
|
||||
client.Send(e.DataFrame.ToText());
|
||||
break;
|
||||
case WarningTypeEnum.恢复正常:
|
||||
var SolvedGuids = warning.SolvedGuids;
|
||||
SolvedGuids.ForEach(guid =>
|
||||
{
|
||||
WarningManager.RemoveWarning(guid);
|
||||
});
|
||||
TextBoxLog.AddLog(warning.WarningMessage, "InstoreLog", DateTime.Now);
|
||||
client.Send(e.DataFrame.ToText());
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
WarningManager.AddWarning(warning);
|
||||
TextBoxLog.AddLog(warning.WarningMessage, "InstoreLog", DateTime.Now);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
client.Send(e.DataFrame.ToText());
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
return;
|
||||
|
||||
|
Reference in New Issue
Block a user