| 122 |
ashish |
1 |
from shop2020.thriftpy.model.v1.catalog.ttypes import Item, status, Warehouse
|
|
|
2 |
import datetime
|
| 384 |
ashish |
3 |
from shop2020.clients.InventoryClient import InventoryClient
|
| 122 |
ashish |
4 |
from shop2020.utils.Utils import to_java_date
|
| 100 |
ashish |
5 |
|
| 384 |
ashish |
6 |
inventory_client = InventoryClient()
|
|
|
7 |
|
|
|
8 |
inventory_client.__start__()
|
|
|
9 |
|
|
|
10 |
client = inventory_client.get_client()
|
|
|
11 |
|
| 483 |
rajveer |
12 |
timestamp = to_java_date(datetime.datetime.now())
|
|
|
13 |
availability = {1:20}
|
|
|
14 |
|
|
|
15 |
|
| 494 |
rajveer |
16 |
warehouse = Warehouse()
|
| 483 |
rajveer |
17 |
|
| 494 |
rajveer |
18 |
warehouse.location = "SPICE RETAIL LTD. WZ-152-A/3, Main Najafgarh Road, Uttam Nagar, N.D.-110059"
|
|
|
19 |
warehouse.status = status.ACTIVE
|
|
|
20 |
warehouse.addedOn = to_java_date(datetime.datetime.now())
|
|
|
21 |
warehouse.lastCheckedOn = to_java_date(datetime.datetime.now())
|
|
|
22 |
warehouse.tinNumber = "07430284979"
|
|
|
23 |
warehouse.vendorString = "07430284979"
|
|
|
24 |
|
|
|
25 |
client.addWarehouse(warehouse)
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
'''
|
| 483 |
rajveer |
29 |
client.updateInventory(1, timestamp, availability)
|
|
|
30 |
|
| 494 |
rajveer |
31 |
|
| 384 |
ashish |
32 |
warehouse = Warehouse()
|
|
|
33 |
|
| 483 |
rajveer |
34 |
warehouse.location = "SPICE RETAIL LTD. WZ-152-A/3, Main Najafgarh Road, Uttam Nagar, N.D.-110059"
|
| 384 |
ashish |
35 |
warehouse.status = status.ACTIVE
|
|
|
36 |
warehouse.addedOn = to_java_date(datetime.datetime.now())
|
| 483 |
rajveer |
37 |
warehouse.lastCheckedOn = to_java_date(datetime.datetime.now())
|
|
|
38 |
warehouse.tinNumber = "07430284979"
|
| 384 |
ashish |
39 |
|
|
|
40 |
client.addWarehouse(warehouse)
|
| 483 |
rajveer |
41 |
#client.addWarehouse(warehouse)
|
| 384 |
ashish |
42 |
|
|
|
43 |
item = Item()
|
| 483 |
rajveer |
44 |
item.vendorItemId = 38574
|
| 384 |
ashish |
45 |
item.featureDescription = "Red colour"
|
|
|
46 |
item.featureId = 11
|
|
|
47 |
item.itemStatus = status.ACTIVE
|
| 472 |
rajveer |
48 |
item.catalogItemId = 1000120
|
|
|
49 |
item.weight = 65.2
|
| 384 |
ashish |
50 |
price_map = {}
|
| 472 |
rajveer |
51 |
price_map[1] = 8967.3
|
|
|
52 |
price_map[2] = 2010.3
|
| 384 |
ashish |
53 |
item.price = price_map
|
|
|
54 |
item.addedOn = to_java_date(datetime.datetime.now())
|
|
|
55 |
item.startDate = to_java_date(datetime.datetime.now())
|
|
|
56 |
client.addItem(item)
|
| 483 |
rajveer |
57 |
|
|
|
58 |
|
| 384 |
ashish |
59 |
'''
|
| 483 |
rajveer |
60 |
|
|
|
61 |
'''
|
| 384 |
ashish |
62 |
warehouse = Warehouse()
|
|
|
63 |
warehouse.location = "Delhi"
|
|
|
64 |
#print inventory_client.add_warehouse(warehouse)
|
|
|
65 |
|
|
|
66 |
timestamp = datetime.datetime.now()
|
|
|
67 |
print client.update_inventory(2, 2, 10, to_java_date(timestamp))
|
|
|
68 |
# item = inventory_client.get_item(2)
|
|
|
69 |
# print item
|
|
|
70 |
|
|
|
71 |
#items = inventory_client.get_all_active_items()
|
|
|
72 |
inventory = inventory_client.get_item_inventory(2)
|
|
|
73 |
print inventory
|
|
|
74 |
|
|
|
75 |
warehouses = inventory_client.get_all_warehouses(True)
|
|
|
76 |
|
|
|
77 |
print warehouses
|
|
|
78 |
|
|
|
79 |
warehouses = inventory_client.get_all_warehouses_for_item(2)
|
|
|
80 |
|
|
|
81 |
print warehouses
|
|
|
82 |
|
|
|
83 |
items = inventory_client.get_all_items_for_warehouse(2)
|
|
|
84 |
|
|
|
85 |
print items
|
|
|
86 |
'''
|