From 0bfeb859f8109041cbd09fd2e8523859a1574216 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 18 Sep 2017 09:11:39 +0300 Subject: [PATCH] Fixed issue #754. Converting to new label template system cause error in cut number. --HG-- branch : develop --- src/libs/ifc/xml/vpatternconverter.cpp | 29 +++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp index 01edf624e..c1bbe4071 100644 --- a/src/libs/ifc/xml/vpatternconverter.cpp +++ b/src/libs/ifc/xml/vpatternconverter.cpp @@ -160,6 +160,8 @@ static const QString strLetter = QStringLiteral("letter"); static const QString strMaterial = QStringLiteral("material"); static const QString strUserDefined = QStringLiteral("userDef"); static const QString strPlacement = QStringLiteral("placement"); +static const QString strCutNumber = QStringLiteral("cutNumber"); +static const QString strQuantity = QStringLiteral("quantity"); //--------------------------------------------------------------------------------------------------------------------- VPatternConverter::VPatternConverter(const QString &fileName) @@ -2252,6 +2254,9 @@ void VPatternConverter::PortPieceLabelstoV0_6_0() AddLabelTemplateLineV0_6_0(dataTag, "%pName%", true, false, Qt::AlignHCenter, 2); + int firstLineCutNumber = 1; + bool firstLine = true; + for (int iMCP = 0; iMCP < count; ++iMCP) { QDomElement domMCP = nodeListMCP.at(iMCP).toElement(); @@ -2279,7 +2284,29 @@ void VPatternConverter::PortPieceLabelstoV0_6_0() break; } - line.append(", %wCut% %pQuantity%"); + line.append(", %wCut% "); + + const int cutNumber = static_cast(GetParametrUInt(domMCP, strCutNumber, "1")); + + if (firstLine) + { + firstLineCutNumber = cutNumber; + dataTag.setAttribute(strQuantity, cutNumber); + line.append("%pQuantity%"); + firstLine = false; + } + else + { + if (firstLineCutNumber != cutNumber) + { + line.append(QString::number(cutNumber)); + } + else + { + line.append("%pQuantity%"); + } + } + if (GetParametrUInt(domMCP, strPlacement, "0") == 1) { line.append(" %wOnFold%");