eval函数调整
This commit is contained in:
parent
5046f4dbb1
commit
c5fc214c10
|
@ -6,7 +6,7 @@ from apps.system.models import CommonAModel, CommonBModel, Organization, User, D
|
|||
from utils.model import SoftModel, BaseModel
|
||||
from simple_history.models import HistoricalRecords
|
||||
from apps.mtm.models import Material
|
||||
|
||||
from apps.pm.models import SubProductionPlan
|
||||
|
||||
|
||||
class WareHouse(CommonAModel):
|
||||
|
@ -57,4 +57,13 @@ class FIFO(CommonAModel):
|
|||
(3, '采购入库'),
|
||||
(4, '生产入库')
|
||||
)
|
||||
type = models.IntegerField('出入库类型', default=1)
|
||||
type = models.IntegerField('出入库类型', default=1)
|
||||
operator = models.ForeignKey(User, verbose_name='操作人', on_delete=models.CASCADE)
|
||||
subproduction_plan = models.ForeignKey(SubProductionPlan, verbose_name='关联子生产计划', on_delete=models.DO_NOTHING, null=True, blank=True)
|
||||
|
||||
class FIFODetail(CommonAModel):
|
||||
"""
|
||||
领料详细记录
|
||||
"""
|
||||
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ from rest_framework.exceptions import APIException
|
|||
from django.utils import timezone
|
||||
from datetime import timedelta
|
||||
import random
|
||||
from ast import literal_eval
|
||||
|
||||
class WfService(object):
|
||||
@staticmethod
|
||||
def get_worlflow_states(workflow:Workflow):
|
||||
|
@ -116,7 +116,7 @@ class WfService(object):
|
|||
for i in transition.condition_expression:
|
||||
expression = i['expression'].format(**ticket_all_value)
|
||||
import datetime, time # 用于支持条件表达式中对时间的操作
|
||||
if literal_eval(expression):
|
||||
if eval(expression):
|
||||
destination_state = State.objects.get(pk=i['target_state'])
|
||||
return destination_state
|
||||
|
||||
|
|
Loading…
Reference in New Issue