提交 c8d9c597 authored 作者: 贺阳's avatar 贺阳

提货扫码查询提单时优化: 关务节点的package_state为空 或者 package_state的tally_state不在已提货/已理货/尾程交接状态

上级 fffc3ac5
...@@ -626,7 +626,8 @@ class OrderController(http.Controller): ...@@ -626,7 +626,8 @@ class OrderController(http.Controller):
'zh': '系统解析错误,错误原因是%s' % e 'zh': '系统解析错误,错误原因是%s' % e
} }
logging.info('last_mile_delivery error:%s' % e) logging.info('last_mile_delivery error:%s' % e)
res['message'] = exceptions_msg_dic[pda_lang] # _('System parsing error, the reason for the error is %s', e) # 系统解析错误,错误原因是 res['message'] = exceptions_msg_dic[
pda_lang] # _('System parsing error, the reason for the error is %s', e) # 系统解析错误,错误原因是
logging.info('last_mile_delivery res:%s' % res) logging.info('last_mile_delivery res:%s' % res)
return res return res
...@@ -768,7 +769,8 @@ class OrderController(http.Controller): ...@@ -768,7 +769,8 @@ class OrderController(http.Controller):
current_time = request.env['common.common'].sudo().get_utc_time(datetime.now()) current_time = request.env['common.common'].sudo().get_utc_time(datetime.now())
operation_time = latest_pickup_record.operation_time operation_time = latest_pickup_record.operation_time
time_diff = (datetime.strptime(current_time, '%Y-%m-%d %H:%M:%S') - operation_time).total_seconds() / 60 time_diff = (datetime.strptime(current_time, '%Y-%m-%d %H:%M:%S') - operation_time).total_seconds() / 60
logging.info(f"tally_time_check current_time: {current_time}, pickup_time: {operation_time}, time_diff: {time_diff}") logging.info(
f"tally_time_check current_time: {current_time}, pickup_time: {operation_time}, time_diff: {time_diff}")
# 如果时间差小于等于配置的参数,则存在风险 # 如果时间差小于等于配置的参数,则存在风险
if time_diff <= allowed_minutes: if time_diff <= allowed_minutes:
...@@ -838,7 +840,8 @@ class OrderController(http.Controller): ...@@ -838,7 +840,8 @@ class OrderController(http.Controller):
current_time = request.env['common.common'].sudo().get_utc_time(datetime.now()) current_time = request.env['common.common'].sudo().get_utc_time(datetime.now())
operation_time = latest_record.operation_time operation_time = latest_record.operation_time
time_diff = (datetime.strptime(current_time, '%Y-%m-%d %H:%M:%S') - operation_time).total_seconds() / 60 time_diff = (datetime.strptime(current_time, '%Y-%m-%d %H:%M:%S') - operation_time).total_seconds() / 60
logging.info(f"delivery_time_check current_time: {current_time}, operation_time: {operation_time}, time_diff: {time_diff}") logging.info(
f"delivery_time_check current_time: {current_time}, operation_time: {operation_time}, time_diff: {time_diff}")
# 如果时间差小于等于配置的参数,则存在风险 # 如果时间差小于等于配置的参数,则存在风险
if time_diff <= allowed_minutes: if time_diff <= allowed_minutes:
if pallet_name: if pallet_name:
...@@ -1315,9 +1318,14 @@ class OrderController(http.Controller): ...@@ -1315,9 +1318,14 @@ class OrderController(http.Controller):
# 查询符合条件的提单 # 查询符合条件的提单
# 1. 状态为未开始和清关中 # 1. 状态为未开始和清关中
# 2. 提单的关务节点状态不是已完成节点 # 2. 提单的关务节点状态不是已完成节点
bl_domain = [('state', 'in', ['draft', 'ccing']), ('customs_clearance_status.is_done', '=', False), ( # 3. 关务节点的package_state为空 或者 package_state的tally_state不在已提货/已理货/尾程交接状态
'customs_clearance_status.package_state.tally_state', 'not in', bl_domain = [
['picked_up', 'checked_goods', 'handover_completed'])] ('state', 'in', ['draft', 'ccing']),
('customs_clearance_status.is_done', '=', False),
'|', ('customs_clearance_status.package_state', '=', False), # package_state为空
('customs_clearance_status.package_state.tally_state', 'not in',
['picked_up', 'checked_goods', 'handover_completed']) # 或者tally_state不在指定状态
]
bl_objs = request.env['cc.bl'].sudo().search(bl_domain) bl_objs = request.env['cc.bl'].sudo().search(bl_domain)
if bl_objs: if bl_objs:
res['bl_arr'] = [bl_obj.search_bl_info(pda_lang=pda_lang, type='pickup', is_all=False) for bl_obj in res['bl_arr'] = [bl_obj.search_bl_info(pda_lang=pda_lang, type='pickup', is_all=False) for bl_obj in
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论