Commit 28d0cfd08e3379612e90e5448c090afb5d516e1d
1 parent
98e11135
✨ feat(item-receipt): 添加采购入库单相关字段和功能
新增采购入库单编码和采购订单号字段,优化相关服务和控制器以支持批量获取入库单信息,提升数据处理能力。
Showing
7 changed files
with
49 additions
and
5 deletions
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/workorder/MesProWorkOrderBomController.java
| ... | ... | @@ -122,6 +122,8 @@ public class MesProWorkOrderBomController { |
| 122 | 122 | Map<Long, MesMdItemDO> itemMap = itemService.getItemMap(leafItems.keySet()); |
| 123 | 123 | Map<Long, MesMdUnitMeasureDO> unitMeasureMap = unitMeasureService.getUnitMeasureMap( |
| 124 | 124 | convertSet(itemMap.values(), MesMdItemDO::getUnitMeasureId)); |
| 125 | + Map<Long, MesMdItemTypeDO> itemTypeMap = itemTypeService.getItemTypeMap( | |
| 126 | + convertSet(itemMap.values(), MesMdItemDO::getItemTypeId)); | |
| 125 | 127 | List<MesProWorkOrderItemRespVO> result = new ArrayList<>(leafItems.size()); |
| 126 | 128 | for (Map.Entry<Long, BigDecimal> entry : leafItems.entrySet()) { |
| 127 | 129 | MesMdItemDO item = itemMap.get(entry.getKey()); |
| ... | ... | @@ -133,6 +135,8 @@ public class MesProWorkOrderBomController { |
| 133 | 135 | .setItemCode(item.getCode()).setItemName(item.getName()).setItemSpec(item.getSpecification()); |
| 134 | 136 | MapUtils.findAndThen(unitMeasureMap, item.getUnitMeasureId(), |
| 135 | 137 | unitMeasure -> vo.setUnitMeasureName(unitMeasure.getName())); |
| 138 | + MapUtils.findAndThen(itemTypeMap, item.getItemTypeId(), | |
| 139 | + itemType -> vo.setItemOrProduct(itemType.getItemOrProduct())); | |
| 136 | 140 | result.add(vo); |
| 137 | 141 | } |
| 138 | 142 | return success(result); | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/workorder/vo/MesProWorkOrderItemRespVO.java
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/itemreceipt/MesWmItemReceiptLineController.java
| ... | ... | @@ -10,10 +10,12 @@ import cn.iocoder.yudao.module.mes.controller.admin.wm.itemreceipt.vo.line.MesWm |
| 10 | 10 | import cn.iocoder.yudao.module.mes.controller.admin.wm.itemreceipt.vo.line.MesWmItemReceiptLineSaveReqVO; |
| 11 | 11 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; |
| 12 | 12 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.unitmeasure.MesMdUnitMeasureDO; |
| 13 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.itemreceipt.MesWmItemReceiptDO; | |
| 13 | 14 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.itemreceipt.MesWmItemReceiptLineDO; |
| 14 | 15 | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; |
| 15 | 16 | import cn.iocoder.yudao.module.mes.service.md.unitmeasure.MesMdUnitMeasureService; |
| 16 | 17 | import cn.iocoder.yudao.module.mes.service.wm.itemreceipt.MesWmItemReceiptLineService; |
| 18 | +import cn.iocoder.yudao.module.mes.service.wm.itemreceipt.MesWmItemReceiptService; | |
| 17 | 19 | import io.swagger.v3.oas.annotations.Operation; |
| 18 | 20 | import io.swagger.v3.oas.annotations.Parameter; |
| 19 | 21 | import io.swagger.v3.oas.annotations.tags.Tag; |
| ... | ... | @@ -38,12 +40,12 @@ public class MesWmItemReceiptLineController { |
| 38 | 40 | |
| 39 | 41 | @Resource |
| 40 | 42 | private MesWmItemReceiptLineService itemReceiptLineService; |
| 41 | - | |
| 42 | 43 | @Resource |
| 43 | 44 | private MesMdItemService itemService; |
| 44 | - | |
| 45 | 45 | @Resource |
| 46 | 46 | private MesMdUnitMeasureService unitMeasureService; |
| 47 | + @Resource | |
| 48 | + private MesWmItemReceiptService itemReceiptService; | |
| 47 | 49 | |
| 48 | 50 | @PostMapping("/create") |
| 49 | 51 | @Operation(summary = "创建采购入库单行") |
| ... | ... | @@ -101,6 +103,8 @@ public class MesWmItemReceiptLineController { |
| 101 | 103 | convertSet(list, MesWmItemReceiptLineDO::getItemId)); |
| 102 | 104 | Map<Long, MesMdUnitMeasureDO> unitMeasureMap = unitMeasureService.getUnitMeasureMap( |
| 103 | 105 | convertSet(itemMap.values(), MesMdItemDO::getUnitMeasureId)); |
| 106 | + Map<Long, MesWmItemReceiptDO> receiptMap = itemReceiptService.getItemReceiptMap( | |
| 107 | + convertSet(list, MesWmItemReceiptLineDO::getReceiptId)); | |
| 104 | 108 | // 2. 构建结果 |
| 105 | 109 | return BeanUtils.toBean(list, MesWmItemReceiptLineRespVO.class, vo -> { |
| 106 | 110 | MapUtils.findAndThen(itemMap, vo.getItemId(), item -> { |
| ... | ... | @@ -108,6 +112,8 @@ public class MesWmItemReceiptLineController { |
| 108 | 112 | MapUtils.findAndThen(unitMeasureMap, item.getUnitMeasureId(), |
| 109 | 113 | unitMeasure -> vo.setUnitMeasureName(unitMeasure.getName())); |
| 110 | 114 | }); |
| 115 | + MapUtils.findAndThen(receiptMap, vo.getReceiptId(), receipt -> | |
| 116 | + vo.setReceiptCode(receipt.getCode()).setPurchaseOrderCode(receipt.getPurchaseOrderCode())); | |
| 111 | 117 | }); |
| 112 | 118 | } |
| 113 | 119 | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/itemreceipt/vo/line/MesWmItemReceiptLineRespVO.java
| ... | ... | @@ -16,6 +16,12 @@ public class MesWmItemReceiptLineRespVO { |
| 16 | 16 | @Schema(description = "入库单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 17 | 17 | private Long receiptId; |
| 18 | 18 | |
| 19 | + @Schema(description = "入库单编码", example = "IR2026020001") | |
| 20 | + private String receiptCode; | |
| 21 | + | |
| 22 | + @Schema(description = "采购订单号", example = "PO20260201") | |
| 23 | + private String purchaseOrderCode; | |
| 24 | + | |
| 19 | 25 | @Schema(description = "到货通知单行编号", example = "1") |
| 20 | 26 | private Long arrivalNoticeLineId; |
| 21 | 27 | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pro/route/MesProRouteProcessServiceImpl.java
| ... | ... | @@ -191,8 +191,6 @@ public class MesProRouteProcessServiceImpl implements MesProRouteProcessService |
| 191 | 191 | // 1. 根据产品查找关联的工艺路线产品记录 |
| 192 | 192 | MesProRouteProductDO routeProduct = routeProductService.getRouteProductByItemId(productId); |
| 193 | 193 | if (routeProduct == null) { |
| 194 | - // TODO @芋艿:会不会存在配置了多个的情况??? | |
| 195 | - // TODO @AI:会有这个情况么? | |
| 196 | 194 | return Collections.emptyList(); |
| 197 | 195 | } |
| 198 | 196 | // 2. 返回该工艺路线的工序列表 | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/itemreceipt/MesWmItemReceiptService.java
| ... | ... | @@ -5,8 +5,11 @@ import cn.iocoder.yudao.module.mes.controller.admin.wm.itemreceipt.vo.MesWmItemR |
| 5 | 5 | import cn.iocoder.yudao.module.mes.controller.admin.wm.itemreceipt.vo.MesWmItemReceiptSaveReqVO; |
| 6 | 6 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.itemreceipt.MesWmItemReceiptDO; |
| 7 | 7 | import jakarta.validation.Valid; |
| 8 | - | |
| 8 | +import java.util.Collection; | |
| 9 | 9 | import java.util.List; |
| 10 | +import java.util.Map; | |
| 11 | + | |
| 12 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | |
| 10 | 13 | |
| 11 | 14 | /** |
| 12 | 15 | * MES 采购入库单 Service 接口 |
| ... | ... | @@ -103,4 +106,22 @@ public interface MesWmItemReceiptService { |
| 103 | 106 | */ |
| 104 | 107 | List<MesWmItemReceiptDO> getItemReceiptListByVendorId(Long vendorId); |
| 105 | 108 | |
| 109 | + /** | |
| 110 | + * 批量获得采购入库单列表 | |
| 111 | + * | |
| 112 | + * @param ids 编号数组 | |
| 113 | + * @return 入库单列表 | |
| 114 | + */ | |
| 115 | + List<MesWmItemReceiptDO> getItemReceiptList(Collection<Long> ids); | |
| 116 | + | |
| 117 | + /** | |
| 118 | + * 批量获得采购入库单 Map | |
| 119 | + * | |
| 120 | + * @param ids 编号数组 | |
| 121 | + * @return 入库单 Map | |
| 122 | + */ | |
| 123 | + default Map<Long, MesWmItemReceiptDO> getItemReceiptMap(Collection<Long> ids) { | |
| 124 | + return convertMap(getItemReceiptList(ids), MesWmItemReceiptDO::getId); | |
| 125 | + } | |
| 126 | + | |
| 106 | 127 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/itemreceipt/MesWmItemReceiptServiceImpl.java
| ... | ... | @@ -29,6 +29,7 @@ import org.springframework.transaction.annotation.Transactional; |
| 29 | 29 | import org.springframework.validation.annotation.Validated; |
| 30 | 30 | |
| 31 | 31 | import java.math.BigDecimal; |
| 32 | +import java.util.Collection; | |
| 32 | 33 | import java.util.List; |
| 33 | 34 | |
| 34 | 35 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| ... | ... | @@ -271,4 +272,9 @@ public class MesWmItemReceiptServiceImpl implements MesWmItemReceiptService { |
| 271 | 272 | return itemReceiptMapper.selectListByVendorId(vendorId); |
| 272 | 273 | } |
| 273 | 274 | |
| 275 | + @Override | |
| 276 | + public List<MesWmItemReceiptDO> getItemReceiptList(Collection<Long> ids) { | |
| 277 | + return itemReceiptMapper.selectByIds(ids); | |
| 278 | + } | |
| 279 | + | |
| 274 | 280 | } | ... | ... |