ipiranga-inovai-project-lib 0.2__py3-none-any.whl → 0.4__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/__init__.py +0 -0
- inovai/entities.py +259 -0
- inovai/enums.py +16 -0
- {ipiranga_inovai_project_lib-0.2.dist-info → ipiranga_inovai_project_lib-0.4.dist-info}/METADATA +1 -1
- ipiranga_inovai_project_lib-0.4.dist-info/RECORD +8 -0
- ipiranga_inovai_project_lib-0.4.dist-info/top_level.txt +1 -0
- ipiranga_inovai_project_lib-0.2.dist-info/RECORD +0 -5
- ipiranga_inovai_project_lib-0.2.dist-info/top_level.txt +0 -1
- {ipiranga_inovai_project_lib-0.2.dist-info → ipiranga_inovai_project_lib-0.4.dist-info}/LICENSE +0 -0
- {ipiranga_inovai_project_lib-0.2.dist-info → ipiranga_inovai_project_lib-0.4.dist-info}/WHEEL +0 -0
inovai/__init__.py
ADDED
|
File without changes
|
inovai/entities.py
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from sqlalchemy import Column, String, Date, DateTime, ForeignKey, Integer, Text, Numeric, Boolean, JSON
|
|
3
|
+
from sqlalchemy.ext.declarative import declarative_base
|
|
4
|
+
from sqlalchemy.orm import relationship
|
|
5
|
+
|
|
6
|
+
Base = declarative_base()
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class IntegrationDocument(Base):
|
|
10
|
+
__tablename__ = 'documento_integracao'
|
|
11
|
+
__table_args__ = {'schema': 'fiscal'}
|
|
12
|
+
|
|
13
|
+
document_id = Column('no_seq_doc_integr', Integer, primary_key=True, nullable=False)
|
|
14
|
+
access_key = Column('cd_chave_doc_integr', String(44))
|
|
15
|
+
json_content = Column('aq_json', JSON, nullable=False)
|
|
16
|
+
document_movement_type = Column('cd_tipo_mov_doc_integr', String(1))
|
|
17
|
+
document_type = Column('cd_tipo_doc_integr', String(4))
|
|
18
|
+
document_series = Column('cd_serie_doc_integr', String(3), nullable=False)
|
|
19
|
+
document_number = Column('no_doc_integr', Numeric(precision=11, scale=0), nullable=False)
|
|
20
|
+
document_model = Column('cd_modl_doc_integr', String(3), nullable=False)
|
|
21
|
+
branch_code = Column('cd_filial', Numeric(precision=6, scale=0), nullable=False)
|
|
22
|
+
recipient_cnpj = Column('cd_cnpj_dest', String(14), nullable=False)
|
|
23
|
+
issuer_cnpj = Column('cd_cnpj_emit', String(14), nullable=False)
|
|
24
|
+
issuance_date = Column('dt_emis_doc_integr', Date, nullable=False)
|
|
25
|
+
fiscal_date = Column('dt_fisc', Date, nullable=False)
|
|
26
|
+
created_at = Column('dt_hora_criacao', DateTime, nullable=False)
|
|
27
|
+
updated_at = Column('dt_incl', DateTime, nullable=False, server_default='NOW()')
|
|
28
|
+
request_id = Column('id_req_doc_fisc', String(40), nullable=True)
|
|
29
|
+
origin = Column('nm_sist_orig', String(50), nullable=True)
|
|
30
|
+
responsible_movement = Column('id_cnpj_mov', String(), nullable=True)
|
|
31
|
+
|
|
32
|
+
integration_batch = relationship('IntegrationDocumentBatch', back_populates='integration_document')
|
|
33
|
+
kit_integration_document_status = relationship("KitIntegrationDocumentStatus", back_populates="integration_document")
|
|
34
|
+
|
|
35
|
+
def to_dict(self):
|
|
36
|
+
return {
|
|
37
|
+
"no_seq_doc_integr": self.document_id,
|
|
38
|
+
"cd_chave_doc_integr": self.access_key,
|
|
39
|
+
"aq_json": self.json_content,
|
|
40
|
+
"cd_tipo_mov_doc_integr": self.document_movement_type,
|
|
41
|
+
"cd_tipo_doc_integr": self.document_type,
|
|
42
|
+
"cd_serie_doc_integr": self.document_series,
|
|
43
|
+
"no_doc_integr": self.document_number,
|
|
44
|
+
"cd_modl_doc_integr": self.document_model,
|
|
45
|
+
"cd_filial": self.branch_code,
|
|
46
|
+
"cd_cnpj_dest": self.recipient_cnpj,
|
|
47
|
+
"cd_cnpj_emit": self.issuer_cnpj,
|
|
48
|
+
"dt_emis_doc_integr": self.issuance_date.strftime("%Y-%m-%d") if self.issuance_date is not None else None,
|
|
49
|
+
"dt_fisc": self.fiscal_date.strftime("%Y-%m-%d") if self.fiscal_date is not None else None,
|
|
50
|
+
"dt_hora_criacao": self.created_at.strftime("%Y-%m-%d %H:%M:%S") if self.created_at is not None else None,
|
|
51
|
+
"dt_incl": self.updated_at.strftime("%Y-%m-%d %H:%M:%S") if self.updated_at is not None else None,
|
|
52
|
+
"request_id": self.request_id,
|
|
53
|
+
"nm_sist_orig": self.origin,
|
|
54
|
+
"id_cnpj_mov": self.responsible_movement
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
def __str__(self):
|
|
58
|
+
return str(self.to_dict())
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class ObiOrganizationUnit(Base):
|
|
62
|
+
__tablename__ = 'unidade_organizacional_obi'
|
|
63
|
+
__table_args__ = {'schema': 'fiscal'}
|
|
64
|
+
|
|
65
|
+
employer_number = Column("cd_cnpj_empr", String(14), primary_key=True, nullable=False)
|
|
66
|
+
organization_code = Column("cd_filial", Integer, nullable=False)
|
|
67
|
+
corporate_name = Column("nm_razao_social", String(60), nullable=False)
|
|
68
|
+
active = Column("id_status_integr", Boolean, nullable=False)
|
|
69
|
+
create_at = Column("dt_incl", DateTime, nullable=False)
|
|
70
|
+
|
|
71
|
+
def __init__(self, employer_number, organization_code, corporate_name, active, create_at):
|
|
72
|
+
super().__init__()
|
|
73
|
+
self.employer_number = employer_number
|
|
74
|
+
self.organization_code = organization_code
|
|
75
|
+
self.corporate_name = corporate_name
|
|
76
|
+
self.active = active
|
|
77
|
+
self.create_at = create_at
|
|
78
|
+
|
|
79
|
+
def __str__(self):
|
|
80
|
+
return (f"Employer Number: {self.employer_number}, Organization Code: {self.organization_code}, "
|
|
81
|
+
f"Corporate Name: {self.corporate_name}, Active: {self.active}, Create At: {self.create_at}")
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class IntegrationBatch(Base):
|
|
85
|
+
__tablename__ = 'lote_integracao'
|
|
86
|
+
__table_args__ = {'schema': 'fiscal'}
|
|
87
|
+
|
|
88
|
+
integration_batch_id = Column('cd_integr', String(36), primary_key=True, nullable=False)
|
|
89
|
+
employer_number = Column('cd_cnpj_empr', String(14), ForeignKey(ObiOrganizationUnit.employer_number),
|
|
90
|
+
nullable=False)
|
|
91
|
+
first_date_document = Column('dt_ini_doc_integr', Date)
|
|
92
|
+
last_date_document = Column('dt_fim_doc_integr', Date)
|
|
93
|
+
error_reason = Column('ds_mot_erro', String)
|
|
94
|
+
batch_code = Column('cd_lote_obi', String)
|
|
95
|
+
start_integration_date = Column('dt_hora_ini_lote_integr', DateTime)
|
|
96
|
+
end_integration_date = Column('dt_hora_fim_lote_integr', DateTime)
|
|
97
|
+
created_at = Column('dt_incl', DateTime, nullable=False)
|
|
98
|
+
status = Column('ds_status_integr', String(), nullable=False)
|
|
99
|
+
|
|
100
|
+
batch_files = relationship('BatchFileIntegration', back_populates='integration_batch')
|
|
101
|
+
integration_processing = relationship('IntegrationProcessing', back_populates='integration_batch')
|
|
102
|
+
|
|
103
|
+
def __init__(self, integration_batch_id, employer_number, first_date_document, last_date_document, status):
|
|
104
|
+
super().__init__()
|
|
105
|
+
self.integration_batch_id = integration_batch_id
|
|
106
|
+
self.employer_number = employer_number
|
|
107
|
+
self.first_date_document = first_date_document
|
|
108
|
+
self.last_date_document = last_date_document
|
|
109
|
+
self.status = status
|
|
110
|
+
self.start_integration_date = datetime.now()
|
|
111
|
+
self.created_at = self.start_integration_date
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class IntegrationFile(Base):
|
|
115
|
+
__tablename__ = 'arquivo_integracao'
|
|
116
|
+
__table_args__ = {'schema': 'fiscal'}
|
|
117
|
+
|
|
118
|
+
integration_file_id = Column('no_seq_aq_integr', Integer, primary_key=True, nullable=False)
|
|
119
|
+
file_name = Column('nm_aq', String(50))
|
|
120
|
+
crypt_file_integration = Column('aq_integr_criptog', Text)
|
|
121
|
+
created_at = Column('dt_incl', DateTime, nullable=False)
|
|
122
|
+
|
|
123
|
+
batch_files = relationship('BatchFileIntegration', back_populates='integration_file')
|
|
124
|
+
|
|
125
|
+
def __init__(self, file_name, crypt_file_integration):
|
|
126
|
+
super().__init__()
|
|
127
|
+
self.file_name = file_name
|
|
128
|
+
self.crypt_file_integration = crypt_file_integration
|
|
129
|
+
self.created_at = datetime.now()
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
class BatchFileIntegration(Base):
|
|
133
|
+
__tablename__ = 'lote_arquivo_integracao'
|
|
134
|
+
__table_args__ = {'schema': 'fiscal'}
|
|
135
|
+
|
|
136
|
+
integration_file_id = Column('cd_dos_aq_integr', Integer, ForeignKey('fiscal.arquivo_integracao.no_seq_aq_integr'),
|
|
137
|
+
primary_key=True, nullable=False)
|
|
138
|
+
integration_batch_id = Column('cd_integr', String(36), ForeignKey('fiscal.lote_integracao.cd_integr'),
|
|
139
|
+
primary_key=True, nullable=False)
|
|
140
|
+
created_at = Column('dt_incl', DateTime, nullable=False)
|
|
141
|
+
|
|
142
|
+
integration_batch = relationship('IntegrationBatch', back_populates='batch_files')
|
|
143
|
+
integration_file = relationship('IntegrationFile', back_populates='batch_files')
|
|
144
|
+
|
|
145
|
+
def __init__(self, file_integration_id, integration_batch_id):
|
|
146
|
+
super().__init__()
|
|
147
|
+
self.integration_batch_id = integration_batch_id
|
|
148
|
+
self.integration_file_id = file_integration_id
|
|
149
|
+
self.created_at = datetime.now()
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
class ParamProcessingKit(Base):
|
|
153
|
+
__tablename__ = 'param_processamento_kit'
|
|
154
|
+
__table_args__ = {'schema': 'fiscal'}
|
|
155
|
+
|
|
156
|
+
param_processing_kit_id = Column('no_seq_proc', Numeric(precision=8, scale=0), primary_key=True, nullable=False)
|
|
157
|
+
kit_id = Column('cd_kit', Integer, ForeignKey('fiscal.kit_obi.no_seq_kit'), nullable=False)
|
|
158
|
+
process_code = Column('cd_proc_obi', String(30))
|
|
159
|
+
status = Column('id_status_param', Boolean, nullable=False)
|
|
160
|
+
created_at = Column('dt_incl', DateTime, nullable=False, server_default='NOW()')
|
|
161
|
+
|
|
162
|
+
def __init__(self, param_processing_kit_id, kit_id, process_code, status):
|
|
163
|
+
super().__init__()
|
|
164
|
+
self.param_processing_kit_id = param_processing_kit_id
|
|
165
|
+
self.kit_id = kit_id
|
|
166
|
+
self.process_code = process_code
|
|
167
|
+
self.status = status
|
|
168
|
+
self.created_at = datetime.now()
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
class IntegrationProcessing(Base):
|
|
172
|
+
__tablename__ = 'integracao_processamento'
|
|
173
|
+
__table_args__ = {'schema': 'fiscal'}
|
|
174
|
+
|
|
175
|
+
integration_batch_id = Column('cd_integr', String(36), ForeignKey('fiscal.lote_integracao.cd_integr'),
|
|
176
|
+
primary_key=True, nullable=False)
|
|
177
|
+
param_processing_kit_id = Column('no_seq_proc', Numeric(precision=8, scale=0),
|
|
178
|
+
ForeignKey('fiscal.param_processamento_kit.no_seq_proc'),
|
|
179
|
+
primary_key=True, nullable=False)
|
|
180
|
+
created_at = Column('dt_incl', DateTime, nullable=False)
|
|
181
|
+
|
|
182
|
+
integration_batch = relationship('IntegrationBatch', back_populates='integration_processing')
|
|
183
|
+
param_processing_kit = relationship(ParamProcessingKit,
|
|
184
|
+
primaryjoin="IntegrationProcessing.param_processing_kit_id == "
|
|
185
|
+
"ParamProcessingKit.param_processing_kit_id")
|
|
186
|
+
|
|
187
|
+
def __init__(self, integration_batch_id, param_processing_kit_id):
|
|
188
|
+
super().__init__()
|
|
189
|
+
self.param_processing_kit_id = param_processing_kit_id
|
|
190
|
+
self.integration_batch_id = integration_batch_id
|
|
191
|
+
self.created_at = datetime.now()
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
class IntegrationDocumentBatch(Base):
|
|
195
|
+
__tablename__ = 'lote_documento_integracao'
|
|
196
|
+
__table_args__ = {'schema': 'fiscal'}
|
|
197
|
+
|
|
198
|
+
integration_batch_id = Column('cd_integr', String(36), ForeignKey('fiscal.lote_integracao.cd_integr'),
|
|
199
|
+
primary_key=True, nullable=False)
|
|
200
|
+
integration_document_id = Column('cd_seq_doc_integr', Integer, ForeignKey('fiscal.documento_integracao'
|
|
201
|
+
'.no_seq_doc_integr'),
|
|
202
|
+
primary_key=True, nullable=False)
|
|
203
|
+
created_at = Column('dt_incl', DateTime, nullable=False)
|
|
204
|
+
|
|
205
|
+
integration_document = relationship('IntegrationDocument', back_populates='integration_batch')
|
|
206
|
+
|
|
207
|
+
def __init__(self, integration_batch_id, integration_document_id):
|
|
208
|
+
super().__init__()
|
|
209
|
+
self.integration_document_id = integration_document_id
|
|
210
|
+
self.integration_batch_id = integration_batch_id
|
|
211
|
+
self.created_at = datetime.now()
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
class KitObi(Base):
|
|
215
|
+
__tablename__ = 'kit_obi'
|
|
216
|
+
__table_args__ = {'schema': 'fiscal'}
|
|
217
|
+
|
|
218
|
+
kit_id = Column('no_seq_kit', Integer, primary_key=True, nullable=False)
|
|
219
|
+
kit_description = Column('ds_kit', String(150))
|
|
220
|
+
created_at = Column('dt_incl', DateTime, nullable=False)
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
class ObiAuthentication(Base):
|
|
224
|
+
__tablename__ = 'autenticacao_obi'
|
|
225
|
+
__table_args__ = {'schema': 'fiscal'}
|
|
226
|
+
|
|
227
|
+
id_obi_authentication = Column('no_seq_token', Integer, primary_key=True, nullable=False)
|
|
228
|
+
access_token = Column('ds_access_token_obi', Text, nullable=False)
|
|
229
|
+
expiration_date = Column('dt_hora_expir_token', DateTime, nullable=False)
|
|
230
|
+
created_date = Column('dt_hora_criacao_token', DateTime)
|
|
231
|
+
created_at = Column('dt_incl', DateTime, nullable=False)
|
|
232
|
+
|
|
233
|
+
def __init__(self, access_token, expiration_date):
|
|
234
|
+
super().__init__()
|
|
235
|
+
self.access_token = access_token
|
|
236
|
+
self.expiration_date = expiration_date
|
|
237
|
+
self.created_date = datetime.now()
|
|
238
|
+
self.created_at = datetime.now()
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
class KitIntegrationDocumentStatus(Base):
|
|
242
|
+
__tablename__ = 'kit_documento_integracao_status'
|
|
243
|
+
__table_args__ = {'schema': 'fiscal'}
|
|
244
|
+
|
|
245
|
+
document_id = Column('no_seq_doc_integr', Integer, ForeignKey('fiscal.documento_integracao.no_seq_doc_integr'),
|
|
246
|
+
primary_key=True, nullable=False)
|
|
247
|
+
kit_id = Column('no_seq_kit', Integer, ForeignKey('fiscal.kit_obi.no_seq_kit'),
|
|
248
|
+
primary_key=True, nullable=False)
|
|
249
|
+
integration_status = Column('ds_status_proc', String(20), nullable=False)
|
|
250
|
+
created_at = Column('dt_incl', DateTime, nullable=False)
|
|
251
|
+
|
|
252
|
+
integration_document = relationship(IntegrationDocument, back_populates="kit_integration_document_status")
|
|
253
|
+
|
|
254
|
+
def __init__(self, document_id, kit_id, integration_status):
|
|
255
|
+
super().__init__()
|
|
256
|
+
self.document_id = document_id
|
|
257
|
+
self.kit_id = kit_id
|
|
258
|
+
self.integration_status = integration_status
|
|
259
|
+
self.created_at = datetime.now()
|
inovai/enums.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class DocumentStatus(Enum):
|
|
5
|
+
INTEGRATED = 'INTEGRADO'
|
|
6
|
+
PENDING_INTEGRATION = 'PENDENTE_INTEGRACAO'
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class DocumentMovementType(Enum):
|
|
10
|
+
INPUT = 'E',
|
|
11
|
+
OUTPUT = 'S'
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ResponsibleMovement(Enum):
|
|
15
|
+
ISSUER = 'EMITENTE'
|
|
16
|
+
RECIPIENT = 'DESTINATARIO'
|
{ipiranga_inovai_project_lib-0.2.dist-info → ipiranga_inovai_project_lib-0.4.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ipiranga-inovai-project-lib
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4
|
|
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
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
inovai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
inovai/entities.py,sha256=D0gLL5RvHxeNYEBQd8nc7OzOXtPrT4pLDECxbX8Ssfg,12752
|
|
3
|
+
inovai/enums.py,sha256=5NxAF59BwbXCi-pt6vHlBuoyykViXaCTIphFci__hYE,305
|
|
4
|
+
ipiranga_inovai_project_lib-0.4.dist-info/LICENSE,sha256=UJ3ql8eZec9Y1kER7QSHAuvdgFPuL47asePHYmdzG_o,198
|
|
5
|
+
ipiranga_inovai_project_lib-0.4.dist-info/METADATA,sha256=krxX6cwc8Psj0lTB8A5gt0zNzVKrfcJhkOk2CnPAWvQ,518
|
|
6
|
+
ipiranga_inovai_project_lib-0.4.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
7
|
+
ipiranga_inovai_project_lib-0.4.dist-info/top_level.txt,sha256=BD-APH5oIEb_KDXwrfnZiu9QDsD9ttTEkYc32r9thqg,7
|
|
8
|
+
ipiranga_inovai_project_lib-0.4.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
inovai
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
ipiranga_inovai_project_lib-0.2.dist-info/LICENSE,sha256=UJ3ql8eZec9Y1kER7QSHAuvdgFPuL47asePHYmdzG_o,198
|
|
2
|
-
ipiranga_inovai_project_lib-0.2.dist-info/METADATA,sha256=mrw_68yQZAEG4roAKti6yy5kxOKBtOx_o0odqsqkTW8,518
|
|
3
|
-
ipiranga_inovai_project_lib-0.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
4
|
-
ipiranga_inovai_project_lib-0.2.dist-info/top_level.txt,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
5
|
-
ipiranga_inovai_project_lib-0.2.dist-info/RECORD,,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
{ipiranga_inovai_project_lib-0.2.dist-info → ipiranga_inovai_project_lib-0.4.dist-info}/LICENSE
RENAMED
|
File without changes
|
{ipiranga_inovai_project_lib-0.2.dist-info → ipiranga_inovai_project_lib-0.4.dist-info}/WHEEL
RENAMED
|
File without changes
|