Skip to content

Instantly share code, notes, and snippets.

@nhwaani
Created June 4, 2020 15:13
Show Gist options
  • Save nhwaani/f59430f9cc50cc8b10f588831a865ba2 to your computer and use it in GitHub Desktop.
Save nhwaani/f59430f9cc50cc8b10f588831a865ba2 to your computer and use it in GitHub Desktop.
class TransferDocument(Model):
__tablename__ = 'transfer_document'
id_transfer_document = sa.Column(sa.BIGINT, primary_key=True)
id_warehouse = sa.Column(sa.Integer,nullable=False)
id_partner = sa.Column(sa.Integer, nullable=False)
doc_nr = sa.Column(sa.String(100),nullable=False, unique=True)
doc_type = sa.Column(sa.String(50), nullable=False)
doc_ref = sa.Column(sa.String(100), nullable=False)
zone_src = sa.Column(sa.String(100),nullable=False)
is_posted = sa.Column(sa.Boolean, nullable=False)
created_at = sa.Column(types.TIMESTAMP, server_default=text('CURRENT_TIMESTAMP'), nullable=False)
updated_at = sa.Column(types.TIMESTAMP, server_default=text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), nullable=False)
__table_args__ = (
UniqueConstraint('id_warehouse', 'doc_nr', name='uq_warehouse_doc_nr'),
UniqueConstraint('doc_nr', 'doc_type', name='uq_doc_nr_doc_type'),
)
class TransferDocumentLines(Model):
__tablename__ = 'transfer_document_lines'
id_transfer_document_lines = sa.Column(sa.BIGINT, primary_key=True)
id_transfer_document = sa.Column(sa.BIGINT,nullable=False)
barcode = sa.Column(sa.String(100), nullable=False)
created_at = sa.Column(types.TIMESTAMP, server_default=text('CURRENT_TIMESTAMP'), nullable=False)
updated_at = sa.Column(types.TIMESTAMP, server_default=text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), nullable=False)
class TransferDocumentType(Model):
_tablename__ = 'transfer_document_type'
id_transfer_document_type = sa.Column(sa.BIGINT, primary_key=True)
code = sa.Column(sa.String(100),nullable=False) #RTV ASN
max_limit_units = sa.Column(sa.Integer, nullable=False)
min_limit_uints = sa.Column(sa.Integer, nullable=False)
breach_time = sa.Column(sa.Integer, nullable=False) # Days so to stop creating more docs
class TransferDocumentCapacity(Model):
_tablename__ = 'transfer_document_capacity'
id_transfer_document_capacity = sa.Column(sa.BIGINT, primary_key=True)
id_partner = sa.Column(sa.Integer, nullable=False)
id_transfer_document_type = sa.Column(sa.BIGINT, nullable=False)
units_allowed = sa.Column(sa.Integer, nullable=True) # used to stop partners to send more units if still have lot of rtvs pending
created_at = sa.Column(types.TIMESTAMP, server_default=text('CURRENT_TIMESTAMP'), nullable=False)
updated_at = sa.Column(types.TIMESTAMP, server_default=text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), nullable=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment