| Line 7... |
Line 7... |
| 7 |
from elixir.entity import Entity
|
7 |
from elixir.entity import Entity
|
| 8 |
from elixir.fields import Field
|
8 |
from elixir.fields import Field
|
| 9 |
from elixir.options import using_options, using_table_options
|
9 |
from elixir.options import using_options, using_table_options
|
| 10 |
from elixir.relationships import OneToMany, ManyToOne
|
10 |
from elixir.relationships import OneToMany, ManyToOne
|
| 11 |
from sqlalchemy import create_engine
|
11 |
from sqlalchemy import create_engine
|
| 12 |
from sqlalchemy.types import Integer, String, DateTime, Float, Boolean, Enum, Date
|
12 |
from sqlalchemy.types import Integer, String, DateTime, Float, Boolean, Enum, Date, Text
|
| 13 |
import datetime
|
13 |
import datetime
|
| 14 |
|
- |
|
| 15 |
class Vendor(Entity):
|
14 |
class Vendor(Entity):
|
| 16 |
id = Field(Integer, primary_key=True, autoincrement=True)
|
15 |
id = Field(Integer, primary_key=True, autoincrement=True)
|
| 17 |
name = Field(String(50))
|
16 |
name = Field(String(50))
|
| 18 |
warehouses = OneToMany('Warehouse')
|
17 |
warehouses = OneToMany('Warehouse')
|
| 19 |
using_options(shortnames=True)
|
18 |
using_options(shortnames=True)
|
| Line 53... |
Line 52... |
| 53 |
warehouseType = Field(Enum('OURS', 'THIRD_PARTY'))
|
52 |
warehouseType = Field(Enum('OURS', 'THIRD_PARTY'))
|
| 54 |
shippingWarehouseId = Field(Integer)
|
53 |
shippingWarehouseId = Field(Integer)
|
| 55 |
billingWarehouseId = Field(Integer)
|
54 |
billingWarehouseId = Field(Integer)
|
| 56 |
transferDelayInHours = Field(Integer)
|
55 |
transferDelayInHours = Field(Integer)
|
| 57 |
isAvailabilityMonitored = Field(Boolean)
|
56 |
isAvailabilityMonitored = Field(Boolean)
|
| - |
|
57 |
source = Field(Integer)
|
| 58 |
using_options(shortnames=True)
|
58 |
using_options(shortnames=True)
|
| 59 |
using_table_options(mysql_engine="InnoDB")
|
59 |
using_table_options(mysql_engine="InnoDB")
|
| 60 |
|
60 |
|
| 61 |
def __repr__(self):
|
61 |
def __repr__(self):
|
| 62 |
return "<warehouse>%s</warehouse>" %(self.location)
|
62 |
return "<warehouse>%s</warehouse>" %(self.location)
|
| Line 228... |
Line 228... |
| 228 |
availability = Field(Integer)
|
228 |
availability = Field(Integer)
|
| 229 |
date = Field(DateTime, primary_key=True,autoincrement=False)
|
229 |
date = Field(DateTime, primary_key=True,autoincrement=False)
|
| 230 |
using_options(shortnames=True)
|
230 |
using_options(shortnames=True)
|
| 231 |
using_table_options(mysql_engine="InnoDB")
|
231 |
using_table_options(mysql_engine="InnoDB")
|
| 232 |
|
232 |
|
| - |
|
233 |
class StockWeightedNlcInfo(Entity):
|
| - |
|
234 |
itemId = Field(Integer, primary_key=True,autoincrement=False)
|
| - |
|
235 |
source = Field(Integer, primary_key=True,autoincrement=False)
|
| - |
|
236 |
updatedTimestamp = Field(DateTime, primary_key=True,autoincrement=False)
|
| - |
|
237 |
grnDetail = Field(Text)
|
| - |
|
238 |
stockQuantity = Field(Integer)
|
| - |
|
239 |
avgWeightedNlc = Field(Float)
|
| - |
|
240 |
using_options(shortnames=True)
|
| - |
|
241 |
using_table_options(mysql_engine="InnoDB")
|
| 233 |
|
242 |
|
| 234 |
def initialize(dbname='inventory', db_hostname="localhost"):
|
243 |
def initialize(dbname='inventory', db_hostname="localhost"):
|
| 235 |
#metadata.bind = "sqlite:///inventory-new.sqlite" #need to read it from configserver.
|
244 |
#metadata.bind = "sqlite:///inventory-new.sqlite" #need to read it from configserver.
|
| 236 |
#metadata.bind = 'mysql://root:shop2020@localhost/inventory'
|
245 |
#metadata.bind = 'mysql://root:shop2020@localhost/inventory'
|
| 237 |
iengine = create_engine('mysql://root:shop2020@' + db_hostname + '/' + dbname, pool_recycle=7200)
|
246 |
iengine = create_engine('mysql://root:shop2020@' + db_hostname + '/' + dbname, pool_recycle=7200)
|