Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests, sys, time, os, pickle, gc
- from flask import Flask, render_template, request
- def gettextfromfile(filename):
- fin = open(filename, 'r')
- textinfile = fin.read()
- fin.close()
- return textinfile
- def getlinesfromfile(filename):
- fin = open(filename, 'r')
- linesoffile = fin.read().splitlines()
- fin.close()
- return linesoffile
- def runGCIfNeeded(iterations, max_iterations):
- if iterations==max_iterations:
- print("Running GC..")
- gc.collect()
- return 0
- else:
- return iterations
- def save_string(filename, string_to_save):
- fout = open(filename, 'w')
- fout.write(string_to_save)
- fout.close()
- def save_string_append(filename, e_str):
- fappend = open(filename, 'a')
- fappend.write(e_str)
- fappend.close()
- def save_list(filename, blocklist):
- fout = open(filename, 'w')
- for l in blocklist:
- fout.write(l)
- fout.close()
- def save_object(filename, the_object):
- subfile = open(filename, 'wb')
- pickle.dump(the_object, subfile)
- subfile.close()
- def load_object(filename):
- subfile = open(filename, 'rb')
- the_object = pickle.load(subfile)
- subfile.close()
- return the_object
- def loadpicklelist(filename):
- if os.path.isfile(filename):
- return load_object(filename)
- else:
- return list()
- def DeleteFile(filename):
- if os.path.isfile(filename):
- os.remove(filename)
- def IsInList(item, list_two):
- for l in list_two:
- if l == item:
- return 1
- return 0
- class ToteAdder:
- sometotes = list()
- currentpos = 1
- def ChangeRoom(theroom):
- if theroom == 'Ambient':
- return 'Refrigerated'
- elif theroom == 'Refrigerated':
- return 'Frozen'
- elif theroom == 'Frozen':
- return 'Ambient'
- def ChangeArea(thearea, theroom):
- if thearea == 'A':
- return 'A Overflow'
- elif thearea == 'A Overflow':
- return 'B'
- elif thearea == 'B':
- return 'B Overflow'
- elif thearea == 'B Overflow':
- return 'C'
- elif thearea == 'C':
- return 'C Overflow'
- elif thearea == 'C Overflow' and theroom == 'Ambient':
- return 'Oversized Overflow'
- elif thearea == 'C Overflow' and theroom != 'Ambient':
- return 'A'
- elif thearea == 'Oversized Overflow':
- return 'A'
- def AddTotes():
- rawtotes = []
- thetotes = []
- num = 1
- area = 'A'
- room = 'Ambient'
- rawtotes = getlinesfromfile('rawtotes.txt')
- index = 0
- temptote = ''
- totelen = len(rawtotes)
- while index<totelen:
- if rawtotes[index] == 'n':
- num = num + 1
- elif rawtotes[index] == 'a':
- area = ChangeArea(area, room)
- num = 1
- elif rawtotes[index] == 'r':
- room = ChangeRoom(room)
- num = 1
- else:
- temptote = rawtotes[index] + ' in ' + room + ' ' + area + str(num)
- thetotes.append(temptote)
- index = index + 1
- save_object("thetotes.pickle", thetotes)
- def PrintTotes():
- thetotes = loadpicklelist('thetotes.pickle')
- print(thetotes)
- AddTotes()
- PrintTotes()
- import requests, sys, time, os, pickle, gc
- def gettextfromfile(filename):
- fin = open(filename, 'r')
- textinfile = fin.read()
- fin.close()
- return textinfile
- def getlinesfromfile(filename):
- fin = open(filename, 'r')
- linesoffile = fin.read().splitlines()
- fin.close()
- return linesoffile
- def runGCIfNeeded(iterations, max_iterations):
- if iterations==max_iterations:
- print("Running GC..")
- gc.collect()
- return 0
- else:
- return iterations
- def save_string(filename, string_to_save):
- fout = open(filename, 'w')
- fout.write(string_to_save)
- fout.close()
- def save_string_append(filename, e_str):
- fappend = open(filename, 'a')
- fappend.write(e_str)
- fappend.close()
- def save_list(filename, blocklist):
- fout = open(filename, 'w')
- for l in blocklist:
- fout.write(l)
- fout.close()
- def save_object(filename, the_object):
- subfile = open(filename, 'wb')
- pickle.dump(the_object, subfile)
- subfile.close()
- def load_object(filename):
- subfile = open(filename, 'rb')
- the_object = pickle.load(subfile)
- subfile.close()
- return the_object
- def loadpicklelist(filename):
- if os.path.isfile(filename):
- return load_object(filename)
- else:
- return list()
- def DeleteFile(filename):
- if os.path.isfile(filename):
- os.remove(filename)
- def IsInList(item, list_two):
- for l in list_two:
- if l == item:
- return 1
- return 0
- thetotes = loadpicklelist('thetotes.pickle')
- while True:
- ordernumber = raw_input("\nEnter an order number:")
- for t in thetotes:
- if (t.find(ordernumber) > -1):
- print(t)
- rawtotes.txt
- 6848
- 6830
- 6817
- n
- 6806
- 6905
- 6806
- 6995
- 6894
- 6813
- n
- 6976
- 6810
- n
- n
- 6802
- 6809
- 6810
- 6894
- n
- 6904
- 6864
- 6907
- 6978
- 6910
- n
- 6817
- 6894
- n
- 6907
- 6842
- 6849
- 6905
- n
- 6839
- 6982
- 6847
- 6845
- n
- 6849
- 6806
- 6102
- 5688
- a
- 6842
- 6910
- 6982
- a
- a
- a
- a
- a
- a
- r
- 6907
- 6830
- 6102
- 5688
- 5649
- n
- 6848
- 6847
- 6809
- n
- 6849
- 6817
- 6839
- 6976
- n
- 6849
- 6995
- 6802
- 6845
- n
- 6905
- 6910
- 6806
- 6904
- n
- 6806
- 6810
- n
- 6806
- 6982
- 6817
- n
- a
- 6894
- r
- r
- a
- 6971
- 6998
- n
- 6811
- 6833
- n
- 6822
- n
- 6828
- n
- 6823
- 6912
- n
- 6858
- 6801
- 6897
- n
- 6908
- 6859
- 6827
- 6837
- n
- 6850
- 6809
- n
- 6912
- 6003
- 6855
- n
- 6855
- 6899
- 6805
- 6853
- n
- 6850
- 6856
- 6914
- 6852
- 6911
- a
- 6842
- 6982
- n
- 6857
- 6805
- 6857
- 6998
- 6983
- r
- a
- a
- a
- a
- a
- 6855
- 6805
- 6908
- 6850
- n
- 6833
- 6907
- 6859
- 6897
- n
- 6801
- 6852
- 6858
- 6899
- 6811
- 6912
- 6864
- 6998
- n
- 6853
- n
- 6828
- 6857
- 6856
- 6827
- n
- 6837
- 6983
- 6971
- n
- 6823
- 6003
- a
- a
- r
- r
- 6867
- 6903
- 6841
- n
- 6863
- 6871
- 6005
- 6825
- n
- 6826
- 6861
- 6836
- n
- 6866
- 6834
- 6821
- n
- 6871
- 6869
- 6838
- n
- 6835
- 6902
- 6898
- n
- 6865
- 6840
- 6866
- n
- 6862
- 6870
- 6862
- 6869
- n
- 6867
- 6871
- 6826
- 5737
- n
- 6840
- n
- 6900
- n
- 6867
- 6866
- n
- 6870
- 6846
- n
- 6898
- 6832
- 6900
- n
- 6836
- 6834
- r
- 6840
- 6872
- n
- 6834
- 6835
- 6865
- 6826
- n
- 6866
- n
- 6866
- 6870
- 6861
- 6838
- n
- 6871
- 5737
- 6825
- 6821
- n
- 6869
- 6832
- 6005
- 6867
- a
- 6838
- 6902
- 69pp
- n
- 6836
- 6903
- 6846
- n
- 6834
- 6898
- 6841
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement