| 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))
|
|
|
12 |
awb = OneToMany("AWB")
|
|
|
13 |
|
|
|
14 |
class AWB(Entity):
|
|
|
15 |
id = Field(Integer, primary_key=True, autoincrement=True)
|
|
|
16 |
awb_number = Field(String(100))
|
|
|
17 |
is_available = Field(Boolean)
|
|
|
18 |
provider = ManyToOne("Provider")
|
|
|
19 |
#shipment = OneToOne("Shipment", inverse="awb")
|
|
|
20 |
|
|
|
21 |
class ShipmentUpdate(Entity):
|
|
|
22 |
id = Field(Integer, primary_key=True, autoincrement=True)
|
|
|
23 |
pin = Field(String(20))
|
|
|
24 |
timestamp = Field(DateTime)
|
|
|
25 |
description = Field(String(100))
|
|
|
26 |
#awb = ManyToOne("AWB")
|
|
|
27 |
shipment = ManyToOne("Shipment")
|
|
|
28 |
|
|
|
29 |
class Shipment(Entity):
|
|
|
30 |
id = Field(Integer, primary_key=True, autoincrement=True)
|
|
|
31 |
warehouse_name = Field(String(100))
|
|
|
32 |
awb = Field(String(100))
|
|
|
33 |
origin = Field(String(100))
|
|
|
34 |
destination = Field(String(100))
|
|
|
35 |
timestamp = Field(DateTime)
|
|
|
36 |
recepient_name = Field(String(100))
|
|
|
37 |
recepient_address = Field(String(200))
|
|
|
38 |
recepient_pincode = Field(String(20))
|
|
|
39 |
recepient_phone = Field(String(20))
|
|
|
40 |
shipment_weight = Field(String(20))
|
|
|
41 |
shipment_contents = Field(String(100))
|
|
|
42 |
status_message = Field(String(100))
|
|
|
43 |
#awb = ManyToOne("AWB")
|
|
|
44 |
shipment_update = OneToMany("ShipmentUpdate")
|
|
|
45 |
|
|
|
46 |
'''
|
|
|
47 |
struct Shipment{
|
|
|
48 |
1:string warehouse_id,
|
|
|
49 |
2:string awb,
|
|
|
50 |
3:string origin,
|
|
|
51 |
4:string destination,
|
|
|
52 |
5:i64 timestamp,
|
|
|
53 |
6:string recepient_name,
|
|
|
54 |
7:string recepient_address,
|
|
|
55 |
8:string recepient_pincode,
|
|
|
56 |
9:string recepient_phone,
|
|
|
57 |
10:string shipment_weight,
|
|
|
58 |
11:string shipment_contents
|
|
|
59 |
}
|
|
|
60 |
'''
|
|
|
61 |
|
|
|
62 |
def initialize():
|
|
|
63 |
metadata.bind = "sqlite:///logistics.sqlite" #need to read it from configserver.
|
|
|
64 |
metadata.bind.echo = True
|
|
|
65 |
setup_all(True)
|
|
|
66 |
|
|
|
67 |
if __name__=="__main__":
|
|
|
68 |
initialize()
|
|
|
69 |
|