Subversion Repositories SmartDukaan

Rev

Rev 3374 | Rev 3424 | 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
 
2820 chandransh 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 WarehouseDashboardUser{
25
//	1:i64 id,
26
//	2:string name,
27
//	3:string password,
28
//	4:Role role
29
//}
30
 
31
struct LineItem{
32
	1:i64 orderId,
33
	2:i64 itemId,
34
	3:string productGroup,
35
	4:string brand,
36
	5:string modelNumber,
37
	6:string modelName,
38
	7:string color,
39
	8:string itemNumber,
40
	9:double quantity,
41
	10:double unfulfilledQuantity,
42
	11:i64 createdAt,
43
	12:double unitPrice,
44
	13:bool fulfilled
45
}
46
 
47
enum POStatus{
48
	INIT = 0,					//Just created.
49
	READY = 1,					//Posted for fulfillment.
50
	PARTIALLY_FULFILLED = 2, 	//Partially fulfullied. Possible to accept purchases against it.
51
	PRECLOSED = 3,				//PO was partially fulfilled and the supplier has clarified that he can't supply the remaining items. 
52
	CLOSED = 4					//PO was completely fulfilled.
53
}
54
 
55
struct PurchaseOrder{
56
	1:i64 id,
57
	2:string poNumber,
58
	3:list<LineItem> lineitems,
59
	4:i64 supplierId,
60
	5:i64 warehouseId,
61
	6:POStatus status,
62
	7:i64 createdAt,
63
	8:i64 updatedAt,
64
	9:double totalCost,
65
	10:double freightCharges,
66
	11:double realizedCost,
67
	12:double realizedFreightCharges
68
}
69
 
70
struct Purchase{
71
	1:i64 id,
72
	2:i64 poId,
73
	3:string invoiceNumber,
74
	4:i64 receivedOn,
75
	5:double freightCharges
76
}
77
 
78
struct Warehouse{
79
	1:i64 id,
80
	2:string displayName,
81
	3:string location
82
}
83
 
84
enum ScanType{
85
	PURCHASE = 0,	//Scan-in at the time of purchase
86
	SALE = 1,		//Scan-out for sale
87
	SALE_RET = 2,	//Scan-in when an item is returned undelivered
88
	DOA_IN = 3,		//Scan-in when an item is returned by the customer with the DOA certificate
89
	DOA_OUT = 4		//Scan-out to return an item to the supplier
90
}
91
 
92
struct Scan{
93
	1:i64 id,
94
	2:i64 itemId,
3383 chandransh 95
	3:i64 warehouseId,
96
	4:i64 purchaseId,
97
	5:string itemNumber,
98
	6:string imeiNumber,
99
	7:ScanType type,
100
	8:i64 scannedAt
2820 chandransh 101
}
102
 
103
exception WarehouseServiceException{
104
	1:i64 id,
105
	2:string message
106
}
107
 
3374 rajveer 108
service WarehouseService extends GenericService.GenericService{
2820 chandransh 109
	/**
110
	Creates a purchase order based on the data in the given purchase order object.
111
	This method populates a nummber of missing fields 
112
	*/
113
	i64 createPurchaseOrder(1:PurchaseOrder purchaseOrder) throws (1:WarehouseServiceException wex),
114
 
115
	/**
116
	Returns the purchase order with the given id. Throws an exception if there is no such purchase order.
117
	*/
118
	PurchaseOrder getPurchaseOrder(1:i64 id) throws (1:WarehouseServiceException wex),
3383 chandransh 119
 
120
	/**
121
	Returns a list of all the purchase orders in the given state
122
	*/
123
	list<PurchaseOrder> getAllPurchaseOrders(1:POStatus status) throws(1:WarehouseServiceException wex),
2820 chandransh 124
 
125
	/**
2832 chandransh 126
	Returns the supplier with the given order id. Throws an exception if there is no such supplier.
127
	*/
128
	Supplier getSupplier(1:i64 id) throws (1:WarehouseServiceException wex),
129
 
130
	/**
2820 chandransh 131
	Creates a purchase for the given purchase order.
132
	Throws an exception if no more purchases are allowed against the given purchase order.
133
	*/
134
	i64 startPurchase(1:i64 purchaseOrderId, 2:string invoiceNumber, 3:double freightCharges) throws (1:WarehouseServiceException wex), 
135
 
136
	/**
137
	Marks a purchase as complete and updates the receivedOn time.
138
	Throws an exception if no such purchase exists.
139
	*/
140
	i64 closePurchase(1:i64 purchaseId) throws (1:WarehouseServiceException wex),
141
 
142
	/**
3383 chandransh 143
	Returns all open or closed purchases for the given purchase order. Throws an exception if no such purchase order exists
144
	*/
145
	list<Purchase> getAllPurchases(1:i64 purchaseOrderId, 2:bool open) throws(1:WarehouseServiceException wex),
146
 
147
	/**
148
	Creates a Scan object using the given details.
2820 chandransh 149
	Raises an exception if no more of the given item can be scanned in against the purchase order of the given purchase.
150
	*/
3383 chandransh 151
	void scanIn(1:i64 purchaseId, 2:string itemNumber, 3:string imeiNumber, 4:ScanType type) throws (1:WarehouseServiceException wex),
2820 chandransh 152
 
153
	/**
3383 chandransh 154
	Marks the Scan object with the given details as scanned out. In case, the imeiNumber is not given,
2820 chandransh 155
	marks the oldest ItemInventory object as being scanned out.
156
	Raises an exception if:
157
	1. There is no stock present corresponding to the given item details.
158
	2. An older stock is present corresponding to the itemNumber which has not been scanned out.
159
	*/
160
	void scanOut(1:i64 itemNumber, 2:i64 imeiNumber, 3:ScanType type) throws (1:WarehouseServiceException wex)
161
}