Commit 736ba079 by xiaoqing.gu

新增库存同步按钮和弹窗

parent 8b795003
Pipeline #42869 failed with stage
in 0 seconds
...@@ -55,7 +55,8 @@ SOURCES += main.cpp \ ...@@ -55,7 +55,8 @@ SOURCES += main.cpp \
qrencode/qrinput.c \ qrencode/qrinput.c \
qrencode/qrspec.c \ qrencode/qrspec.c \
qrencode/rscode.c \ qrencode/rscode.c \
qrencode/split.c qrencode/split.c \
infodlg.cpp
HEADERS += mainwindow.h \ HEADERS += mainwindow.h \
models/orderObject.h \ models/orderObject.h \
...@@ -84,7 +85,8 @@ HEADERS += mainwindow.h \ ...@@ -84,7 +85,8 @@ HEADERS += mainwindow.h \
qrencode/qrinput.h \ qrencode/qrinput.h \
qrencode/qrspec.h \ qrencode/qrspec.h \
qrencode/rscode.h \ qrencode/rscode.h \
qrencode/split.h qrencode/split.h \
infodlg.h
FORMS += mainwindow.ui \ FORMS += mainwindow.ui \
alertform.ui \ alertform.ui \
...@@ -92,7 +94,8 @@ FORMS += mainwindow.ui \ ...@@ -92,7 +94,8 @@ FORMS += mainwindow.ui \
storemgtform.ui \ storemgtform.ui \
dishmgtform.ui \ dishmgtform.ui \
detailform.ui \ detailform.ui \
dailyform.ui dailyform.ui \
infodlg.ui
DISTFILES += \ DISTFILES += \
../run/client.ini \ ../run/client.ini \
......
#include "infodlg.h"
#include "ui_infodlg.h"
InfoDlg::InfoDlg(QWidget *parent) :
QDialog(parent),
ui(new Ui::InfoDlg)
{
ui->setupUi(this);
setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint);
// setAttribute(Qt::WA_TranslucentBackground);
this->setModal(true);
}
InfoDlg::~InfoDlg()
{
delete ui;
}
void InfoDlg::on_btn_cancel_clicked()
{
this->reject();
}
void InfoDlg::on_btn_ok_clicked()
{
this->accept();
}
#ifndef INFODLG_H
#define INFODLG_H
#include <QDialog>
namespace Ui {
class InfoDlg;
}
class InfoDlg : public QDialog
{
Q_OBJECT
public:
explicit InfoDlg(QWidget *parent = nullptr);
~InfoDlg();
private slots:
void on_btn_cancel_clicked();
void on_btn_ok_clicked();
private:
Ui::InfoDlg *ui;
};
#endif // INFODLG_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>InfoDlg</class>
<widget class="QDialog" name="InfoDlg">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<height>200</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>500</width>
<height>200</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>500</width>
<height>200</height>
</size>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="styleSheet">
<string notr="true">#InfoDlg
{
border:1px solid rgb(159, 159, 159);
background-color: rgb(255, 255, 255);
border-radius:10px;
}
</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>温馨提示</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string> 将门店库存立即全部同步给外卖平台。设置自定义比例/自定义
数量将会清空,如果需要自定义请再去设置。</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btn_cancel">
<property name="minimumSize">
<size>
<width>80</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>40</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">border:1px solid rgb(186, 186, 186);
background:rgb(255,255,255);
font: 75 14px &quot;微软雅黑&quot;;
border-radius:10px;</string>
</property>
<property name="text">
<string>取 消</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btn_ok">
<property name="minimumSize">
<size>
<width>80</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>40</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">border:1px solid rgb(186, 186, 186);
background:rgb(159,33,37);
font: 75 14px &quot;微软雅黑&quot;;
border-radius:10px;</string>
</property>
<property name="text">
<string>确 定</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <QDir> #include <QDir>
#include <memory> #include <memory>
#include "qrencode/qrcodeicon.h" #include "qrencode/qrcodeicon.h"
#include "infodlg.h"
#if _MSC_VER >= 1600 #if _MSC_VER >= 1600
#pragma execution_character_set("utf-8") #pragma execution_character_set("utf-8")
...@@ -49,7 +50,8 @@ MainWindow::MainWindow(QWidget *parent) : ...@@ -49,7 +50,8 @@ MainWindow::MainWindow(QWidget *parent) :
{ {
if(state == LOGON) if(state == LOGON)
{ {
ui->main_btnMDGL->setEnabled(true); // ui->main_btnMDGL->setEnabled(true);
ui->main_btnKCTB->setEnabled(true);
ui->main_btnSPGL->setEnabled(true); ui->main_btnSPGL->setEnabled(true);
ui->main_btnRJ->setEnabled(true); ui->main_btnRJ->setEnabled(true);
ui->main_labStoreName->setText(storeName); ui->main_labStoreName->setText(storeName);
...@@ -57,7 +59,8 @@ MainWindow::MainWindow(QWidget *parent) : ...@@ -57,7 +59,8 @@ MainWindow::MainWindow(QWidget *parent) :
} }
else if(state == LOGOUT) else if(state == LOGOUT)
{ {
ui->main_btnMDGL->setEnabled(false); // ui->main_btnMDGL->setEnabled(false);
ui->main_btnKCTB->setEnabled(false);
ui->main_btnSPGL->setEnabled(false); ui->main_btnSPGL->setEnabled(false);
ui->main_btnRJ->setEnabled(false); ui->main_btnRJ->setEnabled(false);
ui->main_labStoreName->setText("<font color='#ff0000'>未登录</font>"); ui->main_labStoreName->setText("<font color='#ff0000'>未登录</font>");
...@@ -107,6 +110,8 @@ MainWindow::MainWindow(QWidget *parent) : ...@@ -107,6 +110,8 @@ MainWindow::MainWindow(QWidget *parent) :
// 日结窗口 // 日结窗口
m_dailyForm = new DailyForm(this); m_dailyForm = new DailyForm(this);
m_infoDlg = new InfoDlg(this);
connect(ui->main_btnRJ, &QPushButton::clicked, []() connect(ui->main_btnRJ, &QPushButton::clicked, []()
{ {
FlowControl::Instance().GetDailyInfo(); FlowControl::Instance().GetDailyInfo();
...@@ -149,12 +154,13 @@ MainWindow::MainWindow(QWidget *parent) : ...@@ -149,12 +154,13 @@ MainWindow::MainWindow(QWidget *parent) :
table->hide(); table->hide();
} }
// 先将部分功能禁用(登陆后可以使用) // 先将部分功能禁用(登陆后可以使用)
ui->main_btnMDGL->setEnabled(false); // ui->main_btnMDGL->setEnabled(false);
ui->main_btnKCTB->setEnabled(false);
ui->main_btnSPGL->setEnabled(false); ui->main_btnSPGL->setEnabled(false);
ui->main_btnRJ->setEnabled(false); ui->main_btnRJ->setEnabled(false);
if( !ConfigManage::Instance().bStoreManagement() ) if( !ConfigManage::Instance().bStoreManagement() )
{ {
ui->main_btnMDGL->hide(); // ui->main_btnMDGL->hide();
} }
if( !ConfigManage::Instance().bDishesManagement() ) if( !ConfigManage::Instance().bDishesManagement() )
{ {
...@@ -628,3 +634,40 @@ void MainWindow::onNeedToPrint(OrderObject* orderObj) ...@@ -628,3 +634,40 @@ void MainWindow::onNeedToPrint(OrderObject* orderObj)
{ {
_PrintNewOrder(orderObj); _PrintNewOrder(orderObj);
} }
void MainWindow::on_main_btnKCTB_clicked()
{
m_infoDlg->exec();
if(m_infoDlg->result() == QDialog::Accepted)
{
QTcpSocket *socket = new QTcpSocket();
socket->connectToHost("127.0.0.1", 34956);
if(socket->waitForConnected(1000))
{
QByteArray ba("Inventory synchronization");
FMSOCKEHEADER header = { 0, 0, 0 };
header.flag = 0x4d46;
header.len = ba.length();
header.ver = 0x1;
char* m_pFmPackage = new char[ba.length() + sizeof(FMSOCKEHEADER)];
memcpy(m_pFmPackage, &header, sizeof(FMSOCKEHEADER));
memcpy(m_pFmPackage+sizeof(FMSOCKEHEADER), ba, ba.length());
socket->write(m_pFmPackage, ba.length() + sizeof(FMSOCKEHEADER));
if(! socket->waitForBytesWritten(1000))
{
QLOG_INFO() << "takeaway component maybe cannot timinate";
}
socket->disconnectFromHost();
delete[] m_pFmPackage;
}
if (socket->state() == QAbstractSocket::UnconnectedState ||
socket->waitForDisconnected(1000))
delete socket;
}
}
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "floatform.h" #include "floatform.h"
#include "detailform.h" #include "detailform.h"
#include "dailyform.h" #include "dailyform.h"
#include "infodlg.h"
#include <QMainWindow> #include <QMainWindow>
#include <QPushButton> #include <QPushButton>
...@@ -44,6 +45,8 @@ private: ...@@ -44,6 +45,8 @@ private:
DailyForm *m_dailyForm=nullptr; DailyForm *m_dailyForm=nullptr;
// 托盘 // 托盘
QSystemTrayIcon* m_trayIcon=nullptr; QSystemTrayIcon* m_trayIcon=nullptr;
//提示框
InfoDlg *m_infoDlg = nullptr;
private: private:
/* 功能:获取订单对应的Table、操作和状态描述 /* 功能:获取订单对应的Table、操作和状态描述
...@@ -88,6 +91,7 @@ private slots: ...@@ -88,6 +91,7 @@ private slots:
void on_main_btnDown_clicked(); void on_main_btnDown_clicked();
void on_main_btnSPGL_clicked(); void on_main_btnSPGL_clicked();
void onNeedToPrint(OrderObject *orderObj); void onNeedToPrint(OrderObject *orderObj);
void on_main_btnKCTB_clicked();
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H
...@@ -250,52 +250,52 @@ ...@@ -250,52 +250,52 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QPushButton" name="main_btnRJ"> <widget class="QPushButton" name="main_btnKCTB">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>40</width> <width>58</width>
<height>30</height> <height>30</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>40</width> <width>58</width>
<height>30</height> <height>30</height>
</size> </size>
</property> </property>
<property name="focusPolicy"> <property name="focusPolicy">
<enum>Qt::NoFocus</enum> <enum>Qt::NoFocus</enum>
</property> </property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text"> <property name="text">
<string>日结</string> <string>库存同步</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="main_btnMDGL"> <widget class="QPushButton" name="main_btnRJ">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>58</width> <width>40</width>
<height>30</height> <height>30</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>58</width> <width>40</width>
<height>30</height> <height>30</height>
</size> </size>
</property> </property>
<property name="focusPolicy"> <property name="focusPolicy">
<enum>Qt::NoFocus</enum> <enum>Qt::NoFocus</enum>
</property> </property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text"> <property name="text">
<string>门店管理</string> <string>日结</string>
</property> </property>
</widget> </widget>
</item> </item>
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
color: #000000; color: #000000;
border-image: url(:main_btnTab_disabled.png); border-image: url(:main_btnTab_disabled.png);
} }
#main_btnMDGL,#main_btnSPGL,#main_btnSetting,#main_btnHide,#main_btnRJ #main_btnMDGL,#main_btnSPGL,#main_btnSetting,#main_btnHide,#main_btnRJ,#main_btnKCTB
{ {
font: 10pt "微软雅黑"; font: 10pt "微软雅黑";
color: #ffffff; color: #ffffff;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment