ipiranga-inovai-project-lib 2.5__py3-none-any.whl → 2.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
inovai/dtos.py ADDED
@@ -0,0 +1,56 @@
1
+ from typing import List
2
+
3
+
4
+ class FileRequestDto:
5
+ file_name: str
6
+ hash_file: str
7
+
8
+ def __init__(self, file_name, hash_file, **data):
9
+ super().__init__(**data)
10
+ self.file_name = file_name
11
+ self.hash_file = hash_file
12
+
13
+ def to_dict(self):
14
+ return {
15
+ "nome": self.file_name,
16
+ "bytesBase64": self.hash_file,
17
+ }
18
+
19
+
20
+ class FullSendRequestDto:
21
+ employer_number: str
22
+ process_codes: str
23
+ start_date: str
24
+ end_date: str
25
+ internal_code: str
26
+ files: List[FileRequestDto]
27
+
28
+ def __init__(self, employer_number, process_codes, start_date, end_date, internal_code, **data):
29
+ super().__init__(**data)
30
+ self.employer_number = employer_number
31
+ self.process_codes = process_codes
32
+ self.start_date = start_date
33
+ self.end_date = end_date
34
+ self.internal_code = internal_code
35
+ self.files = []
36
+
37
+ def to_dict(self):
38
+ return {
39
+ "cnpjEmpresa": self.employer_number,
40
+ "codProcessamentos": self.process_codes,
41
+ "dataIni": self.start_date,
42
+ "dataFim": self.end_date,
43
+ "codInterno": self.internal_code,
44
+ "arquivos": [file.to_dict() for file in self.files],
45
+ }
46
+
47
+ def __str__(self):
48
+ return str({
49
+ "cnpjEmpresa": self.employer_number,
50
+ "codProcessamentos": self.process_codes,
51
+ "dataIni": self.start_date,
52
+ "dataFim": self.end_date,
53
+ "codInterno": self.internal_code,
54
+ })
55
+
56
+
inovai/entities.py CHANGED
@@ -2,6 +2,7 @@ from datetime import datetime
2
2
  from sqlalchemy import Column, String, Date, DateTime, ForeignKey, Integer, Text, Numeric, Boolean, JSON
3
3
  from sqlalchemy.ext.declarative import declarative_base
4
4
  from sqlalchemy.orm import relationship
5
+ from sqlalchemy.util import deprecated
5
6
 
6
7
  Base = declarative_base()
7
8
  DATETIME_NOW = 'NOW()'
@@ -23,7 +24,8 @@ class ObiIntegration(Base):
23
24
  created_at = Column('dt_incl', DateTime, nullable=False, server_default=DATETIME_NOW)
24
25
  request_id = Column('id_req', String(40), nullable=True)
25
26
  origin = Column('nm_sist_orig', String(50), nullable=True)
26
- type_id = Column('cd_tipo_param_obi', Integer, ForeignKey('fiscal.tipo_param_kit_obi.cd_tipo_param_obi'), nullable=False)
27
+ type_id = Column('cd_tipo_param_obi', Integer, ForeignKey('fiscal.tipo_param_kit_obi.cd_tipo_param_obi'),
28
+ nullable=False)
27
29
 
28
30
  integration_obi_batch = relationship('IntegrationObiBatch', back_populates='integration_obi')
29
31
  kit_integration_obi_status = relationship("KitIntegrationObiStatus", back_populates="integration_obi")
@@ -76,8 +78,8 @@ class IntegrationObiBatch(Base):
76
78
  integration_batch_id = Column('cd_integr', String(36), ForeignKey(INTEGRATION_BATCH_KEY),
77
79
  primary_key=True, nullable=False)
78
80
  integration_obi_id = Column('cd_seq_integr_obi', Integer, ForeignKey('fiscal.integracao_obi'
79
- '.cd_seq_integr_obi'),
80
- primary_key=True, nullable=False)
81
+ '.cd_seq_integr_obi'),
82
+ primary_key=True, nullable=False)
81
83
  created_at = Column('dt_incl', DateTime, nullable=False)
82
84
 
83
85
  integration_obi = relationship('ObiIntegration', back_populates='integration_obi_batch')
@@ -94,7 +96,7 @@ class KitIntegrationObiStatus(Base):
94
96
  __table_args__ = {'schema': 'fiscal'}
95
97
 
96
98
  integration_obi_id = Column('cd_seq_integr_obi', Integer, ForeignKey('fiscal.integracao_obi.cd_seq_integr_obi'),
97
- primary_key=True, nullable=False)
99
+ primary_key=True, nullable=False)
98
100
  kit_id = Column('no_seq_kit', Integer, ForeignKey(OBI_KIT_KEY),
99
101
  primary_key=True, nullable=False)
100
102
  integration_status = Column('ds_status_proc', String(20), nullable=False)
@@ -113,6 +115,7 @@ class KitIntegrationObiStatus(Base):
113
115
  return f'integration_obi_id: {self.integration_obi_id}, kit_id: {self.kit_id}, integration_status: {self.integration_status}'
114
116
 
115
117
 
118
+ @deprecated('Tabela "documento_integracao" foi substituida pela tabela "integracao_obi"')
116
119
  class IntegrationDocument(Base):
117
120
  __tablename__ = 'documento_integracao'
118
121
  __table_args__ = {'schema': 'fiscal'}
@@ -137,7 +140,8 @@ class IntegrationDocument(Base):
137
140
  responsible_movement = Column('id_cnpj_mov', String(), nullable=True)
138
141
 
139
142
  integration_batch = relationship('IntegrationDocumentBatch', back_populates='integration_document')
140
- kit_integration_document_status = relationship("KitIntegrationDocumentStatus", back_populates="integration_document")
143
+ kit_integration_document_status = relationship("KitIntegrationDocumentStatus",
144
+ back_populates="integration_document")
141
145
 
142
146
  def to_dict(self):
143
147
  return {
@@ -188,6 +192,37 @@ class ObiOrganizationUnit(Base):
188
192
  f"Corporate Name: {self.corporate_name}, Active: {self.active}, Create At: {self.create_at}")
189
193
 
190
194
 
195
+ class Batch(Base):
196
+ __tablename__ = 'lote'
197
+ __table_args__ = {'schema': 'fiscal'}
198
+
199
+ batch_id = Column('no_seq_lote', Integer, primary_key=True, nullable=False)
200
+ employer_number = Column('cd_cnpj_empr', String(14), ForeignKey(ObiOrganizationUnit.employer_number),
201
+ nullable=False)
202
+ first_date_document = Column('dt_ini_doc_integr', Date)
203
+ last_date_document = Column('dt_fim_doc_integr', Date)
204
+ error_reason = Column('ds_mot_erro', String)
205
+ batch_code_obi = Column('cd_lote_obi', String)
206
+ start_integration_date = Column('dt_hora_ini_lote_integr', DateTime)
207
+ end_integration_date = Column('dt_hora_fim_lote_integr', DateTime)
208
+ created_at = Column('dt_incl', DateTime, nullable=False)
209
+ status = Column('ds_status_integr', String(), nullable=False)
210
+
211
+ batch_files = relationship('BatchFileIntegration', back_populates='integration_batch')
212
+ integration_processing = relationship('IntegrationProcessing', back_populates='integration_batch')
213
+
214
+ def __init__(self, integration_batch_id, employer_number, first_date_document, last_date_document, status):
215
+ super().__init__()
216
+ self.integration_batch_id = integration_batch_id
217
+ self.employer_number = employer_number
218
+ self.first_date_document = first_date_document
219
+ self.last_date_document = last_date_document
220
+ self.status = status
221
+ self.start_integration_date = datetime.now()
222
+ self.created_at = self.start_integration_date
223
+
224
+
225
+ @deprecated('Tabela "lote_integracao" foi substituida pela tabela "lote"')
191
226
  class IntegrationBatch(Base):
192
227
  __tablename__ = 'lote_integracao'
193
228
  __table_args__ = {'schema': 'fiscal'}
@@ -264,7 +299,8 @@ class ParamProcessingKit(Base):
264
299
  kit_id = Column('cd_kit', Integer, ForeignKey(OBI_KIT_KEY), nullable=False)
265
300
  process_code = Column('cd_proc_obi', String(30))
266
301
  status = Column('id_status_param', Boolean, nullable=False)
267
- type_id = Column('cd_tipo_param_obi', Integer, ForeignKey('fiscal.tipo_param_kit_obi.cd_tipo_param_obi'), nullable=False)
302
+ type_id = Column('cd_tipo_param_obi', Integer, ForeignKey('fiscal.tipo_param_kit_obi.cd_tipo_param_obi'),
303
+ nullable=False)
268
304
  document_type = Column('cd_tipo_doc_integr', String(8))
269
305
  created_at = Column('dt_incl', DateTime, nullable=False, server_default=DATETIME_NOW)
270
306
 
@@ -304,6 +340,7 @@ class IntegrationProcessing(Base):
304
340
  self.created_at = datetime.now()
305
341
 
306
342
 
343
+ @deprecated('Tabela "lote_documento_integracao" foi substituida pela tabela "lote_integracao_obi"')
307
344
  class IntegrationDocumentBatch(Base):
308
345
  __tablename__ = 'lote_documento_integracao'
309
346
  __table_args__ = {'schema': 'fiscal'}
@@ -351,6 +388,7 @@ class ObiAuthentication(Base):
351
388
  self.created_at = datetime.now()
352
389
 
353
390
 
391
+ @deprecated('Tabela "kit_documento_integracao_status" foi substituida pela tabela "kit_integracao_obi_status"')
354
392
  class KitIntegrationDocumentStatus(Base):
355
393
  __tablename__ = 'kit_documento_integracao_status'
356
394
  __table_args__ = {'schema': 'fiscal'}
inovai/enums.py CHANGED
@@ -8,11 +8,12 @@ class DocumentStatus(Enum):
8
8
 
9
9
 
10
10
  class IntegrationStatus(Enum):
11
- SENDED = 'ENVIADO'
11
+ SENT = 'ENVIADO'
12
12
  INTEGRATED = 'INTEGRADO'
13
13
  PENDING_INTEGRATION = 'PENDENTE_INTEGRACAO'
14
14
  CONVERTER_ERROR = 'ERRO_CONVERSAO'
15
15
  ERROR = "ERRO"
16
+ STARTING = 'INICIANDO'
16
17
 
17
18
 
18
19
  class BatchStatus(Enum):
@@ -49,9 +50,26 @@ class IntegrationType(IntEnum):
49
50
  MOVIMENTACAO_ESTOQUE = 4
50
51
  PRODUTO_ACABADO_SEM_EMBALAGEM = 5
51
52
  PRODUTO_ACABADO_COM_EMBALAGEM = 6
52
- ORDEM_PRODUCAO = 7
53
+ ORDEM_PRODUCAO_PROPRIA = 7
54
+ ORDEM_PRODUCAO_TERCEIROS = 9
53
55
  CORRECAO_APONTAMENTO = 8
54
- DEFAULT = 9
56
+ DEFAULT = 999
57
+
58
+ @classmethod
59
+ def get_by_kit_id(cls, kit_id):
60
+ if kit_id == KitId.ONE.value:
61
+ return [cls.SERV, cls.SERV_ISS, cls.PROD]
62
+ elif kit_id == KitId.THREE.value:
63
+ return [
64
+ cls.MOVIMENTACAO_ESTOQUE,
65
+ cls.PRODUTO_ACABADO_SEM_EMBALAGEM,
66
+ cls.PRODUTO_ACABADO_COM_EMBALAGEM,
67
+ cls.ORDEM_PRODUCAO_PROPRIA,
68
+ cls.ORDEM_PRODUCAO_TERCEIROS,
69
+ cls.CORRECAO_APONTAMENTO
70
+ ]
71
+ else:
72
+ return [cls.DEFAULT]
55
73
 
56
74
 
57
75
  class TaxType(Enum):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ipiranga-inovai-project-lib
3
- Version: 2.5
3
+ Version: 2.7
4
4
  Summary: Projeto criado para importação genérica de entidades
5
5
  Home-page: https://gitlab.ipirangacloud.com/clayton.monteiro.ext/ipiranga-inovai-project-lib
6
6
  Author: Clayton Sandes Monteiro
@@ -1,6 +1,7 @@
1
1
  inovai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- inovai/entities.py,sha256=ZQuimib2PNLFj5lYDzlhKt6chsnvs_X-9KffT0VC_LM,17963
3
- inovai/enums.py,sha256=Ei8B5WacDvJsBXUWi5jnKK1My3fuKBrbebmZKtwJV2Y,1636
2
+ inovai/dtos.py,sha256=qaWZB7n5SHcC58RP351IQ1HLjv7fx3VAdILj-GugVWs,1587
3
+ inovai/entities.py,sha256=p4JEIA5DEbyV01S2g9LIWNrqlhvhAItgbv0CyyUndwQ,20002
4
+ inovai/enums.py,sha256=aROt6aXbFGWeaA6E-gWDkPJk6c_lNEiC56FDfQOar38,2267
4
5
  inovai/models/Endereco.py,sha256=Vft20vMwYwTXtEuh5NH7O5FxXVahnLmgaXMDOVdBxY4,3519
5
6
  inovai/models/NFe.py,sha256=3PiMvK6AODaagZU7KEpnjYfulz8PvcQYGChIa-QCvg0,13023
6
7
  inovai/models/NFeBoleto.py,sha256=tLWqsOlszA6UiJdxesJKQkgwNk_4DuI3NRBCYZh7RKc,5006
@@ -33,8 +34,8 @@ inovai/models/NFeVolume.py,sha256=_cayb-rrz1mSxQ3wFFnB4KCi524jtAsdTTcS4WQTBOc,19
33
34
  inovai/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
35
  inovai/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
36
  inovai/utils/util.py,sha256=tEFFoYhtyZk2pxor2vb23NWr3otPzPXTiTIf-VrGik4,366
36
- ipiranga_inovai_project_lib-2.5.dist-info/LICENSE,sha256=UJ3ql8eZec9Y1kER7QSHAuvdgFPuL47asePHYmdzG_o,198
37
- ipiranga_inovai_project_lib-2.5.dist-info/METADATA,sha256=7qvzzMYsz8HRZd3Y0OQATp22CMeyalkj3E5IJCihqW8,518
38
- ipiranga_inovai_project_lib-2.5.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
39
- ipiranga_inovai_project_lib-2.5.dist-info/top_level.txt,sha256=BD-APH5oIEb_KDXwrfnZiu9QDsD9ttTEkYc32r9thqg,7
40
- ipiranga_inovai_project_lib-2.5.dist-info/RECORD,,
37
+ ipiranga_inovai_project_lib-2.7.dist-info/LICENSE,sha256=UJ3ql8eZec9Y1kER7QSHAuvdgFPuL47asePHYmdzG_o,198
38
+ ipiranga_inovai_project_lib-2.7.dist-info/METADATA,sha256=YKOOZ99puFwm8AvdvOuXWmtSUYMv3zbOZDFBGMG-dkQ,518
39
+ ipiranga_inovai_project_lib-2.7.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
40
+ ipiranga_inovai_project_lib-2.7.dist-info/top_level.txt,sha256=BD-APH5oIEb_KDXwrfnZiu9QDsD9ttTEkYc32r9thqg,7
41
+ ipiranga_inovai_project_lib-2.7.dist-info/RECORD,,