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.
301 lines
10 KiB
C#
301 lines
10 KiB
C#
using CommonFunc;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
using System.Threading;
|
|
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 Thrift.Protocol;
|
|
using Thrift.Server;
|
|
using Thrift.Transport;
|
|
using CentralControl.BaseData;
|
|
using CentralControl.DBDAO;
|
|
namespace XGL.FormItem
|
|
{
|
|
/// <summary>
|
|
/// FormHandUp.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class FormTakeOff : Window
|
|
{
|
|
/// <summary>
|
|
/// 时间刷新
|
|
/// </summary>
|
|
private DispatcherTimer dispatcherTimer;
|
|
|
|
public FormTakeOff()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
|
|
string thriftport = System.Configuration.ConfigurationManager.AppSettings["localPort"];
|
|
Thread offMaterialThriftThread = new Thread(new ParameterizedThreadStart(StartOffThriftLogic));
|
|
offMaterialThriftThread.Start(thriftport);
|
|
|
|
|
|
dispatcherTimer = new DispatcherTimer();
|
|
dispatcherTimer.Interval = TimeSpan.FromMilliseconds(1000);
|
|
dispatcherTimer.Tick += DispatcherTimer_Tick;
|
|
dispatcherTimer.IsEnabled = true;
|
|
dispatcherTimer.Start();
|
|
txtTime.Content = DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString();
|
|
List<test> tests = new List<test>() {
|
|
// new test()
|
|
//{
|
|
// ProductCode="e",
|
|
//},
|
|
new test()
|
|
{
|
|
ProductCode="d",
|
|
},
|
|
new test()
|
|
{
|
|
ProductCode="c",
|
|
},
|
|
new test()
|
|
{
|
|
ProductCode="b",
|
|
},
|
|
new test()
|
|
{
|
|
ProductCode="a",
|
|
}
|
|
};
|
|
lvCars.ItemsSource = tests;
|
|
lvCars.Items.Refresh();
|
|
|
|
List<test> tests1 = new List<test>() {
|
|
new test()
|
|
{
|
|
ProductCode="f",
|
|
},
|
|
new test()
|
|
{
|
|
ProductCode="e",
|
|
},
|
|
new test()
|
|
{
|
|
ProductCode="d",
|
|
},
|
|
new test()
|
|
{
|
|
ProductCode="c",
|
|
},
|
|
new test()
|
|
{
|
|
ProductCode="b",
|
|
},
|
|
new test()
|
|
{
|
|
ProductCode="a",
|
|
}
|
|
};
|
|
List<test> tests2 = new List<test>() {
|
|
new test()
|
|
{
|
|
ProductCode="c",
|
|
},
|
|
new test()
|
|
{
|
|
ProductCode="b",
|
|
},
|
|
new test()
|
|
{
|
|
ProductCode="a",
|
|
}
|
|
};
|
|
lvCar.ItemsSource = tests1;
|
|
lvCar.Items.Refresh();
|
|
|
|
lvEmptyCars1.ItemsSource = tests2;
|
|
lvEmptyCars1.Items.Refresh();
|
|
lvEmptyCars2.ItemsSource = tests2;
|
|
lvEmptyCars2.Items.Refresh();
|
|
}
|
|
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 StartOffThriftLogic(object thriftpoint)
|
|
{
|
|
int point = Convert.ToInt32(thriftpoint);
|
|
XGL.Thrift.ThriftServiceImp business = new XGL.Thrift.ThriftServiceImp();
|
|
business.GetUnloadMaterialEvent += GetUnloadMaterial;
|
|
XGL.Thrift.ThriftCommon thriftCommon = new XGL.Thrift.ThriftCommon();
|
|
thriftCommon.Start(business, point);
|
|
|
|
}
|
|
|
|
|
|
string GetUnloadMaterial(string carno, string materialno, string materialdesc, string orderno, string str1, string str2, string str3)
|
|
{
|
|
Application.Current.Dispatcher.Invoke(new Action(
|
|
delegate
|
|
{
|
|
lblBarcode.Content = str1;
|
|
lblCarNo.Content = carno;
|
|
lblMaterialDesc.Content = materialdesc;
|
|
lblMaterialMode.Content = str2;
|
|
lblMaterialNo.Content = materialno;
|
|
lblOrdercode.Content = orderno;
|
|
}));
|
|
|
|
return "";
|
|
}
|
|
|
|
|
|
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);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 下件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void btnTakeOff_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
TTransport transport = new TSocket(Common.ThriftConfigIp, Convert.ToInt32(Common.ThriftConfigPort));
|
|
TProtocol protocol = new TBinaryProtocol(transport);
|
|
ThriftService.Client client = new ThriftService.Client(protocol);
|
|
transport.Open();
|
|
client.UnloadCarMaterial(lblCarNo.Content.ToString().Trim());
|
|
transport.Close();
|
|
}
|
|
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>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void btnPullBack_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
TTransport transport = new TSocket(Common.ThriftConfigIp, Convert.ToInt32(Common.ThriftConfigPort));
|
|
TProtocol protocol = new TBinaryProtocol(transport);
|
|
ThriftService.Client client = new ThriftService.Client(protocol);
|
|
transport.Open();
|
|
List<string> list = new List<string>();
|
|
list.Add(lblCarNo.Content.ToString().Trim());
|
|
client.HaulbackCarFromPoint(list);
|
|
transport.Close();
|
|
}
|
|
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 BindPlan()
|
|
//{
|
|
// try
|
|
// {
|
|
// using (basedata_orderplanDb orderplanDb = new basedata_orderplanDb())
|
|
// {
|
|
// List<vbasedata_orderplanModel> models = orderplanDb.GetVList("");
|
|
// gridPlan.ItemsSource = models;
|
|
// gridPlan.Items.Refresh();
|
|
// }
|
|
// }
|
|
// 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 BindBill()
|
|
{
|
|
try
|
|
{
|
|
|
|
}
|
|
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 BindKC()
|
|
{
|
|
try
|
|
{
|
|
using (basedata_carrealinfoDb carrealinfoDb = new basedata_carrealinfoDb())
|
|
{
|
|
DataSet ds = carrealinfoDb.GetDataCount(" AreaType>=4");
|
|
//gridEmergency.ItemsSource = ds.Tables[0].DefaultView;
|
|
//gridEmergency.Items.Refresh();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MethodInfo method = (MethodInfo)MethodBase.GetCurrentMethod();
|
|
Common.Log.Error(method.DeclaringType.FullName + "-" + method.Name + "\r\n" + ex.Message + "\r\n" + ex.StackTrace);
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|