Subversion Repositories SmartDukaan

Rev

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

Rev 11894 Rev 11940
Line 23... Line 23...
23
import java.io.File;
23
import java.io.File;
24
import java.io.FileWriter;
24
import java.io.FileWriter;
25
import java.io.IOException;
25
import java.io.IOException;
26
import java.io.InputStreamReader;
26
import java.io.InputStreamReader;
27
import java.util.ArrayList;
27
import java.util.ArrayList;
-
 
28
import java.util.Collections;
28
import java.util.HashMap;
29
import java.util.HashMap;
29
import java.util.HashSet;
30
import java.util.HashSet;
30
import java.util.Iterator;
31
import java.util.Iterator;
31
import java.util.List;
32
import java.util.List;
32
import java.util.Map;
33
import java.util.Map;
Line 47... Line 48...
47
import org.apache.http.message.BasicNameValuePair;
48
import org.apache.http.message.BasicNameValuePair;
48
import org.apache.http.params.HttpParams;
49
import org.apache.http.params.HttpParams;
49
import org.apache.thrift.TException;
50
import org.apache.thrift.TException;
50
import org.apache.thrift.transport.TTransportException;
51
import org.apache.thrift.transport.TTransportException;
51
 
52
 
-
 
53
public class NlcLeftOutInventoryDetailScript {
52
 
54
 
53
public class NlcLeftOutInventoryDetailScript{
-
 
54
 
-
 
55
	//private static ArrayList<Inventory> currentInventoryItemList;
55
	// private static ArrayList<Inventory> currentInventoryItemList;
56
	private static List<SnapdealItemDetails> snapdealItems;
56
	private static List<SnapdealItemDetails> snapdealItems;
57
	private static List<FlipkartItem> flipkartItems;
57
	private static List<FlipkartItem> flipkartItems;
58
	private static List<FlipkartItem> flipkartInventoryItems = new ArrayList<FlipkartItem>();
58
	private static List<FlipkartItem> flipkartInventoryItems = new ArrayList<FlipkartItem>();
59
	static Map<Long,SnapdealItemDetails> snapdealItemMap = new HashMap<Long,SnapdealItemDetails>();
59
	static Map<Long, SnapdealItemDetails> snapdealItemMap = new HashMap<Long, SnapdealItemDetails>();
60
	static Map<Long,FlipkartItem> flipkartItemMap = new HashMap<Long,FlipkartItem>();
60
	static Map<Long, FlipkartItem> flipkartItemMap = new HashMap<Long, FlipkartItem>();
61
	//private static Map<Long, SnapdealItemForInventory> allItemsInventoryMap = new HashMap<Long, SnapdealItemForInventory>();
61
	// private static Map<Long, SnapdealItemForInventory> allItemsInventoryMap =
-
 
62
	// new HashMap<Long, SnapdealItemForInventory>();
62
	private static Map<Long, String> vendorDataMap = new HashMap<Long, String>();
63
	private static Map<Long, String> vendorDataMap = new HashMap<Long, String>();
63
	//static java.text.SimpleDateFormat sdf;
64
	// static java.text.SimpleDateFormat sdf;
64
	static String emailFromAddress;
65
	static String emailFromAddress;
65
	static String password;
66
	static String password;
66
	static GmailUtils mailer;
67
	static GmailUtils mailer;
67
	static String sendTo[];
68
	static String sendTo[];
68
	private static Map<String, Map<Long, NlcLeftOutInventory>> nlcLoiItemsMapSD = new HashMap<String, Map<Long, NlcLeftOutInventory>>();
69
	private static Map<String, Map<Long, NlcLeftOutInventory>> nlcLoiItemsMapSD = new HashMap<String, Map<Long, NlcLeftOutInventory>>();
69
	private static Map<String, Map<Long, NlcLeftOutInventory>> nlcLoiItemsMapFK = new HashMap<String, Map<Long, NlcLeftOutInventory>>();
70
	private static Map<String, Map<Long, NlcLeftOutInventory>> nlcLoiItemsMapFK = new HashMap<String, Map<Long, NlcLeftOutInventory>>();
70
 
71
 
-
 
72
	private static List<NlcLeftOutInventory> mainNlcLoiItemsListSD = new ArrayList<NlcLeftOutInventory>();
-
 
73
	private static List<NlcLeftOutInventory> mainNlcLoiItemsListFK = new ArrayList<NlcLeftOutInventory>();
-
 
74
 
71
	static{
75
	static {
72
		emailFromAddress = "build-staging@shop2020.in";
76
		emailFromAddress = "build-staging@shop2020.in";
73
		password = "shop2020";
77
		password = "shop2020";
74
		mailer = new GmailUtils();
78
		mailer = new GmailUtils();
75
		sendTo = new String[]{"vikram.raghav@shop2020.in", "manish.sharma@shop2020.in"};
79
		sendTo = new String[] { "vikram.raghav@shop2020.in",
-
 
80
				"manish.sharma@shop2020.in" };
-
 
81
		/*
-
 
82
		 * sendTo = new String[]{ "sandeep.sachdeva@shop2020.in",
76
		/*sendTo = new String[]{ "sandeep.sachdeva@shop2020.in", "vikram.raghav@shop2020.in", "rajneesh.arora@shop2020.in",
83
		 * "vikram.raghav@shop2020.in", "rajneesh.arora@shop2020.in",
-
 
84
		 * "khushal.bhatia@shop2020.in"
77
				"khushal.bhatia@shop2020.in","manoj.kumar@saholic.com","chaitnaya.vats@saholic.com",
85
		 * ,"manoj.kumar@saholic.com","chaitnaya.vats@saholic.com",
-
 
86
		 * "yukti.jain@shop2020.in"
78
				"yukti.jain@shop2020.in","manisha.sharma@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in"};*/
87
		 * ,"manisha.sharma@shop2020.in","chandan.kumar@shop2020.in"
-
 
88
		 * ,"ankush.dhingra@shop2020.in"};
-
 
89
		 */
79
		CatalogClient catalogServiceClient = null;
90
		CatalogClient catalogServiceClient = null;
80
		try {
91
		try {
81
			catalogServiceClient = new CatalogClient();
92
			catalogServiceClient = new CatalogClient();
82
		} catch (TTransportException e1) {
93
		} catch (TTransportException e1) {
83
			// TODO Auto-generated catch block
94
			// TODO Auto-generated catch block
84
			e1.printStackTrace();
95
			e1.printStackTrace();
85
		}
96
		}
86
		in.shop2020.model.v1.catalog.CatalogService.Client catalogClient = catalogServiceClient.getClient();
97
		in.shop2020.model.v1.catalog.CatalogService.Client catalogClient = catalogServiceClient
-
 
98
				.getClient();
87
 
99
 
88
		try {
100
		try {
89
			snapdealItems = catalogClient.getAllSnapdealItems();
101
			snapdealItems = catalogClient.getAllSnapdealItems();
90
			flipkartItems = catalogClient.getAllFlipkartItems();
102
			flipkartItems = catalogClient.getAllFlipkartItems();
91
		} catch (TException e) {
103
		} catch (TException e) {
92
			// TODO Auto-generated catch block
104
			// TODO Auto-generated catch block
93
			e.printStackTrace();
105
			e.printStackTrace();
94
		}
106
		}
95
		for(FlipkartItem flipkartItem:flipkartItems){
107
		for (FlipkartItem flipkartItem : flipkartItems) {
-
 
108
			if (flipkartItem.isIsListedOnFlipkart()
96
			if(flipkartItem.isIsListedOnFlipkart() && !flipkartItem.isSuppressInventoryFeed())
109
					&& !flipkartItem.isSuppressInventoryFeed())
97
				flipkartInventoryItems.add(flipkartItem);
110
				flipkartInventoryItems.add(flipkartItem);
98
		}
111
		}
99
 
112
 
100
		for(FlipkartItem flipkartItem:flipkartItems){
113
		for (FlipkartItem flipkartItem : flipkartItems) {
-
 
114
			if (flipkartItem.isIsListedOnFlipkart()
101
			if(flipkartItem.isIsListedOnFlipkart() && !flipkartItem.isSuppressInventoryFeed()){
115
					&& !flipkartItem.isSuppressInventoryFeed()) {
102
				flipkartItemMap.put(flipkartItem.getItem_id(), flipkartItem);
116
				flipkartItemMap.put(flipkartItem.getItem_id(), flipkartItem);
103
			}
117
			}
104
		}
118
		}
105
 
119
 
106
		for(SnapdealItemDetails snapdealItem:snapdealItems){
120
		for (SnapdealItemDetails snapdealItem : snapdealItems) {
107
			snapdealItemMap.put(snapdealItem.getItem_id(),snapdealItem);
121
			snapdealItemMap.put(snapdealItem.getItem_id(), snapdealItem);
108
		}
122
		}
109
 
123
 
110
		if(flipkartItemMap.size()==0){
124
		if (flipkartItemMap.size() == 0) {
111
			String text = "";
125
			String text = "";
112
			try {
126
			try {
-
 
127
				mailer.sendSSLMessage(sendTo,
113
				mailer.sendSSLMessage(sendTo,"No items to check not sent Inventory Data ", emailFromAddress, password, text);
128
						"No items to check not sent Inventory Data ",
-
 
129
						emailFromAddress, password, text);
114
				System.exit(0);
130
				System.exit(0);
115
			} catch (MessagingException e) {
131
			} catch (MessagingException e) {
116
				e.printStackTrace();
132
				e.printStackTrace();
117
			}
133
			}
118
		}
134
		}
119
 
135
 
120
		if(snapdealItemMap.size()==0){
136
		if (snapdealItemMap.size() == 0) {
121
			String text = "";
137
			String text = "";
122
			try {
138
			try {
-
 
139
				mailer.sendSSLMessage(sendTo,
123
				mailer.sendSSLMessage(sendTo,"No items to check not sent Inventory Data ", emailFromAddress, password, text);
140
						"No items to check not sent Inventory Data ",
-
 
141
						emailFromAddress, password, text);
124
				System.exit(0);
142
				System.exit(0);
125
			} catch (MessagingException e) {
143
			} catch (MessagingException e) {
126
				e.printStackTrace();
144
				e.printStackTrace();
127
			}
145
			}
128
		}
146
		}
129
	}
147
	}
130
 
148
 
131
	private static void calculateinventory(){
149
	private static void calculateinventory() {
132
		CatalogClient catalogServiceClient = null;
150
		CatalogClient catalogServiceClient = null;
133
		Map<Long,ItemInventory> availability= new HashMap<Long,ItemInventory>();
151
		Map<Long, ItemInventory> availability = new HashMap<Long, ItemInventory>();
134
		try {
152
		try {
135
			catalogServiceClient = new CatalogClient();
153
			catalogServiceClient = new CatalogClient();
136
		} catch (TTransportException e) {
154
		} catch (TTransportException e) {
137
			e.printStackTrace();
155
			e.printStackTrace();
138
		}
156
		}
139
		in.shop2020.model.v1.catalog.CatalogService.Client catalogClient = catalogServiceClient.getClient();
157
		in.shop2020.model.v1.catalog.CatalogService.Client catalogClient = catalogServiceClient
-
 
158
				.getClient();
140
		try {
159
		try {
141
			List<Item> aliveItems = catalogClient.getAllAliveItems();
160
			List<Item> aliveItems = catalogClient.getAllAliveItems();
142
			Map<Long,Item> aliveItemsMap = new HashMap<Long,Item>(); 
161
			Map<Long, Item> aliveItemsMap = new HashMap<Long, Item>();
143
			for(in.shop2020.model.v1.catalog.Item thriftItem:aliveItems){
162
			for (in.shop2020.model.v1.catalog.Item thriftItem : aliveItems) {
144
				aliveItemsMap.put(thriftItem.getId(), thriftItem);
163
				aliveItemsMap.put(thriftItem.getId(), thriftItem);
145
 
164
 
146
			}
165
			}
147
			InventoryClient inventoryServiceClient = new InventoryClient();
166
			InventoryClient inventoryServiceClient = new InventoryClient();
148
			try {
167
			try {
149
				inventoryServiceClient = new InventoryClient();
168
				inventoryServiceClient = new InventoryClient();
150
			} catch (TTransportException e) {
169
			} catch (TTransportException e) {
151
				e.printStackTrace();
170
				e.printStackTrace();
152
			}
171
			}
153
			in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = inventoryServiceClient.getClient();
172
			in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = inventoryServiceClient
-
 
173
					.getClient();
154
			List<Vendor> allVendors = inventoryClient.getAllVendors();
174
			List<Vendor> allVendors = inventoryClient.getAllVendors();
155
			for(Vendor v: allVendors){
175
			for (Vendor v : allVendors) {
156
				vendorDataMap.put(v.getId(), v.getName());
176
				vendorDataMap.put(v.getId(), v.getName());
157
			}
177
			}
158
			List<in.shop2020.model.v1.inventory.IgnoredInventoryUpdateItems> ignoreItems = inventoryClient.getIgnoredWarehouseidsAndItemids();
178
			List<in.shop2020.model.v1.inventory.IgnoredInventoryUpdateItems> ignoreItems = inventoryClient
-
 
179
					.getIgnoredWarehouseidsAndItemids();
159
 
180
 
160
			availability = inventoryClient.getInventorySnapshot(0);
181
			availability = inventoryClient.getInventorySnapshot(0);
161
			List<Warehouse> allwarehouses = inventoryClient.getWarehouses(null,null,0,0,0);
182
			List<Warehouse> allwarehouses = inventoryClient.getWarehouses(null,
-
 
183
					null, 0, 0, 0);
162
			Map<Long,Warehouse> allWarehousesMap = new HashMap<Long,Warehouse>();
184
			Map<Long, Warehouse> allWarehousesMap = new HashMap<Long, Warehouse>();
163
			for(Warehouse warehouse:allwarehouses){
185
			for (Warehouse warehouse : allwarehouses) {
164
				allWarehousesMap.put(warehouse.getId(),warehouse);
186
				allWarehousesMap.put(warehouse.getId(), warehouse);
165
			}
187
			}
166
			List<Warehouse> warehouses = inventoryClient.getWarehouses(WarehouseType.OURS_THIRDPARTY,null,0,0,0);
188
			List<Warehouse> warehouses = inventoryClient.getWarehouses(
-
 
189
					WarehouseType.OURS_THIRDPARTY, null, 0, 0, 0);
167
			List<Warehouse> ours_warehouses = inventoryClient.getWarehouses(WarehouseType.OURS, InventoryType.GOOD, 0, 0, 0);
190
			List<Warehouse> ours_warehouses = inventoryClient.getWarehouses(
-
 
191
					WarehouseType.OURS, InventoryType.GOOD, 0, 0, 0);
168
			List<Long> thirdpartywarehouseids = new ArrayList<Long>();
192
			List<Long> thirdpartywarehouseids = new ArrayList<Long>();
169
			List<Long> oursGoodWarehouse = new ArrayList<Long>();
193
			List<Long> oursGoodWarehouse = new ArrayList<Long>();
170
			for(Warehouse warehouse:warehouses){
194
			for (Warehouse warehouse : warehouses) {
171
				thirdpartywarehouseids.add(warehouse.getId());
195
				thirdpartywarehouseids.add(warehouse.getId());
172
			}
196
			}
173
			for (Warehouse warehouse:ours_warehouses){
197
			for (Warehouse warehouse : ours_warehouses) {
174
				oursGoodWarehouse.add(warehouse.getId());
198
				oursGoodWarehouse.add(warehouse.getId());
175
			}
199
			}
176
			/*long available=0;
200
			/*
177
			long reserve=0;
-
 
178
			long total_warehouse_held=0;
201
			 * long available=0; long reserve=0; long total_warehouse_held=0;
179
			long heldForSource=0;
202
			 * long heldForSource=0; long total_held=0;
180
			long total_held=0;*/
203
			 */
181
			double nlc=0;
204
			double nlc = 0;
182
			double maxnlcSD=0;
205
			double maxnlcSD = 0;
183
			double maxnlcFK=0;
206
			double maxnlcFK = 0;
184
 
207
 
185
			Map<String, Map<Long, NlcLeftOutInventory>> snapdealLeftInvDataMap = new HashMap<String, Map<Long, NlcLeftOutInventory>>();
208
			Map<String, Map<Long, NlcLeftOutInventory>> snapdealLeftInvDataMap = new HashMap<String, Map<Long, NlcLeftOutInventory>>();
186
			Map<String, Map<Long, NlcLeftOutInventory>> flipkartLeftInvDataMap = new HashMap<String, Map<Long, NlcLeftOutInventory>>();
209
			Map<String, Map<Long, NlcLeftOutInventory>> flipkartLeftInvDataMap = new HashMap<String, Map<Long, NlcLeftOutInventory>>();
187
 
210
 
188
 
-
 
189
			for(Item thriftItem : aliveItems){
211
			for (Item thriftItem : aliveItems) {
190
				SnapdealItemDetails snapdealItem = null;
212
				SnapdealItemDetails snapdealItem = null;
191
				FlipkartItem flipkartItem = null;
213
				FlipkartItem flipkartItem = null;
192
				NlcLeftOutInventory nlcLOISD;
214
				NlcLeftOutInventory nlcLOISD;
193
				NlcLeftOutInventory nlcLOIFK;
215
				NlcLeftOutInventory nlcLOIFK;
194
				maxnlcSD=0;
216
				maxnlcSD = 0;
195
				maxnlcFK=0;
217
				maxnlcFK = 0;
196
				Map<Long, NlcLeftOutInventory> nlcLoiMapSD = new HashMap<Long, NlcLeftOutInventory>();
218
				Map<Long, NlcLeftOutInventory> nlcLoiMapSD = new HashMap<Long, NlcLeftOutInventory>();
197
				Map<Long, NlcLeftOutInventory> nlcLoiMapFK = new HashMap<Long, NlcLeftOutInventory>();
219
				Map<Long, NlcLeftOutInventory> nlcLoiMapFK = new HashMap<Long, NlcLeftOutInventory>();
198
				Set<NlcLeftOutInventory> nlcLoiSetSD = new HashSet<NlcLeftOutInventory>();
220
				Set<NlcLeftOutInventory> nlcLoiSetSD = new HashSet<NlcLeftOutInventory>();
199
				Set<NlcLeftOutInventory> nlcLoiSetFK = new HashSet<NlcLeftOutInventory>();
221
				Set<NlcLeftOutInventory> nlcLoiSetFK = new HashSet<NlcLeftOutInventory>();
200
				if(snapdealItemMap.containsKey(thriftItem.getId())){
222
				if (snapdealItemMap.containsKey(thriftItem.getId())) {
201
					snapdealItem = snapdealItemMap.get(thriftItem.getId());
223
					snapdealItem = snapdealItemMap.get(thriftItem.getId());
202
					maxnlcSD = snapdealItem.getMaxNlc();
224
					maxnlcSD = snapdealItem.getMaxNlc();
203
				}
225
				}
204
				if(flipkartItemMap.containsKey(thriftItem.getId())){
226
				if (flipkartItemMap.containsKey(thriftItem.getId())) {
205
					flipkartItem = flipkartItemMap.get(thriftItem.getId());
227
					flipkartItem = flipkartItemMap.get(thriftItem.getId());
206
					maxnlcFK = flipkartItem.getMaxNlc();
228
					maxnlcFK = flipkartItem.getMaxNlc();
207
				}
229
				}
208
				nlc=0;
230
				nlc = 0;
209
				List<Warehouse> vendor_warehouses=null; 
231
				List<Warehouse> vendor_warehouses = null;
210
				if(availability.get(thriftItem.getId())!=null){ 
232
				if (availability.get(thriftItem.getId()) != null) {
211
					ItemInventory iteminventory = availability.get(thriftItem.getId());
233
					ItemInventory iteminventory = availability.get(thriftItem
-
 
234
							.getId());
212
					Map<Long,Long> itemavailability = new HashMap<Long,Long>();
235
					Map<Long, Long> itemavailability = new HashMap<Long, Long>();
213
					itemavailability = iteminventory.getAvailability();
236
					itemavailability = iteminventory.getAvailability();
214
					if (thriftItem.isIsWarehousePreferenceSticky() && thriftItem.getPreferredVendor()!=0){
237
					if (thriftItem.isIsWarehousePreferenceSticky()
-
 
238
							&& thriftItem.getPreferredVendor() != 0) {
215
						//System.out.println("Item id "+thriftItem.getId()+".Found prefered vendor and warehouse is marked sticky (Calculating availability)"+thriftItem.getPreferredVendor());						
239
						// System.out.println("Item id "+thriftItem.getId()+".Found prefered vendor and warehouse is marked sticky (Calculating availability)"+thriftItem.getPreferredVendor());
216
						vendor_warehouses = inventoryClient.getWarehouses(WarehouseType.THIRD_PARTY,InventoryType.GOOD , thriftItem.getPreferredVendor(), 0, 0);
240
						vendor_warehouses = inventoryClient.getWarehouses(
-
 
241
								WarehouseType.THIRD_PARTY, InventoryType.GOOD,
-
 
242
								thriftItem.getPreferredVendor(), 0, 0);
217
						vendor_warehouses.addAll(ours_warehouses);
243
						vendor_warehouses.addAll(ours_warehouses);
218
						for (Warehouse warehouse:vendor_warehouses){
244
						for (Warehouse warehouse : vendor_warehouses) {
219
							if(warehouse.getBillingWarehouseId()!=7){
245
							if (warehouse.getBillingWarehouseId() != 7) {
220
								if(warehouse.getLogisticsLocation().equals(WarehouseLocation.Delhi) && warehouse.getWarehouseType().equals(WarehouseType.THIRD_PARTY) && warehouse.getVendor().getId()!=1){
246
								if (warehouse.getLogisticsLocation().equals(
-
 
247
										WarehouseLocation.Delhi)
-
 
248
										&& warehouse.getWarehouseType().equals(
-
 
249
												WarehouseType.THIRD_PARTY)
-
 
250
										&& warehouse.getVendor().getId() != 1) {
221
 
251
 
222
								}
-
 
223
								else{
252
								} else {
224
									continue;
253
									continue;
225
								}
254
								}
226
							}
255
							}
227
							in.shop2020.model.v1.inventory.IgnoredInventoryUpdateItems ignoredItem = new in.shop2020.model.v1.inventory.IgnoredInventoryUpdateItems();
256
							in.shop2020.model.v1.inventory.IgnoredInventoryUpdateItems ignoredItem = new in.shop2020.model.v1.inventory.IgnoredInventoryUpdateItems();
228
							ignoredItem.setItemId(thriftItem.getId());
257
							ignoredItem.setItemId(thriftItem.getId());
229
							ignoredItem.setWarehouseId(warehouse.getId());
258
							ignoredItem.setWarehouseId(warehouse.getId());
230
							if (itemavailability.get(warehouse.getId())!=null && !thirdpartywarehouseids.contains(warehouse.getId()) && !ignoreItems.contains(ignoredItem)){
259
							if (itemavailability.get(warehouse.getId()) != null
-
 
260
									&& !thirdpartywarehouseids
-
 
261
											.contains(warehouse.getId())
-
 
262
									&& !ignoreItems.contains(ignoredItem)) {
231
								try{
263
								try {
232
									nlc = inventoryClient.getNlcForWarehouse(warehouse.getId(),thriftItem.getId());
264
									nlc = inventoryClient.getNlcForWarehouse(
-
 
265
											warehouse.getId(),
-
 
266
											thriftItem.getId());
233
 
267
 
234
								}
-
 
235
								catch(TTransportException e){
268
								} catch (TTransportException e) {
236
									inventoryClient = inventoryServiceClient.getClient(); 
269
									inventoryClient = inventoryServiceClient
-
 
270
											.getClient();
237
									nlc = inventoryClient.getNlcForWarehouse(warehouse.getId(),thriftItem.getId());
271
									nlc = inventoryClient.getNlcForWarehouse(
-
 
272
											warehouse.getId(),
-
 
273
											thriftItem.getId());
238
								}
274
								}
239
 
275
 
-
 
276
								// maxnlc =
240
								//maxnlc = catalogClient.getSnapdealItem(thriftItem.getId()).getMaxNlc();
277
								// catalogClient.getSnapdealItem(thriftItem.getId()).getMaxNlc();
241
 
278
 
242
								if(snapdealItem!=null){
279
								if (snapdealItem != null) {
243
									if(nlc !=0 && (maxnlcSD >= nlc)){
280
									if (nlc != 0 && (maxnlcSD >= nlc)) {
-
 
281
										/*
-
 
282
										 * total_warehouse_held =
-
 
283
										 * inventoryClient.
244
										/*total_warehouse_held = inventoryClient.getHoldInventoryDetailForItemForWarehouseIdExceptSource(thriftItem.getId(), warehouse.getId(), 0);
284
										 * getHoldInventoryDetailForItemForWarehouseIdExceptSource
-
 
285
										 * (thriftItem.getId(),
-
 
286
										 * warehouse.getId(), 0); heldForSource
-
 
287
										 * = heldForSource +
-
 
288
										 * total_warehouse_held -
-
 
289
										 * inventoryClient.
245
										heldForSource = heldForSource + total_warehouse_held - inventoryClient.getHoldInventoryDetailForItemForWarehouseIdExceptSource(thriftItem.getId(), warehouse.getId(), 7);
290
										 * getHoldInventoryDetailForItemForWarehouseIdExceptSource
-
 
291
										 * (thriftItem.getId(),
-
 
292
										 * warehouse.getId(), 7); available =
-
 
293
										 * available +
246
										available = available + itemavailability.get(warehouse.getId());
294
										 * itemavailability.get(warehouse
247
										total_held = total_held + total_warehouse_held;*/ 
295
										 * .getId()); total_held = total_held +
-
 
296
										 * total_warehouse_held;
-
 
297
										 */
248
										//continue;
298
										// continue;
-
 
299
										// System.out.println("itemId:" +
249
										//System.out.println("itemId:" + thriftItem.getId() + "\ttotal_held: " + total_held + "\theldForSource:" + heldForSource + "\tavailable:" + available);
300
										// thriftItem.getId() + "\ttotal_held: "
-
 
301
										// + total_held + "\theldForSource:" +
-
 
302
										// heldForSource + "\tavailable:" +
-
 
303
										// available);
-
 
304
									} else if (maxnlcSD == 0) {
250
									}
305
										/*
-
 
306
										 * total_warehouse_held =
251
									else if(maxnlcSD==0){
307
										 * inventoryClient.
252
										/*total_warehouse_held = inventoryClient.getHoldInventoryDetailForItemForWarehouseIdExceptSource(thriftItem.getId(), warehouse.getId(), 0);
308
										 * getHoldInventoryDetailForItemForWarehouseIdExceptSource
-
 
309
										 * (thriftItem.getId(),
-
 
310
										 * warehouse.getId(), 0); heldForSource
-
 
311
										 * = heldForSource +
-
 
312
										 * total_warehouse_held -
-
 
313
										 * inventoryClient.
253
										heldForSource = heldForSource + total_warehouse_held - inventoryClient.getHoldInventoryDetailForItemForWarehouseIdExceptSource(thriftItem.getId(), warehouse.getId(), 7);
314
										 * getHoldInventoryDetailForItemForWarehouseIdExceptSource
-
 
315
										 * (thriftItem.getId(),
-
 
316
										 * warehouse.getId(), 7); available =
-
 
317
										 * available +
254
										available = available + itemavailability.get(warehouse.getId());
318
										 * itemavailability.get(warehouse
255
										total_held = total_held + total_warehouse_held;*/
319
										 * .getId()); total_held = total_held +
-
 
320
										 * total_warehouse_held;
-
 
321
										 */
256
										//continue;
322
										// continue;
-
 
323
										// System.out.println("itemId:" +
257
										//System.out.println("itemId:" + thriftItem.getId() + "\ttotal_held: " + total_held + "\theldForSource:" + heldForSource + "\tavailable:" + available);
324
										// thriftItem.getId() + "\ttotal_held: "
-
 
325
										// + total_held + "\theldForSource:" +
-
 
326
										// heldForSource + "\tavailable:" +
258
									}
327
										// available);
259
									else{
328
									} else {
260
										long available = itemavailability.get(warehouse.getId());
329
										long available = itemavailability
-
 
330
												.get(warehouse.getId());
261
										if(available>0){
331
										if (available > 0) {
262
											nlcLOISD= new NlcLeftOutInventory();
332
											nlcLOISD = new NlcLeftOutInventory();
263
											nlcLOISD.setItemId(snapdealItem.getItem_id());
333
											nlcLOISD.setItemId(snapdealItem
-
 
334
													.getItem_id());
264
											nlcLOISD.setProductName(snapdealItem.getBrand()+" " +snapdealItem.getModel_name() + " "+ snapdealItem.getModel_number() + " " +  snapdealItem.getColor());
335
											nlcLOISD.setProductName(snapdealItem
-
 
336
													.getBrand()
-
 
337
													+ " "
-
 
338
													+ snapdealItem
-
 
339
															.getModel_name()
-
 
340
													+ " "
-
 
341
													+ snapdealItem
-
 
342
															.getModel_number()
-
 
343
													+ " "
-
 
344
													+ snapdealItem.getColor());
265
											nlcLOISD.setOurNlc(maxnlcSD);
345
											nlcLOISD.setOurNlc(maxnlcSD);
266
											nlcLOISD.setSkuAtSource(snapdealItem.getSkuAtSnapdeal());
346
											nlcLOISD.setSkuAtSource(snapdealItem
-
 
347
													.getSkuAtSnapdeal());
267
											nlcLOISD.setVendorName(warehouse.getVendor().getName());
348
											nlcLOISD.setVendorName(warehouse
-
 
349
													.getVendor().getName());
268
											nlcLOISD.setVendorAvailability(available);
350
											nlcLOISD.setVendorAvailability(available);
269
											nlcLOISD.setVendorNlc(nlc);
351
											nlcLOISD.setVendorNlc(nlc);
270
											nlcLOISD.setVendorWarehouseId(warehouse.getId());
352
											nlcLOISD.setVendorWarehouseId(warehouse
-
 
353
													.getId());
271
											nlcLOISD.setWarehouseType(warehouse.getWarehouseType().toString());
354
											nlcLOISD.setWarehouseType(warehouse
-
 
355
													.getWarehouseType()
-
 
356
													.toString());
-
 
357
											if (!nlcLoiMapSD
272
											if(!nlcLoiMapSD.containsKey(warehouse.getId()))
358
													.containsKey(warehouse
-
 
359
															.getId()))
-
 
360
												nlcLoiMapSD.put(
273
												nlcLoiMapSD.put(warehouse.getId(), nlcLOISD);
361
														warehouse.getId(),
-
 
362
														nlcLOISD);
274
 
363
 
275
										}
364
										}
276
									}
365
									}
277
								}
366
								}
278
 
367
 
279
								if(flipkartItem!=null){
368
								if (flipkartItem != null) {
280
									if(nlc !=0 && (maxnlcFK >= nlc)){
369
									if (nlc != 0 && (maxnlcFK >= nlc)) {
-
 
370
										/*
-
 
371
										 * total_warehouse_held =
-
 
372
										 * inventoryClient.
281
										/*total_warehouse_held = inventoryClient.getHoldInventoryDetailForItemForWarehouseIdExceptSource(thriftItem.getId(), warehouse.getId(), 0);
373
										 * getHoldInventoryDetailForItemForWarehouseIdExceptSource
-
 
374
										 * (thriftItem.getId(),
-
 
375
										 * warehouse.getId(), 0); heldForSource
-
 
376
										 * = heldForSource +
-
 
377
										 * total_warehouse_held -
-
 
378
										 * inventoryClient.
282
										heldForSource = heldForSource + total_warehouse_held - inventoryClient.getHoldInventoryDetailForItemForWarehouseIdExceptSource(thriftItem.getId(), warehouse.getId(), 8);
379
										 * getHoldInventoryDetailForItemForWarehouseIdExceptSource
-
 
380
										 * (thriftItem.getId(),
-
 
381
										 * warehouse.getId(), 8); available =
-
 
382
										 * available +
283
										available = available + itemavailability.get(warehouse.getId());
383
										 * itemavailability.get(warehouse
284
										total_held = total_held + total_warehouse_held; */
384
										 * .getId()); total_held = total_held +
-
 
385
										 * total_warehouse_held;
-
 
386
										 */
285
										//continue;
387
										// continue;
-
 
388
										// System.out.println("itemId:" +
286
										//System.out.println("itemId:" + thriftItem.getId() + "\ttotal_held: " + total_held + "\theldForSource:" + heldForSource + "\tavailable:" + available);
389
										// thriftItem.getId() + "\ttotal_held: "
-
 
390
										// + total_held + "\theldForSource:" +
-
 
391
										// heldForSource + "\tavailable:" +
-
 
392
										// available);
-
 
393
									} else if (maxnlcFK == 0) {
287
									}
394
										/*
-
 
395
										 * total_warehouse_held =
288
									else if(maxnlcFK==0){
396
										 * inventoryClient.
289
										/*total_warehouse_held = inventoryClient.getHoldInventoryDetailForItemForWarehouseIdExceptSource(thriftItem.getId(), warehouse.getId(), 0);
397
										 * getHoldInventoryDetailForItemForWarehouseIdExceptSource
-
 
398
										 * (thriftItem.getId(),
-
 
399
										 * warehouse.getId(), 0); heldForSource
-
 
400
										 * = heldForSource +
-
 
401
										 * total_warehouse_held -
-
 
402
										 * inventoryClient.
290
										heldForSource = heldForSource + total_warehouse_held - inventoryClient.getHoldInventoryDetailForItemForWarehouseIdExceptSource(thriftItem.getId(), warehouse.getId(), 8);
403
										 * getHoldInventoryDetailForItemForWarehouseIdExceptSource
-
 
404
										 * (thriftItem.getId(),
-
 
405
										 * warehouse.getId(), 8); available =
-
 
406
										 * available +
291
										available = available + itemavailability.get(warehouse.getId());
407
										 * itemavailability.get(warehouse
292
										total_held = total_held + total_warehouse_held;*/
408
										 * .getId()); total_held = total_held +
-
 
409
										 * total_warehouse_held;
-
 
410
										 */
293
										//continue;
411
										// continue;
-
 
412
										// System.out.println("itemId:" +
294
										//System.out.println("itemId:" + thriftItem.getId() + "\ttotal_held: " + total_held + "\theldForSource:" + heldForSource + "\tavailable:" + available);
413
										// thriftItem.getId() + "\ttotal_held: "
-
 
414
										// + total_held + "\theldForSource:" +
-
 
415
										// heldForSource + "\tavailable:" +
295
									}
416
										// available);
296
									else{
417
									} else {
297
										long available = itemavailability.get(warehouse.getId());
418
										long available = itemavailability
-
 
419
												.get(warehouse.getId());
298
										if(available>0){
420
										if (available > 0) {
299
											nlcLOIFK = new NlcLeftOutInventory();
421
											nlcLOIFK = new NlcLeftOutInventory();
300
											nlcLOIFK.setItemId(flipkartItem.getItem_id());
422
											nlcLOIFK.setItemId(flipkartItem
-
 
423
													.getItem_id());
301
											nlcLOIFK.setProductName(thriftItem.getBrand()+" " +thriftItem.getModelName() + " "+ thriftItem.getModelNumber() + " " +  thriftItem.getColor());
424
											nlcLOIFK.setProductName(thriftItem
-
 
425
													.getBrand()
-
 
426
													+ " "
-
 
427
													+ thriftItem.getModelName()
-
 
428
													+ " "
-
 
429
													+ thriftItem
-
 
430
															.getModelNumber()
-
 
431
													+ " "
-
 
432
													+ thriftItem.getColor());
302
											nlcLOIFK.setOurNlc(maxnlcFK);
433
											nlcLOIFK.setOurNlc(maxnlcFK);
303
											nlcLOIFK.setSkuAtSource(flipkartItem.getSkuAtFlipkart());
434
											nlcLOIFK.setSkuAtSource(flipkartItem
-
 
435
													.getSkuAtFlipkart());
304
											nlcLOIFK.setVendorName(warehouse.getVendor().getName());
436
											nlcLOIFK.setVendorName(warehouse
-
 
437
													.getVendor().getName());
305
											nlcLOIFK.setVendorAvailability(available);
438
											nlcLOIFK.setVendorAvailability(available);
306
											nlcLOIFK.setVendorNlc(nlc);
439
											nlcLOIFK.setVendorNlc(nlc);
307
											nlcLOIFK.setVendorWarehouseId(warehouse.getId());
440
											nlcLOIFK.setVendorWarehouseId(warehouse
-
 
441
													.getId());
308
											nlcLOIFK.setWarehouseType(warehouse.getWarehouseType().toString());
442
											nlcLOIFK.setWarehouseType(warehouse
-
 
443
													.getWarehouseType()
-
 
444
													.toString());
-
 
445
											if (!nlcLoiMapFK
309
											if(!nlcLoiMapFK.containsKey(warehouse.getId()))
446
													.containsKey(warehouse
-
 
447
															.getId()))
-
 
448
												nlcLoiMapFK.put(
310
												nlcLoiMapFK.put(warehouse.getId(), nlcLOIFK);
449
														warehouse.getId(),
-
 
450
														nlcLOIFK);
311
										}
451
										}
312
									}
452
									}
313
								}
453
								}
-
 
454
								// System.out.println("itemId:" +
-
 
455
								// thriftItem.getId() + "\tmaxnlc: " + maxnlc +
314
								//System.out.println("itemId:" + thriftItem.getId() + "\tmaxnlc: " + maxnlc + "\tnlc:" + nlc + "\twid:" + warehouse.getId() );
456
								// "\tnlc:" + nlc + "\twid:" + warehouse.getId()
-
 
457
								// );
315
 
458
 
316
							}
459
							}
317
						}
460
						}
318
						if(nlcLoiMapSD!=null && nlcLoiMapSD.size()>0){
461
						if (nlcLoiMapSD != null && nlcLoiMapSD.size() > 0) {
-
 
462
							snapdealLeftInvDataMap.put(
319
							snapdealLeftInvDataMap.put(snapdealItem.getSkuAtSnapdeal(), nlcLoiMapSD);
463
									snapdealItem.getSkuAtSnapdeal(),
-
 
464
									nlcLoiMapSD);
320
						}
465
						}
321
						if(nlcLoiMapFK!=null && nlcLoiMapFK.size()>0){
466
						if (nlcLoiMapFK != null && nlcLoiMapFK.size() > 0) {
-
 
467
							flipkartLeftInvDataMap.put(
322
							flipkartLeftInvDataMap.put(flipkartItem.getSkuAtFlipkart(), nlcLoiMapFK);
468
									flipkartItem.getSkuAtFlipkart(),
-
 
469
									nlcLoiMapFK);
323
						}
470
						}
324
					}
-
 
325
					else{
471
					} else {
326
						for (Map.Entry<Long,Long> entry :  itemavailability.entrySet()) {
472
						for (Map.Entry<Long, Long> entry : itemavailability
-
 
473
								.entrySet()) {
327
							if(allWarehousesMap.get(entry.getKey()).getBillingWarehouseId()!=7){
474
							if (allWarehousesMap.get(entry.getKey())
-
 
475
									.getBillingWarehouseId() != 7) {
-
 
476
								if (allWarehousesMap.get(entry.getKey())
-
 
477
										.getLogisticsLocation()
-
 
478
										.equals(WarehouseLocation.Delhi)
-
 
479
										&& allWarehousesMap
-
 
480
												.get(entry.getKey())
-
 
481
												.getWarehouseType()
328
								if(allWarehousesMap.get(entry.getKey()).getLogisticsLocation().equals(WarehouseLocation.Delhi) && allWarehousesMap.get(entry.getKey()).getWarehouseType().equals(WarehouseType.THIRD_PARTY) && allWarehousesMap.get(entry.getKey()).getVendor().getId()!=1){
482
												.equals(WarehouseType.THIRD_PARTY)
-
 
483
										&& allWarehousesMap.get(entry.getKey())
-
 
484
												.getVendor().getId() != 1) {
329
 
485
 
330
								}
-
 
331
								else{
486
								} else {
332
									continue;
487
									continue;
333
								}
488
								}
334
							}
489
							}
335
							in.shop2020.model.v1.inventory.IgnoredInventoryUpdateItems ignoredItem = new in.shop2020.model.v1.inventory.IgnoredInventoryUpdateItems();
490
							in.shop2020.model.v1.inventory.IgnoredInventoryUpdateItems ignoredItem = new in.shop2020.model.v1.inventory.IgnoredInventoryUpdateItems();
336
							ignoredItem.setItemId(thriftItem.getId());
491
							ignoredItem.setItemId(thriftItem.getId());
337
							ignoredItem.setWarehouseId(entry.getKey());
492
							ignoredItem.setWarehouseId(entry.getKey());
-
 
493
							if (!thirdpartywarehouseids
-
 
494
									.contains(entry.getKey())
338
							if(!thirdpartywarehouseids.contains(entry.getKey()) && !ignoreItems.contains(ignoredItem)){
495
									&& !ignoreItems.contains(ignoredItem)) {
339
 
496
 
340
								nlc = inventoryClient.getNlcForWarehouse(entry.getKey(),thriftItem.getId());
497
								nlc = inventoryClient.getNlcForWarehouse(
-
 
498
										entry.getKey(), thriftItem.getId());
341
 
499
 
-
 
500
								// System.out.println("itemId:" +
-
 
501
								// thriftItem.getId() + "\tmaxnlc: " + maxnlc +
342
								//System.out.println("itemId:" + thriftItem.getId() + "\tmaxnlc: " + maxnlc + "\tnlc:" + nlc + "\twid:" + entry.getKey() );
502
								// "\tnlc:" + nlc + "\twid:" + entry.getKey() );
343
								if(snapdealItem!=null){
503
								if (snapdealItem != null) {
344
									if(nlc !=0 && (maxnlcSD >= nlc)){
504
									if (nlc != 0 && (maxnlcSD >= nlc)) {
-
 
505
										/*
-
 
506
										 * total_warehouse_held =
-
 
507
										 * inventoryClient.
345
										/*total_warehouse_held = inventoryClient.getHoldInventoryDetailForItemForWarehouseIdExceptSource(thriftItem.getId(), entry.getKey(), 0);
508
										 * getHoldInventoryDetailForItemForWarehouseIdExceptSource
-
 
509
										 * (thriftItem.getId(), entry.getKey(),
-
 
510
										 * 0); heldForSource = heldForSource +
-
 
511
										 * total_warehouse_held -
-
 
512
										 * inventoryClient.
346
										heldForSource = heldForSource + total_warehouse_held - inventoryClient.getHoldInventoryDetailForItemForWarehouseIdExceptSource(thriftItem.getId(), entry.getKey(), 7);
513
										 * getHoldInventoryDetailForItemForWarehouseIdExceptSource
-
 
514
										 * (thriftItem.getId(), entry.getKey(),
347
										available =  available + entry.getValue();
515
										 * 7); available = available +
-
 
516
										 * entry.getValue(); total_held =
348
										total_held = total_held + total_warehouse_held;*/
517
										 * total_held + total_warehouse_held;
-
 
518
										 */
349
										//continue;
519
										// continue;
-
 
520
										// System.out.println("itemId:" +
350
										//System.out.println("itemId:" + thriftItem.getId() + "\ttotal_held: " + total_held + "\theldForSource:" + heldForSource + "\tavailable:" + available);
521
										// thriftItem.getId() + "\ttotal_held: "
-
 
522
										// + total_held + "\theldForSource:" +
-
 
523
										// heldForSource + "\tavailable:" +
-
 
524
										// available);
-
 
525
									} else if (maxnlcSD == 0) {
351
									}
526
										/*
-
 
527
										 * total_warehouse_held =
352
									else if(maxnlcSD==0){
528
										 * inventoryClient.
353
										/*total_warehouse_held = inventoryClient.getHoldInventoryDetailForItemForWarehouseIdExceptSource(thriftItem.getId(), entry.getKey(), 0);
529
										 * getHoldInventoryDetailForItemForWarehouseIdExceptSource
-
 
530
										 * (thriftItem.getId(), entry.getKey(),
-
 
531
										 * 0); heldForSource = heldForSource +
-
 
532
										 * total_warehouse_held -
-
 
533
										 * inventoryClient.
354
										heldForSource = heldForSource + total_warehouse_held - inventoryClient.getHoldInventoryDetailForItemForWarehouseIdExceptSource(thriftItem.getId(), entry.getKey(), 7);
534
										 * getHoldInventoryDetailForItemForWarehouseIdExceptSource
-
 
535
										 * (thriftItem.getId(), entry.getKey(),
-
 
536
										 * 7); available = available +
355
										available = available + itemavailability.get(entry.getKey());
537
										 * itemavailability.get(entry.getKey());
356
										total_held = total_held + total_warehouse_held;*/
538
										 * total_held = total_held +
-
 
539
										 * total_warehouse_held;
-
 
540
										 */
357
 
541
 
358
										//continue;
542
										// continue;
-
 
543
										// System.out.println("itemId:" +
359
										//System.out.println("itemId:" + thriftItem.getId() + "\ttotal_held: " + total_held + "\theldForSource:" + heldForSource + "\tavailable:" + available);
544
										// thriftItem.getId() + "\ttotal_held: "
-
 
545
										// + total_held + "\theldForSource:" +
-
 
546
										// heldForSource + "\tavailable:" +
360
									}
547
										// available);
361
									else{
548
									} else {
362
										long available = itemavailability.get(entry.getKey());
549
										long available = itemavailability
-
 
550
												.get(entry.getKey());
363
										if(available>0){
551
										if (available > 0) {
364
											nlcLOISD = new NlcLeftOutInventory();
552
											nlcLOISD = new NlcLeftOutInventory();
365
											nlcLOISD.setItemId(snapdealItem.getItem_id());
553
											nlcLOISD.setItemId(snapdealItem
-
 
554
													.getItem_id());
366
											nlcLOISD.setProductName(snapdealItem.getBrand()+" " +snapdealItem.getModel_name() + " "+ snapdealItem.getModel_number() + " " +  snapdealItem.getColor());
555
											nlcLOISD.setProductName(snapdealItem
-
 
556
													.getBrand()
-
 
557
													+ " "
-
 
558
													+ snapdealItem
-
 
559
															.getModel_name()
-
 
560
													+ " "
-
 
561
													+ snapdealItem
-
 
562
															.getModel_number()
-
 
563
													+ " "
-
 
564
													+ snapdealItem.getColor());
367
											nlcLOISD.setOurNlc(maxnlcSD);
565
											nlcLOISD.setOurNlc(maxnlcSD);
368
											nlcLOISD.setSkuAtSource(snapdealItem.getSkuAtSnapdeal());
566
											nlcLOISD.setSkuAtSource(snapdealItem
-
 
567
													.getSkuAtSnapdeal());
369
											nlcLOISD.setVendorName(vendorDataMap.get(allWarehousesMap.get(entry.getKey()).getVendor().getId()));
568
											nlcLOISD.setVendorName(vendorDataMap
-
 
569
													.get(allWarehousesMap
-
 
570
															.get(entry.getKey())
-
 
571
															.getVendor()
-
 
572
															.getId()));
370
											nlcLOISD.setVendorAvailability(available);
573
											nlcLOISD.setVendorAvailability(available);
371
											nlcLOISD.setVendorNlc(nlc);
574
											nlcLOISD.setVendorNlc(nlc);
372
											nlcLOISD.setVendorWarehouseId(entry.getKey());
575
											nlcLOISD.setVendorWarehouseId(entry
-
 
576
													.getKey());
373
											nlcLOISD.setWarehouseType(allWarehousesMap.get(entry.getKey()).getWarehouseType().toString());
577
											nlcLOISD.setWarehouseType(allWarehousesMap
-
 
578
													.get(entry.getKey())
-
 
579
													.getWarehouseType()
-
 
580
													.toString());
374
											if(!nlcLoiMapSD.containsKey(entry.getKey()))
581
											if (!nlcLoiMapSD.containsKey(entry
-
 
582
													.getKey()))
375
												nlcLoiMapSD.put(entry.getKey(), nlcLOISD);
583
												nlcLoiMapSD.put(entry.getKey(),
-
 
584
														nlcLOISD);
376
										}
585
										}
377
									}
586
									}
378
								}
587
								}
379
 
588
 
380
								if(flipkartItem!=null){
589
								if (flipkartItem != null) {
381
									if(nlc !=0 && (maxnlcFK >= nlc)){
590
									if (nlc != 0 && (maxnlcFK >= nlc)) {
-
 
591
										/*
-
 
592
										 * total_warehouse_held =
-
 
593
										 * inventoryClient.
382
										/*total_warehouse_held = inventoryClient.getHoldInventoryDetailForItemForWarehouseIdExceptSource(thriftItem.getId(), entry.getKey(), 0);
594
										 * getHoldInventoryDetailForItemForWarehouseIdExceptSource
-
 
595
										 * (thriftItem.getId(), entry.getKey(),
-
 
596
										 * 0); heldForSource = heldForSource +
-
 
597
										 * total_warehouse_held -
-
 
598
										 * inventoryClient.
383
										heldForSource = heldForSource + total_warehouse_held - inventoryClient.getHoldInventoryDetailForItemForWarehouseIdExceptSource(thriftItem.getId(), entry.getKey(), 8);
599
										 * getHoldInventoryDetailForItemForWarehouseIdExceptSource
-
 
600
										 * (thriftItem.getId(), entry.getKey(),
384
										available =  available + entry.getValue();
601
										 * 8); available = available +
-
 
602
										 * entry.getValue(); total_held =
385
										total_held = total_held + total_warehouse_held;*/
603
										 * total_held + total_warehouse_held;
-
 
604
										 */
386
										//continue;
605
										// continue;
-
 
606
										// System.out.println("itemId:" +
387
										//System.out.println("itemId:" + thriftItem.getId() + "\ttotal_held: " + total_held + "\theldForSource:" + heldForSource + "\tavailable:" + available);
607
										// thriftItem.getId() + "\ttotal_held: "
-
 
608
										// + total_held + "\theldForSource:" +
-
 
609
										// heldForSource + "\tavailable:" +
-
 
610
										// available);
-
 
611
									} else if (maxnlcFK == 0) {
388
									}
612
										/*
-
 
613
										 * total_warehouse_held =
389
									else if(maxnlcFK==0){
614
										 * inventoryClient.
390
										/*total_warehouse_held = inventoryClient.getHoldInventoryDetailForItemForWarehouseIdExceptSource(thriftItem.getId(), entry.getKey(), 0);
615
										 * getHoldInventoryDetailForItemForWarehouseIdExceptSource
-
 
616
										 * (thriftItem.getId(), entry.getKey(),
-
 
617
										 * 0); heldForSource = heldForSource +
-
 
618
										 * total_warehouse_held -
-
 
619
										 * inventoryClient.
391
										heldForSource = heldForSource + total_warehouse_held - inventoryClient.getHoldInventoryDetailForItemForWarehouseIdExceptSource(thriftItem.getId(), entry.getKey(), 8);
620
										 * getHoldInventoryDetailForItemForWarehouseIdExceptSource
-
 
621
										 * (thriftItem.getId(), entry.getKey(),
-
 
622
										 * 8); available = available +
392
										available = available + itemavailability.get(entry.getKey());
623
										 * itemavailability.get(entry.getKey());
393
										total_held = total_held + total_warehouse_held;*/
624
										 * total_held = total_held +
-
 
625
										 * total_warehouse_held;
-
 
626
										 */
394
										//continue;
627
										// continue;
-
 
628
										// System.out.println("itemId:" +
395
										//System.out.println("itemId:" + thriftItem.getId() + "\ttotal_held: " + total_held + "\theldForSource:" + heldForSource + "\tavailable:" + available);
629
										// thriftItem.getId() + "\ttotal_held: "
-
 
630
										// + total_held + "\theldForSource:" +
-
 
631
										// heldForSource + "\tavailable:" +
396
									}
632
										// available);
397
									else{
633
									} else {
398
										long available = itemavailability.get(entry.getKey());
634
										long available = itemavailability
-
 
635
												.get(entry.getKey());
399
										if(available>0){
636
										if (available > 0) {
400
											nlcLOIFK = new NlcLeftOutInventory();
637
											nlcLOIFK = new NlcLeftOutInventory();
401
											nlcLOIFK.setItemId(flipkartItem.getItem_id());
638
											nlcLOIFK.setItemId(flipkartItem
-
 
639
													.getItem_id());
402
											nlcLOIFK.setProductName(thriftItem.getBrand()+" " +thriftItem.getModelName() + " "+ thriftItem.getModelNumber() + " " +  thriftItem.getColor());
640
											nlcLOIFK.setProductName(thriftItem
-
 
641
													.getBrand()
-
 
642
													+ " "
-
 
643
													+ thriftItem.getModelName()
-
 
644
													+ " "
-
 
645
													+ thriftItem
-
 
646
															.getModelNumber()
-
 
647
													+ " "
-
 
648
													+ thriftItem.getColor());
403
											nlcLOIFK.setOurNlc(maxnlcFK);
649
											nlcLOIFK.setOurNlc(maxnlcFK);
404
											nlcLOIFK.setSkuAtSource(flipkartItem.getSkuAtFlipkart());
650
											nlcLOIFK.setSkuAtSource(flipkartItem
-
 
651
													.getSkuAtFlipkart());
405
											nlcLOIFK.setVendorName(vendorDataMap.get(allWarehousesMap.get(entry.getKey()).getVendor().getId()));
652
											nlcLOIFK.setVendorName(vendorDataMap
-
 
653
													.get(allWarehousesMap
-
 
654
															.get(entry.getKey())
-
 
655
															.getVendor()
-
 
656
															.getId()));
406
											nlcLOIFK.setVendorAvailability(available);
657
											nlcLOIFK.setVendorAvailability(available);
407
											nlcLOIFK.setVendorNlc(nlc);
658
											nlcLOIFK.setVendorNlc(nlc);
408
											nlcLOIFK.setVendorWarehouseId(entry.getKey());
659
											nlcLOIFK.setVendorWarehouseId(entry
-
 
660
													.getKey());
409
											nlcLOIFK.setWarehouseType(allWarehousesMap.get(entry.getKey()).getWarehouseType().toString());
661
											nlcLOIFK.setWarehouseType(allWarehousesMap
-
 
662
													.get(entry.getKey())
-
 
663
													.getWarehouseType()
-
 
664
													.toString());
410
											if(!nlcLoiMapFK.containsKey(entry.getKey()))
665
											if (!nlcLoiMapFK.containsKey(entry
-
 
666
													.getKey()))
411
												nlcLoiMapFK.put(entry.getKey(), nlcLOIFK);
667
												nlcLoiMapFK.put(entry.getKey(),
-
 
668
														nlcLOIFK);
412
										}
669
										}
413
									}
670
									}
414
								}
671
								}
415
 
672
 
416
 
-
 
417
							}
673
							}
418
						}
674
						}
419
						if(nlcLoiMapSD!=null && nlcLoiMapSD.size()>0){
675
						if (nlcLoiMapSD != null && nlcLoiMapSD.size() > 0) {
-
 
676
							snapdealLeftInvDataMap.put(
420
							snapdealLeftInvDataMap.put(snapdealItem.getSkuAtSnapdeal(), nlcLoiMapSD);
677
									snapdealItem.getSkuAtSnapdeal(),
-
 
678
									nlcLoiMapSD);
421
						}
679
						}
422
						if(nlcLoiMapFK!=null && nlcLoiMapFK.size()>0){
680
						if (nlcLoiMapFK != null && nlcLoiMapFK.size() > 0) {
-
 
681
							flipkartLeftInvDataMap.put(
423
							flipkartLeftInvDataMap.put(flipkartItem.getSkuAtFlipkart(), nlcLoiMapFK);
682
									flipkartItem.getSkuAtFlipkart(),
-
 
683
									nlcLoiMapFK);
424
						}
684
						}
425
					}
685
					}
426
 
686
 
427
					Map<Long,Long> itemreserve = new HashMap<Long,Long>();
687
					Map<Long, Long> itemreserve = new HashMap<Long, Long>();
428
					itemreserve = iteminventory.getReserved();
688
					itemreserve = iteminventory.getReserved();
429
					if (thriftItem.isIsWarehousePreferenceSticky() && thriftItem.getPreferredVendor()!=0){
689
					if (thriftItem.isIsWarehousePreferenceSticky()
-
 
690
							&& thriftItem.getPreferredVendor() != 0) {
430
						//System.out.println("Item id "+thriftItem.getId()+".Found prefered vendor and warehouse is marked sticky (Calculating Reserve)"+thriftItem.getPreferredVendor());
691
						// System.out.println("Item id "+thriftItem.getId()+".Found prefered vendor and warehouse is marked sticky (Calculating Reserve)"+thriftItem.getPreferredVendor());
431
						for (Warehouse warehouse:vendor_warehouses){
692
						for (Warehouse warehouse : vendor_warehouses) {
432
							if(warehouse.getBillingWarehouseId()!=7){
693
							if (warehouse.getBillingWarehouseId() != 7) {
433
								if(warehouse.getLogisticsLocation().equals(WarehouseLocation.Delhi) && warehouse.getWarehouseType().equals(WarehouseType.THIRD_PARTY) && warehouse.getVendor().getId()!=1){
694
								if (warehouse.getLogisticsLocation().equals(
-
 
695
										WarehouseLocation.Delhi)
-
 
696
										&& warehouse.getWarehouseType().equals(
-
 
697
												WarehouseType.THIRD_PARTY)
-
 
698
										&& warehouse.getVendor().getId() != 1) {
434
 
699
 
435
								}
-
 
436
								else{
700
								} else {
437
									continue;
701
									continue;
438
								}
702
								}
439
							}
703
							}
440
							in.shop2020.model.v1.inventory.IgnoredInventoryUpdateItems ignoredItem = new in.shop2020.model.v1.inventory.IgnoredInventoryUpdateItems();
704
							in.shop2020.model.v1.inventory.IgnoredInventoryUpdateItems ignoredItem = new in.shop2020.model.v1.inventory.IgnoredInventoryUpdateItems();
441
							ignoredItem.setItemId(thriftItem.getId());
705
							ignoredItem.setItemId(thriftItem.getId());
442
							ignoredItem.setWarehouseId(warehouse.getId());
706
							ignoredItem.setWarehouseId(warehouse.getId());
-
 
707
							if (itemreserve.get(warehouse.getId()) != null
-
 
708
									&& !thirdpartywarehouseids
-
 
709
											.contains(warehouse.getId())
443
							if (itemreserve.get(warehouse.getId())!=null && !thirdpartywarehouseids.contains(warehouse.getId()) && !ignoreItems.contains(warehouse.getId())){
710
									&& !ignoreItems.contains(warehouse.getId())) {
444
								nlc = inventoryClient.getNlcForWarehouse(warehouse.getId(),thriftItem.getId());
711
								nlc = inventoryClient.getNlcForWarehouse(
-
 
712
										warehouse.getId(), thriftItem.getId());
-
 
713
								// maxnlc =
445
								//maxnlc = catalogClient.getSnapdealItem(thriftItem.getId()).getMaxNlc();
714
								// catalogClient.getSnapdealItem(thriftItem.getId()).getMaxNlc();
-
 
715
								// System.out.println("itemId:" +
-
 
716
								// thriftItem.getId() + "\tmaxnlc: " + maxnlc +
446
								//System.out.println("itemId:" + thriftItem.getId() + "\tmaxnlc: " + maxnlc + "\tnlc:" + nlc + "\twid:" + warehouse.getId() );
717
								// "\tnlc:" + nlc + "\twid:" + warehouse.getId()
-
 
718
								// );
447
								if(snapdealItem!=null){
719
								if (snapdealItem != null) {
448
									if(nlc !=0 && (maxnlcSD >= nlc)){
720
									if (nlc != 0 && (maxnlcSD >= nlc)) {
-
 
721
										// reserve = reserve +
449
										//reserve = reserve + itemreserve.get(warehouse.getId());
722
										// itemreserve.get(warehouse.getId());
-
 
723
										// System.out.println("itemId:" +
450
										//System.out.println("itemId:" + thriftItem.getId() + "\ttotal_held: " + total_held + "\theldForSource:" + heldForSource + "\treserve:" + reserve);
724
										// thriftItem.getId() + "\ttotal_held: "
-
 
725
										// + total_held + "\theldForSource:" +
-
 
726
										// heldForSource + "\treserve:" +
451
										//continue;
727
										// reserve);
452
									}
728
										// continue;
453
									else if(maxnlcSD==0){
729
									} else if (maxnlcSD == 0) {
-
 
730
										// reserve = reserve +
454
										//reserve = reserve + itemreserve.get(warehouse.getId());
731
										// itemreserve.get(warehouse.getId());
-
 
732
										// System.out.println("itemId:" +
455
										//System.out.println("itemId:" + thriftItem.getId() + "\ttotal_held: " + total_held + "\theldForSource:" + heldForSource + "\treserve:" + reserve);
733
										// thriftItem.getId() + "\ttotal_held: "
-
 
734
										// + total_held + "\theldForSource:" +
-
 
735
										// heldForSource + "\treserve:" +
456
										//continue;
736
										// reserve);
457
									}
737
										// continue;
458
									else{
738
									} else {
-
 
739
										if (snapdealLeftInvDataMap
459
										if(snapdealLeftInvDataMap.containsKey(snapdealItem.getSkuAtSnapdeal())){
740
												.containsKey(snapdealItem
-
 
741
														.getSkuAtSnapdeal())) {
460
											Map<Long, NlcLeftOutInventory> newNlcObjMap = snapdealLeftInvDataMap.get(snapdealItem.getSkuAtSnapdeal());
742
											Map<Long, NlcLeftOutInventory> newNlcObjMap = snapdealLeftInvDataMap
-
 
743
													.get(snapdealItem
-
 
744
															.getSkuAtSnapdeal());
-
 
745
											if (newNlcObjMap
461
											if(newNlcObjMap.containsKey(warehouse.getId())){
746
													.containsKey(warehouse
-
 
747
															.getId())) {
462
												NlcLeftOutInventory newObj = newNlcObjMap.get(warehouse.getId());
748
												NlcLeftOutInventory newObj = newNlcObjMap
-
 
749
														.get(warehouse.getId());
463
												newObj.setReserved(itemreserve.get(warehouse.getId()));
750
												newObj.setReserved(itemreserve
-
 
751
														.get(warehouse.getId()));
464
												newObj.setTotalAvailability(newObj.getVendorAvailability()-itemreserve.get(warehouse.getId()));
752
												newObj.setTotalAvailability(newObj
-
 
753
														.getVendorAvailability()
-
 
754
														- itemreserve.get(warehouse
-
 
755
																.getId()));
465
												newNlcObjMap.remove(warehouse.getId());
756
												newNlcObjMap.remove(warehouse
-
 
757
														.getId());
-
 
758
												newNlcObjMap.put(
466
												newNlcObjMap.put(warehouse.getId(), newObj);
759
														warehouse.getId(),
-
 
760
														newObj);
467
 
761
 
468
											}
762
											}
469
											nlcLoiMapSD = newNlcObjMap;
763
											nlcLoiMapSD = newNlcObjMap;
470
										}
764
										}
471
									}
765
									}
472
								}
766
								}
473
 
767
 
474
								if(flipkartItem!=null){
768
								if (flipkartItem != null) {
475
									if(nlc !=0 && (maxnlcFK >= nlc)){
769
									if (nlc != 0 && (maxnlcFK >= nlc)) {
-
 
770
										// reserve = reserve +
476
										//reserve = reserve + itemreserve.get(warehouse.getId());
771
										// itemreserve.get(warehouse.getId());
-
 
772
										// System.out.println("itemId:" +
477
										//System.out.println("itemId:" + thriftItem.getId() + "\ttotal_held: " + total_held + "\theldForSource:" + heldForSource + "\treserve:" + reserve);
773
										// thriftItem.getId() + "\ttotal_held: "
-
 
774
										// + total_held + "\theldForSource:" +
-
 
775
										// heldForSource + "\treserve:" +
478
										//continue;
776
										// reserve);
479
									}
777
										// continue;
480
									else if(maxnlcFK==0){
778
									} else if (maxnlcFK == 0) {
-
 
779
										// reserve = reserve +
481
										//reserve = reserve + itemreserve.get(warehouse.getId());
780
										// itemreserve.get(warehouse.getId());
-
 
781
										// System.out.println("itemId:" +
482
										//System.out.println("itemId:" + thriftItem.getId() + "\ttotal_held: " + total_held + "\theldForSource:" + heldForSource + "\treserve:" + reserve);
782
										// thriftItem.getId() + "\ttotal_held: "
-
 
783
										// + total_held + "\theldForSource:" +
-
 
784
										// heldForSource + "\treserve:" +
483
										//continue;
785
										// reserve);
484
									}
786
										// continue;
485
									else{
787
									} else {
-
 
788
										if (flipkartLeftInvDataMap
486
										if(flipkartLeftInvDataMap.containsKey(flipkartItem.getSkuAtFlipkart())){
789
												.containsKey(flipkartItem
-
 
790
														.getSkuAtFlipkart())) {
487
											Map<Long, NlcLeftOutInventory> newNlcObjMap = flipkartLeftInvDataMap.get(flipkartItem.getSkuAtFlipkart());
791
											Map<Long, NlcLeftOutInventory> newNlcObjMap = flipkartLeftInvDataMap
-
 
792
													.get(flipkartItem
-
 
793
															.getSkuAtFlipkart());
-
 
794
											if (newNlcObjMap
488
											if(newNlcObjMap.containsKey(warehouse.getId())){
795
													.containsKey(warehouse
-
 
796
															.getId())) {
489
												NlcLeftOutInventory newObj = newNlcObjMap.get(warehouse.getId());
797
												NlcLeftOutInventory newObj = newNlcObjMap
-
 
798
														.get(warehouse.getId());
490
												newObj.setReserved(itemreserve.get(warehouse.getId()));
799
												newObj.setReserved(itemreserve
-
 
800
														.get(warehouse.getId()));
491
												newObj.setTotalAvailability(newObj.getVendorAvailability()-itemreserve.get(warehouse.getId()));
801
												newObj.setTotalAvailability(newObj
-
 
802
														.getVendorAvailability()
-
 
803
														- itemreserve.get(warehouse
-
 
804
																.getId()));
492
												newNlcObjMap.remove(warehouse.getId());
805
												newNlcObjMap.remove(warehouse
-
 
806
														.getId());
-
 
807
												newNlcObjMap.put(
493
												newNlcObjMap.put(warehouse.getId(), newObj);
808
														warehouse.getId(),
-
 
809
														newObj);
494
 
810
 
495
											}
811
											}
496
											nlcLoiMapFK = newNlcObjMap;
812
											nlcLoiMapFK = newNlcObjMap;
497
										}
813
										}
498
									}
814
									}
499
								}
815
								}
500
 
816
 
501
 
-
 
502
							}
817
							}
503
						}
818
						}
504
 
819
 
505
						if(nlcLoiMapSD!=null && nlcLoiMapSD.size()>0){
820
						if (nlcLoiMapSD != null && nlcLoiMapSD.size() > 0) {
-
 
821
							snapdealLeftInvDataMap.put(
506
							snapdealLeftInvDataMap.put(snapdealItem.getSkuAtSnapdeal(), nlcLoiMapSD);
822
									snapdealItem.getSkuAtSnapdeal(),
-
 
823
									nlcLoiMapSD);
507
						}
824
						}
508
						if(nlcLoiMapFK!=null && nlcLoiMapFK.size()>0){
825
						if (nlcLoiMapFK != null && nlcLoiMapFK.size() > 0) {
-
 
826
							flipkartLeftInvDataMap.put(
509
							flipkartLeftInvDataMap.put(flipkartItem.getSkuAtFlipkart(), nlcLoiMapFK);
827
									flipkartItem.getSkuAtFlipkart(),
-
 
828
									nlcLoiMapFK);
510
						}
829
						}
511
 
830
 
512
					}else{
831
					} else {
513
						for (Map.Entry<Long,Long> entry : itemreserve.entrySet()) {
832
						for (Map.Entry<Long, Long> entry : itemreserve
-
 
833
								.entrySet()) {
514
							if(allWarehousesMap.get(entry.getKey()).getBillingWarehouseId()!=7){
834
							if (allWarehousesMap.get(entry.getKey())
-
 
835
									.getBillingWarehouseId() != 7) {
-
 
836
								if (allWarehousesMap.get(entry.getKey())
-
 
837
										.getLogisticsLocation()
-
 
838
										.equals(WarehouseLocation.Delhi)
-
 
839
										&& allWarehousesMap
-
 
840
												.get(entry.getKey())
-
 
841
												.getWarehouseType()
515
								if(allWarehousesMap.get(entry.getKey()).getLogisticsLocation().equals(WarehouseLocation.Delhi) && allWarehousesMap.get(entry.getKey()).getWarehouseType().equals(WarehouseType.THIRD_PARTY) && allWarehousesMap.get(entry.getKey()).getVendor().getId()!=1){
842
												.equals(WarehouseType.THIRD_PARTY)
-
 
843
										&& allWarehousesMap.get(entry.getKey())
-
 
844
												.getVendor().getId() != 1) {
516
 
845
 
517
								}
-
 
518
								else{
846
								} else {
519
									continue;
847
									continue;
520
								}
848
								}
521
							}
849
							}
522
							in.shop2020.model.v1.inventory.IgnoredInventoryUpdateItems ignoredItem = new in.shop2020.model.v1.inventory.IgnoredInventoryUpdateItems();
850
							in.shop2020.model.v1.inventory.IgnoredInventoryUpdateItems ignoredItem = new in.shop2020.model.v1.inventory.IgnoredInventoryUpdateItems();
523
							ignoredItem.setItemId(thriftItem.getId());
851
							ignoredItem.setItemId(thriftItem.getId());
524
							ignoredItem.setWarehouseId(entry.getKey());
852
							ignoredItem.setWarehouseId(entry.getKey());
-
 
853
							if (!thirdpartywarehouseids
-
 
854
									.contains(entry.getKey())
525
							if(!thirdpartywarehouseids.contains(entry.getKey()) && !ignoreItems.contains(ignoredItem)){
855
									&& !ignoreItems.contains(ignoredItem)) {
526
								nlc = inventoryClient.getNlcForWarehouse(entry.getKey(),thriftItem.getId());
856
								nlc = inventoryClient.getNlcForWarehouse(
-
 
857
										entry.getKey(), thriftItem.getId());
-
 
858
								// System.out.println("itemId:" +
-
 
859
								// thriftItem.getId() + "\tmaxnlc: " + maxnlc +
527
								//System.out.println("itemId:" + thriftItem.getId() + "\tmaxnlc: " + maxnlc + "\tnlc:" + nlc + "\twid:" + entry.getKey() );
860
								// "\tnlc:" + nlc + "\twid:" + entry.getKey() );
528
								if(snapdealItem!=null){
861
								if (snapdealItem != null) {
529
									if(nlc !=0 && (maxnlcSD >= nlc)){
862
									if (nlc != 0 && (maxnlcSD >= nlc)) {
530
										//reserve =  reserve + entry.getValue();
863
										// reserve = reserve + entry.getValue();
-
 
864
										// System.out.println("itemId:" +
531
										//System.out.println("itemId:" + thriftItem.getId() + "\ttotal_held: " + total_held + "\theldForSource:" + heldForSource + "\treserve:" + reserve);
865
										// thriftItem.getId() + "\ttotal_held: "
-
 
866
										// + total_held + "\theldForSource:" +
-
 
867
										// heldForSource + "\treserve:" +
532
										//continue;
868
										// reserve);
533
									}
869
										// continue;
534
									else if(maxnlcSD==0){
870
									} else if (maxnlcSD == 0) {
535
										//reserve =  reserve + entry.getValue();
871
										// reserve = reserve + entry.getValue();
-
 
872
										// System.out.println("itemId:" +
536
										//System.out.println("itemId:" + thriftItem.getId() + "\ttotal_held: " + total_held + "\theldForSource:" + heldForSource + "\treserve:" + reserve);
873
										// thriftItem.getId() + "\ttotal_held: "
-
 
874
										// + total_held + "\theldForSource:" +
-
 
875
										// heldForSource + "\treserve:" +
537
										//continue;
876
										// reserve);
538
									}
877
										// continue;
539
									else{
878
									} else {
-
 
879
										if (snapdealLeftInvDataMap
540
										if(snapdealLeftInvDataMap.containsKey(snapdealItem.getSkuAtSnapdeal())){
880
												.containsKey(snapdealItem
-
 
881
														.getSkuAtSnapdeal())) {
541
											Map<Long, NlcLeftOutInventory> newNlcObjMap = snapdealLeftInvDataMap.get(snapdealItem.getSkuAtSnapdeal());
882
											Map<Long, NlcLeftOutInventory> newNlcObjMap = snapdealLeftInvDataMap
-
 
883
													.get(snapdealItem
-
 
884
															.getSkuAtSnapdeal());
542
											if(newNlcObjMap.containsKey(entry.getKey())){
885
											if (newNlcObjMap.containsKey(entry
-
 
886
													.getKey())) {
543
												NlcLeftOutInventory newObj = newNlcObjMap.get(entry.getKey());
887
												NlcLeftOutInventory newObj = newNlcObjMap
-
 
888
														.get(entry.getKey());
544
												newObj.setReserved(itemreserve.get(entry.getKey()));
889
												newObj.setReserved(itemreserve
-
 
890
														.get(entry.getKey()));
545
												newObj.setTotalAvailability(newObj.getVendorAvailability()-itemreserve.get(entry.getKey()));
891
												newObj.setTotalAvailability(newObj
-
 
892
														.getVendorAvailability()
-
 
893
														- itemreserve.get(entry
-
 
894
																.getKey()));
546
												newNlcObjMap.remove(entry.getKey());
895
												newNlcObjMap.remove(entry
-
 
896
														.getKey());
-
 
897
												newNlcObjMap.put(
547
												newNlcObjMap.put(entry.getKey(), newObj);
898
														entry.getKey(), newObj);
548
 
899
 
549
											}
900
											}
550
											nlcLoiMapSD = newNlcObjMap;
901
											nlcLoiMapSD = newNlcObjMap;
551
										}
902
										}
552
									}
903
									}
553
								}
904
								}
554
								if(flipkartItem!=null){
905
								if (flipkartItem != null) {
555
									if(nlc !=0 && (maxnlcFK >= nlc)){
906
									if (nlc != 0 && (maxnlcFK >= nlc)) {
556
										//reserve =  reserve + entry.getValue();
907
										// reserve = reserve + entry.getValue();
-
 
908
										// System.out.println("itemId:" +
557
										//System.out.println("itemId:" + thriftItem.getId() + "\ttotal_held: " + total_held + "\theldForSource:" + heldForSource + "\treserve:" + reserve);
909
										// thriftItem.getId() + "\ttotal_held: "
-
 
910
										// + total_held + "\theldForSource:" +
-
 
911
										// heldForSource + "\treserve:" +
558
										//continue;
912
										// reserve);
559
									}
913
										// continue;
560
									else if(maxnlcFK==0){
914
									} else if (maxnlcFK == 0) {
561
										//reserve =  reserve + entry.getValue();
915
										// reserve = reserve + entry.getValue();
-
 
916
										// System.out.println("itemId:" +
562
										//System.out.println("itemId:" + thriftItem.getId() + "\ttotal_held: " + total_held + "\theldForSource:" + heldForSource + "\treserve:" + reserve);
917
										// thriftItem.getId() + "\ttotal_held: "
-
 
918
										// + total_held + "\theldForSource:" +
-
 
919
										// heldForSource + "\treserve:" +
563
										//continue;
920
										// reserve);
564
									}
921
										// continue;
565
									else{
922
									} else {
-
 
923
										if (flipkartLeftInvDataMap
566
										if(flipkartLeftInvDataMap.containsKey(flipkartItem.getSkuAtFlipkart())){
924
												.containsKey(flipkartItem
-
 
925
														.getSkuAtFlipkart())) {
567
											Map<Long, NlcLeftOutInventory> newNlcObjMap = flipkartLeftInvDataMap.get(flipkartItem.getSkuAtFlipkart());
926
											Map<Long, NlcLeftOutInventory> newNlcObjMap = flipkartLeftInvDataMap
-
 
927
													.get(flipkartItem
-
 
928
															.getSkuAtFlipkart());
568
											if(newNlcObjMap.containsKey(entry.getKey())){
929
											if (newNlcObjMap.containsKey(entry
-
 
930
													.getKey())) {
569
												NlcLeftOutInventory newObj = newNlcObjMap.get(entry.getKey());
931
												NlcLeftOutInventory newObj = newNlcObjMap
-
 
932
														.get(entry.getKey());
570
												newObj.setReserved(itemreserve.get(entry.getKey()));
933
												newObj.setReserved(itemreserve
-
 
934
														.get(entry.getKey()));
571
												newObj.setTotalAvailability(newObj.getVendorAvailability()-itemreserve.get(entry.getKey()));
935
												newObj.setTotalAvailability(newObj
-
 
936
														.getVendorAvailability()
-
 
937
														- itemreserve.get(entry
-
 
938
																.getKey()));
572
												newNlcObjMap.remove(entry.getKey());
939
												newNlcObjMap.remove(entry
-
 
940
														.getKey());
-
 
941
												newNlcObjMap.put(
573
												newNlcObjMap.put(entry.getKey(), newObj);
942
														entry.getKey(), newObj);
574
 
943
 
575
											}
944
											}
576
											nlcLoiMapFK = newNlcObjMap;
945
											nlcLoiMapFK = newNlcObjMap;
577
										}
946
										}
578
									}
947
									}
579
								}
948
								}
580
 
949
 
581
							}
950
							}
582
 
951
 
583
							else{
952
							else {
584
								//System.out.println("skipping inventory for warehouse id " + entry.getKey());
953
								// System.out.println("skipping inventory for warehouse id "
-
 
954
								// + entry.getKey());
585
							}
955
							}
586
						}
956
						}
587
 
957
 
588
						if(nlcLoiMapSD!=null && nlcLoiMapSD.size()>0){
958
						if (nlcLoiMapSD != null && nlcLoiMapSD.size() > 0) {
-
 
959
							snapdealLeftInvDataMap.put(
589
							snapdealLeftInvDataMap.put(snapdealItem.getSkuAtSnapdeal(), nlcLoiMapSD);
960
									snapdealItem.getSkuAtSnapdeal(),
-
 
961
									nlcLoiMapSD);
590
						}
962
						}
591
						if(nlcLoiMapFK!=null && nlcLoiMapFK.size()>0){
963
						if (nlcLoiMapFK != null && nlcLoiMapFK.size() > 0) {
-
 
964
							flipkartLeftInvDataMap.put(
592
							flipkartLeftInvDataMap.put(flipkartItem.getSkuAtFlipkart(), nlcLoiMapFK);
965
									flipkartItem.getSkuAtFlipkart(),
-
 
966
									nlcLoiMapFK);
593
						}
967
						}
594
					}
968
					}
595
 
969
 
596
 
-
 
597
				}
970
				}
598
 
971
 
599
				nlcLoiItemsMapSD = snapdealLeftInvDataMap;
972
				nlcLoiItemsMapSD = snapdealLeftInvDataMap;
600
				nlcLoiItemsMapFK = flipkartLeftInvDataMap;
973
				nlcLoiItemsMapFK = flipkartLeftInvDataMap;
-
 
974
 
-
 
975
				List<NlcLeftOutInventory> subNlcLoiItemsListSD1 = new ArrayList<NlcLeftOutInventory>();
-
 
976
				List<NlcLeftOutInventory> subNlcLoiItemsListSD2 = new ArrayList<NlcLeftOutInventory>();
-
 
977
				List<NlcLeftOutInventory> subNlcLoiItemsListFK1 = new ArrayList<NlcLeftOutInventory>();
-
 
978
				List<NlcLeftOutInventory> subNlcLoiItemsListFK2 = new ArrayList<NlcLeftOutInventory>();
601
				/*for (Map.Entry<String,Map<Long, NlcLeftOutInventory>> entry : snapdealLeftInvDataMap.entrySet()){
979
				for (Map<Long, NlcLeftOutInventory> nlcLOImap : nlcLoiItemsMapSD
-
 
980
						.values()) {
-
 
981
					// System.out.println("Inner Map Size "+nlcLOImap.size());
602
					for(NlcLeftOutInventory nlcLOI : entry.getValue().values()){
982
					for (NlcLeftOutInventory nlcLOI : nlcLOImap.values()) {
-
 
983
						if (nlcLOI.getWarehouseType().equalsIgnoreCase("OURS")) {
-
 
984
							subNlcLoiItemsListSD1.add(nlcLOI);
-
 
985
						}
-
 
986
						if (nlcLOI.getWarehouseType().equalsIgnoreCase(
-
 
987
								"THIRD_PARTY")) {
603
						nlcLeftOutInventoryItemsSD.add(nlcLOI);
988
							subNlcLoiItemsListSD2.add(nlcLOI);
-
 
989
						}
604
					}
990
					}
605
				}
991
				}
-
 
992
 
-
 
993
				if (subNlcLoiItemsListSD1 != null
-
 
994
						&& subNlcLoiItemsListSD1.size() >= 2) {
-
 
995
					Collections.sort(subNlcLoiItemsListSD1,
-
 
996
							new NlcLeftOutInventoryComparator());
-
 
997
				}
-
 
998
				if (subNlcLoiItemsListSD2 != null
-
 
999
						&& subNlcLoiItemsListSD2.size() >= 2) {
-
 
1000
					Collections.sort(subNlcLoiItemsListSD2,
-
 
1001
							new NlcLeftOutInventoryComparator());
-
 
1002
				}
-
 
1003
				mainNlcLoiItemsListSD.addAll(subNlcLoiItemsListSD1);
-
 
1004
				mainNlcLoiItemsListSD.addAll(subNlcLoiItemsListSD2);
-
 
1005
 
606
				for (Map.Entry<String,Map<Long, NlcLeftOutInventory>> entry : flipkartLeftInvDataMap.entrySet()){
1006
				for (Map<Long, NlcLeftOutInventory> nlcLOImap : nlcLoiItemsMapFK
-
 
1007
						.values()) {
-
 
1008
					// System.out.println("Inner Map Size "+nlcLOImap.size());
607
					for(NlcLeftOutInventory nlcLOI : entry.getValue().values()){
1009
					for (NlcLeftOutInventory nlcLOI : nlcLOImap.values()) {
-
 
1010
						if (nlcLOI.getWarehouseType().equalsIgnoreCase("OURS")) {
-
 
1011
							subNlcLoiItemsListFK1.add(nlcLOI);
-
 
1012
						}
-
 
1013
						if (nlcLOI.getWarehouseType().equalsIgnoreCase("THIRD_PARTY")) {
608
						nlcLeftOutInventoryItemsFK.add(nlcLOI);
1014
							subNlcLoiItemsListFK2.add(nlcLOI);
-
 
1015
						}
609
					}
1016
					}
610
				}*/
1017
				}
-
 
1018
 
-
 
1019
				if (subNlcLoiItemsListFK1 != null
-
 
1020
						&& subNlcLoiItemsListFK1.size() >= 2) {
-
 
1021
					Collections.sort(subNlcLoiItemsListFK1,
-
 
1022
							new NlcLeftOutInventoryComparator());
-
 
1023
				}
-
 
1024
				if (subNlcLoiItemsListFK2 != null
-
 
1025
						&& subNlcLoiItemsListFK2.size() >= 2) {
-
 
1026
					Collections.sort(subNlcLoiItemsListFK2,
-
 
1027
							new NlcLeftOutInventoryComparator());
-
 
1028
				}
-
 
1029
				
-
 
1030
				mainNlcLoiItemsListFK.addAll(subNlcLoiItemsListFK1);
-
 
1031
				mainNlcLoiItemsListFK.addAll(subNlcLoiItemsListFK2);
-
 
1032
				
611
 
1033
 
612
			}
1034
			}
613
		} catch (TException e) {
1035
		} catch (TException e) {
614
			// TODO Auto-generated catch block
1036
			// TODO Auto-generated catch block
615
			e.printStackTrace();
1037
			e.printStackTrace();
616
		}
1038
		}
617
 
1039
 
618
	}
1040
	}
619
 
1041
 
-
 
1042
	private static void createAndSendLeftOutInventoryFile(
620
	private static void createAndSendLeftOutInventoryFile(Map<String, Map<Long, NlcLeftOutInventory>> nlcLeftoutInventoryItems, String fileName){
1043
			Map<String, Map<Long, NlcLeftOutInventory>> nlcLeftoutInventoryItems,
-
 
1044
			String fileName) {
621
		try {
1045
		try {
622
			File file = new File("/tmp/" + fileName +"-leftOutInv.xls");
-
 
623
			BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file));
-
 
624
			bufferedWriter.write(StringUtils.join(new String[] {
-
 
625
					"ItemId", 
-
 
626
					"Product Name",
-
 
627
					"SkuAtSource",
-
 
628
					"Vendor Name",
-
 
629
					"Vendor Warehouse Id",
-
 
630
					"Warehouse Type",
-
 
631
					"Max Our NLC",
-
 
632
					"Vendor NLC",
-
 
633
					"Availability Count",
-
 
634
					"Reserved Count",
-
 
635
					"Net Availabilty"
-
 
636
			}, '\t'));
-
 
637
 
1046
 
-
 
1047
			StringBuffer sb = new StringBuffer();
-
 
1048
			sb.append("<html><table border=\"1\" align=\"center\">"
-
 
1049
					+ "<caption><b>" + "LEFT OUT INVENTORY DETAIL" + "</b></caption>"
-
 
1050
					+ "<tr>" + "<td><b>" + "ITEM-ID" + "</b></td>" + "<td><b>"
-
 
1051
					+ "PRODUCT-NAME" + "</b></td>" + "<td><b>" + "SKU-AT-SOURCE"
-
 
1052
					+ "</b></td>" + "<td><b>" + "VENDOR-NAME" + "</b></td>"
-
 
1053
					+ "<td><b>" + "VENDOR-WAREHOUSE" + "</b></td>" + "<td><b>"
-
 
1054
					+ "WAREHOUSE-TYPE" + "</b></td>" + "<td><b>" + "MAX-OUR-NLC"
-
 
1055
					+ "</b></td>" + "</b></td>" + "<td><b>" + "VENDOR-NLC"
-
 
1056
					+ "</b></td>" + "<td><b>" + "AVAILABILITY-COUNT" + "</b></td>"
-
 
1057
					+ "<td><b>" + "RESERVED-COUNT" + "</b></td>"
-
 
1058
					+ "<td><b>" + "NET-AVAILABILITY" + "</b></td>"
-
 
1059
					+ "</tr>");
-
 
1060
			
-
 
1061
			if(fileName.equalsIgnoreCase("SNAPDEAL")){
638
			//System.out.println(fileName+ " Main Map Size "+nlcLeftoutInventoryItems.size());
1062
				for(NlcLeftOutInventory obj: mainNlcLoiItemsListSD){
-
 
1063
					sb.append("<tr>"+"<td>"+obj.getItemId()+"</td>"
-
 
1064
							+"<td>"+obj.getProductName()+"</td>"
-
 
1065
							+"<td>"+obj.getSkuAtSource()+"</td>"
-
 
1066
							+"<td>"+obj.getVendorName()+"</td>"
-
 
1067
							+"<td>"+obj.getVendorWarehouseId()+"</td>"
-
 
1068
							+"<td>"+obj.getWarehouseType()+"</td>"
-
 
1069
							+"<td>"+obj.getOurNlc()+"</td>"
-
 
1070
							+"<td>"+obj.getVendorNlc()+"</td>"
-
 
1071
							+"<td>"+obj.getVendorAvailability()+"</td>"
-
 
1072
							+"<td>"+obj.getReserved()+"</td>"
-
 
1073
							+"<td>"+obj.getTotalAvailability()+"</td>"+"</tr>"
-
 
1074
							);
-
 
1075
				}
-
 
1076
			}
-
 
1077
			
-
 
1078
			if(fileName.equalsIgnoreCase("FLIPKART")){
-
 
1079
				for(NlcLeftOutInventory obj: mainNlcLoiItemsListFK){
-
 
1080
					sb.append("<tr>"+"<td>"+obj.getItemId()+"</td>"
-
 
1081
							+"<td>"+obj.getProductName()+"</td>"
-
 
1082
							+"<td>"+obj.getSkuAtSource()+"</td>"
-
 
1083
							+"<td>"+obj.getVendorName()+"</td>"
-
 
1084
							+"<td>"+obj.getVendorWarehouseId()+"</td>"
-
 
1085
							+"<td>"+obj.getWarehouseType()+"</td>"
-
 
1086
							+"<td>"+obj.getOurNlc()+"</td>"
-
 
1087
							+"<td>"+obj.getVendorNlc()+"</td>"
-
 
1088
							+"<td>"+obj.getVendorAvailability()+"</td>"
-
 
1089
							+"<td>"+obj.getReserved()+"</td>"
-
 
1090
							+"<td>"+obj.getTotalAvailability()+"</td>"+"</tr>"
-
 
1091
							);
-
 
1092
				}
-
 
1093
			}
639
			
1094
			
-
 
1095
			sb.append("</table></html>");
-
 
1096
			
-
 
1097
			BufferedWriter out = new BufferedWriter(new FileWriter("/tmp/"+fileName+"-leftOutInv-file.htm"));
-
 
1098
			out.write(sb.toString());
-
 
1099
			out.flush();
-
 
1100
			out.close();
-
 
1101
			
-
 
1102
			File file = new File("/tmp/" + fileName + "-leftOutInv.xls");
-
 
1103
			BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(
-
 
1104
					file));
-
 
1105
			bufferedWriter.write(StringUtils.join(new String[] { "ItemId",
-
 
1106
					"Product Name", "SkuAtSource", "Vendor Name",
-
 
1107
					"Vendor Warehouse Id", "Warehouse Type", "Max Our NLC",
-
 
1108
					"Vendor NLC", "Availability Count", "Reserved Count",
-
 
1109
					"Net Availabilty" }, '\t'));
-
 
1110
 
-
 
1111
			// System.out.println(fileName+
-
 
1112
			// " Main Map Size "+nlcLeftoutInventoryItems.size());
-
 
1113
 
640
			for(Map<Long, NlcLeftOutInventory> nlcLOImap : nlcLeftoutInventoryItems.values()){
1114
			for (Map<Long, NlcLeftOutInventory> nlcLOImap : nlcLeftoutInventoryItems
-
 
1115
					.values()) {
641
				//System.out.println("Inner Map Size "+nlcLOImap.size());
1116
				// System.out.println("Inner Map Size "+nlcLOImap.size());
642
				for(NlcLeftOutInventory nlcLOI : nlcLOImap.values()){
1117
				for (NlcLeftOutInventory nlcLOI : nlcLOImap.values()) {
643
					bufferedWriter.newLine();
1118
					bufferedWriter.newLine();
644
 
1119
 
645
					bufferedWriter.write(StringUtils.join(
1120
					bufferedWriter.write(StringUtils.join(
646
							new String[] {
1121
							new String[] {
647
									String.valueOf(nlcLOI.getItemId()),
1122
									String.valueOf(nlcLOI.getItemId()),
648
									nlcLOI.getProductName(),
1123
									nlcLOI.getProductName(),
649
									nlcLOI.getSkuAtSource(),
1124
									nlcLOI.getSkuAtSource(),
650
									nlcLOI.getVendorName(),
1125
									nlcLOI.getVendorName(),
-
 
1126
									String.valueOf(nlcLOI
651
									String.valueOf(nlcLOI.getVendorWarehouseId()),
1127
											.getVendorWarehouseId()),
652
									nlcLOI.getWarehouseType(),
1128
									nlcLOI.getWarehouseType(),
653
									String.valueOf(nlcLOI.getOurNlc()),
1129
									String.valueOf(nlcLOI.getOurNlc()),
654
									String.valueOf(nlcLOI.getVendorNlc()),
1130
									String.valueOf(nlcLOI.getVendorNlc()),
-
 
1131
									String.valueOf(nlcLOI
655
									String.valueOf(nlcLOI.getVendorAvailability()),
1132
											.getVendorAvailability()),
656
									String.valueOf(nlcLOI.getReserved()),
1133
									String.valueOf(nlcLOI.getReserved()),
-
 
1134
									String.valueOf(nlcLOI
657
									String.valueOf(nlcLOI.getTotalAvailability())}, '\t'));
1135
											.getTotalAvailability()) }, '\t'));
658
 
1136
 
659
				}
1137
				}
660
			}
1138
			}
661
			bufferedWriter.close();
1139
			bufferedWriter.close();
662
 
1140
 
663
			List<File> files = new ArrayList<File>();
1141
			List<File> files = new ArrayList<File>();
664
			files.add(file);
1142
			files.add(file);
665
 
1143
 
-
 
1144
			mailer.sendSSLMessage(sendTo,
-
 
1145
					"Inventory not Sent due to NLC Limitaion in case of - "
-
 
1146
							+ fileName, "Please find attached file.",
666
			mailer.sendSSLMessage(sendTo, "Inventory not Sent due to NLC Limitaion in case of - "+ fileName , "Please find attached file.", emailFromAddress, password, files);
1147
					emailFromAddress, password, "/tmp/" + fileName + "-leftOutInv.xls", "/tmp/"+fileName+"-leftOutInv-file.htm");
-
 
1148
			/*mailer.sendSSLMessage(sendTo,
-
 
1149
					"Inventory not Sent due to NLC Limitaion in case of - "
-
 
1150
							+ fileName, "Please find attached file.",
-
 
1151
					emailFromAddress, password, files);*/
667
		} catch (Exception e) {
1152
		} catch (Exception e) {
668
			e.printStackTrace();
1153
			e.printStackTrace();
669
			try {
1154
			try {
-
 
1155
				mailer.sendSSLMessage(sendTo,
670
				mailer.sendSSLMessage(sendTo,"Error while creating file from data ", emailFromAddress, password, "");
1156
						"Error while creating file from data ",
-
 
1157
						emailFromAddress, password, "");
671
			} catch (MessagingException e1) {
1158
			} catch (MessagingException e1) {
672
				e1.printStackTrace();
1159
				e1.printStackTrace();
673
			}
1160
			}
674
		}
1161
		}
675
	}
1162
	}
676
 
1163
 
677
	//private static DefaultHttpClient client = new DefaultHttpClient();
1164
	// private static DefaultHttpClient client = new DefaultHttpClient();
678
 
1165
 
679
	public static void main(String[] args) throws Exception {
1166
	public static void main(String[] args) throws Exception {
680
		calculateinventory();
1167
		calculateinventory();
681
		createAndSendLeftOutInventoryFile(nlcLoiItemsMapSD, "SNAPDEAL");
1168
		createAndSendLeftOutInventoryFile(nlcLoiItemsMapSD, "SNAPDEAL");
682
		createAndSendLeftOutInventoryFile(nlcLoiItemsMapFK, "FLIPKART");
1169
		createAndSendLeftOutInventoryFile(nlcLoiItemsMapFK, "FLIPKART");
683
 
1170
 
684
 
1171
		/*
-
 
1172
		 * HttpPost post = new
685
		/*HttpPost post = new HttpPost("http://selleraccounts.snapdeal.com/keymaker/login");
1173
		 * HttpPost("http://selleraccounts.snapdeal.com/keymaker/login");
-
 
1174
		 * HttpGet get = new HttpGet(
686
		HttpGet get = new HttpGet("http://seller.snapdeal.com/pricing/search?gridType=normal&_search=false&nd=1392188583467&rows=30&page=1&sidx=&sord=asc");
1175
		 * "http://seller.snapdeal.com/pricing/search?gridType=normal&_search=false&nd=1392188583467&rows=30&page=1&sidx=&sord=asc"
687
		BufferedReader rd= null;
-
 
688
		List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
1176
		 * ); BufferedReader rd= null; List<NameValuePair> nameValuePairs = new
689
		nameValuePairs.add(new BasicNameValuePair("username",
1177
		 * ArrayList<NameValuePair>(); nameValuePairs.add(new
690
		"khushal.bhatia@saholic.com"));
1178
		 * BasicNameValuePair("username", "khushal.bhatia@saholic.com"));
691
		nameValuePairs.add(new BasicNameValuePair("password",
1179
		 * nameValuePairs.add(new BasicNameValuePair("password", "sonline"));
692
		"sonline"));
-
 
693
		nameValuePairs.add(new BasicNameValuePair("lt",
1180
		 * nameValuePairs.add(new BasicNameValuePair("lt",
694
		"LT-14717-oFCLyRTRMWfMDeczgXm0aaufUjfwPV"));
1181
		 * "LT-14717-oFCLyRTRMWfMDeczgXm0aaufUjfwPV")); nameValuePairs.add(new
695
		nameValuePairs.add(new BasicNameValuePair("execution",
1182
		 * BasicNameValuePair("execution", "e1s1")); nameValuePairs.add(new
696
		"e1s1"));
-
 
697
		nameValuePairs.add(new BasicNameValuePair("_eventId",
1183
		 * BasicNameValuePair("_eventId", "submit")); nameValuePairs.add(new
698
		"submit"));
-
 
699
		nameValuePairs.add(new BasicNameValuePair("submit",
1184
		 * BasicNameValuePair("submit", "LOGIN")); //post.setEntity(new
700
		"LOGIN"));
-
 
701
		//post.setEntity(new UrlEncodedFormEntity(nameValuePairs,"utf-8"));
1185
		 * UrlEncodedFormEntity(nameValuePairs,"utf-8"));
702
 
-
 
703
		HttpResponse response = null;
-
 
704
		try {
1186
		 * 
705
			response = client.execute(post);
1187
		 * HttpResponse response = null; try { response = client.execute(post);
706
		} catch (ClientProtocolException e) {
1188
		 * } catch (ClientProtocolException e) { // TODO Auto-generated catch
707
			// TODO Auto-generated catch block
-
 
708
			e.printStackTrace();
-
 
709
		} catch (IOException e) {
1189
		 * block e.printStackTrace(); } catch (IOException e) { // TODO
710
			// TODO Auto-generated catch block
1190
		 * Auto-generated catch block e.printStackTrace(); }
711
			e.printStackTrace();
-
 
712
		}
1191
		 * 
713
 
-
 
714
		try {
1192
		 * try { rd = new BufferedReader(new
715
			rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
1193
		 * InputStreamReader(response.getEntity().getContent())); } catch
716
		} catch (IllegalStateException e1) {
-
 
717
			// TODO Auto-generated catch block
1194
		 * (IllegalStateException e1) { // TODO Auto-generated catch block
718
			e1.printStackTrace();
-
 
719
		} catch (IOException e1) {
1195
		 * e1.printStackTrace(); } catch (IOException e1) { // TODO
720
			// TODO Auto-generated catch block
1196
		 * Auto-generated catch block e1.printStackTrace(); } String line = "";
721
			e1.printStackTrace();
-
 
722
		}
-
 
723
		String line = "";
-
 
724
		try {
-
 
725
			while ((line = rd.readLine()) != null) {
1197
		 * try { while ((line = rd.readLine()) != null) {
726
				System.out.println(line);
1198
		 * System.out.println(line); } } catch (IOException e) { // TODO
727
			}
-
 
728
		} catch (IOException e) {
-
 
729
			// TODO Auto-generated catch block
1199
		 * Auto-generated catch block e.printStackTrace(); }
730
			e.printStackTrace();
-
 
731
		}
1200
		 * 
732
 
-
 
733
		for(Header h: response.getAllHeaders()){
1201
		 * for(Header h: response.getAllHeaders()){
734
			System.out.println(h.getName()+" "+h.getValue());
1202
		 * System.out.println(h.getName()+" "+h.getValue()); }
735
		}
1203
		 * 
736
 
-
 
737
 
-
 
738
		try {
1204
		 * 
739
			response = client.execute(get);
1205
		 * try { response = client.execute(get); } catch
740
		} catch (ClientProtocolException e) {
-
 
741
			// TODO Auto-generated catch block
1206
		 * (ClientProtocolException e) { // TODO Auto-generated catch block
742
			e.printStackTrace();
-
 
743
		} catch (IOException e) {
1207
		 * e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated
744
			// TODO Auto-generated catch block
-
 
745
			e.printStackTrace();
1208
		 * catch block e.printStackTrace(); }
746
		}
1209
		 * 
747
 
-
 
748
		try {
1210
		 * try { rd = new BufferedReader(new
749
			rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
1211
		 * InputStreamReader(response.getEntity().getContent())); } catch
750
		} catch (IllegalStateException e1) {
-
 
751
			// TODO Auto-generated catch block
1212
		 * (IllegalStateException e1) { // TODO Auto-generated catch block
752
			e1.printStackTrace();
-
 
753
		} catch (IOException e1) {
1213
		 * e1.printStackTrace(); } catch (IOException e1) { // TODO
754
			// TODO Auto-generated catch block
1214
		 * Auto-generated catch block e1.printStackTrace(); }
755
			e1.printStackTrace();
-
 
756
		}
1215
		 * 
757
 
-
 
758
		System.out.println("Get Response for Get Request");
1216
		 * System.out.println("Get Response for Get Request");
759
 
-
 
760
		try {
1217
		 * 
761
			while ((line = rd.readLine()) != null) {
1218
		 * try { while ((line = rd.readLine()) != null) {
762
				System.out.println(line);
1219
		 * System.out.println(line); } } catch (IOException e) { // TODO
763
			}
-
 
764
		} catch (IOException e) {
-
 
765
			// TODO Auto-generated catch block
1220
		 * Auto-generated catch block e.printStackTrace(); }
766
			e.printStackTrace();
-
 
767
		}*/
1221
		 */
768
 
1222
 
769
	}
1223
	}
770
}
1224
}
771
1225