Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 121 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# verification
erp_system/verification/
64 changes: 64 additions & 0 deletions README_ERP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# 統合業務ERPシステム

このシステムは、Djangoを用いて構築された、実運用を想定したERP(Enterprise Resource Planning)システムです。
人事、販売、在庫の各管理機能を備え、すぐに業務での利用を開始できます。

## 主な機能

1. **人事管理 (HR)**
- 従業員情報の登録・管理
- 部署・役職のマスタ管理
- 従業員の検索・フィルタリング

2. **販売管理 (Sales)**
- 顧客情報の管理
- 商品マスタ管理
- 受注管理(見積、受注、請求ステータス管理)
- 受注明細のインライン編集

3. **在庫管理 (Inventory)**
- 商品ごとの在庫数管理
- 入出庫履歴(入荷、出荷、返品、廃棄)の記録
- 在庫数の自動更新機能

## セットアップと起動方法

### 前提条件
- Python 3.x がインストールされていること

### インストール手順

1. 依存パッケージのインストール
```bash
pip install django
```

2. データベースのセットアップ
```bash
python manage.py migrate
```

3. 初期データの投入(管理者ユーザーとテストデータが作成されます)
```bash
python populate_data.py
```
※ 管理者ユーザー名: `admin` / パスワード: `adminpass`

4. サーバーの起動
```bash
python manage.py runserver
```

5. アクセス
- ブラウザで `http://127.0.0.1:8000/` にアクセスするとダッシュボードが表示されます。
- 管理画面へは `http://127.0.0.1:8000/admin/` からアクセスできます。

## 運用上の注意

- **在庫の更新**: 在庫数は「入出庫履歴 (StockMovement)」を作成することで自動的に増減します。手動で在庫数を変更することも可能ですが、履歴を残すために履歴の登録を推奨します。
- **受注の入力**: 受注画面で「受注明細」を追加することで、複数の商品を一度に注文登録できます。

## 開発者情報

- このシステムは拡張性を考慮して設計されています。
- データベースはデフォルトでSQLiteを使用していますが、`settings.py` を変更することでPostgreSQLなどのRDBMSに容易に移行可能です。
Empty file added core/__init__.py
Empty file.
Binary file added core/__pycache__/__init__.cpython-312.pyc
Binary file not shown.
Binary file added core/__pycache__/admin.cpython-312.pyc
Binary file not shown.
Binary file added core/__pycache__/apps.cpython-312.pyc
Binary file not shown.
Binary file added core/__pycache__/models.cpython-312.pyc
Binary file not shown.
Binary file added core/__pycache__/views.cpython-312.pyc
Binary file not shown.
6 changes: 6 additions & 0 deletions core/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.contrib import admin
from .models import CompanyInfo

@admin.register(CompanyInfo)
class CompanyInfoAdmin(admin.ModelAdmin):
list_display = ('name', 'phone', 'email', 'updated_at')
5 changes: 5 additions & 0 deletions core/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class CoreConfig(AppConfig):
name = "core"
65 changes: 65 additions & 0 deletions core/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Generated by Django 6.0.2 on 2026-02-16 09:30

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = []

operations = [
migrations.CreateModel(
name="CompanyInfo",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=255, verbose_name="会社名")),
(
"address",
models.CharField(
blank=True, max_length=255, null=True, verbose_name="住所"
),
),
(
"phone",
models.CharField(
blank=True, max_length=20, null=True, verbose_name="電話番号"
),
),
(
"email",
models.EmailField(
blank=True,
max_length=254,
null=True,
verbose_name="代表メールアドレス",
),
),
(
"website",
models.URLField(blank=True, null=True, verbose_name="ウェブサイト"),
),
(
"created_at",
models.DateTimeField(auto_now_add=True, verbose_name="作成日時"),
),
(
"updated_at",
models.DateTimeField(auto_now=True, verbose_name="更新日時"),
),
],
options={
"verbose_name": "会社情報",
"verbose_name_plural": "会社情報",
},
),
]
Empty file added core/migrations/__init__.py
Empty file.
Binary file not shown.
Binary file added core/migrations/__pycache__/__init__.cpython-312.pyc
Binary file not shown.
17 changes: 17 additions & 0 deletions core/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from django.db import models

class CompanyInfo(models.Model):
name = models.CharField(max_length=255, verbose_name="会社名")
address = models.CharField(max_length=255, null=True, blank=True, verbose_name="住所")
phone = models.CharField(max_length=20, null=True, blank=True, verbose_name="電話番号")
email = models.EmailField(null=True, blank=True, verbose_name="代表メールアドレス")
website = models.URLField(null=True, blank=True, verbose_name="ウェブサイト")
created_at = models.DateTimeField(auto_now_add=True, verbose_name="作成日時")
updated_at = models.DateTimeField(auto_now=True, verbose_name="更新日時")

class Meta:
verbose_name = "会社情報"
verbose_name_plural = "会社情報"

def __str__(self):
return self.name
94 changes: 94 additions & 0 deletions core/templates/core/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ERP System</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
.feature-icon {
width: 4rem;
height: 4rem;
border-radius: .75rem;
}
</style>
</head>
<body class="bg-light">
<nav class="navbar navbar-expand-lg navbar-dark bg-primary mb-4">
<div class="container">
<a class="navbar-brand" href="#">株式会社ERPデモ - 統合業務システム</a>
</div>
</nav>

<div class="container">
<div class="p-5 mb-4 bg-white rounded-3 shadow-sm">
<div class="container-fluid py-5">
<h1 class="display-5 fw-bold">業務システムへようこそ</h1>
<p class="col-md-8 fs-4">本システムは、人事、販売、在庫管理を一元的に行うためのプラットフォームです。</p>
<a class="btn btn-primary btn-lg" href="/admin/" role="button">管理画面へログイン</a>
</div>
</div>

<div class="row align-items-md-stretch">
<div class="col-md-6 mb-4">
<div class="h-100 p-5 text-white bg-success rounded-3">
<h2>現在の受注件数</h2>
<p class="display-4">{{ order_count }} 件</p>
<a href="/admin/sales/order/" class="btn btn-outline-light">受注一覧を見る</a>
</div>
</div>
<div class="col-md-6 mb-4">
<div class="h-100 p-5 bg-warning text-dark rounded-3">
<h2>在庫アラート</h2>
<p>在庫が10個未満の商品があります。</p>
<ul class="list-group list-group-flush mb-3">
{% for stock in low_stock_items %}
<li class="list-group-item bg-warning border-0">{{ stock.product.name }}: {{ stock.quantity }}個</li>
{% empty %}
<li class="list-group-item bg-warning border-0">現在、在庫不足の商品はありません。</li>
{% endfor %}
</ul>
<a href="/admin/inventory/stock/" class="btn btn-outline-dark">在庫状況を確認</a>
</div>
</div>
</div>

<div class="row g-4 py-5 row-cols-1 row-cols-lg-3">
<div class="col d-flex align-items-start">
<div class="icon-square bg-light text-dark flex-shrink-0 me-3">
<svg class="bi" width="1em" height="1em"><use xlink:href="#toggles2"/></svg>
</div>
<div>
<h2>人事管理 (HR)</h2>
<p>従業員情報の管理、部署・役職の設定を行います。</p>
<a href="/admin/hr/employee/" class="btn btn-secondary">従業員一覧 &raquo;</a>
</div>
</div>
<div class="col d-flex align-items-start">
<div class="icon-square bg-light text-dark flex-shrink-0 me-3">
<svg class="bi" width="1em" height="1em"><use xlink:href="#cpu-fill"/></svg>
</div>
<div>
<h2>販売管理 (Sales)</h2>
<p>顧客情報の管理、見積・受注・請求業務を行います。</p>
<a href="/admin/sales/order/" class="btn btn-secondary">受注一覧 &raquo;</a>
</div>
</div>
<div class="col d-flex align-items-start">
<div class="icon-square bg-light text-dark flex-shrink-0 me-3">
<svg class="bi" width="1em" height="1em"><use xlink:href="#tools"/></svg>
</div>
<div>
<h2>在庫管理 (Inventory)</h2>
<p>商品在庫の管理、入出庫履歴の確認を行います。</p>
<a href="/admin/inventory/stock/" class="btn btn-secondary">在庫一覧 &raquo;</a>
</div>
</div>
</div>

<footer class="pt-3 mt-4 text-muted border-top">
&copy; 2026 ERP Demo Corp
</footer>
</div>
</body>
</html>
3 changes: 3 additions & 0 deletions core/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
14 changes: 14 additions & 0 deletions core/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from django.shortcuts import render
from sales.models import Order
from inventory.models import Stock

def index(request):
# 簡易ダッシュボード用のデータ取得
order_count = Order.objects.count()
low_stock_items = Stock.objects.filter(quantity__lt=10)

context = {
'order_count': order_count,
'low_stock_items': low_stock_items,
}
return render(request, 'core/index.html', context)
Binary file added db.sqlite3
Binary file not shown.
Empty file added erp_system/__init__.py
Empty file.
Binary file added erp_system/__pycache__/__init__.cpython-312.pyc
Binary file not shown.
Binary file added erp_system/__pycache__/settings.cpython-312.pyc
Binary file not shown.
Binary file added erp_system/__pycache__/tests.cpython-312.pyc
Binary file not shown.
Binary file added erp_system/__pycache__/urls.cpython-312.pyc
Binary file not shown.
Binary file added erp_system/__pycache__/wsgi.cpython-312.pyc
Binary file not shown.
Loading