| Line 1... |
Line 1... |
| 1 |
package in.shop2020.hotspot.dashbaord.server;
|
1 |
package in.shop2020.hotspot.dashbaord.server;
|
| 2 |
|
2 |
|
| 3 |
import in.shop2020.hotspot.dashbaord.shared.actions.Order;
|
3 |
import in.shop2020.hotspot.dashbaord.shared.actions.Order;
|
| 4 |
import in.shop2020.hotspot.dashbaord.shared.actions.OrderType;
|
4 |
import in.shop2020.hotspot.dashbaord.shared.actions.OrderType;
|
| 5 |
import in.shop2020.hotspot.dashbaord.shared.actions.ReturnOrder;
|
5 |
import in.shop2020.hotspot.dashbaord.shared.actions.ReturnOrder;
|
| - |
|
6 |
import in.shop2020.model.v1.catalog.InventoryType;
|
| - |
|
7 |
import in.shop2020.model.v1.catalog.Item;
|
| - |
|
8 |
import in.shop2020.model.v1.catalog.ItemType;
|
| - |
|
9 |
import in.shop2020.model.v1.catalog.Warehouse;
|
| - |
|
10 |
import in.shop2020.model.v1.catalog.WarehouseType;
|
| 6 |
import in.shop2020.model.v1.order.LineItem;
|
11 |
import in.shop2020.model.v1.order.LineItem;
|
| 7 |
import in.shop2020.model.v1.order.OrderStatus;
|
12 |
import in.shop2020.model.v1.order.OrderStatus;
|
| 8 |
import in.shop2020.model.v1.order.TransactionService.Client;
|
13 |
import in.shop2020.model.v1.order.TransactionService.Client;
|
| - |
|
14 |
import in.shop2020.thrift.clients.CatalogClient;
|
| 9 |
import in.shop2020.thrift.clients.TransactionClient;
|
15 |
import in.shop2020.thrift.clients.TransactionClient;
|
| 10 |
|
16 |
|
| 11 |
import java.io.ByteArrayOutputStream;
|
17 |
import java.io.ByteArrayOutputStream;
|
| 12 |
import java.io.File;
|
18 |
import java.io.File;
|
| 13 |
import java.io.FileNotFoundException;
|
19 |
import java.io.FileNotFoundException;
|
| Line 197... |
Line 203... |
| 197 |
* A thrift order object with line items.
|
203 |
* A thrift order object with line items.
|
| 198 |
* @return an Order bean which can be used for rendering on the client side.
|
204 |
* @return an Order bean which can be used for rendering on the client side.
|
| 199 |
*/
|
205 |
*/
|
| 200 |
public static Order getOrderFromThriftOrder(in.shop2020.model.v1.order.Order t_order) {
|
206 |
public static Order getOrderFromThriftOrder(in.shop2020.model.v1.order.Order t_order) {
|
| 201 |
LineItem lineItem = t_order.getLineitems().get(0);
|
207 |
LineItem lineItem = t_order.getLineitems().get(0);
|
| - |
|
208 |
String pickFromWarehouse = null;
|
| - |
|
209 |
Item item = null;
|
| - |
|
210 |
|
| - |
|
211 |
try {
|
| - |
|
212 |
in.shop2020.model.v1.catalog.InventoryService.Client client = new CatalogClient().getClient();
|
| - |
|
213 |
item = client.getItem(lineItem.getItem_id());
|
| - |
|
214 |
pickFromWarehouse = CatalogUtils.getWarehousesForBillingWarehouse(t_order.getWarehouse_id())
|
| - |
|
215 |
.get(t_order.getFulfilmentWarehouseId());
|
| - |
|
216 |
|
| - |
|
217 |
if (pickFromWarehouse == null) {
|
| - |
|
218 |
Warehouse warehouse = client.getWarehouse(t_order.getFulfilmentWarehouseId());
|
| - |
|
219 |
pickFromWarehouse = client.getWarehouses(null, InventoryType.GOOD, warehouse.getVendor().getId(), t_order.getWarehouse_id(), 0).get(0).getDisplayName();
|
| - |
|
220 |
}
|
| 202 |
|
221 |
}
|
| - |
|
222 |
catch (Exception e) {
|
| - |
|
223 |
logger.error("Error looking up warehouse: " + t_order.getVendorId(), e);
|
| - |
|
224 |
}
|
| - |
|
225 |
|
| 203 |
String delayReason = null;
|
226 |
String delayReason = null;
|
| 204 |
if(t_order.getDelayReason() != null)
|
227 |
if(t_order.getDelayReason() != null)
|
| 205 |
delayReason = t_order.getDelayReason().name();
|
228 |
delayReason = t_order.getDelayReason().name();
|
| 206 |
|
229 |
|
| 207 |
Order order = new Order(t_order.getId(),
|
230 |
Order order = new Order(t_order.getId(),
|
| Line 242... |
Line 265... |
| 242 |
t_order.getBatchNo(),
|
265 |
t_order.getBatchNo(),
|
| 243 |
t_order.getSerialNo(),
|
266 |
t_order.getSerialNo(),
|
| 244 |
t_order.isDoaFlag(),
|
267 |
t_order.isDoaFlag(),
|
| 245 |
t_order.getPickupRequestNo(),
|
268 |
t_order.getPickupRequestNo(),
|
| 246 |
t_order.isCod(),
|
269 |
t_order.isCod(),
|
| 247 |
delayReason);
|
270 |
delayReason,
|
| - |
|
271 |
pickFromWarehouse,
|
| - |
|
272 |
ItemType.SERIALIZED.equals(item.getType()),
|
| - |
|
273 |
t_order.getFulfilmentWarehouseId());
|
| 248 |
return order;
|
274 |
return order;
|
| 249 |
}
|
275 |
}
|
| 250 |
|
276 |
|
| 251 |
/**
|
277 |
/**
|
| 252 |
* Queries the transction server to get the list of all return orders that
|
278 |
* Queries the transction server to get the list of all return orders that
|