步进电机 挡料地
This commit is contained in:
@ -694,6 +694,14 @@ namespace DHSoftware
|
||||
cam.CameraName = cameraBase.CameraName;
|
||||
cam.CameraIP = cameraBase.CameraIP;
|
||||
cam.IsEnabled = cameraBase.IsEnabled;
|
||||
cam.IsZoomCamera = cameraBase.IsZoomCamera;
|
||||
cam.Exposure = cameraBase.Exposure;
|
||||
cam.Gain = cameraBase.Gain;
|
||||
cam.RotateImage = cameraBase.RotateImage;
|
||||
cam.ROIX= cameraBase.ROIX;
|
||||
cam.ROIH= cameraBase.ROIH;
|
||||
cam.ROIW= cameraBase.ROIW;
|
||||
cam.ROIY=cameraBase.ROIY;
|
||||
cam.ImageSaveDirectory = Path.Combine("D://Projects", cameraBase.CameraName);
|
||||
Cameras.Add(cam);
|
||||
if (cameraBase.IsEnabled)
|
||||
@ -1215,120 +1223,127 @@ namespace DHSoftware
|
||||
|
||||
private void StartProcess()
|
||||
{
|
||||
BatchNO = textBoxBatchNO.Text;
|
||||
textBoxBatchNO.ReadOnly = true;
|
||||
btnCreateBatchNO.Enabled = false;
|
||||
PrepareBatchNO();//生成批次号
|
||||
ProcessstartTime = DateTime.Now;
|
||||
lblStartTime.Text = ProcessstartTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
//计数清零
|
||||
PieceCount = 0;
|
||||
|
||||
//CameraSummaries.Clear();
|
||||
|
||||
if (PLC?.Enable == true)
|
||||
try
|
||||
{
|
||||
PLC.OnNewPieces -= MainMotion_NewPieces;
|
||||
PLC.OnNewPieces += MainMotion_NewPieces;
|
||||
}
|
||||
|
||||
Cameras.ForEach(d =>
|
||||
{
|
||||
if (d is CameraBase cam)
|
||||
|
||||
BatchNO = textBoxBatchNO.Text;
|
||||
textBoxBatchNO.ReadOnly = true;
|
||||
btnCreateBatchNO.Enabled = false;
|
||||
PrepareBatchNO();//生成批次号
|
||||
ProcessstartTime = DateTime.Now;
|
||||
lblStartTime.Text = ProcessstartTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
//计数清零
|
||||
PieceCount = 0;
|
||||
|
||||
//CameraSummaries.Clear();
|
||||
|
||||
if (PLC?.Enable == true)
|
||||
{
|
||||
cam.SnapshotCount = 0;
|
||||
PLC.OnNewPieces -= MainMotion_NewPieces;
|
||||
PLC.OnNewPieces += MainMotion_NewPieces;
|
||||
}
|
||||
});
|
||||
|
||||
//PrepareBatchNO();
|
||||
// isInPositionChecking = false;
|
||||
//isFullTrayChecking = false;
|
||||
//队列清空
|
||||
// var temp = new List<ITriggerSet>();
|
||||
// temp.AddRange(XKRSPLCConfig.TriggerConfigCollection);
|
||||
// temp.AddRange(XKRSPLCConfig.SnapshotTriggerConfigCollection);
|
||||
|
||||
//temp.ForEach(t =>
|
||||
//{
|
||||
// var diskInfo = XKRSPLCConfig.DiskInfoList.FirstOrDefault(u => u.DiskName == t.DiskName);
|
||||
// if (diskInfo != null)
|
||||
// {
|
||||
// t.AxisNum = diskInfo.DiskAxisNum;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// t.AxisNum = -1;
|
||||
// }
|
||||
//});
|
||||
|
||||
//if (temp.Any(u => u.AxisNum < 0))
|
||||
//{
|
||||
// LogAsync(DateTime.Now, LogLevel.Error, "触发信号归属转盘未确认");
|
||||
// return new ProcessResponse(false);
|
||||
//}
|
||||
|
||||
// _diskInfoListInOrder = XKRSPLCConfig.DiskInfoList.OrderBy(u => u.DiskSequence).ToList();
|
||||
// var axisNumList = _diskInfoListInOrder.Select(u => u.DiskAxisNum).ToList();
|
||||
|
||||
/// PrepareMLEngine();
|
||||
|
||||
// if (_PLCConfig?.Enable == true)
|
||||
//挡料电机操作
|
||||
// _PLC.FeedingMotor(_PLCConfig.CunToZeroSpeed, _PLCConfig.CunPos, _PLCConfig.CunSpeed, _PLCConfig.CunDirection);
|
||||
|
||||
//流程开启操作配置
|
||||
// ProcessInitialAction();
|
||||
// if (_PLC?Enabled == true)
|
||||
//皮带
|
||||
// _PLC.Belt(true);
|
||||
|
||||
//DeviceCollection.ForEach(d =>
|
||||
//{
|
||||
// if (d is CameraBase c)
|
||||
// {
|
||||
// c.OnHImageOutput -= OnCameraHImageOutput;
|
||||
// c.OnHImageOutput += OnCameraHImageOutput;
|
||||
// c.SnapshotCount = 0;
|
||||
// }
|
||||
//});
|
||||
_productLists.Clear();
|
||||
|
||||
#region 虚拟相机
|
||||
|
||||
//mOfflineImageTimer = new System.Timers.Timer();
|
||||
|
||||
//mOfflineImageTimer.Elapsed += OnEmitSerialPortAsync;
|
||||
//mOfflineImageTimer.Interval = 1000;
|
||||
//mOfflineImageTimer.Start();
|
||||
|
||||
#endregion 虚拟相机
|
||||
|
||||
var settings = _visionEngine.DetectionConfigs.Where(u => u.IsEnabled && u.IsAddStation).ToList();
|
||||
if (settings != null)
|
||||
{
|
||||
settings = settings.Where(s => s.IsEnabled).ToList();
|
||||
ProductBaseCount = settings.Count;
|
||||
|
||||
for (int i = 0; i < ProductBaseCount * ProductListMulti; i++)
|
||||
Cameras.ForEach(d =>
|
||||
{
|
||||
ConcurrentDictionary<uint, ProductData> products = new ConcurrentDictionary<uint, ProductData>();
|
||||
_productLists.Add(products);
|
||||
if (d is CameraBase cam)
|
||||
{
|
||||
cam.SnapshotCount = 0;
|
||||
}
|
||||
});
|
||||
|
||||
//PrepareBatchNO();
|
||||
// isInPositionChecking = false;
|
||||
//isFullTrayChecking = false;
|
||||
//队列清空
|
||||
// var temp = new List<ITriggerSet>();
|
||||
// temp.AddRange(XKRSPLCConfig.TriggerConfigCollection);
|
||||
// temp.AddRange(XKRSPLCConfig.SnapshotTriggerConfigCollection);
|
||||
|
||||
//temp.ForEach(t =>
|
||||
//{
|
||||
// var diskInfo = XKRSPLCConfig.DiskInfoList.FirstOrDefault(u => u.DiskName == t.DiskName);
|
||||
// if (diskInfo != null)
|
||||
// {
|
||||
// t.AxisNum = diskInfo.DiskAxisNum;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// t.AxisNum = -1;
|
||||
// }
|
||||
//});
|
||||
|
||||
//if (temp.Any(u => u.AxisNum < 0))
|
||||
//{
|
||||
// LogAsync(DateTime.Now, LogLevel.Error, "触发信号归属转盘未确认");
|
||||
// return new ProcessResponse(false);
|
||||
//}
|
||||
|
||||
// _diskInfoListInOrder = XKRSPLCConfig.DiskInfoList.OrderBy(u => u.DiskSequence).ToList();
|
||||
// var axisNumList = _diskInfoListInOrder.Select(u => u.DiskAxisNum).ToList();
|
||||
|
||||
/// PrepareMLEngine();
|
||||
|
||||
// if (_PLCConfig?.Enable == true)
|
||||
//挡料电机操作
|
||||
// _PLC.FeedingMotor(_PLCConfig.CunToZeroSpeed, _PLCConfig.CunPos, _PLCConfig.CunSpeed, _PLCConfig.CunDirection);
|
||||
|
||||
//流程开启操作配置
|
||||
// ProcessInitialAction();
|
||||
// if (_PLC?Enabled == true)
|
||||
//皮带
|
||||
// _PLC.Belt(true);
|
||||
|
||||
//DeviceCollection.ForEach(d =>
|
||||
//{
|
||||
// if (d is CameraBase c)
|
||||
// {
|
||||
// c.OnHImageOutput -= OnCameraHImageOutput;
|
||||
// c.OnHImageOutput += OnCameraHImageOutput;
|
||||
// c.SnapshotCount = 0;
|
||||
// }
|
||||
//});
|
||||
_productLists.Clear();
|
||||
|
||||
#region 虚拟相机
|
||||
|
||||
//mOfflineImageTimer = new System.Timers.Timer();
|
||||
|
||||
//mOfflineImageTimer.Elapsed += OnEmitSerialPortAsync;
|
||||
//mOfflineImageTimer.Interval = 1000;
|
||||
//mOfflineImageTimer.Start();
|
||||
|
||||
#endregion 虚拟相机
|
||||
|
||||
var settings = _visionEngine.DetectionConfigs.Where(u => u.IsEnabled && u.IsAddStation).ToList();
|
||||
if (settings != null)
|
||||
{
|
||||
settings = settings.Where(s => s.IsEnabled).ToList();
|
||||
ProductBaseCount = settings.Count;
|
||||
|
||||
for (int i = 0; i < ProductBaseCount * ProductListMulti; i++)
|
||||
{
|
||||
ConcurrentDictionary<uint, ProductData> products = new ConcurrentDictionary<uint, ProductData>();
|
||||
_productLists.Add(products);
|
||||
}
|
||||
}
|
||||
|
||||
// _MGSCameraList = DeviceCollection
|
||||
//.OfType<MGSCameraDriver>() // 直接筛选出 MGSCameraDriver 类型的元素
|
||||
//.Where(camera => camera.IConfig != null && camera.IConfig.IsEnabled) // 进一步筛选 IConfig 不为 null 且 IsEnabled 为 true
|
||||
//.ToList();
|
||||
|
||||
// ProductBaseCount = _MGSCameraList.Count;
|
||||
|
||||
|
||||
|
||||
//流程执行时PLC
|
||||
PLC.StartProcess();
|
||||
InitialOEEStatistic();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
|
||||
// _MGSCameraList = DeviceCollection
|
||||
//.OfType<MGSCameraDriver>() // 直接筛选出 MGSCameraDriver 类型的元素
|
||||
//.Where(camera => camera.IConfig != null && camera.IConfig.IsEnabled) // 进一步筛选 IConfig 不为 null 且 IsEnabled 为 true
|
||||
//.ToList();
|
||||
|
||||
// ProductBaseCount = _MGSCameraList.Count;
|
||||
|
||||
|
||||
|
||||
//流程执行时PLC
|
||||
PLC.StartProcess();
|
||||
InitialOEEStatistic();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user