| Line 1... |
Line 1... |
| 1 |
package in.shop2020.support.controllers;
|
1 |
package in.shop2020.support.controllers;
|
| 2 |
|
2 |
|
| 3 |
import in.shop2020.thrift.clients.WarehouseClient;
|
- |
|
| 4 |
import in.shop2020.warehouse.POStatus;
|
3 |
import in.shop2020.purchase.POStatus;
|
| 5 |
import in.shop2020.warehouse.Purchase;
|
4 |
import in.shop2020.purchase.Purchase;
|
| 6 |
import in.shop2020.warehouse.PurchaseOrder;
|
5 |
import in.shop2020.purchase.PurchaseOrder;
|
| 7 |
import in.shop2020.warehouse.WarehouseService.Client;
|
6 |
import in.shop2020.purchase.PurchaseServiceException;
|
| 8 |
import in.shop2020.warehouse.WarehouseServiceException;
|
7 |
import in.shop2020.thrift.clients.PurchaseClient;
|
| 9 |
|
8 |
|
| 10 |
import java.util.List;
|
9 |
import java.util.List;
|
| 11 |
|
10 |
|
| 12 |
import javax.servlet.ServletContext;
|
11 |
import javax.servlet.ServletContext;
|
| 13 |
|
12 |
|
| Line 30... |
Line 29... |
| 30 |
private List<Purchase> purchases;
|
29 |
private List<Purchase> purchases;
|
| 31 |
|
30 |
|
| 32 |
public String index(){
|
31 |
public String index(){
|
| 33 |
//Get a list of all the open purchase orders
|
32 |
//Get a list of all the open purchase orders
|
| 34 |
try {
|
33 |
try {
|
| 35 |
WarehouseClient warehouseClient = new WarehouseClient();
|
34 |
PurchaseClient purchaseClient = new PurchaseClient();
|
| 36 |
Client client = warehouseClient.getClient();
|
35 |
in.shop2020.purchase.PurchaseService.Client client = purchaseClient.getClient();
|
| 37 |
purchaseOrders = client.getAllPurchaseOrders(POStatus.READY);
|
36 |
purchaseOrders = client.getAllPurchaseOrders(POStatus.READY);
|
| 38 |
purchaseOrders.addAll(client.getAllPurchaseOrders(POStatus.PARTIALLY_FULFILLED));
|
37 |
purchaseOrders.addAll(client.getAllPurchaseOrders(POStatus.PARTIALLY_FULFILLED));
|
| 39 |
} catch (TTransportException e) {
|
38 |
} catch (TTransportException e) {
|
| 40 |
logger.error("Unable to get the list of all purchase orders.", e);
|
39 |
logger.error("Unable to get the list of all purchase orders.", e);
|
| 41 |
} catch (WarehouseServiceException e) {
|
- |
|
| 42 |
logger.error("Error while getting the list of all purchase orders.", e);
|
- |
|
| 43 |
} catch (TException e) {
|
40 |
} catch (TException e) {
|
| 44 |
logger.error("Error while communicating to the warehouse server.", e);
|
41 |
logger.error("Error while communicating to the warehouse server.", e);
|
| - |
|
42 |
} catch (PurchaseServiceException e) {
|
| - |
|
43 |
logger.error("Error while getting the list of all purchase orders.", e);
|
| 45 |
}
|
44 |
}
|
| 46 |
|
45 |
|
| 47 |
return "index";
|
46 |
return "index";
|
| 48 |
}
|
47 |
}
|
| 49 |
|
48 |
|
| 50 |
public String show(){
|
49 |
public String show(){
|
| 51 |
//Get a list of all the open purchase orders
|
50 |
//Get a list of all the open purchase orders
|
| 52 |
try {
|
51 |
try {
|
| 53 |
WarehouseClient warehouseClient = new WarehouseClient();
|
52 |
PurchaseClient warehouseClient = new PurchaseClient();
|
| 54 |
Client client = warehouseClient.getClient();
|
53 |
in.shop2020.purchase.PurchaseService.Client client = warehouseClient.getClient();
|
| 55 |
purchaseOrder = client.getPurchaseOrder(Long.parseLong(id));
|
54 |
purchaseOrder = client.getPurchaseOrder(Long.parseLong(id));
|
| 56 |
purchases = client.getAllPurchases(purchaseOrder.getId(), true);
|
55 |
purchases = client.getAllPurchases(purchaseOrder.getId(), true);
|
| 57 |
} catch (TTransportException e) {
|
56 |
} catch (TTransportException e) {
|
| 58 |
logger.error("Unable to get the list of all purchases.", e);
|
57 |
logger.error("Unable to get the list of all purchases.", e);
|
| 59 |
} catch (WarehouseServiceException e) {
|
- |
|
| 60 |
logger.error("Error while getting the list of all purchases.", e);
|
- |
|
| 61 |
} catch (TException e) {
|
58 |
} catch (TException e) {
|
| 62 |
logger.error("Error while communicating to the warehouse server.", e);
|
59 |
logger.error("Error while communicating to the warehouse server.", e);
|
| - |
|
60 |
} catch (NumberFormatException e) {
|
| - |
|
61 |
// TODO Auto-generated catch block
|
| - |
|
62 |
e.printStackTrace();
|
| - |
|
63 |
} catch (PurchaseServiceException e) {
|
| - |
|
64 |
logger.error("Error while getting the list of all purchases.", e);
|
| 63 |
}
|
65 |
}
|
| 64 |
return "show";
|
66 |
return "show";
|
| 65 |
}
|
67 |
}
|
| 66 |
|
68 |
|
| 67 |
public void setId(String id){
|
69 |
public void setId(String id){
|