Subversion Repositories SmartDukaan

Rev

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

Rev 1939 Rev 2091
Line 7... Line 7...
7
 
7
 
8
if __name__ == '__main__' and __package__ is None:
8
if __name__ == '__main__' and __package__ is None:
9
    import os
9
    import os
10
    sys.path.insert(0, os.getcwd())
10
    sys.path.insert(0, os.getcwd())
11
 
11
 
-
 
12
from shop2020.clients.InventoryClient import InventoryClient
12
from shop2020.thriftpy.model.v1.order.ttypes import OrderStatus,\
13
from shop2020.thriftpy.model.v1.order.ttypes import OrderStatus,\
13
    TransactionServiceException
14
    TransactionServiceException
14
from shop2020.model.v1.order.impl import DataService
15
from shop2020.model.v1.order.impl import DataService
15
from shop2020.model.v1.order.impl.DataAccessors import get_order,\
16
from shop2020.model.v1.order.impl.DataAccessors import get_order,\
16
    order_outofstock, close_session
17
    order_outofstock, close_session
Line 138... Line 139...
138
    
139
    
139
    color = raw_input("Enter the color of the new item: ")
140
    color = raw_input("Enter the color of the new item: ")
140
    if color is None or color == "":
141
    if color is None or color == "":
141
        print("Color information is mandatory.")
142
        print("Color information is mandatory.")
142
        return
143
        return
143
 
144
    
-
 
145
    #warehouse_id = raw_input("Enter the warehouse id which will fulfill this order. Leave empty to keep it unchanged: ")
144
    #TODO: Check that the item has the same price
146
    #if warehouse_id is None or warehouse_id == "":
-
 
147
    #    warehouse_id = order.warehouse_id
-
 
148
    
145
    lineitem = order.lineitems[0]
149
    lineitem = order.lineitems[0]
-
 
150
    
-
 
151
    catalog_client = InventoryClient().get_client()
-
 
152
    catalog_client.reserveItemInWarehouse(item_id, order.warehouse_id, lineitem.quantity)
-
 
153
    catalog_client.reduceReservationCount(lineitem.item_id, order.warehouse_id, lineitem.quantity)
-
 
154
    #TODO: Check that the item has the same price
-
 
155
        
146
    lineitem.item_id = item_id
156
    lineitem.item_id = item_id
147
    lineitem.color = color
157
    lineitem.color = color
148
    
158
    
149
    session.commit()
159
    session.commit()
150
 
160