Subversion Repositories SmartDukaan

Rev

Rev 477 | Rev 669 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
442 rajveer 1
'''
2
Created on 13-Sep-2010
3
 
4
@author: rajveer
5
'''
6
from elixir import *
7
import datetime
8
 
9
class Provider(Entity):
10
    id = Field(Integer, primary_key=True, autoincrement=True)
11
    name = Field(String(100))
644 chandransh 12
    email = Field(String(100))
13
    phone = Field(String(15))
14
    using_options(shortnames=True)
442 rajveer 15
 
644 chandransh 16
class Slab(Entity):
442 rajveer 17
    id = Field(Integer, primary_key=True, autoincrement=True)
644 chandransh 18
    description = Field(String(50))
19
    using_options(shortnames=True)
20
 
21
class Cost(Entity):
22
    provider = ManyToOne("Provider", primary_key=True)
23
    slab = ManyToOne("Slab", primary_key=True)
24
    cost = Field(Float)
25
    using_options(shortnames=True)
26
 
27
class Awb(Entity):
28
    id = Field(Integer, primary_key=True, autoincrement=True)
442 rajveer 29
    awb_number = Field(String(100))
644 chandransh 30
    provider = ManyToOne("Provider")
442 rajveer 31
    is_available = Field(Boolean)
644 chandransh 32
    type = Field(String(50))
33
    updates = OneToMany("AwbUpdate")
34
    using_options(shortnames=True)
442 rajveer 35
 
644 chandransh 36
class AwbUpdate(Entity):
442 rajveer 37
    id = Field(Integer, primary_key=True, autoincrement=True)
644 chandransh 38
    awb = ManyToOne("Awb")
39
    location = Field(String(50))
40
    entry_date = Field(DateTime)
442 rajveer 41
    description = Field(String(100))
644 chandransh 42
    comments = Field(String(100))
43
    using_options(shortnames=True)
442 rajveer 44
 
644 chandransh 45
class WarehouseAllocation(Entity):
46
    pincode = Field(String(6), primary_key=True)
47
    primary_warehouse_location = Field(Integer)
48
    using_options(shortnames=True)
442 rajveer 49
 
644 chandransh 50
class ServiceableLocationDetails(Entity):
51
    provider = ManyToOne("Provider", primary_key=True)
52
    dest_pincode = Field(String(6), primary_key=True)
53
    dest_code = Field(String(5))
54
    exp = Field(Boolean)
55
    cod = Field(Boolean)
56
    station_type = Field(Integer)
57
    using_options(shortnames=True)
477 rajveer 58
 
472 rajveer 59
class DeliveryEstimate(Entity):
644 chandransh 60
    destination_pin = Field(String(6), primary_key=True)
477 rajveer 61
    provider = ManyToOne("Provider", primary_key=True)
644 chandransh 62
    warehouse_location = Field(Integer, primary_key=True)
63
    #slab = ManyToOne("Slab")
472 rajveer 64
    delivery_time = Field(Integer)
644 chandransh 65
    reliability = Field(Integer)
66
    using_options(shortnames=True)
442 rajveer 67
 
68
def initialize():
69
    metadata.bind = "sqlite:///logistics.sqlite" #need to read it from configserver.
70
    metadata.bind.echo = True
71
    setup_all(True)
72
 
73
if __name__=="__main__":
74
    initialize()
75