| Line 88... |
Line 88... |
| 88 |
|
88 |
|
| 89 |
@SuppressWarnings("serial")
|
89 |
@SuppressWarnings("serial")
|
| 90 |
public class InvoiceServlet extends HttpServlet {
|
90 |
public class InvoiceServlet extends HttpServlet {
|
| 91 |
|
91 |
|
| 92 |
private static Logger logger = LoggerFactory.getLogger(InvoiceServlet.class);
|
92 |
private static Logger logger = LoggerFactory.getLogger(InvoiceServlet.class);
|
| 93 |
private static long cutoffTime = 0;
|
93 |
public static long cutoffTime = 0;
|
| 94 |
|
94 |
|
| 95 |
static {
|
95 |
static {
|
| 96 |
try {
|
96 |
try {
|
| 97 |
String cutOffDate = ConfigClient.getClient().get("warehouse_company_cutoff_date");
|
97 |
String cutOffDate = ConfigClient.getClient().get("warehouse_company_cutoff_date");
|
| 98 |
DateFormat df = new SimpleDateFormat("yyyy-mm-dd");
|
98 |
DateFormat df = new SimpleDateFormat("yyyy-mm-dd");
|
| Line 199... |
Line 199... |
| 199 |
ByteArrayOutputStream baosPDF = null;
|
199 |
ByteArrayOutputStream baosPDF = null;
|
| 200 |
in.shop2020.model.v1.order.TransactionService.Client tclient = tsc.getClient();
|
200 |
in.shop2020.model.v1.order.TransactionService.Client tclient = tsc.getClient();
|
| 201 |
in.shop2020.model.v1.inventory.InventoryService.Client iclient = csc.getClient();
|
201 |
in.shop2020.model.v1.inventory.InventoryService.Client iclient = csc.getClient();
|
| 202 |
in.shop2020.logistics.LogisticsService.Client logisticsClient = lsc.getClient();
|
202 |
in.shop2020.logistics.LogisticsService.Client logisticsClient = lsc.getClient();
|
| 203 |
|
203 |
|
| - |
|
204 |
//Sort out all variables related to company date here
|
| - |
|
205 |
|
| 204 |
try {
|
206 |
try {
|
| 205 |
baosPDF = new ByteArrayOutputStream();
|
207 |
baosPDF = new ByteArrayOutputStream();
|
| 206 |
|
208 |
|
| 207 |
Document document = new Document();
|
209 |
Document document = new Document();
|
| 208 |
PdfWriter.getInstance(document, baosPDF);
|
210 |
PdfWriter.getInstance(document, baosPDF);
|
| Line 259... |
Line 261... |
| 259 |
String destCode = null;
|
261 |
String destCode = null;
|
| 260 |
Warehouse shippingLocation = null;
|
262 |
Warehouse shippingLocation = null;
|
| 261 |
int barcodeFontSize = 0;
|
263 |
int barcodeFontSize = 0;
|
| 262 |
String invoiceFormat = null;
|
264 |
String invoiceFormat = null;
|
| 263 |
try {
|
265 |
try {
|
| - |
|
266 |
if(singleOrder.getWarehouse_id() == 7 && InvoiceServlet.cutoffTime > singleOrder.getBilling_timestamp() ){
|
| - |
|
267 |
companyName = SORPL;
|
| - |
|
268 |
warehouse = iclient.getWarehouse(7151);
|
| - |
|
269 |
} else {
|
| 264 |
warehouse = iclient.getWarehouse(singleOrder.getWarehouse_id());
|
270 |
warehouse = iclient.getWarehouse(singleOrder.getWarehouse_id());
|
| - |
|
271 |
}
|
| 265 |
long providerId = singleOrder.getLogistics_provider_id();
|
272 |
long providerId = singleOrder.getLogistics_provider_id();
|
| 266 |
provider = logisticsClient.getProvider(providerId);
|
273 |
provider = logisticsClient.getProvider(providerId);
|
| 267 |
if(provider.getPickup().equals(PickUpType.SELF) || provider.getPickup().equals(PickUpType.RUNNER))
|
274 |
if(provider.getPickup().equals(PickUpType.SELF) || provider.getPickup().equals(PickUpType.RUNNER))
|
| 268 |
destCode = provider.getPickup().toString();
|
275 |
destCode = provider.getPickup().toString();
|
| 269 |
else
|
276 |
else
|
| 270 |
destCode = logisticsClient.getDestinationCode(providerId, singleOrder.getCustomer_pincode());
|
277 |
destCode = logisticsClient.getDestinationCode(providerId, singleOrder.getCustomer_pincode());
|
| 271 |
|
278 |
|
| 272 |
barcodeFontSize = Integer.parseInt(ConfigClient.getClient().get(provider.getName().toLowerCase() + "_barcode_fontsize"));
|
279 |
barcodeFontSize = Integer.parseInt(ConfigClient.getClient().get(provider.getName().toLowerCase() + "_barcode_fontsize"));
|
| - |
|
280 |
|
| 273 |
shippingLocation = CatalogUtils.getWarehouse(warehouse.getShippingWarehouseId());
|
281 |
shippingLocation = CatalogUtils.getWarehouse(warehouse.getShippingWarehouseId());
|
| 274 |
invoiceFormat = tclient.getInvoiceFormatLogisticsTxnId(singleOrder.getTransactionId(), Long.parseLong(logisticsTxnId.split("-")[1]));
|
282 |
invoiceFormat = tclient.getInvoiceFormatLogisticsTxnId(singleOrder.getTransactionId(), Long.parseLong(logisticsTxnId.split("-")[1]));
|
| 275 |
} catch (InventoryServiceException ise) {
|
283 |
} catch (InventoryServiceException ise) {
|
| 276 |
logger.error("Error while getting the warehouse information.", ise);
|
284 |
logger.error("Error while getting the warehouse information.", ise);
|
| 277 |
return baosPDF;
|
285 |
return baosPDF;
|