Subversion Repositories SmartDukaan

Rev

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

Rev 13146 Rev 19004
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.server.TransactionUtils;
-
 
4
 
-
 
5
import java.text.ParseException;
-
 
6
import java.text.SimpleDateFormat;
3
import java.util.Date;
7
import java.util.Date;
4
import java.util.List;
8
import java.util.List;
5
import java.util.Map;
9
import java.util.Map;
6
 
10
 
7
import com.google.gwt.user.client.rpc.IsSerializable;
11
import com.google.gwt.user.client.rpc.IsSerializable;
Line 157... Line 161...
157
		checkForAlerts();
161
		checkForAlerts();
158
	}
162
	}
159
 
163
 
160
	private void checkForAlerts(){
164
	private void checkForAlerts(){
161
	    this.alert = OrderAlert.NONE;
165
	    this.alert = OrderAlert.NONE;
162
	    Date date = new Date();
166
	    Date date = new Date(System.currentTimeMillis());
-
 
167
	    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
163
	    long currentTime = date.getTime();
168
	    long currentTime = date.getTime();
-
 
169
	    long currentDateTime = 0;
-
 
170
	    long expectedDateShippingTime =0 ;
-
 
171
	    try {
-
 
172
	    	currentDateTime = sdf.parse(sdf.format(date)).getTime();
-
 
173
			expectedDateShippingTime = sdf.parse(sdf.format(new Date(this.expectedShippingTime))).getTime();
-
 
174
		} catch (ParseException e) {
-
 
175
			e.printStackTrace();
-
 
176
		}
164
	    if(this.expectedDeliveryTime <= currentTime && this.status < 12){
177
	    if(this.expectedDeliveryTime <= currentTime && this.status < 12){
165
	        //Orders whose delivery dates have passed but which are not yet delivered
178
	        //Orders whose delivery dates have passed but which are not yet delivered
166
	        this.alert = OrderAlert.DELIVERY_TIME_EXCEEDED;
179
	        this.alert = OrderAlert.DELIVERY_TIME_EXCEEDED;
167
	        return;
180
	        return;
168
	    }
181
	    }
169
	    
182
	    
-
 
183
    	//Orders whose expected shipping dates have passed but which have not been shipped yet
-
 
184
    	if(expectedDateShippingTime >0){
-
 
185
    		if(expectedDateShippingTime <= currentDateTime){
-
 
186
    			if( TransactionUtils.virtualInvnetoryWarehouses.contains(this.fulfilmentWarehouseId)){
-
 
187
    				this.alert = OrderAlert.TODAY_SHIPPING_NOT_IN_STOCK;
-
 
188
    			}else{
-
 
189
    				this.alert = OrderAlert.TODAY_SHIPPING_IN_STOCK;
-
 
190
    			}
-
 
191
    			return;
-
 
192
    		}else{
170
	    if(this.expectedShippingTime <= currentTime && this.status < 9){
193
    			if(this.expectedShippingTime <= currentTime && this.status < 9){
-
 
194
    				this.alert = OrderAlert.SHIPPING_TIME_EXCEEDED;
-
 
195
        			return;
-
 
196
    			}else{
-
 
197
	    			this.alert = OrderAlert.LATER_SHIPPING;
-
 
198
	    			return;
-
 
199
    			}
-
 
200
    		}
-
 
201
    	}else{
171
	        //Orders whose expected shipping dates have passed but which have not been shipped yet
202
    		if(this.expectedShippingTime <= currentTime && this.status < 9){
172
	        this.alert = OrderAlert.SHIPPING_TIME_EXCEEDED;
203
    			this.alert = OrderAlert.SHIPPING_TIME_EXCEEDED;
173
	        return;
204
    			return;
-
 
205
    		}
-
 
206
    	}
174
	    }
207
	    	
175
	    
208
	    
176
	    if(this.createdOn <= currentTime - 2 * MS_IN_HOUR && this.status == 3 && !this.cod){
209
	    if(this.createdOn <= currentTime - 2 * MS_IN_HOUR && this.status == 3 && !this.cod){
177
            //A prepaid order has neither been accepted nor marked out of stock after 2 hours of order creation
210
            //A prepaid order has neither been accepted nor marked out of stock after 2 hours of order creation
178
            this.alert = OrderAlert.ACCEPTANCE_DELAYED_TOO_MUCH;
211
            this.alert = OrderAlert.ACCEPTANCE_DELAYED_TOO_MUCH;
179
            return;
212
            return;
Line 619... Line 652...
619
 
652
 
620
	public void setAcceptTogetherOrdersMap(
653
	public void setAcceptTogetherOrdersMap(
621
			Map<Long, Map<String, String>> acceptTogetherOrdersMap) {
654
			Map<Long, Map<String, String>> acceptTogetherOrdersMap) {
622
		this.acceptTogetherOrdersMap = acceptTogetherOrdersMap;
655
		this.acceptTogetherOrdersMap = acceptTogetherOrdersMap;
623
	}
656
	}
624
	
657
 
625
}
658
}