Начальная структура MES: ShiftFlow, gunicorn и модели

This commit is contained in:
2026-03-27 15:52:47 +03:00
parent 9ab30f9a01
commit 70f4f5d761
15 changed files with 250 additions and 0 deletions

0
shiftflow/__init__.py Normal file
View File

3
shiftflow/admin.py Normal file
View File

@@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

5
shiftflow/apps.py Normal file
View File

@@ -0,0 +1,5 @@
from django.apps import AppConfig
class ShiftflowConfig(AppConfig):
name = 'shiftflow'

View File

40
shiftflow/models.py Normal file
View File

@@ -0,0 +1,40 @@
from django.db import models
# Create your models here.
from django.db import models
from django.utils import timezone
class Machine(models.Model):
name = models.CharField("Станок", max_length=100) # Лентопил, Труборез, Лазер
def __str__(self): return self.name
class Meta:
verbose_name = "Станок"; verbose_name_plural = "Станки"
class Item(models.Model):
STATUS_CHOICES = [
('new', 'В задании'),
('work', 'В работе'),
('done', 'Выполнено'),
]
date = models.DateField("Дата", default=timezone.now)
machine = models.ForeignKey(Machine, on_delete=models.PROTECT, verbose_name="Станок")
deal = models.CharField("№ Сделки", max_length=100) # Твои "Переходники" или заказы
drawing_name = models.CharField("Чертеж / Деталь", max_length=255)
# Характеристики из твоих файлов
material = models.CharField("Материал", max_length=255) # Труба 180х32, MS 12.00mm и т.д.
dim_value = models.FloatField("Размер (мм)", help_text="Длина реза или толщина листа")
quantity_plan = models.PositiveIntegerField("План, шт")
quantity_fact = models.PositiveIntegerField("Факт, шт", default=0)
priority = models.PositiveIntegerField("Приоритет", default=10)
status = models.CharField("Статус", max_length=10, choices=STATUS_CHOICES, default='new')
class Meta:
verbose_name = "Позиция"; verbose_name_plural = "Сменное задание"
ordering = ['-date', 'priority']
def __str__(self):
return f"{self.drawing_name} ({self.deal})"

3
shiftflow/tests.py Normal file
View File

@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

3
shiftflow/views.py Normal file
View File

@@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.