创建操作时同步设备状态
This commit is contained in:
parent
e5bef0f5ef
commit
b8824e94ac
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.2.9 on 2022-01-18 00:39
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('em', '0009_auto_20210916_1108'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='equipment',
|
||||
name='state',
|
||||
field=models.PositiveIntegerField(choices=[(0, '完好'), (1, '限用'), (2, '在修'), (3, '禁用')], default=0, verbose_name='设备状态'),
|
||||
),
|
||||
]
|
|
@ -14,11 +14,16 @@ class Equipment(CommonBModel):
|
|||
"""
|
||||
设备台账信息
|
||||
"""
|
||||
EQUIP_STATE_OK = 0
|
||||
EQUIP_STATE_LIMIT = 1
|
||||
EQUIP_STATE_FIX = 2
|
||||
EQUIP_STATE_DISABLE = 3
|
||||
state_choices = (
|
||||
(0, '完好'),
|
||||
(1, '限用'),
|
||||
(2, '在修'),
|
||||
(3, '禁用')
|
||||
(EQUIP_STATE_OK, '完好'),
|
||||
(EQUIP_STATE_LIMIT, '限用'),
|
||||
(EQUIP_STATE_FIX, '在修'),
|
||||
(EQUIP_STATE_DISABLE, '禁用')
|
||||
|
||||
)
|
||||
statedm_choices = (
|
||||
(0, '合格'),
|
||||
|
@ -54,7 +59,7 @@ class Equipment(CommonBModel):
|
|||
factory = models.CharField('生产厂', max_length=50, null=True, blank=True)
|
||||
production_date = models.DateField('生产日期', null=True, blank=True)
|
||||
buy_date = models.DateField('购置日期', null=True, blank=True)
|
||||
state = models.CharField('设备状态', max_length=11, choices=state_choices, default=0)
|
||||
state = models.PositiveIntegerField('设备状态', choices=state_choices, default=0)
|
||||
parameter = models.TextField('技术参数', null=True, blank=True)
|
||||
place = models.CharField('存放位置', max_length=50, null=True, blank=True)
|
||||
count = models.IntegerField('数量', default=0)
|
||||
|
|
|
@ -36,8 +36,8 @@ class Employee(CommonAModel):
|
|||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class Attendance(CommonADModel):
|
||||
"""
|
||||
出勤记录
|
||||
"""
|
||||
# class Attendance(CommonADModel):
|
||||
# """
|
||||
# 出勤记录
|
||||
# """
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
# Generated by Django 3.2.9 on 2022-01-18 00:39
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('sam', '0010_auto_20211208_1408'),
|
||||
('pm', '0022_auto_20211229_1429'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='productionplan',
|
||||
name='order',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='plan_order', to='sam.order', verbose_name='关联订单'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.2.9 on 2022-01-18 00:39
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('wpm', '0048_operationwproduct_place'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='operationequip',
|
||||
name='state',
|
||||
field=models.PositiveSmallIntegerField(choices=[(0, '完好'), (1, '限用'), (2, '在修'), (3, '禁用')], default=0, verbose_name='当前设备状态'),
|
||||
),
|
||||
]
|
|
@ -336,4 +336,5 @@ class OperationEquip(BaseModel):
|
|||
Operation, verbose_name='关联操作', on_delete=models.CASCADE, related_name='oe_operation')
|
||||
equip = models.ForeignKey(Equipment, verbose_name='生产设备',
|
||||
on_delete=models.CASCADE, related_name='oe_equip')
|
||||
state = models.PositiveSmallIntegerField('当前设备状态', choices=Equipment.state_choices, default=Equipment.EQUIP_STATE_OK)
|
||||
remark = models.TextField('备注', null=True, blank=True)
|
||||
|
|
|
@ -559,6 +559,7 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
|
|||
ope = OperationEquip()
|
||||
ope.operation = op
|
||||
ope.equip = i
|
||||
ope.state = i.state
|
||||
ope.save()
|
||||
# 查询所需的工具工装
|
||||
for i in SubprodctionMaterial.objects.filter(type=SubprodctionMaterial.SUB_MA_TYPE_TOOL,
|
||||
|
|
Loading…
Reference in New Issue