Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
ypt_mgw_local
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
苏星豪
ypt_mgw_local
Commits
580d7dc9
提交
580d7dc9
authored
8月 08, 2024
作者:
张颂恩
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
调整
上级
cc2d4380
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
48 行增加
和
30 行删除
+48
-30
views.py
banquet/views.py
+48
-30
没有找到文件。
banquet/views.py
浏览文件 @
580d7dc9
...
...
@@ -22,7 +22,7 @@ from django.utils.translation import gettext_lazy as _
# 2024-06-28
sK
=
'fgfdvgu$#&3t@j'
from
utils.views
import
time_key_check
from
inventory.views
import
LabelQuery
,
decrypt_11h
from
inventory.views
import
LabelQuery
,
decrypt_11h
from
wx.views
import
transfer_batch
import
redis
...
...
@@ -54,7 +54,7 @@ def banquetList(request,obj):
elif
obj
==
"apply"
:
data
[
'subtt'
]
=
[
'宴会管理'
,
'宴会申请'
]
data
[
'clmns'
]
=
[
'状态'
,
'类别'
,
'产品'
,
'政策'
,
'用酒人'
,
'联系电话'
,
'宴会时间'
,
'结束时间'
,
'地址'
,
'桌数'
,
'
箱数'
,
'实际桌数'
,
'实际箱数
'
,
'大区'
,
data
[
'clmns'
]
=
[
'状态'
,
'类别'
,
'产品'
,
'政策'
,
'用酒人'
,
'联系电话'
,
'宴会时间'
,
'结束时间'
,
'地址'
,
'桌数'
,
'
实际桌数'
,
'箱数'
,
'实际箱数'
,
'扫码数量'
,
'瓶数'
,
'扫码占比
'
,
'大区'
,
'分区'
,
'上级经销商'
,
'申请终端'
,
'申请人'
,
'部门'
,
'申请时间'
,
'审核时间'
,
'审核人'
,
'操作'
]
data
[
'dt'
]
=
True
...
...
@@ -81,36 +81,42 @@ def banquetList(request,obj):
"status,COALESCE ( ( select last_name from company_user WHERE id = permiter_id ), '' ), "
"(SELECT COUNT(1) FROM banquet_apply_codes WHERE apply_id = a.id AND package_id = 3),"
+
\
"coalesce(to_char(end_tm,'yyyy-mm-dd HH24:MI:SS'),''), "
+
\
"actual_table_num,"
+
\
"(SELECT COUNT(0) FROM banquet_writeoff WHERE apply_id = a.id AND package_id = 3), "
+
\
"(select name from company_company where id = (select parent_id from company_company where id = company_id)) "
+
\
"(SELECT COUNT(0) FROM banquet_writeoff WHERE apply_id = a.id), "
+
\
"(select name from company_company where id = (select parent_id from company_company where id = company_id)), "
+
\
"scan_num,"
+
\
"bottle_num "
+
\
"from banquet_apply a "
+
sWhere
cur
.
execute
(
s
)
rs
=
cur
.
fetchall
()
for
r
in
rs
:
dict
=
{
0
:
'未审核'
,
1
:
'已通过'
,
2
:
'未通过'
,
3
:
'结算审核中'
,
4
:
'结算中'
,
5
:
'已结算'
,
0
:
[
'未审核'
,
'blue'
]
,
1
:
[
'已通过'
,
'#07c160'
]
,
2
:
[
'未通过'
,
'red'
]
,
3
:
[
'结算审核中'
,
'blue'
]
,
4
:
[
'结算中'
,
'blue'
]
,
5
:
[
'已结算'
,
'#07c160'
]
,
}
status
=
dict
[
r
[
16
]]
color
=
'blue'
btn1
=
"<a href='/banquet/list/apply_permit/?id="
+
str
(
r
[
0
])
+
"' target='_blank' class='btn-dlg btn-only-dlg'
>"
+
status
+
"</a>"
r
[
0
])
+
"' target='_blank' class='btn-dlg btn-only-dlg'
style='text-decoration: underline; color: "
+
status
[
1
]
+
"'>"
+
status
[
0
]
+
"</a>"
btns
=
"<a href='/banquet/list/apply_codes/?id="
+
str
(
r
[
0
])
+
"' target='_blank' class='btn btn-default btn-sm btn-only-dlg'>扫码详情</a>"
r
[
0
])
+
"' target='_blank' class='btn btn-default btn-sm btn-only-dlg'>
申请
扫码详情</a>"
btns
=
btns
+
"<a href='/banquet/list/writeoff/?id="
+
str
(
r
[
0
])
+
"' target='_blank' class='btn btn-default btn-sm btn-only-dlg'>核销详情</a>"
#
btns = btns + "<a href='/banquet/list/information_edit/?id=" + str(
#
r[0]) + "' target='_blank' class='btn btn-default btn-sm btn-only-dlg'>补充宴会信息</a>"
btns
=
btns
+
"<a href='/banquet/list/information_edit/?id="
+
str
(
r
[
0
])
+
"' target='_blank' class='btn btn-default btn-sm btn-only-dlg'>补充宴会信息</a>"
btns
=
btns
+
"<a href='/banquet/list/apply_photos/?id="
+
str
(
r
[
0
])
+
"' target='_blank' class='btn btn-default btn-sm btn-only-dlg'>查看照片</a>"
scan_rate
=
0
if
r
[
23
]
and
r
[
24
]:
#scan_rate = str(round(r[23] / r[24], 4) * 100) + '%'
scan_rate
=
format
((
r
[
23
]
/
r
[
24
])
*
100
,
'.2f'
)
+
'
%
'
data
[
'data'
]
.
append
([
btn1
,
r
[
1
],
r
[
2
],
r
[
3
],
r
[
4
],
r
[
5
],
r
[
6
],
r
[
19
],
r
[
7
],
r
[
8
],
r
[
18
],
r
[
20
],
r
[
21
],
r
[
9
],
r
[
10
],
r
[
21
],
r
[
11
],
r
[
12
],
btn1
,
r
[
1
],
r
[
2
],
r
[
3
],
r
[
4
],
r
[
5
],
r
[
6
],
r
[
19
],
r
[
7
],
r
[
8
],
r
[
20
],
r
[
18
],
r
[
21
],
r
[
23
],
r
[
24
],
scan_rate
,
r
[
9
],
r
[
10
],
r
[
22
],
r
[
11
],
r
[
12
],
r
[
13
],
r
[
14
],
r
[
15
],
r
[
17
],
btns
])
elif
obj
==
"apply_codes"
:
...
...
@@ -135,7 +141,7 @@ def banquetList(request,obj):
data
[
'clmns'
]
=
[
'标签序号'
,
'类型'
,
'产品'
]
id
=
int
(
request
.
GET
.
get
(
'id'
,
'0'
))
if
id
:
cur
.
execute
(
"select
code,package_id
,(select name from product_product where id = product_id) from banquet_writeoff where apply_id = "
+
str
(
id
))
cur
.
execute
(
"select
label_code,label_pkg
,(select name from product_product where id = product_id) from banquet_writeoff where apply_id = "
+
str
(
id
))
rs
=
cur
.
fetchall
()
for
r
in
rs
:
pkg
=
"瓶"
...
...
@@ -1004,7 +1010,7 @@ def ajaxBanquetInformationEdit(request):
else
:
res
[
'e'
]
=
'数据丢失'
return
JsonResponse
(
res
)
return
JsonResponse
(
res
)
def
ajaxBanquetSettle
(
request
):
data
=
{
...
...
@@ -1022,11 +1028,18 @@ def ajaxBanquetSettle(request):
apply_codes_cnt
=
cur
.
fetchone
()[
0
]
cur
.
execute
(
"select count(0) from banquet_writeoff where apply_id = "
+
str
(
apply
.
id
))
writeoff_cnt
=
cur
.
fetchone
()[
0
]
apply
.
status
=
3
#结算审核中
# 如果提交箱数和核销相同 且 实际桌数与申请桌数相同 则自动返利 并修改状态为结算中
if
apply_codes_cnt
==
writeoff_cnt
and
apply
.
actual_table_num
==
apply
.
table_num
:
apply
.
status
=
4
#结算中
else
:
apply
.
status
=
3
#结算审核中
if
apply
.
ancestor_id
==
208869
:
d
=
ajaxBanquetConsumerScanAnalysis
(
id
)
#print(d)
if
d
[
'scan_rate'
]
>=
0.5
:
apply
.
status
=
4
#结算中
else
:
apply
.
status
=
4
#结算中
apply
.
save
()
else
:
data
[
'e'
]
=
'无实际桌数,不能结算'
...
...
@@ -1036,7 +1049,7 @@ def ajaxBanquetSettle(request):
data
[
'e'
]
=
'数据丢失'
return
JsonResponse
(
data
)
def
ajaxBanquetConsumerScanAnalysis
(
id
):
data
=
{
'e'
:
''
,
...
...
@@ -1047,7 +1060,7 @@ def ajaxBanquetConsumerScanAnalysis(id):
if
id
:
code4s
=
{}
cur
=
connection
.
cursor
()
cur
.
execute
(
"select
label_code from banquet_writeoff
where apply_id = "
+
str
(
id
))
cur
.
execute
(
"select
code from banquet_apply_codes
where apply_id = "
+
str
(
id
))
rs
=
cur
.
fetchall
()
for
r
in
rs
:
label_code
=
r
[
0
]
...
...
@@ -1055,17 +1068,19 @@ def ajaxBanquetConsumerScanAnalysis(id):
if
c4
in
code4s
:
code4s
[
c4
]
.
append
(
label_code
)
else
:
code4s
=
[
label_code
]
code4s
[
c4
]
=
[
label_code
]
bottle_num
=
0
bottles
=
[]
#print(code4s)
for
c
in
code4s
:
cstr
=
','
.
join
(
"'{0}'"
.
format
(
i
)
for
i
in
code4s
[
c
])
cur
.
execute
(
f
"""
SELECT
code,
(SELECT cap FROM mes_bottlcap where label_code = a.code)
(SELECT cap FROM mes_bottlcap where label_code = a.code
and cap is not null and cap !='' limit 1
)
from label.t{c} a where a.parent_id in (
SELECT id from label.t{c} where code in (
{
','.join("'{0}'".format(i) for i in code4s[c])
}
{
cstr
}
)
)
...
...
@@ -1079,15 +1094,18 @@ def ajaxBanquetConsumerScanAnalysis(id):
bottles
.
append
(
code
)
data
[
'bottle_num'
]
=
bottle_num
if
bottles
:
cur
.
execute
(
f
"SELECT count(DISTINCT(label_code)) FROM sales_labelscan where label_code in ({','.join("'{0}'".format(i) for i in bottles)})"
)
s
=
"SELECT count(DISTINCT(label_code)) FROM sales_labelscan where label_code in ("
+
(
','
.
join
(
"'{0}'"
.
format
(
i
)
for
i
in
bottles
))
+
")"
#print(s)
cur
.
execute
(
s
)
r
=
cur
.
fetchone
()
data
[
'scan_num'
]
=
r
[
0
]
data
[
'scan_rate'
]
=
round
(
r
[
0
]
/
bottle_num
,
2
)
cur
.
execute
(
f
"UPDATE banquet_apply set scan_num = {str(r[0])}, bottle_num = {str(bottle_num)} where id = {str(id)}"
)
else
:
data
[
'e'
]
=
'数据丢失'
return
data
# 2024-06-24
def
policy
(
request
,
action
=
'list'
,
id
=
None
):
u
=
request
.
user
...
...
@@ -1310,7 +1328,7 @@ def close_applys(request,agent_id,apply_id=None):
# pos方法
if
request
.
method
==
'GET'
:
data
[
'e'
]
=
_
(
'请求方式错误'
)
return
JsonResonse
(
data
)
return
JsonRes
p
onse
(
data
)
d
=
json
.
loads
(
request
.
body
)
...
...
@@ -1380,7 +1398,7 @@ def close_applys(request,agent_id,apply_id=None):
# 修改宴会申请is_cose状态
s
=
"update banquet_apply set "
+
\
"is_closed=true,tm_closed=now(),closed_by_id="
+
uid
+
" "
+
\
"is_closed=true,tm_closed=now(),closed_by_id="
+
uid
+
"
,status=5
"
+
\
"where id="
+
app
cur
.
execute
(
s
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论