完成wip-退火模块

This commit is contained in:
2026-03-15 15:10:17 +08:00
parent 9a645100df
commit 5487f04cf5
5 changed files with 137 additions and 62 deletions

View File

@@ -20,7 +20,7 @@ CREATE TABLE IF NOT EXISTS wms_furnace_plan (
actual_start_time DATETIME NULL COMMENT '实际开始时间',
end_time DATETIME NULL COMMENT '结束时间',
target_furnace_id BIGINT NOT NULL COMMENT '目标炉子ID',
status TINYINT DEFAULT 0 COMMENT '计划状态(0草稿 1已下发 2执行中 3已完成 4已取消)',
status TINYINT DEFAULT 0 COMMENT '计划状态(0未开始 1进行中 2已完成)',
remark VARCHAR(500) NULL COMMENT '备注',
del_flag TINYINT DEFAULT 0 COMMENT '删除标记(0正常 1删除)',
create_by VARCHAR(64) NULL,

View File

@@ -75,7 +75,7 @@
<el-table-column label="钢卷数" prop="coilCount" align="center" />
<el-table-column label="操作" align="center" width="160">
<template slot-scope="scope">
<el-button v-if="scope.row.status === 0" size="mini" type="primary" @click="handleInFurnace(scope.row)">入炉</el-button>
<el-button v-if="scope.row.status === 0" size="mini" type="primary" :disabled="!scope.row.coilCount" @click="handleInFurnace(scope.row)">入炉</el-button>
<el-button v-if="scope.row.status === 2" size="mini" type="success" @click="openCompleteDialog(scope.row)">完成</el-button>
</template>
</el-table-column>
@@ -86,11 +86,9 @@
<div class="complete-tip">请为每条钢卷分配实际库位未分配将无法完成</div>
<el-table :data="completeCoils" v-loading="completeLoading" height="360px">
<el-table-column label="入场钢卷号" prop="enterCoilNo" align="center" />
<el-table-column label="实际库位" align="center" width="240">
<el-table-column label="实际库位" align="center" width="260">
<template slot-scope="scope">
<el-select v-model="scope.row.actualWarehouseId" placeholder="请选择" filterable>
<el-option v-for="item in actualWarehouseOptions" :key="item.actualWarehouseId" :label="item.name" :value="item.actualWarehouseId" />
</el-select>
<ActualWarehouseSelect v-model="scope.row.actualWarehouseId" :clearInput="false" :showEmpty="false" :width="240" />
</template>
</el-table-column>
</el-table>
@@ -105,10 +103,13 @@
<script>
import { getAnnealOverview } from "@/api/wms/annealOverview";
import { inFurnace, completeAnnealPlan, listAnnealPlanCoils } from "@/api/wms/annealPlan";
import { listActualWarehouse } from "@/api/wms/actualWarehouse";
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
export default {
name: "AnnealOverview",
components: {
ActualWarehouseSelect
},
data() {
return {
loading: true,
@@ -127,7 +128,6 @@ export default {
created() {
this.fetchOverview();
this.startTimer();
this.loadActualWarehouses();
},
beforeDestroy() {
this.stopTimer();
@@ -152,11 +152,6 @@ export default {
this.timer = null;
}
},
loadActualWarehouses() {
listActualWarehouse({ pageNum: 1, pageSize: 999, actualWarehouseType: 2, isEnabled: 1 }).then(response => {
this.actualWarehouseOptions = response.rows || [];
});
},
openCompleteDialog(row) {
this.completePlanId = row.planId;
this.completeOpen = true;
@@ -197,14 +192,14 @@ export default {
if (!this.overview.planQueue) {
return 0;
}
return this.overview.planQueue.filter(item => item.targetFurnaceId === furnaceId && item.status !== 2).length;
return this.overview.planQueue.filter(item => item.targetFurnaceId === furnaceId && item.status === 0).length;
},
statusLabel(status) {
const map = { 0: '草稿', 1: '已下发', 2: '行中', 3: '已完成', 4: '已取消' };
return map[status] || '-';
const map = { 0: '未开始', 2: '行中', 3: '已完成' };
return map[status] || '未开始';
},
statusTag(status) {
const map = { 0: 'info', 1: 'warning', 2: 'success', 3: 'success', 4: 'danger' };
const map = { 0: 'info', 2: 'success', 3: 'success' };
return map[status] || 'info';
},
formatCountdown(endTime) {
@@ -225,13 +220,14 @@ export default {
this.$message.warning(`炉子正忙:计划${furnace.currentPlanNo || ''},钢卷${furnace.coilCount || 0}`);
return;
}
this.$confirm('确定入炉该计划吗?', '提示', {
this.$confirm('点击入炉后钢卷将会被释放库位,是否确认入炉', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
return inFurnace({ planId: row.planId });
}).then(() => {
row.status = 2;
this.$message.success('入炉成功');
this.fetchOverview();
});

View File

@@ -64,7 +64,7 @@
<el-button size="mini" type="text" icon="el-icon-edit" @click.stop="handleUpdate(scope.row)">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click.stop="handleDelete(scope.row)">删除</el-button>
<el-button size="mini" type="text" icon="el-icon-s-operation" @click.stop="openStatusDialog(scope.row)">状态</el-button>
<el-button v-if="scope.row.status === 0" size="mini" type="text" icon="el-icon-s-flag" @click.stop="handleInFurnace(scope.row)">入炉</el-button>
<el-button v-if="scope.row.status === 0" size="mini" type="text" icon="el-icon-s-flag" :disabled="!scope.row.coilCount" @click.stop="handleInFurnace(scope.row)">入炉</el-button>
<el-button v-if="scope.row.status === 2" size="mini" type="text" icon="el-icon-check" @click.stop="handleComplete(scope.row)">完成</el-button>
</template>
</el-table-column>
@@ -101,7 +101,7 @@
<div class="material-title">{{ item.currentCoilNo || '-' }}</div>
<div class="material-sub">入场{{ item.enterCoilNo || '-' }}</div>
</div>
<el-button type="primary" size="mini" @click="handleAddToPlan(item)" :disabled="!currentPlan.planId || currentPlan.status === 2">加入计划</el-button>
<el-button type="primary" size="mini" @click="handleAddToPlan(item)" :disabled="!currentPlan.planId || currentPlan.status !== 0">加入计划</el-button>
</div>
<div class="material-body">
<div class="material-row">厂家{{ item.supplierCoilNo || '-' }}</div>
@@ -120,6 +120,7 @@
<span>退火计划</span>
<div>
<el-button size="mini" icon="el-icon-refresh" @click="loadPlanCoils" :disabled="!currentPlan.planId">刷新</el-button>
<el-button size="mini" type="primary" icon="el-icon-s-flag" :disabled="!currentPlan.planId || currentPlan.status !== 0 || !currentPlan.coilCount" @click="handleInFurnace(currentPlan)">入炉</el-button>
<el-button size="mini" type="success" icon="el-icon-check" :disabled="!currentPlan.planId || currentPlan.status !== 2" @click="openCompleteDialog">完成退火</el-button>
</div>
</div>
@@ -131,6 +132,9 @@
<div>计划号{{ currentPlan.planNo }}</div>
<div>目标炉{{ currentPlan.targetFurnaceName || '-' }}</div>
<div>状态{{ statusLabel(currentPlan.status) }}</div>
<div>
<el-button size="mini" type="primary" icon="el-icon-s-flag" :disabled="currentPlan.status !== 0" @click="handleInFurnace(currentPlan)">入炉</el-button>
</div>
</div>
<el-table :data="coilList" v-loading="coilLoading" class="light-table">
<el-table-column label="入场钢卷号" align="center" prop="enterCoilNo" />
@@ -139,16 +143,16 @@
{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}') }}
</template>
</el-table-column>
<el-table-column label="实际库位" align="center" width="180">
<el-table-column label="实际库位" align="center" width="220">
<template slot-scope="scope">
<el-select v-model="scope.row.actualWarehouseId" placeholder="选择库位" clearable size="mini" filterable>
<el-option v-for="item in actualWarehouseOptions" :key="item.actualWarehouseId" :label="item.actualWarehouseName" :value="item.actualWarehouseId" />
</el-select>
<span>{{ scope.row.actualWarehouseName || '-' }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleUnbind(scope.row)" :disabled="currentPlan.status === 2">解绑</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleUnbind(scope.row)">
{{ unbindLabel(currentPlan.status) }}
</el-button>
</template>
</el-table-column>
</el-table>
@@ -157,6 +161,22 @@
</el-col>
</el-row>
<el-dialog title="完成退火" :visible.sync="completeOpen" width="720px" append-to-body>
<div class="complete-tip">请为每条钢卷分配实际库位未分配将无法完成</div>
<el-table :data="completeCoils" v-loading="completeLoading" height="360px">
<el-table-column label="入场钢卷号" prop="enterCoilNo" align="center" />
<el-table-column label="实际库位" align="center" width="240">
<template slot-scope="scope">
<ActualWarehouseSelect v-model="scope.row.actualWarehouseId" :clear-input="false" :show-empty="false" />
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitComplete"> </el-button>
<el-button @click="completeOpen = false"> </el-button>
</div>
</el-dialog>
<el-dialog :title="title" :visible.sync="open" width="520px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="110px">
<el-form-item label="计划号" prop="planNo">
@@ -172,11 +192,9 @@
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="form.status" placeholder="请选择">
<el-option label="草稿" :value="0" />
<el-option label="已下发" :value="1" />
<el-option label="执行中" :value="2" />
<el-option label="未开始" :value="0" />
<el-option label="进行中" :value="2" />
<el-option label="已完成" :value="3" />
<el-option label="已取消" :value="4" />
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark">
@@ -211,10 +229,13 @@
import { listAnnealPlan, getAnnealPlan, addAnnealPlan, updateAnnealPlan, delAnnealPlan, changeAnnealPlanStatus, inFurnace, completeAnnealPlan, listAnnealPlanCoils, bindAnnealPlanCoils, unbindAnnealPlanCoil } from "@/api/wms/annealPlan";
import { listAnnealFurnace } from "@/api/wms/annealFurnace";
import { listMaterialCoil } from "@/api/wms/coil";
import { listActualWarehouse } from "@/api/wms/actualWarehouse";
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
export default {
name: "AnnealPlan",
components: {
ActualWarehouseSelect
},
data() {
return {
buttonLoading: false,
@@ -249,17 +270,20 @@ export default {
materialList: [],
materialQueryParams: {
pageNum: 1,
pageSize: 10,
pageSize: 20,
enterCoilNo: undefined,
currentCoilNo: undefined,
status: 0,
dataType: 1,
},
actualWarehouseOptions: [],
statusForm: {
planId: undefined,
status: undefined,
},
completeOpen: false,
completeLoading: false,
completePlanId: null,
completeCoils: [],
};
},
created() {
@@ -303,11 +327,6 @@ export default {
this.resetMaterialForm();
this.handleMaterialQuery();
},
loadActualWarehouses() {
listActualWarehouse({ pageNum: 1, pageSize: 999, actualWarehouseType: 2, isEnabled: 1 }).then(response => {
this.actualWarehouseOptions = response.rows || [];
});
},
openCompleteDialog() {
if (!this.currentPlan.planId) {
this.$message.warning('请先选择计划');
@@ -317,12 +336,18 @@ export default {
this.$message.warning('计划未进行中,无法完成');
return;
}
this.$confirm('完成计划前请为每条钢卷选择实际库位,确认继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.handleComplete(this.currentPlan);
this.completePlanId = this.currentPlan.planId;
this.completeOpen = true;
this.completeLoading = true;
listAnnealPlanCoils(this.currentPlan.planId).then(response => {
this.completeCoils = (response.data || []).map(item => ({
coilId: item.coilId,
enterCoilNo: item.enterCoilNo,
actualWarehouseId: item.actualWarehouseId || null
}));
this.completeLoading = false;
}).catch(() => {
this.completeLoading = false;
});
},
handleAddToPlan(item) {
@@ -462,7 +487,7 @@ export default {
});
},
async handleInFurnace(row) {
await this.$confirm('确定执行入炉操作吗?', '提示', {
await this.$confirm('点击入炉后钢卷将会被释放库位,是否确认入炉', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
@@ -470,14 +495,18 @@ export default {
this.loading = true;
await inFurnace({ planId: row.planId });
this.loading = false;
this.getList();
row.status = 2;
row.actualStartTime = new Date();
if (this.currentPlan.planId === row.planId) {
this.currentPlan.status = 2;
this.currentPlan.actualStartTime = row.actualStartTime;
this.loadPlanCoils();
}
this.getList();
this.$message.success('已入炉');
},
async handleComplete(row) {
const locations = (this.coilList || []).map(item => ({
submitComplete() {
const locations = (this.completeCoils || []).map(item => ({
coilId: item.coilId,
actualWarehouseId: item.actualWarehouseId
}));
@@ -486,15 +515,18 @@ export default {
this.$message.warning('请先为所有钢卷分配实际库位');
return;
}
this.loading = true;
await completeAnnealPlan({
planId: row.planId,
this.completeLoading = true;
completeAnnealPlan({
planId: this.completePlanId,
locations: locations
}).then(() => {
this.$message.success('已完成');
this.completeOpen = false;
this.getList();
this.loadPlanCoils();
}).finally(() => {
this.completeLoading = false;
});
this.loading = false;
this.getList();
this.loadPlanCoils();
this.$message.success('已完成');
},
handleUnbind(row) {
this.$confirm('确定解绑该钢卷吗?', '提示', {
@@ -528,6 +560,15 @@ export default {
return 'info';
}
return 'warning';
},
unbindLabel(status) {
if (status === 2) {
return '取消';
}
if (status === 3) {
return '撤回';
}
return '解绑';
}
}
};
@@ -551,10 +592,25 @@ export default {
}
.material-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
grid-template-columns: repeat(4, minmax(220px, 1fr));
gap: 12px;
min-height: 120px;
}
@media (max-width: 1400px) {
.material-grid {
grid-template-columns: repeat(3, minmax(220px, 1fr));
}
}
@media (max-width: 1100px) {
.material-grid {
grid-template-columns: repeat(2, minmax(220px, 1fr));
}
}
@media (max-width: 768px) {
.material-grid {
grid-template-columns: 1fr;
}
}
.material-card {
border: 1px solid #e9ecf2;
border-radius: 8px;

View File

@@ -28,6 +28,12 @@ public class WmsFurnacePlanCoilVo {
@ExcelProperty(value = "入场钢卷号")
private String enterCoilNo;
@ExcelProperty(value = "实际库位ID")
private Long actualWarehouseId;
@ExcelProperty(value = "实际库位")
private String actualWarehouseName;
@ExcelProperty(value = "创建时间")
private Date createTime;
}

View File

@@ -192,9 +192,27 @@ public class WmsFurnacePlanServiceImpl implements IWmsFurnacePlanService {
if (coilIds.isEmpty()) {
return list;
}
java.util.Map<Long, String> enterNoMap = materialCoilMapper.selectBatchIds(coilIds).stream()
.collect(Collectors.toMap(WmsMaterialCoil::getCoilId, WmsMaterialCoil::getEnterCoilNo, (a, b) -> a));
list.forEach(item -> item.setEnterCoilNo(enterNoMap.get(item.getCoilId())));
List<WmsMaterialCoil> materialCoils = materialCoilMapper.selectBatchIds(coilIds);
java.util.Map<Long, WmsMaterialCoil> coilMap = materialCoils.stream()
.collect(Collectors.toMap(WmsMaterialCoil::getCoilId, item -> item, (a, b) -> a));
List<Long> actualWarehouseIds = materialCoils.stream()
.map(WmsMaterialCoil::getActualWarehouseId)
.filter(id -> id != null)
.distinct()
.collect(Collectors.toList());
java.util.Map<Long, String> warehouseMap = actualWarehouseIds.isEmpty()
? java.util.Collections.emptyMap()
: actualWarehouseMapper.selectBatchIds(actualWarehouseIds).stream()
.collect(Collectors.toMap(WmsActualWarehouse::getActualWarehouseId,
WmsActualWarehouse::getActualWarehouseName, (a, b) -> a));
list.forEach(item -> {
WmsMaterialCoil coil = coilMap.get(item.getCoilId());
if (coil != null) {
item.setEnterCoilNo(coil.getEnterCoilNo());
item.setActualWarehouseId(coil.getActualWarehouseId());
item.setActualWarehouseName(warehouseMap.get(coil.getActualWarehouseId()));
}
});
return list;
}
@@ -321,10 +339,9 @@ public class WmsFurnacePlanServiceImpl implements IWmsFurnacePlanService {
warehouse.setIsEnabled(1);
actualWarehouseMapper.updateById(warehouse);
}
WmsMaterialCoil updateCoil = new WmsMaterialCoil();
updateCoil.setCoilId(coilId);
updateCoil.setActualWarehouseId(null);
materialCoilMapper.updateById(updateCoil);
materialCoilMapper.update(null, Wrappers.<WmsMaterialCoil>lambdaUpdate()
.eq(WmsMaterialCoil::getCoilId, coilId)
.set(WmsMaterialCoil::getActualWarehouseId, null));
}
private void occupyActualWarehouse(Long coilId, Long actualWarehouseId) {