|
@@ -336,10 +336,12 @@ namespace parkMonitor.server
|
|
|
//从哪个地址开始,读取长度
|
|
|
PLC_Read((ushort)startAddr, (ushort)addrLength);
|
|
|
//LaserMonitor();
|
|
|
+ plcMsg.originalPlcList = JsonHelper.DeserializeJsonToList<PLCNode>(json);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
json = "";
|
|
|
+ plcMsg.originalPlcList = new List<PLCNode>();
|
|
|
if (EntityForCore.ins.globalStatus)
|
|
|
{
|
|
|
Reconnect();
|
|
@@ -374,7 +376,6 @@ namespace parkMonitor.server
|
|
|
Log.WriteLog(LogType.NOT_DATABASE, LogFile.LOG, "PLC重连中,请稍候。。。。。。");
|
|
|
}
|
|
|
LinkStart();
|
|
|
- Thread.Sleep(6000);
|
|
|
if (isConnection)
|
|
|
{
|
|
|
EntityForCore.ins.globalStatus = true;
|
|
@@ -382,6 +383,7 @@ namespace parkMonitor.server
|
|
|
exceptionBreak = false;
|
|
|
break;
|
|
|
}
|
|
|
+ Thread.Sleep(6000);
|
|
|
}
|
|
|
if (linkCount <= 0)
|
|
|
{
|
|
@@ -501,7 +503,7 @@ namespace parkMonitor.server
|
|
|
AsyncCmdServer.ins.send(AsyncCmdType.PLCOnline);
|
|
|
UILogServer.ins.info("PLC连接成功");
|
|
|
isConnection = true;
|
|
|
- linkCount = 0;
|
|
|
+ //linkCount = 0;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -689,14 +691,14 @@ namespace parkMonitor.server
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- if (json != "")
|
|
|
- {
|
|
|
- plcMsg.originalPlcList = JsonHelper.DeserializeJsonToList<PLCNode>(json);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- plcMsg.originalPlcList = new List<PLCNode>();
|
|
|
- }
|
|
|
+ //if (json != "")
|
|
|
+ //{
|
|
|
+ // plcMsg.originalPlcList = JsonHelper.DeserializeJsonToList<PLCNode>(json);
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // plcMsg.originalPlcList = new List<PLCNode>();
|
|
|
+ //}
|
|
|
|
|
|
if (decompressIndex != null && decompressIndex.Count != 0)
|
|
|
{
|
|
@@ -748,7 +750,7 @@ namespace parkMonitor.server
|
|
|
string laser_start_addr = "";
|
|
|
foreach (LaserProcessUnit lpu in laserMgmtList)
|
|
|
{
|
|
|
- if (cm.laserID == lpu.id)
|
|
|
+ if (cm.posID / 6 + 1 == lpu.id)
|
|
|
{
|
|
|
lpuTemp = lpu;
|
|
|
laser_start_addr = lpu.laser_start_address.ToString();
|
|
@@ -763,7 +765,7 @@ namespace parkMonitor.server
|
|
|
SendtoPLC(laser_start_addr, "0");
|
|
|
lpuTemp.laserMsg.licenseNum = cm.LicenseNum;
|
|
|
Thread.Sleep(300);
|
|
|
- SendtoPLC(laser_start_addr, "1");
|
|
|
+ SendtoPLC(laser_start_addr, cm.posID.ToString());
|
|
|
Thread.Sleep(100);
|
|
|
//SendtoPLC("1", "1");//停车指令置1
|
|
|
Log.WriteLog(LogType.NOT_DATABASE, "已发送激光" + lpuTemp.id + "启动指令");
|
|
@@ -878,11 +880,11 @@ namespace parkMonitor.server
|
|
|
addrLength = Int32.Parse(ConfigurationManager.AppSettings.Get("PLC_address_length"));
|
|
|
}
|
|
|
catch (Exception) { UILogServer.ins.error("PLC配置文件异常"); Log.WriteLog(LogType.NOT_DATABASE, LogFile.ERROR, "PLC配置文件异常"); }
|
|
|
- for (int i = startAddr; i < startAddr + addrLength; i++)
|
|
|
- {
|
|
|
- plcMsg.originalPlcList.Add(new PLCNode(i.ToString(), "0"));
|
|
|
- }
|
|
|
-
|
|
|
+ //for (int i = startAddr; i < startAddr + addrLength; i++)
|
|
|
+ //{
|
|
|
+ // plcMsg.originalPlcList.Add(new PLCNode(i.ToString(), "0"));
|
|
|
+ //}
|
|
|
+ plcMsg.originalPlcList = new List<PLCNode>();
|
|
|
LinkStart();
|
|
|
|
|
|
Task.Factory.StartNew(() =>
|
|
@@ -900,19 +902,19 @@ namespace parkMonitor.server
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- //模拟plc与激光自动操作
|
|
|
- Task.Factory.StartNew(() =>
|
|
|
- {
|
|
|
- laserAnim();
|
|
|
- });
|
|
|
- Task.Factory.StartNew(() =>
|
|
|
- {
|
|
|
- wheelbaseAnim();
|
|
|
- });
|
|
|
- Task.Factory.StartNew(() =>
|
|
|
- {
|
|
|
- autoCycling();
|
|
|
- });
|
|
|
+ ////模拟plc与激光自动操作
|
|
|
+ //Task.Factory.StartNew(() =>
|
|
|
+ //{
|
|
|
+ // laserAnim();
|
|
|
+ //});
|
|
|
+ //Task.Factory.StartNew(() =>
|
|
|
+ //{
|
|
|
+ // wheelbaseAnim();
|
|
|
+ //});
|
|
|
+ //Task.Factory.StartNew(() =>
|
|
|
+ //{
|
|
|
+ // autoCycling();
|
|
|
+ //});
|
|
|
}
|
|
|
|
|
|
/// <summary>
|