Commit 29861c1c LN

增加TaskCreationOptions.LongRunning

1 个父辈 254bf6bb
...@@ -263,7 +263,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -263,7 +263,7 @@ namespace OnlineStore.DeviceLibrary
Alarm(LineAlarmType.SuddenStop); Alarm(LineAlarmType.SuddenStop);
return; return;
} }
}); }, TaskCreationOptions.LongRunning);
} }
} }
else if (IOValue(IO_Type.DLine_Reset).Equals(IO_VALUE.HIGH)) else if (IOValue(IO_Type.DLine_Reset).Equals(IO_VALUE.HIGH))
...@@ -489,13 +489,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -489,13 +489,18 @@ namespace OnlineStore.DeviceLibrary
} }
NewTypeScan(); NewTypeScan();
} }
else
{
LogUtil.error (Name + "Line3EndProcess result=" + result + "");
}
} }
private bool ScanIsEnd() private bool ScanIsEnd()
{ {
TimeSpan span = DateTime.Now - LastScanTime; TimeSpan span = DateTime.Now - LastScanTime;
if (IsInScanCode && span.TotalMinutes < 1) //if (IsInScanCode && span.TotalMinutes < 1)
if (IsInScanCode)
{ {
return false ; return false;
} }
return true; return true;
} }
...@@ -527,25 +532,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -527,25 +532,6 @@ namespace OnlineStore.DeviceLibrary
if (IOValue(IO_Type.ExitTray_Check3).Equals(IO_VALUE.LOW)) if (IOValue(IO_Type.ExitTray_Check3).Equals(IO_VALUE.LOW))
{ {
UpdateScanInfo(IO_VALUE.LOW,""); UpdateScanInfo(IO_VALUE.LOW,"");
//List<string> LastCodeList = CodeManager.CameraScan(Config.GetCameraList(), "", true);
//LastCode = SServerManager.ProcessCodeList(LastCodeList);
//if (LastCodeList.Count > 0)
//{
// UpdateScanInfo(IO_VALUE.HIGH, LastCode);
// LogUtil.info(hengyiName + "ExitTray_Check3不亮,但扫到条码,更改为有料: " + LastCode);
// if (DeviceID.Equals(301))
// {
// if (Line3LastTrayP > Line3MaxPosition) { Line3LastTrayP = Line3MaxPosition; }
// // StationInfo_NG = new StationTrayInfo(StationInfo_Scan.TrayValue, StationInfo_Scan.CodeStr);
// }
// else
// {
// if (Line3LastTrayP > Line3MaxPosition - 1)
// {
// Line3LastTrayP = Line3MaxPosition - 1;
// }
// }
//}
IsInScanCode = false; IsInScanCode = false;
} }
...@@ -589,7 +575,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -589,7 +575,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(hengyiName + " 扫码工位 : 扫码结束 ," + StationInfo_Scan.ToStr + " IsInScanCode = " + IsInScanCode); LogUtil.info(hengyiName + " 扫码工位 : 扫码结束 ," + StationInfo_Scan.ToStr + " IsInScanCode = " + IsInScanCode);
} }
} }
}); }, TaskCreationOptions.LongRunning);
} }
private void UpdateScanInfo(IO_VALUE value,string code) private void UpdateScanInfo(IO_VALUE value,string code)
......
...@@ -365,7 +365,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -365,7 +365,7 @@ namespace OnlineStore.DeviceLibrary
} }
return; return;
} }
}); }, TaskCreationOptions.LongRunning);
} }
} }
else if (IOValue(IO_Type.SL_Reset_BTN).Equals(IO_VALUE.HIGH)) else if (IOValue(IO_Type.SL_Reset_BTN).Equals(IO_VALUE.HIGH))
...@@ -764,7 +764,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -764,7 +764,7 @@ namespace OnlineStore.DeviceLibrary
{ {
Thread.Sleep(1000); Thread.Sleep(1000);
AgvClient.SetStatus(Config.AgvOutName, "", ClientAction.None, ClientLevel.High, true); AgvClient.SetStatus(Config.AgvOutName, "", ClientAction.None, ClientLevel.High, true);
}); }, TaskCreationOptions.LongRunning);
ProcessShelfOut = false; ProcessShelfOut = false;
LogUtil.info(logName + ",停止转动,清空料架["+ LastOutShelfId + "], 结束"); LogUtil.info(logName + ",停止转动,清空料架["+ LastOutShelfId + "], 结束");
} }
...@@ -786,7 +786,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -786,7 +786,7 @@ namespace OnlineStore.DeviceLibrary
IOMove(IO_Type.SL_OutSideWay_Run, IO_VALUE.LOW); IOMove(IO_Type.SL_OutSideWay_Run, IO_VALUE.LOW);
ProcessShelfOut = false; ProcessShelfOut = false;
} }
}); }, TaskCreationOptions.LongRunning);
} }
internal void ShelfEnterProcess() internal void ShelfEnterProcess()
{ {
...@@ -844,7 +844,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -844,7 +844,7 @@ namespace OnlineStore.DeviceLibrary
{ {
Thread.Sleep(1000); Thread.Sleep(1000);
AgvClient.SetStatus(Config.AgvInName, "", ClientAction.None, ClientLevel.High, true); AgvClient.SetStatus(Config.AgvInName, "", ClientAction.None, ClientLevel.High, true);
}); }, TaskCreationOptions.LongRunning);
ProcessShelfEnter = false; ProcessShelfEnter = false;
LogUtil.info(logName + " 结束"); LogUtil.info(logName + " 结束");
} }
...@@ -862,7 +862,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -862,7 +862,7 @@ namespace OnlineStore.DeviceLibrary
IOMove(IO_Type.SL_Line_Run, IO_VALUE.LOW); IOMove(IO_Type.SL_Line_Run, IO_VALUE.LOW);
ProcessShelfEnter = false; ProcessShelfEnter = false;
} }
}); }, TaskCreationOptions.LongRunning);
} }
private bool ReadShelfId() private bool ReadShelfId()
......
...@@ -755,9 +755,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -755,9 +755,19 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_13_ScanCode)) else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_13_ScanCode))
{ {
if (ScanCodeTask == null || ScanCodeTask.IsCompleted)
{
MoveInfo.NextMoveStep(LineMoveStep.FI_14_CylinderTake); MoveInfo.NextMoveStep(LineMoveStep.FI_14_CylinderTake);
InLog("料盘移栽" + MoveInfo.SLog + ":上料横移取料端"); InLog("料盘移栽" + MoveInfo.SLog + ":上料横移取料端");
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take); CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take);
ClearTimeoutAlarm("扫码执行结束超时");
}
else if (MoveInfo.IsTimeOut(60))
{
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveStep + "] 扫码执行结束超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, DeviceID * 1000 + 30);
Alarm(LineAlarmType.IoSingleTimeOut);
}
} }
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_14_CylinderTake)) else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_14_CylinderTake))
{ {
...@@ -1152,7 +1162,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1152,7 +1162,7 @@ namespace OnlineStore.DeviceLibrary
//需要等待500再下降 //需要等待500再下降
Thread.Sleep(500); Thread.Sleep(500);
CylinderMove(null, IO_Type.SW_TopCylinder_Up, IO_Type.SW_TopCylinder_Down); CylinderMove(null, IO_Type.SW_TopCylinder_Up, IO_Type.SW_TopCylinder_Down);
}); }, TaskCreationOptions.LongRunning);
} }
} }
else else
...@@ -1244,6 +1254,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1244,6 +1254,7 @@ namespace OnlineStore.DeviceLibrary
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Down, IO_Type.SL_MoveCylinder_Up); CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Down, IO_Type.SL_MoveCylinder_Up);
} }
} }
private Task ScanCodeTask = null;
private void FI_13_ScanCode() private void FI_13_ScanCode()
{ {
if (CylinderIsOk(IO_Type.SL_MoveCylinder_Take,IO_Type.SL_MoveCylinder_Give)) if (CylinderIsOk(IO_Type.SL_MoveCylinder_Take,IO_Type.SL_MoveCylinder_Give))
...@@ -1253,6 +1264,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1253,6 +1264,7 @@ namespace OnlineStore.DeviceLibrary
LastCodeList = new List<string>(); LastCodeList = new List<string>();
ScanCodeTask = null;
if (NextCodeList.Count > 0) if (NextCodeList.Count > 0)
{ {
InLog("料盘移栽" + MoveInfo.SLog + ":开始扫码:使用预扫码"); InLog("料盘移栽" + MoveInfo.SLog + ":开始扫码:使用预扫码");
...@@ -1271,7 +1283,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1271,7 +1283,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(7000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(7000));
try try
{ {
Task<List<string>> scanTask = Task.Factory.StartNew(delegate ScanCodeTask = Task.Factory.StartNew(delegate
{ {
LastCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name); LastCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name);
bool hasRightCode = CodeManager.HasRightCode(LastCodeList.ToArray()); bool hasRightCode = CodeManager.HasRightCode(LastCodeList.ToArray());
...@@ -1280,7 +1292,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1280,7 +1292,7 @@ namespace OnlineStore.DeviceLibrary
LastCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name, false, 3000); LastCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name, false, 3000);
} }
return LastCodeList; return LastCodeList;
}); }, TaskCreationOptions.LongRunning);
} }
catch (Exception ex) catch (Exception ex)
{ {
......
...@@ -661,7 +661,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -661,7 +661,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(Name + "【" + MoveInfo.MoveParam.WareCode + "】【" + CurrShelfId + "】【" + OutStoreCount.ToString() + "】afterPutCut 结果:" + msg); LogUtil.error(Name + "【" + MoveInfo.MoveParam.WareCode + "】【" + CurrShelfId + "】【" + OutStoreCount.ToString() + "】afterPutCut 结果:" + msg);
taskData = null; taskData = null;
} }
}); }, TaskCreationOptions.LongRunning);
} }
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_221_UpdownAxisToP1)) else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_221_UpdownAxisToP1))
{ {
......
...@@ -182,7 +182,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -182,7 +182,7 @@ namespace OnlineStore.DeviceLibrary
canStart = true; canStart = true;
AgvClient.Init(); AgvClient.Init();
}); }, TaskCreationOptions.LongRunning);
} }
...@@ -686,7 +686,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -686,7 +686,7 @@ namespace OnlineStore.DeviceLibrary
SetWarnMsg("收到急停信号,报警急停"); SetWarnMsg("收到急停信号,报警急停");
Alarm(LineAlarmType.SuddenStop); Alarm(LineAlarmType.SuddenStop);
} }
}); }, TaskCreationOptions.LongRunning);
} }
} }
else if (fuweiValue.Equals(IO_VALUE.HIGH) && (!fuweiValue.Equals(lastFuwei))) else if (fuweiValue.Equals(IO_VALUE.HIGH) && (!fuweiValue.Equals(lastFuwei)))
......
...@@ -534,7 +534,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -534,7 +534,7 @@ namespace OnlineStore.DeviceLibrary
waitInStoreList.RemoveAt(reIndex); waitInStoreList.RemoveAt(reIndex);
Task.Factory.StartNew(delegate { Task.Factory.StartNew(delegate {
SServerManager.cancelPutInTask(Name, currCode.WareCode); SServerManager.cancelPutInTask(Name, currCode.WareCode);
}); }, TaskCreationOptions.LongRunning);
return false; return false;
} }
......
...@@ -401,7 +401,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -401,7 +401,7 @@ namespace OnlineStore.DeviceLibrary
{ {
canWhileCount = 3; canWhileCount = 3;
LineRunAndWait(timeOutMS); LineRunAndWait(timeOutMS);
}); }, TaskCreationOptions.LongRunning);
} }
private string LineRunAndWait(int timeOutMS = 30000) private string LineRunAndWait(int timeOutMS = 30000)
...@@ -519,7 +519,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -519,7 +519,7 @@ namespace OnlineStore.DeviceLibrary
Task.Factory.StartNew(delegate Task.Factory.StartNew(delegate
{ {
turnEnd?.Invoke(result.Equals("")); turnEnd?.Invoke(result.Equals(""));
}); }, TaskCreationOptions.LongRunning);
} }
InTurn = false; InTurn = false;
WaitCheckDI_High = false; WaitCheckDI_High = false;
......
...@@ -152,7 +152,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -152,7 +152,7 @@ namespace OnlineStore.DeviceLibrary
Task.Factory.StartNew(delegate Task.Factory.StartNew(delegate
{ {
SServerManager.cancelPutInTask(Name, trayInfo.InoutPar.WareCode); SServerManager.cancelPutInTask(Name, trayInfo.InoutPar.WareCode);
}); }, TaskCreationOptions.LongRunning);
} }
//入料失败料 //入料失败料
return inoup; return inoup;
......
...@@ -140,7 +140,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -140,7 +140,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(moveEquip.Name + " 入库命令: " + param.ToStr() + " 给料仓发送验证失败,等待3秒后重发 "); LogUtil.error(moveEquip.Name + " 入库命令: " + param.ToStr() + " 给料仓发送验证失败,等待3秒后重发 ");
Thread.Sleep(3000); Thread.Sleep(3000);
LineServer.CheckInStorePos(storeId, param); LineServer.CheckInStorePos(storeId, param);
}); }, TaskCreationOptions.LongRunning);
} }
lock (moveEquip.waitInListLock) lock (moveEquip.waitInListLock)
{ {
...@@ -589,7 +589,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -589,7 +589,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(deviceName + "[" + moveEquip.Name + " ]入库命令: " + param.ToStr() + " 给料仓发送验证失败,等待3秒后重发 "); LogUtil.error(deviceName + "[" + moveEquip.Name + " ]入库命令: " + param.ToStr() + " 给料仓发送验证失败,等待3秒后重发 ");
Thread.Sleep(3000); Thread.Sleep(3000);
LineServer.CheckInStorePos(storeId, param); LineServer.CheckInStorePos(storeId, param);
}); }, TaskCreationOptions.LongRunning);
} }
lock (moveEquip.waitInListLock) lock (moveEquip.waitInListLock)
{ {
......
...@@ -536,7 +536,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -536,7 +536,7 @@ namespace OnlineStore.DeviceLibrary
} }
} }
IOManager.IOMove(IoType, tValue, baseConfig.Id); IOManager.IOMove(IoType, tValue, baseConfig.Id);
}); }, TaskCreationOptions.LongRunning);
} }
} }
public IO_VALUE IOValue(string IoType) public IO_VALUE IOValue(string IoType)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!