Compare commits
2 Commits
2445ae53f1
...
9909596cdb
Author | SHA1 | Date |
---|---|---|
|
9909596cdb | |
|
6f4a1c4c88 |
|
@ -0,0 +1,20 @@
|
||||||
|
# Generated by Django 3.2.12 on 2025-09-25 07:41
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('wf', '0003_workflow_view_path'),
|
||||||
|
('ofm', '0012_publicity_ticket'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='mroomslot',
|
||||||
|
name='ticket',
|
||||||
|
field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='mrooms_ticket', to='wf.ticket', verbose_name='关联会议室'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -36,6 +36,8 @@ class MroomSlot(BaseModel):
|
||||||
booking = models.ForeignKey(MroomBooking, on_delete=models.CASCADE, related_name="slot_b")
|
booking = models.ForeignKey(MroomBooking, on_delete=models.CASCADE, related_name="slot_b")
|
||||||
mdate = models.DateField('会议日期', db_index=True)
|
mdate = models.DateField('会议日期', db_index=True)
|
||||||
slot = models.PositiveIntegerField('时段', help_text='0-47')
|
slot = models.PositiveIntegerField('时段', help_text='0-47')
|
||||||
|
ticket = models.ForeignKey('wf.ticket', verbose_name='关联会议室',
|
||||||
|
on_delete=models.SET_NULL, related_name='mrooms_ticket', null=True, blank=True, db_constraint=False)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
unique_together = ('mroom', 'mdate', 'slot')
|
unique_together = ('mroom', 'mdate', 'slot')
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
from apps.wf.models import Ticket
|
from apps.wf.models import Ticket
|
||||||
# TicketFlow, Transition, Workflow, CustomField, State,
|
# TicketFlow, Transition, Workflow, CustomField, State,
|
||||||
from apps.ofm.models import LendingSeal, Vehicle, BorrowRecord, Publicity
|
from apps.ofm.models import LendingSeal, Vehicle, BorrowRecord, Publicity, MroomSlot
|
||||||
from rest_framework.exceptions import ParseError
|
from rest_framework.exceptions import ParseError
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,6 +11,20 @@ def seal_submit_validate(ins: LendingSeal):
|
||||||
if ins.mtask and ins.mtask.state == LendingSeal.MTASK_STOP:
|
if ins.mtask and ins.mtask.state == LendingSeal.MTASK_STOP:
|
||||||
raise ParseError('该任务已停止!')
|
raise ParseError('该任务已停止!')
|
||||||
|
|
||||||
|
def bind_mslot(ticket: Ticket, transition, new_ticket_data: dict):
|
||||||
|
ins = MroomSlot.objects.get(id=new_ticket_data['t_id'])
|
||||||
|
ticket_data = ticket.ticket_data
|
||||||
|
ticket_data.update({
|
||||||
|
't_model': 'mroomslot',
|
||||||
|
'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 bind_lendingseal(ticket: Ticket, transition, new_ticket_data: dict):
|
def bind_lendingseal(ticket: Ticket, transition, new_ticket_data: dict):
|
||||||
ins = LendingSeal.objects.get(id=new_ticket_data['t_id'])
|
ins = LendingSeal.objects.get(id=new_ticket_data['t_id'])
|
||||||
ticket_data = ticket.ticket_data
|
ticket_data = ticket.ticket_data
|
||||||
|
|
Loading…
Reference in New Issue