分配計画を運搬計画に再設計: 軽トラ1回分を基本単位とする運搬回モデルを導入

実運用のワークフロー(複数施肥計画混在・軽トラ複数回・肥料指定)に合わせ、
旧 DistributionPlan/Group/GroupField を DeliveryPlan/Group/GroupField/Trip/TripItem に置き換え。
施肥計画への直接FK廃止→年度ベースで全施肥計画を横断。
回ごとの日付記録、圃場の回間移動、対象肥料フィルタ、回ごとPDF出力に対応。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Akira
2026-03-16 16:29:01 +09:00
parent eba6267495
commit 1c27a66691
14 changed files with 1640 additions and 903 deletions

View File

@@ -0,0 +1,75 @@
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<style>
@page { size: A4 landscape; margin: 12mm; }
body { font-family: "Noto Sans CJK JP", "Hiragino Kaku Gothic Pro", sans-serif; font-size: 10pt; }
h1 { font-size: 14pt; text-align: center; margin-bottom: 4px; }
.subtitle { text-align: center; font-size: 9pt; color: #555; margin-bottom: 10px; }
table { width: 100%; border-collapse: collapse; margin-top: 6px; }
th, td { border: 1px solid #888; padding: 4px 6px; text-align: right; }
th { background: #e8f5e9; text-align: center; }
.col-name { text-align: left; }
.group-row { font-weight: bold; background: #c8e6c9; }
.group-row td { font-size: 10pt; }
.group-star { color: #2e7d32; margin-right: 2px; }
.field-row td { font-size: 8.5pt; color: #444; background: #fafafa; }
.field-indent { padding-left: 14px; }
tr.total-row { font-weight: bold; background: #f5f5f5; }
.zero { color: #bbb; }
.page-break { page-break-before: always; }
</style>
</head>
<body>
{% for page in trip_pages %}
{% if not forloop.first %}<div class="page-break"></div>{% endif %}
<h1>運搬計画書 {{ page.trip.order|add:1 }}回目</h1>
<p class="subtitle">
{{ plan.year }}年度 「{{ plan.name }}」
{% if page.trip.name %}{{ page.trip.name }}{% endif %}
{% if page.trip.date %}{{ page.trip.date }}{% endif %}
</p>
<table>
<thead>
<tr>
<th class="col-name">グループ / 圃場</th>
{% for fert in page.fertilizers %}
<th>{{ fert.name }}<br><small>(袋)</small></th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for group in page.group_rows %}
{# グループ合計行 #}
<tr class="group-row">
<td class="col-name"><span class="group-star"></span>{{ group.name }}</td>
{% for total in group.totals %}
<td>{% if total %}{{ total }}{% else %}<span class="zero">-</span>{% endif %}</td>
{% endfor %}
</tr>
{# 圃場サブ行 #}
{% for row in group.field_rows %}
<tr class="field-row">
<td class="col-name field-indent">{{ row.field.name }}{{ row.field.area_tan }}反)</td>
{% for cell in row.cells %}
<td>{% if cell %}{{ cell }}{% else %}<span class="zero">-</span>{% endif %}</td>
{% endfor %}
</tr>
{% endfor %}
{% endfor %}
</tbody>
<tfoot>
<tr class="total-row">
<td class="col-name">合計</td>
{% for total in page.fert_totals %}
<td>{{ total }}</td>
{% endfor %}
</tr>
</tfoot>
</table>
{% endfor %}
</body>
</html>