Subversion Repositories SmartDukaan

Rev

Rev 10353 | Rev 12098 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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