| Line 22... |
Line 22... |
| 22 |
import java.net.MalformedURLException;
|
22 |
import java.net.MalformedURLException;
|
| 23 |
import java.text.DateFormat;
|
23 |
import java.text.DateFormat;
|
| 24 |
import java.text.DecimalFormat;
|
24 |
import java.text.DecimalFormat;
|
| 25 |
import java.util.ArrayList;
|
25 |
import java.util.ArrayList;
|
| 26 |
import java.util.Date;
|
26 |
import java.util.Date;
|
| - |
|
27 |
import java.util.HashMap;
|
| 27 |
import java.util.List;
|
28 |
import java.util.List;
|
| - |
|
29 |
import java.util.Map;
|
| 28 |
|
30 |
|
| 29 |
import org.apache.thrift.TException;
|
31 |
import org.apache.thrift.TException;
|
| 30 |
import org.slf4j.Logger;
|
32 |
import org.slf4j.Logger;
|
| 31 |
import org.slf4j.LoggerFactory;
|
33 |
import org.slf4j.LoggerFactory;
|
| 32 |
|
34 |
|
| Line 120... |
Line 122... |
| 120 |
PdfPTable ordersTable = null;
|
122 |
PdfPTable ordersTable = null;
|
| 121 |
ordersTable = new PdfPTable(8);
|
123 |
ordersTable = new PdfPTable(8);
|
| 122 |
if (providerId > 7 && providerId <12) {
|
124 |
if (providerId > 7 && providerId <12) {
|
| 123 |
ordersTable = new PdfPTable(10);
|
125 |
ordersTable = new PdfPTable(10);
|
| 124 |
}
|
126 |
}
|
| 125 |
if(provider.isGroupShipmentAllowed()){
|
- |
|
| 126 |
ordersTable = new PdfPTable(9);
|
- |
|
| 127 |
}
|
127 |
|
| 128 |
ordersTable.addCell(new Phrase("Sl No", helvetica8));
|
128 |
ordersTable.addCell(new Phrase("Sl No", helvetica8));
|
| 129 |
if(provider.isGroupShipmentAllowed()){
|
- |
|
| 130 |
ordersTable.addCell(new Phrase("Master Order Id", helvetica8));
|
129 |
ordersTable.addCell(new Phrase("Master Order Id", helvetica8));
|
| 131 |
}
|
130 |
|
| 132 |
ordersTable.addCell(new Phrase("Order No", helvetica8));
|
- |
|
| 133 |
ordersTable.addCell(new Phrase("AWB No", helvetica8));
|
131 |
ordersTable.addCell(new Phrase("AWB No", helvetica8));
|
| 134 |
ordersTable.addCell(new Phrase("Packet Wt.", helvetica8));
|
132 |
ordersTable.addCell(new Phrase("Packet Wt.", helvetica8));
|
| 135 |
|
133 |
|
| 136 |
//if Logistics is Ebay Power Ship add extra fields like Sales Record Number and PaisaPayId
|
134 |
//if Logistics is Ebay Power Ship add extra fields like Sales Record Number and PaisaPayId
|
| 137 |
if(providerId > 7 && providerId <12) {
|
135 |
if(providerId > 7 && providerId <12) {
|
| Line 149... |
Line 147... |
| 149 |
ordersTable.addCell(new Phrase("Store Address", helvetica8));
|
147 |
ordersTable.addCell(new Phrase("Store Address", helvetica8));
|
| 150 |
ordersTable.addCell(new Phrase("Store City", helvetica8));
|
148 |
ordersTable.addCell(new Phrase("Store City", helvetica8));
|
| 151 |
ordersTable.addCell(new Phrase("Phone", helvetica8));
|
149 |
ordersTable.addCell(new Phrase("Phone", helvetica8));
|
| 152 |
}
|
150 |
}
|
| 153 |
|
151 |
|
| - |
|
152 |
Map<String, Double> totalWeightMap = new HashMap<String, Double>();
|
| - |
|
153 |
Map<String, String> airwayBillNoMap = new HashMap<String, String>();
|
| - |
|
154 |
Map<String, Order> orderDetailsMap = new HashMap<String, Order>();
|
| - |
|
155 |
|
| 154 |
int serialNo = 0;
|
156 |
List<Order> selectedOrders = new ArrayList<Order>();
|
| - |
|
157 |
|
| 155 |
for(int i=0; i < orders.size();i++){
|
158 |
for(int i=0; i < orders.size();i++){
|
| 156 |
Order order = orders.get(i);
|
159 |
Order order = orders.get(i);
|
| 157 |
if(!orderIds.contains(order.getId()))
|
160 |
if(!orderIds.contains(order.getId()))
|
| 158 |
continue;
|
161 |
continue;
|
| 159 |
if(order.getLogistics_provider_id()!=providerId)
|
162 |
if(order.getLogistics_provider_id()!=providerId)
|
| 160 |
continue;
|
163 |
continue;
|
| 161 |
if(order.isLogisticsCod() != isCod)
|
164 |
if(order.isLogisticsCod() != isCod)
|
| 162 |
continue;
|
165 |
continue;
|
| - |
|
166 |
selectedOrders.add(order);
|
| - |
|
167 |
}
|
| - |
|
168 |
|
| - |
|
169 |
for(Order order: selectedOrders){
|
| - |
|
170 |
if(orderDetailsMap.containsKey(order.getLogisticsTransactionId())){
|
| - |
|
171 |
continue;
|
| - |
|
172 |
} else {
|
| - |
|
173 |
orderDetailsMap.put(order.getLogisticsTransactionId(), order);
|
| - |
|
174 |
}
|
| - |
|
175 |
}
|
| - |
|
176 |
|
| - |
|
177 |
for(Order order: selectedOrders){
|
| - |
|
178 |
if(totalWeightMap.containsKey(order.getLogisticsTransactionId())){
|
| - |
|
179 |
double totalWeight = totalWeightMap.get(order.getLogisticsTransactionId())+ order.getTotal_weight();
|
| - |
|
180 |
totalWeightMap.put(order.getLogisticsTransactionId(), totalWeight);
|
| - |
|
181 |
}else{
|
| - |
|
182 |
double totalWeight = order.getTotal_weight();
|
| - |
|
183 |
totalWeightMap.put(order.getLogisticsTransactionId(), totalWeight);
|
| - |
|
184 |
}
|
| - |
|
185 |
if(airwayBillNoMap.containsKey(order.getLogisticsTransactionId())){
|
| - |
|
186 |
continue;
|
| - |
|
187 |
}else{
|
| - |
|
188 |
airwayBillNoMap.put(order.getLogisticsTransactionId(), order.getAirwaybill_no());
|
| - |
|
189 |
}
|
| - |
|
190 |
}
|
| - |
|
191 |
|
| - |
|
192 |
int serialNo = 0;
|
| - |
|
193 |
|
| - |
|
194 |
for(String logisticsTxnId : airwayBillNoMap.keySet()){
|
| - |
|
195 |
Order singleOrder = orderDetailsMap.get(logisticsTxnId);
|
| - |
|
196 |
serialNo++;
|
| - |
|
197 |
ordersTable.addCell(new Phrase(serialNo + "", helvetica8));
|
| - |
|
198 |
ordersTable.addCell(new Phrase(logisticsTxnId, helvetica8));
|
| - |
|
199 |
ordersTable.addCell(new Phrase(airwayBillNoMap.get(logisticsTxnId), helvetica8));
|
| - |
|
200 |
ordersTable.addCell(new Phrase(weightFormat.format(totalWeightMap.get(logisticsTxnId)), helvetica8));
|
| - |
|
201 |
|
| - |
|
202 |
if(providerId > 7 && providerId <12) {
|
| - |
|
203 |
try {
|
| - |
|
204 |
EbayOrder ebayOrder = txnClient.getEbayOrderByOrderId(singleOrder.getId());
|
| - |
|
205 |
ordersTable.addCell(new Phrase(ebayOrder.getPaisaPayId(), helvetica8));
|
| - |
|
206 |
ordersTable.addCell(new Phrase(new Long(ebayOrder.getSalesRecordNumber()).toString(), helvetica8));
|
| - |
|
207 |
} catch (Exception e) {
|
| - |
|
208 |
logger.error("Error getting Ebay Order for OrderId : " + singleOrder.getId(), e);
|
| - |
|
209 |
return baosPDF;
|
| - |
|
210 |
}
|
| - |
|
211 |
}
|
| - |
|
212 |
if(runner == null){
|
| - |
|
213 |
ordersTable.addCell(new Phrase(singleOrder.getCustomer_name(), helvetica8));
|
| - |
|
214 |
ordersTable.addCell(new Phrase(singleOrder.getCustomer_city(), helvetica8));
|
| - |
|
215 |
ordersTable.addCell(new Phrase(singleOrder.getCustomer_pincode(), helvetica8));
|
| - |
|
216 |
ordersTable.addCell(new Phrase(singleOrder.getCustomer_state(), helvetica8));
|
| - |
|
217 |
}else{
|
| - |
|
218 |
PickupStore store = getStoreFromId(stores, singleOrder.getPickupStoreId());
|
| - |
|
219 |
ordersTable.addCell(new Phrase(store.getHotspotId(), helvetica8));
|
| - |
|
220 |
ordersTable.addCell(new Phrase(store.getLine1() + ((store.getLine2() == null)? "": "\n" + store.getLine2()), helvetica8));
|
| - |
|
221 |
ordersTable.addCell(new Phrase(store.getCity(), helvetica8));
|
| - |
|
222 |
ordersTable.addCell(new Phrase(store.getPhone(), helvetica8));
|
| - |
|
223 |
}
|
| - |
|
224 |
|
| - |
|
225 |
}
|
| - |
|
226 |
/*for(int i=0; i < orders.size();i++){
|
| - |
|
227 |
Order order = orders.get(i);
|
| - |
|
228 |
if(!orderIds.contains(order.getId()))
|
| - |
|
229 |
continue;
|
| - |
|
230 |
if(order.getLogistics_provider_id()!=providerId)
|
| - |
|
231 |
continue;
|
| - |
|
232 |
if(order.isLogisticsCod() != isCod)
|
| - |
|
233 |
continue;
|
| 163 |
//TODO: These are exactly the orders which will be shipped now. Shouldn't we change their status to be SHIPPED?
|
234 |
//TODO: These are exactly the orders which will be shipped now. Shouldn't we change their status to be SHIPPED?
|
| 164 |
serialNo++;
|
235 |
serialNo++;
|
| 165 |
List<LineItem> lineItems = order.getLineitems();
|
236 |
List<LineItem> lineItems = order.getLineitems();
|
| 166 |
double weight = 0;
|
237 |
double weight = 0;
|
| 167 |
for(LineItem lineItem: lineItems)
|
238 |
for(LineItem lineItem: lineItems)
|
| Line 197... |
Line 268... |
| 197 |
ordersTable.addCell(new Phrase(store.getHotspotId(), helvetica8));
|
268 |
ordersTable.addCell(new Phrase(store.getHotspotId(), helvetica8));
|
| 198 |
ordersTable.addCell(new Phrase(store.getLine1() + ((store.getLine2() == null)? "": "\n" + store.getLine2()), helvetica8));
|
269 |
ordersTable.addCell(new Phrase(store.getLine1() + ((store.getLine2() == null)? "": "\n" + store.getLine2()), helvetica8));
|
| 199 |
ordersTable.addCell(new Phrase(store.getCity(), helvetica8));
|
270 |
ordersTable.addCell(new Phrase(store.getCity(), helvetica8));
|
| 200 |
ordersTable.addCell(new Phrase(store.getPhone(), helvetica8));
|
271 |
ordersTable.addCell(new Phrase(store.getPhone(), helvetica8));
|
| 201 |
}
|
272 |
}
|
| 202 |
}
|
273 |
}*/
|
| 203 |
|
274 |
|
| 204 |
table.addCell(logoCell);
|
275 |
table.addCell(logoCell);
|
| 205 |
table.addCell(addressCell);
|
276 |
table.addCell(addressCell);
|
| 206 |
if(isCod)
|
277 |
if(isCod)
|
| 207 |
table.addCell(new Phrase("PAYMODE: COD", helvetica8));
|
278 |
table.addCell(new Phrase("PAYMODE: COD", helvetica8));
|