Subversion Repositories SmartDukaan

Rev

Rev 4754 | Rev 5443 | 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,
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,
4555 mandeep.dh 69
    5:double freightCharges,
4496 mandeep.dh 70
}
71
 
72
exception PurchaseServiceException {
73
    1:GenericService.ExceptionType exceptionType,
74
    2:string message
75
}
76
 
77
service PurchaseService extends GenericService.GenericService {
78
    /**
79
    Creates a purchase order based on the data in the given purchase order object.
80
    This method populates a nummber of missing fields 
81
    */
82
    i64 createPurchaseOrder(1:PurchaseOrder purchaseOrder) throws (1:PurchaseServiceException e),
83
 
84
    /**
85
    Returns the purchase order with the given id. Throws an exception if there is no such purchase order.
86
    */
87
    PurchaseOrder getPurchaseOrder(1:i64 id) throws (1:PurchaseServiceException e),
88
 
89
    /**
90
    Returns a list of all the purchase orders in the given state
91
    */
92
    list<PurchaseOrder> getAllPurchaseOrders(1:POStatus status) throws (1:PurchaseServiceException e),
93
 
94
    /**
95
    Returns the supplier with the given order id. Throws an exception if there is no such supplier.
96
    */
97
    Supplier getSupplier(1:i64 id) throws (1:PurchaseServiceException e),
98
 
99
    /**
100
    Creates a purchase for the given purchase order.
101
    Throws an exception if no more purchases are allowed against the given purchase order.
102
    */
103
    i64 startPurchase(1:i64 purchaseOrderId, 2:string invoiceNumber, 3:double freightCharges) throws (1:PurchaseServiceException e),
104
 
105
    /**
106
    Marks a purchase as complete and updates the receivedOn time.
107
    Throws an exception if no such purchase exists.
108
    */
109
    i64 closePurchase(1:i64 purchaseId) throws (1:PurchaseServiceException e),
110
 
111
    /**
112
    Returns all open or closed purchases for the given purchase order. Throws an exception if no such purchase order exists
113
    */
114
    list<Purchase> getAllPurchases(1:i64 purchaseOrderId, 2:bool open) throws (1:PurchaseServiceException e),
4555 mandeep.dh 115
 
4496 mandeep.dh 116
    /**
4555 mandeep.dh 117
     * Returns the purchase order object for a given purchase
4496 mandeep.dh 118
     */
4555 mandeep.dh 119
    PurchaseOrder getPurchaseOrderForPurchase(1:i64 purchaseId);
4754 mandeep.dh 120
 
121
    /**
122
     * Creates purchase order objects from pending orders
123
     */
124
    list<PurchaseOrder> getPendingPurchaseOrders(1:i64 warehouseId) throws (1:PurchaseServiceException e);
125
 
126
    /**
127
     * Returns all the valid suppliers
128
     */
129
    list<Supplier> getSuppliers() throws (1:PurchaseServiceException e);
130
 
131
    /**
132
     * Fulfills a given purchase order with an item.
133
     */
134
    void fulfillPO(1:i64 purchaseOrderId, 2:i64 itemId, 3:i64 quantity) throws (1:PurchaseServiceException e);
135
 
136
    /**
137
     * Amends a PO as per the new lineitems passed 
138
     */
139
    void updatePurchaseOrder(1:PurchaseOrder purchaseOrder) throws (1:PurchaseServiceException e),
5185 mandeep.dh 140
 
141
    /**
142
     * Fulfills a given purchase id with an item and its quantity.
143
     */
144
    void unFulfillPO(1:i64 purchaseId, 2:i64 itemId, 3:i64 quantity) throws (1:PurchaseServiceException e);
4496 mandeep.dh 145
}