Compare commits
4 Commits
main
...
72f1d53051
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72f1d53051 | ||
|
|
b1e0693131 | ||
|
|
86713fc75f | ||
|
|
f108e013c2 |
10
.gitignore
vendored
10
.gitignore
vendored
@@ -1,11 +1,9 @@
|
|||||||
*.csv
|
|
||||||
.vscode
|
.vscode
|
||||||
instance
|
.idea
|
||||||
venv/
|
venv/
|
||||||
123
|
instance/
|
||||||
|
__pycache__/
|
||||||
|
migrations/
|
||||||
*.csv
|
*.csv
|
||||||
*.db
|
*.db
|
||||||
c*.txt
|
c*.txt
|
||||||
migrations
|
|
||||||
__pycache__
|
|
||||||
.idea
|
|
||||||
|
|||||||
2
backend/__init__.py
Normal file
2
backend/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
"""Backend package initializer."""
|
||||||
|
|
||||||
5
backend/create_new_db.py
Normal file
5
backend/create_new_db.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
from backend.models import Base
|
||||||
|
from backend.database import engine
|
||||||
|
|
||||||
|
Base.metadata.drop_all(bind=engine) # Опционально, если вдруг есть
|
||||||
|
Base.metadata.create_all(bind=engine)
|
||||||
15
backend/database.py
Normal file
15
backend/database.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# backend/database.py
|
||||||
|
from sqlalchemy import create_engine
|
||||||
|
from sqlalchemy.orm import sessionmaker, scoped_session
|
||||||
|
|
||||||
|
SQLALCHEMY_DATABASE_URL = "sqlite:///./app.db" # или PostgreSQL URL
|
||||||
|
|
||||||
|
engine = create_engine(SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False})
|
||||||
|
SessionLocal = scoped_session(sessionmaker(autocommit=False, autoflush=False, bind=engine))
|
||||||
|
|
||||||
|
def get_db():
|
||||||
|
db = SessionLocal()
|
||||||
|
try:
|
||||||
|
yield db
|
||||||
|
finally:
|
||||||
|
db.close()
|
||||||
43
backend/main.py
Normal file
43
backend/main.py
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# backend/main.py
|
||||||
|
from fastapi import FastAPI
|
||||||
|
from fastapi.responses import RedirectResponse
|
||||||
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
|
|
||||||
|
from backend.routers.equipment_types import equipment_types
|
||||||
|
from backend.routers.auditories import auditories
|
||||||
|
from backend.routers.oboruds import oboruds
|
||||||
|
from backend.routers.components import components
|
||||||
|
from backend.routers.rashodniki import consumables
|
||||||
|
from backend.routers.zametki import zametki
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
app = FastAPI()
|
||||||
|
|
||||||
|
# Для фронтенда Vue.js
|
||||||
|
app.add_middleware(
|
||||||
|
CORSMiddleware,
|
||||||
|
allow_origins=["*"], # заменить на ['http://localhost:5173'] для безопасности
|
||||||
|
allow_credentials=True,
|
||||||
|
allow_methods=["*"],
|
||||||
|
allow_headers=["*"],
|
||||||
|
)
|
||||||
|
|
||||||
|
@app.get("/ping")
|
||||||
|
def ping():
|
||||||
|
return {"message": "pong"}
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/")
|
||||||
|
def root():
|
||||||
|
return RedirectResponse(url="/docs")
|
||||||
|
|
||||||
|
|
||||||
|
# Подключение роутов
|
||||||
|
app.include_router(equipment_types)
|
||||||
|
app.include_router(auditories)
|
||||||
|
app.include_router(oboruds)
|
||||||
|
app.include_router(components)
|
||||||
|
app.include_router(consumables)
|
||||||
|
app.include_router(zametki)
|
||||||
69
backend/migrate_data.py
Normal file
69
backend/migrate_data.py
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
import sys
|
||||||
|
from sqlalchemy import create_engine, text
|
||||||
|
from sqlalchemy.orm import sessionmaker
|
||||||
|
from backend.database import SessionLocal as NewSession
|
||||||
|
from backend import models
|
||||||
|
|
||||||
|
OLD_DB_URL = "sqlite:///./backend/old_app.db"
|
||||||
|
old_engine = create_engine(OLD_DB_URL, connect_args={"check_same_thread": False})
|
||||||
|
OldSession = sessionmaker(bind=old_engine)
|
||||||
|
old_db = OldSession()
|
||||||
|
|
||||||
|
new_db = NewSession()
|
||||||
|
|
||||||
|
def log(msg: str):
|
||||||
|
print(f"[INFO] {msg}", file=sys.stderr)
|
||||||
|
|
||||||
|
def migrate():
|
||||||
|
log("Запуск переноса данных из old_app.db → app.db")
|
||||||
|
|
||||||
|
# Тип оборудования по умолчанию
|
||||||
|
log("Добавление типа оборудования по умолчанию: 'Неизвестно'")
|
||||||
|
default_type = models.EquipmentType(name="Неизвестно")
|
||||||
|
new_db.add(default_type)
|
||||||
|
new_db.commit()
|
||||||
|
|
||||||
|
# Перенос аудиторий
|
||||||
|
log("Перенос аудиторий...")
|
||||||
|
auditory_map = {}
|
||||||
|
aud_rows = old_db.execute(text("SELECT id, audnazvanie FROM auditory")).fetchall()
|
||||||
|
for aud in aud_rows:
|
||||||
|
new_aud = models.Auditory(audnazvanie=aud.audnazvanie)
|
||||||
|
new_db.add(new_aud)
|
||||||
|
new_db.flush()
|
||||||
|
auditory_map[aud.id] = new_aud.id
|
||||||
|
log(f" → перенесено: {len(aud_rows)}")
|
||||||
|
|
||||||
|
# Перенос оборудования
|
||||||
|
log("Перенос оборудования...")
|
||||||
|
ob_rows = old_db.execute(text("SELECT * FROM oboruds")).fetchall()
|
||||||
|
for ob in ob_rows:
|
||||||
|
new_ob = models.Oboruds(
|
||||||
|
invNumber=ob.invNumber,
|
||||||
|
nazvanie=ob.nazvanie,
|
||||||
|
raspologenie=ob.raspologenie,
|
||||||
|
numberppasu=ob.numberppasu,
|
||||||
|
kolichestvo=ob.kolichestvo,
|
||||||
|
aud_id=auditory_map.get(ob.aud_id),
|
||||||
|
type_id=default_type.id
|
||||||
|
)
|
||||||
|
new_db.add(new_ob)
|
||||||
|
log(f" → перенесено: {len(ob_rows)}")
|
||||||
|
|
||||||
|
# Перенос заметок
|
||||||
|
log("Перенос заметок...")
|
||||||
|
z_rows = old_db.execute(text("SELECT * FROM zametki")).fetchall()
|
||||||
|
for z in z_rows:
|
||||||
|
new_z = models.Zametki(
|
||||||
|
txtzam=z.txtzam,
|
||||||
|
created_date=z.created_date,
|
||||||
|
rmdt=z.rmdt
|
||||||
|
)
|
||||||
|
new_db.add(new_z)
|
||||||
|
log(f" → перенесено: {len(z_rows)}")
|
||||||
|
|
||||||
|
new_db.commit()
|
||||||
|
log("✅ Перенос завершён успешно.")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
migrate()
|
||||||
80
backend/models.py
Normal file
80
backend/models.py
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
# backend/models.py
|
||||||
|
|
||||||
|
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime
|
||||||
|
from sqlalchemy.orm import relationship, declarative_base
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Auditory(Base):
|
||||||
|
__tablename__ = 'auditories'
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True)
|
||||||
|
audnazvanie = Column(String)
|
||||||
|
|
||||||
|
oboruds = relationship("Oboruds", back_populates="auditory")
|
||||||
|
|
||||||
|
|
||||||
|
class EquipmentType(Base):
|
||||||
|
__tablename__ = 'equipment_types'
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True)
|
||||||
|
name = Column(String, unique=True, nullable=False)
|
||||||
|
|
||||||
|
oboruds = relationship("Oboruds", back_populates="type")
|
||||||
|
|
||||||
|
|
||||||
|
class Oboruds(Base):
|
||||||
|
__tablename__ = 'oboruds'
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True)
|
||||||
|
invNumber = Column(Integer)
|
||||||
|
nazvanie = Column(String(500))
|
||||||
|
raspologenie = Column(String(200))
|
||||||
|
numberppasu = Column(String(100))
|
||||||
|
kolichestvo = Column(Integer)
|
||||||
|
|
||||||
|
aud_id = Column(Integer, ForeignKey("auditories.id"))
|
||||||
|
auditory = relationship("Auditory", back_populates="oboruds")
|
||||||
|
|
||||||
|
type_id = Column(Integer, ForeignKey("equipment_types.id"))
|
||||||
|
type = relationship("EquipmentType", back_populates="oboruds")
|
||||||
|
|
||||||
|
components = relationship("Component", back_populates="oborud")
|
||||||
|
consumables = relationship("Consumable", back_populates="oborud")
|
||||||
|
|
||||||
|
|
||||||
|
class Component(Base):
|
||||||
|
__tablename__ = 'components'
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True)
|
||||||
|
name = Column(String, nullable=False)
|
||||||
|
description = Column(String)
|
||||||
|
|
||||||
|
oborud_id = Column(Integer, ForeignKey("oboruds.id"))
|
||||||
|
oborud = relationship("Oboruds", back_populates="components")
|
||||||
|
|
||||||
|
|
||||||
|
class Consumable(Base):
|
||||||
|
__tablename__ = 'consumables'
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True)
|
||||||
|
name = Column(String, nullable=False)
|
||||||
|
description = Column(String)
|
||||||
|
|
||||||
|
oborud_id = Column(Integer, ForeignKey("oboruds.id"))
|
||||||
|
oborud = relationship("Oboruds", back_populates="consumables")
|
||||||
|
|
||||||
|
|
||||||
|
class Zametki(Base):
|
||||||
|
__tablename__ = 'zametki'
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True)
|
||||||
|
txtzam = Column(String(10000))
|
||||||
|
created_date = Column(DateTime, default=datetime.datetime.utcnow)
|
||||||
|
rmdt = Column(DateTime)
|
||||||
BIN
backend/requirements.txt
Normal file
BIN
backend/requirements.txt
Normal file
Binary file not shown.
2
backend/routers/__init__.py
Normal file
2
backend/routers/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
"""Routers package initializer."""
|
||||||
|
|
||||||
18
backend/routers/auditories.py
Normal file
18
backend/routers/auditories.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
from fastapi import APIRouter, Depends
|
||||||
|
from sqlalchemy.orm import Session
|
||||||
|
from .. import models, schemas, database
|
||||||
|
|
||||||
|
auditories = APIRouter(prefix="/auditories", tags=["auditories"])
|
||||||
|
|
||||||
|
@auditories.post("/", response_model=schemas.AuditoryRead)
|
||||||
|
def create_auditory(item: schemas.AuditoryCreate, db: Session = Depends(database.get_db)):
|
||||||
|
obj = models.Auditory(**item.dict())
|
||||||
|
db.add(obj)
|
||||||
|
db.commit()
|
||||||
|
db.refresh(obj)
|
||||||
|
return obj
|
||||||
|
|
||||||
|
@auditories.get("/", response_model=list[schemas.AuditoryRead])
|
||||||
|
def list_auditories(db: Session = Depends(database.get_db)):
|
||||||
|
return db.query(models.Auditory).all()
|
||||||
|
|
||||||
18
backend/routers/components.py
Normal file
18
backend/routers/components.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
from fastapi import APIRouter, Depends
|
||||||
|
from sqlalchemy.orm import Session
|
||||||
|
from .. import models, schemas, database
|
||||||
|
|
||||||
|
|
||||||
|
components = APIRouter(prefix="/components", tags=["components"])
|
||||||
|
|
||||||
|
@components.post("/", response_model=schemas.ComponentRead)
|
||||||
|
def create_component(item: schemas.ComponentCreate, db: Session = Depends(database.get_db)):
|
||||||
|
obj = models.Component(**item.dict())
|
||||||
|
db.add(obj)
|
||||||
|
db.commit()
|
||||||
|
db.refresh(obj)
|
||||||
|
return obj
|
||||||
|
|
||||||
|
@components.get("/", response_model=list[schemas.ComponentRead])
|
||||||
|
def list_components(db: Session = Depends(database.get_db)):
|
||||||
|
return db.query(models.Component).all()
|
||||||
17
backend/routers/equipment_types.py
Normal file
17
backend/routers/equipment_types.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
from fastapi import APIRouter, Depends
|
||||||
|
from sqlalchemy.orm import Session
|
||||||
|
from .. import models, schemas, database
|
||||||
|
|
||||||
|
equipment_types = APIRouter(prefix="/equipment-types", tags=["equipment_types"])
|
||||||
|
|
||||||
|
@equipment_types.post("/", response_model=schemas.EquipmentTypeRead)
|
||||||
|
def create_equipment_type(item: schemas.EquipmentTypeCreate, db: Session = Depends(database.get_db)):
|
||||||
|
obj = models.EquipmentType(**item.dict())
|
||||||
|
db.add(obj)
|
||||||
|
db.commit()
|
||||||
|
db.refresh(obj)
|
||||||
|
return obj
|
||||||
|
|
||||||
|
@equipment_types.get("/", response_model=list[schemas.EquipmentTypeRead])
|
||||||
|
def list_equipment_types(db: Session = Depends(database.get_db)):
|
||||||
|
return db.query(models.EquipmentType).all()
|
||||||
28
backend/routers/oboruds.py
Normal file
28
backend/routers/oboruds.py
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
from fastapi import APIRouter, Depends, HTTPException
|
||||||
|
from typing import Optional
|
||||||
|
from sqlalchemy.orm import Session
|
||||||
|
from .. import models, schemas, database
|
||||||
|
|
||||||
|
oboruds = APIRouter(prefix="/oboruds", tags=["oboruds"])
|
||||||
|
|
||||||
|
@oboruds.post("/", response_model=schemas.OborudRead)
|
||||||
|
def create_oborud(item: schemas.OborudCreate, db: Session = Depends(database.get_db)):
|
||||||
|
obj = models.Oboruds(**item.dict())
|
||||||
|
db.add(obj)
|
||||||
|
db.commit()
|
||||||
|
db.refresh(obj)
|
||||||
|
return obj
|
||||||
|
|
||||||
|
@oboruds.get("/", response_model=list[schemas.OborudRead])
|
||||||
|
def list_oboruds(aud_id: Optional[int] = None, db: Session = Depends(database.get_db)):
|
||||||
|
query = db.query(models.Oboruds)
|
||||||
|
if aud_id is not None:
|
||||||
|
query = query.filter(models.Oboruds.aud_id == aud_id)
|
||||||
|
return query.all()
|
||||||
|
|
||||||
|
@oboruds.get("/{oborud_id}", response_model=schemas.OborudRead)
|
||||||
|
def get_oborud(oborud_id: int, db: Session = Depends(database.get_db)):
|
||||||
|
obj = db.query(models.Oboruds).filter(models.Oboruds.id == oborud_id).first()
|
||||||
|
if not obj:
|
||||||
|
raise HTTPException(status_code=404, detail="Oborud not found")
|
||||||
|
return obj
|
||||||
17
backend/routers/rashodniki.py
Normal file
17
backend/routers/rashodniki.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
from fastapi import APIRouter, Depends
|
||||||
|
from sqlalchemy.orm import Session
|
||||||
|
from .. import models, schemas, database
|
||||||
|
|
||||||
|
consumables = APIRouter(prefix="/consumables", tags=["consumables"])
|
||||||
|
|
||||||
|
@consumables.post("/", response_model=schemas.ConsumableRead)
|
||||||
|
def create_consumable(item: schemas.ConsumableCreate, db: Session = Depends(database.get_db)):
|
||||||
|
obj = models.Consumable(**item.dict())
|
||||||
|
db.add(obj)
|
||||||
|
db.commit()
|
||||||
|
db.refresh(obj)
|
||||||
|
return obj
|
||||||
|
|
||||||
|
@consumables.get("/", response_model=list[schemas.ConsumableRead])
|
||||||
|
def list_consumables(db: Session = Depends(database.get_db)):
|
||||||
|
return db.query(models.Consumable).all()
|
||||||
17
backend/routers/zametki.py
Normal file
17
backend/routers/zametki.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
from fastapi import APIRouter, Depends
|
||||||
|
from sqlalchemy.orm import Session
|
||||||
|
from .. import models, schemas, database
|
||||||
|
|
||||||
|
zametki = APIRouter(prefix="/zametki", tags=["zametki"])
|
||||||
|
|
||||||
|
@zametki.post("/", response_model=schemas.ZametkaRead)
|
||||||
|
def create_zametka(item: schemas.ZametkaCreate, db: Session = Depends(database.get_db)):
|
||||||
|
obj = models.Zametki(**item.dict())
|
||||||
|
db.add(obj)
|
||||||
|
db.commit()
|
||||||
|
db.refresh(obj)
|
||||||
|
return obj
|
||||||
|
|
||||||
|
@zametki.get("/", response_model=list[schemas.ZametkaRead])
|
||||||
|
def list_zametki(db: Session = Depends(database.get_db)):
|
||||||
|
return db.query(models.Zametki).all()
|
||||||
102
backend/schemas.py
Normal file
102
backend/schemas.py
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
# backend/schemas.py
|
||||||
|
|
||||||
|
from pydantic import BaseModel
|
||||||
|
from typing import Optional, List
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
||||||
|
# === Equipment Type ===
|
||||||
|
class EquipmentTypeBase(BaseModel):
|
||||||
|
name: str
|
||||||
|
|
||||||
|
class EquipmentTypeCreate(EquipmentTypeBase):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class EquipmentTypeRead(EquipmentTypeBase):
|
||||||
|
id: int
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
orm_mode = True
|
||||||
|
|
||||||
|
|
||||||
|
# === Component ===
|
||||||
|
class ComponentBase(BaseModel):
|
||||||
|
name: str
|
||||||
|
description: Optional[str] = None
|
||||||
|
|
||||||
|
class ComponentCreate(ComponentBase):
|
||||||
|
oborud_id: int
|
||||||
|
|
||||||
|
class ComponentRead(ComponentBase):
|
||||||
|
id: int
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
orm_mode = True
|
||||||
|
|
||||||
|
|
||||||
|
# === Consumable ===
|
||||||
|
class ConsumableBase(BaseModel):
|
||||||
|
name: str
|
||||||
|
description: Optional[str] = None
|
||||||
|
|
||||||
|
class ConsumableCreate(ConsumableBase):
|
||||||
|
oborud_id: int
|
||||||
|
|
||||||
|
class ConsumableRead(ConsumableBase):
|
||||||
|
id: int
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
orm_mode = True
|
||||||
|
|
||||||
|
|
||||||
|
# === Oborud ===
|
||||||
|
class OborudBase(BaseModel):
|
||||||
|
invNumber: Optional[int]
|
||||||
|
nazvanie: str
|
||||||
|
raspologenie: Optional[str] = None
|
||||||
|
numberppasu: Optional[str] = None
|
||||||
|
kolichestvo: Optional[int] = None
|
||||||
|
aud_id: int
|
||||||
|
type_id: int
|
||||||
|
|
||||||
|
class OborudCreate(OborudBase):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class OborudRead(OborudBase):
|
||||||
|
id: int
|
||||||
|
type: EquipmentTypeRead
|
||||||
|
components: List[ComponentRead] = []
|
||||||
|
consumables: List[ConsumableRead] = []
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
orm_mode = True
|
||||||
|
|
||||||
|
|
||||||
|
# === Auditory ===
|
||||||
|
class AuditoryBase(BaseModel):
|
||||||
|
audnazvanie: str
|
||||||
|
|
||||||
|
class AuditoryCreate(AuditoryBase):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class AuditoryRead(AuditoryBase):
|
||||||
|
id: int
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
orm_mode = True
|
||||||
|
|
||||||
|
|
||||||
|
# === Zametka ===
|
||||||
|
class ZametkaBase(BaseModel):
|
||||||
|
txtzam: str
|
||||||
|
rmdt: Optional[datetime] = None
|
||||||
|
|
||||||
|
class ZametkaCreate(ZametkaBase):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class ZametkaRead(ZametkaBase):
|
||||||
|
id: int
|
||||||
|
created_date: datetime
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
orm_mode = True
|
||||||
86
models.py
86
models.py
@@ -1,32 +1,76 @@
|
|||||||
|
# backend/models.py
|
||||||
|
|
||||||
from flask_sqlalchemy import SQLAlchemy
|
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime
|
||||||
|
from sqlalchemy.orm import relationship, declarative_base
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
db = SQLAlchemy()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
||||||
class Auditory(db.Model):
|
class Auditory(Base):
|
||||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
__tablename__ = 'auditories'
|
||||||
audnazvanie=db.Column(db.String)
|
|
||||||
oboruds = db.relationship('Oboruds')
|
id = Column(Integer, primary_key=True)
|
||||||
|
audnazvanie = Column(String)
|
||||||
|
|
||||||
|
oboruds = relationship("Oboruds", back_populates="auditory")
|
||||||
|
|
||||||
|
|
||||||
|
class EquipmentType(Base):
|
||||||
|
__tablename__ = 'equipment_types'
|
||||||
|
|
||||||
class Oboruds(db.Model):
|
id = Column(Integer, primary_key=True)
|
||||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
name = Column(String, unique=True, nullable=False)
|
||||||
invNumber=db.Column(db.Integer)
|
|
||||||
nazvanie=db.Column(db.String(500))
|
oboruds = relationship("Oboruds", back_populates="type")
|
||||||
raspologenie = db.Column(db.String(200))
|
|
||||||
numberved = db.Column(db.String(100))
|
|
||||||
numberppasu = db.Column(db.String(100))
|
|
||||||
kolichestvo = db.Column(db.Integer)
|
|
||||||
balancenumber = db.Column(db.Integer)
|
|
||||||
aud_id = db.Column(db.Integer, db.ForeignKey(Auditory.id))
|
|
||||||
|
|
||||||
|
|
||||||
class Zametki(db.Model):
|
class Oboruds(Base):
|
||||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
__tablename__ = 'oboruds'
|
||||||
txtzam=db.Column(db.String(10000))
|
|
||||||
created_date = db.Column(db.DateTime, default=datetime.datetime.utcnow)
|
|
||||||
rmdt = db.Column(db.DateTime)
|
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True)
|
||||||
|
invNumber = Column(Integer)
|
||||||
|
nazvanie = Column(String(500))
|
||||||
|
raspologenie = Column(String(200))
|
||||||
|
numberppasu = Column(String(100))
|
||||||
|
kolichestvo = Column(Integer)
|
||||||
|
|
||||||
|
aud_id = Column(Integer, ForeignKey("auditories.id"))
|
||||||
|
auditory = relationship("Auditory", back_populates="oboruds")
|
||||||
|
|
||||||
|
type_id = Column(Integer, ForeignKey("equipment_types.id"))
|
||||||
|
type = relationship("EquipmentType", back_populates="oboruds")
|
||||||
|
|
||||||
|
components = relationship("Component", back_populates="oborud")
|
||||||
|
consumables = relationship("Consumable", back_populates="oborud")
|
||||||
|
|
||||||
|
|
||||||
|
class Component(Base):
|
||||||
|
__tablename__ = 'components'
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True)
|
||||||
|
name = Column(String, nullable=False)
|
||||||
|
description = Column(String)
|
||||||
|
|
||||||
|
oborud_id = Column(Integer, ForeignKey("oboruds.id"))
|
||||||
|
oborud = relationship("Oboruds", back_populates="components")
|
||||||
|
|
||||||
|
|
||||||
|
class Consumable(Base):
|
||||||
|
__tablename__ = 'consumables'
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True)
|
||||||
|
name = Column(String, nullable=False)
|
||||||
|
description = Column(String)
|
||||||
|
|
||||||
|
oborud_id = Column(Integer, ForeignKey("oboruds.id"))
|
||||||
|
oborud = relationship("Oboruds", back_populates="consumables")
|
||||||
|
|
||||||
|
|
||||||
|
class Zametki(Base):
|
||||||
|
__tablename__ = 'zametki'
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True)
|
||||||
|
txtzam = Column(String(10000))
|
||||||
|
created_date = Column(DateTime, default=datetime.datetime.utcnow)
|
||||||
|
rmdt = Column(DateTime)
|
||||||
|
|||||||
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
147
templates/all_OLD.html
Normal file
147
templates/all_OLD.html
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<!-- Modal -->
|
||||||
|
<div class="modal fade" id="getmodal" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-body" id="textarea">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<a id="modal_invnom"> </a><a id="modal_matcenn"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
№ из ведомости
|
||||||
|
<input type="text" class="form-control" id ='modal_vednumber' placeholder="Номер из ведомости">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Количество
|
||||||
|
<input type="text" class="form-control" id ='modal_kolvo' placeholder="Количество">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Балансовый счёт
|
||||||
|
<input type="text" class="form-control" id ='modal_balance' placeholder="Балансовый счёт">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Расположение
|
||||||
|
<input type="text" class="form-control" id ='modal_rapolog' placeholder="Введите расположение">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="modalclose">Закрыть</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="modalsavetodb" >Сохранить изменения</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Modal2 -->
|
||||||
|
<div class="modal fade" id="addmodal" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-body" id="textarea">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<a id="modal_invnom"> </a><a id="modal2_matcenn"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
№ из ведомости
|
||||||
|
<input type="text" class="form-control" id ='modal2_vednumber' placeholder="Номер из ведомости">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Инвентарный номер
|
||||||
|
<input type="text" class="form-control" id ='modal2_invnom' placeholder="Инвентарный номер">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Название
|
||||||
|
<input type="text" class="form-control" id ='modal2_nazvanie' placeholder="Название">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Количество
|
||||||
|
<input type="text" class="form-control" id ='modal2_kolvo' placeholder="Количество">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Балансовый счёт
|
||||||
|
<input type="text" class="form-control" id ='modal2_balance' placeholder="Балансовый счёт">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Расположение
|
||||||
|
<input type="text" class="form-control" id ='modal2_rapolog' placeholder="Введите расположение">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="modal2close">Закрыть</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="modal2savetodb" >Сохранить изменения</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<h3 id ='123' class=" no-print"> Все мат. ценности </h3>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row col-12">
|
||||||
|
<button class="button" id="printallbutton"> Печать </button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row col-12">
|
||||||
|
<button class="button" id="addoborud"> Добавить </button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="card col-md-11 table-responsive">
|
||||||
|
<table id="alldatatable" class="alldatable table pagebreak" >
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">№ <br>п/п <br>АСУ</th>
|
||||||
|
<th scope="col">№ п/п <br>вед</th>
|
||||||
|
<th scope="col">Инв. номер</th>
|
||||||
|
<th scope="col">Название</th>
|
||||||
|
<th scope="col">Кол-во</th>
|
||||||
|
<th scope="col">Счёт</th>
|
||||||
|
<th scope="col">Ауд - я</th>
|
||||||
|
<th scope="col">Расположение</th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tr>
|
||||||
|
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script src="{{url_for('static', filename='js/allmatc.js') }}"></script>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user