Subversion Repositories SmartDukaan

Rev

Rev 2832 | Rev 3383 | 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 StockLedgerStatus{
85
	PRESENT = 0,
86
	CHECKED_OUT = 1,
87
	SALES_RETURNED = 2,
88
	DOA = 3,
89
	DOA_RETURNED = 4
90
}
91
 
92
struct StockLedger{
93
	1:i64 id,
94
	2:i64 itemId,
95
	3:i64 warehouseId,
96
	4:i64 purchaseId,
97
	5:string itemNumber,
98
	6:string imeiNumber,
99
	7:StockLedgerStatus status	
100
}
101
 
102
enum ScanType{
103
	PURCHASE = 0,	//Scan-in at the time of purchase
104
	SALE = 1,		//Scan-out for sale
105
	SALE_RET = 2,	//Scan-in when an item is returned undelivered
106
	DOA_IN = 3,		//Scan-in when an item is returned by the customer with the DOA certificate
107
	DOA_OUT = 4		//Scan-out to return an item to the supplier
108
}
109
 
110
struct Scan{
111
	1:i64 id,
112
	2:i64 itemId,
113
	3:i64 stockLedgerId,
114
	4:ScanType type,
115
	5:i64 scannedAt
116
}
117
 
118
exception WarehouseServiceException{
119
	1:i64 id,
120
	2:string message
121
}
122
 
3374 rajveer 123
service WarehouseService extends GenericService.GenericService{
2820 chandransh 124
	/**
125
	Creates a purchase order based on the data in the given purchase order object.
126
	This method populates a nummber of missing fields 
127
	*/
128
	i64 createPurchaseOrder(1:PurchaseOrder purchaseOrder) throws (1:WarehouseServiceException wex),
129
 
130
	/**
131
	Returns the purchase order with the given id. Throws an exception if there is no such purchase order.
132
	*/
133
	PurchaseOrder getPurchaseOrder(1:i64 id) throws (1:WarehouseServiceException wex),
134
 
135
	/**
2832 chandransh 136
	Returns the supplier with the given order id. Throws an exception if there is no such supplier.
137
	*/
138
	Supplier getSupplier(1:i64 id) throws (1:WarehouseServiceException wex),
139
 
140
	/**
2820 chandransh 141
	Creates a purchase for the given purchase order.
142
	Throws an exception if no more purchases are allowed against the given purchase order.
143
	*/
144
	i64 startPurchase(1:i64 purchaseOrderId, 2:string invoiceNumber, 3:double freightCharges) throws (1:WarehouseServiceException wex), 
145
 
146
	/**
147
	Marks a purchase as complete and updates the receivedOn time.
148
	Throws an exception if no such purchase exists.
149
	*/
150
	i64 closePurchase(1:i64 purchaseId) throws (1:WarehouseServiceException wex),
151
 
152
	/**
153
	Creates a StockLedger and a Scan object using the given details.
154
	Raises an exception if no more of the given item can be scanned in against the purchase order of the given purchase.
155
	*/
156
	void scanIn(1:i64 purchaseId, 2:i64 itemId, 3:string itemNumber, 4:string imeiNumber, 5:ScanType type) throws (1:WarehouseServiceException wex),
157
 
158
	/**
159
	Marks the StockLedger object with the given details as scanned out. In case, the imeiNumber is not given,
160
	marks the oldest ItemInventory object as being scanned out.
161
	Creats a Scan object for this action.
162
	Raises an exception if:
163
	1. There is no stock present corresponding to the given item details.
164
	2. An older stock is present corresponding to the itemNumber which has not been scanned out.
165
	*/
166
	void scanOut(1:i64 itemNumber, 2:i64 imeiNumber, 3:ScanType type) throws (1:WarehouseServiceException wex)
167
}