修改界面

This commit is contained in:
2025-03-12 17:18:39 +08:00
parent b8c83e459d
commit a9d02a5a9d
14 changed files with 2425 additions and 636 deletions

View File

@ -1,6 +1,7 @@
using DH.Commons.Enums;
using DH.Devices.Motion;
using MCDLL_NET;
using OpenCvSharp;
using System.Diagnostics;
using static System.Collections.Specialized.BitVector32;
@ -287,53 +288,56 @@ namespace DH.Devices.Motion
for (ushort station = 0; station < BoardCount; station++)
{
// 关闭调试测试后的位置比较
//关闭调试测试后的位置比较
for (int i = 0; i < 16; i++)
{
rtn = CMCDLL_NET.MCF_Set_Compare_Config_Net((ushort)i, 0, 0, station);
Console.WriteLine($"MCF_Set_Compare_Config_Net {i}::{rtn}");
}
// 2.配置物件设置
rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Piece_Size_Net(PieceMaxSize, PieceMinSize, station);
//2.配置物件设置
rtn = CMCDLL_NET.MCF_Sorting_Set_Piece_Size_Net(PieceMaxSize, PieceMinSize, station);
Console.WriteLine($"MCF_Sorting_Set_Piece_Size_Net::{rtn}");
rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Piece_Place_Net(MinDistance, MinTimeInterval, station);
rtn = CMCDLL_NET.MCF_Sorting_Set_Piece_Place_Net(MinDistance, MinTimeInterval, station);
Console.WriteLine($"MCF_Sorting_Set_Piece_Place_Net::{rtn}");
}
if (BoardCount < 2)
{
// rtn = CMCDLL_NET_Sorting.MCF_Sorting_Camera_Blow_Config_Net(10, 6, 0);
// 3.配置相机设置
rtn = CMCDLL_NET_Sorting.MCF_Sorting_Camera_Blow_Config_Net(10, 6, 0);
//设置来料使能 0 是默认 1是开始
//
rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Enable_Net((ushort)SortingInputSetting.BitInputNumber, 1);
//设置物件检测有效电平 0是低电平 1是高电平
rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Logic_Net((ushort)SortingInputSetting.BitInputNumber, 0);
//设置来料检测编码器 双转盘要设置两个轴
/*Bit_Input_Number设置位号。
取值: Bit_Input_0, Bit_Input_1。
Axis: 轴号。
Source跟随方式
取值0命令
1编码器(默认)
StationNumber: 站点号;*/
// rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Source_Net((ushort)IIConfig.SortingInputSetting.BitInputNumber, 0, 1);
rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Source_Net((ushort)SortingInputSetting.BitInputNumber, 1, 1);
//if (BoardCount < 2)
//{
// // rtn = CMCDLL_NET_Sorting.MCF_Sorting_Camera_Blow_Config_Net(10, 6, 0);
// // 3.配置相机设置
// rtn = CMCDLL_NET_Sorting.MCF_Sorting_Camera_Blow_Config_Net(10, 6, 0);
// //设置来料使能 0 是默认 1是开始
// //
// rtn = CMCDLL_NET.MCF_Sorting_Set_Input_Enable_Net((ushort)SortingInputSetting.BitInputNumber, 1);
// //设置物件检测有效电平 0是低电平 1是高电平
// rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Logic_Net((ushort)SortingInputSetting.BitInputNumber, 0);
// //设置来料检测编码器 双转盘要设置两个轴
// /*Bit_Input_Number设置位号。
// 取值: Bit_Input_0, Bit_Input_1。
// Axis: 轴号。
// Source跟随方式
// 取值0命令
// 1编码器(默认)
// StationNumber: 站点号;*/
// // rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Source_Net((ushort)IIConfig.SortingInputSetting.BitInputNumber, 0, 1);
// rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Source_Net((ushort)SortingInputSetting.BitInputNumber, 1, 1);
//rtn = CMCDLL_NET_Sorting.MCF_Sorting_Camera_Blow_Config_Net(
// (ushort)IIConfig.SnapshotSettings.Count,
// (ushort)IIConfig.BlowSettings.Count,
// 0);
// rtn = CMCDLL_NET_Sorting.MCF_Set_Config_Camera_Net();
//为防止转盘第二个盘不触发拍照 设置一键取反功能
}
// //rtn = CMCDLL_NET_Sorting.MCF_Sorting_Camera_Blow_Config_Net(
// // (ushort)IIConfig.SnapshotSettings.Count,
// // (ushort)IIConfig.BlowSettings.Count,
// // 0);
// // rtn = CMCDLL_NET_Sorting.MCF_Set_Config_Camera_Net();
// //为防止转盘第二个盘不触发拍照 设置一键取反功能
//}
// 3.配置相机设置
ConfigCamera();
// 4.配置气阀
ConfigBlow();
// ConfigBlow();
@ -345,54 +349,33 @@ namespace DH.Devices.Motion
for (ushort card = 0; card < cardCount; card++)
{
//IIConfig.SortingInputSettings.ForEach(sortingInputSetting =>
//5.开启筛选
rtn = CMCDLL_NET.MCF_Sorting_Start_Net(0, card);
if (rtn != (short)0)
{
// LogAsync(DateTime.Now, LogLevel.Warning, $"卡{station}开启筛选异常ret{rtn}");
}
//if (cardCount < 2)
//{
// var camStart = 0;
// if (sortingInputSetting.EnableBindCamera)
// {
// camStart = sortingInputSetting.CameraStartNumber;
// }
// var blowStart = 0;
// if (sortingInputSetting.EnableBindBlow)
// {
// blowStart = sortingInputSetting.BlowStartNumber;
// }
// var b = (ushort)sortingInputSetting.BitInputNumber;
// //var ret = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Bind_Net(b,
// // (ushort)camStart,
// // (ushort)blowStart,
// // card);
// var ret = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Bind_Net(1,
// 1,
// 2,
// // 最小值 1 2 2
// var ret = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Bind_Net(
// (ushort)SortingInputSetting.BitInputNumber, // 1
// SortingInputSetting.CameraStartNumber, // 7,
// SortingInputSetting.BlowStartNumber, // 2,
// card);
//});
// CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Source_Net();
if (cardCount < 2)
{
// 最小值 1 2 2
var ret = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Bind_Net(
(ushort)SortingInputSetting.BitInputNumber, // 1
SortingInputSetting.CameraStartNumber, // 7,
SortingInputSetting.BlowStartNumber, // 2,
card);
//}
}
for (ushort station = 0; station < cardCount; station++)
{
// 5.开启筛选
//开启自动筛选功能
rtn = CMCDLL_NET_Sorting.MCF_Sorting_Start_Net(0, station);
if (rtn != (short)FuncRet.Function_Success)
{
//LogAsync(DateTime.Now, LogLevel.Warning, $"卡{card}开启筛选异常ret{rtn}");
}
}
//for (ushort station = 0; station < cardCount; station++)
//{
// // 5.开启筛选
// //开启自动筛选功能
// rtn = CMCDLL_NET_Sorting.MCF_Sorting_Start_Net(0, station);
// if (rtn != (short)FuncRet.Function_Success)
// {
// //LogAsync(DateTime.Now, LogLevel.Warning, $"卡{card}开启筛选异常ret{rtn}");
// }
//}
}
}
@ -419,6 +402,7 @@ namespace DH.Devices.Motion
public override void Stop()
{
isconnected = false;
//base.Stop();
AxisStop();
int ret = CMCDLL_NET.MCF_Set_Servo_Enable_Net(0, (ushort)ServoLogic.Servo_Open, 0);
@ -636,7 +620,7 @@ namespace DH.Devices.Motion
// 初始化
for (ushort station = 0; station < BoardCount; station++)
{
ret = CMCDLL_NET_Sorting.MCF_Sorting_Init_Net(station);
ret = CMCDLL_NET.MCF_Sorting_Init_Net(station);
stations.Add(station);
cardTypes.Add(2);
}
@ -658,8 +642,8 @@ namespace DH.Devices.Motion
{
}
MCF_Screen_Set_Trigger1();
MCF_Screen_Set_Trigger1(1);
//MCF_Screen_Set_Trigger1();
// MCF_Screen_Set_Trigger1(1);
}
@ -1859,7 +1843,7 @@ namespace DH.Devices.Motion
continue;
}
var rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Trig_Camera_Delay_Count_Net(i,
var rtn = CMCDLL_NET.MCF_Sorting_Set_Trig_Camera_Delay_Count_Net(i,
camSetting.CameraDelayCountMS, camSetting.StationNumber);
@ -1894,7 +1878,7 @@ namespace DH.Devices.Motion
}
else
{
rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Camera_Net(
rtn = CMCDLL_NET.MCF_Sorting_Set_Camera_Net(
i, // CCD0
CameraPositionReal,
RotationDirectionReal,
@ -2004,23 +1988,31 @@ namespace DH.Devices.Motion
switch (blowSetting.BlowType)
{
case BlowType.OK:
CMCDLL_NET_Sorting.MCF_Sorting_Set_Blow_OK_Net(CameraPositionReal, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)ioIndex, blowSetting.StationNumber);
CMCDLL_NET.MCF_Sorting_Set_Blow_OK_Net(CameraPositionReal, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)ioIndex, blowSetting.StationNumber);
break;
case BlowType.NG:
CMCDLL_NET_Sorting.MCF_Sorting_Set_Blow_NG_Net(CameraPositionReal, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)ioIndex, blowSetting.StationNumber);
CMCDLL_NET.MCF_Sorting_Set_Blow_NG_Net(CameraPositionReal, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)ioIndex, blowSetting.StationNumber);
break;
case BlowType.Blow1:
CMCDLL_NET_Sorting.MCF_Sorting_Set_Blow_Net(1, CameraPositionReal, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)ioIndex, blowSetting.StationNumber);
CMCDLL_NET.MCF_Sorting_Set_Blow_1_Net(blowSetting.BlowPosition, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)blowSetting.BlowIO.IOIndex, blowSetting.StationNumber);
break;
///第一路绑定OK NG 吹起口1
case BlowType.Blow2:
CMCDLL_NET_Sorting.MCF_Sorting_Set_Blow_Net(2, CameraPositionReal, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)ioIndex, blowSetting.StationNumber);
CMCDLL_NET.MCF_Sorting_Set_Blow_2_Net(blowSetting.BlowPosition, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)blowSetting.BlowIO.IOIndex, blowSetting.StationNumber);
break;
case BlowType.Blow3:
CMCDLL_NET_Sorting.MCF_Sorting_Set_Blow_Net(3, CameraPositionReal, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)ioIndex, blowSetting.StationNumber);
CMCDLL_NET.MCF_Sorting_Set_Blow_3_Net(blowSetting.BlowPosition, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)blowSetting.BlowIO.IOIndex, blowSetting.StationNumber);
break;
case BlowType.Blow4:
CMCDLL_NET_Sorting.MCF_Sorting_Set_Blow_Net(4, CameraPositionReal, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)ioIndex, blowSetting.StationNumber);
CMCDLL_NET.MCF_Sorting_Set_Blow_4_Net(blowSetting.BlowPosition, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)blowSetting.BlowIO.IOIndex, blowSetting.StationNumber);
break;
case BlowType.Blow5:
CMCDLL_NET.MCF_Sorting_Set_Blow_5_Net(blowSetting.BlowPosition, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)blowSetting.BlowIO.IOIndex, blowSetting.StationNumber);
break;
case BlowType.Blow6:
CMCDLL_NET.MCF_Sorting_Set_Blow_6_Net(blowSetting.BlowPosition, (ushort)rotationDirectionEnum, (ushort)blowSetting.ActionMode, (ushort)blowSetting.BlowIO.IOIndex, blowSetting.StationNumber);
break;
default:
break;
//case BlowType.OK:
// CMCDLL_NET_Sorting.MCF_Sorting_Set_Blow_OK_Net(setting.BlowPosition, (ushort)IIConfig.MotionDir, (ushort)setting.ActionMode, (ushort)setting.BlowIO.IOIndex, setting.StationNumber);
@ -2047,8 +2039,7 @@ namespace DH.Devices.Motion
//case BlowType.Blow6:
// CMCDLL_NET_Sorting.MCF_Sorting_Set_Blow_6_Net(setting.BlowPosition, (ushort)IIConfig.MotionDir, (ushort)setting.ActionMode, (ushort)setting.BlowIO.IOIndex, setting.StationNumber);
// break;
default:
break;
}
}