Commit 96b0eb0d LN

扫码后休眠10ms。去掉部分task

1 个父辈 2bb2f618
......@@ -130,6 +130,7 @@ namespace OnlineStore.AssemblyLine
LogUtil.logBox = this.logBox;
LoadOk = true;
HideForm();
lastLogTime = DateTime.Now.AddMinutes(-10);
timer1.Start();
}
......@@ -452,7 +453,7 @@ namespace OnlineStore.AssemblyLine
try
{
TimeSpan sp = DateTime.Now - lastLogTime;
if (sp.TotalMinutes > 10)
if (sp.TotalMinutes >= 5)
{
lastLogTime = DateTime.Now;
......@@ -479,7 +480,7 @@ namespace OnlineStore.AssemblyLine
private void timer1_Tick(object sender, EventArgs e)
{
LogM();
if (!this.Visible)
if (!listView1.Visible)
{
return;
}
......
......@@ -254,8 +254,8 @@ namespace OnlineStore.DeviceLibrary
if (!isInSuddenDown)
{
LogUtil.error(Name + "收到急停信号,等待300后再次验证急停");
Task.Factory.StartNew(delegate
{
//Task.Factory.StartNew(delegate
//{
Thread.Sleep(300);
if (IOValue(IO_Type.DLine_SuddenStop).Equals(IO_VALUE.LOW))
{
......@@ -263,7 +263,7 @@ namespace OnlineStore.DeviceLibrary
Alarm(LineAlarmType.SuddenStop);
return;
}
});
//});
}
}
else if (IOValue(IO_Type.DLine_Reset).Equals(IO_VALUE.HIGH))
......
......@@ -353,8 +353,8 @@ namespace OnlineStore.DeviceLibrary
if (!isInSuddenDown)
{
LogUtil.error(Name + "收到急停信号,等待300后再次验证急停");
Task.Factory.StartNew(delegate
{
//Task.Factory.StartNew(delegate
//{
Thread.Sleep(300);
if (IOValue(IO_Type.SL_SuddenStop_BTN).Equals(IO_VALUE.LOW))
{
......@@ -365,7 +365,7 @@ namespace OnlineStore.DeviceLibrary
}
return;
}
});
//});
}
}
else if (IOValue(IO_Type.SL_Reset_BTN).Equals(IO_VALUE.HIGH))
......@@ -763,14 +763,13 @@ namespace OnlineStore.DeviceLibrary
//停止转动 ,阻挡上升
IOMove(IO_Type.SL_OutSideWay_Run, IO_VALUE.LOW);
IOMove(IO_Type.SL_Out_StopDown, IO_VALUE.LOW);
AgvClient.SetStatus(Config.AgvOutName, LastOutShelfId, ClientAction.FinishLeave,ClientLevel.High,true);
Task.Factory.StartNew(delegate
{
AgvClient.SetStatus(Config.AgvOutName, LastOutShelfId, ClientAction.FinishLeave, ClientLevel.High, true);
Thread.Sleep(1000);
AgvClient.SetStatus(Config.AgvOutName, "", ClientAction.None, ClientLevel.High, true);
});
ProcessShelfOut = false;
LogUtil.info(logName + ",停止转动,清空料架["+ LastOutShelfId + "], 结束");
LogUtil.info(logName + ",停止转动,清空料架[" + LastOutShelfId + "], 结束");
}
else
{
......@@ -844,11 +843,9 @@ namespace OnlineStore.DeviceLibrary
}
//料架可离开
AgvClient.SetStatus(Config.AgvInName, "", ClientAction.FinishEnter, ClientLevel.High, true);
Task.Factory.StartNew(delegate
{
Thread.Sleep(1000);
AgvClient.SetStatus(Config.AgvInName, "", ClientAction.None, ClientLevel.High, true);
});
ProcessShelfEnter = false;
LogUtil.info(logName + " 结束");
}
......
......@@ -758,19 +758,19 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FI_13_ScanCode))
{
if (ScanCodeTask == null || ScanCodeTask.IsCompleted)
{
//if (ScanCodeTask == null || ScanCodeTask.IsCompleted)
//{
MoveInfo.NextMoveStep(LineMoveStep.FI_14_CylinderTake);
InLog("料盘移栽" + MoveInfo.SLog + ":上料横移取料端");
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.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))
{
......@@ -1229,7 +1229,7 @@ namespace OnlineStore.DeviceLibrary
{
Task<List<string>> scanTask = Task.Factory.StartNew(delegate
{
Thread.Sleep(500);
Thread.Sleep(100);
NextCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name.Trim()+"预扫码");
bool isCanUse = true;
//判断是否可用
......@@ -1278,7 +1278,7 @@ namespace OnlineStore.DeviceLibrary
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Down, IO_Type.SL_MoveCylinder_Up);
}
}
private Task ScanCodeTask = null;
//private Task ScanCodeTask = null;
private void FI_13_ScanCode()
{
if (CylinderIsOk(IO_Type.SL_MoveCylinder_Take,IO_Type.SL_MoveCylinder_Give))
......@@ -1288,7 +1288,7 @@ namespace OnlineStore.DeviceLibrary
LastCodeList = new List<string>();
ScanCodeTask = null;
//ScanCodeTask = null;
if (NextCodeList.Count > 0)
{
InLog("料盘移栽" + MoveInfo.SLog + ":开始扫码:使用预扫码");
......@@ -1304,24 +1304,28 @@ namespace OnlineStore.DeviceLibrary
InLog("料盘移栽" + MoveInfo.SLog + ":开始扫码");
MoveInfo.OneWaitCanEndStep = true;
MoveInfo.WaitList.Add(WaitResultInfo.WaitFeedScanCode());
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(7000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(20000));
try
{
ScanCodeTask = Task.Factory.StartNew(delegate
{
//ScanCodeTask = Task.Factory.StartNew(delegate
//{
LastCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name);
bool hasRightCode = CodeManager.HasRightCode(LastCodeList.ToArray());
if (!hasRightCode)
{
LastCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name, false, 3000);
}
return LastCodeList;
});
//return LastCodeList;
//});
}
catch (Exception ex)
{
LogUtil.error("FI_13_ScanCode扫码出错:", ex);
}
finally
{
MoveInfo.EndStepWait();
}
}
else
{
......
......@@ -669,15 +669,14 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
OutLog(outType + MoveInfo.SLog + ":移栽伺服上升到待机点P1,通知服务器 afterPutCut");
UpdownAxis.AbsMove(MoveInfo, Config.UpDownAxisP1, Config.UpdownAxis_P1Speed);
Task.Factory.StartNew(delegate
{
afterPutOk = false;
string msg = SServerManager.afterPutCut(Name, CurrShelfId, MoveInfo.MoveParam.WareCode, "", OutStoreCount, out taskData);
if (String.IsNullOrEmpty(msg).Equals(false))
{
LogUtil.error(Name + "【" + MoveInfo.MoveParam.WareCode + "】【" + CurrShelfId + "】【" + OutStoreCount.ToString() + "】afterPutCut 结果:" + msg);
taskData = null;
}
});
afterPutOk = true;
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_221_UpdownAxisToP1))
{
......@@ -706,6 +705,8 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.FO_222_CylinderTake))
{
if (afterPutOk)
{
//出库结束 TODO
// bool isNeedSendShelf = false;
//判断料架是否满了
......@@ -741,7 +742,15 @@ namespace OnlineStore.DeviceLibrary
}
}
}
else if (MoveInfo.IsTimeOut(60))
{
WarnMsg = SecondMoveInfo.Name + "[" + SecondMoveInfo.MoveStep + "] 等待给服务器发送afterPut完成超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, DeviceID * 1000 + 21);
Alarm(LineAlarmType.IoSingleTimeOut);
}
}
}
private bool afterPutOk = false;
private void FO_214_CylinderDown(string outType)
{
if (CylinderIsOk(IO_Type.SL_MoveCylinder_Up, IO_Type.SL_MoveCylinder_Down))
......
......@@ -686,15 +686,15 @@ namespace OnlineStore.DeviceLibrary
if (isInSuddenDown.Equals(false))
{
LogUtil.error(Name + "收到急停信号,等待300后再次验证急停");
Task.Factory.StartNew(delegate
{
//Task.Factory.StartNew(delegate
//{
Thread.Sleep(300);
if (IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
{
SetWarnMsg("收到急停信号,报警急停");
Alarm(LineAlarmType.SuddenStop);
}
});
//});
}
}
else if (fuweiValue.Equals(IO_VALUE.HIGH) && (!fuweiValue.Equals(lastFuwei)))
......
......@@ -555,10 +555,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(Name + "托盘号【" + currTrayNum + "】入库信息【" + currCode.ToStr() + "】料仓未验证成功,不拦截托盘,更新此托盘为NG,从waitInStoreList中删除,取消入库任务");
TrayManager.UpdateInStoreNG(currTrayNum, true, "Box验证入库失败");
waitInStoreList.RemoveAt(reIndex);
Task.Factory.StartNew(delegate
{
SServerManager.cancelPutInTask(Name, currCode.WareCode);
});
return false;
}
......@@ -763,7 +760,7 @@ namespace OnlineStore.DeviceLibrary
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_06_TopUp))
{
CheckLog("托盘阻挡*************** 托盘号【" + currTrayNum + "】");
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000));
//托盘号正确
//preTrayNum = num;
bool isNeedMove = false;
......
......@@ -639,8 +639,7 @@ namespace OnlineStore.DeviceLibrary
if (MoveInfo.MoveParam.urgentReel && this.Config.SidesWayNum.Equals(4))
{
Task.Factory.StartNew(delegate
{
afterPutCutOK = false;
OutLog("出料:" + MoveInfo.SLog + ",紧急料,且SidesWayNum=4,发送 afterPutCut");
TaskData taskData;
string shefId = "BN";
......@@ -651,7 +650,11 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(Name + "【" + MoveInfo.MoveParam.WareCode + "】【" + shefId + "】【" + ShelfLoc.ToString() + "】afterPutCut 结果:" + msg);
taskData = null;
}
});
afterPutCutOK = true;
}
else
{
afterPutCutOK = true;
}
}
else if (MoveInfo.IsTimeOut())
......@@ -692,10 +695,20 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_10_CylinderAfter))
{
if (afterPutCutOK)
{
OutLog("出料【" + posId + "】处理完成!");
MoveEndS();
}
else if (MoveInfo.IsTimeOut(60))
{
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.MoveStep + "]等待 给服务器发送afterPutCutTask完成 " + "超时[" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, DeviceID * 1000 + 20);
Alarm(LineAlarmType.IoSingleTimeOut);
}
}
}
private bool afterPutCutOK= false ;
private OutTrayLineBean GetDisLine()
{
try
......
......@@ -98,7 +98,7 @@ namespace OnlineStore.DeviceLibrary
private static int ScanCount = 0;
private static int codeCount = ConfigAppSettings.GetIntValue(Setting_Init.CodeCount);
[HandleProcessCorruptedStateExceptions]
public static List<string> CameraScan(List<string> cameraList, string deviceName, bool findRightCodeBreak = false,int timeOut=1500)
public static List<string> CameraScan(List<string> cameraList, string deviceName, bool findRightCodeBreak = false, int timeOut = 1500)
{
List<string> codeList = new List<string>();
if (cameraList == null || cameraList.Count <= 0)
......@@ -123,8 +123,8 @@ namespace OnlineStore.DeviceLibrary
bool findRightCode = false;
try
{
ho_Image = Camera._cam.CaptureOnImage(cameraName);
if (ho_Image == null)
bool result = Camera._cam.CaptureOnImage(cameraName, out ho_Image);
if (!result || ho_Image == null)
{
LogUtil.error(deviceName + " 【" + cameraName + "】取图片失败[" + Camera._cam.ErrInfo + "],关闭相机");
CloseCamera(cameraName);
......@@ -159,7 +159,7 @@ namespace OnlineStore.DeviceLibrary
}
}
if (findRightCodeBreak&&findRightCode)
if (findRightCodeBreak && findRightCode)
{
break;
}
......@@ -190,8 +190,11 @@ namespace OnlineStore.DeviceLibrary
ho_Image.Dispose();
ho_Image = null;
}
// GC.Collect();
Thread.Sleep(10);
}
}
}
catch (AccessViolationException e)
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!