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 1bdfd602..405aec7d 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 @@ -413,6 +413,21 @@ public class SqlServerApiClient { return executeSql("oracle", sql.toString(), params); } + public ExecuteSqlResponse queryExcoilByTimeRange(String startTime, String endTime) { + Map params = new java.util.HashMap<>(); + StringBuilder sql = new StringBuilder("SELECT * FROM JXPLTCM.PLTCM_PDO_EXCOIL WHERE 1=1"); + if (startTime != null && !startTime.trim().isEmpty()) { + sql.append(" AND END_DATE >= TO_DATE(:startTime, 'YYYY-MM-DD HH24:MI:SS')"); + params.put("startTime", startTime.trim()); + } + if (endTime != null && !endTime.trim().isEmpty()) { + sql.append(" AND END_DATE <= TO_DATE(:endTime, 'YYYY-MM-DD HH24:MI:SS')"); + params.put("endTime", endTime.trim()); + } + sql.append(" ORDER BY END_DATE DESC"); + return executeSql("oracle", sql.toString(), params); + } + public ExecuteSqlResponse queryExcoilList(int page, int pageSize) { int endRow = page * pageSize; int startRow = endRow - pageSize; diff --git a/klp-admin/src/main/java/com/klp/framework/controller/CoilComparisonController.java b/klp-admin/src/main/java/com/klp/framework/controller/CoilComparisonController.java new file mode 100644 index 00000000..fb26c9dc --- /dev/null +++ b/klp-admin/src/main/java/com/klp/framework/controller/CoilComparisonController.java @@ -0,0 +1,120 @@ +package com.klp.framework.controller; + +import com.klp.common.core.domain.R; +import com.klp.domain.bo.WmsMaterialCoilBo; +import com.klp.domain.vo.WmsMaterialCoilVo; +import com.klp.framework.service.SqlServerApiBusinessService; +import com.klp.service.IWmsMaterialCoilService; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +@RequiredArgsConstructor +@RestController +@RequestMapping("/wms/coil-comparison") +public class CoilComparisonController { + + private final SqlServerApiBusinessService sqlServerService; + private final IWmsMaterialCoilService wmsMaterialCoilService; + + @GetMapping("/excoil-status") + public R>> getExcoilStatus( + @RequestParam(required = false) String startTime, + @RequestParam(required = false) String endTime, + @RequestParam(required = false) String lineType) { + + List> excoilRows = sqlServerService.getExcoilByTimeRange(startTime, endTime); + + WmsMaterialCoilBo bo = new WmsMaterialCoilBo(); + bo.setItemType("raw_material"); + bo.setMaterialType("原料"); + bo.setItemName("热轧卷板"); + bo.setSelectType("raw_material"); + List localCoils = wmsMaterialCoilService.queryList(bo); + + Map localMap = new HashMap<>(); + for (WmsMaterialCoilVo coil : localCoils) { + if (coil.getEnterCoilNo() != null) { + localMap.put(coil.getEnterCoilNo(), coil); + } + } + + List> result = new ArrayList<>(); + for (Map excoil : excoilRows) { + String hotCoilId = excoil.get("HOT_COILID") != null ? String.valueOf(excoil.get("HOT_COILID")) : null; + Map item = new LinkedHashMap<>(); + item.put("excoilId", excoil.get("EXCOILID")); + item.put("coilId", excoil.get("COILID")); + item.put("hotCoilId", hotCoilId); + item.put("endDate", excoil.get("END_DATE")); + item.put("startDate", excoil.get("START_DATE")); + item.put("actualThick", excoil.get("ACTUAL_THICK")); + item.put("actualWidth", excoil.get("ACTUAL_WIDTH")); + item.put("actualWeight", excoil.get("ACTUAL_WEIGHT")); + item.put("processCode", excoil.get("PROCESS_CODE")); + + if (hotCoilId != null) { + WmsMaterialCoilVo matched = localMap.get(hotCoilId); + if (matched != null) { + item.put("enterCoilNo", matched.getEnterCoilNo()); + item.put("currentCoilNo", matched.getCurrentCoilNo()); + item.put("supplierCoilNo", matched.getSupplierCoilNo()); + item.put("dataType", matched.getDataType()); + item.put("itemName", matched.getItemName()); + item.put("itemCode", matched.getItemCode()); + item.put("specification", matched.getSpecification()); + item.put("material", matched.getMaterial()); + item.put("manufacturer", matched.getManufacturer()); + item.put("coilStatus", matched.getStatus()); + item.put("warehouseName", matched.getWarehouseName()); + if (matched.getDataType() != null && matched.getDataType() == 0) { + item.put("matchStatus", 0); + item.put("matchStatusDesc", "已加工"); + } else { + item.put("matchStatus", 1); + item.put("matchStatusDesc", "未加工"); + } + } else { + item.put("enterCoilNo", null); + item.put("currentCoilNo", null); + item.put("supplierCoilNo", null); + item.put("dataType", null); + item.put("itemName", null); + item.put("itemCode", null); + item.put("specification", null); + item.put("material", null); + item.put("manufacturer", null); + item.put("coilStatus", null); + item.put("warehouseName", null); + item.put("matchStatus", 2); + item.put("matchStatusDesc", "未入库"); + } + } else { + item.put("enterCoilNo", null); + item.put("currentCoilNo", null); + item.put("supplierCoilNo", null); + item.put("dataType", null); + item.put("itemName", null); + item.put("itemCode", null); + item.put("specification", null); + item.put("material", null); + item.put("manufacturer", null); + item.put("coilStatus", null); + item.put("warehouseName", null); + item.put("matchStatus", 2); + item.put("matchStatusDesc", "未入库"); + } + result.add(item); + } + + return R.ok(result); + } +} 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 416eb7ce..bf39a5c6 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 @@ -154,6 +154,13 @@ public class SqlServerApiBusinessService { public List> getExitTrace() { return exitTrace; } } + /** + * 出口卷实绩列表(按时间段),来自 PLTCM_PDO_EXCOIL。 + */ + public List> getExcoilByTimeRange(String startTime, String endTime) { + return asRowList(client.queryExcoilByTimeRange(startTime, endTime)); + } + /** * 出口卷实绩列表(分页),来自 PLTCM_PDO_EXCOIL。 */ 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 52a2e5e3..b4b972b5 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 @@ -155,6 +155,17 @@ public class SqlServerApiController { return R.ok(businessService.getRollHistoryList(page, pageSize, rollId, standId)); } + /** + * 出口卷实绩列表(按时间段),来自 PLTCM_PDO_EXCOIL。 + * startTime / endTime 格式:yyyy-MM-dd HH:mm:ss + */ + @GetMapping("/excoil/by-time") + public R>> excoilByTime( + @RequestParam(required = false) String startTime, + @RequestParam(required = false) String endTime) { + return R.ok(businessService.getExcoilByTimeRange(startTime, endTime)); + } + /** * 出口卷实绩列表(分页),来自 PLTCM_PDO_EXCOIL。 */ diff --git a/klp-ui/src/api/wms/coilComparison.js b/klp-ui/src/api/wms/coilComparison.js new file mode 100644 index 00000000..716514d3 --- /dev/null +++ b/klp-ui/src/api/wms/coilComparison.js @@ -0,0 +1,9 @@ +import request from '@/utils/request' + +export function getExcoilStatus(query) { + return request({ + url: '/wms/coil-comparison/excoil-status', + method: 'get', + params: query + }) +} diff --git a/klp-ui/src/views/wms/coilComparison/index.vue b/klp-ui/src/views/wms/coilComparison/index.vue new file mode 100644 index 00000000..46b1c218 --- /dev/null +++ b/klp-ui/src/views/wms/coilComparison/index.vue @@ -0,0 +1,94 @@ + + +