feat(service): 添加按热卷号查询计划详情功能
- 在 SqlServerApiBusinessService 中实现按热卷号查询计划详情方法 - 新增调用查询扩展卷数据接口并整合到返回结果中 - 修改 PlanDetailView 构造函数以支持扩展卷数据列表 - 添加 excoilRows 属性和相应的 getter 方法 - 提供新的 fromExecuteSqlResponse 静态工厂方法处理双响应对象 - 在 SqlServerApiClient 中新增 queryExcoilByHotCoilId 查询接口
This commit is contained in:
@@ -361,6 +361,15 @@ public class SqlServerApiClient {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ExecuteSqlResponse queryExcoilByHotCoilId(String hotCoilId) {
|
||||||
|
return executeSql(
|
||||||
|
"oracle",
|
||||||
|
"select * from JXPLTCM.PLTCM_PDO_EXCOIL where HOT_COILID = :hotCoilId",
|
||||||
|
singletonParam("hotCoilId", hotCoilId)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public ExecuteSqlResponse queryPlanListByHotCoilIdLike(String hotCoilId, int page, int pageSize) {
|
public ExecuteSqlResponse queryPlanListByHotCoilIdLike(String hotCoilId, int page, int pageSize) {
|
||||||
int endRow = page * pageSize;
|
int endRow = page * pageSize;
|
||||||
int startRow = endRow - pageSize;
|
int startRow = endRow - pageSize;
|
||||||
|
|||||||
@@ -122,7 +122,10 @@ public class SqlServerApiBusinessService {
|
|||||||
* 计划详情:按热卷号查询。
|
* 计划详情:按热卷号查询。
|
||||||
*/
|
*/
|
||||||
public PlanDetailView getPlanByHotCoilId(String hotCoilId) {
|
public PlanDetailView getPlanByHotCoilId(String hotCoilId) {
|
||||||
return PlanDetailView.fromExecuteSqlResponse(hotCoilId, client.queryPlanByHotCoilId(hotCoilId));
|
SqlServerApiClient.ExecuteSqlResponse planResponse = client.queryPlanByHotCoilId(hotCoilId);
|
||||||
|
SqlServerApiClient.ExecuteSqlResponse excoilResponse = null;
|
||||||
|
excoilResponse = client.queryExcoilByHotCoilId(hotCoilId);
|
||||||
|
return PlanDetailView.fromExecuteSqlResponse(hotCoilId, planResponse, excoilResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -421,11 +424,13 @@ public class SqlServerApiBusinessService {
|
|||||||
private final String coilId;
|
private final String coilId;
|
||||||
private final List<Map<String, Object>> rows;
|
private final List<Map<String, Object>> rows;
|
||||||
private final Map<String, Object> firstRow;
|
private final Map<String, Object> firstRow;
|
||||||
|
private final List<Map<String, Object>> excoilRows;
|
||||||
|
|
||||||
public PlanDetailView(String coilId, List<Map<String, Object>> rows, Map<String, Object> firstRow) {
|
public PlanDetailView(String coilId, List<Map<String, Object>> rows, Map<String, Object> firstRow, List<Map<String, Object>> excoilRows) {
|
||||||
this.coilId = coilId;
|
this.coilId = coilId;
|
||||||
this.rows = rows;
|
this.rows = rows;
|
||||||
this.firstRow = firstRow;
|
this.firstRow = firstRow;
|
||||||
|
this.excoilRows = excoilRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCoilId() {
|
public String getCoilId() {
|
||||||
@@ -440,10 +445,21 @@ public class SqlServerApiBusinessService {
|
|||||||
return firstRow;
|
return firstRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Map<String, Object>> getExcoilRows() {
|
||||||
|
return excoilRows;
|
||||||
|
}
|
||||||
|
|
||||||
public static PlanDetailView fromExecuteSqlResponse(String coilId, SqlServerApiClient.ExecuteSqlResponse response) {
|
public static PlanDetailView fromExecuteSqlResponse(String coilId, SqlServerApiClient.ExecuteSqlResponse response) {
|
||||||
List<Map<String, Object>> rows = asRowList(response);
|
List<Map<String, Object>> rows = asRowList(response);
|
||||||
Map<String, Object> firstRow = rows.isEmpty() ? Collections.<String, Object>emptyMap() : rows.get(0);
|
Map<String, Object> firstRow = rows.isEmpty() ? Collections.<String, Object>emptyMap() : rows.get(0);
|
||||||
return new PlanDetailView(coilId, rows, firstRow);
|
return new PlanDetailView(coilId, rows, firstRow, Collections.<Map<String, Object>>emptyList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PlanDetailView fromExecuteSqlResponse(String coilId, SqlServerApiClient.ExecuteSqlResponse response, SqlServerApiClient.ExecuteSqlResponse excoilResponse) {
|
||||||
|
List<Map<String, Object>> rows = asRowList(response);
|
||||||
|
Map<String, Object> firstRow = rows.isEmpty() ? Collections.<String, Object>emptyMap() : rows.get(0);
|
||||||
|
List<Map<String, Object>> excoilRows = asRowList(excoilResponse);
|
||||||
|
return new PlanDetailView(coilId, rows, firstRow, excoilRows);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,15 @@ export default {
|
|||||||
this.matchLoading = true
|
this.matchLoading = true
|
||||||
getTimingPlanDetailByHotcoilId(hotCoilId).then(res => {
|
getTimingPlanDetailByHotcoilId(hotCoilId).then(res => {
|
||||||
const fr = res?.data?.firstRow
|
const fr = res?.data?.firstRow
|
||||||
this.bestMatch = (fr && Object.keys(fr).length > 0) ? fr : null
|
if (!fr || Object.keys(fr).length === 0) { this.bestMatch = null; return }
|
||||||
|
const excoilRows = res?.data?.excoilRows || []
|
||||||
|
const excoil = excoilRows.length > 0 ? excoilRows[0] : null
|
||||||
|
if (excoil) {
|
||||||
|
fr.exit_length = excoil.exit_length ?? excoil.EXIT_LENGTH ?? fr.exit_length
|
||||||
|
fr.start_time = excoil.start_date ?? excoil.START_DATE ?? null
|
||||||
|
fr.end_time = excoil.end_date ?? excoil.END_DATE ?? null
|
||||||
|
}
|
||||||
|
this.bestMatch = fr
|
||||||
}).catch(() => {}).finally(() => { this.matchLoading = false })
|
}).catch(() => {}).finally(() => { this.matchLoading = false })
|
||||||
},
|
},
|
||||||
loadRecentList() {
|
loadRecentList() {
|
||||||
|
|||||||
@@ -641,6 +641,9 @@ export default {
|
|||||||
if (data.exit_thick != null) this.$set(this.updateForm, 'actualThickness', parseFloat(data.exit_thick))
|
if (data.exit_thick != null) this.$set(this.updateForm, 'actualThickness', parseFloat(data.exit_thick))
|
||||||
if (data.exit_width != null) this.$set(this.updateForm, 'actualWidth', parseFloat(data.exit_width))
|
if (data.exit_width != null) this.$set(this.updateForm, 'actualWidth', parseFloat(data.exit_width))
|
||||||
|
|
||||||
|
if (data.start_date) this.$set(this.updateForm, 'productionStartTime', data.start_date)
|
||||||
|
if (data.end_date) this.$set(this.updateForm, 'productionEndTime', data.date)
|
||||||
|
|
||||||
const query = {
|
const query = {
|
||||||
specification: data.exit_thick ? `${data.exit_thick}*${data.exit_width}` : '',
|
specification: data.exit_thick ? `${data.exit_thick}*${data.exit_width}` : '',
|
||||||
material: data.grade,
|
material: data.grade,
|
||||||
|
|||||||
Reference in New Issue
Block a user