Commit 88cf4e7b by ss.dai

修复打印机不打印、乱码问题,更改销售单写入提示语

parent 48a42b72
......@@ -87,7 +87,8 @@ QString FmPrinter::_GetPrintData(OrderObject *pData)
bool FmPrinter::_RawDataToPrinter(QString printerName, QString data)
{
LPTSTR szPrinterName = (LPTSTR)printerName.toStdWString().c_str();
LPBYTE lpData=(LPBYTE)data.toLocal8Bit().data();
QByteArray tmpData = data.toLocal8Bit();
LPBYTE lpData=(LPBYTE)tmpData.data();
DWORD dwCount = strlen((char*)lpData);
BOOL bStatus = FALSE;
HANDLE hPrinter = NULL;
......@@ -99,9 +100,9 @@ bool FmPrinter::_RawDataToPrinter(QString printerName, QString data)
bStatus = OpenPrinter( szPrinterName, &hPrinter, NULL );
if (bStatus) {
// Fill in the structure with info about this "document."
DocInfo.pDocName = (LPTSTR)QString("TakeawayDoc").toStdWString().c_str();
DocInfo.pDocName = (LPTSTR)L"TakeawayDoc";
DocInfo.pOutputFile = NULL;
DocInfo.pDatatype = (LPTSTR)QString("RAW").toStdWString().c_str();
DocInfo.pDatatype = (LPTSTR)L"RAW";
// Inform the spooler the document is beginning.
dwJob = StartDocPrinter( hPrinter, 1, (LPBYTE)&DocInfo );
......
......@@ -242,10 +242,10 @@ bool FlowControl::_ConfirmOrder(const QString &orderId, const DeliverObject &del
{
OrderObject *orderObject = m_ordersMap.value(orderId);
emit showAlert(AlertForm::LOADING, "正在写入销售单......");
emit showAlert(AlertForm::LOADING, "正在录入天天饮食......");
QLOG_INFO() << QString("[---order entry begin---]");
// 写入销售单
QString orderEntryError("\r\n写入销售单成功");
QString orderEntryError("[此单录入天天饮食成功]");
if(!FmPlugin::GetInstance().DoOrderEntry(orderObject, m_cashierObject.id, m_cashierObject.name,
m_cashierObject.shiftId, m_cashierObject.shiftName, error))
{
......@@ -258,7 +258,7 @@ bool FlowControl::_ConfirmOrder(const QString &orderId, const DeliverObject &del
file.open(QFile::WriteOnly);
file.close();
}
orderEntryError = QString("\r\n[写入销售单失败,可在订单详情页补录.]");
orderEntryError = QString("<font color=\"#FF0000\">[此单录入天天饮食失败,请务必及时在订单详情页补录]</font>");
QLOG_ERROR() << QString("order entry failed,[%1]").arg(error);
}else
{
......@@ -266,9 +266,9 @@ bool FlowControl::_ConfirmOrder(const QString &orderId, const DeliverObject &del
}
QString remark(orderObject->remark), deliveryTime;
remark = remark.isEmpty()? "" : QString("\r\n[备注: %1]").arg(remark);
deliveryTime = QString("\r\n[期望送达时间: %1]").arg(QDateTime::fromTime_t(orderObject->delivery_time).toString("yyyy-MM-dd hh:mm:ss"));
emit showAlert(AlertForm::SUCCESS, QString("接单成功!%1%2%3").arg(remark).arg(deliveryTime).arg(orderEntryError));
remark = remark.isEmpty()? "" : QString("[备注: %1]").arg(remark);
deliveryTime = QString("[期望送达时间: %1]").arg(QDateTime::fromTime_t(orderObject->delivery_time).toString("yyyy-MM-dd hh:mm:ss"));
emit showAlert(AlertForm::SUCCESS, QString("接单成功!%1<br/>%2<br/>%3").arg(remark).arg(deliveryTime).arg(orderEntryError));
// 通知主界面移动订单
int oldStatus = orderObject->status;
......@@ -615,7 +615,7 @@ void FlowControl::onGetOrderDetails(const QString &orderId)
void FlowControl::onReEntryOrder(const QString &orderId)
{
emit showAlert(AlertForm::LOADING, "正在补录销售单......");
emit showAlert(AlertForm::LOADING, "正在补录到天天饮食......");
QLOG_INFO() << QString("[---order reEntry begin---]");
// 写入销售单
......@@ -625,13 +625,13 @@ void FlowControl::onReEntryOrder(const QString &orderId)
m_cashierObject.shiftId, m_cashierObject.shiftName, error))
{
QLOG_ERROR() << QString("order reEntry failed,[%1]").arg(error);
emit showAlert(AlertForm::ERROR, "补录销售单失败");
emit showAlert(AlertForm::ERROR, "<font color=\"#FF0000\">补录天天饮食失败,请联系管理员或者进群咨询(205821431)</font>");
}else
{
QFile file(QString("%1/orders/%2").arg(QApplication::applicationDirPath(), orderObject->order_id));
file.remove();
QLOG_INFO() << QString("order reEentry success.");
emit showAlert(AlertForm::SUCCESS, "补录销售单成功");
emit showAlert(AlertForm::SUCCESS, "补录天天饮食成功");
}
}
......
......@@ -7,6 +7,7 @@
#include "fmPrinter.h"
#include <QApplication>
#include <QFile>
#include "QsLog.h"
DetailForm::DetailForm(QWidget *parent) :
QDialog(parent),
......
......@@ -10,6 +10,7 @@
#include "Control/refundControl.h"
#include "floatForm.h"
#include "DTools/configManger.h"
#include <windows.h>
using namespace QsLogging;
......@@ -49,6 +50,14 @@ void LoadTheme(const QString& theme)
int main(int argc, char *argv[])
{
HANDLE m_hMutex = CreateMutex(NULL, FALSE, L"fmTakeaway" );
if (GetLastError() == ERROR_ALREADY_EXISTS) {
CloseHandle(m_hMutex);
m_hMutex = NULL;
return -1;
}
QApplication a(argc, argv);
g_appDir = a.applicationDirPath();
......
......@@ -93,7 +93,6 @@ void MainForm::MyShow()
void MainForm::_Init()
{
this->setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
// TODO
this->showFullScreen();
// 显示托盘
m_tray.show();
......
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