コード例 #1
0
ファイル: logistics.py プロジェクト: abbddos/Enterprise_1
def edit_transaction(transid):
    wh = EnterpriseAPI.GetWareHouses()
    warehouse = EnterpriseAPI.GetWareHouses()
    trans = EnterpriseAPI.GetTrans()
    head, details = EnterpriseAPI.TransInfo(transid)
    rqst = EnterpriseAPI.ApprRequests()
    if request.method == 'POST':
        if request.form['submit'] == 'Submit':
            try:
                EnterpriseAPI.UpdateTransaction(
                    session['username'], session['password'], transid,
                    request.form['transaction-status'],
                    request.form['comments'])
                flash('Transaction updated...', category='success')
                return redirect(url_for('logistics.transactions'))
            except Exception as e:
                flash('Cannot to update a Complete or Canceled transacction.',
                      category='fail')
                return redirect(
                    url_for('logistics.edit_transaction', transid=transid))
    return render_template('logistics/edit-transaction.html',
                           username=session['username'],
                           role=session['role'],
                           warehouse=warehouse,
                           wh=wh,
                           trans=trans,
                           head=head,
                           details=details,
                           rqst=rqst)
コード例 #2
0
ファイル: logistics.py プロジェクト: abbddos/Enterprise_1
def transactions():
    itms = EnterpriseAPI.ItemPicker()
    pkgs = EnterpriseAPI.PackagePicker()
    wh = EnterpriseAPI.GetWareHouses()
    warehouse = EnterpriseAPI.GetWareHouses()
    trans = EnterpriseAPI.GetTrans()
    rqst = EnterpriseAPI.ApprRequests()
    if request.method == 'POST':
        if request.form['submit'] == 'Submit':
            try:
                if request.form['transaction-type'] == 'Inbound':
                    transid = EnterpriseAPI.InboundTransaction(
                        session['username'], session['password'],
                        request.form.getlist('Name'),
                        request.form.getlist('code'),
                        request.form['warehouse'],
                        request.form.getlist('bins'),
                        request.form.getlist('unit'),
                        request.form.getlist('quantity'),
                        request.form['transaction-status'],
                        request.form['comments'])
                    flash('Inbound transaction recorded...',
                          category='success')
                    return redirect(url_for('logistics.transactions'))

                elif request.form['transaction-type'] == 'Outbound':
                    transid = EnterpriseAPI.OutboundTransaction(
                        session['username'], session['password'],
                        request.form.getlist('Name'),
                        request.form.getlist('code'),
                        request.form['warehouse'],
                        request.form.getlist('bins'),
                        request.form.getlist('unit'),
                        request.form.getlist('quantity'),
                        request.form['transaction-status'],
                        request.form['comments'])
                    flash('Outbound transaction recorded...',
                          category='success')
                    return redirect(url_for('logistics.transactions'))
            except Exception as e:
                flash(str(e), category='fail')
                return redirect(url_for('logistics.transactions'))
    return render_template('logistics/transactions.html',
                           username=session['username'],
                           role=session['role'],
                           itms=itms,
                           pkgs=pkgs,
                           warehouse=warehouse,
                           wh=wh,
                           trans=trans,
                           rqst=rqst)