Subversion Repositories SmartDukaan

Rev

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

Rev 19052 Rev 19054
Line 25... Line 25...
25
import java.io.FileNotFoundException;
25
import java.io.FileNotFoundException;
26
import java.io.FileOutputStream;
26
import java.io.FileOutputStream;
27
import java.io.IOException;
27
import java.io.IOException;
28
import java.text.DecimalFormat;
28
import java.text.DecimalFormat;
29
import java.text.NumberFormat;
29
import java.text.NumberFormat;
-
 
30
import java.text.SimpleDateFormat;
30
import java.util.ArrayList;
31
import java.util.ArrayList;
31
import java.util.Calendar;
32
import java.util.Calendar;
32
import java.util.Collections;
33
import java.util.Collections;
33
import java.util.Date;
34
import java.util.Date;
34
import java.util.GregorianCalendar;
35
import java.util.GregorianCalendar;
Line 40... Line 41...
40
import net.sf.ehcache.CacheManager;
41
import net.sf.ehcache.CacheManager;
41
 
42
 
42
import org.slf4j.Logger;
43
import org.slf4j.Logger;
43
import org.slf4j.LoggerFactory;
44
import org.slf4j.LoggerFactory;
44
 
45
 
45
import com.google.gwt.i18n.client.DateTimeFormat;
-
 
46
 
-
 
47
/**
46
/**
48
 * This class is a facade to the Transaction service and should be used to
47
 * This class is a facade to the Transaction service and should be used to
49
 * access all order specific data which requires some kind of transformation.
48
 * access all order specific data which requires some kind of transformation.
50
 * 
49
 * 
51
 * @author Chandranshu
50
 * @author Chandranshu
Line 278... Line 277...
278
					inventoryClient = new InventoryClient().getClient();
277
					inventoryClient = new InventoryClient().getClient();
279
				}
278
				}
280
				Warehouse fulfillmentWarehouse = inventoryClient.getWarehouse(t_order.getFulfilmentWarehouseId());
279
				Warehouse fulfillmentWarehouse = inventoryClient.getWarehouse(t_order.getFulfilmentWarehouseId());
281
				warehouseType = fulfillmentWarehouse.getWarehouseType().toString();
280
				warehouseType = fulfillmentWarehouse.getWarehouseType().toString();
282
				orderValuesMap.put("WarehouseType", fulfillmentWarehouse.getWarehouseType().toString());
281
				orderValuesMap.put("WarehouseType", fulfillmentWarehouse.getWarehouseType().toString());
283
				DateTimeFormat sdf = DateTimeFormat.getFormat("EEE MMM dd HH:mm:ss yyyy");
282
				SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy");
284
				orderValuesMap.put("Promised_Shipping", sdf.format(new Date(t_order.getPromised_shipping_time())));
283
				orderValuesMap.put("Promised_Shipping", sdf.format(new Date(t_order.getPromised_shipping_time())));
285
				NumberFormat formatter = new DecimalFormat("#0.000");     
284
				NumberFormat formatter = new DecimalFormat("#0.000");     
286
				orderValuesMap.put("Weight", formatter.format(t_order.getLineitems().get(0).getUnit_weight()));
285
				orderValuesMap.put("Weight", formatter.format(t_order.getLineitems().get(0).getUnit_weight()));
287
				formatter = new DecimalFormat("#0.00");   
286
				formatter = new DecimalFormat("#0.00");   
288
				orderValuesMap.put("UnitPrice", formatter.format(t_order.getLineitems().get(0).getUnit_price()));
287
				orderValuesMap.put("UnitPrice", formatter.format(t_order.getLineitems().get(0).getUnit_price()));
Line 471... Line 470...
471
			order.setBillTogetherOrdersMap(billTogetherOrdersMap);
470
			order.setBillTogetherOrdersMap(billTogetherOrdersMap);
472
		}
471
		}
473
		if(t_order.isSetLogisticsTransactionId()){
472
		if(t_order.isSetLogisticsTransactionId()){
474
			order.setLogisticsTransactionId(t_order.getLogisticsTransactionId());
473
			order.setLogisticsTransactionId(t_order.getLogisticsTransactionId());
475
		}
474
		}
476
		DateTimeFormat sdf = DateTimeFormat.getFormat("yyyy-MM-dd");
475
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
477
		Date date = new Date(System.currentTimeMillis());
476
		Date date = new Date(System.currentTimeMillis());
478
		long currentDateTime = 0;
477
		long currentDateTime = 0;
479
		long expectedDateShippingTime =0 ;
478
		long expectedDateShippingTime =0 ;
480
		long currentTime = date.getTime();
479
		long currentTime = date.getTime();
-
 
480
		try{
481
		currentDateTime = sdf.parse(sdf.format(date)).getTime();
481
			currentDateTime = sdf.parse(sdf.format(date)).getTime();
482
		expectedDateShippingTime = sdf.parse(sdf.format(new Date(order.getExpectedShippingTime()))).getTime();
482
			expectedDateShippingTime = sdf.parse(sdf.format(new Date(order.getExpectedShippingTime()))).getTime();
-
 
483
		}catch(Exception e){
-
 
484
			e.printStackTrace();
-
 
485
		}
483
		if(expectedDateShippingTime >0 && order.getStatus() < 9){
486
		if(expectedDateShippingTime >0 && order.getStatus() < 9){
484
			if(expectedDateShippingTime <= currentDateTime){
487
			if(expectedDateShippingTime <= currentDateTime){
485
				if(loadVirtualWarehouseDetails().contains(order.getFulfilmentWarehouseId())){
488
				if(loadVirtualWarehouseDetails().contains(order.getFulfilmentWarehouseId())){
486
					order.setAlert(OrderAlert.TODAY_SHIPPING_NOT_IN_STOCK);
489
					order.setAlert(OrderAlert.TODAY_SHIPPING_NOT_IN_STOCK);
487
				}else{
490
				}else{