Browse Source

refs #1 Syncronizing with release commit: 67264ddcfe

qt5
parent
commit
81aacf5055
8 changed files with 82 additions and 18 deletions
  1. +1
    -0
      3.0/src/includes/Hardware/Common/DeviceDataConstants.h
  2. +3
    -0
      3.0/src/includes/Hardware/FR/FRBaseConstants.h
  3. +26
    -8
      3.0/src/modules/Hardware/CashAcceptors/src/SSP/SSPCashAcceptor.cpp
  4. +3
    -1
      3.0/src/modules/Hardware/CashAcceptors/src/SSP/SSPCashAcceptorConstants.h
  5. +8
    -0
      3.0/src/modules/Hardware/Common/src/Meta/MetaDevice.cpp
  6. +23
    -1
      3.0/src/modules/Hardware/FR/src/Base/FRBase.cpp
  7. +3
    -0
      3.0/src/modules/Hardware/FR/src/Base/FRBase.h
  8. +15
    -8
      3.0/src/modules/Hardware/FR/src/Shtrih/Online/ShtrihOnlineFRBase.cpp

+ 1
- 0
3.0/src/includes/Hardware/Common/DeviceDataConstants.h View File

@@ -38,6 +38,7 @@ namespace CDeviceData
const char InternalHardware[] = "device_id_value";
const char ControllerBuild[] = "controller_build";
const char Count[] = "count";
const char Number[] = "number";
/// Общие значения.
namespace Values


+ 3
- 0
3.0/src/includes/Hardware/FR/FRBaseConstants.h View File

@@ -109,6 +109,9 @@ namespace CFR
/// Формальная дата окончания ФН.
inline QString FSValidityDateOff(const QDate & aDate) { return aDate.addDays(-3).toString(CFR::DateLogFormat); }
/// Срок годности обычной (на 13 месяцев) ФН в днях.
const int SimpleFSValidityDays = 365 + 30;
/// Результаты запроса статуса.
namespace Result
{


+ 26
- 8
3.0/src/modules/Hardware/CashAcceptors/src/SSP/SSPCashAcceptor.cpp View File

@@ -139,6 +139,14 @@ bool SSPCashAcceptor::processReset()
return false;
}
// иначе ITL забудет, по какому протоколу он работает
int protocolNumber = 1;
while (!processCommand(CSSP::Commands::SetProtocolVersion, QByteArray(1, uchar(protocolNumber++)))) {}
while ( processCommand(CSSP::Commands::SetProtocolVersion, QByteArray(1, uchar(protocolNumber++)))) {}
setDeviceParameter(CDeviceData::ProtocolVersion, protocolNumber - 2);
return true;
}
@@ -147,7 +155,7 @@ bool SSPCashAcceptor::isConnected()
{
QByteArray answer;
if (!processCommand(CSSP::Commands::GetVersion, &answer))
if (!processCommand(CSSP::Commands::GetFirmware, &answer))
{
toLog(LogLevel::Error, mDeviceName + ": Failed to get firmware version");
return false;
@@ -182,13 +190,6 @@ bool SSPCashAcceptor::isConnected()
//--------------------------------------------------------------------------------
void SSPCashAcceptor::processDeviceData()
{
int protocolNumber = 1;
while (!processCommand(CSSP::Commands::SetProtocolVersion, QByteArray(1, uchar(protocolNumber++)))) {}
while ( processCommand(CSSP::Commands::SetProtocolVersion, QByteArray(1, uchar(protocolNumber++)))) {}
setDeviceParameter(CDeviceData::ProtocolVersion, protocolNumber - 2);
QByteArray answer;
if (processCommand(CSSP::Commands::GetSerial, &answer) && !answer.isEmpty())
@@ -200,6 +201,23 @@ void SSPCashAcceptor::processDeviceData()
{
setDeviceParameter(CDeviceData::Firmware, answer.mid(1, 4).insert(1, ASCII::Dot));
}
if (processCommand(CSSP::Commands::GetDataset, &answer) && !answer.isEmpty())
{
setDeviceParameter(CDeviceData::CashAcceptors::BillSet, answer);
}
if (processCommand(CSSP::Commands::GetBuild, &answer) && !answer.isEmpty())
{
setDeviceParameter(CDeviceData::Build, "0x" + answer.toHex().toUpper());
setDeviceParameter(CDeviceData::Type, uint(answer[0]), CDeviceData::Build);
if (answer.size() >= 3)
{
ushort build = ushort(answer[1]) | ushort(answer[0] << 8);
setDeviceParameter(CDeviceData::Number, build, CDeviceData::Build);
}
}
}
//--------------------------------------------------------------------------------


+ 3
- 1
3.0/src/modules/Hardware/CashAcceptors/src/SSP/SSPCashAcceptorConstants.h View File

@@ -87,8 +87,10 @@ namespace CSSP
const char Enable = '\x0A'; /// Включить на прием денег.
const char GetSerial = '\x0C'; /// Запрос серийного номера.
const char Sync = '\x11'; /// Синхронизация байта последовательности.
const char GetVersion = '\x20'; /// Запрос версии прошивки.
const char GetFirmware = '\x20'; /// Запрос версии прошивки.
const char GetDataset = '\x21'; /// Запрос версии биллсета.
const char Stack = '\x43'; /// Уложить в стекер.
const char GetBuild = '\x4F'; /// Запрос версии билда.
class CData: public CSpecification<char, SData>
{


+ 8
- 0
3.0/src/modules/Hardware/Common/src/Meta/MetaDevice.cpp View File

@@ -44,6 +44,7 @@ MetaDevice<T>::MetaDevice() :
mDeviceName(CMetaDevice::DefaultName),
mLogDate(QDate::currentDate()),
mOperatorPresence(false),
mFiscalServerPresence(false),
mDetectingPosition(0),
mInitialized(ERequestStatus::Fail),
mExitTimeout(ULONG_MAX),
@@ -132,6 +133,13 @@ void MetaDevice<T>::setDeviceConfiguration(const QVariantMap & aConfiguration)
}
mOperatorPresence = aConfiguration.value(CHardwareSDK::OperatorPresence, mOperatorPresence).toBool();
mFiscalServerPresence = aConfiguration.value(CHardwareSDK::FiscalServerPresence, mFiscalServerPresence).toBool();
if (aConfiguration.contains(CHardwareSDK::FiscalServerPresence))
{
toLog(LogLevel::Normal, QString("--- setDeviceConfiguration: aConfiguration[CHardwareSDK::FiscalServerPresence] = %1, mFiscalServerPresence = %2")
.arg(aConfiguration[CHardwareSDK::FiscalServerPresence].toString()).arg(mFiscalServerPresence ? "true" : "false"));
}
}
//--------------------------------------------------------------------------------


+ 23
- 1
3.0/src/modules/Hardware/FR/src/Base/FRBase.cpp View File

@@ -1319,7 +1319,7 @@ bool FRBase<T>::processStatus(TStatusCodes & aStatusCodes)
QString automaticNumber = getDeviceParameter(CDeviceData::FR::AutomaticNumber).toString();
if (mWrongFiscalizationSettings || (mOperatorPresence && !automaticNumber.isEmpty()))
if (!mFiscalServerPresence && (mWrongFiscalizationSettings || (mOperatorPresence && !automaticNumber.isEmpty())))
{
aStatusCodes.insert(FRStatusCode::Warning::WrongFiscalizationSettings);
}
@@ -1607,6 +1607,28 @@ int FRBase<T>::getErrorStatusCode(FRError::EType::Enum aErrorType)
//--------------------------------------------------------------------------------
template <class T>
bool FRBase<T>::isFS36() const
{
QString FSValidityDateText = getDeviceParameter(CDeviceData::FS::ValidityData).toString();
QDate FSValidityDate = QDate::fromString(FSValidityDateText, CFR::DateLogFormat);
if (!FSValidityDate.isValid() || FSValidityDate.isNull())
{
toLog(LogLevel::Error, mDeviceName + ": Failed to check FS validity date");
return false;
}
int days = QDate::currentDate().daysTo(FSValidityDate);
bool result = days > CFR::SimpleFSValidityDays;
toLog(LogLevel::Normal, mDeviceName + QString(": --- isFS36: current date = %1, FS validity date = %2, days = %3, result = %4")
.arg(QDate::currentDate().toString(CFR::DateLogFormat)).arg(FSValidityDateText).arg(days).arg(result ? "true" : "false"));
return result;
}
//--------------------------------------------------------------------------------
template <class T>
void FRBase<T>::setLog(ILog * aLog)
{
T::setLog(aLog);


+ 3
- 0
3.0/src/modules/Hardware/FR/src/Base/FRBase.h View File

@@ -231,6 +231,9 @@ protected:
/// Получить статус по типу ошибки устройства.
static int getErrorStatusCode(FRError::EType::Enum aErrorType);
/// Является ли срок годности ФН 36 месяцев. По умолчанию (не получилось сделать какую-то проверку) - нет.
bool isFS36() const;
/// Наличие ЭКЛЗ.
bool mEKLZ;


+ 15
- 8
3.0/src/modules/Hardware/FR/src/Shtrih/Online/ShtrihOnlineFRBase.cpp View File

@@ -493,17 +493,24 @@ bool ShtrihOnlineFRBase<T>::sale(const SUnitData & aUnitData, EPayOffTypes::Enum
QByteArray sum = getHexReverted(aUnitData.sum, 5, 2);
QString name = aUnitData.name;
bool isFS36Result = isFS36();
bool noPayOffSubjectType = (mFFDFS <= EFFD::F105) && isFS36Result * mFiscalServerPresence;
char payOffSubjectType = char(aUnitData.payOffSubjectType) * !noPayOffSubjectType;
toLog(LogLevel::Normal, QString("--- sale: mFFDFS = %1, isFS36() = %2, mFiscalServerPresence = %3, noPayOffSubjectType = %4, payOffSubjectType = %5")
.arg(int(mFFDFS)).arg(isFS36Result ? "true" : "false").arg(mFiscalServerPresence ? "true" : "false").arg(noPayOffSubjectType ? "true" : "false").arg(int(payOffSubjectType)));
QByteArray commandData;
commandData.append(char(aPayOffType)); // тип операции
commandData.append(getHexReverted(1, 6, 6)); // количество
commandData.append(sum); // цена
commandData.append(sum); // сумма операций
commandData.append(CShtrihOnlineFR::FiscalTaxData); // налог
commandData.append(char(aPayOffType)); // тип операции (1054)
commandData.append(getHexReverted(1, 6, 6)); // количество (1023)
commandData.append(sum); // цена (1079)
commandData.append(sum); // сумма операций (1023)
commandData.append(CShtrihOnlineFR::FiscalTaxData); // налог (1102..1107)
commandData.append(taxIndex); // налоговая ставка
commandData.append(section); // отдел
commandData.append(char(aUnitData.payOffSubjectMethodType)); // признак способа расчета
commandData.append(char(aUnitData.payOffSubjectType)); // признак предмета расчета
commandData.append(mCodec->fromUnicode(name)); // наименование товара
commandData.append(char(aUnitData.payOffSubjectMethodType)); // признак способа расчета (1214)
commandData.append(payOffSubjectType); // признак предмета расчета (1212)
commandData.append(mCodec->fromUnicode(name)); // наименование товара (1030)
if (!processCommand(CShtrihOnlineFR::Commands::FS::Sale, commandData))
{


Loading…
Cancel
Save