Subversion Repositories SmartDukaan

Rev

Rev 731 | Rev 1131 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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