| Line 39... |
Line 39... |
| 39 |
|
39 |
|
| 40 |
private static Logger logger = LoggerFactory.getLogger(StockSalesReportFetcher.class);
|
40 |
private static Logger logger = LoggerFactory.getLogger(StockSalesReportFetcher.class);
|
| 41 |
|
41 |
|
| 42 |
private static void createAndMailReport() {
|
42 |
private static void createAndMailReport() {
|
| 43 |
try {
|
43 |
try {
|
| - |
|
44 |
CatalogClient catalogServiceClient = new CatalogClient();
|
| 44 |
CatalogService.Client catalogClient = new CatalogClient().getClient();
|
45 |
CatalogService.Client catalogClient = catalogServiceClient.getClient();
|
| 45 |
List<Item> itemList = catalogClient.getAllAliveItems();
|
46 |
List<Item> itemList = catalogClient.getAllAliveItems();
|
| 46 |
|
47 |
|
| 47 |
if(!catalogClient.isAlive()){
|
48 |
if(!catalogClient.isAlive()){
|
| 48 |
catalogClient = new CatalogClient().getClient();
|
49 |
catalogClient = catalogServiceClient.getClient();
|
| 49 |
}
|
50 |
}
|
| 50 |
List<Category> allCategories = catalogClient.getAllCategories();
|
51 |
List<Category> allCategories = catalogClient.getAllCategories();
|
| 51 |
Map<Long, String> categoryIdLabelMap = new Hashtable<Long, String>();
|
52 |
Map<Long, String> categoryIdLabelMap = new Hashtable<Long, String>();
|
| 52 |
for(Category category : allCategories) {
|
53 |
for(Category category : allCategories) {
|
| 53 |
categoryIdLabelMap.put(category.getId(), category.getLabel());
|
54 |
categoryIdLabelMap.put(category.getId(), category.getLabel());
|
| 54 |
}
|
55 |
}
|
| 55 |
|
56 |
|
| - |
|
57 |
InventoryClient inventoryServiceClient = new InventoryClient();
|
| 56 |
InventoryService.Client inventoryClient = new InventoryClient().getClient();
|
58 |
InventoryService.Client inventoryClient = inventoryServiceClient.getClient();
|
| 57 |
Map<Long, ItemInventory> inventoryMap = inventoryClient.getInventorySnapshot(0);
|
59 |
Map<Long, ItemInventory> inventoryMap = inventoryClient.getInventorySnapshot(0);
|
| 58 |
|
60 |
|
| 59 |
if(!inventoryClient.isAlive()){
|
61 |
if(!inventoryClient.isAlive()){
|
| 60 |
inventoryClient = new InventoryClient().getClient();
|
62 |
inventoryClient = inventoryServiceClient.getClient();
|
| 61 |
}
|
63 |
}
|
| 62 |
List<OOSStatus> oosStatuses = inventoryClient.getOosStatusesForXDays(-1, NUMBER_OF_DAYS_SALE);
|
64 |
List<OOSStatus> oosStatuses = inventoryClient.getOosStatusesForXDays(-1, NUMBER_OF_DAYS_SALE);
|
| 63 |
Map<Long, List<OOSStatus>> oosStatusMapByItem = new Hashtable<Long, List<OOSStatus>>(5000);
|
65 |
Map<Long, List<OOSStatus>> oosStatusMapByItem = new Hashtable<Long, List<OOSStatus>>(5000);
|
| 64 |
for(OOSStatus oosStatus : oosStatuses) {
|
66 |
for(OOSStatus oosStatus : oosStatuses) {
|
| 65 |
List<OOSStatus> oosStatusList;
|
67 |
List<OOSStatus> oosStatusList;
|
| Line 73... |
Line 75... |
| 73 |
}
|
75 |
}
|
| 74 |
oosStatusMapByItem.put(itemId, oosStatusList);
|
76 |
oosStatusMapByItem.put(itemId, oosStatusList);
|
| 75 |
}
|
77 |
}
|
| 76 |
|
78 |
|
| 77 |
if(!inventoryClient.isAlive()){
|
79 |
if(!inventoryClient.isAlive()){
|
| 78 |
inventoryClient = new InventoryClient().getClient();
|
80 |
inventoryClient = inventoryServiceClient.getClient();
|
| 79 |
}
|
81 |
}
|
| 80 |
List<Warehouse> ourGoodWarehouses = inventoryClient.getWarehouses(WarehouseType.OURS, InventoryType.GOOD, 0, 0, 0);
|
82 |
List<Warehouse> ourGoodWarehouses = inventoryClient.getWarehouses(WarehouseType.OURS, InventoryType.GOOD, 0, 0, 0);
|
| 81 |
Map<Long, Warehouse> ourWarehouseMap = new Hashtable<Long, Warehouse>(200);
|
83 |
Map<Long, Warehouse> ourWarehouseMap = new Hashtable<Long, Warehouse>(200);
|
| 82 |
for(Warehouse warehouse : ourGoodWarehouses) {
|
84 |
for(Warehouse warehouse : ourGoodWarehouses) {
|
| 83 |
//System.out.println("Warehouse = " + warehouse.getId());
|
85 |
//System.out.println("Warehouse = " + warehouse.getId());
|
| 84 |
ourWarehouseMap.put(warehouse.getId(), warehouse);
|
86 |
ourWarehouseMap.put(warehouse.getId(), warehouse);
|
| 85 |
}
|
87 |
}
|
| 86 |
|
88 |
|
| 87 |
if(!inventoryClient.isAlive()){
|
89 |
if(!inventoryClient.isAlive()){
|
| 88 |
inventoryClient = new InventoryClient().getClient();
|
90 |
inventoryClient = inventoryServiceClient.getClient();
|
| 89 |
}
|
91 |
}
|
| 90 |
List<VendorItemPricing> vendorItemPricings = inventoryClient.getAllVendorItemPricing(0, 0);
|
92 |
List<VendorItemPricing> vendorItemPricings = inventoryClient.getAllVendorItemPricing(0, 0);
|
| 91 |
Map<Long, List<VendorItemPricing>> itemPricingMap = new Hashtable<Long, List<VendorItemPricing>>(5000);
|
93 |
Map<Long, List<VendorItemPricing>> itemPricingMap = new Hashtable<Long, List<VendorItemPricing>>(5000);
|
| 92 |
for(VendorItemPricing vendorItemPricing : vendorItemPricings) {
|
94 |
for(VendorItemPricing vendorItemPricing : vendorItemPricings) {
|
| 93 |
List<VendorItemPricing> pricingListForItem;
|
95 |
List<VendorItemPricing> pricingListForItem;
|