Subversion Repositories SmartDukaan

Rev

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