Subversion Repositories SmartDukaan

Rev

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