|
|
@@ -100,7 +100,7 @@ namespace TeamAAS_VP.Core
|
|
|
// 扫码完成事件
|
|
|
private readonly ManualResetEventSlim _scanDoneEvent = new ManualResetEventSlim(false);
|
|
|
//键盘数据
|
|
|
- public Dictionary<string, double> keyData = new Dictionary<string, double>{};
|
|
|
+ public Dictionary<string, double> keyData = new Dictionary<string, double> { };
|
|
|
//键盘单独数据
|
|
|
public Dictionary<string, double> keyData1 = new Dictionary<string, double> { };
|
|
|
//键盘差值
|
|
|
@@ -275,7 +275,7 @@ namespace TeamAAS_VP.Core
|
|
|
set { SetProperty(ref _ProductList, value); }
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
#region 命令
|
|
|
@@ -1393,7 +1393,7 @@ namespace TeamAAS_VP.Core
|
|
|
monitorNodeIds.Add(string.Format(addressConfig.In_MesCheck.Address, i));
|
|
|
}
|
|
|
//订阅PLC地址变化
|
|
|
- plc.SubscribeNodes("AutoSensor", monitorNodeIds, PlcCommandTrigger,OpcUaSubscriptionMode.CustomPolling);
|
|
|
+ plc.SubscribeNodes("AutoSensor", monitorNodeIds, PlcCommandTrigger, OpcUaSubscriptionMode.CustomPolling);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -1556,7 +1556,7 @@ namespace TeamAAS_VP.Core
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_UPCameracheckStatus.Address, (Int16)2);
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
SetProducts(new int[] { targetPoint.Camera_Product1, targetPoint.Camera_Product2, targetPoint.Camera_Product3, targetPoint.Camera_Product4 });
|
|
|
|
|
|
@@ -1944,13 +1944,13 @@ namespace TeamAAS_VP.Core
|
|
|
var cameraProcedures = currentProduct.CameraProcedures;
|
|
|
if (cameraProcedures == null || cameraProcedures.Count == 0)
|
|
|
{
|
|
|
- if(cameraIndex != currentProduct.PhotoCountStop)
|
|
|
+ if (cameraIndex != currentProduct.PhotoCountStop)
|
|
|
{
|
|
|
SendTaskMessage($"当前产品未配置 CameraProcedures,无法执行视觉流程", MessageLevel.Alarm);
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_FixedCameraPickStatus.Address, (Int16)2);
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
if (cameraIndex == currentProduct.PhotoCount)
|
|
|
@@ -2290,7 +2290,7 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
|
|
|
_ImageTaskList.Clear();
|
|
|
-
|
|
|
+
|
|
|
foreach (var prcId in procIds)
|
|
|
{
|
|
|
ProcedureModel selectedProcedure = null;
|
|
|
@@ -2312,12 +2312,12 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
|
await _remoteCommandService.SetLightBeforePhoto(selectedProcedure);
|
|
|
}
|
|
|
-
|
|
|
- if(sysConfig.PhotosUse==true)
|
|
|
+
|
|
|
+ if (sysConfig.PhotosUse == true)
|
|
|
{
|
|
|
bool Is3dPhoto = Is3D(prcId);
|
|
|
- var tt=await GrabImageEx(cameraIndex, prcId, Is3dPhoto);
|
|
|
- if(tt.IsSucceed==false)
|
|
|
+ var tt = await GrabImageEx(cameraIndex, prcId, Is3dPhoto);
|
|
|
+ if (tt.IsSucceed == false)
|
|
|
{
|
|
|
SendTaskMessage($"图像采集失败!{cameraIndex}: {prcId}", MessageLevel.Alarm);
|
|
|
return;
|
|
|
@@ -2329,7 +2329,7 @@ namespace TeamAAS_VP.Core
|
|
|
bool Is3dPhoto = Is3D(prcId);
|
|
|
_ImageTaskList.Add(GrabImageEx(cameraIndex, prcId, Is3dPhoto));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (sysConfig.TurnOnAllLightUse == false)
|
|
|
{
|
|
|
await _remoteCommandService.TurnOffLightAfterPhoto(selectedProcedure);
|
|
|
@@ -2348,7 +2348,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, sysConfig.confThreshold, sysConfig.iouThreshold));
|
|
|
//_PrcTaskList.Add(ExecuteProcedureAsync(cameraIndex, prcId, imageData.imges));
|
|
|
}
|
|
|
else
|
|
|
@@ -2366,12 +2366,12 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
|
foreach (var item in lockResultsAll)
|
|
|
{
|
|
|
- if (item.PhotoPassed=="NG")
|
|
|
+ if (item.PhotoPassed == "NG")
|
|
|
{
|
|
|
resultFlog = false;
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
@@ -2379,7 +2379,7 @@ namespace TeamAAS_VP.Core
|
|
|
//等待所有的图像处理流程处理完成
|
|
|
var results = await Task.WhenAll(_PrcTaskList);
|
|
|
|
|
|
-
|
|
|
+
|
|
|
foreach (var item in results)
|
|
|
{
|
|
|
if (!item.IsSucceed || item.Result == null)
|
|
|
@@ -2400,7 +2400,7 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
//全部OK
|
|
|
if (resultFlog)
|
|
|
@@ -2741,7 +2741,7 @@ namespace TeamAAS_VP.Core
|
|
|
|
|
|
if (stationConfig.SaveCsvkeyData)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
if (keyData != null)
|
|
|
{
|
|
|
ok = CheckKeyBoardValue(keyData, out string msg);
|
|
|
@@ -2760,7 +2760,7 @@ namespace TeamAAS_VP.Core
|
|
|
ShowMes_Result = true;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//StringBuilder submitDataError2 = new StringBuilder();
|
|
|
//foreach (var item in keyData)
|
|
|
//{
|
|
|
@@ -2775,7 +2775,7 @@ namespace TeamAAS_VP.Core
|
|
|
if (submitData.Length > 0)
|
|
|
{
|
|
|
string data1 = submitData.ToString().TrimEnd('&');
|
|
|
- (bool isSuccess, string response) = await _mesService.SubmitGetAsync(0,ProductMainSN, "", submitData.ToString(), ShowMes_Result, submitDataError.ToString(), _LastMesCheckTime[i], serverTimeResult.Now);
|
|
|
+ (bool isSuccess, string response) = await _mesService.SubmitGetAsync(0, ProductMainSN, "", submitData.ToString(), ShowMes_Result, submitDataError.ToString(), _LastMesCheckTime[i], serverTimeResult.Now);
|
|
|
allSuccess &= isSuccess;
|
|
|
}
|
|
|
if (submitData2.Length > 0)
|
|
|
@@ -2787,7 +2787,7 @@ namespace TeamAAS_VP.Core
|
|
|
if (submitData3.Length > 0)
|
|
|
{
|
|
|
string data3 = submitData3.ToString().TrimEnd('&');
|
|
|
- (bool isSuccess, string response) = await _mesService.SubmitGetAsync(2, ProductMainSN, "", submitData3.ToString(), ShowMes_Result , submitDataError.ToString(), _LastMesCheckTime[i], serverTimeResult.Now);
|
|
|
+ (bool isSuccess, string response) = await _mesService.SubmitGetAsync(2, ProductMainSN, "", submitData3.ToString(), ShowMes_Result, submitDataError.ToString(), _LastMesCheckTime[i], serverTimeResult.Now);
|
|
|
allSuccess &= isSuccess;
|
|
|
}
|
|
|
if (submitData4.Length > 0)
|
|
|
@@ -2810,14 +2810,14 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
|
|
|
|
|
|
-
|
|
|
+
|
|
|
//是否保存当前的产品记录至CSV?
|
|
|
if (stationConfig.SaveCsv)
|
|
|
{
|
|
|
string saveppid = "NA";
|
|
|
if (stationConfig.SaveCsvPPID) saveppid = ppid;
|
|
|
Dictionary<string, double> adjacentDiffDict = GetAdjacentDiffDict(keyData);
|
|
|
- // Dictionary<string, double> adjacentDiffDict1 = GetAdjacentDiffDict(keyData1);
|
|
|
+ // Dictionary<string, double> adjacentDiffDict1 = GetAdjacentDiffDict(keyData1);
|
|
|
//判断锁付路径字符串是否为空,如果不为空则保存,否则不保存
|
|
|
if (!string.IsNullOrEmpty(stationConfig.SaveCsvPath))
|
|
|
{
|
|
|
@@ -2837,7 +2837,7 @@ namespace TeamAAS_VP.Core
|
|
|
//{
|
|
|
// item.PhotoName = "_" + k.ToString();
|
|
|
//}
|
|
|
- }
|
|
|
+ }
|
|
|
DFC.Add(new DataFormCtq
|
|
|
{
|
|
|
PPID = saveppid,
|
|
|
@@ -2864,7 +2864,7 @@ namespace TeamAAS_VP.Core
|
|
|
PD_ATTR_03 = "",
|
|
|
PD_ATTR_04 = code,
|
|
|
PD_ATTR_05 = "",
|
|
|
- });
|
|
|
+ });
|
|
|
}
|
|
|
if (stationConfig.SaveCsvkeyData)
|
|
|
{
|
|
|
@@ -3030,12 +3030,12 @@ namespace TeamAAS_VP.Core
|
|
|
keyData.Clear();
|
|
|
keyData1.Clear();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
ProductMainSN = "";
|
|
|
LogHelper.WriteLogMes($"【mes结束ADD】");
|
|
|
SendTaskMessage($"mes结束ADD", MessageLevel.Info);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
else
|
|
|
{
|
|
|
SendTaskMessage($"{i}过站检查信号:state={state},处理为默认状态", MessageLevel.Alarm);
|
|
|
@@ -3046,7 +3046,7 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
}
|
|
|
@@ -3222,7 +3222,7 @@ 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 Task<(bool IsSucceed, bool[] Result, string Message)> ExecuteProcedureAsync(int pointIndex, Guid procedureId, ICogImage[] images, bool is3dmodel, float confThreshold = 0.25f, float iouThreshold = 0.45f)
|
|
|
{
|
|
|
return Task.Run(async () =>
|
|
|
{
|
|
|
@@ -3278,7 +3278,7 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
PhotoPath = selectedProcedure.SavePath;
|
|
|
//1. 执行拍照,图像处理
|
|
|
- var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint1(selectedProcedure, images, null, null, ctsAll.Token, is3dmodel);
|
|
|
+ var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint1(selectedProcedure, images, null, null, ctsAll.Token, is3dmodel, confThreshold, iouThreshold);
|
|
|
if (visionResult.Count == 0)
|
|
|
{
|
|
|
SendTaskMessage("Count值为0", MessageLevel.Alarm);
|
|
|
@@ -3304,7 +3304,7 @@ namespace TeamAAS_VP.Core
|
|
|
//}
|
|
|
try
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
string[] strpoints1 = visionResult.Items[i].Split(',');
|
|
|
string[] body1 = strpoints1[1].Split(";");
|
|
|
|
|
|
@@ -3360,9 +3360,9 @@ namespace TeamAAS_VP.Core
|
|
|
keyData.Add(keyName, average);
|
|
|
keyData1.Add(keyName, chazhi);
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (body1.Length > 1)
|
|
|
{
|
|
|
for (int j = 1; j <= body1.Length; j++)
|
|
|
@@ -3446,9 +3446,9 @@ namespace TeamAAS_VP.Core
|
|
|
lockResultsAll.Add(lockResult1);
|
|
|
}
|
|
|
}
|
|
|
- catch (Exception ex)
|
|
|
+ catch (Exception ex)
|
|
|
{
|
|
|
- SendTaskMessage($"拆分视觉结果出错:{ex}",MessageLevel.Error);
|
|
|
+ SendTaskMessage($"拆分视觉结果出错:{ex}", MessageLevel.Error);
|
|
|
|
|
|
}
|
|
|
App.Current.Dispatcher.Invoke(() =>
|
|
|
@@ -3653,7 +3653,7 @@ namespace TeamAAS_VP.Core
|
|
|
if (cameras is TeamAAS_VP.Core.Cameras.SSZNCamera sszn)
|
|
|
{
|
|
|
sszn.CameraRevFinish = false;
|
|
|
- sszn.SetProducts(CameraNum,points);
|
|
|
+ sszn.SetProducts(CameraNum, points);
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
@@ -3725,7 +3725,7 @@ namespace TeamAAS_VP.Core
|
|
|
if (!stationConfig.EnableMES || !stationConfig.EnableDoubleMes || !stationConfig.SaveCsv)
|
|
|
{
|
|
|
mesStatus = false;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -3818,10 +3818,10 @@ namespace TeamAAS_VP.Core
|
|
|
// ==============================================
|
|
|
// 第一行:ESC + F1~F12
|
|
|
// ==============================================
|
|
|
- ["ESC"] = new List<string> { "F1", "~", },
|
|
|
+ ["ESC"] = new List<string> { "F1", "~", },
|
|
|
["F1"] = new List<string> { "ESC", "F2", "1" },
|
|
|
- ["F2"] = new List<string> { "F1", "F3", "2" },
|
|
|
- ["F3"] = new List<string> { "F2", "F4", "2", "3"},
|
|
|
+ ["F2"] = new List<string> { "F1", "F3", "2" },
|
|
|
+ ["F3"] = new List<string> { "F2", "F4", "2", "3" },
|
|
|
["F4"] = new List<string> { "F3", "F5", "3", "4" },
|
|
|
["F5"] = new List<string> { "F4", "F6", "4", "5" },
|
|
|
["F6"] = new List<string> { "F5", "F7", "5", "6" },
|
|
|
@@ -3832,24 +3832,24 @@ namespace TeamAAS_VP.Core
|
|
|
["F11"] = new List<string> { "F10", "F12", "0", "-" },
|
|
|
["F12"] = new List<string> { "F11", "-", "=", "Insert" },
|
|
|
["Insert"] = new List<string> { "F12", "Power", "Backspace" },
|
|
|
- ["Power"] = new List<string> {"Backspace" },
|
|
|
+ ["Power"] = new List<string> { "Backspace" },
|
|
|
|
|
|
// ==============================================
|
|
|
// 第二行:` 1 2 3 4 5 6 7 8 9 0 - = Backspace
|
|
|
// ==============================================
|
|
|
["~"] = new List<string> { "ESC", "1", "TAB" },
|
|
|
- ["1"] = new List<string> { "F1", "`", "2", "TAB", "Q" },
|
|
|
- ["2"] = new List<string> { "F2", "1", "3", "Q", "W" },
|
|
|
- ["3"] = new List<string> { "F3", "F4", "2", "4", "W", "E" },
|
|
|
- ["4"] = new List<string> { "F4", "F5", "3", "5", "E", "R" },
|
|
|
- ["5"] = new List<string> { "F5", "F6", "4", "6", "R", "T" },
|
|
|
- ["6"] = new List<string> { "F6", "F7", "5", "7", "T", "Y" },
|
|
|
- ["7"] = new List<string> { "F7", "F8", "6", "8", "Y", "U" },
|
|
|
- ["8"] = new List<string> { "F8", "F9", "7", "9", "U", "I" },
|
|
|
- ["9"] = new List<string> { "F9", "F10", "8", "0", "I", "O" },
|
|
|
- ["0"] = new List<string> { "F10", "F11", "9", "-", "O", "P" },
|
|
|
- ["-"] = new List<string> { "F11", "F12", "0", "=", "P", "{" },
|
|
|
- ["="] = new List<string> { "F12", "-", "Backspace", "{", "}" },
|
|
|
+ ["1"] = new List<string> { "F1", "`", "2", "TAB", "Q" },
|
|
|
+ ["2"] = new List<string> { "F2", "1", "3", "Q", "W" },
|
|
|
+ ["3"] = new List<string> { "F3", "F4", "2", "4", "W", "E" },
|
|
|
+ ["4"] = new List<string> { "F4", "F5", "3", "5", "E", "R" },
|
|
|
+ ["5"] = new List<string> { "F5", "F6", "4", "6", "R", "T" },
|
|
|
+ ["6"] = new List<string> { "F6", "F7", "5", "7", "T", "Y" },
|
|
|
+ ["7"] = new List<string> { "F7", "F8", "6", "8", "Y", "U" },
|
|
|
+ ["8"] = new List<string> { "F8", "F9", "7", "9", "U", "I" },
|
|
|
+ ["9"] = new List<string> { "F9", "F10", "8", "0", "I", "O" },
|
|
|
+ ["0"] = new List<string> { "F10", "F11", "9", "-", "O", "P" },
|
|
|
+ ["-"] = new List<string> { "F11", "F12", "0", "=", "P", "{" },
|
|
|
+ ["="] = new List<string> { "F12", "-", "Backspace", "{", "}" },
|
|
|
["Backspace"] = new List<string> { "Insert", "=", "}", "|", "Power" },
|
|
|
|
|
|
// ==============================================
|
|
|
@@ -3865,7 +3865,7 @@ namespace TeamAAS_VP.Core
|
|
|
["U"] = new List<string> { "Y", "6", "7", "8", "I", "H", "J" },
|
|
|
["I"] = new List<string> { "U", "7", "8", "9", "O", "J", "K" },
|
|
|
["O"] = new List<string> { "I", "8", "9", "0", "P", "K", "L" },
|
|
|
- ["P"] = new List<string> { "O", "9", "0", "-", "{", "L", ";" },
|
|
|
+ ["P"] = new List<string> { "O", "9", "0", "-", "{", "L", ";" },
|
|
|
["{"] = new List<string> { "P", "0", "-", "=", "}", ";", "'" },
|
|
|
["}"] = new List<string> { "{", "-", "=", "Backspace", "|", "'", "Enter" },
|
|
|
["|"] = new List<string> { "}", "Backspace", "Enter" },
|
|
|
@@ -3878,7 +3878,7 @@ namespace TeamAAS_VP.Core
|
|
|
["S"] = new List<string> { "A", "W", "E", "D", "Z", "X", "LeftShift" },
|
|
|
["D"] = new List<string> { "S", "E", "R", "F", "X", "C", "LeftShift" },
|
|
|
["F"] = new List<string> { "D", "R", "T", "G", "C", "V" },
|
|
|
- ["G"] = new List<string> { "F", "T", "Y", "H", "V", "B" },
|
|
|
+ ["G"] = new List<string> { "F", "T", "Y", "H", "V", "B" },
|
|
|
["H"] = new List<string> { "G", "Y", "U", "J", "B", "N" },
|
|
|
["J"] = new List<string> { "H", "U", "I", "K", "N", "M" },
|
|
|
["K"] = new List<string> { "J", "I", "O", "L", "M", "," },
|
|
|
@@ -3912,7 +3912,7 @@ namespace TeamAAS_VP.Core
|
|
|
["Alt1"] = new List<string> { "Win", "Space" },
|
|
|
["Space1"] = new List<string> { "Alt", "Alt2" },
|
|
|
["Alt2"] = new List<string> { "Space", "Ctrl2" },
|
|
|
- // ["RightFn"] = new List<string> { "RightAlt", "RightCtrl" },
|
|
|
+ // ["RightFn"] = new List<string> { "RightAlt", "RightCtrl" },
|
|
|
["Ctrl2"] = new List<string> { "Alt2", "Left", "Updown", "Right" },
|
|
|
["Left"] = new List<string> { "RightCtrl", "Updown" },
|
|
|
["Updown"] = new List<string> { "Left", "Right", "Ctrl2" },
|
|
|
@@ -4218,7 +4218,7 @@ 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)
|
|
|
{
|
|
|
// 获取当前产品
|
|
|
var currentProduct = _productService.GetCurrentProduct();
|
|
|
@@ -4267,7 +4267,7 @@ namespace TeamAAS_VP.Core
|
|
|
await _remoteCommandService.SetLightBeforePhoto(selectedProcedure);
|
|
|
}
|
|
|
//1. 执行拍照
|
|
|
- var res = await _remoteCommandService.ExecuteGrabImageAsync(selectedProcedure,Is3dPhoto);
|
|
|
+ var res = await _remoteCommandService.ExecuteGrabImageAsync(selectedProcedure, Is3dPhoto);
|
|
|
return (res.IsSucceed, res.Image, res.Msg, pointIndex, procedureId);
|
|
|
}
|
|
|
catch (Exception ex)
|