Subversion Repositories SmartDukaan

Rev

Rev 4496 | Rev 4754 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
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,
37
    13:bool fulfilled
38
}
39
 
40
enum POStatus {
41
    INIT = 0,                   //Just created.
42
    READY = 1,                  //Posted for fulfillment.
43
    PARTIALLY_FULFILLED = 2,    //Partially fulfullied. Possible to accept purchases against it.
44
    PRECLOSED = 3,              //PO was partially fulfilled and the supplier has clarified that he can't supply the remaining items. 
45
    CLOSED = 4                  //PO was completely fulfilled.
46
}
47
 
48
struct PurchaseOrder {
49
    1:i64 id,
50
    2:string poNumber,
51
    3:list<LineItem> lineitems,
52
    4:i64 supplierId,
53
    5:i64 warehouseId,
54
    6:POStatus status,
55
    7:i64 createdAt,
56
    8:i64 updatedAt,
57
    9:double totalCost,
58
    10:double freightCharges,
59
    11:double realizedCost,
60
    12:double realizedFreightCharges
61
}
62
 
63
struct Purchase {
64
    1:i64 id,
65
    2:i64 poId,
66
    3:string invoiceNumber,
67
    4:i64 receivedOn,
4555 mandeep.dh 68
    5:double freightCharges,
4496 mandeep.dh 69
}
70
 
71
exception PurchaseServiceException {
72
    1:GenericService.ExceptionType exceptionType,
73
    2:string message
74
}
75
 
76
service PurchaseService extends GenericService.GenericService {
77
    /**
78
    Creates a purchase order based on the data in the given purchase order object.
79
    This method populates a nummber of missing fields 
80
    */
81
    i64 createPurchaseOrder(1:PurchaseOrder purchaseOrder) throws (1:PurchaseServiceException e),
82
 
83
    /**
84
    Returns the purchase order with the given id. Throws an exception if there is no such purchase order.
85
    */
86
    PurchaseOrder getPurchaseOrder(1:i64 id) throws (1:PurchaseServiceException e),
87
 
88
    /**
89
    Returns a list of all the purchase orders in the given state
90
    */
91
    list<PurchaseOrder> getAllPurchaseOrders(1:POStatus status) throws (1:PurchaseServiceException e),
92
 
93
    /**
94
    Returns the supplier with the given order id. Throws an exception if there is no such supplier.
95
    */
96
    Supplier getSupplier(1:i64 id) throws (1:PurchaseServiceException e),
97
 
98
    /**
99
    Creates a purchase for the given purchase order.
100
    Throws an exception if no more purchases are allowed against the given purchase order.
101
    */
102
    i64 startPurchase(1:i64 purchaseOrderId, 2:string invoiceNumber, 3:double freightCharges) throws (1:PurchaseServiceException e),
103
 
104
    /**
105
    Marks a purchase as complete and updates the receivedOn time.
106
    Throws an exception if no such purchase exists.
107
    */
108
    i64 closePurchase(1:i64 purchaseId) throws (1:PurchaseServiceException e),
109
 
110
    /**
111
    Returns all open or closed purchases for the given purchase order. Throws an exception if no such purchase order exists
112
    */
113
    list<Purchase> getAllPurchases(1:i64 purchaseOrderId, 2:bool open) throws (1:PurchaseServiceException e),
4555 mandeep.dh 114
 
4496 mandeep.dh 115
    /**
4555 mandeep.dh 116
     * Returns the purchase order object for a given purchase
4496 mandeep.dh 117
     */
4555 mandeep.dh 118
    PurchaseOrder getPurchaseOrderForPurchase(1:i64 purchaseId);
4496 mandeep.dh 119
}