|
@@ -25,7 +25,7 @@ using RabbitMQ.Client.Events;
|
|
|
|
|
|
namespace ct_terminal
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
|
|
|
public partial class MainForm : Form
|
|
|
{
|
|
@@ -61,7 +61,7 @@ namespace ct_terminal
|
|
|
|
|
|
private TimedData<string> m_pick_command_response = new TimedData<string>("");
|
|
|
private Process m_process = null;
|
|
|
-
|
|
|
+ private string m_image_path;
|
|
|
private static readonly object Lock = new object();
|
|
|
public MainForm()
|
|
|
{
|
|
@@ -86,22 +86,22 @@ namespace ct_terminal
|
|
|
string t_pick_queue_key = "pick_response_" + m_ternimalID.ToString() + "_queue";
|
|
|
m_pick_consumer.consumer_init(m_rabbitmq_ip, m_rabbitmq_port, m_rabbitmq_user, m_rabbitmq_password, t_pick_queue_key, pick_response_thread);
|
|
|
|
|
|
-
|
|
|
+ m_image_path = System.AppDomain.CurrentDomain.BaseDirectory + "./Resource/";
|
|
|
|
|
|
#if ENABLE_PACK
|
|
|
- //获取号牌线程
|
|
|
- m_car_number = new NumMachine.NumMachineLinker();
|
|
|
- m_car_number_condition = true;
|
|
|
- m_car_number_thread = new Thread(get_car_number_thread);
|
|
|
+ //获取号牌线程
|
|
|
+ m_car_number = new NumMachine.NumMachineLinker();
|
|
|
+ m_car_number_condition = true;
|
|
|
+ m_car_number_thread = new Thread(get_car_number_thread);
|
|
|
|
|
|
- //初始化打印机
|
|
|
- PrintManual.Instance.PrintManualInit();
|
|
|
+ //初始化打印机
|
|
|
+ PrintManual.Instance.PrintManualInit();
|
|
|
|
|
|
- //初始化消费指令
|
|
|
- string t_park_queue_key = "park_response_" + m_ternimalID.ToString() + "_queue";
|
|
|
- m_park_consumer.consumer_init(m_rabbitmq_ip, m_rabbitmq_port, m_rabbitmq_user, m_rabbitmq_password, t_park_queue_key, park_response_thread);
|
|
|
+ //初始化消费指令
|
|
|
+ string t_park_queue_key = "park_response_" + m_ternimalID.ToString() + "_queue";
|
|
|
+ m_park_consumer.consumer_init(m_rabbitmq_ip, m_rabbitmq_port, m_rabbitmq_user, m_rabbitmq_password, t_park_queue_key, park_response_thread);
|
|
|
#else
|
|
|
- this.parkingBtn.BackgroundImage = Image.FromFile(System.AppDomain.CurrentDomain.BaseDirectory + "./Resource/" + "parkingBtn_gray.BackgroundImage.png");
|
|
|
+ this.parkingBtn.BackgroundImage = Image.FromFile(m_image_path + "parkingBtn_gray.BackgroundImage.png");
|
|
|
this.parkingBtn.Enabled = false;
|
|
|
#endif
|
|
|
}
|
|
@@ -145,8 +145,9 @@ namespace ct_terminal
|
|
|
#endif
|
|
|
|
|
|
}
|
|
|
- public string startNumer(Random r)
|
|
|
+ public string randomNumer()
|
|
|
{
|
|
|
+ Random r = new Random();
|
|
|
char E1 = (char)r.Next(65, 90);
|
|
|
char E2 = (char)r.Next(65, 90);
|
|
|
int N1 = r.Next(10, 99);
|
|
@@ -160,6 +161,7 @@ namespace ct_terminal
|
|
|
|
|
|
private void parkingBtn_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
+ //string car_license = randomNumer();
|
|
|
string car_license = "";
|
|
|
if (m_timed_car_license.IsTimeout() == false && m_timed_car_license.Value != "")
|
|
|
{
|
|
@@ -187,15 +189,24 @@ namespace ct_terminal
|
|
|
messageBoxEe.Show("服务器连接失败!请联系管理员!");
|
|
|
return;
|
|
|
}
|
|
|
- //this.parkingBtn.BackgroundImage = Image.FromFile(System.AppDomain.CurrentDomain.BaseDirectory + "./Resource/" + "parkingBtn_gray.BackgroundImage.png");
|
|
|
+ this.parkingBtn.BackgroundImage = Image.FromFile(m_image_path + "parkingBtn_gray.BackgroundImage.png");
|
|
|
this.parkingBtn.Enabled = false;
|
|
|
while (!m_park_command_response.IsTimeout())
|
|
|
{
|
|
|
- if (m_park_command_response.Value == "")
|
|
|
- continue;
|
|
|
+ if (m_park_command_response.Value != "")
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (m_park_command_response.IsTimeout() && m_park_command_response.Value == "")
|
|
|
+ {
|
|
|
+ MessageBoxEe messageBoxEe = new MessageBoxEe();
|
|
|
+ messageBoxEe.Show("反馈超时,请重试或联系管理员!");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
try
|
|
|
{
|
|
|
park_table response_Table = park_table.Parser.ParseText(m_park_command_response.Value);
|
|
|
+ //response_Table.PrimaryKey = "ddddddddddd";
|
|
|
if (response_Table.Statu.ExecuteStatu == STATU.ENormal && response_Table.PrimaryKey != "")
|
|
|
{
|
|
|
PrintManual.Instance.PrintTicket(response_Table.PrimaryKey, response_Table.CarNumber);
|
|
@@ -211,7 +222,7 @@ namespace ct_terminal
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- else
|
|
|
+ else
|
|
|
{
|
|
|
MessageBoxEe messageBoxEe = new MessageBoxEe();
|
|
|
messageBoxEe.Show(response_Table.Statu.StatuDescription);
|
|
@@ -222,21 +233,9 @@ namespace ct_terminal
|
|
|
MessageBoxEe messageBoxEe = new MessageBoxEe();
|
|
|
messageBoxEe.Show("反馈解析失败!\n" + ex.StackTrace);
|
|
|
}
|
|
|
- m_park_command_response = "";
|
|
|
- //this.parkingBtn.BackgroundImage = Image.FromFile(System.AppDomain.CurrentDomain.BaseDirectory + "./Resource/" + "parkingBtn.BackgroundImage.png");
|
|
|
- this.parkingBtn.Enabled = true;
|
|
|
- return;
|
|
|
-
|
|
|
- }
|
|
|
- if (m_park_command_response.IsTimeout() && m_park_command_response.Value == "")
|
|
|
- {
|
|
|
- MessageBoxEe messageBoxEe = new MessageBoxEe();
|
|
|
- messageBoxEe.Show("反馈超时,请重试或联系管理员!");
|
|
|
}
|
|
|
m_park_command_response = "";
|
|
|
-
|
|
|
- //this.parkingBtn.BackgroundImage = Image.FromFile(System.AppDomain.CurrentDomain.BaseDirectory + "./Resource/" + "parkingBtn.BackgroundImage.png");
|
|
|
-
|
|
|
+ this.parkingBtn.BackgroundImage = Image.FromFile(m_image_path + "parkingBtn.BackgroundImage.png");
|
|
|
this.parkingBtn.Enabled = true;
|
|
|
|
|
|
}
|
|
@@ -265,42 +264,50 @@ namespace ct_terminal
|
|
|
messageBoxEe.Show("服务器连接失败!请联系管理员!");
|
|
|
return;
|
|
|
}
|
|
|
- //this.pickupBtn.BackgroundImage = Image.FromFile(System.AppDomain.CurrentDomain.BaseDirectory + "./Resource/" + "fetchingBtn_gray.BackgroundImage.png");
|
|
|
+ this.pickupBtn.BackgroundImage = Image.FromFile(m_image_path + "fetchingBtn_gray.BackgroundImage.png");
|
|
|
this.pickupBtn.Enabled = false;
|
|
|
while (!m_pick_command_response.IsTimeout())
|
|
|
{
|
|
|
- if (m_pick_command_response.Value == "")
|
|
|
- continue;
|
|
|
- pick_table response_Table = new pick_table();
|
|
|
- response_Table = pick_table.Parser.ParseText(m_pick_command_response.Value);
|
|
|
- if (response_Table.Statu.ExecuteStatu == STATU.ENormal)
|
|
|
- {
|
|
|
-
|
|
|
- MessageBoxEe messageBoxEe = new MessageBoxEe();
|
|
|
- messageBoxEe.Show(response_Table.CarNumber + " 取车成功,请观察LED屏幕提示取车!");
|
|
|
+ if (m_pick_command_response.Value != "")
|
|
|
break;
|
|
|
-
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- MessageBoxEe messageBoxEe = new MessageBoxEe();
|
|
|
- messageBoxEe.Show(response_Table.Statu.StatuDescription);
|
|
|
- break;
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
- if (m_pick_command_response.IsTimeout()&& m_pick_command_response.Value == "")
|
|
|
+ if (m_pick_command_response.IsTimeout() && m_pick_command_response.Value == "")
|
|
|
{
|
|
|
MessageBoxEe messageBoxEe = new MessageBoxEe();
|
|
|
messageBoxEe.Show("反馈超时,请重试或联系管理员!");
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ pick_table response_Table = new pick_table();
|
|
|
+ response_Table = pick_table.Parser.ParseText(m_pick_command_response.Value);
|
|
|
+ if (response_Table.Statu.ExecuteStatu == STATU.ENormal)
|
|
|
+ {
|
|
|
+ MessageBoxEe messageBoxEe = new MessageBoxEe();
|
|
|
+ messageBoxEe.Show(response_Table.CarNumber + " 取车成功,请观察LED屏幕提示取车!");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ MessageBoxEe messageBoxEe = new MessageBoxEe();
|
|
|
+ messageBoxEe.Show(response_Table.Statu.StatuDescription);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ MessageBoxEe messageBoxEe = new MessageBoxEe();
|
|
|
+ messageBoxEe.Show("反馈解析失败!\n" + ex.StackTrace);
|
|
|
+ }
|
|
|
+ }
|
|
|
m_pick_command_response = "";
|
|
|
- //this.pickupBtn.BackgroundImage = Image.FromFile(System.AppDomain.CurrentDomain.BaseDirectory + "./Resource/" + "fetchingBtn.BackgroundImage.png");
|
|
|
+ this.pickupBtn.BackgroundImage = Image.FromFile(m_image_path + "fetchingBtn.BackgroundImage.png");
|
|
|
this.pickupBtn.Enabled = true;
|
|
|
}
|
|
|
//停车反馈线程
|
|
|
- void park_response_thread(string msg, ref IModel channel ,ref BasicDeliverEventArgs args)
|
|
|
+ void park_response_thread(string msg, ref IModel channel, ref BasicDeliverEventArgs args)
|
|
|
{
|
|
|
- Console.WriteLine("停车反馈:"+msg);
|
|
|
+ Console.WriteLine("停车反馈:" + msg);
|
|
|
if (msg != null && msg != "")
|
|
|
{
|
|
|
m_park_command_response = msg;
|
|
@@ -310,7 +317,7 @@ namespace ct_terminal
|
|
|
channel.BasicAck(args.DeliveryTag, true);
|
|
|
}
|
|
|
//取车反馈线程
|
|
|
- void pick_response_thread(string msg,ref IModel channel, ref BasicDeliverEventArgs args)
|
|
|
+ void pick_response_thread(string msg, ref IModel channel, ref BasicDeliverEventArgs args)
|
|
|
{
|
|
|
Console.WriteLine("取车反馈:" + msg);
|
|
|
if (msg != null && msg != "")
|
|
@@ -345,7 +352,7 @@ namespace ct_terminal
|
|
|
}
|
|
|
#endif
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取号牌线程
|
|
@@ -355,7 +362,7 @@ namespace ct_terminal
|
|
|
while (m_car_number_condition == true)
|
|
|
{
|
|
|
string number = m_car_number.GetLicensePlate(0);
|
|
|
- // Console.WriteLine("号牌机接收到号牌:"+number);
|
|
|
+ // Console.WriteLine("号牌机接收到号牌:"+number);
|
|
|
if (number != null && number != "")
|
|
|
{
|
|
|
lock (Lock)
|
|
@@ -364,7 +371,7 @@ namespace ct_terminal
|
|
|
m_timed_car_license.Set_timeout_ms(900000);
|
|
|
}
|
|
|
|
|
|
- // MessageBoxEe.Show(m_timed_car_license.Value);
|
|
|
+ // MessageBoxEe.Show(m_timed_car_license.Value);
|
|
|
}
|
|
|
if (!m_timed_car_license.IsTimeout() && m_timed_car_license.Value != "")
|
|
|
{
|