Subversion Repositories SmartDukaan

Rev

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

Rev 10308 Rev 10489
Line 8... Line 8...
8
import in.shop2020.thrift.clients.InventoryClient;
8
import in.shop2020.thrift.clients.InventoryClient;
9
import in.shop2020.thrift.clients.PurchaseClient;
9
import in.shop2020.thrift.clients.PurchaseClient;
10
import in.shop2020.thrift.clients.WarehouseClient;
10
import in.shop2020.thrift.clients.WarehouseClient;
11
import in.shop2020.utils.ModelUtils;
11
import in.shop2020.utils.ModelUtils;
12
import in.shop2020.warehouse.InventoryItem;
12
import in.shop2020.warehouse.InventoryItem;
-
 
13
import in.shop2020.warehouse.Scan;
13
import in.shop2020.warehouse.ScanType;
14
import in.shop2020.warehouse.ScanType;
14
import in.shop2020.warehouse.WarehouseService.Client;
15
import in.shop2020.warehouse.WarehouseService.Client;
15
 
16
 
16
import java.util.ArrayList;
17
import java.util.ArrayList;
-
 
18
import java.util.Date;
17
import java.util.List;
19
import java.util.List;
18
 
20
 
19
import org.apache.commons.logging.Log;
21
import org.apache.commons.logging.Log;
20
import org.apache.commons.logging.LogFactory;
22
import org.apache.commons.logging.LogFactory;
21
 
23
 
Line 77... Line 79...
77
        } catch (Exception e) {
79
        } catch (Exception e) {
78
            logger.error("Could not fetch inventory items", e);
80
            logger.error("Could not fetch inventory items", e);
79
        }
81
        }
80
 
82
 
81
        return index();
83
        return index();
-
 
84
    }
-
 
85
    
-
 
86
    public String closeDOAByCreditNote() {
-
 
87
        try {
-
 
88
        	Client warehouseClient = new WarehouseClient().getClient();
-
 
89
            InventoryItem inventoryItem = warehouseClient.getInventoryItemFromId(Long.valueOf(id));
-
 
90
            in.shop2020.model.v1.inventory.InventoryService.Client catalogClient = new InventoryClient().getClient();
-
 
91
            Warehouse warehouse = catalogClient.getWarehouse(inventoryItem.getCurrentWarehouseId());
-
 
92
            
-
 
93
            Scan scan = new Scan();
-
 
94
            scan.setInventoryItemId(Long.parseLong(id));
-
 
95
            scan.setScannedAt((new Date()).getTime());
-
 
96
            scan.setType(ScanType.DOA_CLOSED_BY_CREDIT_NOTE);
-
 
97
            scan.setQuantity(1);
-
 
98
            scan.setWarehouseId(inventoryItem.getCurrentWarehouseId());
-
 
99
            warehouseClient.genericScan(inventoryItem, scan);
-
 
100
        } catch (Exception e) {
-
 
101
            logger.error("Could not fetch inventory items", e);
-
 
102
        }
-
 
103
 
-
 
104
        return index();
82
    }
105
    }
83
 
106
 
84
    public String getPONumber(long purchaseId) {
107
    public String getPONumber(long purchaseId) {
85
        try {
108
        try {
86
            in.shop2020.purchase.PurchaseService.Client purchaseClient = new PurchaseClient().getClient();
109
            in.shop2020.purchase.PurchaseService.Client purchaseClient = new PurchaseClient().getClient();