Commit c159ec9d by unknown

Add 1: git init

parent bc2bb8b1
#-------------------------------------------------
#
# Project created by QtCreator 2017-11-02T10:38:18
#
#-------------------------------------------------
QT += network
QT -= gui
TARGET = fmHttp
TEMPLATE = lib
DEFINES += FMHTTP_LIBRARY
SOURCES += fmhttp.cpp
HEADERS += fmhttp.h\
fmhttp_global.h
unix {
target.path = /usr/lib
INSTALLS += target
}
#include "fmhttp.h"
FmHttp::FmHttp()
{
}
#ifndef FMHTTP_H
#define FMHTTP_H
#include "fmhttp_global.h"
class FMHTTPSHARED_EXPORT FmHttp
{
public:
FmHttp();
};
#endif // FMHTTP_H
#ifndef FMHTTP_GLOBAL_H
#define FMHTTP_GLOBAL_H
#include <QtCore/qglobal.h>
#if defined(FMHTTP_LIBRARY)
# define FMHTTPSHARED_EXPORT Q_DECL_EXPORT
#else
# define FMHTTPSHARED_EXPORT Q_DECL_IMPORT
#endif
#endif // FMHTTP_GLOBAL_H
......@@ -28,6 +28,8 @@
#include "QsLogDestFile.h"
#include "QsLogDestFunctor.h"
#include <QString>
#include <QDir>
#include <QDate>
namespace QsLogging
{
......@@ -37,19 +39,37 @@ Destination::~Destination()
}
//! destination factory
DestinationPtr DestinationFactory::MakeFileDestination(const QString& filePath,
DestinationPtr DestinationFactory::MakeFileDestination(const QString& fileDir, const QString &filePrefix, int fileHoldDays,
LogRotationOption rotation, const MaxSizeBytes &sizeInBytesToRotateAfter,
const MaxOldLogCount &oldLogsToKeep)
{
//清理之前的日志
QDir dir(fileDir);
if(dir.exists())
{
dir.setFilter(QDir::Files | QDir::NoSymLinks);
QFileInfoList list = dir.entryInfoList();
foreach(QFileInfo info, list)
{
if(info.baseName().startsWith(filePrefix) &&
QDate::currentDate()>=info.lastModified().date().addDays(fileHoldDays))
{
QFile(info.filePath()).remove();
}
}
}
QString logPath = QString("%1/%2%3.txt").arg(fileDir, filePrefix, QDate::currentDate().toString("yyyy-MM-dd"));
if (EnableLogRotation == rotation) {
QScopedPointer<SizeRotationStrategy> logRotation(new SizeRotationStrategy);
logRotation->setMaximumSizeInBytes(sizeInBytesToRotateAfter.size);
logRotation->setBackupCount(oldLogsToKeep.count);
return DestinationPtr(new FileDestination(filePath, RotationStrategyPtr(logRotation.take())));
return DestinationPtr(new FileDestination(logPath, RotationStrategyPtr(logRotation.take())));
}
return DestinationPtr(new FileDestination(filePath, RotationStrategyPtr(new NullRotationStrategy)));
return DestinationPtr(new FileDestination(logPath, RotationStrategyPtr(new NullRotationStrategy)));
}
DestinationPtr DestinationFactory::MakeDebugOutputDestination()
......
......@@ -94,7 +94,8 @@ struct QSLOG_SHARED_OBJECT MaxOldLogCount
class QSLOG_SHARED_OBJECT DestinationFactory
{
public:
static DestinationPtr MakeFileDestination(const QString& filePath,
static DestinationPtr MakeFileDestination(const QString& fileDir,
const QString& filePrefix, int fileHoldDays = 10,
LogRotationOption rotation = DisableLogRotation,
const MaxSizeBytes &sizeInBytesToRotateAfter = MaxSizeBytes(),
const MaxOldLogCount &oldLogsToKeep = MaxOldLogCount());
......
......@@ -29,6 +29,8 @@ FlowControl::FlowControl()
// 初始化TcpServer监听
m_tcpServer = new QTcpServer(this);
// 业务需求不高,未作并发处理
connect(m_tcpServer, &QTcpServer::newConnection, [this]()
{
QTcpSocket *socket = m_tcpServer->nextPendingConnection();
......@@ -49,24 +51,40 @@ FlowControl::FlowControl()
connect(this, &FlowControl::recordSale, &Sales::Instance(), &Sales::onRecordSale);
}
void FlowControl::Start()
{
QLOG_INFO() << QString(">>>>>>>>>>>>>>>>>>程序启动%1<<<<<<<<<<<<<<<<<<").arg(PRODUCT_VERSION);
QString storeId = ConfigManage::Instance().storeId();
if( !storeId.isEmpty() )
{
m_storeInfo.sotoreId = storeId;
m_storeInfo.posId = "01";
_onLogin();
}
int port = ConfigManage::Instance().tcpServerPort();
bool result = m_tcpServer->listen(QHostAddress::Any, port);
QLOG_INFO() << QString("绑定端口[%1],结果[%2]").arg(port).arg(result);
}
int FlowControl::_ParseTcpData(const QString &data, QString& error)
{
int result = 0;
error = "invalid data";
QJsonObject jsonObject, store_info;
error = "无效的数据";
QJsonObject recvObj, infoObj;
QJsonParseError jsonError;
jsonObject = QJsonDocument::fromJson(data.toUtf8(), &jsonError).object();
recvObj = QJsonDocument::fromJson(data.toUtf8(), &jsonError).object();
if( jsonError.error == QJsonParseError::NoError )
{
QString fm_cmd = jsonObject["fm_cmd"].toString();
QString fm_cmd = recvObj["fm_cmd"].toString();
if( !fm_cmd.compare("put_store_info") )
{
// 获取到的是门店信息->登陆
store_info = jsonObject["store_info"].toObject();
QString pos_id = store_info["pos_id"].toString();
QString store_id = store_info["store_id"].toString();
QString business_date = store_info["business_date"].toString();
infoObj = recvObj["store_info"].toObject();
QString pos_id = infoObj["pos_id"].toString();
QString store_id = infoObj["store_id"].toString();
QString business_date = infoObj["business_date"].toString();
if( !pos_id.isEmpty() && !store_id.isEmpty() )
{
if( !m_bLogged )
......@@ -76,12 +94,11 @@ int FlowControl::_ParseTcpData(const QString &data, QString& error)
m_storeInfo.businessDate = business_date;
_onLogin();
}
error = QString("sucessful");
error = QString("成功");
result = 1;
}
}
}
return result;
}
......@@ -109,7 +126,7 @@ void FlowControl::_onLogin()
m_storeInfo.phone = storeObj["phone"].toString();
m_storeInfo.address = storeObj["address"].toString();
emit loginSucessful(m_storeInfo.name);
// 记录下门店号
// 记录下门店号到配置文件
ConfigManage::Instance().setStoreId(m_storeInfo.sotoreId);
// 开始拉取订单
......@@ -143,7 +160,7 @@ void FlowControl::_onPullOrder()
QJsonObject recvObj = QJsonDocument::fromJson(data).object();
if(recvObj["statusCode"].toInt() == 100)
{
hideAlertForm();
//hideAlertForm();
m_timestamp = recvObj["timestamp"].toString();
QJsonArray values = recvObj["orders"].toArray();
foreach(QJsonValue value, values)
......@@ -155,11 +172,15 @@ void FlowControl::_onPullOrder()
{
orderObj = new OrderObject(this);
m_ordersMap.insert(order_id, orderObj);
}else
{
orderObj = m_ordersMap.value(order_id);
}
orderObj->FetchDataFromJson(order);
// TODO
orderObj->dis_desc.append("拿破仑起酥蛋糕");
orderObj->dis_desc.append("香蒜脆片(4入装)");
emit updateOrderDisplay(orderObj);
......@@ -176,7 +197,7 @@ void FlowControl::_onPullOrder()
{
showAlertForm(AlertForm::ERROR, "拉取订单失败[网络错误,请检查网络连接]", true);
QLOG_ERROR() << QString("轮询失败: %1").arg(error);
QTimer::singleShot(20000, this, &FlowControl::_onPullOrder);
QTimer::singleShot(60000, this, &FlowControl::_onPullOrder);
}
);
}
......@@ -247,23 +268,48 @@ void FlowControl::ProcessOrder(OrderObject *orderObj, const QString &operation)
_onProcessOrderHandle(orderObj->order_id, operation, appendData, []{});
}
OrderObject *FlowControl::GetOrderObject(const QString &orderId)
void FlowControl::GetDailyInfo()
{
return m_ordersMap.value(orderId);
}
QLOG_INFO() << QString(">>>>>>>>>>>>>>>>>>>>>>>>>");
QByteArray appendData = DataManage::pullDailyData(m_token);
QLOG_INFO() << QString("获取日结信息,请求数据: %1").arg(QString(appendData));
showAlertForm(AlertForm::LOADING, QString("正在获取日结信息......"));
void FlowControl::Start()
{
QLOG_INFO() << QString(">>>>>>>>>>>>>>>>>>程序启动%1<<<<<<<<<<<<<<<<<<").arg(PRODUCT_VERSION);
QString storeId = ConfigManage::Instance().storeId();
if( !storeId.isEmpty() )
m_http.Post(appendData
,[this](const QByteArray &data)
{
m_storeInfo.sotoreId = storeId;
m_storeInfo.posId = "01";
_onLogin();
QLOG_INFO() << QString("获取日结信息,返回数据: %1").arg(QString(data).simplified());
QJsonObject recvObj = QJsonDocument::fromJson(data).object();
int status = recvObj["statusCode"].toInt();
if( status == 100)
{
emit hideAlertForm();
QList<DailyInfo> infos;
QJsonArray array = recvObj["daily_summarys"].toArray();
foreach(QJsonValue v, array)
{
QJsonObject json = v.toObject();
DailyInfo info;
info.channel = json["channel"].toString();
info.total_number = json["total_number"].toInt();
info.total_fee = json["total_fee"].toInt();
info.refund_number = json["refund_number"].toInt();
info.refund_total_fee = json["refund_total_fee"].toInt();
info.total_projected_revenue = json["total_projected_revenue"].toInt();
infos.append(info);
}
emit showDailyForm(infos);
int port = ConfigManage::Instance().tcpServerPort();
bool result = m_tcpServer->listen(QHostAddress::Any, port);
QLOG_INFO() << QString("绑定端口[%1],结果[%2]").arg(port).arg(result);
}else
{
showAlertForm(AlertForm::ERROR, QString("获取日结信息,失败[%1]").arg(recvObj["msg"].toString()), true);
}
}
,[this](const QNetworkReply::NetworkError &error)
{
showAlertForm(AlertForm::ERROR, QString("获取日结信息,失败[网络错误,请检查网络连接]"), true);
QLOG_ERROR() << QString("获取日结信息,失败: %1").arg(error);
}
);
}
......@@ -20,23 +20,30 @@ public:
void Start();
/* 功能:处理订单
* 参数:[1]订单对象[2]操作
* 返回:NULL
/* 功能:获取门店信息
* 参数:NULL
* 返回:门店信息
* */
void ProcessOrder(OrderObject* orderObj, const QString& operation);
inline StoreInfo GetStoreInfo(){ return m_storeInfo; }
/* 功能:获取订单对象
* 参数:[1]订单号
* 返回:订单对象
* */
OrderObject* GetOrderObject(const QString& orderId);
inline OrderObject* GetOrderObject(const QString& orderId)
{ return m_ordersMap.value(orderId); }
/* 功能:获取门店信息
/* 功能:处理订单
* 参数:[1]订单对象[2]操作
* 返回:NULL
* */
void ProcessOrder(OrderObject* orderObj, const QString& operation);
/* 功能:获取日结信息
* 参数:NULL
* 返回:门店信息
* 返回:NULL
* */
StoreInfo GetStoreInfo(){ return m_storeInfo; }
void GetDailyInfo();
private:
FlowControl();
......@@ -48,16 +55,18 @@ private:
int _ParseTcpData(const QString &data, QString &error);
private:
// 标记是否已经登陆
bool m_bLogged;
// 用于接收POS信息的TcpServer
QTcpServer *m_tcpServer;
// 门店信息
StoreInfo m_storeInfo;
// http
FmHttp m_http;
//用于和服务端通信的本地数据
// 用于和服务端通信的本地数据
QString m_token;
QString m_timestamp;
//用于存储订单信息<订单ID, 订单对象>
// 用于存储订单信息<订单ID, 订单对象>
QMap<QString, OrderObject*> m_ordersMap;
private slots:
......@@ -77,8 +86,8 @@ private slots:
* 参数:[1]操作名称[2]发送数据[3]成功对应的回调函数
* 返回:NULL
* */
void _onProcessOrderHandle(const QString &orderId, const QString& operationName, const QByteArray& appendData
, const std::function< void() > &onSucessful);
void _onProcessOrderHandle(const QString &orderId, const QString& operationName,
const QByteArray& appendData, const std::function< void() > &onSucessful);
signals:
/* 功能:登陆成功
......@@ -100,6 +109,12 @@ signals:
void showAlertForm(AlertForm::AlertType type, const QString& msg, bool bFocus = false);
void hideAlertForm();
/* 功能:显示日结窗口
* 参数:[1]日结信息
* 返回:NULL
* */
void showDailyForm(QList<DailyInfo> infos);
/* 功能:打印
* 参数:[1]订单对象
* 返回:NULL
......
......@@ -62,6 +62,7 @@ bool Printer::_print(QString strData)
QString Printer::_printData(const OrderObject *orderObj)
{
QString result_str;
QString str_comd_list;
// 分辨出所有篮子信息
......@@ -73,6 +74,12 @@ QString Printer::_printData(const OrderObject *orderObj)
map.insert(dishObj->bsk_num, dishObj);
}
foreach(QString comm, orderObj->dis_desc)
{
str_comd_list.append(QString("(赠)"+comm+"#"));
}
foreach(QString key, map.uniqueKeys())
{
foreach(DishObject* dishObj, map.values(key))
......
......@@ -36,7 +36,7 @@ private:
public slots:
/* 功能:接受打印任务
* 参数:[1]订单对象
* 参数:[1]订单对象 [2]是否重新打印,如果是则忽略判断条件
* 返回:NULL
* */
void onPrint( OrderObject const *orderObj = nullptr, bool bReprint = false );
......
#include "sales.h"
#include "sales.h"
#include "util.h"
#include "QsLog.h"
#include <QDateTime>
#include <QSqlQuery>
#include <QDebug>
#include <QSqlError>
#include <tools/configManage.h>
extern QString g_appDir;
......@@ -15,7 +18,6 @@ Sales &Sales::Instance()
Sales::Sales()
{
qDebug() << " Sales" << QThread::currentThreadId();
m_thread = new QThread(this);
this->moveToThread(m_thread);
connect(m_thread, &QThread::started, this, &Sales::onInit);
......@@ -24,36 +26,66 @@ Sales::Sales()
m_mutex = new QMutex();
}
Sales::~Sales()
{
m_thread->quit();
m_thread->wait();
}
void Sales::onInit()
{
#ifdef kesf
QString dbPath = ConfigManage::Instance().databasePath();
dbPath.isEmpty()? dbPath = g_appDir : dbPath;
m_db = QSqlDatabase::addDatabase("QODBC", "sales");
QString dsn = QString("DRIVER={Microsoft Access Driver (*.mdb)};FIL={MS Access};DBQ=%1/WSDataBase.mdb").arg(g_appDir);
QString dsn = QString("DRIVER={Microsoft Access Driver (*.mdb)}; \
FIL={MS Access};DBQ=%1/WSDataBase.mdb").arg(dbPath);
m_db.setDatabaseName(dsn);
m_db.setPassword("jinher-lpos5");
#endif
}
void Sales::onRecordSale(OrderObject *orderObj)
{
m_mutex->lock();
qDebug() << " 写销售单" <<orderObj->order_id << QThread::currentThreadId();
if( orderObj->status == 3 )
#ifdef kesf
if(orderObj->channel=="jdwm")
{
m_mutex->unlock();
return;
orderObj->service_fee = (orderObj->product_fee - orderObj->dis_shop_fee) * 0.15;
}
#ifdef kesf
if( !m_db.open() )
{
QLOG_INFO() << QString("数据库打开失败")<<m_db.lastError();
m_mutex->unlock();
return;
}
QSqlQuery query = QSqlQuery(m_db);
//当状态为100或者3时(退款完成时),更改数据库订单的状态为02
if(orderObj->status==100||orderObj->status==3)
{
QLOG_INFO() << QString("准备撤销订单[%1]").arg(orderObj->order_id);
query.prepare(QString("UPDATE orders_Ws SET State = '02' WHERE OrderID = ?"));
query.addBindValue(orderObj->order_id); // --平台订单号
if( query.exec() )
{
QLOG_INFO() << QString("撤销订单[%1]成功").arg(orderObj->order_id);
}else
{
QLOG_ERROR() << query.lastError().databaseText();
}
}
else{
QLOG_INFO() << QString("准备写入订单[%1]").arg(orderObj->order_id);
query.prepare("INSERT INTO Orders_WS(OrderID, SaleTime, CustName, CustTel, "
"CustAddr, Pay_id, Pay_Str, Pay_ebCode, Pay_ebCode_str, Shop_fee, Service_fee, Products_fee, discount_fee, "
"dis_shop_fee, dis_platform_fee, Send_fee, Package_fee, Invoice_amount, fm_id, CloseWorkDate, State) "
"VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
"dis_shop_fee, dis_platform_fee, Send_fee, Package_fee, Invoice_amount, fm_id, CloseWorkDate, State, Memo,PIndex) "
"VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?)");
query.addBindValue(orderObj->order_id); // --平台订单号
query.addBindValue(QDateTime::fromTime_t(orderObj->create_time)); // --下单时间
query.addBindValue(orderObj->customer); // --顾客姓名
......@@ -75,25 +107,109 @@ void Sales::onRecordSale(OrderObject *orderObj)
query.addBindValue(orderObj->fm_id); // --非码交易号 唯一
query.addBindValue(QDate::currentDate().toString("yyyyMMdd")); // ---工作日 如 20170909
query.addBindValue("01"); // ---季河订单状态 初始值为01(即新订单写入数据库此字段值写入01)
query.addBindValue(orderObj->remark); // ---订单备注
query.addBindValue(orderObj->order_index); // ---订单平台序号
if( query.exec() )
{
query.clear();
int index = 1;
typedef struct DISH_ITEM
{
QString pid;
QString name;
float price;
int num;
QString oprice;
}DishItem;
float ys_total_fee = (float)(orderObj->product_fee - orderObj->package_fee)/100;
float ss_total_fee = ys_total_fee - (float)( orderObj->dis_shop_fee + orderObj->service_fee)/100;
qDebug() << "ys_total_fee" << ys_total_fee;
qDebug() << "ss_total_fee" << ss_total_fee;
QList<DishItem> dishItemList;
foreach(DishObject* dishObj, orderObj->products)
{
if(dishObj->sub_products.isEmpty())
{
// 单品
DishItem item;
item.pid = dishObj->pid;
item.name = dishObj->name;
item.num = dishObj->product_amount;
item.price = QString::number(dishObj->price/ys_total_fee*ss_total_fee/100, 'f', 2).toFloat();
item.oprice = QString::number((float)dishObj->price/100, 'f', 2);
// 针对活动做处理
if(orderObj->channel=="bdwm")
{
if( QDate::currentDate() >= QDate(2017, 12, 19) && QDate::currentDate() <= QDate(2017, 12, 31) )
{
// 满赠(百度平台奶茶买一赠一)
if(item.pid =="04173" || item.pid =="04645")
{
item.num = item.num*2;
item.price = QString::number(dishObj->price/ys_total_fee*ss_total_fee/100/2, 'f', 2).toFloat();
item.oprice = QString::number((float)dishObj->price/100/2, 'f', 2);
}
}
}
dishItemList.append(item);
qDebug()<< "单品" << item.name << item.price << dishObj->price << item.oprice;
}else
{
// 组合品
foreach(DishObject *subDishObj, dishObj->sub_products)
{
DishItem item;
// 一个组合中包含几个此单品
item.pid = subDishObj->pid;
item.name = subDishObj->name;
item.num = subDishObj->unit_ratio/100 * subDishObj->product_amount;
item.price = QString::number(subDishObj->price/ys_total_fee*ss_total_fee/100, 'f', 2).toFloat();
item.oprice = QString::number((float)subDishObj->price/100, 'f', 2);
dishItemList.append(item);
}
}
}
float total_fee = 0;
for(int i=0; i<dishItemList.count(); i++)
{
DishItem item = dishItemList.at(i);
if((i+1) == dishItemList.count())
{
qDebug() <<"最后单品" << ss_total_fee << total_fee;
item.price = (ss_total_fee - total_fee)/item.num;
qDebug() <<"最后单品" << item.price;
}
total_fee += item.price*item.num;
query.prepare("INSERT INTO Items_WS(ID, OrderID, FoodID, FoodName, "
"Count, OPrice, Total, fm_id) VALUES(?, ?, ?, ?, ?, ?, ?, ?)");
query.addBindValue( index++ ); // -- ID
"Count, OPrice, Total, fm_id, Price, OTotal) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
query.addBindValue( i+1 ); // -- ID
query.addBindValue( orderObj->order_id ); // --平台订单号 以Orders_WS表中OrderID对应
query.addBindValue( dishObj->pid ); // --商品编号
query.addBindValue( dishObj->name ); // --商品名称
query.addBindValue( dishObj->product_amount ); // --商品数量
query.addBindValue( Util::Penny2Dollar(dishObj->price) ); // --平台商品单价
query.addBindValue( Util::Penny2Dollar(dishObj->product_amount*dishObj->price) ); // --商品金额
query.addBindValue( item.pid ); // --商品编号
query.addBindValue( item.name ); // --商品名称
query.addBindValue( item.num ); // --商品数量
query.addBindValue( QString::number(item.price, 'f', 2) ); // --平台商品单价
query.addBindValue( QString::number(item.price*item.num, 'f', 2) ); // --商品金额
query.addBindValue( orderObj->fm_id ); // --非码交易号 以Orders_WS表中fm_id对应
query.addBindValue( item.oprice ); // --商品原价
query.addBindValue( QString::number(item.oprice.toFloat()*item.num, 'f', 2) ); // --原价总价
query.exec();
query.clear();
}
QLOG_INFO() << QString("订单写入成功");
}else
{
QLOG_ERROR() << query.lastError().databaseText();
}
}
m_db.close();
......
......@@ -18,6 +18,7 @@ public:
private:
Sales();
~Sales();
private:
QThread* m_thread = nullptr;
......@@ -29,7 +30,7 @@ private:
public slots:
/* 功能:初始化数据
* 说明:由于写销售单动作放在单独的线程所以db链接对象也放在工作线程中创建
* 说明:由于写销售单动作放在单独的线程,所以db链接对象也放在工作线程中创建
* 参数:[1]订单对象
* 返回:NULL
* */
......
#include "dailyform.h"
#include "ui_dailyform.h"
#include <QDateTime>
#include "flowControl.h"
DailyForm::DailyForm(QWidget *parent) :
QDialog(parent),
ui(new Ui::DailyForm)
{
ui->setupUi(this);
setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint);
this->setModal(true);
m_map.insert("mtwm", "美团外卖");
m_map.insert("bdwm", "百度外卖");
m_map.insert("jdwm", "京东到家");
m_map.insert("eleme2", "饿了么");
m_map.insert("fmwd", "非码微店");
m_map.insert("mall", "APP");
}
DailyForm::~DailyForm()
{
delete ui;
}
void DailyForm::InitData(QList<DailyInfo> infos)
{
ui->daily_table0->clearContents();
ui->daily_table0->setRowCount(0);
ui->daily_table1->clearContents();
ui->daily_table1->setRowCount(0);
QDateTime time = QDateTime::currentDateTime();
ui->daily_labStoreName->setText(FlowControl::Instance().GetStoreInfo().name);
ui->daily_labStoreId->setText(FlowControl::Instance().GetStoreInfo().sotoreId);
ui->daily_labDate->setText(time.toString("yyyy-MM-dd"));
ui->daily_labTime->setText(QString("00:00:00 - %1").arg(time.toString("hh:mm:ss")));
int channel0_total_fee = 0;
int channel0_total_num = 0;
int channel1_total_fee = 0;
int channel1_total_num = 0;
int shop_total_fee = 0;
foreach (DailyInfo info, infos) {
ui->daily_table0->insertRow(0);
ui->daily_table1->insertRow(0);
QTableWidgetItem *channel0 = new QTableWidgetItem(m_map.value(info.channel));
channel0->setTextAlignment(Qt::AlignCenter);
ui->daily_table0->setItem(0, 0, channel0);
QTableWidgetItem *num0 = new QTableWidgetItem(QString::number(info.total_number));
num0->setTextAlignment(Qt::AlignCenter);
ui->daily_table0->setItem(0, 1, num0);
QTableWidgetItem *fee0 = new QTableWidgetItem(Util::Penny2Dollar(info.total_fee));
fee0->setTextAlignment(Qt::AlignCenter);
ui->daily_table0->setItem(0, 2, fee0);
QTableWidgetItem *channel1 = new QTableWidgetItem(m_map.value(info.channel));
channel1->setTextAlignment(Qt::AlignCenter);
ui->daily_table1->setItem(0, 0, channel1);
QTableWidgetItem *num1 = new QTableWidgetItem(QString::number(info.refund_number));
num1->setTextAlignment(Qt::AlignCenter);
ui->daily_table1->setItem(0, 1, num1);
QTableWidgetItem *fee1 = new QTableWidgetItem(Util::Penny2Dollar(info.refund_total_fee));
fee1->setTextAlignment(Qt::AlignCenter);
ui->daily_table1->setItem(0, 2, fee1);
channel0_total_fee += info.total_fee;
channel0_total_num += info.total_number;
channel1_total_fee += info.refund_total_fee;
channel1_total_num += info.refund_number;
shop_total_fee += info.total_projected_revenue;
}
int rowIndex = infos.count();
ui->daily_table0->insertRow(rowIndex);
ui->daily_table1->insertRow(rowIndex);
QTableWidgetItem *channel0 = new QTableWidgetItem("总计");
channel0->setTextAlignment(Qt::AlignCenter);
ui->daily_table0->setItem(rowIndex, 0, channel0);
QTableWidgetItem *num0 = new QTableWidgetItem(QString::number(channel0_total_num));
num0->setTextAlignment(Qt::AlignCenter);
ui->daily_table0->setItem(rowIndex, 1, num0);
QTableWidgetItem *fee0 = new QTableWidgetItem(Util::Penny2Dollar(channel0_total_fee));
fee0->setTextAlignment(Qt::AlignCenter);
ui->daily_table0->setItem(rowIndex, 2, fee0);
QTableWidgetItem *channel1 = new QTableWidgetItem("总计");
channel1->setTextAlignment(Qt::AlignCenter);
ui->daily_table1->setItem(rowIndex, 0, channel1);
QTableWidgetItem *num1 = new QTableWidgetItem(QString::number(channel1_total_num));
num1->setTextAlignment(Qt::AlignCenter);
ui->daily_table1->setItem(rowIndex, 1, num1);
QTableWidgetItem *fee1 = new QTableWidgetItem(Util::Penny2Dollar(channel1_total_fee));
fee1->setTextAlignment(Qt::AlignCenter);
ui->daily_table1->setItem(rowIndex, 2, fee1);
ui->daily_labYJZSR->setText(Util::Penny2Dollar(shop_total_fee));
}
void DailyForm::on_daily_btnClose_clicked()
{
hide();
}
#ifndef DAILYFORM_H
#define DAILYFORM_H
#include <QDialog>
#include <QMap>
#include "util.h"
namespace Ui {
class DailyForm;
}
class DailyForm : public QDialog
{
Q_OBJECT
public:
explicit DailyForm(QWidget *parent = 0);
~DailyForm();
void InitData(QList<DailyInfo> infos);
private slots:
void on_daily_btnClose_clicked();
private:
Ui::DailyForm *ui;
// 用于存储平台码和平台名称映射
QMap<QString, QString> m_map;
};
#endif // DAILYFORM_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DailyForm</class>
<widget class="QDialog" name="DailyForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="styleSheet">
<string notr="true">font: 10pt &quot;微软雅黑&quot;;</string>
</property>
<widget class="QWidget" name="daily_wdgBody" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>50</y>
<width>800</width>
<height>550</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<widget class="QLabel" name="daily_labStoreName">
<property name="geometry">
<rect>
<x>60</x>
<y>0</y>
<width>680</width>
<height>50</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>38</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="daily_btnPrint">
<property name="geometry">
<rect>
<x>444</x>
<y>470</y>
<width>120</width>
<height>40</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>38</height>
</size>
</property>
<property name="text">
<string>打印小票</string>
</property>
</widget>
<widget class="QLabel" name="daily_slabYJZSR">
<property name="geometry">
<rect>
<x>50</x>
<y>470</y>
<width>94</width>
<height>38</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>38</height>
</size>
</property>
<property name="text">
<string>【预计总收入】:</string>
</property>
</widget>
<widget class="QLabel" name="daily_labYJZSR">
<property name="geometry">
<rect>
<x>165</x>
<y>470</y>
<width>221</width>
<height>38</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>38</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="daily_btnClose">
<property name="geometry">
<rect>
<x>626</x>
<y>470</y>
<width>120</width>
<height>40</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>38</height>
</size>
</property>
<property name="text">
<string>关闭</string>
</property>
</widget>
<widget class="QLabel" name="daily_slabMDBH">
<property name="geometry">
<rect>
<x>86</x>
<y>65</y>
<width>70</width>
<height>35</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>门店编号:</string>
</property>
</widget>
<widget class="QLabel" name="daily_slabSJD">
<property name="geometry">
<rect>
<x>446</x>
<y>65</y>
<width>70</width>
<height>35</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>时间段:</string>
</property>
</widget>
<widget class="QLabel" name="daily_labTime">
<property name="geometry">
<rect>
<x>536</x>
<y>65</y>
<width>150</width>
<height>35</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="daily_labStoreId">
<property name="geometry">
<rect>
<x>176</x>
<y>65</y>
<width>120</width>
<height>35</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="daily_slabSKQK">
<property name="geometry">
<rect>
<x>85</x>
<y>128</y>
<width>300</width>
<height>40</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>38</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">border-bottom: 1px dashed #919191;</string>
</property>
<property name="text">
<string>【收款情况】</string>
</property>
</widget>
<widget class="QLabel" name="daily_slabTKQK">
<property name="geometry">
<rect>
<x>445</x>
<y>128</y>
<width>300</width>
<height>40</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>38</height>
</size>
</property>
<property name="text">
<string>【退款情况】</string>
</property>
</widget>
<widget class="QTableWidget" name="daily_table1">
<property name="geometry">
<rect>
<x>445</x>
<y>183</y>
<width>300</width>
<height>250</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="showGrid">
<bool>false</bool>
</property>
<property name="gridStyle">
<enum>Qt::NoPen</enum>
</property>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>渠道</string>
</property>
</column>
<column>
<property name="text">
<string>订单数</string>
</property>
</column>
<column>
<property name="text">
<string>金额</string>
</property>
</column>
</widget>
<widget class="QTableWidget" name="daily_table0">
<property name="geometry">
<rect>
<x>85</x>
<y>183</y>
<width>300</width>
<height>250</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="showGrid">
<bool>false</bool>
</property>
<property name="gridStyle">
<enum>Qt::NoPen</enum>
</property>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>渠道</string>
</property>
</column>
<column>
<property name="text">
<string>订单数</string>
</property>
</column>
<column>
<property name="text">
<string>金额</string>
</property>
</column>
</widget>
</widget>
<widget class="QWidget" name="daily_wdgHead" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>50</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<widget class="QLabel" name="daily_slabRJXX">
<property name="geometry">
<rect>
<x>40</x>
<y>0</y>
<width>100</width>
<height>50</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">font: 75 12pt &quot;微软雅黑&quot;;</string>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="text">
<string>日结信息</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QLabel" name="daily_labDate">
<property name="geometry">
<rect>
<x>140</x>
<y>0</y>
<width>100</width>
<height>50</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>
......@@ -41,12 +41,12 @@ void DetailForm::InitData(OrderObject *orderObj)
// 当前订单详情
ui->detail_labDDZT->setText(statusDesc);
ui->detail_labDDBZ->setText(orderObj->remark);
ui->detail_labGKXM->setText(orderObj->customer);
ui->detail_labSHDZ->setText(orderObj->address);
ui->detail_labSCY->setText(QString("%1 %2").arg(orderObj->courier_name, orderObj->courier_phone));
ui->detail_labSDSJ->setText(orderObj->delivery_time==0?"立即送出":QDateTime::fromTime_t(orderObj->delivery_time).toString("yyyy-MM-dd hh:mm"));
ui->detail_labFPXX->setText(orderObj->invoice_title);
ui->detail_labDDBZ->setText( orderObj->remark.isEmpty()? "无" : orderObj->remark );
ui->detail_labGKXM->setText( orderObj->customer );
ui->detail_labSHDZ->setText( orderObj->address );
ui->detail_labSCY->setText( orderObj->courier_name.isEmpty() ? "正在分配中....." : QString("%1 %2").arg(orderObj->courier_name, orderObj->courier_phone) );
ui->detail_labSDSJ->setText( orderObj->delivery_time==0?"立即送出":QDateTime::fromTime_t(orderObj->delivery_time).toString("yyyy-MM-dd hh:mm") );
ui->detail_labFPXX->setText( orderObj->invoice_title.isEmpty() ? "无需发票" : orderObj->invoice_title );
// 操作按钮
ui->detail_btnProc->setText(operation);
......@@ -120,15 +120,15 @@ void DetailForm::_GetOrderAdditional(OrderObject *orderObj, QString &operation,
operation = OPERATION_REJECT;
ui->detail_btnRefund->hide();
break;
case 2:
statusDesc = "正在分配骑手......";
operation = OPERATION_SENDOUT;
break;
case 20:
statusDesc = "等待退款,如需退款请返回上级页面.";
operation = OPERATION_REFUSE_REFUND;
ui->detail_btnRefund->hide();
break;
case 2:
statusDesc = "正在分配骑手.";
operation = OPERATION_SENDOUT;
break;
case 4:
case 5:
statusDesc = "正在配送中.";
......
......@@ -43,7 +43,8 @@ SOURCES += main.cpp \
dishmgtform.cpp \
detailform.cpp \
controls/printer.cpp \
controls/sales.cpp
controls/sales.cpp \
dailyform.cpp
HEADERS += mainwindow.h \
models/orderObject.h \
......@@ -59,14 +60,16 @@ HEADERS += mainwindow.h \
dishmgtform.h \
detailform.h \
controls/printer.h \
controls/sales.h
controls/sales.h \
dailyform.h
FORMS += mainwindow.ui \
alertform.ui \
floatform.ui \
storemgtform.ui \
dishmgtform.ui \
detailform.ui
detailform.ui \
dailyform.ui
DISTFILES += \
../run/client.ini \
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.5.1, 2018-03-05T10:59:23. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{f5526090-0576-44e9-8172-543e0b5a92dd}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap"/>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.5.1 MinGW 32bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.5.1 MinGW 32bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.55.win32_mingw492_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/NewProject/build/fmTakeaway-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">清理</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/NewProject/build/fmTakeaway-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">清理</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">部署</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">在本地部署</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fmTakeaway</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:E:/NewProject/fmTakeaway/fmTakeaway.pro</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fmTakeaway.pro</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">18</value>
</data>
<data>
<variable>Version</variable>
<value type="int">18</value>
</data>
</qtcreator>
......@@ -34,28 +34,13 @@ int main(int argc, char *argv[])
void InitLog()
{
QString logDir = QString("%1/log").arg(g_appDir);
//清理之前的日志
QDir dir(logDir);
if(dir.exists())
{
dir.setFilter(QDir::Files | QDir::NoSymLinks);
QFileInfoList list = dir.entryInfoList();
foreach(QFileInfo info, list)
{
if(info.baseName().startsWith(ConfigManage::Instance().logPrefix()) &&
QDate::currentDate()>=info.lastModified().date().addDays(ConfigManage::Instance().logHoldTime()))
{
QFile(info.filePath()).remove();
}
}
}
QDir().mkdir(logDir);
QsLogging::Logger& logger = QsLogging::Logger::instance();
logger.setLoggingLevel(QsLogging::TraceLevel);
QDir().mkdir(logDir);
QString logPath = QString("%1/%2%3.txt").arg(logDir, ConfigManage::Instance().logPrefix()
, QDate::currentDate().toString("yyyy-MM-dd"));
QsLogging::DestinationPtr fileDst(QsLogging::DestinationFactory::MakeFileDestination(logPath,
QsLogging::DestinationPtr fileDst(QsLogging::DestinationFactory::MakeFileDestination(logDir,
ConfigManage::Instance().logPrefix(), ConfigManage::Instance().logHoldDays(),
QsLogging::EnableLogRotation, QsLogging::MaxSizeBytes(20*1024*1024), QsLogging::MaxOldLogCount(1)));
logger.addDestination(fileDst);
QsLogging::DestinationPtr consoleDst(QsLogging::DestinationFactory::MakeDebugOutputDestination());
......
......@@ -44,7 +44,7 @@ MainWindow::MainWindow(QWidget *parent) :
// 网络状态显示
ui->main_labNetStatus->setText("正常");
// 订单显示
// 更新订单显示
connect(&FlowControl::Instance(), &FlowControl::updateOrderDisplay, this, &MainWindow::onUpdateOrderDisplay);
// 提示窗口显示
......@@ -54,15 +54,13 @@ MainWindow::MainWindow(QWidget *parent) :
m_alertForm->SetContent(type, msg);
if( bFocus )
{
show();
m_floatForm->hide();
this->show();
m_alertForm->show();
}else
{
if( !isHidden() )
}else if( !isHidden() )
{
m_alertForm->show();
}
}
});
connect(&FlowControl::Instance(), &FlowControl::hideAlertForm, [this]()
{
......@@ -75,8 +73,22 @@ MainWindow::MainWindow(QWidget *parent) :
// 详情窗口
m_detailForm = new DetailForm(this);
// 初始化界面
// 日结窗口
m_dailyForm = new DailyForm(this);
connect(ui->main_btnRJ, &QPushButton::clicked, []()
{
FlowControl::Instance().GetDailyInfo();
});
connect(&FlowControl::Instance(), &FlowControl::showDailyForm, [this](QList<DailyInfo> infos)
{
m_dailyForm->move(pos());
m_dailyForm->InitData(infos);
m_dailyForm->show();
});
// 界面无边框&置顶
setWindowFlags(windowFlags() | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
// 隐藏部分TAB页不需要的列
ui->main_tableDCL->setColumnHidden(7, true);
ui->main_tableDCL->setColumnHidden(8, true);
ui->main_tableYCL->setColumnHidden(7, true);
......@@ -90,9 +102,9 @@ MainWindow::MainWindow(QWidget *parent) :
table->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
table->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
table->horizontalHeader()->setFixedHeight(35);
table->hide();
}
// 先将部分功能禁用(登陆后可以使用)
ui->main_btnMDGL->setEnabled(false);
ui->main_btnSPGL->setEnabled(false);
ui->main_btnRJ->setEnabled(false);
......@@ -109,11 +121,18 @@ MainWindow::MainWindow(QWidget *parent) :
m_trayIcon = new QSystemTrayIcon(QIcon(":fm.ico"), this);
QMenu* menu = new QMenu(this);
menu->setObjectName("trayMenu");
QAction *acShow = new QAction("显示主界面", this);
connect(acShow, &QAction::triggered, [this]
{
m_floatForm->hide();
this->show();
});
QAction *acQuit = new QAction("退出", this);
connect(acQuit, &QAction::triggered, []
{
qApp->exit(0);
});
menu->addAction(acShow);
menu->addAction(acQuit);
m_trayIcon->setContextMenu(menu);
m_trayIcon->show();
......@@ -144,7 +163,7 @@ void MainWindow::_GetOrderAdditional(OrderObject *orderObj, QTableWidget *&table
if(orderType == 3 || orderType == 4)
{
// 已核销
if(orderStatus == 4)
if(orderStatus == 6)
{
statusDesc = "已核销";
table = ui->main_tableYWC;
......@@ -364,3 +383,8 @@ void MainWindow::on_main_btnDown_clicked()
QTableWidget *table = findChild<QTableWidget*>(m_curtTabBtn->property("table").toString());
table->verticalScrollBar()->setValue(table->verticalScrollBar()->value()+1);
}
void MainWindow::on_main_btnSPGL_clicked()
{
}
......@@ -5,6 +5,7 @@
#include "alertform.h"
#include "floatform.h"
#include "detailform.h"
#include "dailyform.h"
#include <QMainWindow>
#include <QPushButton>
......@@ -39,6 +40,8 @@ private:
FloatForm *m_floatForm=nullptr;
// 详情窗口
DetailForm *m_detailForm=nullptr;
// 日结窗口
DailyForm *m_dailyForm=nullptr;
// 托盘
QSystemTrayIcon* m_trayIcon=nullptr;
......@@ -75,6 +78,7 @@ private slots:
void on_main_btnHide_clicked();
void on_main_btnUp_clicked();
void on_main_btnDown_clicked();
void on_main_btnSPGL_clicked();
};
#endif // MAINWINDOW_H
......@@ -138,6 +138,7 @@ class OrderObject : public QObject
Q_PROPERTY (QString courier_name READ getcourier_name WRITE setcourier_name)
Q_PROPERTY (QString courier_phone READ getcourier_phone WRITE setcourier_phone)
Q_PROPERTY (QStringList records READ getrecords WRITE setrecords)
Q_PROPERTY (QStringList dis_desc READ getdis_desc WRITE setdis_desc)
Q_PROPERTY (int total_amount READ gettotal_amount WRITE settotal_amount)
public:
......@@ -267,6 +268,9 @@ private:
inline QStringList getrecords(){ return records; }
inline void setrecords(const QStringList& v){ records = v; }
inline QStringList getdis_desc(){ return dis_desc; }
inline void setdis_desc(const QStringList& v){ dis_desc = v; }
inline int gettotal_amount(){ return total_amount; }
inline void settotal_amount(const int& v){ total_amount = v; }
......@@ -312,6 +316,7 @@ public:
QString courier_phone; // 配送员手机号
QStringList records; // 订单操作纪录
int total_amount; // 商品总数
QStringList dis_desc; // 满赠描述
QList<DishObject*> products; // 子商品
// 自定义属性
......
......@@ -3,6 +3,8 @@
#include <QTimer>
#include "configManage.h"
#include <QDebug>
FmHttp::FmHttp()
{
// 初始化Httprequest
......@@ -69,15 +71,16 @@ void FmHttp::handle(QNetworkReply *reply, const int &timeout, const std::functio
timer = new QTimer;
timer->setSingleShot(true);
QObject::connect( timer, &QTimer::timeout, [ timer, onTimeout ]()
QObject::connect( timer, &QTimer::timeout, [reply, timer, onTimeout ]()
{
reply->deleteLater();
onTimeout();
timer->deleteLater();
} );
timer->start( timeout );
}
QObject::connect( reply, &QNetworkReply::finished, [ reply, timer, onFinished ]()
QObject::connect( reply, &QNetworkReply::finished, [ this, reply, timer, onFinished ]()
{
if ( timer->isActive() )
{
......@@ -87,10 +90,12 @@ void FmHttp::handle(QNetworkReply *reply, const int &timeout, const std::functio
{
onFinished( reply->readAll() );
}
reply->deleteLater();
} );
QObject::connect( reply, ( void( QNetworkReply::* )( QNetworkReply::NetworkError ) )&QNetworkReply::error, [ reply, timer, onError ](const QNetworkReply::NetworkError &code)
QObject::connect( reply, ( void( QNetworkReply::* )( QNetworkReply::NetworkError ) )&QNetworkReply::error, [ this, reply, timer, onError ](const QNetworkReply::NetworkError &code)
{
reply->deleteLater();
if ( timer->isActive() )
{
timer->stop();
......
......@@ -6,6 +6,7 @@
#include <QNetworkRequest>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QMutex>
class FmHttp
{
......@@ -14,12 +15,12 @@ public:
inline void SetRequest(const QNetworkRequest &request){ m_request = request; }
bool Post(const QByteArray &appendData, QByteArray &target, const int &timeout = 30000);
bool Post(const QByteArray &appendData, QByteArray &target, const int &timeout = 10000);
void Post(const QByteArray &appendData,
const std::function< void(const QByteArray &data) > &onFinished,
const std::function< void(const QNetworkReply::NetworkError &code) > &onError,
const int &timeout = 20000);
const int &timeout = 10000);
private:
void handle(QNetworkReply *reply, const int &timeout,
......@@ -30,6 +31,7 @@ private:
private:
QNetworkRequest m_request;
QNetworkAccessManager m_manage;
QMutex m_mutex;
};
#endif // FMNET_H
......@@ -50,9 +50,9 @@ public:
* 参数:NULL
* 返回:保存天数
* */
inline int logHoldTime()
inline int logHoldDays()
{
return m_clientIni->value("log/holdTime").toInt();
return m_clientIni->value("log/holdDays").toInt();
}
/* 功能:获取TcpServer监听端口
......@@ -123,6 +123,14 @@ public:
* */
QString printerParameter();
/* 功能:获取数据库路径
* 参数:NULLi
* 返回:数据库路径
* */
inline QString databasePath(){
return m_userIni->value("database/path").toString();
}
private:
ConfigManage();
......
......@@ -126,3 +126,11 @@ QByteArray DataManage::refuseRefundOrderData(const QString &token, const QString
json.insert("pos_version", g_posVersion);
return QJsonDocument(json).toJson().simplified();
}
QByteArray DataManage::pullDailyData(const QString &token)
{
QJsonObject json;
json.insert("reqtype", 260);
json.insert("token", token);
return QJsonDocument(json).toJson().simplified();
}
......@@ -18,6 +18,8 @@ public:
static QByteArray merchantRefundOrderData(const QString& token, const QString& orderId, const QString& reason);
static QByteArray agreeRefundOrderData(const QString& token, const QString& orderId, const QString& reason);
static QByteArray refuseRefundOrderData(const QString& token, const QString& orderId, const QString& reason);
static QByteArray pullDailyData(const QString& token);
};
#endif // DATAMANAGE_H
......@@ -91,6 +91,17 @@ namespace Util {
QString Penny2Dollar(const int penny);
}
// 日结渠道信息
typedef struct DailyInfo
{
QString channel;
int total_number;
int total_fee;
int refund_number;
int refund_total_fee;
int total_projected_revenue;
}DailyInfo;
#endif // UTIL_H
......@@ -10,7 +10,7 @@
#ifdef freemud
#define PRODUCT_VERSION BASE_VERSION "0.0"
#elif kesf
#define PRODUCT_VERSION BASE_VERSION "0.1"
#define PRODUCT_VERSION BASE_VERSION "0.7"
#elif miy
#define PRODUCT_VERSION BASE_VERSION "0.0"
#elif shanl
......
......@@ -8,7 +8,7 @@ bDishesManagement=false
[log]
;保存时间单位天
holdTime=20
holdDays=20
;外卖日志前缀
prefix=wm
......
......@@ -218,3 +218,44 @@
{
background-color: #cc3a41;
}
/**********日结表样式**********/
#daily_wdgHead
{
background-color: rgb(121, 121, 121);
}
#daily_wdgBody
{
background-color: #ffffff;
}
#daily_labDate
{
color: rgb(255, 131, 74);
}
#daily_labStoreName,#daily_slabSKQK,#daily_slabTKQK
{
border: 0px;
border-bottom: 1px dashed #919191;
}
#daily_table0,#daily_table1
{
color: #878787;
}
#daily_wdgBody QHeaderView::section,#daily_wdgBody QHeaderView::section
{
border: 0px;
background: #ffffff;
color: #878787;
}
#daily_btnClose,#daily_btnPrint
{
background-color: #ffffff;
border: 1px solid rgb(121, 121, 121);
border-radius: 4px;
}
#daily_btnClose:pressed,#daily_btnPrint:pressed
{
background-color: rgb(121, 121, 121);
}
\ No newline at end of file
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