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