Subversion Repositories SmartDukaan

Rev

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

Rev 22059 Rev 22119
Line 11... Line 11...
11
from shop2020.clients.PurchaseClient import PurchaseClient
11
from shop2020.clients.PurchaseClient import PurchaseClient
12
from shop2020.clients.TransactionClient import TransactionClient
12
from shop2020.clients.TransactionClient import TransactionClient
13
from shop2020.clients.UserClient import UserClient
13
from shop2020.clients.UserClient import UserClient
14
from shop2020.model.v1.catalog.impl import DataService
14
from shop2020.model.v1.catalog.impl import DataService
15
from shop2020.model.v1.catalog.impl.DataService import CentralGstMaster, \
15
from shop2020.model.v1.catalog.impl.DataService import CentralGstMaster, \
16
    StateGstMaster
16
    StateGstMaster, Category, CategoryHsnCodes
17
from shop2020.thriftpy.model.v1.order.ttypes import TransactionStatus
17
from shop2020.thriftpy.model.v1.order.ttypes import TransactionStatus
18
from sqlalchemy import desc, asc
18
from sqlalchemy import desc, asc
19
from sqlalchemy.orm import aliased
19
from sqlalchemy.orm import aliased
20
from sqlalchemy.sql.expression import or_, distinct, func, and_, exists
20
from sqlalchemy.sql.expression import or_, distinct, func, and_, exists
21
from sqlalchemy.sql.functions import now
21
from sqlalchemy.sql.functions import now
22
 
22
 
23
 
23
 
-
 
24
def getCategories():
-
 
25
    
-
 
26
    categories = session.query(Category).all()
-
 
27
    rootCategory = 10000
-
 
28
    l1 = []
-
 
29
    for category in categories:
-
 
30
        if category.parent_category_id == rootCategory:
-
 
31
            l1.append(category.id)
-
 
32
            
-
 
33
    leaves = []
-
 
34
    for category in categories:
-
 
35
        if category.parent_category_id in l1:
-
 
36
            leaves.append(category)
-
 
37
 
-
 
38
    for leaf in leaves:
-
 
39
        print "({}, '{}')".format(leaf.id, leaf.label) 
-
 
40
        
-
 
41
def getChildCategories(rootCategory, categories):
-
 
42
    childCategories = []
-
 
43
    
24
 
44
 
25
def addHsnCodes():
45
def addHsnCodes():
-
 
46
    gstTuple = [
-
 
47
                (10027, 'Power Bank', '85076000', 28),
-
 
48
                (10030, 'Cables', '85183000', 28),
-
 
49
                (10024, 'Ear Buds', '85444220', 18),
26
    hsnCodesRateMap={'39269099':28,'39269099':28,'42022190':28,'84713090':18,'85044090':28,'85171210':12,'85171290':12,'85176290':18,'85182900':18,'85183000':18,'85235100':28,'85441990':28}
50
                (12101, 'Fitness Band', '90318000', 18)
-
 
51
            ]
27
    
52
    
-
 
53
    
-
 
54
    
28
    for hsnCode, rate in hsnCodesRateMap.iteritems():
55
    for (categoryId, description, hsnCode, rate)  in gstTuple:
-
 
56
        categoryHsnCode = session.query(CategoryHsnCodes).filter(CategoryHsnCodes.hsnCode==hsnCode).first()
-
 
57
        if categoryHsnCode:
-
 
58
            categoryHsnCode.categoryId = categoryId
-
 
59
            categoryHsnCode.description = description
-
 
60
        else:
-
 
61
            categoryHsnCode = CategoryHsnCodes()
-
 
62
            categoryHsnCode.hsnCode = hsnCode
-
 
63
            categoryHsnCode.categoryId = categoryId
-
 
64
            categoryHsnCode.description = description
-
 
65
        
29
        cgs = session.query(CentralGstMaster).filter(CentralGstMaster.hsnCode==hsnCode).filter(CentralGstMaster.gstPercent==rate).first()
66
        cgs = session.query(CentralGstMaster).filter(CentralGstMaster.hsnCode==hsnCode).filter(CentralGstMaster.gstPercent==rate).first()
30
        if cgs is None:
67
        if cgs is None:
31
            cgs = CentralGstMaster()
68
            cgs = CentralGstMaster()
32
            cgs.hsnCode = hsnCode
69
            cgs.hsnCode = hsnCode
33
            cgs.gstPercent = rate
70
            cgs.gstPercent = rate
Line 62... Line 99...
62
#uc = UserClient().get_client()
99
#uc = UserClient().get_client()
63
#print uc.getCounterByUserId(120398953)
100
#print uc.getCounterByUserId(120398953)
64
 
101
 
65
def main():
102
def main():
66
    pass
103
    pass
67
    #DataService.initialize('catalog', 'localhost', False)
104
    DataService.initialize('catalog', '173.255.254.24', False)
68
    #addHsnCodes()
105
    addHsnCodes()
-
 
106
    #getCategories()
69
 
107
 
70
#tc = TransactionClient().get_client()
108
#tc = TransactionClient().get_client()
71
#tc.changeTransactionStatus(699979, TransactionStatus.COD_IN_PROCESS, "COD in Process", 0, 0, 1)
109
#tc.changeTransactionStatus(699979, TransactionStatus.COD_IN_PROCESS, "COD in Process", 0, 0, 1)
72
#tc.verifyOrderForTransaction(699983)
110
#tc.verifyOrderForTransaction(699983)
73
#tc.acceptOrder(748108)
111
#tc.acceptOrder(748108)
74
#tc.addBillingDetailsForGrouppedOrders([748108], 'AMIT2', {748108:'1'}, {748108:['443423432431', '443423432432']}, {}, 'dl-ad-adonis', 1, 0, False, 'BulkInvoice')
112
#tc.addBillingDetailsForGrouppedOrders([748108], 'AMIT2', {748108:'1'}, {748108:['443423432431', '443423432432']}, {}, 'dl-ad-adonis', 1, 0, False, 'BulkInvoice')
75
                                        #order_ids, invoice_number, itemNumbersMap, serialNumbersMap, {}, 'mp-mmx-admin', 1, 0, False, 'Individual'
113
                                        #order_ids, invoice_number, itemNumbersMap, serialNumbersMap, {}, 'mp-mmx-admin', 1, 0, False, 'Individual'
76
 
114
 
77
tc = TransactionClient().get_client()
115
#tc = TransactionClient().get_client()
78
print tc.getLatestUserWalletHistory(483649, 0, 20)
116
#print tc.getLatestUserWalletHistory(483649, 0, 20)
-
 
117
 
-
 
118
 
-
 
119
#tupleList = [
-
 
120
#(10006, 'Mobile Phone')
-
 
121
#(10008, 'Codless Phones')
-
 
122
#(10010, 'Tablets')
-
 
123
#(10012, 'Bluetooth Headset')
-
 
124
#(10013, 'Memory Card')
-
 
125
#(10014, 'Battery')
-
 
126
#(10015, 'Headset')
-
 
127
#(10016, 'Charger')
-
 
128
#(10017, 'Pen Drive')
-
 
129
#(10018, 'Carrying Case')
-
 
130
#(10019, 'Car Charger')
-
 
131
#(10020, 'Screen Guard')
-
 
132
#(10021, 'Face Plate')
-
 
133
#(10022, 'Decal')
-
 
134
#(10023, 'Data Cable')
-
 
135
#(10024, 'Ear Buds')
-
 
136
#(10025, 'Cleaning Kit')
-
 
137
#(10026, 'Speaker')
-
 
138
#(10027, 'Power Bank')
-
 
139
#(10028, 'AUX Cable')
-
 
140
#(10029, 'Vehiclle Mounts')
-
 
141
#(10030, 'Cables')
-
 
142
#(10032, 'LED Lights')
-
 
143
#(10050, 'Laptops')
-
 
144
#(10071, 'RAM')
-
 
145
#(10072, 'Cooling Stands')
-
 
146
#(10073, 'External Hard Disks')
-
 
147
#(10074, 'USB Hubs')
-
 
148
#(10075, 'Solid State Drives')
-
 
149
#(10076, 'Wi-Fi Routers')
-
 
150
#(10077, 'Laptop Batteries')
-
 
151
#(10078, 'Antivirus')
-
 
152
#(10079, 'Office Packs')
-
 
153
#(10080, 'Keyboards')
-
 
154
#(10081, 'Mouse')
-
 
155
#(10082, 'Headphones')
-
 
156
#(10083, 'Data Card')
-
 
157
#(10084, 'Mouse pads')
-
 
158
#(10085, 'Laptop bags')
-
 
159
#(10086, 'Laptop Chargers')
-
 
160
#(10087, 'Printer cartridges')
-
 
161
#(10088, 'TV Tuner')
-
 
162
#(10089, 'USB Light')
-
 
163
#(10090, 'Card Reader')
-
 
164
#(10091, 'USB Devices')
-
 
165
#(11002, 'Compact Cameras')
-
 
166
#(11003, 'DSLR Cameras')
-
 
167
#(12002, 'Portable Music Players')
-
 
168
#(12101, 'Smart Watches')
-
 
169
#(12102, 'Corded Phones')
-
 
170
#(12103, 'Screen Magnifier')
-
 
171
#(12104, 'Mobile Holder')
-
 
172
#(12105, 'Selfie Stick')
-
 
173
#(13101, 'Projectors')
-
 
174
#(14101, 'Scanners')
-
 
175
#(14201, 'DVD Player')
-
 
176
#(14202, 'LED TV')
-
 
177
#(14203, 'LCD TV')
-
 
178
#(14204, 'Home Theater')
-
 
179
#(14205, 'Karaoke')
-
 
180
#(14206, 'Radio')
-
 
181
#(14207, 'Lens')
-
 
182
#(14208, 'Boom Box')
-
 
183
#(14301, 'Watch Strap')
-
 
184
#(14401, 'Gaming Consoles')
-
 
185
#(14501, 'Power Sockets')
-
 
186
#(14601, 'Remote')
-
 
187
#(15001, 'Trimmers')
-
 
188
#(15002, 'Shavers')
-
 
189
#(15003, 'Hair Dryers')
-
 
190
#(15004, 'Hair Stylers')
-
 
191
#(15005, 'Epilators')
-
 
192
#(15006, 'Hair Straightners')
-
 
193
#(15007, 'Hair  Curlers')
-
 
194
#(15008, 'Grooming Kits')
-
 
195
#(15009, 'Clippers')
-
 
196
#(15101, 'Microwave Ovens and OTG')
-
 
197
#(15102, 'Juicer, Mixer, Grinder')
-
 
198
#(15103, 'Food Processors')
-
 
199
#(15104, 'Choppers and Blenders')
-
 
200
#(15105, 'Cookers and Steamers')
-
 
201
#(15106, 'Induction Cooktops')
-
 
202
#(15107, 'Toasters and Sandwich Makers')
-
 
203
#(15108, 'Grills and Tandoors')
-
 
204
#(15109, 'Coffee Maker and Kettles')
-
 
205
#(15110, 'Air Fryers')
-
 
206
#(15111, 'Chimney and Hoods')
-
 
207
#(15112, 'Gas Stoves and Hobs')
-
 
208
#(15113, 'Roti Maker and Snack Maker')
-
 
209
#(15301, 'Irons')
-
 
210
#(15302, 'Vacuum Cleaners')
-
 
211
#(15303, 'Lighting')
-
 
212
#(15304, 'Air Purifiers')
-
 
213
#(15305, 'Water Purifiers')
-
 
214
#(15306, 'Dish Washers')
-
 
215
#(16001, 'Power and Hand Tool Kits')
-
 
216
#(16002, 'Drills')
-
 
217
#(16003, 'Power Planes')
-
 
218
#(16004, 'Sanders and Polishers')
-
 
219
#(16005, 'Soldering Irons')
-
 
220
#(16006, 'Nailers and Staplers')
-
 
221
#(16007, 'Blowers')
-
 
222
#(16101, 'Hammers')
-
 
223
#(16102, 'Axes')
-
 
224
#(16103, 'Clamps')
-
 
225
#(16104, 'Crimpers')
-
 
226
#(16105, 'Chisels and Sets')
-
 
227
#(16106, 'Socket Sets')
-
 
228
#(16107, 'Cutters and Snips')
-
 
229
#(16108, 'Power and Hand Tool Kits')
-
 
230
#(16109, 'Wrenches and Sets')
-
 
231
#(16110, 'Pliers')
-
 
232
#(16111, 'Locks')
-
 
233
#(16112, 'Screwdrivers and Allen Keys')
-
 
234
#(16113, 'Handsaws and Sets')
-
 
235
#(16201, 'Calipers')
-
 
236
#(16202, 'Level Measuring Instruments')
-
 
237
#]
-
 
238
 
-
 
239
 
79
                                        
240
                                        
80
                                        
241
                                        
81
if __name__ == "__main__":
242
if __name__ == "__main__":
82
    main()
-
 
83
243
    main()
-
 
244
    
-
 
245
 
-
 
246
 
-
 
247
 
-
 
248