예제 #1
0
class Balance(db.Model):
    bid = db.Column(db.Integer, primary_key=True, nullable=False)
    product = db.Column(db.String(20), nullable=False)
    location = db.Column(db.String(20), nullable=False)
    quantity = db.Column(db.Integer, nullable=False)

    def __repr__(self):
        return f"Balance('{self.bid}','{self.product}','{self.location}','{self.quantity}')"
예제 #2
0
class Product(db.Model):
    prod_id = db.Column(db.Integer, primary_key=True)
    prod_name = db.Column(db.String(20), nullable=False)
    prod_name = db.Column(db.String(20), unique=True, nullable=False)
    prod_qty = db.Column(db.Integer, nullable=False)

    def __repr__(self):
        return f"Product('{self.prod_id}','{self.prod_name}','{self.prod_qty}')"
예제 #3
0
class Movement(db.Model):
    mid = db.Column(db.Integer, primary_key=True)
    ts = db.Column(db.DateTime, default=datetime.utcnow)
    frm = db.Column(db.String(20), nullable=False)
    to = db.Column(db.String(20), nullable=False)
    pname = db.Column(db.String(20), nullable=False)
    pqty = db.Column(db.Integer, nullable=False)

    def __repr__(self):
        return f"Movement('{self.mid}','{self.ts}','{self.frm}','{self.to}','{self.pname}','{self.pqty}')"
예제 #4
0
class Person(db.Model):
    db.__tablename__ = 'person'
    id = db.Column(db.Integer, primary_key=True, nullable=False)
    name = db.Column(db.String(20), nullable=False)
    lastname = db.Column(db.String(20), nullable=True)
    phone = db.Column(db.String, nullable=True)
    code = db.Column(db.String, nullable=False)
    sells = relationship("Sell", back_populates="person")

    def __repr__(self):
        return f"Balance('{self.bid}','{self.product}','{self.location}','{self.quantity}')"
예제 #5
0
class Location(db.Model):
    loc_id = db.Column(db.Integer, primary_key=True)
    loc_name = db.Column(db.String(20), unique=True, nullable=False)

    def __repr__(self):
        return f"Location('{self.loc_id}','{self.loc_name}')"
        return "Location('{self.loc_id}','{self.loc_name}')"
예제 #6
0
class Location(db.Model):
    db.__tablename__ = 'location'
    id = db.Column(db.Integer, primary_key=True)
    loc_name = db.Column(db.String(20), unique=True, nullable=False)
    sells = db.relationship("Sell", back_populates="location")
    stocks = db.relationship("Stock", back_populates="location")
    margin = db.relationship("Margin", back_populates="location")
    products = relationship("Product", back_populates="location")

    def __repr__(self):
        return f"Location('{self.id}','{self.loc_name}')"
예제 #7
0
class Product(db.Model):
    db.__tablename__ = 'product'
    id = db.Column(db.Integer, primary_key=True)
    price = db.Column(db.Integer)
    prod_name = db.Column(db.String(20), unique=True, nullable=False)
    loc_id = db.Column(db.Integer, db.ForeignKey('location.id'))
    location = relationship("Location", back_populates="products")
    margin = db.relationship("Margin", back_populates="product")
    kits = db.relationship("Kit", secondary=products_kits)
    stocks = db.relationship("Stock", back_populates="product")

    def __repr__(self):
        return f"Product('{self.id}','{self.prod_name}','{self.stocks[0].prod_qty}')"