停机时长修复

This commit is contained in:
2026-05-11 15:44:37 +08:00
parent dcb5f9525e
commit 7b1827ed83
8 changed files with 1633 additions and 389 deletions

View File

@@ -376,13 +376,13 @@ public class SqlServerApiClient {
"select COILID from JXPLTCM.PLTCM_PDI_PLAN where HOT_COILID = :hotCoilId",
singletonParam("hotCoilId", hotCoilId)
);
List<Map<String, Object>> rows = (List<Map<String, Object>>) planResponse.getResult();
if (rows == null || rows.isEmpty()) {
// 如果没有找到对应的计划记录,返回空结果
return new ExecuteSqlResponse();
}
// 收集所有有效的 COILID
List<String> coilIds = new ArrayList<>();
for (Map<String, Object> row : rows) {
@@ -391,11 +391,11 @@ public class SqlServerApiClient {
coilIds.add(coilId);
}
}
if (coilIds.isEmpty()) {
return new ExecuteSqlResponse();
}
// 用所有的 COILID 去查询 PLTCM_PRO_SEG 表的 ENCOILID
// 使用 IN 查询一次性获取所有数据
Map<String, Object> params = new java.util.HashMap<>();
@@ -409,10 +409,39 @@ public class SqlServerApiClient {
params.put(paramName, coilIds.get(i));
}
sql.append(") order by ENCOILID, SEGNO");
return executeSql("oracle", sql.toString(), params);
}
public ExecuteSqlResponse queryExcoilList(int page, int pageSize) {
int endRow = page * pageSize;
int startRow = endRow - pageSize;
Map<String, Object> params = new java.util.HashMap<>();
params.put("startRow", startRow);
params.put("endRow", endRow);
return executeSql(
"oracle",
"select * from (select t.*, ROWNUM rn from (select * from JXPLTCM.PLTCM_PDO_EXCOIL order by END_DATE desc) t where ROWNUM <= :endRow) where rn > :startRow",
params
);
}
public ExecuteSqlResponse queryExcoilCount() {
return executeSql(
"oracle",
"select count(*) as total from JXPLTCM.PLTCM_PDO_EXCOIL",
emptyParams()
);
}
public ExecuteSqlResponse queryPresetSetupByCoilId(String coilId) {
return executeSql(
"oracle",
"select * from JXPLTCM.PLTCM_PRESET_SETUP where COILID = :coilId",
singletonParam("coilId", coilId)
);
}
public ExecuteSqlResponse queryProSegByExcoilId(String excoilId) {
return executeSql(
"oracle",

View File

@@ -126,6 +126,32 @@ public class SqlServerApiBusinessService {
return client.queryShapeByMatId(matId);
}
/**
* 出口卷实绩列表(分页),来自 PLTCM_PDO_EXCOIL。
*/
public ExcoilPageView getExcoilList(int page, int pageSize) {
return new ExcoilPageView(asRowList(client.queryExcoilList(page, pageSize)));
}
/**
* 出口卷实绩总数。
*/
public long getExcoilCount() {
List<Map<String, Object>> rows = asRowList(client.queryExcoilCount());
if (rows.isEmpty()) return 0L;
Number n = asNumber(rows.get(0).get("total"));
return n == null ? 0L : n.longValue();
}
/**
* 工艺预设参数按钢卷号查询PLTCM_PRESET_SETUP
*/
public PresetSetupView getPresetSetupByCoilId(String coilId) {
List<Map<String, Object>> rows = asRowList(client.queryPresetSetupByCoilId(coilId));
Map<String, Object> firstRow = rows.isEmpty() ? Collections.<String, Object>emptyMap() : rows.get(0);
return new PresetSetupView(coilId, firstRow);
}
/**
* 实时数据总入口:一次性返回厚度与板形两类数据。
*/
@@ -361,6 +387,36 @@ public class SqlServerApiBusinessService {
}
}
public static class ExcoilPageView {
private final List<Map<String, Object>> rows;
public ExcoilPageView(List<Map<String, Object>> rows) {
this.rows = rows;
}
public List<Map<String, Object>> getRows() {
return rows;
}
}
public static class PresetSetupView {
private final String coilId;
private final Map<String, Object> data;
public PresetSetupView(String coilId, Map<String, Object> data) {
this.coilId = coilId;
this.data = data;
}
public String getCoilId() {
return coilId;
}
public Map<String, Object> getData() {
return data;
}
}
public static class RollListView {
private final List<Map<String, Object>> rows;

View File

@@ -155,6 +155,34 @@ public class SqlServerApiController {
return R.ok(businessService.getRollHistoryList(page, pageSize, rollId, standId));
}
/**
* 出口卷实绩列表(分页),来自 PLTCM_PDO_EXCOIL。
*/
@GetMapping("/excoil")
public R<SqlServerApiBusinessService.ExcoilPageView> excoilList(
@RequestParam(defaultValue = "1") int page,
@RequestParam(defaultValue = "50") int pageSize) {
return R.ok(businessService.getExcoilList(page, pageSize));
}
/**
* 出口卷实绩总数。
*/
@GetMapping("/excoil/count")
public R<Map<String, Long>> excoilCount() {
Map<String, Long> result = new HashMap<>();
result.put("total", businessService.getExcoilCount());
return R.ok(result);
}
/**
* 工艺预设参数按计划钢卷号查询PLTCM_PRESET_SETUP
*/
@GetMapping("/preset-setup/{coilId}")
public R<SqlServerApiBusinessService.PresetSetupView> presetSetup(@PathVariable String coilId) {
return R.ok(businessService.getPresetSetupByCoilId(coilId));
}
/**
* 换辊历史总条数。
*/