Merge branch 'master' of http://gitea.xxhhcty.xyz:8080/zcdsj/factory
This commit is contained in:
commit
e001de9bb6
|
|
@ -0,0 +1,19 @@
|
||||||
|
# Generated by Django 3.2.12 on 2025-11-10 05:20
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('srm', '0005_platform_platstanding'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='platstanding',
|
||||||
|
name='platinfo',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='platstanding', to='srm.platform', verbose_name='平台信息'),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -132,6 +132,7 @@ class Platstanding(CommonADModel):
|
||||||
p_type = models.CharField("平台类型", max_length=50, null=True, blank=True)
|
p_type = models.CharField("平台类型", max_length=50, null=True, blank=True)
|
||||||
org = models.CharField("单位", max_length=100, null=True, blank=True)
|
org = models.CharField("单位", max_length=100, null=True, blank=True)
|
||||||
period = models.CharField("建设期", max_length=200, null=True, blank=True)
|
period = models.CharField("建设期", max_length=200, null=True, blank=True)
|
||||||
|
platinfo = models.ForeignKey('Platform', verbose_name="平台信息", on_delete=models.CASCADE, related_name='platstanding',null=True, blank=True)
|
||||||
city_p = models.BooleanField("市级平台", default=False)
|
city_p = models.BooleanField("市级平台", default=False)
|
||||||
province_p = models.BooleanField("省级平台", default=False)
|
province_p = models.BooleanField("省级平台", default=False)
|
||||||
plat_amount = models.DecimalField(max_digits=10,decimal_places=2, null=True,blank=True,verbose_name="平台资金(元)")
|
plat_amount = models.DecimalField(max_digits=10,decimal_places=2, null=True,blank=True,verbose_name="平台资金(元)")
|
||||||
|
|
|
||||||
|
|
@ -44,22 +44,22 @@ class PaperRecordSerializer(CustomModelSerializer):
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
read_only_fields = EXCLUDE_FIELDS
|
read_only_fields = EXCLUDE_FIELDS
|
||||||
|
|
||||||
class PlatformSerializer(serializers.ModelSerializer):
|
class PlatformSerializer(CustomModelSerializer):
|
||||||
create_by_name = serializers.CharField(source='create_by.name', read_only=True)
|
create_by_name = serializers.CharField(source='create_by.name', read_only=True)
|
||||||
belong_dept_name = serializers.CharField(source='belong_dept.name', read_only=True)
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Platform
|
model = Platform
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
read_only_fields = EXCLUDE_FIELDS
|
read_only_fields = EXCLUDE_FIELDS
|
||||||
|
|
||||||
class PlatstandingSerializer(serializers.ModelSerializer):
|
class PlatstandingSerializer(CustomModelSerializer):
|
||||||
|
platinfo_ = PlatformSerializer(source='platinfo', read_only=True)
|
||||||
create_by_name = serializers.CharField(source='create_by.name', read_only=True)
|
create_by_name = serializers.CharField(source='create_by.name', read_only=True)
|
||||||
belong_dept_name = serializers.CharField(source='belong_dept.name', read_only=True)
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Platstanding
|
model = Platstanding
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
read_only_fields = EXCLUDE_FIELDS
|
read_only_fields = EXCLUDE_FIELDS
|
||||||
|
|
||||||
|
|
||||||
# class ProjectSerializer(serializers.ModelSerializer):
|
# class ProjectSerializer(serializers.ModelSerializer):
|
||||||
# class Meta:
|
# class Meta:
|
||||||
# model = Project
|
# model = Project
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from apps.wf.models import Ticket
|
from apps.wf.models import Ticket
|
||||||
# TicketFlow, Transition, Workflow, CustomField, State,
|
# TicketFlow, Transition, Workflow, CustomField, State,
|
||||||
from apps.srm.models import PatentInfo, Papersecret
|
from apps.srm.models import PatentInfo, Papersecret, Platform
|
||||||
from rest_framework.exceptions import ParseError
|
from rest_framework.exceptions import ParseError
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -51,6 +51,32 @@ def paperse_save_ticket_data(ticket: Ticket, new_ticket_data: dict, **kwargs):
|
||||||
raise ParseError("Publicity t_id 不存在")
|
raise ParseError("Publicity t_id 不存在")
|
||||||
data_save = {k: v for k, v in new_ticket_data.items() if k not in ['t_model', 't_id']}
|
data_save = {k: v for k, v in new_ticket_data.items() if k not in ['t_model', 't_id']}
|
||||||
|
|
||||||
|
for k, v in data_save.items():
|
||||||
|
setattr(obj, k, v)
|
||||||
|
obj.save()
|
||||||
|
|
||||||
|
|
||||||
|
def platform(ticket: Ticket, transition, new_ticket_data: dict):
|
||||||
|
ins = Platform.objects.get(id=new_ticket_data['t_id'])
|
||||||
|
ticket_data = ticket.ticket_data
|
||||||
|
ticket_data.update({
|
||||||
|
't_model': 'platform',
|
||||||
|
't_id': ins.id,
|
||||||
|
})
|
||||||
|
ticket.ticket_data = ticket_data
|
||||||
|
ticket.create_by = ins.create_by
|
||||||
|
ticket.save()
|
||||||
|
if ins.ticket is None:
|
||||||
|
ins.ticket = ticket
|
||||||
|
ins.save()
|
||||||
|
|
||||||
|
def save_platform_data(ticket: Ticket, new_ticket_data: dict, **kwargs):
|
||||||
|
try:
|
||||||
|
obj = Platform.objects.get(id=new_ticket_data['t_id'])
|
||||||
|
except Platform.DoesNotExist:
|
||||||
|
raise ParseError("Publicity t_id 不存在")
|
||||||
|
data_save = {k: v for k, v in new_ticket_data.items() if k not in ['t_model', 't_id']}
|
||||||
|
|
||||||
for k, v in data_save.items():
|
for k, v in data_save.items():
|
||||||
setattr(obj, k, v)
|
setattr(obj, k, v)
|
||||||
obj.save()
|
obj.save()
|
||||||
Loading…
Reference in New Issue