|
@@ -1,5 +1,7 @@
|
|
|
using Cognex.VisionPro;
|
|
using Cognex.VisionPro;
|
|
|
using CSScripting;
|
|
using CSScripting;
|
|
|
|
|
+using NPOI.Util;
|
|
|
|
|
+
|
|
|
//using ICSharpCode.SharpZipLib.Zip;
|
|
//using ICSharpCode.SharpZipLib.Zip;
|
|
|
using Prism.Events;
|
|
using Prism.Events;
|
|
|
using Prism.Ioc;
|
|
using Prism.Ioc;
|
|
@@ -2234,7 +2236,8 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
{
|
|
|
if (item.IsSucceed)
|
|
if (item.IsSucceed)
|
|
|
{
|
|
{
|
|
|
- _PrcTaskList.Add(ExecuteProcedureAsync(item.cameraIndex, item.procedureId, item.Images));
|
|
|
|
|
|
|
+ bool Is3d = Is3D(item.procedureId);
|
|
|
|
|
+ _PrcTaskList.Add(ExecuteProcedureAsync(item.cameraIndex, item.procedureId, item.Images, Is3d));
|
|
|
//_PrcTaskList.Add(ExecuteProcedureAsync(cameraIndex, prcId, imageData.imges));
|
|
//_PrcTaskList.Add(ExecuteProcedureAsync(cameraIndex, prcId, imageData.imges));
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
@@ -2520,6 +2523,18 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
{
|
|
|
foreach (var item in lockResultsAll)
|
|
foreach (var item in lockResultsAll)
|
|
|
{
|
|
{
|
|
|
|
|
+ for (int k = 1; k <=8; k++)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (item.PhotoName == "-"+"_"+k.ToString())
|
|
|
|
|
+ {
|
|
|
|
|
+ item.PhotoName = "'-" + "_" + k.ToString();
|
|
|
|
|
+ }
|
|
|
|
|
+ if (item.PhotoName == "=" + "_" + k.ToString())
|
|
|
|
|
+ {
|
|
|
|
|
+ item.PhotoName = "'=" + "_" + k.ToString();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
DFC.Add(new DataFormCtq
|
|
DFC.Add(new DataFormCtq
|
|
|
{
|
|
{
|
|
|
PPID = ppid,
|
|
PPID = ppid,
|
|
@@ -2555,30 +2570,33 @@ namespace TeamAAS_VP.Core
|
|
|
//上传数据
|
|
//上传数据
|
|
|
try
|
|
try
|
|
|
{
|
|
{
|
|
|
- DateTime dt = DateTime.Now;
|
|
|
|
|
- string filename = $"{ProductMainSN}_{dt.ToString("yyyyMMddHHmmss")}";
|
|
|
|
|
- var device = _configService.GetDeviceInfo();
|
|
|
|
|
- (bool isSuc, string resp) = await _mesService.SendFtpFileAsync(ProductMainSN, filename);
|
|
|
|
|
- if (isSuc)
|
|
|
|
|
- {
|
|
|
|
|
- LogHelper.WriteLogMes($"上传数据成功");
|
|
|
|
|
- SendTaskMessage($"上传数据成功", MessageLevel.Debug);
|
|
|
|
|
- string filePath = $"D:\\Image\\Recored\\{dt.ToString("yyyy-MM")}\\{dt.ToString("MM-dd")}\\{currentProduct.Name}\\{ProductMainSN[i]}";
|
|
|
|
|
- //复制csv
|
|
|
|
|
- string source_csv = $"{stationConfig.SaveCsvPath}\\{dt.ToString("yyyy-MM")}\\{i}_{stationConfig.DeviceName}_{dt.ToString("yyyy-MM-dd")}.csv";
|
|
|
|
|
- string target_csv = Path.Combine(filePath, Path.GetFileName(source_csv)); ;
|
|
|
|
|
- File.Copy(source_csv, target_csv, true);
|
|
|
|
|
- //复制log
|
|
|
|
|
- string source_log = $"..\\Log\\LogInfo\\{dt.ToString("yyyy-MM")}\\{dt.ToString("yyyy-MM-dd")}.txt";
|
|
|
|
|
- string target_log = Path.Combine(filePath, Path.GetFileName(source_log));
|
|
|
|
|
- File.Copy(source_log, target_log, true);
|
|
|
|
|
- CompressionImage(filePath, filename, device.Station, device.FixtureId);
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
|
|
+ if (stationConfig.EnableMES)
|
|
|
{
|
|
{
|
|
|
- LogHelper.WriteLogMes($"上传数据失败");
|
|
|
|
|
- SendTaskMessage($"上传数据失败", MessageLevel.Error);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ DateTime dt = DateTime.Now;
|
|
|
|
|
+ string filename = $"{ProductMainSN}_{dt.ToString("yyyyMMddHHmmss")}";
|
|
|
|
|
+ var device = _configService.GetDeviceInfo();
|
|
|
|
|
+ (bool isSuc, string resp) = await _mesService.SendFtpFileAsync(ProductMainSN, filename);
|
|
|
|
|
+ if (isSuc)
|
|
|
|
|
+ {
|
|
|
|
|
+ LogHelper.WriteLogMes($"上传数据成功");
|
|
|
|
|
+ SendTaskMessage($"上传数据成功", MessageLevel.Debug);
|
|
|
|
|
+ string filePath = $"D:\\Image\\Recored\\{dt.ToString("yyyy-MM")}\\{dt.ToString("MM-dd")}\\{currentProduct.Name}\\{ProductMainSN[i]}";
|
|
|
|
|
+ //复制csv
|
|
|
|
|
+ string source_csv = $"{stationConfig.SaveCsvPath}\\{dt.ToString("yyyy-MM")}\\{i}_{stationConfig.DeviceName}_{dt.ToString("yyyy-MM-dd")}.csv";
|
|
|
|
|
+ string target_csv = Path.Combine(filePath, Path.GetFileName(source_csv)); ;
|
|
|
|
|
+ File.Copy(source_csv, target_csv, true);
|
|
|
|
|
+ //复制log
|
|
|
|
|
+ string source_log = $"..\\Log\\LogInfo\\{dt.ToString("yyyy-MM")}\\{dt.ToString("yyyy-MM-dd")}.txt";
|
|
|
|
|
+ string target_log = Path.Combine(filePath, Path.GetFileName(source_log));
|
|
|
|
|
+ File.Copy(source_log, target_log, true);
|
|
|
|
|
+ CompressionImage(filePath, filename, device.Station, device.FixtureId);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ LogHelper.WriteLogMes($"上传数据失败");
|
|
|
|
|
+ SendTaskMessage($"上传数据失败", MessageLevel.Error);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
|
{
|
|
{
|
|
@@ -2793,7 +2811,7 @@ namespace TeamAAS_VP.Core
|
|
|
/// <param name="pointIndex"></param>
|
|
/// <param name="pointIndex"></param>
|
|
|
/// <param name="procedureId"></param>
|
|
/// <param name="procedureId"></param>
|
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
|
- private Task<(bool IsSucceed, bool[] Result, string Message)> ExecuteProcedureAsync(int pointIndex, Guid procedureId, ICogImage[] images)
|
|
|
|
|
|
|
+ private Task<(bool IsSucceed, bool[] Result, string Message)> ExecuteProcedureAsync(int pointIndex, Guid procedureId, ICogImage[] images,bool is3dmodel)
|
|
|
{
|
|
{
|
|
|
return Task.Run(async () =>
|
|
return Task.Run(async () =>
|
|
|
{
|
|
{
|
|
@@ -2848,7 +2866,7 @@ namespace TeamAAS_VP.Core
|
|
|
await _remoteCommandService.TurnOffLightAfterPhoto(selectedProcedure);
|
|
await _remoteCommandService.TurnOffLightAfterPhoto(selectedProcedure);
|
|
|
}
|
|
}
|
|
|
//1. 执行拍照,图像处理
|
|
//1. 执行拍照,图像处理
|
|
|
- var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint1(selectedProcedure, images, null, null, ctsAll.Token);
|
|
|
|
|
|
|
+ var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint1(selectedProcedure, images, null, null, ctsAll.Token,is3dmodel);
|
|
|
if (visionResult.Count == 0)
|
|
if (visionResult.Count == 0)
|
|
|
{
|
|
{
|
|
|
SendTaskMessage("Count值为0", MessageLevel.Alarm);
|
|
SendTaskMessage("Count值为0", MessageLevel.Alarm);
|
|
@@ -2856,43 +2874,45 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//2. 结果分析
|
|
//2. 结果分析
|
|
|
- for (int i = 1; i <= visionResult.Count; i++)
|
|
|
|
|
|
|
+ lock (_stateLock)
|
|
|
{
|
|
{
|
|
|
|
|
+ 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();
|
|
|
|
|
- // }
|
|
|
|
|
-
|
|
|
|
|
- //}
|
|
|
|
|
|
|
+ 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)
|
|
|
|
|
- {
|
|
|
|
|
- for (int j = 1; j <= body1.Length; j++)
|
|
|
|
|
|
|
+ //}
|
|
|
|
|
+
|
|
|
|
|
+ string[] strpoints1 = visionResult.Items[i].Split(',');
|
|
|
|
|
+ string[] body1 = strpoints1[1].Split(";");
|
|
|
|
|
+ if (body1.Length > 1)
|
|
|
{
|
|
{
|
|
|
- lockResult1.PhotoName = strpoints1[0] + j.ToString();
|
|
|
|
|
- lockResult1.ResultData = body1[j - 1];
|
|
|
|
|
- lockResult1.PhotoCode = ProductMainSN;
|
|
|
|
|
- var globalParam = currentProduct.GlobalParamListCollection.FirstOrDefault(p => p.Name == strpoints1[0]);
|
|
|
|
|
- if (globalParam != null)
|
|
|
|
|
|
|
+ for (int j = 1; j <= body1.Length; j++)
|
|
|
{
|
|
{
|
|
|
- lockResult1.UpLimit = globalParam.Param1;
|
|
|
|
|
- lockResult1.DownLimit = globalParam.Param2;
|
|
|
|
|
- lockResult1.MidLimit = globalParam.Param5;
|
|
|
|
|
- string ResData = strpoints1[1];
|
|
|
|
|
- if (ResData.Contains("NA"))
|
|
|
|
|
|
|
+ lockResult1.PhotoName = strpoints1[0] + "_" + j.ToString();
|
|
|
|
|
+ lockResult1.ResultData = body1[j - 1];
|
|
|
|
|
+ lockResult1.PhotoCode = ProductMainSN;
|
|
|
|
|
+ var globalParam = currentProduct.GlobalParamListCollection.FirstOrDefault(p => p.Name == strpoints1[0]);
|
|
|
|
|
+ if (globalParam != null)
|
|
|
{
|
|
{
|
|
|
- ResData = "-1000";
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- bool resultflog = true;
|
|
|
|
|
- if (Convert.ToDouble(lockResult1.ResultData) >= Convert.ToDouble(globalParam.Param2) && Convert.ToDouble(lockResult1.ResultData) <= Convert.ToDouble(globalParam.Param1))
|
|
|
|
|
|
|
+ lockResult1.UpLimit = globalParam.Param1;
|
|
|
|
|
+ lockResult1.DownLimit = globalParam.Param2;
|
|
|
|
|
+ lockResult1.MidLimit = globalParam.Param5;
|
|
|
|
|
+ string ResData = body1[j - 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))
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -2900,25 +2920,23 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
{
|
|
|
resultflog = false;
|
|
resultflog = false;
|
|
|
}
|
|
}
|
|
|
- if (resultflog)
|
|
|
|
|
- {
|
|
|
|
|
- lockResult1.PhotoPassed = "OK";
|
|
|
|
|
- results.Add(true);
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- lockResult1.PhotoPassed = "NG";
|
|
|
|
|
- results.Add(false);
|
|
|
|
|
|
|
+ if (resultflog)
|
|
|
|
|
+ {
|
|
|
|
|
+ lockResult1.PhotoPassed = "OK";
|
|
|
|
|
+ results.Add(true);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ lockResult1.PhotoPassed = "NG";
|
|
|
|
|
+ results.Add(false);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- lock (_stateLock)
|
|
|
|
|
- {
|
|
|
|
|
- lockResultsAll.Add(lockResult1);
|
|
|
|
|
|
|
+ lockResultsAll.Add(lockResult1.Copy());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
lockResult1.PhotoName = strpoints1[0];
|
|
lockResult1.PhotoName = strpoints1[0];
|
|
|
lockResult1.ResultData = strpoints1[1];
|
|
lockResult1.ResultData = strpoints1[1];
|
|
|
lockResult1.PhotoCode = ProductMainSN;
|
|
lockResult1.PhotoCode = ProductMainSN;
|
|
@@ -2935,7 +2953,7 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
bool resultflog = true;
|
|
bool resultflog = true;
|
|
|
- if (Convert.ToDouble(lockResult1.ResultData) >= Convert.ToDouble(globalParam.Param2) && Convert.ToDouble(lockResult1.ResultData) <= Convert.ToDouble(globalParam.Param1))
|
|
|
|
|
|
|
+ if (Convert.ToDouble(ResData) >= Convert.ToDouble(globalParam.Param2) && Convert.ToDouble(ResData) <= Convert.ToDouble(globalParam.Param1))
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -2954,17 +2972,16 @@ namespace TeamAAS_VP.Core
|
|
|
results.Add(false);
|
|
results.Add(false);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- lock (_stateLock)
|
|
|
|
|
- {
|
|
|
|
|
- lockResultsAll.Add(lockResult1);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ lockResultsAll.Add(lockResult1);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
App.Current.Dispatcher.Invoke(() =>
|
|
App.Current.Dispatcher.Invoke(() =>
|
|
|
{
|
|
{
|
|
|
_eventAggregator.GetEvent<LockFinishNotification>().Publish(lockResult1);
|
|
_eventAggregator.GetEvent<LockFinishNotification>().Publish(lockResult1);
|
|
|
});
|
|
});
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
|
|
|
////排序
|
|
////排序
|
|
|
//lock (_stateLock)
|
|
//lock (_stateLock)
|