| 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))
|
| 5527 |
anupam.sin |
15 |
pickup = Field(Integer)
|
| 5387 |
rajveer |
16 |
isActive = Field(Boolean)
|
| 3044 |
chandransh |
17 |
details = OneToMany("ProviderDetails")
|
| 13146 |
manish.sha |
18 |
bundleWeightLimit = Field(Float)
|
|
|
19 |
groupShipmentAllowed = Field(Boolean)
|
|
|
20 |
maxCodLimit = Field(Float)
|
| 3044 |
chandransh |
21 |
using_options(shortnames=True)
|
|
|
22 |
using_table_options(mysql_engine="InnoDB")
|
|
|
23 |
|
|
|
24 |
class ProviderDetails(Entity):
|
|
|
25 |
provider = ManyToOne("Provider", primary_key=True)
|
|
|
26 |
type = Field(Integer, primary_key=True, autoincrement=False)
|
| 7792 |
anupam.sin |
27 |
logisticLocation = Field(Integer, primary_key=True, autoincrement=False)
|
| 669 |
chandransh |
28 |
accountNo = Field(String(10))
|
| 644 |
chandransh |
29 |
email = Field(String(100))
|
| 7792 |
anupam.sin |
30 |
phone = Field(String(15))
|
| 20837 |
amit.gupta |
31 |
active = Field(Boolean)
|
| 644 |
chandransh |
32 |
using_options(shortnames=True)
|
| 746 |
rajveer |
33 |
using_table_options(mysql_engine="InnoDB")
|
| 3044 |
chandransh |
34 |
|
| 644 |
chandransh |
35 |
class Awb(Entity):
|
|
|
36 |
id = Field(Integer, primary_key=True, autoincrement=True)
|
| 442 |
rajveer |
37 |
awb_number = Field(String(100))
|
| 644 |
chandransh |
38 |
provider = ManyToOne("Provider")
|
| 442 |
rajveer |
39 |
is_available = Field(Boolean)
|
| 644 |
chandransh |
40 |
type = Field(String(50))
|
| 13146 |
manish.sha |
41 |
awbUsedFor = Field(Integer)
|
| 644 |
chandransh |
42 |
using_options(shortnames=True)
|
| 746 |
rajveer |
43 |
using_table_options(mysql_engine="InnoDB")
|
| 442 |
rajveer |
44 |
|
| 644 |
chandransh |
45 |
class AwbUpdate(Entity):
|
| 6643 |
rajveer |
46 |
providerId = Field(Integer, primary_key=True, autoincrement=False)
|
|
|
47 |
awbNumber = Field(String(50), primary_key=True, autoincrement=False)
|
|
|
48 |
location = Field(String(50), primary_key=True, autoincrement=False)
|
|
|
49 |
date = Field(DateTime, primary_key=True, autoincrement=False)
|
|
|
50 |
status = Field(String(100), primary_key=True, autoincrement=False)
|
|
|
51 |
description = Field(String(100), primary_key=True, autoincrement=False)
|
| 644 |
chandransh |
52 |
using_options(shortnames=True)
|
| 746 |
rajveer |
53 |
using_table_options(mysql_engine="InnoDB")
|
| 442 |
rajveer |
54 |
|
| 644 |
chandransh |
55 |
class WarehouseAllocation(Entity):
|
|
|
56 |
pincode = Field(String(6), primary_key=True)
|
|
|
57 |
primary_warehouse_location = Field(Integer)
|
|
|
58 |
using_options(shortnames=True)
|
| 746 |
rajveer |
59 |
using_table_options(mysql_engine="InnoDB")
|
|
|
60 |
|
| 644 |
chandransh |
61 |
class ServiceableLocationDetails(Entity):
|
|
|
62 |
provider = ManyToOne("Provider", primary_key=True)
|
|
|
63 |
dest_pincode = Field(String(6), primary_key=True)
|
| 731 |
chandransh |
64 |
dest_code = Field(String(10))
|
| 644 |
chandransh |
65 |
exp = Field(Boolean)
|
|
|
66 |
cod = Field(Boolean)
|
|
|
67 |
station_type = Field(Integer)
|
| 6537 |
rajveer |
68 |
otgAvailable = Field(Boolean, default=0, server_default="0")
|
| 7491 |
rajveer |
69 |
providerCodLimit = Field(Integer)
|
|
|
70 |
websiteCodLimit = Field(Integer)
|
|
|
71 |
storeCodLimit = Field(Integer)
|
| 7627 |
rajveer |
72 |
providerPrepaidLimit = Field(Integer)
|
| 644 |
chandransh |
73 |
using_options(shortnames=True)
|
| 746 |
rajveer |
74 |
using_table_options(mysql_engine="InnoDB")
|
| 477 |
rajveer |
75 |
|
| 472 |
rajveer |
76 |
class DeliveryEstimate(Entity):
|
| 644 |
chandransh |
77 |
destination_pin = Field(String(6), primary_key=True)
|
| 477 |
rajveer |
78 |
provider = ManyToOne("Provider", primary_key=True)
|
| 746 |
rajveer |
79 |
warehouse_location = Field(Integer, primary_key=True, autoincrement=False)
|
| 472 |
rajveer |
80 |
delivery_time = Field(Integer)
|
| 6537 |
rajveer |
81 |
delivery_delay = Field(Integer, default=0, server_default="0")
|
| 19421 |
manish.sha |
82 |
providerZoneCode = Field(String(20))
|
| 644 |
chandransh |
83 |
using_options(shortnames=True)
|
| 746 |
rajveer |
84 |
using_table_options(mysql_engine="InnoDB")
|
| 1504 |
ankur.sing |
85 |
|
| 1730 |
ankur.sing |
86 |
class PublicHolidays(Entity):
|
|
|
87 |
date = Field(Date, primary_key=True)
|
|
|
88 |
occasion = Field(String(100))
|
|
|
89 |
using_options(shortnames=True)
|
|
|
90 |
using_table_options(mysql_engine="InnoDB")
|
| 19413 |
amit.gupta |
91 |
|
|
|
92 |
class Locations(Entity):
|
|
|
93 |
id = Field(Integer, primary_key=True)
|
|
|
94 |
state_id = Field(Integer)
|
|
|
95 |
label = Field(String(50))
|
|
|
96 |
description = Field(String(100))
|
|
|
97 |
using_options(shortnames=True)
|
|
|
98 |
using_table_options(mysql_engine="InnoDB")
|
| 5555 |
rajveer |
99 |
|
|
|
100 |
class PickupStore(Entity):
|
|
|
101 |
id = Field(Integer, primary_key=True)
|
| 5719 |
rajveer |
102 |
hotspotId = Field(String(3))
|
| 5555 |
rajveer |
103 |
name = Field(String(100))
|
|
|
104 |
line_1 = Field(String(100))
|
|
|
105 |
line_2 = Field(String(100))
|
|
|
106 |
city = Field(String(100))
|
|
|
107 |
state = Field(String(100))
|
|
|
108 |
pin = Field(String(10))
|
|
|
109 |
phone = Field(String(20))
|
| 5863 |
rajveer |
110 |
email = Field(String(100))
|
| 5739 |
rajveer |
111 |
zone = Field(String(30))
|
| 5813 |
rajveer |
112 |
bdm = Field(String(100))
|
|
|
113 |
bdmEmail = Field(String(100))
|
| 5555 |
rajveer |
114 |
using_options(shortnames=True)
|
|
|
115 |
using_table_options(mysql_engine="InnoDB")
|
| 19421 |
manish.sha |
116 |
|
|
|
117 |
class ProviderCosting(Entity):
|
|
|
118 |
provider = ManyToOne("Provider", primary_key=True)
|
|
|
119 |
zoneCode = Field(String(20), primary_key=True)
|
|
|
120 |
zoneCodeDescription = Field(String(256))
|
|
|
121 |
initialWeightUpperLimit = Field(Float)
|
|
|
122 |
initialLogisticsCost = Field(Float)
|
|
|
123 |
additionalUnitWeight = Field(Float)
|
|
|
124 |
additionalUnitLogisticsCost = Field(Float)
|
|
|
125 |
minimumCodCollectionCharges = Field(Float)
|
|
|
126 |
codCollectionFactor = Field(Float, default=0)
|
|
|
127 |
using_options(shortnames=True)
|
|
|
128 |
using_table_options(mysql_engine="InnoDB")
|
| 20745 |
kshitij.so |
129 |
|
|
|
130 |
class BluedartAttribute(Entity):
|
| 20769 |
kshitij.so |
131 |
logisticsTransactionId = Field(String(100))
|
| 20745 |
kshitij.so |
132 |
name = Field(String(100))
|
|
|
133 |
value = Field(String(100))
|
|
|
134 |
using_options(shortnames=True)
|
|
|
135 |
using_table_options(mysql_engine="InnoDB")
|
| 6524 |
rajveer |
136 |
|
| 21093 |
amit.gupta |
137 |
class PincodeStates(Entity):
|
|
|
138 |
pin = Field(Integer(6), primary_key=True)
|
| 21097 |
amit.gupta |
139 |
statename = Field(String(64))
|
| 21093 |
amit.gupta |
140 |
using_options(shortnames=True)
|
|
|
141 |
using_table_options(mysql_engine="InnoDB")
|
|
|
142 |
|
| 19426 |
manish.sha |
143 |
def initialize(dbname="logistics",db_hostname="localhost", echoOn=True, setup=True):
|
| 746 |
rajveer |
144 |
#metadata.bind = "sqlite:///logistics.sqlite" #need to read it from configserver.
|
| 3187 |
rajveer |
145 |
engine = create_engine('mysql://root:shop2020@' + db_hostname + '/' + dbname, pool_recycle=7200)
|
| 1131 |
chandransh |
146 |
metadata.bind = engine
|
| 19426 |
manish.sha |
147 |
metadata.bind.echo = echoOn
|
|
|
148 |
setup_all(setup)
|
| 442 |
rajveer |
149 |
|
|
|
150 |
if __name__=="__main__":
|
|
|
151 |
initialize()
|
|
|
152 |
|