System Overview
A warehouse management system for agricultural machinery parts offers significant advantages in terms of operational fluidity, data consistency, and scalability. This design enables efficient handling of product catalogs, procurement, inbound/outbound logistics, and supplier relations.
Core Technologies
Primary Language: Java
Backend Framework: Spring Boot
Frontend Stack: JavaScript, Vue.js, CSS3
Development Environments: IntelliJ IDEA, Eclipse, VS Code
Database: MySQL 5.7/8.0
Database Tools: phpMyAdmin, Navicat
Java Runtime: JDK 1.8
Build Tool: Apache Maven 3.8.1
System Architecture
The system's structural diagram organizes functional modules logical, providing clarity for development, modification, and comprehension of the overall design process and theory.
Administrator Module
Administrators access the system via a login page requiring username and password credentials.
Upon authentication, the administrator dashboard provides access to core management functions: system overview, profile settings, and management interfaces for procurement staff, sales personnel, warehouse keepers, product categories, product details, purchase orders, sales orders, inbound/outbound stock, damage reports, supplier data, customer information, and announcements.
From the procurement staff management interface, administrators can query, add, or remove records containing employee ID, name, gender, position, and contact number.
The sales personnel management section allows administrators to perform similar operations on sales staff data, including sales ID, name, gender, position, and phone number.
Warehouse keeper management provides controls for records of keeper ID, name, gender, current address, and contact details.
The product catalog management interface displays information such as product code, name, category, brand, quantity, cost price, selling price, manufacturer, shelf life, and notes, supporting query and deletion operations.
The purchase order management screen lists details including order number, product code, product name, category, brand, purchase quantity, unit cost, total amount, manufacturer, shelf life, production date, purchaser ID, purchaser name, supplier name, and purchase timestamp, enabling query and deletion functions.
Procurement Staff Module
Procurement personnel log in through a dedicated authentication page.
After logging in, procuremetn staff can access the system homepage, personal center, product catalog management, purchase orrder management, supplier management, and announcement boards.
Within the product catalog interface, procurement staff can view product details and initiate purchase processes for items listed by code, name, category, brand, quantity, cost, price, manufacturer, shelf life, and remarks.
Sales Staff Module
Sales representatives authenticate via a specific login page.
The sales dashboard provides access to the main page, personal settings, product catalog, sales order management, customer information, and announcements.
In the product catalog, sales staff can query product information and execute sales transactions.
The sales order management interface displays records containing product code, product name, category, customer name, brand, quantity, unit price, total value, sales ID, salesperson name, and sale time, supporting query and deletion of sales data.
Warehouse Keeper Module
Warehouse keepers enter the system through their designated login portal.
The keeper's interface includes the system homepage, personal center, product category management, product catalog, inbound stock management, outbound stock management, damage registration, and announcement boards.
The inbound stock management screen shows records for product code, name, category, brand, received quantity, keeper ID, keeper name, and receipt time, allowing query and deletion of inbound entries.
Key Implementation Code
/**
* Authentication and User Management Controller
*/
@RestController
@RequestMapping("/api/auth")
public class AuthController {
@Autowired
private UserAccountService accountService;
@Autowired
private SecurityTokenService tokenService;
/**
* User Login Endpoint
*/
@PostMapping("/signin")
@PermitAll
public ApiResponse authenticateUser(@RequestParam String userIdentifier,
@RequestParam String secretKey,
HttpServletRequest servletRequest) {
UserAccount account = accountService.fetchUserByUsername(userIdentifier);
if (account == null || !account.getSecretKey().equals(secretKey)) {
return ApiResponse.error("Invalid credentials provided.");
}
String authToken = tokenService.createToken(account.getUserId(), userIdentifier, "user", account.getAccessLevel());
ApiResponse response = ApiResponse.success();
response.put("authToken", authToken);
response.put("accessLevel", account.getAccessLevel());
response.put("accountId", account.getUserId());
return response;
}
/**
* User Registration Endpoint
*/
@PostMapping("/signup")
@PermitAll
public ApiResponse registerAccount(@RequestBody UserAccount newAccount) {
if (accountService.fetchUserByUsername(newAccount.getUsername()) != null) {
return ApiResponse.error("Username already exists.");
}
accountService.createAccount(newAccount);
return ApiResponse.success();
}
/**
* Password Update Functionality
*/
@GetMapping("/updateSecret")
public ApiResponse modifySecretKey(@RequestParam String currentSecret,
@RequestParam String newSecret,
HttpServletRequest servletRequest) {
Integer activeUserId = (Integer) servletRequest.getSession().getAttribute("activeUserId");
UserAccount activeAccount = accountService.fetchUserById(activeUserId);
if (newSecret == null || newSecret.trim().isEmpty()) {
return ApiResponse.error("New password cannot be empty.");
}
if (!currentSecret.equals(activeAccount.getSecretKey())) {
return ApiResponse.error("Current password is incorrect.");
}
if (newSecret.equals(activeAccount.getSecretKey())) {
return ApiResponse.error("New password must differ from the current one.");
}
activeAccount.setSecretKey(newSecret);
accountService.modifyAccount(activeAccount);
return ApiResponse.success();
}
/**
* Password Reset Endpoint
*/
@PostMapping("/resetSecret")
@PermitAll
public ApiResponse resetSecretKey(@RequestParam String userIdentifier) {
UserAccount targetAccount = accountService.fetchUserByUsername(userIdentifier);
if (targetAccount == null) {
return ApiResponse.error("Account not found.");
}
targetAccount.setSecretKey("default123");
accountService.modifyAccount(targetAccount);
return ApiResponse.success("Password has been reset to: default123");
}
}