140 lines
4.5 KiB
C#
140 lines
4.5 KiB
C#
using HandyControl.Controls;
|
|
using Ping9719.WpfEx;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading;
|
|
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.ApiModel.StoreInfo;
|
|
using WCS.Model;
|
|
using 智慧物流软件系统.ViewModel;
|
|
using 智慧物流软件系统.Api;
|
|
|
|
namespace 智慧物流软件系统
|
|
{
|
|
public partial class StoreInfoView : UserControlBase
|
|
{
|
|
public StoreInfoViewModel viewModel { get; set; } = new StoreInfoViewModel();
|
|
public StoreInfoView()
|
|
{
|
|
InitializeComponent();
|
|
this.DataContext = viewModel;
|
|
}
|
|
|
|
private void LoadedVisible(object sender, EventArgs e)
|
|
{
|
|
viewModel.BtnReset();
|
|
viewModel.BtnSearchReset();
|
|
}
|
|
|
|
private void allChecked_Checked(object sender, RoutedEventArgs e)
|
|
{
|
|
if (viewModel != null && viewModel.DataGridItemSource != null && viewModel.DataGridItemSource.Count() > 0)
|
|
{
|
|
foreach (var item in viewModel.DataGridItemSource)
|
|
{
|
|
item.IsSelected = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void allChecked_Unchecked(object sender, RoutedEventArgs e)
|
|
{
|
|
if (viewModel != null && viewModel.DataGridItemSource != null && viewModel.DataGridItemSource.Count() > 0)
|
|
{
|
|
foreach (var item in viewModel.DataGridItemSource)
|
|
{
|
|
item.IsSelected = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void dataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
// 更新选中项的状态
|
|
if (dataGrid.SelectedCells.Count > 0 && viewModel.SelectedataGridItem != null)
|
|
{
|
|
viewModel.SelectedataGridItem.IsSelected = !viewModel.SelectedataGridItem.IsSelected;
|
|
//dataGrid.UnselectAllCells(); // 取消选中所有单元格
|
|
}
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
Debug.WriteLine("SelectionChanged event handler failed: " + ex.Message);
|
|
}
|
|
}
|
|
|
|
private void CheckBox_Checked(object sender, RoutedEventArgs e)
|
|
{
|
|
;
|
|
}
|
|
|
|
private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
|
|
{
|
|
;
|
|
}
|
|
|
|
private void CheckBox_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
;
|
|
}
|
|
|
|
private void MenuItem_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
//先获取选中的模组
|
|
var storeInfo = viewModel.SelectedataGridItem;
|
|
#region 调用接口 发送指令进行查询
|
|
try
|
|
{
|
|
var body = new QueryStoreInfoHistoryVoltageRequest()
|
|
{
|
|
StoreIds = new List<int>() { storeInfo.Id },
|
|
UserName = LocalStatic.CurrentUser,
|
|
DeviceType = LocalFile.Config.DeviceType,
|
|
};
|
|
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<List<StoreInfoHistoryVoltageModel>>>(LocalFile.Config.ApiIpHost + "storeInfo/queryStoreInfoHistoryVoltage", body, "POST");
|
|
if (Result != null && Result.Code == 200)
|
|
{
|
|
if (Result.Data == null || Result.Data.Count == 0)
|
|
{
|
|
Growl.Success("查询成功!该库位没有历史电压值数据!");
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
Growl.Success("查询成功!请查看弹窗内数据!");
|
|
var window = new StoreInfoHistoryVoltageWindow(Result.Data, storeInfo.StoreCode);
|
|
window.ShowDialog();
|
|
}
|
|
|
|
}
|
|
else if (Result != null)
|
|
{
|
|
Growl.Success(Result.Message);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Growl.Warning("查询失败:" + ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
|
|
}
|
|
#endregion
|
|
}
|
|
}
|
|
}
|