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

托盘理货的优化

上级 c8d9c597
......@@ -595,7 +595,7 @@ class OrderController(http.Controller):
res = {'state': 201, 'message': ''}
try:
logging.info('last_mile_tally kwargs:%s' % kwargs)
return self._get_last_mile_grouped('unprocessed_goods', pda_lang)
return self._get_last_mile_grouped(['unprocessed_goods', 'picked_up'], pda_lang)
except Exception as e:
exceptions_msg_dic = {
'en': 'System parsing error, the reason for the error is %s' % e,
......@@ -618,7 +618,7 @@ class OrderController(http.Controller):
try:
logging.info('last_mile_delivery kwargs:%s' % kwargs)
# 按尾程交货时,检查时间风险 大包或小包对应的提单是否已存在成功扫码记录
res = self._get_last_mile_grouped('checked_goods', pda_lang)
res = self._get_last_mile_grouped(['checked_goods', 'picked_up'], pda_lang)
return res
except Exception as e:
exceptions_msg_dic = {
......@@ -693,7 +693,7 @@ class OrderController(http.Controller):
logging.info('last_mile_tally_time_check res:%s' % res)
return res
def _get_last_mile_grouped(self, tally_state, pda_lang, is_pallet=False):
def _get_last_mile_grouped(self, tally_state_arr, pda_lang, is_pallet=False):
lang = 'zh_CN' if pda_lang == 'zh' else 'en_US' # 语言
# if is_pallet:
# domain=[('state', '!=', 'done')]# 1. 按托盘理货时,查非已完成状态的提单
......@@ -701,8 +701,8 @@ class OrderController(http.Controller):
# 先都查清关中的,如果以后要查非已完成状态的提单,再修改domain。而且查尾程快递和对应的大包或托盘信息得分两个接口
domain = [('bl_id.state', '=', 'ccing')] # 1. 按尾程理货时,查所有清关中提单
# 2. 查所有大包 如果是托盘的交货,不需要过滤理货状态
if not is_pallet or (is_pallet and tally_state == 'unprocessed_goods'):
domain += [('tally_state', '=', tally_state)]
if not is_pallet or (is_pallet and 'unprocessed_goods' in tally_state_arr):
domain += [('tally_state', 'in', tally_state_arr)]
big_packages = request.env['cc.big.package'].sudo().search(domain)
# 3. 按"下一阶段服务商名称"分组
group_dict = {}
......@@ -719,13 +719,14 @@ class OrderController(http.Controller):
group_dict[key]['ship_package_arr'] = [] # 小包信息
group_dict[key]['pallet_info_arr'] = [] # 托盘信息
group_dict[key]['count'] += 1
if tally_state == 'unprocessed_goods' or (tally_state == 'checked_goods' and not is_pallet):
group_dict[key]['big_package_arr'].append(
pkg.search_big_package_info(pda_lang=pda_lang, type=tally_state))
if 'unprocessed_goods' in tally_state_arr or ('checked_goods' in tally_state_arr and not is_pallet):
for tally_state in tally_state_arr:
group_dict[key]['big_package_arr'].append(
pkg.search_big_package_info(pda_lang=pda_lang, type=tally_state))
# 按托盘理货时返回未使用的托盘信息,按尾程时返回小包信息
if is_pallet:
# 如果是未理货,查未使用托盘;如果是已理货,查已使用托盘
if tally_state == 'unprocessed_goods':
if 'unprocessed_goods' in tally_state_arr:
domain = [('usage_state', '=', 'unused')]
else:
domain = [('usage_state', '=', 'used')]
......@@ -914,7 +915,7 @@ class OrderController(http.Controller):
res = {'state': 201, 'message': ''}
try:
logging.info('pallet_tally kwargs:%s' % kwargs)
return self._get_last_mile_grouped('unprocessed_goods', pda_lang, is_pallet=True)
return self._get_last_mile_grouped(['unprocessed_goods', 'picked_up'], pda_lang, is_pallet=True)
except Exception as e:
exceptions_msg_dic = {
'en': 'System parsing error, the reason for the error is %s' % e,
......@@ -937,7 +938,7 @@ class OrderController(http.Controller):
res = {'state': 201, 'message': ''}
try:
logging.info('pallet_handover kwargs:%s' % kwargs)
res = self._get_last_mile_grouped('checked_goods', pda_lang, is_pallet=True)
res = self._get_last_mile_grouped(['checked_goods', 'picked_up'], pda_lang, is_pallet=True)
except Exception as e:
exceptions_msg_dic = {
'en': 'System parsing error, the reason for the error is %s' % e,
......@@ -1015,12 +1016,12 @@ class OrderController(http.Controller):
package_obj.update_exception_info(
exception_cause_ids) # 修改异常信息
tally_time = package_item.get('tally_time')
if (action_type == 'tally' and package_item.get('tally_state') == 'checked_goods') or (
if (action_type == 'pickup' and package_item.get('tally_state') == 'picked_up') or (action_type == 'tally' and package_item.get('tally_state') == 'checked_goods') or (
action_type == 'handover' and package_item.get(
'tally_state') == 'handover_completed'):
for package in package_obj:
if (
action_type == 'tally' and package.tally_state == 'unprocessed_goods') or (
action_type == 'pickup' and package.tally_state == 'unprocessed_goods') or (action_type == 'tally' and package.tally_state == 'unprocessed_goods') or (
action_type == 'handover' and package.tally_state in (
'unprocessed_goods', 'checked_goods')):
ship_packages.append({
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论