feat(wms): 新增钢卷对比功能实现数据同步状态监控

- 在 SqlServerApiBusinessService 中新增按时间段查询出口卷实绩方法
- 在 SqlServerApiClient 中实现 queryExcoilByTimeRange 数据查询接口
- 在 SqlServerApiController 中添加 /excoil/by-time 时间段查询端点
- 新增 CoilComparisonController 实现钢卷数据对比和匹配状态逻辑
- 创建前端 coilComparison API 接口文件并导出 getExcoilStatus 方法
- 开发钢卷对比页面界面,包含产线切换标签页和时间范围筛选功能
- 实现钢卷加工状态、入库状态和匹配状态的数据展示和标记功能
This commit is contained in:
2026-05-21 14:29:14 +08:00
parent 2fc8cf02d1
commit d982efc866
6 changed files with 256 additions and 0 deletions

View File

@@ -413,6 +413,21 @@ public class SqlServerApiClient {
return executeSql("oracle", sql.toString(), params);
}
public ExecuteSqlResponse queryExcoilByTimeRange(String startTime, String endTime) {
Map<String, Object> 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;

View File

@@ -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<List<Map<String, Object>>> getExcoilStatus(
@RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime,
@RequestParam(required = false) String lineType) {
List<Map<String, Object>> excoilRows = sqlServerService.getExcoilByTimeRange(startTime, endTime);
WmsMaterialCoilBo bo = new WmsMaterialCoilBo();
bo.setItemType("raw_material");
bo.setMaterialType("原料");
bo.setItemName("热轧卷板");
bo.setSelectType("raw_material");
List<WmsMaterialCoilVo> localCoils = wmsMaterialCoilService.queryList(bo);
Map<String, WmsMaterialCoilVo> localMap = new HashMap<>();
for (WmsMaterialCoilVo coil : localCoils) {
if (coil.getEnterCoilNo() != null) {
localMap.put(coil.getEnterCoilNo(), coil);
}
}
List<Map<String, Object>> result = new ArrayList<>();
for (Map<String, Object> excoil : excoilRows) {
String hotCoilId = excoil.get("HOT_COILID") != null ? String.valueOf(excoil.get("HOT_COILID")) : null;
Map<String, Object> 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);
}
}

View File

@@ -154,6 +154,13 @@ public class SqlServerApiBusinessService {
public List<Map<String, Object>> getExitTrace() { return exitTrace; }
}
/**
* 出口卷实绩列表(按时间段),来自 PLTCM_PDO_EXCOIL。
*/
public List<Map<String, Object>> getExcoilByTimeRange(String startTime, String endTime) {
return asRowList(client.queryExcoilByTimeRange(startTime, endTime));
}
/**
* 出口卷实绩列表(分页),来自 PLTCM_PDO_EXCOIL。
*/

View File

@@ -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<List<Map<String, Object>>> excoilByTime(
@RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime) {
return R.ok(businessService.getExcoilByTimeRange(startTime, endTime));
}
/**
* 出口卷实绩列表(分页),来自 PLTCM_PDO_EXCOIL。
*/