订单流程添加修改
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <QList>
|
||||
#include <QPair>
|
||||
#include <QSet>
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -29,8 +30,28 @@ bool ModbusAddressMap::isValid(QString *error) const
|
||||
<< qMakePair(QString("emergencyStop"), emergencyStop)
|
||||
<< qMakePair(QString("currentStep"), currentStep)
|
||||
<< qMakePair(QString("checkResult"), checkResult)
|
||||
<< qMakePair(QString("errorCode"), errorCode);
|
||||
<< qMakePair(QString("errorCode"), errorCode)
|
||||
<< qMakePair(QString("rackPickCommand"), rackPickCommand)
|
||||
<< qMakePair(QString("frontLoadCommand"), frontLoadCommand)
|
||||
<< qMakePair(QString("inspectionCommand"), inspectionCommand)
|
||||
<< qMakePair(QString("frontUnloadCommand"), frontUnloadCommand)
|
||||
<< qMakePair(QString("flipCommand"), flipCommand)
|
||||
<< qMakePair(QString("backLoadCommand"), backLoadCommand)
|
||||
<< qMakePair(QString("backUnloadCommand"), backUnloadCommand)
|
||||
<< qMakePair(QString("rackPlaceCommand"), rackPlaceCommand)
|
||||
<< qMakePair(QString("rackPickFeedback"), rackPickFeedback)
|
||||
<< qMakePair(QString("frontLoadFeedback"), frontLoadFeedback)
|
||||
<< qMakePair(QString("inspectionFeedback"), inspectionFeedback)
|
||||
<< qMakePair(QString("frontUnloadFeedback"), frontUnloadFeedback)
|
||||
<< qMakePair(QString("flipFeedback"), flipFeedback)
|
||||
<< qMakePair(QString("backLoadFeedback"), backLoadFeedback)
|
||||
<< qMakePair(QString("backUnloadFeedback"), backUnloadFeedback)
|
||||
<< qMakePair(QString("rackPlaceFeedback"), rackPlaceFeedback)
|
||||
<< qMakePair(QString("inspectionMode"), inspectionMode)
|
||||
<< qMakePair(QString("trayNumber"), trayNumber)
|
||||
<< qMakePair(QString("slotNumber"), slotNumber);
|
||||
|
||||
QSet<int> usedAddresses;
|
||||
for (const QPair<QString, int> &item : addresses) {
|
||||
if (!isValidAddress(item.second)) {
|
||||
if (error) {
|
||||
@@ -38,6 +59,14 @@ bool ModbusAddressMap::isValid(QString *error) const
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (usedAddresses.contains(item.second)) {
|
||||
if (error) {
|
||||
*error = QString("Modbus address is duplicated: %1")
|
||||
.arg(item.first);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
usedAddresses.insert(item.second);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -24,6 +24,28 @@ struct ModbusAddressMap
|
||||
int checkResult = 201;
|
||||
int errorCode = 202;
|
||||
|
||||
int rackPickCommand = 300;
|
||||
int frontLoadCommand = 301;
|
||||
int inspectionCommand = 302;
|
||||
int frontUnloadCommand = 303;
|
||||
int flipCommand = 304;
|
||||
int backLoadCommand = 305;
|
||||
int backUnloadCommand = 306;
|
||||
int rackPlaceCommand = 307;
|
||||
|
||||
int rackPickFeedback = 310;
|
||||
int frontLoadFeedback = 311;
|
||||
int inspectionFeedback = 312;
|
||||
int frontUnloadFeedback = 313;
|
||||
int flipFeedback = 314;
|
||||
int backLoadFeedback = 315;
|
||||
int backUnloadFeedback = 316;
|
||||
int rackPlaceFeedback = 317;
|
||||
|
||||
int inspectionMode = 320;
|
||||
int trayNumber = 400;
|
||||
int slotNumber = 401;
|
||||
|
||||
bool isValid(QString *error = nullptr) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ ModbusConfig ModbusConfig::defaultConfig()
|
||||
config.timeoutMs = 1000;
|
||||
config.retryCount = 1;
|
||||
config.pollIntervalMs = 1000;
|
||||
config.commandPulseMs = 100;
|
||||
config.feedbackTimeoutMs = 2000;
|
||||
config.reconnectDelayMs = 200;
|
||||
config.reconnectAttempts = 2;
|
||||
|
||||
@@ -13,7 +13,6 @@ struct ModbusConfig
|
||||
int timeoutMs;
|
||||
int retryCount;
|
||||
int pollIntervalMs;
|
||||
int commandPulseMs;
|
||||
int feedbackTimeoutMs;
|
||||
int reconnectDelayMs;
|
||||
int reconnectAttempts;
|
||||
|
||||
Reference in New Issue
Block a user