Commit 86184988 张东亮

两相机同时拍照

1 个父辈 95dd62db
...@@ -94,18 +94,57 @@ namespace OnlineStore.DeviceLibrary ...@@ -94,18 +94,57 @@ namespace OnlineStore.DeviceLibrary
return bitmap; return bitmap;
} }
string imgPath = ConfigAppSettings.GetValue(Setting_Init.ImagePath); string imgPath = ConfigAppSettings.GetValue(Setting_Init.ImagePath);
//public void SaveImage(string camName)
//{
// try
// {
// if (MoveInfo.MoveParam == null)
// {
// string path = Application.StartupPath + imgPath + camName + "\\" + DateTime.Now.ToString("yyyyMMdd");
// if (AutoSaveImage)
// {
// if (!System.IO.Directory.Exists(path))
// Directory.CreateDirectory(path);
// camera.SaveImage(camName, path, DateTime.Now.ToString("hhmmssfff"), System.Drawing.Imaging.ImageFormat.Bmp);
// }
// }
// else
// {
// if (MoveInfo.MoveParam.PosInfo != null)
// {
// InOutPosInfo inOutPosInfo = MoveInfo.MoveParam.PosInfo;
// string path = Application.StartupPath + imgPath + camName + "\\" + DateTime.Now.ToString("yyyyMMdd") + "\\" + inOutPosInfo.PosId;
// if (AutoSaveImage)
// {
// if (!System.IO.Directory.Exists(path))
// Directory.CreateDirectory(path);
// camera.SaveImage(camName, path, $"{inOutPosInfo.barcode}-{MoveInfo.MoveType}-{DateTime.Now.ToString("hhmmssfff")}", System.Drawing.Imaging.ImageFormat.Bmp);
// }
// }
// }
// }
// catch (Exception ex)
// {
// LogUtil.error($"保存{camName}图片失败", ex);
// }
//}
public void SaveImage(string camName) public void SaveImage(string camName)
{ {
try try
{ {
if (MoveInfo.MoveParam == null) if (MoveInfo.MoveParam == null)
{ {
string path = Application.StartupPath + imgPath + camName + "\\" + DateTime.Now.ToString("yyyyMMdd"); string path = Application.StartupPath + imgPath + "Records\\" + DateTime.Now.ToString("yyyyMMdd");
if (AutoSaveImage) if (AutoSaveImage)
{ {
if (!System.IO.Directory.Exists(path)) if (!System.IO.Directory.Exists(path))
Directory.CreateDirectory(path); Directory.CreateDirectory(path);
camera.SaveImage(camName, path, DateTime.Now.ToString("hhmmssfff"), System.Drawing.Imaging.ImageFormat.Bmp); Task.Factory.StartNew(() =>
{
camera.SaveImage(camName, path, $"{camName}-{DateTime.Now.ToString("hhmmssfff")}", System.Drawing.Imaging.ImageFormat.Bmp);
});
} }
} }
else else
...@@ -113,12 +152,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -113,12 +152,16 @@ namespace OnlineStore.DeviceLibrary
if (MoveInfo.MoveParam.PosInfo != null) if (MoveInfo.MoveParam.PosInfo != null)
{ {
InOutPosInfo inOutPosInfo = MoveInfo.MoveParam.PosInfo; InOutPosInfo inOutPosInfo = MoveInfo.MoveParam.PosInfo;
string path = Application.StartupPath + imgPath + camName + "\\" + DateTime.Now.ToString("yyyyMMdd") + "\\" + inOutPosInfo.PosId; string path = Application.StartupPath + imgPath + "Records\\" + DateTime.Now.ToString("yyyyMMdd") + "\\" + inOutPosInfo.PosId;
if (AutoSaveImage) if (AutoSaveImage)
{ {
if (!System.IO.Directory.Exists(path)) if (!System.IO.Directory.Exists(path))
Directory.CreateDirectory(path); Directory.CreateDirectory(path);
camera.SaveImage(camName, path, $"{inOutPosInfo.barcode}-{MoveInfo.MoveType}-{DateTime.Now.ToString("hhmmssfff")}", System.Drawing.Imaging.ImageFormat.Bmp); Task.Factory.StartNew(() =>
{
camera.SaveImage(camName, path, $"{camName}-{inOutPosInfo.barcode}-{MoveInfo.MoveType}-{DateTime.Now.ToString("hhmmssfff")}", System.Drawing.Imaging.ImageFormat.Bmp);
});
} }
} }
......
...@@ -292,13 +292,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -292,13 +292,13 @@ namespace OnlineStore.DeviceLibrary
if (!GetShieldState(sheidBColmns[GetPosColumn()])) if (!GetShieldState(sheidBColmns[GetPosColumn()]))
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(trayBColumns[GetPosColumn()], IO_VALUE.LOW)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(trayBColumns[GetPosColumn()], IO_VALUE.LOW));
} }
SaveSpecifiedImage();
break; break;
case StepEnum.SI_11_PullTray: case StepEnum.SI_11_PullTray:
MoveInfo.NextMoveStep(StepEnum.SI_12_DropTrayToPos); MoveInfo.NextMoveStep(StepEnum.SI_12_DropTrayToPos);
LogInfo($"入库 {MoveInfo.SLog}:将抽屉降到库位提取点,料斗拉取升降轴到P2料屉提取水平点P2,到位后检测{trayRows[GetPosRow()]}=1[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"); LogInfo($"入库 {MoveInfo.SLog}:将抽屉降到库位提取点,料斗拉取升降轴到P2料屉提取水平点P2,到位后检测{trayRows[GetPosRow()]}=1[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
PullAxis_UpdownToMiddleP2(); PullAxis_UpdownToMiddleP2();
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(trayRows[GetPosRow()], IO_VALUE.HIGH)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(trayRows[GetPosRow()], IO_VALUE.HIGH));
SaveSpecifiedImage();
break; break;
case StepEnum.SI_12_DropTrayToPos: case StepEnum.SI_12_DropTrayToPos:
MoveInfo.NextMoveStep(StepEnum.SI_13_GetReel); MoveInfo.NextMoveStep(StepEnum.SI_13_GetReel);
......
...@@ -91,13 +91,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -91,13 +91,13 @@ namespace OnlineStore.DeviceLibrary
if (!GetShieldState(sheidBColmns[GetPosColumn()])) if (!GetShieldState(sheidBColmns[GetPosColumn()]))
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(trayBColumns[GetPosColumn()], IO_VALUE.LOW)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(trayBColumns[GetPosColumn()], IO_VALUE.LOW));
} }
SaveSpecifiedImage();
break; break;
case StepEnum.SO_05_PullTray: case StepEnum.SO_05_PullTray:
MoveInfo.NextMoveStep(StepEnum.SO_06_DropTrayToPos); MoveInfo.NextMoveStep(StepEnum.SO_06_DropTrayToPos);
LogInfo($"出库 {MoveInfo.SLog}:将抽屉降到库位提取点,料斗拉取升降轴到P2料屉提取水平点P2,到位后检测{trayRows[GetPosRow()]}=1[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"); LogInfo($"出库 {MoveInfo.SLog}:将抽屉降到库位提取点,料斗拉取升降轴到P2料屉提取水平点P2,到位后检测{trayRows[GetPosRow()]}=1[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]");
PullAxis_UpdownToMiddleP2(); PullAxis_UpdownToMiddleP2();
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(trayRows[GetPosRow()], IO_VALUE.HIGH)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(trayRows[GetPosRow()], IO_VALUE.HIGH));
SaveSpecifiedImage();
break; break;
case StepEnum.SO_06_DropTrayToPos: case StepEnum.SO_06_DropTrayToPos:
MoveInfo.NextMoveStep(StepEnum.SO_07_GetReel); MoveInfo.NextMoveStep(StepEnum.SO_07_GetReel);
......
...@@ -646,7 +646,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -646,7 +646,7 @@ namespace OnlineStore.DeviceLibrary
int row = 1; int row = 1;
int col = 1; int col = 1;
string side = "BB"; string side = "BB";
string PosId = CID+"BB01010101"; string PosId = CID + "BB01010101";
for (int i = 1; i <= trayRows.Length; i++) for (int i = 1; i <= trayRows.Length; i++)
{ {
if (i == trayRows.Length) if (i == trayRows.Length)
...@@ -758,7 +758,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -758,7 +758,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
/// <param name="deviceStatus">设备上报服务端的状态</param> /// <param name="deviceStatus">设备上报服务端的状态</param>
/// <param name="runStatus">设备显示的状态</param> /// <param name="runStatus">设备显示的状态</param>
private void SetBoxStatus(DeviceStatus deviceStatus, RunStatus runStatus, string lastPosId = "",string lastBarcode="") private void SetBoxStatus(DeviceStatus deviceStatus, RunStatus runStatus, string lastPosId = "", string lastBarcode = "")
{ {
if (!string.IsNullOrEmpty(lastPosId)) if (!string.IsNullOrEmpty(lastPosId))
{ {
...@@ -939,7 +939,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -939,7 +939,7 @@ namespace OnlineStore.DeviceLibrary
LogInfo("LoadInoutParam:" + JsonHelper.SerializeObject(param.MoveP)); LogInfo("LoadInoutParam:" + JsonHelper.SerializeObject(param.MoveP));
MoveInfo.NewMove(MoveType.InStore, param); MoveInfo.NewMove(MoveType.InStore, param);
IgnoreCamDect = false; IgnoreCamDect = false;
SetBoxStatus(DeviceStatus.InStoreExecute, RunStatus.Busy, param.PosInfo.PosId,param.PosInfo.barcode); SetBoxStatus(DeviceStatus.InStoreExecute, RunStatus.Busy, param.PosInfo.PosId, param.PosInfo.barcode);
MoveInfo.NextMoveStep(StepEnum.SI_00_StartInstore); MoveInfo.NextMoveStep(StepEnum.SI_00_StartInstore);
AxisAlarmFlag = false; AxisAlarmFlag = false;
return true; return true;
...@@ -1117,7 +1117,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1117,7 +1117,7 @@ namespace OnlineStore.DeviceLibrary
{ {
return false; return false;
} }
if(!CloseOutStoreCheck) if (!CloseOutStoreCheck)
{ {
if (!OutDoorCheck(param)) if (!OutDoorCheck(param))
{ {
...@@ -1139,7 +1139,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1139,7 +1139,7 @@ namespace OnlineStore.DeviceLibrary
} }
startOutStoreTime = DateTime.Now; startOutStoreTime = DateTime.Now;
param.MoveP = new LineMoveP(Config, param.PosInfo.PosId); param.MoveP = new LineMoveP(Config, param.PosInfo.PosId);
SetBoxStatus(DeviceStatus.OutStoreExecute, RunStatus.Busy, param.PosInfo.PosId,param.PosInfo.barcode); SetBoxStatus(DeviceStatus.OutStoreExecute, RunStatus.Busy, param.PosInfo.PosId, param.PosInfo.barcode);
MoveInfo.NewMove(MoveType.OutStore, param); MoveInfo.NewMove(MoveType.OutStore, param);
LogInfo("启动出库【" + param.PosInfo.ToStr() + "】 "); LogInfo("启动出库【" + param.PosInfo.ToStr() + "】 ");
LogInfo("LoadInoutParam:" + JsonHelper.SerializeObject(param.MoveP)); LogInfo("LoadInoutParam:" + JsonHelper.SerializeObject(param.MoveP));
...@@ -1165,19 +1165,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -1165,19 +1165,16 @@ namespace OnlineStore.DeviceLibrary
#endregion #endregion
private void SaveSpecifiedImage() private void SaveSpecifiedImage()
{ {
Task.Factory.StartNew(new Action(() =>
{
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
if (CheckASide())
{
SaveImage("box_A"); SaveImage("box_A");
}
else
{
SaveImage("box_B"); SaveImage("box_B");
} //if (CheckASide())
})); //{
// SaveImage("box_A");
//}
//else
//{
// SaveImage("box_B");
//}
} }
} }
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!