LukeSavefrogs / danea-easyfatt

Danea Easyfatt automation suite
https://lukesavefrogs.github.io/danea-easyfatt/
GNU General Public License v3.0
4 stars 0 forks source link

Errore calcolo peso spedizione: `DimensionalityError: Cannot convert from 'dimensionless'` #90

Closed LukeSavefrogs closed 1 year ago

LukeSavefrogs commented 1 year ago

In fase di calcolo peso spedizione esce il seguente errore:

[01-09-2023 14:44:11] INFO     Creazione CSV './Documenti.csv' terminata..
D:\Progetti\danea-automation\.venv\lib\site-packages\pandas\core\dtypes\missing.py:225: UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
  return _isna_array(np.asarray(obj), inf_as_na=inf_as_na)
[01-09-2023 14:44:11] ERROR    Errore in fase di calcolo peso totale
Traceback (most recent call last):
  File "D:\Progetti\danea-automation\src\veryeasyfatt\app\main.py", line 162, in main
    peso_totale = ureg.Quantity(df["TransportedWeight"].sum(), 'g')
  File "D:\Progetti\danea-automation\.venv\lib\site-packages\pint\facets\plain\quantity.py", line 237, in __new__
    magnitude = value.to(units)._magnitude
  File "D:\Progetti\danea-automation\.venv\lib\site-packages\pint\facets\plain\quantity.py", line 522, in to
    magnitude = self._convert_magnitude_not_inplace(other, *contexts, **ctx_kwargs)
  File "D:\Progetti\danea-automation\.venv\lib\site-packages\pint\facets\plain\quantity.py", line 471, in _convert_magnitude_not_inplace     
    return self._REGISTRY.convert(self._magnitude, self._units, other)
  File "D:\Progetti\danea-automation\.venv\lib\site-packages\pint\facets\plain\registry.py", line 911, in convert
    return self._convert(value, src, dst, inplace)
  File "D:\Progetti\danea-automation\.venv\lib\site-packages\pint\facets\context\registry.py", line 393, in _convert
    return super()._convert(value, src, dst, inplace)
  File "D:\Progetti\danea-automation\.venv\lib\site-packages\pint\facets\nonmultiplicative\registry.py", line 206, in _convert
    return super()._convert(value, src, dst, inplace)
  File "D:\Progetti\danea-automation\.venv\lib\site-packages\pint\facets\plain\registry.py", line 944, in _convert
    raise DimensionalityError(src, dst, src_dim, dst_dim)
pint.errors.DimensionalityError: Cannot convert from 'dimensionless' (dimensionless) to 'gram' ([mass])
[01-09-2023 14:44:11] INFO     Procedura terminata.

Il file Documents.DefXml è il seguente:

<?xml version="1.0" encoding="UTF-8"?>
<!-- File in formato Easyfatt-XML creato con Danea Easyfatt - www.danea.it/software/easyfatt -->
<!-- Per importare o creare un file in formato Easyfatt-Xml, consultare la documentazione tecnica: www.danea.it/software/easyfatt/xml -->
<EasyfattDocuments AppVersion="2" Creator="Danea Easyfatt Enterprise  2023.54b" CreatorUrl="http://www.danea.it/software/easyfatt" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://www.danea.it/public/easyfatt-xml.xsd">
  <Company>
    <Name>ACME Inc.</Name>
    <Address>Via Anagnina, 0</Address>
    <Postcode>00173</Postcode>
    <City>Roma</City>
    <Province>RM</Province>
    <Country>Italia</Country>
    <FiscalCode>00000000000</FiscalCode>
    <VatCode>00000000000</VatCode>
    <Tel>0000000000</Tel>
    <Email>acme@acme.com</Email>
    <HomePage>https://example.com/</HomePage>
  </Company>
  <Documents>
    <Document>
      <CustomerCode>99999</CustomerCode>
      <CustomerWebLogin></CustomerWebLogin>
      <CustomerName>TEST - Non dovrebbe andare in cache</CustomerName>
      <CustomerAddress>VIA TUSCOLANA, 0</CustomerAddress>
      <CustomerPostcode>00182</CustomerPostcode>
      <CustomerCity>ROMA</CustomerCity>
      <CustomerProvince>RM</CustomerProvince>
      <CustomerCountry>Italia</CustomerCountry>
      <CustomerFiscalCode>PDFDNR38H51B374Q</CustomerFiscalCode>
      <CustomerReference>TEST</CustomerReference>
      <CustomerCellPhone>0123456789</CustomerCellPhone>
      <CustomerEmail>test@gmail.com</CustomerEmail>
      <DeliveryName>TEST's temporary address</DeliveryName>
      <DeliveryAddress>VIA TUSCOLANA, 1000</DeliveryAddress>
      <DeliveryPostcode>00174</DeliveryPostcode>
      <DeliveryCity>ROMA</DeliveryCity>
      <DeliveryProvince>RM</DeliveryProvince>
      <DeliveryCountry>Italia</DeliveryCountry>
      <DocumentType>C</DocumentType>
      <Date>2023-01-30</Date>
      <Number>725</Number>
      <Numbering></Numbering>
      <CostDescription></CostDescription>
      <CostVatCode></CostVatCode>
      <CostAmount></CostAmount>
      <ContribDescription></ContribDescription>
      <ContribPerc></ContribPerc>
      <ContribSubjectToWithholdingTax></ContribSubjectToWithholdingTax>
      <ContribAmount></ContribAmount>
      <ContribVatCode></ContribVatCode>
      <TotalWithoutTax>92.21</TotalWithoutTax>
      <VatAmount>20.29</VatAmount>
      <WithholdingTaxAmount>0</WithholdingTaxAmount>
      <WithholdingTaxAmountB>0</WithholdingTaxAmountB>
      <WithholdingTaxNameB></WithholdingTaxNameB>
      <Total>112.5</Total>
      <PriceList>Dom. OFFERTA</PriceList>
      <PricesIncludeVat>true</PricesIncludeVat>
      <TotalSubjectToWithholdingTax>0</TotalSubjectToWithholdingTax>
      <WithholdingTaxPerc>0</WithholdingTaxPerc>
      <WithholdingTaxPerc2>0</WithholdingTaxPerc2>
      <PaymentName></PaymentName>
      <PaymentBank></PaymentBank>
      <PaymentAdvanceAmount></PaymentAdvanceAmount>
      <Carrier></Carrier>
      <TransportReason></TransportReason>
      <GoodsAppearance></GoodsAppearance>
      <NumOfPieces></NumOfPieces>
      <TransportDateTime></TransportDateTime>
      <ShipmentTerms></ShipmentTerms>
      <TransportedWeight></TransportedWeight>
      <TrackingNumber></TrackingNumber>
      <InternalComment></InternalComment>
      <CustomField1>7:00&gt;&gt;18:00</CustomField1>
      <CustomField2></CustomField2>
      <CustomField3></CustomField3>
      <CustomField4></CustomField4>
      <FootNotes></FootNotes>
      <ExpectedConclusionDate></ExpectedConclusionDate>
      <SalesAgent></SalesAgent>
      <Rows>
        <Row>
          <Code>000029</Code>
          <Description>ACQUA EGERIA LT.1,5X6 PET EFFERVESCENTE NATURALE PLASTICA</Description>
          <Qty>30</Qty>
          <Um>CF</Um>
          <Price>3.75</Price>
          <Discounts></Discounts>
          <VatCode Perc="22" Class="Imponibile" Description="Imponibile 22%">22</VatCode>
          <Total>112.5</Total>
          <Stock>true</Stock>
          <Notes></Notes>
        </Row>
      </Rows>
    </Document>
    <Document>
      <CustomerCode>99999</CustomerCode>
      <CustomerWebLogin></CustomerWebLogin>
      <CustomerName>TEST - Non dovrebbe andare in cache</CustomerName>
      <CustomerAddress>VIA TUSCOLANA, 0</CustomerAddress>
      <CustomerPostcode>00182</CustomerPostcode>
      <CustomerCity>ROMA</CustomerCity>
      <CustomerProvince>RM</CustomerProvince>
      <CustomerCountry>Italia</CustomerCountry>
      <CustomerFiscalCode>PDFDNR38H51B374Q</CustomerFiscalCode>
      <CustomerReference>TEST</CustomerReference>
      <CustomerCellPhone>0123456789</CustomerCellPhone>
      <CustomerEmail>test@gmail.com</CustomerEmail>
      <DeliveryName>TEST's temporary address</DeliveryName>
      <DeliveryAddress>VIA TUSCOLANA, 1000</DeliveryAddress>
      <DeliveryPostcode>00174</DeliveryPostcode>
      <DeliveryCity>ROMA</DeliveryCity>
      <DeliveryProvince>RM</DeliveryProvince>
      <DeliveryCountry>Italia</DeliveryCountry>
      <DocumentType>C</DocumentType>
      <Date>2023-01-30</Date>
      <Number>725</Number>
      <Numbering></Numbering>
      <CostDescription></CostDescription>
      <CostVatCode></CostVatCode>
      <CostAmount></CostAmount>
      <ContribDescription></ContribDescription>
      <ContribPerc></ContribPerc>
      <ContribSubjectToWithholdingTax></ContribSubjectToWithholdingTax>
      <ContribAmount></ContribAmount>
      <ContribVatCode></ContribVatCode>
      <TotalWithoutTax>92.21</TotalWithoutTax>
      <VatAmount>20.29</VatAmount>
      <WithholdingTaxAmount>0</WithholdingTaxAmount>
      <WithholdingTaxAmountB>0</WithholdingTaxAmountB>
      <WithholdingTaxNameB></WithholdingTaxNameB>
      <Total>112.5</Total>
      <PriceList>Dom. OFFERTA</PriceList>
      <PricesIncludeVat>true</PricesIncludeVat>
      <TotalSubjectToWithholdingTax>0</TotalSubjectToWithholdingTax>
      <WithholdingTaxPerc>0</WithholdingTaxPerc>
      <WithholdingTaxPerc2>0</WithholdingTaxPerc2>
      <PaymentName></PaymentName>
      <PaymentBank></PaymentBank>
      <PaymentAdvanceAmount></PaymentAdvanceAmount>
      <Carrier></Carrier>
      <TransportReason></TransportReason>
      <GoodsAppearance></GoodsAppearance>
      <NumOfPieces></NumOfPieces>
      <TransportDateTime></TransportDateTime>
      <ShipmentTerms></ShipmentTerms>
      <TransportedWeight></TransportedWeight>
      <TrackingNumber></TrackingNumber>
      <InternalComment></InternalComment>
      <CustomField1>7:00&gt;&gt;18:00</CustomField1>
      <CustomField2></CustomField2>
      <CustomField3></CustomField3>
      <CustomField4></CustomField4>
      <FootNotes></FootNotes>
      <ExpectedConclusionDate></ExpectedConclusionDate>
      <SalesAgent></SalesAgent>
      <Rows>
        <Row>
          <Code>000029</Code>
          <Description>ACQUA EGERIA LT.1,5X6 PET EFFERVESCENTE NATURALE PLASTICA</Description>
          <Qty>30</Qty>
          <Um>CF</Um>
          <Price>3.75</Price>
          <Discounts></Discounts>
          <VatCode Perc="22" Class="Imponibile" Description="Imponibile 22%">22</VatCode>
          <Total>112.5</Total>
          <Stock>true</Stock>
          <Notes></Notes>
        </Row>
      </Rows>
    </Document>
  </Documents>
</EasyfattDocuments>
LukeSavefrogs commented 1 year ago

Valorizzando ALMENO UN tag TransportedWeight (ad esempio impostandolo a 1Kg) tutto funziona.

Il bug si verifica solamente quando nessun record ha il il tag TransportedWeight valorizzato