Subversion Repositories SmartDukaan

Rev

Rev 4878 | Rev 4914 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4878 Rev 4913
Line 32... Line 32...
32
import javax.servlet.http.HttpServletRequest;
32
import javax.servlet.http.HttpServletRequest;
33
import javax.servlet.http.HttpServletResponse;
33
import javax.servlet.http.HttpServletResponse;
34
import javax.servlet.http.HttpSession;
34
import javax.servlet.http.HttpSession;
35
 
35
 
36
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
36
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-
 
37
import org.apache.poi.ss.usermodel.Cell;
37
import org.apache.poi.ss.usermodel.Row;
38
import org.apache.poi.ss.usermodel.Row;
38
import org.apache.poi.ss.usermodel.Sheet;
39
import org.apache.poi.ss.usermodel.Sheet;
39
import org.apache.poi.ss.usermodel.Workbook;
40
import org.apache.poi.ss.usermodel.Workbook;
40
import org.apache.struts2.convention.annotation.InterceptorRef;
41
import org.apache.struts2.convention.annotation.InterceptorRef;
41
import org.apache.struts2.convention.annotation.InterceptorRefs;
42
import org.apache.struts2.convention.annotation.InterceptorRefs;
Line 67... Line 68...
67
    private static final long REPORT_GENERATION_INTERVAL = 1;
68
    private static final long REPORT_GENERATION_INTERVAL = 1;
68
    private static final long CUT_OFF_TIME = 15;
69
    private static final long CUT_OFF_TIME = 15;
69
    private static long NEXT_DAY_DELAY = 1;
70
    private static long NEXT_DAY_DELAY = 1;
70
 
71
 
71
    private static final int ID = 0, BRAND = 1, MODEL_NUMBER = 2, MODEL_NAME = 3, COLOR = 4, DELIVERY_DAYS = 5, TOTAL_AVAILABILITY = 6, TOTAL_RESERVED = 7;
72
    private static final int ID = 0, BRAND = 1, MODEL_NUMBER = 2, MODEL_NAME = 3, COLOR = 4, DELIVERY_DAYS = 5, TOTAL_AVAILABILITY = 6, TOTAL_RESERVED = 7;
72
	private static final int WH1_AVAILABILITY = 8, WH1_RESERVED = 9, WH5_AVALABILITY = 10, WH5_RESERVED = 11, WH7_AVALABILITY = 12, WH7_RESERVED = 13;
73
	private static final int WH1_AVAILABILITY = 8, WH1_RESERVED = 9, WH5_AVALABILITY = 10, WH5_RESERVED = 11, WH7_AVALABILITY = 12, WH7_RESERVED = 13, SIMILAR_ITEMS = 14;
73
		
74
		
74
    private HttpSession session;
75
    private HttpSession session;
75
    private HttpServletRequest request;
76
    private HttpServletRequest request;
76
    private HttpServletResponse response;
77
    private HttpServletResponse response;
77
    private ServletContext context;
78
    private ServletContext context;
Line 194... Line 195...
194
                	if(state == status.ACTIVE){
195
                	if(state == status.ACTIVE){
195
                    	if(deliveryDays == NEXT_DAY_DELAY)
196
                    	if(deliveryDays == NEXT_DAY_DELAY)
196
                    		sheetsMap.get(nextDay).add(rowItem);
197
                    		sheetsMap.get(nextDay).add(rowItem);
197
                        else
198
                        else
198
                        	sheetsMap.get(notNextDay).add(rowItem);    
199
                        	sheetsMap.get(notNextDay).add(rowItem);    
199
                    }else
200
                    }else{
200
                    	sheetsMap.get(notAvailable).add(rowItem);
201
                    	sheetsMap.get(notAvailable).add(rowItem);
-
 
202
                    	List<Item> similaritems= client.getAllSimilarItems(item.getId());
-
 
203
                    	if(similaritems!=null){
-
 
204
                    		boolean isFirst = true;
-
 
205
                    		for(Item item1: similaritems){
-
 
206
                    			if(!isFirst) rowItem.similarItems += "\n";
-
 
207
                    			rowItem.similarItems = rowItem.similarItems + item1.getBrand() + " " + item1.getModelName() + " " + item1.getModelNumber() + " " + item1.getColor();
-
 
208
                    		}
-
 
209
                    	}
-
 
210
                    }
201
                }
211
                }
202
            }
212
            }
203
        } catch (TTransportException e) {
213
        } catch (TTransportException e) {
204
            logger.error("Unable to get the items from the inventory", e);
214
            logger.error("Unable to get the items from the inventory", e);
205
            return null;
215
            return null;
Line 263... Line 273...
263
        headerRow.createCell(WH1_RESERVED).setCellValue("901 Reserved");
273
        headerRow.createCell(WH1_RESERVED).setCellValue("901 Reserved");
264
        headerRow.createCell(WH5_AVALABILITY).setCellValue("9D2 Availabality");
274
        headerRow.createCell(WH5_AVALABILITY).setCellValue("9D2 Availabality");
265
        headerRow.createCell(WH5_RESERVED).setCellValue("9D2 Reserved");
275
        headerRow.createCell(WH5_RESERVED).setCellValue("9D2 Reserved");
266
        headerRow.createCell(WH7_AVALABILITY).setCellValue("MP Availabality");
276
        headerRow.createCell(WH7_AVALABILITY).setCellValue("MP Availabality");
267
        headerRow.createCell(WH7_RESERVED).setCellValue("MP Reserved");
277
        headerRow.createCell(WH7_RESERVED).setCellValue("MP Reserved");
-
 
278
        headerRow.createCell(SIMILAR_ITEMS).setCellType(Cell.CELL_TYPE_STRING);
-
 
279
        headerRow.getCell(SIMILAR_ITEMS).setCellValue("Similar Items");
268
 
280
        
269
        //        headerRow.createCell(WH2_A).setCellValue("WH2 Availabality");
281
        //        headerRow.createCell(WH2_A).setCellValue("WH2 Availabality");
270
        //        headerRow.createCell(WH3_A).setCellValue("WH3 Availabality");
282
        //        headerRow.createCell(WH3_A).setCellValue("WH3 Availabality");
271
        //        headerRow.createCell(WH4_A).setCellValue("WH4 Availabality");     
283
        //        headerRow.createCell(WH4_A).setCellValue("WH4 Availabality");     
272
        //        headerRow.createCell(WH2_R).setCellValue("WH2 Reserved");
284
        //        headerRow.createCell(WH2_R).setCellValue("WH2 Reserved");
273
        //        headerRow.createCell(WH3_R).setCellValue("WH3 Reserved");
285
        //        headerRow.createCell(WH3_R).setCellValue("WH3 Reserved");
Line 287... Line 299...
287
            contentRow.createCell(WH1_RESERVED).setCellValue(item.wh1Reserved);
299
            contentRow.createCell(WH1_RESERVED).setCellValue(item.wh1Reserved);
288
            contentRow.createCell(WH5_AVALABILITY).setCellValue(item.wh5Availability);
300
            contentRow.createCell(WH5_AVALABILITY).setCellValue(item.wh5Availability);
289
            contentRow.createCell(WH5_RESERVED).setCellValue(item.wh5Reserved);
301
            contentRow.createCell(WH5_RESERVED).setCellValue(item.wh5Reserved);
290
            contentRow.createCell(WH7_AVALABILITY).setCellValue(item.wh7Availability);
302
            contentRow.createCell(WH7_AVALABILITY).setCellValue(item.wh7Availability);
291
            contentRow.createCell(WH7_RESERVED).setCellValue(item.wh7Reserved);
303
            contentRow.createCell(WH7_RESERVED).setCellValue(item.wh7Reserved);
-
 
304
            contentRow.createCell(SIMILAR_ITEMS).setCellValue(item.similarItems);
292
        }
305
        }
-
 
306
        sheet.autoSizeColumn(SIMILAR_ITEMS);
-
 
307
 
293
    }
308
    }
294
    
309
    
295
    public String getErrorMsg() {
310
    public String getErrorMsg() {
296
        return errorMsg;
311
        return errorMsg;
297
    }
312
    }
Line 345... Line 360...
345
        public long wh1Reserved = 0;
360
        public long wh1Reserved = 0;
346
        public long wh5Availability = 0;
361
        public long wh5Availability = 0;
347
        public long wh5Reserved = 0;
362
        public long wh5Reserved = 0;
348
        public long wh7Availability = 0;
363
        public long wh7Availability = 0;
349
        public long wh7Reserved = 0;
364
        public long wh7Reserved = 0;
-
 
365
        public String similarItems = "";
350
        
366
        
351
        public RowItem(Item item, long estimate){
367
        public RowItem(Item item, long estimate){
352
           id = item.getId();
368
           id = item.getId();
353
           brand = item.getBrand();
369
           brand = item.getBrand();
354
           modelNumber = item.getModelNumber();
370
           modelNumber = item.getModelNumber();