Commit 2867d09b by ss.dai

方象提交演示版本

parent b633db9d
......@@ -3,6 +3,14 @@
#include <QtSql/QSqlQuery>
#include <QVariant>
#include <QDebug>
#include <QSettings>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QJsonObject>
#include <QJsonDocument>
#include <QEventLoop>
#include <QTimer>
#include <QJsonArray>
FmPlugin &FmPlugin::GetInstance()
{
......@@ -112,53 +120,174 @@ bool FmPlugin::GetOnDutyCashiers(QList<CashierObject> &cashiersList, QString &er
bool FmPlugin::DoOrderEntry(const OrderObject *orderObject, const QString &cashierId, const QString &cashierName, const QString &shiftId, const QString &shiftName, QString &error)
{
m_orderObject = orderObject;
if(!m_db.open())
// if(!m_db.open())
// {
// error = m_db.lastError().text();
// return false;
// }
// // 开启事务
// if(!m_db.transaction())
// {
// error = m_db.lastError().text();
// m_db.close();
// return false;
// }
// // 插入三张临时表后执行存储过程有一个失败则回滚
// if(!_InsertInto_d_t_food_fmbill0(cashierId, cashierName, shiftId, shiftName))
// {
// error = m_db.lastError().text();
// m_db.rollback();
// m_db.close();
// return false;
// }
// if(!_InsertInto_d_t_food_fmbills0())
// {
// error = m_db.lastError().text();
// m_db.rollback();
// m_db.close();
// return false;
// }
// if(!_InsertInto_d_t_bill_fmpay0())
// {
// error = m_db.lastError().text();
// m_db.rollback();
// m_db.close();
// return false;
// }
// if(!_Exec_pr_fmwm())
// {
// error = m_db.lastError().text();
// m_db.rollback();
// m_db.close();
// return false;
// }
// // 都成功则提交
// m_db.commit();
// error = QString("success");
// m_db.close();
QSettings set("config.ini", QSettings::IniFormat);
QString host = set.value("DbServer/postUrl").toString();
QNetworkAccessManager manger;
QNetworkRequest qRequset;
qRequset.setUrl(QUrl(host+"/FMJsonInterfaceByDefault"));
qRequset.setRawHeader("Content-Type","application/x-www-form-urlencoded");
QJsonObject rootObj, cObj;
rootObj.insert("fm_cmd", "put_order");
rootObj.insert("fm_ver", "1.0");
rootObj.insert("operator_id", cashierId);
rootObj.insert("pos_id", cashierName.toInt());
rootObj.insert("store_id", "0001");
rootObj.insert("business_date", shiftName);
cObj.insert("pay_id","002");
cObj.insert("pay_str","非码外卖");
cObj.insert("pay_ebcode",orderObject->channel);
cObj.insert("pay_ebcode_str",orderObject->channelName);
cObj.insert("total_amount",orderObject->shop_fee);
cObj.insert("paid_total_amount",orderObject->shop_fee);
cObj.insert("incentives_amount",orderObject->discount_fee);
cObj.insert("invoice_amount",orderObject->shop_fee);
cObj.insert("paid_trans_id",orderObject->order_id);
cObj.insert("fm_id",orderObject->order_id);
cObj.insert("order_time",QString::number(orderObject->create_time));
rootObj.insert("pay_id", cObj);
QJsonArray tmpArray;
for(int i=0; i < orderObject->proList.count(); i++)
{
error = m_db.lastError().text();
QJsonObject tmpObj;
tmpObj.insert("consume_num", orderObject->proList.at(i)->productAmount);
tmpObj.insert("pid", orderObject->proList.at(i)->pid);
tmpObj.insert("original_price", orderObject->proList.at(i)->price);
tmpArray.insert(i, tmpObj);
}
rootObj.insert("products", tmpArray);
QJsonDocument doc(rootObj);
QString strArray = QString("jsonStr=") + QString(doc.toJson( QJsonDocument::Compact));
qDebug() << strArray;
QNetworkReply *reply = manger.post(qRequset , strArray.toUtf8());
QEventLoop eventLoop;
QObject::connect(&manger, SIGNAL(networkAccessibleChanged(QNetworkAccessManager::NetworkAccessibility)), &eventLoop, SLOT(quit()));
QObject::connect(reply, SIGNAL(finished()), &eventLoop, SLOT(quit()));
QObject::connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), &eventLoop, SLOT(quit()));
// 加用定时器防止网络出现异常长时间不返回导致的阻塞
QTimer::singleShot(10000, &eventLoop, &QEventLoop::quit);
eventLoop.exec();
if( reply->error() != QNetworkReply::NoError){
error = reply->errorString();
return false;
}
// 开启事务
if(!m_db.transaction())
QByteArray receArray = reply->readAll();
if(receArray.size() == 0)
{
error = m_db.lastError().text();
m_db.close();
error = "nothing recved";
return false;
}
// 插入三张临时表后执行存储过程有一个失败则回滚
if(!_InsertInto_d_t_food_fmbill0(cashierId, cashierName, shiftId, shiftName))
QJsonDocument doc1 = QJsonDocument::fromJson( receArray);
QJsonObject ttmp = doc1.object();
if(ttmp["statusCode"].toInt()==100)
{
error = m_db.lastError().text();
m_db.rollback();
m_db.close();
return true;
}else
{
error = ttmp["msg"].toString();
return false;
}
if(!_InsertInto_d_t_food_fmbills0())
{
error = m_db.lastError().text();
m_db.rollback();
m_db.close();
}
bool FmPlugin::RefundOrder(const QString &orderId, QString &error)
{
QSettings set("config.ini", QSettings::IniFormat);
QString host = set.value("DbServer/postUrl").toString();
QNetworkAccessManager manger;
QNetworkRequest qRequset;
qRequset.setUrl(QUrl(host+"/FMJsonInterfaceByDefault"));
qRequset.setRawHeader("Content-Type","application/x-www-form-urlencoded");
QJsonObject rootObj;
rootObj.insert("fm_cmd", "refund_order");
rootObj.insert("fm_ver", "1.0");
rootObj.insert("fm_id", orderId);
QJsonDocument doc(rootObj);
QString strArray = QString("jsonStr=") + QString(doc.toJson( QJsonDocument::Compact));
QNetworkReply *reply = manger.post(qRequset , strArray.toUtf8());
QEventLoop eventLoop;
QObject::connect(&manger, SIGNAL(networkAccessibleChanged(QNetworkAccessManager::NetworkAccessibility)), &eventLoop, SLOT(quit()));
QObject::connect(reply, SIGNAL(finished()), &eventLoop, SLOT(quit()));
QObject::connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), &eventLoop, SLOT(quit()));
// 加用定时器防止网络出现异常长时间不返回导致的阻塞
QTimer::singleShot(10000, &eventLoop, &QEventLoop::quit);
eventLoop.exec();
if( reply->error() != QNetworkReply::NoError){
error = reply->errorString();
return false;
}
if(!_InsertInto_d_t_bill_fmpay0())
QByteArray receArray = reply->readAll();
if(receArray.size() == 0)
{
error = m_db.lastError().text();
m_db.rollback();
m_db.close();
error = "nothing recved";
return false;
}
if(!_Exec_pr_fmwm())
QJsonDocument doc1 = QJsonDocument::fromJson( receArray);
QJsonObject ttmp = doc1.object();
if(ttmp["statusCode"].toInt()==100)
{
error = m_db.lastError().text();
m_db.rollback();
m_db.close();
return true;
}else
{
error = ttmp["msg"].toString();
return false;
}
// 都成功则提交
m_db.commit();
error = QString("success");
m_db.close();
return true;
}
bool FmPlugin::_InsertInto_d_t_food_fmbill0(const QString& cashierId, const QString& cashierName, const QString& shiftId, const QString& shiftName)
......
......@@ -37,6 +37,11 @@ public:
* */
bool DoOrderEntry(OrderObject const *orderObject, const QString& cashierId, const QString& cashierName,
const QString& shiftId, const QString& shiftName, QString& error);
/* 功能:撤销销售单
* 参数:[1]订单编号[2]错误信息
* 返回:是否成功
* */
bool RefundOrder(const QString& orderId, QString& error);
private:
FmPlugin(){}
......
......@@ -6,7 +6,7 @@
QT -= gui
QT += sql
QT += sql network
TARGET = fmPlugin
TEMPLATE = lib
......
......@@ -52,7 +52,7 @@ bool FlowControl::_Login()
QJsonObject recvJson;
// TODO
sendJson = DataManger::GetInstance().GetLoginData(/*m_storeId*/"fm9999", SERVER_PASSWORD, m_posId, m_cashierId);
sendJson = DataManger::GetInstance().GetLoginData(m_storeId, SERVER_PASSWORD, m_posId, m_cashierId);
emit showAlert(AlertForm::LOADING, "正在登录......");
QLOG_INFO() << QString("[---login---][requestData:%1]").arg(_GetJsonStr(sendJson));
......@@ -74,16 +74,17 @@ bool FlowControl::_Login()
DataManger::GetInstance().SetToken(recvJson[JSON_TOKEN].toString());
emit hideAlert();
emit setStoreInfo(m_storeId);
emit setCashierInfo(m_cashierId);
_PullOrder();
}
}
/*
if(!result)
{
QLOG_INFO() << QString("%1 msec after login...").arg(VALUE_RELOGINTIME);
QTimer::singleShot(VALUE_RELOGINTIME, this, &FlowControl::_Login);
}
}*/
return result;
}
......@@ -231,8 +232,9 @@ bool FlowControl::_ConfirmOrder(const QString &orderId, const DeliverObject &del
emit showAlert(AlertForm::LOADING, "正在写入销售单......");
QString orderEntryError("");
// 写入销售单
if(!FmPlugin::GetInstance().DoOrderEntry(orderObject, m_cashierObject.id, m_cashierObject.name,
m_cashierObject.shiftId, m_cashierObject.shiftName, error))
QLOG_INFO() << QString("[---begin entry order---].");
if(!FmPlugin::GetInstance().DoOrderEntry(orderObject, m_cashierId, m_posId,
m_storeId, m_bDate.toString("yyyy-MM-dd"), error))
{
QString dirPath = QString("%1/orders").arg(QApplication::applicationDirPath());
QDir dir;
......@@ -243,7 +245,11 @@ bool FlowControl::_ConfirmOrder(const QString &orderId, const DeliverObject &del
file.open(QFile::WriteOnly);
file.close();
}
orderEntryError = QString("\r\n[<font color='#ff0000'>写入销售单失败,可在订单详情页补录.</font>]");
orderEntryError = QString("\r\n[写入销售单失败]");
QLOG_INFO() << QString("entry order failed[%1]").arg(error);
}else
{
orderEntryError = QString("\r\n[写入销售单成功]");
}
QString remark(orderObject->remark), deliveryTime;
......@@ -399,6 +405,7 @@ bool FlowControl::_RefuseRefund(const QString& orderId)
sendJson = DataManger::GetInstance().GetRefuseRefundData(VALUE_REFUSEREFUND_REASON,orderId);
emit showAlert(AlertForm::LOADING, "正在通信......");
QLOG_INFO() << QString("[---refuseRefund order---]. [requestData:%1]").arg(_GetJsonStr(sendJson));
result = m_procOrderSocket->Request(sendJson, recvJson, error);
QLOG_INFO() << QString("refuseRefund order finsh. [result:%1][msg:%2][recvData:%3]")
......@@ -428,6 +435,58 @@ bool FlowControl::_RefuseRefund(const QString& orderId)
return result;
}
bool FlowControl::_RefundOrder(const QString &orderId)
{
QString error;
bool result;
QJsonObject sendJson;
QJsonObject recvJson;
sendJson = DataManger::GetInstance().GetRefundOrderData("1",orderId);
emit showAlert(AlertForm::LOADING, "正在通信......");
QLOG_INFO() << QString("[---Refund order---]. [requestData:%1]").arg(_GetJsonStr(sendJson));
result = m_procOrderSocket->Request(sendJson, recvJson, error);
QLOG_INFO() << QString("Refund order finsh. [result:%1][msg:%2][recvData:%3]")
.arg(result).arg(error, _GetJsonStr(recvJson));
if(!result)
{
emit showAlert(AlertForm::ERROR, "退单失败![网络错误]");
}else
{
if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt())
{
result = false;
emit showAlert(AlertForm::ERROR, QString("退单失败![%1]").arg(recvJson[JSON_MESSAGE].toString()));
}else
{
// 通知主界面移动订单
OrderObject *orderObject = m_ordersMap.value(orderId);
int oldStatus = orderObject->status;
orderObject->status = recvJson[JSON_STATUS].toInt();
orderObject->status_desc = recvJson[JSON_STATUSDESC].toString();
emit changeOrderStatus(orderObject, oldStatus);
QString tmpstr;
// 撤回销售单
QLOG_INFO() << QString("[---begin refund order---].");
if(!FmPlugin::GetInstance().RefundOrder(orderId,error))
{
tmpstr = QString("\r\n[撤回销售单失败]");
QLOG_INFO() << QString("entry order failed[%1]").arg(error);
}else
{
tmpstr = QString("\r\n[撤回销售单成功]");
}
emit showAlert(AlertForm::SUCCESS, QString("退单成功!%1").arg(tmpstr));
}
}
return result;
}
bool FlowControl::_GetCashiers(QList<CashierObject> &cashiersList)
{
QString strCashiers, error;
......@@ -478,6 +537,16 @@ QString FlowControl::_GetJsonStr(const QJsonObject &json)
return QString(QJsonDocument(json).toJson(QJsonDocument::Compact)).replace("\"","");
}
bool FlowControl::_DoOrderEntry(OrderObject *orderObject)
{
}
bool FlowControl::_RefundOrder()
{
}
void FlowControl::onFlowStart()
{
m_timestamp = "0";
......@@ -485,10 +554,10 @@ void FlowControl::onFlowStart()
m_pullOrderSocket = new BillSocket(this);
m_procOrderSocket = new BillSocket(this);
if(_GetStoreInfo())
{
_Login();
}
// if(_GetStoreInfo())
// {
// _Login();
// }
return;
}
......@@ -508,10 +577,10 @@ void FlowControl::onProcessOrder(const QString &operation, const QString &orderI
if(!operation.compare(OPERATION_GETDELIVERS))
{
// 放在这检测收银员的合法性因为接单前会获取配送员
if(_CheckCashiers())
{
//if(_CheckCashiers())
//{
_GetDelivers(orderId);
}
//}
}else if(!operation.compare(OPERATION_CONFRIM))
{
_ConfirmOrder(orderId, deliverObj);
......@@ -526,7 +595,7 @@ void FlowControl::onProcessOrder(const QString &operation, const QString &orderI
_CompleteOrder(orderId);
}else if(!operation.compare(OPERATION_REFUSEREFUND))
{
_RefuseRefund(orderId);
_RefundOrder(orderId);
}
}
......@@ -547,9 +616,19 @@ void FlowControl::onUpdateCashier(const CashierObject &cashier)
void FlowControl::onGetOrderDetails(const QString &orderId)
{
if(_CheckCashiers())
{
//if(_CheckCashiers())
//{
emit hideAlert();
emit showOrderDetails(m_ordersMap.value(orderId));
}
//}
}
void FlowControl::onGetNewStoreInfo(const QString &operator_id, const QString &pos_id, const QString &store_id, const QString &business_date)
{
m_storeId = store_id;
m_posId = pos_id;
m_cashierId = operator_id;
m_bDate = QDateTime::fromString(business_date, "yyyyMMdd");
_Login();
}
......@@ -62,6 +62,11 @@ signals:
* 返回:NULL
* */
void setStoreInfo(const QString& storeId);
/* 功能:设置主界收银员信息
* 参数:[1]收银员信息
* 返回:NULL
* */
void setCashierInfo(const QString& cashierInfo);
/* 功能:设置门店营业状态
* 参数:[1]营业状态
* 返回:NULL
......@@ -139,6 +144,11 @@ private slots:
* 返回:是否成功
* */
bool _RefuseRefund(const QString& orderId);
/* 功能:退单
* 参数:NULL
* 返回:是否成功
* */
bool _RefundOrder(const QString& orderId);
/* 功能:获取收银员
* 参数:[1]收银员列表
* 返回:成功true失败false
......@@ -155,6 +165,17 @@ private slots:
* */
QString _GetJsonStr(const QJsonObject& json);
/* 功能:写入销售单
* 参数:NULL
* 返回:成功true失败false
* */
bool _DoOrderEntry(OrderObject* orderObject);
/* 功能:销售单退单
* 参数:NULL
* 返回:成功true失败false
* */
bool _RefundOrder();
public slots:
/* 功能:开启流程控制器
* 参数:NULL
......@@ -187,6 +208,13 @@ public slots:
* 返回:NULL
* */
void onGetOrderDetails(const QString& orderId);
/* 功能:获取到新的门店信息
* 参数:[1]操作员ID[2]POS机ID
* [3]门店ID[4]营业日
* 返回:NULL
* */
void onGetNewStoreInfo(const QString& operator_id, const QString& pos_id,
const QString& store_id, const QString& business_date);
};
......
#include "sinfoControl.h"
#include "QsLog.h"
#include <QJsonObject>
#include <QJsonDocument>
SInfoControl &SInfoControl::GetInstance()
{
static SInfoControl sc;
return sc;
}
void SInfoControl::SetListenPort(int port)
{
m_port = port;
}
void SInfoControl::run()
{
m_tcpServer = new QTcpServer(this);
if(!m_tcpServer->listen(QHostAddress::LocalHost, m_port))
{
QLOG_WARN() << QString("SInfoControl listen failed on port[%1]").arg(m_port);
return;
}
m_bContinue = true;
QByteArray recvData;
QString replyData;
QJsonParseError jsonError;
QJsonDocument jsonDoc;
while(m_bContinue)
{
if(!m_tcpServer->waitForNewConnection(60000))
{
continue;
}
QLOG_INFO() << "onNewConnecion.....";
QString error;
QString fm_cmd, fm_ver, operator_id, pos_id, store_id, business_date;
QJsonObject store_info;
m_tcpSocket = m_tcpServer->nextPendingConnection();
if(!m_tcpSocket->waitForReadyRead())
{
m_tcpSocket->close();
continue;
}
recvData = m_tcpSocket->readAll();
QLOG_INFO() << QString("recv data.[%1]").arg(QString(recvData));
jsonDoc = QJsonDocument::fromJson(recvData, &jsonError);
if(jsonError.error == QJsonParseError::NoError)
{
QJsonObject jsonObject = jsonDoc.object();
fm_cmd = jsonObject["fm_cmd"].toString();
fm_ver = jsonObject["fm_ver"].toString();
store_info = jsonObject["store_info"].toObject();
operator_id = store_info["operator_id"].toString();
pos_id = store_info["pos_id"].toString();
store_id = store_info["store_id"].toString();
business_date = store_info["business_date"].toString();
if(!fm_cmd.compare("put_store_info"))
{
if(!fm_ver.compare("1.0"))
{
if(!operator_id.isEmpty() && !pos_id.isEmpty()
&& !store_id.isEmpty() && !business_date.isEmpty())
{
emit getNewStoreInfo(operator_id, pos_id, store_id, business_date);
replyData = QString("{\"statusCode\": 100,\"msg\": \"\"}");
m_tcpSocket->write(replyData.toUtf8());
m_tcpSocket->waitForBytesWritten();
m_tcpSocket->close();
continue;
}else
{
error = QString("wrong store_info");
}
}else
{
error = QString("wrong ver, current[%1] right[1.0]").arg(fm_ver);
}
}else
{
error = QString("wrong cmd, current[%1] right[put_store_info]").arg(fm_cmd);
}
}else
{
error = "invalid data";
}
// 发生错误
replyData = QString("{\"statusCode\":0, \"msg\":\"%1\"}").arg(error);
m_tcpSocket->write(replyData.toUtf8());
m_tcpSocket->waitForBytesWritten();
m_tcpSocket->close();
continue;
}
QLOG_INFO() << "refundControl exit.";
}
#ifndef SINFOCONTROL_H
#define SINFOCONTROL_H
#include <QObject>
#include <QTcpServer>
#include <QTcpSocket>
class SInfoControl : public QObject
{
Q_OBJECT
public:
static SInfoControl& GetInstance();
void SetListenPort(int port);
private:
SInfoControl(){}
SInfoControl(SInfoControl const&);
SInfoControl& operator=(SInfoControl const&);
QTcpServer *m_tcpServer;
QTcpSocket *m_tcpSocket;
int m_port;
bool m_bContinue;
public slots:
/* 功能:开启控制器
* 参数:NULL
* 返回:NULL
* */
void run();
signals:
/* 功能:通知获取到门店信息
* 参数:[1]操作员ID[2]POS机ID
* [3]门店ID[4]营业日
* 返回:NULL
* */
void getNewStoreInfo(const QString& operator_id, const QString& pos_id,
const QString& store_id, const QString& business_date);
};
#endif // SINFOCONTROL_H
......@@ -76,5 +76,10 @@ bool ConfigManger::GetIsExistReEntryOrder()
return m_config->value(INI_REENTRY, 0).toBool();
}
int ConfigManger::GetTcpServerPort()
{
return m_config->value(INI_TCPPORT, 93953).toInt();
}
......@@ -70,6 +70,12 @@ public:
* 返回:true存在false不存在
* */
bool GetIsExistReEntryOrder();
/* 功能:获取TCP监听端口
* 参数:NULL
* 返回:端口号
* */
int GetTcpServerPort();
private:
ConfigManger();
......
......@@ -119,6 +119,7 @@ void FloatForm::_Blink()
void FloatForm::_PlayWav()
{
qDebug() << "playWav";
QSound::play(m_remindWav);
if(m_bReminding)
......@@ -129,6 +130,7 @@ void FloatForm::_PlayWav()
void FloatForm::onStartRemind(int type)
{
qDebug() << "onStartRemind";
switch(type)
{
case 0:
......@@ -142,6 +144,7 @@ void FloatForm::onStartRemind(int type)
break;
}
qDebug() << "aaaaaaaaaaa" << m_bReminding;
if(m_bReminding)
{
return;
......
......@@ -37,7 +37,8 @@ SOURCES += main.cpp\
settingForm.cpp \
floatForm.cpp \
detailForm.cpp \
Control/refundControl.cpp
Control/refundControl.cpp \
Control/sinfoControl.cpp
HEADERS += \
mainForm.h \
......@@ -58,7 +59,8 @@ HEADERS += \
settingForm.h \
floatForm.h \
detailForm.h \
Control/refundControl.h
Control/refundControl.h \
Control/sinfoControl.h
FORMS += mainForm.ui \
alertForm.ui \
......
......@@ -8,7 +8,9 @@
#include "dbsetForm.h"
#include "Control/flowControl.h"
#include "Control/refundControl.h"
#include "Control/sinfoControl.h"
#include "floatForm.h"
#include "DTools/configManger.h"
using namespace QsLogging;
......@@ -64,19 +66,14 @@ int main(int argc, char *argv[])
FlowControl::GetInstance().moveToThread(&workThread);
workThread.start();
// 将退款控制器移到工作线程
QThread refundThread;
RefundControl::GetInstance().SetListenPort(5566);
RefundControl::GetInstance().moveToThread(&refundThread);
QObject::connect(&refundThread, &QThread::started, &RefundControl::GetInstance(), &RefundControl::run);
refundThread.start();
// 将门店信息获取控制器移到工作线程
QThread sInfoThread;
SInfoControl::GetInstance().SetListenPort(ConfigManger::GetInstance().GetTcpServerPort());
SInfoControl::GetInstance().moveToThread(&sInfoThread);
QObject::connect(&sInfoThread, &QThread::started, &SInfoControl::GetInstance(), &SInfoControl::run);
sInfoThread.start();
DbsetForm d;
if(QDialog::Rejected == d.exec())
{
QLOG_INFO() << QString("-------- fmTakeaway exit --------");
return -1;
}
QObject::connect(&SInfoControl::GetInstance(), &SInfoControl::getNewStoreInfo, &FlowControl::GetInstance(), &FlowControl::onGetNewStoreInfo);
FloatForm f;
MainForm w;
......
......@@ -41,6 +41,7 @@ MainForm::MainForm(QWidget *parent) :
connect(&FlowControl::GetInstance(), &FlowControl::setOpeStatus, this, &MainForm::onSetOpeStatus);
connect(&FlowControl::GetInstance(), &FlowControl::setNetStatus, this, &MainForm::onSetNetStatus);
connect(&FlowControl::GetInstance(), &FlowControl::setStoreInfo, this, &MainForm::onSetStoreInfo);
connect(&FlowControl::GetInstance(), &FlowControl::setCashierInfo, this, &MainForm::onSetCashierInfo);
connect(&FlowControl::GetInstance(), &FlowControl::changeOrderStatus, this, &MainForm::onChangeOrderStatus);
connect(&FlowControl::GetInstance(), &FlowControl::showDeliverPickForm, this, &MainForm::onShowDeliverPickForm);
connect(&FlowControl::GetInstance(), &FlowControl::showCashierPickForm, this, &MainForm::onShowCashierPickForm);
......@@ -82,7 +83,6 @@ void MainForm::_Init()
// 初始化文字
ui->mainLabStoreid->setText(UI_STOREID);
ui->mainLabVersion->setText(APP_VERSION);
ui->mainLabCashier->setText(UI_CASHIER);
// 初始化表
int scales6[] = {3, 4, 2, 3, 3, 3};
......@@ -116,10 +116,6 @@ void MainForm::_Init()
m_prevBtn = ui->mainBtnNew;
m_prevTable = ui->mainTableNew;
m_currentTable = ui->mainTableNew;
// 门店营业状态详情暂时屏蔽
// TODO
ui->mainBtnOpeDetails->hide();
}
void MainForm::onSetCurrentTime()
......@@ -166,7 +162,7 @@ void MainForm::on_mainBtnHide_clicked()
void MainForm::onUpdateCashier(const CashierObject &cashier)
{
ui->mainLabCashier->setText(cashier.name);
//ui->mainBtnCashier->setText(cashier.name);
}
void MainForm::onShowOrderDetails(OrderObject *orderObject)
......@@ -233,6 +229,11 @@ void MainForm::onSetStoreInfo(const QString &storeId)
ui->mainLabStoreid->setText(storeId);
}
void MainForm::onSetCashierInfo(const QString &cashierInfo)
{
ui->mainLabCashier->setText(cashierInfo);
}
void MainForm::onSetOpeStatus(const QString &status)
{
ui->mainLabOpeStatus->setText(status);
......@@ -261,7 +262,7 @@ void MainForm::onChangeOrderStatus(OrderObject *orderObject, int oldStatus)
QString btnText(tabBtn->property("name").toString());
if(table->rowCount() != 0)
{
btnText = QString("%1(%2)").arg(btnText).arg(table->rowCount());
btnText = QString("%1\n%2").arg(table->rowCount()).arg(btnText);
}
tabBtn->setText(btnText);
}
......@@ -294,8 +295,7 @@ void MainForm::onChangeOrderStatus(OrderObject *orderObject, int oldStatus)
QWidget *pWdg = new QWidget(table);
QHBoxLayout *hLayout = new QHBoxLayout(pWdg);
QPushButton * pBtn = new QPushButton(pWdg);
QPixmap btnImg(":btnCommon_normal.png");
pBtn->setFixedSize(btnImg.size());
pBtn->setFixedSize(70, 30);
pBtn->setFocusPolicy(Qt::NoFocus);
pBtn->setObjectName("mainProcBtn");
pBtn->setProperty("orderId", orderObject->order_id);
......@@ -309,7 +309,7 @@ void MainForm::onChangeOrderStatus(OrderObject *orderObject, int oldStatus)
connect(pBtn, &QPushButton::clicked, this, &MainForm::onMainProcBtnClicked);
}
QString btnText = QString("%1(%2)").arg(tabBtn->property("name").toString()).arg(table->rowCount());
QString btnText = QString("%1\n%2").arg(table->rowCount()).arg(tabBtn->property("name").toString());
tabBtn->setText(btnText);
// 检测是否需要提示
......
......@@ -175,6 +175,11 @@ public slots:
* 返回:NULL
* */
void onSetStoreInfo(const QString& storeId);
/* 功能:设置收银员信息
* 参数:[1]收银员编号
* 返回:NULL
* */
void onSetCashierInfo(const QString& cashierInfo);
/* 功能:设置门店营业状态
* 参数:[1]营业状态
* 返回:NULL
......
......@@ -24,7 +24,8 @@
#define INI_FLOATOPACITY "Float/opacity"
#define INI_BLINKINTERVAL "Float/blinkInterval"
#define INI_SOUNDINTERVAL "Float/soundInterval"
#define INI_REENTRY "Features/reEntry"
#define INI_REENTRY "Features/reEntry"
#define INI_TCPPORT "TcpServer/Port"
#define JSON_REQTYPE "reqtype"
#define JSON_CURRENTUSER "current_user"
......
[FmServer]
url=http://waimaitest.freemudorder.com/api
\ No newline at end of file
url=http://waimaitest.freemudorder.com/api
[TcpServer]
port=
[DbServer]
postUrl=http://register.smartpos.top:8091/WebService/FtrendWS.asmx
\ No newline at end of file
run/skin/alert_bg.png

1.68 KB | W: | H:

run/skin/alert_bg.png

1.57 KB | W: | H:

run/skin/alert_bg.png
run/skin/alert_bg.png
run/skin/alert_bg.png
run/skin/alert_bg.png
  • 2-up
  • Swipe
  • Onion skin
run/skin/btnDown_normal.png

1.25 KB | W: | H:

run/skin/btnDown_normal.png

1.22 KB | W: | H:

run/skin/btnDown_normal.png
run/skin/btnDown_normal.png
run/skin/btnDown_normal.png
run/skin/btnDown_normal.png
  • 2-up
  • Swipe
  • Onion skin
run/skin/btnDown_press.png

1.28 KB | W: | H:

run/skin/btnDown_press.png

1.28 KB | W: | H:

run/skin/btnDown_press.png
run/skin/btnDown_press.png
run/skin/btnDown_press.png
run/skin/btnDown_press.png
  • 2-up
  • Swipe
  • Onion skin
run/skin/btnUp_normal.png

1.21 KB | W: | H:

run/skin/btnUp_normal.png

1.28 KB | W: | H:

run/skin/btnUp_normal.png
run/skin/btnUp_normal.png
run/skin/btnUp_normal.png
run/skin/btnUp_normal.png
  • 2-up
  • Swipe
  • Onion skin
run/skin/btnUp_press.png

1.32 KB | W: | H:

run/skin/btnUp_press.png

1.21 KB | W: | H:

run/skin/btnUp_press.png
run/skin/btnUp_press.png
run/skin/btnUp_press.png
run/skin/btnUp_press.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -4,8 +4,6 @@
<file>tabBtn_normal.png</file>
<file>tabBtn_checked.png</file>
<file>magn.png</file>
<file>btnCommon_normal.png</file>
<file>btnCommon_press.png</file>
<file>pickBtn_select.png</file>
<file>error.png</file>
<file>ok.png</file>
......@@ -17,14 +15,9 @@
<file>btnDown_press.png</file>
<file>cbxArrow.png</file>
<file>logo_0.png</file>
<file>logo_1.png</file>
<file>float_normal.png</file>
<file>float_remind.png</file>
<file>detailBtn_close_normal.png</file>
<file>detailBtn_close_press.png</file>
<file>detailFrm_bg.png</file>
<file>detailFrm_bg1.png</file>
<file>detailFrm_bg2.png</file>
<file>detailLab.png</file>
</qresource>
</RCC>
\ No newline at end of file
QWidget
{
font: 10pt "微软雅黑";
font: 9pt "微软雅黑";
}
......@@ -60,7 +60,11 @@ QWidget
/*---------------------------------mainForm[begin]---------------------------------*/
#MainForm
{
background-color: rgb(64, 119, 61);
background-color: #303030;
}
#mainFrmHead
{
background-color: #a02125;
}
#mainSlabLogo0
{
......@@ -72,29 +76,25 @@ QWidget
}
#mainBtnNew,#mainBtnMake,#mainBtnSend,#mainBtnFinsh,#mainBtnRefund,#mainBtnOther
{
font: bold 11pt "微软雅黑";
color: rgb(98, 98, 98);
color: #e4d0cd;
border-image: url(:tabBtn_normal.png);
}
#mainBtnNew:checked,#mainBtnMake:checked,#mainBtnSend:checked,#mainBtnFinsh:checked,#mainBtnRefund:checked,#mainBtnOther:checked
{
color: rgb(255, 255, 255);
color: #262626;
border-image: url(:tabBtn_checked.png);
}
#mainBtnHide,#mainBtnSet
{
font: bold 10pt "微软雅黑";
color: rgb(62, 118, 64);
background-color: rgb(122, 173, 106);
border-radius: 5px;
color: rgb(255, 255, 255);
background-color: #a02125;
border: 1px solid #ffffff;
border-radius: 5px;
}
#mainBtnHide:pressed,#mainBtnSet:pressed
{
color: rgb(172, 219, 169);
}
#mainSlabDiv
{
background-color: rgb(207, 6, 14);
color: #a02125;
background-color: #ffffff;
}
#mainFrmTables
{
......@@ -102,36 +102,28 @@ QWidget
}
#mainBtnUp
{
image: url(:btnUp_normal.png);
border-radius: 5px;
background-color: rgb(62, 118, 64);
border-image: url(:btnUp_normal.png);
}
#mainBtnUp:pressed
{
image: url(:btnUp_press.png);
border-radius: 5px;
background-color: rgb(62, 118, 64);
border-image: url(:btnUp_press.png);
}
#mainBtnDown
{
image: url(:btnDown_normal.png);
border-radius: 5px;
background-color: rgb(62, 118, 64);
border-image: url(:btnDown_normal.png);
}
#mainBtnDown:pressed
{
image: url(:btnDown_press.png);
border-radius: 5px;
background-color: rgb(62, 118, 64);
border-image: url(:btnDown_press.png);
}
#mainFrmSearch
{
background-color: rgb(82, 139, 78);
background-color: #303030;
}
#mainFrmSearchC,#mainEdtSearch
{
color: rgb(172, 219, 169);
background-color: rgb(88, 161, 100);
color: #cbcbcb;
background-color: #535353;
}
#mainSlabMagn
{
......@@ -139,33 +131,27 @@ QWidget
}
#mainLabPlacard
{
color: rgb(141, 193, 141);
background-color: rgb(44, 82, 44);
color: #b9b9b9;
background-color: #262626;
}
#mainSlabStoreid,#mainSlabOpeStatus,#mainSlabNetStatus,#mainSlabVersion,#mainSlabCashier,
#mainSlabTime,#mainLabStoreid,#mainLabOpeStatus,#mainLabNetStatus,#mainLabVersion
#mainSlabTime,#mainLabStoreid,#mainLabOpeStatus,#mainLabNetStatus,#mainLabVersion,#mainLabCashier
{
color: rgb(31, 55, 31);
}
#mainLabCashier
{
color: rgb(135, 223, 60);
}
#mainBtnOpeDetails,#mainBtnCashier
{
color: rgb(62, 118, 64);
background-color: rgb(122, 173, 106);
border-radius: 5px;
color: #9b9b9b;
}
#mainProcBtn
{
color: rgb(124, 124, 124);
border-image: url(:btnCommon_normal.png);
color: #878787;
background-color: #ffffff;
border: 1px solid #878787;
border-radius: 4px;
}
#mainProcBtn:pressed
{
color: rgb(154, 154, 154);
border-image: url(:btnCommon_press.png);
color: #3de17b;
background-color: #ffffff;
border: 1px solid #3de17b;
border-radius: 4px;
}
#mainBtnOpeDetails:pressed,#mainBtnCashier:pressed
{
......@@ -175,7 +161,7 @@ QWidget
{
font: 11pt "微软雅黑";
color: rgb(98, 98, 98);
selection-background-color: rgb(239, 235, 143);
selection-background-color: #f4f4f4;
}
#mainTableNew QHeaderView::section,#mainTableMake QHeaderView::section,
#mainTableSend QHeaderView::section,#mainTableFinsh QHeaderView::section,
......@@ -183,8 +169,7 @@ QWidget
{
border: 0px;
background: rgb(255, 255, 255);
color: rgb(98, 98, 98);
font: bold 12pt "微软雅黑";
color: #878787;
}
#mainTableNew QHeaderView::down-arrow,#mainTableMake QHeaderView::down-arrow,
#mainTableSend QHeaderView::down-arrow,#mainTableFinsh QHeaderView::down-arrow,
......@@ -357,7 +342,23 @@ QWidget
/*---------------------------------DetailForm[begin]---------------------------------*/
#DetailForm
{
background-color: rgb(64, 119, 61);
background-color: rgb(255, 255, 255);
}
#detailFrmHead
{
background-color: #ad3237;
}
#detailLeftHead
{
font: 10pt "微软雅黑";
color: #676666;
background-color: #f1f0f0;
}
#detailRightHead
{
font: 10pt "微软雅黑";
color: #666666;
background-color: #dddadb;
}
#detailBtnClose
{
......@@ -376,9 +377,11 @@ QWidget
}
#detailFrm2
{
margin-top: -2px;
margin-bottom: -2px;
border-image: url(:detailFrm_bg2.png);
background-color: #e5e5e5;
}
#detailSlab11
{
color: #4b4b4b;
}
#detailFrm3,#detailFrm4
{
......@@ -394,76 +397,58 @@ QWidget
#detailSlab0,#detailSlab1,#detailSlab2,#detailSlab3,#detailSlab4,
#detailSlab5,#detailSlab6,#detailSlab7,#detailSlab8
{
margin-top: -2px;
margin-bottom: 1px;
font: bold 9pt "微软雅黑";
color: rgb(171, 226, 177);
border-image: url(:detailLab.png);
color: #a6a6a6;
background-color: #faf9f9;
border: 1px solid #ececec;
}
#detailLab0,#detailLab2,#detailLab3,#detailLab4,
#detailLab5,#detailLab6,#detailLab7,#detailLab8
{
border-bottom: 1px solid rgb(90, 162, 98);
color: rgb(44, 69, 43);
background-color: rgb(155, 204, 134);
border-top: 1px solid #ececec;
border-bottom: 1px solid #ececec;
color: #4d4d4d;
background-color: #faf9f9;
}
#detailLab1
{
border-bottom: 1px solid rgb(90, 162, 98);
color: rgb(190, 63, 0);
background-color: rgb(155, 204, 134);
background-color: #faf9f9;
}
#detailBtn0,#detailBtn1
#detailBtn0,#detailBtn1,#detailBtn3
{
font: bold 10pt "微软雅黑";
color: rgb(110, 110, 110);
background-color: rgb(255, 255, 255);
border-radius: 3px;
color: #ffffff;
background-color: #3e4d65;
border-radius: 5px;
}
#detailBtn2
{
font: bold 10pt "微软雅黑";
color: rgb(205, 0, 0);
background-color: rgb(255, 255, 255);
border-radius: 3px;
color: #ffffff;
background-color: #ad3237;
border-radius: 5px;
}
#detailBtn3
#detailBtn2:pressed
{
font: bold 10pt "微软雅黑";
color: rgb(25, 162, 25);
background-color: rgb(255, 255, 255);
border-radius: 3px;
background-color: #be3c41;
}
#detailBtn0:pressed,#detailBtn1:pressed,#detailBtn2:pressed,#detailBtn3:pressed
#detailBtn0:pressed,#detailBtn1:pressed,#detailBtn3:pressed
{
font: bold 10pt "微软雅黑";
color: rgb(161, 161, 161);
background-color: rgb(255, 255, 255);
border-radius: 3px;
background-color: #4d5f7c;
}
#detailTable0
{
gridline-color: rgb(207, 234, 187);
background-color: rgb(180, 205, 163);
color: rgb(66, 66, 66);
background-color: #ffffff;
color: #333333;
}
#detailLabRecord
{
color: rgb(66, 66, 66);
background-color: rgb(180, 205, 163);
}
#detailSlab11
{
font: bold 11pt "微软雅黑";
color: rgb(255, 255, 255);
color: #4b4b4b;
background-color: #f9f9f9;
}
#detailTable0 QHeaderView::section
{
border: 0px;
border-left: 1px solid rgb(56, 104, 53);
background: rgb(90, 162, 98);
color: rgb(171, 226, 177);
font: bold 9pt "微软雅黑";
background: #ffffff;
color: #636363;
}
#detailTable0 QScrollBar:vertical
{
......
run/skin/detailBtn_close_normal.png

2.59 KB | W: | H:

run/skin/detailBtn_close_normal.png

1.14 KB | W: | H:

run/skin/detailBtn_close_normal.png
run/skin/detailBtn_close_normal.png
run/skin/detailBtn_close_normal.png
run/skin/detailBtn_close_normal.png
  • 2-up
  • Swipe
  • Onion skin
run/skin/detailBtn_close_press.png

2.68 KB | W: | H:

run/skin/detailBtn_close_press.png

1.2 KB | W: | H:

run/skin/detailBtn_close_press.png
run/skin/detailBtn_close_press.png
run/skin/detailBtn_close_press.png
run/skin/detailBtn_close_press.png
  • 2-up
  • Swipe
  • Onion skin
run/skin/float_normal.png

10.6 KB | W: | H:

run/skin/float_normal.png

8.17 KB | W: | H:

run/skin/float_normal.png
run/skin/float_normal.png
run/skin/float_normal.png
run/skin/float_normal.png
  • 2-up
  • Swipe
  • Onion skin
run/skin/float_remind.png

11.6 KB | W: | H:

run/skin/float_remind.png

9.32 KB | W: | H:

run/skin/float_remind.png
run/skin/float_remind.png
run/skin/float_remind.png
run/skin/float_remind.png
  • 2-up
  • Swipe
  • Onion skin
run/skin/logo_0.png

2.67 KB | W: | H:

run/skin/logo_0.png

4.03 KB | W: | H:

run/skin/logo_0.png
run/skin/logo_0.png
run/skin/logo_0.png
run/skin/logo_0.png
  • 2-up
  • Swipe
  • Onion skin
run/skin/magn.png

1.46 KB | W: | H:

run/skin/magn.png

1.26 KB | W: | H:

run/skin/magn.png
run/skin/magn.png
run/skin/magn.png
run/skin/magn.png
  • 2-up
  • Swipe
  • Onion skin
run/skin/tabBtn_checked.png

1.46 KB | W: | H:

run/skin/tabBtn_checked.png

1.89 KB | W: | H:

run/skin/tabBtn_checked.png
run/skin/tabBtn_checked.png
run/skin/tabBtn_checked.png
run/skin/tabBtn_checked.png
  • 2-up
  • Swipe
  • Onion skin
run/skin/tabBtn_normal.png

2.31 KB | W: | H:

run/skin/tabBtn_normal.png

1.43 KB | W: | H:

run/skin/tabBtn_normal.png
run/skin/tabBtn_normal.png
run/skin/tabBtn_normal.png
run/skin/tabBtn_normal.png
  • 2-up
  • Swipe
  • Onion skin
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