diff --git a/hb_server/apps/mtm/migrations/0010_auto_20210907_1111.py b/hb_server/apps/mtm/migrations/0010_auto_20210907_1111.py new file mode 100644 index 0000000..22ef6f8 --- /dev/null +++ b/hb_server/apps/mtm/migrations/0010_auto_20210907_1111.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.6 on 2021-09-07 03:11 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('mtm', '0009_techdoc'), + ] + + operations = [ + migrations.AlterField( + model_name='recordformfield', + name='boolean_field_display', + field=models.JSONField(blank=True, default=dict, help_text='当为布尔类型时候,可以支持自定义显示形式。{"1":"是","0":"否"}或{"1":"需要","0":"不需要"},注意数字也需要引号', null=True, verbose_name='布尔类型显示名'), + ), + migrations.AlterField( + model_name='recordformfield', + name='field_choice', + field=models.JSONField(blank=True, default=dict, help_text='radio,checkbox,select,multiselect类型可供选择的选项,格式为json如:{"1":"中国", "2":"美国"},注意数字也需要引号', null=True, verbose_name='radio、checkbox、select的选项'), + ), + ] diff --git a/hb_server/apps/mtm/models.py b/hb_server/apps/mtm/models.py index f38b152..038140c 100644 --- a/hb_server/apps/mtm/models.py +++ b/hb_server/apps/mtm/models.py @@ -109,9 +109,9 @@ class RecordFormField(CommonAModel): field_type = models.CharField('类型', max_length=50, choices=field_type_choices) field_key = models.CharField('字段标识', max_length=50, help_text='字段类型请尽量特殊,避免与系统中关键字冲突') field_name = models.CharField('字段名称', max_length=50) - boolean_field_display = models.JSONField('布尔类型显示名', default=dict, blank=True, + boolean_field_display = models.JSONField('布尔类型显示名', default=dict, blank=True, null=True, help_text='当为布尔类型时候,可以支持自定义显示形式。{"1":"是","0":"否"}或{"1":"需要","0":"不需要"},注意数字也需要引号') - field_choice = models.JSONField('radio、checkbox、select的选项', default=dict, blank=True, + field_choice = models.JSONField('radio、checkbox、select的选项', default=dict, blank=True, null=True, help_text='radio,checkbox,select,multiselect类型可供选择的选项,格式为json如:{"1":"中国", "2":"美国"},注意数字也需要引号') sort = models.IntegerField('排序号', default=1) class Meta: diff --git a/hb_server/apps/sam/models.py b/hb_server/apps/sam/models.py index 8f14d29..e5cdcb0 100644 --- a/hb_server/apps/sam/models.py +++ b/hb_server/apps/sam/models.py @@ -1,3 +1,5 @@ +from numpy import product +from apps.system.models import CommonAModel from django.db import models from django.contrib.auth.models import AbstractUser from django.db.models.base import Model @@ -6,10 +8,11 @@ from django.db.models.query import QuerySet from utils.model import SoftModel, BaseModel from simple_history.models import HistoricalRecords +from apps.mtm.models import Material -class Customer(BaseModel): +class Customer(CommonAModel): """ 客户信息 """ @@ -17,7 +20,7 @@ class Customer(BaseModel): country = models.CharField('所属国家', max_length=20, blank=True, null=True) address = models.CharField('详细地址', max_length=20, blank=True, null=True) contact = models.CharField('联系人', max_length=20, blank=True, null=True) - contactphone = models.CharField('联系电话', max_length=11,unique=True, blank=True, null=True) + phone = models.CharField('联系电话', max_length=11,unique=True, blank=True, null=True) description = models.CharField('描述', max_length=200, blank=True, null=True) class Meta: @@ -27,16 +30,16 @@ class Customer(BaseModel): def __str__(self): return self.name -class Contact(BaseModel): +class Contact(CommonAModel): """ 合同信息 """ name = models.CharField('合同名称', max_length=100) - number = models.CharField('合同编号', max_length=100, unique=True, blank=True, null=True) - money = models.IntegerField('合同金额', default=0, null=True, blank=True) + number = models.CharField('合同编号', max_length=100, unique=True) + amount = models.IntegerField('合同金额', default=0) customer = models.ForeignKey(Customer, verbose_name='关联客户', on_delete=models.CASCADE, related_name='contact_customer') # contactuser = models.CharField('合同签订人', max_length=100, unique=True, blank=True, null=True) - date = models.DateField('签订日期', null=True, blank=True) + sign_date = models.DateField('签订日期') description = models.CharField('描述', max_length=200, blank=True, null=True) class Meta: @@ -46,11 +49,16 @@ class Contact(BaseModel): def __str__(self): return self.name -class Order(BaseModel): +class Order(CommonAModel): """ 订单信息 """ number = models.CharField('订单编号', max_length=100) + customer = models.ForeignKey(Customer, verbose_name='客户', on_delete=models.CASCADE) + contact = models.ForeignKey(Contact, verbose_name='所属合同', null=True, blank=True) + product = models.ForeignKey(Material, verbose_name='所需产品') + count = models.IntegerField('所需数量', default=0) + delivery_date = models.DateField('交货日期') class Meta: verbose_name = '订单信息' verbose_name_plural = verbose_name diff --git a/hb_server/requirements.txt b/hb_server/requirements.txt index 5cc912b..595fea2 100644 --- a/hb_server/requirements.txt +++ b/hb_server/requirements.txt @@ -10,4 +10,3 @@ drf-yasg==1.20.0 psutil==5.8.0 pillow==8.3.1 opencv-python==4.5.3.56 -face-gecognition==1.3.0