Subversion Repositories SmartDukaan

Rev

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

Rev 5110 Rev 5185
Line 6... Line 6...
6
import in.shop2020.generic.ExceptionType;
6
import in.shop2020.generic.ExceptionType;
7
import in.shop2020.purchase.LineItem;
7
import in.shop2020.purchase.LineItem;
8
import in.shop2020.purchase.PurchaseOrder;
8
import in.shop2020.purchase.PurchaseOrder;
9
import in.shop2020.purchase.PurchaseService.Client;
9
import in.shop2020.purchase.PurchaseService.Client;
10
import in.shop2020.thrift.clients.PurchaseClient;
10
import in.shop2020.thrift.clients.PurchaseClient;
-
 
11
import in.shop2020.warehouse.ScanType;
11
import in.shop2020.warehouse.WarehouseServiceException;
12
import in.shop2020.warehouse.WarehouseServiceException;
12
 
13
 
13
import org.apache.commons.logging.Log;
14
import org.apache.commons.logging.Log;
14
import org.apache.commons.logging.LogFactory;
15
import org.apache.commons.logging.LogFactory;
15
 
16
 
Line 26... Line 27...
26
    private String itemNumber;
27
    private String itemNumber;
27
    private String serialNumber;
28
    private String serialNumber;
28
    private long initialQuantity;
29
    private long initialQuantity;
29
    private long currentQuantity;
30
    private long currentQuantity;
30
    private long purchaseId;
31
    private long purchaseId;
-
 
32
    private long currentWarehouseId;
-
 
33
    private ScanType lastScanType;
31
    
34
 
32
    public static InventoryItem create(in.shop2020.warehouse.InventoryItem thriftInventoryItem) {
35
    public static InventoryItem create(in.shop2020.warehouse.InventoryItem thriftInventoryItem) {
33
        InventoryItem inventoryItem = new InventoryItem();
36
        InventoryItem inventoryItem = new InventoryItem();
34
        inventoryItem.id = thriftInventoryItem.getId();
37
        inventoryItem.id = thriftInventoryItem.getId();
35
        inventoryItem.itemId = thriftInventoryItem.getItemId();
38
        inventoryItem.itemId = thriftInventoryItem.getItemId();
36
        inventoryItem.itemNumber = thriftInventoryItem.getItemNumber();
39
        inventoryItem.itemNumber = thriftInventoryItem.getItemNumber();
37
        inventoryItem.serialNumber = thriftInventoryItem.getSerialNumber();
40
        inventoryItem.serialNumber = thriftInventoryItem.getSerialNumber();
38
        inventoryItem.initialQuantity = thriftInventoryItem.getInitialQuantity();
41
        inventoryItem.initialQuantity = thriftInventoryItem.getInitialQuantity();
39
        inventoryItem.currentQuantity = thriftInventoryItem.getCurrentQuantity();
42
        inventoryItem.currentQuantity = thriftInventoryItem.getCurrentQuantity();
40
        inventoryItem.purchaseId = thriftInventoryItem.getPurchaseId();
43
        inventoryItem.purchaseId = thriftInventoryItem.getPurchaseId();
-
 
44
        inventoryItem.currentWarehouseId = thriftInventoryItem.getCurrentWarehouseId();
-
 
45
        inventoryItem.lastScanType = thriftInventoryItem.getLastScanType();
41
 
46
 
42
        return inventoryItem;
47
        return inventoryItem;
43
    }
48
    }
44
 
49
 
45
    public in.shop2020.warehouse.InventoryItem convert() throws WarehouseServiceException {
50
    public in.shop2020.warehouse.InventoryItem convert() throws WarehouseServiceException {
Line 49... Line 54...
49
        inventoryItem.setCurrentQuantity(currentQuantity);
54
        inventoryItem.setCurrentQuantity(currentQuantity);
50
        inventoryItem.setInitialQuantity(initialQuantity);
55
        inventoryItem.setInitialQuantity(initialQuantity);
51
        inventoryItem.setItemNumber(itemNumber);
56
        inventoryItem.setItemNumber(itemNumber);
52
        inventoryItem.setPurchaseId(purchaseId);
57
        inventoryItem.setPurchaseId(purchaseId);
53
        inventoryItem.setSerialNumber(serialNumber);
58
        inventoryItem.setSerialNumber(serialNumber);
-
 
59
        inventoryItem.setCurrentWarehouseId(currentWarehouseId);
-
 
60
        inventoryItem.setLastScanType(lastScanType);        
54
 
61
 
55
        // Setting derived fields
62
        // Setting derived fields
56
        try {
63
        try {
57
            Client client = new PurchaseClient().getClient();
64
            Client client = new PurchaseClient().getClient();
58
            PurchaseOrder purchaseOrder = client.getPurchaseOrderForPurchase(purchaseId);
65
            PurchaseOrder purchaseOrder = client.getPurchaseOrderForPurchase(purchaseId);
Line 111... Line 118...
111
        return purchaseId;
118
        return purchaseId;
112
    }
119
    }
113
    public void setPurchaseId(long purchaseId) {
120
    public void setPurchaseId(long purchaseId) {
114
        this.purchaseId = purchaseId;
121
        this.purchaseId = purchaseId;
115
    }
122
    }
-
 
123
 
-
 
124
    public long getCurrentWarehouseId() {
-
 
125
        return currentWarehouseId;
-
 
126
    }
-
 
127
 
-
 
128
    public void setCurrentWarehouseId(long currentWarehouseId) {
-
 
129
        this.currentWarehouseId = currentWarehouseId;
-
 
130
    }
-
 
131
 
-
 
132
    public ScanType getLastScanType() {
-
 
133
        return lastScanType;
-
 
134
    }
-
 
135
 
-
 
136
    public void setLastScanType(ScanType lastScanType) {
-
 
137
        this.lastScanType = lastScanType;
-
 
138
    }
116
}
139
}