231 lines
9.1 KiB
C
231 lines
9.1 KiB
C
|
#ifndef MAINWIDGETFUNCTION_H
|
|||
|
#define MAINWIDGETFUNCTION_H
|
|||
|
|
|||
|
#include <QObject>
|
|||
|
#include <QWidget>
|
|||
|
#include <QApplication>
|
|||
|
#include <stdio.h>
|
|||
|
#include <QDateTime>
|
|||
|
#include <QProcess>
|
|||
|
#include "main.h"
|
|||
|
#include "machine/error.h"
|
|||
|
#include "sharedviews/promptdialog.h"
|
|||
|
#include "sharedviews/passworddialog.h"
|
|||
|
#include "sharedviews/systemmanagedialog.h"
|
|||
|
#include "sharedviews/brokenlinedialog.h"
|
|||
|
#include "datafile/datafiledst.h"
|
|||
|
#include "datafile/datafiledsr.h"
|
|||
|
#include "settings/lotsettings.h"
|
|||
|
#include "items/errorcodestateitem.h"
|
|||
|
#include "Lot/csvcode.h"
|
|||
|
#include "items/paraitem.h"
|
|||
|
#include "sharedviews/debuginfodialog.h"
|
|||
|
|
|||
|
#ifdef Q_OS_WIN
|
|||
|
#include <windows.h>
|
|||
|
#endif
|
|||
|
|
|||
|
#define DATA_DS8 1
|
|||
|
#define DATA_DS16 2
|
|||
|
#define DATA_FORMATE DATA_DS16
|
|||
|
|
|||
|
#define COLUMN_CODE 0 //信息代码(第一列)
|
|||
|
#define COLUMN_INFO 1 //映射信息(第二列)
|
|||
|
#define COLUMN_SCORE 2 //分值(第三列)
|
|||
|
#define COLUMN_PRESSNUM 3 //是否被点击过(第四列)
|
|||
|
|
|||
|
#define HEADNUM 32
|
|||
|
#define NEEDLENUM 15
|
|||
|
|
|||
|
#define WIFIINIPATH "/etc/iot_cfg/mcgs_box_conf.ini"
|
|||
|
|
|||
|
struct HMIFileHead
|
|||
|
{
|
|||
|
int fileNum;
|
|||
|
};
|
|||
|
|
|||
|
struct HMIItemFileHead
|
|||
|
{
|
|||
|
char filePath[64];
|
|||
|
char fileName[64];
|
|||
|
int dataCheck;
|
|||
|
int fileSize;
|
|||
|
};
|
|||
|
|
|||
|
class MainWidgetFunction : public QObject
|
|||
|
{
|
|||
|
Q_OBJECT
|
|||
|
public:
|
|||
|
explicit MainWidgetFunction(QObject *parent = 0);
|
|||
|
~MainWidgetFunction();
|
|||
|
|
|||
|
private:
|
|||
|
PromptDialog *m_pPromptDlg;
|
|||
|
SystemManageDialog *m_pSystemManageDlg;
|
|||
|
BrokenLineDialog *m_pBrokenLineDialog;
|
|||
|
DebugInfoDialog *m_pDebugInfoDlg;
|
|||
|
MCStatus m_mcStatus;
|
|||
|
int m_curFileID;
|
|||
|
QString m_filePath;
|
|||
|
QString m_fileName;
|
|||
|
McLotData m_mcLotData;//下位机物联数据
|
|||
|
HMILotData m_HMILotData;//上位机物联数据
|
|||
|
int m_sensorBitmapNum;//传感器位图个数
|
|||
|
QList<ErrorCodeStateItem> m_errorCodeAndStateItemList;//错误代码和状态列表
|
|||
|
QTimer * m_pTipsTimer; //4小时定时器提示用户使用时长不足5天
|
|||
|
//QTimer timer; //测试物联网用
|
|||
|
int m_getScore;//安装进度调试得分
|
|||
|
int m_totalScore;//总分值
|
|||
|
QStringList m_csvFileStrList;
|
|||
|
|
|||
|
private:
|
|||
|
void initialize();//初始化
|
|||
|
void initializeLotInfo();//初始化物联网所需要的机器信息
|
|||
|
void initializeLotData();//初始化物联网数据
|
|||
|
void systemUpgrade(int type);
|
|||
|
s16 refreshWifiList(QStringList &wifiStrList,s16 scan = 0);//刷新wifi列表
|
|||
|
QString getIpSegment(bool bl);//获取已连接wifi分配的IP
|
|||
|
void writePonitToFile(QString filePath,int x, int y, int flag = 0);//将定位点或起绣点写回到文件中(以及工作机头)
|
|||
|
void sendDs16PatternData(int type = FILE_TYPE_DAT);//发送ds16花样数据
|
|||
|
void convertDs16ToDs8AndSend(QString filePath,int type = FILE_TYPE_DAT);//将ds16数据转换为ds8数据并发送
|
|||
|
void addProductStatisInfo(int patternBreakLineNum);//添加生产统计信息
|
|||
|
|
|||
|
void addJournalInfoError();//添加错误日志信息
|
|||
|
void addJournalInfoBreakage();//添加断线日志信息
|
|||
|
void addJournalInfoDebug();//添加调试信息
|
|||
|
|
|||
|
QString getCompileDateTime();
|
|||
|
QString compositionJson(QString key,QString value);//组成json键值对
|
|||
|
HMILotData getHMILotData();//获取界面物联数据
|
|||
|
void sendDataToGateway(s16 code,s16 type = 0);//发送数据到物联网
|
|||
|
|
|||
|
public:
|
|||
|
void setErrorCodeAndStateList(QList<ErrorCodeStateItem> list);//设置错误代码和状态的列表
|
|||
|
void setShutDownTime();//上电计算关机时间并发送给主控
|
|||
|
void setMcStates(MCStatus mcStatus);//设置机器状态
|
|||
|
QString getVersionStr();
|
|||
|
QString detectUsb();//优盘检测
|
|||
|
s16 detectWifiConnect();
|
|||
|
void funImportParameter(QString tStyle);//参数导入
|
|||
|
void funExportParameter();//参数导出
|
|||
|
void funMCUpgrade(QString tStyle);//主控升级
|
|||
|
void funHMIUpgrade(QString tStyle);//界面升级
|
|||
|
void funWIFI(QString tStyle);//WIFI管理
|
|||
|
void funAllToZero();//全部归零
|
|||
|
void funResetOutput();//产量清零
|
|||
|
void funAllToReset();//流程复位
|
|||
|
void funFlatEmbHook();//平绣勾线
|
|||
|
void funSpindleJog();//主轴点动
|
|||
|
|
|||
|
void funSpindleRotate();//主轴旋转
|
|||
|
void funBackWorkPoint();//回工作点
|
|||
|
void funBackToOrigin();//回原点
|
|||
|
void funSetStartPoint(QString filePath,int x,int y,int showFlag = 0);//设置起始点
|
|||
|
void funBackStartPoint();// 回起针点
|
|||
|
void funSetOffsetPoint();//设置偏移点
|
|||
|
void funBackOffsetPoint();//回偏移点
|
|||
|
void funBorderCheck();//边框检查
|
|||
|
void funManualTrim();//手动剪线
|
|||
|
void funCutterOpenAndClose();//剪刀开合
|
|||
|
void funSetWorkArea();// 设置可工作区域
|
|||
|
void funSimulateFrame();//空走边框
|
|||
|
void funProcessReset();//流程复位
|
|||
|
void funSetFeedPoint();//定上料点
|
|||
|
void funBackFeedPoint();//回上料点
|
|||
|
void funManualOil();//手动加油
|
|||
|
void funResetRepeatNum();//重置反复次数
|
|||
|
void funShuttleChange();//梭盘计数复位
|
|||
|
void funGotoZeroPos();//框架归零
|
|||
|
void funSetWorkRange();//定工作范围
|
|||
|
void sendPatternHead(QString filePath);//发送花样文件头
|
|||
|
void sendPatternData(QString filePath,int type = FILE_TYPE_DAT);//发送花样数据
|
|||
|
void funBottomDetect();//底线检测
|
|||
|
void funFaceDetect();//面线检测
|
|||
|
void funExitRoot();//退出登录
|
|||
|
void funAgingTest();//老化测试
|
|||
|
void funGetMCVersionInfo();//获取主控主板版本信息
|
|||
|
void funProductStatistics(QString tStyle,QString filePath,int patternBreakLineNum);//生产统计
|
|||
|
// void funJournal(QString bStyle,QString tStyle);//文件日志
|
|||
|
void funJournalError(QString tStyle);//错误日志
|
|||
|
// void funJournalBreakage(QString bStyle,QString tStyle);//断线日志
|
|||
|
void funDebugInfo();
|
|||
|
void funSoftwareAuthor();//软件授权
|
|||
|
void funChangeOneShuttle();//自动换一个梭
|
|||
|
void funAllMtZero();//所有主轴零位
|
|||
|
void funAllMtG();//所有主轴勾线
|
|||
|
void funAllMtM();//所有主轴点动
|
|||
|
void funMainshaftAdjust();// 针梭校对
|
|||
|
void funAllMainShaftRun(); // 主轴研车
|
|||
|
void funShutDown();//win下关闭计算机
|
|||
|
int funErrorPrompt(QString info);//错误信息提示
|
|||
|
int funDetectBreakLineStatus();//检测断线状态
|
|||
|
void funSetPromptDlgVisibleFalse();//错误信息提示窗体隐藏
|
|||
|
void funBottomLineCountReset();//底线计数复位
|
|||
|
void funManualOrAutoSwitch(s16 val = 0);//手自动工作状态切换 0:手动 1:自动
|
|||
|
void deleteDir(QString path);//删除文件夹
|
|||
|
void funSimulatedSewing();//模拟工作
|
|||
|
void manualThreadCutting(); //手动剪线
|
|||
|
void makeup(int mode); //补缝
|
|||
|
void headLiftUpDown();//机头升降
|
|||
|
void headLifting();//机头上升
|
|||
|
void funSetAnchorPoint(QString filePath,int x,int y,int showFlag = 0);//设置定位点
|
|||
|
void funBackAnchorPoint();//回定位点
|
|||
|
void funBackShuttlePos();//回换梭位
|
|||
|
void funNeedleShuttleReset();//针梭校对
|
|||
|
|
|||
|
private slots:
|
|||
|
void slotMCInfoChange();//机器信息改变
|
|||
|
void slotReceiveLotData();//接收物联数据
|
|||
|
void slotRunLotDataAction(QString str);//执行网关数据动作
|
|||
|
//void slotSendJsonToMqtt();//当界面与网关建立连接时需要向网关发送固定的键值对
|
|||
|
void slotTransProgress(u8 fileType, int send, int total); // 发送文件进度条
|
|||
|
void slotClearProductStatis();//清空产量统计
|
|||
|
void slotCsvExport(int logType);//导出csv文件
|
|||
|
void slotClearJournal();//清空文件日志
|
|||
|
void slotRefreshWifiList();//刷新wifi列表
|
|||
|
void onTipsTimer();//4小时定时器
|
|||
|
void slotSetDynamicIP(QString ssid);//设置动态IP
|
|||
|
void slotSetStaticIP(QString ssid,QString psd,QString dnip);//设置静态IP
|
|||
|
void slotSpindleAction(int action);//主轴动作
|
|||
|
void slotSpindleRotate(int angle);//主轴旋转
|
|||
|
|
|||
|
signals:
|
|||
|
void siSetButtonUserLogo(int level);
|
|||
|
void siHeadBuf(u8* buf);
|
|||
|
void siClearPatternBreakLineNum();
|
|||
|
void siDebugState();
|
|||
|
void siCloseRootPara();
|
|||
|
void siClearPattern();
|
|||
|
void siClearPatternFcg();
|
|||
|
void siShowPercentage(int val);
|
|||
|
//void siReceiveLotDat(); //测试物联网用
|
|||
|
|
|||
|
void siAfterDeleteFileid();//xcy 0314 删掉影响fileid的数据后需要将m_fileHead置为0
|
|||
|
void siWifiState(bool bl);//wifi连接状态
|
|||
|
void siHeadParaImportFinish(int type);
|
|||
|
|
|||
|
public slots:
|
|||
|
void slotUserLogin(s16 user);//用户登录
|
|||
|
void slotHMIDecrypt(QString id);//界面解密
|
|||
|
void slotExitApp();//超级用户退出程序
|
|||
|
void slotVerRecovery();//超级用户下版本恢复
|
|||
|
void slotChangePassword();//超级用户下修改一级密码
|
|||
|
void slotDeleteIni();//删除执行目录下的config.ini
|
|||
|
void slotImportCSV();//导入csv文件
|
|||
|
void slotDeleteCSV();//删除csv文件
|
|||
|
void slotResetCSV();//重置安装调试进度
|
|||
|
void slotDebugMode();//界面调试模式
|
|||
|
void slotPatternClear();//超级用户下花样总清
|
|||
|
void slotCalMachineProgress(s16 csvCode,s16 type = 0);//计算安装调试进度
|
|||
|
void slotJournalError();//错误日志
|
|||
|
void slotJournalBreakage();//断线日志
|
|||
|
void slotCsvChangeDebug();//调试信息
|
|||
|
//以下为测试记录断线次数精准到针位
|
|||
|
//void testBreakLineNeedle();
|
|||
|
public:
|
|||
|
//QTimer *m_testNeedle;
|
|||
|
|
|||
|
};
|
|||
|
|
|||
|
#endif // MAINWIDGETFUNCTION_H
|