|
|
@@ -37,33 +37,32 @@ class Command(CompatibilityBaseCommand):
|
37
|
37
|
|
38
|
38
|
distributors = DistributorInfo.objects.filter(brand_id=b.brand_id, status=True)
|
39
|
39
|
models = ModelInfo.objects.filter(brand_id=b.brand_id, status=True)
|
40
|
|
- for log in logs:
|
41
|
|
- for m in models:
|
42
|
|
- logs = SaleclerkSubmitLogInfo.objects.filter(model_pk=m.pk, dupload=False, test_sn=False, status=True)
|
43
|
|
- for d in distributors:
|
44
|
|
- saleclerks = SaleclerkInfo.objects.filter(brand_id=b.brand_id, distributor_id=d.distributor_id, status=True)
|
45
|
|
- yesterday_num = 0
|
46
|
|
- current_month = 0
|
47
|
|
- last_month = 0
|
48
|
|
- for saleclerk in saleclerks:
|
49
|
|
- log = logs.filter(clerk_id=saleclerk.clerk_id)
|
50
|
|
- yesterday_num += logs.filter(ymd=lastday).count()
|
51
|
|
- current_month += logs.filter(ym=month).count()
|
52
|
|
- last_month += logs.filter(ym=lastmonth).count()
|
53
|
|
- if m.is_important or (yesterday_num or current_month or last_month):
|
54
|
|
- SalesResponsibilityInfoModelsSaleStatisticInfo.objects.create(
|
55
|
|
- brand_id=b.brand_id,
|
56
|
|
- sr_id=d.sr_id,
|
57
|
|
- distributor_id=d.distributor_id,
|
58
|
|
- distributor_name=d.distributor_name,
|
59
|
|
- model_id=m.model_id,
|
60
|
|
- model_name=m.model_name,
|
61
|
|
- is_important=m.is_important,
|
62
|
|
- ymd=day,
|
63
|
|
- yesterday_num=yesterday_num,
|
64
|
|
- current_month=current_month,
|
65
|
|
- last_month=last_month,
|
66
|
|
- )
|
|
40
|
+ for m in models:
|
|
41
|
+ logs = SaleclerkSubmitLogInfo.objects.filter(model_pk=m.pk, dupload=False, test_sn=False, status=True)
|
|
42
|
+ for d in distributors:
|
|
43
|
+ saleclerks = SaleclerkInfo.objects.filter(brand_id=b.brand_id, distributor_id=d.distributor_id, status=True)
|
|
44
|
+ yesterday_num = 0
|
|
45
|
+ current_month = 0
|
|
46
|
+ last_month = 0
|
|
47
|
+ for saleclerk in saleclerks:
|
|
48
|
+ log = logs.filter(clerk_id=saleclerk.clerk_id)
|
|
49
|
+ yesterday_num += logs.filter(ymd=lastday).count()
|
|
50
|
+ current_month += logs.filter(ym=month).count()
|
|
51
|
+ last_month += logs.filter(ym=lastmonth).count()
|
|
52
|
+ if m.is_important or (yesterday_num or current_month or last_month):
|
|
53
|
+ SalesResponsibilityInfoModelsSaleStatisticInfo.objects.create(
|
|
54
|
+ brand_id=b.brand_id,
|
|
55
|
+ sr_id=d.sr_id,
|
|
56
|
+ distributor_id=d.distributor_id,
|
|
57
|
+ distributor_name=d.distributor_name,
|
|
58
|
+ model_id=m.model_id,
|
|
59
|
+ model_name=m.model_name,
|
|
60
|
+ is_important=m.is_important,
|
|
61
|
+ ymd=day,
|
|
62
|
+ yesterday_num=yesterday_num,
|
|
63
|
+ current_month=current_month,
|
|
64
|
+ last_month=last_month,
|
|
65
|
+ )
|
67
|
66
|
|
68
|
67
|
srs = SalesResponsibilityInfo.objects.filter(brand_id=b.brand_id, status=True)
|
69
|
68
|
for s in srs:
|