Subversion Repositories SmartDukaan

Rev

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

Rev 10544 Rev 11173
Line 1... Line 1...
1
'''
1
'''
2
Created on 27-Apr-2010
2
Created on 27-Apr-2010
3
 
3
 
4
@author: ashish
4
@author: ashish
5
'''
5
'''
-
 
6
from elixir import *
6
from shop2020.config.client.ConfigClient import ConfigClient
7
from shop2020.config.client.ConfigClient import ConfigClient
7
from shop2020.model.v1.inventory.impl import DataService
8
from shop2020.model.v1.inventory.impl import DataService
8
from shop2020.model.v1.inventory.impl.Convertors import to_t_item_inventory, \
9
from shop2020.model.v1.inventory.impl.Convertors import to_t_item_inventory, \
9
    to_t_warehouse, to_t_vendor_item_pricing, to_t_vendor, to_t_vendor_item_mapping, \
10
    to_t_warehouse, to_t_vendor_item_pricing, to_t_vendor, to_t_vendor_item_mapping, \
10
    to_t_item_stock_purchase_params, to_t_oos_status, to_t_amazon_inventory_snapshot, \
11
    to_t_item_stock_purchase_params, to_t_oos_status, to_t_amazon_inventory_snapshot, \
Line 781... Line 782...
781
        finally:
782
        finally:
782
            close_session()
783
            close_session()
783
            
784
            
784
    def addOrUpdateAmazonFbaInventory(self,amazonfbainventorysnapshot):
785
    def addOrUpdateAmazonFbaInventory(self,amazonfbainventorysnapshot):
785
        try:
786
        try:
786
            return add_or_update_amazon_fba_inventory(amazonfbainventorysnapshot)
787
            add_or_update_amazon_fba_inventory(amazonfbainventorysnapshot)
-
 
788
            session.commit()
-
 
789
            return True 
787
        finally:
790
        finally:
788
            close_session()
791
            close_session()
789
            
792
            
790
    def addUpdateHoldInventory(self, itemId, warehouseId, holdQuantity, source):
793
    def addUpdateHoldInventory(self, itemId, warehouseId, holdQuantity, source):
791
        try:
794
        try:
792
            add_update_hold_inventory(itemId, warehouseId, holdQuantity, source)
795
            add_update_hold_inventory(itemId, warehouseId, holdQuantity, source)
793
        finally:
796
        finally:
794
            close_session()
797
            close_session()
795
            
798
            
796
    def getAmazonFbaItemInventory(self,itemId):
799
    def getAmazonFbaItemInventory(self,itemId):
-
 
800
        fba_inventory = []
797
        try:
801
        try:
798
            return get_amazon_fba_inventory(itemId)
802
            for inventory in get_amazon_fba_inventory(itemId):
-
 
803
                fba_inventory.append(to_t_amazon_fba_inventory_snapshot(inventory))
-
 
804
            return fba_inventory     
799
        finally:
805
        finally:
800
            close_session()            
806
            close_session()            
801
            
807
            
802
    def getAllAmazonFbaItemInventory(self):
808
    def getAllAmazonFbaItemInventory(self):
803
        all_fba_inventory = []
809
        all_fba_inventory = []
Line 843... Line 849...
843
            return get_nlc_for_warehouse(warehouse_id,item_id)
849
            return get_nlc_for_warehouse(warehouse_id,item_id)
844
        finally:
850
        finally:
845
            close_session()
851
            close_session()
846
            
852
            
847
    def addOrUpdateAllAmazonFbaInventory(self,allamazonfbainventorysnapshot):
853
    def addOrUpdateAllAmazonFbaInventory(self,allamazonfbainventorysnapshot):
-
 
854
        print 'inside handler'
848
        try:
855
        try:
849
            for amazonfbainventorysnapshot in allamazonfbainventorysnapshot:
856
            for amazonfbainventorysnapshot in allamazonfbainventorysnapshot:
-
 
857
                print amazonfbainventorysnapshot 
850
                add_or_update_amazon_fba_inventory(amazonfbainventorysnapshot)
858
                add_or_update_amazon_fba_inventory(amazonfbainventorysnapshot)
-
 
859
            session.commit()    
851
        finally:
860
        finally:
852
            close_session()
861
            close_session()
853
    
862
    
854
    def addOrUpdateAllSnapdealInventory(self,allsnapdealinventorysnapshot):
863
    def addOrUpdateAllSnapdealInventory(self,allsnapdealinventorysnapshot):
855
        try:
864
        try: