Commit 0f0b39573a37816beac57ff6f374562068c61740
1 parent
bf026611
✨ feat(mes): 新增采购订单号字段及相关逻辑处理
Showing
5 changed files
with
13 additions
and
24 deletions
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/itemreceipt/vo/MesWmItemReceiptSaveReqVO.java
| @@ -36,6 +36,9 @@ public class MesWmItemReceiptSaveReqVO { | @@ -36,6 +36,9 @@ public class MesWmItemReceiptSaveReqVO { | ||
| 36 | @NotNull(message = "入库日期不能为空") | 36 | @NotNull(message = "入库日期不能为空") |
| 37 | private LocalDateTime receiptDate; | 37 | private LocalDateTime receiptDate; |
| 38 | 38 | ||
| 39 | + @Schema(description = "采购订单号", example = "PO20260201") | ||
| 40 | + private String purchaseOrderCode; | ||
| 41 | + | ||
| 39 | @Schema(description = "备注", example = "备注") | 42 | @Schema(description = "备注", example = "备注") |
| 40 | private String remark; | 43 | private String remark; |
| 41 | 44 |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/itemreceipt/vo/line/MesWmItemReceiptLineSaveReqVO.java
| @@ -31,13 +31,6 @@ public class MesWmItemReceiptLineSaveReqVO { | @@ -31,13 +31,6 @@ public class MesWmItemReceiptLineSaveReqVO { | ||
| 31 | @DecimalMin(value = "0", inclusive = false, message = "入库数量必须大于 0") | 31 | @DecimalMin(value = "0", inclusive = false, message = "入库数量必须大于 0") |
| 32 | private BigDecimal receivedQuantity; | 32 | private BigDecimal receivedQuantity; |
| 33 | 33 | ||
| 34 | - // TODO DONE @芋艿:已添加 batchCode 字段,前端可以使用 batchCode 输入批次编码 | ||
| 35 | - @Schema(description = "批次编号", example = "1") | ||
| 36 | - private Long batchId; | ||
| 37 | - | ||
| 38 | - @Schema(description = "批次编码", example = "BATCH20260225001") | ||
| 39 | - private String batchCode; | ||
| 40 | - | ||
| 41 | @Schema(description = "生产日期") | 34 | @Schema(description = "生产日期") |
| 42 | private LocalDateTime productionDate; | 35 | private LocalDateTime productionDate; |
| 43 | 36 |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/wm/itemreceipt/MesWmItemReceiptDO.java
| @@ -3,11 +3,8 @@ package cn.iocoder.yudao.module.mes.dal.dataobject.wm.itemreceipt; | @@ -3,11 +3,8 @@ package cn.iocoder.yudao.module.mes.dal.dataobject.wm.itemreceipt; | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.vendor.MesMdVendorDO; | 4 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.vendor.MesMdVendorDO; |
| 5 | import cn.iocoder.yudao.module.mes.dal.dataobject.qc.iqc.MesQcIqcDO; | 5 | import cn.iocoder.yudao.module.mes.dal.dataobject.qc.iqc.MesQcIqcDO; |
| 6 | -import cn.iocoder.yudao.module.mes.enums.wm.MesWmItemReceiptStatusEnum; | ||
| 7 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.arrivalnotice.MesWmArrivalNoticeDO; | 6 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.arrivalnotice.MesWmArrivalNoticeDO; |
| 8 | -import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseAreaDO; | ||
| 9 | -import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseDO; | ||
| 10 | -import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseLocationDO; | 7 | +import cn.iocoder.yudao.module.mes.enums.wm.MesWmItemReceiptStatusEnum; |
| 11 | import com.baomidou.mybatisplus.annotation.KeySequence; | 8 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 12 | import com.baomidou.mybatisplus.annotation.TableId; | 9 | import com.baomidou.mybatisplus.annotation.TableId; |
| 13 | import com.baomidou.mybatisplus.annotation.TableName; | 10 | import com.baomidou.mybatisplus.annotation.TableName; |
| @@ -54,6 +51,12 @@ public class MesWmItemReceiptDO extends BaseDO { | @@ -54,6 +51,12 @@ public class MesWmItemReceiptDO extends BaseDO { | ||
| 54 | */ | 51 | */ |
| 55 | private Long noticeId; | 52 | private Long noticeId; |
| 56 | /** | 53 | /** |
| 54 | + * 采购订单号 | ||
| 55 | + * | ||
| 56 | + * 冗余自 {@link MesWmArrivalNoticeDO#getPurchaseOrderCode()},也可以手动填写 | ||
| 57 | + */ | ||
| 58 | + private String purchaseOrderCode; | ||
| 59 | + /** | ||
| 57 | * 供应商编号 | 60 | * 供应商编号 |
| 58 | * | 61 | * |
| 59 | * 关联 {@link MesMdVendorDO#getId()} | 62 | * 关联 {@link MesMdVendorDO#getId()} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/itemreceipt/MesWmItemReceiptLineServiceImpl.java
| @@ -6,13 +6,11 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | @@ -6,13 +6,11 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 6 | import cn.iocoder.yudao.module.mes.controller.admin.wm.batch.vo.MesWmBatchGenerateReqVO; | 6 | import cn.iocoder.yudao.module.mes.controller.admin.wm.batch.vo.MesWmBatchGenerateReqVO; |
| 7 | import cn.iocoder.yudao.module.mes.controller.admin.wm.itemreceipt.vo.line.MesWmItemReceiptLinePageReqVO; | 7 | import cn.iocoder.yudao.module.mes.controller.admin.wm.itemreceipt.vo.line.MesWmItemReceiptLinePageReqVO; |
| 8 | import cn.iocoder.yudao.module.mes.controller.admin.wm.itemreceipt.vo.line.MesWmItemReceiptLineSaveReqVO; | 8 | import cn.iocoder.yudao.module.mes.controller.admin.wm.itemreceipt.vo.line.MesWmItemReceiptLineSaveReqVO; |
| 9 | -import cn.iocoder.yudao.module.mes.dal.dataobject.wm.arrivalnotice.MesWmArrivalNoticeDO; | ||
| 10 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.batch.MesWmBatchDO; | 9 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.batch.MesWmBatchDO; |
| 11 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.itemreceipt.MesWmItemReceiptDO; | 10 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.itemreceipt.MesWmItemReceiptDO; |
| 12 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.itemreceipt.MesWmItemReceiptLineDO; | 11 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.itemreceipt.MesWmItemReceiptLineDO; |
| 13 | import cn.iocoder.yudao.module.mes.dal.mysql.wm.itemreceipt.MesWmItemReceiptLineMapper; | 12 | import cn.iocoder.yudao.module.mes.dal.mysql.wm.itemreceipt.MesWmItemReceiptLineMapper; |
| 14 | import cn.iocoder.yudao.module.mes.service.wm.arrivalnotice.MesWmArrivalNoticeLineService; | 13 | import cn.iocoder.yudao.module.mes.service.wm.arrivalnotice.MesWmArrivalNoticeLineService; |
| 15 | -import cn.iocoder.yudao.module.mes.service.wm.arrivalnotice.MesWmArrivalNoticeService; | ||
| 16 | import cn.iocoder.yudao.module.mes.service.wm.batch.MesWmBatchService; | 14 | import cn.iocoder.yudao.module.mes.service.wm.batch.MesWmBatchService; |
| 17 | import jakarta.annotation.Resource; | 15 | import jakarta.annotation.Resource; |
| 18 | import org.springframework.context.annotation.Lazy; | 16 | import org.springframework.context.annotation.Lazy; |
| @@ -45,9 +43,6 @@ public class MesWmItemReceiptLineServiceImpl implements MesWmItemReceiptLineServ | @@ -45,9 +43,6 @@ public class MesWmItemReceiptLineServiceImpl implements MesWmItemReceiptLineServ | ||
| 45 | @Lazy | 43 | @Lazy |
| 46 | private MesWmArrivalNoticeLineService arrivalNoticeLineService; | 44 | private MesWmArrivalNoticeLineService arrivalNoticeLineService; |
| 47 | @Resource | 45 | @Resource |
| 48 | - @Lazy | ||
| 49 | - private MesWmArrivalNoticeService arrivalNoticeService; | ||
| 50 | - @Resource | ||
| 51 | private MesWmBatchService batchService; | 46 | private MesWmBatchService batchService; |
| 52 | 47 | ||
| 53 | @Override | 48 | @Override |
| @@ -183,14 +178,8 @@ public class MesWmItemReceiptLineServiceImpl implements MesWmItemReceiptLineServ | @@ -183,14 +178,8 @@ public class MesWmItemReceiptLineServiceImpl implements MesWmItemReceiptLineServ | ||
| 183 | batchReqVO.setItemId(reqVO.getItemId()).setProduceDate(reqVO.getProductionDate()) | 178 | batchReqVO.setItemId(reqVO.getItemId()).setProduceDate(reqVO.getProductionDate()) |
| 184 | .setExpireDate(reqVO.getExpireDate()).setLotNumber(reqVO.getLotNumber()); | 179 | .setExpireDate(reqVO.getExpireDate()).setLotNumber(reqVO.getLotNumber()); |
| 185 | // 从父单据获取 | 180 | // 从父单据获取 |
| 186 | - batchReqVO.setVendorId(receipt.getVendorId()).setReceiptDate(receipt.getReceiptDate()); | ||
| 187 | - // 从到货通知单获取采购订单号(如果关联了到货通知单) | ||
| 188 | - if (receipt.getNoticeId() != null) { | ||
| 189 | - MesWmArrivalNoticeDO notice = arrivalNoticeService.getArrivalNotice(receipt.getNoticeId()); | ||
| 190 | - if (notice != null) { | ||
| 191 | - batchReqVO.setPurchaseOrderCode(notice.getPurchaseOrderCode()); | ||
| 192 | - } | ||
| 193 | - } | 181 | + batchReqVO.setVendorId(receipt.getVendorId()).setReceiptDate(receipt.getReceiptDate()) |
| 182 | + .setPurchaseOrderCode(receipt.getPurchaseOrderCode()); | ||
| 194 | 183 | ||
| 195 | // 生成或获取批次 | 184 | // 生成或获取批次 |
| 196 | return batchService.getOrGenerateBatchCode(batchReqVO); | 185 | return batchService.getOrGenerateBatchCode(batchReqVO); |
yudao-module-mes/src/test/resources/sql/create_tables.sql
| @@ -459,6 +459,7 @@ CREATE TABLE IF NOT EXISTS "mes_wm_item_receipt" ( | @@ -459,6 +459,7 @@ CREATE TABLE IF NOT EXISTS "mes_wm_item_receipt" ( | ||
| 459 | "iqc_id" bigint DEFAULT NULL, | 459 | "iqc_id" bigint DEFAULT NULL, |
| 460 | "notice_id" bigint DEFAULT NULL, | 460 | "notice_id" bigint DEFAULT NULL, |
| 461 | "vendor_id" bigint DEFAULT NULL, | 461 | "vendor_id" bigint DEFAULT NULL, |
| 462 | + "purchase_order_code" varchar(64) DEFAULT NULL, | ||
| 462 | "receipt_date" timestamp DEFAULT NULL, | 463 | "receipt_date" timestamp DEFAULT NULL, |
| 463 | "status" tinyint NOT NULL DEFAULT 0, | 464 | "status" tinyint NOT NULL DEFAULT 0, |
| 464 | "remark" varchar(500) DEFAULT NULL, | 465 | "remark" varchar(500) DEFAULT NULL, |