Exemple #1
0
 def confirm_issue():
     global p_sn, p_partno, p_qty
     issue_qty = eval(e_issue_qty.get())
     go_next = tk.messagebox.askyesno(
         '提示',
         '你选择了出库包装:{0},物料号为:{1},数量为:{2}'.format(p_sn, p_partno, issue_qty) +
         '。确定出库?')
     if go_next:
         l_show_content.set("正在出库...")
         if p_sn and issue_qty and p_user:
             if issue_qty > p_qty or issue_qty <= 0:
                 tk.messagebox.showerror('错误', "出库数量不正确。")
             else:
                 retVar = run_oracle_function('goods_issue',
                                              [p_sn, issue_qty, p_user])
                 print(retVar)
                 if retVar == '0':
                     tk.messagebox.showinfo('成功', '出库操作完成!')
                     l_show_content.set('扫描下一个需要出库的包装二维码')
                     label_content.set('')
                     e_issue_qty.set('')
                 else:
                     tk.messagebox.showerror('错误', '出库异常。联系系统管理员。')
         else:
             tk.messagebox.showerror('错误', '出库信息不完整!')
     else:
         pass
 def bind():
     p_loc = e_warehouse_2.get()
     p_subloc = e_location_2.get()
     ret = run_oracle_function('bind_locations', [p_loc, p_subloc, p_user])
     if ret == '0':
         tk.messagebox.showinfo('成功', '库位结构添加成功!')
     else:
         tk.messagebox.showerror(
             '错误', '库存区域/地点{}已经存在于仓库{}下!'.format(p_subloc, ret))
 def unbind():
     p_loc = e_warehouse_3.get()
     p_subloc = e_location_3.get()
     ret = run_oracle_function('unbind_locations',
                               [p_loc, p_subloc, p_user])
     if ret == '0':
         tk.messagebox.showinfo('成功', '库位结构删除成功!')
     elif ret == '2':
         tk.messagebox.showerror('错误', '库存地点/区域下还有库存,不允许修改库位结构!')
     else:
         tk.messagebox.showerror('错误', '发生其他异常,请检查或联系系统管理员')
 def new():
     p_loc = e_loc_1.get()
     p_loc_descr = e_loc_descr1.get()
     dict = {'仓库': 'Warehouse', '库存区域': 'AREA', '库存地点': 'STO'}
     p_loc_type = dict.get(e_loc_type1.get(), 'unknown')
     ret = run_oracle_function('create_locations',
                               [p_loc, p_loc_descr, p_loc_type, p_user])
     if ret == '0':
         tk.messagebox.showinfo('成功', '库位信息添加成功!')
     elif ret == '2':
         tk.messagebox.showerror('错误', '该位置已存在!')
     else:
         tk.messagebox.showerror('错误', '发生其他异常,请检查重试或联系管理员')
     refresh_list()
 def delete():
     p_loc = e_loc_1.get()
     p_loc_descr = e_loc_descr1.get()
     dict = {'仓库': 'Warehouse', '库存区域': 'AREA', '库存地点': 'STO'}
     p_loc_type = dict.get(e_loc_type1.get(), 'unknown')
     ret = run_oracle_function('delete_locations',
                               [p_loc, p_loc_descr, p_loc_type, p_user])
     if ret == '0':
         tk.messagebox.showinfo('成功', '库位信息删除成功!')
     elif ret == '2':
         tk.messagebox.showerror('错误', '该位置已存在库位结构中,若要删除,先移除库位结构关系')
     elif ret == '3':
         tk.messagebox.showerror('错误', '该位置上还有库存,不能直接删除库存地点')
     else:
         tk.messagebox.showerror('错误', '发生其他异常,请检查重试或联系管理员')
     refresh_list()
 def update():
     p_partno = e_partno.get()
     p_descr = e_descr.get()
     p_unit = e_unit.get()
     p_min = e_min.get()
     p_max = e_max.get()
     p_warrenty = e_warrenty.get()
     p_supplier = e_supplier.get()
     p_invalid = e_invalid.get()
     p_shelf = e_shelf.get()
     p_serial = e_serial.get()
     ret = run_oracle_function('update_parts', [
         p_partno, p_descr, p_unit, p_min, p_max, p_warrenty, p_supplier,
         p_invalid, p_shelf, p_serial, p_user
     ])
     if ret == '0':
         tk.messagebox.showinfo('成功', '物料信息更新成功!')
     elif ret == '2':
         tk.messagebox.showerror('错误', '物料号不存在')
     elif ret == '3':
         tk.messagebox.showerror('错误', '物料要求保质期管理,必须输入保质期(天数)')
     else:
         tk.messagebox.showerror('错误', '发生其他异常,请检查重试或者联系管理员')