| 4496 |
mandeep.dh |
1 |
namespace java in.shop2020.purchase
|
|
|
2 |
namespace py shop2020.thriftpy.purchase
|
|
|
3 |
|
|
|
4 |
include "GenericService.thrift"
|
|
|
5 |
|
|
|
6 |
struct Supplier {
|
|
|
7 |
1:i64 id,
|
|
|
8 |
2:string name,
|
|
|
9 |
3:string phone,
|
|
|
10 |
4:string fax,
|
|
|
11 |
5:string tin,
|
|
|
12 |
6:string pan,
|
|
|
13 |
7:string headName,
|
|
|
14 |
8:string headDesignation,
|
|
|
15 |
9:string headEmail,
|
|
|
16 |
10:string contactName,
|
|
|
17 |
11:string contactPhone,
|
|
|
18 |
12:string contactFax,
|
|
|
19 |
13:string contactEmail,
|
|
|
20 |
14:string registeredAddress,
|
| 10295 |
amar.kumar |
21 |
15:string communicationAddress,
|
|
|
22 |
16:i64 stateId
|
| 4496 |
mandeep.dh |
23 |
}
|
|
|
24 |
|
|
|
25 |
struct LineItem {
|
|
|
26 |
1:i64 orderId,
|
|
|
27 |
2:i64 itemId,
|
|
|
28 |
3:string productGroup,
|
|
|
29 |
4:string brand,
|
|
|
30 |
5:string modelNumber,
|
|
|
31 |
6:string modelName,
|
|
|
32 |
7:string color,
|
|
|
33 |
8:string itemNumber,
|
|
|
34 |
9:double quantity,
|
|
|
35 |
10:double unfulfilledQuantity,
|
|
|
36 |
11:i64 createdAt,
|
|
|
37 |
12:double unitPrice,
|
| 4754 |
mandeep.dh |
38 |
13:bool fulfilled,
|
| 9416 |
amar.kumar |
39 |
14:i64 codCount,
|
|
|
40 |
15:i64 availableQuantity,
|
|
|
41 |
16:i64 reservedQuantity,
|
|
|
42 |
17:double avgSales,
|
|
|
43 |
18:i64 minStockLevel,
|
|
|
44 |
19:i64 numberOfDaysStock,
|
|
|
45 |
20:i64 suggestedQuantity,
|
|
|
46 |
21:i64 numberOfDaysInStock,
|
|
|
47 |
22:i64 rtoOrders,
|
|
|
48 |
23:string lastXdaysSale,
|
|
|
49 |
24:i64 previouslyOrderedQty,
|
|
|
50 |
25:double nlc,
|
|
|
51 |
26:double mrp
|
| 4496 |
mandeep.dh |
52 |
}
|
|
|
53 |
|
|
|
54 |
enum POStatus {
|
|
|
55 |
INIT = 0, //Just created.
|
|
|
56 |
READY = 1, //Posted for fulfillment.
|
|
|
57 |
PARTIALLY_FULFILLED = 2, //Partially fulfullied. Possible to accept purchases against it.
|
|
|
58 |
PRECLOSED = 3, //PO was partially fulfilled and the supplier has clarified that he can't supply the remaining items.
|
|
|
59 |
CLOSED = 4 //PO was completely fulfilled.
|
|
|
60 |
}
|
|
|
61 |
|
| 6821 |
amar.kumar |
62 |
enum POType {
|
|
|
63 |
REAL = 1, //PO created manually
|
|
|
64 |
VIRTUAL = 2 //Virtual PO generated automatically for Ours_External Billing
|
|
|
65 |
}
|
|
|
66 |
|
|
|
67 |
enum PurchaseReturnType {
|
|
|
68 |
REAL = 1, //Purchase Returns where stock is returned to Vendor
|
|
|
69 |
VIRTUAL = 2 //Virtual Purchase Return associated with Sale Returns for OursExternal Billing
|
|
|
70 |
}
|
|
|
71 |
|
| 9416 |
amar.kumar |
72 |
enum TaxType {
|
|
|
73 |
VAT = 0,
|
|
|
74 |
CST = 1,
|
|
|
75 |
CFORM = 2
|
|
|
76 |
}
|
|
|
77 |
|
| 4496 |
mandeep.dh |
78 |
struct PurchaseOrder {
|
|
|
79 |
1:i64 id,
|
|
|
80 |
2:string poNumber,
|
|
|
81 |
3:list<LineItem> lineitems,
|
|
|
82 |
4:i64 supplierId,
|
|
|
83 |
5:i64 warehouseId,
|
| 9925 |
amar.kumar |
84 |
6:i64 shippingWarehouseId,
|
|
|
85 |
7:POStatus status,
|
|
|
86 |
8:i64 createdAt,
|
|
|
87 |
9:i64 updatedAt,
|
|
|
88 |
10:double totalCost,
|
|
|
89 |
11:double freightCharges,
|
|
|
90 |
12:double realizedCost,
|
|
|
91 |
13:double realizedFreightCharges,
|
|
|
92 |
14:POType type
|
|
|
93 |
15:TaxType taxType
|
| 4496 |
mandeep.dh |
94 |
}
|
|
|
95 |
|
|
|
96 |
struct Purchase {
|
|
|
97 |
1:i64 id,
|
|
|
98 |
2:i64 poId,
|
|
|
99 |
3:string invoiceNumber,
|
|
|
100 |
4:i64 receivedOn,
|
| 5530 |
mandeep.dh |
101 |
5:double freightCharges
|
| 4496 |
mandeep.dh |
102 |
}
|
|
|
103 |
|
| 6467 |
amar.kumar |
104 |
struct PurchaseReturn {
|
|
|
105 |
1:i64 id,
|
|
|
106 |
2:i64 vendorId,
|
|
|
107 |
3:i64 amount,
|
|
|
108 |
4:i64 returnTimestamp,
|
| 6821 |
amar.kumar |
109 |
5:bool isSettled,
|
|
|
110 |
6:PurchaseReturnType type
|
| 6467 |
amar.kumar |
111 |
}
|
|
|
112 |
|
| 5443 |
mandeep.dh |
113 |
struct Invoice {
|
|
|
114 |
1:i64 id,
|
|
|
115 |
2:string invoiceNumber,
|
|
|
116 |
3:i64 date,
|
|
|
117 |
4:i64 numItems,
|
|
|
118 |
5:string receivedFrom,
|
| 7410 |
amar.kumar |
119 |
6:i64 supplierId,
|
|
|
120 |
7:i64 warehouseId
|
| 5443 |
mandeep.dh |
121 |
}
|
|
|
122 |
|
| 4496 |
mandeep.dh |
123 |
exception PurchaseServiceException {
|
|
|
124 |
1:GenericService.ExceptionType exceptionType,
|
|
|
125 |
2:string message
|
|
|
126 |
}
|
|
|
127 |
|
|
|
128 |
service PurchaseService extends GenericService.GenericService {
|
|
|
129 |
/**
|
|
|
130 |
Creates a purchase order based on the data in the given purchase order object.
|
|
|
131 |
This method populates a nummber of missing fields
|
|
|
132 |
*/
|
|
|
133 |
i64 createPurchaseOrder(1:PurchaseOrder purchaseOrder) throws (1:PurchaseServiceException e),
|
|
|
134 |
|
|
|
135 |
/**
|
|
|
136 |
Returns the purchase order with the given id. Throws an exception if there is no such purchase order.
|
|
|
137 |
*/
|
|
|
138 |
PurchaseOrder getPurchaseOrder(1:i64 id) throws (1:PurchaseServiceException e),
|
|
|
139 |
|
|
|
140 |
/**
|
|
|
141 |
Returns a list of all the purchase orders in the given state
|
|
|
142 |
*/
|
|
|
143 |
list<PurchaseOrder> getAllPurchaseOrders(1:POStatus status) throws (1:PurchaseServiceException e),
|
|
|
144 |
|
|
|
145 |
/**
|
|
|
146 |
Returns the supplier with the given order id. Throws an exception if there is no such supplier.
|
|
|
147 |
*/
|
|
|
148 |
Supplier getSupplier(1:i64 id) throws (1:PurchaseServiceException e),
|
|
|
149 |
|
|
|
150 |
/**
|
|
|
151 |
Creates a purchase for the given purchase order.
|
|
|
152 |
Throws an exception if no more purchases are allowed against the given purchase order.
|
|
|
153 |
*/
|
|
|
154 |
i64 startPurchase(1:i64 purchaseOrderId, 2:string invoiceNumber, 3:double freightCharges) throws (1:PurchaseServiceException e),
|
|
|
155 |
|
|
|
156 |
/**
|
|
|
157 |
Marks a purchase as complete and updates the receivedOn time.
|
|
|
158 |
Throws an exception if no such purchase exists.
|
|
|
159 |
*/
|
|
|
160 |
i64 closePurchase(1:i64 purchaseId) throws (1:PurchaseServiceException e),
|
|
|
161 |
|
|
|
162 |
/**
|
|
|
163 |
Returns all open or closed purchases for the given purchase order. Throws an exception if no such purchase order exists
|
|
|
164 |
*/
|
|
|
165 |
list<Purchase> getAllPurchases(1:i64 purchaseOrderId, 2:bool open) throws (1:PurchaseServiceException e),
|
| 6385 |
amar.kumar |
166 |
|
|
|
167 |
/**
|
|
|
168 |
Returns all purchases for the given purchase order. Throws an exception if no such purchase order exists
|
|
|
169 |
*/
|
|
|
170 |
list<Purchase> getPurchasesForPO(1:i64 purchaseOrderId) throws (1:PurchaseServiceException e),
|
| 4555 |
mandeep.dh |
171 |
|
| 4496 |
mandeep.dh |
172 |
/**
|
| 4555 |
mandeep.dh |
173 |
* Returns the purchase order object for a given purchase
|
| 4496 |
mandeep.dh |
174 |
*/
|
| 4555 |
mandeep.dh |
175 |
PurchaseOrder getPurchaseOrderForPurchase(1:i64 purchaseId);
|
| 4754 |
mandeep.dh |
176 |
|
|
|
177 |
/**
|
|
|
178 |
* Creates purchase order objects from pending orders
|
|
|
179 |
*/
|
|
|
180 |
list<PurchaseOrder> getPendingPurchaseOrders(1:i64 warehouseId) throws (1:PurchaseServiceException e);
|
|
|
181 |
|
|
|
182 |
/**
|
|
|
183 |
* Returns all the valid suppliers
|
|
|
184 |
*/
|
|
|
185 |
list<Supplier> getSuppliers() throws (1:PurchaseServiceException e);
|
|
|
186 |
|
|
|
187 |
/**
|
|
|
188 |
* Fulfills a given purchase order with an item.
|
|
|
189 |
*/
|
|
|
190 |
void fulfillPO(1:i64 purchaseOrderId, 2:i64 itemId, 3:i64 quantity) throws (1:PurchaseServiceException e);
|
|
|
191 |
|
|
|
192 |
/**
|
|
|
193 |
* Amends a PO as per the new lineitems passed
|
|
|
194 |
*/
|
|
|
195 |
void updatePurchaseOrder(1:PurchaseOrder purchaseOrder) throws (1:PurchaseServiceException e),
|
| 5185 |
mandeep.dh |
196 |
|
|
|
197 |
/**
|
|
|
198 |
* Fulfills a given purchase id with an item and its quantity.
|
|
|
199 |
*/
|
|
|
200 |
void unFulfillPO(1:i64 purchaseId, 2:i64 itemId, 3:i64 quantity) throws (1:PurchaseServiceException e);
|
| 5443 |
mandeep.dh |
201 |
|
|
|
202 |
/**
|
| 5530 |
mandeep.dh |
203 |
* Fetches all invoices after a given date
|
| 5443 |
mandeep.dh |
204 |
*/
|
|
|
205 |
list<Invoice> getInvoices(1:i64 date);
|
|
|
206 |
|
| 7410 |
amar.kumar |
207 |
/**
|
|
|
208 |
* Fetches all invoices after a given date
|
|
|
209 |
*/
|
|
|
210 |
list<Invoice> getInvoicesForWarehouse(1:i64 warehouseId, 2:i64 supplierId, 3:i64 date);
|
|
|
211 |
|
| 5443 |
mandeep.dh |
212 |
/**
|
|
|
213 |
* Creates an invoice object
|
|
|
214 |
*/
|
|
|
215 |
void createInvoice(1:Invoice invoice) throws (1:PurchaseServiceException e);
|
| 5591 |
mandeep.dh |
216 |
|
|
|
217 |
/**
|
|
|
218 |
* Creates a supplier
|
|
|
219 |
*/
|
|
|
220 |
Supplier addSupplier(1:Supplier supplier);
|
|
|
221 |
|
|
|
222 |
/**
|
|
|
223 |
* Updates a supplier
|
|
|
224 |
*/
|
|
|
225 |
void updateSupplier(1:Supplier supplier);
|
| 6467 |
amar.kumar |
226 |
|
|
|
227 |
/**
|
|
|
228 |
* Create a new Purchase Return
|
|
|
229 |
*/
|
|
|
230 |
i64 createPurchaseReturn(1:PurchaseReturn purchaseReturn);
|
|
|
231 |
|
|
|
232 |
/**
|
|
|
233 |
* Create a new Purchase Return
|
|
|
234 |
*/
|
|
|
235 |
void settlePurchaseReturn(1:i64 id);
|
|
|
236 |
|
|
|
237 |
/**
|
|
|
238 |
* Create a new Purchase Return
|
|
|
239 |
*/
|
|
|
240 |
list<PurchaseReturn> getUnsettledPurchaseReturns();
|
| 6630 |
amar.kumar |
241 |
|
|
|
242 |
/**
|
|
|
243 |
* Get invoice with given supplierId and invoiceNumber
|
|
|
244 |
*/
|
|
|
245 |
list<PurchaseReturn> getInvoice(1:string invoiceNumber, 2:i64 supplierId);
|
|
|
246 |
|
| 6762 |
amar.kumar |
247 |
/**
|
|
|
248 |
* Inserts new Invoice/LineItem/Purchase Entries for Billed Product done through Our External Billing
|
|
|
249 |
**/
|
| 7672 |
rajveer |
250 |
i64 createPurchaseForOurExtBilling(1:string invoiceNumber, 2:double unitPrice, 3:double nlc, 4:i64 itemId);
|
| 6762 |
amar.kumar |
251 |
|
|
|
252 |
void fulfillPOForExtBilling(1:i64 itemId, 2:i64 quantity);
|
|
|
253 |
|
| 7410 |
amar.kumar |
254 |
/**
|
|
|
255 |
* Marks a purchase order as closedcomplete and updates the receivedOn time.
|
|
|
256 |
*/
|
|
|
257 |
void closePO(1:i64 poId) throws (1:PurchaseServiceException e),
|
|
|
258 |
|
|
|
259 |
/**
|
|
|
260 |
* Check if invoice is already received with given supplierId and invoiceNumber
|
|
|
261 |
*/
|
|
|
262 |
bool isInvoiceReceived(1:string invoiceNumber, 2:i64 supplierId);
|
| 9829 |
amar.kumar |
263 |
|
|
|
264 |
/**
|
|
|
265 |
* Change warehouseId of PO if no items have been received yet for the PO
|
|
|
266 |
*/
|
|
|
267 |
void changeWarehouseForPO(1:i64 id, 2:i64 warehouseId) throws (1:PurchaseServiceException e);
|
| 9925 |
amar.kumar |
268 |
|
|
|
269 |
/**
|
|
|
270 |
* Change status of PO
|
|
|
271 |
*/
|
|
|
272 |
void changePOStatus(1:i64 id, 2:POStatus poStatus)throws (1:PurchaseServiceException e);
|
| 4496 |
mandeep.dh |
273 |
}
|