feat(wms): 新增钢卷对比功能实现数据同步状态监控
- 在 SqlServerApiBusinessService 中新增按时间段查询出口卷实绩方法 - 在 SqlServerApiClient 中实现 queryExcoilByTimeRange 数据查询接口 - 在 SqlServerApiController 中添加 /excoil/by-time 时间段查询端点 - 新增 CoilComparisonController 实现钢卷数据对比和匹配状态逻辑 - 创建前端 coilComparison API 接口文件并导出 getExcoilStatus 方法 - 开发钢卷对比页面界面,包含产线切换标签页和时间范围筛选功能 - 实现钢卷加工状态、入库状态和匹配状态的数据展示和标记功能
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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。
|
||||
*/
|
||||
|
||||
@@ -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。
|
||||
*/
|
||||
|
||||
9
klp-ui/src/api/wms/coilComparison.js
Normal file
9
klp-ui/src/api/wms/coilComparison.js
Normal file
@@ -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
|
||||
})
|
||||
}
|
||||
94
klp-ui/src/views/wms/coilComparison/index.vue
Normal file
94
klp-ui/src/views/wms/coilComparison/index.vue
Normal file
@@ -0,0 +1,94 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-tabs v-model="activeLine" type="card" @tab-click="handleQuery">
|
||||
<el-tab-pane label="酸连轧" name="acid" />
|
||||
<el-tab-pane label="双机架" name="dr" />
|
||||
<el-tab-pane label="镀锌" name="cgl" />
|
||||
<el-tab-pane label="镀铬" name="ecl" />
|
||||
<el-tab-pane label="脱脂" name="spl" />
|
||||
<el-tab-pane label="纵剪" name="sl" />
|
||||
</el-tabs>
|
||||
<div class="mb8" style="display:flex;align-items:center;gap:12px;padding:12px 0">
|
||||
<el-date-picker v-model="dateRange" type="daterange" range-separator="至"
|
||||
start-placeholder="开始日期" end-placeholder="结束日期"
|
||||
value-format="yyyy-MM-dd HH:mm:ss" :default-time="['00:00:00', '23:59:59']"
|
||||
style="width:360px" />
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button>
|
||||
<span style="color:#999;font-size:13px">查询二级实绩中的热卷是否已在三级更新</span>
|
||||
</div>
|
||||
<KLPTable v-loading="loading" :data="list" max-height="600">
|
||||
<el-table-column label="出口卷号" align="center" prop="excoilId" width="150" />
|
||||
<el-table-column label="热卷号" align="center" prop="hotCoilId" width="150" />
|
||||
<el-table-column label="下线时间" align="center" width="150">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.endDate) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工序" align="center" prop="processCode" width="80" />
|
||||
<el-table-column label="对比状态" align="center" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.matchStatus === 0" type="success">已加工</el-tag>
|
||||
<el-tag v-else-if="scope.row.matchStatus === 1" type="warning">未加工</el-tag>
|
||||
<el-tag v-else type="danger">未入库</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="入场钢卷号" align="center" prop="enterCoilNo" width="150" />
|
||||
<el-table-column label="当前钢卷号" align="center" prop="currentCoilNo" width="150" />
|
||||
<el-table-column label="供应商钢卷号" align="center" prop="supplierCoilNo" width="150" />
|
||||
<el-table-column label="物品名称" align="center" prop="itemName" width="120" />
|
||||
<el-table-column label="物品编码" align="center" prop="itemCode" width="120" />
|
||||
<el-table-column label="规格" align="center" prop="specification" width="110" />
|
||||
<el-table-column label="材质" align="center" prop="material" width="100" />
|
||||
<el-table-column label="生产厂家" align="center" prop="manufacturer" width="100" />
|
||||
<el-table-column label="库区" align="center" prop="warehouseName" width="130" />
|
||||
<el-table-column label="钢卷状态" align="center" prop="coilStatus" width="80">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.coilStatus === 0">在库</span>
|
||||
<span v-else-if="scope.row.coilStatus === 1">在途</span>
|
||||
<span v-else-if="scope.row.coilStatus === 2">已出库</span>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</KLPTable>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getExcoilStatus } from "@/api/wms/coilComparison";
|
||||
|
||||
export default {
|
||||
name: "CoilComparison",
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
activeLine: 'acid',
|
||||
dateRange: [],
|
||||
list: [],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
const end = new Date();
|
||||
const start = new Date();
|
||||
start.setDate(start.getDate() - 7);
|
||||
this.dateRange = [start, end];
|
||||
this.handleQuery();
|
||||
},
|
||||
methods: {
|
||||
handleQuery() {
|
||||
this.loading = true;
|
||||
const params = {};
|
||||
if (this.dateRange && this.dateRange.length === 2) {
|
||||
params.startTime = this.dateRange[0];
|
||||
params.endTime = this.dateRange[1];
|
||||
}
|
||||
params.lineType = this.activeLine;
|
||||
getExcoilStatus(params).then(res => {
|
||||
this.list = res.data || [];
|
||||
this.loading = false;
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user