| Line 19... |
Line 19... |
| 19 |
if len(sys.argv) <= 1 or sys.argv[1] == '--help':
|
19 |
if len(sys.argv) <= 1 or sys.argv[1] == '--help':
|
| 20 |
print ''
|
20 |
print ''
|
| 21 |
print 'Usage: ' + sys.argv[0] + ' [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]'
|
21 |
print 'Usage: ' + sys.argv[0] + ' [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]'
|
| 22 |
print ''
|
22 |
print ''
|
| 23 |
print 'Functions:'
|
23 |
print 'Functions:'
|
| - |
|
24 |
print ' i64 createSerializedInventoryItem(i64 itemId, string serialNumber, i64 purchaseId)'
|
| - |
|
25 |
print ' i64 createSerializedInventoryItemFromItemNumber(string itemNumber, string serialNumber, i64 purchaseId)'
|
| 24 |
print ' i64 createPurchaseOrder(PurchaseOrder purchaseOrder)'
|
26 |
print ' i64 createInventoryItem(i64 itemId, i64 quantity, i64 purchaseId)'
|
| - |
|
27 |
print ' InventoryItem getInventoryItem(string serialNumber)'
|
| - |
|
28 |
print ' getNonSeralizedInventoryItems(i64 itemId, i64 quantity, i64 supplierId)'
|
| 25 |
print ' PurchaseOrder getPurchaseOrder(i64 id)'
|
29 |
print ' getInventoryItems(i64 itemId)'
|
| 26 |
print ' getAllPurchaseOrders(POStatus status)'
|
30 |
print ' getScanForOrder(i64 orderId)'
|
| 27 |
print ' Supplier getSupplier(i64 id)'
|
31 |
print ' getScan(i64 inventoryItemId)'
|
| 28 |
print ' i64 startPurchase(i64 purchaseOrderId, string invoiceNumber, double freightCharges)'
|
32 |
print ' void scanSerializedItem(i64 inventoryItemId, ScanType type, i64 warehouseId)'
|
| 29 |
print ' i64 closePurchase(i64 purchaseId)'
|
33 |
print ' void scan(i64 inventoryItemId, ScanType type, i64 quantity, i64 warehouseId)'
|
| 30 |
print ' getAllPurchases(i64 purchaseOrderId, bool open)'
|
34 |
print ' i64 scanSerializedItemForOrder(i64 inventoryItemId, ScanType type, i64 orderId, i64 warehouseId)'
|
| 31 |
print ' void scanIn(i64 purchaseId, string itemNumber, string imeiNumber, ScanType type)'
|
35 |
print ' void scanForOrder(i64 inventoryItemId, ScanType type, i64 quantity, i64 orderId, i64 warehouseId)'
|
| 32 |
print ' void scanOut(string itemNumber, string imeiNumber, ScanType type)'
|
36 |
print ' void createItemNumberMapping(string itemNumber, i64 itemId)'
|
| 33 |
print ''
|
37 |
print ''
|
| 34 |
sys.exit(0)
|
38 |
sys.exit(0)
|
| 35 |
|
39 |
|
| 36 |
pp = pprint.PrettyPrinter(indent = 2)
|
40 |
pp = pprint.PrettyPrinter(indent = 2)
|
| 37 |
host = 'localhost'
|
41 |
host = 'localhost'
|
| Line 78... |
Line 82... |
| 78 |
transport = TTransport.TBufferedTransport(socket)
|
82 |
transport = TTransport.TBufferedTransport(socket)
|
| 79 |
protocol = TBinaryProtocol.TBinaryProtocol(transport)
|
83 |
protocol = TBinaryProtocol.TBinaryProtocol(transport)
|
| 80 |
client = WarehouseService.Client(protocol)
|
84 |
client = WarehouseService.Client(protocol)
|
| 81 |
transport.open()
|
85 |
transport.open()
|
| 82 |
|
86 |
|
| - |
|
87 |
if cmd == 'createSerializedInventoryItem':
|
| - |
|
88 |
if len(args) != 3:
|
| - |
|
89 |
print 'createSerializedInventoryItem requires 3 args'
|
| - |
|
90 |
sys.exit(1)
|
| - |
|
91 |
pp.pprint(client.createSerializedInventoryItem(eval(args[0]),args[1],eval(args[2]),))
|
| - |
|
92 |
|
| - |
|
93 |
elif cmd == 'createSerializedInventoryItemFromItemNumber':
|
| - |
|
94 |
if len(args) != 3:
|
| - |
|
95 |
print 'createSerializedInventoryItemFromItemNumber requires 3 args'
|
| - |
|
96 |
sys.exit(1)
|
| - |
|
97 |
pp.pprint(client.createSerializedInventoryItemFromItemNumber(args[0],args[1],eval(args[2]),))
|
| - |
|
98 |
|
| 83 |
if cmd == 'createPurchaseOrder':
|
99 |
elif cmd == 'createInventoryItem':
|
| - |
|
100 |
if len(args) != 3:
|
| - |
|
101 |
print 'createInventoryItem requires 3 args'
|
| - |
|
102 |
sys.exit(1)
|
| - |
|
103 |
pp.pprint(client.createInventoryItem(eval(args[0]),eval(args[1]),eval(args[2]),))
|
| - |
|
104 |
|
| - |
|
105 |
elif cmd == 'getInventoryItem':
|
| 84 |
if len(args) != 1:
|
106 |
if len(args) != 1:
|
| 85 |
print 'createPurchaseOrder requires 1 args'
|
107 |
print 'getInventoryItem requires 1 args'
|
| 86 |
sys.exit(1)
|
108 |
sys.exit(1)
|
| 87 |
pp.pprint(client.createPurchaseOrder(eval(args[0]),))
|
109 |
pp.pprint(client.getInventoryItem(args[0],))
|
| 88 |
|
110 |
|
| - |
|
111 |
elif cmd == 'getNonSeralizedInventoryItems':
|
| - |
|
112 |
if len(args) != 3:
|
| - |
|
113 |
print 'getNonSeralizedInventoryItems requires 3 args'
|
| - |
|
114 |
sys.exit(1)
|
| - |
|
115 |
pp.pprint(client.getNonSeralizedInventoryItems(eval(args[0]),eval(args[1]),eval(args[2]),))
|
| - |
|
116 |
|
| 89 |
elif cmd == 'getPurchaseOrder':
|
117 |
elif cmd == 'getInventoryItems':
|
| 90 |
if len(args) != 1:
|
118 |
if len(args) != 1:
|
| 91 |
print 'getPurchaseOrder requires 1 args'
|
119 |
print 'getInventoryItems requires 1 args'
|
| 92 |
sys.exit(1)
|
120 |
sys.exit(1)
|
| 93 |
pp.pprint(client.getPurchaseOrder(eval(args[0]),))
|
121 |
pp.pprint(client.getInventoryItems(eval(args[0]),))
|
| 94 |
|
122 |
|
| 95 |
elif cmd == 'getAllPurchaseOrders':
|
123 |
elif cmd == 'getScanForOrder':
|
| 96 |
if len(args) != 1:
|
124 |
if len(args) != 1:
|
| 97 |
print 'getAllPurchaseOrders requires 1 args'
|
125 |
print 'getScanForOrder requires 1 args'
|
| 98 |
sys.exit(1)
|
126 |
sys.exit(1)
|
| 99 |
pp.pprint(client.getAllPurchaseOrders(eval(args[0]),))
|
127 |
pp.pprint(client.getScanForOrder(eval(args[0]),))
|
| 100 |
|
128 |
|
| 101 |
elif cmd == 'getSupplier':
|
129 |
elif cmd == 'getScan':
|
| 102 |
if len(args) != 1:
|
130 |
if len(args) != 1:
|
| 103 |
print 'getSupplier requires 1 args'
|
131 |
print 'getScan requires 1 args'
|
| 104 |
sys.exit(1)
|
132 |
sys.exit(1)
|
| 105 |
pp.pprint(client.getSupplier(eval(args[0]),))
|
133 |
pp.pprint(client.getScan(eval(args[0]),))
|
| 106 |
|
134 |
|
| 107 |
elif cmd == 'startPurchase':
|
135 |
elif cmd == 'scanSerializedItem':
|
| 108 |
if len(args) != 3:
|
136 |
if len(args) != 3:
|
| 109 |
print 'startPurchase requires 3 args'
|
137 |
print 'scanSerializedItem requires 3 args'
|
| 110 |
sys.exit(1)
|
138 |
sys.exit(1)
|
| 111 |
pp.pprint(client.startPurchase(eval(args[0]),args[1],eval(args[2]),))
|
139 |
pp.pprint(client.scanSerializedItem(eval(args[0]),eval(args[1]),eval(args[2]),))
|
| 112 |
|
140 |
|
| 113 |
elif cmd == 'closePurchase':
|
141 |
elif cmd == 'scan':
|
| 114 |
if len(args) != 1:
|
142 |
if len(args) != 4:
|
| 115 |
print 'closePurchase requires 1 args'
|
143 |
print 'scan requires 4 args'
|
| 116 |
sys.exit(1)
|
144 |
sys.exit(1)
|
| 117 |
pp.pprint(client.closePurchase(eval(args[0]),))
|
145 |
pp.pprint(client.scan(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
|
| 118 |
|
146 |
|
| 119 |
elif cmd == 'getAllPurchases':
|
147 |
elif cmd == 'scanSerializedItemForOrder':
|
| 120 |
if len(args) != 2:
|
148 |
if len(args) != 4:
|
| 121 |
print 'getAllPurchases requires 2 args'
|
149 |
print 'scanSerializedItemForOrder requires 4 args'
|
| 122 |
sys.exit(1)
|
150 |
sys.exit(1)
|
| 123 |
pp.pprint(client.getAllPurchases(eval(args[0]),eval(args[1]),))
|
151 |
pp.pprint(client.scanSerializedItemForOrder(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),))
|
| 124 |
|
152 |
|
| 125 |
elif cmd == 'scanIn':
|
153 |
elif cmd == 'scanForOrder':
|
| 126 |
if len(args) != 4:
|
154 |
if len(args) != 5:
|
| 127 |
print 'scanIn requires 4 args'
|
155 |
print 'scanForOrder requires 5 args'
|
| 128 |
sys.exit(1)
|
156 |
sys.exit(1)
|
| 129 |
pp.pprint(client.scanIn(eval(args[0]),args[1],args[2],eval(args[3]),))
|
157 |
pp.pprint(client.scanForOrder(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),))
|
| 130 |
|
158 |
|
| 131 |
elif cmd == 'scanOut':
|
159 |
elif cmd == 'createItemNumberMapping':
|
| 132 |
if len(args) != 3:
|
160 |
if len(args) != 2:
|
| 133 |
print 'scanOut requires 3 args'
|
161 |
print 'createItemNumberMapping requires 2 args'
|
| 134 |
sys.exit(1)
|
162 |
sys.exit(1)
|
| 135 |
pp.pprint(client.scanOut(args[0],args[1],eval(args[2]),))
|
163 |
pp.pprint(client.createItemNumberMapping(args[0],eval(args[1]),))
|
| 136 |
|
164 |
|
| 137 |
else:
|
165 |
else:
|
| 138 |
print 'Unrecognized method %s' % cmd
|
166 |
print 'Unrecognized method %s' % cmd
|
| 139 |
sys.exit(1)
|
167 |
sys.exit(1)
|
| 140 |
|
168 |
|