Subversion Repositories SmartDukaan

Rev

Rev 6630 | Rev 6765 | 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
 
6762 amar.kumar 80
struct InventoryMovement{
81
	1:i64 itemId,
82
	2:string brand,
83
	3:string modelName,
84
	4:string modelNumber,
85
	5:string color,
86
	6:ScanType type
87
	7:i64 quantity
88
}
89
 
5711 mandeep.dh 90
struct InventoryAge {
91
    1:i64 itemId,
92
    2:string brand,
93
    3:string modelName,
94
    4:string modelNumber,
95
    5:string color,
96
    6:i64 freshCount,
97
    7:i64 oneToTwoCount,
98
    8:i64 TwoToThreeCount,
99
    9:i64 ThreeToFourCount,
5768 mandeep.dh 100
   10:i64 FourPlusCount,
101
   11:i64 ZeroPlusCount,
102
   12:i64 OnePlusCount,
103
   13:i64 ZeroPlusCost,
104
   14:i64 OnePlusCost,
105
   15:string category
5711 mandeep.dh 106
}
107
 
4496 mandeep.dh 108
exception WarehouseServiceException {
109
    1:GenericService.ExceptionType exceptionType,
110
    2:string message
2820 chandransh 111
}
112
 
6548 amar.kumar 113
 
4496 mandeep.dh 114
service WarehouseService extends GenericService.GenericService {
115
    /**
116
     * Retrieves serialized inventory item given a serial number
117
     */
4541 mandeep.dh 118
    InventoryItem getInventoryItem(1:string serialNumber) throws (1:WarehouseServiceException wex);
2820 chandransh 119
 
4496 mandeep.dh 120
    /**
5361 mandeep.dh 121
     * Retrieves non-serialized inventory item from a given supplier
4496 mandeep.dh 122
     */
5530 mandeep.dh 123
    InventoryItem getNonSeralizedInventoryItem(1:string itemNumber, 2:i64 itemId, 3:i64 fulfilmentWarehouseId) throws (1:WarehouseServiceException wex);
3383 chandransh 124
 
4496 mandeep.dh 125
    /**
126
     * Scan non-serialized items.
127
     */
5361 mandeep.dh 128
    void scan(1:InventoryItem inventoryItem, 2:ScanType type, 3:i64 quantity, 4:i64 billingWarehouseId) throws (1:WarehouseServiceException wex);
4496 mandeep.dh 129
 
130
    /**
131
     * Scan serialized items linked with an order. Returns its price.
132
     */
5110 mandeep.dh 133
    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 134
 
135
    /**
136
     * Scan non-serialized items linked with an order.
137
     */
5361 mandeep.dh 138
    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 139
 
140
    /**
141
     * Created item number to item id mapping
142
     */
143
    void createItemNumberMapping(1:string itemNumber, 2:i64 itemId);
4618 amit.gupta 144
 
145
    /**
146
     * Get itemNumber mappings for itemId 
147
     */
148
    list<string> getItemNumbers(1:i64 itemId);
5110 mandeep.dh 149
 
150
    /**
151
     * Gets item ids for a given item number
152
     */
153
    list<i64> getItemIds(1:string itemNumber);
5185 mandeep.dh 154
 
155
    /**
156
     * Retrieves all inventory items given a last scan type
157
     */
158
    list<InventoryItem> getInventoryItemsFromLastScanType(1:ScanType lastScanType) throws (1:WarehouseServiceException wex);
159
 
160
    /**
161
     * Retrieves inventory item given a inventoryItem id
162
     */
5372 mandeep.dh 163
    InventoryItem getInventoryItemFromId(1:i64 inventoryItemId) throws (1:WarehouseServiceException wex);
164
 
165
    /**
166
     * Returns the purchase scans grouped by items for Purchase register reconciliation
167
     */
168
    list<DetailedPurchaseScan> getPurchaseScans(1:i64 startDate, 2:i64 endDate);
5496 mandeep.dh 169
 
170
    /**
171
     * Returns the invoices and the count of scans against on a given day.
172
     */
173
     list<InvoiceScan> fetchScansPerInvoiceNumber(1:i64 date);
5620 mandeep.dh 174
 
175
     /**
176
      * Returns inventory item for a given order
177
      */
178
     InventoryItem getInventoryItemFromOrder(1:i64 orderId) throws (1:WarehouseServiceException we);
5711 mandeep.dh 179
 
180
     /**
181
      * Fetches the stock inventory age week-wise
182
      */
183
     list<InventoryAge> getInventoryAge();
6322 amar.kumar 184
 
185
	 /**
186
      * Fetches the scanRecords for a given item for a given time interval 
187
      */
188
     list<Scan> getInventoryScansForItem(1:i64 itemId, 2:i64 fromDate, 3:i64 toDate);
189
 
190
     /**
191
      * Fetches the scanRecords for a given serialNumber for a given time interval 
192
      */
193
     list<Scan> getScanRecordsForSerialNumber(1:i64 serialNumber);
194
 
6467 amar.kumar 195
     /**
6548 amar.kumar 196
      * Inserts outgoing scans for Returned Items and updates returnId in InventoryItems
6467 amar.kumar 197
      */
198
     void scanForPurchaseReturn(1:list<InventoryItem> saleReturnItems, 2:i64 vendorId) throws (1:WarehouseServiceException ex);
6322 amar.kumar 199
 
6548 amar.kumar 200
     /**
201
      * Inserts scans for lost Items and updates lastScanType in InventoryItems
202
      */
203
     void scanForLostItem(1:list<InventoryItem> lostItems, 2:i64 vendorId) throws (1:WarehouseServiceException ex);
204
 
205
     /**
206
      * Get inventory count for available Serialized items in our warehouses using entries in ScanNew table
207
      */
208
     list<InventoryAvailability> getCurrentSerializedInventoryByScans();
6630 amar.kumar 209
 
210
      /**
211
      * Get inventory count for available Serialized items in our warehouses using entries in ScanNew table
212
      */
213
     list<InventoryAvailability> getCurrentNonSerializedInventoryByScans();
214
 
6762 amar.kumar 215
     /**
216
      * Get inventory for Serialized items in our warehouses at a given date using entries in ScanNew table
217
      */
218
     list<InventoryAvailability> getHistoricSerializedInventoryByScans(1:i64 date);
219
 
220
      /**
221
      * Get inventory for Non Serialized items in our warehouses at a given date using entries in ScanNew table
222
      */
223
     list<InventoryAvailability> getHistoricNonSerializedInventoryByScans(1:i64 date);
224
 
225
     /**
226
      * Insert Purchase/Scan Entries for product billed by Hotspot using OURS_EXTERNAL Billing
227
      */
228
     InventoryItem scanForOursExternalSale(1:i64 itemId, 2:string serialNumber, 3:string itemNumber, 4:string invoiceNumber, 5:i64 warehouseId, 6:double unitPrice, 7: i64 orderId)throws (1:WarehouseServiceException ex);
229
 
230
     /**
231
      * Insert Purchase_Ret Entries for product billed by Hotspot using OURS_EXTERNAL Billing
232
      */
233
     void scanForOursExternalSaleReturn(1:i64 orderId, 2:double unitPrice);
234
 
235
     list<InventoryMovement> getMovementNonSerializedInventoryByScans(1:i64 startDate, 2:i64 endDate);
236
 
237
     list<InventoryMovement> getMovementSerializedInventoryByScans(1:i64 startDate, 2:i64 endDate);
238
 
4496 mandeep.dh 239
}