diff --git a/klp-admin/src/main/java/com/klp/framework/client/SqlServerApiClient.java b/klp-admin/src/main/java/com/klp/framework/client/SqlServerApiClient.java index 2a4b39a5..47db1d68 100644 --- a/klp-admin/src/main/java/com/klp/framework/client/SqlServerApiClient.java +++ b/klp-admin/src/main/java/com/klp/framework/client/SqlServerApiClient.java @@ -1,5 +1,6 @@ package com.klp.framework.client; +import com.fasterxml.jackson.annotation.JsonProperty; import com.klp.framework.config.SqlServerApiProperties; import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; @@ -73,7 +74,9 @@ public class SqlServerApiClient { } public static class TableSchemaRequest { + @JsonProperty("table_type") private String tableType; + @JsonProperty("table_name") private String tableName; public TableSchemaRequest() { @@ -102,6 +105,7 @@ public class SqlServerApiClient { } public static class ExecuteSqlRequest { + @JsonProperty("table_type") private String tableType; private String sql; private Map params; @@ -311,10 +315,23 @@ public class SqlServerApiClient { ); } - public ExecuteSqlResponse queryPlanList() { + public ExecuteSqlResponse queryPlanList(int page, int pageSize) { + int endRow = page * pageSize; + int startRow = endRow - pageSize; + Map params = new java.util.HashMap<>(); + params.put("startRow", startRow); + params.put("endRow", endRow); return executeSql( "oracle", - "select * from JXPLTCM.PLTCM_PDI_PLAN order by INSDATE desc", + "select * from (select t.*, ROWNUM rn from (select * from JXPLTCM.PLTCM_PDI_PLAN order by INSDATE desc) t where ROWNUM <= :endRow) where rn > :startRow", + params + ); + } + + public ExecuteSqlResponse queryPlanCount() { + return executeSql( + "oracle", + "select count(*) as total from JXPLTCM.PLTCM_PDI_PLAN", emptyParams() ); } diff --git a/klp-admin/src/main/java/com/klp/framework/config/SqlServerApiClientConfig.java b/klp-admin/src/main/java/com/klp/framework/config/SqlServerApiClientConfig.java index b6f520b2..7549a7e6 100644 --- a/klp-admin/src/main/java/com/klp/framework/config/SqlServerApiClientConfig.java +++ b/klp-admin/src/main/java/com/klp/framework/config/SqlServerApiClientConfig.java @@ -17,7 +17,7 @@ public class SqlServerApiClientConfig { public RestTemplate sqlServerApiRestTemplate(RestTemplateBuilder builder) { return builder .setConnectTimeout(Duration.ofSeconds(5)) - .setReadTimeout(Duration.ofSeconds(30)) + .setReadTimeout(Duration.ofSeconds(60)) .build(); } } diff --git a/klp-admin/src/main/java/com/klp/framework/service/SqlServerApiBusinessService.java b/klp-admin/src/main/java/com/klp/framework/service/SqlServerApiBusinessService.java index 141ad459..10932c26 100644 --- a/klp-admin/src/main/java/com/klp/framework/service/SqlServerApiBusinessService.java +++ b/klp-admin/src/main/java/com/klp/framework/service/SqlServerApiBusinessService.java @@ -32,12 +32,24 @@ public class SqlServerApiBusinessService { } /** - * 计划列表:查询所有计划,按时间倒序。 - *

- * 这是后续按 coilId 关联 SEG、实时数据的入口。 + * 计划列表(分页):按时间倒序,page 从 1 开始。 */ - public PlanListView getPlanList() { - return PlanListView.fromExecuteSqlResponse(client.queryPlanList()); + public PlanListView getPlanList(int page, int pageSize) { + return PlanListView.fromExecuteSqlResponse(client.queryPlanList(page, pageSize)); + } + + /** + * 计划总数。 + */ + public long getPlanCount() { + SqlServerApiClient.ExecuteSqlResponse resp = client.queryPlanCount(); + List> rows = asRowList(resp); + if (rows.isEmpty()) { + return 0L; + } + Object total = rows.get(0).get("total"); + Number n = asNumber(total); + return n == null ? 0L : n.longValue(); } /** diff --git a/klp-admin/src/main/java/com/klp/framework/sqlserver/SqlServerApiController.java b/klp-admin/src/main/java/com/klp/framework/sqlserver/SqlServerApiController.java index f499d74c..43f27f03 100644 --- a/klp-admin/src/main/java/com/klp/framework/sqlserver/SqlServerApiController.java +++ b/klp-admin/src/main/java/com/klp/framework/sqlserver/SqlServerApiController.java @@ -1,4 +1,4 @@ -package com.klp.web.controller.sqlserver; +package com.klp.framework.sqlserver; import com.klp.common.core.domain.R; import com.klp.framework.service.SqlServerApiBusinessService; @@ -6,8 +6,12 @@ import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import java.util.HashMap; +import java.util.Map; + /** * sql-server-api 业务查询接口。 *

@@ -21,11 +25,24 @@ public class SqlServerApiController { private final SqlServerApiBusinessService businessService; /** - * 计划列表。 + * 计划列表(分页)。 + * page 从 1 开始,默认第 1 页,每页 20 条。 */ @GetMapping("/plans") - public R planList() { - return R.ok(businessService.getPlanList()); + public R planList( + @RequestParam(defaultValue = "1") int page, + @RequestParam(defaultValue = "20") int pageSize) { + return R.ok(businessService.getPlanList(page, pageSize)); + } + + /** + * 计划总数,用于前端分页器。 + */ + @GetMapping("/plans/count") + public R> planCount() { + Map result = new HashMap<>(); + result.put("total", businessService.getPlanCount()); + return R.ok(result); } /** diff --git a/klp-admin/src/main/resources/application-dev.yml b/klp-admin/src/main/resources/application-dev.yml index c5e8a7f4..a5fe3783 100644 --- a/klp-admin/src/main/resources/application-dev.yml +++ b/klp-admin/src/main/resources/application-dev.yml @@ -7,6 +7,12 @@ klp: # 开发环境文件存储目录 directory-path: testDirectory +--- # sql-server-api 中间件配置(开发/测试环境) +sql-server-api: + host: 140.143.206.120 + port: 15000 + base-url: http://${sql-server-api.host}:${sql-server-api.port} + --- # OEE 聚合(klp-da)多服务地址配置 da: oee: diff --git a/klp-admin/src/main/resources/application-prod.yml b/klp-admin/src/main/resources/application-prod.yml index a96a335b..99661cb6 100644 --- a/klp-admin/src/main/resources/application-prod.yml +++ b/klp-admin/src/main/resources/application-prod.yml @@ -7,6 +7,12 @@ klp: # 生产环境文件存储目录 directory-path: /home/ubuntu/oa/folder +--- # sql-server-api 中间件配置(生产环境) +sql-server-api: + host: 192.168.0.219 + port: 15000 + base-url: http://${sql-server-api.host}:${sql-server-api.port} + --- # OEE 聚合(klp-da)多服务地址配置 da: oee: diff --git a/klp-admin/src/main/resources/application.yml b/klp-admin/src/main/resources/application.yml index 4b95c60e..334cadf3 100644 --- a/klp-admin/src/main/resources/application.yml +++ b/klp-admin/src/main/resources/application.yml @@ -66,14 +66,6 @@ user: lockTime: 10 # sql-server-api 中间件配置 -sql-server-api: - # 请求地址,请替换为实际 IP - host: 127.0.0.1 - # 请求端口,请替换为实际端口 - port: 8080 - # 基础访问地址(可直接注入使用) - base-url: http://${sql-server-api.host}:${sql-server-api.port} - # Spring配置 spring: application: diff --git a/klp-ui/src/api/l2/timing.js b/klp-ui/src/api/l2/timing.js index d2f865c0..0801ec12 100644 --- a/klp-ui/src/api/l2/timing.js +++ b/klp-ui/src/api/l2/timing.js @@ -1,36 +1,50 @@ -import axios from 'axios' +import request from '@/utils/request' -export default function createTimingFetch(url) { - const request = axios.create({ - baseURL: 'http://' + url, - headers: { - 'Content-Type': 'application/json' - }, - timeout: 10000 +// 计划列表(分页) +export function getTimingPlanList(page = 1, pageSize = 20) { + return request({ + url: '/sql-server-api/plans', + method: 'get', + params: { page, pageSize } + }) +} + +// 计划总数 +export function getTimingPlanCount() { + return request({ + url: '/sql-server-api/plans/count', + method: 'get' + }) +} + +// 计划详情 +export function getTimingPlanDetail(coilId) { + return request({ + url: '/sql-server-api/plans/' + coilId, + method: 'get' + }) +} + +// 钢卷实际 SEG,按入口卷号查询 +export function getTimingSegByEncoilId(encoilId) { + return request({ + url: '/sql-server-api/seg/' + encoilId, + method: 'get' + }) +} + +// 钢卷实际 SEG,按出口卷号查询 +export function getTimingSegByExcoilId(excoilId) { + return request({ + url: '/sql-server-api/seg-by-excoil/' + excoilId, + method: 'get' + }) +} + +// 实时数据:Gauge + Shape +export function getTimingRealtimeData(matId) { + return request({ + url: '/sql-server-api/realtime/' + matId, + method: 'get' }) - - request.interceptors.response.use(response => response.data) - - return { - getPlanList: () => request({ - url: '/sql-server-api/plans', - method: 'get' - }), - getPlanDetail: (coilId) => request({ - url: `/sql-server-api/plans/${coilId}`, - method: 'get' - }), - getSegByEncoilId: (encoilId) => request({ - url: `/sql-server-api/seg/${encoilId}`, - method: 'get' - }), - getSegByExcoilId: (excoilId) => request({ - url: `/sql-server-api/seg-by-excoil/${excoilId}`, - method: 'get' - }), - getRealtimeData: (matId) => request({ - url: `/sql-server-api/realtime/${matId}`, - method: 'get' - }) - } } diff --git a/klp-ui/src/views/timing/acid/index.vue b/klp-ui/src/views/timing/acid/index.vue index 0f7d1bc9..679a169e 100644 --- a/klp-ui/src/views/timing/acid/index.vue +++ b/klp-ui/src/views/timing/acid/index.vue @@ -1,151 +1,204 @@ diff --git a/klp-ui/src/views/timing/realtime/index.vue b/klp-ui/src/views/timing/realtime/index.vue index e9e0f9cd..1e2f8daa 100644 --- a/klp-ui/src/views/timing/realtime/index.vue +++ b/klp-ui/src/views/timing/realtime/index.vue @@ -55,16 +55,12 @@ + + diff --git a/klp-ui/src/views/wms/processSpec/planSpec.vue b/klp-ui/src/views/wms/processSpec/planSpec.vue new file mode 100644 index 00000000..d54dc3aa --- /dev/null +++ b/klp-ui/src/views/wms/processSpec/planSpec.vue @@ -0,0 +1,533 @@ + + + + + diff --git a/klp-ui/src/views/wms/processSpec/versionManage.vue b/klp-ui/src/views/wms/processSpec/versionManage.vue index 642416b2..1299de71 100644 --- a/klp-ui/src/views/wms/processSpec/versionManage.vue +++ b/klp-ui/src/views/wms/processSpec/versionManage.vue @@ -1,192 +1,97 @@