Subversion Repositories SmartDukaan

Rev

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

Rev 19022 Rev 19025
Line 1... Line 1...
1
package in.shop2020.hotspot.dashbaord.shared.actions;
1
package in.shop2020.hotspot.dashbaord.shared.actions;
2
 
2
 
3
import in.shop2020.hotspot.dashbaord.shared.actions.WarehouseFinder;
-
 
4
 
3
 
5
import java.util.Date;
4
import java.util.Date;
6
import java.util.Map;
5
import java.util.Map;
7
 
6
 
8
import com.google.gwt.i18n.client.DateTimeFormat;
-
 
9
import com.google.gwt.user.client.rpc.IsSerializable;
7
import com.google.gwt.user.client.rpc.IsSerializable;
10
 
8
 
11
public class Order implements IsSerializable{
9
public class Order implements IsSerializable{
12
	
10
	
13
	private static final long serialVersionUID = 5804421607858217477L;
11
	private static final long serialVersionUID = 5804421607858217477L;
Line 160... Line 158...
160
	}
158
	}
161
 
159
 
162
	private void checkForAlerts(){
160
	private void checkForAlerts(){
163
	    this.alert = OrderAlert.NONE;
161
	    this.alert = OrderAlert.NONE;
164
	    Date date = new Date(System.currentTimeMillis());
162
	    Date date = new Date(System.currentTimeMillis());
165
	    DateTimeFormat sdf = DateTimeFormat.getFormat("yyyy-MM-dd");
-
 
166
	    long currentTime = date.getTime();
163
	    long currentTime = date.getTime();
167
	    long currentDateTime = 0;
-
 
168
	    long expectedDateShippingTime =0 ;
-
 
169
	    currentDateTime = sdf.parse(sdf.format(date)).getTime();
-
 
170
		expectedDateShippingTime = sdf.parse(sdf.format(new Date(this.expectedShippingTime))).getTime();
-
 
171
		
164
	  		
172
	    if(this.expectedDeliveryTime <= currentTime && this.status < 12){
165
	    if(this.expectedDeliveryTime <= currentTime && this.status < 12){
173
	        //Orders whose delivery dates have passed but which are not yet delivered
166
	        //Orders whose delivery dates have passed but which are not yet delivered
174
	        this.alert = OrderAlert.DELIVERY_TIME_EXCEEDED;
167
	        this.alert = OrderAlert.DELIVERY_TIME_EXCEEDED;
175
	        return;
168
	        return;
176
	    }
169
	    }
177
	    
170
	    
178
    	//Orders whose expected shipping dates have passed but which have not been shipped yet
171
    	//Orders whose expected shipping dates have passed but which have not been shipped yet
179
    	if(expectedDateShippingTime >0){
-
 
180
    		if(expectedDateShippingTime <= currentDateTime){
-
 
181
    			if( WarehouseFinder.virtualInvnetoryWarehouses.contains(this.fulfilmentWarehouseId)){
-
 
182
    				this.alert = OrderAlert.TODAY_SHIPPING_NOT_IN_STOCK;
-
 
183
    			}else{
-
 
184
    				this.alert = OrderAlert.TODAY_SHIPPING_IN_STOCK;
-
 
185
    			}
-
 
186
    			return;
-
 
187
    		}else{
-
 
188
    			if(this.expectedShippingTime <= currentTime && this.status < 9){
-
 
189
    				this.alert = OrderAlert.SHIPPING_TIME_EXCEEDED;
-
 
190
        			return;
-
 
191
    			}else{
-
 
192
	    			this.alert = OrderAlert.LATER_SHIPPING;
-
 
193
	    			return;
-
 
194
    			}
-
 
195
    		}
-
 
196
    	}else{
-
 
197
    		if(this.expectedShippingTime <= currentTime && this.status < 9){
172
		if(this.expectedShippingTime <= currentTime && this.status < 9){
198
    			this.alert = OrderAlert.SHIPPING_TIME_EXCEEDED;
173
			this.alert = OrderAlert.SHIPPING_TIME_EXCEEDED;
199
    			return;
174
			return;
200
    		}
175
		}
201
    	}
-
 
202
	    	
176
	    	
203
	    
177
	    
204
	    if(this.createdOn <= currentTime - 2 * MS_IN_HOUR && this.status == 3 && !this.cod){
178
	    if(this.createdOn <= currentTime - 2 * MS_IN_HOUR && this.status == 3 && !this.cod){
205
            //A prepaid order has neither been accepted nor marked out of stock after 2 hours of order creation
179
            //A prepaid order has neither been accepted nor marked out of stock after 2 hours of order creation
206
            this.alert = OrderAlert.ACCEPTANCE_DELAYED_TOO_MUCH;
180
            this.alert = OrderAlert.ACCEPTANCE_DELAYED_TOO_MUCH;
Line 648... Line 622...
648
	public void setAcceptTogetherOrdersMap(
622
	public void setAcceptTogetherOrdersMap(
649
			Map<Long, Map<String, String>> acceptTogetherOrdersMap) {
623
			Map<Long, Map<String, String>> acceptTogetherOrdersMap) {
650
		this.acceptTogetherOrdersMap = acceptTogetherOrdersMap;
624
		this.acceptTogetherOrdersMap = acceptTogetherOrdersMap;
651
	}
625
	}
652
 
626
 
-
 
627
	public long getExpectedShippingTime() {
-
 
628
		return expectedShippingTime;
-
 
629
	}
-
 
630
 
-
 
631
	public void setExpectedShippingTime(long expectedShippingTime) {
-
 
632
		this.expectedShippingTime = expectedShippingTime;
-
 
633
	}
-
 
634
 
653
}
635
}