Subversion Repositories SmartDukaan

Rev

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