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 57b16b49..7b990455 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 @@ -10,6 +10,7 @@ import org.springframework.web.client.RestTemplate; import org.springframework.web.util.UriComponentsBuilder; import java.net.URI; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; @@ -368,6 +369,79 @@ public class SqlServerApiClient { ); } + public ExecuteSqlResponse queryProSegByHotCoilId(String hotCoilId) { + // 先通过 HOT_COILID 从 PLTCM_PDI_PLAN 表查询到所有的 COILID + ExecuteSqlResponse planResponse = executeSql( + "oracle", + "select COILID from JXPLTCM.PLTCM_PDI_PLAN where HOT_COILID = :hotCoilId", + singletonParam("hotCoilId", hotCoilId) + ); + + List> rows = (List>) planResponse.getResult(); + if (rows == null || rows.isEmpty()) { + // 如果没有找到对应的计划记录,返回空结果 + return new ExecuteSqlResponse(); + } + + // 收集所有有效的 COILID + List coilIds = new ArrayList<>(); + for (Map row : rows) { + String coilId = (String) row.get("COILID"); + if (coilId != null && !coilId.trim().isEmpty()) { + coilIds.add(coilId); + } + } + + if (coilIds.isEmpty()) { + return new ExecuteSqlResponse(); + } + + // 用所有的 COILID 去查询 PLTCM_PRO_SEG 表的 ENCOILID + // 使用 IN 查询一次性获取所有数据 + Map params = new java.util.HashMap<>(); + StringBuilder sql = new StringBuilder("select * from JXPLTCM.PLTCM_PRO_SEG where ENCOILID IN ("); + for (int i = 0; i < coilIds.size(); i++) { + if (i > 0) { + sql.append(", "); + } + String paramName = "coilId" + i; + sql.append(":").append(paramName); + params.put(paramName, coilIds.get(i)); + } + sql.append(") order by ENCOILID, SEGNO"); + + return executeSql("oracle", sql.toString(), params); + } + + public ExecuteSqlResponse queryExcoilList(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 (select t.*, ROWNUM rn from (select * from JXPLTCM.PLTCM_PDO_EXCOIL order by END_DATE desc) t where ROWNUM <= :endRow) where rn > :startRow", + params + ); + } + + public ExecuteSqlResponse queryExcoilCount() { + return executeSql( + "oracle", + "select count(*) as total from JXPLTCM.PLTCM_PDO_EXCOIL", + emptyParams() + ); + } + + public ExecuteSqlResponse queryPresetSetupByCoilId(String coilId) { + return executeSql( + "oracle", + "select * from JXPLTCM.PLTCM_PRESET_SETUP where COILID = :coilId", + singletonParam("coilId", coilId) + ); + } + public ExecuteSqlResponse queryProSegByExcoilId(String excoilId) { return executeSql( "oracle", 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 ef66dff2..f5c9544d 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 @@ -89,6 +89,13 @@ public class SqlServerApiBusinessService { return SegSeriesView.fromExecuteSqlResponse(encoilId, client.queryProSegByEncoilId(encoilId)); } + /** + * 钢卷实际 SEG 查询:按入场卷号查询。 + */ + public SegSeriesView getSegByHotCoilId(String hotCoilId) { + return SegSeriesView.fromExecuteSqlResponse(hotCoilId, client.queryProSegByHotCoilId(hotCoilId)); + } + /** * 钢卷实际 SEG 查询:按出口卷号查询。 */ @@ -119,6 +126,32 @@ public class SqlServerApiBusinessService { return client.queryShapeByMatId(matId); } + /** + * 出口卷实绩列表(分页),来自 PLTCM_PDO_EXCOIL。 + */ + public ExcoilPageView getExcoilList(int page, int pageSize) { + return new ExcoilPageView(asRowList(client.queryExcoilList(page, pageSize))); + } + + /** + * 出口卷实绩总数。 + */ + public long getExcoilCount() { + List> rows = asRowList(client.queryExcoilCount()); + if (rows.isEmpty()) return 0L; + Number n = asNumber(rows.get(0).get("total")); + return n == null ? 0L : n.longValue(); + } + + /** + * 工艺预设参数,按钢卷号查询(PLTCM_PRESET_SETUP)。 + */ + public PresetSetupView getPresetSetupByCoilId(String coilId) { + List> rows = asRowList(client.queryPresetSetupByCoilId(coilId)); + Map firstRow = rows.isEmpty() ? Collections.emptyMap() : rows.get(0); + return new PresetSetupView(coilId, firstRow); + } + /** * 实时数据总入口:一次性返回厚度与板形两类数据。 */ @@ -354,6 +387,36 @@ public class SqlServerApiBusinessService { } } + public static class ExcoilPageView { + private final List> rows; + + public ExcoilPageView(List> rows) { + this.rows = rows; + } + + public List> getRows() { + return rows; + } + } + + public static class PresetSetupView { + private final String coilId; + private final Map data; + + public PresetSetupView(String coilId, Map data) { + this.coilId = coilId; + this.data = data; + } + + public String getCoilId() { + return coilId; + } + + public Map getData() { + return data; + } + } + public static class RollListView { private final List> rows; 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 14454bbd..fd7e144c 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 @@ -54,6 +54,14 @@ public class SqlServerApiController { return R.ok(businessService.getPlanByCoilId(coilId)); } + /** + * 计划详情:按热卷号查询。 + */ + @GetMapping("/plans-by-hotcoil/{hotCoilId}") + public R planDetailByHotCoilId(@PathVariable String hotCoilId) { + return R.ok(businessService.getPlanByHotCoilId(hotCoilId)); + } + /** * 钢卷实际 SEG,按入口卷号查询。 */ @@ -62,6 +70,14 @@ public class SqlServerApiController { return R.ok(businessService.getSegSeriesViewByEncoilId(encoilId)); } + /** + * 钢卷实际 SEG,按入场卷号查询。 + */ + @GetMapping("/seg-by-hotcoil/{hotCoilId}") + public R segByHotCoilId(@PathVariable String hotCoilId) { + return R.ok(businessService.getSegByHotCoilId(hotCoilId)); + } + /** * 钢卷实际 SEG,按出口卷号查询。 */ @@ -139,6 +155,34 @@ public class SqlServerApiController { return R.ok(businessService.getRollHistoryList(page, pageSize, rollId, standId)); } + /** + * 出口卷实绩列表(分页),来自 PLTCM_PDO_EXCOIL。 + */ + @GetMapping("/excoil") + public R excoilList( + @RequestParam(defaultValue = "1") int page, + @RequestParam(defaultValue = "50") int pageSize) { + return R.ok(businessService.getExcoilList(page, pageSize)); + } + + /** + * 出口卷实绩总数。 + */ + @GetMapping("/excoil/count") + public R> excoilCount() { + Map result = new HashMap<>(); + result.put("total", businessService.getExcoilCount()); + return R.ok(result); + } + + /** + * 工艺预设参数,按计划钢卷号查询(PLTCM_PRESET_SETUP)。 + */ + @GetMapping("/preset-setup/{coilId}") + public R presetSetup(@PathVariable String coilId) { + return R.ok(businessService.getPresetSetupByCoilId(coilId)); + } + /** * 换辊历史总条数。 */ diff --git a/klp-ui/package.json b/klp-ui/package.json index f6a6a48c..2a2d5e7b 100644 --- a/klp-ui/package.json +++ b/klp-ui/package.json @@ -50,6 +50,7 @@ "dayjs": "^1.11.18", "dom-to-image": "^2.6.0", "echarts": "5.4.0", + "echarts-gl": "^2.0.9", "element-ui": "2.15.12", "exceljs": "^4.4.0", "file-saver": "2.0.5", diff --git a/klp-ui/src/api/l2/timing.js b/klp-ui/src/api/l2/timing.js index af5cbdeb..43ebc625 100644 --- a/klp-ui/src/api/l2/timing.js +++ b/klp-ui/src/api/l2/timing.js @@ -33,6 +33,22 @@ export function getTimingSegByEncoilId(encoilId) { }) } +export function getTimingSegByHotcoilId(encoilId) { + return request({ + url: '/sql-server-api/seg-by-hotcoil/' + encoilId, + method: 'get' + }) +} + +// 根据热卷好查询计划详情 +export function getTimingPlanDetailByHotcoilId(hotcoilId) { + return request({ + url: '/sql-server-api/plans-by-hotcoil/' + hotcoilId, + method: 'get' + }) +} + + // 钢卷实际 SEG,按出口卷号查询 export function getTimingSegByExcoilId(excoilId) { return request({ @@ -101,3 +117,28 @@ export function getRollHistoryCount(rollId, standId) { params: { rollId, standId } }) } + +// 出口卷实绩列表(分页),PLTCM_PDO_EXCOIL +export function getExcoilList(page = 1, pageSize = 50) { + return request({ + url: '/sql-server-api/excoil', + method: 'get', + params: { page, pageSize } + }) +} + +// 出口卷实绩总数 +export function getExcoilCount() { + return request({ + url: '/sql-server-api/excoil/count', + method: 'get' + }) +} + +// 工艺预设参数,按计划钢卷号查询,PLTCM_PRESET_SETUP +export function getPresetSetupByCoilId(coilId) { + return request({ + url: '/sql-server-api/preset-setup/' + coilId, + method: 'get' + }) +} diff --git a/klp-ui/src/assets/styles/element-ui.scss b/klp-ui/src/assets/styles/element-ui.scss index 9a16eafb..8e0d00d7 100644 --- a/klp-ui/src/assets/styles/element-ui.scss +++ b/klp-ui/src/assets/styles/element-ui.scss @@ -947,7 +947,8 @@ body { .el-dialog.is-fullscreen { .el-dialog__body { padding: $--spacing-lg; - max-height: calc(100vh - 100px); + height: calc(100vh - 100px); + max-height: 100vh; overflow-y: auto; } } diff --git a/klp-ui/src/components/CoilSelector/data.js b/klp-ui/src/components/CoilSelector/data.js index 3bcbc004..1234331d 100644 --- a/klp-ui/src/components/CoilSelector/data.js +++ b/klp-ui/src/components/CoilSelector/data.js @@ -1,5 +1,4 @@ -export const defaultColumns = [ - { +export const defaultColumns = [{ label: '入场卷号', align: 'center', prop: 'enterCoilNo', @@ -30,6 +29,12 @@ export const defaultColumns = [ prop: 'specification', width: '100' }, + { + label: '重量(t)', + align: 'center', + prop: 'netWeight', + width: '100' + }, { label: '材质', align: 'center', @@ -42,12 +47,6 @@ export const defaultColumns = [ prop: 'manufacturer', width: '100' }, - { - label: '重量(t)', - align: 'center', - prop: 'netWeight', - width: '100' - }, { label: '库区', align: 'center', @@ -62,10 +61,10 @@ export const defaultColumns = [ width: '100', showOverflowTooltip: true }, - { - label: '备注', - align: 'center', - prop: 'remark', - showOverflowTooltip: true - } -] \ No newline at end of file + // { + // label: '备注', + // align: 'center', + // prop: 'remark', + // showOverflowTooltip: true + // } +] diff --git a/klp-ui/src/components/CoilSelector/index.vue b/klp-ui/src/components/CoilSelector/index.vue index c072d6b6..26701f9c 100644 --- a/klp-ui/src/components/CoilSelector/index.vue +++ b/klp-ui/src/components/CoilSelector/index.vue @@ -19,179 +19,190 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - 搜索 - 重置 - 显示钢卷地图 - 显示订单详情 - - + + 搜索 + 重置 + 全选当前卷 + 显示钢卷地图 + 显示订单详情 + + -
- - - + + +
+ + +
+ + + + + + + + + + + + + +
+ + 总净重:{{ coilTrimStatistics.total_net_weight || 0 }}t + + + +
+ @@ -287,6 +288,75 @@
+ + + +
+ +
+
选择合同
+ + + + + + + + + + + + 搜索 + 重置 + + + + + + + + + + + + + +
+ +
+
+ + +
+
选择明细(多选)
+ + + + + + + + + + + + + + + +
+
+ +
@@ -351,7 +421,31 @@ export default { // 订单明细加载状态 orderItemLoading: false, // 当前编辑的行 - currentEditingRow: null + currentEditingRow: null, + // 批量新增对话框 + batchAddDialogVisible: false, + // 批量查询参数 + batchQueryParams: { + pageNum: 1, + pageSize: 10, + contractCode: undefined, + customerName: undefined, + salesman: undefined + }, + // 批量订单列表 + batchOrderList: [], + // 批量订单总数 + batchOrderTotal: 0, + // 批量订单加载状态 + batchOrderLoading: false, + // 批量明细列表 + batchItemList: [], + // 批量明细加载状态 + batchItemLoading: false, + // 选中的合同 + selectedContract: null, + // 选中的明细 + selectedBatchItems: [] }; }, created() { @@ -582,6 +676,98 @@ export default { // 处理订单行点击 handleOrderSelect(row) { this.selectOrder(row); + }, + // 打开批量新增对话框 + handleBatchAdd() { + this.batchAddDialogVisible = true; + this.selectedContract = null; + this.selectedBatchItems = []; + this.getBatchOrderList(); + }, + // 获取批量订单列表 + getBatchOrderList() { + this.batchOrderLoading = true; + listOrder(this.batchQueryParams).then(response => { + this.batchOrderList = response.rows; + this.batchOrderTotal = response.total; + this.batchOrderLoading = false; + }); + }, + // 重置批量查询参数 + resetBatchQuery() { + this.batchQueryParams = { + pageNum: 1, + pageSize: 10, + contractCode: undefined, + customerName: undefined, + salesman: undefined + }; + this.getBatchOrderList(); + }, + // 选择批量合同 + selectBatchContract(row) { + this.selectedContract = row; + this.selectedBatchItems = []; + this.batchItemLoading = true; + listOrderItem({ orderId: row.orderId }).then(res => { + this.batchItemList = res.rows; + this.batchItemLoading = false; + }); + }, + // 处理批量明细选择变更 + handleBatchItemSelectionChange(selection) { + this.selectedBatchItems = selection; + }, + // 确认批量新增 + confirmBatchAdd() { + if (this.selectedBatchItems.length === 0) { + this.$message.warning('请至少选择一条明细'); + return; + } + + this.$confirm(`确认新增 ${this.selectedBatchItems.length} 条明细?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + const currentMaxSeqNo = this.planDetailList.length > 0 + ? Math.max(...this.planDetailList.map(item => parseInt(item.bizSeqNo) || 0)) + : 0; + + const addPromises = this.selectedBatchItems.map((item, index) => { + const newRow = { + planSheetId: this.currentPlanSheetId, + bizSeqNo: currentMaxSeqNo + index + 1, + orderCode: this.selectedContract.orderCode, + contractCode: this.selectedContract.contractCode, + customerName: this.selectedContract.companyName, + salesman: this.selectedContract.salesman, + orderId: this.selectedContract.orderId, + productName: item.productType, + productMaterial: item.material, + productWidth: item.width, + rollingThick: item.thickness, + markCoatThick: item.thickness, + tonSteelLengthRange: 0, + planQty: item.productNum, + planWeight: item.weight, + surfaceTreatment: item.surfaceTreatment, + productPackaging: item.packagingReq, + widthReq: item.edgeCuttingReq, + productEdgeReq: item.widthTolerance, + usageReq: item.purpose + }; + return addPlanDetail(newRow); + }); + + Promise.all(addPromises).then(() => { + this.$message.success('批量新增成功'); + this.batchAddDialogVisible = false; + this.getList(); + }).catch(error => { + this.$message.error('批量新增失败'); + }); + }); } } }; @@ -654,4 +840,25 @@ export default { /* ::v-deep .el-input__inner { padding: 0 1px; } */ + +.batch-add-content { + padding: 10px 0; +} + +.contract-section { + margin-bottom: 30px; + padding-bottom: 20px; + border-bottom: 1px solid #eee; +} + +.item-section { + margin-top: 20px; +} + +.section-title { + font-size: 14px; + font-weight: 600; + margin-bottom: 15px; + color: #303133; +} diff --git a/klp-ui/src/views/crm/components/OrderObjection.vue b/klp-ui/src/views/crm/components/OrderObjection.vue index 88d53e40..869153a8 100644 --- a/klp-ui/src/views/crm/components/OrderObjection.vue +++ b/klp-ui/src/views/crm/components/OrderObjection.vue @@ -42,6 +42,16 @@ 已关闭 + + + - @@ -113,28 +112,28 @@ placeholder="请输入客户诉求" > - @@ -150,17 +149,6 @@ -