|
|
@@ -22,6 +22,7 @@ using TeamAAS_VP.Enums;
|
|
|
using TeamAAS_VP.Events;
|
|
|
using TeamAAS_VP.Interfaces;
|
|
|
using TeamAAS_VP.Models;
|
|
|
+using TeamAAS_VP.Models.PLC;
|
|
|
using TeamAAS_VP.Models.Torque;
|
|
|
using TeamAAS_VP.Resources.Languages;
|
|
|
using TouchSocket.Core;
|
|
|
@@ -1224,24 +1225,40 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
if (current.ScrewCameraPoints != null && current.ScrewCameraPoints.Count > 0)
|
|
|
{
|
|
|
+ int index = 0;
|
|
|
foreach (var item in current.ScrewCameraPoints)
|
|
|
{
|
|
|
- await item.WriteToPlcAddress(addressConfig.Out_ScrewCamera, plc);
|
|
|
+ //根据使用的点位进行排序
|
|
|
+ if (item.IsUse)
|
|
|
+ {
|
|
|
+ index++;
|
|
|
+ await item.WriteToPlcAddress(addressConfig.Out_ScrewCamera, plc, index);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if (current.ScrewPoints != null && current.ScrewPoints.Count > 0)
|
|
|
{
|
|
|
+ int index = 0;
|
|
|
foreach (var item in current.ScrewPoints)
|
|
|
{
|
|
|
- await item.WriteToPlcAddressEx(addressConfig.Out_Screw, plc);
|
|
|
+ if (item.IsUse)
|
|
|
+ {
|
|
|
+ index++;
|
|
|
+ await item.WriteToPlcAddressEx(addressConfig.Out_Screw, plc, index);
|
|
|
+ }
|
|
|
}
|
|
|
- await plc.WriteNodeAsync(addressConfig.Out_WorkNum.Address, (Int16)current.ScrewPoints.Count);
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_WorkNum.Address, (Int16)index);
|
|
|
}
|
|
|
if (current.CheckCameraPoints != null && current.CheckCameraPoints.Count > 0)
|
|
|
{
|
|
|
+ int index = 0;
|
|
|
foreach (var item in current.CheckCameraPoints)
|
|
|
{
|
|
|
- await item.WriteToPlcAddress(addressConfig.Out_CheckCamera, plc);
|
|
|
+ if (item.IsUse)
|
|
|
+ {
|
|
|
+ index++;
|
|
|
+ await item.WriteToPlcAddress(addressConfig.Out_CheckCamera, plc,index);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if (current.QrCodePoints != null && current.QrCodePoints.Count > 0)
|
|
|
@@ -1499,8 +1516,17 @@ namespace TeamAAS_VP.Core
|
|
|
//视觉流程ID
|
|
|
Guid procedureId = currentProduct.MoveDownCameraLockPhotoProcedureId;
|
|
|
|
|
|
+ List<PlcPoint> plcPoints = new List<PlcPoint>();
|
|
|
+ foreach (var item in currentProduct.ScrewCameraPoints)
|
|
|
+ {
|
|
|
+ if (item.IsUse)
|
|
|
+ {
|
|
|
+ plcPoints.Add(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//获取锁付拍照的点位
|
|
|
- var pos = currentProduct.ScrewCameraPoints.FirstOrDefault(p => p.Number == cameraIndex);
|
|
|
+ var pos = plcPoints[cameraIndex-1];
|
|
|
if (pos != null)
|
|
|
{
|
|
|
procedureId = pos.VisionProcessID;
|
|
|
@@ -1579,10 +1605,20 @@ namespace TeamAAS_VP.Core
|
|
|
Int16 cameraIndex = plc.ReadNode<Int16>(addressConfig.In_UPCameracheckNum.Address);
|
|
|
SendTaskMessage(string.Format(Lang.编号0, cameraIndex), MessageLevel.Info);
|
|
|
|
|
|
+ //获取锁付拍照的点位
|
|
|
+ List<PlcPoint> plcPoints = new List<PlcPoint>();
|
|
|
+ foreach (var item in currentProduct.CheckCameraPoints)
|
|
|
+ {
|
|
|
+ if (item.IsUse)
|
|
|
+ {
|
|
|
+ plcPoints.Add(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//视觉流程ID
|
|
|
Guid procedureId = Guid.Empty;
|
|
|
//获取锁付拍照的点位
|
|
|
- var pos = currentProduct.CheckCameraPoints.FirstOrDefault(p => p.Number == cameraIndex);
|
|
|
+ var pos = plcPoints[cameraIndex-1];
|
|
|
if (pos != null)
|
|
|
{
|
|
|
procedureId = pos.VisionProcessID;
|
|
|
@@ -1898,7 +1934,15 @@ namespace TeamAAS_VP.Core
|
|
|
//拍1打1
|
|
|
if (systemConfig.WorkMode == 1)
|
|
|
{
|
|
|
- var point = currentProduct.ScrewPoints.FirstOrDefault(p => p.Number == positionIndex);
|
|
|
+ List<PlcPoint> plcPoints = new List<PlcPoint>();
|
|
|
+ foreach (var item in currentProduct.ScrewPoints)
|
|
|
+ {
|
|
|
+ if (item.IsUse)
|
|
|
+ {
|
|
|
+ plcPoints.Add(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var point = plcPoints[positionIndex-1];
|
|
|
if (point == null)
|
|
|
{
|
|
|
SendTaskMessage($"点:{positionIndex}不存在", MessageLevel.Info);
|
|
|
@@ -1909,7 +1953,7 @@ namespace TeamAAS_VP.Core
|
|
|
point.X_Position = UpCameraPutResults[1].X + DowmCameraResults[1].X;
|
|
|
point.Y_Position = UpCameraPutResults[1].Y + DowmCameraResults[1].Y;
|
|
|
SendTaskMessage($"点:{positionIndex},{point.X_Position:F3},{point.Y_Position:F4}", MessageLevel.Info);
|
|
|
- await point.WriteToPlcAddress(addressConfig.Out_Screw, plc);
|
|
|
+ await point.WriteToPlcAddress(addressConfig.Out_Screw, plc, positionIndex);
|
|
|
}
|
|
|
//拍1打所有
|
|
|
else if (systemConfig.WorkMode == 2)
|
|
|
@@ -3264,7 +3308,7 @@ namespace TeamAAS_VP.Core
|
|
|
#endregion
|
|
|
|
|
|
#region 压缩图片文件夹
|
|
|
- public async void CompressionImage(string sourcePath, string zipname,string fixid)
|
|
|
+ public async void CompressionImage(string sourcePath, string zipname, string fixid)
|
|
|
{
|
|
|
string zipPath = "";
|
|
|
try
|