Subversion Repositories SmartDukaan

Rev

Rev 4541 | Rev 4618 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2820 chandransh 1
namespace java in.shop2020.warehouse
2
namespace py shop2020.thriftpy.warehouse
3
 
3374 rajveer 4
include "GenericService.thrift"
5
 
4496 mandeep.dh 6
struct Warehouse {
7
    1:i64 id,
8
    2:string displayName,
9
    3:string location
2820 chandransh 10
}
11
 
4496 mandeep.dh 12
struct InventoryItem {
4555 mandeep.dh 13
    // fields in db
4496 mandeep.dh 14
    1:i64 id,
15
    2:i64 itemId,
16
    3:string itemNumber,
17
    4:string serialNumber,
18
    5:i64 initialQuantity,
19
    6:i64 currentQuantity,
4555 mandeep.dh 20
    7:i64 purchaseId,
21
 
22
    // derived fields for  efficient lookups
23
    8:i64 supplierId,
24
    9:double unitPrice
2820 chandransh 25
}
26
 
4496 mandeep.dh 27
enum ScanType {
28
    PURCHASE = 0,   // Scan-in at the time of purchase
29
    SALE = 1,       // Scan-out for sale
30
    SALE_RET = 2,   // Scan-in when an item is returned undelivered
31
    DOA_IN = 3,     // Scan-in when an item is returned by the customer with the DOA certificate
32
    DOA_OUT = 4,     // Scan-out to return an item to the supplier
33
    PURCHASE_RETURN = 5 // Scan-out to return an item to the supplier (a Non-DOA case)
2820 chandransh 34
}
35
 
4496 mandeep.dh 36
struct Scan {
37
    1:i64 id,
38
    2:i64 inventoryItemId,
39
    3:optional i64 quantity, // ignored in case of serialized items
40
    4:optional i64 orderId, // The order that was fulfilled with thin scan!
41
    5:i64 warehouseId,
42
    6:ScanType type,
43
    7:i64 scannedAt
2820 chandransh 44
}
45
 
4496 mandeep.dh 46
exception WarehouseServiceException {
47
    1:GenericService.ExceptionType exceptionType,
48
    2:string message
2820 chandransh 49
}
50
 
4496 mandeep.dh 51
service WarehouseService extends GenericService.GenericService {
52
    /**
53
     * Creating inventory for a serialized item
54
     */
4555 mandeep.dh 55
    InventoryItem createSerializedInventoryItem(1:i64 itemId, 2:string serialNumber, 3:i64 purchaseId) throws (1:WarehouseServiceException wex);
2820 chandransh 56
 
4496 mandeep.dh 57
    /**
58
     * Creating inventory for a serialized item using item number
59
     */
4555 mandeep.dh 60
    InventoryItem createSerializedInventoryItemFromItemNumber(1:string itemNumber, 2:string serialNumber, 3:i64 purchaseId) throws (1:WarehouseServiceException wex);
2820 chandransh 61
 
4496 mandeep.dh 62
    /**
63
     * Creates inventory for an unserailized item
64
     */
4555 mandeep.dh 65
    InventoryItem createInventoryItem(1:i64 itemId, 2:i64 quantity, 3:i64 purchaseId) throws (1:WarehouseServiceException wex);
2820 chandransh 66
 
4496 mandeep.dh 67
    /**
68
     * Retrieves serialized inventory item given a serial number
69
     */
4541 mandeep.dh 70
    InventoryItem getInventoryItem(1:string serialNumber) throws (1:WarehouseServiceException wex);
2820 chandransh 71
 
4496 mandeep.dh 72
    /**
73
     * Retrieves non-serialized inventory items from a given supplier
74
     */
75
    list<InventoryItem> getNonSeralizedInventoryItems(1:i64 itemId, 2:i64 quantity, 3:i64 supplierId);
3383 chandransh 76
 
4496 mandeep.dh 77
    /**
78
     * Retrieves inventory items for a given item
79
     */
80
    list<InventoryItem> getInventoryItems(1:i64 itemId);
81
 
82
    /**
83
     * Retrieves scans for a given order
84
     */
85
    list<Scan> getScanForOrder(1:i64 orderId);
86
 
87
    /**
88
     * Retrieves scans for a given inventory item
89
     */
90
    list<Scan> getScan(1:i64 inventoryItemId);
91
 
92
    /**
93
     * Scan serialized items.
94
     */
95
    void scanSerializedItem(1:i64 inventoryItemId, 2:ScanType type, 3:i64 warehouseId) throws (1:WarehouseServiceException wex);
96
 
97
    /**
98
     * Scan non-serialized items.
99
     */
100
    void scan(1:i64 inventoryItemId, 2:ScanType type, 3:i64 quantity, 4:i64 warehouseId) throws (1:WarehouseServiceException wex);
101
 
102
    /**
103
     * Scan serialized items linked with an order. Returns its price.
104
     */
4555 mandeep.dh 105
    InventoryItem scanSerializedItemForOrder(1:string serialNumber, 2:ScanType type, 3:i64 orderId, 4:i64 warehouseId) throws (1:WarehouseServiceException wex);
4496 mandeep.dh 106
 
107
    /**
108
     * Scan non-serialized items linked with an order.
109
     */
110
    void scanForOrder(1:i64 inventoryItemId, 2:ScanType type, 3:i64 quantity, 4:i64 orderId, 5:i64 warehouseId) throws (1:WarehouseServiceException wex);
111
 
112
    /**
113
     * Created item number to item id mapping
114
     */
115
    void createItemNumberMapping(1:string itemNumber, 2:i64 itemId);
116
}