| Line 1... |
Line -... |
| 1 |
|
- |
|
| 2 |
'''
|
1 |
'''
|
| 3 |
Created on 23-Mar-2010
|
2 |
Created on 23-Mar-2010
|
| 4 |
|
3 |
|
| 5 |
@author: ashish
|
4 |
@author: ashish
|
| 6 |
'''
|
5 |
'''
|
| 7 |
from elixir import *
|
6 |
from elixir import *
|
| 8 |
from functools import partial
|
7 |
from functools import partial
|
| 9 |
from shop2020.clients.CatalogClient import CatalogClient
|
8 |
from shop2020.clients.CatalogClient import CatalogClient
|
| 10 |
from shop2020.clients.HelperClient import HelperClient
|
9 |
from shop2020.clients.HelperClient import HelperClient
|
| 11 |
from shop2020.clients.InventoryClient import InventoryClient
|
10 |
from shop2020.clients.InventoryClient import InventoryClient
|
| 12 |
from shop2020.clients.UserClient import UserClient
|
- |
|
| 13 |
from shop2020.config.client.ConfigClient import ConfigClient
|
11 |
from shop2020.config.client.ConfigClient import ConfigClient
|
| 14 |
from shop2020.model.v1.catalog.impl import DataService
|
12 |
from shop2020.model.v1.catalog.impl import DataService
|
| 15 |
from shop2020.model.v1.catalog.impl.CategoryManager import CategoryManager
|
13 |
from shop2020.model.v1.catalog.impl.CategoryManager import CategoryManager
|
| 16 |
from shop2020.model.v1.catalog.impl.Convertors import to_t_item, to_t_source, \
|
14 |
from shop2020.model.v1.catalog.impl.Convertors import to_t_item, to_t_source, \
|
| 17 |
to_t_brand_info, to_t_private_deal, to_t_exclusive_affiliate_item_info, \
|
15 |
to_t_brand_info, to_t_private_deal, to_t_exclusive_affiliate_item_info, to_t_bulk_pricing
|
| 18 |
to_t_bulk_pricing
|
- |
|
| 19 |
from shop2020.model.v1.catalog.impl.DataService import Item, ItemChangeLog, \
|
16 |
from shop2020.model.v1.catalog.impl.DataService import Item, ItemChangeLog, \
|
| 20 |
Category, EntityIDGenerator, SimilarItems, ProductNotification, Source, \
|
17 |
Category, EntityIDGenerator, SimilarItems, ProductNotification, Source, \
|
| 21 |
SourceItemPricing, AuthorizationLog, VoucherItemMapping, CategoryVatMaster, \
|
18 |
SourceItemPricing, AuthorizationLog, VoucherItemMapping, CategoryVatMaster, \
|
| 22 |
OOSTracker, EntityTag, ItemInsurerMapping, Insurer, Banner, BannerMap, \
|
19 |
OOSTracker, EntityTag, ItemInsurerMapping, Insurer, Banner, BannerMap, \
|
| 23 |
FreebieItem, BrandInfo, Amazonlisted, StorePricing, ItemVatMaster, \
|
20 |
FreebieItem, BrandInfo, Amazonlisted, StorePricing, ItemVatMaster, \
|
| Line 25... |
Line 22... |
| 25 |
ProductFeedSubmit, MarketplaceItems, MarketPlaceItemPrice, \
|
22 |
ProductFeedSubmit, MarketplaceItems, MarketPlaceItemPrice, \
|
| 26 |
SourcePercentageMaster, SourceItemPercentage, FlipkartItem, \
|
23 |
SourcePercentageMaster, SourceItemPercentage, FlipkartItem, \
|
| 27 |
MarketPlaceUpdateHistory, SourceCategoryPercentage, MarketPlaceHistory, \
|
24 |
MarketPlaceUpdateHistory, SourceCategoryPercentage, MarketPlaceHistory, \
|
| 28 |
PrivateDeals, AmazonOutOfSync, PrivateDealsPriceComparison, \
|
25 |
PrivateDeals, AmazonOutOfSync, PrivateDealsPriceComparison, \
|
| 29 |
SourceReturnPercentage, CompetitorPricing, CompetitorPricingRequest, \
|
26 |
SourceReturnPercentage, CompetitorPricing, CompetitorPricingRequest, \
|
| 30 |
AmazonPromotion, ExclusiveAffiliateItemInfo, OutboundAffiliateMaster, HsItem, \
|
27 |
AmazonPromotion, ExclusiveAffiliateItemInfo, OutboundAffiliateMaster, HsItem, BulkItemPricing
|
| 31 |
BulkItemPricing
|
- |
|
| 32 |
from shop2020.model.v1.inventory.impl.DataService import \
|
- |
|
| 33 |
ItemLocationAvailabilityCache
|
- |
|
| 34 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status, ItemShippingInfo, \
|
28 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status, ItemShippingInfo, \
|
| 35 |
ItemType, PremiumType, FreebieItem as t_FreebieItem, \
|
29 |
ItemType, PremiumType, FreebieItem as t_FreebieItem, \
|
| 36 |
StorePricing as tStorePricing, CatalogServiceException, BannerType, InsurerType, \
|
30 |
StorePricing as tStorePricing, CatalogServiceException, BannerType, InsurerType, \
|
| 37 |
Banner as t_banner, CompetitorPricing as TCompetitorPricing, AmazonPromotionType
|
31 |
Banner as t_banner, CompetitorPricing as TCompetitorPricing, AmazonPromotionType
|
| 38 |
from shop2020.thriftpy.model.v1.inventory.ttypes import VatType, \
|
32 |
from shop2020.thriftpy.model.v1.inventory.ttypes import VatType, \
|
| 39 |
InventoryServiceException, IgnoredInventoryUpdateItems, SnapdealInventoryItem, \
|
33 |
InventoryServiceException, IgnoredInventoryUpdateItems, SnapdealInventoryItem
|
| 40 |
ItemLocationAvailability
|
- |
|
| 41 |
from shop2020.thriftpy.model.v1.order.ttypes import OrderSource
|
- |
|
| 42 |
from shop2020.thriftpy.utils.ttypes import UserSmsInfo, SmsType
|
34 |
from shop2020.thriftpy.utils.ttypes import UserSmsInfo, SmsType
|
| - |
|
35 |
from shop2020.thriftpy.model.v1.order.ttypes import OrderSource
|
| 43 |
from shop2020.utils import EmailAttachmentSender
|
36 |
from shop2020.utils import EmailAttachmentSender
|
| 44 |
from shop2020.utils.EmailAttachmentSender import mail
|
37 |
from shop2020.utils.EmailAttachmentSender import mail
|
| 45 |
from shop2020.utils.Utils import to_py_date, log_risky_flag, to_java_date
|
38 |
from shop2020.utils.Utils import to_py_date, log_risky_flag, to_java_date
|
| 46 |
from sqlalchemy import desc, asc
|
39 |
from sqlalchemy import desc, asc
|
| 47 |
from sqlalchemy.sql.expression import or_, distinct, func, and_, tuple_
|
40 |
from sqlalchemy.sql.expression import or_, distinct, func, and_
|
| 48 |
from sqlalchemy.sql.functions import now
|
41 |
from sqlalchemy.sql.functions import now
|
| 49 |
from string import Template
|
42 |
from string import Template
|
| 50 |
import datetime
|
43 |
import datetime
|
| 51 |
import math
|
44 |
import math
|
| 52 |
import operator
|
- |
|
| 53 |
import sys
|
45 |
import sys
|
| 54 |
import threading
|
46 |
import threading
|
| 55 |
import urllib2
|
47 |
import urllib2
|
| - |
|
48 |
from shop2020.clients.UserClient import UserClient
|
| - |
|
49 |
import operator
|
| 56 |
|
50 |
|
| 57 |
sourceId = int(ConfigClient().get_property("sourceid"))
|
51 |
sourceId = int(ConfigClient().get_property("sourceid"))
|
| 58 |
to_addresses = ["khushal.bhatia@shop2020.in", "chandan.kumar@shop2020.in", "chaitnaya.vats@shop2020.in",'manoj.kumar@shop2020.in']
|
52 |
to_addresses = ["khushal.bhatia@shop2020.in", "chandan.kumar@shop2020.in", "chaitnaya.vats@shop2020.in",'manoj.kumar@shop2020.in']
|
| 59 |
to_store_addresses = ["rajveer.singh@shop2020.in"]
|
53 |
to_store_addresses = ["rajveer.singh@shop2020.in"]
|
| 60 |
mail_user = "cnc.center@shop2020.in"
|
54 |
mail_user = "cnc.center@shop2020.in"
|
| Line 130... |
Line 124... |
| 130 |
item = Item.query.filter_by(catalog_item_id=catalog_id).first()
|
124 |
item = Item.query.filter_by(catalog_item_id=catalog_id).first()
|
| 131 |
if item is not None:
|
125 |
if item is not None:
|
| 132 |
return True
|
126 |
return True
|
| 133 |
else:
|
127 |
else:
|
| 134 |
return False
|
128 |
return False
|
| 135 |
|
- |
|
| 136 |
def get_item_location_availability_by_item_ids(item_ids):
|
- |
|
| 137 |
pass
|
- |
|
| 138 |
def get_item_location_availability(item_locations):
|
- |
|
| 139 |
item_location = ItemLocationAvailability()
|
- |
|
| 140 |
tuples = []
|
- |
|
| 141 |
for item_location in item_locations:
|
- |
|
| 142 |
tuples.append((item_location.itemId, item_location.locationId))
|
- |
|
| 143 |
return session.query(ItemLocationAvailabilityCache).filter(tuple_(ItemLocationAvailabilityCache.item_id, ItemLocationAvailabilityCache.location_id).in_(tuples)).all()
|
- |
|
| 144 |
|
129 |
|
| 145 |
def is_active(item_id):
|
130 |
def is_active(item_id):
|
| 146 |
t_item_shipping_info = ItemShippingInfo()
|
131 |
t_item_shipping_info = ItemShippingInfo()
|
| 147 |
try:
|
132 |
try:
|
| 148 |
item = get_item(item_id)
|
133 |
item = get_item(item_id)
|