提交 1896dfeb authored 作者: 李思鑫's avatar 李思鑫

宴会申请调整

上级 310b40b0
......@@ -45,8 +45,7 @@ class Policy(models.Model):
(2,_('以宴席桌数为准')),
(3,_('严格的箱与桌公式设定')),
(4,_('箱数为主要条件,桌数为次要条件')),
(5,_('桌数为主要条件,箱数为次要条件')),
(6,_('按扫码瓶数换算箱数计算'))),default=3)
(5,_('桌数为主要条件,箱数为次要条件'))),default=3)
grades=models.JSONField(_('奖励等级'),default=list,blank=True,null=True)
# [{
......@@ -170,6 +169,8 @@ class Apply(models.Model):
(3, _('结算审核中')),
(4, _('结算中')),
(5, _('已结算')),
(6, _('开瓶数量不足,未通过结算奖励')),
(7, _('宴席资料异常')),
), default=0)
reason = 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):
actual_table_num = models.SmallIntegerField(_('实际宴席桌数'), blank=True, null=True, default=0)
actual_qty_x=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:
verbose_name = _('宴会申请')
......
......@@ -25,9 +25,9 @@ sK = 'fgfdvgu$#&3t@j'
from utils.views import time_key_check
from inventory.views import LabelQuery, decrypt_11h
from wx.views import transfer_batch
from mall.views import update_member_points_agent
import redis
import math
from mall.views import update_member_points_agent
#2020-12-21 微信redis库
......@@ -99,6 +99,8 @@ def banquetList(request,obj):
3: ['结算审核中','blue'],
4: ['结算中','blue'],
5: ['已结算','#07c160'],
6: ['开瓶数量不足,未通过结算奖励','red'],
7: ['宴席资料异常','red'],
}
status = dict[r[16]]
color = 'blue'
......@@ -317,6 +319,9 @@ def banquetList(request,obj):
data['data'].append([
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)
......@@ -385,7 +390,8 @@ def ajax_banquet(request,obj):
return JsonResponse(ajaxBanquetConsumerScanAnalysis(id))
elif obj == "manual_settle":
return ajaxBanquetManualSettle(request)
elif obj == "code_search":
return ajaxBanquetCodeSearch(request)
def ajaxBanquetApply(request):
res = {
......@@ -397,7 +403,6 @@ def ajaxBanquetApply(request):
'applyer_id' in d and
'category_id' in d and
'policy' in d and
'address' in d and
'table_num' in d and
'user_name' in d and
'user_phone' in d and
......@@ -408,7 +413,6 @@ def ajaxBanquetApply(request):
applyer_id = d['applyer_id']
category_id = d['category_id']
policy = d['policy']
address = d['address']
table_num = d['table_num']
user_name = d['user_name']
user_phone = d['user_phone']
......@@ -419,7 +423,6 @@ def ajaxBanquetApply(request):
applyer_id and
category_id and
policy and
address and
table_num and
user_name and
user_phone and
......@@ -433,14 +436,20 @@ def ajaxBanquetApply(request):
apply.ancestor_id = c.ancestor_id
apply.applyer_id = applyer_id
apply.company = c
if apply.status == 6:
res['e'] = '当前状态不允许修改'
return JsonResponse(res)
apply.category_id = category_id
if 'product_id' in d and d['product_id']:
product_id = d['product_id']
apply.product_id = product_id
if 'address' in d and d['address']:
apply.address = d['address']
apply.policy = policy
apply.address = address
apply.table_num = table_num
apply.user_name = user_name
apply.user_phone = user_phone
......@@ -872,9 +881,9 @@ def ajaxBanquetCancel(request):
if obj.status == 0:
obj.delete()
else:
res['e'] = '无法删除已审核申请'
data['e'] = '无法删除已审核申请'
else:
res['e'] = '数据丢失'
data['e'] = '数据丢失'
return JsonResponse(res)
......@@ -1096,10 +1105,15 @@ def ajaxBanquetSettle(request):
# 如果提交箱数和核销相同 且 实际桌数与申请桌数相同 则自动返利 并修改状态为结算中
if apply_codes_cnt == writeoff_cnt and apply.actual_table_num == apply.table_num:
if apply.ancestor_id == 208869:
d = ajaxBanquetConsumerScanAnalysis(id)
#print(d)
if d['scan_rate'] >= 0.5:
apply.status = 4 #结算中
apply.status = 3 #结算审核中
#pids = [10558, 10559, 10560, 10561, 10562]
# 如果是一代产品则直接结算
#if apply.product_id in pids:
# apply.status = 4 #结算中
#else:
# d = ajaxBanquetConsumerScanAnalysis(id)
# if d['scan_rate'] >= 1:
# apply.status = 4 #结算中
else:
apply.status = 4 #结算中
......@@ -1199,6 +1213,19 @@ def ajaxBanquetManualSettle(request):
data['e'] = '无数据'
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
def policy(request,action='list',id=None):
u=request.user
......@@ -1223,7 +1250,7 @@ def policy(request,action='list',id=None):
else:
form=PolicyForm(request.POST,instance=obj)
print(form)
if form.is_valid():
form.save()
......@@ -1510,37 +1537,25 @@ def close_applys(request,agent_id,apply_id=None):
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")
r = cur.fetchone()
if r:
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':
# 写入奖励记录产品名称
# 写入奖励记录
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 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 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+\
" group by label_pk_id,product_id"+\
") g group by product_id"+\
") gg"
print(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) "+\
......
......@@ -49,8 +49,10 @@
var status = {{status}}
if(status >= 3){
$("#status_select").html(`
<option value="2">驳回</option>
<option value="4">通过</option>
<option value="1">驳回(重新核销)</option>
<option value="2">驳回(重新申请)</option>
<option value="6">开瓶数量不足,未通过结算奖励</option>
`)
}
......@@ -62,6 +64,8 @@
3: ['结算审核中','blue'],
4: ['结算中','blue'],
5: ['已结算','#07c160'],
6: ['开瓶数量不足,未通过结算奖励','red'],
7: ['宴席资料异常','red'],
}
var firstLink = $(window.click_row).find('td:first a');
$(firstLink).text(status_dict[status][0])
......@@ -86,6 +90,7 @@
<option value="0">未审核</option>
<option value="1">通过</option>
<option value="2">未通过</option>
<option value="7">宴席资料异常</option>
</select>
</div>
</div>
......@@ -95,6 +100,7 @@
<textarea id="txt_remark" cols="30" rows="10" placeholder="填写备注" style="width: 100%;"></textarea>
</div>
</div>
<h3 style="text-align: center; margin-top:20px;">宴会信息审核</h3>
<div>
<button class="btn btn-primary" id="btn_permit" style="float:right;">保存</button>
</div>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论