Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
H
hh_ccs
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
贺阳
hh_ccs
Commits
6ea60517
提交
6ea60517
authored
12月 11, 2024
作者:
刘擎阳
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.优化下载名称
上级
6d65fdd8
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
10 行增加
和
7 行删除
+10
-7
cc_bill_loading.py
ccs_base/models/cc_bill_loading.py
+1
-1
fetch_mail.py
ccs_base/models/fetch_mail.py
+1
-1
order_state_change_rule.py
ccs_base/models/order_state_change_rule.py
+6
-4
cc_clearance_file_view.xml
ccs_base/views/cc_clearance_file_view.xml
+2
-1
没有找到文件。
ccs_base/models/cc_bill_loading.py
浏览文件 @
6ea60517
...
...
@@ -433,7 +433,7 @@ class CcClearanceFile(models.Model):
file
=
fields
.
Binary
(
string
=
'File'
)
# 文件名
file_name
=
fields
.
Char
(
string
=
'File Name'
)
attachment_name
=
fields
.
Char
(
string
=
'File Name'
)
# 是否同步
is_upload
=
fields
.
Boolean
(
string
=
'Is Sync'
,
default
=
False
)
# 同步时间
...
...
ccs_base/models/fetch_mail.py
浏览文件 @
6ea60517
...
...
@@ -136,7 +136,7 @@ class FetchmailServer(models.Model):
filename
,
encoding
=
decode_header
(
filename
)[
0
]
if
isinstance
(
filename
,
bytes
):
filename
=
filename
.
decode
(
encoding
if
encoding
else
"utf-8"
)
attachment_arr
.
append
(
part
.
get_payload
(
decode
=
True
))
attachment_arr
.
append
(
(
filename
,
part
.
get_payload
(
decode
=
True
)
))
for
part
in
msg
.
walk
():
# 如果ture的话内容是没用的
if
not
part
.
is_multipart
():
...
...
ccs_base/models/order_state_change_rule.py
浏览文件 @
6ea60517
...
...
@@ -106,18 +106,20 @@ class OrderStateChangeRule(models.Model):
data_arr
=
data_re
.
findall
(
email_body
)
return
data_arr
def
upload_cds_attachment
(
self
,
bl_obj
,
data
):
def
upload_cds_attachment
(
self
,
bl_obj
,
name
,
data
):
file_obj
=
self
.
env
[
'cc.clearance.file'
]
.
sudo
()
.
search
([(
'file_name'
,
'='
,
'海关CDS申报单(import和授权方式检查拉齐等)'
),
(
'bl_id'
,
'='
,
bl_obj
.
id
)],
limit
=
1
)
file_obj
.
file
=
base64
.
encodebytes
(
data
)
file_obj
.
attachment_name
=
name
file_obj
.
is_upload
=
False
file_obj
.
action_sync
()
def
fetch_mail_dlv_attachment
(
self
,
**
kwargs
):
attachment_arr
=
kwargs
[
'attachment_arr'
]
for
attachment
in
attachment_arr
:
for
attachment
_tuple
in
attachment_arr
:
try
:
order_no
,
date_str
=
self
.
read_pdf
(
attachment
)
attachment_name
,
attachment_data
=
attachment_tuple
order_no
,
date_str
=
self
.
read_pdf
(
attachment_data
)
if
order_no
:
# 转换为 datetime 对象
local_time
=
datetime
.
strptime
(
date_str
,
'
%
d/
%
m/
%
Y
%
H:
%
M:
%
S'
)
...
...
@@ -133,7 +135,7 @@ class OrderStateChangeRule(models.Model):
bl_obj
=
self
.
env
[
'cc.bl'
]
.
sudo
()
.
search
([(
'id'
,
'='
,
result
[
0
][
0
])])
if
result
else
False
logging
.
info
(
'order_no:
%
s, bl_obj:
%
s'
%
(
order_no
,
bl_obj
))
if
bl_obj
:
self
.
upload_cds_attachment
(
bl_obj
,
attachment
)
self
.
upload_cds_attachment
(
bl_obj
,
attachment
_name
,
attachment_data
)
if
bl_obj
and
bl_obj
.
state
!=
'done'
:
redis_conn
=
self
.
env
[
'common.common'
]
.
sudo
()
.
get_redis
()
if
redis_conn
==
'no'
:
...
...
ccs_base/views/cc_clearance_file_view.xml
浏览文件 @
6ea60517
...
...
@@ -11,10 +11,11 @@
<tree
string=
"Clearance File"
decoration-success=
"is_upload == 1"
editable=
"bottom"
>
<field
name=
"bl_id"
string=
"Bill of Loading"
invisible=
"1"
/>
<field
name=
"file_name"
string=
"File Name"
required=
"1"
/>
<field
name=
"file"
string=
"PDF File"
required=
"1"
/>
<field
name=
"file"
string=
"PDF File"
required=
"1"
filename=
"attachment_name"
/>
<field
name=
"is_upload"
readonly=
"1"
/>
<field
name=
"upload_time"
/>
<button
name=
"action_sync"
string=
"SyncTo.."
type=
"object"
icon=
"fa-upload"
/>
<field
name=
"attachment_name"
invisible=
"1"
/>
</tree>
</field>
</record>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论