298 lines
7.6 KiB
C++
298 lines
7.6 KiB
C++
#include "devicestateuserwidget.h"
|
|
#include "ui_devicestateuserwidget.h"
|
|
#include "deviceproxy.h"
|
|
#include "modbustcp.h"
|
|
#include "deviceinfo.h"
|
|
#include <QVector>
|
|
#include <QDebug>
|
|
#include <QFileDialog>
|
|
#include "rs_settings.h"
|
|
#include <QDateTime>
|
|
#include "deviceproxy.h"
|
|
#include "exceptioncode.h"
|
|
#include "bridgesgl.h"
|
|
#include "modbustcp.h"
|
|
#include "login.h"
|
|
#include "setvaluewidget.h"
|
|
|
|
DeviceStateUserWidget::DeviceStateUserWidget(QWidget *parent) :
|
|
QFrame(parent),
|
|
ui(new Ui::DeviceStateUserWidget)
|
|
{
|
|
ui->setupUi(this);
|
|
connect(DEV,SIGNAL(MsgSetValueSGL(int)),this,SLOT(SetParamValue(int)));
|
|
|
|
// connect(DEV,SIGNAL(RSValueChangedSGL(double)),this,SLOT(setRSValue(double)));
|
|
|
|
// connect(DEV,SIGNAL(XAxisCtPosSGL(double)),this,SLOT(setXFPos(double)));
|
|
// connect(DEV,SIGNAL(YAxisCtPosSGL(double)),this,SLOT(setYFPos(double)));
|
|
// connect(DEV,SIGNAL(ZAxisCtPosSGL(double)),this,SLOT(setZFPos(double)));
|
|
// connect(DEV,SIGNAL(ZAAxisCtPosSGL(double)),this,SLOT(setZAFPos(double)));
|
|
// connect(DEV,SIGNAL(DAxisCtPosSGL(double)),this,SLOT(setDFPos(double)));
|
|
// connect(DEV,SIGNAL(Z0AxisCtPosSGL(double)),this,SLOT(setZ0FPos(double)));
|
|
// connect(DEV,SIGNAL(Z2AxisCtPosSGL(double)),this,SLOT(setZ2FPos(double)));
|
|
// connect(DEV,SIGNAL(TransferPLCSGL(int)),this,SLOT(setTransferPLC(int)));
|
|
// connect(DEV,SIGNAL(SeparatePLCSGL(int)),this,SLOT(setSeparatePLC(int)));
|
|
|
|
// strSts[0] = "未连接";
|
|
// strSts[1] = "故 障";
|
|
// strSts[2] = "待 机";
|
|
// strSts[3] = "初始化中";
|
|
// strSts[4] = "停 止";
|
|
// strSts[5] = "运 行";
|
|
// strSts[6] = "运行上料";
|
|
// strSts[7] = "运行下料";
|
|
// strSts[8] = "运行送碇";
|
|
}
|
|
|
|
DeviceStateUserWidget::~DeviceStateUserWidget()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
|
|
//void DeviceStateUserWidget::setXFPos(double XFPos)
|
|
//{
|
|
// QString str;
|
|
// str = QString::number(XFPos,'f',4)+"mm";
|
|
// ui->lbXAxisFPOS->setText(str);
|
|
//}
|
|
|
|
//void DeviceStateUserWidget::setYFPos(double YFPos)
|
|
//{
|
|
// ui->lbYAxisFPOS->setText(QString::number(YFPos,'f',4)+"mm");
|
|
//}
|
|
|
|
//void DeviceStateUserWidget::setZFPos(double ZFPos)
|
|
//{
|
|
// ui->lbZAxisFPOS->setText(QString::number(ZFPos,'f',4)+"mm");
|
|
//}
|
|
|
|
//void DeviceStateUserWidget::setZAFPos(double ZAFPos)
|
|
//{
|
|
// ui->lbZAAxisFPOS->setText(QString::number(ZAFPos,'f',4)+"mm");
|
|
//}
|
|
|
|
//void DeviceStateUserWidget::setZ0FPos(double Z0FPos)
|
|
//{
|
|
// ui->lbZ0AxisFPOS->setText(QString::number(Z0FPos,'f',4)+"mm");
|
|
//}
|
|
|
|
//void DeviceStateUserWidget::setZ2FPos(double Z2FPos)
|
|
//{
|
|
// ui->lbZ2AxisFPOS->setText(QString::number(Z2FPos,'f',4)+"mm");
|
|
//}
|
|
|
|
//void DeviceStateUserWidget::setDFPos(double DFPos)
|
|
//{
|
|
// ui->lbDAxisFPOS->setText(QString::number(DFPos,'f',4)+"mm");
|
|
//}
|
|
|
|
|
|
//void DeviceStateUserWidget::setRSValue(double value)
|
|
//{
|
|
// ui->lbRSValue->setText(QString::number(value,'f',4)+"mm");
|
|
//}
|
|
|
|
|
|
//void DeviceStateUserWidget::setTransferPLC(int sts)
|
|
//{
|
|
// int mysts = sts + 1;
|
|
// if (mysts == 5)
|
|
// mysts += MODBUSTCP->TransferPLCSts;
|
|
// if (mysts > 8)
|
|
// ui->lbTransferPLC->setText("未知状态");
|
|
// else
|
|
// {
|
|
// ui->lbTransferPLC->setText(strSts[mysts]);
|
|
|
|
// }
|
|
//}
|
|
//void DeviceStateUserWidget::setSeparatePLC(int sts)
|
|
//{
|
|
// int mysts = sts + 1;
|
|
// if (mysts > 5)
|
|
// ui->lbSeparatePLC->setText("未知状态");
|
|
// else
|
|
// {
|
|
// ui->lbSeparatePLC->setText(strSts[mysts]);
|
|
// }
|
|
//}
|
|
|
|
|
|
//void DeviceStateUserWidget::on_pbTransferPLCInit_clicked()
|
|
//{
|
|
// int ret = MODBUSTCP->TransferPLCRun(MODBUSTCP->InitAddr,10000);
|
|
// if (ret < 0)
|
|
// {
|
|
// QMessageBox::information(this, "提示", "命令执行中,请稍候");
|
|
// }
|
|
//}
|
|
|
|
//void DeviceStateUserWidget::on_pbTransferPLCRun_clicked()
|
|
//{
|
|
// int ret = MODBUSTCP->TransferPLCRun(MODBUSTCP->RunAddr,1000);
|
|
// if (ret < 0)
|
|
// {
|
|
// QMessageBox::information(this, "提示", "命令执行中,请稍候");
|
|
// }
|
|
//}
|
|
|
|
//void DeviceStateUserWidget::on_pbTransferPLCStop_clicked()
|
|
//{
|
|
// int ret = MODBUSTCP->TransferPLCRun(MODBUSTCP->StopAddr,1000);
|
|
// if (ret < 0)
|
|
// {
|
|
// QMessageBox::information(this, "提示", "命令执行中,请稍候");
|
|
// }
|
|
//}
|
|
|
|
//void DeviceStateUserWidget::on_pbTransferPLCClearAlarm_clicked()
|
|
//{
|
|
// int ret = MODBUSTCP->TransferPLCRun(MODBUSTCP->ClearAlarmAddr,1000);
|
|
// if (ret < 0)
|
|
// {
|
|
// QMessageBox::information(this, "提示", "命令执行中,请稍候");
|
|
// }
|
|
//}
|
|
|
|
//void DeviceStateUserWidget::on_pbSeparatePLCInit_clicked()
|
|
//{
|
|
// int ret = MODBUSTCP->SeparatePLCRun(MODBUSTCP->InitAddr,10000);
|
|
// if (ret < 0)
|
|
// {
|
|
// QMessageBox::information(this, "提示", "命令执行中,请稍候");
|
|
// }
|
|
//}
|
|
|
|
//void DeviceStateUserWidget::on_pbSeparatePLCRun_clicked()
|
|
//{
|
|
// int ret = MODBUSTCP->SeparatePLCRun(MODBUSTCP->RunAddr,1000);
|
|
// if (ret < 0)
|
|
// {
|
|
// QMessageBox::information(this, "提示", "命令执行中,请稍候");
|
|
// }
|
|
//}
|
|
|
|
//void DeviceStateUserWidget::on_pbSeparatePLCStop_clicked()
|
|
//{
|
|
// int ret = MODBUSTCP->SeparatePLCRun(MODBUSTCP->StopAddr,1000);
|
|
// if (ret < 0)
|
|
// {
|
|
// QMessageBox::information(this, "提示", "命令执行中,请稍候");
|
|
// }
|
|
//}
|
|
|
|
//void DeviceStateUserWidget::on_pbSeparatePLCClearAlarm_clicked()
|
|
//{
|
|
// int ret = MODBUSTCP->SeparatePLCRun(MODBUSTCP->ClearAlarmAddr,1000);
|
|
// if (ret < 0)
|
|
// {
|
|
// QMessageBox::information(this, "提示", "命令执行中,请稍候");
|
|
// }
|
|
//}
|
|
void DeviceStateUserWidget::SetParamValue(int value)
|
|
{
|
|
if (flag == 0)
|
|
{
|
|
if ((value != 4) || (value != 6) || (value != 8))
|
|
{
|
|
|
|
}
|
|
else
|
|
{
|
|
// QString str;
|
|
// str = QString()
|
|
// ui->tbSize->setText(str);
|
|
}
|
|
}
|
|
else if (flag == 1)
|
|
{
|
|
|
|
}
|
|
else if (flag == 2)
|
|
{
|
|
|
|
}
|
|
}
|
|
void DeviceStateUserWidget::on_pbRun_clicked()
|
|
{
|
|
|
|
DEV->semiAutoMach();
|
|
}
|
|
|
|
void DeviceStateUserWidget::on_pbUser_clicked()
|
|
{
|
|
LogIn * login = new(LogIn);
|
|
login->exec();
|
|
}
|
|
|
|
void DeviceStateUserWidget::on_pbStop_clicked()
|
|
{
|
|
//if (DEV->bUserPower)
|
|
{
|
|
DEV->stop();
|
|
DEVICE_INFO->printDeviceSystemInfo("界面停止按钮按下!");
|
|
}
|
|
|
|
}
|
|
|
|
void DeviceStateUserWidget::on_pbSuspend_clicked()
|
|
{
|
|
|
|
{
|
|
if (DEV->SuspendFlag)
|
|
DEV->SuspendFlag = false;
|
|
else
|
|
DEV->SuspendFlag = true;
|
|
emit DEV->StopStateSGL(!DEV->SuspendFlag);
|
|
}
|
|
}
|
|
|
|
void DeviceStateUserWidget::on_pbReset_clicked()
|
|
{
|
|
DEV->DEVInit();
|
|
bool isdevIsInit = DEV->getDevIsInit();
|
|
if (isdevIsInit == false)
|
|
return;
|
|
DEV->laserCtlCnn();
|
|
DEV->AirValveClose();
|
|
DEV->CuCeGaoOpen();
|
|
|
|
bool isreset = DEV->getDevIsReset();
|
|
if (isreset == false)
|
|
DEV->reset();
|
|
// if (MODBUSTCP->PLCSts[1] == 1)
|
|
// {
|
|
// MODBUSTCP->SeparatePLCRun(MODBUSTCP->InitAddr,10000);
|
|
// }
|
|
// else
|
|
// QMessageBox::information(this, "提示", "分离PLC不在 待机 状态,不能执行 初始化 操作!");
|
|
// if (MODBUSTCP->PLCSts[0] == 1)
|
|
// MODBUSTCP->TransferPLCRun(MODBUSTCP->InitAddr,10000);
|
|
// else
|
|
// QMessageBox::information(this, "提示", "传输PLC不在 待机 状态,不能执行 初始化 操作!");
|
|
}
|
|
|
|
|
|
void DeviceStateUserWidget::on_tbSize_clicked()
|
|
{
|
|
flag = 0;
|
|
SetValueWidget * setValueWidget = new(SetValueWidget);
|
|
setValueWidget->exec();
|
|
}
|
|
|
|
void DeviceStateUserWidget::on_tbDepth_clicked()
|
|
{
|
|
flag = 1;
|
|
SetValueWidget * setValueWidget = new(SetValueWidget);
|
|
setValueWidget->exec();
|
|
}
|
|
|
|
void DeviceStateUserWidget::on_tbNumber_clicked()
|
|
{
|
|
flag = 2;
|
|
SetValueWidget * setValueWidget = new(SetValueWidget);
|
|
setValueWidget->exec();
|
|
}
|