Commit 55247d2d by wuyang.zou

fix bug:1、获取员工是否绑定钱箱,如果没有绑定提示 员工先绑定钱箱:【测试OK】

2、获取员工是否有退货授权权限

3、POS插件退货时,向服务端传 pos系统的登陆员工号;
4、捕捉pos系统的退货授权异常解析成功;
5、生产环境发布生产,会导致门店插件程序的右下脚,网络状态异常,等待生产环境发布正常后,网路状态不能还原成正常
6、插件程序进行加锁,锁住正在POS系统录单的订单,此时不接受OMS服务端推此订单的状态变化;
parent 71598178
......@@ -32,6 +32,13 @@ public:
* */
QString _GetCashierId();
/* 功能:获取收银员Name
* 参数:NULL
* 返回:是否成功
* */
QString _GetCashierName();
/* 功能:判断SIM有效订单队列list 是否为空;
* 参数:NULL
* 返回:SIM有效订单队列是否为空;
......@@ -67,6 +74,7 @@ private:
QString m_password;
QString m_posId;
QString m_cashierId;
QString m_cashierName;
QDateTime m_bDate;
QString m_storeName;
int m_orderCount;
......@@ -516,7 +524,7 @@ public slots:
*参数:1、请求json参数;2、准备返回请求数据的Buff;3、返回错误信息;
*返回:是否准备成功;
**/
bool _ResponseSimReqFristOrderData(QJsonObject &data,QString &error, const QString &orderId);
bool _ResponseSimReqFristOrderData(const QJsonObject &content,QJsonObject &data,QString &error, const QString &orderId);
};
......
......@@ -46,7 +46,7 @@ QJsonObject DataManger::GetLoginData(const QString &partnerId, const QString &st
const QString &stationId, const QString &cashierId, const QString &ipAddress)
{
QJsonObject rObj;
Q_UNUSED(cashierId);
rObj.insert(JSON_IPADDRESS, ipAddress);
rObj.insert(JSON_PARTNERID,partnerId);
rObj.insert(JSON_ORGCODE, storeId);
......@@ -136,9 +136,11 @@ QJsonObject DataManger::GetCompleteOrderData(const QString &orderId)
return rObj;
}
QJsonObject DataManger::GetRefundOrderData(int reasonCode,const QString &reason, const QString &orderId,const QString& channel,const QString& dishesListString)
QJsonObject DataManger::GetRefundOrderData(int reasonCode,const QString &reason, const QString &orderId,const QString& channel,const QString& dishesListString, const QString& cashierId, const QString& cashierName)
{
QJsonObject rObj;
Q_UNUSED(channel);
Q_UNUSED(reason);
QJsonArray productIds;
QString str = dishesListString;
if(str.length()){
......@@ -150,8 +152,9 @@ QJsonObject DataManger::GetRefundOrderData(int reasonCode,const QString &reason,
rObj.insert(JSON_ORDERID, orderId);
rObj.insert("productIds", productIds);
rObj.insert("canceledCause", QString::number(reasonCode, 10) );
rObj.insert("cashierNumber", cashierId);
rObj.insert("cashierName", cashierName);
rObj.insert(JSON_POSIPADDRESS,QString("http://") + m_posIpAddress);
return rObj;
}
......
......@@ -78,7 +78,7 @@ public:
* 参数:[1]时间戳
* 返回:登录数据
* */
QJsonObject GetRefundOrderData(int reasonCode, const QString& reason, const QString& orderId, const QString &channel,const QString& dishesListString);
QJsonObject GetRefundOrderData(int reasonCode, const QString& reason, const QString& orderId, const QString &channel,const QString& dishesListString,const QString& cashierId,const QString& cashierName);
/* 功能:获取拒绝退单数据
* 参数:[1]时间戳
* 返回:登录数据
......
#include "getCaboxAReAuth.h"
#include "QsLog.h"
#include <QDateTime>
#include "Control/flowControl.h"
#include "preDefine.h"
GetCaboxAReAuth::GetCaboxAReAuth() {
QLOG_INFO()<<"[<<<<---GetCaboxAReAuth:: Structure POS Get Has Cash Box Or Refund Auth DataBase--->>>>]";
}
bool GetCaboxAReAuth::initGetAuthPosDB(){
m_sqlDb = QSqlDatabase::addDatabase("QODBC","GetCaboxAReAuth"); //数据库驱动类型为SQL Server
if(m_sqlDb.isValid()){
QLOG_INFO()<<"[<<<<---SqlServer ODBC driver is valid--->>>>]";
QString dsn="DRIVER={SQL SERVER};SERVER=127.0.0.1\\sqlexpress;DATABASE=DataStore";
m_sqlDb.setDatabaseName(dsn); //设置数据源名称
m_sqlDb.setUserName("sa"); //登录用户
m_sqlDb.setPassword("SIM29@123");
if(!m_sqlDb.open()) { //打开数据库
QLOG_ERROR()<<"[<<<<---SqlServer Open Database error:--->>>>]"<<m_sqlDb.lastError().text();
} else {
QLOG_INFO()<<"[<<<<---SqlServer Test Open database success!:--->>>>]";
m_sqlDb.close();
return true;
}
} else {
QLOG_ERROR()<<"[<<<<---SqlServer ODBC driver no valid--->>>>]";
}
return false;
}
GetCaboxAReAuth &GetCaboxAReAuth::getInstance()
{
static GetCaboxAReAuth GetCaboxAReAuth;
return GetCaboxAReAuth;
}
int GetCaboxAReAuth::getUserHasCashBox(const QString& operatorId){
QMutexLocker mutex(&m_mutex);
if(!m_sqlDb.open()) {
QLOG_ERROR()<<"[<<<<---SqlServer Database:Open Failed--->>>>]"<<m_sqlDb.lastError().text();
return 0;
}
int result=0;
QSqlQuery query(m_sqlDb);
QLOG_INFO()<<QString("select count(*) from [DataStore].[dbo].employee as A, [DataStore].[dbo].CM_EMPLOYEE_TILL_ASSIGNMENT as B where A.EmployeeID = B.EmployeeID and ObjectNumber='%1'").arg(operatorId);
query.prepare(QString("select count(*) from [DataStore].[dbo].employee as A, [DataStore].[dbo].CM_EMPLOYEE_TILL_ASSIGNMENT as B where A.EmployeeID = B.EmployeeID and ObjectNumber='%1'").arg(operatorId));
if(!query.exec()) {
QLOG_ERROR()<<"[<<<<---SqlServer Database:getUserHasCashBox--->>>>]"<<query.lastError().text();
result= 0;
}
if(query.first()) {
result= query.value(0).toInt()?1:0;
QLOG_INFO()<<"[<<<<---SqlServer Database operatorId:%1,getUserHasCashBox:%2--->>>>]"<<operatorId<<result;
QLOG_INFO()<<"[<<<<---SqlServer Database operatorId:%1,:getUserHasCashBox query.value(0):%2--->>>>]"<<operatorId<<query.value(0).toInt();
QLOG_INFO()<<"[<<<<---SqlServer Database operatorId:%1,:getUserHasCashBox query.value(1):%2--->>>>]"<<operatorId<<query.value(1).toInt();
QLOG_INFO()<<"[<<<<---SqlServer Database operatorId:%1,:getUserHasCashBox query.value(2):%2--->>>>]"<<operatorId<<query.value(2).toInt();
} else {
result = 0;
}
m_sqlDb.close();
return result;
}
int GetCaboxAReAuth::getUserRefundAuth(const QString& operatorId){
QMutexLocker mutex(&m_mutex);
Q_UNUSED(operatorId)
if(!m_sqlDb.open()) {
QLOG_ERROR()<<"[<<<<---SqlServer Database:Open Failed--->>>>]"<<m_sqlDb.lastError().text();
return 0;
}
int result = 0;
QSqlQuery query(m_sqlDb);
//query.prepare(QString("select distinct 0 from employee ").arg(operatorId));
query.prepare(QString("select distinct 0 from employee "));
if(!query.exec()) {
QLOG_ERROR()<<"[<<<<---SqlServer Database:getUserRefundAuth--->>>>]"<<query.lastError().text();
result= 0;
}
if(query.first()) {
result= 0; //等待后期更新;
} else {
result = 0;
}
m_sqlDb.close();
return result;
}
#ifndef GETCABOXAREAUTH_H
#define GETCABOXAREAUTH_H
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlQuery>
#include <QtSql/QSqlError>
#include <QObject>
#include <QMutex>
class GetCaboxAReAuth : public QObject
{
Q_OBJECT
public:
// explicit GetCaboxAReAuth(QObject *parent = 0);
static GetCaboxAReAuth& getInstance();
/**
*功能:初始化pos本地数据库;方便后期判断 打开pos本地数据库是否成功;
*参数:[无]
*返回:true:能够成功打开POS本地数据库,false:不能够成功打开POS本地数据库
**/
bool initGetAuthPosDB();
/**
*功能:查询本地的POS系统中当前用户是否已经绑定钱箱;
*参数:[1]当前店员 操作员ID
*返回:1:已经绑定钱箱,0:没有绑定钱箱
**/
int getUserHasCashBox(const QString& operatorId);
/**
*功能:查询本地的POS系统中当前用户是否拥有 经理 或 管理员权限;
*参数:[1]当前店员 操作员ID
*返回:1:是经理权限或是管理员,0:既没有经理权限也没有管理员权限
**/
int getUserRefundAuth(const QString& operatorId);
private:
QMutex m_mutex;
GetCaboxAReAuth();
GetCaboxAReAuth(GetCaboxAReAuth const&);
GetCaboxAReAuth& operator=(GetCaboxAReAuth const&);
QSqlDatabase m_sqlDb;
signals:
public slots:
};
#endif // GETCABOXAREAUTH_H
#include "gethascashboxandrefundauth.h"
GetHasCashboxAndRefundAuth::GetHasCashboxAndRefundAuth()
{
}
......@@ -283,7 +283,7 @@ bool SimProcOrderDB::updatePosOrderCheckNo(const QString &orderId, const QString
QLOG_ERROR()<<query.lastError().text()<<__FUNCTION__;
result= false;
} else {
QLOG_INFO()<<QString("[<<<<---SimProcOrderDB::Action4: Report CheckNo : Update OrderId:%1 posCheckNo:%2 Success--->>>>]").arg(orderId,posOrderCheckNo);
QLOG_INFO()<<QString("[<<<<---SimProcOrderDB::Action4: Report CheckNo : Update OrderId:%1 posCheckNo:%2 Success--->>>>]").arg(orderId).arg(posOrderCheckNo);
result = true;
}
m_sqlDb.close();
......@@ -320,6 +320,7 @@ bool SimProcOrderDB::deleteOrderRecord(QString creatTime)
return false;
}
bool result=true;
QLOG_INFO()<<QString("[<<<<---SimProcOrderDB::begin deleteOrderRecord creatTime:%1--->>>>]").arg(creatTime);
QSqlQuery query(m_sqlDb);
query.prepare(QString("delete from SimProcOrderTable where creatTime<'%1'").arg(creatTime));
if(!query.exec()) {
......
......@@ -5,6 +5,7 @@
BaseObject::BaseObject(const BaseObject &p, QObject *parent)
{
Q_UNUSED(parent);
const QMetaObject *m = p.metaObject();
for( int i=m->propertyOffset(); i<m->propertyCount(); i++)
{
......
......@@ -55,7 +55,8 @@ SOURCES += main.cpp\
dailyreportForm.cpp \
Model/dailyObject.cpp \
DTools/simProcOrderDB.cpp \
DTools/printSumBillPosDB.cpp
DTools/printSumBillPosDB.cpp \
DTools/getCaboxAReAuth.cpp
HEADERS += \
mainForm.h \
......@@ -89,7 +90,8 @@ HEADERS += \
Model/dailyObject.h \
DTools/dump.h \
DTools/simProcOrderDB.h \
DTools/printSumBillPosDB.h
DTools/printSumBillPosDB.h \
DTools/getCaboxAReAuth.h
FORMS += mainForm.ui \
alertForm.ui \
......
......@@ -57,6 +57,7 @@
#define JSON_POSNO "posNo"
#define JSON_STORENAME "StoreName"
#define JSON_USERID "userId"
#define JSON_USERNAME "userName"
#define JSON_BUSINESSDATE "business_date"
#define JSON_STATUSCODE "statusCode"
#define JSON_LOGINCODE "code"
......
......@@ -25,6 +25,7 @@ void refDishesForm::InitData(OrderObject *obj)
_Init();
int i=0;
Q_UNUSED(i);
foreach (dishesObject *product, obj->proList)
{
ui->refDishesTable->setColumnWidth(0,300);
......
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