EricGEGE commited on
Commit
d98975d
·
verified ·
1 Parent(s): 8b3e028

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -10
app.py CHANGED
@@ -32,7 +32,8 @@ def init_sheets():
32
  ['3', 'cevcaiwu369', '财务'],
33
  ['4', 'cevboss888', '总经理'],
34
  ['5', 'cevcaigou357', '采购'],
35
- ['6', 'investor888', '观察员']
 
36
  ]
37
  for user in new_users:
38
  users.append_row(user)
@@ -53,10 +54,10 @@ init_sheets()
53
  def get_next_approval_status(current_status):
54
  try:
55
  if current_status == '待单证审批':
 
 
56
  return '待财务审批'
57
  elif current_status == '待财务审批':
58
- return '待总经理审批'
59
- elif current_status == '待总经理审批':
60
  return '已批准'
61
  return current_status
62
  except Exception as e:
@@ -75,8 +76,8 @@ def approve_order(order_id, approver_role):
75
  current_status = order_records[order_index]['审批状态']
76
 
77
  if (current_status == '待单证审批' and approver_role != '单证') or \
78
- (current_status == '待财务审批' and approver_role != '财务') or \
79
- (current_status == '待总经理审批' and approver_role != '总经理'):
80
  return f'只有{current_status}角色可以批准当前订单'
81
 
82
  next_status = get_next_approval_status(current_status)
@@ -117,7 +118,7 @@ def submit_order(
117
  global profit
118
  login(username)
119
 
120
- if session_state['role'] != '采购':
121
  return "只有采购角色可以提交订单"
122
 
123
  orders = sheet.worksheet(PURCHASE_ORDERS_SHEET)
@@ -175,7 +176,7 @@ def display_orders(username):
175
  login(username)
176
  allowed_roles = [
177
  '采购', '单证', '财务',
178
- '总经理', '观察员'
179
  ]
180
 
181
  if session_state['role'] not in allowed_roles:
@@ -199,7 +200,7 @@ def approve_order_interface(username, order_id):
199
  try:
200
  login(username)
201
 
202
- allowed_roles = ['单证', '财务', '总经理']
203
 
204
  if session_state['role'] not in allowed_roles:
205
  return "您没有批准订单的权限"
@@ -227,7 +228,7 @@ with gr.Blocks() as app:
227
  '采车定金','采车定金(抵车款)','采车定金(全额退回)','采车定金(部分退回)',
228
  '采车尾款(含背户费)','采车尾款','背户手续费','系统刷机费','充电桩费',
229
  '保险费(短期交强)','保险费(长期交强)','保险费(全险)' ,'国内运费(市内)','国内运费',
230
- '购置税费','仓储费','检测报告费','车辆用品费','车辆改装费','港杂费','海运费','海运费+港杂费','其他费用'
231
  ],
232
  label="费用名称")
233
  费用金额 = gr.Textbox(label="费用金额")
@@ -273,4 +274,4 @@ with gr.Blocks() as app:
273
  approve_order_output = gr.HTML(label="输出")
274
  approve_order_button.click(fn=approve_order_interface, inputs=[username_approve, order_id], outputs=approve_order_output)
275
 
276
- app.launch()
 
32
  ['3', 'cevcaiwu369', '财务'],
33
  ['4', 'cevboss888', '总经理'],
34
  ['5', 'cevcaigou357', '采购'],
35
+ ['6', 'investor888', '观察员'],
36
+ ['7', 'cevcaigou888', '采购经理']
37
  ]
38
  for user in new_users:
39
  users.append_row(user)
 
54
  def get_next_approval_status(current_status):
55
  try:
56
  if current_status == '待单证审批':
57
+ return '待采购经理/总经理审批'
58
+ elif current_status == '待采购经理/总经理审批':
59
  return '待财务审批'
60
  elif current_status == '待财务审批':
 
 
61
  return '已批准'
62
  return current_status
63
  except Exception as e:
 
76
  current_status = order_records[order_index]['审批状态']
77
 
78
  if (current_status == '待单证审批' and approver_role != '单证') or \
79
+ (current_status == '待采购经理/总经理审批' and approver_role not in ['采购经理', '总经理']) or \
80
+ (current_status == '待财务审批' and approver_role != '财务'):
81
  return f'只有{current_status}角色可以批准当前订单'
82
 
83
  next_status = get_next_approval_status(current_status)
 
118
  global profit
119
  login(username)
120
 
121
+ if session_state['role'] not in ['采购', '采购经理']:
122
  return "只有采购角色可以提交订单"
123
 
124
  orders = sheet.worksheet(PURCHASE_ORDERS_SHEET)
 
176
  login(username)
177
  allowed_roles = [
178
  '采购', '单证', '财务',
179
+ '总经理', '观察员', '采购经理'
180
  ]
181
 
182
  if session_state['role'] not in allowed_roles:
 
200
  try:
201
  login(username)
202
 
203
+ allowed_roles = ['单证', '财务', '总经理', '采购经理']
204
 
205
  if session_state['role'] not in allowed_roles:
206
  return "您没有批准订单的权限"
 
228
  '采车定金','采车定金(抵车款)','采车定金(全额退回)','采车定金(部分退回)',
229
  '采车尾款(含背户费)','采车尾款','背户手续费','系统刷机费','充电桩费',
230
  '保险费(短期交强)','保险费(长期交强)','保险费(全险)' ,'国内运费(市内)','国内运费',
231
+ '购置税费','仓储费','检测报告费','车辆用品费','车辆改装费','港杂费','海运费','海运费+港杂费','其他费用'
232
  ],
233
  label="费用名称")
234
  费用金额 = gr.Textbox(label="费用金额")
 
274
  approve_order_output = gr.HTML(label="输出")
275
  approve_order_button.click(fn=approve_order_interface, inputs=[username_approve, order_id], outputs=approve_order_output)
276
 
277
+ app.launch(auth=("cevauto", "888"))