|
|
@@ -1499,8 +1499,17 @@ namespace TeamAAS_VP.Core
|
|
|
var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint(process, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token, null);
|
|
|
if (visionResult.IsSucceed)
|
|
|
{
|
|
|
- UpCameraPutResults[cameraIndex] = new PointF((float)visionResult.X, (float)visionResult.Y);
|
|
|
-
|
|
|
+ //是拍一个锁一个还是拍两个点锁所有
|
|
|
+ var systemConfig = _configService.GetSystemConfiguration();
|
|
|
+ //拍1打1
|
|
|
+ if (systemConfig.WorkMode == 1)
|
|
|
+ {
|
|
|
+ UpCameraPutResults[1] = new PointF((float)visionResult.X, (float)visionResult.Y);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ UpCameraPutResults[cameraIndex] = new PointF((float)visionResult.X, (float)visionResult.Y);
|
|
|
+ }
|
|
|
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_UpCameraPutStatus.Address, (Int16)1);
|
|
|
}
|
|
|
@@ -1765,17 +1774,17 @@ namespace TeamAAS_VP.Core
|
|
|
//吸嘴数量+1
|
|
|
NumStatistics.NozzleNum = await _systemDatabaseService.IncrementLatestNozzleLockCountAsync(currentUserName);
|
|
|
|
|
|
-
|
|
|
- await plc.WriteNodeAsync(addressConfig.In_WorkDone.Address, (Int16)0);
|
|
|
- // 停止采集压力并保存
|
|
|
- await StopAndSavePressureCollectionAsync(currentProduct.Name, _productService.CurrentProductCode, positionIndex);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- SendTaskMessage(Lang.停止锁付信号已关闭, MessageLevel.Alarm);
|
|
|
+
|
|
|
+ await plc.WriteNodeAsync(addressConfig.In_WorkDone.Address, (Int16)0);
|
|
|
+ // 停止采集压力并保存
|
|
|
+ await StopAndSavePressureCollectionAsync(currentProduct.Name, _productService.CurrentProductCode, positionIndex);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ SendTaskMessage(Lang.停止锁付信号已关闭, MessageLevel.Alarm);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
// 多相机坐标合并
|
|
|
else if (addressConfig.In_RequestPosition.Address.Contains(tuple.nodeId))
|
|
|
{
|
|
|
@@ -1792,14 +1801,17 @@ namespace TeamAAS_VP.Core
|
|
|
if (state == 1)
|
|
|
{
|
|
|
SendTaskMessage(Lang.收到多相机坐标合并请求开始合并, MessageLevel.Debug);
|
|
|
+ //位置编号
|
|
|
+ Int16 positionIndex = plc.ReadNode<Int16>(addressConfig.In_ProductNum.Address);
|
|
|
//是拍一个锁一个还是拍两个点锁所有
|
|
|
var systemConfig = _configService.GetSystemConfiguration();
|
|
|
//拍1打1
|
|
|
if (systemConfig.WorkMode == 1)
|
|
|
{
|
|
|
- currentProduct.ScrewPoints[0].X_Position = UpCameraPutResults[1].X + DowmCameraResults[0].X;
|
|
|
- currentProduct.ScrewPoints[0].Y_Position = UpCameraPutResults[1].Y + DowmCameraResults[0].Y;
|
|
|
- await currentProduct.ScrewPoints[0].WriteToPlcAddress(addressConfig.Out_Screw, plc);
|
|
|
+ var point = currentProduct.ScrewPoints[positionIndex-1].Clone();
|
|
|
+ point.X_Position = UpCameraPutResults[1].X + DowmCameraResults[1].X;
|
|
|
+ point.Y_Position = UpCameraPutResults[1].Y + DowmCameraResults[1].Y;
|
|
|
+ await point.WriteToPlcAddress(addressConfig.Out_Screw, plc);
|
|
|
}
|
|
|
//拍1打所有
|
|
|
else if (systemConfig.WorkMode == 2)
|
|
|
@@ -1867,7 +1879,7 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 过站检查
|
|
|
else
|
|
|
{
|
|
|
@@ -1932,7 +1944,6 @@ namespace TeamAAS_VP.Core
|
|
|
swCT.Stop();
|
|
|
CTtime = Math.Round(swCT.Elapsed.TotalSeconds, 3);
|
|
|
WriteProductLog(lockResultsAll, code, CTtime);
|
|
|
- lockResultsAll.Clear();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -1970,7 +1981,7 @@ namespace TeamAAS_VP.Core
|
|
|
/// <param name="productName">配方名称</param>
|
|
|
/// <param name="productCode">产品编号</param>
|
|
|
/// <param name="positionIndex">锁付点编号</param>
|
|
|
- private void StartPressureCollection(string productName,string productCode, int positionIndex)
|
|
|
+ private void StartPressureCollection(string productName, string productCode, int positionIndex)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
@@ -2016,7 +2027,7 @@ namespace TeamAAS_VP.Core
|
|
|
if (_pressureTimeoutCts.IsCancellationRequested && !_pressureCts.IsCancellationRequested)
|
|
|
{
|
|
|
SendTaskMessage("Pressure collection timed out, saving collected data.", MessageLevel.Alarm);
|
|
|
- await StopAndSavePressureCollectionAsync(productName, productCode,positionIndex);
|
|
|
+ await StopAndSavePressureCollectionAsync(productName, productCode, positionIndex);
|
|
|
}
|
|
|
}, token);
|
|
|
}
|
|
|
@@ -2164,7 +2175,7 @@ namespace TeamAAS_VP.Core
|
|
|
/// 产品锁付记录进行存储
|
|
|
/// </summary>
|
|
|
/// <param name="result">结果</param>
|
|
|
- public void WriteProductLog(List<LockResult> lockResults,string rfid,double ct)
|
|
|
+ public void WriteProductLog(List<LockResult> lockResults, string rfid, double ct)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
@@ -2183,7 +2194,7 @@ namespace TeamAAS_VP.Core
|
|
|
string path = $"E:\\Data\\生产数据\\{dt.ToString("yyyy-MM")}\\{dt.ToString("yyyy-MM-dd")}.csv";
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
//具体的ct需要优化
|
|
|
- sb.Append($"{dt.ToString("yyyy-MM-dd HH:mm:ss")},{lockResults[0].ProductName},{Math.Round(ct, 3)},{rfid},{result},{lockResults[number-1].NozzleNumber},{lockResults[number - 1].HeadNumber},");
|
|
|
+ sb.Append($"{dt.ToString("yyyy-MM-dd HH:mm:ss")},{lockResults[0].ProductName},{Math.Round(ct, 3)},{rfid},{result},{lockResults[number - 1].NozzleNumber},{lockResults[number - 1].HeadNumber},");
|
|
|
foreach (var item in lockResults)
|
|
|
{
|
|
|
try
|
|
|
@@ -2230,6 +2241,8 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
|
LogHelper.WriteLogError("写入产品记录时出错!", ex);
|
|
|
}
|
|
|
+
|
|
|
+ lockResultsAll.Clear();
|
|
|
}
|
|
|
#endregion
|
|
|
|