Commit 195d453e 刘韬

1

1 个父辈 a684000c
...@@ -345,7 +345,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -345,7 +345,7 @@ namespace OnlineStore.DeviceLibrary
runStatus = StoreRunStatus.Wait; runStatus = StoreRunStatus.Wait;
mainTimer.Enabled = false; mainTimer.Enabled = false;
CameraClose(); //CameraClose();
TimeSpan span = DateTime.Now - StartTime; TimeSpan span = DateTime.Now - StartTime;
LogInfo(",停止运行,总运行时间:" + span.ToString()); LogInfo(",停止运行,总运行时间:" + span.ToString());
} }
......
...@@ -59,6 +59,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -59,6 +59,9 @@ namespace OnlineStore.DeviceLibrary
GC.KeepAlive(camerathread); GC.KeepAlive(camerathread);
} }
~BoxBean() {
CameraClose();
}
int errortimes = 0; int errortimes = 0;
void startCamera() void startCamera()
{ {
...@@ -66,7 +69,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -66,7 +69,11 @@ namespace OnlineStore.DeviceLibrary
{ {
try try
{ {
Bitmap bmp = camera.GetImage(CameraDeviceName); Bitmap bmp;
lock (camera)
{
bmp = camera.GetImage(CameraDeviceName);
}
if (bmp != null) if (bmp != null)
{ {
errortimes = 0; errortimes = 0;
...@@ -93,7 +100,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -93,7 +100,11 @@ namespace OnlineStore.DeviceLibrary
errortimes++; errortimes++;
} }
} }
camera.Close(CameraDeviceName); try
{
camera.Close(CameraDeviceName);
}
catch { }
camera.Dispose(); camera.Dispose();
} }
public void CameraClose() public void CameraClose()
...@@ -106,7 +117,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -106,7 +117,11 @@ namespace OnlineStore.DeviceLibrary
try try
{ {
LogUtil.info(Name + "库位文件名:" + filename); LogUtil.info(Name + "库位文件名:" + filename);
Bitmap bmp = camera.GetImage(CameraDeviceName); Bitmap bmp;
lock (camera)
{
bmp = camera.GetImage(CameraDeviceName);
}
if (bmp != null) if (bmp != null)
{ {
if (File.Exists(filename)) if (File.Exists(filename))
...@@ -115,6 +130,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -115,6 +130,9 @@ namespace OnlineStore.DeviceLibrary
bmp.Save(filename, ImageFormat.Jpeg); bmp.Save(filename, ImageFormat.Jpeg);
bmp.Dispose(); bmp.Dispose();
} }
else {
LogUtil.info(Name + "获取图像失败");
}
} }
catch (Exception e) catch (Exception e)
{ {
......
...@@ -249,8 +249,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -249,8 +249,7 @@ namespace OnlineStore.DeviceLibrary
//OutDoorReelType = 2; //OutDoorReelType = 2;
} }
else if (MoveInfo.IsStep(StoreMoveStep.SI_09_InoutToP1)) else if (MoveInfo.IsStep(StoreMoveStep.SI_09_InoutToP1))
{ {
CameraGrabOne(GetFixtureStateFilename(MoveInfo.MoveParam, FixtureState.Out));
MoveInfo.NextMoveStep(StoreMoveStep.SI_10_GoBack); MoveInfo.NextMoveStep(StoreMoveStep.SI_10_GoBack);
InOutStoreLog(outType + "升降轴到P1[" + moveP.UpDown_P1 + "],旋转轴到P1[" + moveP.Middle_P1 + "] ,压紧轴到P1[" + moveP.ComPress_P1 + "],"); InOutStoreLog(outType + "升降轴到P1[" + moveP.UpDown_P1 + "],旋转轴到P1[" + moveP.Middle_P1 + "] ,压紧轴到P1[" + moveP.ComPress_P1 + "],");
//ComAxis.AbsMove(MoveInfo, moveP.ComPress_P1, Config.CompAxis_P1_Speed); //ComAxis.AbsMove(MoveInfo, moveP.ComPress_P1, Config.CompAxis_P1_Speed);
...@@ -263,6 +262,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -263,6 +262,7 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.IsStep(StoreMoveStep.SI_10_GoBack)) else if (MoveInfo.IsStep(StoreMoveStep.SI_10_GoBack))
{ {
CameraGrabOne(GetFixtureStateFilename(MoveInfo.MoveParam, FixtureState.Out));
TimeSpan span = DateTime.Now - startInStoreTime; TimeSpan span = DateTime.Now - startInStoreTime;
string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosID : ""; string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosID : "";
LogUtil.info(Name + " 【" + posId + "】入库结束,耗时【" + FormUtil.GetSpanStr(span) + "】"); LogUtil.info(Name + " 【" + posId + "】入库结束,耗时【" + FormUtil.GetSpanStr(span) + "】");
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!