| Line 57... |
Line 57... |
| 57 |
* @param warehouseId
|
57 |
* @param warehouseId
|
| 58 |
* The warehouse for which the orders should be queried.
|
58 |
* The warehouse for which the orders should be queried.
|
| 59 |
* @return A list of orders of the given type to be fulfilled from the given
|
59 |
* @return A list of orders of the given type to be fulfilled from the given
|
| 60 |
* warehouse
|
60 |
* warehouse
|
| 61 |
*/
|
61 |
*/
|
| 62 |
public static List<Order> getOrders(OrderType type, long offset, long limit, long warehouseId){
|
62 |
public static List<Order> getOrders(OrderType type, long offset, long limit, long warehouseId, long source){
|
| 63 |
List<OrderStatus> statuses = getStatuses(type);
|
63 |
List<OrderStatus> statuses = getStatuses(type);
|
| 64 |
|
64 |
|
| 65 |
List<Order> orders = new ArrayList<Order>();
|
65 |
List<Order> orders = new ArrayList<Order>();
|
| 66 |
try{
|
66 |
try{
|
| 67 |
TransactionClient txnClient = new TransactionClient();
|
67 |
TransactionClient txnClient = new TransactionClient();
|
| 68 |
Client client = txnClient.getClient();
|
68 |
Client client = txnClient.getClient();
|
| 69 |
|
69 |
|
| 70 |
List<in.shop2020.model.v1.order.Order> t_orders = new ArrayList<in.shop2020.model.v1.order.Order>();
|
70 |
List<in.shop2020.model.v1.order.Order> t_orders = new ArrayList<in.shop2020.model.v1.order.Order>();
|
| 71 |
t_orders.addAll(client.getOrdersInBatch(statuses, offset, limit, warehouseId));
|
71 |
t_orders.addAll(client.getOrdersInBatch(statuses, offset, limit, warehouseId, source));
|
| 72 |
|
72 |
|
| 73 |
for (in.shop2020.model.v1.order.Order t_order: t_orders){
|
73 |
for (in.shop2020.model.v1.order.Order t_order: t_orders){
|
| 74 |
Order o = getOrderFromThriftOrder(t_order);
|
74 |
Order o = getOrderFromThriftOrder(t_order);
|
| 75 |
orders.add(o);
|
75 |
orders.add(o);
|
| 76 |
}
|
76 |
}
|
| Line 90... |
Line 90... |
| 90 |
* @param warehouseId
|
90 |
* @param warehouseId
|
| 91 |
* The warehouse for which the orders should be queried.
|
91 |
* The warehouse for which the orders should be queried.
|
| 92 |
* @return The count of orders of the given type assigned to the given
|
92 |
* @return The count of orders of the given type assigned to the given
|
| 93 |
* warehouse.
|
93 |
* warehouse.
|
| 94 |
*/
|
94 |
*/
|
| 95 |
public static int getOrderCount(OrderType type, long warehouseId){
|
95 |
public static int getOrderCount(OrderType type, long warehouseId, long source){
|
| 96 |
List<OrderStatus> statuses = getStatuses(type);
|
96 |
List<OrderStatus> statuses = getStatuses(type);
|
| 97 |
|
97 |
|
| 98 |
int count = 0;
|
98 |
int count = 0;
|
| 99 |
try{
|
99 |
try{
|
| 100 |
TransactionClient txnClient = new TransactionClient();
|
100 |
TransactionClient txnClient = new TransactionClient();
|
| 101 |
Client client = txnClient.getClient();
|
101 |
Client client = txnClient.getClient();
|
| 102 |
count += client.getOrderCount(statuses, warehouseId);
|
102 |
count += client.getOrderCount(statuses, warehouseId, source);
|
| 103 |
}catch(Exception e){
|
103 |
}catch(Exception e){
|
| 104 |
e.printStackTrace();
|
104 |
e.printStackTrace();
|
| 105 |
}
|
105 |
}
|
| 106 |
return count;
|
106 |
return count;
|
| 107 |
}
|
107 |
}
|
| Line 128... |
Line 128... |
| 128 |
TransactionClient client = new TransactionClient();
|
128 |
TransactionClient client = new TransactionClient();
|
| 129 |
Client c = client.getClient();
|
129 |
Client c = client.getClient();
|
| 130 |
|
130 |
|
| 131 |
List<OrderStatus> statuses = new ArrayList<OrderStatus>();
|
131 |
List<OrderStatus> statuses = new ArrayList<OrderStatus>();
|
| 132 |
statuses.add(OrderStatus.BILLED);
|
132 |
statuses.add(OrderStatus.BILLED);
|
| 133 |
List<in.shop2020.model.v1.order.Order> torders = c.getOrdersInBatch(statuses, 0, 0, warehouseId);
|
133 |
List<in.shop2020.model.v1.order.Order> torders = c.getOrdersInBatch(statuses, 0, 0, warehouseId, 0);
|
| 134 |
for(in.shop2020.model.v1.order.Order torder: torders){
|
134 |
for(in.shop2020.model.v1.order.Order torder: torders){
|
| 135 |
if(torder.getLogistics_provider_id() == provider_id && torder.isLogisticsCod() == cod){
|
135 |
if(torder.getLogistics_provider_id() == provider_id && torder.isLogisticsCod() == cod){
|
| 136 |
orders.put(torder.getId(), torder.getPickupStoreId());
|
136 |
orders.put(torder.getId(), torder.getPickupStoreId());
|
| 137 |
}
|
137 |
}
|
| 138 |
}
|
138 |
}
|