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