diff --git a/klp-admin/src/main/resources/db/migration/V16__qc_quality_review_warehouse.sql b/klp-admin/src/main/resources/db/migration/V16__qc_quality_review_warehouse.sql new file mode 100644 index 000000000..d4c00eafc --- /dev/null +++ b/klp-admin/src/main/resources/db/migration/V16__qc_quality_review_warehouse.sql @@ -0,0 +1,10 @@ +-- ------------------------------------------------------------ +-- 质量评审 — 钢卷明细增加逻辑库区字段 +-- V16__qc_quality_review_warehouse.sql +-- ------------------------------------------------------------ + +ALTER TABLE `qc_quality_review_coil` + ADD COLUMN `before_warehouse_id` bigint DEFAULT NULL COMMENT '改判前逻辑库区ID' AFTER `before_quality`, + ADD COLUMN `before_warehouse_name` varchar(100) DEFAULT NULL COMMENT '改判前逻辑库区名称' AFTER `before_warehouse_id`, + ADD COLUMN `target_warehouse_id` bigint DEFAULT NULL COMMENT '改判后目标库区ID' AFTER `regrade_quality`, + ADD COLUMN `target_warehouse_name` varchar(100) DEFAULT NULL COMMENT '改判后目标库区名称' AFTER `target_warehouse_id`; diff --git a/klp-mes/src/main/java/com/klp/mes/qc/domain/QcQualityReviewCoil.java b/klp-mes/src/main/java/com/klp/mes/qc/domain/QcQualityReviewCoil.java index cf8f3a68c..6cfdc4422 100644 --- a/klp-mes/src/main/java/com/klp/mes/qc/domain/QcQualityReviewCoil.java +++ b/klp-mes/src/main/java/com/klp/mes/qc/domain/QcQualityReviewCoil.java @@ -55,9 +55,21 @@ public class QcQualityReviewCoil extends BaseEntity { /** 改判前质量等级 */ private String beforeQuality; + /** 改判前逻辑库区ID */ + private Long beforeWarehouseId; + + /** 改判前逻辑库区名称 */ + private String beforeWarehouseName; + /** 改判后质量状态(字典:regrade_quality_type) */ private String regradeQuality; + /** 改判后目标库区ID */ + private Long targetWarehouseId; + + /** 改判后目标库区名称 */ + private String targetWarehouseName; + /** 执行状态:0=待执行 1=已执行 */ private Long executeStatus; diff --git a/klp-mes/src/main/java/com/klp/mes/qc/domain/bo/QcQualityReviewCoilBo.java b/klp-mes/src/main/java/com/klp/mes/qc/domain/bo/QcQualityReviewCoilBo.java index a9c304d05..1f64a2aef 100644 --- a/klp-mes/src/main/java/com/klp/mes/qc/domain/bo/QcQualityReviewCoilBo.java +++ b/klp-mes/src/main/java/com/klp/mes/qc/domain/bo/QcQualityReviewCoilBo.java @@ -55,9 +55,21 @@ public class QcQualityReviewCoilBo extends BaseEntity { /** 改判前质量等级 */ private String beforeQuality; + /** 改判前逻辑库区ID */ + private Long beforeWarehouseId; + + /** 改判前逻辑库区名称 */ + private String beforeWarehouseName; + /** 改判后质量状态 */ private String regradeQuality; + /** 改判后目标库区ID */ + private Long targetWarehouseId; + + /** 改判后目标库区名称 */ + private String targetWarehouseName; + /** 执行状态 */ private Long executeStatus; diff --git a/klp-mes/src/main/java/com/klp/mes/qc/domain/vo/QcQualityReviewCoilVo.java b/klp-mes/src/main/java/com/klp/mes/qc/domain/vo/QcQualityReviewCoilVo.java index 21e203f75..10bf13148 100644 --- a/klp-mes/src/main/java/com/klp/mes/qc/domain/vo/QcQualityReviewCoilVo.java +++ b/klp-mes/src/main/java/com/klp/mes/qc/domain/vo/QcQualityReviewCoilVo.java @@ -53,9 +53,21 @@ public class QcQualityReviewCoilVo extends BaseEntity { /** 改判前质量等级 */ private String beforeQuality; + /** 改判前逻辑库区ID */ + private Long beforeWarehouseId; + + /** 改判前逻辑库区名称 */ + private String beforeWarehouseName; + /** 改判后质量状态 */ private String regradeQuality; + /** 改判后目标库区ID */ + private Long targetWarehouseId; + + /** 改判后目标库区名称 */ + private String targetWarehouseName; + /** 执行状态 */ private Long executeStatus; diff --git a/klp-mes/src/main/java/com/klp/mes/qc/service/impl/QcQualityReviewServiceImpl.java b/klp-mes/src/main/java/com/klp/mes/qc/service/impl/QcQualityReviewServiceImpl.java index df9f7862c..83642a870 100644 --- a/klp-mes/src/main/java/com/klp/mes/qc/service/impl/QcQualityReviewServiceImpl.java +++ b/klp-mes/src/main/java/com/klp/mes/qc/service/impl/QcQualityReviewServiceImpl.java @@ -11,7 +11,9 @@ import com.klp.common.core.page.TableDataInfo; import com.klp.common.utils.StringUtils; import com.klp.common.helper.LoginHelper; import com.klp.domain.WmsMaterialCoil; +import com.klp.domain.WmsWarehouse; import com.klp.mapper.WmsMaterialCoilMapper; +import com.klp.mapper.WmsWarehouseMapper; import com.klp.service.IWmsMaterialCoilService; import com.klp.mes.qc.domain.QcQualityReview; import com.klp.mes.qc.domain.QcQualityReviewCoil; @@ -43,13 +45,11 @@ import java.util.*; @Service public class QcQualityReviewServiceImpl implements IQcQualityReviewService { - /** 技术部逻辑库ID(C/D级改判后移入此库区) */ - private static final Long TECH_WAREHOUSE_ID = 2019583656787259393L; - private final QcQualityReviewMapper baseMapper; private final QcQualityReviewCoilMapper coilMapper; private final QcQualityReviewLogMapper logMapper; private final WmsMaterialCoilMapper wmsMaterialCoilMapper; + private final WmsWarehouseMapper wmsWarehouseMapper; private final IWmsMaterialCoilService wmsMaterialCoilService; /** @@ -313,12 +313,11 @@ public class QcQualityReviewServiceImpl implements IQcQualityReviewService { coil.getCoilId(), coil.getRegradeQuality(), reason); } - // 2. 根据改判后质量等级自动更新钢卷所在逻辑库区 - Long targetWarehouseId = determineTargetWarehouse(coil.getRegradeQuality()); - if (targetWarehouseId != null && coil.getCoilId() != null) { + // 2. 使用手动指定的目标逻辑库区更新钢卷所在库区 + if (coil.getTargetWarehouseId() != null && coil.getCoilId() != null) { wmsMaterialCoilMapper.update(null, Wrappers.lambdaUpdate() .eq(WmsMaterialCoil::getCoilId, coil.getCoilId()) - .set(WmsMaterialCoil::getWarehouseId, targetWarehouseId)); + .set(WmsMaterialCoil::getWarehouseId, coil.getTargetWarehouseId())); } // 3. 更新明细执行状态 @@ -359,10 +358,12 @@ public class QcQualityReviewServiceImpl implements IQcQualityReviewService { coil.setGroupSeq(seq); } // 若未传改判前质量等级,从钢卷表获取 - if (StringUtils.isBlank(coil.getBeforeQuality()) && coil.getCoilId() != null) { + if (coil.getCoilId() != null) { WmsMaterialCoil wmsCoil = wmsMaterialCoilMapper.selectById(coil.getCoilId()); if (wmsCoil != null) { - coil.setBeforeQuality(wmsCoil.getQualityStatus()); + if (StringUtils.isBlank(coil.getBeforeQuality())) { + coil.setBeforeQuality(wmsCoil.getQualityStatus()); + } if (StringUtils.isBlank(coil.getCurrentCoilNo())) { coil.setCurrentCoilNo(wmsCoil.getCurrentCoilNo()); } @@ -372,6 +373,14 @@ public class QcQualityReviewServiceImpl implements IQcQualityReviewService { if (coil.getNetWeight() == null) { coil.setNetWeight(wmsCoil.getNetWeight()); } + // 自动带出当前逻辑库区 + if (coil.getBeforeWarehouseId() == null && wmsCoil.getWarehouseId() != null) { + coil.setBeforeWarehouseId(wmsCoil.getWarehouseId()); + WmsWarehouse wh = wmsWarehouseMapper.selectById(wmsCoil.getWarehouseId()); + if (wh != null) { + coil.setBeforeWarehouseName(wh.getWarehouseName()); + } + } } } coilMapper.insert(coil); @@ -402,23 +411,6 @@ public class QcQualityReviewServiceImpl implements IQcQualityReviewService { return "QR-" + dateStr + "-" + String.format("%04d", count + 1); } - /** - * 根据改判后质量等级确定目标逻辑库区 - * O/A/B → 不移动,C+/C/C- → 技术部逻辑库,D+/D/D- → 技术部逻辑库 - */ - private Long determineTargetWarehouse(String regradeQuality) { - if (regradeQuality == null) return null; - // O/A/B 级不移动 - if ("O".equals(regradeQuality) || "A".equals(regradeQuality) || "B".equals(regradeQuality)) { - return null; - } - // C/D 级 → 技术部逻辑库 - if (regradeQuality.startsWith("C") || regradeQuality.startsWith("D")) { - return TECH_WAREHOUSE_ID; - } - return null; - } - private void validEntityBeforeSave(QcQualityReview entity) { if (StringUtils.isBlank(entity.getProductName())) { throw new RuntimeException("产品名称不能为空"); diff --git a/klp-mes/src/main/resources/mapper/qc/QcQualityReviewCoilMapper.xml b/klp-mes/src/main/resources/mapper/qc/QcQualityReviewCoilMapper.xml index b22759e1b..42879a406 100644 --- a/klp-mes/src/main/resources/mapper/qc/QcQualityReviewCoilMapper.xml +++ b/klp-mes/src/main/resources/mapper/qc/QcQualityReviewCoilMapper.xml @@ -16,7 +16,11 @@ + + + + diff --git a/klp-ui/src/views/mes/qc/qualityReview/index.vue b/klp-ui/src/views/mes/qc/qualityReview/index.vue index 7e5f634e0..3d16e6490 100644 --- a/klp-ui/src/views/mes/qc/qualityReview/index.vue +++ b/klp-ui/src/views/mes/qc/qualityReview/index.vue @@ -124,12 +124,22 @@ {{ scope.row.beforeQuality }} - + + + + + + + @@ -170,9 +180,15 @@ - + + + + + @@ -228,7 +244,7 @@ - +
@@ -274,19 +290,37 @@ - + - + + + + - + + + + + + + @@ -372,6 +406,7 @@ import { listQualityReview, getQualityReview, addQualityReview, updateQualityRev submitQualityReview, approveQualityReview, rejectQualityReview, executeQualityReview, listQualityReviewCoil, listQualityReviewLog } from '@/api/mes/qc/qualityReview' import CoilSelector from '@/components/CoilSelector' +import { listWarehouse } from '@/api/wms/warehouse' export default { name: 'QualityReview', @@ -398,6 +433,7 @@ export default { // 钢卷选择 showCoilSelector: false, + warehouseOptions: [], // 库区下拉选项 // 编辑弹窗 dialogVisible: false, @@ -436,6 +472,11 @@ export default { created() { this.getList() }, + watch: { + dialogVisible(val) { + if (val) this.loadWarehouseOptions() + } + }, methods: { // ===== 列表 ===== handleQuery() { @@ -546,24 +587,51 @@ export default { // ===== 钢卷选择(弹窗内) ===== onDialogCoilConfirm(selected) { if (!selected || selected.length === 0) return + const existingIds = new Set(this.editForm.coilList.map(c => c.coilId)) + const newSelected = selected.filter(coil => !existingIds.has(coil.coilId)) + const dupCount = selected.length - newSelected.length + if (dupCount > 0) { + this.$message.warning(`已跳过 ${dupCount} 个重复钢卷`) + } + if (newSelected.length === 0) return const startIdx = this.editForm.coilList.length || 0 - const newCoils = selected.map((coil, idx) => ({ + const newCoils = newSelected.map((coil, idx) => ({ coilId: coil.coilId, currentCoilNo: coil.currentCoilNo, supplierCoilNo: coil.supplierCoilNo || coil.enterCoilNo, - spec: coil.specification, // CoilSelector返回的字段名为specification + spec: coil.specification, netWeight: coil.netWeight, defectDesc: '', - regradeQuality: '', // 改判后等级,由创建者填写 + regradeQuality: '', + beforeWarehouseId: coil.warehouseId || null, + beforeWarehouseName: this.getWarehouseName(coil.warehouseId), + targetWarehouseId: null, + targetWarehouseName: '', groupSeq: startIdx + idx + 1, beforeQuality: coil.qualityStatus || 'O' })) this.editForm.coilList = [...(this.editForm.coilList || []), ...newCoils] }, + getWarehouseName(warehouseId) { + if (!warehouseId) return '' + const wh = this.warehouseOptions.find(w => w.warehouseId === warehouseId) + return wh ? wh.warehouseName : '' + }, handleRemoveCoil(index) { this.coilList.splice(index, 1) }, + // ===== 库区选择 ===== + loadWarehouseOptions() { + listWarehouse().then(res => { + this.warehouseOptions = res.data || [] + }) + }, + onTargetWarehouseChange(row) { + const selected = this.warehouseOptions.find(w => w.warehouseId === row.targetWarehouseId) + row.targetWarehouseName = selected ? selected.warehouseName : '' + }, + // ===== 提交送审 ===== handleSubmit() { this.$confirm('确认提交送审?', '提示', { type: 'warning' }).then(() => { diff --git a/klp-ui/src/views/mes/qc/qualityReview/todo.vue b/klp-ui/src/views/mes/qc/qualityReview/todo.vue index 5ad6a251b..fe0b5eb07 100644 --- a/klp-ui/src/views/mes/qc/qualityReview/todo.vue +++ b/klp-ui/src/views/mes/qc/qualityReview/todo.vue @@ -64,9 +64,15 @@ - + + + + +