Skip to content

Commit

Permalink
Исправлена обработка множителей в значениях R/L/C.
Browse files Browse the repository at this point in the history
  • Loading branch information
baranovskiykonstantin committed Apr 17, 2020
1 parent c8a29c4 commit bbda3cb
Show file tree
Hide file tree
Showing 17 changed files with 66 additions and 37 deletions.
2 changes: 1 addition & 1 deletion bom/Scripts/python/doc/help.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
= Ведомость покупных изделий
:author: Барановский Константин
:email: [email protected]
:revnumber: 1.1
:revnumber: 1.2

Справочное руководство

Expand Down
6 changes: 3 additions & 3 deletions bom/Scripts/python/doc/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ <h1>Ведомость покупных изделий</h1>
<div class="details">
<span id="author" class="author">Барановский Константин</span><br>
<span id="email" class="email"><a href="mailto:[email protected]">[email protected]</a></span><br>
<span id="revnumber">версия 1.1</span>
<span id="revnumber">версия 1.2</span>
</div>
<div id="toc" class="toc2">
<div id="toctitle">Содержание</div>
Expand Down Expand Up @@ -1465,8 +1465,8 @@ <h3 id="_номера_строк">Номера строк</h3>
</div>
<div id="footer">
<div id="footer-text">
Версия 1.1<br>
Редакция от 2020-04-11 10:38:10 +0300
Версия 1.2<br>
Редакция от 2020-04-17 15:20:09 +0300
</div>
</div>
</body>
Expand Down
12 changes: 9 additions & 3 deletions bom/Scripts/python/pythonpath/schematic.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ def getValueWithUnits(self):
# Перевести множитель на русский
if multiplier in Component.multipliersDict:
multiplier = Component.multipliersDict[multiplier]
elif multiplier is None:
multiplier = ''
numValue = numValue.replace('.', ',')
return numValue + separator + multiplier + units
return self.value
Expand Down Expand Up @@ -363,7 +365,10 @@ def getBomValue(self, name, singular=False, plural=False):
value = self.getFieldValue(fieldName)
value = self._convertSingularPlural(value, singular, plural)
if name == "name" and not value:
value = self.value
if config.getboolean("bom", "add units"):
value = self.getValueWithUnits()
else:
value = self.value
if value is None:
value = ""
return value
Expand Down Expand Up @@ -399,7 +404,8 @@ def getExpandedValue(self):
'n': 1e-9,
'н': 1e-9,
'p': 1e-12,
'п': 1e-12
'п': 1e-12,
None: 1
}
if self.getRefType().startswith('C'):
value = self.value
Expand All @@ -425,7 +431,7 @@ def getExpandedValue(self):
value = value.rstrip('H')
value = value.replace("Гн", "")
value = value.strip()
if re.match(r"^\d+[\.,]\d+$", value):
if re.match(r"^\d+(?:[\.,]\d+)?$", value):
extValue = float(value.replace(',', '.')) * 1e-6
elif re.match(Component.regexpr1, value):
searchRes = re.search(Component.regexpr1, value).groups()
Expand Down
2 changes: 1 addition & 1 deletion gbom/Scripts/python/doc/help.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
= Групповая ведомость покупных изделий
:author: Барановский Константин
:email: [email protected]
:revnumber: 1.1
:revnumber: 1.2

Справочное руководство

Expand Down
6 changes: 3 additions & 3 deletions gbom/Scripts/python/doc/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ <h1>Групповая ведомость покупных изделий</h1>
<div class="details">
<span id="author" class="author">Барановский Константин</span><br>
<span id="email" class="email"><a href="mailto:[email protected]">[email protected]</a></span><br>
<span id="revnumber">версия 1.1</span>
<span id="revnumber">версия 1.2</span>
</div>
<div id="toc" class="toc2">
<div id="toctitle">Содержание</div>
Expand Down Expand Up @@ -1456,8 +1456,8 @@ <h3 id="_номера_строк">Номера строк</h3>
</div>
<div id="footer">
<div id="footer-text">
Версия 1.1<br>
Редакция от 2020-04-11 10:38:25 +0300
Версия 1.2<br>
Редакция от 2020-04-17 15:20:24 +0300
</div>
</div>
</body>
Expand Down
12 changes: 9 additions & 3 deletions gbom/Scripts/python/pythonpath/schematic.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ def getValueWithUnits(self):
# Перевести множитель на русский
if multiplier in Component.multipliersDict:
multiplier = Component.multipliersDict[multiplier]
elif multiplier is None:
multiplier = ''
numValue = numValue.replace('.', ',')
return numValue + separator + multiplier + units
return self.value
Expand Down Expand Up @@ -363,7 +365,10 @@ def getBomValue(self, name, singular=False, plural=False):
value = self.getFieldValue(fieldName)
value = self._convertSingularPlural(value, singular, plural)
if name == "name" and not value:
value = self.value
if config.getboolean("bom", "add units"):
value = self.getValueWithUnits()
else:
value = self.value
if value is None:
value = ""
return value
Expand Down Expand Up @@ -399,7 +404,8 @@ def getExpandedValue(self):
'n': 1e-9,
'н': 1e-9,
'p': 1e-12,
'п': 1e-12
'п': 1e-12,
None: 1
}
if self.getRefType().startswith('C'):
value = self.value
Expand All @@ -425,7 +431,7 @@ def getExpandedValue(self):
value = value.rstrip('H')
value = value.replace("Гн", "")
value = value.strip()
if re.match(r"^\d+[\.,]\d+$", value):
if re.match(r"^\d+(?:[\.,]\d+)?$", value):
extValue = float(value.replace(',', '.')) * 1e-6
elif re.match(Component.regexpr1, value):
searchRes = re.search(Component.regexpr1, value).groups()
Expand Down
2 changes: 1 addition & 1 deletion gspec/Scripts/python/doc/help.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
= Групповая спецификация
:author: Барановский Константин
:email: [email protected]
:revnumber: 1.1
:revnumber: 1.2

Справочное руководство

Expand Down
6 changes: 3 additions & 3 deletions gspec/Scripts/python/doc/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ <h1>Групповая спецификация</h1>
<div class="details">
<span id="author" class="author">Барановский Константин</span><br>
<span id="email" class="email"><a href="mailto:[email protected]">[email protected]</a></span><br>
<span id="revnumber">версия 1.1</span>
<span id="revnumber">версия 1.2</span>
</div>
<div id="toc" class="toc2">
<div id="toctitle">Содержание</div>
Expand Down Expand Up @@ -1581,8 +1581,8 @@ <h3 id="_номера_позиций">Номера позиций</h3>
</div>
<div id="footer">
<div id="footer-text">
Версия 1.1<br>
Редакция от 2020-04-11 10:38:44 +0300
Версия 1.2<br>
Редакция от 2020-04-17 15:20:39 +0300
</div>
</div>
</body>
Expand Down
12 changes: 9 additions & 3 deletions gspec/Scripts/python/pythonpath/schematic.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ def getValueWithUnits(self):
# Перевести множитель на русский
if multiplier in Component.multipliersDict:
multiplier = Component.multipliersDict[multiplier]
elif multiplier is None:
multiplier = ''
numValue = numValue.replace('.', ',')
return numValue + separator + multiplier + units
return self.value
Expand Down Expand Up @@ -363,7 +365,10 @@ def getSpecValue(self, name, singular=False, plural=False):
value = self.getFieldValue(fieldName)
value = self._convertSingularPlural(value, singular, plural)
if name == "name" and not value:
value = self.value
if config.getboolean("spec", "add units"):
value = self.getValueWithUnits()
else:
value = self.value
if value is None:
value = ""
return value
Expand Down Expand Up @@ -399,7 +404,8 @@ def getExpandedValue(self):
'n': 1e-9,
'н': 1e-9,
'p': 1e-12,
'п': 1e-12
'п': 1e-12,
None: 1
}
if self.getRefType().startswith('C'):
value = self.value
Expand All @@ -425,7 +431,7 @@ def getExpandedValue(self):
value = value.rstrip('H')
value = value.replace("Гн", "")
value = value.strip()
if re.match(r"^\d+[\.,]\d+$", value):
if re.match(r"^\d+(?:[\.,]\d+)?$", value):
extValue = float(value.replace(',', '.')) * 1e-6
elif re.match(Component.regexpr1, value):
searchRes = re.search(Component.regexpr1, value).groups()
Expand Down
2 changes: 1 addition & 1 deletion index/Scripts/python/doc/help.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
= Перечень элементов
:author: Барановский Константин
:email: [email protected]
:revnumber: 1.1
:revnumber: 1.2

Справочное руководство

Expand Down
6 changes: 3 additions & 3 deletions index/Scripts/python/doc/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ <h1>Перечень элементов</h1>
<div class="details">
<span id="author" class="author">Барановский Константин</span><br>
<span id="email" class="email"><a href="mailto:[email protected]">[email protected]</a></span><br>
<span id="revnumber">версия 1.1</span>
<span id="revnumber">версия 1.2</span>
</div>
<div id="toc" class="toc2">
<div id="toctitle">Содержание</div>
Expand Down Expand Up @@ -1440,8 +1440,8 @@ <h3 id="_размер_шрифта_таблицы">Размер шрифта т
</div>
<div id="footer">
<div id="footer-text">
Версия 1.1<br>
Редакция от 2020-04-11 10:38:58 +0300
Версия 1.2<br>
Редакция от 2020-04-17 15:20:51 +0300
</div>
</div>
</body>
Expand Down
7 changes: 6 additions & 1 deletion index/Scripts/python/pythonpath/schematic.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ def getValueWithUnits(self):
# Перевести множитель на русский
if multiplier in multipliersDict:
multiplier = multipliersDict[multiplier]
elif multiplier is None:
multiplier = ''
numValue = numValue.replace('.', ',')
return numValue + separator + multiplier + units
return self.value
Expand Down Expand Up @@ -362,7 +364,10 @@ def getIndexValue(self, name, singular=False, plural=False):
value = self.getFieldValue(fieldName)
value = self._convertSingularPlural(value, singular, plural)
if name == "name" and not value:
value = self.value
if config.getboolean("index", "add units"):
value = self.getValueWithUnits()
else:
value = self.value
if value is None:
value = ""
return value
Expand Down
2 changes: 1 addition & 1 deletion manual/Scripts/python/doc/help.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
= Пояснительная записка
:author: Барановский Константин
:email: [email protected]
:revnumber: 1.1
:revnumber: 1.2

Справочное руководство

Expand Down
6 changes: 3 additions & 3 deletions manual/Scripts/python/doc/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ <h1>Пояснительная записка</h1>
<div class="details">
<span id="author" class="author">Барановский Константин</span><br>
<span id="email" class="email"><a href="mailto:[email protected]">[email protected]</a></span><br>
<span id="revnumber">версия 1.1</span>
<span id="revnumber">версия 1.2</span>
</div>
<div id="toc" class="toc2">
<div id="toctitle">Содержание</div>
Expand Down Expand Up @@ -788,8 +788,8 @@ <h3 id="_размер_шрифта">Размер шрифта</h3>
</div>
<div id="footer">
<div id="footer-text">
Версия 1.1<br>
Редакция от 2020-04-11 10:39:13 +0300
Версия 1.2<br>
Редакция от 2020-04-17 15:21:04 +0300
</div>
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion spec/Scripts/python/doc/help.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
= Спецификация
:author: Барановский Константин
:email: [email protected]
:revnumber: 1.1
:revnumber: 1.2

Справочное руководство

Expand Down
6 changes: 3 additions & 3 deletions spec/Scripts/python/doc/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ <h1>Спецификация</h1>
<div class="details">
<span id="author" class="author">Барановский Константин</span><br>
<span id="email" class="email"><a href="mailto:[email protected]">[email protected]</a></span><br>
<span id="revnumber">версия 1.1</span>
<span id="revnumber">версия 1.2</span>
</div>
<div id="toc" class="toc2">
<div id="toctitle">Содержание</div>
Expand Down Expand Up @@ -1550,8 +1550,8 @@ <h3 id="_номера_позиций">Номера позиций</h3>
</div>
<div id="footer">
<div id="footer-text">
Версия 1.1<br>
Редакция от 2020-04-11 10:39:27 +0300
Версия 1.2<br>
Редакция от 2020-04-17 15:21:17 +0300
</div>
</div>
</body>
Expand Down
12 changes: 9 additions & 3 deletions spec/Scripts/python/pythonpath/schematic.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ def getValueWithUnits(self):
# Перевести множитель на русский
if multiplier in Component.multipliersDict:
multiplier = Component.multipliersDict[multiplier]
elif multiplier is None:
multiplier = ''
numValue = numValue.replace('.', ',')
return numValue + separator + multiplier + units
return self.value
Expand Down Expand Up @@ -363,7 +365,10 @@ def getSpecValue(self, name, singular=False, plural=False):
value = self.getFieldValue(fieldName)
value = self._convertSingularPlural(value, singular, plural)
if name == "name" and not value:
value = self.value
if config.getboolean("spec", "add units"):
value = self.getValueWithUnits()
else:
value = self.value
if value is None:
value = ""
return value
Expand Down Expand Up @@ -399,7 +404,8 @@ def getExpandedValue(self):
'n': 1e-9,
'н': 1e-9,
'p': 1e-12,
'п': 1e-12
'п': 1e-12,
None: 1
}
if self.getRefType().startswith('C'):
value = self.value
Expand All @@ -425,7 +431,7 @@ def getExpandedValue(self):
value = value.rstrip('H')
value = value.replace("Гн", "")
value = value.strip()
if re.match(r"^\d+[\.,]\d+$", value):
if re.match(r"^\d+(?:[\.,]\d+)?$", value):
extValue = float(value.replace(',', '.')) * 1e-6
elif re.match(Component.regexpr1, value):
searchRes = re.search(Component.regexpr1, value).groups()
Expand Down

0 comments on commit bbda3cb

Please sign in to comment.