|
@@ -447,7 +447,7 @@ namespace parkMonitor.server
|
|
|
AsyncCmdServer.ins.send(AsyncCmdType.PLCReadException);
|
|
|
return;
|
|
|
}
|
|
|
- Thread.Sleep(300);
|
|
|
+ Thread.Sleep(200);
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
@@ -455,7 +455,26 @@ namespace parkMonitor.server
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ private void WaitForLaserReady(LaserProcessUnit lpuTemp)
|
|
|
+ {
|
|
|
+ bool jumpOut = false;
|
|
|
+ while (!jumpOut)
|
|
|
+ {
|
|
|
+ Thread.Sleep(1000);
|
|
|
+ if (plcMsg != null && plcMsg.originalPlcList.Count > lpuTemp.laser_status_address)
|
|
|
+ {
|
|
|
+ foreach (PLCNode node in plcMsg.originalPlcList)
|
|
|
+ {
|
|
|
+ //判断激光空闲状态
|
|
|
+ if (node.Address.Equals(lpuTemp.laser_status_address.ToString()) && (node.Value.Equals("254") || node.Value.Equals("255")))
|
|
|
+ {
|
|
|
+ jumpOut = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
//***************公有方法****************
|
|
|
public AbstractMessage GetMessage()
|
|
|
{
|
|
@@ -516,23 +535,7 @@ namespace parkMonitor.server
|
|
|
if (laser_start_addr == "")
|
|
|
return;
|
|
|
|
|
|
- bool jumpOut = false;
|
|
|
- while (!jumpOut)
|
|
|
- {
|
|
|
- Thread.Sleep(1000);
|
|
|
- if (plcMsg != null && plcMsg.originalPlcList.Count > lpuTemp.laser_status_address)
|
|
|
- {
|
|
|
- foreach (PLCNode node in plcMsg.originalPlcList)
|
|
|
- {
|
|
|
- //判断激光空闲状态
|
|
|
- if (node.Address.Equals(lpuTemp.laser_status_address.ToString()) && (node.Value.Equals("254") || node.Value.Equals("255")))
|
|
|
- {
|
|
|
- jumpOut = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ WaitForLaserReady(lpuTemp);
|
|
|
SendtoPLC(laser_start_addr, "0");
|
|
|
foreach (LaserMessage lm in plcMsg.laserMsgList)
|
|
|
{
|
|
@@ -594,9 +597,10 @@ namespace parkMonitor.server
|
|
|
SendtoPLC(rpu1.frontWheelbase.ToString(), pm.frontWheelbase.ToString());
|
|
|
SendtoPLC(rpu1.rearWheelbase.ToString(), pm.rearWheelbase.ToString());
|
|
|
//取至区域
|
|
|
- SendtoPLC(rpu1.fetch_to_address.ToString(), pm.fetchPosition.ToString());
|
|
|
+ //SendtoPLC(rpu1.fetch_to_address.ToString(), pm.fetchPosition.ToString());
|
|
|
+ SendtoPLC(rpu1.fetch_to_address.ToString(), pm.parkingSpaceX);
|
|
|
//车位信息
|
|
|
- SendtoPLC(rpu1.parkingSpaceID_address.ToString(), "1");
|
|
|
+ SendtoPLC(rpu1.parkingSpaceID_address.ToString(), pm.parkingSpaceID);
|
|
|
SendtoPLC((rpu1.parkingSpaceID_address + 1).ToString(), pm.parkingSpaceX);
|
|
|
SendtoPLC((rpu1.parkingSpaceID_address + 2).ToString(), pm.parkingSpaceY);
|
|
|
SendtoPLC((rpu1.parkingSpaceID_address + 3).ToString(), pm.parkingSpaceZ);
|
|
@@ -734,6 +738,7 @@ namespace parkMonitor.server
|
|
|
if (!disconnected)
|
|
|
{
|
|
|
laserMsg.status = value;
|
|
|
+ //UILogServer.ins.log(value.ToString());
|
|
|
}
|
|
|
//after status 0, start to check laser heartbeat
|
|
|
if (value == 0)
|
|
@@ -783,11 +788,19 @@ namespace parkMonitor.server
|
|
|
//停车指令置0
|
|
|
PLCNode pn = new PLCNode(laser_start_address.ToString(), "0");
|
|
|
plc.SetMessage(pn);
|
|
|
- Thread.Sleep(1000);
|
|
|
//未终止重测,车未开走,停车指令归零后置1
|
|
|
if (!laserMsg.abort_rescan)
|
|
|
{
|
|
|
UILogServer.ins.error("激光" + laserMsg.id + "计算异常,重新测量");
|
|
|
+ //重测检测心跳
|
|
|
+ Task rescan_wait_heartbeat = Task.Factory.StartNew(() =>
|
|
|
+ {
|
|
|
+ while (laserMsg.status != 254 && laserMsg.status != 255)
|
|
|
+ {
|
|
|
+ Thread.Sleep(1000);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ rescan_wait_heartbeat.Wait();
|
|
|
pn = new PLCNode(laser_start_address.ToString(), "1");
|
|
|
plc.SetMessage(pn);
|
|
|
laserMsg.status = value;
|