Commit d0f3a0b1 刘韬

优化气缸暂停

1 个父辈 990fc02d
...@@ -290,5 +290,6 @@ namespace OnlineStore.Common ...@@ -290,5 +290,6 @@ namespace OnlineStore.Common
public static string enable = "enable"; public static string enable = "enable";
public static string disable = "disable"; public static string disable = "disable";
public static string queueTaskCount="queueTaskCount";
} }
} }
...@@ -290,7 +290,7 @@ namespace DeviceLibrary ...@@ -290,7 +290,7 @@ namespace DeviceLibrary
} }
})); }));
Task.Delay(ii * 500).Wait(); Task.Delay(ii * 700).Wait();
} }
while (!cameraTask[0].IsCompleted || !cameraTask[1].IsCompleted) while (!cameraTask[0].IsCompleted || !cameraTask[1].IsCompleted)
......
...@@ -46,6 +46,20 @@ namespace DeviceLibrary ...@@ -46,6 +46,20 @@ namespace DeviceLibrary
public void Pause() public void Pause()
{ {
LogUtil.info($"{Name},停止运行"); LogUtil.info($"{Name},停止运行");
if (currentIOvalue == IO_VALUE.None) {
LogUtil.info($"{Name},没有在运行");
return;
}
else if (currentIOvalue == IO_VALUE.HIGH && IOManager.IOValue(High).Equals(IO_VALUE.HIGH))
{
LogUtil.info($"{Name},currentIOvalue:{currentIOvalue},暂停是IO已到位");
return;
}else if (currentIOvalue == IO_VALUE.LOW && IOManager.IOValue(Low).Equals(IO_VALUE.HIGH))
{
LogUtil.info($"{Name},currentIOvalue:{currentIOvalue},暂停是IO已到位");
return;
}
IOManager.IOMove(Low, IO_VALUE.LOW); IOManager.IOMove(Low, IO_VALUE.LOW);
IOManager.IOMove(High, IO_VALUE.LOW); IOManager.IOMove(High, IO_VALUE.LOW);
} }
......
...@@ -37,6 +37,7 @@ namespace DeviceLibrary ...@@ -37,6 +37,7 @@ namespace DeviceLibrary
serverConnectTimer.Enabled = true; serverConnectTimer.Enabled = true;
serverConnectTimer.Elapsed += ServerConnectTimer_Elapsed; serverConnectTimer.Elapsed += ServerConnectTimer_Elapsed;
GC.KeepAlive(serverConnectTimer); GC.KeepAlive(serverConnectTimer);
LogUtil.info($"server:{server},cid:{CID}");
} }
int lockerrtime = 0; int lockerrtime = 0;
private void ServerConnectTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) private void ServerConnectTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
...@@ -58,9 +59,9 @@ namespace DeviceLibrary ...@@ -58,9 +59,9 @@ namespace DeviceLibrary
ProcessMsg(Msg.msg); ProcessMsg(Msg.msg);
SendLineStatus(); SendLineStatus();
} }
catch catch (Exception ex)
{ {
LogUtil.info($"ServerConnectTimer_Elapsed:{ex}");
} }
finally { finally {
//Monitor.Exit(serverConnectTimer); //Monitor.Exit(serverConnectTimer);
...@@ -292,8 +293,10 @@ namespace DeviceLibrary ...@@ -292,8 +293,10 @@ namespace DeviceLibrary
} }
} }
} }
public int queueTaskCount=-1;
ConcurrentQueue<string> commandResultMsg = new ConcurrentQueue<string>(); ConcurrentQueue<string> commandResultMsg = new ConcurrentQueue<string>();
void ResultProcess(Operation resultOperation) { void ResultProcess(Operation resultOperation)
{
//发送状态信息到服务器 //发送状态信息到服务器
if (resultOperation == null) if (resultOperation == null)
{ {
...@@ -301,9 +304,6 @@ namespace DeviceLibrary ...@@ -301,9 +304,6 @@ namespace DeviceLibrary
return; return;
} }
if (resultOperation.op.Equals(1)) if (resultOperation.op.Equals(1))
{ {
var barcode = ""; var barcode = "";
...@@ -317,14 +317,28 @@ namespace DeviceLibrary ...@@ -317,14 +317,28 @@ namespace DeviceLibrary
} }
else if (resultOperation.op.Equals(5)) else if (resultOperation.op.Equals(5))
{ {
ProcessHumidityCMD(resultOperation); //ProcessHumidityCMD(resultOperation);
} }
ProcessHumidityCMD(resultOperation);
if (resultOperation.data != null) if (resultOperation.data != null)
{ {
string result = ""; string result = "";
Dictionary<string, string> dataMap = resultOperation.data; Dictionary<string, string> dataMap = resultOperation.data;
if (dataMap.ContainsKey(ParamDefine.queueTaskCount))
{
var s = dataMap[ParamDefine.queueTaskCount];
if (int.TryParse(s, out int c))
{
queueTaskCount = c;
}
else
{
queueTaskCount = -1;
}
}
if (dataMap.ContainsKey(ParamDefine.openLock) && dataMap[ParamDefine.openLock].Equals(ParamDefine.doit)) if (dataMap.ContainsKey(ParamDefine.openLock) && dataMap[ParamDefine.openLock].Equals(ParamDefine.doit))
{ {
LogUtil.info(StoreName + "收到服务器命令:openLock=doit"); LogUtil.info(StoreName + "收到服务器命令:openLock=doit");
...@@ -364,7 +378,6 @@ namespace DeviceLibrary ...@@ -364,7 +378,6 @@ namespace DeviceLibrary
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
commandResultMsg.Enqueue(result); commandResultMsg.Enqueue(result);
} }
//SendLineStatus(result); //SendLineStatus(result);
} }
...@@ -489,8 +502,10 @@ namespace DeviceLibrary ...@@ -489,8 +502,10 @@ namespace DeviceLibrary
/// <param name="resultOperation"></param> /// <param name="resultOperation"></param>
private void ProcessHumidityCMD(Operation resultOperation) private void ProcessHumidityCMD(Operation resultOperation)
{ {
if (resultOperation.data == null)
return;
Dictionary<string, string> data = resultOperation.data; Dictionary<string, string> data = resultOperation.data;
if (data != null && data.ContainsKey(ParamDefine.maxHumidity) && data.ContainsKey(ParamDefine.maxTemperature)) if (data.ContainsKey(ParamDefine.maxHumidity) && data.ContainsKey(ParamDefine.maxTemperature))
{ {
string maxHumidity = data[ParamDefine.maxHumidity]; string maxHumidity = data[ParamDefine.maxHumidity];
string maxTemp = data[ParamDefine.maxTemperature]; string maxTemp = data[ParamDefine.maxTemperature];
......
...@@ -140,11 +140,11 @@ namespace DeviceLibrary ...@@ -140,11 +140,11 @@ namespace DeviceLibrary
if (!isbusy) if (!isbusy)
{ {
int outCount = AxisManager.GetActualtPosition(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue()); int outCount = AxisManager.GetActualtPosition(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue());
LogUtil.info($"{wait.AxisInfo.DeviceName},当前位置:{outCount}"); LogUtil.info($"{wait.AxisInfo.Explain},当前位置:{outCount}");
int errorCount = Math.Abs(outCount - wait.TargetPosition); int errorCount = Math.Abs(outCount - wait.TargetPosition);
if (errorCount <= wait.AxisInfo.CanErrorCountMax) if (errorCount <= wait.AxisInfo.CanErrorCountMax)
{ {
LogUtil.info($"{wait.AxisInfo.DeviceName},到达目标:errorCount:{errorCount},停止上升"); LogUtil.info($"{wait.AxisInfo.Explain},到达目标:errorCount:{errorCount},停止上升");
axisBean.StopAxisCheckMove(); axisBean.StopAxisCheckMove();
wait.IsEnd = true; wait.IsEnd = true;
} }
......
...@@ -248,6 +248,11 @@ namespace DeviceLibrary ...@@ -248,6 +248,11 @@ namespace DeviceLibrary
case MoveStep.StringReadyPut: case MoveStep.StringReadyPut:
Msg.add(crc.GetString(L.string_ready_for_put, "料串放料准备就绪"), MsgLevel.info); Msg.add(crc.GetString(L.string_ready_for_put, "料串放料准备就绪"), MsgLevel.info);
StringMoveInfo.log($"料串放料准备就绪"); StringMoveInfo.log($"料串放料准备就绪");
if (ConfigHelper.Config.Get("Device_String_StandbyAtBottom", true) && ServerCM.queueTaskCount == 0 && boxTransport.IsComplateOrFree)
{
StringMoveInfo.log($"当前服务器反馈没有出库任务, 料串下降待机");
StringMoveInfo.NextMoveStep(MoveStep.StringOut_01);
}
break; break;
case MoveStep.StringReelPut: case MoveStep.StringReelPut:
LastStringState = StringStateE.OutStore; LastStringState = StringStateE.OutStore;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!