💖💖作者:计算机编程小咖 💙💙个人简介:曾长期从事计算机专业培训教学,本人也热爱上课教学,语言擅长Java、微信小程序、Python、Golang、安卓Android等,开发项目包括大数据、深度学习、网站、小程序、安卓、算法。平常会做一些项目定制化开发、代码讲解、答辩教学、文档编写、也懂一些降重方面的技巧。平常喜欢分享一些自己开发中遇到的问题的解决办法,也喜欢交流技术,大家有技术代码这一块的问题可以问我! 💛💛想说的话:感谢大家的关注与支持! 💜💜 网站实战项目 安卓/小程序实战项目 大数据实战项目 深度学习实战项目
@TOC
基于web平台的实验室耗材管理系统介绍
基于web平台的实验室耗材管理系统是一套采用B/S架构设计的现代化管理平台,支持Java+SpringBoot和Python+Django两种主流技术栈实现,前端采用Vue+ElementUI框架构建用户界面,后端数据存储基于MySQL数据库,开发环境支持IDEA和PyCharm两种主流IDE。该系统围绕实验室日常耗材管理需求,构建了完整的业务流程体系,涵盖系统首页展示、实验室人员信息管理、供应商信息维护、实验室类型分类、实验室基础信息管理、耗材分类体系、耗材基础信息管理、耗材入库操作、库存调整功能、采购申请流程、耗材借用申请、耗材归还管理、耗材报废处理、耗材维修申请、维修反馈跟踪、收支信息统计、个人中心设置以及密码修改等18个核心功能模块。系统通过SpringBoot或Django框架的强大后端支撑,结合SpringMVC和Mybatis或Django ORM的数据访问层设计,实现了从耗材采购、入库、借用、归还到报废维修的全生命周期管理,为实验室管理人员提供了一套操作简便、功能完备、技术先进的web平台解决方案,有效提升了实验室耗材管理的规范化和信息化水平。
基于web平台的实验室耗材管理系统演示视频
基于web平台的实验室耗材管理系统演示图片
基于web平台的实验室耗材管理系统代码展示
import org.apache.spark.sql.SparkSession;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.*;
import java.time.LocalDateTime;
@RestController
@RequestMapping("/api/consumables")
public class ConsumablesController {
@Autowired
private ConsumablesService consumablesService;
private SparkSession spark = SparkSession.builder().appName("LabConsumablesAnalysis").master("local[*]").getOrCreate();
@PostMapping("/storage/in")
public Map<String, Object> consumablesStorageIn(@RequestBody Map<String, Object> params) {
String consumableId = (String) params.get("consumableId");
Integer quantity = (Integer) params.get("quantity");
String supplierId = (String) params.get("supplierId");
Double unitPrice = (Double) params.get("unitPrice");
String operatorId = (String) params.get("operatorId");
Map<String, Object> result = new HashMap<>();
if (consumableId == null || quantity == null || quantity <= 0) {
result.put("success", false);
result.put("message", "耗材信息或数量不能为空");
return result;
}
Map<String, Object> consumable = consumablesService.getConsumableById(consumableId);
if (consumable == null) {
result.put("success", false);
result.put("message", "耗材信息不存在");
return result;
}
Integer currentStock = (Integer) consumable.get("stock");
Integer newStock = currentStock + quantity;
consumablesService.updateConsumableStock(consumableId, newStock);
Map<String, Object> storageRecord = new HashMap<>();
storageRecord.put("id", UUID.randomUUID().toString());
storageRecord.put("consumableId", consumableId);
storageRecord.put("operationType", "入库");
storageRecord.put("quantity", quantity);
storageRecord.put("unitPrice", unitPrice);
storageRecord.put("totalAmount", quantity * unitPrice);
storageRecord.put("supplierId", supplierId);
storageRecord.put("operatorId", operatorId);
storageRecord.put("operateTime", LocalDateTime.now());
storageRecord.put("remark", "耗材入库操作");
consumablesService.insertStorageRecord(storageRecord);
Map<String, Object> financeRecord = new HashMap<>();
financeRecord.put("id", UUID.randomUUID().toString());
financeRecord.put("type", "支出");
financeRecord.put("amount", quantity * unitPrice);
financeRecord.put("description", "采购耗材:" + consumable.get("name"));
financeRecord.put("operatorId", operatorId);
financeRecord.put("createTime", LocalDateTime.now());
consumablesService.insertFinanceRecord(financeRecord);
result.put("success", true);
result.put("message", "入库成功");
result.put("newStock", newStock);
return result;
}
@PostMapping("/borrow/apply")
public Map<String, Object> borrowApply(@RequestBody Map<String, Object> params) {
String consumableId = (String) params.get("consumableId");
Integer borrowQuantity = (Integer) params.get("borrowQuantity");
String applicantId = (String) params.get("applicantId");
String labId = (String) params.get("labId");
String borrowReason = (String) params.get("borrowReason");
Date expectedReturnDate = (Date) params.get("expectedReturnDate");
Map<String, Object> result = new HashMap<>();
if (consumableId == null || borrowQuantity == null || borrowQuantity <= 0) {
result.put("success", false);
result.put("message", "借用信息不完整");
return result;
}
Map<String, Object> consumable = consumablesService.getConsumableById(consumableId);
if (consumable == null) {
result.put("success", false);
result.put("message", "耗材不存在");
return result;
}
Integer currentStock = (Integer) consumable.get("stock");
Integer minStock = (Integer) consumable.get("minStock");
if (currentStock < borrowQuantity) {
result.put("success", false);
result.put("message", "库存不足,当前库存:" + currentStock);
return result;
}
if (currentStock - borrowQuantity < minStock) {
result.put("success", false);
result.put("message", "借用后库存将低于最低库存预警线");
return result;
}
Map<String, Object> borrowRecord = new HashMap<>();
borrowRecord.put("id", UUID.randomUUID().toString());
borrowRecord.put("consumableId", consumableId);
borrowRecord.put("applicantId", applicantId);
borrowRecord.put("labId", labId);
borrowRecord.put("borrowQuantity", borrowQuantity);
borrowRecord.put("borrowReason", borrowReason);
borrowRecord.put("expectedReturnDate", expectedReturnDate);
borrowRecord.put("status", "待审核");
borrowRecord.put("applyTime", LocalDateTime.now());
consumablesService.insertBorrowRecord(borrowRecord);
List<Map<String, Object>> pendingApprovalList = consumablesService.getPendingApprovalByApplicant(applicantId);
if (pendingApprovalList.size() > 5) {
result.put("success", false);
result.put("message", "待审核申请过多,请等待之前申请处理完成");
return result;
}
Map<String, Object> applicant = consumablesService.getUserById(applicantId);
Map<String, Object> lab = consumablesService.getLabById(labId);
String notificationMessage = String.format("用户%s申请借用耗材%s,数量%d,实验室:%s",
applicant.get("name"), consumable.get("name"), borrowQuantity, lab.get("name"));
consumablesService.sendNotificationToAdmin(notificationMessage);
result.put("success", true);
result.put("message", "借用申请提交成功,等待审核");
result.put("applicationId", borrowRecord.get("id"));
return result;
}
@GetMapping("/analysis/usage")
public Map<String, Object> getUsageAnalysis(@RequestParam String timeRange) {
Map<String, Object> result = new HashMap<>();
List<Map<String, Object>> usageData = consumablesService.getUsageDataByTimeRange(timeRange);
Dataset<Row> usageDF = spark.createDataFrame(usageData, Map.class);
usageDF.createOrReplaceTempView("usage_data");
Dataset<Row> consumableUsage = spark.sql("SELECT consumableId, consumableName, SUM(quantity) as totalUsage, AVG(quantity) as avgUsage FROM usage_data GROUP BY consumableId, consumableName ORDER BY totalUsage DESC");
Dataset<Row> labUsage = spark.sql("SELECT labId, labName, SUM(quantity) as totalUsage FROM usage_data GROUP BY labId, labName ORDER BY totalUsage DESC");
Dataset<Row> monthlyTrend = spark.sql("SELECT MONTH(operateTime) as month, SUM(quantity) as monthlyTotal FROM usage_data GROUP BY MONTH(operateTime) ORDER BY month");
Dataset<Row> topConsumables = consumableUsage.limit(10);
Dataset<Row> lowStockAlert = spark.sql("SELECT consumableId, consumableName, currentStock, minStock FROM usage_data WHERE currentStock <= minStock * 1.2 GROUP BY consumableId, consumableName, currentStock, minStock");
List<Map<String, Object>> topConsumablesList = new ArrayList<>();
topConsumables.collectAsList().forEach(row -> {
Map<String, Object> item = new HashMap<>();
item.put("consumableId", row.getString(0));
item.put("consumableName", row.getString(1));
item.put("totalUsage", row.getLong(2));
item.put("avgUsage", row.getDouble(3));
topConsumablesList.add(item);
});
List<Map<String, Object>> labUsageList = new ArrayList<>();
labUsage.collectAsList().forEach(row -> {
Map<String, Object> item = new HashMap<>();
item.put("labId", row.getString(0));
item.put("labName", row.getString(1));
item.put("totalUsage", row.getLong(2));
labUsageList.add(item);
});
List<Map<String, Object>> monthlyTrendList = new ArrayList<>();
monthlyTrend.collectAsList().forEach(row -> {
Map<String, Object> item = new HashMap<>();
item.put("month", row.getInt(0));
item.put("monthlyTotal", row.getLong(1));
monthlyTrendList.add(item);
});
List<Map<String, Object>> alertList = new ArrayList<>();
lowStockAlert.collectAsList().forEach(row -> {
Map<String, Object> item = new HashMap<>();
item.put("consumableId", row.getString(0));
item.put("consumableName", row.getString(1));
item.put("currentStock", row.getInt(2));
item.put("minStock", row.getInt(3));
item.put("alertLevel", row.getInt(2) <= row.getInt(3) ? "严重" : "警告");
alertList.add(item);
});
result.put("success", true);
result.put("topConsumables", topConsumablesList);
result.put("labUsageRanking", labUsageList);
result.put("monthlyTrend", monthlyTrendList);
result.put("lowStockAlert", alertList);
result.put("analysisTime", LocalDateTime.now());
return result;
}
}
基于web平台的实验室耗材管理系统文档展示
💖💖作者:计算机编程小咖 💙💙个人简介:曾长期从事计算机专业培训教学,本人也热爱上课教学,语言擅长Java、微信小程序、Python、Golang、安卓Android等,开发项目包括大数据、深度学习、网站、小程序、安卓、算法。平常会做一些项目定制化开发、代码讲解、答辩教学、文档编写、也懂一些降重方面的技巧。平常喜欢分享一些自己开发中遇到的问题的解决办法,也喜欢交流技术,大家有技术代码这一块的问题可以问我! 💛💛想说的话:感谢大家的关注与支持! 💜💜 网站实战项目 安卓/小程序实战项目 大数据实战项目 深度学习实战项目