add all those small scripts
parent
f757dca501
commit
6fc5a09c6d
@ -0,0 +1,15 @@
|
||||
import sys
|
||||
from util import xmlfiletodict, get_articles
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 2:
|
||||
print "usage:", sys.argv[0], "order.xml"
|
||||
exit(1)
|
||||
|
||||
orderline = xmlfiletodict(sys.argv[1])
|
||||
|
||||
for article in get_articles(orderline):
|
||||
print article['Barcode']
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
@ -0,0 +1,17 @@
|
||||
import sys
|
||||
from glob import glob
|
||||
from util import xmlfiletodict, get_articles
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 2:
|
||||
print "usage:", sys.argv[0], "order.xml"
|
||||
exit(1)
|
||||
|
||||
orderline = xmlfiletodict(sys.argv[1])
|
||||
|
||||
for article in get_articles(orderline):
|
||||
volume = article['Article']['Length']*article['Article']['Width']*article['Article']['Height']
|
||||
print 1000.0*article['Article']['Weight']/volume
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
@ -0,0 +1,23 @@
|
||||
import sys
|
||||
from util import xmlfiletodict, get_articles
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 2:
|
||||
print "usage:", sys.argv[0], "order.xml"
|
||||
exit(1)
|
||||
|
||||
orderline = xmlfiletodict(sys.argv[1])
|
||||
|
||||
for article in get_articles(orderline):
|
||||
print '\t'.join([str(a) for a in [
|
||||
article['Article']['Description'],
|
||||
article['Article']['ID'],
|
||||
article['Article']['Type'],
|
||||
article['Article']['Family'],
|
||||
article['Article']['Length'],
|
||||
article['Article']['Width'],
|
||||
article['Article']['Height'],
|
||||
article['Article']['Weight']]])
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
@ -0,0 +1,9 @@
|
||||
import ctypes, sys
|
||||
|
||||
if len(sys.argv) != 4:
|
||||
print "usage:", sys.argv[0], "order.xml packlist.xml scoring.xml"
|
||||
exit(1)
|
||||
|
||||
libpallet = ctypes.cdll.LoadLibrary('./libpallet.so.0.0.0')
|
||||
libpallet.evaluate.restype = ctypes.c_double
|
||||
print libpallet.evaluate(sys.argv[1], sys.argv[2], sys.argv[3])
|
@ -0,0 +1,34 @@
|
||||
import ctypes, sys
|
||||
from util import xmlfiletodict, get_packlist_dict, dicttoxmlfile, get_order_dict
|
||||
import tempfile
|
||||
import os
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
print "usage:", sys.argv[0], "packlist.xml scoring.xml"
|
||||
exit(1)
|
||||
|
||||
libpallet = ctypes.cdll.LoadLibrary('./libpallet.so.0.0.0')
|
||||
libpallet.evaluate.restype = ctypes.c_double
|
||||
|
||||
packlist = xmlfiletodict(sys.argv[1])
|
||||
|
||||
pallets = packlist['Response']['PackList']['PackPallets']['PackPallet']
|
||||
|
||||
article_lists = [ pallet['Packages']['Package'] for pallet in pallets ]
|
||||
|
||||
scores = list()
|
||||
for pallet, articles_to_pack in zip(pallets, article_lists):
|
||||
partial_packlist = get_packlist_dict(pallet, articles_to_pack)
|
||||
tmp_fh, tmp = tempfile.mkstemp()
|
||||
tmp_order_fh, tmp_order = tempfile.mkstemp()
|
||||
dicttoxmlfile(partial_packlist, tmp)
|
||||
dicttoxmlfile(get_order_dict(pallet, articles_to_pack), tmp_order)
|
||||
scores.append(libpallet.evaluate(tmp_order, tmp, sys.argv[2]))
|
||||
os.close(tmp_fh)
|
||||
os.close(tmp_order_fh)
|
||||
os.remove(tmp)
|
||||
os.remove(tmp_order)
|
||||
#print tmp_order, tmp
|
||||
print scores
|
||||
|
||||
print sum(scores)/len(scores)
|
@ -0,0 +1,12 @@
|
||||
import sys
|
||||
from util import xmlfiletodict, get_pallet, get_articles
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print "usage:", sys.argv[0], "order.xml"
|
||||
exit(1)
|
||||
|
||||
orderline = xmlfiletodict(sys.argv[1])
|
||||
pallet = get_pallet(orderline)
|
||||
articles = get_articles(orderline)
|
||||
|
||||
print len(articles)
|
@ -0,0 +1,20 @@
|
||||
import sys
|
||||
from util import xmlfiletodict
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print "usage:", sys.argv[0], "packlist.xml"
|
||||
exit(1)
|
||||
|
||||
d = xmlfiletodict(sys.argv[1])
|
||||
|
||||
pallets = d["Response"]["PackList"]["PackPallets"]["PackPallet"]
|
||||
|
||||
if not isinstance(pallets, list):
|
||||
pallets = [pallets]
|
||||
|
||||
num_articles = 0
|
||||
|
||||
for pallet in pallets:
|
||||
num_articles += len(pallet["Packages"]["Package"])
|
||||
|
||||
print num_articles
|
@ -0,0 +1,25 @@
|
||||
import sys
|
||||
from util import xmlfiletodict, get_articles
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 2:
|
||||
print "usage:", sys.argv[0], "order.xml"
|
||||
exit(1)
|
||||
|
||||
d = xmlfiletodict(sys.argv[1])
|
||||
|
||||
pallets = d['Message']['PalletInit']['Pallets']['Pallet']
|
||||
|
||||
if not isinstance(pallets, list):
|
||||
pallets = [pallets]
|
||||
|
||||
for p in pallets:
|
||||
print "\t".join([
|
||||
p['Dimensions']['Length'],
|
||||
p['Dimensions']['Width'],
|
||||
p['Dimensions']['MaxLoadHeight'],
|
||||
p['Dimensions']['MaxLoadWeight']
|
||||
])
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
Reference in New Issue