Files
SMT-ERP/README.md
2026-10-13 16:35:04 +08:00

108 lines
4.4 KiB
Markdown

# SMT-ERP
SMT-ERP is a privately deployed ERP system for Reallin's SMT operation in Malaysia. It brings sales, purchasing, inventory, production, finance, assets, reporting, and system administration into one application. The project is intended for deployment on SMT-managed infrastructure.
## Repository layout
```text
SMT-ERP/
├── smtERP-boot/ Java backend (controllers, services, persistence, configuration)
│ ├── docs/ Database initialization and other SQL scripts
│ └── src/main/resources/ application.yml and MyBatis XML mappers
├── smtERP-web/ Vue frontend (pages, API clients, components)
├── LICENSE
└── README.md
```
## Architecture
| Component | Implementation in this repository |
| --- | --- |
| Frontend | Vue 2.7, Vue Router 3, Vuex 3, Ant Design Vue 1.5.2, Axios, Vue CLI |
| Backend | Java 11, Spring Boot 2.0.0.RELEASE, Maven |
| Persistence | MyBatis-Plus 3.0.7.1 and MyBatis XML mappers |
| Database | MySQL; the configured JDBC driver is MySQL Connector/J 8.0.33 |
| Cache | Redis |
| API documentation | Springfox Swagger 2.7.0 and Swagger Bootstrap UI |
The backend source code is under the `com.reallin.smt` package. The configured backend context path is `/apis`.
## Local setup
### Prerequisites
- JDK 11 and Maven
- Node.js and npm
- MySQL and Redis instances reachable from the backend
### 1. Initialize MySQL
Create a database named `app072` (or update the JDBC URL in `smtERP-boot/src/main/resources/application.yml` to match your database). Import the repository's initialization dump:
```text
smtERP-boot/docs/smt-erp-init-data.sql
```
For example, from the repository root in a shell that supports input redirection:
```bash
mysql -u YOUR_MYSQL_USER -p -e "CREATE DATABASE app072 CHARACTER SET utf8mb4;"
mysql -u YOUR_MYSQL_USER -p app072 < smtERP-boot/docs/smt-erp-init-data.sql
```
On Windows, run the import command in Command Prompt (`cmd`) or use a MySQL client with an SQL import feature. The dump contains `DROP TABLE IF EXISTS` statements and existing data; import it only into the database you intend to initialize.
### 2. Configure the backend
`smtERP-boot/src/main/resources/application.yml` currently uses `127.0.0.1:3306/app072` for MySQL, `10.20.120.47:6379` for Redis, port `27210`, and context path `/apis`. Set these environment variables before starting the backend:
| Variable | Purpose |
| --- | --- |
| `DB_USERNAME` | MySQL username |
| `DB_PASSWORD` | MySQL password |
| `REDIS_PASSWORD` | Redis password |
| `SYNC_API_KEY` | Optional key for external synchronization; without it, a logged-in ERP session is required |
Adjust the MySQL and Redis hosts to match your environment. The configured Tomcat temporary directory (`/data/app/P072/tmp/tomcat`) and file upload/export directories (`/data/app/P072/upload`, `/data/app/P072/export`) must exist and be writable by the backend, or be changed to suitable paths before startup. Do not commit real credentials to the repository.
### 3. Start the backend
```bash
cd smtERP-boot
mvn spring-boot:run
```
With the current configuration, the backend base URL is `http://localhost:27210/apis` when started on your machine. The external inbound synchronization endpoint is `POST http://localhost:27210/apis/smtInbound/sync`.
### 4. Start the frontend
In a second terminal, from the repository root:
```bash
cd smtERP-web
npm install
npm run serve
```
Open `http://localhost:27200`. The frontend sends API requests under `/apis`. Its development proxy in `smtERP-web/vue.config.js` currently forwards those requests to `http://10.20.120.47:27210`. That host must be reachable; for a backend running on the same machine, change the proxy target to `http://localhost:27210` before starting the frontend.
## Build
```bash
cd smtERP-web
npm run build
cd ../smtERP-boot
mvn clean package
```
Frontend build output is written to `smtERP-web/dist/`; Maven writes backend build output to `smtERP-boot/target/`. Both are excluded from Git by the repository ignore rules.
## Deployment notes
Provide production MySQL and Redis connections, environment variables, writable storage paths, and a web server for the built frontend. Route `/apis` to the backend service on port `27210`; serve the frontend separately. Verify authentication, permissions, inventory operations, and integrations against the deployed environment before use.
## License
This project is licensed under Apache License 2.0. See [LICENSE](LICENSE).