Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
takeaway
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shuai.liu
takeaway
Commits
736ba079
Commit
736ba079
authored
Apr 27, 2023
by
xiaoqing.gu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增库存同步按钮和弹窗
parent
8b795003
Pipeline
#42869
failed with stage
in 0 seconds
Changes
9
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
302 additions
and
22 deletions
+302
-22
fmTakeaway/fmTakeaway.pro
+6
-3
fmTakeaway/infodlg.cpp
+27
-0
fmTakeaway/infodlg.h
+27
-0
fmTakeaway/infodlg.ui
+176
-0
fmTakeaway/mainwindow.cpp
+47
-4
fmTakeaway/mainwindow.h
+4
-0
fmTakeaway/mainwindow.ui
+14
-14
run/skin/deafult.qss
+1
-1
run/skin/tool/deafult.rcc
+0
-0
No files found.
fmTakeaway/fmTakeaway.pro
View file @
736ba079
...
...
@@ -55,7 +55,8 @@ SOURCES += main.cpp \
qrencode
/
qrinput
.
c
\
qrencode
/
qrspec
.
c
\
qrencode
/
rscode
.
c
\
qrencode
/
split
.
c
qrencode
/
split
.
c
\
infodlg
.
cpp
HEADERS
+=
mainwindow
.
h
\
models
/
orderObject
.
h
\
...
...
@@ -84,7 +85,8 @@ HEADERS += mainwindow.h \
qrencode
/
qrinput
.
h
\
qrencode
/
qrspec
.
h
\
qrencode
/
rscode
.
h
\
qrencode
/
split
.
h
qrencode
/
split
.
h
\
infodlg
.
h
FORMS
+=
mainwindow
.
ui
\
alertform
.
ui
\
...
...
@@ -92,7 +94,8 @@ FORMS += mainwindow.ui \
storemgtform
.
ui
\
dishmgtform
.
ui
\
detailform
.
ui
\
dailyform
.
ui
dailyform
.
ui
\
infodlg
.
ui
DISTFILES
+=
\
..
/
run
/
client
.
ini
\
...
...
fmTakeaway/infodlg.cpp
0 → 100644
View file @
736ba079
#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
();
}
fmTakeaway/infodlg.h
0 → 100644
View file @
736ba079
#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
fmTakeaway/infodlg.ui
0 → 100644
View file @
736ba079
<?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
"
微软雅黑
"
;
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
"
微软雅黑
"
;
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>
fmTakeaway/mainwindow.cpp
View file @
736ba079
...
...
@@ -13,6 +13,7 @@
#include <QDir>
#include <memory>
#include "qrencode/qrcodeicon.h"
#include "infodlg.h"
#if _MSC_VER >= 1600
#pragma execution_character_set("utf-8")
...
...
@@ -49,7 +50,8 @@ MainWindow::MainWindow(QWidget *parent) :
{
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_btnRJ
->
setEnabled
(
true
);
ui
->
main_labStoreName
->
setText
(
storeName
);
...
...
@@ -57,7 +59,8 @@ MainWindow::MainWindow(QWidget *parent) :
}
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_btnRJ
->
setEnabled
(
false
);
ui
->
main_labStoreName
->
setText
(
"<font color='#ff0000'>未登录</font>"
);
...
...
@@ -107,6 +110,8 @@ MainWindow::MainWindow(QWidget *parent) :
// 日结窗口
m_dailyForm
=
new
DailyForm
(
this
);
m_infoDlg
=
new
InfoDlg
(
this
);
connect
(
ui
->
main_btnRJ
,
&
QPushButton
::
clicked
,
[]()
{
FlowControl
::
Instance
().
GetDailyInfo
();
...
...
@@ -149,12 +154,13 @@ MainWindow::MainWindow(QWidget *parent) :
table
->
hide
();
}
// 先将部分功能禁用(登陆后可以使用)
ui
->
main_btnMDGL
->
setEnabled
(
false
);
// ui->main_btnMDGL->setEnabled(false);
ui
->
main_btnKCTB
->
setEnabled
(
false
);
ui
->
main_btnSPGL
->
setEnabled
(
false
);
ui
->
main_btnRJ
->
setEnabled
(
false
);
if
(
!
ConfigManage
::
Instance
().
bStoreManagement
()
)
{
ui
->
main_btnMDGL
->
hide
();
//
ui->main_btnMDGL->hide();
}
if
(
!
ConfigManage
::
Instance
().
bDishesManagement
()
)
{
...
...
@@ -628,3 +634,40 @@ void MainWindow::onNeedToPrint(OrderObject* 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
;
}
}
fmTakeaway/mainwindow.h
View file @
736ba079
...
...
@@ -6,6 +6,7 @@
#include "floatform.h"
#include "detailform.h"
#include "dailyform.h"
#include "infodlg.h"
#include <QMainWindow>
#include <QPushButton>
...
...
@@ -44,6 +45,8 @@ private:
DailyForm
*
m_dailyForm
=
nullptr
;
// 托盘
QSystemTrayIcon
*
m_trayIcon
=
nullptr
;
//提示框
InfoDlg
*
m_infoDlg
=
nullptr
;
private
:
/* 功能:获取订单对应的Table、操作和状态描述
...
...
@@ -88,6 +91,7 @@ private slots:
void
on_main_btnDown_clicked
();
void
on_main_btnSPGL_clicked
();
void
onNeedToPrint
(
OrderObject
*
orderObj
);
void
on_main_btnKCTB_clicked
();
};
#endif // MAINWINDOW_H
fmTakeaway/mainwindow.ui
View file @
736ba079
...
...
@@ -250,52 +250,52 @@
</spacer>
</item>
<item>
<widget
class=
"QPushButton"
name=
"main_btnRJ"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
<widget
class=
"QPushButton"
name=
"main_btnKCTB"
>
<property
name=
"minimumSize"
>
<size>
<width>
40
</width>
<width>
58
</width>
<height>
30
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
40
</width>
<width>
58
</width>
<height>
30
</height>
</size>
</property>
<property
name=
"focusPolicy"
>
<enum>
Qt::NoFocus
</enum>
</property>
<property
name=
"styleSheet"
>
<string
notr=
"true"
/>
</property>
<property
name=
"text"
>
<string>
日结
</string>
<string>
库存同步
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"main_btnMDGL"
>
<widget
class=
"QPushButton"
name=
"main_btnRJ"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
58
</width>
<width>
40
</width>
<height>
30
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
58
</width>
<width>
40
</width>
<height>
30
</height>
</size>
</property>
<property
name=
"focusPolicy"
>
<enum>
Qt::NoFocus
</enum>
</property>
<property
name=
"styleSheet"
>
<string
notr=
"true"
/>
</property>
<property
name=
"text"
>
<string>
门店管理
</string>
<string>
日结
</string>
</property>
</widget>
</item>
...
...
run/skin/deafult.qss
View file @
736ba079
...
...
@@ -19,7 +19,7 @@
color: #000000;
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 "微软雅黑";
color: #ffffff;
...
...
run/skin/tool/deafult.rcc
View file @
736ba079
No preview for this file type
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment