Ввел логику сделок через партии, дополнение 2
All checks were successful
Deploy MES Core / deploy (push) Successful in 12s

This commit is contained in:
2026-04-22 08:58:23 +03:00
parent da8ef32769
commit 6d13e5a321
6 changed files with 207 additions and 12 deletions

View File

@@ -0,0 +1,54 @@
{% extends 'base.html' %}
{% block content %}
<div class="card shadow border-secondary mb-3">
<div class="card-header border-secondary py-3 d-flex justify-content-between align-items-center">
<div>
<h3 class="text-accent mb-1">
<i class="bi bi-exclamation-triangle me-2"></i>Позиции без техпроцесса
</h3>
<div class="small text-muted">
Сделка {{ deal.number }}
{% if deal.company %} · {{ deal.company.name }}{% endif %}
{% if deal.description %} · {{ deal.description }}{% endif %}
</div>
</div>
<a class="btn btn-outline-secondary btn-sm" href="{% url 'planning_deal' deal.id %}">
<i class="bi bi-arrow-left me-1"></i>Назад к сделке
</a>
</div>
<div class="card-body">
{% if items %}
<div class="text-muted mb-2">Для запуска в производство нужен техпроцесс (операция seq=1).</div>
<div class="table-responsive">
<table class="table table-hover align-middle mb-0" data-sortable="1">
<thead>
<tr class="table-custom-header">
<th style="width:120px;">Тип</th>
<th style="width:200px;">Обозначение</th>
<th>Наименование</th>
<th data-sort="false" class="text-end" style="width:160px;"></th>
</tr>
</thead>
<tbody>
{% for r in items %}
<tr>
<td class="small text-muted">{{ r.entity.get_entity_type_display }}</td>
<td class="fw-bold">{{ r.entity.drawing_number|default:"—" }}</td>
<td>{{ r.entity.name }}</td>
<td class="text-end">
<a class="btn btn-outline-accent btn-sm" href="{{ r.url }}" target="_blank">Открыть паспорт</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="text-muted">Нет данных: список проблемных позиций не найден (или уже очищен).</div>
{% endif %}
</div>
</div>
{% endblock %}

View File

@@ -316,6 +316,7 @@
<thead>
<tr class="table-custom-header">
<th>Позиция</th>
<th>Партия</th>
<th>Операция</th>
<th data-sort="false" style="width: 160px;">Прогресс</th>
<th class="text-center">Заказано / Сделано / В смене</th>
@@ -339,6 +340,19 @@
{% if t.material %}{{ t.material.full_name|default:t.material.name }}{% else %}—{% endif %}
</div>
</td>
<td class="small">
{% if t.delivery_batch_id and t.delivery_batch %}
<div class="fw-bold">{{ t.delivery_batch.due_date|date:"d.m.Y" }}</div>
<div class="text-muted">
{{ t.delivery_batch.name|default:"—" }}
{% if t.delivery_batch.is_default %}
<span class="badge bg-secondary ms-1">по умолчанию</span>
{% endif %}
</div>
{% else %}
<span class="text-muted"></span>
{% endif %}
</td>
<td class="small">{{ t.current_operation_name|default:"—" }}</td>
<td>
<div class="progress bg-secondary-subtle border border-secondary sf-progress" style="height: 10px;" data-done-width="{{ t.done_width }}" data-plan-width="{{ t.plan_width }}" title="Сделано: {{ t.done_pct }}% · В смене: {{ t.plan_pct }}%">
@@ -390,7 +404,7 @@
</td>
</tr>
{% empty %}
<tr><td colspan="7" class="text-center p-4 text-muted">Задач нет</td></tr>
<tr><td colspan="8" class="text-center p-4 text-muted">Задач нет</td></tr>
{% endfor %}
</tbody>
</table>
@@ -504,6 +518,51 @@
</div>
</div>
{% if missing_tech_process_rows %}
<div class="modal fade" id="missingTechProcessModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content border-secondary">
<div class="modal-header border-secondary">
<h5 class="modal-title">Нельзя запустить: нет техпроцесса</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Закрыть"></button>
</div>
<div class="modal-body">
<div class="text-muted mb-2">Добавь техпроцесс (операция seq=1) для позиций ниже и повтори запуск.</div>
<div class="table-responsive">
<table class="table table-sm table-hover mb-0 align-middle">
<thead>
<tr class="table-custom-header">
<th style="width:110px;">Тип</th>
<th style="width:180px;">Обозначение</th>
<th>Наименование</th>
<th data-sort="false" class="text-end" style="width:140px;"></th>
</tr>
</thead>
<tbody>
{% for r in missing_tech_process_rows %}
<tr>
<td class="small text-muted">{{ r.entity.get_entity_type_display }}</td>
<td class="fw-bold">{{ r.entity.drawing_number|default:"—" }}</td>
<td>{{ r.entity.name }}</td>
<td class="text-end">
<a class="btn btn-outline-secondary btn-sm" href="{{ r.url }}" target="_blank">Открыть</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="modal-footer border-secondary">
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">Закрыть</button>
{% if missing_tech_process_details_url %}
<a class="btn btn-outline-accent" href="{{ missing_tech_process_details_url }}" target="_blank">Подробнее</a>
{% endif %}
</div>
</div>
</div>
</div>
{% endif %}
<!-- productInfoModal удалён: паспорт компонента открывается отдельной страницей -->
<div class="d-none" id="productInfoModal" tabindex="-1" aria-hidden="true">
@@ -1048,6 +1107,17 @@ document.addEventListener('DOMContentLoaded', function () {
});
});
{% if missing_tech_process_autoshow and missing_tech_process_rows %}
document.addEventListener('DOMContentLoaded', function () {
const el = document.getElementById('missingTechProcessModal');
if (!el) return;
try {
const m = new bootstrap.Modal(el);
m.show();
} catch (e) {
}
});
{% endif %}
</script>
{% endblock %}