迭代查询,查询最高级别的单位,好处是看起来非常简单清晰
def setTopDepartSpinfo(spinfo,item,value,depart,comp):
# spinfo={"depart":,"comp":,"operator":,"upload":,"width":,"height":,"thickness":,"spformat":,"spcode":,"spname":,"barcode":,"_id"}
topDepart = getTopDepart(depart,comp)
if topDepart:
topDepartSpinfo = getSpinfo(item,value,topDepart,comp)
if not topDepartSpinfo:
spinfo = copyspinfo(spinfo,topDepart,comp)
# spinfo ={‘depart‘: , ‘spname‘: u‘‘, ‘comp‘:, ‘barcode‘: u‘‘, ‘upload‘:,‘thickness‘: , ‘height‘: , ‘spcode‘: u‘‘, ‘width‘: , ‘operator‘: ‘‘, ‘spformat‘: u‘‘, ‘_id‘: ‘‘}
return spinfo
return False
from flask.ext.cors import CORS
CORS(app)
result = [procimg(spcode, depart, comp, side, {"width": width, "height": height, "thickness": thickness}) for side in sides]
r.json() ??? json.loads(r)
sourcePath = "E:\\HGpicture"
targetPath = "D:\\img"
def getTargetPath(spcode,pos,depart,comp,side,picFormat):
pathSave = "\\{comp}\\{depart}\\{pos}\\{side}".format(comp=comp, depart=depart, pos=pos, side=side)
原文:http://www.cnblogs.com/wuqingzangyue/p/5770061.html