Subversion Repositories SmartDukaan

Rev

Rev 11017 | Rev 11095 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
94 ashish 1
'''
2
Created on 23-Mar-2010
3
 
4
@author: ashish
5
'''
8754 vikram.rag 6
from shop2020.model.v1.catalog.impl.DataService import Insurer, SnapdealItem, Item
6511 kshitij.so 7
from shop2020.thriftpy.model.v1.catalog.ttypes import Item, Category, \
8
    SourceItemPricing, Source, ItemType, \
5110 mandeep.dh 9
    ProductNotificationRequest as TProductNotificationRequest, \
10
    ProductNotificationRequestCount as TProductNotificationRequestCount, \
7281 kshitij.so 11
    VoucherItemMapping, EntityTag as TEntityTag, Banner as TBanner, BannerMap as TBannerMap, \
8182 amar.kumar 12
    Insurer as TInsurer, BrandInfo as TBrandInfo, Amazonlisted as TAmazonlisted, \
8739 vikram.rag 13
    EbayItem as TEbayItem, BannerUriMapping as TBannerUriMapping, Campaign as TCampaign, \
9724 kshitij.so 14
    SnapdealItem as TSnapdealItem, SnapdealItemDetails as TSnapdealItemDetails,ProductFeedSubmit as TProductFeedSubmit, \
9779 kshitij.so 15
    MarketplaceItems as TMarketplaceItems, MarketplacePercentage as TMarketplacePercentage, \
10097 kshitij.so 16
    MarketPlaceItemPrice as TMarketPlaceItemPrice, FlipkartItem as TFlipkartItem,\
11015 kshitij.so 17
    FlipkartItemDetails as TFlipkartItemDetails, MarketplaceHistory as TMarketplaceHistory
5110 mandeep.dh 18
from shop2020.utils.Utils import to_java_date
94 ashish 19
 
11076 kshitij.so 20
 
94 ashish 21
def to_t_item(item):
22
    t_item = Item()
576 chandransh 23
    if item is None:
24
        return t_item
94 ashish 25
    t_item.id = item.id
963 chandransh 26
    t_item.productGroup = item.product_group
27
    t_item.brand = item.brand
591 chandransh 28
    t_item.modelNumber = item.model_number
29
    t_item.modelName = item.model_name
609 chandransh 30
    t_item.color = item.color
591 chandransh 31
    t_item.category = item.category
122 ashish 32
    t_item.catalogItemId = item.catalog_item_id
33
    t_item.weight = item.weight
34
    t_item.featureId = item.feature_id
35
    t_item.featureDescription = item.feature_description
36
    if item.startDate:
37
        t_item.startDate = to_java_date(item.startDate)
5217 amit.gupta 38
    if item.comingSoonStartDate:
39
        t_item.comingSoonStartDate = to_java_date(item.comingSoonStartDate)
40
    if item.expectedArrivalDate:
41
        t_item.expectedArrivalDate = to_java_date(item.expectedArrivalDate)
122 ashish 42
    if item.addedOn:
43
        t_item.addedOn = to_java_date(item.addedOn)
609 chandransh 44
    if item.updatedOn:
45
        t_item.updatedOn = to_java_date(item.updatedOn)
122 ashish 46
    t_item.itemStatus = item.status
2035 rajveer 47
    t_item.status_description = item.status_description
501 rajveer 48
    if item.sellingPrice:
609 chandransh 49
        t_item.sellingPrice = item.sellingPrice
630 chandransh 50
    if item.mrp:
501 rajveer 51
        t_item.mrp = item.mrp    
122 ashish 52
 
2028 ankur.sing 53
    if item.comments:
54
        t_item.comments = item.comments
609 chandransh 55
    if item.bestDealText:
56
        t_item.bestDealText = item.bestDealText
6777 vikram.rag 57
    if item.bestDealsDetailsText:
58
        t_item.bestDealsDetailsText = item.bestDealsDetailsText
59
    if item.bestDealsDetailsLink:
60
        t_item.bestDealsDetailsLink = item.bestDealsDetailsLink 
609 chandransh 61
    if item.bestDealValue:
62
        t_item.bestDealValue = item.bestDealValue
7291 vikram.rag 63
    if item.asin:
64
        t_item.asin = item.asin    
1910 varun.gupt 65
    t_item.defaultForEntity = item.defaultForEntity
2065 ankur.sing 66
    t_item.bestSellingRank = item.bestSellingRank
2251 ankur.sing 67
    t_item.risky = item.risky
3355 chandransh 68
    t_item.expectedDelay = item.expectedDelay
4406 anupam.sin 69
    t_item.isWarehousePreferenceSticky = item.isWarehousePreferenceSticky
4295 varun.gupt 70
    t_item.warrantyPeriod = item.warranty_period
4506 phani.kuma 71
    t_item.preferredVendor = item.preferredVendor
5110 mandeep.dh 72
    t_item.type = ItemType._NAMES_TO_VALUES[item.type]
5385 phani.kuma 73
    t_item.hasItemNo = item.hasItemNo
7256 rajveer 74
    t_item.activeOnStore = item.activeOnStore
6241 amit.gupta 75
    t_item.showSellingPrice = item.showSellingPrice
6805 anupam.sin 76
    t_item.preferredInsurer = item.preferredInsurer
7291 vikram.rag 77
    t_item.holdInventory = item.holdInventory
78
    t_item.defaultInventory = item.defaultInventory
9841 rajveer 79
    t_item.holdOverride = item.holdOverride
94 ashish 80
    return t_item
122 ashish 81
 
6805 anupam.sin 82
def to_t_insurer(insurer):
83
    t_insurer = TInsurer()
84
    t_insurer.id = insurer.id
85
    t_insurer.name = insurer.name 
86
    t_insurer.address = insurer.address
6903 anupam.sin 87
    t_insurer.declaredAmount = insurer.declaredAmount
88
    t_insurer.creditedAmount = insurer.creditedAmount
6805 anupam.sin 89
    return t_insurer
90
 
5504 phani.kuma 91
def to_t_voucher_item_mapping(voucher):
92
    t_voucher = VoucherItemMapping()
93
    t_voucher.voucherType = voucher.voucherType
94
    t_voucher.itemId = voucher.item.id
95
    t_voucher.amount = voucher.amount
96
    return t_voucher
97
 
1970 rajveer 98
def to_t_category(category):
99
    t_category = Category()
100
    t_category.id = category.id
101
    t_category.label = category.label
102
    t_category.description = category.description
103
    t_category.parent_category_id = category.parent_category_id
4762 phani.kuma 104
    t_category.display_name = category.display_name
3557 rajveer 105
    return t_category
106
 
107
def to_t_source_item_pricing(source_item_pricing):
108
    t_source_item_pricing = SourceItemPricing()
109
    t_source_item_pricing.sourceId = source_item_pricing.source.id
110
    t_source_item_pricing.itemId = source_item_pricing.item.id
111
    t_source_item_pricing.mrp = source_item_pricing.mrp
112
    t_source_item_pricing.sellingPrice = source_item_pricing.sellingPrice
113
    return t_source_item_pricing
114
 
115
def to_t_source(source):
116
    t_source = Source()
117
    t_source.id = source.id
118
    t_source.name = source.name
119
    t_source.identifier = source.identifier
120
    return t_source
4295 varun.gupt 121
 
122
def to_t_product_notification_request(product_notification_request):
123
    t_product_notification_request = TProductNotificationRequest()
124
 
125
    if product_notification_request:
126
        t_product_notification_request.item = to_t_item(product_notification_request.item)
127
        t_product_notification_request.email = product_notification_request.email
128
        t_product_notification_request.addedOn = to_java_date(product_notification_request.addedOn)
129
 
130
    return t_product_notification_request
131
 
132
def to_t_product_notification_request_count(product_notification_request_count):
133
 
134
    t_product_notification_request_count = TProductNotificationRequestCount()
135
 
136
    if product_notification_request_count:
137
        item, count = product_notification_request_count
138
        t_product_notification_request_count.item = to_t_item(item)
139
        t_product_notification_request_count.count = count
140
 
6511 kshitij.so 141
    return t_product_notification_request_count
142
 
143
def to_t_entity_tag(entity_tag):
144
    t_entity_tag = TEntityTag()
145
    t_entity_tag.entityId = entity_tag.entityId
6848 kshitij.so 146
    t_entity_tag.tag = entity_tag.tag
147
 
148
def to_t_banner(banner):
149
    t_banner = TBanner()
150
    t_banner.bannerName = banner.bannerName
151
    t_banner.imageName = banner.imageName
152
    t_banner.link = banner.link
153
    t_banner.priority = banner.priority
154
    t_banner.hasMap = banner.hasMap
9155 kshitij.so 155
    t_banner.bannerType = banner.bannerType
6848 kshitij.so 156
    return t_banner
157
 
8579 kshitij.so 158
def to_t_banner_list(bannerList):
159
    t_banner_list = []
160
    for banner in bannerList:
161
        t_banner = TBanner()
162
        t_banner.bannerName = banner.bannerName
163
        t_banner.imageName = banner.imageName
164
        t_banner.link = banner.link
165
        t_banner.priority = banner.priority
166
        t_banner.hasMap = banner.hasMap
9155 kshitij.so 167
        t_banner.bannerType = banner.bannerType
8579 kshitij.so 168
        t_banner_list.append(t_banner)
169
    return t_banner_list
170
 
171
 
6848 kshitij.so 172
def to_t_banner_map(banner_map):
173
    t_banner_map = TBannerMap()
174
    t_banner_map.bannerName = banner_map.bannerName
175
    t_banner_map.mapLink = banner_map.mapLink
176
    t_banner_map.coordinates = banner_map.coordinates
177
    return t_banner_map
7272 amit.gupta 178
 
8579 kshitij.so 179
def to_t_uri_mapping(uriMapping):
180
    t_uri_mapping =TBannerUriMapping()
181
    t_uri_mapping.bannerName = uriMapping.bannerName
182
    t_uri_mapping.uri = uriMapping.uri
183
    t_uri_mapping.isActive = uriMapping.isActive
10097 kshitij.so 184
    t_uri_mapping.target = uriMapping.target
8579 kshitij.so 185
    return t_uri_mapping
186
 
187
def to_t_campaign(campaign):
188
    t_campaign = TCampaign()
189
    t_campaign.id = campaign.id
190
    t_campaign.campaignName = campaign.campaignName
191
    t_campaign.imageName = campaign.imageName
192
    return t_campaign
193
 
7281 kshitij.so 194
def to_t_Amazonlisted(Amazonlisted):
195
    t_amazonlisted = TAmazonlisted()
8362 kshitij.so 196
    if Amazonlisted is None:
197
        return t_amazonlisted
7281 kshitij.so 198
    t_amazonlisted.asin = Amazonlisted.asin
199
    t_amazonlisted.brand = Amazonlisted.brand 
200
    t_amazonlisted.itemid = Amazonlisted.itemId
201
    t_amazonlisted.model = Amazonlisted.model
202
    t_amazonlisted.manufacturer_name = Amazonlisted.manufacturer_name
203
    t_amazonlisted.upc = Amazonlisted.upc
204
    t_amazonlisted.part_number = Amazonlisted.part_number
205
    t_amazonlisted.name = Amazonlisted.name
206
    t_amazonlisted.ean = Amazonlisted.ean
207
    t_amazonlisted.fbaPrice = Amazonlisted.fbaPrice
10909 vikram.rag 208
    t_amazonlisted.fbbPrice = Amazonlisted.fbbPrice
7281 kshitij.so 209
    t_amazonlisted.sellingPrice = Amazonlisted.sellingPrice
210
    t_amazonlisted.isFba = Amazonlisted.isFba
10909 vikram.rag 211
    t_amazonlisted.isFbb = Amazonlisted.isFbb
7281 kshitij.so 212
    t_amazonlisted.isNonFba = Amazonlisted.isNonFba
213
    t_amazonlisted.isInventoryOverride = Amazonlisted.isInventoryOverride
214
    t_amazonlisted.color = Amazonlisted.color
215
    t_amazonlisted.category = Amazonlisted.category
7367 kshitij.so 216
    t_amazonlisted.handlingTime = Amazonlisted.handlingTime
217
    t_amazonlisted.isCustomTime = Amazonlisted.isCustomTime
7516 vikram.rag 218
    t_amazonlisted.category_code = Amazonlisted.category_code
7770 kshitij.so 219
    t_amazonlisted.mfnPriceLastUpdatedOn = to_java_date(Amazonlisted.mfnPriceLastUpdatedOn)
220
    t_amazonlisted.fbaPriceLastUpdatedOn = to_java_date(Amazonlisted.fbaPriceLastUpdatedOn)
10909 vikram.rag 221
    t_amazonlisted.fbbPriceLastUpdatedOn = to_java_date(Amazonlisted.fbbPriceLastUpdatedOn)
7770 kshitij.so 222
    t_amazonlisted.mfnPriceLastUpdatedOnSc = to_java_date(Amazonlisted.mfnPriceLastUpdatedOnSc)
10909 vikram.rag 223
    t_amazonlisted.fbbPriceLastUpdatedOnSc = to_java_date(Amazonlisted.fbbPriceLastUpdatedOnSc)
7770 kshitij.so 224
    t_amazonlisted.fbaPriceLastUpdatedOnSc = to_java_date(Amazonlisted.fbaPriceLastUpdatedOnSc)
8139 kshitij.so 225
    t_amazonlisted.suppressMfnPriceUpdate = Amazonlisted.suppressMfnPriceUpdate
8140 kshitij.so 226
    t_amazonlisted.suppressFbaPriceUpdate = Amazonlisted.suppressFbaPriceUpdate
10909 vikram.rag 227
    t_amazonlisted.suppressFbbPriceUpdate = Amazonlisted.suppressFbbPriceUpdate
8619 kshitij.so 228
    t_amazonlisted.taxCode = Amazonlisted.taxCode
10918 vikram.rag 229
    t_amazonlisted.fbbtaxCode = Amazonlisted.fbbtaxCode
7291 vikram.rag 230
    return t_amazonlisted
231
 
8182 amar.kumar 232
def to_t_ebay_item(ebay_item):
233
    t_ebay_item = TEbayItem()
234
    t_ebay_item.ebayListingId = ebay_item.ebayListingId
235
    t_ebay_item.itemId = ebay_item.itemId
236
    t_ebay_item.listingName = ebay_item.listingName
237
    t_ebay_item.listingPrice = ebay_item.listingPrice
238
    t_ebay_item.listingExpiryDate = to_java_date(ebay_item.listingExpiryDate)
239
    t_ebay_item.subsidy = ebay_item.subsidy
8274 amit.gupta 240
    return t_ebay_item
241
 
242
def to_t_brand_info(brand_info):
243
    t_brand_info = TBrandInfo()
244
    t_brand_info.name = brand_info.name
245
    t_brand_info.serviceCenterLocatorUrl = brand_info.serviceCenterLocatorUrl
8739 vikram.rag 246
    return t_brand_info
247
 
248
def to_t_snapdeal_item(snapdealitem):
8754 vikram.rag 249
    if snapdealitem is None:
8746 vikram.rag 250
        t_snapdeal_item = TSnapdealItem()
251
        return t_snapdeal_item
8739 vikram.rag 252
    t_snapdeal_item = TSnapdealItem()
8754 vikram.rag 253
    t_snapdeal_item.item_id = snapdealitem[0].item_id
8739 vikram.rag 254
    t_snapdeal_item.warehouseId = snapdealitem[0].warehouseId
255
    t_snapdeal_item.exceptionPrice = snapdealitem[0].exceptionPrice
9242 kshitij.so 256
    t_snapdeal_item.transferPrice = snapdealitem[0].transferPrice
257
    t_snapdeal_item.sellingPrice = snapdealitem[0].sellingPrice
258
    t_snapdeal_item.courierCost = snapdealitem[0].courierCost
259
    t_snapdeal_item.commission = snapdealitem[0].commission
260
    t_snapdeal_item.serviceTax = snapdealitem[0].serviceTax
261
    t_snapdeal_item.isListedOnSnapdeal = snapdealitem[0].isListedOnSnapdeal
262
    t_snapdeal_item.suppressPriceFeed = snapdealitem[0].suppressPriceFeed
263
    t_snapdeal_item.suppressInventoryFeed = snapdealitem[0].suppressInventoryFeed
9404 vikram.rag 264
    t_snapdeal_item.maxNlc = snapdealitem[0].maxNlc
9456 vikram.rag 265
    t_snapdeal_item.skuAtSnapdeal = snapdealitem[0].skuAtSnapdeal
9568 kshitij.so 266
    t_snapdeal_item.supc = snapdealitem[0].supc
9724 kshitij.so 267
    t_snapdeal_item.shippingTime = snapdealitem[0].shippingTime
9242 kshitij.so 268
    return t_snapdeal_item
269
 
9724 kshitij.so 270
def to_t_snapdeal_item_details(snapdealitem,snapdealItemInventory):
9242 kshitij.so 271
    if snapdealitem is None:
272
        t_snapdeal_item_details = TSnapdealItemDetails()
273
        return t_snapdeal_item_details
274
    t_snapdeal_item_details = TSnapdealItemDetails()
275
    t_snapdeal_item_details.item_id = snapdealitem[0].item_id
276
    t_snapdeal_item_details.warehouseId = snapdealitem[0].warehouseId
277
    t_snapdeal_item_details.exceptionPrice = snapdealitem[0].exceptionPrice
278
    t_snapdeal_item_details.transferPrice = snapdealitem[0].transferPrice
279
    t_snapdeal_item_details.sellingPrice = snapdealitem[0].sellingPrice
280
    t_snapdeal_item_details.courierCost = snapdealitem[0].courierCost
281
    t_snapdeal_item_details.commission = snapdealitem[0].commission
282
    t_snapdeal_item_details.serviceTax = snapdealitem[0].serviceTax
283
    t_snapdeal_item_details.brand = snapdealitem[1].brand
284
    t_snapdeal_item_details.model_name = snapdealitem[1].model_name
285
    t_snapdeal_item_details.model_number = snapdealitem[1].model_number
286
    t_snapdeal_item_details.color = snapdealitem[1].color
287
    t_snapdeal_item_details.risky = snapdealitem[1].risky
288
    t_snapdeal_item_details.itemStatus = snapdealitem[1].status
289
    t_snapdeal_item_details.isListedOnSnapdeal = snapdealitem[0].isListedOnSnapdeal
290
    t_snapdeal_item_details.weight = snapdealitem[1].weight
291
    t_snapdeal_item_details.mrp = snapdealitem[1].mrp
292
    t_snapdeal_item_details.websiteSellingPrice = snapdealitem[1].sellingPrice
293
    t_snapdeal_item_details.suppressPriceFeed = snapdealitem[0].suppressPriceFeed
294
    t_snapdeal_item_details.suppressInventoryFeed = snapdealitem[0].suppressInventoryFeed
9478 kshitij.so 295
    t_snapdeal_item_details.maxNlc = snapdealitem[0].maxNlc
9456 vikram.rag 296
    t_snapdeal_item_details.skuAtSnapdeal = snapdealitem[0].skuAtSnapdeal
9568 kshitij.so 297
    t_snapdeal_item_details.supc = snapdealitem[0].supc
9724 kshitij.so 298
    t_snapdeal_item_details.shippingTime = snapdealitem[0].shippingTime
299
    if snapdealItemInventory is not None:
300
        t_snapdeal_item_details.lastUpdatedInventory = snapdealItemInventory.availability
301
        t_snapdeal_item_details.lastUpdatedInventoryTimestamp = snapdealItemInventory.lastUpdatedOnSnapdeal 
9242 kshitij.so 302
    return t_snapdeal_item_details
9621 manish.sha 303
 
304
def to_t_product_feed_submit(productfeedsubmit):
305
    if productfeedsubmit is None:
306
        t_product_feed_submit = TProductFeedSubmit()
307
        return t_product_feed_submit
308
    t_product_feed_submit = TProductFeedSubmit()
309
    t_product_feed_submit.catalogItemId = productfeedsubmit.catalogItemId
310
    t_product_feed_submit.stockLinkedFeed = productfeedsubmit.stockLinkedFeed
9724 kshitij.so 311
    return t_product_feed_submit
312
 
313
def to_t_marketplace_items(marketplaceItem):
314
    t_marketplace_item = TMarketplaceItems() 
315
    if marketplaceItem is None:
316
        return t_marketplace_item
317
    t_marketplace_item.itemId = marketplaceItem.itemId
318
    t_marketplace_item.source = marketplaceItem.source
319
    t_marketplace_item.emiFee = marketplaceItem.emiFee
320
    t_marketplace_item.courierCost = marketplaceItem.courierCost
321
    t_marketplace_item.closingFee = marketplaceItem.closingFee
322
    t_marketplace_item.commission = marketplaceItem.commission
323
    t_marketplace_item.returnProvision = marketplaceItem.returnProvision
324
    t_marketplace_item.vat = marketplaceItem.vat
325
    t_marketplace_item.packagingCost = marketplaceItem.packagingCost
326
    t_marketplace_item.otherCost = marketplaceItem.otherCost
327
    t_marketplace_item.serviceTax = marketplaceItem.serviceTax
328
    t_marketplace_item.autoIncrement = marketplaceItem.autoIncrement
329
    t_marketplace_item.autoDecrement = marketplaceItem.autoDecrement
330
    t_marketplace_item.autoFavourite = marketplaceItem.autoFavourite
331
    t_marketplace_item.manualFavourite = marketplaceItem.manualFavourite
332
    t_marketplace_item.currentSp = marketplaceItem.currentSp
333
    t_marketplace_item.currentTp = marketplaceItem.currentTp
334
    t_marketplace_item.minimumPossibleSp = marketplaceItem.minimumPossibleSp
335
    t_marketplace_item.minimumPossibleTp = marketplaceItem.minimumPossibleTp
336
    t_marketplace_item.lastCheckedTimestamp = to_java_date(marketplaceItem.lastCheckedTimestamp)
9923 kshitij.so 337
    t_marketplace_item.maximumSellingPrice = marketplaceItem.maximumSellingPrice
10287 kshitij.so 338
    t_marketplace_item.pgFee = marketplaceItem.pgFee
9724 kshitij.so 339
    return t_marketplace_item
9776 vikram.rag 340
 
341
def to_t_marketplace_itemprice(marketplaceitemprice):
342
    t_marketplace_priceitem = TMarketPlaceItemPrice()    
343
    t_marketplace_priceitem.item_id = marketplaceitemprice.item_id
344
    t_marketplace_priceitem.source = marketplaceitemprice.source
345
    t_marketplace_priceitem.sellingPrice = marketplaceitemprice.sellingPrice
346
    t_marketplace_priceitem.lastUpdatedOn = to_java_date(marketplaceitemprice.lastUpdatedOn)
347
    t_marketplace_priceitem.lastUpdatedOnMarketplace = to_java_date(marketplaceitemprice.lastUpdatedOnMarketplace)
348
    t_marketplace_priceitem.isPriceOverride = marketplaceitemprice.suppressPriceFeed
349
    t_marketplace_priceitem.isListedOnSource = marketplaceitemprice.isListedOnSource
350
    return t_marketplace_priceitem 
9779 kshitij.so 351
 
352
def to_t_marketplacepercentage(marketplacePercentage):
353
    t_marketplacepercentage = TMarketplacePercentage()
354
    if marketplacePercentage is None:
355
        return t_marketplacepercentage
356
    t_marketplacepercentage.source =  marketplacePercentage.source
357
    t_marketplacepercentage.emiFee =  marketplacePercentage.emiFee
358
    t_marketplacepercentage.closingFee = marketplacePercentage.closingFee
359
    t_marketplacepercentage.returnProvision = marketplacePercentage.returnProvision
360
    t_marketplacepercentage.commission = marketplacePercentage.commission
361
    t_marketplacepercentage.serviceTax = marketplacePercentage.serviceTax
10287 kshitij.so 362
    t_marketplacepercentage.pgFee = marketplacePercentage.pgFee
9779 kshitij.so 363
    return t_marketplacepercentage
9945 vikram.rag 364
 
365
def to_t_flipkart_item(flipkartItem):
366
    t_flipkartitem = TFlipkartItem()
367
    if flipkartItem is None:
368
        return t_flipkartitem
10097 kshitij.so 369
    t_flipkartitem.item_id = flipkartItem[0].item_id  
370
    t_flipkartitem.exceptionPrice = flipkartItem[0].exceptionPrice
371
    t_flipkartitem.warehouseId = flipkartItem[0].warehouseId
372
    t_flipkartitem.commissionValue  =  flipkartItem[0].commissionValue
373
    t_flipkartitem.serviceTaxValue  =  flipkartItem[0].serviceTaxValue
374
    t_flipkartitem.maxNlc = flipkartItem[0].maxNlc
375
    t_flipkartitem.skuAtFlipkart = flipkartItem[0].skuAtFlipkart
376
    t_flipkartitem.isListedOnFlipkart = flipkartItem[0].isListedOnFlipkart
377
    t_flipkartitem.suppressPriceFeed = flipkartItem[0].suppressPriceFeed
378
    t_flipkartitem.suppressInventoryFeed = flipkartItem[0].suppressInventoryFeed
379
    #t_flipkartitem.updatedOn = to_java_date(flipkartItem.updatedOn)
380
    t_flipkartitem.updatedBy = flipkartItem[0].updatedBy
381
    t_flipkartitem.flipkartSerialNumber = flipkartItem[0].flipkartSerialNumber
9945 vikram.rag 382
    return t_flipkartitem
10097 kshitij.so 383
 
384
def to_t_flipkart_item_details(flipkartitem,flipkartItemInventory):
385
    if flipkartitem is None:
386
        t_flipkart_item_details = TFlipkartItemDetails()
387
        return t_flipkart_item_details
388
    t_flipkart_item_details = TFlipkartItemDetails()
389
    t_flipkart_item_details.item_id = flipkartitem[0].item_id
390
    t_flipkart_item_details.warehouseId = flipkartitem[0].warehouseId
391
    t_flipkart_item_details.exceptionPrice = flipkartitem[0].exceptionPrice
392
    t_flipkart_item_details.commission = flipkartitem[0].commissionValue
393
    t_flipkart_item_details.serviceTax = flipkartitem[0].serviceTaxValue
394
    t_flipkart_item_details.brand = flipkartitem[1].brand
395
    t_flipkart_item_details.model_name = flipkartitem[1].model_name
396
    t_flipkart_item_details.model_number = flipkartitem[1].model_number
397
    t_flipkart_item_details.color = flipkartitem[1].color
398
    t_flipkart_item_details.risky = flipkartitem[1].risky
399
    t_flipkart_item_details.itemStatus = flipkartitem[1].status
400
    t_flipkart_item_details.isListedOnFlipkart = flipkartitem[0].isListedOnFlipkart
401
    t_flipkart_item_details.weight = flipkartitem[1].weight
402
    t_flipkart_item_details.mrp = flipkartitem[1].mrp
403
    t_flipkart_item_details.websiteSellingPrice = flipkartitem[1].sellingPrice
404
    t_flipkart_item_details.suppressPriceFeed = flipkartitem[0].suppressPriceFeed
405
    t_flipkart_item_details.suppressInventoryFeed = flipkartitem[0].suppressInventoryFeed
406
    t_flipkart_item_details.maxNlc = flipkartitem[0].maxNlc
407
    t_flipkart_item_details.skuAtFlipkart = flipkartitem[0].skuAtFlipkart
408
    t_flipkart_item_details.flipkartSerialNumber = flipkartitem[0].flipkartSerialNumber
10156 amar.kumar 409
    t_flipkart_item_details.category = flipkartitem[1].category
10097 kshitij.so 410
    if flipkartItemInventory is not None:
411
        t_flipkart_item_details.lastUpdatedInventory = flipkartItemInventory.availability
412
        #t_flipkart_item_details.lastUpdatedInventoryTimestamp = flipkartItemInventory.lastUpdatedOnFlipkart 
413
    return t_flipkart_item_details
11015 kshitij.so 414
 
415
def to_t_market_place_history(marketplaceHistory):
416
    t_marketplace_history = TMarketplaceHistory()
417
    if marketplaceHistory is None:
418
        return t_marketplace_history
419
    t_marketplace_history.item_id = marketplaceHistory.item_id
420
    t_marketplace_history.source = marketplaceHistory.source
421
    t_marketplace_history.timestamp = to_java_date(marketplaceHistory.timestamp)
11076 kshitij.so 422
    if marketplaceHistory.lowestPossibleTp is None:
423
        t_marketplace_history.lowest_possible_tp =0
424
    else:
425
        t_marketplace_history.lowest_possible_tp = int(marketplaceHistory.lowestPossibleTp)
426
    if marketplaceHistory.lowestPossibleSp is None:
427
        t_marketplace_history.lowest_possible_sp = 0
428
    else:
429
        t_marketplace_history.lowest_possible_sp = int(marketplaceHistory.lowestPossibleSp)
11015 kshitij.so 430
    t_marketplace_history.ourInventory = marketplaceHistory.ourInventory
431
    t_marketplace_history.otherInventory = marketplaceHistory.otherInventory
432
    t_marketplace_history.secondLowestInventory = marketplaceHistory.secondLowestInventory
433
    t_marketplace_history.ourRank = marketplaceHistory.ourRank
11076 kshitij.so 434
    if marketplaceHistory.ourOfferPrice is None:
435
        t_marketplace_history.ourOfferPrice = 0
436
    else: 
437
        t_marketplace_history.ourOfferPrice = int(marketplaceHistory.ourOfferPrice)
438
    if marketplaceHistory.ourSellingPrice is None:
439
        t_marketplace_history.ourSellingPrice = 0
440
    else:
441
        t_marketplace_history.ourSellingPrice = int(marketplaceHistory.ourSellingPrice)
442
    if marketplaceHistory.ourTp is None:
443
        t_marketplace_history.ourTp = 0
444
    else:
445
        t_marketplace_history.ourTp = int(marketplaceHistory.ourTp)
446
    if marketplaceHistory.ourNlc is None:
447
        t_marketplace_history.ourNlc = 0
448
    else:
449
        t_marketplace_history.ourNlc = int(marketplaceHistory.ourNlc)
11015 kshitij.so 450
    t_marketplace_history.competitiveCategory = marketplaceHistory.competitiveCategory
451
    t_marketplace_history.risky = marketplaceHistory.risky
11076 kshitij.so 452
    if marketplaceHistory.lowestOfferPrice is None:
453
        t_marketplace_history.lowestOfferPrice = 0
454
    else:
455
        t_marketplace_history.lowestOfferPrice = int(marketplaceHistory.lowestOfferPrice)
456
    if marketplaceHistory.lowestSellingPrice is None:
457
        t_marketplace_history.lowestSellingPrice = 0
458
    else:
459
        t_marketplace_history.lowestSellingPrice = int(marketplaceHistory.lowestSellingPrice)
460
    if marketplaceHistory.lowestTp is None:
461
        t_marketplace_history.lowestTp = 0
462
    else:
463
        t_marketplace_history.lowestTp = int(marketplaceHistory.lowestTp)
11015 kshitij.so 464
    if marketplaceHistory.lowestSellerName is None:
465
        t_marketplace_history.lowestSellerName = ''
466
    else:
467
        t_marketplace_history.lowestSellerName = marketplaceHistory.lowestSellerName
11076 kshitij.so 468
    if marketplaceHistory.proposedSellingPrice is None:
469
        t_marketplace_history.proposedSellingPrice = 0
470
    else:
471
        t_marketplace_history.proposedSellingPrice = int(marketplaceHistory.proposedSellingPrice)
472
    if marketplaceHistory.proposedTp is None:
473
        t_marketplace_history.proposedTp = 0
474
    else:
475
        t_marketplace_history.proposedTp = int(marketplaceHistory.proposedTp)
476
    if marketplaceHistory.targetNlc is None:
477
        t_marketplace_history.targetNlc = 0
478
    else:
479
        t_marketplace_history.targetNlc = int(marketplaceHistory.targetNlc)
11015 kshitij.so 480
    t_marketplace_history.salesPotential = marketplaceHistory.salesPotential
481
    if marketplaceHistory.secondLowestSellerName is None:
482
        t_marketplace_history.secondLowestSellerName = ''
483
    else:
484
        t_marketplace_history.secondLowestSellerName = marketplaceHistory.secondLowestSellerName
11017 kshitij.so 485
    if marketplaceHistory.secondLowestSellingPrice is None:
11076 kshitij.so 486
        t_marketplace_history.secondLowestSellingPrice=0
11017 kshitij.so 487
    else:
11076 kshitij.so 488
        t_marketplace_history.secondLowestSellingPrice = int(marketplaceHistory.secondLowestSellingPrice)
11017 kshitij.so 489
    if marketplaceHistory.secondLowestOfferPrice is None:
11076 kshitij.so 490
        t_marketplace_history.secondLowestOfferPrice = 0
11017 kshitij.so 491
    else:
11076 kshitij.so 492
        t_marketplace_history.secondLowestOfferPrice = int(marketplaceHistory.secondLowestOfferPrice)
11017 kshitij.so 493
    if marketplaceHistory.secondLowestTp is None:
11076 kshitij.so 494
        t_marketplace_history.secondLowestTp=0
11017 kshitij.so 495
    else:
11076 kshitij.so 496
        t_marketplace_history.secondLowestTp = int(marketplaceHistory.secondLowestTp)
11015 kshitij.so 497
    t_marketplace_history.marginIncreasedPotential = marketplaceHistory.marginIncreasedPotential
11076 kshitij.so 498
    if marketplaceHistory.margin is None:
499
        t_marketplace_history.margin = 0
500
    else:
501
        t_marketplace_history.margin = int(marketplaceHistory.margin)
11015 kshitij.so 502
    t_marketplace_history.ourEnoughStock = marketplaceHistory.ourEnoughStock
503
    t_marketplace_history.totalSeller = marketplaceHistory.totalSeller
504
    t_marketplace_history.averageSale = marketplaceHistory.avgSales
505
    t_marketplace_history.toGroup = marketplaceHistory.toGroup
11076 kshitij.so 506
    t_marketplace_history.decision = marketplaceHistory.decision
507
    t_marketplace_history.reason = marketplaceHistory.reason
11015 kshitij.so 508
    return t_marketplace_history
9945 vikram.rag 509
 
11015 kshitij.so 510