Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
H
hh_ccs
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
贺阳
hh_ccs
Commits
a0778f4e
提交
a0778f4e
authored
1月 14, 2026
作者:
贺阳
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1、同步货站Pod和同步尾程的优化
上级
7b39af6c
全部展开
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
61 行增加
和
24 行删除
+61
-24
cc_bl_view.xml
ccs_base/views/cc_bl_view.xml
+8
-8
batch_get_lastmile_pod_info_wizard.py
ccs_base/wizard/batch_get_lastmile_pod_info_wizard.py
+0
-0
batch_get_pod_info_wizard.py
ccs_base/wizard/batch_get_pod_info_wizard.py
+23
-15
mail_push.py
consumers/mail_push.py
+30
-1
没有找到文件。
ccs_base/views/cc_bl_view.xml
浏览文件 @
a0778f4e
...
...
@@ -426,9 +426,9 @@
</field>
</record>
<!--
获取尾程快递POD
-->
<record
id=
"bl_
get_delivery_pod_info
_server_action"
model=
"ir.actions.server"
>
<field
name=
"name"
>
Batch
Get Last Mile POD Info
</field>
<!--
下载货站提货POD
-->
<record
id=
"bl_
download_pod
_server_action"
model=
"ir.actions.server"
>
<field
name=
"name"
>
Batch
Download PickUp POD
</field>
<field
name=
"model_id"
ref=
"model_cc_bl"
/>
<field
name=
"binding_model_id"
ref=
"model_cc_bl"
/>
<field
name=
"state"
>
code
</field>
...
...
@@ -436,13 +436,13 @@
<field
name=
"groups_id"
eval=
"[(4, ref('ccs_base.group_clearance_of_customs_user'))]"
/>
<field
name=
"code"
>
if records:
action = records.action_batch_
get_last_mile_pod_info(
)
action = records.action_batch_
download_pod('货站提货POD'
)
</field>
</record>
<!--
下载货站提货POD
-->
<record
id=
"bl_
download_pod
_server_action"
model=
"ir.actions.server"
>
<field
name=
"name"
>
Batch
Download PickUp POD
</field>
<!--
获取尾程快递POD
-->
<record
id=
"bl_
get_delivery_pod_info
_server_action"
model=
"ir.actions.server"
>
<field
name=
"name"
>
Batch
Get Last Mile POD Info
</field>
<field
name=
"model_id"
ref=
"model_cc_bl"
/>
<field
name=
"binding_model_id"
ref=
"model_cc_bl"
/>
<field
name=
"state"
>
code
</field>
...
...
@@ -450,7 +450,7 @@
<field
name=
"groups_id"
eval=
"[(4, ref('ccs_base.group_clearance_of_customs_user'))]"
/>
<field
name=
"code"
>
if records:
action = records.action_batch_
download_pod('货站提货POD'
)
action = records.action_batch_
get_last_mile_pod_info(
)
</field>
</record>
...
...
ccs_base/wizard/batch_get_lastmile_pod_info_wizard.py
浏览文件 @
a0778f4e
差异被折叠。
点击展开。
ccs_base/wizard/batch_get_pod_info_wizard.py
浏览文件 @
a0778f4e
...
...
@@ -349,7 +349,6 @@ class BatchGetPodInfoWizard(models.TransientModel):
if
action_type
==
'获取货站提货POD信息'
:
if
self
.
sync_last_mile_pod
and
successful_processed_files
:
self
.
_sync_last_mile_pod
(
successful_processed_files
)
# 同步推送匹配节点
if
self
.
sync_match_node
and
successful_processed_files
:
# 且需先对比小包当前节点的操作时间是否小于提取时间(同时区对比)若大于则不能推送,
...
...
@@ -726,25 +725,34 @@ class BatchGetPodInfoWizard(models.TransientModel):
Sync pickup POD information # 同步货站提货POD信息
:param processed_files: 处理后的文件数组
"""
# return False#测试 先不同步
# 同步货站提货POD信息
is_fail
=
[]
# 同步失败
redis_conn
=
self
.
env
[
'common.common'
]
.
sudo
()
.
get_redis
()
if
not
redis_conn
or
redis_conn
==
'no'
:
raise
ValidationError
(
'未连接redis,无法同步货站提货POD,请联系管理员'
)
bl_ids
=
[]
for
file_info
in
processed_files
:
if
not
file_info
[
'bl'
]:
bl
=
file_info
.
get
(
'bl'
)
if
not
bl
:
continue
bl
=
file_info
[
'bl'
]
# 查找清关文件并执行同步
clearance_file
=
file_info
.
get
(
'clearance_file'
)
if
clearance_file
:
if
not
clearance_file
:
continue
bl_ids
.
append
(
bl
.
id
)
if
not
bl_ids
:
return
payload
=
{
'ids'
:
bl_ids
,
'action_type'
:
'sync_last_mile_pod'
,
'user_login'
:
self
.
env
.
user
.
login
,
'file_type'
:
'货站提货POD'
}
try
:
clearance_file
.
action_sync
()
# 同步货站提货POD
redis_conn
.
lpush
(
'mail_push_package_list'
,
json
.
dumps
(
payload
))
except
Exception
as
e
:
logging
.
info
(
'_sync_last_mile_pod:
%
s'
%
e
)
is_fail
=
True
break
_logger
.
info
(
f
"Successfully synced POD for BL {bl.bl_no}"
)
if
is_fail
:
raise
ValidationError
(
'本次同步失败,请重试!'
)
logging
.
info
(
'sync_last_mile_pod redis error:
%
s'
%
e
)
raise
ValidationError
(
'推送货站提货POD同步任务到redis失败,请重试或联系管理员'
)
def
_check_target_texts_exist
(
self
,
pdf_binary
,
bl_no
):
"""
...
...
consumers/mail_push.py
浏览文件 @
a0778f4e
...
...
@@ -31,8 +31,11 @@ class Order_dispose(object):
try
:
data
=
json
.
loads
(
data
)
logging
.
info
(
'mail_push_data:
%
s'
,
data
)
action_type
=
data
.
get
(
'action_type'
)
if
action_type
==
'sync_last_mile_pod'
:
self
.
_sync_last_mile_pod_from_queue
(
data
)
return
res_data
ship_packages
=
eval
(
data
[
'ship_packages'
])
if
data
.
get
(
'ship_packages'
)
else
[]
# 小包
action_type
=
data
.
get
(
'action_type'
)
# 类型
utc_time
=
data
.
get
(
'utc_time'
)
bl_obj
=
self
.
odoo_db
.
env
[
'cc.bl'
]
if
action_type
and
not
utc_time
:
...
...
@@ -52,6 +55,32 @@ class Order_dispose(object):
logging
.
error
(
'mail_auto_push error:
%
s'
%
str
(
ex
))
return
res_data
def
_sync_last_mile_pod_from_queue
(
self
,
data
):
bl_ids
=
data
.
get
(
'ids'
)
or
[]
if
not
bl_ids
:
return
try
:
bl_model
=
self
.
odoo_db
.
env
[
'cc.bl'
]
clearance_model
=
self
.
odoo_db
.
env
[
'cc.clearance.file'
]
bl_records
=
bl_model
.
browse
(
bl_ids
)
non_temu_ids
=
[
bl
.
id
for
bl
in
bl_records
if
getattr
(
bl
,
'bl_type'
,
False
)
!=
'temu'
]
if
not
non_temu_ids
:
return
clearance_ids
=
clearance_model
.
search
([
(
'bl_id'
,
'in'
,
non_temu_ids
),
(
'file_name'
,
'='
,
data
.
get
(
'file_type'
)),
])
if
not
clearance_ids
:
return
clearance_records
=
clearance_model
.
browse
(
clearance_ids
)
for
clearance_file
in
clearance_records
:
try
:
clearance_file
.
action_sync
()
except
Exception
as
ex
:
logging
.
error
(
'sync_last_mile_pod action_sync error:
%
s'
%
str
(
ex
))
except
Exception
as
ex
:
logging
.
error
(
'sync_last_mile_pod_from_queue error:
%
s'
%
str
(
ex
))
try
:
pool
=
redis
.
ConnectionPool
(
**
config
.
redis_options
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论