| Line 28... |
Line 28... |
| 28 |
import com.itextpdf.text.pdf.PdfPCell;
|
28 |
import com.itextpdf.text.pdf.PdfPCell;
|
| 29 |
import com.itextpdf.text.pdf.PdfPTable;
|
29 |
import com.itextpdf.text.pdf.PdfPTable;
|
| 30 |
import com.itextpdf.text.pdf.PdfWriter;
|
30 |
import com.itextpdf.text.pdf.PdfWriter;
|
| 31 |
|
31 |
|
| 32 |
import in.shop2020.logistics.LogisticsServiceException;
|
32 |
import in.shop2020.logistics.LogisticsServiceException;
|
| - |
|
33 |
import in.shop2020.logistics.PickUpType;
|
| 33 |
import in.shop2020.logistics.PickupStore;
|
34 |
import in.shop2020.logistics.PickupStore;
|
| 34 |
import in.shop2020.logistics.Provider;
|
35 |
import in.shop2020.logistics.Provider;
|
| 35 |
import in.shop2020.model.v1.catalog.InventoryServiceException;
|
36 |
import in.shop2020.model.v1.catalog.InventoryServiceException;
|
| 36 |
import in.shop2020.model.v1.catalog.Warehouse;
|
37 |
import in.shop2020.model.v1.catalog.Warehouse;
|
| 37 |
import in.shop2020.model.v1.order.LineItem;
|
38 |
import in.shop2020.model.v1.order.LineItem;
|
| Line 58... |
Line 59... |
| 58 |
} catch (Exception e) {
|
59 |
} catch (Exception e) {
|
| 59 |
logger.error("Error while initializing one of the thrift clients", e);
|
60 |
logger.error("Error while initializing one of the thrift clients", e);
|
| 60 |
}
|
61 |
}
|
| 61 |
}
|
62 |
}
|
| 62 |
|
63 |
|
| 63 |
public ByteArrayOutputStream generateManifestFile(long warehouseId, long providerId, boolean isCod, List<Long> orderIds) {
|
64 |
public ByteArrayOutputStream generateManifestFile(long warehouseId, long providerId, boolean isCod, List<Long> orderIds, String runner) {
|
| 64 |
ByteArrayOutputStream baosPDF = null;
|
65 |
ByteArrayOutputStream baosPDF = null;
|
| 65 |
in.shop2020.model.v1.order.TransactionService.Client txnClient = tsc.getClient();
|
66 |
in.shop2020.model.v1.order.TransactionService.Client txnClient = tsc.getClient();
|
| 66 |
in.shop2020.model.v1.catalog.InventoryService.Client inventoryClient = csc.getClient();
|
67 |
in.shop2020.model.v1.catalog.InventoryService.Client inventoryClient = csc.getClient();
|
| 67 |
in.shop2020.logistics.LogisticsService.Client logisticsClient = lsc.getClient();
|
68 |
in.shop2020.logistics.LogisticsService.Client logisticsClient = lsc.getClient();
|
| 68 |
|
69 |
|
| Line 153... |
Line 154... |
| 153 |
table.addCell(addressCell);
|
154 |
table.addCell(addressCell);
|
| 154 |
if(isCod)
|
155 |
if(isCod)
|
| 155 |
table.addCell(new Phrase("PAYMODE: COD", helvetica8));
|
156 |
table.addCell(new Phrase("PAYMODE: COD", helvetica8));
|
| 156 |
else
|
157 |
else
|
| 157 |
table.addCell(new Phrase("PAYMODE: Prepaid", helvetica8));
|
158 |
table.addCell(new Phrase("PAYMODE: Prepaid", helvetica8));
|
| - |
|
159 |
if(provider.getPickup() == PickUpType.RUNNER){
|
| - |
|
160 |
table.addCell(new Phrase("Runner Name: " + runner, helvetica8));
|
| - |
|
161 |
}else{
|
| 158 |
table.addCell(new Phrase("Courier Name: " + provider.getName(), helvetica8));
|
162 |
table.addCell(new Phrase("Courier Name: " + provider.getName(), helvetica8));
|
| - |
|
163 |
}
|
| - |
|
164 |
|
| 159 |
table.addCell(new Phrase("Pick up Date: " + DateFormat.getDateInstance(DateFormat.MEDIUM).format(new Date()), helvetica8));
|
165 |
table.addCell(new Phrase("Pick up Date: " + DateFormat.getDateInstance(DateFormat.MEDIUM).format(new Date()), helvetica8));
|
| 160 |
table.addCell(ordersTable);
|
166 |
table.addCell(ordersTable);
|
| 161 |
table.setWidthPercentage(90.0f);
|
167 |
table.setWidthPercentage(90.0f);
|
| 162 |
|
168 |
|
| 163 |
document.add(table);
|
169 |
document.add(table);
|
| Line 268... |
Line 274... |
| 268 |
return baosPDF;
|
274 |
return baosPDF;
|
| 269 |
}
|
275 |
}
|
| 270 |
|
276 |
|
| 271 |
public static void main(String[] args) throws IOException {
|
277 |
public static void main(String[] args) throws IOException {
|
| 272 |
ManifestGenerator manifestGenerator = new ManifestGenerator();
|
278 |
ManifestGenerator manifestGenerator = new ManifestGenerator();
|
| 273 |
ByteArrayOutputStream baos = manifestGenerator.generateManifestFile(1, 1, true, null);
|
279 |
ByteArrayOutputStream baos = manifestGenerator.generateManifestFile(1, 1, true, null, null);
|
| 274 |
File f = new File("/home/ashish/Downloads/manifest-1-2.pdf");
|
280 |
File f = new File("/home/ashish/Downloads/manifest-1-2.pdf");
|
| 275 |
FileOutputStream fos = new FileOutputStream(f);
|
281 |
FileOutputStream fos = new FileOutputStream(f);
|
| 276 |
baos.writeTo(fos);
|
282 |
baos.writeTo(fos);
|
| 277 |
}
|
283 |
}
|
| 278 |
}
|
284 |
}
|