2025-08-20 23:06:28 +08:00
|
|
|
|
#include "P01_MianPage.h"
|
|
|
|
|
|
#include "ui_P01_MianPage.h"
|
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
|
#include <QMovie>
|
|
|
|
|
|
#include <QDir>
|
2025-09-15 22:28:43 +08:00
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
|
#include <QTimer>
|
|
|
|
|
|
#include <GlobalDefinitions/Variable.h>
|
|
|
|
|
|
#include <QImage>
|
2025-09-28 17:14:34 +08:00
|
|
|
|
#include <QLabel>
|
2025-09-15 22:28:43 +08:00
|
|
|
|
#include <QPainter>
|
|
|
|
|
|
#include <QPen>
|
|
|
|
|
|
#include <QImage>
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-20 23:06:28 +08:00
|
|
|
|
int TransportPosMaxX = 0;
|
2025-09-15 22:28:43 +08:00
|
|
|
|
int TransportPosMaxY = 0;
|
|
|
|
|
|
|
|
|
|
|
|
int OldRollerPos[2][2]={{0,0},{0,0}};
|
|
|
|
|
|
QImage Brush[2];
|
2025-08-20 23:06:28 +08:00
|
|
|
|
|
|
|
|
|
|
P01_MianPage::P01_MianPage(QWidget *parent) :
|
|
|
|
|
|
QWidget(parent),
|
|
|
|
|
|
ui(new Ui::P01_MianPage)
|
|
|
|
|
|
{
|
|
|
|
|
|
ui->setupUi(this);
|
2025-09-28 17:14:34 +08:00
|
|
|
|
QTimer::singleShot(10, this, &P01_MianPage::PageInit);
|
|
|
|
|
|
//QTimer::singleShot(1000, this, &P01_MianPage::Show3D);
|
2025-08-20 23:06:28 +08:00
|
|
|
|
}
|
2025-09-15 22:28:43 +08:00
|
|
|
|
|
2025-08-20 23:06:28 +08:00
|
|
|
|
void P01_MianPage::PageInit()
|
|
|
|
|
|
{
|
|
|
|
|
|
QPixmap pix(":/Icos/Icos/Sursor.png");
|
|
|
|
|
|
QCursor custom(pix, pix.width()/2, pix.height()/2);
|
|
|
|
|
|
setCursor(custom);
|
|
|
|
|
|
setWindowFlag(Qt::FramelessWindowHint); // 设置窗口无边框,设置后窗口无法移动
|
|
|
|
|
|
uiInitTransportPos(85,85);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QMovie *MLoading = new QMovie("./Gif/Radar.gif");
|
|
|
|
|
|
//qDebug() << "当前工作文件夹:" << QDir::currentPath();
|
|
|
|
|
|
ui->Gif_Radar->setMovie(MLoading); // 1. 设置要显示的 GIF 动画图片
|
|
|
|
|
|
ui->Gif_Radar->setScaledContents(true);
|
|
|
|
|
|
MLoading->start(); // 2. 启动动画
|
|
|
|
|
|
ui->Gif_Radar->show();
|
2025-09-15 22:28:43 +08:00
|
|
|
|
|
|
|
|
|
|
//所用定时器初始化
|
|
|
|
|
|
QTimer* UIRefresh_Timer = new QTimer(this);
|
|
|
|
|
|
connect(UIRefresh_Timer, &QTimer::timeout, this, &P01_MianPage::UIRefreshTimeOut);
|
|
|
|
|
|
UIRefresh_Timer->setInterval(100); // 设置定时器间隔为 1000 毫秒(1 秒)
|
|
|
|
|
|
UIRefresh_Timer->start();
|
|
|
|
|
|
|
|
|
|
|
|
//所用定时器初始化
|
|
|
|
|
|
QTimer* TrailRefresh_Timer = new QTimer(this);
|
|
|
|
|
|
connect(TrailRefresh_Timer, &QTimer::timeout, this, &P01_MianPage::TrailRefreshTimeOut);
|
|
|
|
|
|
TrailRefresh_Timer->setInterval(1000); // 设置定时器间隔为 1000 毫秒(1 秒)
|
|
|
|
|
|
TrailRefresh_Timer->start();
|
2025-08-20 23:06:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
P01_MianPage::~P01_MianPage()
|
|
|
|
|
|
{
|
|
|
|
|
|
delete ui;
|
|
|
|
|
|
}
|
2025-09-28 17:14:34 +08:00
|
|
|
|
void P01_MianPage::Show3D(){
|
|
|
|
|
|
|
|
|
|
|
|
DevName3D = "整机装配";
|
|
|
|
|
|
// ui->Frame_Dev3D->setStyleSheet("background: transparent;");
|
|
|
|
|
|
// ui->Frame_Dev3D->setAttribute(Qt::WA_TranslucentBackground);
|
|
|
|
|
|
mObjLoader = new ObjLoader();
|
|
|
|
|
|
// mObjLoader->setEnDebug(true);
|
|
|
|
|
|
mObjLoader->init3DScene(ui->Frame_Dev3D);
|
|
|
|
|
|
mObjLoader->setCameraSpeed(200.0,200.0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool LoaderOK = mObjLoader->loadDevice(DevName3D, "./3D模型文件/掘锚一体机/本体/"+DevName3D+".obj");
|
|
|
|
|
|
if(!LoaderOK) {qCritical() <<DevName3D<< "加载:失败";return;}
|
|
|
|
|
|
mObjLoader->scaleDevice(DevName3D, 0.001f);
|
|
|
|
|
|
mObjLoader->addAxisGizmo(nullptr, 5.0f); // 全局坐标轴(原点)
|
|
|
|
|
|
mObjLoader->addAxisGizmo(mObjLoader->getDevice(DevName3D)->entity, 3.0f); // 局部坐标轴
|
|
|
|
|
|
mObjLoader->setParentDevicePosition(DevName3D, QVector3D(-33.394, 1021.68, 190.52)); // 世界坐标
|
|
|
|
|
|
mObjLoader->moveArmLocalOriginTo(DevName3D, QVector3D(0, 0, 0));//14.1, -1.4, 3.4
|
|
|
|
|
|
|
|
|
|
|
|
DevName3D = "运输机";
|
|
|
|
|
|
LoaderOK = LoaderOK && mObjLoader->loadChildDevice(DevName3D,"./3D模型文件/掘锚一体机/本体/"+DevName3D+".obj", "整机装配");
|
|
|
|
|
|
mObjLoader->scaleDevice(DevName3D, 0.001f);
|
|
|
|
|
|
mObjLoader->addAxisGizmo(mObjLoader->getDevice(DevName3D)->entity, 3.0f); // 电控箱体局部坐标轴
|
|
|
|
|
|
mObjLoader->setParentDevicePosition(DevName3D, QVector3D(0,617.183, 95239.7)); // 世界坐标 0 1 96.48
|
|
|
|
|
|
mObjLoader->moveArmLocalOriginTo(DevName3D, QVector3D(0,1,96.48));
|
|
|
|
|
|
mObjLoader->adjustChildDeviceOffset(DevName3D, QVector3D(-3.61, 1.25, 0.25)); //-3.61, 0.17, 0.25
|
|
|
|
|
|
mObjLoader->rotateArmToAbsoluteYAngle(DevName3D, 90);
|
|
|
|
|
|
|
|
|
|
|
|
DevName3D = "截割部";
|
|
|
|
|
|
LoaderOK = LoaderOK && mObjLoader->loadChildDevice(DevName3D,"./3D模型文件/掘锚一体机/本体/"+DevName3D+".obj", "整机装配");
|
|
|
|
|
|
mObjLoader->scaleDevice(DevName3D, 0.001f);
|
|
|
|
|
|
mObjLoader->addAxisGizmo(mObjLoader->getDevice(DevName3D)->entity, 5.0f); // 电控箱体局部坐标轴
|
|
|
|
|
|
mObjLoader->setParentDevicePosition(DevName3D, QVector3D(0, -3633.7, 4141.31)); // 世界坐标
|
|
|
|
|
|
mObjLoader->moveArmLocalOriginTo(DevName3D, QVector3D(0, -2.9800, 1.3800));
|
|
|
|
|
|
mObjLoader->adjustChildDeviceOffset(DevName3D, QVector3D(0.5000, 0.7100, 0.2500));
|
|
|
|
|
|
mObjLoader->rotateArmToAbsoluteYAngle(DevName3D, 90);
|
|
|
|
|
|
|
|
|
|
|
|
DevName3D = "滚筒";
|
|
|
|
|
|
LoaderOK = LoaderOK && mObjLoader->loadChildDevice(DevName3D,"./3D模型文件/掘锚一体机/本体/"+DevName3D+".obj", "截割部");
|
|
|
|
|
|
mObjLoader->rotateDevice(DevName3D,10260,0,0);
|
|
|
|
|
|
mObjLoader->scaleDevice(DevName3D, 0.001f);
|
|
|
|
|
|
mObjLoader->addAxisGizmo(mObjLoader->getDevice(DevName3D)->entity, 10.0f); // 电控箱体局部坐标轴
|
|
|
|
|
|
mObjLoader->setParentDevicePosition(DevName3D, QVector3D(-0.927338, 2800, 1.00699)); // 世界坐标
|
|
|
|
|
|
mObjLoader->moveArmLocalOriginTo(DevName3D, QVector3D(1.0050, 4.2200, 0.5000));//1.0050, 4.2200, 0.5000
|
|
|
|
|
|
mObjLoader->adjustChildDeviceOffset(DevName3D, QVector3D(0, 0, 0));
|
|
|
|
|
|
mObjLoader->moveArmLocalOriginTo(DevName3D, QVector3D(0, -10, 0));//1.0050, 4.2200, 0.5000
|
|
|
|
|
|
mObjLoader->rotateArmToAbsoluteZAngle(DevName3D, 90);
|
|
|
|
|
|
mObjLoader->adjustChildDeviceOffset(DevName3D, QVector3D(4.2000, -1.600, 5.0000));
|
|
|
|
|
|
mObjLoader->rotateArmToAbsoluteXAngle(DevName3D, 1);
|
|
|
|
|
|
|
|
|
|
|
|
if(LoaderOK){
|
|
|
|
|
|
// 初始化定时器(作为成员变量)
|
|
|
|
|
|
QTimer *RotateDev_Timer = new QTimer(this);
|
|
|
|
|
|
connect(RotateDev_Timer, &QTimer::timeout, this, &P01_MianPage::RotateDev);
|
|
|
|
|
|
RotateDev_Timer->setInterval(33);
|
|
|
|
|
|
RotateDev_Timer->start();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Qt3DRender::QCamera* cam = mObjLoader->getCamera();
|
|
|
|
|
|
if (cam) {
|
|
|
|
|
|
cam->setPosition(QVector3D(13.2300, 8.3400, 14.3400)); // 相机在 Z 轴 30 位置,远离模型
|
|
|
|
|
|
cam->setViewCenter(QVector3D(3.3,-1, -2)); // 看向电控箱体的世界位置
|
|
|
|
|
|
}
|
|
|
|
|
|
ui->Frame_Dev3D->resize(420,230);
|
|
|
|
|
|
qDebug()<<ui->Frame_Dev3D->width()<<ui->Frame_Dev3D->height();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-15 22:28:43 +08:00
|
|
|
|
uint32_t TCount =0 ;
|
|
|
|
|
|
void P01_MianPage::UIRefreshTimeOut()
|
|
|
|
|
|
{
|
|
|
|
|
|
if(this->isHidden())
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
2025-09-28 17:14:34 +08:00
|
|
|
|
uint32_t TmpBools[10];
|
|
|
|
|
|
TmpBools[0] = gOPC_NodeValue["ns=6;s=::AsGlobalPV:PageBOOLS.B0"] .toUInt();
|
|
|
|
|
|
TmpBools[1] = gOPC_NodeValue["ns=6;s=::AsGlobalPV:PageBOOLS.B1"] .toUInt();
|
|
|
|
|
|
TmpBools[2] = gOPC_NodeValue["ns=6;s=::AsGlobalPV:PageBOOLS.B2"] .toUInt();
|
|
|
|
|
|
TmpBools[3] = gOPC_NodeValue["ns=6;s=::AsGlobalPV:PageBOOLS.B3"] .toUInt();
|
|
|
|
|
|
TmpBools[4] = gOPC_NodeValue["ns=6;s=::AsGlobalPV:PageBOOLS.B4"] .toUInt();
|
|
|
|
|
|
TmpBools[5] = gOPC_NodeValue["ns=6;s=::AsGlobalPV:PageBOOLS.B5"] .toUInt();
|
|
|
|
|
|
TmpBools[6] = gOPC_NodeValue["ns=6;s=::AsGlobalPV:PageBOOLS.B6"] .toUInt();
|
|
|
|
|
|
TmpBools[7] = gOPC_NodeValue["ns=6;s=::AsGlobalPV:PageBOOLS.B7"] .toUInt();
|
|
|
|
|
|
TmpBools[8] = gOPC_NodeValue["ns=6;s=::AsGlobalPV:PageBOOLS.B8"] .toUInt();
|
|
|
|
|
|
TmpBools[9] = gOPC_NodeValue["ns=6;s=::AsGlobalPV:PageBOOLS.B9"] .toUInt();
|
|
|
|
|
|
|
|
|
|
|
|
//杂进度条显示
|
|
|
|
|
|
QStringList LevelCor = {"rgb(255, 0, 0)","rgb(255, 0, 0)","rgb(0, 255, 0)","rgb(0, 255, 255)"};
|
|
|
|
|
|
ProgressBar_LCD(ui->PB_SpareTemp,ui->LCD_SpareTemp,"ns=6;s=::AsGlobalPV:PB_SpareTemp.PageGroup","ns=6;s=::AsGlobalPV:IN_Sersor.SpareTemp",glMotorTempColor);
|
|
|
|
|
|
ProgressBar_LCD(ui->PB_OilLevel,ui->LCD_OilLevel,"ns=6;s=::AsGlobalPV:PB_OilLevel.PageGroup","ns=6;s=::AsGlobalPV:IN_Sersor.OilLevel",LevelCor);
|
|
|
|
|
|
ProgressBar_LCD(ui->PB_OilTemp,ui->LCD_OilTemp,"ns=6;s=::AsGlobalPV:PB_OilTemp.PageGroup","ns=6;s=::AsGlobalPV:IN_Sersor.OilTemp",glMotorTempColor);
|
|
|
|
|
|
|
|
|
|
|
|
QStringList NullColor = {"rgb(0, 255, 255)","rgb(0, 255, 255)","rgb(0, 255, 255)","rgb(0, 255, 255)"};
|
|
|
|
|
|
ProgressBar_LCD(ui->PB_PressurePump_1,ui->LCD_PressurePump_1,"ns=6;s=::AsGlobalPV:PB_PressurePump1.PageGroup","ns=6;s=::AsGlobalPV:IN_Sersor.Pressure_Pump1",NullColor);
|
|
|
|
|
|
ProgressBar_LCD(ui->PB_PressurePump_2,ui->LCD_PressurePump_2,"ns=6;s=::AsGlobalPV:PB_PressurePump2.PageGroup","ns=6;s=::AsGlobalPV:IN_Sersor.Pressure_Pump2",NullColor);
|
|
|
|
|
|
ProgressBar_LCD(ui->PB_PressurePump_3,ui->LCD_PressurePump_3,"ns=6;s=::AsGlobalPV:PB_PressurePump3.PageGroup","ns=6;s=::AsGlobalPV:IN_Sersor.Pressure_Pump3",NullColor);
|
|
|
|
|
|
|
|
|
|
|
|
// 编码器数值显示
|
|
|
|
|
|
ui->LCD_EncoderL->display(QString::number(gOPC_NodeValue["ns=6;s=::AsGlobalPV:IN_Encoder.EncoderL"] .toUInt()));
|
|
|
|
|
|
ui->LCD_EncoderR->display(QString::number(gOPC_NodeValue["ns=6;s=::AsGlobalPV:IN_Encoder.EncoderR"] .toUInt()));
|
|
|
|
|
|
// 急停的显示
|
|
|
|
|
|
for (uint8_t i=0;i<12;i++) {
|
|
|
|
|
|
QString TextObjName = QString("Led_EStop_%1").arg(i);
|
|
|
|
|
|
QLabel* Label = findChild<QLabel*>(TextObjName);
|
|
|
|
|
|
if (Label) {
|
|
|
|
|
|
SetStyleStr(Label,getBitOf32Data(TmpBools[0], i,false),"color: rgb(255, 0, 0);","color: rgb(0, 255, 0);");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-09-15 22:28:43 +08:00
|
|
|
|
|
2025-09-28 17:14:34 +08:00
|
|
|
|
// ESR状态显示
|
|
|
|
|
|
SetStyleStr(ui->Status_IESR_1,getBitOf32Data(TmpBools[0], 12,false),"border-image: url(:/Icos/Icos/LED2_Green.png);","border-image: url(:/Icos/Icos/LED1_Rad.png);");
|
|
|
|
|
|
SetStyleStr(ui->Status_IESR_2,getBitOf32Data(TmpBools[0], 13,false),"border-image: url(:/Icos/Icos/LED2_Green.png);","border-image: url(:/Icos/Icos/LED1_Rad.png);");
|
|
|
|
|
|
SetStyleStr(ui->Status_QESR_1,getBitOf32Data(TmpBools[0], 14,false),"border-image: url(:/Icos/Icos/LED2_Green.png);","border-image: url(:/Icos/Icos/LED3_Rad (2).png);");
|
|
|
|
|
|
SetStyleStr(ui->Status_QESR_2,getBitOf32Data(TmpBools[0], 15,false),"border-image: url(:/Icos/Icos/LED2_Green.png);","border-image: url(:/Icos/Icos/LED3_Rad (2).png);");
|
2025-09-15 22:28:43 +08:00
|
|
|
|
|
|
|
|
|
|
|
2025-09-28 17:14:34 +08:00
|
|
|
|
//传感器及阀控模块输出的显示
|
|
|
|
|
|
SetStyleStr(ui->Status_P1_1,getBitOf32Data(TmpBools[2], 1,false),"color: rgb(0, 255, 0);","");
|
|
|
|
|
|
SetStyleStr(ui->Status_P1_2,getBitOf32Data(TmpBools[2], 3,false),"color: rgb(0, 255, 0);","");
|
|
|
|
|
|
SetStyleStr(ui->Status_P1_3,getBitOf32Data(TmpBools[2], 5,false),"color: rgb(0, 255, 0);","");
|
|
|
|
|
|
SetStyleStr(ui->Status_P1_4,getBitOf32Data(TmpBools[2], 4,false),"color: rgb(0, 255, 0);","");
|
|
|
|
|
|
SetStyleStr(ui->Status_P1_5,getBitOf32Data(TmpBools[1], 23,false),"color: rgb(0, 255, 0);","");
|
|
|
|
|
|
SetStyleStr(ui->Status_P1_6,getBitOf32Data(TmpBools[2], 0,false),"color: rgb(0, 255, 0);","");
|
|
|
|
|
|
|
|
|
|
|
|
SetStyleStr(ui->Status_P2_1,getBitOf32Data(TmpBools[1], 22,false),"color: rgb(0, 255, 0);","");
|
|
|
|
|
|
SetStyleStr(ui->Status_P2_2,getBitOf32Data(TmpBools[1], 30,false),"color: rgb(0, 255, 0);","");
|
|
|
|
|
|
SetStyleStr(ui->Status_P2_3,getBitOf32Data(TmpBools[1], 21,false),"color: rgb(0, 255, 0);","");
|
|
|
|
|
|
SetStyleStr(ui->Status_P2_4,getBitOf32Data(TmpBools[1], 20,false),"color: rgb(0, 255, 0);","");
|
|
|
|
|
|
SetStyleStr(ui->Status_P2_5,getBitOf32Data(TmpBools[1], 29,false),"color: rgb(0, 255, 0);","");
|
|
|
|
|
|
|
|
|
|
|
|
SetStyleStr(ui->Status_P3_1,getBitOf32Data(TmpBools[1], 24,false),"color: rgb(0, 255, 0);","");
|
|
|
|
|
|
SetStyleStr(ui->Status_P3_2,getBitOf32Data(TmpBools[1], 25,false),"color: rgb(0, 255, 0);","");
|
|
|
|
|
|
SetStyleStr(ui->Status_P3_3,getBitOf32Data(TmpBools[1], 26,false),"color: rgb(0, 255, 0);","");
|
|
|
|
|
|
SetStyleStr(ui->Status_P3_4,getBitOf32Data(TmpBools[1], 27,false),"color: rgb(0, 255, 0);","");
|
|
|
|
|
|
SetStyleStr(ui->Status_P3_5,getBitOf32Data(TmpBools[1], 28,false),"color: rgb(0, 255, 0);","");
|
|
|
|
|
|
|
|
|
|
|
|
//油缸伸缩状态显示
|
|
|
|
|
|
QStringList OilCylindStyle = {"","border-image: url(:/Icos/Icos/icon_stretch.png);","border-image: url(:/Icos/Icos/icon_shorten.png);"};
|
|
|
|
|
|
SetStyleStr(ui->Status_Oil_1, getBitOf32Data(TmpBools[3], 24,false),getBitOf32Data(TmpBools[3], 25,false),OilCylindStyle);
|
|
|
|
|
|
SetStyleStr(ui->Status_Oil_2, getBitOf32Data(TmpBools[1], 12,false),getBitOf32Data(TmpBools[1], 13,false),OilCylindStyle);
|
|
|
|
|
|
SetStyleStr(ui->Status_Oil_3, getBitOf32Data(TmpBools[1], 14,false),getBitOf32Data(TmpBools[1], 15,false),OilCylindStyle);
|
|
|
|
|
|
SetStyleStr(ui->Status_Oil_4, getBitOf32Data(TmpBools[3], 26,false),getBitOf32Data(TmpBools[3], 27,false),OilCylindStyle);
|
|
|
|
|
|
|
|
|
|
|
|
SetStyleStr(ui->Status_Oil_5, getBitOf32Data(TmpBools[1], 8 ,false),getBitOf32Data(TmpBools[1], 9 ,false),OilCylindStyle);
|
|
|
|
|
|
SetStyleStr(ui->Status_Oil_6, getBitOf32Data(TmpBools[1], 0 ,false),getBitOf32Data(TmpBools[1], 1 ,false),OilCylindStyle);
|
|
|
|
|
|
SetStyleStr(ui->Status_Oil_7, getBitOf32Data(TmpBools[1], 10,false),getBitOf32Data(TmpBools[1], 11,false),OilCylindStyle);
|
|
|
|
|
|
SetStyleStr(ui->Status_Oil_8, getBitOf32Data(TmpBools[1], 2 ,false),getBitOf32Data(TmpBools[1], 3 ,false),OilCylindStyle);
|
|
|
|
|
|
|
|
|
|
|
|
SetStyleStr(ui->Status_Oil_9, getBitOf32Data(TmpBools[1], 16,false),getBitOf32Data(TmpBools[1], 17,false),OilCylindStyle);
|
|
|
|
|
|
SetStyleStr(ui->Status_Oil_10,getBitOf32Data(TmpBools[1], 18,false),getBitOf32Data(TmpBools[1], 19,false),OilCylindStyle);
|
|
|
|
|
|
SetStyleStr(ui->Status_Oil_11,getBitOf32Data(TmpBools[1], 4 ,false),getBitOf32Data(TmpBools[1], 5 ,false),OilCylindStyle);
|
|
|
|
|
|
SetStyleStr(ui->Status_Oil_12,getBitOf32Data(TmpBools[1], 6 ,false),getBitOf32Data(TmpBools[1], 7 ,false),OilCylindStyle);
|
|
|
|
|
|
|
|
|
|
|
|
SetStyleStr(ui->Status_Oil_13,getBitOf32Data(TmpBools[3], 28,false),getBitOf32Data(TmpBools[3], 29,false),OilCylindStyle);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//电机温度电流,进度条和LCD的显示
|
2025-09-15 22:28:43 +08:00
|
|
|
|
PB_Refresh("Pump");
|
|
|
|
|
|
PB_Refresh("Cut");
|
|
|
|
|
|
PB_Refresh("LoaderL");
|
|
|
|
|
|
PB_Refresh("LoaderR");
|
|
|
|
|
|
PB_Refresh("TransportL");
|
|
|
|
|
|
PB_Refresh("TransportR");
|
|
|
|
|
|
PB_Refresh("Standby");
|
|
|
|
|
|
|
2025-09-28 17:14:34 +08:00
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
void P01_MianPage::ProgressBar_LCD(QProgressBar *QPB,QLCDNumber *QLCD,QString NodeID_Bar,QString NodeID_Value,QStringList Colors){
|
|
|
|
|
|
uint32_t PB_Group1 = gOPC_NodeValue[NodeID_Bar] .toUInt();
|
|
|
|
|
|
float Value = gOPC_NodeValue[NodeID_Value] .toFloat();
|
|
|
|
|
|
uint16_t PValue= static_cast<uint16_t>(PB_Group1 >> 16); // 高 16 位
|
|
|
|
|
|
uint16_t PColor = static_cast<uint16_t>(PB_Group1 & 0xFFFF);// 低 16 位
|
|
|
|
|
|
SetProgressBar(QPB,PValue,PColor,Colors);
|
|
|
|
|
|
QLCD->display(QString::number(Value,'f',2));
|
2025-09-15 22:28:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
void P01_MianPage::PB_Refresh(QString Dev){
|
|
|
|
|
|
uint32_t PB_Group1 = gOPC_NodeValue["ns=6;s=::AsGlobalPV:PB_Curr_"+Dev+".PageGroup1"] .toUInt();
|
|
|
|
|
|
uint32_t PB_Group2 = gOPC_NodeValue["ns=6;s=::AsGlobalPV:PB_Curr_"+Dev+".PageGroup2"] .toUInt();
|
|
|
|
|
|
uint32_t PB_MotorTemp = gOPC_NodeValue["ns=6;s=::AsGlobalPV:PB_Temp_"+Dev+".PageGroup"] .toUInt();
|
|
|
|
|
|
|
|
|
|
|
|
uint16_t PercentageCurU = static_cast<uint16_t>(PB_Group1 >> 16); // 高 16 位
|
|
|
|
|
|
uint16_t PercentageCurV = static_cast<uint16_t>(PB_Group1 & 0xFFFF);// 低 16 位
|
|
|
|
|
|
uint16_t PercentageCurW = static_cast<uint16_t>(PB_Group2 >> 16); // 高 16 位
|
|
|
|
|
|
uint16_t PercentageTmpColor = static_cast<uint16_t>(PB_Group2 & 0xFFFF);// 低 16 位
|
2025-08-20 23:06:28 +08:00
|
|
|
|
|
2025-09-15 22:28:43 +08:00
|
|
|
|
uint8_t ColorU = (PercentageTmpColor / 10) % 10;
|
|
|
|
|
|
uint8_t ColorV = (PercentageTmpColor / 100) % 10;
|
|
|
|
|
|
uint8_t ColorW = PercentageTmpColor % 10;
|
|
|
|
|
|
|
|
|
|
|
|
uint16_t PercentageMotorTemp = static_cast<uint16_t>(PB_MotorTemp >> 16); // 高 16 位
|
|
|
|
|
|
uint16_t ColorTemp = static_cast<uint16_t>(PB_MotorTemp & 0xFFFF);// 低 16 位
|
|
|
|
|
|
|
|
|
|
|
|
qreal CurrU = gOPC_NodeValue["ns=6;s=::AsGlobalPV:IN_Phase"+Dev+".Filtered30_U"] .toReal();
|
|
|
|
|
|
qreal CurrV = gOPC_NodeValue["ns=6;s=::AsGlobalPV:IN_Phase"+Dev+".Filtered30_V"] .toReal();
|
|
|
|
|
|
qreal CurrW = gOPC_NodeValue["ns=6;s=::AsGlobalPV:IN_Phase"+Dev+".Filtered30_W"] .toReal();
|
|
|
|
|
|
qreal Temp = gOPC_NodeValue["ns=6;s=::AsGlobalPV:IN_Phase"+Dev+".Filtered_Temp"] .toReal();
|
|
|
|
|
|
qreal Curr = fmax(CurrU,fmax(CurrV,CurrW));
|
|
|
|
|
|
|
|
|
|
|
|
qreal Rated;
|
|
|
|
|
|
if (Dev == "LoaderL" || Dev == "LoaderR" )
|
|
|
|
|
|
Rated = gOPC_NodeValue["ns=6;s=::AsGlobalPV:PS.gRatedCur_Loader"] .toReal();
|
|
|
|
|
|
else if(Dev == "TransportL" || Dev == "TransportR" )
|
|
|
|
|
|
Rated = gOPC_NodeValue["ns=6;s=::AsGlobalPV:PS.gRatedCur_Transport"] .toReal();
|
|
|
|
|
|
else{
|
|
|
|
|
|
Rated = gOPC_NodeValue["ns=6;s=::AsGlobalPV:PS.gRatedCur_"+Dev] .toReal();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QProgressBar* CurPB_1 = findChild<QProgressBar*>("PB_Cur"+Dev+"_1");
|
|
|
|
|
|
QProgressBar* CurPB_2 = findChild<QProgressBar*>("PB_Cur"+Dev+"_2");
|
|
|
|
|
|
QProgressBar* CurPB_3 = findChild<QProgressBar*>("PB_Cur"+Dev+"_3");
|
|
|
|
|
|
QProgressBar* TempPB = findChild<QProgressBar*>("PB_Temp"+Dev);
|
|
|
|
|
|
|
|
|
|
|
|
QLCDNumber* CurLCD_1 = findChild<QLCDNumber*>("LCD_Cur"+Dev+"_1");
|
|
|
|
|
|
QLCDNumber* CurLCD_2 = findChild<QLCDNumber*>("LCD_Cur"+Dev+"_2");
|
|
|
|
|
|
QLCDNumber* CurLCD_3 = findChild<QLCDNumber*>("LCD_Cur"+Dev+"_3");
|
|
|
|
|
|
QLCDNumber* CurLCD = findChild<QLCDNumber*>("LCD_Cur"+Dev);
|
|
|
|
|
|
QLCDNumber* TempLCD = findChild<QLCDNumber*>("LCD_Temp"+Dev);
|
|
|
|
|
|
|
|
|
|
|
|
QLabel* CurRated_Label = findChild<QLabel*>("Label_UnitCur"+Dev);
|
|
|
|
|
|
SetProgressBar(CurPB_1,PercentageCurU,ColorU,glMotorCurColor);
|
|
|
|
|
|
SetProgressBar(CurPB_2,PercentageCurV,ColorV,glMotorCurColor);
|
|
|
|
|
|
SetProgressBar(CurPB_3,PercentageCurW,ColorW,glMotorCurColor);
|
|
|
|
|
|
SetProgressBar(TempPB,PercentageMotorTemp,ColorTemp,glMotorTempColor);
|
|
|
|
|
|
|
|
|
|
|
|
CurLCD_1->display(QString::number(CurrU,'f',2));
|
|
|
|
|
|
CurLCD_2->display(QString::number(CurrV,'f',2));
|
|
|
|
|
|
CurLCD_3->display(QString::number(CurrW,'f',2));
|
|
|
|
|
|
CurLCD->display(QString::number(Curr,'f',2));
|
|
|
|
|
|
TempLCD->display(QString::number(Temp,'f',2));
|
|
|
|
|
|
CurRated_Label->setText("A/"+QString::number(Rated,'f',1)+"A");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
void P01_MianPage::SetProgressBar(QProgressBar *PB,uint16_t Value,uint8_t ColorIndex,QStringList Color){
|
2025-09-28 17:14:34 +08:00
|
|
|
|
if(Value > PB->maximum()) Value = PB->maximum();
|
2025-09-15 22:28:43 +08:00
|
|
|
|
PB->setValue(Value);
|
|
|
|
|
|
if(ColorIndex < Color.length()){
|
|
|
|
|
|
QString Style = "QProgressBar {\n background-color: transparent;\n border: 2px solid #888888;\n border-radius: 3px;\n}\nQProgressBar::chunk {\n background-color:"+Color[ColorIndex]+";\n}";
|
|
|
|
|
|
if(PB->styleSheet() != Style){
|
|
|
|
|
|
PB->setStyleSheet(Style);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
uint16_t OldRoller_Length = 0;
|
|
|
|
|
|
void P01_MianPage::TrailRefreshTimeOut(){
|
|
|
|
|
|
if(this->isHidden())
|
|
|
|
|
|
return;
|
2025-09-28 17:14:34 +08:00
|
|
|
|
// 画板的显示
|
2025-09-15 22:28:43 +08:00
|
|
|
|
uint32_t Diameter = gOPC_NodeValue["ns=6;s=::AsGlobalPV:RollerPosition.Diameter"] .toUInt();
|
|
|
|
|
|
uint32_t LengthHeight = gOPC_NodeValue["ns=6;s=::AsGlobalPV:RollerPosition.LengthHeight"] .toUInt();
|
|
|
|
|
|
uint32_t SideView = gOPC_NodeValue["ns=6;s=::AsGlobalPV:RollerPosition.SideView"] .toUInt();
|
|
|
|
|
|
uint32_t FaceView = gOPC_NodeValue["ns=6;s=::AsGlobalPV:RollerPosition.FaceView"] .toUInt();
|
|
|
|
|
|
|
2025-09-28 17:14:34 +08:00
|
|
|
|
uint32_t TransPos = gOPC_NodeValue["ns=6;s=::AsGlobalPV:RollerPosition.TransportPos"] .toUInt();
|
|
|
|
|
|
uint32_t TmpHaul = gOPC_NodeValue["ns=6;s=::AsGlobalPV:RollerPosition.ShowHaulSpeed"] .toUInt();
|
|
|
|
|
|
float CenterHeight = gOPC_NodeValue["ns=6;s=::AsGlobalPV:RollerPosition.CenterHeight"] .toFloat();
|
2025-09-15 22:28:43 +08:00
|
|
|
|
|
|
|
|
|
|
int16_t Roller_SideX = static_cast<int16_t>(SideView >> 16); // 高 16 位
|
|
|
|
|
|
int16_t Roller_SideY = static_cast<int16_t>(SideView & 0xFFFF);// 低 16 位
|
|
|
|
|
|
int16_t Roller_FaceX = static_cast<int16_t>(FaceView >> 16); // 高 16 位
|
|
|
|
|
|
int16_t Roller_FaceY = static_cast<int16_t>(FaceView & 0xFFFF);// 低 16 位
|
|
|
|
|
|
int16_t Roller_Length = static_cast<int16_t>(LengthHeight >> 16); // 高 16 位
|
2025-09-28 17:14:34 +08:00
|
|
|
|
|
2025-09-15 22:28:43 +08:00
|
|
|
|
int16_t TransPos_SideX = static_cast<int16_t>(TransPos >> 16); // 高 16 位
|
|
|
|
|
|
int16_t TransPos_SideY = static_cast<int16_t>(TransPos & 0xFFFF);// 低 16 位
|
2025-09-28 17:14:34 +08:00
|
|
|
|
int16_t TmpSpeedL = static_cast<int16_t>(TmpHaul >> 16); // 高 16 位
|
|
|
|
|
|
int16_t TmpSpeedR = static_cast<int16_t>(TmpHaul & 0xFFFF);// 低 16 位
|
|
|
|
|
|
uint16_t Roller_Diameter_Img = static_cast<int16_t>(Diameter >> 16); // 高 16 位
|
|
|
|
|
|
uint16_t Roller_Diameter_mm = static_cast<int16_t>(Diameter & 0xFFFF); // 低 16 位
|
2025-09-15 22:28:43 +08:00
|
|
|
|
if(Brush[0].isNull()){
|
|
|
|
|
|
Brush[0] = QImage(":/Devices/Devices/ICO_Cutting1.png");
|
|
|
|
|
|
Brush[0] = Brush[0].scaled(Roller_Diameter_Img, Roller_Diameter_Img, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
|
|
|
|
|
ui->TrailDisplay_1->setBrushImage(Brush[0]);
|
|
|
|
|
|
}
|
|
|
|
|
|
if(Brush[1].isNull() || OldRoller_Length != Roller_Length){
|
|
|
|
|
|
Brush[1] = QImage(Roller_Length, Roller_Diameter_Img, QImage::Format_ARGB32);
|
|
|
|
|
|
Brush[1].fill(Qt::green);
|
|
|
|
|
|
ui->TrailDisplay_2->setBrushImage(Brush[1]);
|
|
|
|
|
|
OldRoller_Length = Roller_Length;
|
|
|
|
|
|
}
|
|
|
|
|
|
uiRollerPosition(0,Roller_SideX,Roller_SideY);
|
|
|
|
|
|
uiRollerPosition(1,Roller_FaceX,Roller_FaceY);
|
|
|
|
|
|
uiSetTransportPos(TransPos_SideX,TransPos_SideY);
|
2025-09-28 17:14:34 +08:00
|
|
|
|
|
|
|
|
|
|
uiSetHaulSpeed(TmpSpeedL,TmpSpeedR);
|
|
|
|
|
|
// 采高卧底的显示
|
|
|
|
|
|
uiSetMining(CenterHeight,Roller_Diameter_mm);
|
2025-09-15 22:28:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
void P01_MianPage::uiRollerPosition(uint8_t Index,uint16_t aX,uint16_t aY){
|
|
|
|
|
|
//qDebug()<<Index<<aX<<aY<<OldRollerPos[Index][0]<<OldRollerPos[Index][1] ;
|
2025-09-28 17:14:34 +08:00
|
|
|
|
//掘锚机运输机位置的显示
|
2025-09-15 22:28:43 +08:00
|
|
|
|
if(OldRollerPos[Index][0] != aX || OldRollerPos[Index][1] != aY){
|
|
|
|
|
|
QPoint localPos(aX,aY);
|
|
|
|
|
|
if(Index == 0)
|
|
|
|
|
|
ui->TrailDisplay_1->moveBrush(localPos);
|
|
|
|
|
|
else
|
|
|
|
|
|
ui->TrailDisplay_2->moveBrush(localPos);
|
|
|
|
|
|
}
|
|
|
|
|
|
OldRollerPos[Index][0] = aX;
|
|
|
|
|
|
OldRollerPos[Index][1] = aY;
|
|
|
|
|
|
}
|
2025-08-20 23:06:28 +08:00
|
|
|
|
void P01_MianPage::uiInitHaulSpeed(int Max){
|
|
|
|
|
|
ui->Slider_Haul_L->setMinimum(0-Max);
|
|
|
|
|
|
ui->Slider_Haul_L->setMaximum(Max);
|
|
|
|
|
|
ui->Slider_Haul_R->setMinimum(0-Max);
|
|
|
|
|
|
ui->Slider_Haul_R->setMaximum(Max);
|
|
|
|
|
|
}
|
|
|
|
|
|
void P01_MianPage::uiInitMining(int Max,int Min){
|
2025-09-28 17:14:34 +08:00
|
|
|
|
ui->Slider_Mining->setMinimum(Min);
|
|
|
|
|
|
ui->Slider_Mining->setMaximum(Max);
|
2025-08-20 23:06:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
void P01_MianPage::uiInitTransportPos(int MaxX,int MaxY){
|
|
|
|
|
|
TransportPosMaxX = MaxX;
|
|
|
|
|
|
TransportPosMaxY = MaxY;
|
|
|
|
|
|
}
|
|
|
|
|
|
void P01_MianPage::uiSetHaulSpeed(int SpeedL,int SpeedR){
|
|
|
|
|
|
ui->Slider_Haul_L->setValue(SpeedL);
|
|
|
|
|
|
ui->LCD_MainHaul_L->display(QString::number(SpeedL));
|
|
|
|
|
|
ui->Slider_Haul_R->setValue(SpeedR);
|
|
|
|
|
|
ui->LCD_MainHaul_R->display(QString::number(SpeedR));
|
|
|
|
|
|
}
|
2025-09-28 17:14:34 +08:00
|
|
|
|
void P01_MianPage::uiSetMining(float CenterHeight,uint16_t Roller_Diameter_mm){
|
|
|
|
|
|
int16_t CH = CenterHeight*1000;
|
|
|
|
|
|
ui->Slider_Mining->setValue(CH);
|
|
|
|
|
|
ui->LCD_MiningB1->display(QString::number(CenterHeight - Roller_Diameter_mm * 0.001, 'f', 2));
|
|
|
|
|
|
ui->LCD_MiningT1->display(QString::number(CenterHeight + Roller_Diameter_mm * 0.001, 'f', 2));
|
2025-08-20 23:06:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
void P01_MianPage::uiSetTransportPos(int rx,int ry){
|
2025-09-28 17:14:34 +08:00
|
|
|
|
int NewRX = 29+(130/2)+rx;
|
|
|
|
|
|
int NewRY = -6+(130/2)+ry;
|
2025-08-20 23:06:28 +08:00
|
|
|
|
//qDebug()<<NewRX<<NewRY;
|
|
|
|
|
|
ui->Label_TransportPos->move(NewRX,NewRY);
|
|
|
|
|
|
}
|
2025-09-28 17:14:34 +08:00
|
|
|
|
void P01_MianPage::SetStyleStr(QLabel *L,bool Status,QString TStr,QString FStr){
|
|
|
|
|
|
if(L == nullptr) return;
|
|
|
|
|
|
QString Style = "";
|
|
|
|
|
|
if(Status){
|
|
|
|
|
|
Style = TStr;
|
|
|
|
|
|
}else{
|
|
|
|
|
|
Style = FStr;
|
|
|
|
|
|
}
|
|
|
|
|
|
if(L->styleSheet() != Style)
|
|
|
|
|
|
L->setStyleSheet(Style);
|
|
|
|
|
|
}
|
|
|
|
|
|
void P01_MianPage::SetStyleStr(QLabel *L,bool B1,bool B2,QStringList StyStr){
|
|
|
|
|
|
if(L == nullptr) return;
|
|
|
|
|
|
QString Style = "";
|
|
|
|
|
|
if(B1 && ! B2){
|
|
|
|
|
|
Style = StyStr[1];
|
|
|
|
|
|
}else if(!B1 && B2){
|
|
|
|
|
|
Style = StyStr[2];
|
|
|
|
|
|
}else if(!B1 && !B2){
|
|
|
|
|
|
Style = StyStr[0];
|
|
|
|
|
|
}else{
|
|
|
|
|
|
Style = "";
|
|
|
|
|
|
}
|
|
|
|
|
|
if(L->styleSheet() != Style)
|
|
|
|
|
|
L->setStyleSheet(Style);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void P01_MianPage::RotateDev(){
|
|
|
|
|
|
mAngle = mAngle + 1;
|
|
|
|
|
|
if(mAngle > 360) mAngle =0;
|
|
|
|
|
|
//mObjLoader->rotateArmToAbsoluteYAngle(DevName3D, jd);
|
|
|
|
|
|
}
|