Subversion Repositories SmartDukaan

Rev

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

Rev 19714 Rev 19754
Line 46... Line 46...
46
import sys
46
import sys
47
import threading
47
import threading
48
import urllib2
48
import urllib2
49
from shop2020.clients.UserClient import UserClient
49
from shop2020.clients.UserClient import UserClient
50
import operator
50
import operator
-
 
51
from sqlalchemy.orm import aliased
51
 
52
 
52
sourceId = int(ConfigClient().get_property("sourceid"))
53
sourceId = int(ConfigClient().get_property("sourceid"))
53
to_addresses = ["khushal.bhatia@shop2020.in", "chandan.kumar@shop2020.in",  "chaitnaya.vats@shop2020.in",'manoj.kumar@shop2020.in']
54
to_addresses = ["khushal.bhatia@shop2020.in", "chandan.kumar@shop2020.in",  "chaitnaya.vats@shop2020.in",'manoj.kumar@shop2020.in']
54
to_store_addresses = ["rajveer.singh@shop2020.in"]
55
to_store_addresses = ["rajveer.singh@shop2020.in"]
55
mail_user = "cnc.center@shop2020.in"
56
mail_user = "cnc.center@shop2020.in"
Line 981... Line 982...
981
    __send_mail(subject,"")
982
    __send_mail(subject,"")
982
   
983
   
983
def get_items_for_mastersheet(categoryName, brand):
984
def get_items_for_mastersheet(categoryName, brand):
984
    if not categoryName or not brand:
985
    if not categoryName or not brand:
985
        raise InventoryServiceException(101, "Invalid category or brand in request")
986
        raise InventoryServiceException(101, "Invalid category or brand in request")
986
   
-
 
-
 
987
    stmt = session.query(PrivateDeals).filter_by(isActive=1).filter(now().between(PrivateDeals.startDate, PrivateDeals.endDate)).subquery()
-
 
988
    privateDealAlias = aliased(PrivateDeals,stmt)
987
    categories = ["Handsets", "Tablets", "Laptops"]
989
    categories = ["Handsets", "Tablets", "Laptops"]
988
    query = Item.query.filter(Item.status != status.PHASED_OUT)
990
    query = session.query(Item, privateDealAlias.dealPrice).outerjoin((privateDealAlias, Item.id==privateDealAlias.item_id).filter(Item.status != status.PHASED_OUT)
989
    if categoryName == "ALL":
991
    if categoryName == "ALL":
990
        pass
992
        pass
991
    elif categoryName == "ALL Accessories":
993
    elif categoryName == "ALL Accessories":
992
        query = query.filter(~Item.product_group.in_(categories))
994
        query = query.filter(~Item.product_group.in_(categories))
993
    elif categoryName == "ALL Handsets":
995
    elif categoryName == "ALL Handsets":
Line 1837... Line 1839...
1837
    return True
1839
    return True
1838
   
1840
   
1839
   
1841
   
1840
 
1842
 
1841
def get_defalut_store_pricing(itemId):
1843
def get_defalut_store_pricing(itemId):
1842
    inventoryClient = InventoryClient().get_client()
-
 
1843
    pricings = inventoryClient.getAllItemPricing(itemId)
-
 
1844
    item = get_item(itemId)
1844
    item = get_item(itemId)
1845
    maxp = item.sellingPrice
1845
    maxp = item.sellingPrice
1846
    if item.mrp:
1846
    if item.mrp:
1847
        maxp = item.mrp
1847
        maxp = item.mrp
1848
           
1848
           
1849
    minp = 0
-
 
1850
    rp = item.sellingPrice
1849
    minp = rp = item.sellingPrice
1851
    for pricing in pricings:
-
 
1852
        if not minp or minp > pricing.dealerPrice:
-
 
1853
            minp = pricing.dealerPrice
-
 
1854
        
-
 
1855
       
-
 
1856
    minap = math.ceil(min(max(500, rp*0.1),rp))
1850
    minap = math.ceil(min(max(500, rp*0.1),rp))
1857
 
1851
 
1858
    if minp > rp:
-
 
1859
        minp = rp
-
 
1860
    sp = tStorePricing()
1852
    sp = tStorePricing()
1861
    sp.itemId = itemId
1853
    sp.itemId = itemId
1862
    sp.recommendedPrice = rp
1854
    sp.recommendedPrice = rp
1863
    sp.absoluteMinPrice = minp
1855
    sp.absoluteMinPrice = minp
1864
    sp.minPrice = minp
1856
    sp.minPrice = minp