Commit 98e11135b22e61ea80b1f1bcd75c73a1553c45a9
1 parent
08e5dc71
✨ feat(service): 新增供应商 ID 统计功能
为多个服务新增根据供应商 ID 统计相关数量的方法,包括工单、来料检验单、外协发料单和外协入库单,提升数据查询能力。
Showing
13 changed files
with
89 additions
and
1 deletions
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/pro/workorder/MesProWorkOrderMapper.java
| ... | ... | @@ -41,4 +41,8 @@ public interface MesProWorkOrderMapper extends BaseMapperX<MesProWorkOrderDO> { |
| 41 | 41 | .setSql("quantity_produced = IFNULL(quantity_produced, 0) + " + incrQuantityProduced)); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | + default Long selectCountByVendorId(Long vendorId) { | |
| 45 | + return selectCount(MesProWorkOrderDO::getVendorId, vendorId); | |
| 46 | + } | |
| 47 | + | |
| 44 | 48 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/qc/iqc/MesQcIqcMapper.java
| ... | ... | @@ -32,4 +32,8 @@ public interface MesQcIqcMapper extends BaseMapperX<MesQcIqcDO> { |
| 32 | 32 | return selectOne(MesQcIqcDO::getCode, code); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | + default Long selectCountByVendorId(Long vendorId) { | |
| 36 | + return selectCount(MesQcIqcDO::getVendorId, vendorId); | |
| 37 | + } | |
| 38 | + | |
| 35 | 39 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/wm/outsourceissue/MesWmOutsourceIssueMapper.java
| ... | ... | @@ -29,4 +29,8 @@ public interface MesWmOutsourceIssueMapper extends BaseMapperX<MesWmOutsourceIss |
| 29 | 29 | return selectOne(MesWmOutsourceIssueDO::getCode, code); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | + default Long selectCountByVendorId(Long vendorId) { | |
| 33 | + return selectCount(MesWmOutsourceIssueDO::getVendorId, vendorId); | |
| 34 | + } | |
| 35 | + | |
| 32 | 36 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/wm/outsourcereceipt/MesWmOutsourceReceiptMapper.java
| ... | ... | @@ -28,4 +28,8 @@ public interface MesWmOutsourceReceiptMapper extends BaseMapperX<MesWmOutsourceR |
| 28 | 28 | return selectOne(MesWmOutsourceReceiptDO::getCode, code); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | + default Long selectCountByVendorId(Long vendorId) { | |
| 32 | + return selectCount(MesWmOutsourceReceiptDO::getVendorId, vendorId); | |
| 33 | + } | |
| 34 | + | |
| 31 | 35 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/md/vendor/MesMdVendorServiceImpl.java
| ... | ... | @@ -14,9 +14,13 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 14 | 14 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.vendor.MesMdVendorDO; |
| 15 | 15 | import cn.iocoder.yudao.module.mes.dal.mysql.md.vendor.MesMdVendorMapper; |
| 16 | 16 | import cn.iocoder.yudao.module.mes.enums.wm.BarcodeBizTypeEnum; |
| 17 | +import cn.iocoder.yudao.module.mes.service.pro.workorder.MesProWorkOrderService; | |
| 18 | +import cn.iocoder.yudao.module.mes.service.qc.iqc.MesQcIqcService; | |
| 17 | 19 | import cn.iocoder.yudao.module.mes.service.wm.arrivalnotice.MesWmArrivalNoticeService; |
| 18 | 20 | import cn.iocoder.yudao.module.mes.service.wm.barcode.MesWmBarcodeService; |
| 19 | 21 | import cn.iocoder.yudao.module.mes.service.wm.itemreceipt.MesWmItemReceiptService; |
| 22 | +import cn.iocoder.yudao.module.mes.service.wm.outsourceissue.MesWmOutsourceIssueService; | |
| 23 | +import cn.iocoder.yudao.module.mes.service.wm.outsourcereceipt.MesWmOutsourceReceiptService; | |
| 20 | 24 | import cn.iocoder.yudao.module.mes.service.wm.returnvendor.MesWmReturnVendorService; |
| 21 | 25 | import jakarta.annotation.Resource; |
| 22 | 26 | import org.springframework.context.annotation.Lazy; |
| ... | ... | @@ -57,6 +61,18 @@ public class MesMdVendorServiceImpl implements MesMdVendorService { |
| 57 | 61 | @Resource |
| 58 | 62 | @Lazy |
| 59 | 63 | private MesWmReturnVendorService returnVendorService; |
| 64 | + @Resource | |
| 65 | + @Lazy | |
| 66 | + private MesQcIqcService iqcService; | |
| 67 | + @Resource | |
| 68 | + @Lazy | |
| 69 | + private MesProWorkOrderService workOrderService; | |
| 70 | + @Resource | |
| 71 | + @Lazy | |
| 72 | + private MesWmOutsourceIssueService outsourceIssueService; | |
| 73 | + @Resource | |
| 74 | + @Lazy | |
| 75 | + private MesWmOutsourceReceiptService outsourceReceiptService; | |
| 60 | 76 | |
| 61 | 77 | @Override |
| 62 | 78 | public Long createVendor(MesMdVendorSaveReqVO createReqVO) { |
| ... | ... | @@ -158,7 +174,11 @@ public class MesMdVendorServiceImpl implements MesMdVendorService { |
| 158 | 174 | private void validateVendorNotReferenced(Long id) { |
| 159 | 175 | if (itemReceiptService.getItemReceiptCountByVendorId(id) > 0 |
| 160 | 176 | || arrivalNoticeService.getArrivalNoticeCountByVendorId(id) > 0 |
| 161 | - || returnVendorService.getReturnVendorCountByVendorId(id) > 0) { | |
| 177 | + || returnVendorService.getReturnVendorCountByVendorId(id) > 0 | |
| 178 | + || iqcService.getIqcCountByVendorId(id) > 0 | |
| 179 | + || workOrderService.getWorkOrderCountByVendorId(id) > 0 | |
| 180 | + || outsourceIssueService.getOutsourceIssueCountByVendorId(id) > 0 | |
| 181 | + || outsourceReceiptService.getOutsourceReceiptCountByVendorId(id) > 0) { | |
| 162 | 182 | throw exception(MD_VENDOR_HAS_REFERENCE); |
| 163 | 183 | } |
| 164 | 184 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pro/workorder/MesProWorkOrderService.java
| ... | ... | @@ -129,4 +129,12 @@ public interface MesProWorkOrderService { |
| 129 | 129 | */ |
| 130 | 130 | void updateProducedQuantity(Long id, BigDecimal incrQuantityProduced); |
| 131 | 131 | |
| 132 | + /** | |
| 133 | + * 根据供应商 ID 统计工单数量 | |
| 134 | + * | |
| 135 | + * @param vendorId 供应商 ID | |
| 136 | + * @return 数量 | |
| 137 | + */ | |
| 138 | + Long getWorkOrderCountByVendorId(Long vendorId); | |
| 139 | + | |
| 132 | 140 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pro/workorder/MesProWorkOrderServiceImpl.java
| ... | ... | @@ -245,4 +245,9 @@ public class MesProWorkOrderServiceImpl implements MesProWorkOrderService { |
| 245 | 245 | workOrderMapper.updateProducedQuantity(id, incrQuantityProduced); |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | + @Override | |
| 249 | + public Long getWorkOrderCountByVendorId(Long vendorId) { | |
| 250 | + return workOrderMapper.selectCountByVendorId(vendorId); | |
| 251 | + } | |
| 252 | + | |
| 248 | 253 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/qc/iqc/MesQcIqcService.java
| ... | ... | @@ -87,4 +87,12 @@ public interface MesQcIqcService { |
| 87 | 87 | */ |
| 88 | 88 | Map<Long, MesQcIqcDO> getIqcMap(Collection<Long> ids); |
| 89 | 89 | |
| 90 | + /** | |
| 91 | + * 根据供应商 ID 统计来料检验单数量 | |
| 92 | + * | |
| 93 | + * @param vendorId 供应商 ID | |
| 94 | + * @return 数量 | |
| 95 | + */ | |
| 96 | + Long getIqcCountByVendorId(Long vendorId); | |
| 97 | + | |
| 90 | 98 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/qc/iqc/MesQcIqcServiceImpl.java
| ... | ... | @@ -296,4 +296,9 @@ public class MesQcIqcServiceImpl implements MesQcIqcService { |
| 296 | 296 | return convertMap(list, MesQcIqcDO::getId); |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | + @Override | |
| 300 | + public Long getIqcCountByVendorId(Long vendorId) { | |
| 301 | + return iqcMapper.selectCountByVendorId(vendorId); | |
| 302 | + } | |
| 303 | + | |
| 299 | 304 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/outsourceissue/MesWmOutsourceIssueService.java
| ... | ... | @@ -87,4 +87,12 @@ public interface MesWmOutsourceIssueService { |
| 87 | 87 | */ |
| 88 | 88 | Boolean checkOutsourceIssueQuantity(Long id); |
| 89 | 89 | |
| 90 | + /** | |
| 91 | + * 根据供应商 ID 统计外协发料单数量 | |
| 92 | + * | |
| 93 | + * @param vendorId 供应商 ID | |
| 94 | + * @return 数量 | |
| 95 | + */ | |
| 96 | + Long getOutsourceIssueCountByVendorId(Long vendorId); | |
| 97 | + | |
| 90 | 98 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/outsourceissue/MesWmOutsourceIssueServiceImpl.java
| ... | ... | @@ -281,4 +281,9 @@ public class MesWmOutsourceIssueServiceImpl implements MesWmOutsourceIssueServic |
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | + @Override | |
| 285 | + public Long getOutsourceIssueCountByVendorId(Long vendorId) { | |
| 286 | + return outsourceIssueMapper.selectCountByVendorId(vendorId); | |
| 287 | + } | |
| 288 | + | |
| 284 | 289 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/outsourcereceipt/MesWmOutsourceReceiptService.java
| ... | ... | @@ -99,4 +99,12 @@ public interface MesWmOutsourceReceiptService { |
| 99 | 99 | */ |
| 100 | 100 | void validateOutsourceReceiptAndLineExists(Long receiptId, Long lineId); |
| 101 | 101 | |
| 102 | + /** | |
| 103 | + * 根据供应商 ID 统计外协入库单数量 | |
| 104 | + * | |
| 105 | + * @param vendorId 供应商 ID | |
| 106 | + * @return 数量 | |
| 107 | + */ | |
| 108 | + Long getOutsourceReceiptCountByVendorId(Long vendorId); | |
| 109 | + | |
| 102 | 110 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/outsourcereceipt/MesWmOutsourceReceiptServiceImpl.java
| ... | ... | @@ -326,4 +326,9 @@ public class MesWmOutsourceReceiptServiceImpl implements MesWmOutsourceReceiptSe |
| 326 | 326 | } |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | + @Override | |
| 330 | + public Long getOutsourceReceiptCountByVendorId(Long vendorId) { | |
| 331 | + return outsourceReceiptMapper.selectCountByVendorId(vendorId); | |
| 332 | + } | |
| 333 | + | |
| 329 | 334 | } | ... | ... |