Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
ypt_mgw_local
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
苏星豪
ypt_mgw_local
Commits
1896dfeb
提交
1896dfeb
authored
11月 21, 2024
作者:
李思鑫
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
宴会申请调整
上级
310b40b0
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
57 行增加
和
32 行删除
+57
-32
models.py
banquet/models.py
+6
-2
views.py
banquet/views.py
+44
-29
apply_permit.html
templates/banquet/apply_permit.html
+7
-1
没有找到文件。
banquet/models.py
浏览文件 @
1896dfeb
...
@@ -45,8 +45,7 @@ class Policy(models.Model):
...
@@ -45,8 +45,7 @@ class Policy(models.Model):
(
2
,
_
(
'以宴席桌数为准'
)),
(
2
,
_
(
'以宴席桌数为准'
)),
(
3
,
_
(
'严格的箱与桌公式设定'
)),
(
3
,
_
(
'严格的箱与桌公式设定'
)),
(
4
,
_
(
'箱数为主要条件,桌数为次要条件'
)),
(
4
,
_
(
'箱数为主要条件,桌数为次要条件'
)),
(
5
,
_
(
'桌数为主要条件,箱数为次要条件'
)),
(
5
,
_
(
'桌数为主要条件,箱数为次要条件'
))),
default
=
3
)
(
6
,
_
(
'按扫码瓶数换算箱数计算'
))),
default
=
3
)
grades
=
models
.
JSONField
(
_
(
'奖励等级'
),
default
=
list
,
blank
=
True
,
null
=
True
)
grades
=
models
.
JSONField
(
_
(
'奖励等级'
),
default
=
list
,
blank
=
True
,
null
=
True
)
# [{
# [{
...
@@ -170,6 +169,8 @@ class Apply(models.Model):
...
@@ -170,6 +169,8 @@ class Apply(models.Model):
(
3
,
_
(
'结算审核中'
)),
(
3
,
_
(
'结算审核中'
)),
(
4
,
_
(
'结算中'
)),
(
4
,
_
(
'结算中'
)),
(
5
,
_
(
'已结算'
)),
(
5
,
_
(
'已结算'
)),
(
6
,
_
(
'开瓶数量不足,未通过结算奖励'
)),
(
7
,
_
(
'宴席资料异常'
)),
),
default
=
0
)
),
default
=
0
)
reason
=
models
.
CharField
(
_
(
'原因'
),
max_length
=
500
,
blank
=
True
,
null
=
True
)
reason
=
models
.
CharField
(
_
(
'原因'
),
max_length
=
500
,
blank
=
True
,
null
=
True
)
annotation
=
models
.
CharField
(
_
(
'批注'
),
max_length
=
500
,
blank
=
True
,
null
=
True
)
annotation
=
models
.
CharField
(
_
(
'批注'
),
max_length
=
500
,
blank
=
True
,
null
=
True
)
...
@@ -185,6 +186,9 @@ class Apply(models.Model):
...
@@ -185,6 +186,9 @@ class Apply(models.Model):
actual_table_num
=
models
.
SmallIntegerField
(
_
(
'实际宴席桌数'
),
blank
=
True
,
null
=
True
,
default
=
0
)
actual_table_num
=
models
.
SmallIntegerField
(
_
(
'实际宴席桌数'
),
blank
=
True
,
null
=
True
,
default
=
0
)
actual_qty_x
=
models
.
IntegerField
(
_
(
'实际箱数'
),
default
=
0
)
actual_qty_x
=
models
.
IntegerField
(
_
(
'实际箱数'
),
default
=
0
)
actual_qty_p
=
models
.
IntegerField
(
_
(
'实际瓶数'
),
default
=
0
)
actual_qty_p
=
models
.
IntegerField
(
_
(
'实际瓶数'
),
default
=
0
)
scan_num
=
models
.
IntegerField
(
_
(
'扫码数量'
),
default
=
0
)
bottle_num
=
models
.
IntegerField
(
_
(
'瓶数'
),
default
=
0
)
is_ck
=
models
.
BooleanField
(
_
(
'是否出库'
),
default
=
False
,
db_index
=
True
)
class
Meta
:
class
Meta
:
verbose_name
=
_
(
'宴会申请'
)
verbose_name
=
_
(
'宴会申请'
)
...
...
banquet/views.py
浏览文件 @
1896dfeb
...
@@ -25,9 +25,9 @@ sK = 'fgfdvgu$#&3t@j'
...
@@ -25,9 +25,9 @@ sK = 'fgfdvgu$#&3t@j'
from
utils.views
import
time_key_check
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
from
wx.views
import
transfer_batch
from
mall.views
import
update_member_points_agent
import
redis
import
redis
import
math
import
math
from
mall.views
import
update_member_points_agent
#2020-12-21 微信redis库
#2020-12-21 微信redis库
...
@@ -99,6 +99,8 @@ def banquetList(request,obj):
...
@@ -99,6 +99,8 @@ def banquetList(request,obj):
3
:
[
'结算审核中'
,
'blue'
],
3
:
[
'结算审核中'
,
'blue'
],
4
:
[
'结算中'
,
'blue'
],
4
:
[
'结算中'
,
'blue'
],
5
:
[
'已结算'
,
'#07c160'
],
5
:
[
'已结算'
,
'#07c160'
],
6
:
[
'开瓶数量不足,未通过结算奖励'
,
'red'
],
7
:
[
'宴席资料异常'
,
'red'
],
}
}
status
=
dict
[
r
[
16
]]
status
=
dict
[
r
[
16
]]
color
=
'blue'
color
=
'blue'
...
@@ -317,6 +319,9 @@ def banquetList(request,obj):
...
@@ -317,6 +319,9 @@ def banquetList(request,obj):
data
[
'data'
]
.
append
([
data
[
'data'
]
.
append
([
r
[
1
],
r
[
2
],
float
(
r
[
3
]),
r
[
4
],
r
[
5
],
r
[
6
],
btns
r
[
1
],
r
[
2
],
float
(
r
[
3
]),
r
[
4
],
r
[
5
],
r
[
6
],
btns
])
])
elif
obj
==
"code_search"
:
return
render
(
request
,
'banquet/code_search.html'
,
data
)
return
render
(
request
,
'obj/list_obj.html'
,
data
)
return
render
(
request
,
'obj/list_obj.html'
,
data
)
...
@@ -385,7 +390,8 @@ def ajax_banquet(request,obj):
...
@@ -385,7 +390,8 @@ def ajax_banquet(request,obj):
return
JsonResponse
(
ajaxBanquetConsumerScanAnalysis
(
id
))
return
JsonResponse
(
ajaxBanquetConsumerScanAnalysis
(
id
))
elif
obj
==
"manual_settle"
:
elif
obj
==
"manual_settle"
:
return
ajaxBanquetManualSettle
(
request
)
return
ajaxBanquetManualSettle
(
request
)
elif
obj
==
"code_search"
:
return
ajaxBanquetCodeSearch
(
request
)
def
ajaxBanquetApply
(
request
):
def
ajaxBanquetApply
(
request
):
res
=
{
res
=
{
...
@@ -397,7 +403,6 @@ def ajaxBanquetApply(request):
...
@@ -397,7 +403,6 @@ def ajaxBanquetApply(request):
'applyer_id'
in
d
and
'applyer_id'
in
d
and
'category_id'
in
d
and
'category_id'
in
d
and
'policy'
in
d
and
'policy'
in
d
and
'address'
in
d
and
'table_num'
in
d
and
'table_num'
in
d
and
'user_name'
in
d
and
'user_name'
in
d
and
'user_phone'
in
d
and
'user_phone'
in
d
and
...
@@ -408,7 +413,6 @@ def ajaxBanquetApply(request):
...
@@ -408,7 +413,6 @@ def ajaxBanquetApply(request):
applyer_id
=
d
[
'applyer_id'
]
applyer_id
=
d
[
'applyer_id'
]
category_id
=
d
[
'category_id'
]
category_id
=
d
[
'category_id'
]
policy
=
d
[
'policy'
]
policy
=
d
[
'policy'
]
address
=
d
[
'address'
]
table_num
=
d
[
'table_num'
]
table_num
=
d
[
'table_num'
]
user_name
=
d
[
'user_name'
]
user_name
=
d
[
'user_name'
]
user_phone
=
d
[
'user_phone'
]
user_phone
=
d
[
'user_phone'
]
...
@@ -419,7 +423,6 @@ def ajaxBanquetApply(request):
...
@@ -419,7 +423,6 @@ def ajaxBanquetApply(request):
applyer_id
and
applyer_id
and
category_id
and
category_id
and
policy
and
policy
and
address
and
table_num
and
table_num
and
user_name
and
user_name
and
user_phone
and
user_phone
and
...
@@ -433,14 +436,20 @@ def ajaxBanquetApply(request):
...
@@ -433,14 +436,20 @@ def ajaxBanquetApply(request):
apply
.
ancestor_id
=
c
.
ancestor_id
apply
.
ancestor_id
=
c
.
ancestor_id
apply
.
applyer_id
=
applyer_id
apply
.
applyer_id
=
applyer_id
apply
.
company
=
c
apply
.
company
=
c
if
apply
.
status
==
6
:
res
[
'e'
]
=
'当前状态不允许修改'
return
JsonResponse
(
res
)
apply
.
category_id
=
category_id
apply
.
category_id
=
category_id
if
'product_id'
in
d
and
d
[
'product_id'
]:
if
'product_id'
in
d
and
d
[
'product_id'
]:
product_id
=
d
[
'product_id'
]
product_id
=
d
[
'product_id'
]
apply
.
product_id
=
product_id
apply
.
product_id
=
product_id
if
'address'
in
d
and
d
[
'address'
]:
apply
.
address
=
d
[
'address'
]
apply
.
policy
=
policy
apply
.
policy
=
policy
apply
.
address
=
address
apply
.
table_num
=
table_num
apply
.
table_num
=
table_num
apply
.
user_name
=
user_name
apply
.
user_name
=
user_name
apply
.
user_phone
=
user_phone
apply
.
user_phone
=
user_phone
...
@@ -872,9 +881,9 @@ def ajaxBanquetCancel(request):
...
@@ -872,9 +881,9 @@ def ajaxBanquetCancel(request):
if
obj
.
status
==
0
:
if
obj
.
status
==
0
:
obj
.
delete
()
obj
.
delete
()
else
:
else
:
res
[
'e'
]
=
'无法删除已审核申请'
data
[
'e'
]
=
'无法删除已审核申请'
else
:
else
:
res
[
'e'
]
=
'数据丢失'
data
[
'e'
]
=
'数据丢失'
return
JsonResponse
(
res
)
return
JsonResponse
(
res
)
...
@@ -1096,10 +1105,15 @@ def ajaxBanquetSettle(request):
...
@@ -1096,10 +1105,15 @@ def ajaxBanquetSettle(request):
# 如果提交箱数和核销相同 且 实际桌数与申请桌数相同 则自动返利 并修改状态为结算中
# 如果提交箱数和核销相同 且 实际桌数与申请桌数相同 则自动返利 并修改状态为结算中
if
apply_codes_cnt
==
writeoff_cnt
and
apply
.
actual_table_num
==
apply
.
table_num
:
if
apply_codes_cnt
==
writeoff_cnt
and
apply
.
actual_table_num
==
apply
.
table_num
:
if
apply
.
ancestor_id
==
208869
:
if
apply
.
ancestor_id
==
208869
:
d
=
ajaxBanquetConsumerScanAnalysis
(
id
)
apply
.
status
=
3
#结算审核中
#print(d)
#pids = [10558, 10559, 10560, 10561, 10562]
if
d
[
'scan_rate'
]
>=
0.5
:
# 如果是一代产品则直接结算
apply
.
status
=
4
#结算中
#if apply.product_id in pids:
# apply.status = 4 #结算中
#else:
# d = ajaxBanquetConsumerScanAnalysis(id)
# if d['scan_rate'] >= 1:
# apply.status = 4 #结算中
else
:
else
:
apply
.
status
=
4
#结算中
apply
.
status
=
4
#结算中
...
@@ -1199,6 +1213,19 @@ def ajaxBanquetManualSettle(request):
...
@@ -1199,6 +1213,19 @@ def ajaxBanquetManualSettle(request):
data
[
'e'
]
=
'无数据'
data
[
'e'
]
=
'无数据'
return
JsonResponse
(
data
)
return
JsonResponse
(
data
)
def
ajaxBanquetCodeSearch
(
request
):
data
=
{
'e'
:
''
,
'apply_id'
:
0
}
code
=
request
.
GET
.
get
(
'code'
,
''
)
if
code
:
bc
=
Apply_Codes
.
objects
.
filter
(
code
=
code
)
if
bc
:
data
[
'apply_id'
]
=
bc
[
0
]
.
apply_id
else
:
data
[
'e'
]
=
'数据不存在'
else
:
data
[
'e'
]
=
'数据丢失'
return
JsonResponse
(
data
)
# 2024-06-24
# 2024-06-24
def
policy
(
request
,
action
=
'list'
,
id
=
None
):
def
policy
(
request
,
action
=
'list'
,
id
=
None
):
u
=
request
.
user
u
=
request
.
user
...
@@ -1223,7 +1250,7 @@ def policy(request,action='list',id=None):
...
@@ -1223,7 +1250,7 @@ def policy(request,action='list',id=None):
else
:
else
:
form
=
PolicyForm
(
request
.
POST
,
instance
=
obj
)
form
=
PolicyForm
(
request
.
POST
,
instance
=
obj
)
print
(
form
)
if
form
.
is_valid
():
if
form
.
is_valid
():
form
.
save
()
form
.
save
()
...
@@ -1510,37 +1537,25 @@ def close_applys(request,agent_id,apply_id=None):
...
@@ -1510,37 +1537,25 @@ def close_applys(request,agent_id,apply_id=None):
data
[
'apply_ids'
]
.
append
(
r
[
1
])
data
[
'apply_ids'
]
.
append
(
r
[
1
])
# 箱数
x_num
=
'count(*)'
# 查询手动结算记录,如果有手动结算,则以手动结算为准
# 查询手动结算记录,如果有手动结算,则以手动结算为准
cur
.
execute
(
"select amt from banquet_settlerecord where apply_id = "
+
app
+
" order by id desc limit 1"
)
cur
.
execute
(
"select amt from banquet_settlerecord where apply_id = "
+
app
+
" order by id desc limit 1"
)
r
=
cur
.
fetchone
()
r
=
cur
.
fetchone
()
if
r
:
if
r
:
amt
=
str
(
r
[
0
])
amt
=
str
(
r
[
0
])
else
:
# # 查询扫码率 过滤不需要扫码的产品
if
ancestor_id
==
208869
:
include_product_ids
=
[
10124
,
10125
,
10126
,
10127
,
10128
]
if
product_id
in
include_product_ids
:
analysis
=
ajaxBanquetConsumerScanAnalysis
(
int
(
app
))
if
analysis
[
'bottle_num'
]:
x_num
=
str
(
math
.
floor
(
analysis
[
'bottle_num'
]
/
6
))
print
(
amt
)
if
amt
!=
'0'
:
if
amt
!=
'0'
:
# 写入奖励记录
产品名称
# 写入奖励记录
s
=
"insert into banquet_bonus(ancestor_id,agent_id,policy_id,apply_id,product_id,qty_x,table_num,amt,qty_p) "
+
\
s
=
"insert into banquet_bonus(ancestor_id,agent_id,policy_id,apply_id,product_id,qty_x,table_num,amt,qty_p) "
+
\
"select "
+
aid
+
","
+
agent_id
+
","
+
id
+
","
+
app
+
",product_id,X,Z,"
+
amt
+
",P from "
+
\
"select "
+
aid
+
","
+
agent_id
+
","
+
id
+
","
+
app
+
",product_id,X,Z,"
+
amt
+
",P from "
+
\
"(select product_id,
"
+
x_num
+
"
X, "
+
z
+
" Z,sum(P) P from "
+
\
"(select product_id,
count(*)
X, "
+
z
+
" Z,sum(P) P from "
+
\
"(select label_pk_id,product_id,"
+
\
"(select label_pk_id,product_id,"
+
\
"(select count(*) from banquet_writeoff where apply_id="
+
app
+
" and label_pk_id=w.label_pk_id and label_pkg!=3) P "
+
\
"(select count(*) from banquet_writeoff where apply_id="
+
app
+
" and label_pk_id=w.label_pk_id and label_pkg!=3) P "
+
\
"from banquet_writeoff w where apply_id="
+
app
+
\
"from banquet_writeoff w where apply_id="
+
app
+
\
" group by label_pk_id,product_id"
+
\
" group by label_pk_id,product_id"
+
\
") g group by product_id"
+
\
") g group by product_id"
+
\
") gg"
") gg"
print
(
s
)
cur
.
execute
(
s
)
cur
.
execute
(
s
)
#print(s)
# 写入剩余实物
# 写入剩余实物
s
=
"INSERT INTO banquet_surplus(ancestor_id,agent_id,policy_id,apply_id,product_id,qty_x,qty_p,dt,tm) "
+
\
s
=
"INSERT INTO banquet_surplus(ancestor_id,agent_id,policy_id,apply_id,product_id,qty_x,qty_p,dt,tm) "
+
\
...
...
templates/banquet/apply_permit.html
浏览文件 @
1896dfeb
...
@@ -49,8 +49,10 @@
...
@@ -49,8 +49,10 @@
var
status
=
{{
status
}}
var
status
=
{{
status
}}
if
(
status
>=
3
){
if
(
status
>=
3
){
$
(
"#status_select"
).
html
(
`
$
(
"#status_select"
).
html
(
`
<option value="2">驳回</option>
<option value="4">通过</option>
<option value="4">通过</option>
<option value="1">驳回(重新核销)</option>
<option value="2">驳回(重新申请)</option>
<option value="6">开瓶数量不足,未通过结算奖励</option>
`
)
`
)
}
}
...
@@ -62,6 +64,8 @@
...
@@ -62,6 +64,8 @@
3
:
[
'结算审核中'
,
'blue'
],
3
:
[
'结算审核中'
,
'blue'
],
4
:
[
'结算中'
,
'blue'
],
4
:
[
'结算中'
,
'blue'
],
5
:
[
'已结算'
,
'#07c160'
],
5
:
[
'已结算'
,
'#07c160'
],
6
:
[
'开瓶数量不足,未通过结算奖励'
,
'red'
],
7
:
[
'宴席资料异常'
,
'red'
],
}
}
var
firstLink
=
$
(
window
.
click_row
).
find
(
'td:first a'
);
var
firstLink
=
$
(
window
.
click_row
).
find
(
'td:first a'
);
$
(
firstLink
).
text
(
status_dict
[
status
][
0
])
$
(
firstLink
).
text
(
status_dict
[
status
][
0
])
...
@@ -86,6 +90,7 @@
...
@@ -86,6 +90,7 @@
<option
value=
"0"
>
未审核
</option>
<option
value=
"0"
>
未审核
</option>
<option
value=
"1"
>
通过
</option>
<option
value=
"1"
>
通过
</option>
<option
value=
"2"
>
未通过
</option>
<option
value=
"2"
>
未通过
</option>
<option
value=
"7"
>
宴席资料异常
</option>
</select>
</select>
</div>
</div>
</div>
</div>
...
@@ -95,6 +100,7 @@
...
@@ -95,6 +100,7 @@
<textarea
id=
"txt_remark"
cols=
"30"
rows=
"10"
placeholder=
"填写备注"
style=
"width: 100%;"
></textarea>
<textarea
id=
"txt_remark"
cols=
"30"
rows=
"10"
placeholder=
"填写备注"
style=
"width: 100%;"
></textarea>
</div>
</div>
</div>
</div>
<h3
style=
"text-align: center; margin-top:20px;"
>
宴会信息审核
</h3>
<div>
<div>
<button
class=
"btn btn-primary"
id=
"btn_permit"
style=
"float:right;"
>
保存
</button>
<button
class=
"btn btn-primary"
id=
"btn_permit"
style=
"float:right;"
>
保存
</button>
</div>
</div>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论