| 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,
|
|
|
21 |
15:string communicationAddress
|
|
|
22 |
}
|
|
|
23 |
|
|
|
24 |
struct LineItem {
|
|
|
25 |
1:i64 orderId,
|
|
|
26 |
2:i64 itemId,
|
|
|
27 |
3:string productGroup,
|
|
|
28 |
4:string brand,
|
|
|
29 |
5:string modelNumber,
|
|
|
30 |
6:string modelName,
|
|
|
31 |
7:string color,
|
|
|
32 |
8:string itemNumber,
|
|
|
33 |
9:double quantity,
|
|
|
34 |
10:double unfulfilledQuantity,
|
|
|
35 |
11:i64 createdAt,
|
|
|
36 |
12:double unitPrice,
|
| 4754 |
mandeep.dh |
37 |
13:bool fulfilled,
|
|
|
38 |
14:i64 codCount
|
| 4496 |
mandeep.dh |
39 |
}
|
|
|
40 |
|
|
|
41 |
enum POStatus {
|
|
|
42 |
INIT = 0, //Just created.
|
|
|
43 |
READY = 1, //Posted for fulfillment.
|
|
|
44 |
PARTIALLY_FULFILLED = 2, //Partially fulfullied. Possible to accept purchases against it.
|
|
|
45 |
PRECLOSED = 3, //PO was partially fulfilled and the supplier has clarified that he can't supply the remaining items.
|
|
|
46 |
CLOSED = 4 //PO was completely fulfilled.
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
struct PurchaseOrder {
|
|
|
50 |
1:i64 id,
|
|
|
51 |
2:string poNumber,
|
|
|
52 |
3:list<LineItem> lineitems,
|
|
|
53 |
4:i64 supplierId,
|
|
|
54 |
5:i64 warehouseId,
|
|
|
55 |
6:POStatus status,
|
|
|
56 |
7:i64 createdAt,
|
|
|
57 |
8:i64 updatedAt,
|
|
|
58 |
9:double totalCost,
|
|
|
59 |
10:double freightCharges,
|
|
|
60 |
11:double realizedCost,
|
|
|
61 |
12:double realizedFreightCharges
|
|
|
62 |
}
|
|
|
63 |
|
|
|
64 |
struct Purchase {
|
|
|
65 |
1:i64 id,
|
|
|
66 |
2:i64 poId,
|
|
|
67 |
3:string invoiceNumber,
|
|
|
68 |
4:i64 receivedOn,
|
| 5530 |
mandeep.dh |
69 |
5:double freightCharges
|
| 4496 |
mandeep.dh |
70 |
}
|
|
|
71 |
|
| 6467 |
amar.kumar |
72 |
struct PurchaseReturn {
|
|
|
73 |
1:i64 id,
|
|
|
74 |
2:i64 vendorId,
|
|
|
75 |
3:i64 amount,
|
|
|
76 |
4:i64 returnTimestamp,
|
|
|
77 |
5:bool isSettled
|
|
|
78 |
}
|
|
|
79 |
|
| 5443 |
mandeep.dh |
80 |
struct Invoice {
|
|
|
81 |
1:i64 id,
|
|
|
82 |
2:string invoiceNumber,
|
|
|
83 |
3:i64 date,
|
|
|
84 |
4:i64 numItems,
|
|
|
85 |
5:string receivedFrom,
|
|
|
86 |
6:i64 supplierId
|
|
|
87 |
}
|
|
|
88 |
|
| 4496 |
mandeep.dh |
89 |
exception PurchaseServiceException {
|
|
|
90 |
1:GenericService.ExceptionType exceptionType,
|
|
|
91 |
2:string message
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
service PurchaseService extends GenericService.GenericService {
|
|
|
95 |
/**
|
|
|
96 |
Creates a purchase order based on the data in the given purchase order object.
|
|
|
97 |
This method populates a nummber of missing fields
|
|
|
98 |
*/
|
|
|
99 |
i64 createPurchaseOrder(1:PurchaseOrder purchaseOrder) throws (1:PurchaseServiceException e),
|
|
|
100 |
|
|
|
101 |
/**
|
|
|
102 |
Returns the purchase order with the given id. Throws an exception if there is no such purchase order.
|
|
|
103 |
*/
|
|
|
104 |
PurchaseOrder getPurchaseOrder(1:i64 id) throws (1:PurchaseServiceException e),
|
|
|
105 |
|
|
|
106 |
/**
|
|
|
107 |
Returns a list of all the purchase orders in the given state
|
|
|
108 |
*/
|
|
|
109 |
list<PurchaseOrder> getAllPurchaseOrders(1:POStatus status) throws (1:PurchaseServiceException e),
|
|
|
110 |
|
|
|
111 |
/**
|
|
|
112 |
Returns the supplier with the given order id. Throws an exception if there is no such supplier.
|
|
|
113 |
*/
|
|
|
114 |
Supplier getSupplier(1:i64 id) throws (1:PurchaseServiceException e),
|
|
|
115 |
|
|
|
116 |
/**
|
|
|
117 |
Creates a purchase for the given purchase order.
|
|
|
118 |
Throws an exception if no more purchases are allowed against the given purchase order.
|
|
|
119 |
*/
|
|
|
120 |
i64 startPurchase(1:i64 purchaseOrderId, 2:string invoiceNumber, 3:double freightCharges) throws (1:PurchaseServiceException e),
|
|
|
121 |
|
|
|
122 |
/**
|
|
|
123 |
Marks a purchase as complete and updates the receivedOn time.
|
|
|
124 |
Throws an exception if no such purchase exists.
|
|
|
125 |
*/
|
|
|
126 |
i64 closePurchase(1:i64 purchaseId) throws (1:PurchaseServiceException e),
|
|
|
127 |
|
|
|
128 |
/**
|
|
|
129 |
Returns all open or closed purchases for the given purchase order. Throws an exception if no such purchase order exists
|
|
|
130 |
*/
|
|
|
131 |
list<Purchase> getAllPurchases(1:i64 purchaseOrderId, 2:bool open) throws (1:PurchaseServiceException e),
|
| 6385 |
amar.kumar |
132 |
|
|
|
133 |
/**
|
|
|
134 |
Returns all purchases for the given purchase order. Throws an exception if no such purchase order exists
|
|
|
135 |
*/
|
|
|
136 |
list<Purchase> getPurchasesForPO(1:i64 purchaseOrderId) throws (1:PurchaseServiceException e),
|
| 4555 |
mandeep.dh |
137 |
|
| 4496 |
mandeep.dh |
138 |
/**
|
| 4555 |
mandeep.dh |
139 |
* Returns the purchase order object for a given purchase
|
| 4496 |
mandeep.dh |
140 |
*/
|
| 4555 |
mandeep.dh |
141 |
PurchaseOrder getPurchaseOrderForPurchase(1:i64 purchaseId);
|
| 4754 |
mandeep.dh |
142 |
|
|
|
143 |
/**
|
|
|
144 |
* Creates purchase order objects from pending orders
|
|
|
145 |
*/
|
|
|
146 |
list<PurchaseOrder> getPendingPurchaseOrders(1:i64 warehouseId) throws (1:PurchaseServiceException e);
|
|
|
147 |
|
|
|
148 |
/**
|
|
|
149 |
* Returns all the valid suppliers
|
|
|
150 |
*/
|
|
|
151 |
list<Supplier> getSuppliers() throws (1:PurchaseServiceException e);
|
|
|
152 |
|
|
|
153 |
/**
|
|
|
154 |
* Fulfills a given purchase order with an item.
|
|
|
155 |
*/
|
|
|
156 |
void fulfillPO(1:i64 purchaseOrderId, 2:i64 itemId, 3:i64 quantity) throws (1:PurchaseServiceException e);
|
|
|
157 |
|
|
|
158 |
/**
|
|
|
159 |
* Amends a PO as per the new lineitems passed
|
|
|
160 |
*/
|
|
|
161 |
void updatePurchaseOrder(1:PurchaseOrder purchaseOrder) throws (1:PurchaseServiceException e),
|
| 5185 |
mandeep.dh |
162 |
|
|
|
163 |
/**
|
|
|
164 |
* Fulfills a given purchase id with an item and its quantity.
|
|
|
165 |
*/
|
|
|
166 |
void unFulfillPO(1:i64 purchaseId, 2:i64 itemId, 3:i64 quantity) throws (1:PurchaseServiceException e);
|
| 5443 |
mandeep.dh |
167 |
|
|
|
168 |
/**
|
| 5530 |
mandeep.dh |
169 |
* Fetches all invoices after a given date
|
| 5443 |
mandeep.dh |
170 |
*/
|
|
|
171 |
list<Invoice> getInvoices(1:i64 date);
|
|
|
172 |
|
|
|
173 |
/**
|
|
|
174 |
* Creates an invoice object
|
|
|
175 |
*/
|
|
|
176 |
void createInvoice(1:Invoice invoice) throws (1:PurchaseServiceException e);
|
| 5591 |
mandeep.dh |
177 |
|
|
|
178 |
/**
|
|
|
179 |
* Creates a supplier
|
|
|
180 |
*/
|
|
|
181 |
Supplier addSupplier(1:Supplier supplier);
|
|
|
182 |
|
|
|
183 |
/**
|
|
|
184 |
* Updates a supplier
|
|
|
185 |
*/
|
|
|
186 |
void updateSupplier(1:Supplier supplier);
|
| 6467 |
amar.kumar |
187 |
|
|
|
188 |
/**
|
|
|
189 |
* Create a new Purchase Return
|
|
|
190 |
*/
|
|
|
191 |
i64 createPurchaseReturn(1:PurchaseReturn purchaseReturn);
|
|
|
192 |
|
|
|
193 |
/**
|
|
|
194 |
* Create a new Purchase Return
|
|
|
195 |
*/
|
|
|
196 |
void settlePurchaseReturn(1:i64 id);
|
|
|
197 |
|
|
|
198 |
/**
|
|
|
199 |
* Create a new Purchase Return
|
|
|
200 |
*/
|
|
|
201 |
list<PurchaseReturn> getUnsettledPurchaseReturns();
|
| 6630 |
amar.kumar |
202 |
|
|
|
203 |
/**
|
|
|
204 |
* Get invoice with given supplierId and invoiceNumber
|
|
|
205 |
*/
|
|
|
206 |
list<PurchaseReturn> getInvoice(1:string invoiceNumber, 2:i64 supplierId);
|
|
|
207 |
|
| 4496 |
mandeep.dh |
208 |
}
|