ipiranga-inovai-project-lib 0.1__tar.gz
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.
- ipiranga-inovai-project-lib-0.1/LICENSE +5 -0
- ipiranga-inovai-project-lib-0.1/PKG-INFO +13 -0
- ipiranga-inovai-project-lib-0.1/README.md +0 -0
- ipiranga-inovai-project-lib-0.1/ipiranga_inovai_project_lib.egg-info/PKG-INFO +13 -0
- ipiranga-inovai-project-lib-0.1/ipiranga_inovai_project_lib.egg-info/SOURCES.txt +14 -0
- ipiranga-inovai-project-lib-0.1/ipiranga_inovai_project_lib.egg-info/dependency_links.txt +1 -0
- ipiranga-inovai-project-lib-0.1/ipiranga_inovai_project_lib.egg-info/top_level.txt +1 -0
- ipiranga-inovai-project-lib-0.1/setup.cfg +4 -0
- ipiranga-inovai-project-lib-0.1/setup.py +19 -0
- ipiranga-inovai-project-lib-0.1/src/__init__.py +0 -0
- ipiranga-inovai-project-lib-0.1/src/domain/__init__.py +0 -0
- ipiranga-inovai-project-lib-0.1/src/domain/entity/__init__.py +0 -0
- ipiranga-inovai-project-lib-0.1/src/domain/entity/entities.py +254 -0
- ipiranga-inovai-project-lib-0.1/src/domain/enum/__init__.py +0 -0
- ipiranga-inovai-project-lib-0.1/src/domain/enum/document_movement_type.py +7 -0
- ipiranga-inovai-project-lib-0.1/src/domain/enum/document_status.py +7 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: ipiranga-inovai-project-lib
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: Projeto criado para importação genérica de entidades
|
|
5
|
+
Home-page: https://gitlab.ipirangacloud.com/clayton.monteiro.ext/ipiranga-inovai-project-lib
|
|
6
|
+
Author: Clayton Sandes Monteiro
|
|
7
|
+
Author-email: clayton.monteiro.ext@ipiranga.ipiranga
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: inovai
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: ipiranga-inovai-project-lib
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: Projeto criado para importação genérica de entidades
|
|
5
|
+
Home-page: https://gitlab.ipirangacloud.com/clayton.monteiro.ext/ipiranga-inovai-project-lib
|
|
6
|
+
Author: Clayton Sandes Monteiro
|
|
7
|
+
Author-email: clayton.monteiro.ext@ipiranga.ipiranga
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: inovai
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
setup.py
|
|
4
|
+
ipiranga_inovai_project_lib.egg-info/PKG-INFO
|
|
5
|
+
ipiranga_inovai_project_lib.egg-info/SOURCES.txt
|
|
6
|
+
ipiranga_inovai_project_lib.egg-info/dependency_links.txt
|
|
7
|
+
ipiranga_inovai_project_lib.egg-info/top_level.txt
|
|
8
|
+
src/__init__.py
|
|
9
|
+
src/domain/__init__.py
|
|
10
|
+
src/domain/entity/__init__.py
|
|
11
|
+
src/domain/entity/entities.py
|
|
12
|
+
src/domain/enum/__init__.py
|
|
13
|
+
src/domain/enum/document_movement_type.py
|
|
14
|
+
src/domain/enum/document_status.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
src
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="ipiranga-inovai-project-lib",
|
|
5
|
+
version="0.1",
|
|
6
|
+
packages=find_packages(),
|
|
7
|
+
description="Projeto criado para importação genérica de entidades",
|
|
8
|
+
long_description=open('README.md').read(),
|
|
9
|
+
long_description_content_type='text/markdown',
|
|
10
|
+
author="Clayton Sandes Monteiro",
|
|
11
|
+
author_email="clayton.monteiro.ext@ipiranga.ipiranga",
|
|
12
|
+
url="https://gitlab.ipirangacloud.com/clayton.monteiro.ext/ipiranga-inovai-project-lib",
|
|
13
|
+
license="MIT",
|
|
14
|
+
classifiers=[
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
],
|
|
18
|
+
keywords="inovai",
|
|
19
|
+
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,254 @@
|
|
|
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
|
+
|
|
31
|
+
integration_batch = relationship('IntegrationDocumentBatch', back_populates='integration_document')
|
|
32
|
+
kit_integration_document_status = relationship("KitIntegrationDocumentStatus", back_populates="integration_document")
|
|
33
|
+
|
|
34
|
+
def to_dict(self):
|
|
35
|
+
return {
|
|
36
|
+
"no_seq_doc_integr": self.document_id,
|
|
37
|
+
"cd_chave_doc_integr": self.access_key,
|
|
38
|
+
"aq_json": self.json_content,
|
|
39
|
+
"cd_tipo_mov_doc_integr": self.document_movement_type,
|
|
40
|
+
"cd_tipo_doc_integr": self.document_type,
|
|
41
|
+
"cd_serie_doc_integr": self.document_series,
|
|
42
|
+
"no_doc_integr": self.document_number,
|
|
43
|
+
"cd_modl_doc_integr": self.document_model,
|
|
44
|
+
"cd_filial": self.branch_code,
|
|
45
|
+
"cd_cnpj_dest": self.recipient_cnpj,
|
|
46
|
+
"cd_cnpj_emit": self.issuer_cnpj,
|
|
47
|
+
"dt_emis_doc_integr": self.issuance_date.strftime("%Y-%m-%d") if self.issuance_date is not None else None,
|
|
48
|
+
"dt_fisc": self.fiscal_date.strftime("%Y-%m-%d") if self.fiscal_date is not None else None,
|
|
49
|
+
"dt_hora_criacao": self.created_at.strftime("%Y-%m-%d %H:%M:%S") if self.created_at is not None else None,
|
|
50
|
+
"dt_incl": self.updated_at.strftime("%Y-%m-%d %H:%M:%S") if self.updated_at is not None else None,
|
|
51
|
+
"request_id": self.request_id
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
def __str__(self):
|
|
55
|
+
return str(self.to_dict())
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class ObiOrganizationUnit(Base):
|
|
59
|
+
__tablename__ = 'unidade_organizacional_obi'
|
|
60
|
+
__table_args__ = {'schema': 'fiscal'}
|
|
61
|
+
|
|
62
|
+
employer_number = Column("cd_cnpj_empr", String(14), primary_key=True, nullable=False)
|
|
63
|
+
organization_code = Column("cd_filial", Integer, nullable=False)
|
|
64
|
+
corporate_name = Column("nm_razao_social", String(60), nullable=False)
|
|
65
|
+
active = Column("id_status_integr", Boolean, nullable=False)
|
|
66
|
+
create_at = Column("dt_incl", DateTime, nullable=False)
|
|
67
|
+
|
|
68
|
+
def __init__(self, employer_number, organization_code, corporate_name, active, create_at):
|
|
69
|
+
super().__init__()
|
|
70
|
+
self.employer_number = employer_number
|
|
71
|
+
self.organization_code = organization_code
|
|
72
|
+
self.corporate_name = corporate_name
|
|
73
|
+
self.active = active
|
|
74
|
+
self.create_at = create_at
|
|
75
|
+
|
|
76
|
+
def __str__(self):
|
|
77
|
+
return (f"Employer Number: {self.employer_number}, Organization Code: {self.organization_code}, "
|
|
78
|
+
f"Corporate Name: {self.corporate_name}, Active: {self.active}, Create At: {self.create_at}")
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class IntegrationBatch(Base):
|
|
82
|
+
__tablename__ = 'lote_integracao'
|
|
83
|
+
__table_args__ = {'schema': 'fiscal'}
|
|
84
|
+
|
|
85
|
+
integration_batch_id = Column('cd_integr', String(36), primary_key=True, nullable=False)
|
|
86
|
+
employer_number = Column('cd_cnpj_empr', String(14), ForeignKey(ObiOrganizationUnit.employer_number),
|
|
87
|
+
nullable=False)
|
|
88
|
+
first_date_document = Column('dt_ini_doc_integr', Date)
|
|
89
|
+
last_date_document = Column('dt_fim_doc_integr', Date)
|
|
90
|
+
error_reason = Column('ds_mot_erro', String)
|
|
91
|
+
batch_code = Column('cd_lote_obi', String)
|
|
92
|
+
start_integration_date = Column('dt_hora_ini_lote_integr', DateTime)
|
|
93
|
+
end_integration_date = Column('dt_hora_fim_lote_integr', DateTime)
|
|
94
|
+
created_at = Column('dt_incl', DateTime, nullable=False)
|
|
95
|
+
|
|
96
|
+
batch_files = relationship('BatchFileIntegration', back_populates='integration_batch')
|
|
97
|
+
integration_processing = relationship('IntegrationProcessing', back_populates='integration_batch')
|
|
98
|
+
|
|
99
|
+
def __init__(self, integration_batch_id, employer_number, first_date_document, last_date_document):
|
|
100
|
+
super().__init__()
|
|
101
|
+
self.integration_batch_id = integration_batch_id
|
|
102
|
+
self.employer_number = employer_number
|
|
103
|
+
self.first_date_document = first_date_document
|
|
104
|
+
self.last_date_document = last_date_document
|
|
105
|
+
self.start_integration_date = datetime.now()
|
|
106
|
+
self.created_at = self.start_integration_date
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class IntegrationFile(Base):
|
|
110
|
+
__tablename__ = 'arquivo_integracao'
|
|
111
|
+
__table_args__ = {'schema': 'fiscal'}
|
|
112
|
+
|
|
113
|
+
integration_file_id = Column('no_seq_aq_integr', Integer, primary_key=True, nullable=False)
|
|
114
|
+
file_name = Column('nm_aq', String(50))
|
|
115
|
+
crypt_file_integration = Column('aq_integr_criptog', Text)
|
|
116
|
+
created_at = Column('dt_incl', DateTime, nullable=False)
|
|
117
|
+
|
|
118
|
+
batch_files = relationship('BatchFileIntegration', back_populates='integration_file')
|
|
119
|
+
|
|
120
|
+
def __init__(self, file_name, crypt_file_integration):
|
|
121
|
+
super().__init__()
|
|
122
|
+
self.file_name = file_name
|
|
123
|
+
self.crypt_file_integration = crypt_file_integration
|
|
124
|
+
self.created_at = datetime.now()
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
class BatchFileIntegration(Base):
|
|
128
|
+
__tablename__ = 'lote_arquivo_integracao'
|
|
129
|
+
__table_args__ = {'schema': 'fiscal'}
|
|
130
|
+
|
|
131
|
+
integration_file_id = Column('cd_dos_aq_integr', Integer, ForeignKey('fiscal.arquivo_integracao.no_seq_aq_integr'),
|
|
132
|
+
primary_key=True, nullable=False)
|
|
133
|
+
integration_batch_id = Column('cd_integr', String(36), ForeignKey('fiscal.lote_integracao.cd_integr'),
|
|
134
|
+
primary_key=True, nullable=False)
|
|
135
|
+
created_at = Column('dt_incl', DateTime, nullable=False)
|
|
136
|
+
|
|
137
|
+
integration_batch = relationship('IntegrationBatch', back_populates='batch_files')
|
|
138
|
+
integration_file = relationship('IntegrationFile', back_populates='batch_files')
|
|
139
|
+
|
|
140
|
+
def __init__(self, file_integration_id, integration_batch_id):
|
|
141
|
+
super().__init__()
|
|
142
|
+
self.integration_batch_id = integration_batch_id
|
|
143
|
+
self.integration_file_id = file_integration_id
|
|
144
|
+
self.created_at = datetime.now()
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
class ParamProcessingKit(Base):
|
|
148
|
+
__tablename__ = 'param_processamento_kit'
|
|
149
|
+
__table_args__ = {'schema': 'fiscal'}
|
|
150
|
+
|
|
151
|
+
param_processing_kit_id = Column('no_seq_proc', Numeric(precision=8, scale=0), primary_key=True, nullable=False)
|
|
152
|
+
kit_id = Column('cd_kit', Integer, ForeignKey('fiscal.kit_obi.no_seq_kit'), nullable=False)
|
|
153
|
+
process_code = Column('cd_proc_obi', String(30))
|
|
154
|
+
status = Column('id_status_param', Boolean, nullable=False)
|
|
155
|
+
created_at = Column('dt_incl', DateTime, nullable=False, server_default='NOW()')
|
|
156
|
+
|
|
157
|
+
def __init__(self, param_processing_kit_id, kit_id, process_code, status):
|
|
158
|
+
super().__init__()
|
|
159
|
+
self.param_processing_kit_id = param_processing_kit_id
|
|
160
|
+
self.kit_id = kit_id
|
|
161
|
+
self.process_code = process_code
|
|
162
|
+
self.status = status
|
|
163
|
+
self.created_at = datetime.now()
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
class IntegrationProcessing(Base):
|
|
167
|
+
__tablename__ = 'integracao_processamento'
|
|
168
|
+
__table_args__ = {'schema': 'fiscal'}
|
|
169
|
+
|
|
170
|
+
integration_batch_id = Column('cd_integr', String(36), ForeignKey('fiscal.lote_integracao.cd_integr'),
|
|
171
|
+
primary_key=True, nullable=False)
|
|
172
|
+
param_processing_kit_id = Column('no_seq_proc', Numeric(precision=8, scale=0),
|
|
173
|
+
ForeignKey('fiscal.param_processamento_kit.no_seq_proc'),
|
|
174
|
+
primary_key=True, nullable=False)
|
|
175
|
+
created_at = Column('dt_incl', DateTime, nullable=False)
|
|
176
|
+
|
|
177
|
+
integration_batch = relationship('IntegrationBatch', back_populates='integration_processing')
|
|
178
|
+
param_processing_kit = relationship(ParamProcessingKit,
|
|
179
|
+
primaryjoin="IntegrationProcessing.param_processing_kit_id == "
|
|
180
|
+
"ParamProcessingKit.param_processing_kit_id")
|
|
181
|
+
|
|
182
|
+
def __init__(self, integration_batch_id, param_processing_kit_id):
|
|
183
|
+
super().__init__()
|
|
184
|
+
self.param_processing_kit_id = param_processing_kit_id
|
|
185
|
+
self.integration_batch_id = integration_batch_id
|
|
186
|
+
self.created_at = datetime.now()
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
class IntegrationDocumentBatch(Base):
|
|
190
|
+
__tablename__ = 'lote_documento_integracao'
|
|
191
|
+
__table_args__ = {'schema': 'fiscal'}
|
|
192
|
+
|
|
193
|
+
integration_batch_id = Column('cd_integr', String(36), ForeignKey('fiscal.lote_integracao.cd_integr'),
|
|
194
|
+
primary_key=True, nullable=False)
|
|
195
|
+
integration_document_id = Column('cd_seq_doc_integr', Integer, ForeignKey('fiscal.documento_integracao'
|
|
196
|
+
'.no_seq_doc_integr'),
|
|
197
|
+
primary_key=True, nullable=False)
|
|
198
|
+
created_at = Column('dt_incl', DateTime, nullable=False)
|
|
199
|
+
|
|
200
|
+
integration_document = relationship('IntegrationDocument', back_populates='integration_batch')
|
|
201
|
+
|
|
202
|
+
def __init__(self, integration_batch_id, integration_document_id):
|
|
203
|
+
super().__init__()
|
|
204
|
+
self.integration_document_id = integration_document_id
|
|
205
|
+
self.integration_batch_id = integration_batch_id
|
|
206
|
+
self.created_at = datetime.now()
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
class KitObi(Base):
|
|
210
|
+
__tablename__ = 'kit_obi'
|
|
211
|
+
__table_args__ = {'schema': 'fiscal'}
|
|
212
|
+
|
|
213
|
+
kit_id = Column('no_seq_kit', Integer, primary_key=True, nullable=False)
|
|
214
|
+
kit_description = Column('ds_kit', String(150))
|
|
215
|
+
created_at = Column('dt_incl', DateTime, nullable=False)
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
class ObiAuthentication(Base):
|
|
219
|
+
__tablename__ = 'autenticacao_obi'
|
|
220
|
+
__table_args__ = {'schema': 'fiscal'}
|
|
221
|
+
|
|
222
|
+
id_obi_authentication = Column('no_seq_token', Integer, primary_key=True, nullable=False)
|
|
223
|
+
access_token = Column('ds_access_token_obi', Text, nullable=False)
|
|
224
|
+
expiration_date = Column('dt_hora_expir_token', DateTime, nullable=False)
|
|
225
|
+
created_date = Column('dt_hora_criacao_token', DateTime)
|
|
226
|
+
created_at = Column('dt_incl', DateTime, nullable=False)
|
|
227
|
+
|
|
228
|
+
def __init__(self, access_token, expiration_date):
|
|
229
|
+
super().__init__()
|
|
230
|
+
self.access_token = access_token
|
|
231
|
+
self.expiration_date = expiration_date
|
|
232
|
+
self.created_date = datetime.now()
|
|
233
|
+
self.created_at = datetime.now()
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
class KitIntegrationDocumentStatus(Base):
|
|
237
|
+
__tablename__ = 'kit_documento_integracao_status'
|
|
238
|
+
__table_args__ = {'schema': 'fiscal'}
|
|
239
|
+
|
|
240
|
+
document_id = Column('no_seq_doc_integr', Integer, ForeignKey('fiscal.documento_integracao.no_seq_doc_integr'),
|
|
241
|
+
primary_key=True, nullable=False)
|
|
242
|
+
kit_id = Column('no_seq_kit', Integer, ForeignKey('fiscal.kit_obi.no_seq_kit'),
|
|
243
|
+
primary_key=True, nullable=False)
|
|
244
|
+
integration_status = Column('ds_status_proc', String(20), nullable=False)
|
|
245
|
+
created_at = Column('dt_incl', DateTime, nullable=False)
|
|
246
|
+
|
|
247
|
+
integration_document = relationship(IntegrationDocument, back_populates="kit_integration_document_status")
|
|
248
|
+
|
|
249
|
+
def __init__(self, document_id, kit_id, integration_status):
|
|
250
|
+
super().__init__()
|
|
251
|
+
self.document_id = document_id
|
|
252
|
+
self.kit_id = kit_id
|
|
253
|
+
self.integration_status = integration_status
|
|
254
|
+
self.created_at = datetime.now()
|
|
File without changes
|