|
|
406
|
+ mssi.saleclerks += [clerk.clerk_id]
|
|
|
407
|
+ mssi.num = len(mssi.saleclerks)
|
|
|
408
|
+ mssi.save()
|
|
|
409
|
+
|
|
|
410
|
+ mssi, _ = ModelSaleStatisticInfo.objects.select_for_update().get_or_create(
|
|
|
411
|
+ brand_id=brand.brand_id,
|
|
|
412
|
+ model_name=model.model_uni_name,
|
|
|
413
|
+ ymd=ymd[:4],
|
|
|
414
|
+ )
|
|
|
415
|
+ mssi.saleclerks += [clerk.clerk_id]
|
|
|
416
|
+ mssi.num = len(mssi.saleclerks)
|
|
|
417
|
+ mssi.save()
|
|
|
418
|
+
|
|
|
419
|
+ # 经销商销量统计
|
|
|
420
|
+ dssi, _ = DistributorSaleStatisticInfo.objects.select_for_update().get_or_create(
|
|
|
421
|
+ brand_id=brand.brand_id,
|
|
|
422
|
+ distributor_id=distributor.distributor_id,
|
|
|
423
|
+ ymd=ymd,
|
|
|
424
|
+ )
|
|
|
425
|
+ dssi.distributor_name = distributor.distributor_name
|
|
|
426
|
+ dssi.num += 1
|
|
|
427
|
+ dssi.save()
|
|
|
428
|
+
|
|
|
429
|
+ dssi2, _ = DistributorSaleStatisticInfo.objects.select_for_update().get_or_create(
|
|
|
430
|
+ brand_id=brand.brand_id,
|
|
|
431
|
+ distributor_id=distributor.distributor_id,
|
|
|
432
|
+ ymd=0,
|
|
|
433
|
+ )
|
|
|
434
|
+ dssi2.distributor_name = distributor.distributor_name
|
|
|
435
|
+ dssi2.num += 1
|
|
|
436
|
+ dssi2.save()
|
|
|
437
|
+
|
|
|
438
|
+ # 日省份销量统计
|
|
|
439
|
+ pssi, _ = ProvinceSaleStatisticInfo.objects.select_for_update().get_or_create(
|
|
|
440
|
+ brand_id=brand.brand_id,
|
|
|
441
|
+ province_code=distributor.distributor_province_code,
|
|
|
442
|
+ ymd=ymd,
|
|
|
443
|
+ )
|
|
|
444
|
+ pssi.province_name = distributor.distributor_province_name
|
|
|
445
|
+ pssi.num += 1
|
|
|
446
|
+ pssi.save()
|
|
|
447
|
+ # 月省份销量统计
|
|
|
448
|
+ pssi, _ = ProvinceSaleStatisticInfo.objects.select_for_update().get_or_create(
|
|
|
449
|
+ brand_id=brand.brand_id,
|
|
|
450
|
+ province_code=distributor.distributor_province_code,
|
|
|
451
|
+ ymd=ymd[:6],
|
|
|
452
|
+ )
|
|
|
453
|
+ pssi.province_name = distributor.distributor_province_name
|
|
|
454
|
+ pssi.num += 1
|
|
|
455
|
+ pssi.save()
|
|
|
456
|
+ # 年省份销量统计
|
|
|
457
|
+ pssi, _ = ProvinceSaleStatisticInfo.objects.select_for_update().get_or_create(
|
|
|
458
|
+ brand_id=brand.brand_id,
|
|
|
459
|
+ province_code=distributor.distributor_province_code,
|
|
|
460
|
+ ymd=ymd[:4],
|
|
|
461
|
+ )
|
|
|
462
|
+ pssi.province_name = distributor.distributor_province_name
|
|
|
463
|
+ pssi.num += 1
|
|
|
464
|
+ pssi.save()
|
|
|
465
|
+
|
|
|
466
|
+ # 日销售员销量统计
|
|
|
467
|
+ sssi, _ = SaleclerkSaleStatisticInfo.objects.select_for_update().get_or_create(
|
|
|
468
|
+ brand_id=brand.brand_id,
|
|
|
469
|
+ clerk_id=clerk.clerk_id,
|
|
|
470
|
+ ymd=ymd,
|
|
|
471
|
+ )
|
|
|
472
|
+ sssi.distributor_id = distributor.distributor_id
|
|
|
473
|
+ sssi.distributor_name = distributor.distributor_name
|
|
|
474
|
+ sssi.distributor_short_name = distributor.distributor_short_name
|
|
|
475
|
+ sssi.clerk_name = clerk.clerk_name
|
|
|
476
|
+ sssi.num += 1
|
|
|
477
|
+ sssi.save()
|
|
|
478
|
+ # 月销售员销量统计
|
|
|
479
|
+ sssi, _ = SaleclerkSaleStatisticInfo.objects.select_for_update().get_or_create(
|
|
|
480
|
+ brand_id=brand.brand_id,
|
|
|
481
|
+ clerk_id=clerk.clerk_id,
|
|
|
482
|
+ ymd=ymd[:6],
|
|
|
483
|
+ )
|
|
|
484
|
+ sssi.distributor_id = distributor.distributor_id
|
|
|
485
|
+ sssi.distributor_name = distributor.distributor_name
|
|
|
486
|
+ sssi.distributor_short_name = distributor.distributor_short_name
|
|
|
487
|
+ sssi.clerk_name = clerk.clerk_name
|
|
|
488
|
+ sssi.num += 1
|
|
|
489
|
+ sssi.save()
|
|
|
490
|
+ # 年销售员销量统计
|
|
|
491
|
+ sssi, _ = SaleclerkSaleStatisticInfo.objects.select_for_update().get_or_create(
|
|
|
492
|
+ brand_id=brand.brand_id,
|
|
|
493
|
+ clerk_id=clerk.clerk_id,
|
|
|
494
|
+ ymd=ymd[:4],
|
|
|
495
|
+ )
|
|
|
496
|
+ sssi.distributor_id = distributor.distributor_id
|
|
|
497
|
+ sssi.distributor_name = distributor.distributor_name
|
|
|
498
|
+ sssi.distributor_short_name = distributor.distributor_short_name
|
|
|
499
|
+ sssi.clerk_name = clerk.clerk_name
|
|
|
500
|
+ sssi.num += 1
|
|
|
501
|
+ sssi.save()
|
|
|
|
@@ -3,4 +3,5 @@ from __future__ import unicode_literals
|
|
3
|
3
|
|
|
4
|
4
|
from django.contrib import admin
|
|
5
|
5
|
|
|
|
6
|
+
|
|
6
|
7
|
# Register your models here.
|
|
|
|
@@ -3,4 +3,5 @@ from __future__ import unicode_literals
|
|
3
|
3
|
|
|
4
|
4
|
from django.db import models
|
|
5
|
5
|
|
|
|
6
|
+
|
|
6
|
7
|
# Create your models here.
|
|
|
|
@@ -3,4 +3,5 @@ from __future__ import unicode_literals
|
|
3
|
3
|
|
|
4
|
4
|
from django.test import TestCase
|
|
5
|
5
|
|
|
|
6
|
+
|
|
6
|
7
|
# Create your tests here.
|
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+# -*- coding: utf-8 -*-
|
|
|
2
|
+
|
|
|
3
|
+from django.contrib import admin
|
|
|
4
|
+
|
|
|
5
|
+from staff.models import StaffDeleteClerkSaleSubmitLogInfo
|
|
|
6
|
+
|
|
|
7
|
+
|
|
|
8
|
+class StaffDeleteClerkSaleSubmitLogInfoAdmin(admin.ModelAdmin):
|
|
|
9
|
+ list_display = ('username', 'code', 'status', 'created_at', 'updated_at')
|
|
|
10
|
+
|
|
|
11
|
+
|
|
|
12
|
+admin.site.register(StaffDeleteClerkSaleSubmitLogInfo, StaffDeleteClerkSaleSubmitLogInfoAdmin)
|
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+# -*- coding: utf-8 -*-
|
|
|
2
|
+from __future__ import unicode_literals
|
|
|
3
|
+
|
|
|
4
|
+from django.apps import AppConfig
|
|
|
5
|
+
|
|
|
6
|
+
|
|
|
7
|
+class StaffConfig(AppConfig):
|
|
|
8
|
+ name = 'staff'
|
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+# -*- coding: utf-8 -*-
|
|
|
2
|
+# Generated by Django 1.11.28 on 2020-03-01 13:19
|
|
|
3
|
+from __future__ import unicode_literals
|
|
|
4
|
+
|
|
|
5
|
+from django.db import migrations, models
|
|
|
6
|
+
|
|
|
7
|
+
|
|
|
8
|
+class Migration(migrations.Migration):
|
|
|
9
|
+
|
|
|
10
|
+ initial = True
|
|
|
11
|
+
|
|
|
12
|
+ dependencies = [
|
|
|
13
|
+ ]
|
|
|
14
|
+
|
|
|
15
|
+ operations = [
|
|
|
16
|
+ migrations.CreateModel(
|
|
|
17
|
+ name='StaffDeleteClerkSaleSubmitLogInfo',
|
|
|
18
|
+ fields=[
|
|
|
19
|
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
|
20
|
+ ('status', models.BooleanField(db_index=True, default=True, help_text='Status', verbose_name='status')),
|
|
|
21
|
+ ('created_at', models.DateTimeField(auto_now_add=True, help_text='Create Time', verbose_name='created_at')),
|
|
|
22
|
+ ('updated_at', models.DateTimeField(auto_now=True, help_text='Update Time', verbose_name='updated_at')),
|
|
|
23
|
+ ('username', models.CharField(blank=True, db_index=True, help_text='\u7528\u6237\u540d', max_length=32, null=True, verbose_name='username')),
|
|
|
24
|
+ ('code', models.CharField(blank=True, db_index=True, help_text='\u673a\u8eab\u7801', max_length=32, null=True, verbose_name='code')),
|
|
|
25
|
+ ],
|
|
|
26
|
+ options={
|
|
|
27
|
+ 'verbose_name': 'staffdeleteclerksalesubmitloginfo',
|
|
|
28
|
+ 'verbose_name_plural': 'staffdeleteclerksalesubmitloginfo',
|
|
|
29
|
+ },
|
|
|
30
|
+ ),
|
|
|
31
|
+ ]
|
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+# -*- coding: utf-8 -*-
|
|
|
2
|
+
|
|
|
3
|
+from django.db import models
|
|
|
4
|
+from django.utils.translation import ugettext_lazy as _
|
|
|
5
|
+from django_models_ext import BaseModelMixin
|
|
|
6
|
+
|
|
|
7
|
+
|
|
|
8
|
+class StaffDeleteClerkSaleSubmitLogInfo(BaseModelMixin):
|
|
|
9
|
+ username = models.CharField(_(u'username'), max_length=32, blank=True, null=True, help_text=u'用户名', db_index=True)
|
|
|
10
|
+ code = models.CharField(_(u'code'), max_length=32, blank=True, null=True, help_text=u'机身码', db_index=True)
|
|
|
11
|
+
|
|
|
12
|
+ class Meta:
|
|
|
13
|
+ verbose_name = _(u'staffdeleteclerksalesubmitloginfo')
|
|
|
14
|
+ verbose_name_plural = _(u'staffdeleteclerksalesubmitloginfo')
|
|
|
15
|
+
|
|
|
16
|
+ def __unicode__(self):
|
|
|
17
|
+ return unicode(self.pk)
|
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+# -*- coding: utf-8 -*-
|
|
|
2
|
+from __future__ import unicode_literals
|
|
|
3
|
+
|
|
|
4
|
+from django.test import TestCase
|
|
|
5
|
+
|
|
|
6
|
+# Create your tests here.
|
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+# -*- coding: utf-8 -*-
|
|
|
2
|
+from __future__ import unicode_literals
|
|
|
3
|
+
|
|
|
4
|
+from django.shortcuts import render
|
|
|
5
|
+
|
|
|
6
|
+# Create your views here.
|