Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
H
hh_ccs
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
贺阳
hh_ccs
Commits
d99770e0
提交
d99770e0
authored
6月 10, 2025
作者:
贺阳
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
尾程服务商 名称增加中英文模式,按尾程理货和交货接口根据语言返回
上级
8c92b179
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
44 行增加
和
15 行删除
+44
-15
cc_exception_info.py
ccs_base/models/cc_exception_info.py
+1
-2
cc_last_mile_provider.py
ccs_base/models/cc_last_mile_provider.py
+3
-3
order_controller.py
ccs_connect_tiktok/controllers/order_controller.py
+40
-10
没有找到文件。
ccs_base/models/cc_exception_info.py
浏览文件 @
d99770e0
import
random
from
odoo
import
models
,
fields
,
api
...
...
@@ -21,7 +20,7 @@ class CCExceptionInfo(models.Model):
# 异常编码增加唯一约束
_sql_constraints
=
[(
'exception_code_uniq'
,
'unique(exception_code)'
,
'The Exception Code must be unique.'
)]
def
search_exception_info
(
self
,
pda_lang
=
False
):
def
search_exception_info
(
self
):
"""
查询包裹异常原因
:return:
...
...
ccs_base/models/cc_last_mile_provider.py
浏览文件 @
d99770e0
...
...
@@ -31,7 +31,7 @@ class CCLastMileProvider(models.Model):
_
(
"Placement Area must be unique !"
))
logo
=
fields
.
Binary
(
'Courier Logo'
)
# 快递logo,英文
name
=
fields
.
Char
(
string
=
'Courier Name'
,
required
=
True
)
# 快递名称
name
=
fields
.
Char
(
string
=
'Courier Name'
,
required
=
True
,
translate
=
True
)
# 快递名称
abbreviation
=
fields
.
Char
(
string
=
'Abbreviation'
,
required
=
True
)
# 简称
tape_color_value
=
fields
.
Char
(
string
=
'Tape Color Value'
)
# 胶带色值
active
=
fields
.
Boolean
(
'Active'
,
default
=
True
)
# 有效☑️
...
...
@@ -41,7 +41,7 @@ class CCLastMileProvider(models.Model):
def
match_provider
(
self
,
provider_name
):
"""Check if the provider name exists in matching values and return the record."""
# 查询所有匹配的记录
matching_records
=
self
.
search
([])
matching_records
=
self
.
s
udo
()
.
s
earch
([])
# 检查是否有记录的 matching_value 包含 provider_name
for
record
in
matching_records
:
if
provider_name
in
record
.
matching_value
.
split
(
'
\n
'
):
...
...
@@ -50,7 +50,7 @@ class CCLastMileProvider(models.Model):
def
get_all_placement_area
(
self
,
domain
=
[]):
"""
获取所有摆放区域
,英文
获取所有摆放区域
"""
all_providers
=
self
.
sudo
()
.
search
(
domain
or
[])
provider_map
=
{
...
...
ccs_connect_tiktok/controllers/order_controller.py
浏览文件 @
d99770e0
...
...
@@ -190,7 +190,7 @@ class OrderController(http.Controller):
tally_time
=
package_item
.
get
(
'tally_time'
)
if
(
action_type
==
'tally'
and
package_item
.
get
(
'tally_state'
)
==
'checked_goods'
)
or
(
action_type
==
'handover'
and
package_item
.
get
(
'tally_state'
)
==
'handover_completed'
):
'tally_state'
)
==
'handover_completed'
):
if
package_type
==
'ship'
:
ship_packages
.
append
({
'id'
:
[
package_obj
.
id
],
...
...
@@ -310,10 +310,8 @@ class OrderController(http.Controller):
try
:
logging
.
info
(
'exceptions_info kwargs:
%
s'
%
kwargs
)
lang
=
'zh_CN'
if
pda_lang
==
'zh'
else
'en_US'
# 语言
exception_obj
=
request
.
env
[
'cc.exception.info'
]
.
sudo
(
)
.
with_context
({
'lang'
:
lang
})
.
search
([])
# 包裹异常原因
res
[
'exception_arr'
]
=
[
excep
.
search_exception_info
(
pda_lang
=
pda_lang
)
for
excep
in
exception_obj
]
exception_obj
=
request
.
env
[
'cc.exception.info'
]
.
sudo
()
.
with_context
({
'lang'
:
lang
})
.
search
([])
# 包裹异常原因
res
[
'exception_arr'
]
=
[
excep
.
search_exception_info
()
for
excep
in
exception_obj
]
res
[
'state'
]
=
200
except
Exception
as
e
:
exceptions_msg_dic
=
{
...
...
@@ -333,16 +331,48 @@ class OrderController(http.Controller):
尾程快递名称,摆放区域,快递LOGO,大包件数
大包信息字段:大包号,尾程快递名称,尾程快递色值;
"""
return
self
.
_get_last_mile_grouped
(
'unprocessed_goods'
)
kwargs
=
json
.
loads
(
request
.
httprequest
.
data
)
pda_lang
=
kwargs
.
get
(
'pda_lang'
)
or
'zh'
res
=
{
'state'
:
201
,
'message'
:
''
}
try
:
logging
.
info
(
'last_mile_tally kwargs:
%
s'
%
kwargs
)
lang
=
'zh_CN'
if
pda_lang
==
'zh'
else
'en_US'
# 语言
return
self
.
_get_last_mile_grouped
(
'unprocessed_goods'
,
lang
)
except
Exception
as
e
:
exceptions_msg_dic
=
{
'en'
:
'System parsing error, the reason for the error is
%
s'
%
e
,
'zh'
:
'系统解析错误,错误原因是
%
s'
%
e
}
logging
.
info
(
'last_mile_tally error:
%
s'
%
e
)
res
[
'message'
]
=
exceptions_msg_dic
[
pda_lang
]
# _('System parsing error, the reason for the error is %s', e) # 系统解析错误,错误原因是
logging
.
info
(
'last_mile_tally res:
%
s'
%
res
)
return
res
@http.route
(
'/api/last_mile/delivery'
,
type
=
'json'
,
auth
=
'public'
,
csrf
=
False
)
def
last_mile_delivery
(
self
):
"""
按尾程快递交货接口,查询系统所有清关中的提单关联的大包,且大包状态为已理货的数量,按下一阶段服务商名称分组,下一个阶段服务商名称匹配尾程快递传给PDA。传输字段与理货的一致。
"""
return
self
.
_get_last_mile_grouped
(
'checked_goods'
)
kwargs
=
json
.
loads
(
request
.
httprequest
.
data
)
pda_lang
=
kwargs
.
get
(
'pda_lang'
)
or
'zh'
res
=
{
'state'
:
201
,
'message'
:
''
}
try
:
logging
.
info
(
'last_mile_delivery kwargs:
%
s'
%
kwargs
)
lang
=
'zh_CN'
if
pda_lang
==
'zh'
else
'en_US'
# 语言
return
self
.
_get_last_mile_grouped
(
'checked_goods'
,
lang
)
except
Exception
as
e
:
exceptions_msg_dic
=
{
'en'
:
'System parsing error, the reason for the error is
%
s'
%
e
,
'zh'
:
'系统解析错误,错误原因是
%
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) # 系统解析错误,错误原因是
logging
.
info
(
'last_mile_delivery res:
%
s'
%
res
)
return
res
def
_get_last_mile_grouped
(
self
,
tally_state
):
def
_get_last_mile_grouped
(
self
,
tally_state
,
lang
):
# 1. 查所有清关中提单
bls
=
request
.
env
[
'cc.bl'
]
.
sudo
()
.
search
([(
'state'
,
'='
,
'ccing'
)])
# 2. 查所有大包
...
...
@@ -354,8 +384,8 @@ class OrderController(http.Controller):
group_dict
=
{}
for
pkg
in
big_packages
:
provider
=
request
.
env
[
'cc.last.mile.provider'
]
.
sudo
(
)
.
match_provider
(
pkg
.
next_provider_name
)
provider
=
request
.
env
[
'cc.last.mile.provider'
]
.
sudo
(
)
.
with_context
({
'lang'
:
lang
})
.
match_provider
(
pkg
.
next_provider_name
)
if
not
provider
:
continue
key
=
provider
.
id
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论