Subversion Repositories SmartDukaan

Rev

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

Rev 8532 Rev 8544
Line 172... Line 172...
172
					} catch (FileNotFoundException e) {
172
					} catch (FileNotFoundException e) {
173
						// TODO Auto-generated catch block
173
						// TODO Auto-generated catch block
174
						e.printStackTrace();
174
						e.printStackTrace();
175
					}
175
					}
176
					String [] nextLine;
176
					String [] nextLine;
177
					CatalogClient catalogServiceClient = null;
177
					//CatalogClient catalogServiceClient = null;
178
					InventoryClient inventoryServiceClient = null;
178
					InventoryClient inventoryServiceClient = null;
179
					try {
179
					try {
180
						inventoryServiceClient = new InventoryClient();
180
						inventoryServiceClient = new InventoryClient();
181
						//catalogServiceClient = new CatalogClient();
181
						//catalogServiceClient = new CatalogClient();
182
						catalogServiceClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port");
182
						//catalogServiceClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port");
183
					} catch (Exception e) {
183
					} catch (Exception e) {
184
						// TODO Auto-generated catch block
184
						// TODO Auto-generated catch block
185
						e.printStackTrace();
185
						e.printStackTrace();
186
					}	
186
					}	
187
					in.shop2020.model.v1.catalog.CatalogService.Client catalogClient   = catalogServiceClient.getClient();
187
					//in.shop2020.model.v1.catalog.CatalogService.Client catalogClient   = catalogServiceClient.getClient();
188
					in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = inventoryServiceClient.getClient();
188
					in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = inventoryServiceClient.getClient();
189
					try {
189
					try {
190
						while ((nextLine = reader.readNext()) != null) {
190
						while ((nextLine = reader.readNext()) != null) {
191
							// nextLine[] is an array of values from the line
191
							// nextLine[] is an array of values from the line
192
							//System.out.println(nextLine[0] +" "+ nextLine[1]+" " + nextLine[2]+" " + nextLine[3] +" "+ nextLine[4] +" " + nextLine[5]);
192
							//System.out.println(nextLine[0] +" "+ nextLine[1]+" " + nextLine[2]+" " + nextLine[3] +" "+ nextLine[4] +" " + nextLine[5]);
193
							if(nextLine[0].startsWith("FBA") && nextLine[4].equalsIgnoreCase("SELLABLE") ){
193
							if(nextLine[0].startsWith("FBA") && nextLine[4].equalsIgnoreCase("SELLABLE") ){
194
								//System.out.println("Item ID" + nextLine[0].replaceAll("FBA","") + "---"+"Inventory" + nextLine[5]);
194
								//System.out.println("Item ID" + nextLine[0].replaceAll("FBA","") + "---"+"Inventory" + nextLine[5]);
195
								if(catalogClient.getAmazonItemDetails(Long.parseLong(nextLine[0].replaceAll("FBA",""))).getItemid()!=0){
195
						//if(catalogClient.getAmazonItemDetails(Long.parseLong(nextLine[0].replaceAll("FBA",""))).getItemid()!=0){
196
									AmazonFbaInventorySnapshot amazonfbainventorysnapshot = new AmazonFbaInventorySnapshot() ;
196
									AmazonFbaInventorySnapshot amazonfbainventorysnapshot = new AmazonFbaInventorySnapshot() ;
197
									amazonfbainventorysnapshot.setAvailability(Long.parseLong(nextLine[5]));
197
									amazonfbainventorysnapshot.setAvailability(Long.parseLong(nextLine[5]));
198
									amazonfbainventorysnapshot.setItem_id(Long.parseLong(nextLine[0].replaceAll("FBA","")));
198
									amazonfbainventorysnapshot.setItem_id(Long.parseLong(nextLine[0].replaceAll("FBA","")));
199
									inventoryClient.addOrUpdateAmazonFbaInventory(amazonfbainventorysnapshot);
199
									inventoryClient.addOrUpdateAmazonFbaInventory(amazonfbainventorysnapshot);
200
								}
200
						//		}
201
							}
201
							}
202
						}
202
						}
203
					} catch (IOException e) {
203
					} catch (IOException e) {
204
						// TODO Auto-generated catch block
204
						// TODO Auto-generated catch block
205
						e.printStackTrace();
205
						e.printStackTrace();