Subversion Repositories SmartDukaan

Rev

Rev 3424 | Rev 4541 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3424 Rev 4496
Line 1... Line 1...
1
namespace java in.shop2020.warehouse
1
namespace java in.shop2020.warehouse
2
namespace py shop2020.thriftpy.warehouse
2
namespace py shop2020.thriftpy.warehouse
3
 
3
 
4
include "GenericService.thrift"
4
include "GenericService.thrift"
5
 
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 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,
-
 
95
	3:i64 warehouseId,
-
 
96
	4:i64 purchaseId,
-
 
97
	5:string itemNumber,
-
 
98
	6:string imeiNumber,
-
 
99
	7:ScanType type,
-
 
100
	8:i64 scannedAt
-
 
101
}
-
 
102
 
-
 
103
exception WarehouseServiceException{
-
 
104
	1:i64 id,
-
 
105
	2:string message
-
 
106
}
-
 
107
 
-
 
108
service WarehouseService extends GenericService.GenericService{
-
 
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),
-
 
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),
-
 
124
	
-
 
125
	/**
-
 
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
	/**
-
 
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
	/**
-
 
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.
-
 
149
	Raises an exception if no more of the given item can be scanned in against the purchase order of the given purchase.
-
 
150
	*/
-
 
151
	void scanIn(1:i64 purchaseId, 2:string itemNumber, 3:string imeiNumber, 4:ScanType type) throws (1:WarehouseServiceException wex),
-
 
152
	
-
 
153
	/**
-
 
154
	Marks the Scan object with the given details as scanned out. In case, the imeiNumber is not given,
-
 
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:string itemNumber, 2:string imeiNumber, 3:ScanType type) throws (1:WarehouseServiceException wex)
-
 
161
}
-
 
162
6
struct Warehouse {
-
 
7
    1:i64 id,
-
 
8
    2:string displayName,
-
 
9
    3:string location
-
 
10
}
-
 
11
 
-
 
12
struct InventoryItem {
-
 
13
    1:i64 id,
-
 
14
    2:i64 itemId,
-
 
15
    3:string itemNumber,
-
 
16
    4:string serialNumber,
-
 
17
    5:i64 initialQuantity,
-
 
18
    6:i64 currentQuantity,
-
 
19
    7:i64 purchaseId
-
 
20
}
-
 
21
 
-
 
22
enum ScanType {
-
 
23
    PURCHASE = 0,   // Scan-in at the time of purchase
-
 
24
    SALE = 1,       // Scan-out for sale
-
 
25
    SALE_RET = 2,   // Scan-in when an item is returned undelivered
-
 
26
    DOA_IN = 3,     // Scan-in when an item is returned by the customer with the DOA certificate
-
 
27
    DOA_OUT = 4,     // Scan-out to return an item to the supplier
-
 
28
    PURCHASE_RETURN = 5 // Scan-out to return an item to the supplier (a Non-DOA case)
-
 
29
}
-
 
30
 
-
 
31
struct Scan {
-
 
32
    1:i64 id,
-
 
33
    2:i64 inventoryItemId,
-
 
34
    3:optional i64 quantity, // ignored in case of serialized items
-
 
35
    4:optional i64 orderId, // The order that was fulfilled with thin scan!
-
 
36
    5:i64 warehouseId,
-
 
37
    6:ScanType type,
-
 
38
    7:i64 scannedAt
-
 
39
}
-
 
40
 
-
 
41
exception WarehouseServiceException {
-
 
42
    1:GenericService.ExceptionType exceptionType,
-
 
43
    2:string message
-
 
44
}
-
 
45
 
-
 
46
service WarehouseService extends GenericService.GenericService {
-
 
47
    /**
-
 
48
     * Creating inventory for a serialized item
-
 
49
     */
-
 
50
    i64 createSerializedInventoryItem(1:i64 itemId, 2:string serialNumber, 3:i64 purchaseId) throws (1:WarehouseServiceException wex);
-
 
51
 
-
 
52
    /**
-
 
53
     * Creating inventory for a serialized item using item number
-
 
54
     */
-
 
55
    i64 createSerializedInventoryItemFromItemNumber(1:string itemNumber, 2:string serialNumber, 3:i64 purchaseId) throws (1:WarehouseServiceException wex);
-
 
56
 
-
 
57
    /**
-
 
58
     * Creates inventory for an unserailized item
-
 
59
     */
-
 
60
    i64 createInventoryItem(1:i64 itemId, 2:i64 quantity, 3:i64 purchaseId) throws (1:WarehouseServiceException wex);
-
 
61
 
-
 
62
    /**
-
 
63
     * Retrieves serialized inventory item given a serial number
-
 
64
     */
-
 
65
    InventoryItem getInventoryItem(1:string serialNumber);
-
 
66
 
-
 
67
    /**
-
 
68
     * Retrieves non-serialized inventory items from a given supplier
-
 
69
     */
-
 
70
    list<InventoryItem> getNonSeralizedInventoryItems(1:i64 itemId, 2:i64 quantity, 3:i64 supplierId);
-
 
71
 
-
 
72
    /**
-
 
73
     * Retrieves inventory items for a given item
-
 
74
     */
-
 
75
    list<InventoryItem> getInventoryItems(1:i64 itemId);
-
 
76
 
-
 
77
    /**
-
 
78
     * Retrieves scans for a given order
-
 
79
     */
-
 
80
    list<Scan> getScanForOrder(1:i64 orderId);
-
 
81
 
-
 
82
    /**
-
 
83
     * Retrieves scans for a given inventory item
-
 
84
     */
-
 
85
    list<Scan> getScan(1:i64 inventoryItemId);
-
 
86
 
-
 
87
    /**
-
 
88
     * Scan serialized items.
-
 
89
     */
-
 
90
    void scanSerializedItem(1:i64 inventoryItemId, 2:ScanType type, 3:i64 warehouseId) throws (1:WarehouseServiceException wex);
-
 
91
 
-
 
92
    /**
-
 
93
     * Scan non-serialized items.
-
 
94
     */
-
 
95
    void scan(1:i64 inventoryItemId, 2:ScanType type, 3:i64 quantity, 4:i64 warehouseId) throws (1:WarehouseServiceException wex);
-
 
96
 
-
 
97
    /**
-
 
98
     * Scan serialized items linked with an order. Returns its price.
-
 
99
     */
-
 
100
    i64 scanSerializedItemForOrder(1:i64 inventoryItemId, 2:ScanType type, 3:i64 orderId, 4:i64 warehouseId) throws (1:WarehouseServiceException wex);
-
 
101
 
-
 
102
    /**
-
 
103
     * Scan non-serialized items linked with an order.
-
 
104
     */
-
 
105
    void scanForOrder(1:i64 inventoryItemId, 2:ScanType type, 3:i64 quantity, 4:i64 orderId, 5:i64 warehouseId) throws (1:WarehouseServiceException wex);
-
 
106
 
-
 
107
    /**
-
 
108
     * Created item number to item id mapping
-
 
109
     */
-
 
110
    void createItemNumberMapping(1:string itemNumber, 2:i64 itemId);
-
 
111
}
-
 
112