Commit 34f879e0a108ed203e3f8a1f844cbaab4318905a
1 parent
a4cba300
✨ feat(mes): 新增生产流转卡和装箱单精简列表接口
新增获取生产流转卡和装箱单的精简列表接口,主要用于前端下拉选项选择,提升用户体验。同时,更新条码配置相关逻辑,增加条码配置关联检查,确保数据一致性。
Showing
11 changed files
with
70 additions
and
0 deletions
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/card/MesProCardController.java
| ... | ... | @@ -100,6 +100,13 @@ public class MesProCardController { |
| 100 | 100 | return success(new PageResult<>(buildCardRespVOList(pageResult.getList()), pageResult.getTotal())); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | + @GetMapping("/simple-list") | |
| 104 | + @Operation(summary = "获得生产流转卡精简列表", description = "主要用于前端的下拉选项") | |
| 105 | + public CommonResult<List<MesProCardRespVO>> getCardSimpleList() { | |
| 106 | + List<MesProCardDO> list = cardService.getCardSimpleList(); | |
| 107 | + return success(buildCardRespVOList(list)); | |
| 108 | + } | |
| 109 | + | |
| 103 | 110 | @GetMapping("/export-excel") |
| 104 | 111 | @Operation(summary = "导出生产流转卡 Excel") |
| 105 | 112 | @PreAuthorize("@ss.hasPermission('mes:pro-card:export')") | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/packages/MesWmPackageController.java
| ... | ... | @@ -133,6 +133,13 @@ public class MesWmPackageController { |
| 133 | 133 | return success(buildRespVOList(list)); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | + @GetMapping("/simple-list") | |
| 137 | + @Operation(summary = "获得装箱单精简列表", description = "主要用于前端的下拉选项") | |
| 138 | + public CommonResult<List<MesWmPackageRespVO>> getPackageSimpleList() { | |
| 139 | + List<MesWmPackageDO> list = packageService.getPackageSimpleList(); | |
| 140 | + return success(buildRespVOList(list)); | |
| 141 | + } | |
| 142 | + | |
| 136 | 143 | // ========== 私有方法 ========== |
| 137 | 144 | |
| 138 | 145 | private List<MesWmPackageRespVO> buildRespVOList(List<MesWmPackageDO> list) { | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/wm/barcode/MesWmBarcodeMapper.java
| ... | ... | @@ -39,4 +39,8 @@ public interface MesWmBarcodeMapper extends BaseMapperX<MesWmBarcodeDO> { |
| 39 | 39 | return selectOne(MesWmBarcodeDO::getContent, content); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | + default Long selectCountByConfigId(Long configId) { | |
| 43 | + return selectCount(MesWmBarcodeDO::getConfigId, configId); | |
| 44 | + } | |
| 45 | + | |
| 42 | 46 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/enums/ErrorCodeConstants.java
| ... | ... | @@ -592,6 +592,7 @@ public interface ErrorCodeConstants { |
| 592 | 592 | // ========== MES 仓库管理-条码配置(1-040-730-000) ========== |
| 593 | 593 | ErrorCode WM_BARCODE_CONFIG_NOT_EXISTS = new ErrorCode(1_040_730_000, "条码配置不存在"); |
| 594 | 594 | ErrorCode WM_BARCODE_CONFIG_BIZ_TYPE_DUPLICATE = new ErrorCode(1_040_730_001, "该业务类型的条码配置已存在"); |
| 595 | + ErrorCode WM_BARCODE_CONFIG_HAS_BARCODE = new ErrorCode(1_040_730_002, "该条码配置已被条码记录关联,无法删除"); | |
| 595 | 596 | |
| 596 | 597 | // ========== MES 仓库管理-条码清单(1-040-731-000) ========== |
| 597 | 598 | ErrorCode WM_BARCODE_NOT_EXISTS = new ErrorCode(1_040_731_000, "条码不存在"); | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pro/card/MesProCardService.java
| ... | ... | @@ -6,6 +6,8 @@ import cn.iocoder.yudao.module.mes.controller.admin.pro.card.vo.MesProCardSaveRe |
| 6 | 6 | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.card.MesProCardDO; |
| 7 | 7 | import jakarta.validation.Valid; |
| 8 | 8 | |
| 9 | +import java.util.List; | |
| 10 | + | |
| 9 | 11 | /** |
| 10 | 12 | * MES 生产流转卡 Service 接口 |
| 11 | 13 | * |
| ... | ... | @@ -58,4 +60,11 @@ public interface MesProCardService { |
| 58 | 60 | */ |
| 59 | 61 | PageResult<MesProCardDO> getCardPage(MesProCardPageReqVO pageReqVO); |
| 60 | 62 | |
| 63 | + /** | |
| 64 | + * 获得生产流转卡精简列表 | |
| 65 | + * | |
| 66 | + * @return 流转卡列表 | |
| 67 | + */ | |
| 68 | + List<MesProCardDO> getCardSimpleList(); | |
| 69 | + | |
| 61 | 70 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pro/card/MesProCardServiceImpl.java
| ... | ... | @@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.mes.service.pro.card; |
| 3 | 3 | import cn.hutool.core.util.ObjUtil; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 6 | + | |
| 7 | +import java.util.List; | |
| 6 | 8 | import cn.iocoder.yudao.module.mes.controller.admin.pro.card.vo.MesProCardPageReqVO; |
| 7 | 9 | import cn.iocoder.yudao.module.mes.controller.admin.pro.card.vo.MesProCardSaveReqVO; |
| 8 | 10 | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.card.MesProCardDO; |
| ... | ... | @@ -92,6 +94,11 @@ public class MesProCardServiceImpl implements MesProCardService { |
| 92 | 94 | return cardMapper.selectPage(pageReqVO); |
| 93 | 95 | } |
| 94 | 96 | |
| 97 | + @Override | |
| 98 | + public List<MesProCardDO> getCardSimpleList() { | |
| 99 | + return cardMapper.selectList(); | |
| 100 | + } | |
| 101 | + | |
| 95 | 102 | // ==================== 校验方法 ==================== |
| 96 | 103 | |
| 97 | 104 | @Override | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/barcode/MesWmBarcodeConfigServiceImpl.java
| ... | ... | @@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.mes.controller.admin.wm.barcode.vo.config.MesWmBa |
| 8 | 8 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.barcode.MesWmBarcodeConfigDO; |
| 9 | 9 | import cn.iocoder.yudao.module.mes.dal.mysql.wm.barcode.MesWmBarcodeConfigMapper; |
| 10 | 10 | import jakarta.annotation.Resource; |
| 11 | +import org.springframework.context.annotation.Lazy; | |
| 11 | 12 | import org.springframework.stereotype.Service; |
| 12 | 13 | import org.springframework.validation.annotation.Validated; |
| 13 | 14 | |
| ... | ... | @@ -26,6 +27,10 @@ public class MesWmBarcodeConfigServiceImpl implements MesWmBarcodeConfigService |
| 26 | 27 | @Resource |
| 27 | 28 | private MesWmBarcodeConfigMapper barcodeConfigMapper; |
| 28 | 29 | |
| 30 | + @Resource | |
| 31 | + @Lazy | |
| 32 | + private MesWmBarcodeService barcodeService; | |
| 33 | + | |
| 29 | 34 | @Override |
| 30 | 35 | public Long createBarcodeConfig(MesWmBarcodeConfigSaveReqVO createReqVO) { |
| 31 | 36 | // 校验业务类型唯一 |
| ... | ... | @@ -53,6 +58,11 @@ public class MesWmBarcodeConfigServiceImpl implements MesWmBarcodeConfigService |
| 53 | 58 | public void deleteBarcodeConfig(Long id) { |
| 54 | 59 | // 校验存在 |
| 55 | 60 | validateBarcodeConfigExists(id); |
| 61 | + // 校验是否有关联的条码记录 | |
| 62 | + if (barcodeService.getBarcodeCountByConfigId(id) > 0) { | |
| 63 | + throw exception(WM_BARCODE_CONFIG_HAS_BARCODE); | |
| 64 | + } | |
| 65 | + | |
| 56 | 66 | // 删除 |
| 57 | 67 | barcodeConfigMapper.deleteById(id); |
| 58 | 68 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/barcode/MesWmBarcodeService.java
| ... | ... | @@ -79,4 +79,12 @@ public interface MesWmBarcodeService { |
| 79 | 79 | */ |
| 80 | 80 | String generateBarcodeContent(Integer bizType, String bizCode); |
| 81 | 81 | |
| 82 | + /** | |
| 83 | + * 根据条码配置编号获取相关联的条码数量 | |
| 84 | + * | |
| 85 | + * @param configId 条码配置编号 | |
| 86 | + * @return 条码数量 | |
| 87 | + */ | |
| 88 | + long getBarcodeCountByConfigId(Long configId); | |
| 89 | + | |
| 82 | 90 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/barcode/MesWmBarcodeServiceImpl.java
| ... | ... | @@ -170,4 +170,9 @@ public class MesWmBarcodeServiceImpl implements MesWmBarcodeService { |
| 170 | 170 | createBarcode(createReqVO); |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | + @Override | |
| 174 | + public long getBarcodeCountByConfigId(Long configId) { | |
| 175 | + return barcodeMapper.selectCountByConfigId(configId); | |
| 176 | + } | |
| 177 | + | |
| 173 | 178 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/packages/MesWmPackageService.java
| ... | ... | @@ -90,6 +90,13 @@ public interface MesWmPackageService { |
| 90 | 90 | List<MesWmPackageDO> getChildablePackageList(); |
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | + * 获得装箱单精简列表 | |
| 94 | + * | |
| 95 | + * @return 装箱单列表 | |
| 96 | + */ | |
| 97 | + List<MesWmPackageDO> getPackageSimpleList(); | |
| 98 | + | |
| 99 | + /** | |
| 93 | 100 | * 获取指定装箱单及其所有子孙箱的 ID 列表 |
| 94 | 101 | * |
| 95 | 102 | * @param packageId 装箱单 ID | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/packages/MesWmPackageServiceImpl.java
| ... | ... | @@ -143,6 +143,11 @@ public class MesWmPackageServiceImpl implements MesWmPackageService { |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | @Override |
| 146 | + public List<MesWmPackageDO> getPackageSimpleList() { | |
| 147 | + return packageMapper.selectList(); | |
| 148 | + } | |
| 149 | + | |
| 150 | + @Override | |
| 146 | 151 | public List<Long> getPackageAndDescendantIds(Long packageId) { |
| 147 | 152 | List<Long> result = CollUtil.newArrayList(packageId); |
| 148 | 153 | // 使用广度优先搜索 (BFS) 按层批量查询所有子孙箱 ID | ... | ... |