Commit 891537b0 by ss.dai

2

parent 01718d6e
......@@ -218,19 +218,52 @@ bool FlowControl::_PullOrder()
}
}
if(orderObject->status==2 && orderObject->courier_name.isEmpty())
if(orderObject->status==2 && orderObject->delivery_status==1)
{
// 打印
QString error;
QLOG_INFO() << QString("[---begin print---].");
if(FmPrinter::GetInstance().DoPrint(ConfigManger::GetInstance().GetPrinterName(), orderObject, error))
{
QLOG_INFO() << QString("print sucessful");
}else
{
QLOG_INFO() << QString("print failed, %1").arg(error);
}
QString fileDir = QString("%1/printed").arg(QApplication::applicationDirPath());
QDir().mkdir(fileDir);
QString filePath = QString("%1/%2_%3").arg(fileDir, orderObject->channel, orderObject->order_id);
QFile file(filePath);
if(!file.exists())
{
QString error;
QLOG_INFO() << QString("[---begin print---].");
if(FmPrinter::GetInstance().DoPrint(ConfigManger::GetInstance().GetPrinterName(), orderObject, error))
{
QLOG_INFO() << QString("print sucessful");
file.open(QIODevice::WriteOnly);
file.close();
}else
{
QLOG_INFO() << QString("print failed, %1").arg(error);
}
}
}
if(orderObject->order_type==3 || orderObject->order_type==4)
{
// 打印
QString fileDir = QString("%1/printed").arg(QApplication::applicationDirPath());
QDir().mkdir(fileDir);
QString filePath = QString("%1/%2_%3").arg(fileDir, orderObject->channel, orderObject->order_id);
QFile file(filePath);
if(!file.exists())
{
QString error;
QLOG_INFO() << QString("[---begin print---].");
if(FmPrinter::GetInstance().DoPrint(ConfigManger::GetInstance().GetPrinterName(), orderObject, error))
{
QLOG_INFO() << QString("print sucessful");
file.open(QIODevice::WriteOnly);
file.close();
}else
{
QLOG_INFO() << QString("print failed, %1").arg(error);
}
}
}
m_timestamp = orderObject->timestamp;
......
......@@ -86,6 +86,11 @@ QString ConfigManger::GetDbServerIp()
return m_config->value(INI_DBSERVERIP).toString();
}
QString ConfigManger::GetPrefix()
{
return m_config->value(INI_PREFIX).toString();
}
int ConfigManger::GetDbServerPort()
{
return m_config->value(INI_DBSERVERPORT).toInt();
......
......@@ -80,6 +80,12 @@ public:
* 返回:销售单地址
* */
QString GetDbServerIp();
/* 功能:获取帐号前缀
* 参数:NULL
* 返回:销售单地址
* */
QString GetPrefix();
/* 功能:获取销售单写入端口
* 参数:NULL
* 返回:销售单端口
......
#include "dataManger.h"
#include "preDefine.h"
#include "configManger.h"
// 请求类型
enum
......@@ -26,7 +27,7 @@ QJsonObject DataManger::GetLoginData(const QString &storeId, const QString &pass
{
QJsonObject rObj, cObj;
rObj.insert(JSON_REQTYPE, LOGIN);
cObj.insert(JSON_USERNAME, storeId);
cObj.insert(JSON_USERNAME, ConfigManger::GetInstance().GetPrefix()+storeId);
cObj.insert(JSON_PASSWORD, password);
rObj.insert(JSON_CURRENTUSER, cObj);
rObj.insert(JSON_STATIONID, stationId);
......
......@@ -170,12 +170,8 @@ void DetailForm::onOperaBtnClicked()
void DetailForm::on_detailBtn1_clicked()
{
QLOG_INFO() << "re print...............";
if(!m_orderObject->courier_name.isEmpty())
{
QLOG_INFO() << "---------------------" << m_orderObject->courier_name;
QString error;
FmPrinter::GetInstance().DoPrint(ConfigManger::GetInstance().GetPrinterName(), m_orderObject, error);
}
QString error;
FmPrinter::GetInstance().DoPrint(ConfigManger::GetInstance().GetPrinterName(), m_orderObject, error);
}
void DetailForm::on_detailBtn0_clicked()
......
......@@ -19,6 +19,7 @@
#define INI_PASSWORD "SqlServer/password"
#define INI_DATABASE "SqlServer/database"
#define INI_SERVER "FmServer/url"
#define INI_PREFIX "FmServer/prefix"
#define INI_PRINTERNAME "Printer/name"
#define INI_FLOATPOSTION "Float/postion"
#define INI_FLOATOPACITY "Float/opacity"
......
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