Subversion Repositories SmartDukaan

Rev

Rev 7185 | Rev 7199 | 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,
7185 amit.gupta 16
    LOST_IN_WAREHOUSE = 9,
17
    MARKED_USED	= 10,
18
  	MARKED_BAD = 11,
19
  	MARKED_GOOD = 12;
5185 mandeep.dh 20
}
21
 
4496 mandeep.dh 22
struct InventoryItem {
5185 mandeep.dh 23
    // primary fields
4496 mandeep.dh 24
    1:i64 id,
25
    2:i64 itemId,
26
    3:string itemNumber,
27
    4:string serialNumber,
28
    5:i64 initialQuantity,
29
    6:i64 currentQuantity,
4555 mandeep.dh 30
    7:i64 purchaseId,
6467 amar.kumar 31
    8:i64 purchaseReturnId,
4555 mandeep.dh 32
    // derived fields for  efficient lookups
6467 amar.kumar 33
    9:i64 supplierId,
34
    10:double unitPrice,
35
    11:i64 currentWarehouseId,
36
    12:ScanType lastScanType
2820 chandransh 37
}
38
 
4496 mandeep.dh 39
struct Scan {
40
    1:i64 id,
41
    2:i64 inventoryItemId,
42
    3:optional i64 quantity, // ignored in case of serialized items
43
    4:optional i64 orderId, // The order that was fulfilled with thin scan!
44
    5:i64 warehouseId,
45
    6:ScanType type,
7190 amar.kumar 46
    7:i64 scannedAt,
47
    //8:string remarks
2820 chandransh 48
}
49
 
5372 mandeep.dh 50
struct DetailedPurchaseScan {
51
    1:i64 purchaseOrderId,
52
    2:i64 poCreatedAt,
53
    3:string supplierName,
54
    4:string invoiceNumbers,
6494 amar.kumar 55
    5:string receivedBy,
56
    6:i64 itemId,
57
    7:string brand,
58
    8:string modelName,
59
    9:string modelNumber,
60
   10:string color,
61
   11:double unitPrice,
62
   12:i64 quantity,
63
   13:i64 purchaseId,
64
   14:i64 purchasedAt
5372 mandeep.dh 65
}
66
 
5496 mandeep.dh 67
struct InvoiceScan {
68
    1:string invoiceNumber,
69
    2:i64 numItems,
70
    3:string supplierName,
71
    4:i64 date,
72
    5:i64 scannedQuantity
73
}
74
 
6548 amar.kumar 75
struct InventoryAvailability{
76
	1:i64 itemId,
77
	2:string brand,
78
	3:string modelName,
79
	4:string modelNumber,
80
	5:string color,
81
	6:i64 quantity
82
}
83
 
6762 amar.kumar 84
struct InventoryMovement{
85
	1:i64 itemId,
86
	2:string brand,
87
	3:string modelName,
88
	4:string modelNumber,
89
	5:string color,
90
	6:ScanType type
91
	7:i64 quantity
92
}
93
 
5711 mandeep.dh 94
struct InventoryAge {
95
    1:i64 itemId,
96
    2:string brand,
97
    3:string modelName,
98
    4:string modelNumber,
99
    5:string color,
100
    6:i64 freshCount,
101
    7:i64 oneToTwoCount,
102
    8:i64 TwoToThreeCount,
103
    9:i64 ThreeToFourCount,
5768 mandeep.dh 104
   10:i64 FourPlusCount,
105
   11:i64 ZeroPlusCount,
106
   12:i64 OnePlusCount,
107
   13:i64 ZeroPlusCost,
108
   14:i64 OnePlusCost,
109
   15:string category
5711 mandeep.dh 110
}
111
 
4496 mandeep.dh 112
exception WarehouseServiceException {
113
    1:GenericService.ExceptionType exceptionType,
114
    2:string message
2820 chandransh 115
}
116
 
6548 amar.kumar 117
 
4496 mandeep.dh 118
service WarehouseService extends GenericService.GenericService {
119
    /**
120
     * Retrieves serialized inventory item given a serial number
121
     */
4541 mandeep.dh 122
    InventoryItem getInventoryItem(1:string serialNumber) throws (1:WarehouseServiceException wex);
2820 chandransh 123
 
4496 mandeep.dh 124
    /**
5361 mandeep.dh 125
     * Retrieves non-serialized inventory item from a given supplier
4496 mandeep.dh 126
     */
5530 mandeep.dh 127
    InventoryItem getNonSeralizedInventoryItem(1:string itemNumber, 2:i64 itemId, 3:i64 fulfilmentWarehouseId) throws (1:WarehouseServiceException wex);
3383 chandransh 128
 
4496 mandeep.dh 129
    /**
130
     * Scan non-serialized items.
131
     */
5361 mandeep.dh 132
    void scan(1:InventoryItem inventoryItem, 2:ScanType type, 3:i64 quantity, 4:i64 billingWarehouseId) throws (1:WarehouseServiceException wex);
4496 mandeep.dh 133
 
134
    /**
135
     * Scan serialized items linked with an order. Returns its price.
136
     */
5110 mandeep.dh 137
    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 138
 
139
    /**
140
     * Scan non-serialized items linked with an order.
141
     */
5361 mandeep.dh 142
    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 143
 
144
    /**
145
     * Created item number to item id mapping
146
     */
147
    void createItemNumberMapping(1:string itemNumber, 2:i64 itemId);
4618 amit.gupta 148
 
149
    /**
150
     * Get itemNumber mappings for itemId 
151
     */
152
    list<string> getItemNumbers(1:i64 itemId);
5110 mandeep.dh 153
 
154
    /**
155
     * Gets item ids for a given item number
156
     */
157
    list<i64> getItemIds(1:string itemNumber);
5185 mandeep.dh 158
 
159
    /**
160
     * Retrieves all inventory items given a last scan type
161
     */
162
    list<InventoryItem> getInventoryItemsFromLastScanType(1:ScanType lastScanType) throws (1:WarehouseServiceException wex);
163
 
164
    /**
165
     * Retrieves inventory item given a inventoryItem id
166
     */
5372 mandeep.dh 167
    InventoryItem getInventoryItemFromId(1:i64 inventoryItemId) throws (1:WarehouseServiceException wex);
168
 
169
    /**
170
     * Returns the purchase scans grouped by items for Purchase register reconciliation
171
     */
172
    list<DetailedPurchaseScan> getPurchaseScans(1:i64 startDate, 2:i64 endDate);
5496 mandeep.dh 173
 
174
    /**
175
     * Returns the invoices and the count of scans against on a given day.
176
     */
177
     list<InvoiceScan> fetchScansPerInvoiceNumber(1:i64 date);
5620 mandeep.dh 178
 
179
     /**
180
      * Returns inventory item for a given order
181
      */
182
     InventoryItem getInventoryItemFromOrder(1:i64 orderId) throws (1:WarehouseServiceException we);
5711 mandeep.dh 183
 
184
     /**
185
      * Fetches the stock inventory age week-wise
186
      */
187
     list<InventoryAge> getInventoryAge();
6322 amar.kumar 188
 
189
	 /**
190
      * Fetches the scanRecords for a given item for a given time interval 
191
      */
192
     list<Scan> getInventoryScansForItem(1:i64 itemId, 2:i64 fromDate, 3:i64 toDate);
193
 
194
     /**
195
      * Fetches the scanRecords for a given serialNumber for a given time interval 
196
      */
197
     list<Scan> getScanRecordsForSerialNumber(1:i64 serialNumber);
198
 
6467 amar.kumar 199
     /**
6548 amar.kumar 200
      * Inserts outgoing scans for Returned Items and updates returnId in InventoryItems
6467 amar.kumar 201
      */
202
     void scanForPurchaseReturn(1:list<InventoryItem> saleReturnItems, 2:i64 vendorId) throws (1:WarehouseServiceException ex);
6322 amar.kumar 203
 
6548 amar.kumar 204
     /**
205
      * Inserts scans for lost Items and updates lastScanType in InventoryItems
206
      */
207
     void scanForLostItem(1:list<InventoryItem> lostItems, 2:i64 vendorId) throws (1:WarehouseServiceException ex);
208
 
209
     /**
210
      * Get inventory count for available Serialized items in our warehouses using entries in ScanNew table
211
      */
212
     list<InventoryAvailability> getCurrentSerializedInventoryByScans();
6630 amar.kumar 213
 
214
      /**
215
      * Get inventory count for available Serialized items in our warehouses using entries in ScanNew table
216
      */
217
     list<InventoryAvailability> getCurrentNonSerializedInventoryByScans();
218
 
6762 amar.kumar 219
     /**
220
      * Get inventory for Serialized items in our warehouses at a given date using entries in ScanNew table
221
      */
222
     list<InventoryAvailability> getHistoricSerializedInventoryByScans(1:i64 date);
223
 
224
      /**
225
      * Get inventory for Non Serialized items in our warehouses at a given date using entries in ScanNew table
226
      */
227
     list<InventoryAvailability> getHistoricNonSerializedInventoryByScans(1:i64 date);
228
 
229
     /**
6880 amar.kumar 230
      * Insert Purchase/Sale Entries for product billed by Hotspot using OURS_EXTERNAL Billing
6762 amar.kumar 231
      */
232
     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);
233
 
234
     /**
6880 amar.kumar 235
      * Insert Purchase_Ret/Sale_Ret Entries for product billed by Hotspot using OURS_EXTERNAL Billing
6762 amar.kumar 236
      */
237
     void scanForOursExternalSaleReturn(1:i64 orderId, 2:double unitPrice);
238
 
6880 amar.kumar 239
     list<InventoryMovement> getMovementNonSerializedInventoryByScans(1:i64 startDate, 2:i64 endDate);
6762 amar.kumar 240
 
6880 amar.kumar 241
     list<InventoryMovement> getMovementSerializedInventoryByScans(1:i64 startDate, 2:i64 endDate);
6762 amar.kumar 242
 
7190 amar.kumar 243
     InventoryItem scanfreebie(1:i64 orderId, 2:i64 freebieItemId, 3:i64 freebieWarehouseId, 4:ScanType scanType) throws (1:WarehouseServiceException wex);
244
 
4496 mandeep.dh 245
}