Subversion Repositories SmartDukaan

Rev

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