Subversion Repositories SmartDukaan

Rev

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