| Line 1169... |
Line 1169... |
| 1169 |
itemCountMap = {}
|
1169 |
itemCountMap = {}
|
| 1170 |
oosDate = oosDate - datetime.timedelta(days = 1) - datetime.timedelta(hours = 1)
|
1170 |
oosDate = oosDate - datetime.timedelta(days = 1) - datetime.timedelta(hours = 1)
|
| 1171 |
lines = session.query(OOSStatus.item_id, func.sum(OOSStatus.num_orders)/func.count(OOSStatus.num_orders)).filter(OOSStatus.date >= oosDate).filter(OOSStatus.sourceId == 1).filter(OOSStatus.is_oos == 0).group_by(OOSStatus.item_id).all()
|
1171 |
lines = session.query(OOSStatus.item_id, func.sum(OOSStatus.num_orders)/func.count(OOSStatus.num_orders)).filter(OOSStatus.date >= oosDate).filter(OOSStatus.sourceId == 1).filter(OOSStatus.is_oos == 0).group_by(OOSStatus.item_id).all()
|
| 1172 |
for line in lines:
|
1172 |
for line in lines:
|
| 1173 |
item_id = line[0]
|
1173 |
item_id = line[0]
|
| 1174 |
quantity = int(math.ceil(max(1,3*line[1])))
|
1174 |
quantity = int(math.ceil(max(1,2*line[1])))
|
| 1175 |
itemCountMap[item_id] = quantity
|
1175 |
itemCountMap[item_id] = quantity
|
| 1176 |
cl = CatalogClient('catalog_service_server_host_prod','catalog_service_server_port').get_client()
|
1176 |
cl = CatalogClient('catalog_service_server_host_prod','catalog_service_server_port').get_client()
|
| 1177 |
cl.updateItemHoldInventory(itemCountMap)
|
1177 |
cl.updateItemHoldInventory(itemCountMap)
|
| 1178 |
|
1178 |
|
| 1179 |
def get_oos_statuses_for_x_days_for_item(itemId, sourceId, days):
|
1179 |
def get_oos_statuses_for_x_days_for_item(itemId, sourceId, days):
|
| Line 1327... |
Line 1327... |
| 1327 |
heldInventoryQuery = heldInventoryQuery.filter_by(warehouse_id = warehouseId)
|
1327 |
heldInventoryQuery = heldInventoryQuery.filter_by(warehouse_id = warehouseId)
|
| 1328 |
if source:
|
1328 |
if source:
|
| 1329 |
heldInventoryQuery = heldInventoryQuery.filter_by(source = source)
|
1329 |
heldInventoryQuery = heldInventoryQuery.filter_by(source = source)
|
| 1330 |
holdInventoryDetails = heldInventoryQuery.all()
|
1330 |
holdInventoryDetails = heldInventoryQuery.all()
|
| 1331 |
return holdInventoryDetails
|
1331 |
return holdInventoryDetails
|
| 1332 |
|
- |
|
| 1333 |
|
1332 |
|
| - |
|
1333 |
|