| 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 |
|
|
|
12 |
warehouse = Warehouse()
|
|
|
13 |
|
|
|
14 |
warehouse.location = "Delhi"
|
|
|
15 |
warehouse.status = status.ACTIVE
|
|
|
16 |
warehouse.addedOn = to_java_date(datetime.datetime.now())
|
|
|
17 |
|
|
|
18 |
client.addWarehouse(warehouse)
|
|
|
19 |
client.addWarehouse(warehouse)
|
|
|
20 |
|
|
|
21 |
item = Item()
|
|
|
22 |
item.vendorItemId = 11
|
|
|
23 |
item.featureDescription = "Red colour"
|
|
|
24 |
item.featureId = 11
|
|
|
25 |
item.itemStatus = status.ACTIVE
|
|
|
26 |
item.catalogItemId = 1000008
|
|
|
27 |
item.weight = 14.2
|
|
|
28 |
price_map = {}
|
|
|
29 |
price_map[1] = 23.5
|
|
|
30 |
price_map[2] = 32.3
|
|
|
31 |
item.price = price_map
|
|
|
32 |
item.addedOn = to_java_date(datetime.datetime.now())
|
|
|
33 |
item.startDate = to_java_date(datetime.datetime.now())
|
|
|
34 |
client.addItem(item)
|
|
|
35 |
'''
|
|
|
36 |
warehouse = Warehouse()
|
|
|
37 |
warehouse.location = "Delhi"
|
|
|
38 |
#print inventory_client.add_warehouse(warehouse)
|
|
|
39 |
|
|
|
40 |
timestamp = datetime.datetime.now()
|
|
|
41 |
print client.update_inventory(2, 2, 10, to_java_date(timestamp))
|
|
|
42 |
# item = inventory_client.get_item(2)
|
|
|
43 |
# print item
|
|
|
44 |
|
|
|
45 |
#items = inventory_client.get_all_active_items()
|
|
|
46 |
inventory = inventory_client.get_item_inventory(2)
|
|
|
47 |
print inventory
|
|
|
48 |
|
|
|
49 |
warehouses = inventory_client.get_all_warehouses(True)
|
|
|
50 |
|
|
|
51 |
print warehouses
|
|
|
52 |
|
|
|
53 |
warehouses = inventory_client.get_all_warehouses_for_item(2)
|
|
|
54 |
|
|
|
55 |
print warehouses
|
|
|
56 |
|
|
|
57 |
items = inventory_client.get_all_items_for_warehouse(2)
|
|
|
58 |
|
|
|
59 |
print items
|
|
|
60 |
'''
|