提交酸扎串联内容以及磨辊间
This commit is contained in:
@@ -414,6 +414,71 @@ public class SqlServerApiClient {
|
||||
return multiValueMap;
|
||||
}
|
||||
|
||||
public ExecuteSqlResponse queryRollDataAll() {
|
||||
return executeSql(
|
||||
"oracle",
|
||||
"SELECT * FROM JXPLTCM.ROLL_DATA WHERE STATUS = 'ONLINE' ORDER BY STANDID",
|
||||
emptyParams()
|
||||
);
|
||||
}
|
||||
|
||||
public ExecuteSqlResponse queryRollDataFiltered(String type, String status) {
|
||||
java.util.HashMap<String, Object> params = new java.util.HashMap<>();
|
||||
StringBuilder sql = new StringBuilder("SELECT * FROM JXPLTCM.ROLL_DATA WHERE 1=1");
|
||||
if (type != null && !type.trim().isEmpty()) {
|
||||
sql.append(" AND TYPE = :type");
|
||||
params.put("type", type.trim());
|
||||
}
|
||||
if (status != null && !status.trim().isEmpty()) {
|
||||
sql.append(" AND STATUS = :status");
|
||||
params.put("status", status.trim());
|
||||
}
|
||||
sql.append(" ORDER BY STANDID");
|
||||
return executeSql("oracle", sql.toString(), params);
|
||||
}
|
||||
|
||||
public ExecuteSqlResponse queryRollHistoryByRollId(String rollId) {
|
||||
return executeSql(
|
||||
"oracle",
|
||||
"SELECT * FROM JXPLTCM.ROLL_HISTORY WHERE ROLLID = :rollId ORDER BY CHANGE_TIME DESC",
|
||||
singletonParam("rollId", rollId)
|
||||
);
|
||||
}
|
||||
|
||||
public ExecuteSqlResponse queryRollHistoryList(int page, int pageSize, String rollId, Integer standId) {
|
||||
java.util.HashMap<String, Object> params = new java.util.HashMap<>();
|
||||
StringBuilder inner = new StringBuilder("SELECT * FROM JXPLTCM.ROLL_HISTORY WHERE 1=1");
|
||||
if (rollId != null && !rollId.trim().isEmpty()) {
|
||||
inner.append(" AND ROLLID = :rollId");
|
||||
params.put("rollId", rollId.trim());
|
||||
}
|
||||
if (standId != null) {
|
||||
inner.append(" AND STANDID = :standId");
|
||||
params.put("standId", standId);
|
||||
}
|
||||
inner.append(" ORDER BY CHANGE_TIME DESC");
|
||||
int endRow = page * pageSize;
|
||||
int startRow = endRow - pageSize;
|
||||
params.put("endRow", endRow);
|
||||
params.put("startRow", startRow);
|
||||
String sql = "SELECT * FROM (SELECT t.*, ROWNUM rn FROM (" + inner + ") t WHERE ROWNUM <= :endRow) WHERE rn > :startRow";
|
||||
return executeSql("oracle", sql, params);
|
||||
}
|
||||
|
||||
public ExecuteSqlResponse queryRollHistoryCount(String rollId, Integer standId) {
|
||||
java.util.HashMap<String, Object> params = new java.util.HashMap<>();
|
||||
StringBuilder sql = new StringBuilder("SELECT COUNT(*) as total FROM JXPLTCM.ROLL_HISTORY WHERE 1=1");
|
||||
if (rollId != null && !rollId.trim().isEmpty()) {
|
||||
sql.append(" AND ROLLID = :rollId");
|
||||
params.put("rollId", rollId.trim());
|
||||
}
|
||||
if (standId != null) {
|
||||
sql.append(" AND STANDID = :standId");
|
||||
params.put("standId", standId);
|
||||
}
|
||||
return executeSql("oracle", sql.toString(), params);
|
||||
}
|
||||
|
||||
private Map<String, Object> singletonParam(String key, Object value) {
|
||||
java.util.HashMap<String, Object> params = new java.util.HashMap<String, Object>();
|
||||
if (value != null) {
|
||||
|
||||
@@ -129,6 +129,46 @@ public class SqlServerApiBusinessService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 轧辊数据:返回全部在辊/备辊数据。
|
||||
*/
|
||||
public RollListView getRollData() {
|
||||
return RollListView.fromExecuteSqlResponse(client.queryRollDataAll());
|
||||
}
|
||||
|
||||
/**
|
||||
* 轧辊数据:按类型和状态过滤。
|
||||
*/
|
||||
public RollListView getRollDataFiltered(String type, String status) {
|
||||
return RollListView.fromExecuteSqlResponse(client.queryRollDataFiltered(type, status));
|
||||
}
|
||||
|
||||
/**
|
||||
* 换辊历史:按轧辊号查询(供配辊页内联使用)。
|
||||
*/
|
||||
public List<Map<String, Object>> getRollHistory(String rollId) {
|
||||
return asRowList(client.queryRollHistoryByRollId(rollId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 换辊历史列表(分页 + 可选过滤)。
|
||||
*/
|
||||
public RollHistoryPageView getRollHistoryList(int page, int pageSize, String rollId, Integer standId) {
|
||||
List<Map<String, Object>> rows = asRowList(client.queryRollHistoryList(page, pageSize, rollId, standId));
|
||||
return new RollHistoryPageView(rows);
|
||||
}
|
||||
|
||||
/**
|
||||
* 换辊历史总条数(用于前端分页器)。
|
||||
*/
|
||||
public long getRollHistoryCount(String rollId, Integer standId) {
|
||||
SqlServerApiClient.ExecuteSqlResponse resp = client.queryRollHistoryCount(rollId, standId);
|
||||
List<Map<String, Object>> rows = asRowList(resp);
|
||||
if (rows.isEmpty()) return 0L;
|
||||
Number n = asNumber(rows.get(0).get("total"));
|
||||
return n == null ? 0L : n.longValue();
|
||||
}
|
||||
|
||||
private static PlanListView toPlanListView(SqlServerApiClient.ExecuteSqlResponse response) {
|
||||
return PlanListView.fromExecuteSqlResponse(response);
|
||||
}
|
||||
@@ -297,6 +337,34 @@ public class SqlServerApiBusinessService {
|
||||
}
|
||||
}
|
||||
|
||||
public static class RollListView {
|
||||
private final List<Map<String, Object>> rows;
|
||||
|
||||
public RollListView(List<Map<String, Object>> rows) {
|
||||
this.rows = rows;
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getRows() {
|
||||
return rows;
|
||||
}
|
||||
|
||||
public static RollListView fromExecuteSqlResponse(SqlServerApiClient.ExecuteSqlResponse response) {
|
||||
return new RollListView(asRowList(response));
|
||||
}
|
||||
}
|
||||
|
||||
public static class RollHistoryPageView {
|
||||
private final List<Map<String, Object>> rows;
|
||||
|
||||
public RollHistoryPageView(List<Map<String, Object>> rows) {
|
||||
this.rows = rows;
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getRows() {
|
||||
return rows;
|
||||
}
|
||||
}
|
||||
|
||||
public static class RealtimeDataBundle {
|
||||
private final SqlServerApiClient.ExecuteSqlResponse gauge;
|
||||
private final SqlServerApiClient.ExecuteSqlResponse shape;
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -76,4 +77,49 @@ public class SqlServerApiController {
|
||||
public R<SqlServerApiBusinessService.RealtimeDataBundle> realtime(@PathVariable String matId) {
|
||||
return R.ok(businessService.getRealtimeData(matId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 轧辊数据:type / status 均可选,不传则返回全量。
|
||||
*/
|
||||
@GetMapping("/rolls")
|
||||
public R<SqlServerApiBusinessService.RollListView> rollList(
|
||||
@RequestParam(required = false) String type,
|
||||
@RequestParam(required = false) String status) {
|
||||
if ((type != null && !type.isEmpty()) || (status != null && !status.isEmpty())) {
|
||||
return R.ok(businessService.getRollDataFiltered(type, status));
|
||||
}
|
||||
return R.ok(businessService.getRollData());
|
||||
}
|
||||
|
||||
/**
|
||||
* 换辊历史:按轧辊号查询(配辊页内联用)。
|
||||
*/
|
||||
@GetMapping("/rolls/{rollId}/history")
|
||||
public R<List<Map<String, Object>>> rollHistory(@PathVariable String rollId) {
|
||||
return R.ok(businessService.getRollHistory(rollId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 换辊历史列表(分页)。rollId / standId 均可选。
|
||||
*/
|
||||
@GetMapping("/rolls/history")
|
||||
public R<SqlServerApiBusinessService.RollHistoryPageView> rollHistoryList(
|
||||
@RequestParam(defaultValue = "1") int page,
|
||||
@RequestParam(defaultValue = "50") int pageSize,
|
||||
@RequestParam(required = false) String rollId,
|
||||
@RequestParam(required = false) Integer standId) {
|
||||
return R.ok(businessService.getRollHistoryList(page, pageSize, rollId, standId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 换辊历史总条数。
|
||||
*/
|
||||
@GetMapping("/rolls/history/count")
|
||||
public R<Map<String, Long>> rollHistoryCount(
|
||||
@RequestParam(required = false) String rollId,
|
||||
@RequestParam(required = false) Integer standId) {
|
||||
Map<String, Long> result = new HashMap<>();
|
||||
result.put("total", businessService.getRollHistoryCount(rollId, standId));
|
||||
return R.ok(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
-- =====================================================================
|
||||
-- 磨辊记录表
|
||||
-- 记录每次磨削的参数,并通过触发 Service 逻辑同步更新 mes_roll_info
|
||||
-- =====================================================================
|
||||
CREATE TABLE IF NOT EXISTS mes_roll_grind (
|
||||
grind_id BIGINT NOT NULL AUTO_INCREMENT COMMENT '磨削记录ID',
|
||||
roll_id BIGINT NOT NULL COMMENT '关联轧辊ID',
|
||||
roll_no VARCHAR(50) COMMENT '轧辊编号(冗余,方便查询)',
|
||||
grind_time DATETIME COMMENT '磨削时间',
|
||||
team VARCHAR(50) COMMENT '磨削班组/负责人',
|
||||
dia_before DECIMAL(10,2) COMMENT '磨前直径(mm)',
|
||||
dia_after DECIMAL(10,2) COMMENT '磨后直径(mm)',
|
||||
grind_amount DECIMAL(10,2) COMMENT '磨削量(mm) = dia_before - dia_after',
|
||||
roll_shape VARCHAR(100) COMMENT '辊型/辊面状态',
|
||||
flaw_result VARCHAR(200) COMMENT '探伤结果',
|
||||
hardness VARCHAR(50) COMMENT '硬度检测值',
|
||||
operator VARCHAR(50) COMMENT '操作人员',
|
||||
remark VARCHAR(500) COMMENT '备注',
|
||||
|
||||
del_flag INT NOT NULL DEFAULT 0 COMMENT '删除标志(0正常 1删除)',
|
||||
create_by VARCHAR(64) COMMENT '创建人',
|
||||
create_time DATETIME COMMENT '创建时间',
|
||||
update_by VARCHAR(64) COMMENT '更新人',
|
||||
update_time DATETIME COMMENT '更新时间',
|
||||
|
||||
PRIMARY KEY (grind_id),
|
||||
KEY idx_roll_id (roll_id),
|
||||
KEY idx_grind_time (grind_time)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='轧辊磨削记录';
|
||||
|
||||
|
||||
-- =====================================================================
|
||||
-- 菜单:磨辊间
|
||||
-- 运行前请先查询轧辊管理父菜单 ID:
|
||||
-- SELECT menu_id, menu_name, path FROM sys_menu WHERE path LIKE '%roll%';
|
||||
-- 将下方的 @roll_parent 替换为实际的父菜单 ID,再执行。
|
||||
-- =====================================================================
|
||||
-- 示例(请先确认父菜单 ID):
|
||||
--
|
||||
-- SET @roll_parent = (
|
||||
-- SELECT menu_id FROM sys_menu
|
||||
-- WHERE path = 'roll' AND parent_id != 0
|
||||
-- LIMIT 1
|
||||
-- );
|
||||
--
|
||||
-- INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component,
|
||||
-- is_frame, is_cache, menu_type, visible, status, perms, icon,
|
||||
-- create_by, create_time, update_by, update_time, remark)
|
||||
-- VALUES ('磨辊间', @roll_parent, 3, 'grind', 'mes/roll/grind/index',
|
||||
-- 1, 0, 'C', '0', '0', NULL, 'tool',
|
||||
-- 'admin', NOW(), 'admin', NOW(), '磨辊间管理');
|
||||
Reference in New Issue
Block a user