|
|
|
@ -2361,6 +2361,10 @@ namespace Rs.MotionPlat.Flow
|
|
|
|
|
|
|
|
|
|
public void ScanBarCode()
|
|
|
|
|
{
|
|
|
|
|
//需要检测的穴位
|
|
|
|
|
List<TurnoverTraySlot> checkSlots = new List<TurnoverTraySlot>();
|
|
|
|
|
int reScanNum = 0;
|
|
|
|
|
bool exitScan = false;
|
|
|
|
|
SchedulingMessageBox box = new SchedulingMessageBox();
|
|
|
|
|
if (GlobalVar.RunSpace)
|
|
|
|
|
{
|
|
|
|
@ -2390,243 +2394,307 @@ namespace Rs.MotionPlat.Flow
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//没有需要给周转盘上料的任务后,就开始上相机扫码
|
|
|
|
|
//判断周转盘第一行有没有产品,如果有产品则拍第一行
|
|
|
|
|
if (TurnoverTrayManager.Instance.HasProduct(ETrayRow.One))
|
|
|
|
|
{
|
|
|
|
|
//找拍照起点和终点
|
|
|
|
|
SlotPoint grabStartPoint = TrayPointManager.GetSlotPoint(ETrayType.Turnover, 1);
|
|
|
|
|
SlotPoint grabEndPoint = TrayPointManager.GetSlotPoint(ETrayType.Turnover, 8);
|
|
|
|
|
List<VisionResult> result = UpCameraScanBarCodeFlow.Instance.ScanMulti(1, false);
|
|
|
|
|
//List<VisionResult> result = UpCameraScanBarCodeFlow.Instance.Wait();
|
|
|
|
|
foreach (var vr in result)
|
|
|
|
|
while(!exitScan)
|
|
|
|
|
{
|
|
|
|
|
checkSlots.Clear();
|
|
|
|
|
reScanNum++;
|
|
|
|
|
//没有需要给周转盘上料的任务后,就开始上相机扫码
|
|
|
|
|
//判断周转盘第一行有没有产品,如果有产品则拍第一行
|
|
|
|
|
if (TurnoverTrayManager.Instance.HasProduct(ETrayRow.One))
|
|
|
|
|
{
|
|
|
|
|
if (TurnoverTrayManager.Instance.Slot(vr.SlotIndex).IsHasProduct)
|
|
|
|
|
//找拍照起点和终点
|
|
|
|
|
SlotPoint grabStartPoint = TrayPointManager.GetSlotPoint(ETrayType.Turnover, 1);
|
|
|
|
|
SlotPoint grabEndPoint = TrayPointManager.GetSlotPoint(ETrayType.Turnover, 8);
|
|
|
|
|
List<VisionResult> result = UpCameraScanBarCodeFlow.Instance.ScanMulti(1, false);
|
|
|
|
|
//List<VisionResult> result = UpCameraScanBarCodeFlow.Instance.Wait();
|
|
|
|
|
foreach (var vr in result)
|
|
|
|
|
{
|
|
|
|
|
if (vr.SearchModelOK)//定位成功
|
|
|
|
|
if (TurnoverTrayManager.Instance.Slot(vr.SlotIndex).IsHasProduct)
|
|
|
|
|
{
|
|
|
|
|
if (!GlobalVar.EnableScanBarCodeByDownCamera)
|
|
|
|
|
if (vr.SearchModelOK)//定位成功
|
|
|
|
|
{
|
|
|
|
|
if (GlobalVar.RunSpace)
|
|
|
|
|
{
|
|
|
|
|
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex - 1, VirtualBarCode.Code);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (!GlobalVar.EnableScanBarCodeByDownCamera)
|
|
|
|
|
{
|
|
|
|
|
if (vr.ScanBarCodeOK)
|
|
|
|
|
if (GlobalVar.RunSpace)
|
|
|
|
|
{
|
|
|
|
|
OnShowGrabResult?.Invoke(vr, true);
|
|
|
|
|
//复制二维码
|
|
|
|
|
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex - 1, vr.SN);
|
|
|
|
|
TurnoverTrayManager.Instance.Slot(vr.SlotIndex).SN = vr.SN;
|
|
|
|
|
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex - 1, VirtualBarCode.Code);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int failNum = 1;
|
|
|
|
|
while (true)
|
|
|
|
|
if (vr.ScanBarCodeOK)
|
|
|
|
|
{
|
|
|
|
|
if (failNum < 4)
|
|
|
|
|
{
|
|
|
|
|
//如果扫码失败再重扫一次
|
|
|
|
|
VisionResult vrsigle = UpCameraScanBarCodeFlow.Instance.ScanSingle(vr.SlotIndex, true, false, true);
|
|
|
|
|
//VisionResult vrsigle = UpCameraScanBarCodeFlow.Instance.WaitSingle();
|
|
|
|
|
if (vrsigle.ScanBarCodeOK)
|
|
|
|
|
{
|
|
|
|
|
OnShowGrabResult?.Invoke(vrsigle, true);
|
|
|
|
|
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex - 1, vrsigle.SN);
|
|
|
|
|
TurnoverTrayManager.Instance.Slot(vr.SlotIndex).SN = vrsigle.SN;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
failNum++;
|
|
|
|
|
OnShowGrabResult?.Invoke(vrsigle, true);
|
|
|
|
|
//复制二维码
|
|
|
|
|
//LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex - 1, "");
|
|
|
|
|
Thread.Sleep(500);
|
|
|
|
|
}
|
|
|
|
|
if (vrsigle != null)
|
|
|
|
|
{
|
|
|
|
|
vrsigle = null;
|
|
|
|
|
GC.Collect();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
OnShowGrabResult?.Invoke(vr, true);
|
|
|
|
|
//复制二维码
|
|
|
|
|
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex - 1, vr.SN);
|
|
|
|
|
TurnoverTrayManager.Instance.Slot(vr.SlotIndex).SN = vr.SN;
|
|
|
|
|
checkSlots.Add(TurnoverTrayManager.Instance.Slot(vr.SlotIndex));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int failNum = 1;
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
|
|
|
|
if (GlobalVar.ScanBarcodeFailAutoSkip)
|
|
|
|
|
if (failNum < 4)
|
|
|
|
|
{
|
|
|
|
|
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex - 1, "");
|
|
|
|
|
TurnoverTrayManager.Instance.Slot(vr.SlotIndex).SN = "";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
alarmInfo = string.Format(AlarmCollection.GetAlarm(AlarmConstID.扫码失败), vr.SlotIndex);
|
|
|
|
|
Dictionary<ETipButton, string> buttonTexts = new Dictionary<ETipButton, string>() {
|
|
|
|
|
{ ETipButton.Retry,"重试|Retry"},
|
|
|
|
|
{ ETipButton.Cancel,"自动移走|Auto remove"}
|
|
|
|
|
};
|
|
|
|
|
box = PromptMessageBox.ShowDialog(AlarmConstID.扫码失败, alarmInfo, ETipButton.Retry | ETipButton.Cancel, buttonTexts);
|
|
|
|
|
if (box.Button == ETipButton.Retry)
|
|
|
|
|
//如果扫码失败再重扫一次
|
|
|
|
|
VisionResult vrsigle = UpCameraScanBarCodeFlow.Instance.ScanSingle(vr.SlotIndex, true, false, true);
|
|
|
|
|
//VisionResult vrsigle = UpCameraScanBarCodeFlow.Instance.WaitSingle();
|
|
|
|
|
if (vrsigle.ScanBarCodeOK)
|
|
|
|
|
{
|
|
|
|
|
failNum = 1;
|
|
|
|
|
OnShowGrabResult?.Invoke(vrsigle, true);
|
|
|
|
|
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex - 1, vrsigle.SN);
|
|
|
|
|
TurnoverTrayManager.Instance.Slot(vr.SlotIndex).SN = vrsigle.SN;
|
|
|
|
|
checkSlots.Add(TurnoverTrayManager.Instance.Slot(vr.SlotIndex));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else if (box.Button == ETipButton.Cancel)
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//OnShowGrabResult?.Invoke(vrsigle, true);
|
|
|
|
|
failNum++;
|
|
|
|
|
OnShowGrabResult?.Invoke(vrsigle, true);
|
|
|
|
|
//复制二维码
|
|
|
|
|
//LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex - 1, "");
|
|
|
|
|
Thread.Sleep(500);
|
|
|
|
|
}
|
|
|
|
|
if (vrsigle != null)
|
|
|
|
|
{
|
|
|
|
|
vrsigle = null;
|
|
|
|
|
GC.Collect();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (GlobalVar.ScanBarcodeFailAutoSkip)
|
|
|
|
|
{
|
|
|
|
|
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex - 1, "");
|
|
|
|
|
TurnoverTrayManager.Instance.Slot(vr.SlotIndex).SN = "";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
alarmInfo = string.Format(AlarmCollection.GetAlarm(AlarmConstID.扫码失败), vr.SlotIndex);
|
|
|
|
|
Dictionary<ETipButton, string> buttonTexts = new Dictionary<ETipButton, string>() {
|
|
|
|
|
{ ETipButton.Retry,"重试|Retry"},
|
|
|
|
|
{ ETipButton.Cancel,"自动移走|Auto remove"}
|
|
|
|
|
};
|
|
|
|
|
box = PromptMessageBox.ShowDialog(AlarmConstID.扫码失败, alarmInfo, ETipButton.Retry | ETipButton.Cancel, buttonTexts);
|
|
|
|
|
if (box.Button == ETipButton.Retry)
|
|
|
|
|
{
|
|
|
|
|
failNum = 1;
|
|
|
|
|
}
|
|
|
|
|
else if (box.Button == ETipButton.Cancel)
|
|
|
|
|
{
|
|
|
|
|
//OnShowGrabResult?.Invoke(vrsigle, true);
|
|
|
|
|
//复制二维码
|
|
|
|
|
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex - 1, "");
|
|
|
|
|
TurnoverTrayManager.Instance.Slot(vr.SlotIndex).SN = "";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//定位失败,或者超出指定范围
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//定位失败,或者超出指定范围
|
|
|
|
|
OnShowGrabResult?.Invoke(vr, false);
|
|
|
|
|
}
|
|
|
|
|
//vr.Dispose();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (result != null && result.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
OnShowGrabResult?.Invoke(vr, false);
|
|
|
|
|
result.Clear();
|
|
|
|
|
GC.Collect();
|
|
|
|
|
}
|
|
|
|
|
//vr.Dispose();
|
|
|
|
|
//OnUpCameraGrabResult?.Invoke(result);
|
|
|
|
|
}
|
|
|
|
|
if (result != null && result.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
result.Clear();
|
|
|
|
|
GC.Collect();
|
|
|
|
|
}
|
|
|
|
|
//OnUpCameraGrabResult?.Invoke(result);
|
|
|
|
|
}
|
|
|
|
|
//判断周转盘第三行有没有产品,如果有产品则拍第三行
|
|
|
|
|
if (TurnoverTrayManager.Instance.HasProduct(ETrayRow.Three))
|
|
|
|
|
{
|
|
|
|
|
//找拍照起点和终点
|
|
|
|
|
SlotPoint grabStartPoint = TrayPointManager.GetSlotPoint(ETrayType.Turnover, 17);
|
|
|
|
|
SlotPoint grabEndPoint = TrayPointManager.GetSlotPoint(ETrayType.Turnover, 24);
|
|
|
|
|
List<VisionResult> result = UpCameraScanBarCodeFlow.Instance.ScanMulti(24, true);
|
|
|
|
|
// List<VisionResult> result = UpCameraScanBarCodeFlow.Instance.Wait();
|
|
|
|
|
foreach (var vr in result)
|
|
|
|
|
//判断周转盘第三行有没有产品,如果有产品则拍第三行
|
|
|
|
|
if (TurnoverTrayManager.Instance.HasProduct(ETrayRow.Three))
|
|
|
|
|
{
|
|
|
|
|
if (TurnoverTrayManager.Instance.Slot(vr.SlotIndex).IsHasProduct)
|
|
|
|
|
//找拍照起点和终点
|
|
|
|
|
SlotPoint grabStartPoint = TrayPointManager.GetSlotPoint(ETrayType.Turnover, 17);
|
|
|
|
|
SlotPoint grabEndPoint = TrayPointManager.GetSlotPoint(ETrayType.Turnover, 24);
|
|
|
|
|
List<VisionResult> result = UpCameraScanBarCodeFlow.Instance.ScanMulti(24, true);
|
|
|
|
|
// List<VisionResult> result = UpCameraScanBarCodeFlow.Instance.Wait();
|
|
|
|
|
foreach (var vr in result)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (vr.SearchModelOK)//定位成功
|
|
|
|
|
if (TurnoverTrayManager.Instance.Slot(vr.SlotIndex).IsHasProduct)
|
|
|
|
|
{
|
|
|
|
|
if (!GlobalVar.EnableScanBarCodeByDownCamera)
|
|
|
|
|
|
|
|
|
|
if (vr.SearchModelOK)//定位成功
|
|
|
|
|
{
|
|
|
|
|
if (GlobalVar.RunSpace)
|
|
|
|
|
if (!GlobalVar.EnableScanBarCodeByDownCamera)
|
|
|
|
|
{
|
|
|
|
|
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex - 1, VirtualBarCode.Code);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (vr.ScanBarCodeOK)
|
|
|
|
|
if (GlobalVar.RunSpace)
|
|
|
|
|
{
|
|
|
|
|
OnShowGrabResult?.Invoke(vr, true);
|
|
|
|
|
//复制二维码
|
|
|
|
|
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex - 1, vr.SN);
|
|
|
|
|
TurnoverTrayManager.Instance.Slot(vr.SlotIndex).SN = vr.SN;
|
|
|
|
|
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex - 1, VirtualBarCode.Code);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int failNum = 1;
|
|
|
|
|
while (true)
|
|
|
|
|
if (vr.ScanBarCodeOK)
|
|
|
|
|
{
|
|
|
|
|
if (failNum < 4)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//如果扫码失败再重扫一次
|
|
|
|
|
VisionResult vrsigle = UpCameraScanBarCodeFlow.Instance.ScanSingle(vr.SlotIndex, true, false, true);
|
|
|
|
|
//VisionResult vrsigle = UpCameraScanBarCodeFlow.Instance.WaitSingle();
|
|
|
|
|
if (vrsigle.ScanBarCodeOK)
|
|
|
|
|
{
|
|
|
|
|
OnShowGrabResult?.Invoke(vrsigle, true);
|
|
|
|
|
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex - 1, vrsigle.SN);
|
|
|
|
|
TurnoverTrayManager.Instance.Slot(vr.SlotIndex).SN = vrsigle.SN;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
failNum++;
|
|
|
|
|
OnShowGrabResult?.Invoke(vrsigle, true);
|
|
|
|
|
//复制二维码
|
|
|
|
|
//LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex - 1, "");
|
|
|
|
|
Thread.Sleep(500);
|
|
|
|
|
}
|
|
|
|
|
if (vrsigle != null)
|
|
|
|
|
{
|
|
|
|
|
vrsigle = null;
|
|
|
|
|
GC.Collect();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
OnShowGrabResult?.Invoke(vr, true);
|
|
|
|
|
//复制二维码
|
|
|
|
|
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex - 1, vr.SN);
|
|
|
|
|
TurnoverTrayManager.Instance.Slot(vr.SlotIndex).SN = vr.SN;
|
|
|
|
|
checkSlots.Add(TurnoverTrayManager.Instance.Slot(vr.SlotIndex));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int failNum = 1;
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
|
|
|
|
//box = MsgBox.ShowDialog(AlarmConstID.ScanBarCodeFailAlarm, $"{vr.SlotIndex}穴位扫码失败", ETipButton.Retry | ETipButton.Skip);
|
|
|
|
|
if (GlobalVar.ScanBarcodeFailAutoSkip)
|
|
|
|
|
if (failNum < 4)
|
|
|
|
|
{
|
|
|
|
|
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex - 1, "");
|
|
|
|
|
TurnoverTrayManager.Instance.Slot(vr.SlotIndex).SN = "";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
alarmInfo = string.Format(AlarmCollection.GetAlarm(AlarmConstID.扫码失败), vr.SlotIndex);
|
|
|
|
|
Dictionary<ETipButton, string> buttonTexts = new Dictionary<ETipButton, string>()
|
|
|
|
|
{
|
|
|
|
|
{ ETipButton.Retry,"重试|Retry"},
|
|
|
|
|
{ ETipButton.Cancel,"自动移走|Auto remove"}
|
|
|
|
|
};
|
|
|
|
|
box = PromptMessageBox.ShowDialog(AlarmConstID.扫码失败, alarmInfo, ETipButton.Retry | ETipButton.Cancel, buttonTexts);
|
|
|
|
|
if (box.Button == ETipButton.Retry)
|
|
|
|
|
|
|
|
|
|
//如果扫码失败再重扫一次
|
|
|
|
|
VisionResult vrsigle = UpCameraScanBarCodeFlow.Instance.ScanSingle(vr.SlotIndex, true, false, true);
|
|
|
|
|
//VisionResult vrsigle = UpCameraScanBarCodeFlow.Instance.WaitSingle();
|
|
|
|
|
if (vrsigle.ScanBarCodeOK)
|
|
|
|
|
{
|
|
|
|
|
failNum = 1;
|
|
|
|
|
OnShowGrabResult?.Invoke(vrsigle, true);
|
|
|
|
|
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex - 1, vrsigle.SN);
|
|
|
|
|
TurnoverTrayManager.Instance.Slot(vr.SlotIndex).SN = vrsigle.SN;
|
|
|
|
|
checkSlots.Add(TurnoverTrayManager.Instance.Slot(vr.SlotIndex));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else if (box.Button == ETipButton.Cancel)
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//OnShowGrabResult?.Invoke(vrsigle, true);
|
|
|
|
|
failNum++;
|
|
|
|
|
OnShowGrabResult?.Invoke(vrsigle, true);
|
|
|
|
|
//复制二维码
|
|
|
|
|
//LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex - 1, "");
|
|
|
|
|
Thread.Sleep(500);
|
|
|
|
|
}
|
|
|
|
|
if (vrsigle != null)
|
|
|
|
|
{
|
|
|
|
|
vrsigle = null;
|
|
|
|
|
GC.Collect();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//box = MsgBox.ShowDialog(AlarmConstID.ScanBarCodeFailAlarm, $"{vr.SlotIndex}穴位扫码失败", ETipButton.Retry | ETipButton.Skip);
|
|
|
|
|
if (GlobalVar.ScanBarcodeFailAutoSkip)
|
|
|
|
|
{
|
|
|
|
|
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex - 1, "");
|
|
|
|
|
TurnoverTrayManager.Instance.Slot(vr.SlotIndex).SN = "";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
alarmInfo = string.Format(AlarmCollection.GetAlarm(AlarmConstID.扫码失败), vr.SlotIndex);
|
|
|
|
|
Dictionary<ETipButton, string> buttonTexts = new Dictionary<ETipButton, string>()
|
|
|
|
|
{
|
|
|
|
|
{ ETipButton.Retry,"重试|Retry"},
|
|
|
|
|
{ ETipButton.Cancel,"自动移走|Auto remove"}
|
|
|
|
|
};
|
|
|
|
|
box = PromptMessageBox.ShowDialog(AlarmConstID.扫码失败, alarmInfo, ETipButton.Retry | ETipButton.Cancel, buttonTexts);
|
|
|
|
|
if (box.Button == ETipButton.Retry)
|
|
|
|
|
{
|
|
|
|
|
failNum = 1;
|
|
|
|
|
}
|
|
|
|
|
else if (box.Button == ETipButton.Cancel)
|
|
|
|
|
{
|
|
|
|
|
//OnShowGrabResult?.Invoke(vrsigle, true);
|
|
|
|
|
//复制二维码
|
|
|
|
|
LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex - 1, "");
|
|
|
|
|
TurnoverTrayManager.Instance.Slot(vr.SlotIndex).SN = "";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//定位失败,或者超出指定范围
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//定位失败,或者超出指定范围
|
|
|
|
|
OnShowGrabResult?.Invoke(vr, false);
|
|
|
|
|
}
|
|
|
|
|
//vr.Dispose();
|
|
|
|
|
}
|
|
|
|
|
if (result != null && result.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
result.Clear();
|
|
|
|
|
GC.Collect();
|
|
|
|
|
}
|
|
|
|
|
//OnUpCameraGrabResult?.Invoke(result);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if(checkSlots!=null && checkSlots.Count>0)
|
|
|
|
|
{
|
|
|
|
|
var repeatList = checkSlots.GroupBy(s => s.SN).Where(k => k.Count() >= 2).ToList();
|
|
|
|
|
if (repeatList != null && repeatList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
if (reScanNum >= 3)
|
|
|
|
|
{
|
|
|
|
|
List<int> slots = new List<int>();
|
|
|
|
|
List<string> repeatMsg = new List<string>();
|
|
|
|
|
//here need alarm and after take products out from tray point
|
|
|
|
|
foreach (var item in repeatList)
|
|
|
|
|
{
|
|
|
|
|
string repeatSnSlot = string.Join(" eq ", item.Select(s => s.Index));
|
|
|
|
|
repeatMsg.Add(repeatSnSlot);
|
|
|
|
|
foreach (var rslot in item)
|
|
|
|
|
{
|
|
|
|
|
slots.Add(rslot.Index);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
string msg = string.Join(",", repeatMsg);
|
|
|
|
|
alarmInfo = GetClassName() + msg;
|
|
|
|
|
MessageQueue.Instance.Warn(alarmInfo);
|
|
|
|
|
alarmEntity = AlarmCollection.Get(AlarmConstID.二维码重码报警).Transform(msg);
|
|
|
|
|
AlarmMessageBox.ShowDialog(alarmEntity, ETipButton.Retry, null, true);
|
|
|
|
|
//judge product taked away use upcamea
|
|
|
|
|
foreach (var item in slots)
|
|
|
|
|
{
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
|
|
|
|
SlotProductHasOrNotResult haveProduct = UpCameraCheckFlow.Instance.CheckTurnoverTrayHasProduct(null, item);
|
|
|
|
|
if (haveProduct.HasProduct)
|
|
|
|
|
{
|
|
|
|
|
alarmEntity = AlarmCollection.Get(AlarmConstID.周转盘产品未取出).Transform(item);
|
|
|
|
|
AlarmMessageBox.ShowDialog(alarmEntity, ETipButton.Retry, null);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
LoadAndUnloadTask.Instance.RemoveRepeatSnTask(item-1);
|
|
|
|
|
TurnoverTrayManager.Instance.Slot(item).ClearProduct();
|
|
|
|
|
GlobalTray.TurnoverTray.ChangeStatus(item, ESlotStatus.NotHave);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
reScanNum = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
OnShowGrabResult?.Invoke(vr, false);
|
|
|
|
|
exitScan = true;
|
|
|
|
|
}
|
|
|
|
|
//vr.Dispose();
|
|
|
|
|
}
|
|
|
|
|
if (result != null && result.Count > 0)
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result.Clear();
|
|
|
|
|
GC.Collect();
|
|
|
|
|
exitScan = true;
|
|
|
|
|
}
|
|
|
|
|
//OnUpCameraGrabResult?.Invoke(result);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|