Subversion Repositories SmartDukaan

Rev

Rev 6494 | Rev 6630 | 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,
6548 amar.kumar 15
    DOA_REPLACED = 8,
16
    LOST_IN_WAREHOUSE = 9
5185 mandeep.dh 17
}
18
 
4496 mandeep.dh 19
struct InventoryItem {
5185 mandeep.dh 20
    // primary fields
4496 mandeep.dh 21
    1:i64 id,
22
    2:i64 itemId,
23
    3:string itemNumber,
24
    4:string serialNumber,
25
    5:i64 initialQuantity,
26
    6:i64 currentQuantity,
4555 mandeep.dh 27
    7:i64 purchaseId,
6467 amar.kumar 28
    8:i64 purchaseReturnId,
4555 mandeep.dh 29
    // derived fields for  efficient lookups
6467 amar.kumar 30
    9:i64 supplierId,
31
    10:double unitPrice,
32
    11:i64 currentWarehouseId,
33
    12:ScanType lastScanType
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
 
5372 mandeep.dh 46
struct DetailedPurchaseScan {
47
    1:i64 purchaseOrderId,
48
    2:i64 poCreatedAt,
49
    3:string supplierName,
50
    4:string invoiceNumbers,
6494 amar.kumar 51
    5:string receivedBy,
52
    6:i64 itemId,
53
    7:string brand,
54
    8:string modelName,
55
    9:string modelNumber,
56
   10:string color,
57
   11:double unitPrice,
58
   12:i64 quantity,
59
   13:i64 purchaseId,
60
   14:i64 purchasedAt
5372 mandeep.dh 61
}
62
 
5496 mandeep.dh 63
struct InvoiceScan {
64
    1:string invoiceNumber,
65
    2:i64 numItems,
66
    3:string supplierName,
67
    4:i64 date,
68
    5:i64 scannedQuantity
69
}
70
 
6548 amar.kumar 71
struct InventoryAvailability{
72
	1:i64 itemId,
73
	2:string brand,
74
	3:string modelName,
75
	4:string modelNumber,
76
	5:string color,
77
	6:i64 quantity
78
}
79
 
5711 mandeep.dh 80
struct InventoryAge {
81
    1:i64 itemId,
82
    2:string brand,
83
    3:string modelName,
84
    4:string modelNumber,
85
    5:string color,
86
    6:i64 freshCount,
87
    7:i64 oneToTwoCount,
88
    8:i64 TwoToThreeCount,
89
    9:i64 ThreeToFourCount,
5768 mandeep.dh 90
   10:i64 FourPlusCount,
91
   11:i64 ZeroPlusCount,
92
   12:i64 OnePlusCount,
93
   13:i64 ZeroPlusCost,
94
   14:i64 OnePlusCost,
95
   15:string category
5711 mandeep.dh 96
}
97
 
4496 mandeep.dh 98
exception WarehouseServiceException {
99
    1:GenericService.ExceptionType exceptionType,
100
    2:string message
2820 chandransh 101
}
102
 
6548 amar.kumar 103
 
4496 mandeep.dh 104
service WarehouseService extends GenericService.GenericService {
105
    /**
106
     * Retrieves serialized inventory item given a serial number
107
     */
4541 mandeep.dh 108
    InventoryItem getInventoryItem(1:string serialNumber) throws (1:WarehouseServiceException wex);
2820 chandransh 109
 
4496 mandeep.dh 110
    /**
5361 mandeep.dh 111
     * Retrieves non-serialized inventory item from a given supplier
4496 mandeep.dh 112
     */
5530 mandeep.dh 113
    InventoryItem getNonSeralizedInventoryItem(1:string itemNumber, 2:i64 itemId, 3:i64 fulfilmentWarehouseId) throws (1:WarehouseServiceException wex);
3383 chandransh 114
 
4496 mandeep.dh 115
    /**
116
     * Scan non-serialized items.
117
     */
5361 mandeep.dh 118
    void scan(1:InventoryItem inventoryItem, 2:ScanType type, 3:i64 quantity, 4:i64 billingWarehouseId) throws (1:WarehouseServiceException wex);
4496 mandeep.dh 119
 
120
    /**
121
     * Scan serialized items linked with an order. Returns its price.
122
     */
5110 mandeep.dh 123
    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 124
 
125
    /**
126
     * Scan non-serialized items linked with an order.
127
     */
5361 mandeep.dh 128
    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 129
 
130
    /**
131
     * Created item number to item id mapping
132
     */
133
    void createItemNumberMapping(1:string itemNumber, 2:i64 itemId);
4618 amit.gupta 134
 
135
    /**
136
     * Get itemNumber mappings for itemId 
137
     */
138
    list<string> getItemNumbers(1:i64 itemId);
5110 mandeep.dh 139
 
140
    /**
141
     * Gets item ids for a given item number
142
     */
143
    list<i64> getItemIds(1:string itemNumber);
5185 mandeep.dh 144
 
145
    /**
146
     * Retrieves all inventory items given a last scan type
147
     */
148
    list<InventoryItem> getInventoryItemsFromLastScanType(1:ScanType lastScanType) throws (1:WarehouseServiceException wex);
149
 
150
    /**
151
     * Retrieves inventory item given a inventoryItem id
152
     */
5372 mandeep.dh 153
    InventoryItem getInventoryItemFromId(1:i64 inventoryItemId) throws (1:WarehouseServiceException wex);
154
 
155
    /**
156
     * Returns the purchase scans grouped by items for Purchase register reconciliation
157
     */
158
    list<DetailedPurchaseScan> getPurchaseScans(1:i64 startDate, 2:i64 endDate);
5496 mandeep.dh 159
 
160
    /**
161
     * Returns the invoices and the count of scans against on a given day.
162
     */
163
     list<InvoiceScan> fetchScansPerInvoiceNumber(1:i64 date);
5620 mandeep.dh 164
 
165
     /**
166
      * Returns inventory item for a given order
167
      */
168
     InventoryItem getInventoryItemFromOrder(1:i64 orderId) throws (1:WarehouseServiceException we);
5711 mandeep.dh 169
 
170
     /**
171
      * Fetches the stock inventory age week-wise
172
      */
173
     list<InventoryAge> getInventoryAge();
6322 amar.kumar 174
 
175
	 /**
176
      * Fetches the scanRecords for a given item for a given time interval 
177
      */
178
     list<Scan> getInventoryScansForItem(1:i64 itemId, 2:i64 fromDate, 3:i64 toDate);
179
 
180
     /**
181
      * Fetches the scanRecords for a given serialNumber for a given time interval 
182
      */
183
     list<Scan> getScanRecordsForSerialNumber(1:i64 serialNumber);
184
 
6467 amar.kumar 185
     /**
6548 amar.kumar 186
      * Inserts outgoing scans for Returned Items and updates returnId in InventoryItems
6467 amar.kumar 187
      */
188
     void scanForPurchaseReturn(1:list<InventoryItem> saleReturnItems, 2:i64 vendorId) throws (1:WarehouseServiceException ex);
6322 amar.kumar 189
 
6548 amar.kumar 190
     /**
191
      * Inserts scans for lost Items and updates lastScanType in InventoryItems
192
      */
193
     void scanForLostItem(1:list<InventoryItem> lostItems, 2:i64 vendorId) throws (1:WarehouseServiceException ex);
194
 
195
     /**
196
      * Get inventory count for available Serialized items in our warehouses using entries in ScanNew table
197
      */
198
     list<InventoryAvailability> getCurrentSerializedInventoryByScans();
4496 mandeep.dh 199
}