Commit 2676319a76dc0969b6bb3bf8ee65142c5537b05c
1 parent
d9722c13
✨ feat(mes): 添加反馈记录关联及代码注释优化
Showing
3 changed files
with
12 additions
and
14 deletions
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/wm/productproduce/MesWmProductProduceDO.java
| ... | ... | @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.mes.dal.dataobject.wm.productproduce; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | 4 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.workstation.MesMdWorkstationDO; |
| 5 | +import cn.iocoder.yudao.module.mes.dal.dataobject.pro.feedback.MesProFeedbackDO; | |
| 5 | 6 | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.process.MesProProcessDO; |
| 6 | 7 | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.task.MesProTaskDO; |
| 7 | 8 | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.workorder.MesProWorkOrderDO; |
| ... | ... | @@ -42,7 +43,7 @@ public class MesWmProductProduceDO extends BaseDO { |
| 42 | 43 | /** |
| 43 | 44 | * 报工记录 ID |
| 44 | 45 | * |
| 45 | - * TODO @芋艿:关联 ProFeedback,待 ProFeedback 联调时补充 | |
| 46 | + * 关联 {@link MesProFeedbackDO#getId()} | |
| 46 | 47 | */ |
| 47 | 48 | private Long feedbackId; |
| 48 | 49 | /** |
| ... | ... | @@ -51,7 +52,6 @@ public class MesWmProductProduceDO extends BaseDO { |
| 51 | 52 | * 关联 {@link MesProTaskDO#getId()} |
| 52 | 53 | */ |
| 53 | 54 | private Long taskId; |
| 54 | - // TODO @芋艿:workstationId、processId 哪些是必填字段; | |
| 55 | 55 | /** |
| 56 | 56 | * 工作站 ID |
| 57 | 57 | * | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/wm/productproduce/MesWmProductProduceLineDO.java
| ... | ... | @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.mes.dal.dataobject.wm.productproduce; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | 4 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; |
| 5 | +import cn.iocoder.yudao.module.mes.dal.dataobject.pro.feedback.MesProFeedbackDO; | |
| 5 | 6 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 6 | 7 | import com.baomidou.mybatisplus.annotation.TableId; |
| 7 | 8 | import com.baomidou.mybatisplus.annotation.TableName; |
| ... | ... | @@ -39,7 +40,7 @@ public class MesWmProductProduceLineDO extends BaseDO { |
| 39 | 40 | /** |
| 40 | 41 | * 报工记录 ID |
| 41 | 42 | * |
| 42 | - * TODO @芋艿:关联 ProFeedback,待 ProFeedback 联调时补充 | |
| 43 | + * 关联 {@link MesProFeedbackDO#getId()} | |
| 43 | 44 | */ |
| 44 | 45 | private Long feedbackId; |
| 45 | 46 | /** |
| ... | ... | @@ -68,12 +69,10 @@ public class MesWmProductProduceLineDO extends BaseDO { |
| 68 | 69 | * 生产批号 |
| 69 | 70 | */ |
| 70 | 71 | private String lotNumber; |
| 71 | - // TODO @AI:待定 | |
| 72 | 72 | /** |
| 73 | 73 | * 质量状态 |
| 74 | 74 | * |
| 75 | - * 0-待检, 1-合格, 2-不合格 | |
| 76 | - * 字典类型 mes_wm_quality_status | |
| 75 | + * 枚举 {@link cn.iocoder.yudao.module.mes.enums.wm.MesWmQualityStatusEnum} | |
| 77 | 76 | */ |
| 78 | 77 | private Integer qualityStatus; |
| 79 | 78 | /** | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/productproduce/MesWmProductProduceServiceImpl.java
| ... | ... | @@ -129,10 +129,9 @@ public class MesWmProductProduceServiceImpl implements MesWmProductProduceServic |
| 129 | 129 | .setExpireDate(feedback.getExpireDate()) |
| 130 | 130 | .setWorkOrderId(feedback.getWorkOrderId()) |
| 131 | 131 | .setClientId(workOrder != null ? workOrder.getClientId() : null) |
| 132 | + .setSalesOrderCode(workOrder != null ? workOrder.getOrderSourceCode() : null) | |
| 132 | 133 | .setWorkstationId(feedback.getWorkstationId()) |
| 133 | 134 | .setLotNumber(feedback.getLotNumber()); |
| 134 | - // TODO @AI(from codex):对齐 批次生成还需要带上工单来源单号(salesOrderCode / coCode 对应 orderSourceCode); | |
| 135 | - // 否则启用该维度的批次规则会生成错误批次或直接缺参失败。 | |
| 136 | 135 | MesWmBatchDO batch = batchService.getOrGenerateBatchCode(batchReqVO); |
| 137 | 136 | Long batchId = batch != null ? batch.getId() : null; |
| 138 | 137 | String batchCode = batch != null ? batch.getCode() : null; |
| ... | ... | @@ -148,7 +147,7 @@ public class MesWmProductProduceServiceImpl implements MesWmProductProduceServic |
| 148 | 147 | MesWmProductProduceLineDO line = buildProduceLine(produce, feedback, batchId, batchCode, |
| 149 | 148 | feedback.getFeedbackQuantity(), MesWmQualityStatusEnum.PENDING.getStatus()); |
| 150 | 149 | productProduceLineService.createProductProduceLine(line); |
| 151 | - // TODO @芋艿:先不生成明细行,等待检验完成时,再根据行的质量状态生成明细行 | |
| 150 | + // 注意:checkFlag=true 时不生成明细行,等 IPQC 检验完成后由 splitPendingAndFinishProduce 按质量结果拆行+生成明细 | |
| 152 | 151 | } else { |
| 153 | 152 | // 3.2 无需检验:按合格品/不合格品各生成一行 + 明细 |
| 154 | 153 | BigDecimal qualifiedQty = ObjectUtil.defaultIfNull(feedback.getQualifiedQuantity(), BigDecimal.ZERO); |
| ... | ... | @@ -236,11 +235,11 @@ public class MesWmProductProduceServiceImpl implements MesWmProductProduceServic |
| 236 | 235 | |
| 237 | 236 | // 2. 查找待检验行(checkFlag=true 时只有一行 PENDING) |
| 238 | 237 | List<MesWmProductProduceLineDO> lines = productProduceLineService.getProductProduceLineListByProduceId(produce.getId()); |
| 239 | - // TODO @AI:hutool 的 findOne 方法,替代掉 stream;手动 if 判断为空,抛出异常; | |
| 240 | - MesWmProductProduceLineDO pendingLine = lines.stream() | |
| 241 | - .filter(l -> ObjUtil.equal(l.getQualityStatus(), MesWmQualityStatusEnum.PENDING.getStatus())) | |
| 242 | - .findFirst() | |
| 243 | - .orElseThrow(() -> exception(WM_PRODUCT_PRODUCE_LINE_NOT_EXISTS)); | |
| 238 | + MesWmProductProduceLineDO pendingLine = CollUtil.findOne(lines, | |
| 239 | + l -> ObjUtil.equal(l.getQualityStatus(), MesWmQualityStatusEnum.PENDING.getStatus())); | |
| 240 | + if (pendingLine == null) { | |
| 241 | + throw exception(WM_PRODUCT_PRODUCE_LINE_NOT_EXISTS); | |
| 242 | + } | |
| 244 | 243 | |
| 245 | 244 | // 3A. 情况一:存在不合格品数量,需要拆分行 |
| 246 | 245 | if (unqualifiedQty != null && unqualifiedQty.compareTo(BigDecimal.ZERO) > 0) { | ... | ... |