Subversion Repositories SmartDukaan

Rev

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