You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
225 lines
7.1 KiB
C#
225 lines
7.1 KiB
C#
using CommonFunc;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
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 System.Windows.Threading;
|
|
using XGL.Data;
|
|
using XGL.Models;
|
|
using XGL.UControl;
|
|
using Thrift.Protocol;
|
|
using Thrift.Server;
|
|
using Thrift.Transport;
|
|
using CentralControl.BaseData;
|
|
using CentralControl.DBDAO;
|
|
using XGL.Thrift;
|
|
using System.Threading;
|
|
namespace XGL.FormItem
|
|
{
|
|
/// <summary>
|
|
/// FormHandUp.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class FormUpLineBoard : Window
|
|
{
|
|
|
|
List<LineCatchArea> listCatchAreas = new List<LineCatchArea>();
|
|
List<CarRealInfo> listCarreals = new List<CarRealInfo>();
|
|
/// <summary>
|
|
/// 时间刷新
|
|
/// </summary>
|
|
private DispatcherTimer dispatcherTimer;
|
|
|
|
/// <summary>
|
|
/// UI数据刷新
|
|
/// </summary>
|
|
private DispatcherTimer RefreshUITimer;
|
|
/// <summary>
|
|
/// 上件区小车列表
|
|
/// </summary>
|
|
ObservableCollection<basedata_carrealinfoModel> Cars = new ObservableCollection<basedata_carrealinfoModel>();
|
|
public FormUpLineBoard()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
dispatcherTimer = new DispatcherTimer();
|
|
dispatcherTimer.Interval = TimeSpan.FromMilliseconds(1000);
|
|
dispatcherTimer.Tick += DispatcherTimer_Tick;
|
|
dispatcherTimer.IsEnabled = true;
|
|
dispatcherTimer.Start();
|
|
|
|
RefreshUITimer = new DispatcherTimer();
|
|
RefreshUITimer.Interval = TimeSpan.FromSeconds(6);
|
|
RefreshUITimer.Tick += RefreshUITimer_Tick;
|
|
RefreshUITimer.IsEnabled = true;
|
|
RefreshUITimer.Start();
|
|
txtTime.Content = DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString();
|
|
|
|
|
|
BindLocatorViewList();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod();
|
|
Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace);
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 绑定左侧库位图形列表
|
|
/// </summary>
|
|
private void BindLocatorViewList()
|
|
{
|
|
|
|
Application.Current.Dispatcher.Invoke(new Action(
|
|
delegate
|
|
{
|
|
DataTable dt = DBService.GetUpLIneMaterialView(FormHandUp.WeekNo);
|
|
List<UpLineBoardModel> list = new List<UpLineBoardModel>();
|
|
foreach (DataRow dr in dt.Rows)
|
|
{
|
|
UpLineBoardModel car = new UpLineBoardModel();
|
|
car.materialno = dr["MaterialBarNo"].ToString();
|
|
car.maxnumber = Convert.ToInt32(dr["MaxNumber"]);
|
|
car.currnumber = Convert.ToInt32(dr["HadNumber"]);
|
|
car.caninnumber = (Convert.ToInt32(dr["MaxNumber"]) - Convert.ToInt32(dr["HadNumber"]));
|
|
car.dayneednumber = Convert.ToInt32(dr["total"]);
|
|
list.Add(car);
|
|
}
|
|
gridMaterial.ItemsSource = list;
|
|
gridMaterial.Items.Refresh();
|
|
}));
|
|
|
|
}
|
|
|
|
|
|
|
|
private void RefreshUITimer_Tick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
BindLocatorViewList();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
CommonFunc.Logger logger = new CommonFunc.Logger();
|
|
logger.Error("系统刷新数据上件点异常:" + ex.Message + ex.StackTrace);
|
|
}
|
|
}
|
|
|
|
private void DispatcherTimer_Tick(object sender, EventArgs e)
|
|
{
|
|
txtTime.Content = DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString();
|
|
}
|
|
|
|
private void btnExit_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (MessageBox.Show("是否确认关闭当前窗口", "提示信息", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.No)
|
|
{
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
Environment.Exit(System.Environment.ExitCode);
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod();
|
|
Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace);
|
|
}
|
|
}
|
|
|
|
private void GridMaterial_LoadingRow(object sender, DataGridRowEventArgs e)
|
|
{
|
|
e.Row.Header = e.Row.GetIndex() + 1;
|
|
var drv = e.Row.Item as UpLineBoardModel;
|
|
if (drv.caninnumber == 0 )
|
|
{
|
|
e.Row.Background = new SolidColorBrush(Colors.Red);
|
|
}
|
|
//else if (drv.caninnumber <5)
|
|
//{
|
|
// e.Row.Background = new SolidColorBrush(Colors.Yellow);
|
|
//}
|
|
else
|
|
{
|
|
e.Row.Background = new SolidColorBrush(Colors.Green);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
public class UpLineBoardModel
|
|
{
|
|
/// <summary>
|
|
/// 物料型号
|
|
/// </summary>
|
|
public string materialno { get; set; }
|
|
/// <summary>
|
|
/// 库存最大数量
|
|
/// </summary>
|
|
public int maxnumber { get; set; }
|
|
/// <summary>
|
|
/// 当前库存量
|
|
/// </summary>
|
|
public int currnumber { get; set; }
|
|
/// <summary>
|
|
/// 可入库存数
|
|
/// </summary>
|
|
public int caninnumber { get; set; }
|
|
/// <summary>
|
|
/// 当日需求数量
|
|
/// </summary>
|
|
public int dayneednumber { get; set; }
|
|
|
|
|
|
}
|
|
|
|
[ValueConversion(typeof(int), typeof(Brushes))]
|
|
public class BGConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
|
{
|
|
int surplus = (int)value;
|
|
if (surplus <=0)
|
|
{
|
|
return Brushes.Red;
|
|
}
|
|
else if (surplus <10)
|
|
{
|
|
return Brushes.Yellow;
|
|
}
|
|
else
|
|
{
|
|
return Brushes.White;
|
|
}
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
|
|
} |