Subversion Repositories SmartDukaan

Rev

Rev 13089 | Rev 18668 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
11349 manish.sha 1
package in.shop2020.inventory.controllers;
2
 
3
import in.shop2020.model.v1.catalog.Item;
4
import in.shop2020.model.v1.catalog.ItemType;
5
import in.shop2020.model.v1.inventory.InventoryService;
6
import in.shop2020.model.v1.inventory.InventoryType;
7
import in.shop2020.model.v1.inventory.Warehouse;
8
import in.shop2020.model.v1.inventory.WarehouseType;
9
import in.shop2020.model.v1.order.LineItem;
10
import in.shop2020.purchase.Invoice;
11
import in.shop2020.purchase.PurchaseOrder;
12
import in.shop2020.purchase.PurchaseServiceException;
13
import in.shop2020.thrift.clients.CatalogClient;
14
import in.shop2020.thrift.clients.InventoryClient;
15
import in.shop2020.thrift.clients.PurchaseClient;
16
import in.shop2020.thrift.clients.WarehouseClient;
17
import in.shop2020.utils.ModelUtils;
18
import in.shop2020.warehouse.InventoryItem;
19
import in.shop2020.warehouse.ScanType;
20
import in.shop2020.warehouse.WarehouseService;
21
import in.shop2020.warehouse.WarehouseService.Client;
22
 
23
import java.io.BufferedInputStream;
24
import java.io.BufferedReader;
25
import java.io.BufferedWriter;
26
import java.io.File;
27
import java.io.FileInputStream;
28
import java.io.FileReader;
29
import java.io.FileWriter;
30
import java.io.IOException;
31
import java.io.InputStream;
32
import java.util.ArrayList;
33
import java.util.HashMap;
34
import java.util.List;
35
import java.util.Map;
36
 
37
import javax.servlet.ServletContext;
38
import javax.servlet.ServletOutputStream;
39
 
40
import org.apache.commons.io.FileUtils;
41
import org.apache.commons.lang.StringUtils;
42
import org.apache.struts2.convention.annotation.Result;
43
import org.apache.struts2.convention.annotation.Results;
44
import org.apache.thrift.TException;
45
import org.apache.thrift.transport.TTransportException;
46
import org.slf4j.Logger;
47
import org.slf4j.LoggerFactory;
48
 
49
@SuppressWarnings("serial")
50
@Results({ @Result(name = "redirect", type = "redirectAction", params = {
51
		"actionName", "warehouse" }) })
52
		public class BulkPurchaseController extends BaseController {
53
	private static Logger logger = LoggerFactory.getLogger(BulkPurchaseController.class);
54
	private List<String> exceptionList = new ArrayList<String>();
55
	private static final int NUM_BULK__SCAN_ITEMS = 10;
11801 manish.sha 56
	private static final long DUMMY_VENDOR_ID = 40;
11349 manish.sha 57
 
58
	private ServletContext context;
59
	private String id="";
60
	private Long transferLotId;
61
	private String itemId;
62
	private String itemNo;
63
	private String errorMsg = "";
64
	private String successMsg = "";
65
	private List<Item> items;
66
	private List<LineItem> lineItems;
67
	private String bulkScanUploadItem;
68
	private File scanDataFile;
69
 
70
	private String invoiceNumber;
71
	private Double freightCharges ;
11801 manish.sha 72
	private String purchaseComments;
11349 manish.sha 73
	private Long poId;
74
	private String fileNameVal;
75
 
76
	private String purchaseId;
77
	private String purchaseOrderId;
78
	private Long warehouseId;
79
	private Long transferWarehouseId;
80
	private Warehouse warehouse;
11801 manish.sha 81
	private Warehouse thirdPartyWarehouse;
11349 manish.sha 82
 
83
	private Map<Long, Double> unfulfilledMap = new HashMap<Long, Double>(); 
84
 
85
 
86
	public String show() {
87
		resetLineItems();
88
		setItemsFromPO();
89
		return SHOW;
90
	}
91
 
92
	private void resetLineItems() {
93
		lineItems = new ArrayList<LineItem>();
94
 
95
		for (int i = 0; i < NUM_BULK__SCAN_ITEMS; i++) {
96
			LineItem lineItem = new LineItem();
97
			lineItem.setId(i);
98
			lineItem.setExtra_info("");
99
			lineItem.setSerial_number("");
100
			lineItem.setItem_number("");
101
			lineItem.setQuantity(1);
102
			lineItem.setItem_id(-1);
103
			lineItems.add(lineItem);
104
		}
105
	}
106
 
107
	public String create() {
108
		this.purchaseOrderId = request.getParameter("poId");
109
		poId = Long.parseLong(purchaseOrderId);
110
		invoiceNumber = request.getParameter("invoiceNumber");
111
		String fc = request.getParameter("freightCharges").trim();
112
		freightCharges = 0D;
113
		if(id == null ||StringUtils.isEmpty(id))
114
			id = "0";
115
		if (fc != null && !fc.isEmpty())
116
			freightCharges = Double.parseDouble(fc);
117
		return show();
118
		//return "create";
119
 
120
	}
121
 
122
	public boolean createPurchase(){
123
		try {
11801 manish.sha 124
			logger.info("poId="+poId+" invoiceNumber="+invoiceNumber+" freightCharges="+freightCharges+ " purchaseComments="+purchaseComments);
11349 manish.sha 125
			PurchaseClient purchaseClient = new PurchaseClient();
126
			in.shop2020.purchase.PurchaseService.Client client = purchaseClient
127
			.getClient();
11801 manish.sha 128
			id = "" + client.startPurchase(poId, invoiceNumber, freightCharges, purchaseComments);
11349 manish.sha 129
			logger.info("id = "+id);
130
		} catch (TTransportException e) {
131
			errorMsg = errorMsg + "<br> Error while establishing connection to the warehouse server";
132
			exceptionList.add("Error while establishing connection to the warehouse server");
133
			logger.error(errorMsg, e);
134
		} catch (TException e) {
135
			errorMsg = errorMsg+ "<br> Error while scanning in the item";
136
			exceptionList.add("Error while strating purchase");
137
			logger.error(errorMsg, e);
138
		} catch (PurchaseServiceException e) {
139
			errorMsg = errorMsg+ e.getMessage();
140
			exceptionList.add(e.getMessage());
141
			logger.error(errorMsg, e);
142
		}
143
 
144
		if (errorMsg.isEmpty())
145
			return true;
146
		else {
147
			addActionError(errorMsg);
148
			return false;
149
		}
150
	}
151
 
152
	public File getScanFileToRead(){
153
		File fileToCreate = null;
154
 
155
		if(scanDataFile!=null & fileNameVal !=null && !fileNameVal.isEmpty()){
156
 
157
			logger.info("File Name "+scanDataFile.getName());
158
			System.out.println("File Name "+scanDataFile.getName());
159
 
160
			logger.info("File Name Value "+fileNameVal);
161
			System.out.println("File Name Value "+fileNameVal);
162
			String fileName = fileNameVal;
163
			try {
164
				if(!fileName.substring(fileName.lastIndexOf(".")+1).equalsIgnoreCase("txt")){
165
					throw new Exception("File is not in expected TXT Format");
166
				}
167
				fileToCreate = new File("/tmp/", fileName);
168
 
169
				FileUtils.copyFile(this.scanDataFile, fileToCreate);
170
			} catch (Exception e) {
171
				logger.error("Error while writing file used to the local file system", e);
172
				errorMsg = e.getMessage();
173
				//addActionError(errorMsg);
174
				return null;
175
			}
176
		} else {
177
			errorMsg = errorMsg + "<br>Either No File Uploaded or file name is blank";
178
		}
179
		return fileToCreate;
180
	}
181
 
182
	public boolean transferLotCreate(PurchaseOrder po){
183
		String errMsg  = "";
184
		try{
185
			if(transferLotId==null || transferLotId==0) {
186
				if(transferWarehouseId!=null && transferWarehouseId!=0) {
187
					WarehouseClient warehouseClient = new WarehouseClient();
188
					Client client = warehouseClient.getClient();
189
					InventoryService.Client inventoryClient = new InventoryClient().getClient();
190
					Warehouse fulfilmentWarehouse = inventoryClient.getWarehouses(WarehouseType.OURS, InventoryType.GOOD, po.getSupplierId(), po.getWarehouseId(), 0L).get(0);
191
					transferLotId = client.createTransferLot(po.getWarehouseId(), transferWarehouseId);
192
				}
193
			}
194
		} catch(Exception e){
195
			errMsg = "<br> Error while creating Transfer Lot due to : "+ e.getMessage();
196
		}
197
		if (errMsg.isEmpty()){
198
			return true;
199
		}
200
		else {
201
			errorMsg = errMsg;
202
			addActionError(errorMsg);
203
			return false;
204
		}
205
	}
206
 
207
	public File createErrorFile(List<String> errorList){
208
		try{
209
			String tmpDir = System.getProperty("java.io.tmpdir");
210
			File file = new File(tmpDir + "/ScanRecordResult.xls");
211
			BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(
212
					file));
213
			bufferedWriter.write(StringUtils.join(new String[] { "----Scan Response----"}, '\t'));
214
			//bufferedWriter.newLine();
215
			for(String record : errorList){
216
				bufferedWriter.newLine();
217
				bufferedWriter.write(StringUtils.join(new String[] { record }, '\t'));
218
			}
219
			bufferedWriter.close();
220
			return file;
221
		} catch (Exception e) {
222
			logger.error("Could not create file for Scan Record Result", e);
223
			return null;
224
		}
225
	}
226
 
227
	public void setResponseErrorFile(File errorFile) throws IOException{
228
		byte[] buffer = null;
229
		buffer = new byte[(int) errorFile.length()];
230
		InputStream input = null;
231
		try {
232
			int totalBytesRead = 0;
233
			input = new BufferedInputStream(new FileInputStream(errorFile));
234
			while (totalBytesRead < buffer.length) {
235
				int bytesRemaining = buffer.length - totalBytesRead;
236
				// input.read() returns -1, 0, or more :
237
					int bytesRead = input.read(buffer, totalBytesRead,
238
							bytesRemaining);
239
					if (bytesRead > 0) {
240
						totalBytesRead = totalBytesRead + bytesRead;
241
					}
242
			}
243
			/*
244
			 * the above style is a bit tricky: it places bytes into the
245
			 * 'buffer' array; 'buffer' is an output parameter; the while
246
			 * loop usually has a single iteration only.
247
			 */
248
		} finally {
249
			input.close();
250
		}
251
 
252
		response.setContentType("application/vnd.ms-excel");
253
		response.setHeader("Content-disposition", "inline; filename="
254
				+ errorFile.getName());
255
 
256
		ServletOutputStream sos = response.getOutputStream();
257
		sos.write(buffer);
258
		sos.flush();
259
	}
260
 
261
	public boolean checkForException() throws IOException{
262
		if(exceptionList!=null && exceptionList.size()>0){
263
			File errorFile = createErrorFile(exceptionList);
264
			if(errorFile.isFile()){
265
				setResponseErrorFile(errorFile);
266
				return false;
267
			}
268
		}
269
		return true;
270
	}
271
 
272
	private void areValidSerializedItems() throws Exception {
273
		Client warehouseClient = new WarehouseClient().getClient();
274
		for (LineItem lineItem : lineItems) {
275
			if (StringUtils.isNotBlank(lineItem.getSerial_number())) {
276
				InventoryItem inventoryItem = new InventoryItem();
277
				try{
278
					inventoryItem = warehouseClient.getInventoryItem(lineItem.getSerial_number());
279
				} catch(Exception e){
280
					continue;
281
				}
282
				if(inventoryItem.getLastScanType()!=ScanType.PURCHASE_RETURN && inventoryItem.getLastScanType()!=ScanType.DOA_REPLACED) {
283
					lineItem.setExtra_info("Item scanned already.");
284
					exceptionList.add("Items Scanned already : "+ lineItem.getSerial_number());
285
					continue;
286
				}    			
287
			}
288
		}
289
	}
290
 
291
	private void setItemsFromPO() {
292
		try {
293
			items = new ArrayList<Item>();
294
			in.shop2020.purchase.PurchaseService.Client purchaseClient = new PurchaseClient().getClient();
295
			//PurchaseOrder purchaseOrder = purchaseClient.getPurchaseOrderForPurchase(id);
296
			PurchaseOrder purchaseOrder = purchaseClient.getPurchaseOrder(poId);
297
			warehouseId = purchaseOrder.getWarehouseId();
298
			in.shop2020.model.v1.catalog.CatalogService.Client catalogClient = new CatalogClient().getClient();
299
 
300
			for (in.shop2020.purchase.LineItem lineItem : purchaseOrder.getLineitems()) {
301
				items.add(catalogClient.getItem(lineItem.getItemId()));
302
				unfulfilledMap.put(lineItem.getItemId(), lineItem.getUnfulfilledQuantity());
303
			}
304
 
305
			in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = new InventoryClient().getClient();
11801 manish.sha 306
            thirdPartyWarehouse = inventoryClient.getWarehouse(warehouseId);
307
            if(thirdPartyWarehouse.getVendor().getId()==DUMMY_VENDOR_ID && thirdPartyWarehouse.getInventoryType()==InventoryType.GOOD && thirdPartyWarehouse.getWarehouseType()==WarehouseType.OURS_THIRDPARTY){
308
            	warehouse = thirdPartyWarehouse;
309
            } else {
310
            	warehouse = inventoryClient.getWarehouses(WarehouseType.OURS, InventoryType.GOOD, purchaseOrder.getSupplierId(), warehouseId, warehouseId).get(0);
311
            }
11349 manish.sha 312
		} catch (Exception e) {
313
			logger.error("Could not find items in PO with purchase: " + id, e);
314
		}
315
	}
316
 
317
	public String update() {
318
		if(("-1").equalsIgnoreCase(bulkScanUploadItem)){
319
			errorMsg = errorMsg +" <br> No Item Selected to Scan In";
320
			return show();
321
		}
322
 
323
		File fileToCreate = getScanFileToRead();
324
		Map<Long, String> correctRowsMap = new HashMap<Long, String>();
325
		Map<Long, String> errorRowsMap = new HashMap<Long, String>();		
326
 
327
		if(fileToCreate==null){
328
			errorMsg = errorMsg +" <br> No File to read";
329
			return create();
330
		}
331
 
332
		ItemType itemType = ItemType.SERIALIZED;
333
		setItemsFromPO();
334
		lineItems = new ArrayList<LineItem>();
335
 
336
		if(fileToCreate.isFile()){
337
			try{
338
				in.shop2020.model.v1.catalog.CatalogService.Client catalogClient = new CatalogClient().getClient();
339
				Item item = catalogClient.getItem(Long.parseLong(bulkScanUploadItem));
340
 
341
				itemType = item.getType();
342
 
343
				in.shop2020.purchase.PurchaseService.Client purchaseClient = new PurchaseClient().getClient();
344
				PurchaseOrder po = purchaseClient.getPurchaseOrder(poId);
345
				List<in.shop2020.purchase.LineItem> poLineItems = po.getLineitems();
346
				in.shop2020.purchase.LineItem poLineItem = new in.shop2020.purchase.LineItem();
347
 
348
				for(in.shop2020.purchase.LineItem pItem : poLineItems){
349
					if(pItem.getItemId() == item.getId()){
350
						poLineItem = pItem;
351
						break;
352
					}
353
				}
354
 
355
				if(!transferLotCreate(po)){
356
					return create();
357
				}
358
 
359
				BufferedReader br = new BufferedReader(new FileReader(fileToCreate));
360
				long line = 1;
361
				String strLine;
362
				String[] values;
363
				while((strLine = br.readLine())!=null){
364
					if(line==1){
365
						values = strLine.split("\t");						
366
						if(values.length !=3){
367
							errorMsg = errorMsg + "<br> File contains Inappropriate Content ";
368
							addActionError(errorMsg);
369
							return create();
370
						}
371
						line++;
372
						continue;
373
					}
374
					values = strLine.split("\t");
375
					for(String s : values){
376
						logger.info("Row No "+line+" :"+s);
377
						System.out.println("Row No "+line+" :"+s);
378
					}
379
					LineItem lineItem = new LineItem();
380
					lineItem.setId(line);
381
					lineItem.setItem_id(item.getId());
382
					lineItem.setBrand(item.getBrand());
383
					lineItem.setColor(item.getColor());
384
					lineItem.setModel_name(item.getModelName());
385
					lineItem.setModel_number(item.getModelNumber());
386
					lineItem.setProductGroup(item.getProductGroup());
387
					lineItem.setNlc(poLineItem.getNlc());
388
					lineItem.setTransfer_price(poLineItem.getUnitPrice());
389
					lineItem.setUnit_price(poLineItem.getUnitPrice());
390
					if(itemType==ItemType.SERIALIZED){
391
						if(StringUtils.isNotBlank(values[0]) && StringUtils.isNotEmpty(values[0])){
392
							if(StringUtils.isNotBlank(values[1]) && StringUtils.isNotEmpty(values[1])){
393
								lineItem.setItem_number(values[0].trim());
394
								lineItem.setSerial_number(values[1].trim());
395
								lineItem.setQuantity(1);
396
								correctRowsMap.put(line, "Entries are correct in the row");
397
							}
398
							else{
399
								errorRowsMap.put(line, "Error: Serial Number Missing ");
400
								line++;
401
								continue;
402
							}
403
						}
404
						else{
405
							errorRowsMap.put(line, "Error: Item Number Missing ");
406
							line++;
407
							continue;
408
						}
409
					}
410
 
411
					if(itemType==ItemType.NON_SERIALIZED){
412
						if(StringUtils.isNotBlank(values[0]) && StringUtils.isNotEmpty(values[0])){
413
							lineItem.setItem_number(values[0].trim());
414
							lineItem.setSerial_number("");
415
							if(StringUtils.isNotBlank(values[2]) && StringUtils.isNumeric(values[2]) && Double.parseDouble(values[2]) > 0){
416
								lineItem.setQuantity(Double.parseDouble(values[2].trim()));
417
								correctRowsMap.put(line, "Entries are correct in the row ");
418
							}
419
							else{
420
								errorRowsMap.put(line, "Error: Invalid Item Quantity ");
421
								line++;
422
								continue;
423
							}
424
						} else{
425
							errorRowsMap.put(line, "Error: Item Number Missing ");
426
							line++;
427
							continue;
428
						}
429
 
430
					}
431
 
432
					if(correctRowsMap.containsKey(line) && !errorRowsMap.containsKey(line)){
433
						lineItems.add(lineItem);
434
					}
435
 
436
					line++;
437
				}
438
				if(correctRowsMap!=null && correctRowsMap.size()>0){
439
					if(errorRowsMap!=null && errorRowsMap.size()>0){
440
						for(Long row : errorRowsMap.keySet()){
441
							exceptionList.add("At Row "+ row +" "+ errorRowsMap.get(row));
442
						}
443
					}
444
				}
445
				else{
446
					exceptionList.add("-- File Contains Zero Correct Records --");
447
					if(errorRowsMap!=null && errorRowsMap.size()>0){
448
						exceptionList.add("-- Data in uploaded sheet is Inappropriate --");
449
					}
450
				}
451
 
452
				if(itemType==ItemType.SERIALIZED){
453
					areValidSerializedItems();
454
				}
455
 
456
				if(id == null || Long.parseLong(id)==0) {
457
					if(!createPurchase()) {
458
						if(!checkForException()){
459
							return create();
460
						}
461
					}
462
				}		
463
 
464
				WarehouseClient warehouseClient = new WarehouseClient();
465
				Client client = warehouseClient.getClient();
16490 manish.sha 466
				InventoryService.Client inventoryClient = new InventoryClient().getClient();
11801 manish.sha 467
				boolean checkDirectScanWarehouse = false;
468
 
469
	            if(thirdPartyWarehouse.getVendor().getId()==DUMMY_VENDOR_ID && thirdPartyWarehouse.getInventoryType()==InventoryType.GOOD && thirdPartyWarehouse.getWarehouseType()==WarehouseType.OURS_THIRDPARTY){
470
	            	checkDirectScanWarehouse = true;
471
	            }
16490 manish.sha 472
 
473
	            long currentWarehouseId = 0;
474
	            if(!checkDirectScanWarehouse){
475
	            	Warehouse fulfilmentWarehouse = inventoryClient.getWarehouses(WarehouseType.OURS, InventoryType.GOOD, po.getSupplierId(), po.getWarehouseId(), 0).get(0);
476
	            	currentWarehouseId = fulfilmentWarehouse.getId();
477
	            }
11801 manish.sha 478
 
11349 manish.sha 479
				for (LineItem lineItem : lineItems) {
480
 
481
					InventoryItem inventoryItem = new InventoryItem();
482
					inventoryItem.setItemId(lineItem.getItem_id());
483
					inventoryItem.setPurchaseId(Long.parseLong(id));
484
					inventoryItem.setCurrentQuantity(0);
485
					inventoryItem.setItemNumber(lineItem.getItem_number());
486
					inventoryItem.setSerialNumber(lineItem.getSerial_number());
487
					inventoryItem.setInitialQuantity(new Double(lineItem.getQuantity()).longValue());
11801 manish.sha 488
	                if(checkDirectScanWarehouse){
489
	                	inventoryItem.setPhysicalWarehouseId(po.getWarehouseId());
490
	                	inventoryItem.setCurrentWarehouseId(po.getWarehouseId());
491
	                }else{
492
	                	inventoryItem.setPhysicalWarehouseId(po.getWarehouseId());
16490 manish.sha 493
	                	inventoryItem.setCurrentWarehouseId(currentWarehouseId);
11801 manish.sha 494
	                }
11349 manish.sha 495
					if(!client.isAlive()){
496
						client = warehouseClient.getClient();
497
					}
498
					try{
13089 manish.sha 499
						if(itemType==ItemType.SERIALIZED){
500
							if(lineItem.getExtra_info()!=null && "Item scanned already.".equalsIgnoreCase(lineItem.getExtra_info())){
501
								continue;
502
							}
503
						}
11349 manish.sha 504
						client.scan(inventoryItem, ScanType.PURCHASE, new Double(lineItem.getQuantity()).longValue(), warehouseId, (transferLotId!=null)?transferLotId:0L);
505
						if(lineItem.getSerial_number()!=null && !lineItem.getSerial_number().isEmpty()){
506
							exceptionList.add("Item with Serial Number "+ lineItem.getSerial_number() + " Scanned Successfully");
507
						}
508
						else{
509
							exceptionList.add("Item with Item Number "+ lineItem.getItem_number() + " with "+ lineItem.getQuantity() + " units Scanned Successfully");
510
						}
511
					}
512
					catch(Exception e){
513
						exceptionList.add("Error "+lineItem.getId()+" "+e.getMessage());
514
						continue;
515
					}
516
				}
517
 
518
				if(lineItems!= null && lineItems.size()!=exceptionList.size()){
519
					if(!checkForException()){
520
						return null;
521
					} 
522
				}else{
523
					successMsg = "Items scanned Successfully.<br>Check the unfulfilled Quantity for further details";
524
				}
525
 
526
			} catch(Exception e){
527
				errorMsg = errorMsg + " <br> Error while scanning items";
528
				logger.error(errorMsg, e);
529
			}
530
		}
531
		return create();
532
	}
533
 
534
	public String destroy() {
535
		long id = Long.parseLong(this.id);
536
 
537
		try {
538
			PurchaseClient warehouseClient = new PurchaseClient();
539
			in.shop2020.purchase.PurchaseService.Client client = warehouseClient
540
			.getClient();
541
			client.closePurchase(id);
542
		} catch (TTransportException e) {
543
			errorMsg = errorMsg + "<br> Error while establishing connection to the warehouse server";
544
			logger.error(errorMsg, e);
545
		} catch (TException e) {
546
			errorMsg = errorMsg + "<br> Error while scanning in the item";
547
			logger.error(errorMsg, e);
548
		} catch (PurchaseServiceException e) {
549
			errorMsg = errorMsg + e.getMessage();
550
			logger.error(errorMsg, e);
551
		}
552
		return "redirect";
553
	}
554
 
555
	public List<Warehouse> getAllowedDestinationWarehousesForTransfer(long originWarehouseId){
556
		try {
557
			WarehouseService.Client warehouseClient = new WarehouseClient().getClient();
558
			List<Long> allowedWarehouseIds = warehouseClient.getAllowedDestinationWarehousesForTransfer(originWarehouseId);
559
			List<Warehouse> allowedWarehouses = new ArrayList<Warehouse>();
560
			InventoryService.Client inventoryClient = new InventoryClient().getClient();
561
			for(Long allowedWarehouseId : allowedWarehouseIds) {
562
				allowedWarehouses.add(inventoryClient.getWarehouse(allowedWarehouseId));
563
			}
564
			return allowedWarehouses;
565
		} catch(Exception e) {
566
			logger.error("Error while getting all destination warehouses for warehouseId " + warehouseId, e);
567
			return new ArrayList<Warehouse>();
568
		}
569
	}
570
 
571
	public boolean isItemScannedIn(long id){
572
		if(unfulfilledMap.get(id)> 0){
573
			return true;
574
		}
575
		return false;
576
	}
577
 
578
	public String getName(Item item){
579
		return ModelUtils.extractProductNameFromItem(item);
580
	}
581
 
582
	public void setId(String id) {
583
		this.id = id;
584
	}
585
 
586
	public String getId() {
587
		return id;
588
	}
589
 
590
	public String getErrorMessage() {
591
		return errorMsg;
592
	}
593
 
594
	public String getPurchaseOrderId() {
595
		return purchaseOrderId;
596
	}
597
 
598
	public String getServletContextPath() {
599
		return context.getContextPath();
600
	}
601
 
602
	public String getItemId() {
603
		return itemId;
604
	}
605
 
606
	public void setItemId(String itemId) {
607
		this.itemId = itemId;
608
	}
609
 
610
	public String getItemNo() {
611
		return itemNo;
612
	}
613
 
614
	public void setItemNo(String itemNo) {
615
		this.itemNo = itemNo;
616
	}
617
 
618
	public List<Item> getItems() {
619
		return items;
620
	}
621
 
622
	public void setItems(List<Item> items) {
623
		this.items = items;
624
	}
625
 
626
	public List<LineItem> getLineItems() {
627
		return lineItems;
628
	}
629
 
630
	public void setLineItems(List<LineItem> lineItems) {
631
		this.lineItems = lineItems;
632
	}
633
 
634
	public Warehouse getWarehouse() {
635
		return warehouse;
636
	}
637
 
638
	public String getInvoiceNumber() {
639
		return invoiceNumber;
640
	}
641
 
642
	public void setInvoiceNumber(String invoiceNumber) {
643
		this.invoiceNumber = invoiceNumber;
644
	}
645
 
646
	public Double getFreightCharges() {
647
		return freightCharges;
648
	}
649
 
650
	public void setFreightCharges(Double freightCharges) {
651
		this.freightCharges = freightCharges;
652
	}
653
 
654
	public Long getPoId() {
655
		return poId;
656
	}
657
 
658
	public void setPoId(Long poId) {
659
		this.poId = poId;
660
	}
661
 
662
	public Long getWarehouseId() {
663
		return warehouseId;
664
	}
665
 
666
	public void setWarehouseId(Long warehouseId) {
667
		this.warehouseId = warehouseId;
668
	}
669
 
670
	public Long getTransferWarehouseId() {
671
		return transferWarehouseId;
672
	}
673
 
674
	public void setTransferWarehouseId(Long transferWarehouseId) {
675
		this.transferWarehouseId = transferWarehouseId;
676
	}
677
 
678
	public Long getTransferLotId() {
679
		return transferLotId;
680
	}
681
 
682
	public void setTransferLotId(Long transferLotId) {
683
		this.transferLotId = transferLotId;
684
	}
685
 
686
	public String getBulkScanUploadItem() {
687
		return bulkScanUploadItem;
688
	}
689
 
690
	public void setBulkScanUploadItem(String bulkScanUploadItem) {
691
		this.bulkScanUploadItem = bulkScanUploadItem;
692
	}
693
 
694
	public File getScanDataFile() {
695
		return scanDataFile;
696
	}
697
 
698
	public void setScanDataFile(File scanDataFile) {
699
		this.scanDataFile = scanDataFile;
700
	}
701
 
702
	public String getPurchaseId() {
703
		return purchaseId;
704
	}
705
 
706
	public void setPurchaseId(String purchaseId) {
707
		this.purchaseId = purchaseId;
708
	}
709
 
710
	public String getFileNameVal() {
711
		return fileNameVal;
712
	}
713
 
714
	public void setFileNameVal(String fileNameVal) {
715
		this.fileNameVal = fileNameVal;
716
	}
717
 
718
	public String getSuccessMsg() {
719
		return successMsg;
720
	}
721
 
722
	public void setSuccessMsg(String successMsg) {
723
		this.successMsg = successMsg;
724
	}
725
 
11801 manish.sha 726
	public String getPurchaseComments() {
727
		return purchaseComments;
728
	}
729
 
730
	public void setPurchaseComments(String purchaseComments) {
731
		this.purchaseComments = purchaseComments;
732
	}
733
 
734
	public Warehouse getThirdPartyWarehouse() {
735
		return thirdPartyWarehouse;
736
	}
737
 
738
	public void setThirdPartyWarehouse(Warehouse thirdPartyWarehouse) {
739
		this.thirdPartyWarehouse = thirdPartyWarehouse;
740
	}
11349 manish.sha 741
}