Subversion Repositories SmartDukaan

Rev

Rev 4408 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4408 Rev 4497
Line 4... Line 4...
4
 
4
 
5
package in.shop2020.support.controllers;
5
package in.shop2020.support.controllers;
6
 
6
 
7
import in.shop2020.model.v1.catalog.InventoryServiceException;
7
import in.shop2020.model.v1.catalog.InventoryServiceException;
8
import in.shop2020.model.v1.catalog.Vendor;
8
import in.shop2020.model.v1.catalog.Vendor;
-
 
9
import in.shop2020.purchase.PurchaseOrder;
-
 
10
import in.shop2020.purchase.PurchaseService.Client;
-
 
11
import in.shop2020.purchase.PurchaseServiceException;
-
 
12
import in.shop2020.purchase.Supplier;
9
import in.shop2020.support.utils.ReportsUtils;
13
import in.shop2020.support.utils.ReportsUtils;
10
import in.shop2020.thrift.clients.CatalogClient;
14
import in.shop2020.thrift.clients.CatalogClient;
11
import in.shop2020.thrift.clients.WarehouseClient;
15
import in.shop2020.thrift.clients.PurchaseClient;
12
import in.shop2020.warehouse.Supplier;
-
 
13
import in.shop2020.warehouse.WarehouseServiceException;
-
 
14
 
16
 
15
import java.io.BufferedInputStream;
17
import java.io.BufferedInputStream;
16
import java.io.File;
18
import java.io.File;
17
import java.io.FileInputStream;
19
import java.io.FileInputStream;
18
import java.io.FileNotFoundException;
20
import java.io.FileNotFoundException;
Line 138... Line 140...
138
             * 
140
             * 
139
             */
141
             */
140
            if(output.contains("POId:")) {
142
            if(output.contains("POId:")) {
141
                String [] arr = output.split(":");
143
                String [] arr = output.split(":");
142
                purchaseOrderId = Long.parseLong(arr[1]);
144
                purchaseOrderId = Long.parseLong(arr[1]);
143
                WarehouseClient warehouseServiceClient = new WarehouseClient();
145
                PurchaseClient warehouseServiceClient = new PurchaseClient();
144
                in.shop2020.warehouse.WarehouseService.Client client = warehouseServiceClient.getClient();
146
                Client client = warehouseServiceClient.getClient();
145
                in.shop2020.warehouse.PurchaseOrder purchaseOrder = client.getPurchaseOrder(purchaseOrderId);
147
                PurchaseOrder purchaseOrder = client.getPurchaseOrder(purchaseOrderId);
146
                Supplier supplier = client.getSupplier(purchaseOrder.getSupplierId());
148
                Supplier supplier = client.getSupplier(purchaseOrder.getSupplierId());
147
                String pdfFilename = in.shop2020.support.services.PdfPoSheetGenerator.generatePdfSheet(purchaseOrder, supplier);
149
                String pdfFilename = in.shop2020.support.services.PdfPoSheetGenerator.generatePdfSheet(purchaseOrder, supplier);
148
                
150
                
149
                /*
151
                /*
150
                 * Put pdf file in a buffer to send it in response 
152
                 * Put pdf file in a buffer to send it in response 
Line 204... Line 206...
204
            
206
            
205
        } catch (TException e) {
207
        } catch (TException e) {
206
            e.printStackTrace();
208
            e.printStackTrace();
207
            setResult(e.getMessage());
209
            setResult(e.getMessage());
208
            
210
            
209
        } catch (WarehouseServiceException e) {
-
 
210
            e.printStackTrace();
-
 
211
            setResult(e.getMessage());
-
 
212
            
-
 
213
        } catch (InventoryServiceException e) {
211
        } catch (InventoryServiceException e) {
214
            setResult(e.getMessage());
212
            setResult(e.getMessage());
215
            
213
            
216
        } catch(IOException e) {
214
        } catch(IOException e) {
217
            log.error("Error occured");
215
            log.error("Error occured");
218
            setResult(e.getMessage());
216
            setResult(e.getMessage());
-
 
217
        } catch (PurchaseServiceException e) {
-
 
218
            setResult(e.getMessage());
219
        }
219
        }
220
        return "result";
220
        return "result";
221
    }
221
    }
222
 
222
 
223
    public File getPurchaseOrderDetails() {
223
    public File getPurchaseOrderDetails() {