| Line -... |
Line 1... |
| - |
|
1 |
|
| 1 |
'''
|
2 |
'''
|
| 2 |
Created on 23-Mar-2010
|
3 |
Created on 23-Mar-2010
|
| 3 |
|
4 |
|
| 4 |
@author: ashish
|
5 |
@author: ashish
|
| 5 |
'''
|
6 |
'''
|
| 6 |
from elixir import *
|
7 |
from elixir import *
|
| 7 |
from functools import partial
|
8 |
from functools import partial
|
| 8 |
from shop2020.clients.CatalogClient import CatalogClient
|
9 |
from shop2020.clients.CatalogClient import CatalogClient
|
| 9 |
from shop2020.clients.HelperClient import HelperClient
|
10 |
from shop2020.clients.HelperClient import HelperClient
|
| 10 |
from shop2020.clients.InventoryClient import InventoryClient
|
11 |
from shop2020.clients.InventoryClient import InventoryClient
|
| - |
|
12 |
from shop2020.clients.UserClient import UserClient
|
| 11 |
from shop2020.config.client.ConfigClient import ConfigClient
|
13 |
from shop2020.config.client.ConfigClient import ConfigClient
|
| 12 |
from shop2020.model.v1.catalog.impl import DataService
|
14 |
from shop2020.model.v1.catalog.impl import DataService
|
| 13 |
from shop2020.model.v1.catalog.impl.CategoryManager import CategoryManager
|
15 |
from shop2020.model.v1.catalog.impl.CategoryManager import CategoryManager
|
| 14 |
from shop2020.model.v1.catalog.impl.Convertors import to_t_item, to_t_source, \
|
16 |
from shop2020.model.v1.catalog.impl.Convertors import to_t_item, to_t_source, \
|
| 15 |
to_t_brand_info, to_t_private_deal, to_t_exclusive_affiliate_item_info, to_t_bulk_pricing
|
17 |
to_t_brand_info, to_t_private_deal, to_t_exclusive_affiliate_item_info, \
|
| - |
|
18 |
to_t_bulk_pricing
|
| 16 |
from shop2020.model.v1.catalog.impl.DataService import Item, ItemChangeLog, \
|
19 |
from shop2020.model.v1.catalog.impl.DataService import Item, ItemChangeLog, \
|
| 17 |
Category, EntityIDGenerator, SimilarItems, ProductNotification, Source, \
|
20 |
Category, EntityIDGenerator, SimilarItems, ProductNotification, Source, \
|
| 18 |
SourceItemPricing, AuthorizationLog, VoucherItemMapping, CategoryVatMaster, \
|
21 |
SourceItemPricing, AuthorizationLog, VoucherItemMapping, CategoryVatMaster, \
|
| 19 |
OOSTracker, EntityTag, ItemInsurerMapping, Insurer, Banner, BannerMap, \
|
22 |
OOSTracker, EntityTag, ItemInsurerMapping, Insurer, Banner, BannerMap, \
|
| 20 |
FreebieItem, BrandInfo, Amazonlisted, StorePricing, ItemVatMaster, \
|
23 |
FreebieItem, BrandInfo, Amazonlisted, StorePricing, ItemVatMaster, \
|
| Line 22... |
Line 25... |
| 22 |
ProductFeedSubmit, MarketplaceItems, MarketPlaceItemPrice, \
|
25 |
ProductFeedSubmit, MarketplaceItems, MarketPlaceItemPrice, \
|
| 23 |
SourcePercentageMaster, SourceItemPercentage, FlipkartItem, \
|
26 |
SourcePercentageMaster, SourceItemPercentage, FlipkartItem, \
|
| 24 |
MarketPlaceUpdateHistory, SourceCategoryPercentage, MarketPlaceHistory, \
|
27 |
MarketPlaceUpdateHistory, SourceCategoryPercentage, MarketPlaceHistory, \
|
| 25 |
PrivateDeals, AmazonOutOfSync, PrivateDealsPriceComparison, \
|
28 |
PrivateDeals, AmazonOutOfSync, PrivateDealsPriceComparison, \
|
| 26 |
SourceReturnPercentage, CompetitorPricing, CompetitorPricingRequest, \
|
29 |
SourceReturnPercentage, CompetitorPricing, CompetitorPricingRequest, \
|
| 27 |
AmazonPromotion, ExclusiveAffiliateItemInfo, OutboundAffiliateMaster, HsItem, BulkItemPricing
|
30 |
AmazonPromotion, ExclusiveAffiliateItemInfo, OutboundAffiliateMaster, HsItem, \
|
| - |
|
31 |
BulkItemPricing
|
| - |
|
32 |
from shop2020.model.v1.inventory.impl.DataService import \
|
| - |
|
33 |
ItemLocationAvailabilityCache
|
| 28 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status, ItemShippingInfo, \
|
34 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status, ItemShippingInfo, \
|
| 29 |
ItemType, PremiumType, FreebieItem as t_FreebieItem, \
|
35 |
ItemType, PremiumType, FreebieItem as t_FreebieItem, \
|
| 30 |
StorePricing as tStorePricing, CatalogServiceException, BannerType, InsurerType, \
|
36 |
StorePricing as tStorePricing, CatalogServiceException, BannerType, InsurerType, \
|
| 31 |
Banner as t_banner, CompetitorPricing as TCompetitorPricing, AmazonPromotionType
|
37 |
Banner as t_banner, CompetitorPricing as TCompetitorPricing, AmazonPromotionType
|
| 32 |
from shop2020.thriftpy.model.v1.inventory.ttypes import VatType, \
|
38 |
from shop2020.thriftpy.model.v1.inventory.ttypes import VatType, \
|
| 33 |
InventoryServiceException, IgnoredInventoryUpdateItems, SnapdealInventoryItem
|
39 |
InventoryServiceException, IgnoredInventoryUpdateItems, SnapdealInventoryItem, \
|
| 34 |
from shop2020.thriftpy.utils.ttypes import UserSmsInfo, SmsType
|
40 |
ItemLocationAvailability
|
| 35 |
from shop2020.thriftpy.model.v1.order.ttypes import OrderSource
|
41 |
from shop2020.thriftpy.model.v1.order.ttypes import OrderSource
|
| - |
|
42 |
from shop2020.thriftpy.utils.ttypes import UserSmsInfo, SmsType
|
| 36 |
from shop2020.utils import EmailAttachmentSender
|
43 |
from shop2020.utils import EmailAttachmentSender
|
| 37 |
from shop2020.utils.EmailAttachmentSender import mail
|
44 |
from shop2020.utils.EmailAttachmentSender import mail
|
| 38 |
from shop2020.utils.Utils import to_py_date, log_risky_flag, to_java_date
|
45 |
from shop2020.utils.Utils import to_py_date, log_risky_flag, to_java_date
|
| 39 |
from sqlalchemy import desc, asc
|
46 |
from sqlalchemy import desc, asc
|
| 40 |
from sqlalchemy.sql.expression import or_, distinct, func, and_
|
47 |
from sqlalchemy.sql.expression import or_, distinct, func, and_, tuple_
|
| 41 |
from sqlalchemy.sql.functions import now
|
48 |
from sqlalchemy.sql.functions import now
|
| 42 |
from string import Template
|
49 |
from string import Template
|
| 43 |
import datetime
|
50 |
import datetime
|
| 44 |
import math
|
51 |
import math
|
| - |
|
52 |
import operator
|
| 45 |
import sys
|
53 |
import sys
|
| 46 |
import threading
|
54 |
import threading
|
| 47 |
import urllib2
|
55 |
import urllib2
|
| 48 |
from shop2020.clients.UserClient import UserClient
|
- |
|
| 49 |
import operator
|
- |
|
| 50 |
|
56 |
|
| 51 |
sourceId = int(ConfigClient().get_property("sourceid"))
|
57 |
sourceId = int(ConfigClient().get_property("sourceid"))
|
| 52 |
to_addresses = ["khushal.bhatia@shop2020.in", "chandan.kumar@shop2020.in", "chaitnaya.vats@shop2020.in",'manoj.kumar@shop2020.in']
|
58 |
to_addresses = ["khushal.bhatia@shop2020.in", "chandan.kumar@shop2020.in", "chaitnaya.vats@shop2020.in",'manoj.kumar@shop2020.in']
|
| 53 |
to_store_addresses = ["rajveer.singh@shop2020.in"]
|
59 |
to_store_addresses = ["rajveer.singh@shop2020.in"]
|
| 54 |
mail_user = "cnc.center@shop2020.in"
|
60 |
mail_user = "cnc.center@shop2020.in"
|
| Line 124... |
Line 130... |
| 124 |
item = Item.query.filter_by(catalog_item_id=catalog_id).first()
|
130 |
item = Item.query.filter_by(catalog_item_id=catalog_id).first()
|
| 125 |
if item is not None:
|
131 |
if item is not None:
|
| 126 |
return True
|
132 |
return True
|
| 127 |
else:
|
133 |
else:
|
| 128 |
return False
|
134 |
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()
|
| 129 |
|
144 |
|
| 130 |
def is_active(item_id):
|
145 |
def is_active(item_id):
|
| 131 |
t_item_shipping_info = ItemShippingInfo()
|
146 |
t_item_shipping_info = ItemShippingInfo()
|
| 132 |
try:
|
147 |
try:
|
| 133 |
item = get_item(item_id)
|
148 |
item = get_item(item_id)
|
| Line 195... |
Line 210... |
| 195 |
if item.modelNumber:
|
210 |
if item.modelNumber:
|
| 196 |
ds_item.model_number = item.modelNumber
|
211 |
ds_item.model_number = item.modelNumber
|
| 197 |
ds_item.color = item.color
|
212 |
ds_item.color = item.color
|
| 198 |
ds_item.model_name = item.modelName
|
213 |
ds_item.model_name = item.modelName
|
| 199 |
ds_item.category = item.category
|
214 |
ds_item.category = item.category
|
| 200 |
if item.category == 10006:
|
215 |
# if item.category == 10006:
|
| 201 |
itemInsurerMapping = ItemInsurerMapping.query.filter(ItemInsurerMapping.itemId == item.id).filter(ItemInsurerMapping.insurerType == InsurerType._NAMES_TO_VALUES.get("DEVICE")).first()
|
216 |
# itemInsurerMapping = ItemInsurerMapping.query.filter(ItemInsurerMapping.itemId == item.id).filter(ItemInsurerMapping.insurerType == InsurerType._NAMES_TO_VALUES.get("DEVICE")).first()
|
| 202 |
if itemInsurerMapping is None:
|
217 |
# if itemInsurerMapping is None:
|
| 203 |
itemInsurerMapping = ItemInsurerMapping()
|
218 |
# itemInsurerMapping = ItemInsurerMapping()
|
| 204 |
itemInsurerMapping.itemId = item.id
|
219 |
# itemInsurerMapping.itemId = item.id
|
| 205 |
itemInsurerMapping.insurerId = 1
|
220 |
# itemInsurerMapping.insurerId = 1
|
| 206 |
itemInsurerMapping.insurerType = 1
|
221 |
# itemInsurerMapping.insurerType = 1
|
| 207 |
|
222 |
|
| 208 |
ds_item.comments = item.comments
|
223 |
ds_item.comments = item.comments
|
| 209 |
|
224 |
|
| 210 |
ds_item.catalog_item_id = item.catalogItemId
|
225 |
ds_item.catalog_item_id = item.catalogItemId
|
| 211 |
|
226 |
|