| 4502 |
mandeep.dh |
1 |
#!/usr/bin/env python
|
|
|
2 |
#
|
|
|
3 |
# Autogenerated by Thrift Compiler (0.7.0)
|
|
|
4 |
#
|
|
|
5 |
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
|
|
6 |
#
|
|
|
7 |
|
|
|
8 |
import sys
|
|
|
9 |
import pprint
|
|
|
10 |
from urlparse import urlparse
|
|
|
11 |
from thrift.transport import TTransport
|
|
|
12 |
from thrift.transport import TSocket
|
|
|
13 |
from thrift.transport import THttpClient
|
|
|
14 |
from thrift.protocol import TBinaryProtocol
|
|
|
15 |
|
|
|
16 |
import PurchaseService
|
|
|
17 |
from ttypes import *
|
|
|
18 |
|
|
|
19 |
if len(sys.argv) <= 1 or sys.argv[1] == '--help':
|
|
|
20 |
print ''
|
|
|
21 |
print 'Usage: ' + sys.argv[0] + ' [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]'
|
|
|
22 |
print ''
|
|
|
23 |
print 'Functions:'
|
|
|
24 |
print ' i64 createPurchaseOrder(PurchaseOrder purchaseOrder)'
|
|
|
25 |
print ' PurchaseOrder getPurchaseOrder(i64 id)'
|
|
|
26 |
print ' getAllPurchaseOrders(POStatus status)'
|
|
|
27 |
print ' Supplier getSupplier(i64 id)'
|
|
|
28 |
print ' i64 startPurchase(i64 purchaseOrderId, string invoiceNumber, double freightCharges)'
|
|
|
29 |
print ' i64 closePurchase(i64 purchaseId)'
|
|
|
30 |
print ' getAllPurchases(i64 purchaseOrderId, bool open)'
|
| 6762 |
amar.kumar |
31 |
print ' getPurchasesForPO(i64 purchaseOrderId)'
|
| 4555 |
mandeep.dh |
32 |
print ' PurchaseOrder getPurchaseOrderForPurchase(i64 purchaseId)'
|
| 4754 |
mandeep.dh |
33 |
print ' getPendingPurchaseOrders(i64 warehouseId)'
|
|
|
34 |
print ' getSuppliers()'
|
|
|
35 |
print ' void fulfillPO(i64 purchaseOrderId, i64 itemId, i64 quantity)'
|
|
|
36 |
print ' void updatePurchaseOrder(PurchaseOrder purchaseOrder)'
|
| 5185 |
mandeep.dh |
37 |
print ' void unFulfillPO(i64 purchaseId, i64 itemId, i64 quantity)'
|
| 5443 |
mandeep.dh |
38 |
print ' getInvoices(i64 date)'
|
| 7410 |
amar.kumar |
39 |
print ' getInvoicesForWarehouse(i64 warehouseId, i64 supplierId, i64 date)'
|
| 5443 |
mandeep.dh |
40 |
print ' void createInvoice(Invoice invoice)'
|
| 5591 |
mandeep.dh |
41 |
print ' Supplier addSupplier(Supplier supplier)'
|
|
|
42 |
print ' void updateSupplier(Supplier supplier)'
|
| 6762 |
amar.kumar |
43 |
print ' i64 createPurchaseReturn(PurchaseReturn purchaseReturn)'
|
|
|
44 |
print ' void settlePurchaseReturn(i64 id)'
|
|
|
45 |
print ' getUnsettledPurchaseReturns()'
|
|
|
46 |
print ' getInvoice(string invoiceNumber, i64 supplierId)'
|
| 7672 |
rajveer |
47 |
print ' i64 createPurchaseForOurExtBilling(string invoiceNumber, double unitPrice, double nlc, i64 itemId)'
|
| 6762 |
amar.kumar |
48 |
print ' void fulfillPOForExtBilling(i64 itemId, i64 quantity)'
|
| 7410 |
amar.kumar |
49 |
print ' void closePO(i64 poId)'
|
|
|
50 |
print ' bool isInvoiceReceived(string invoiceNumber, i64 supplierId)'
|
| 10864 |
manish.sha |
51 |
print ' void changeWarehouseForPO(i64 id, i64 warehouseId)'
|
|
|
52 |
print ' void changePOStatus(i64 id, POStatus poStatus)'
|
| 11751 |
manish.sha |
53 |
print ' PurchaseReturn getPurchaseReturn(i64 id)'
|
| 4502 |
mandeep.dh |
54 |
print ''
|
|
|
55 |
sys.exit(0)
|
|
|
56 |
|
|
|
57 |
pp = pprint.PrettyPrinter(indent = 2)
|
|
|
58 |
host = 'localhost'
|
|
|
59 |
port = 9090
|
|
|
60 |
uri = ''
|
|
|
61 |
framed = False
|
|
|
62 |
http = False
|
|
|
63 |
argi = 1
|
|
|
64 |
|
|
|
65 |
if sys.argv[argi] == '-h':
|
|
|
66 |
parts = sys.argv[argi+1].split(':')
|
|
|
67 |
host = parts[0]
|
|
|
68 |
port = int(parts[1])
|
|
|
69 |
argi += 2
|
|
|
70 |
|
|
|
71 |
if sys.argv[argi] == '-u':
|
|
|
72 |
url = urlparse(sys.argv[argi+1])
|
|
|
73 |
parts = url[1].split(':')
|
|
|
74 |
host = parts[0]
|
|
|
75 |
if len(parts) > 1:
|
|
|
76 |
port = int(parts[1])
|
|
|
77 |
else:
|
|
|
78 |
port = 80
|
|
|
79 |
uri = url[2]
|
|
|
80 |
if url[4]:
|
|
|
81 |
uri += '?%s' % url[4]
|
|
|
82 |
http = True
|
|
|
83 |
argi += 2
|
|
|
84 |
|
|
|
85 |
if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':
|
|
|
86 |
framed = True
|
|
|
87 |
argi += 1
|
|
|
88 |
|
|
|
89 |
cmd = sys.argv[argi]
|
|
|
90 |
args = sys.argv[argi+1:]
|
|
|
91 |
|
|
|
92 |
if http:
|
|
|
93 |
transport = THttpClient.THttpClient(host, port, uri)
|
|
|
94 |
else:
|
|
|
95 |
socket = TSocket.TSocket(host, port)
|
|
|
96 |
if framed:
|
|
|
97 |
transport = TTransport.TFramedTransport(socket)
|
|
|
98 |
else:
|
|
|
99 |
transport = TTransport.TBufferedTransport(socket)
|
|
|
100 |
protocol = TBinaryProtocol.TBinaryProtocol(transport)
|
|
|
101 |
client = PurchaseService.Client(protocol)
|
|
|
102 |
transport.open()
|
|
|
103 |
|
|
|
104 |
if cmd == 'createPurchaseOrder':
|
|
|
105 |
if len(args) != 1:
|
|
|
106 |
print 'createPurchaseOrder requires 1 args'
|
|
|
107 |
sys.exit(1)
|
|
|
108 |
pp.pprint(client.createPurchaseOrder(eval(args[0]),))
|
|
|
109 |
|
|
|
110 |
elif cmd == 'getPurchaseOrder':
|
|
|
111 |
if len(args) != 1:
|
|
|
112 |
print 'getPurchaseOrder requires 1 args'
|
|
|
113 |
sys.exit(1)
|
|
|
114 |
pp.pprint(client.getPurchaseOrder(eval(args[0]),))
|
|
|
115 |
|
|
|
116 |
elif cmd == 'getAllPurchaseOrders':
|
|
|
117 |
if len(args) != 1:
|
|
|
118 |
print 'getAllPurchaseOrders requires 1 args'
|
|
|
119 |
sys.exit(1)
|
|
|
120 |
pp.pprint(client.getAllPurchaseOrders(eval(args[0]),))
|
|
|
121 |
|
|
|
122 |
elif cmd == 'getSupplier':
|
|
|
123 |
if len(args) != 1:
|
|
|
124 |
print 'getSupplier requires 1 args'
|
|
|
125 |
sys.exit(1)
|
|
|
126 |
pp.pprint(client.getSupplier(eval(args[0]),))
|
|
|
127 |
|
|
|
128 |
elif cmd == 'startPurchase':
|
|
|
129 |
if len(args) != 3:
|
|
|
130 |
print 'startPurchase requires 3 args'
|
|
|
131 |
sys.exit(1)
|
|
|
132 |
pp.pprint(client.startPurchase(eval(args[0]),args[1],eval(args[2]),))
|
|
|
133 |
|
|
|
134 |
elif cmd == 'closePurchase':
|
|
|
135 |
if len(args) != 1:
|
|
|
136 |
print 'closePurchase requires 1 args'
|
|
|
137 |
sys.exit(1)
|
|
|
138 |
pp.pprint(client.closePurchase(eval(args[0]),))
|
|
|
139 |
|
|
|
140 |
elif cmd == 'getAllPurchases':
|
|
|
141 |
if len(args) != 2:
|
|
|
142 |
print 'getAllPurchases requires 2 args'
|
|
|
143 |
sys.exit(1)
|
|
|
144 |
pp.pprint(client.getAllPurchases(eval(args[0]),eval(args[1]),))
|
|
|
145 |
|
| 6762 |
amar.kumar |
146 |
elif cmd == 'getPurchasesForPO':
|
|
|
147 |
if len(args) != 1:
|
|
|
148 |
print 'getPurchasesForPO requires 1 args'
|
|
|
149 |
sys.exit(1)
|
|
|
150 |
pp.pprint(client.getPurchasesForPO(eval(args[0]),))
|
|
|
151 |
|
| 4555 |
mandeep.dh |
152 |
elif cmd == 'getPurchaseOrderForPurchase':
|
|
|
153 |
if len(args) != 1:
|
|
|
154 |
print 'getPurchaseOrderForPurchase requires 1 args'
|
| 4502 |
mandeep.dh |
155 |
sys.exit(1)
|
| 4555 |
mandeep.dh |
156 |
pp.pprint(client.getPurchaseOrderForPurchase(eval(args[0]),))
|
| 4502 |
mandeep.dh |
157 |
|
| 4754 |
mandeep.dh |
158 |
elif cmd == 'getPendingPurchaseOrders':
|
|
|
159 |
if len(args) != 1:
|
|
|
160 |
print 'getPendingPurchaseOrders requires 1 args'
|
|
|
161 |
sys.exit(1)
|
|
|
162 |
pp.pprint(client.getPendingPurchaseOrders(eval(args[0]),))
|
|
|
163 |
|
|
|
164 |
elif cmd == 'getSuppliers':
|
|
|
165 |
if len(args) != 0:
|
|
|
166 |
print 'getSuppliers requires 0 args'
|
|
|
167 |
sys.exit(1)
|
|
|
168 |
pp.pprint(client.getSuppliers())
|
|
|
169 |
|
|
|
170 |
elif cmd == 'fulfillPO':
|
|
|
171 |
if len(args) != 3:
|
|
|
172 |
print 'fulfillPO requires 3 args'
|
|
|
173 |
sys.exit(1)
|
|
|
174 |
pp.pprint(client.fulfillPO(eval(args[0]),eval(args[1]),eval(args[2]),))
|
|
|
175 |
|
|
|
176 |
elif cmd == 'updatePurchaseOrder':
|
|
|
177 |
if len(args) != 1:
|
|
|
178 |
print 'updatePurchaseOrder requires 1 args'
|
|
|
179 |
sys.exit(1)
|
|
|
180 |
pp.pprint(client.updatePurchaseOrder(eval(args[0]),))
|
|
|
181 |
|
| 5185 |
mandeep.dh |
182 |
elif cmd == 'unFulfillPO':
|
|
|
183 |
if len(args) != 3:
|
|
|
184 |
print 'unFulfillPO requires 3 args'
|
|
|
185 |
sys.exit(1)
|
|
|
186 |
pp.pprint(client.unFulfillPO(eval(args[0]),eval(args[1]),eval(args[2]),))
|
|
|
187 |
|
| 5443 |
mandeep.dh |
188 |
elif cmd == 'getInvoices':
|
|
|
189 |
if len(args) != 1:
|
|
|
190 |
print 'getInvoices requires 1 args'
|
|
|
191 |
sys.exit(1)
|
|
|
192 |
pp.pprint(client.getInvoices(eval(args[0]),))
|
|
|
193 |
|
| 7410 |
amar.kumar |
194 |
elif cmd == 'getInvoicesForWarehouse':
|
|
|
195 |
if len(args) != 3:
|
|
|
196 |
print 'getInvoicesForWarehouse requires 3 args'
|
|
|
197 |
sys.exit(1)
|
|
|
198 |
pp.pprint(client.getInvoicesForWarehouse(eval(args[0]),eval(args[1]),eval(args[2]),))
|
|
|
199 |
|
| 5443 |
mandeep.dh |
200 |
elif cmd == 'createInvoice':
|
|
|
201 |
if len(args) != 1:
|
|
|
202 |
print 'createInvoice requires 1 args'
|
|
|
203 |
sys.exit(1)
|
|
|
204 |
pp.pprint(client.createInvoice(eval(args[0]),))
|
|
|
205 |
|
| 5591 |
mandeep.dh |
206 |
elif cmd == 'addSupplier':
|
|
|
207 |
if len(args) != 1:
|
|
|
208 |
print 'addSupplier requires 1 args'
|
|
|
209 |
sys.exit(1)
|
|
|
210 |
pp.pprint(client.addSupplier(eval(args[0]),))
|
|
|
211 |
|
|
|
212 |
elif cmd == 'updateSupplier':
|
|
|
213 |
if len(args) != 1:
|
|
|
214 |
print 'updateSupplier requires 1 args'
|
|
|
215 |
sys.exit(1)
|
|
|
216 |
pp.pprint(client.updateSupplier(eval(args[0]),))
|
|
|
217 |
|
| 6762 |
amar.kumar |
218 |
elif cmd == 'createPurchaseReturn':
|
|
|
219 |
if len(args) != 1:
|
|
|
220 |
print 'createPurchaseReturn requires 1 args'
|
|
|
221 |
sys.exit(1)
|
|
|
222 |
pp.pprint(client.createPurchaseReturn(eval(args[0]),))
|
|
|
223 |
|
|
|
224 |
elif cmd == 'settlePurchaseReturn':
|
|
|
225 |
if len(args) != 1:
|
|
|
226 |
print 'settlePurchaseReturn requires 1 args'
|
|
|
227 |
sys.exit(1)
|
|
|
228 |
pp.pprint(client.settlePurchaseReturn(eval(args[0]),))
|
|
|
229 |
|
|
|
230 |
elif cmd == 'getUnsettledPurchaseReturns':
|
|
|
231 |
if len(args) != 0:
|
|
|
232 |
print 'getUnsettledPurchaseReturns requires 0 args'
|
|
|
233 |
sys.exit(1)
|
|
|
234 |
pp.pprint(client.getUnsettledPurchaseReturns())
|
|
|
235 |
|
|
|
236 |
elif cmd == 'getInvoice':
|
|
|
237 |
if len(args) != 2:
|
|
|
238 |
print 'getInvoice requires 2 args'
|
|
|
239 |
sys.exit(1)
|
|
|
240 |
pp.pprint(client.getInvoice(args[0],eval(args[1]),))
|
|
|
241 |
|
|
|
242 |
elif cmd == 'createPurchaseForOurExtBilling':
|
| 7672 |
rajveer |
243 |
if len(args) != 4:
|
|
|
244 |
print 'createPurchaseForOurExtBilling requires 4 args'
|
| 6762 |
amar.kumar |
245 |
sys.exit(1)
|
| 7672 |
rajveer |
246 |
pp.pprint(client.createPurchaseForOurExtBilling(args[0],eval(args[1]),eval(args[2]),eval(args[3]),))
|
| 6762 |
amar.kumar |
247 |
|
|
|
248 |
elif cmd == 'fulfillPOForExtBilling':
|
|
|
249 |
if len(args) != 2:
|
|
|
250 |
print 'fulfillPOForExtBilling requires 2 args'
|
|
|
251 |
sys.exit(1)
|
|
|
252 |
pp.pprint(client.fulfillPOForExtBilling(eval(args[0]),eval(args[1]),))
|
|
|
253 |
|
| 7410 |
amar.kumar |
254 |
elif cmd == 'closePO':
|
|
|
255 |
if len(args) != 1:
|
|
|
256 |
print 'closePO requires 1 args'
|
|
|
257 |
sys.exit(1)
|
|
|
258 |
pp.pprint(client.closePO(eval(args[0]),))
|
|
|
259 |
|
|
|
260 |
elif cmd == 'isInvoiceReceived':
|
|
|
261 |
if len(args) != 2:
|
|
|
262 |
print 'isInvoiceReceived requires 2 args'
|
|
|
263 |
sys.exit(1)
|
|
|
264 |
pp.pprint(client.isInvoiceReceived(args[0],eval(args[1]),))
|
|
|
265 |
|
| 10864 |
manish.sha |
266 |
elif cmd == 'changeWarehouseForPO':
|
|
|
267 |
if len(args) != 2:
|
|
|
268 |
print 'changeWarehouseForPO requires 2 args'
|
|
|
269 |
sys.exit(1)
|
|
|
270 |
pp.pprint(client.changeWarehouseForPO(eval(args[0]),eval(args[1]),))
|
|
|
271 |
|
|
|
272 |
elif cmd == 'changePOStatus':
|
|
|
273 |
if len(args) != 2:
|
|
|
274 |
print 'changePOStatus requires 2 args'
|
|
|
275 |
sys.exit(1)
|
|
|
276 |
pp.pprint(client.changePOStatus(eval(args[0]),eval(args[1]),))
|
|
|
277 |
|
| 11751 |
manish.sha |
278 |
elif cmd == 'getPurchaseReturn':
|
|
|
279 |
if len(args) != 1:
|
|
|
280 |
print 'getPurchaseReturn requires 1 args'
|
|
|
281 |
sys.exit(1)
|
|
|
282 |
pp.pprint(client.getPurchaseReturn(eval(args[0]),))
|
|
|
283 |
|
| 4502 |
mandeep.dh |
284 |
else:
|
|
|
285 |
print 'Unrecognized method %s' % cmd
|
|
|
286 |
sys.exit(1)
|
|
|
287 |
|
|
|
288 |
transport.close()
|