Subversion Repositories SmartDukaan

Rev

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

Rev 19034 Rev 19050
Line 12... Line 12...
12
import in.shop2020.model.v1.inventory.Warehouse;
12
import in.shop2020.model.v1.inventory.Warehouse;
13
import in.shop2020.model.v1.order.LineItem;
13
import in.shop2020.model.v1.order.LineItem;
14
import in.shop2020.model.v1.order.OrderSource;
14
import in.shop2020.model.v1.order.OrderSource;
15
import in.shop2020.model.v1.order.OrderStatus;
15
import in.shop2020.model.v1.order.OrderStatus;
16
import in.shop2020.model.v1.order.TransactionService.Client;
16
import in.shop2020.model.v1.order.TransactionService.Client;
-
 
17
import in.shop2020.hotspot.dashbaord.server.EhcacheWrapper;
17
import in.shop2020.thrift.clients.CatalogClient;
18
import in.shop2020.thrift.clients.CatalogClient;
18
import in.shop2020.thrift.clients.InventoryClient;
19
import in.shop2020.thrift.clients.InventoryClient;
19
import in.shop2020.thrift.clients.TransactionClient;
20
import in.shop2020.thrift.clients.TransactionClient;
20
import in.shop2020.thrift.clients.LogisticsClient;
21
import in.shop2020.thrift.clients.LogisticsClient;
21
 
22
 
Line 34... Line 35...
34
import java.util.HashMap;
35
import java.util.HashMap;
35
import java.util.List;
36
import java.util.List;
36
import java.util.Map;
37
import java.util.Map;
37
import java.util.Map.Entry;
38
import java.util.Map.Entry;
38
 
39
 
-
 
40
import net.sf.ehcache.CacheManager;
-
 
41
 
39
import org.slf4j.Logger;
42
import org.slf4j.Logger;
40
import org.slf4j.LoggerFactory;
43
import org.slf4j.LoggerFactory;
41
 
44
 
42
import com.google.gwt.i18n.client.DateTimeFormat;
45
import com.google.gwt.i18n.client.DateTimeFormat;
43
 
46
 
Line 49... Line 52...
49
 * 
52
 * 
50
 */
53
 */
51
public class TransactionUtils {
54
public class TransactionUtils {
52
	private static String courierDetailsPath = "/CourierDetailReports";
55
	private static String courierDetailsPath = "/CourierDetailReports";
53
	private static Logger logger = LoggerFactory.getLogger(TransactionUtils.class);
56
	private static Logger logger = LoggerFactory.getLogger(TransactionUtils.class);
54
	public static List<Long> virtualInvnetoryWarehouses;
-
 
55
 
-
 
56
	static{
-
 
57
		virtualInvnetoryWarehouses = new ArrayList<Long>();
-
 
58
		try{
-
 
59
			in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = new InventoryClient().getClient();
-
 
60
			List<Warehouse> allWarehouses = inventoryClient.getWarehouses(null, null, 0, 0, 0);
-
 
61
			for(Warehouse wh:allWarehouses){
-
 
62
				if(wh.getWarehouseType()==WarehouseType.THIRD_PARTY){
-
 
63
					virtualInvnetoryWarehouses.add(wh.getId());
-
 
64
				}
-
 
65
			}
-
 
66
		}catch(Exception e){
-
 
67
			e.printStackTrace();
-
 
68
		}
-
 
69
 
-
 
70
	}
-
 
71
	
57
	
72
	/**
58
	/**
73
	 * The human user is concerned only with a consolidated view of actionable
59
	 * The human user is concerned only with a consolidated view of actionable
74
	 * orders. Orders with different statuses in the database can be part of the
60
	 * orders. Orders with different statuses in the database can be part of the
75
	 * same consolidated view. This method uses a mapping of <i>type</i> to
61
	 * same consolidated view. This method uses a mapping of <i>type</i> to
Line 494... Line 480...
494
		long currentTime = date.getTime();
480
		long currentTime = date.getTime();
495
		currentDateTime = sdf.parse(sdf.format(date)).getTime();
481
		currentDateTime = sdf.parse(sdf.format(date)).getTime();
496
		expectedDateShippingTime = sdf.parse(sdf.format(new Date(order.getExpectedShippingTime()))).getTime();
482
		expectedDateShippingTime = sdf.parse(sdf.format(new Date(order.getExpectedShippingTime()))).getTime();
497
		if(expectedDateShippingTime >0 && order.getStatus() < 9){
483
		if(expectedDateShippingTime >0 && order.getStatus() < 9){
498
			if(expectedDateShippingTime <= currentDateTime){
484
			if(expectedDateShippingTime <= currentDateTime){
499
				if( virtualInvnetoryWarehouses.contains(order.getFulfilmentWarehouseId())){
485
				if(loadVirtualWarehouseDetails().contains(order.getFulfilmentWarehouseId())){
500
					order.setAlert(OrderAlert.TODAY_SHIPPING_NOT_IN_STOCK);
486
					order.setAlert(OrderAlert.TODAY_SHIPPING_NOT_IN_STOCK);
501
				}else{
487
				}else{
502
					order.setAlert(OrderAlert.TODAY_SHIPPING_IN_STOCK);
488
					order.setAlert(OrderAlert.TODAY_SHIPPING_IN_STOCK);
503
				}
489
				}
504
			}else{
490
			}else{
Line 760... Line 746...
760
                && !item.getColor().trim().equals("NA"))
746
                && !item.getColor().trim().equals("NA"))
761
            itemName.append("(" + item.getColor() + ")");
747
            itemName.append("(" + item.getColor() + ")");
762
 
748
 
763
        return itemName.toString();
749
        return itemName.toString();
764
	}
750
	}
-
 
751
	
-
 
752
	public static List<Long> loadVirtualWarehouseDetails(){
-
 
753
		EhcacheWrapper<String, List<Long>> virtualWhCache = new EhcacheWrapper<String, List<Long>>(
-
 
754
				"VirtualWarehouses", CacheManager.create());
-
 
755
		
-
 
756
		List<Long> virtualWarehouseIds = virtualWhCache.get("virtual_warehouses");
-
 
757
		
-
 
758
		if(virtualWarehouseIds!=null && virtualWarehouseIds.size()>0){
-
 
759
			return virtualWarehouseIds;
-
 
760
		}else{
-
 
761
			virtualWarehouseIds = new ArrayList<Long>();
-
 
762
			try{
-
 
763
				in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = new InventoryClient().getClient();
-
 
764
				List<Warehouse> allWarehouses = inventoryClient.getWarehouses(null, null, 0, 0, 0);
-
 
765
				for(Warehouse wh:allWarehouses){
-
 
766
					if(wh.getWarehouseType()==WarehouseType.THIRD_PARTY){
-
 
767
						virtualWarehouseIds.add(wh.getId());
-
 
768
					}
-
 
769
				}
-
 
770
			}catch(Exception e){
-
 
771
				e.printStackTrace();
-
 
772
			}
-
 
773
			virtualWhCache.put("virtual_warehouses", virtualWarehouseIds);
-
 
774
		}
-
 
775
		
-
 
776
		return virtualWarehouseIds;
-
 
777
	}
765
}
778
}