feat: 质检统计增加班月month_sf
This commit is contained in:
parent
6df6b75499
commit
0abade21b7
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.2.12 on 2023-07-24 02:32
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('qm', '0006_auto_20230724_1017'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='quastat',
|
||||
name='type',
|
||||
field=models.CharField(default='day', help_text='year_s/month_s/month_sf/day_s/sflog', max_length=50, verbose_name='统计维度'),
|
||||
),
|
||||
]
|
|
@ -19,7 +19,7 @@ class QuaStat(CommonBDModel):
|
|||
"""
|
||||
质量数据统计表 需要有belong_dept
|
||||
"""
|
||||
type = models.CharField('统计维度', max_length=50, default='day', help_text='year_s/month_s/day_s/shift/sflog')
|
||||
type = models.CharField('统计维度', max_length=50, default='day', help_text='year_s/month_s/month_sf/day_s/sflog')
|
||||
year_s = models.PositiveSmallIntegerField('班年', null=True, blank=True)
|
||||
month_s = models.PositiveSmallIntegerField('班月', null=True, blank=True)
|
||||
day_s = models.PositiveSmallIntegerField('班日', null=True, blank=True)
|
||||
|
|
|
@ -7,7 +7,7 @@ from django.db.models import Sum, F, ExpressionWrapper, FloatField, Q
|
|||
def cal_quastat_type(qs, params_o: dict, type: str):
|
||||
params = params_o.copy()
|
||||
v_list = ['belong_dept', 'material', 'testitem', 'year_s', 'month_s', 'day_s', 'shift']
|
||||
if type == 'shift':
|
||||
if type == 'month_sf':
|
||||
params.pop('day_s')
|
||||
v_list = ['belong_dept', 'material', 'testitem', 'year_s', 'month_s', 'shift']
|
||||
elif type == 'month_s':
|
||||
|
@ -63,8 +63,6 @@ def cal_quastat(quastatId: str):
|
|||
}
|
||||
# 日统计
|
||||
cal_quastat_type(qs, params_o=params, type='day_s')
|
||||
# 班统计
|
||||
cal_quastat_type(qs, params_o=params, type='shift')
|
||||
# 班月统计
|
||||
cal_quastat_type(qs, params_o=params, type='month_sf')
|
||||
# 月统计
|
||||
|
|
Loading…
Reference in New Issue