Add FloorSection and ProductPhysicalLocation models

This commit is contained in:
Lance Edgar 2020-03-30 13:06:53 -05:00
parent acc85ba8de
commit 64e4b18cf0

View file

@ -571,6 +571,75 @@ class ScaleItem(Base):
# origin_text = sa.Column('originText', sa.String(length=100), nullable=True) # origin_text = sa.Column('originText', sa.String(length=100), nullable=True)
class FloorSection(Base):
"""
Represents a physical "floor section" within a store.
"""
__tablename__ = 'FloorSections'
floorSectionID = sa.Column(sa.Integer(), primary_key=True, autoincrement=True, nullable=False)
id = orm.synonym('floorSectionID')
store_id = sa.Column('storeID', sa.Integer(), nullable=True, default=1)
name = sa.Column(sa.String(length=50), nullable=True)
# TODO: this was not in some older DBs
# map_x = sa.Column('mapX', sa.Integer(), nullable=True, default=0)
# TODO: this was not in some older DBs
# map_y = sa.Column('mapY', sa.Integer(), nullable=True, default=0)
# TODO: this was not in some older DBs
# map_rotate = sa.Column('mapRotate', sa.Integer(), nullable=True, default=0)
class ProductPhysicalLocation(Base):
"""
Represents a physical location for a product
"""
__tablename__ = 'prodPhysicalLocation'
__table_args__ = (
sa.ForeignKeyConstraint(['floorSectionID'], ['FloorSections.floorSectionID']),
)
upc = sa.Column(sa.String(length=13), primary_key=True, nullable=False)
product = orm.relationship(
Product,
primaryjoin=Product.upc == upc,
foreign_keys=[upc],
doc="""
Reference to the :class:`Product` to which this record applies.
""",
backref=orm.backref(
'physical_location',
uselist=False,
doc="""
Reference to the :class:`ProductPhysicalLocation` record for this
product.
"""))
store_id = sa.Column(sa.SmallInteger(), nullable=True, default=0)
floor_section_id = sa.Column('floorSectionID', sa.Integer(), nullable=True)
floor_section = orm.relationship(
FloorSection,
doc="""
Reference to the :class:`FloorSection` with which this location is
associated.
""")
section = sa.Column(sa.SmallInteger(), nullable=True, default=0)
subsection = sa.Column(sa.SmallInteger(), nullable=True, default=0)
shelf_set = sa.Column(sa.SmallInteger(), nullable=True, default=0)
shelf = sa.Column(sa.SmallInteger(), nullable=True, default=0)
location = sa.Column(sa.SmallInteger(), nullable=True, default=0)
class Employee(Base): class Employee(Base):
""" """
Represents an employee within the organization. Represents an employee within the organization.