Subversion Repositories SmartDukaan

Rev

Rev 10177 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 10177 Rev 10886
Line 7... Line 7...
7
import in.shop2020.thrift.clients.CatalogClient;
7
import in.shop2020.thrift.clients.CatalogClient;
8
import in.shop2020.thrift.clients.InventoryClient;
8
import in.shop2020.thrift.clients.InventoryClient;
9
import in.shop2020.thrift.clients.WarehouseClient;
9
import in.shop2020.thrift.clients.WarehouseClient;
10
import in.shop2020.utils.ModelUtils;
10
import in.shop2020.utils.ModelUtils;
11
import in.shop2020.warehouse.InventoryItem;
11
import in.shop2020.warehouse.InventoryItem;
-
 
12
import in.shop2020.warehouse.Scan;
12
import in.shop2020.warehouse.ScanType;
13
import in.shop2020.warehouse.ScanType;
13
import in.shop2020.warehouse.WarehouseService.Client;
14
import in.shop2020.warehouse.WarehouseService.Client;
14
 
15
 
-
 
16
import java.text.SimpleDateFormat;
15
import java.util.ArrayList;
17
import java.util.ArrayList;
-
 
18
import java.util.Date;
16
import java.util.List;
19
import java.util.List;
17
 
20
 
18
import org.apache.commons.logging.Log;
21
import org.apache.commons.logging.Log;
19
import org.apache.commons.logging.LogFactory;
22
import org.apache.commons.logging.LogFactory;
20
 
23
 
Line 24... Line 27...
24
 */
27
 */
25
public class DoaInController extends BaseController {
28
public class DoaInController extends BaseController {
26
    private Log logger = LogFactory.getLog(DoaInController.class);
29
    private Log logger = LogFactory.getLog(DoaInController.class);
27
    private List<InventoryItem> inventoryItems;
30
    private List<InventoryItem> inventoryItems;
28
    private String id;
31
    private String id;
-
 
32
    private String output;
29
 
33
 
30
    public String index() {
34
    public String index() {
31
        try {
35
        try {
32
        	List<InventoryItem> tobeRemovedInventoryItems = new ArrayList<InventoryItem>();
36
        	List<InventoryItem> tobeRemovedInventoryItems = new ArrayList<InventoryItem>();
33
            Client warehouseClient = new WarehouseClient().getClient();
37
            Client warehouseClient = new WarehouseClient().getClient();
Line 80... Line 84...
80
                    .getItem(itemId));
84
                    .getItem(itemId));
81
        } catch (Exception e) {
85
        } catch (Exception e) {
82
            return "N/A";
86
            return "N/A";
83
        }
87
        }
84
    }
88
    }
-
 
89
    
-
 
90
    public String getOrderIdDOAInItem(){
-
 
91
    	try{
-
 
92
    		Client warehouseClient = new WarehouseClient().getClient();
-
 
93
    		List<Scan> scanList = warehouseClient.getScansForInventoryItem(Long.valueOf(id), ScanType.DOA_IN);
-
 
94
    		Scan lastScan = scanList.get(scanList.size()-1);
-
 
95
    		SimpleDateFormat df= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-
 
96
    		String doaInOrderIdDiv = "<div id = 'doa-in-order-id-div' align='center'><table id = 'doa-in-order-id-table'><tr><th>OrderId</th><th>DOA-In Time</th></tr>";
-
 
97
    		doaInOrderIdDiv = doaInOrderIdDiv + "<tr><td>" + lastScan.getOrderId()+ "</td><td>" + df.format(new Date(lastScan.getScannedAt())) +"</td></tr></table></div>";
-
 
98
    		setOutput(doaInOrderIdDiv);
-
 
99
    	} catch(Exception e){
-
 
100
    		logger.error("Error while getting order Id for DOA In item", e);
-
 
101
    	}
-
 
102
    	return OUTPUT;
-
 
103
    }
85
 
104
 
86
    public Log getLogger() {
105
    public Log getLogger() {
87
        return logger;
106
        return logger;
88
    }
107
    }
89
 
108
 
Line 104... Line 123...
104
    }
123
    }
105
 
124
 
106
    public void setId(String id) {
125
    public void setId(String id) {
107
        this.id = id;
126
        this.id = id;
108
    }
127
    }
-
 
128
 
-
 
129
	public String getOutput() {
-
 
130
		return output;
-
 
131
	}
-
 
132
 
-
 
133
	public void setOutput(String output) {
-
 
134
		this.output = output;
-
 
135
	}
109
}
136
}