示例#1
0
def edit_pallet_location(wh, plid):
    pl_name = admpal.select_palletloc_name(plid)
    if request.POST.get("update-pallet-location"):
        locname = request.POST.get("location-name")
        err = admpal.update_palletloc_name(plid, locname, wh)
        if err:
            err = "pallet location name {0} already in use.".format(locname)
            return dict(pl_name=pl_name, wh=wh, plid=plid, err=err)
        else:
            url = whu.gen_route("/{0}/pallet-locations/edit-{1}".format(
                wh, plid))
            redirect(url)
    return dict(pl_name=pl_name, wh=wh, plid=plid, err=None)
示例#2
0
def edit_pallet_location(wh, plid):
    pl_name = admpal.select_palletloc_name(plid)
    if request.POST.get("update-pallet-location"):
        locname = request.POST.get("location-name")
        err = admpal.update_palletloc_name(plid, locname, wh)
        if err:
            err = "pallet location name {0} already in use.".format(locname)
            return dict(pl_name = pl_name, wh = wh, plid = plid,
                        err = err)
        else:
            url = whu.gen_route("/{0}/pallet-locations/edit-{1}".format(wh, plid))
            redirect(url)
    return dict(pl_name = pl_name, wh = wh, plid = plid, err = None)
示例#3
0
def delete_pallet_location(wh, plid):
    check_admin()
    adm.delete_palletloc(plid)
    url = whu.gen_route("/{0}/pallet-locations".format(wh))
    redirect(url)
示例#4
0
# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

from route_utils import *
import routes.admin.wh.wh_utils as whu

@route(whu.gen_route("/<wh>/add-pallet-locations"))
@post(whu.gen_route("/<wh>/add-pallet-locations"))
@view(whu.gen_view("add_pallet_location"))
def add_pallet_location(wh):
    check_admin()
    wh_info = adm.select_warehouse_info(wh)
    if not wh_info:
        return error404("err")

    whu.check_bm(wh_info[0][6])
    if request.POST.get("add-pallet-location"):
        location_name = request.POST.get("location-name")
        err = adm.insert_pallet_location(wh, location_name)
        if err:
            err = "{0} already exists".format(location_name)
            return dict(wh_info = wh_info, message = err)
        else:
            message = "Added {0}".format(location_name)
            return dict(wh_info = wh_info, message = message)

    elif request.POST.get("upload"):
        locfile = request.POST.get("loc-file")
        message = whu.upload_csv(adm.bulk_load_palletlocs, locfile, wh)
        return dict(wh_info = wh_info, message = message)

    else:
示例#5
0
            return dict(wh_err=err,
                        new_warehouse=warehouse_name,
                        wh_types=wh_types)

        if wh_id:
            wh_err = "{0} already exists. Try another ID".format(warehouse_id)
            return dict(new_warehouse=warehouse_name,
                        wh_types=wh_types,
                        wh_err=wh_err)
        admwh.insert_warehouse(warehouse_id, warehouse_name, street, state,
                               zip, country, warehouse_type)
        return dict(new_warehouse=warehouse_name, wh_types=wh_types)
    return dict(wh_types=wh_types)


@route(whu.gen_route("/<wh>"))
@post(whu.gen_route("/<wh>"))
@view(whu.gen_view("manage_warehouses_whinfo"), err=None)
@check_user
@check_admin
def manage_warehouses(wh):
    wh_info = admwh.select_warehouse_info(wh)
    if request.POST.get("update-warehouse"):
        wh_id = request.POST.get("wh-id")
        wh_name = request.POST.get("wh-name")
        wh_street = request.POST.get("wh-street")
        wh_state = request.POST.get("wh-state")
        wh_zip = request.POST.get("wh-zip")
        wh_country = request.POST.get("wh-country")

        if " " in wh_id:
示例#6
0
# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

from route_utils import *
import routes.admin.wh.wh_utils as whu

@route(whu.gen_route("/<wh>/add-picking-locations"))
@post(whu.gen_route("/<wh>/add-picking-locations"))
@view(whu.gen_view("add_picking_location"))
def add_picking_location(wh):
    check_admin()
    wh_info = adm.select_warehouse_info(wh)
    if not wh_info:
        return erro404("err")

    whu.check_bm(wh_info[0][6])
    if request.POST.get("add-picking-location"):
        location_name = request.POST.get("location-name")
        upc = request.POST.get("upc")
        err = adm.insert_picking_location(wh, location_name, upc)
        if err:
            err = "{0} already exists".format(location_name)
            return dict(wh_info = wh_info, message = err)
        else:
            message = "Added {0}".format(location_name)
            return dict(wh_info = wh_info, message = message)

    elif request.POST.get("upload"):
        locfile = request.POST.get("loc-file")
        message = upload_csv(adm.bulk_load_pickinglocs, locfile, wh)
        return dict(wh_info = wh_info, message = message)
示例#7
0
            return dict (wh_err = err,
                         new_warehouse = warehouse_name,
                         wh_types = wh_types)

        if wh_id:
            wh_err = "{0} already exists. Try another ID".format(warehouse_id)
            return dict(new_warehouse = warehouse_name,
                        wh_types = wh_types, wh_err = wh_err)
        admwh.insert_warehouse(warehouse_id, warehouse_name, street,
                             state,
                         zip, country, warehouse_type)
        return dict(new_warehouse = warehouse_name,
                    wh_types = wh_types)
    return dict(wh_types = wh_types)

@route(whu.gen_route("/<wh>"))
@post(whu.gen_route("/<wh>"))
@view(whu.gen_view("manage_warehouses_whinfo"), err = None)
@check_user
@check_admin
def manage_warehouses(wh):
    wh_info = admwh.select_warehouse_info(wh)
    if request.POST.get("update-warehouse"):
        wh_id = request.POST.get("wh-id")
        wh_name = request.POST.get("wh-name")
        wh_street = request.POST.get("wh-street")
        wh_state = request.POST.get("wh-state")
        wh_zip = request.POST.get("wh-zip")
        wh_country = request.POST.get("wh-country")

        if " " in wh_id:
示例#8
0
# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

from route_utils import *
import routes.admin.wh.wh_utils as whu

@route(whu.gen_route("/add-warehouse"))
@post(whu.gen_route("/add-warehouse"))
@view(whu.gen_view("/add_warehouse"), wh_err = None)
def add_warehouse():
    check_admin()
    wh_types = adm.select_warehouse_types()
    if request.POST.get("add-warehouse"):
        warehouse_id = request.POST.get("warehouse-id")
        warehouse_name = request.POST.get("warehouse-name")
        street = request.POST.get("street")
        state = request.POST.get("state")
        zip = request.POST.get("zip_code")
        country = request.POST.get("country")
        warehouse_type = request.POST.get("wh-type")
        wh_id = adm.select_warehouse_id(warehouse_id)

        if " " in warehouse_id:
            err = "Warehouse ID has spaces in it."
            return dict (wh_err = err,
                         new_warehouse = warehouse_name,
                         wh_types = wh_types)

        if wh_id:
            wh_err = "{0} already exists. Try another ID".format(warehouse_id)
            return dict(new_warehouse = warehouse_name,
                        wh_types = wh_types, wh_err = wh_err)
示例#9
0
def delete_pallet_location(wh, plid):
    admpal.delete_palletloc(plid)
    url = whu.gen_route("/{0}/pallet-locations".format(wh))
    redirect(url)
示例#10
0
# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

from route_utils import *
import routes.admin.wh.wh_utils as whu


@route(whu.gen_route("/<wh>/add-pallet-locations"))
@post(whu.gen_route("/<wh>/add-pallet-locations"))
@view(whu.gen_view("add_pallet_location"))
@check_admin
def add_pallet_location(wh):
    wh_info = admwh.select_warehouse_info(wh)
    if not wh_info:
        return error404("err")

    whu.check_bm(wh_info[0][6])
    if request.POST.get("add-pallet-location"):
        location_name = request.POST.get("location-name")
        err = admpal.insert_pallet_location(wh, location_name)
        if err:
            err = "{0} already exists".format(location_name)
            return dict(wh_info=wh_info, message=err)
        else:
            message = "Added {0}".format(location_name)
            return dict(wh_info=wh_info, message=message)

    elif request.POST.get("upload"):
        locfile = request.POST.get("loc-file")
        message = whu.upload_csv(admpal.bulk_load_palletlocs, locfile, wh)
        return dict(wh_info=wh_info, message=message)
示例#11
0
# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

from route_utils import *
import routes.admin.wh.wh_utils as whu


@route(whu.gen_route("/<wh>/add-picking-locations"))
@post(whu.gen_route("/<wh>/add-picking-locations"))
@view(whu.gen_view("add_picking_location"))
@check_admin
def add_picking_location(wh):
    wh_info = admwh.select_warehouse_info(wh)
    if not wh_info:
        return erro404("err")

    whu.check_bm(wh_info[0][6])

    d = {"wh": wh}

    if request.POST.get("add-picking-location"):
        d["plname"] = request.POST.get("location-name")
        d["upc"] = request.POST.get("upc")
        err = admpic.insert_picking_location(d)
        if err:
            err = "{0} already exists".format(location_name)
            return dict(wh_info=wh_info, message=err)
        else:
            message = "Added {0}".format(d["plname"])
            return dict(wh_info=wh_info, message=message)

    elif request.POST.get("upload"):