| Line 31... |
Line 31... |
| 31 |
workbook = xlrd.open_workbook(filename)
|
31 |
workbook = xlrd.open_workbook(filename)
|
| 32 |
sheet = workbook.sheet_by_index(0)
|
32 |
sheet = workbook.sheet_by_index(0)
|
| 33 |
num_rows = sheet.nrows
|
33 |
num_rows = sheet.nrows
|
| 34 |
updatedOn = to_java_date(datetime.datetime.now())
|
34 |
updatedOn = to_java_date(datetime.datetime.now())
|
| 35 |
cclient = CatalogClient().get_client()
|
35 |
cclient = CatalogClient().get_client()
|
| - |
|
36 |
prodClient = CatalogClient("catalog_service_server_host_prod").get_client()
|
| - |
|
37 |
iclient = InventoryClient().get_client()
|
| - |
|
38 |
|
| 36 |
tcategories = cclient.getAllCategories()
|
39 |
tcategories = cclient.getAllCategories()
|
| 37 |
parent_category_ids = []
|
40 |
parent_category_ids = []
|
| 38 |
categoryMap = {}
|
41 |
categoryMap = {}
|
| 39 |
#0-Delhi 1-Maha 2-Blr 3-Ggn 4-Rajasthan 5-Telangana 6-Gujarat
|
42 |
#0-Delhi 1-Maha 2-Blr 3-Ggn 4-Rajasthan 5-Telangana 6-Gujarat
|
| 40 |
|
43 |
|
| Line 46... |
Line 49... |
| 46 |
if tcategory.id not in parent_category_ids:
|
49 |
if tcategory.id not in parent_category_ids:
|
| 47 |
categoryMap[tcategory.label] = tcategory.id
|
50 |
categoryMap[tcategory.label] = tcategory.id
|
| 48 |
|
51 |
|
| 49 |
message = ""
|
52 |
message = ""
|
| 50 |
for rownum in range(1, num_rows):
|
53 |
for rownum in range(1, num_rows):
|
| 51 |
if (rownum-1)%5==0:
|
- |
|
| 52 |
print "Sleeping for 10 sec"
|
- |
|
| 53 |
time.sleep(10)
|
- |
|
| 54 |
cclient = CatalogClient().get_client()
|
- |
|
| 55 |
prodClient = CatalogClient("catalog_service_server_host_prod").get_client()
|
- |
|
| 56 |
iclient = InventoryClient().get_client()
|
- |
|
| 57 |
|
- |
|
| 58 |
states = {}
|
54 |
states = {}
|
| 59 |
try:
|
55 |
try:
|
| 60 |
product_group, category_name, brand, model_number, model_name, color, mrp, sp, mop, dp, tp, nlc, start_date, preferred_vendor, risky, weight, item_type, states[0], states[3], states[1], states[2] = sheet.row_values(rownum)[0:21]
|
56 |
product_group, category_name, brand, model_number, model_name, color, mrp, sp, mop, dp, tp, nlc, start_date, preferred_vendor, risky, weight, item_type, states[0], states[3], states[1], states[2] = sheet.row_values(rownum)[0:21]
|
| 61 |
if isinstance(model_number, float):
|
57 |
if isinstance(model_number, float):
|
| 62 |
model_number = str(int(model_number))
|
58 |
model_number = str(int(model_number))
|
| Line 112... |
Line 108... |
| 112 |
except:
|
108 |
except:
|
| 113 |
prodClient = CatalogClient("catalog_service_server_host_prod").get_client()
|
109 |
prodClient = CatalogClient("catalog_service_server_host_prod").get_client()
|
| 114 |
break
|
110 |
break
|
| 115 |
except Exception as e:
|
111 |
except Exception as e:
|
| 116 |
cclient = CatalogClient().get_client()
|
112 |
cclient = CatalogClient().get_client()
|
| 117 |
|
113 |
break
|
| 118 |
vip = VendorItemPricing()
|
114 |
vip = VendorItemPricing()
|
| 119 |
vip.itemId = item_id
|
115 |
vip.itemId = item_id
|
| 120 |
vip.dealerPrice = round(dp)
|
116 |
vip.dealerPrice = round(dp)
|
| 121 |
vip.mop = round(mop)
|
117 |
vip.mop = round(mop)
|
| 122 |
vip.nlc = round(nlc)
|
118 |
vip.nlc = round(nlc)
|
| Line 131... |
Line 127... |
| 131 |
|
127 |
|
| 132 |
except Exception as e:
|
128 |
except Exception as e:
|
| 133 |
message = message + "\t" + str(brand) + "\t" + str(model_name) + "\t" + str(model_number) + "\t" + str(e.message) + "\n"
|
129 |
message = message + "\t" + str(brand) + "\t" + str(model_name) + "\t" + str(model_number) + "\t" + str(e.message) + "\n"
|
| 134 |
print message
|
130 |
print message
|
| 135 |
mail("build@shop2020.in", "cafe@nes", ["amit.gupta@shop2020.in", "chandan.kumar@shop2020.in"], "Problem while adding items", message, [], [], [])
|
131 |
mail("build@shop2020.in", "cafe@nes", ["amit.gupta@shop2020.in", "chandan.kumar@shop2020.in"], "Problem while adding items", message, [], [], [])
|
| - |
|
132 |
print "Successfully updated the item list information."
|
| 136 |
|
133 |
|
| 137 |
|
134 |
|
| 138 |
def main():
|
135 |
def main():
|
| 139 |
parser = optparse.OptionParser()
|
136 |
parser = optparse.OptionParser()
|
| 140 |
parser.add_option("-f", "--file", dest="filename",
|
137 |
parser.add_option("-f", "--file", dest="filename",
|