|
|
@@ -16,6 +16,7 @@ using Prism.Regions;
|
|
|
using SqlSugar;
|
|
|
using SqlSugar.SplitTableExtensions;
|
|
|
using System;
|
|
|
+using System.Collections.Concurrent;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Collections.ObjectModel;
|
|
|
using System.Drawing;
|
|
|
@@ -108,9 +109,9 @@ namespace TeamAAS_VP.Core
|
|
|
// 扫码完成事件
|
|
|
private readonly ManualResetEventSlim _scanDoneEvent = new ManualResetEventSlim(false);
|
|
|
//键盘数据
|
|
|
- public Dictionary<string, double> keyData = new Dictionary<string, double> { };
|
|
|
+ public ConcurrentDictionary<string, double> keyData = new ConcurrentDictionary<string, double> { };
|
|
|
//键盘单独数据
|
|
|
- public Dictionary<string, double> keyData1 = new Dictionary<string, double> { };
|
|
|
+ public ConcurrentDictionary<string, double> keyData1 = new ConcurrentDictionary<string, double> { };
|
|
|
//键盘差值
|
|
|
public bool isValueOk;
|
|
|
|
|
|
@@ -699,15 +700,15 @@ namespace TeamAAS_VP.Core
|
|
|
Task.Factory.StartNew(() =>
|
|
|
{
|
|
|
ScriptHelper.ExecuteScriptingAsync(script, _regionManager, _eventAggregator, _container, rst =>
|
|
|
- {
|
|
|
- if (!rst.Item1)
|
|
|
{
|
|
|
- foreach (var err in rst.Item2)
|
|
|
+ if (!rst.Item1)
|
|
|
{
|
|
|
- SendTaskMessage($"{Lang.后台脚本出错}:{err}", MessageLevel.Error);
|
|
|
+ foreach (var err in rst.Item2)
|
|
|
+ {
|
|
|
+ SendTaskMessage($"{Lang.后台脚本出错}:{err}", MessageLevel.Error);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
@@ -1513,7 +1514,7 @@ namespace TeamAAS_VP.Core
|
|
|
Int16 _LastPickINC = 0;
|
|
|
DateTime[] _LastMesCheckTime = new DateTime[10];
|
|
|
List<Task<(bool IsSucceed, bool[] Result, string Message)>> _PrcTaskList = new List<Task<(bool IsSucceed, bool[] Result, string Message)>>();
|
|
|
- List<Task<(bool IsSucceed, ICogImage[] Images, string Message, int cameraIndex, Guid procedureId)>> _ImageTaskList = new List<Task<(bool IsSucceed, ICogImage[] Images, string Message, int cameraIndex, Guid procedureId)>>();
|
|
|
+ //List<Task<(bool IsSucceed, ICogImage[] Images, string Message, int cameraIndex, Guid procedureId)>> _ImageTaskList = new List<Task<(bool IsSucceed, ICogImage[] Images, string Message, int cameraIndex, Guid procedureId)>>();
|
|
|
|
|
|
private readonly object _stateLock = new object();
|
|
|
|
|
|
@@ -1623,7 +1624,6 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
// 固定相机检测拍照
|
|
|
else if (addressConfig.In_FixedCameracheckExe.Address.Contains(tuple.nodeId))
|
|
|
{
|
|
|
@@ -1660,44 +1660,24 @@ namespace TeamAAS_VP.Core
|
|
|
try
|
|
|
{
|
|
|
if (targetPoint.CameraProcedureId1 != Guid.Empty && !procIds.Contains(targetPoint.CameraProcedureId1)) procIds.Add(targetPoint.CameraProcedureId1);
|
|
|
- }
|
|
|
- catch { }
|
|
|
- try
|
|
|
- {
|
|
|
+
|
|
|
if (targetPoint.CameraProcedureId2 != Guid.Empty && !procIds.Contains(targetPoint.CameraProcedureId2)) procIds.Add(targetPoint.CameraProcedureId2);
|
|
|
- }
|
|
|
- catch { }
|
|
|
- try
|
|
|
- {
|
|
|
+
|
|
|
if (targetPoint.CameraProcedureId3 != Guid.Empty && !procIds.Contains(targetPoint.CameraProcedureId3)) procIds.Add(targetPoint.CameraProcedureId3);
|
|
|
- }
|
|
|
- catch { }
|
|
|
- try
|
|
|
- {
|
|
|
+
|
|
|
if (targetPoint.CameraProcedureId4 != Guid.Empty && !procIds.Contains(targetPoint.CameraProcedureId4)) procIds.Add(targetPoint.CameraProcedureId4);
|
|
|
- }
|
|
|
- catch { }
|
|
|
- try
|
|
|
- {
|
|
|
+
|
|
|
if (targetPoint.CameraProcedureId5 != Guid.Empty && !procIds.Contains(targetPoint.CameraProcedureId5)) procIds.Add(targetPoint.CameraProcedureId5);
|
|
|
- }
|
|
|
- catch { }
|
|
|
- try
|
|
|
- {
|
|
|
+
|
|
|
if (targetPoint.CameraProcedureId6 != Guid.Empty && !procIds.Contains(targetPoint.CameraProcedureId6)) procIds.Add(targetPoint.CameraProcedureId6);
|
|
|
- }
|
|
|
- catch { }
|
|
|
- try
|
|
|
- {
|
|
|
+
|
|
|
if (targetPoint.CameraProcedureId7 != Guid.Empty && !procIds.Contains(targetPoint.CameraProcedureId7)) procIds.Add(targetPoint.CameraProcedureId7);
|
|
|
- }
|
|
|
- catch { }
|
|
|
- try
|
|
|
- {
|
|
|
+
|
|
|
if (targetPoint.CameraProcedureId8 != Guid.Empty && !procIds.Contains(targetPoint.CameraProcedureId8)) procIds.Add(targetPoint.CameraProcedureId8);
|
|
|
}
|
|
|
catch { }
|
|
|
var sysConfig = _configService.GetSystemConfiguration();
|
|
|
+
|
|
|
if (sysConfig.ScannerUse == true && cameraIndex == 1 && sysConfig.CodeUse2 == true)
|
|
|
{
|
|
|
ScanValue = "";
|
|
|
@@ -1974,7 +1954,6 @@ namespace TeamAAS_VP.Core
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
if (procIds.Count == 0 && cameraIndex != currentProduct.PhotoCountStop)
|
|
|
{
|
|
|
SendTaskMessage($"Point#{cameraIndex} 未配置任何视觉流程 (CameraProcedureId1/2/3)", MessageLevel.Alarm);
|
|
|
@@ -2002,6 +1981,7 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
|
lockResultsAll.Clear();
|
|
|
}
|
|
|
+
|
|
|
App.Current.Dispatcher.Invoke(() =>
|
|
|
{
|
|
|
_eventAggregator.GetEvent<LockResetNotification>().Publish();
|
|
|
@@ -2344,7 +2324,7 @@ namespace TeamAAS_VP.Core
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- _ImageTaskList.Clear();
|
|
|
+ var _ImageTaskList = new List<Task<(bool IsSucceed, ICogImage[] Images, string Message, int cameraIndex, Guid procedureId)>>();
|
|
|
|
|
|
foreach (var prcId in procIds)
|
|
|
{
|
|
|
@@ -2371,18 +2351,18 @@ namespace TeamAAS_VP.Core
|
|
|
if (sysConfig.PhotosUse == true)
|
|
|
{
|
|
|
bool Is3dPhoto = Is3D(prcId);
|
|
|
- var tt = await GrabImageEx(cameraIndex, prcId, Is3dPhoto);
|
|
|
+ var tt = await GrabImageEx(cameraIndex, prcId, Is3dPhoto, currentProduct, sysConfig);
|
|
|
if (tt.IsSucceed == false)
|
|
|
{
|
|
|
SendTaskMessage($"图像采集失败!{cameraIndex}: {prcId}", MessageLevel.Alarm);
|
|
|
return;
|
|
|
}
|
|
|
- await ExecuteProcedureAsync(cameraIndex, prcId, tt.imges, Is3dPhoto);
|
|
|
+ await ExecuteProcedureAsync(cameraIndex, prcId, tt.imges, Is3dPhoto, currentProduct);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
bool Is3dPhoto = Is3D(prcId);
|
|
|
- _ImageTaskList.Add(GrabImageEx(cameraIndex, prcId, Is3dPhoto));
|
|
|
+ _ImageTaskList.Add(GrabImageEx(cameraIndex, prcId, Is3dPhoto, currentProduct, sysConfig));
|
|
|
}
|
|
|
|
|
|
if (sysConfig.TurnOnAllLightUse == false)
|
|
|
@@ -2390,11 +2370,13 @@ namespace TeamAAS_VP.Core
|
|
|
await _remoteCommandService.TurnOffLightAfterPhoto(selectedProcedure);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
if (cameraIndex != currentProduct.PhotoCountStop)
|
|
|
{
|
|
|
//直接放行,执行下一个检测点
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_FixedCameraPickStatus.Address, (Int16)1);
|
|
|
}
|
|
|
+
|
|
|
if (_ImageTaskList.Count > 0)//如果2D取图有队列
|
|
|
{
|
|
|
var ImageTaskResults = await Task.WhenAll(_ImageTaskList);
|
|
|
@@ -2403,7 +2385,7 @@ namespace TeamAAS_VP.Core
|
|
|
if (item.IsSucceed)
|
|
|
{
|
|
|
bool Is3d = Is3D(item.procedureId);
|
|
|
- _PrcTaskList.Add(ExecuteProcedureAsync(item.cameraIndex, item.procedureId, item.Images, Is3d));
|
|
|
+ _PrcTaskList.Add(ExecuteProcedureAsync(item.cameraIndex, item.procedureId, item.Images, Is3d, currentProduct));
|
|
|
//_PrcTaskList.Add(ExecuteProcedureAsync(cameraIndex, prcId, imageData.imges));
|
|
|
}
|
|
|
else
|
|
|
@@ -2412,6 +2394,7 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
//如果最后一个拍照点,则需要等待前面所有的拍照处理完成
|
|
|
if (cameraIndex == currentProduct.PhotoCountStop)
|
|
|
{
|
|
|
@@ -2434,7 +2417,6 @@ namespace TeamAAS_VP.Core
|
|
|
//等待所有的图像处理流程处理完成
|
|
|
var results = await Task.WhenAll(_PrcTaskList);
|
|
|
|
|
|
-
|
|
|
foreach (var item in results)
|
|
|
{
|
|
|
if (!item.IsSucceed || item.Result == null)
|
|
|
@@ -2455,8 +2437,6 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
//全部OK
|
|
|
if (resultFlog)
|
|
|
{
|
|
|
@@ -2470,6 +2450,7 @@ namespace TeamAAS_VP.Core
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_FixedCameraPickStatus.Address, (Int16)2);
|
|
|
}
|
|
|
}
|
|
|
+ return;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -2478,7 +2459,6 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
// 翻转相机检测拍照
|
|
|
else if (addressConfig.In_FzCameraPixExe.Address.Contains(tuple.nodeId))
|
|
|
{
|
|
|
@@ -2702,6 +2682,7 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
|
//这里缺少从MES获取产品配方的内容,需要补充
|
|
|
_LastMesCheckTime[i] = (await _mesService.GetServerTimeAsync(code, 2)).Now;
|
|
|
+ ProductMainSN = "";
|
|
|
var stationConfig2 = _configService.GetDeviceInfo(0);
|
|
|
if (homeview.IsNoCode == false)
|
|
|
{
|
|
|
@@ -2802,7 +2783,7 @@ namespace TeamAAS_VP.Core
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- //if(kb_sn==)
|
|
|
+ //if (kb_sn ==)
|
|
|
if (currentProduct.ID != productId || productWithMes.ProductKBSN != kb_sn)
|
|
|
{
|
|
|
//切换产品
|
|
|
@@ -2817,16 +2798,23 @@ namespace TeamAAS_VP.Core
|
|
|
await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)1);
|
|
|
LogHelper.WriteLogMes($"【mes结束QUERY】");
|
|
|
SendTaskMessage($"mes结束QUERY", MessageLevel.Info);
|
|
|
- // return;
|
|
|
+ // return;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
|
|
|
|
|
|
- LogHelper.WriteLogMes($"询问mes失败");
|
|
|
- SendTaskMessage($"询问mes失败:{response}", MessageLevel.Error);
|
|
|
+ LogHelper.WriteLogMes($"二次询问mes失败");
|
|
|
+ SendTaskMessage($"二次询问mes失败:{response}", MessageLevel.Error);
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
|
|
|
+
|
|
|
+ LogHelper.WriteLogMes($"询问mes失败");
|
|
|
+ SendTaskMessage($"询问mes失败:{response}", MessageLevel.Error);
|
|
|
+ }
|
|
|
}
|
|
|
// 上传本站数据
|
|
|
else if (state == 2)
|
|
|
@@ -2837,6 +2825,8 @@ namespace TeamAAS_VP.Core
|
|
|
List<DataFormCtq> DFC = new List<DataFormCtq>();
|
|
|
SendTaskMessage($"收到{i}上传本站数据请求...", MessageLevel.Debug);
|
|
|
|
|
|
+ await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
|
|
|
+
|
|
|
//这里缺少上传MES的本站数据结果及开始和结束时间,需要补充
|
|
|
//从服务器中获取当前时间
|
|
|
var serverTimeResult = await _mesService.GetServerTimeAsync(ProductMainSN, 2);
|
|
|
@@ -2923,7 +2913,7 @@ namespace TeamAAS_VP.Core
|
|
|
|
|
|
if (keyData != null)
|
|
|
{
|
|
|
- ok = CheckKeyBoardValue(keyData,name, out string msg);
|
|
|
+ ok = CheckKeyBoardValue(keyData, name, out string msg);
|
|
|
}
|
|
|
|
|
|
if (ok && resultIndex == 1 ? true : false && isValueOk)
|
|
|
@@ -2933,7 +2923,7 @@ namespace TeamAAS_VP.Core
|
|
|
else
|
|
|
{
|
|
|
ShowMes_Result = false;
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
ShowMes_Result = resultIndex == 1 ? true : false;
|
|
|
@@ -2983,7 +2973,7 @@ namespace TeamAAS_VP.Core
|
|
|
LogHelper.WriteLogMes($"上传mes失败");
|
|
|
SendTaskMessage($"上传mes失败", MessageLevel.Error);
|
|
|
}
|
|
|
- await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
|
|
|
+ //await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
|
|
|
|
|
|
|
|
|
//是否保存当前的产品记录至CSV?
|
|
|
@@ -2992,7 +2982,7 @@ namespace TeamAAS_VP.Core
|
|
|
string saveppid = "NA";
|
|
|
string names = currentProduct.Name;
|
|
|
if (stationConfig.SaveCsvPPID) saveppid = ppid;
|
|
|
-
|
|
|
+
|
|
|
// Dictionary<string, double> adjacentDiffDict1 = GetAdjacentDiffDict(keyData1);
|
|
|
//判断锁付路径字符串是否为空,如果不为空则保存,否则不保存
|
|
|
if (!string.IsNullOrEmpty(stationConfig.SaveCsvPath))
|
|
|
@@ -3014,6 +3004,45 @@ namespace TeamAAS_VP.Core
|
|
|
// item.PhotoName = "_" + k.ToString();
|
|
|
//}
|
|
|
}
|
|
|
+
|
|
|
+ string temp_COMMODITY_TYPE = stationConfig.DataInfo.COMMODITY_TYPE;
|
|
|
+
|
|
|
+ if (item.PhotoName.Contains("A1b"))
|
|
|
+ {
|
|
|
+ temp_COMMODITY_TYPE = "Mechanical Hardware LCD CVR";
|
|
|
+ }
|
|
|
+ if (item.PhotoName.Contains("A1c") || item.PhotoName.Contains("A1d"))
|
|
|
+ {
|
|
|
+ temp_COMMODITY_TYPE = "Mechanical Hardware_LCD BZL";
|
|
|
+ }
|
|
|
+ if (item.PhotoName.Contains("A2"))
|
|
|
+ {
|
|
|
+ temp_COMMODITY_TYPE = "CAMERA";
|
|
|
+ }
|
|
|
+ if (item.PhotoName.Contains("A4"))
|
|
|
+ {
|
|
|
+ temp_COMMODITY_TYPE = "Mechanical Hardware_HNG CVR";
|
|
|
+ }
|
|
|
+ if (item.PhotoName.Contains("C4"))
|
|
|
+ {
|
|
|
+ temp_COMMODITY_TYPE = "Mechanical Hardware_PLMRST";
|
|
|
+ }
|
|
|
+ if (item.PhotoName.Contains("D5"))
|
|
|
+ {
|
|
|
+ temp_COMMODITY_TYPE = "Mechanical Hardware_DOOR";
|
|
|
+ }
|
|
|
+ if (item.PhotoName.Contains("B1"))
|
|
|
+ {
|
|
|
+ temp_COMMODITY_TYPE = "Mechanical Hardware_KB BKT";
|
|
|
+ }
|
|
|
+ if (item.PhotoName.Contains("B2"))
|
|
|
+ {
|
|
|
+ temp_COMMODITY_TYPE = "Mechanical Hardware_TP BKT";
|
|
|
+ }
|
|
|
+ if (item.PhotoName.Contains("D1"))
|
|
|
+ {
|
|
|
+ temp_COMMODITY_TYPE = "Mechanical Hardware_BTM CVR";
|
|
|
+ }
|
|
|
DFC.Add(new DataFormCtq
|
|
|
{
|
|
|
PPID = saveppid,
|
|
|
@@ -3026,7 +3055,7 @@ namespace TeamAAS_VP.Core
|
|
|
CTQ_USL = item.UpLimit,
|
|
|
PROCESS_END_TIME = serverTimeResult.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
|
|
|
SUPPLIER_NAME = stationConfig.DataInfo.SUPPLIER_NAME,
|
|
|
- COMMODITY_TYPE = stationConfig.DataInfo.COMMODITY_TYPE,
|
|
|
+ COMMODITY_TYPE = temp_COMMODITY_TYPE,
|
|
|
REVISION = stationConfig.DataInfo.REVISION + "_" + stage,//
|
|
|
WO = wo,//
|
|
|
MFG_LOT = stationConfig.DataInfo.MFG_LOT,//
|
|
|
@@ -3109,11 +3138,11 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //测试使用,强制上传mes为pass
|
|
|
- //if (sysConfig.IsMesResult)
|
|
|
- //{
|
|
|
- // resultToMes.Clear();
|
|
|
- //}
|
|
|
+ //测试使用,强制上传mes为pass
|
|
|
+ //if (sysConfig.IsMesResult)
|
|
|
+ //{
|
|
|
+ // resultToMes.Clear();
|
|
|
+ //}
|
|
|
bool recordResult = RecordStationResult(i, DFC, ProductMainSN, serverTimeResult.Now.Subtract(_LastMesCheckTime[i]).TotalSeconds, _LastMesCheckTime[i], stationConfig.SaveCsvPath);
|
|
|
// bool recordResult1 = WriteProductLog( ProductMainSN, serverTimeResult.Now.Subtract(_LastMesCheckTime[i]).TotalSeconds, _LastMesCheckTime[i], stationConfig.SaveCsvPath, DFC);
|
|
|
|
|
|
@@ -3231,18 +3260,10 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
|
SendTaskMessage($"未启用保存键盘格JMP数据", MessageLevel.Info);
|
|
|
}
|
|
|
- lock (_stateLock)
|
|
|
- {
|
|
|
- lockResultsAll.Clear();
|
|
|
- keyData.Clear();
|
|
|
- keyData1.Clear();
|
|
|
- }
|
|
|
|
|
|
- ProductMainSN = "";
|
|
|
LogHelper.WriteLogMes($"【mes结束ADD】");
|
|
|
SendTaskMessage($"mes结束ADD", MessageLevel.Info);
|
|
|
}
|
|
|
-
|
|
|
else
|
|
|
{
|
|
|
SendTaskMessage($"{i}过站检查信号:state={state},处理为默认状态", MessageLevel.Alarm);
|
|
|
@@ -3252,10 +3273,6 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
@@ -3429,279 +3446,269 @@ namespace TeamAAS_VP.Core
|
|
|
/// <param name="pointIndex"></param>
|
|
|
/// <param name="procedureId"></param>
|
|
|
/// <returns></returns>
|
|
|
- private Task<(bool IsSucceed, bool[] Result, string Message)> ExecuteProcedureAsync(int pointIndex, Guid procedureId, ICogImage[] images, bool is3dmodel)
|
|
|
+ private async Task<(bool IsSucceed, bool[] Result, string Message)> ExecuteProcedureAsync(int pointIndex, Guid procedureId, ICogImage[] images, bool is3dmodel, ProductModel currentProduct)
|
|
|
{
|
|
|
- return Task.Run(async () =>
|
|
|
- {
|
|
|
- List<bool> results = new List<bool>();
|
|
|
- // 获取当前产品
|
|
|
- var currentProduct = _productService.GetCurrentProduct();
|
|
|
- if (currentProduct == null)
|
|
|
- {
|
|
|
- return (false, null, "当前产品为空,未加载产品!");
|
|
|
- }
|
|
|
|
|
|
- var cameraProcedures = currentProduct.CameraProcedures;
|
|
|
- if (cameraProcedures == null || cameraProcedures.Count == 0)
|
|
|
- {
|
|
|
- SendTaskMessage($"当前产品未配置 CameraProcedures,无法执行视觉流程", MessageLevel.Alarm);
|
|
|
- return (false, null, $"当前产品未配置 CameraProcedures,无法执行视觉流程");
|
|
|
- }
|
|
|
+ List<bool> results = new List<bool>();
|
|
|
|
|
|
+ //Guid start = currentProduct.FixedUpCamera1ProcedureId;
|
|
|
+ //Guid stop = currentProduct.FixedUpCamera2ProcedureId;
|
|
|
+ //var startProcedures = _productService.GetCurrentProductProcedureModelById(start);
|
|
|
+ //var stopProcedures = _productService.GetCurrentProductProcedureModelById(stop);
|
|
|
|
|
|
- var ctsAll = new CancellationTokenSource();
|
|
|
+ var cameraProcedures = currentProduct.CameraProcedures;
|
|
|
+ if (cameraProcedures == null || cameraProcedures.Count == 0)
|
|
|
+ {
|
|
|
+ SendTaskMessage($"当前产品未配置 CameraProcedures,无法执行视觉流程", MessageLevel.Alarm);
|
|
|
+ return (false, null, $"当前产品未配置 CameraProcedures,无法执行视觉流程");
|
|
|
+ }
|
|
|
|
|
|
+
|
|
|
+ var ctsAll = new CancellationTokenSource();
|
|
|
+
|
|
|
+ try
|
|
|
+ {
|
|
|
+ ProcedureModel selectedProcedure = null;
|
|
|
try
|
|
|
{
|
|
|
- ProcedureModel selectedProcedure = null;
|
|
|
- try
|
|
|
+ foreach (var cp in cameraProcedures)
|
|
|
{
|
|
|
- foreach (var cp in cameraProcedures)
|
|
|
- {
|
|
|
- if (cp?.ProcedureModels == null) continue;
|
|
|
- selectedProcedure = cp.ProcedureModels.FirstOrDefault(pm => pm.Id == procedureId);
|
|
|
+ if (cp?.ProcedureModels == null) continue;
|
|
|
+ selectedProcedure = cp.ProcedureModels.FirstOrDefault(pm => pm.Id == procedureId);
|
|
|
|
|
|
- if (selectedProcedure != null) break;
|
|
|
- }
|
|
|
+ if (selectedProcedure != null) break;
|
|
|
}
|
|
|
- catch (Exception ex)
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ LogHelper.WriteLogError("查找 AOI 点位对应视觉流程时出错", ex);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (selectedProcedure == null)
|
|
|
+ {
|
|
|
+ SendTaskMessage($"未找到 AOI 点位对应的视觉流程,Point#{pointIndex} ProcedureId={pointIndex}", MessageLevel.Alarm);
|
|
|
+ return (false, null, $"未找到 AOI 点位对应的视觉流程,Point#{pointIndex} ProcedureId={procedureId}");
|
|
|
+ }
|
|
|
+
|
|
|
+ SendTaskMessage($"开始执行 AOI 流程 (Point#{pointIndex}) 流程Id={pointIndex}", MessageLevel.Debug);
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var sysConfig = _configService.GetSystemConfiguration();
|
|
|
+ if (selectedProcedure.Id == currentProduct.MoveDownCameraLockPhotoProcedureId && sysConfig.TurnOffAllLightUse == true)
|
|
|
{
|
|
|
- LogHelper.WriteLogError("查找 AOI 点位对应视觉流程时出错", ex);
|
|
|
+ await _remoteCommandService.TurnOffLightAfterPhoto(selectedProcedure);
|
|
|
}
|
|
|
-
|
|
|
- if (selectedProcedure == null)
|
|
|
+ PhotoPath = selectedProcedure.SavePath;
|
|
|
+ //1. 执行拍照,图像处理
|
|
|
+ var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint1(selectedProcedure, images, null, null, ctsAll.Token, is3dmodel);
|
|
|
+ if (visionResult.Count == 0)
|
|
|
{
|
|
|
- SendTaskMessage($"未找到 AOI 点位对应的视觉流程,Point#{pointIndex} ProcedureId={pointIndex}", MessageLevel.Alarm);
|
|
|
+ SendTaskMessage("Count值为0", MessageLevel.Alarm);
|
|
|
return (false, null, $"未找到 AOI 点位对应的视觉流程,Point#{pointIndex} ProcedureId={procedureId}");
|
|
|
}
|
|
|
|
|
|
- SendTaskMessage($"开始执行 AOI 流程 (Point#{pointIndex}) 流程Id={pointIndex}", MessageLevel.Debug);
|
|
|
- try
|
|
|
+ //2. 结果分析
|
|
|
+ //lock (_stateLock)
|
|
|
+ //{
|
|
|
+
|
|
|
+ //if (currentProduct.Name==startProcedures.Name)
|
|
|
+ //{
|
|
|
+ // lockResultsAll.Clear();
|
|
|
+ //}
|
|
|
+
|
|
|
+ var stationConfig = _configService.GetDeviceInfo(0);
|
|
|
+ for (int i = 1; i <= visionResult.Count; i++)
|
|
|
{
|
|
|
- var sysConfig = _configService.GetSystemConfiguration();
|
|
|
- if (selectedProcedure.Id == currentProduct.MoveDownCameraLockPhotoProcedureId && sysConfig.TurnOffAllLightUse == true)
|
|
|
- {
|
|
|
- await _remoteCommandService.TurnOffLightAfterPhoto(selectedProcedure);
|
|
|
- }
|
|
|
- PhotoPath = selectedProcedure.SavePath;
|
|
|
- //1. 执行拍照,图像处理
|
|
|
- var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint1(selectedProcedure, images, null, null, ctsAll.Token, is3dmodel);
|
|
|
- if (visionResult.Count == 0)
|
|
|
- {
|
|
|
- SendTaskMessage("Count值为0", MessageLevel.Alarm);
|
|
|
- return (false, null, $"未找到 AOI 点位对应的视觉流程,Point#{pointIndex} ProcedureId={procedureId}");
|
|
|
- }
|
|
|
|
|
|
- //2. 结果分析
|
|
|
- lock (_stateLock)
|
|
|
+ LockResult lockResult1 = new LockResult();
|
|
|
+
|
|
|
+ try
|
|
|
{
|
|
|
- var stationConfig = _configService.GetDeviceInfo(0);
|
|
|
- for (int i = 1; i <= visionResult.Count; i++)
|
|
|
- {
|
|
|
|
|
|
- LockResult lockResult1 = new LockResult();
|
|
|
- //if (pointIndex == currentProduct.PhotoCount && selectedProcedure.Id == currentProduct.FixedUpCamera1ProcedureId && i == 1)
|
|
|
- //{
|
|
|
- // lockResult1.Number = 1;
|
|
|
- // lock (_stateLock)
|
|
|
- // {
|
|
|
- // lockResultsAll.Clear();
|
|
|
- // }
|
|
|
+ string[] strpoints1 = visionResult.Items[i].Split(',');
|
|
|
+ string[] body1 = strpoints1[1].Split(";");
|
|
|
+
|
|
|
+ if (body1.Length > 1)
|
|
|
+ {
|
|
|
|
|
|
- //}
|
|
|
- try
|
|
|
+ for (int j = 1; j <= body1.Length; j++)
|
|
|
{
|
|
|
+ lockResult1.PhotoName = strpoints1[0] + "_" + j.ToString();
|
|
|
+ lockResult1.ResultData = body1[j - 1];
|
|
|
+ lockResult1.PhotoCode = ProductMainSN;
|
|
|
|
|
|
- string[] strpoints1 = visionResult.Items[i].Split(',');
|
|
|
- string[] body1 = strpoints1[1].Split(";");
|
|
|
-
|
|
|
- if (body1.Length > 1)
|
|
|
+ var globalParam = currentProduct.GlobalParamListCollection.FirstOrDefault(p => p.Name == strpoints1[0]);
|
|
|
+ if (globalParam != null)
|
|
|
{
|
|
|
+ lockResult1.UpLimit = globalParam.Param1;
|
|
|
+ lockResult1.DownLimit = globalParam.Param2;
|
|
|
+ lockResult1.MidLimit = globalParam.Param5;
|
|
|
+ string ResData = body1[j - 1];
|
|
|
+ if (ResData.Contains("NA"))
|
|
|
+ {
|
|
|
+ ResData = "-999";
|
|
|
+ }
|
|
|
|
|
|
- for (int j = 1; j <= body1.Length; j++)
|
|
|
+ bool resultflog = true;
|
|
|
+ if (Convert.ToDouble(ResData) >= Convert.ToDouble(globalParam.Param2) && Convert.ToDouble(ResData) <= Convert.ToDouble(globalParam.Param1))
|
|
|
{
|
|
|
- lockResult1.PhotoName = strpoints1[0] + "_" + j.ToString();
|
|
|
- lockResult1.ResultData = body1[j - 1];
|
|
|
- lockResult1.PhotoCode = ProductMainSN;
|
|
|
- //if (lockResult1.PhotoName.Contains("gap"))
|
|
|
- //{
|
|
|
- // lockResult1.PhotoPassed = "OK";
|
|
|
- // results.Add(true);
|
|
|
- //}
|
|
|
- var globalParam = currentProduct.GlobalParamListCollection.FirstOrDefault(p => p.Name == strpoints1[0]);
|
|
|
- if (globalParam != null)
|
|
|
- {
|
|
|
- lockResult1.UpLimit = globalParam.Param1;
|
|
|
- lockResult1.DownLimit = globalParam.Param2;
|
|
|
- lockResult1.MidLimit = globalParam.Param5;
|
|
|
- string ResData = body1[j - 1];
|
|
|
- if (ResData.Contains("NA"))
|
|
|
- {
|
|
|
- ResData = "-999";
|
|
|
- }
|
|
|
|
|
|
- bool resultflog = true;
|
|
|
- if (Convert.ToDouble(ResData) >= Convert.ToDouble(globalParam.Param2) && Convert.ToDouble(ResData) <= Convert.ToDouble(globalParam.Param1))
|
|
|
- {
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ SendTaskMessage($"检测项{lockResult1.PhotoName}结果{ResData}超出上下限!", MessageLevel.Error);
|
|
|
+ resultflog = false;
|
|
|
+ }
|
|
|
+ if (resultflog)
|
|
|
+ {
|
|
|
+ lockResult1.PhotoPassed = "OK";
|
|
|
+ results.Add(true);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ lockResult1.PhotoPassed = "NG";
|
|
|
+ results.Add(false);
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- SendTaskMessage($"检测项{lockResult1.PhotoName}结果{ResData}超出上下限!", MessageLevel.Error);
|
|
|
- resultflog = false;
|
|
|
- }
|
|
|
- if (resultflog )
|
|
|
- {
|
|
|
- lockResult1.PhotoPassed = "OK";
|
|
|
- results.Add(true);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- lockResult1.PhotoPassed = "NG";
|
|
|
- results.Add(false);
|
|
|
- }
|
|
|
+ }
|
|
|
+ lockResultsAll.Add(lockResult1.Copy());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ lockResult1.PhotoName = strpoints1[0];
|
|
|
+ lockResult1.ResultData = strpoints1[1];
|
|
|
+ lockResult1.PhotoCode = ProductMainSN;
|
|
|
|
|
|
- }
|
|
|
- lockResultsAll.Add(lockResult1.Copy());
|
|
|
- }
|
|
|
+ var globalParam = currentProduct.GlobalParamListCollection.FirstOrDefault(p => p.Name == strpoints1[0]);
|
|
|
+ if (globalParam != null)
|
|
|
+ {
|
|
|
+ lockResult1.UpLimit = globalParam.Param1;
|
|
|
+ lockResult1.DownLimit = globalParam.Param2;
|
|
|
+ lockResult1.MidLimit = globalParam.Param5;
|
|
|
+ string ResData = strpoints1[1];
|
|
|
+ if (ResData.Contains("NA"))
|
|
|
+ {
|
|
|
+ ResData = "-1000";
|
|
|
}
|
|
|
- else
|
|
|
+
|
|
|
+ bool resultflog = true;
|
|
|
+ if (Convert.ToDouble(ResData) >= Convert.ToDouble(globalParam.Param2) && Convert.ToDouble(ResData) <= Convert.ToDouble(globalParam.Param1))
|
|
|
{
|
|
|
- // if(lockResult1.PhotoName)
|
|
|
- lockResult1.PhotoName = strpoints1[0];
|
|
|
- lockResult1.ResultData = strpoints1[1];
|
|
|
- lockResult1.PhotoCode = ProductMainSN;
|
|
|
- //if (lockResult1.PhotoName.Contains("gap"))
|
|
|
- //{
|
|
|
- // lockResult1.PhotoPassed = "OK";
|
|
|
- // results.Add(true);
|
|
|
- //}
|
|
|
- var globalParam = currentProduct.GlobalParamListCollection.FirstOrDefault(p => p.Name == strpoints1[0]);
|
|
|
- if (globalParam != null)
|
|
|
- {
|
|
|
- lockResult1.UpLimit = globalParam.Param1;
|
|
|
- lockResult1.DownLimit = globalParam.Param2;
|
|
|
- lockResult1.MidLimit = globalParam.Param5;
|
|
|
- string ResData = strpoints1[1];
|
|
|
- if (ResData.Contains("NA"))
|
|
|
- {
|
|
|
- ResData = "-1000";
|
|
|
- }
|
|
|
|
|
|
- bool resultflog = true;
|
|
|
- if (Convert.ToDouble(ResData) >= Convert.ToDouble(globalParam.Param2) && Convert.ToDouble(ResData) <= Convert.ToDouble(globalParam.Param1))
|
|
|
- {
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ SendTaskMessage($"检测项{lockResult1.PhotoName}结果{ResData}超出上下限!", MessageLevel.Error);
|
|
|
+ resultflog = false;
|
|
|
+ }
|
|
|
+ if (resultflog)
|
|
|
+ {
|
|
|
+ lockResult1.PhotoPassed = "OK";
|
|
|
+ results.Add(true);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ lockResult1.PhotoPassed = "NG";
|
|
|
+ results.Add(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- SendTaskMessage($"检测项{lockResult1.PhotoName}结果{ResData}超出上下限!",MessageLevel.Error);
|
|
|
- resultflog = false;
|
|
|
- }
|
|
|
- if (resultflog )
|
|
|
- {
|
|
|
- lockResult1.PhotoPassed = "OK";
|
|
|
- results.Add(true);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- lockResult1.PhotoPassed = "NG";
|
|
|
- results.Add(false);
|
|
|
- }
|
|
|
- }
|
|
|
+ lock (_stateLock)
|
|
|
+ {
|
|
|
+ lockResultsAll.Add(lockResult1.Copy());
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- lockResultsAll.Add(lockResult1);
|
|
|
- }
|
|
|
+ if (stationConfig.SaveCsvkeyData)
|
|
|
+ {
|
|
|
+ if (body1.Length >= 5)
|
|
|
+ {
|
|
|
+ string keyName = strpoints1[0].Split('-').Last().Trim();
|
|
|
+ List<double> list = new List<double>();
|
|
|
|
|
|
- if (stationConfig.SaveCsvkeyData)
|
|
|
+ foreach (string v in body1)
|
|
|
{
|
|
|
- if (body1.Length >= 5)
|
|
|
+ if (double.TryParse(v.Trim(), out double num))
|
|
|
{
|
|
|
- string keyName = strpoints1[0].Split('-').Last().Trim();
|
|
|
- List<double> list = new List<double>();
|
|
|
-
|
|
|
- foreach (string v in body1)
|
|
|
- {
|
|
|
- if (double.TryParse(v.Trim(), out double num))
|
|
|
- {
|
|
|
- if (num == 999)
|
|
|
- {
|
|
|
- continue;
|
|
|
- }
|
|
|
- list.Add(num);
|
|
|
- }
|
|
|
- }
|
|
|
- if (list.Count == 0)
|
|
|
+ if (num == 999)
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
+ list.Add(num);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (list.Count == 0)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
- double max = list.Max();
|
|
|
- double min = list.Min();
|
|
|
- double chazhi = max - min;
|
|
|
- double average = list.Average();
|
|
|
- if (max - min > 0.3)
|
|
|
- {
|
|
|
- isValueOk = false;
|
|
|
- SendTaskMessage($"键盘格{keyName}最大值{max}与最小值{min}相差大于0.3!", MessageLevel.Error);
|
|
|
- }
|
|
|
+ double max = list.Max();
|
|
|
+ double min = list.Min();
|
|
|
+ double chazhi = max - min;
|
|
|
+ double average = list.Average();
|
|
|
+ if (max - min > 0.3)
|
|
|
+ {
|
|
|
+ isValueOk = false;
|
|
|
+ SendTaskMessage($"键盘格{keyName}最大值{max}与最小值{min}相差大于0.3!", MessageLevel.Error);
|
|
|
+ }
|
|
|
|
|
|
- if (keyData != null)
|
|
|
- {
|
|
|
- if (!keyData.ContainsKey(keyName))
|
|
|
- {
|
|
|
- keyData.Add(keyName, average);
|
|
|
+ if (keyData != null)
|
|
|
+ {
|
|
|
+ if (!keyData.ContainsKey(keyName))
|
|
|
+ {
|
|
|
+ keyData.TryAdd(keyName, average);
|
|
|
|
|
|
- }
|
|
|
- if (!keyData1.ContainsKey(keyName))
|
|
|
- {
|
|
|
- keyData1.Add(keyName, chazhi);
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- keyData.Add(keyName, average);
|
|
|
- keyData1.Add(keyName, chazhi);
|
|
|
- }
|
|
|
+ }
|
|
|
+ if (!keyData1.ContainsKey(keyName))
|
|
|
+ {
|
|
|
+ keyData1.TryAdd(keyName, chazhi);
|
|
|
}
|
|
|
}
|
|
|
- App.Current.Dispatcher.Invoke(() =>
|
|
|
+ else
|
|
|
{
|
|
|
- _eventAggregator.GetEvent<LockFinishNotification>().Publish(lockResult1);
|
|
|
- });
|
|
|
-
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- SendTaskMessage($"拆分视觉结果出错:{ex}", MessageLevel.Error);
|
|
|
-
|
|
|
+ keyData.TryAdd(keyName, average);
|
|
|
+ keyData1.TryAdd(keyName, chazhi);
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
+ _ = App.Current.Dispatcher.BeginInvoke(new Action(() =>
|
|
|
+ {
|
|
|
+ _eventAggregator
|
|
|
+ .GetEvent<LockFinishNotification>()
|
|
|
+ .Publish(lockResult1);
|
|
|
+ }));
|
|
|
+
|
|
|
}
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ SendTaskMessage($"拆分视觉结果出错:{ex}", MessageLevel.Error);
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- ////排序
|
|
|
- //lock (_stateLock)
|
|
|
- //{
|
|
|
- // var bf1 = lockResultsAll.OrderBy(p => int.Parse(p.PhotoName));
|
|
|
- // lockResultsAll = new List<LockResult>(bf1);
|
|
|
- //}
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- LogHelper.WriteLogError("执行 AOI 视觉流程时出错", ex);
|
|
|
- SendTaskMessage($"执行 AOI 视觉流程异常: {ex.Message}", MessageLevel.Alarm);
|
|
|
}
|
|
|
-
|
|
|
- return (true, results.ToArray(), $"成功");
|
|
|
+ // }
|
|
|
+
|
|
|
+ ////排序
|
|
|
+ //lock (_stateLock)
|
|
|
+ //{
|
|
|
+ // var bf1 = lockResultsAll.OrderBy(p => int.Parse(p.PhotoName));
|
|
|
+ // lockResultsAll = new List<LockResult>(bf1);
|
|
|
+ //}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- LogHelper.WriteLogError("处理固定相机检测拍照时出错", ex);
|
|
|
- return (false, null, $"处理固定相机检测拍照时出错");
|
|
|
+ LogHelper.WriteLogError("执行 AOI 视觉流程时出错", ex);
|
|
|
+ SendTaskMessage($"执行 AOI 视觉流程异常: {ex.Message}", MessageLevel.Alarm);
|
|
|
}
|
|
|
- });
|
|
|
+
|
|
|
+ return (true, results.ToArray(), $"成功");
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ LogHelper.WriteLogError("处理固定相机检测拍照时出错", ex);
|
|
|
+ return (false, null, $"处理固定相机检测拍照时出错");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -3985,7 +3992,7 @@ namespace TeamAAS_VP.Core
|
|
|
/// <summary>
|
|
|
/// 校验键盘所有按键值,相邻差值不能大于 0.3
|
|
|
/// </summary>
|
|
|
- public bool CheckKeyBoardValue(Dictionary<string, double> keyDic, string name, out string errorMsg)
|
|
|
+ public bool CheckKeyBoardValue(ConcurrentDictionary<string, double> keyDic, string name, out string errorMsg)
|
|
|
{
|
|
|
errorMsg = "";
|
|
|
try
|
|
|
@@ -4416,7 +4423,7 @@ namespace TeamAAS_VP.Core
|
|
|
["F12"] = new List<string> { "F11", "Insert", "=" },
|
|
|
["Insert"] = new List<string> { "F12", "Backspace", "Delete" },
|
|
|
["Delete"] = new List<string> { "Insert", "Power", "Backspace" },
|
|
|
- ["Power"] = new List<string> { "Insert" , "Delete" , "Backspace" },
|
|
|
+ ["Power"] = new List<string> { "Insert", "Delete", "Backspace" },
|
|
|
// ==============================================
|
|
|
// 第二行:` 1 2 3 4 5 6 7 8 9 0 _ = Backspace
|
|
|
// ==============================================
|
|
|
@@ -4503,7 +4510,7 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
- private Dictionary<string, double> GetAdjacentDiffDict(Dictionary<string, double> keyData, string name)
|
|
|
+ private Dictionary<string, double> GetAdjacentDiffDict(ConcurrentDictionary<string, double> keyData, string name)
|
|
|
{
|
|
|
var currentProduct = _productService.GetCurrentProduct();
|
|
|
|
|
|
@@ -4611,18 +4618,18 @@ namespace TeamAAS_VP.Core
|
|
|
#endregion
|
|
|
|
|
|
#region 保存CSV
|
|
|
- public bool WriteProductLogKB(IEnumerable<DataFormCtq> lockResults, string rfid)
|
|
|
+ public bool WriteProductLogKB(IEnumerable<DataFormCtq> lockResults, string rfid)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
DateTime dt = DateTime.Now;
|
|
|
- if (rfid == null||rfid.Count()==0)
|
|
|
+ if (rfid == null || rfid.Count() == 0)
|
|
|
{
|
|
|
rfid = dt.ToString("MM-dd-mm");
|
|
|
}
|
|
|
- if (lockResults.Count()==0 || lockResults == null)
|
|
|
+ if (lockResults.Count() == 0 || lockResults == null)
|
|
|
{
|
|
|
- SendTaskMessage("保存KB数据为空",MessageLevel.Error);
|
|
|
+ SendTaskMessage("保存KB数据为空", MessageLevel.Error);
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
@@ -4634,11 +4641,11 @@ namespace TeamAAS_VP.Core
|
|
|
foreach (var item in lockResults)
|
|
|
{
|
|
|
try
|
|
|
- {
|
|
|
+ {
|
|
|
//!item.CTQ_NAME.Contains("Left")|| !item.CTQ_NAME.Contains("Right")||!item.CTQ_NAME.Contains("Updown")|| !item.CTQ_NAME.Contains("Down")
|
|
|
if (item.CTQ_NAME.Contains("Left") || item.CTQ_NAME.Contains("Down") || item.CTQ_NAME.Contains("Right") || item.CTQ_NAME.Contains("Updown"))
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -4649,7 +4656,7 @@ namespace TeamAAS_VP.Core
|
|
|
catch (Exception)
|
|
|
{
|
|
|
sb.Append($",,,,,,,,,,,,,,");
|
|
|
-
|
|
|
+
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
@@ -4686,7 +4693,7 @@ namespace TeamAAS_VP.Core
|
|
|
try
|
|
|
{
|
|
|
DateTime dt = DateTime.Now;
|
|
|
- if (rfid==null||rfid.Count()==0)
|
|
|
+ if (rfid == null || rfid.Count() == 0)
|
|
|
{
|
|
|
rfid = dt.ToString("MM-dd-mm");
|
|
|
}
|
|
|
@@ -4907,10 +4914,10 @@ namespace TeamAAS_VP.Core
|
|
|
/// </summary>
|
|
|
/// <param name="procedureId"></param>
|
|
|
/// <returns></returns>
|
|
|
- private async Task<(bool IsSucceed, ICogImage[] imges, string Message, int pointIndex, Guid procedureId)> GrabImageEx(int pointIndex, Guid procedureId, bool Is3dPhoto)
|
|
|
+ private async Task<(bool IsSucceed, ICogImage[] imges, string Message, int pointIndex, Guid procedureId)> GrabImageEx(int pointIndex, Guid procedureId, bool Is3dPhoto, ProductModel currentProduct, SystemConfiguration sysConfig)
|
|
|
{
|
|
|
// 获取当前产品
|
|
|
- var currentProduct = _productService.GetCurrentProduct();
|
|
|
+ //var currentProduct = _productService.GetCurrentProduct();
|
|
|
if (currentProduct == null)
|
|
|
{
|
|
|
return (false, null, "当前产品为空,未加载产品!", pointIndex, procedureId);
|
|
|
@@ -4950,13 +4957,13 @@ namespace TeamAAS_VP.Core
|
|
|
SendTaskMessage($"开始执行 AOI 流程 (Point#{pointIndex}) 流程Id={pointIndex}", MessageLevel.Debug);
|
|
|
try
|
|
|
{
|
|
|
- var sysConfig = _configService.GetSystemConfiguration();
|
|
|
+ //var sysConfig = _configService.GetSystemConfiguration();
|
|
|
if (selectedProcedure.Id == currentProduct.FixedDownCameraProcedureId && sysConfig.TurnOnAllLightUse == true)
|
|
|
{
|
|
|
await _remoteCommandService.SetLightBeforePhoto(selectedProcedure);
|
|
|
}
|
|
|
//1. 执行拍照
|
|
|
- var res = await _remoteCommandService.ExecuteGrabImageAsync(selectedProcedure, Is3dPhoto);
|
|
|
+ var res = await _remoteCommandService.ExecuteGrabImageAsync(selectedProcedure, Is3dPhoto, sysConfig);
|
|
|
return (res.IsSucceed, res.Image, res.Msg, pointIndex, procedureId);
|
|
|
}
|
|
|
catch (Exception ex)
|