示例#1
0
def maintain():
    vm = MaintainVM()
    vm.plant = 'GHUO'
    if 'plant' in request.form:
        vm.plant = request.form['plant']

    wos = repository.get_all_wo_status(vm.plant, host=HOST, port=PORT, db=DB)
    vm.wos = wos
    vm.wo_nos = sorted(wos.keys())

    return render_template('maintain.html', vm=vm)
示例#2
0
def close_all_wos():
    # 1.删除所有
    if request.form.get('btnclose'):
        keys = request.form.getlist('hidcloseall')
        vm = MaintainVM()
        vm.plant = keys[0]
        if 'plant' in request.form:
            vm.plant = request.form['plant']
        wos = repository.get_all_wo_status(vm.plant,
                                           host=HOST,
                                           port=PORT,
                                           db=DB)
        vm.wos = wos
        vm.wo_nos = sorted(wos.keys())  # ['000060030987', '000060030988']
        for wo in vm.wo_nos:
            result = repository.del_key('%s:%s' % (vm.plant, wo),
                                        host=HOST,
                                        port=PORT,
                                        db=DB)
        return render_template('maintain.html', vm=vm)
示例#3
0
def index_query():
    vm = MaintainVM()
    vm.plant = 'GHUO'
    keys = []
    if 'plant' in request.form:
        vm.plant = request.form['plant']
    wos = repository.get_all_wo_status(vm.plant,
                                       host=HOST,
                                       port=PORT,
                                       db=store_DB)
    vm.wos = wos
    vm.wo_nos = sorted(wos.keys())
    stations = set([])
    for wo_no in vm.wo_nos:
        stations = stations.union(vm.wos[wo_no].status.keys())
    kf = sfc.SortKeyFinder(r'.\static\station.json')
    vm.stations = sorted(stations, key=lambda s: kf.get_key(s))
    merger = sfc.StationMerger(r'.\static\merge.json')
    vm.c_stations = merger.merger(vm.stations)
    if request.method == 'post':
        return render_template('query_redis.html', vm=vm, keys=keys)
    return render_template('query_redis.html', vm=vm, keys=keys)
示例#4
0
def close_part_wos():
    # 1.批量删除
    if request.form.get('clspart'):
        keys = request.form.getlist('hidclosepart')
        vm = MaintainVM()
        vm.plant = keys[0]
        wos = repository.get_all_wo_status(vm.plant,
                                           host=HOST,
                                           port=PORT,
                                           db=DB)
        vm.wos = wos
        vm.wo_nos = sorted(wos.keys())
        part_list = request.form.getlist('CheckPart')
        if 'plant' in request.form:
            vm.plant = request.form['plant']
        for wo in part_list:
            result = repository.del_key('%s:%s' % (vm.plant, wo),
                                        host=HOST,
                                        port=PORT,
                                        db=DB)

        return render_template('maintain.html', vm=vm)